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

@ -134,31 +134,31 @@ TabSupervisor::TabSupervisor(AbstractClient *_client, QMenu *tabsMenu, QWidget *
aTabVisualDeckStorage = new QAction(this); aTabVisualDeckStorage = new QAction(this);
aTabVisualDeckStorage->setCheckable(true); aTabVisualDeckStorage->setCheckable(true);
connect(aTabVisualDeckStorage, &QAction::toggled, this, &TabSupervisor::actTabVisualDeckStorage); connect(aTabVisualDeckStorage, &QAction::triggered, this, &TabSupervisor::actTabVisualDeckStorage);
aTabServer = new QAction(this); aTabServer = new QAction(this);
aTabServer->setCheckable(true); aTabServer->setCheckable(true);
connect(aTabServer, &QAction::toggled, this, &TabSupervisor::actTabServer); connect(aTabServer, &QAction::triggered, this, &TabSupervisor::actTabServer);
aTabAccount = new QAction(this); aTabAccount = new QAction(this);
aTabAccount->setCheckable(true); aTabAccount->setCheckable(true);
connect(aTabAccount, &QAction::toggled, this, &TabSupervisor::actTabAccount); connect(aTabAccount, &QAction::triggered, this, &TabSupervisor::actTabAccount);
aTabDeckStorage = new QAction(this); aTabDeckStorage = new QAction(this);
aTabDeckStorage->setCheckable(true); aTabDeckStorage->setCheckable(true);
connect(aTabDeckStorage, &QAction::toggled, this, &TabSupervisor::actTabDeckStorage); connect(aTabDeckStorage, &QAction::triggered, this, &TabSupervisor::actTabDeckStorage);
aTabReplays = new QAction(this); aTabReplays = new QAction(this);
aTabReplays->setCheckable(true); aTabReplays->setCheckable(true);
connect(aTabReplays, &QAction::toggled, this, &TabSupervisor::actTabReplays); connect(aTabReplays, &QAction::triggered, this, &TabSupervisor::actTabReplays);
aTabAdmin = new QAction(this); aTabAdmin = new QAction(this);
aTabAdmin->setCheckable(true); aTabAdmin->setCheckable(true);
connect(aTabAdmin, &QAction::toggled, this, &TabSupervisor::actTabAdmin); connect(aTabAdmin, &QAction::triggered, this, &TabSupervisor::actTabAdmin);
aTabLog = new QAction(this); aTabLog = new QAction(this);
aTabLog->setCheckable(true); aTabLog->setCheckable(true);
connect(aTabLog, &QAction::toggled, this, &TabSupervisor::actTabLog); connect(aTabLog, &QAction::triggered, this, &TabSupervisor::actTabLog);
connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this, connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
&TabSupervisor::refreshShortcuts); &TabSupervisor::refreshShortcuts);
@ -168,10 +168,7 @@ TabSupervisor::TabSupervisor(AbstractClient *_client, QMenu *tabsMenu, QWidget *
retranslateUi(); retranslateUi();
// open always-available tabs on startup initStartupTabs();
addDeckEditorTab(nullptr);
aTabVisualDeckStorage->setChecked(SettingsCache::instance().getVisualDeckStorageShowOnLoad());
} }
TabSupervisor::~TabSupervisor() TabSupervisor::~TabSupervisor()
@ -264,7 +261,38 @@ QString TabSupervisor::sanitizeHtml(QString dirty) const
return dirty.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;").replace("\"", "&quot;"); return dirty.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;").replace("\"", "&quot;");
} }
int TabSupervisor::myAddTab(Tab *tab) /**
* If the action is not in the target checked state, then set it to that state by triggering the action.
* If the action is already in the target checked state, then do nothing.
*
* This allows us to programmatically trigger a QAction::triggered signal for a specific checked state.
*/
static void checkAndTrigger(QAction *checkableAction, bool checked)
{
if (checkableAction->isChecked() != checked) {
checkableAction->trigger();
}
}
/**
* Opens the always-available tabs, depending on settings.
*/
void TabSupervisor::initStartupTabs()
{
addDeckEditorTab(nullptr);
checkAndTrigger(aTabVisualDeckStorage, SettingsCache::instance().getTabVisualDeckStorageOpen());
}
/**
* Adds the tab to the TabSupervisor's tab bar.
*
* @param tab The Tab to add
* @param manager The menu action that corresponds to this tab, if this is a single-instance managed tab. Pass in
* nullptr if this is not a managed tab.
* @return The index of the added tab in the tab widget's tab menu
*/
int TabSupervisor::myAddTab(Tab *tab, QAction *manager)
{ {
connect(tab, &TabGame::userEvent, this, &TabSupervisor::tabUserEvent); connect(tab, &TabGame::userEvent, this, &TabSupervisor::tabUserEvent);
connect(tab, &TabGame::tabTextChanged, this, &TabSupervisor::updateTabText); connect(tab, &TabGame::tabTextChanged, this, &TabSupervisor::updateTabText);
@ -273,11 +301,33 @@ int TabSupervisor::myAddTab(Tab *tab)
int idx = addTab(tab, sanitizeTabName(tabText)); int idx = addTab(tab, sanitizeTabName(tabText));
setTabToolTip(idx, sanitizeHtml(tabText)); setTabToolTip(idx, sanitizeHtml(tabText));
addCloseButtonToTab(tab, idx); addCloseButtonToTab(tab, idx, manager);
return idx; return idx;
} }
/**
* Adds a usable close button to the tab.
*
* @param tab The Tab
* @param tabIndex The tab bar index of the tab
* @param manager The menu action that corresponds to this tab, if this is a single-instance managed tab. Pass in
* nullptr if this is not a managed tab.
*/
void TabSupervisor::addCloseButtonToTab(Tab *tab, int tabIndex, QAction *manager)
{
auto closeSide = static_cast<QTabBar::ButtonPosition>(
tabBar()->style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, tabBar()));
auto *closeButton = new CloseButton(tab);
if (manager) {
// If managed, all close requests should go through the menu action
connect(closeButton, &CloseButton::clicked, this, [manager] { checkAndTrigger(manager, false); });
} else {
connect(closeButton, &CloseButton::clicked, tab, [tab] { tab->closeRequest(); });
}
tabBar()->setTabButton(tabIndex, closeSide, closeButton);
}
/** /**
* Resets the tabs menu to the tabs that are always available * Resets the tabs menu to the tabs that are always available
*/ */
@ -302,8 +352,8 @@ void TabSupervisor::start(const ServerInfo_User &_userInfo)
tabsMenu->addAction(aTabServer); tabsMenu->addAction(aTabServer);
tabsMenu->addAction(aTabAccount); tabsMenu->addAction(aTabAccount);
aTabServer->setChecked(true); checkAndTrigger(aTabServer, SettingsCache::instance().getTabServerOpen());
aTabAccount->setChecked(true); checkAndTrigger(aTabAccount, SettingsCache::instance().getTabAccountOpen());
updatePingTime(0, -1); updatePingTime(0, -1);
@ -311,8 +361,8 @@ void TabSupervisor::start(const ServerInfo_User &_userInfo)
tabsMenu->addAction(aTabDeckStorage); tabsMenu->addAction(aTabDeckStorage);
tabsMenu->addAction(aTabReplays); tabsMenu->addAction(aTabReplays);
aTabDeckStorage->setChecked(true); checkAndTrigger(aTabDeckStorage, SettingsCache::instance().getTabDeckStorageOpen());
aTabReplays->setChecked(true); checkAndTrigger(aTabReplays, SettingsCache::instance().getTabReplaysOpen());
} }
if (userInfo->user_level() & ServerInfo_User::IsModerator) { if (userInfo->user_level() & ServerInfo_User::IsModerator) {
@ -320,8 +370,8 @@ void TabSupervisor::start(const ServerInfo_User &_userInfo)
tabsMenu->addAction(aTabAdmin); tabsMenu->addAction(aTabAdmin);
tabsMenu->addAction(aTabLog); tabsMenu->addAction(aTabLog);
aTabAdmin->setChecked(true); checkAndTrigger(aTabAdmin, SettingsCache::instance().getTabAdminOpen());
aTabLog->setChecked(true); checkAndTrigger(aTabLog, SettingsCache::instance().getTabLogOpen());
} }
retranslateUi(); retranslateUi();
@ -408,9 +458,10 @@ void TabSupervisor::stop()
void TabSupervisor::actTabVisualDeckStorage(bool checked) void TabSupervisor::actTabVisualDeckStorage(bool checked)
{ {
SettingsCache::instance().setTabVisualDeckStorageOpen(checked);
if (checked && !tabVisualDeckStorage) { if (checked && !tabVisualDeckStorage) {
tabVisualDeckStorage = new TabDeckStorageVisual(this, client); tabVisualDeckStorage = new TabDeckStorageVisual(this, client);
myAddTab(tabVisualDeckStorage); myAddTab(tabVisualDeckStorage, aTabVisualDeckStorage);
setCurrentWidget(tabVisualDeckStorage); setCurrentWidget(tabVisualDeckStorage);
connect(tabVisualDeckStorage, &Tab::closed, this, [this] { connect(tabVisualDeckStorage, &Tab::closed, this, [this] {
tabVisualDeckStorage = nullptr; tabVisualDeckStorage = nullptr;
@ -423,10 +474,11 @@ void TabSupervisor::actTabVisualDeckStorage(bool checked)
void TabSupervisor::actTabServer(bool checked) void TabSupervisor::actTabServer(bool checked)
{ {
SettingsCache::instance().setTabServerOpen(checked);
if (checked && !tabServer) { if (checked && !tabServer) {
tabServer = new TabServer(this, client); tabServer = new TabServer(this, client);
connect(tabServer, &TabServer::roomJoined, this, &TabSupervisor::addRoomTab); connect(tabServer, &TabServer::roomJoined, this, &TabSupervisor::addRoomTab);
myAddTab(tabServer); myAddTab(tabServer, aTabServer);
connect(tabServer, &Tab::closed, this, [this] { connect(tabServer, &Tab::closed, this, [this] {
tabServer = nullptr; tabServer = nullptr;
aTabServer->setChecked(false); aTabServer->setChecked(false);
@ -438,12 +490,13 @@ void TabSupervisor::actTabServer(bool checked)
void TabSupervisor::actTabAccount(bool checked) void TabSupervisor::actTabAccount(bool checked)
{ {
SettingsCache::instance().setTabAccountOpen(checked);
if (checked && !tabAccount) { if (checked && !tabAccount) {
tabAccount = new TabAccount(this, client, *userInfo); tabAccount = new TabAccount(this, client, *userInfo);
connect(tabAccount, &TabAccount::openMessageDialog, this, &TabSupervisor::addMessageTab); connect(tabAccount, &TabAccount::openMessageDialog, this, &TabSupervisor::addMessageTab);
connect(tabAccount, &TabAccount::userJoined, this, &TabSupervisor::processUserJoined); connect(tabAccount, &TabAccount::userJoined, this, &TabSupervisor::processUserJoined);
connect(tabAccount, &TabAccount::userLeft, this, &TabSupervisor::processUserLeft); connect(tabAccount, &TabAccount::userLeft, this, &TabSupervisor::processUserLeft);
myAddTab(tabAccount); myAddTab(tabAccount, aTabAccount);
connect(tabAccount, &Tab::closed, this, [this] { connect(tabAccount, &Tab::closed, this, [this] {
tabAccount = nullptr; tabAccount = nullptr;
aTabAccount->setChecked(false); aTabAccount->setChecked(false);
@ -455,10 +508,11 @@ void TabSupervisor::actTabAccount(bool checked)
void TabSupervisor::actTabDeckStorage(bool checked) void TabSupervisor::actTabDeckStorage(bool checked)
{ {
SettingsCache::instance().setTabDeckStorageOpen(checked);
if (checked && !tabDeckStorage) { if (checked && !tabDeckStorage) {
tabDeckStorage = new TabDeckStorage(this, client); tabDeckStorage = new TabDeckStorage(this, client);
connect(tabDeckStorage, &TabDeckStorage::openDeckEditor, this, &TabSupervisor::addDeckEditorTab); connect(tabDeckStorage, &TabDeckStorage::openDeckEditor, this, &TabSupervisor::addDeckEditorTab);
myAddTab(tabDeckStorage); myAddTab(tabDeckStorage, aTabDeckStorage);
connect(tabDeckStorage, &Tab::closed, this, [this] { connect(tabDeckStorage, &Tab::closed, this, [this] {
tabDeckStorage = nullptr; tabDeckStorage = nullptr;
aTabDeckStorage->setChecked(false); aTabDeckStorage->setChecked(false);
@ -470,10 +524,11 @@ void TabSupervisor::actTabDeckStorage(bool checked)
void TabSupervisor::actTabReplays(bool checked) void TabSupervisor::actTabReplays(bool checked)
{ {
SettingsCache::instance().setTabReplaysOpen(checked);
if (checked && !tabReplays) { if (checked && !tabReplays) {
tabReplays = new TabReplays(this, client); tabReplays = new TabReplays(this, client);
connect(tabReplays, &TabReplays::openReplay, this, &TabSupervisor::openReplay); connect(tabReplays, &TabReplays::openReplay, this, &TabSupervisor::openReplay);
myAddTab(tabReplays); myAddTab(tabReplays, aTabReplays);
connect(tabReplays, &Tab::closed, this, [this] { connect(tabReplays, &Tab::closed, this, [this] {
tabReplays = nullptr; tabReplays = nullptr;
aTabReplays->setChecked(false); aTabReplays->setChecked(false);
@ -485,10 +540,11 @@ void TabSupervisor::actTabReplays(bool checked)
void TabSupervisor::actTabAdmin(bool checked) void TabSupervisor::actTabAdmin(bool checked)
{ {
SettingsCache::instance().setTabAdminOpen(checked);
if (checked && !tabAdmin) { if (checked && !tabAdmin) {
tabAdmin = new TabAdmin(this, client, (userInfo->user_level() & ServerInfo_User::IsAdmin)); tabAdmin = new TabAdmin(this, client, (userInfo->user_level() & ServerInfo_User::IsAdmin));
connect(tabAdmin, &TabAdmin::adminLockChanged, this, &TabSupervisor::adminLockChanged); connect(tabAdmin, &TabAdmin::adminLockChanged, this, &TabSupervisor::adminLockChanged);
myAddTab(tabAdmin); myAddTab(tabAdmin, aTabAdmin);
connect(tabAdmin, &Tab::closed, this, [this] { connect(tabAdmin, &Tab::closed, this, [this] {
tabAdmin = nullptr; tabAdmin = nullptr;
aTabAdmin->setChecked(false); aTabAdmin->setChecked(false);
@ -500,9 +556,10 @@ void TabSupervisor::actTabAdmin(bool checked)
void TabSupervisor::actTabLog(bool checked) void TabSupervisor::actTabLog(bool checked)
{ {
SettingsCache::instance().setTabLogOpen(checked);
if (checked && !tabLog) { if (checked && !tabLog) {
tabLog = new TabLog(this, client); tabLog = new TabLog(this, client);
myAddTab(tabLog); myAddTab(tabLog, aTabLog);
connect(tabLog, &Tab::closed, this, [this] { connect(tabLog, &Tab::closed, this, [this] {
tabLog = nullptr; tabLog = nullptr;
aTabAdmin->setChecked(false); aTabAdmin->setChecked(false);
@ -522,15 +579,6 @@ void TabSupervisor::updatePingTime(int value, int max)
setTabIcon(indexOf(tabServer), QIcon(PingPixmapGenerator::generatePixmap(15, value, max))); setTabIcon(indexOf(tabServer), QIcon(PingPixmapGenerator::generatePixmap(15, value, max)));
} }
void TabSupervisor::addCloseButtonToTab(Tab *tab, int tabIndex)
{
auto closeSide = static_cast<QTabBar::ButtonPosition>(
tabBar()->style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, tabBar()));
auto *closeButton = new CloseButton(tab);
connect(closeButton, &CloseButton::clicked, tab, [tab] { tab->closeRequest(); });
tabBar()->setTabButton(tabIndex, closeSide, closeButton);
}
void TabSupervisor::gameJoined(const Event_GameJoined &event) void TabSupervisor::gameJoined(const Event_GameJoined &event)
{ {
QMap<int, QString> roomGameTypes; QMap<int, QString> roomGameTypes;

View file

@ -89,8 +89,10 @@ private:
QAction *aTabDeckEditor, *aTabVisualDeckStorage, *aTabServer, *aTabAccount, *aTabDeckStorage, *aTabReplays, QAction *aTabDeckEditor, *aTabVisualDeckStorage, *aTabServer, *aTabAccount, *aTabDeckStorage, *aTabReplays,
*aTabAdmin, *aTabLog; *aTabAdmin, *aTabLog;
int myAddTab(Tab *tab); void initStartupTabs();
void addCloseButtonToTab(Tab *tab, int tabIndex);
int myAddTab(Tab *tab, QAction *manager = nullptr);
void addCloseButtonToTab(Tab *tab, int tabIndex, QAction *manager);
QString sanitizeTabName(QString dirty) const; QString sanitizeTabName(QString dirty) const;
QString sanitizeHtml(QString dirty) const; QString sanitizeHtml(QString dirty) const;
void resetTabsMenu(); void resetTabsMenu();

View file

@ -346,10 +346,6 @@ AppearanceSettingsPage::AppearanceSettingsPage()
showShortcutsCheckBox.setChecked(settings.getShowShortcuts()); showShortcutsCheckBox.setChecked(settings.getShowShortcuts());
connect(&showShortcutsCheckBox, &QCheckBox::QT_STATE_CHANGED, this, &AppearanceSettingsPage::showShortcutsChanged); connect(&showShortcutsCheckBox, &QCheckBox::QT_STATE_CHANGED, this, &AppearanceSettingsPage::showShortcutsChanged);
showVisualDeckStorageOnLoadCheckBox.setChecked(settings.getVisualDeckStorageShowOnLoad());
connect(&showVisualDeckStorageOnLoadCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
&SettingsCache::setVisualDeckStorageShowOnLoad);
visualDeckStorageDrawUnusedColorIdentitiesCheckBox.setChecked( visualDeckStorageDrawUnusedColorIdentitiesCheckBox.setChecked(
settings.getVisualDeckStorageDrawUnusedColorIdentities()); settings.getVisualDeckStorageDrawUnusedColorIdentities());
connect(&visualDeckStorageDrawUnusedColorIdentitiesCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings, connect(&visualDeckStorageDrawUnusedColorIdentitiesCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
@ -366,10 +362,9 @@ AppearanceSettingsPage::AppearanceSettingsPage()
auto *menuGrid = new QGridLayout; auto *menuGrid = new QGridLayout;
menuGrid->addWidget(&showShortcutsCheckBox, 0, 0); menuGrid->addWidget(&showShortcutsCheckBox, 0, 0);
menuGrid->addWidget(&showVisualDeckStorageOnLoadCheckBox, 1, 0); menuGrid->addWidget(&visualDeckStorageDrawUnusedColorIdentitiesCheckBox, 1, 0);
menuGrid->addWidget(&visualDeckStorageDrawUnusedColorIdentitiesCheckBox, 2, 0); menuGrid->addWidget(&visualDeckStorageUnusedColorIdentitiesOpacityLabel, 2, 0);
menuGrid->addWidget(&visualDeckStorageUnusedColorIdentitiesOpacityLabel, 3, 0); menuGrid->addWidget(&visualDeckStorageUnusedColorIdentitiesOpacitySpinBox, 2, 1);
menuGrid->addWidget(&visualDeckStorageUnusedColorIdentitiesOpacitySpinBox, 3, 1);
menuGroupBox = new QGroupBox; menuGroupBox = new QGroupBox;
menuGroupBox->setLayout(menuGrid); menuGroupBox->setLayout(menuGrid);
@ -504,7 +499,6 @@ void AppearanceSettingsPage::retranslateUi()
menuGroupBox->setTitle(tr("Menu settings")); menuGroupBox->setTitle(tr("Menu settings"));
showShortcutsCheckBox.setText(tr("Show keyboard shortcuts in right-click menus")); showShortcutsCheckBox.setText(tr("Show keyboard shortcuts in right-click menus"));
showVisualDeckStorageOnLoadCheckBox.setText(tr("Show visual deck storage on database load"));
visualDeckStorageDrawUnusedColorIdentitiesCheckBox.setText( visualDeckStorageDrawUnusedColorIdentitiesCheckBox.setText(
tr("Draw missing color identities in visual deck storage without color label")); tr("Draw missing color identities in visual deck storage without color label"));
visualDeckStorageUnusedColorIdentitiesOpacityLabel.setText(tr("Missing color identity opacity")); visualDeckStorageUnusedColorIdentitiesOpacityLabel.setText(tr("Missing color identity opacity"));

View file

@ -95,7 +95,6 @@ private:
QLabel minPlayersForMultiColumnLayoutLabel; QLabel minPlayersForMultiColumnLayoutLabel;
QLabel maxFontSizeForCardsLabel; QLabel maxFontSizeForCardsLabel;
QCheckBox showShortcutsCheckBox; QCheckBox showShortcutsCheckBox;
QCheckBox showVisualDeckStorageOnLoadCheckBox;
QCheckBox visualDeckStorageDrawUnusedColorIdentitiesCheckBox; QCheckBox visualDeckStorageDrawUnusedColorIdentitiesCheckBox;
QLabel visualDeckStorageUnusedColorIdentitiesOpacityLabel; QLabel visualDeckStorageUnusedColorIdentitiesOpacityLabel;
QSpinBox visualDeckStorageUnusedColorIdentitiesOpacitySpinBox; QSpinBox visualDeckStorageUnusedColorIdentitiesOpacitySpinBox;

View file

@ -212,6 +212,14 @@ SettingsCache::SettingsCache()
themeName = settings->value("theme/name").toString(); 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 // we only want to reset the cache once, then its up to the user
bool updateCache = settings->value("revert/pixmapCacheSize", false).toBool(); bool updateCache = settings->value("revert/pixmapCacheSize", false).toBool();
if (!updateCache) { if (!updateCache) {
@ -260,7 +268,6 @@ SettingsCache::SettingsCache()
printingSelectorNavigationButtonsVisible = printingSelectorNavigationButtonsVisible =
settings->value("cards/printingselectornavigationbuttonsvisible", true).toBool(); settings->value("cards/printingselectornavigationbuttonsvisible", true).toBool();
visualDeckStorageCardSize = settings->value("cards/visualdeckstoragecardsize", 100).toInt(); visualDeckStorageCardSize = settings->value("cards/visualdeckstoragecardsize", 100).toInt();
visualDeckStorageShowOnLoad = settings->value("interface/visualdeckstorageshowonload", true).toBool();
visualDeckStorageSortingOrder = settings->value("interface/visualdeckstoragesortingorder", 0).toInt(); visualDeckStorageSortingOrder = settings->value("interface/visualdeckstoragesortingorder", 0).toInt();
visualDeckStorageDrawUnusedColorIdentities = visualDeckStorageDrawUnusedColorIdentities =
settings->value("interface/visualdeckstoragedrawunusedcoloridentities", true).toBool(); settings->value("interface/visualdeckstoragedrawunusedcoloridentities", true).toBool();
@ -486,6 +493,48 @@ void SettingsCache::setThemeName(const QString &_themeName)
emit themeChanged(); 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) void SettingsCache::setPicDownload(QT_STATE_CHANGED_T _picDownload)
{ {
picDownload = static_cast<bool>(_picDownload); picDownload = static_cast<bool>(_picDownload);
@ -629,12 +678,6 @@ void SettingsCache::setVisualDeckStorageCardSize(int _visualDeckStorageCardSize)
emit visualDeckStorageCardSizeChanged(); emit visualDeckStorageCardSizeChanged();
} }
void SettingsCache::setVisualDeckStorageShowOnLoad(QT_STATE_CHANGED_T _visualDeckStorageShowOnLoad)
{
visualDeckStorageShowOnLoad = _visualDeckStorageShowOnLoad;
settings->setValue("interface/visualdeckstorageshowonload", visualDeckStorageShowOnLoad);
}
void SettingsCache::setVisualDeckStorageDrawUnusedColorIdentities( void SettingsCache::setVisualDeckStorageDrawUnusedColorIdentities(
QT_STATE_CHANGED_T _visualDeckStorageDrawUnusedColorIdentities) QT_STATE_CHANGED_T _visualDeckStorageDrawUnusedColorIdentities)
{ {

View file

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

View file

@ -124,6 +124,27 @@ void SettingsCache::setTokenDatabasePath(const QString & /* _tokenDatabasePath *
void SettingsCache::setThemeName(const QString & /* _themeName */) void SettingsCache::setThemeName(const QString & /* _themeName */)
{ {
} }
void SettingsCache::setTabVisualDeckStorageOpen(bool /*value*/)
{
}
void SettingsCache::setTabServerOpen(bool /*value*/)
{
}
void SettingsCache::setTabAccountOpen(bool /*value*/)
{
}
void SettingsCache::setTabDeckStorageOpen(bool /*value*/)
{
}
void SettingsCache::setTabReplaysOpen(bool /*value*/)
{
}
void SettingsCache::setTabAdminOpen(bool /*value*/)
{
}
void SettingsCache::setTabLogOpen(bool /*value*/)
{
}
void SettingsCache::setPicDownload(QT_STATE_CHANGED_T /* _picDownload */) void SettingsCache::setPicDownload(QT_STATE_CHANGED_T /* _picDownload */)
{ {
} }
@ -190,9 +211,6 @@ void SettingsCache::setVisualDeckStorageSortingOrder(int /* _visualDeckStorageSo
void SettingsCache::setVisualDeckStorageCardSize(int /* _visualDeckStorageCardSize */) void SettingsCache::setVisualDeckStorageCardSize(int /* _visualDeckStorageCardSize */)
{ {
} }
void SettingsCache::setVisualDeckStorageShowOnLoad(QT_STATE_CHANGED_T /* _visualDeckStorageShowOnLoad */)
{
}
void SettingsCache::setVisualDeckStorageDrawUnusedColorIdentities( void SettingsCache::setVisualDeckStorageDrawUnusedColorIdentities(
QT_STATE_CHANGED_T /* _visualDeckStorageDrawUnusedColorIdentities */) QT_STATE_CHANGED_T /* _visualDeckStorageDrawUnusedColorIdentities */)
{ {

View file

@ -128,6 +128,27 @@ void SettingsCache::setTokenDatabasePath(const QString & /* _tokenDatabasePath *
void SettingsCache::setThemeName(const QString & /* _themeName */) void SettingsCache::setThemeName(const QString & /* _themeName */)
{ {
} }
void SettingsCache::setTabVisualDeckStorageOpen(bool /*value*/)
{
}
void SettingsCache::setTabServerOpen(bool /*value*/)
{
}
void SettingsCache::setTabAccountOpen(bool /*value*/)
{
}
void SettingsCache::setTabDeckStorageOpen(bool /*value*/)
{
}
void SettingsCache::setTabReplaysOpen(bool /*value*/)
{
}
void SettingsCache::setTabAdminOpen(bool /*value*/)
{
}
void SettingsCache::setTabLogOpen(bool /*value*/)
{
}
void SettingsCache::setPicDownload(QT_STATE_CHANGED_T /* _picDownload */) void SettingsCache::setPicDownload(QT_STATE_CHANGED_T /* _picDownload */)
{ {
} }
@ -194,9 +215,6 @@ void SettingsCache::setVisualDeckStorageSortingOrder(int /* _visualDeckStorageSo
void SettingsCache::setVisualDeckStorageCardSize(int /* _visualDeckStorageCardSize */) void SettingsCache::setVisualDeckStorageCardSize(int /* _visualDeckStorageCardSize */)
{ {
} }
void SettingsCache::setVisualDeckStorageShowOnLoad(QT_STATE_CHANGED_T /* _visualDeckStorageShowOnLoad */)
{
}
void SettingsCache::setVisualDeckStorageDrawUnusedColorIdentities( void SettingsCache::setVisualDeckStorageDrawUnusedColorIdentities(
QT_STATE_CHANGED_T /* _visualDeckStorageDrawUnusedColorIdentities */) QT_STATE_CHANGED_T /* _visualDeckStorageDrawUnusedColorIdentities */)
{ {