Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/kmymoney.cpp
Context not available. | |||||
1160 | layout->setSpacing(6); | 1160 | layout->setSpacing(6); | ||
---|---|---|---|---|---|
1161 | 1161 | | |||
1162 | { | 1162 | { | ||
1163 | #ifndef IS_APPIMAGE | ||||
1163 | // find where our custom icons were installed based on an custom icon that we know should exist after installation | 1164 | // find where our custom icons were installed based on an custom icon that we know should exist after installation | ||
1164 | const auto customIconRelativePath = QString(QStringLiteral("icons/hicolor/16x16/actions/account-add.png")); | 1165 | const auto customIconRelativePath = QString(QStringLiteral("icons/hicolor/16x16/actions/account-add.png")); | ||
1165 | auto customIconAbsolutePath = QStandardPaths::locate(QStandardPaths::AppDataLocation, customIconRelativePath); | 1166 | auto customIconAbsolutePath = QStandardPaths::locate(QStandardPaths::AppDataLocation, customIconRelativePath); | ||
1167 | if (customIconAbsolutePath.isEmpty()) { | ||||
1168 | qWarning("Custom icons were not found in any of the following QStandardPaths::AppDataLocation:"); | ||||
1169 | for (const auto &standardPath : QStandardPaths::standardLocations(QStandardPaths::AppDataLocation)) | ||||
1170 | qWarning() << standardPath; | ||||
1171 | } | ||||
1172 | #else | ||||
1173 | // according to https://docs.appimage.org/packaging-guide/ingredients.html#open-source-applications | ||||
1174 | // QStandardPaths::AppDataLocation is unreliable on AppImages, so apply workaround here in case we fail to find icons | ||||
1175 | const auto appImageAppDataLocation = QCoreApplication::applicationDirPath() + QLatin1String("/../share/kmymoney/") + customIconRelativePath; | ||||
1176 | if (QFile::exists(appImageAppDataLocation )) { | ||||
1177 | customIconAbsolutePath = appImageAppDataLocation ; | ||||
1178 | } else { | ||||
1179 | qWarning("Custom icons were not found in the following location:"); | ||||
1180 | qWarning() << appImageAppDataLocation ; | ||||
1181 | } | ||||
1182 | #endif | ||||
1166 | 1183 | | |||
1167 | // add our custom icons path to icons search path | 1184 | // add our custom icons path to icons search path | ||
1168 | if (!customIconAbsolutePath.isEmpty()) { | 1185 | if (!customIconAbsolutePath.isEmpty()) { | ||
Context not available. | |||||
1171 | auto paths = QIcon::themeSearchPaths(); | 1188 | auto paths = QIcon::themeSearchPaths(); | ||
1172 | paths.append(customIconAbsolutePath); | 1189 | paths.append(customIconAbsolutePath); | ||
1173 | QIcon::setThemeSearchPaths(paths); | 1190 | QIcon::setThemeSearchPaths(paths); | ||
1174 | } else { | | |||
1175 | qWarning("Custom icons were not found in any of the following QStandardPaths::AppDataLocation:"); | | |||
1176 | for (const auto &standardPath : QStandardPaths::standardLocations(QStandardPaths::AppDataLocation)) | | |||
1177 | qWarning() << standardPath; | | |||
1178 | } | 1191 | } | ||
1179 | 1192 | | |||
1180 | #if defined(Q_OS_WIN) || defined(Q_OS_MACOS) | 1193 | #if defined(Q_OS_WIN) || defined(Q_OS_MACOS) | ||
Context not available. | |||||
2921 | void KMyMoneyApp::Private::setThemedCSS() | 2934 | void KMyMoneyApp::Private::setThemedCSS() | ||
2922 | { | 2935 | { | ||
2923 | const QStringList CSSnames {QStringLiteral("kmymoney.css"), QStringLiteral("welcome.css")}; | 2936 | const QStringList CSSnames {QStringLiteral("kmymoney.css"), QStringLiteral("welcome.css")}; | ||
2924 | | ||||
2925 | const QString rcDir("/html/"); | 2937 | const QString rcDir("/html/"); | ||
2926 | const QStringList defaultCSSDirs = QStandardPaths::locateAll(QStandardPaths::AppDataLocation, rcDir, QStandardPaths::LocateDirectory); | 2938 | QStringList defaultCSSDirs; | ||
2939 | #ifndef IS_APPIMAGE | ||||
2940 | defaultCSSDirs = QStandardPaths::locateAll(QStandardPaths::AppDataLocation, rcDir, QStandardPaths::LocateDirectory); | ||||
2941 | #else | ||||
2942 | // according to https://docs.appimage.org/packaging-guide/ingredients.html#open-source-applications | ||||
2943 | // QStandardPaths::AppDataLocation is unreliable on AppImages, so apply workaround here in case we fail to find icons | ||||
2944 | const auto appImageAppDataLocation = QCoreApplication::applicationDirPath() + QLatin1String("/../share/kmymoney") + rcDir; | ||||
2945 | if (QFile::exists(appImageAppDataLocation + CSSnames.first())) { | ||||
2946 | defaultCSSDirs.append(appImageAppDataLocation); | ||||
2947 | } else { | ||||
2948 | qWarning("CSS file was not found in the following location:"); | ||||
2949 | qWarning() << appImageAppDataLocation; | ||||
2950 | } | ||||
2951 | #endif | ||||
2927 | 2952 | | |||
2928 | // scan the list of directories to find the ones that really | 2953 | // scan the list of directories to find the ones that really | ||
2929 | // contains all files we look for | 2954 | // contains all files we look for | ||
Context not available. |