Problem was that QSetting were initialized before application/organization name is set
This commit is contained in:
a1ext 2018-11-02 19:49:15 +03:00 committed by Itay Cohen
parent 84b70215ce
commit 313e8b17cd

View File

@ -24,6 +24,14 @@
CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc, argv) CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc, argv)
{ {
// Setup application information
setOrganizationName("Cutter");
setApplicationName("Cutter");
setApplicationVersion(CUTTER_VERSION_FULL);
setWindowIcon(QIcon(":/img/cutter.svg"));
setAttribute(Qt::AA_DontShowIconsInMenus);
// WARN!!! Put initialization code below this line. Code above this line is mandatory to be run First
// Load translations // Load translations
QTranslator *t = new QTranslator; QTranslator *t = new QTranslator;
QTranslator *qtBaseTranslator = new QTranslator; QTranslator *qtBaseTranslator = new QTranslator;
@ -37,10 +45,12 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc
for (auto &it : allLocales) { for (auto &it : allLocales) {
langPrefix = it.bcp47Name(); langPrefix = it.bcp47Name();
if (langPrefix == language) { if (langPrefix == language) {
t->load(QString(QCoreApplication::applicationDirPath() + QDir::separator() + const QString &cutterTranslationPath = QCoreApplication::applicationDirPath() + QDir::separator()
"translations" + QDir::separator() + + "translations" + QDir::separator() + QString("cutter_%1.qm").arg(langPrefix);
"cutter_%1.qm").arg(langPrefix));
installTranslator(t); if (t->load(cutterTranslationPath)) {
installTranslator(t);
}
QApplication::setLayoutDirection(it.textDirection()); QApplication::setLayoutDirection(it.textDirection());
QLocale::setDefault(it); QLocale::setDefault(it);
@ -62,13 +72,6 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc
} }
} }
// Setup application information
setOrganizationName("Cutter");
setApplicationName("Cutter");
setApplicationVersion(CUTTER_VERSION_FULL);
setWindowIcon(QIcon(":/img/cutter.svg"));
setAttribute(Qt::AA_DontShowIconsInMenus);
// Load fonts // Load fonts
int ret = QFontDatabase::addApplicationFont(":/fonts/Anonymous Pro.ttf"); int ret = QFontDatabase::addApplicationFont(":/fonts/Anonymous Pro.ttf");
if (ret == -1) { if (ret == -1) {