Do not prompt to use previous version settings when newer version
This commit is contained in:
committed by
Raphael Coeffic
parent
e64f57768a
commit
7648dfc544
@@ -69,28 +69,22 @@ void checkSettingsImport(bool force = false)
|
|||||||
if (!found && !force)
|
if (!found && !force)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const QString impFileBtn = QCoreApplication::translate("Companion", "Import from File");
|
|
||||||
const QString impPrevBtn = QCoreApplication::translate("Companion", "Import from v%1").arg(previousVersion);
|
|
||||||
const QString impNoneBtn = QCoreApplication::translate("Companion", "Do not import");
|
|
||||||
|
|
||||||
QString msg;
|
QString msg;
|
||||||
if (previousVersion.isEmpty()) {
|
if (previousVersion.isEmpty()) {
|
||||||
|
const QString impFileBtn = QCoreApplication::translate("Companion", "Import from File");
|
||||||
|
const QString impNoneBtn = QCoreApplication::translate("Companion", "Do not import");
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
msg = QCoreApplication::translate("Companion", "We have found possible Companion settings backup file(s).\nDo you want to import settings from a file?");
|
msg = QCoreApplication::translate("Companion", "We have found possible Companion settings backup file(s).\nDo you want to import settings from a file?");
|
||||||
else
|
else
|
||||||
msg = QCoreApplication::translate("Companion", "Import settings from a file, or start with current values.");
|
msg = QCoreApplication::translate("Companion", "Import settings from a file, or start with current values.");
|
||||||
|
|
||||||
|
const int ret = QMessageBox::question(nullptr, CPN_STR_APP_NAME, msg, impNoneBtn, impFileBtn, 0, 0);
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
msg = QCoreApplication::translate("Companion", "We have found existing settings for Companion version: %1.\nDo you want to import them?\n\n" \
|
|
||||||
"If you have a settings backup file, you may import that instead.").arg(previousVersion);
|
|
||||||
}
|
|
||||||
|
|
||||||
const int ret = QMessageBox::question(nullptr, CPN_STR_APP_NAME, msg, impNoneBtn, impFileBtn, (previousVersion.isEmpty() ? QString() : impPrevBtn), 0, 0);
|
|
||||||
if (!ret)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Import from previous version
|
|
||||||
if (ret == 2) {
|
|
||||||
if (!g.importSettings(previousVersion)) {
|
if (!g.importSettings(previousVersion)) {
|
||||||
// very unlikely, but just in case of unexpected error, restart the import
|
// very unlikely, but just in case of unexpected error, restart the import
|
||||||
importError();
|
importError();
|
||||||
|
|||||||
@@ -471,7 +471,7 @@ void AppData::clearUnusedSettings(QSettings & settings)
|
|||||||
bool AppData::findPreviousVersionSettings(QString * version) const
|
bool AppData::findPreviousVersionSettings(QString * version) const
|
||||||
{
|
{
|
||||||
// TODO need a more dynamic method since ETX moves so quickly
|
// TODO need a more dynamic method since ETX moves so quickly
|
||||||
static const QStringList versList({QStringLiteral("2.5"), QStringLiteral("2.4")});
|
static const QStringList versList({QStringLiteral("2.6"), QStringLiteral("2.5"), QStringLiteral("2.4")});
|
||||||
|
|
||||||
for (const QString &ver : versList) {
|
for (const QString &ver : versList) {
|
||||||
const QString prod("Companion " % ver);
|
const QString prod("Companion " % ver);
|
||||||
|
|||||||
Reference in New Issue
Block a user