Minor changes

This commit is contained in:
Blue 2025-05-05 18:20:08 +03:00
parent 066ab487fc
commit c147e02187
Signed by: blue
GPG key ID: 9B203B252A63EE38
6 changed files with 19 additions and 14 deletions

View file

@ -64,9 +64,14 @@ Root::~Root() {
delete global;
}
void Root::initializeTranslation() {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool defaultLoaded = defaultTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::path(QLibraryInfo::TranslationsPath));
if (!defaultLoaded)
qDebug() << "Couldn't load default translation";
#else
defaultTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
#endif
installTranslator(&defaultTranslator);
QStringList shares = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation);
@ -78,15 +83,17 @@ void Root::initializeTranslation() {
}
if (!found)
currentTranslator.load(QLocale(), QLatin1String("squawk"), ".", QCoreApplication::applicationDirPath());
found = currentTranslator.load(QLocale(), QLatin1String("squawk"), ".", QCoreApplication::applicationDirPath());
installTranslator(&currentTranslator);
if (found)
installTranslator(&currentTranslator);
else
qDebug() << "Couldn't load current translation";
}
void Root::initializeAppIcon() {
for (std::vector<unsigned int>::size_type i = 0; i < appIconSizes.size(); ++i)
appIcon.addFile(":images/logo.svg", QSize(appIconSizes[i], appIconSizes[i]));
for (unsigned int appIconSize : appIconSizes)
appIcon.addFile(":images/logo.svg", QSize(appIconSize, appIconSize));
Root::setWindowIcon(appIcon);
}