Launcher: Separate recent-foo data by version
Since our data encoding is incompatible between 2018 and 2020, use different settings keys so running both versions in parallel is easier. Without this, each version screws up the data for the other.
This commit is contained in:
parent
9776c56faa
commit
8c371cf3bb
2 changed files with 8 additions and 4 deletions
|
@ -7,13 +7,14 @@
|
|||
|
||||
const int MAX_RECENT_AIRCRAFT = 20;
|
||||
|
||||
const QString recentAircraftKey = "recent-aircraft-2020";
|
||||
|
||||
RecentAircraftModel::RecentAircraftModel(AircraftItemModel* acModel, QObject* pr) :
|
||||
QAbstractListModel(pr),
|
||||
m_aircraftModel(acModel)
|
||||
{
|
||||
QSettings settings;
|
||||
const QStringList urls = settings.value("recent-aircraft").toStringList();
|
||||
const QStringList urls = settings.value(recentAircraftKey).toStringList();
|
||||
m_data = QUrl::fromStringList(urls);
|
||||
|
||||
connect(m_aircraftModel, &AircraftItemModel::contentsChanged,
|
||||
|
@ -23,7 +24,7 @@ RecentAircraftModel::RecentAircraftModel(AircraftItemModel* acModel, QObject* pr
|
|||
void RecentAircraftModel::saveToSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue("recent-aircraft", QUrl::toStringList(m_data));
|
||||
settings.setValue(recentAircraftKey, QUrl::toStringList(m_data));
|
||||
}
|
||||
|
||||
QUrl RecentAircraftModel::uriAt(int index) const
|
||||
|
|
|
@ -6,17 +6,20 @@
|
|||
|
||||
const int MAX_RECENT_LOCATIONS = 20;
|
||||
|
||||
// avoid clashng with previous versions, with incompatible data
|
||||
const QString recentLocationsKey = "recent-locations-2020";
|
||||
|
||||
RecentLocationsModel::RecentLocationsModel(QObject* pr) :
|
||||
QAbstractListModel(pr)
|
||||
{
|
||||
QSettings settings;
|
||||
m_data = settings.value("recent-location-sets").toList();
|
||||
m_data = settings.value(recentLocationsKey).toList();
|
||||
}
|
||||
|
||||
void RecentLocationsModel::saveToSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue("recent-location-sets", m_data);
|
||||
settings.setValue(recentLocationsKey, m_data);
|
||||
}
|
||||
|
||||
QVariantMap RecentLocationsModel::locationAt(int index) const
|
||||
|
|
Loading…
Add table
Reference in a new issue