mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-22 17:45:09 -07:00
[Tabs] Add a setting to define startup tab on application launch (#7121)
* [Tabs] Add a setting to define startup tab on application launch. Took 29 minutes * Naming and sizing Took 4 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
fbe5c4ade0
commit
16b6132701
14 changed files with 599 additions and 3 deletions
|
|
@ -114,6 +114,10 @@ public:
|
|||
{
|
||||
return roomId;
|
||||
}
|
||||
[[nodiscard]] QString getRoomName() const
|
||||
{
|
||||
return roomName;
|
||||
}
|
||||
[[nodiscard]] const QMap<int, QString> &getGameTypes() const
|
||||
{
|
||||
return gameTypes;
|
||||
|
|
|
|||
|
|
@ -335,7 +335,12 @@ static void checkAndTrigger(QAction *checkableAction, bool checked)
|
|||
}
|
||||
|
||||
/**
|
||||
* Opens the always-available tabs, depending on settings.
|
||||
* Opens the always-available tabs, depending on settings, and lands on the configured startup tab.
|
||||
*
|
||||
* The startup destination is a request: tabs that were not open before (deck editors, storage
|
||||
* tabs disabled in the Tabs menu) are opened as part of the startup flow. Destinations that
|
||||
* require a server connection (Server, Server Room) are handled asynchronously by MainWindow
|
||||
* through the intent system, since this class has no RemoteClient.
|
||||
*/
|
||||
void TabSupervisor::initStartupTabs()
|
||||
{
|
||||
|
|
@ -351,6 +356,42 @@ void TabSupervisor::initStartupTabs()
|
|||
if (SettingsCache::instance().tabs().getTabReplaysOpen()) {
|
||||
openTabReplays();
|
||||
}
|
||||
|
||||
switch (SettingsCache::instance().tabs().getStartupTabIndex()) {
|
||||
case StartupTab::StartupTabVisualDeckStorage:
|
||||
if (!tabVisualDeckStorage) {
|
||||
openTabVisualDeckStorage();
|
||||
}
|
||||
setCurrentWidget(tabVisualDeckStorage);
|
||||
break;
|
||||
case StartupTab::StartupTabDeckStorage:
|
||||
if (!tabDeckStorage) {
|
||||
openTabDeckStorage();
|
||||
}
|
||||
setCurrentWidget(tabDeckStorage);
|
||||
break;
|
||||
case StartupTab::StartupTabReplays:
|
||||
if (!tabReplays) {
|
||||
openTabReplays();
|
||||
}
|
||||
setCurrentWidget(tabReplays);
|
||||
break;
|
||||
case StartupTab::StartupTabDeckEditor:
|
||||
addDeckEditorTab(LoadedDeck());
|
||||
break;
|
||||
case StartupTab::StartupTabVisualDeckEditor:
|
||||
addVisualDeckEditorTab(LoadedDeck());
|
||||
break;
|
||||
case StartupTab::StartupTabServer:
|
||||
case StartupTab::StartupTabServerRoom:
|
||||
// Handled asynchronously by MainWindow::applyStartupDestination(); Home stays selected
|
||||
// until the server connection succeeds.
|
||||
break;
|
||||
case StartupTab::StartupTabHome:
|
||||
default:
|
||||
setCurrentWidget(tabHome);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -184,6 +184,7 @@ public slots:
|
|||
void actTabVisualDeckStorage(bool checked);
|
||||
void actTabReplays(bool checked);
|
||||
void openTabServer();
|
||||
void addRoomTab(const ServerInfo_Room &info, bool setCurrent);
|
||||
private slots:
|
||||
void refreshShortcuts();
|
||||
|
||||
|
|
@ -209,7 +210,6 @@ private slots:
|
|||
void gameJoined(const Event_GameJoined &event);
|
||||
void localGameJoined(const Event_GameJoined &event);
|
||||
void gameLeft(TabGame *tab);
|
||||
void addRoomTab(const ServerInfo_Room &info, bool setCurrent);
|
||||
void roomLeft(TabRoom *tab);
|
||||
TabMessage *addMessageTab(const QString &userName, bool focus);
|
||||
void replayLeft(TabGame *tab);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue