Skip to content

Commit d9fd0e1

Browse files
author
SeongTae Jeong
committed
Change to 'Preference' expression for consistent
Change to 'Preferences' expression instead of 'Configuration' expression for consistent. See the issue #2393
1 parent 0644bc0 commit d9fd0e1

3 files changed

Lines changed: 31 additions & 31 deletions

File tree

src/Application.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,25 @@
1818
Application::Application(int& argc, char** argv) :
1919
QApplication(argc, argv)
2020
{
21-
// Get 'DB4S_CONFIG_FILE' environment variable
22-
const char* env = getenv("DB4S_CONFIG_FILE");
21+
// Get 'DB4S_PREFERENCES_FILE' environment variable
22+
const char* env = getenv("DB4S_PREFERENCES_FILE");
2323

24-
// If 'DB4S_CONFIG_FILE' environment variable exists
24+
// If 'DB4S_PREFERENCES_FILE' environment variable exists
2525
if(env)
26-
Settings::setUserConfigurationFile(QString::fromStdString(env));
26+
Settings::setUserPreferencesFile(QString::fromStdString(env));
2727

2828
for(int i=1;i<arguments().size();i++)
2929
{
30-
if(arguments().at(i) == "-c" || arguments().at(i) == "--config")
30+
if(arguments().at(i) == "-p" || arguments().at(i) == "--preferences")
3131
{
3232
if(++i < arguments().size())
3333
{
3434
if(env)
3535
{
36-
qWarning() << qPrintable(tr("The user configuration file location is replaced with the argument value instead of the environment variable value."));
37-
qWarning() << qPrintable(tr("Ignored environment variable(DB4S_CONFIG_FILE) value : ") + QString::fromStdString(env));
36+
qWarning() << qPrintable(tr("The user preferences file location is replaced with the argument value instead of the environment variable value."));
37+
qWarning() << qPrintable(tr("Ignored environment variable(DB4S_PREFERENCES_FILE) value : ") + QString::fromStdString(env));
3838
}
39-
Settings::setUserConfigurationFile(arguments().at(i));
39+
Settings::setUserPreferencesFile(arguments().at(i));
4040
}
4141
}
4242
}
@@ -121,8 +121,8 @@ Application::Application(int& argc, char** argv) :
121121
qWarning() << qPrintable(tr(" -s, --sql <file> Execute this SQL file after opening the DB"));
122122
qWarning() << qPrintable(tr(" -t, --table <table> Browse this table after opening the DB"));
123123
qWarning() << qPrintable(tr(" -R, --read-only Open database in read-only mode"));
124-
qWarning() << qPrintable(tr(" -c, --config <config_file>"));
125-
qWarning() << qPrintable(tr(" Run application based on this configuration file"));
124+
qWarning() << qPrintable(tr(" -p, --preferences <preferences_file>"));
125+
qWarning() << qPrintable(tr(" Run application based on this preferences file"));
126126
qWarning() << qPrintable(tr(" -o, --option <group>/<setting>=<value>"));
127127
qWarning() << qPrintable(tr(" Run application with this setting temporarily set to value"));
128128
qWarning() << qPrintable(tr(" -O, --save-option <group>/<setting>=<value>"));
@@ -151,11 +151,11 @@ Application::Application(int& argc, char** argv) :
151151
m_dontShowMainWindow = true;
152152
} else if(arguments().at(i) == "-R" || arguments().at(i) == "--read-only") {
153153
readOnly = true;
154-
} else if(arguments().at(i) == "-c" || arguments().at(i) == "--config") {
154+
} else if(arguments().at(i) == "-p" || arguments().at(i) == "--preferences") {
155155
// This option has already been handled above
156156
// For here, only print the error when no parameter value is given
157157
if(++i >= arguments().size())
158-
qWarning() << qPrintable(tr("The -c/--config option requires an argument. The option is ignored."));
158+
qWarning() << qPrintable(tr("The -p/--preferences option requires an argument. The option is ignored."));
159159
} else if(arguments().at(i) == "-o" || arguments().at(i) == "--option" ||
160160
arguments().at(i) == "-O" || arguments().at(i) == "--save-option") {
161161
const QString optionWarning = tr("The -o/--option and -O/--save-option options require an argument in the form group/setting=value");

src/Settings.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <QStandardPaths>
1111
#include <QPalette>
1212

13-
QString Settings::userConfigurationFile;
13+
QString Settings::userPreferencesFile;
1414
QSettings* Settings::settings;
1515
std::unordered_map<std::string, QVariant> Settings::m_hCache;
1616
int Settings::m_defaultFontSize;
@@ -20,9 +20,9 @@ static bool ends_with(const std::string& str, const std::string& with)
2020
return str.rfind(with) == str.size() - with.size();
2121
}
2222

23-
void Settings::setUserConfigurationFile(const QString userConfigurationFileArg)
23+
void Settings::setUserPreferencesFile(const QString userPreferencesFileArg)
2424
{
25-
userConfigurationFile = userConfigurationFileArg;
25+
userPreferencesFile = userPreferencesFileArg;
2626
}
2727

2828
void Settings::setSettingsObject()
@@ -32,47 +32,47 @@ void Settings::setSettingsObject()
3232
return;
3333

3434
/*
35-
Variable that stores whether or not the configuration file requested by the user is a normal configuration file
35+
Variable that stores whether or not the preferences file requested by the user is a normal preferences file
3636
If the file does not exist and is newly created, the if statement below is not executed, so the default value is set to true
3737
*/
38-
bool isNormalUserConfigurationFile = true;
38+
bool isNormalUserPreferencesFile = true;
3939

40-
// Code that verifies that the configuration file requested by the user is a normal configuration file
41-
if(userConfigurationFile != nullptr)
40+
// Code that verifies that the preferences file requested by the user is a normal preferences file
41+
if(userPreferencesFile != nullptr)
4242
{
4343
QFile *file = new QFile;
44-
file->setFileName(userConfigurationFile);
44+
file->setFileName(userPreferencesFile);
4545

4646
if(file->open(QIODevice::ReadOnly))
4747
{
4848
if(file->exists() &&
4949
QString::compare(QString::fromStdString("[%General]\n"), file->readLine(), Qt::CaseInsensitive) != 0)
50-
isNormalUserConfigurationFile = false;
50+
isNormalUserPreferencesFile = false;
5151
}
5252

5353
file->close();
5454
}
5555

56-
if(userConfigurationFile == nullptr)
56+
if(userPreferencesFile == nullptr)
5757
{
5858
settings = new QSettings(QCoreApplication::organizationName(), QCoreApplication::organizationName());
5959
} else {
60-
if(isNormalUserConfigurationFile)
60+
if(isNormalUserPreferencesFile)
6161
{
62-
settings = new QSettings(userConfigurationFile, QSettings::IniFormat);
62+
settings = new QSettings(userPreferencesFile, QSettings::IniFormat);
6363

64-
// Code to verify that the user does not have access to the requested configuration file
64+
// Code to verify that the user does not have access to the requested preferences file
6565
if(settings->status() == QSettings::AccessError) {
66-
qWarning() << qPrintable("The given configuration file can NOT access. Please check the permission for the file.");
67-
qWarning() << qPrintable("So, the -c/--config option is ignored.");
66+
qWarning() << qPrintable("The given preferences file can NOT access. Please check the permission for the file.");
67+
qWarning() << qPrintable("So, the -p/--preferences option is ignored.");
6868

6969
// Since you do not have permission to the file, delete the existing assignment and assign the standard
7070
delete settings;
7171
settings = new QSettings(QCoreApplication::organizationName(), QCoreApplication::organizationName());
7272
}
7373
} else {
74-
qWarning() << qPrintable("The given configuration file is not a normal configuration file. Please check again.");
75-
qWarning() << qPrintable("So, the -c/--config option is ignored.");
74+
qWarning() << qPrintable("The given preferences file is not a normal preferences file. Please check again.");
75+
qWarning() << qPrintable("So, the -p/--preferences option is ignored.");
7676
settings = new QSettings(QCoreApplication::organizationName(), QCoreApplication::organizationName());
7777
}
7878
}

src/Settings.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Settings
1515
DarkStyle
1616
};
1717

18-
static void setUserConfigurationFile(const QString userConfigurationFileArg);
18+
static void setUserPreferencesFile(const QString userPreferencesFileArg);
1919
static QVariant getValue(const std::string& group, const std::string& name);
2020
static void setValue(const std::string& group, const std::string& name, const QVariant& value, bool dont_save_to_disk = false);
2121
static void clearValue(const std::string& group, const std::string& name);
@@ -34,7 +34,7 @@ class Settings
3434
static QColor getDefaultColorValue(const std::string& group, const std::string& name, AppStyle style);
3535

3636
// User configuration file path
37-
static QString userConfigurationFile;
37+
static QString userPreferencesFile;
3838

3939
// QSettings object
4040
static QSettings* settings;

0 commit comments

Comments
 (0)