fix #1098 and some related stuff
This commit is contained in:
parent
a015fec578
commit
3f645ef2bd
|
@ -175,11 +175,9 @@ Application::Application(const QString& id, int& argc, char** argv, const QStrin
|
|||
#if defined(USE_WEBENGINE)
|
||||
m_webFactory->urlIinterceptor()->load();
|
||||
|
||||
const QString web_data_root = userDataFolder() + QDir::separator() + QSL("web");
|
||||
|
||||
m_webFactory->engineProfile()->setCachePath(web_data_root + QDir::separator() + QSL("cache"));
|
||||
m_webFactory->engineProfile()->setCachePath(cacheFolder() + QDir::separator() + QSL("web") + QDir::separator() + QSL("cache"));
|
||||
m_webFactory->engineProfile()->setHttpCacheType(QWebEngineProfile::HttpCacheType::DiskHttpCache);
|
||||
m_webFactory->engineProfile()->setPersistentStoragePath(web_data_root + QDir::separator() + QSL("storage"));
|
||||
m_webFactory->engineProfile()->setPersistentStoragePath(userDataFolder() + QDir::separator() + QSL("web") + QDir::separator() + QSL("storage"));
|
||||
|
||||
m_webFactory->loadCustomCss(userDataFolder() + QDir::separator() + QSL("web") + QDir::separator() +
|
||||
QSL("user-styles.css"));
|
||||
|
@ -509,6 +507,14 @@ QString Application::userDataFolder() {
|
|||
}
|
||||
}
|
||||
|
||||
QString Application::cacheFolder() {
|
||||
#if defined(Q_OS_LINUX)
|
||||
return QStandardPaths::writableLocation(QStandardPaths::StandardLocation::CacheLocation);
|
||||
#else
|
||||
return userDataFolder();
|
||||
#endif
|
||||
}
|
||||
|
||||
QString Application::replaceDataUserDataFolderPlaceholder(QString text) const {
|
||||
auto user_data_folder = qApp->userDataFolder();
|
||||
|
||||
|
|
|
@ -147,6 +147,8 @@ class RSSGUARD_DLLSPEC Application : public SingleApplication {
|
|||
// NOTE: Use this to get correct path under which store user data.
|
||||
QString userDataFolder();
|
||||
|
||||
QString cacheFolder();
|
||||
|
||||
QString replaceDataUserDataFolderPlaceholder(QString text) const;
|
||||
QStringList replaceDataUserDataFolderPlaceholder(QStringList texts) const;
|
||||
|
||||
|
|
|
@ -64,6 +64,11 @@ int main(int argc, char* argv[]) {
|
|||
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
|
||||
#endif
|
||||
|
||||
// Set some names.
|
||||
QCoreApplication::setApplicationName(QSL(APP_NAME));
|
||||
QCoreApplication::setApplicationVersion(QSL(APP_VERSION));
|
||||
QCoreApplication::setOrganizationDomain(QSL(APP_URL));
|
||||
|
||||
// Instantiate base application object.
|
||||
Application application(QSL(APP_LOW_NAME), argc, argv, raw_cli_args);
|
||||
|
||||
|
@ -84,11 +89,8 @@ int main(int argc, char* argv[]) {
|
|||
qRegisterMetaType<QList<Label*>>("QList<Label*>");
|
||||
qRegisterMetaType<Label*>("Label*");
|
||||
|
||||
// These settings needs to be set before any QSettings object.
|
||||
Application::setApplicationName(QSL(APP_NAME));
|
||||
Application::setApplicationVersion(QSL(APP_VERSION));
|
||||
Application::setOrganizationDomain(QSL(APP_URL));
|
||||
Application::setWindowIcon(qApp->desktopAwareIcon());
|
||||
// Set window icon, particularly for Linux/Wayland.
|
||||
QGuiApplication::setWindowIcon(qApp->desktopAwareIcon());
|
||||
|
||||
qApp->reactOnForeignNotifications();
|
||||
|
||||
|
|
Loading…
Reference in New Issue