Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/kmymoney.cpp
Show First 20 Lines • Show All 1157 Lines • ▼ Show 20 Line(s) | 1148 | #endif | |||
---|---|---|---|---|---|
1158 | QFrame* frame = new QFrame; | 1158 | QFrame* frame = new QFrame; | ||
1159 | frame->setFrameStyle(QFrame::NoFrame); | 1159 | frame->setFrameStyle(QFrame::NoFrame); | ||
1160 | // values for margin (11) and spacing(6) taken from KDialog implementation | 1160 | // values for margin (11) and spacing(6) taken from KDialog implementation | ||
1161 | QBoxLayout* layout = new QBoxLayout(QBoxLayout::TopToBottom, frame); | 1161 | QBoxLayout* layout = new QBoxLayout(QBoxLayout::TopToBottom, frame); | ||
1162 | layout->setContentsMargins(2, 2, 2, 2); | 1162 | layout->setContentsMargins(2, 2, 2, 2); | ||
1163 | layout->setSpacing(6); | 1163 | layout->setSpacing(6); | ||
1164 | 1164 | | |||
1165 | { | 1165 | { | ||
1166 | // find where our custom icons were installed based on an custom icon that we know should exist after installation | ||||
1167 | const auto customIconRelativePath = QString(QStringLiteral("icons/hicolor/16x16/actions/account-add.png")); | ||||
1168 | auto customIconAbsolutePath = QStandardPaths::locate(QStandardPaths::AppDataLocation, customIconRelativePath); | ||||
1169 | | ||||
1170 | // add our custom icons path to icons search path | ||||
1171 | if (!customIconAbsolutePath.isEmpty()) { | ||||
1172 | customIconAbsolutePath.chop(customIconRelativePath.length()); | ||||
1173 | customIconAbsolutePath.append(QLatin1String("icons")); | ||||
1174 | auto paths = QIcon::themeSearchPaths(); | ||||
1175 | paths.append(customIconAbsolutePath); | ||||
1176 | QIcon::setThemeSearchPaths(paths); | ||||
1177 | } else { | ||||
1178 | qWarning("Custom icons were not found in any of the following QStandardPaths::AppDataLocation:"); | ||||
tbaumgart: Can we have a warning on the console that our assumption is not correct? I think that would… | |||||
1179 | for (const auto &standardPath : QStandardPaths::standardLocations(QStandardPaths::AppDataLocation)) | ||||
1180 | qWarning() << standardPath; | ||||
1181 | } | ||||
1182 | | ||||
1166 | #if defined(Q_OS_WIN) || defined(Q_OS_MACOS) | 1183 | #if defined(Q_OS_WIN) || defined(Q_OS_MACOS) | ||
1167 | QString themeName = QLatin1Literal("system"); // using QIcon::setThemeName on Craft build system causes icons to disappear | 1184 | QString themeName = QLatin1Literal("system"); // using QIcon::setThemeName on Craft build system causes icons to disappear | ||
1168 | #else | 1185 | #else | ||
1169 | QString themeName = KMyMoneySettings::iconsTheme(); // get theme user wants | 1186 | QString themeName = KMyMoneySettings::iconsTheme(); // get theme user wants | ||
1170 | #endif | 1187 | #endif | ||
1171 | if (!themeName.isEmpty() && themeName != QLatin1Literal("system")) // if it isn't default theme then set it | 1188 | if (!themeName.isEmpty() && themeName != QLatin1Literal("system")) // if it isn't default theme then set it | ||
1172 | QIcon::setThemeName(themeName); | 1189 | QIcon::setThemeName(themeName); | ||
1173 | Icons::setIconThemeNames(QIcon::themeName()); // get whatever theme user ends up with and hope our icon names will fit that theme | 1190 | Icons::setIconThemeNames(QIcon::themeName()); // get whatever theme user ends up with and hope our icon names will fit that theme | ||
▲ Show 20 Lines • Show All 2512 Lines • Show Last 20 Lines |
Can we have a warning on the console that our assumption is not correct? I think that would help. Maybe print out the contents of QIcon::themeSearchPaths() or so.