mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-15 23:12:14 -07:00
Turn Card, Settings and Utility into libraries.
Took 4 hours 3 minutes Took 2 minutes Took 38 seconds Took 5 minutes Took 5 minutes Took 9 minutes Took 15 minutes
This commit is contained in:
parent
30e6b52783
commit
53d80efab8
262 changed files with 1025 additions and 918 deletions
42
cockatrice/libs/settings/src/recents_settings.cpp
Normal file
42
cockatrice/libs/settings/src/recents_settings.cpp
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#include "../include/settings/recents_settings.h"
|
||||
|
||||
#define MAX_RECENT_DECK_COUNT 10
|
||||
|
||||
RecentsSettings::RecentsSettings(const QString &settingPath, QObject *parent)
|
||||
: SettingsManager(settingPath + "recents.ini", parent)
|
||||
{
|
||||
}
|
||||
|
||||
QStringList RecentsSettings::getRecentlyOpenedDeckPaths()
|
||||
{
|
||||
return getValue("deckpaths", "deckbuilder").toStringList();
|
||||
}
|
||||
void RecentsSettings::clearRecentlyOpenedDeckPaths()
|
||||
{
|
||||
deleteValue("deckpaths", "deckbuilder");
|
||||
emit recentlyOpenedDeckPathsChanged();
|
||||
}
|
||||
void RecentsSettings::updateRecentlyOpenedDeckPaths(const QString &deckPath)
|
||||
{
|
||||
auto deckPaths = getValue("deckpaths", "deckbuilder").toStringList();
|
||||
deckPaths.removeAll(deckPath);
|
||||
|
||||
deckPaths.prepend(deckPath);
|
||||
|
||||
while (deckPaths.size() > MAX_RECENT_DECK_COUNT) {
|
||||
deckPaths.removeLast();
|
||||
}
|
||||
|
||||
setValue(deckPaths, "deckpaths", "deckbuilder");
|
||||
emit recentlyOpenedDeckPathsChanged();
|
||||
}
|
||||
|
||||
QString RecentsSettings::getLatestDeckDirPath()
|
||||
{
|
||||
return getValue("latestDeckDir", "dirs").toString();
|
||||
}
|
||||
|
||||
void RecentsSettings::setLatestDeckDirPath(const QString &dirPath)
|
||||
{
|
||||
setValue(dirPath, "latestDeckDir", "dirs");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue