Feature/3139 new features for tips (#3152)

* "Tip of the Day" option added to Help menu

* Tip of the Day setting moved

* If no new tips are availabe, don't show tip of the day again

* list storing try #1

* first unseen tip shown first

* lastShownTip removed

* fixed next/previous buttons

* spaces > tab

* "Show this window on startup" is not checked by default
This commit is contained in:
David Szabo 2018-04-01 10:52:26 +02:00 committed by Zach H
parent 6374d157fc
commit e1394bd851
8 changed files with 62 additions and 22 deletions

View file

@ -143,6 +143,7 @@ QString SettingsCache::getSafeConfigFilePath(QString configEntry, QString defaul
tmp = defaultPath;
return tmp;
}
SettingsCache::SettingsCache()
{
// first, figure out if we are running in portable mode
@ -181,7 +182,9 @@ SettingsCache::SettingsCache()
// tip of the day settings
showTipsOnStartup = settings->value("tipOfDay/showTips", true).toBool();
lastShownTip = settings->value("tipOfDay/lastShown", -1).toInt();
for (auto tipNumber : settings->value("tipOfDay/seenTips").toList()) {
seenTips.append(tipNumber.toInt());
}
deckPath = getSafeConfigPath("paths/decks", dataPath + "/decks/");
replaysPath = getSafeConfigPath("paths/replays", dataPath + "/replays/");
@ -345,10 +348,14 @@ void SettingsCache::setShowTipsOnStartup(bool _showTipsOnStartup)
settings->setValue("tipOfDay/showTips", showTipsOnStartup);
}
void SettingsCache::setLastShownTip(int _lastShownTip)
void SettingsCache::setSeenTips(const QList<int> &_seenTips)
{
lastShownTip = _lastShownTip;
settings->setValue("tipOfDay/lastShown", lastShownTip);
seenTips = _seenTips;
QList<QVariant> storedTipList;
for (auto tipNumber : seenTips) {
storedTipList.append(tipNumber);
}
settings->setValue("tipOfDay/seenTips", storedTipList);
}
void SettingsCache::setDeckPath(const QString &_deckPath)