Skip to content

Commit

Permalink
Add settings migration
Browse files Browse the repository at this point in the history
  • Loading branch information
Luca0208 committed Apr 18, 2023
1 parent 48f3fdb commit df1fa5b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "Whazzup.h"
#include "Window.h"
#include "PilotDetails.h"
#include "GuiMessage.h"
#include "ControllerDetails.h"
#include "AirportDetails.h"
#include "Client.h"
Expand All @@ -16,7 +17,7 @@ QSettings* Settings::instance() {
if(settingsInstance == 0) {
settingsInstance = new QSettings();

const int requiredSettingsVersion = 2;
const int requiredSettingsVersion = 3;
int currentSettingsVersion = settingsInstance->value("settings/version", 0).toInt();
if (currentSettingsVersion < requiredSettingsVersion) {
if(currentSettingsVersion < 1) {
Expand Down Expand Up @@ -53,6 +54,16 @@ QSettings* Settings::instance() {
settingsInstance->setValue("friends/friendList", friendList);
currentSettingsVersion = 2;
}
if(currentSettingsVersion < 3) {
qDebug() << "Starting migration 2 -> 3";
if(settingsInstance->value("download/bookingsLocation").toString() != "http://vatbook.euroutepro.com/servinfo.asp") {
GuiMessages::criticalUserInteraction(QString("You have set the location for bookings to %1.\nThis is different from the old default location. Due to an update in QuteScoop the old format for bookings is no longer supported.\n\nYou will be migrated to the new default VATSIM bookings URL.")
.arg(settingsInstance->value("download/bookingsLocation").toString()),
"Update of bookings format");
}
settingsInstance->setValue("download/bookingsLocation", "https://atc-bookings.vatsim.net/api/booking");
currentSettingsVersion = 3;
}
settingsInstance->setValue("settings/version", currentSettingsVersion);
}
}
Expand Down

0 comments on commit df1fa5b

Please sign in to comment.