added developer setting: don't load fallback language
Dieser Commit ist enthalten in:
Ursprung
a0c9bb32d2
Commit
7015edfc44
@ -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);
|
||||
|
||||
48
client/src/settings/developersettings.hpp
Normale Datei
48
client/src/settings/developersettings.hpp
Normale Datei
@ -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
|
||||
34
client/src/settings/developersettingswidget.cpp
Normale Datei
34
client/src/settings/developersettingswidget.cpp
Normale Datei
@ -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();
|
||||
}
|
||||
36
client/src/settings/developersettingswidget.hpp
Normale Datei
36
client/src/settings/developersettingswidget.hpp
Normale Datei
@ -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
|
||||
@ -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();
|
||||
|
||||
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren