Allow localization to be enabled/disabled by configuration settings.

This is only the logic to check the settings, no GUI.
Changing the setting requires a restart as disabling localization simply
skips the call to bindtextdomain() at the application start.
This commit is contained in:
Torsten Paul 2014-10-18 19:28:08 +02:00
parent ae2d19241e
commit d620c8f40b
2 changed files with 6 additions and 2 deletions

View file

@ -104,6 +104,7 @@ Preferences::Preferences(QWidget *parent) : QMainWindow(parent)
this->defaultmap["advanced/mdi"] = true;
this->defaultmap["advanced/undockableWindows"] = false;
this->defaultmap["launcher/showOnStartup"] = true;
this->defaultmap["advanced/localization"] = false;
// Toolbar
QActionGroup *group = new QActionGroup(this);

View file

@ -505,6 +505,7 @@ Q_IMPORT_PLUGIN(qtaccessiblewidgets)
#endif // MINGW64/MINGW32/MSCVER
#include "MainWindow.h"
#include "launchingscreen.h"
#include "qsettings.h"
#ifdef __APPLE__
#include "EventFilter.h"
#endif
@ -570,7 +571,10 @@ int gui(vector<string> &inputFiles, const fs::path &original_path, int argc, cha
PlatformUtils::registerApplicationPath(app_path.toLocal8Bit().constData());
parser_init(PlatformUtils::applicationPath());
localization_init();
QSettings settings;
if (settings.value("advanced/localization", false).toBool()) {
localization_init();
}
#ifdef Q_OS_MAC
installAppleEventHandlers();
@ -595,7 +599,6 @@ int gui(vector<string> &inputFiles, const fs::path &original_path, int argc, cha
inputFiles.push_back("");
}
QSettings settings;
QVariant showOnStartup = settings.value("launcher/showOnStartup");
if (noInputFiles && (showOnStartup.isNull() || showOnStartup.toBool())) {
LaunchingScreen *launcher = new LaunchingScreen();