Update importSettings() to call reloadSettings()

- PreferencesDialog::importSettings() calls MainWindow::reloadSettings() indirectly
- PreferencesDIalog::exportSettings() calls PreferencesDialog::saveSettings() when beginning
- Settings::importSettings() clear m_hCache
- Update Korean translation that can be translated from the above changes
This commit is contained in:
SeongTae Jeong
2020-09-21 12:23:53 +09:00
parent d8ca11f57a
commit 0031d9ae40
4 changed files with 101 additions and 34 deletions

View File

@@ -215,7 +215,7 @@ void PreferencesDialog::loadSettings()
ui->spinMaxRecentFiles->setValue(Settings::getValue("General", "maxRecentFiles").toInt());
}
void PreferencesDialog::saveSettings()
void PreferencesDialog::saveSettings(bool accept)
{
QApplication::setOverrideCursor(Qt::WaitCursor);
@@ -348,7 +348,8 @@ void PreferencesDialog::saveSettings()
m_proxyDialog->saveSettings();
accept();
if(accept)
PreferencesDialog::accept();
QApplication::restoreOverrideCursor();
}
@@ -701,6 +702,8 @@ void PreferencesDialog::configureProxy()
void PreferencesDialog::exportSettings()
{
saveSettings(false);
const QString fileName = FileDialog::getSaveFileName(CreateSettingsFile, this, tr("Save Settings File"), tr("Initialization File (*.ini)"));
if(!fileName.isEmpty())
{
@@ -712,13 +715,20 @@ void PreferencesDialog::exportSettings()
void PreferencesDialog::importSettings()
{
const QString fileName = FileDialog::getOpenFileName(OpenSettingsFile, this, tr("Open Settings File"), tr("Initialization File (*.ini)"));
const QVariant existingLanguage = Settings::getValue("General", "language");
if(!fileName.isEmpty())
{
if(Settings::importSettings(fileName))
QMessageBox::warning(this, QApplication::applicationName(), tr("Rerun the program to apply the settings."));
else
QMessageBox::critical(this, QApplication::applicationName(), tr("The selected settings file is not a normal settings file.\nPlease check again."));
{
QMessageBox::information(this, QApplication::applicationName(), tr("The settings file was loaded properly."));
if (existingLanguage != Settings::getValue("General", "language"))
QMessageBox::information(this, QApplication::applicationName(),
tr("The language will change after you restart the application."));
PreferencesDialog::close();
accept();
} else {
QMessageBox::critical(this, QApplication::applicationName(), tr("The selected settings file is not a normal settings file.\nPlease check again."));
}
}
}

View File

@@ -34,7 +34,7 @@ public:
private slots:
void loadSettings();
void saveSettings();
void saveSettings(bool accept=true);
void chooseLocation();
void showColourDialog(QTreeWidgetItem* item, int column);

View File

@@ -618,5 +618,6 @@ bool Settings::importSettings(const QString fileName)
importSettings->endGroup();
}
m_hCache.clear();
return true;
}

View File

@@ -131,16 +131,6 @@
<translation>: %1 [] [&lt;&gt;|&lt;&gt;]
</translation>
</message>
<message>
<location filename="../Application.cpp" line="36"/>
<source>The user preferences file location is replaced with the argument value instead of the environment variable value.</source>
<translation> .</translation>
</message>
<message>
<location filename="../Application.cpp" line="37"/>
<source>Ignored environment variable(DB4S_PREFERENCES_FILE) value : </source>
<translation>(DB4S_PREFERENCES_FILE) : </translation>
</message>
<message>
<location filename="../Application.cpp" line="119"/>
<source> -h, --help Show command line options</source>
@@ -166,15 +156,25 @@
<source> -R, --read-only Open database in read-only mode</source>
<translation> -R, --read-only </translation>
</message>
<message>
<location filename="../Application.cpp" line="36"/>
<source>The user settings file location is replaced with the argument value instead of the environment variable value.</source>
<translation> .</translation>
</message>
<message>
<location filename="../Application.cpp" line="37"/>
<source>Ignored environment variable(DB4S_SETTINGS_FILE) value : </source>
<translation> (DB4S_SETTINGS_FILE) : </translation>
</message>
<message>
<location filename="../Application.cpp" line="124"/>
<source> -p, --preferences &lt;preferences_file&gt;</source>
<translation> -p, --preferences &lt;_설정_파일&gt;</translation>
<source> -S, --settings &lt;settings_file&gt;</source>
<translation> -S, --settings &lt;_파일&gt;</translation>
</message>
<message>
<location filename="../Application.cpp" line="125"/>
<source> Run application based on this preferences file</source>
<translation> </translation>
<source> Run application based on this settings file</source>
<translation> </translation>
</message>
<message>
<location filename="../Application.cpp" line="126"/>
@@ -228,8 +228,8 @@
</message>
<message>
<location filename="../Application.cpp" line="158"/>
<source>The -p/--preferences option requires an argument. The option is ignored.</source>
<translation>-p/--preferences . .</translation>
<source>The -S/--settings option requires an argument. The option is ignored.</source>
<translation>-S/--settings . .</translation>
</message>
<message>
<location filename="../Application.cpp" line="161"/>
@@ -1201,7 +1201,12 @@ Errors are indicated with a red squiggle underline.</source>
<translation> 타입: 유효한 JSON</translation>
</message>
<message>
<location filename="../EditDialog.cpp" line="1227"/>
<location filename="../EditDialog.cpp" line="1209"/>
<source>Couldn&apos;t save file: %1.</source>
<translation> : %1.</translation>
</message>
<message>
<location filename="../EditDialog.cpp" line="1234"/>
<source>The data has been saved to a temporary file and has been opened with the default application. You can now edit the file and, when you are ready, apply the saved new data to the cell editor or cancel any changes.</source>
<translation> . .</translation>
</message>
@@ -5152,48 +5157,94 @@ Can be set to 0 for disabling completion.</source>
<translation> </translation>
</message>
<message>
<location filename="../PreferencesDialog.cpp" line="67"/>
<location filename="../PreferencesDialog.cpp" line="646"/>
<location filename="../PreferencesDialog.cpp" line="54"/>
<source>Export Settings</source>
<translation> </translation>
</message>
<message>
<location filename="../PreferencesDialog.cpp" line="56"/>
<source>Import Settings</source>
<translation> </translation>
</message>
<message>
<location filename="../PreferencesDialog.cpp" line="73"/>
<location filename="../PreferencesDialog.cpp" line="653"/>
<source>Choose a directory</source>
<translation> </translation>
</message>
<message>
<location filename="../PreferencesDialog.cpp" line="330"/>
<location filename="../PreferencesDialog.cpp" line="336"/>
<location filename="../PreferencesDialog.cpp" line="727"/>
<source>The language will change after you restart the application.</source>
<translation> .</translation>
</message>
<message>
<location filename="../PreferencesDialog.cpp" line="407"/>
<location filename="../PreferencesDialog.cpp" line="414"/>
<source>Select extension file</source>
<translation> </translation>
</message>
<message>
<location filename="../PreferencesDialog.cpp" line="408"/>
<location filename="../PreferencesDialog.cpp" line="415"/>
<source>Extensions(*.so *.dylib *.dll);;All files(*)</source>
<translation>(*.so *.dylib *dll);; (*)</translation>
</message>
<message>
<location filename="../PreferencesDialog.cpp" line="572"/>
<location filename="../PreferencesDialog.cpp" line="579"/>
<source>Import certificate file</source>
<translation> </translation>
</message>
<message>
<location filename="../PreferencesDialog.cpp" line="580"/>
<location filename="../PreferencesDialog.cpp" line="587"/>
<source>No certificates found in this file.</source>
<translation> .</translation>
</message>
<message>
<location filename="../PreferencesDialog.cpp" line="597"/>
<location filename="../PreferencesDialog.cpp" line="604"/>
<source>Are you sure you want do remove this certificate? All certificate data will be deleted from the application settings!</source>
<translation> ? !</translation>
</message>
<message>
<location filename="../PreferencesDialog.cpp" line="682"/>
<location filename="../PreferencesDialog.cpp" line="689"/>
<source>Are you sure you want to clear all the saved settings?
All your preferences will be lost and default values will be used.</source>
<translation> ?
.</translation>
</message>
<message>
<location filename="../PreferencesDialog.cpp" line="707"/>
<source>Save Settings File</source>
<translation> </translation>
</message>
<message>
<location filename="../PreferencesDialog.cpp" line="707"/>
<location filename="../PreferencesDialog.cpp" line="717"/>
<source>Initialization File (*.ini)</source>
<translation> (*.ini)</translation>
</message>
<message>
<location filename="../PreferencesDialog.cpp" line="711"/>
<source>The settings file has been saved in location :
</source>
<translation> :
</translation>
</message>
<message>
<location filename="../PreferencesDialog.cpp" line="717"/>
<source>Open Settings File</source>
<translation> </translation>
</message>
<message>
<location filename="../PreferencesDialog.cpp" line="724"/>
<source>The settings file was loaded properly.</source>
<translation> .</translation>
</message>
<message>
<location filename="../PreferencesDialog.cpp" line="731"/>
<source>The selected settings file is not a normal settings file.
Please check again.</source>
<translation> .
.</translation>
</message>
</context>
<context>
<name>ProxyDialog</name>
@@ -5288,7 +5339,7 @@ All your preferences will be lost and default values will be used.</source>
<translation> (*)</translation>
</message>
<message>
<location filename="../Settings.cpp" line="257"/>
<location filename="../Settings.cpp" line="265"/>
<source>SQLite database files (*.db *.sqlite *.sqlite3 *.db3)</source>
<translation>SQLite (*.db *.sqlite *.sqlite3 *.db3)</translation>
</message>
@@ -5387,6 +5438,11 @@ All your preferences will be lost and default values will be used.</source>
<source>Extensions (*.so *.dylib *.dll)</source>
<translation> (*.so *.dylib *.dll)</translation>
</message>
<message>
<location filename="../FileDialog.h" line="60"/>
<source>Initialization File (*.ini)</source>
<translation> (*.ini)</translation>
</message>
</context>
<context>
<name>RemoteCommitsModel</name>