mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-26 02:17:33 -05:00
* Give settings managers default groups instead of manually specifying them everywhere. Took 1 hour 2 minutes Took 41 seconds Took 32 seconds Took 5 minutes * Fix dbconverter mock. Took 2 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
42 lines
1.1 KiB
C++
42 lines
1.1 KiB
C++
#include "recents_settings.h"
|
|
|
|
#define MAX_RECENT_DECK_COUNT 10
|
|
|
|
RecentsSettings::RecentsSettings(const QString &settingPath, QObject *parent)
|
|
: SettingsManager(settingPath + "recents.ini", "deckbuilder", QString(), parent)
|
|
{
|
|
}
|
|
|
|
QStringList RecentsSettings::getRecentlyOpenedDeckPaths()
|
|
{
|
|
return getValue("deckpaths").toStringList();
|
|
}
|
|
void RecentsSettings::clearRecentlyOpenedDeckPaths()
|
|
{
|
|
deleteValue("deckpaths");
|
|
emit recentlyOpenedDeckPathsChanged();
|
|
}
|
|
void RecentsSettings::updateRecentlyOpenedDeckPaths(const QString &deckPath)
|
|
{
|
|
auto deckPaths = getValue("deckpaths").toStringList();
|
|
deckPaths.removeAll(deckPath);
|
|
|
|
deckPaths.prepend(deckPath);
|
|
|
|
while (deckPaths.size() > MAX_RECENT_DECK_COUNT) {
|
|
deckPaths.removeLast();
|
|
}
|
|
|
|
setValue(deckPaths, "deckpaths");
|
|
emit recentlyOpenedDeckPathsChanged();
|
|
}
|
|
|
|
QString RecentsSettings::getLatestDeckDirPath()
|
|
{
|
|
return getValue("latestDeckDir", "dirs").toString();
|
|
}
|
|
|
|
void RecentsSettings::setLatestDeckDirPath(const QString &dirPath)
|
|
{
|
|
setValue(dirPath, "latestDeckDir", "dirs");
|
|
} |