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.
This commit is contained in:
Kimmo Varis 2009-07-02 02:02:34 +03:00
parent 339366a79a
commit b245b7a832
5 changed files with 39 additions and 38 deletions

View File

@ -32,8 +32,8 @@ ApplicationList::~ApplicationList()
void ApplicationList::LoadSettings(QSettings &programSettings)
{
QStringList names = programSettings.value(tr("Application names"), QStringList()).toStringList();
QStringList paths = programSettings.value(tr("Application paths"), QStringList()).toStringList();
QStringList names = programSettings.value("Application names", QStringList()).toStringList();
QStringList paths = programSettings.value("Application paths", QStringList()).toStringList();
if (names.size() == paths.size())
{
for (int i = 0; i < names.size(); i++)
@ -54,8 +54,8 @@ void ApplicationList::SaveSettings(QSettings &programSettings)
paths << GetApplicationPath(i);
}
programSettings.setValue(tr("Application names"), names);
programSettings.setValue(tr("Application paths"), paths);
programSettings.setValue("Application names", names);
programSettings.setValue("Application paths", paths);
}

View File

@ -35,7 +35,7 @@
#include "../src/cppcheckexecutor.h"
MainWindow::MainWindow() :
mSettings(tr("Cppcheck"), tr("Cppcheck-GUI")),
mSettings("Cppcheck", "Cppcheck-GUI"),
mActionExit(tr("E&xit"), this),
mActionCheckFiles(tr("&Check files(s)"), this),
mActionClearResults(tr("Clear &results"), this),
@ -184,20 +184,20 @@ void MainWindow::CreateToolbar()
void MainWindow::LoadSettings()
{
if (mSettings.value(tr("Window maximized"), false).toBool())
if (mSettings.value("Window maximized", false).toBool())
{
showMaximized();
}
else
{
resize(mSettings.value(tr("Window width"), 800).toInt(),
mSettings.value(tr("Window height"), 600).toInt());
resize(mSettings.value("Window width", 800).toInt(),
mSettings.value("Window height", 600).toInt());
}
mActionShowAll.setChecked(mSettings.value(tr("Show all"), true).toBool());
mActionShowSecurity.setChecked(mSettings.value(tr("Show security"), true).toBool());
mActionShowStyle.setChecked(mSettings.value(tr("Show style"), true).toBool());
mActionShowErrors.setChecked(mSettings.value(tr("Show errors"), true).toBool());
mActionShowAll.setChecked(mSettings.value("Show all", true).toBool());
mActionShowSecurity.setChecked(mSettings.value("Show security", true).toBool());
mActionShowStyle.setChecked(mSettings.value("Show style", true).toBool());
mActionShowErrors.setChecked(mSettings.value("Show errors", true).toBool());
mResults.ShowResults(SHOW_ALL, mActionShowAll.isChecked());
mResults.ShowResults(SHOW_ERRORS, mActionShowErrors.isChecked());
@ -211,14 +211,14 @@ void MainWindow::LoadSettings()
void MainWindow::SaveSettings()
{
mSettings.setValue(tr("Window width"), size().width());
mSettings.setValue(tr("Window height"), size().height());
mSettings.setValue(tr("Window maximized"), isMaximized());
mSettings.setValue("Window width", size().width());
mSettings.setValue("Window height", size().height());
mSettings.setValue("Window maximized", isMaximized());
mSettings.setValue(tr("Show all"), mActionShowAll.isChecked());
mSettings.setValue(tr("Show security"), mActionShowSecurity.isChecked());
mSettings.setValue(tr("Show style"), mActionShowStyle.isChecked());
mSettings.setValue(tr("Show errors"), mActionShowErrors.isChecked());
mSettings.setValue("Show all", mActionShowAll.isChecked());
mSettings.setValue("Show security", mActionShowSecurity.isChecked());
mSettings.setValue("Show style", mActionShowStyle.isChecked());
mSettings.setValue("Show errors", mActionShowErrors.isChecked());
mSettings.setValue("Toolbars/ShowStandard", mActionViewStandardToolbar.isChecked());
@ -236,7 +236,7 @@ void MainWindow::DoCheckFiles(QFileDialog::FileMode mode)
{
selected = QFileDialog::getOpenFileNames(this,
tr("Select files to check"),
mSettings.value(tr("Check path"), "").toString());
mSettings.value("Check path", "").toString());
if (selected.isEmpty())
mCurrentDirectory.clear();
FormatAndSetTitle();
@ -245,7 +245,7 @@ void MainWindow::DoCheckFiles(QFileDialog::FileMode mode)
{
QString dir = QFileDialog::getExistingDirectory(this,
tr("Select directory to check"),
mSettings.value(tr("Check path"), "").toString());
mSettings.value("Check path", "").toString());
if (!dir.isEmpty())
{
mCurrentDirectory = dir;
@ -285,7 +285,7 @@ void MainWindow::DoCheckFiles(QFileDialog::FileMode mode)
mThread->SetFiles(RemoveUnacceptedFiles(fileNames));
QFileInfo inf(fileNames[0]);
QString absDirectory = inf.absoluteDir().path();
mSettings.setValue(tr("Check path"), absDirectory);
mSettings.setValue("Check path", absDirectory);
EnableCheckButtons(false);
mActionSettings.setEnabled(false);
mResults.SetCheckDirectory(absDirectory);
@ -336,11 +336,11 @@ Settings MainWindow::GetCppcheckSettings()
result._checkCodingStyle = true;
result._errorsOnly = false;
result._verbose = true;
result._force = mSettings.value(tr("Check force"), 1).toBool();
result._force = mSettings.value("Check force", 1).toBool();
result._xml = false;
result._unusedFunctions = false;
result._security = true;
result._jobs = mSettings.value(tr("Check threads"), 1).toInt();
result._jobs = mSettings.value("Check threads", 1).toInt();
if (result._jobs <= 0)
{

View File

@ -211,9 +211,9 @@ void ResultsTree::LoadSettings()
setColumnWidth(i, mSettings.value(temp, 800 / mModel.columnCount()).toInt());
}
mSaveFullPath = mSettings.value(tr("Save full path"), false).toBool();
mSaveAllErrors = mSettings.value(tr("Save all errors"), false).toBool();
mShowFullPath = mSettings.value(tr("Show full path"), false).toBool();
mSaveFullPath = mSettings.value("Save full path", false).toBool();
mSaveAllErrors = mSettings.value("Save all errors", false).toBool();
mShowFullPath = mSettings.value("Show full path", false).toBool();
}
void ResultsTree::SaveSettings()

View File

@ -188,13 +188,14 @@ QCheckBox* SettingsDialog::AddCheckbox(QVBoxLayout *layout,
void SettingsDialog::LoadSettings()
{
resize(mSettings.value(tr("Check dialog width"), 800).toInt(), mSettings.value(tr("Check dialog height"), 600).toInt());
resize(mSettings.value("Check dialog width", 800).toInt(),
mSettings.value("Check dialog height", 600).toInt());
}
void SettingsDialog::SaveSettings()
{
mSettings.setValue(tr("Check dialog width"), size().width());
mSettings.setValue(tr("Check dialog height"), size().height());
mSettings.setValue("Check dialog width", size().width());
mSettings.setValue("Check dialog height", size().height());
}
void SettingsDialog::SaveCheckboxValues()
@ -205,12 +206,12 @@ void SettingsDialog::SaveCheckboxValues()
jobs = 1;
}
mSettings.setValue(tr("Check threads"), jobs);
SaveCheckboxValue(mForce, tr("Check force"));
SaveCheckboxValue(mSaveAllErrors, tr("Save all errors"));
SaveCheckboxValue(mSaveFullPath, tr("Save full path"));
SaveCheckboxValue(mShowFullPath, tr("Show full path"));
SaveCheckboxValue(mShowNoErrorsMessage, tr("Show no errors message"));
mSettings.setValue("Check threads", jobs);
SaveCheckboxValue(mForce, "Check force");
SaveCheckboxValue(mSaveAllErrors, "Save all errors");
SaveCheckboxValue(mSaveFullPath, "Save full path");
SaveCheckboxValue(mShowFullPath, "Show full path");
SaveCheckboxValue(mShowNoErrorsMessage, "Show no errors message");
}
void SettingsDialog::SaveCheckboxValue(QCheckBox *box, const QString &name)

View File

@ -158,11 +158,11 @@ void ThreadHandler::Initialize(ResultsView *view)
void ThreadHandler::LoadSettings(QSettings &settings)
{
SetThreadCount(settings.value(tr("Check threads"), 1).toInt());
SetThreadCount(settings.value("Check threads", 1).toInt());
}
void ThreadHandler::SaveSettings(QSettings &settings)
{
settings.setValue(tr("Check threads"), mThreads.size());
settings.setValue("Check threads", mThreads.size());
}