Skip to content

Commit b245b7a

Browse files
committed
GUI: Do not make settings names translatable.
Having translated settings names is a bad idea. If user changes GUI language one loses settings. Also settings might be exported/imported and translated names might not work between systems/users.
1 parent 339366a commit b245b7a

5 files changed

Lines changed: 39 additions & 38 deletions

File tree

gui/applicationlist.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ ApplicationList::~ApplicationList()
3232
void ApplicationList::LoadSettings(QSettings &programSettings)
3333
{
3434

35-
QStringList names = programSettings.value(tr("Application names"), QStringList()).toStringList();
36-
QStringList paths = programSettings.value(tr("Application paths"), QStringList()).toStringList();
35+
QStringList names = programSettings.value("Application names", QStringList()).toStringList();
36+
QStringList paths = programSettings.value("Application paths", QStringList()).toStringList();
3737
if (names.size() == paths.size())
3838
{
3939
for (int i = 0; i < names.size(); i++)
@@ -54,8 +54,8 @@ void ApplicationList::SaveSettings(QSettings &programSettings)
5454
paths << GetApplicationPath(i);
5555
}
5656

57-
programSettings.setValue(tr("Application names"), names);
58-
programSettings.setValue(tr("Application paths"), paths);
57+
programSettings.setValue("Application names", names);
58+
programSettings.setValue("Application paths", paths);
5959

6060
}
6161

gui/mainwindow.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include "../src/cppcheckexecutor.h"
3636

3737
MainWindow::MainWindow() :
38-
mSettings(tr("Cppcheck"), tr("Cppcheck-GUI")),
38+
mSettings("Cppcheck", "Cppcheck-GUI"),
3939
mActionExit(tr("E&xit"), this),
4040
mActionCheckFiles(tr("&Check files(s)"), this),
4141
mActionClearResults(tr("Clear &results"), this),
@@ -184,20 +184,20 @@ void MainWindow::CreateToolbar()
184184

185185
void MainWindow::LoadSettings()
186186
{
187-
if (mSettings.value(tr("Window maximized"), false).toBool())
187+
if (mSettings.value("Window maximized", false).toBool())
188188
{
189189
showMaximized();
190190
}
191191
else
192192
{
193-
resize(mSettings.value(tr("Window width"), 800).toInt(),
194-
mSettings.value(tr("Window height"), 600).toInt());
193+
resize(mSettings.value("Window width", 800).toInt(),
194+
mSettings.value("Window height", 600).toInt());
195195
}
196196

197-
mActionShowAll.setChecked(mSettings.value(tr("Show all"), true).toBool());
198-
mActionShowSecurity.setChecked(mSettings.value(tr("Show security"), true).toBool());
199-
mActionShowStyle.setChecked(mSettings.value(tr("Show style"), true).toBool());
200-
mActionShowErrors.setChecked(mSettings.value(tr("Show errors"), true).toBool());
197+
mActionShowAll.setChecked(mSettings.value("Show all", true).toBool());
198+
mActionShowSecurity.setChecked(mSettings.value("Show security", true).toBool());
199+
mActionShowStyle.setChecked(mSettings.value("Show style", true).toBool());
200+
mActionShowErrors.setChecked(mSettings.value("Show errors", true).toBool());
201201

202202
mResults.ShowResults(SHOW_ALL, mActionShowAll.isChecked());
203203
mResults.ShowResults(SHOW_ERRORS, mActionShowErrors.isChecked());
@@ -211,14 +211,14 @@ void MainWindow::LoadSettings()
211211

212212
void MainWindow::SaveSettings()
213213
{
214-
mSettings.setValue(tr("Window width"), size().width());
215-
mSettings.setValue(tr("Window height"), size().height());
216-
mSettings.setValue(tr("Window maximized"), isMaximized());
214+
mSettings.setValue("Window width", size().width());
215+
mSettings.setValue("Window height", size().height());
216+
mSettings.setValue("Window maximized", isMaximized());
217217

218-
mSettings.setValue(tr("Show all"), mActionShowAll.isChecked());
219-
mSettings.setValue(tr("Show security"), mActionShowSecurity.isChecked());
220-
mSettings.setValue(tr("Show style"), mActionShowStyle.isChecked());
221-
mSettings.setValue(tr("Show errors"), mActionShowErrors.isChecked());
218+
mSettings.setValue("Show all", mActionShowAll.isChecked());
219+
mSettings.setValue("Show security", mActionShowSecurity.isChecked());
220+
mSettings.setValue("Show style", mActionShowStyle.isChecked());
221+
mSettings.setValue("Show errors", mActionShowErrors.isChecked());
222222

223223
mSettings.setValue("Toolbars/ShowStandard", mActionViewStandardToolbar.isChecked());
224224

@@ -236,7 +236,7 @@ void MainWindow::DoCheckFiles(QFileDialog::FileMode mode)
236236
{
237237
selected = QFileDialog::getOpenFileNames(this,
238238
tr("Select files to check"),
239-
mSettings.value(tr("Check path"), "").toString());
239+
mSettings.value("Check path", "").toString());
240240
if (selected.isEmpty())
241241
mCurrentDirectory.clear();
242242
FormatAndSetTitle();
@@ -245,7 +245,7 @@ void MainWindow::DoCheckFiles(QFileDialog::FileMode mode)
245245
{
246246
QString dir = QFileDialog::getExistingDirectory(this,
247247
tr("Select directory to check"),
248-
mSettings.value(tr("Check path"), "").toString());
248+
mSettings.value("Check path", "").toString());
249249
if (!dir.isEmpty())
250250
{
251251
mCurrentDirectory = dir;
@@ -285,7 +285,7 @@ void MainWindow::DoCheckFiles(QFileDialog::FileMode mode)
285285
mThread->SetFiles(RemoveUnacceptedFiles(fileNames));
286286
QFileInfo inf(fileNames[0]);
287287
QString absDirectory = inf.absoluteDir().path();
288-
mSettings.setValue(tr("Check path"), absDirectory);
288+
mSettings.setValue("Check path", absDirectory);
289289
EnableCheckButtons(false);
290290
mActionSettings.setEnabled(false);
291291
mResults.SetCheckDirectory(absDirectory);
@@ -336,11 +336,11 @@ Settings MainWindow::GetCppcheckSettings()
336336
result._checkCodingStyle = true;
337337
result._errorsOnly = false;
338338
result._verbose = true;
339-
result._force = mSettings.value(tr("Check force"), 1).toBool();
339+
result._force = mSettings.value("Check force", 1).toBool();
340340
result._xml = false;
341341
result._unusedFunctions = false;
342342
result._security = true;
343-
result._jobs = mSettings.value(tr("Check threads"), 1).toInt();
343+
result._jobs = mSettings.value("Check threads", 1).toInt();
344344

345345
if (result._jobs <= 0)
346346
{

gui/resultstree.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,9 @@ void ResultsTree::LoadSettings()
211211
setColumnWidth(i, mSettings.value(temp, 800 / mModel.columnCount()).toInt());
212212
}
213213

214-
mSaveFullPath = mSettings.value(tr("Save full path"), false).toBool();
215-
mSaveAllErrors = mSettings.value(tr("Save all errors"), false).toBool();
216-
mShowFullPath = mSettings.value(tr("Show full path"), false).toBool();
214+
mSaveFullPath = mSettings.value("Save full path", false).toBool();
215+
mSaveAllErrors = mSettings.value("Save all errors", false).toBool();
216+
mShowFullPath = mSettings.value("Show full path", false).toBool();
217217
}
218218

219219
void ResultsTree::SaveSettings()

gui/settingsdialog.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,14 @@ QCheckBox* SettingsDialog::AddCheckbox(QVBoxLayout *layout,
188188

189189
void SettingsDialog::LoadSettings()
190190
{
191-
resize(mSettings.value(tr("Check dialog width"), 800).toInt(), mSettings.value(tr("Check dialog height"), 600).toInt());
191+
resize(mSettings.value("Check dialog width", 800).toInt(),
192+
mSettings.value("Check dialog height", 600).toInt());
192193
}
193194

194195
void SettingsDialog::SaveSettings()
195196
{
196-
mSettings.setValue(tr("Check dialog width"), size().width());
197-
mSettings.setValue(tr("Check dialog height"), size().height());
197+
mSettings.setValue("Check dialog width", size().width());
198+
mSettings.setValue("Check dialog height", size().height());
198199
}
199200

200201
void SettingsDialog::SaveCheckboxValues()
@@ -205,12 +206,12 @@ void SettingsDialog::SaveCheckboxValues()
205206
jobs = 1;
206207
}
207208

208-
mSettings.setValue(tr("Check threads"), jobs);
209-
SaveCheckboxValue(mForce, tr("Check force"));
210-
SaveCheckboxValue(mSaveAllErrors, tr("Save all errors"));
211-
SaveCheckboxValue(mSaveFullPath, tr("Save full path"));
212-
SaveCheckboxValue(mShowFullPath, tr("Show full path"));
213-
SaveCheckboxValue(mShowNoErrorsMessage, tr("Show no errors message"));
209+
mSettings.setValue("Check threads", jobs);
210+
SaveCheckboxValue(mForce, "Check force");
211+
SaveCheckboxValue(mSaveAllErrors, "Save all errors");
212+
SaveCheckboxValue(mSaveFullPath, "Save full path");
213+
SaveCheckboxValue(mShowFullPath, "Show full path");
214+
SaveCheckboxValue(mShowNoErrorsMessage, "Show no errors message");
214215
}
215216

216217
void SettingsDialog::SaveCheckboxValue(QCheckBox *box, const QString &name)

gui/threadhandler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,11 @@ void ThreadHandler::Initialize(ResultsView *view)
158158

159159
void ThreadHandler::LoadSettings(QSettings &settings)
160160
{
161-
SetThreadCount(settings.value(tr("Check threads"), 1).toInt());
161+
SetThreadCount(settings.value("Check threads", 1).toInt());
162162
}
163163

164164
void ThreadHandler::SaveSettings(QSettings &settings)
165165
{
166-
settings.setValue(tr("Check threads"), mThreads.size());
166+
settings.setValue("Check threads", mThreads.size());
167167
}
168168

0 commit comments

Comments
 (0)