added developer setting: don't load fallback language

Dieser Commit ist enthalten in:
Reinder Feenstra 2021-07-14 00:51:36 +02:00
Ursprung a0c9bb32d2
Commit 7015edfc44
5 geänderte Dateien mit 122 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -31,6 +31,7 @@
#include "utils/getlocalepath.hpp"
//#include "network/client.hpp"
#include "settings/generalsettings.hpp"
#include "settings/developersettings.hpp"
#include "style/materialdarkstyle.hpp"
#include "style/materiallightstyle.hpp"
#include "theme/theme.hpp"
@ -85,7 +86,7 @@ int main(int argc, char* argv[])
const QString language = GeneralSettings::instance().language;
Locale* fallback = nullptr;
if(language != languageDefault)
if(language != languageDefault && DeveloperSettings::instance().dontLoadFallbackLanguage)
fallback = new Locale(getLocalePath().toStdString() + "/" + languageDefault.toStdString() + ".txt");
Locale::instance = new Locale(getLocalePath().toStdString() + "/" + language.toStdString() + ".txt", fallback);

Datei anzeigen

@ -0,0 +1,48 @@
/**
* client/src/settings/developersettings.hpp
*
* This file is part of the traintastic source code.
*
* Copyright (C) 2021 Reinder Feenstra
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef TRAINTASTIC_CLIENT_SETTINGS_DEVELOPERSETTINGS_HPP
#define TRAINTASTIC_CLIENT_SETTINGS_DEVELOPERSETTINGS_HPP
#include "settingsbase.hpp"
#include "setting.hpp"
class DeveloperSettings : public SettingsBase
{
private:
DeveloperSettings()
: SettingsBase("developer")
, dontLoadFallbackLanguage{*this, "dont_load_fallback_language", false}
{
}
public:
static DeveloperSettings& instance()
{
static DeveloperSettings settings;
return settings;
}
Setting<bool> dontLoadFallbackLanguage;
};
#endif

Datei anzeigen

@ -0,0 +1,34 @@
/**
* client/src/settings/developersettingswidget.cpp
*
* This file is part of the traintastic source code.
*
* Copyright (C) 2021 Reinder Feenstra
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "developersettingswidget.hpp"
#include "developersettings.hpp"
DeveloperSettingsWidget::DeveloperSettingsWidget(QWidget* parent)
: SettingsBaseWidget("qtapp.settings.developer", parent)
{
DeveloperSettings& s = DeveloperSettings::instance();
addSetting(s.dontLoadFallbackLanguage);
done();
}

Datei anzeigen

@ -0,0 +1,36 @@
/**
* client/src/settings/developersettingswidget.hpp
*
* This file is part of the traintastic source code.
*
* Copyright (C) 2021 Reinder Feenstra
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef TRAINTASTIC_CLIENT_SETTINGS_DEVELOPERSETTINGSWIDGET_HPP
#define TRAINTASTIC_CLIENT_SETTINGS_DEVELOPERSETTINGSWIDGET_HPP
#include "settingsbasewidget.hpp"
class DeveloperSettingsWidget : public SettingsBaseWidget
{
public:
DeveloperSettingsWidget(QWidget* parent = nullptr);
QString title() const final { return QStringLiteral("qtapp.settings:developer"); }
};
#endif

Datei anzeigen

@ -28,6 +28,7 @@
#include <traintastic/locale/locale.hpp>
#include "generalsettingswidget.hpp"
#include "boardsettingswidget.hpp"
#include "developersettingswidget.hpp"
SettingsDialog::SettingsDialog(QWidget* parent) :
QDialog(parent, Qt::Dialog | Qt::WindowTitleHint | Qt::WindowCloseButtonHint),
@ -38,6 +39,7 @@ SettingsDialog::SettingsDialog(QWidget* parent) :
add(new GeneralSettingsWidget(this));
add(new BoardSettingsWidget(this));
add(new DeveloperSettingsWidget(this));
QHBoxLayout* l = new QHBoxLayout();
m_menu->addStretch();