mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
[Tutorial] Seed tutorialCompleted for existing installs at startup
This commit is contained in:
parent
338f38b2da
commit
e4c67f5ea5
2 changed files with 12 additions and 8 deletions
|
|
@ -113,6 +113,12 @@ SettingsCache::SettingsCache()
|
||||||
|
|
||||||
QString settingsPath = getSettingsPath();
|
QString settingsPath = getSettingsPath();
|
||||||
|
|
||||||
|
// Decide once, before any migration writes new files, whether this is an
|
||||||
|
// existing install. Fresh installs have no *.ini files and no legacy
|
||||||
|
// NativeFormat keys; upgrades have one or the other.
|
||||||
|
const bool hadExistingSettings =
|
||||||
|
!QDir(settingsPath).entryList({"*.ini"}, QDir::Files).isEmpty() || !QSettings().allKeys().isEmpty();
|
||||||
|
|
||||||
settings = new QSettings(settingsPath + "global.ini", QSettings::IniFormat, this);
|
settings = new QSettings(settingsPath + "global.ini", QSettings::IniFormat, this);
|
||||||
|
|
||||||
// Both migrations below overwrite per-domain files in place, so snapshot the whole settings
|
// Both migrations below overwrite per-domain files in place, so snapshot the whole settings
|
||||||
|
|
@ -158,6 +164,12 @@ SettingsCache::SettingsCache()
|
||||||
personalSettings = new PersonalSettings(settingsPath, this);
|
personalSettings = new PersonalSettings(settingsPath, this);
|
||||||
cardsDisplaySettings = new CardsDisplaySettings(settingsPath, this);
|
cardsDisplaySettings = new CardsDisplaySettings(settingsPath, this);
|
||||||
interfaceSettings = new InterfaceSettings(settingsPath, this);
|
interfaceSettings = new InterfaceSettings(settingsPath, this);
|
||||||
|
if (hadExistingSettings) {
|
||||||
|
QSettings iface(settingsPath + "interface.ini", QSettings::IniFormat);
|
||||||
|
if (!iface.contains("interface/tutorialCompleted")) {
|
||||||
|
interfaceSettings->setTutorialCompleted(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
deckEditorSettings = new DeckEditorSettings(settingsPath, this);
|
deckEditorSettings = new DeckEditorSettings(settingsPath, this);
|
||||||
pathsSettings = new PathsSettings(settingsPath, this);
|
pathsSettings = new PathsSettings(settingsPath, this);
|
||||||
visualDeckStorageSettings = new VisualDeckStorageSettings(settingsPath, this);
|
visualDeckStorageSettings = new VisualDeckStorageSettings(settingsPath, this);
|
||||||
|
|
|
||||||
|
|
@ -250,14 +250,6 @@ QStringList InterfaceSettings::getUserListExpandedSections() const
|
||||||
|
|
||||||
bool InterfaceSettings::getTutorialCompleted() const
|
bool InterfaceSettings::getTutorialCompleted() const
|
||||||
{
|
{
|
||||||
// Upgrading users have settings files but no tutorial key yet: treat the tutorial as seen so they are
|
|
||||||
// not overlaid on upgrade. Genuinely new installs have no settings files at all, so they still get it.
|
|
||||||
if (!getSettings().contains("interface/tutorialCompleted")) {
|
|
||||||
QDir settingsDir = QFileInfo(settingPath).dir();
|
|
||||||
if (!settingsDir.entryList({"*.ini"}, QDir::Files).isEmpty()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return getValue("tutorialCompleted", QString(), QString(), false).toBool();
|
return getValue("tutorialCompleted", QString(), QString(), false).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue