Remember which tabs are open between sessions (#5467)

This commit is contained in:
RickyRister 2025-01-14 22:10:24 -08:00 committed by GitHub
parent 23bd18a04c
commit 2def02e140
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 219 additions and 66 deletions

View file

@ -212,6 +212,14 @@ SettingsCache::SettingsCache()
themeName = settings->value("theme/name").toString();
tabVisualDeckStorageOpen = settings->value("tabs/visualDeckStorage", true).toBool();
tabServerOpen = settings->value("tabs/server", true).toBool();
tabAccountOpen = settings->value("tabs/account", true).toBool();
tabDeckStorageOpen = settings->value("tabs/deckStorage", true).toBool();
tabReplaysOpen = settings->value("tabs/replays", true).toBool();
tabAdminOpen = settings->value("tabs/admin", true).toBool();
tabLogOpen = settings->value("tabs/log", true).toBool();
// we only want to reset the cache once, then its up to the user
bool updateCache = settings->value("revert/pixmapCacheSize", false).toBool();
if (!updateCache) {
@ -260,7 +268,6 @@ SettingsCache::SettingsCache()
printingSelectorNavigationButtonsVisible =
settings->value("cards/printingselectornavigationbuttonsvisible", true).toBool();
visualDeckStorageCardSize = settings->value("cards/visualdeckstoragecardsize", 100).toInt();
visualDeckStorageShowOnLoad = settings->value("interface/visualdeckstorageshowonload", true).toBool();
visualDeckStorageSortingOrder = settings->value("interface/visualdeckstoragesortingorder", 0).toInt();
visualDeckStorageDrawUnusedColorIdentities =
settings->value("interface/visualdeckstoragedrawunusedcoloridentities", true).toBool();
@ -486,6 +493,48 @@ void SettingsCache::setThemeName(const QString &_themeName)
emit themeChanged();
}
void SettingsCache::setTabVisualDeckStorageOpen(bool value)
{
tabVisualDeckStorageOpen = value;
settings->setValue("tabs/visualDeckStorage", tabVisualDeckStorageOpen);
}
void SettingsCache::setTabServerOpen(bool value)
{
tabServerOpen = value;
settings->setValue("tabs/server", tabServerOpen);
}
void SettingsCache::setTabAccountOpen(bool value)
{
tabAccountOpen = value;
settings->setValue("tabs/account", tabAccountOpen);
}
void SettingsCache::setTabDeckStorageOpen(bool value)
{
tabDeckStorageOpen = value;
settings->setValue("tabs/deckStorage", tabDeckStorageOpen);
}
void SettingsCache::setTabReplaysOpen(bool value)
{
tabReplaysOpen = value;
settings->setValue("tabs/replays", tabReplaysOpen);
}
void SettingsCache::setTabAdminOpen(bool value)
{
tabAdminOpen = value;
settings->setValue("tabs/admin", tabAdminOpen);
}
void SettingsCache::setTabLogOpen(bool value)
{
tabLogOpen = value;
settings->setValue("tabs/log", tabLogOpen);
}
void SettingsCache::setPicDownload(QT_STATE_CHANGED_T _picDownload)
{
picDownload = static_cast<bool>(_picDownload);
@ -629,12 +678,6 @@ void SettingsCache::setVisualDeckStorageCardSize(int _visualDeckStorageCardSize)
emit visualDeckStorageCardSizeChanged();
}
void SettingsCache::setVisualDeckStorageShowOnLoad(QT_STATE_CHANGED_T _visualDeckStorageShowOnLoad)
{
visualDeckStorageShowOnLoad = _visualDeckStorageShowOnLoad;
settings->setValue("interface/visualdeckstorageshowonload", visualDeckStorageShowOnLoad);
}
void SettingsCache::setVisualDeckStorageDrawUnusedColorIdentities(
QT_STATE_CHANGED_T _visualDeckStorageDrawUnusedColorIdentities)
{

View file

@ -96,6 +96,8 @@ private:
QString lang;
QString deckPath, replaysPath, picsPath, redirectCachePath, customPicsPath, cardDatabasePath,
customCardDatabasePath, themesPath, spoilerDatabasePath, tokenDatabasePath, themeName;
bool tabVisualDeckStorageOpen, tabServerOpen, tabAccountOpen, tabDeckStorageOpen, tabReplaysOpen, tabAdminOpen,
tabLogOpen;
bool checkUpdatesOnStartup;
bool notifyAboutUpdates;
bool notifyAboutNewVersion;
@ -128,7 +130,6 @@ private:
int visualDeckStorageCardSize;
bool visualDeckStorageDrawUnusedColorIdentities;
int visualDeckStorageUnusedColorIdentitiesOpacity;
bool visualDeckStorageShowOnLoad;
bool horizontalHand;
bool invertVerticalCoordinate;
int minPlayersForMultiColumnLayout;
@ -254,6 +255,34 @@ public:
{
return themeName;
}
bool getTabVisualDeckStorageOpen() const
{
return tabVisualDeckStorageOpen;
}
bool getTabServerOpen() const
{
return tabServerOpen;
}
bool getTabAccountOpen() const
{
return tabAccountOpen;
}
bool getTabDeckStorageOpen() const
{
return tabDeckStorageOpen;
}
bool getTabReplaysOpen() const
{
return tabReplaysOpen;
}
bool getTabAdminOpen() const
{
return tabAdminOpen;
}
bool getTabLogOpen() const
{
return tabLogOpen;
}
QString getChatMentionColor() const
{
return chatMentionColor;
@ -391,10 +420,6 @@ public:
{
return visualDeckStorageUnusedColorIdentitiesOpacity;
}
bool getVisualDeckStorageShowOnLoad() const
{
return visualDeckStorageShowOnLoad;
}
bool getHorizontalHand() const
{
return horizontalHand;
@ -681,6 +706,13 @@ public slots:
void setSpoilerDatabasePath(const QString &_spoilerDatabasePath);
void setTokenDatabasePath(const QString &_tokenDatabasePath);
void setThemeName(const QString &_themeName);
void setTabVisualDeckStorageOpen(bool value);
void setTabServerOpen(bool value);
void setTabAccountOpen(bool value);
void setTabDeckStorageOpen(bool value);
void setTabReplaysOpen(bool value);
void setTabAdminOpen(bool value);
void setTabLogOpen(bool value);
void setChatMentionColor(const QString &_chatMentionColor);
void setChatHighlightColor(const QString &_chatHighlightColor);
void setPicDownload(QT_STATE_CHANGED_T _picDownload);
@ -707,7 +739,6 @@ public slots:
void setVisualDeckStorageCardSize(int _visualDeckStorageCardSize);
void setVisualDeckStorageDrawUnusedColorIdentities(QT_STATE_CHANGED_T _visualDeckStorageDrawUnusedColorIdentities);
void setVisualDeckStorageUnusedColorIdentitiesOpacity(int _visualDeckStorageUnusedColorIdentitiesOpacity);
void setVisualDeckStorageShowOnLoad(QT_STATE_CHANGED_T _visualDeckStorageShowOnLoad);
void setHorizontalHand(QT_STATE_CHANGED_T _horizontalHand);
void setInvertVerticalCoordinate(QT_STATE_CHANGED_T _invertVerticalCoordinate);
void setMinPlayersForMultiColumnLayout(int _minPlayersForMultiColumnLayout);