From 088ead7522e06c3ee86e3aae2a5fbcf319d92ebb Mon Sep 17 00:00:00 2001 From: RickyRister Date: Sat, 11 Jan 2025 23:46:25 -0800 Subject: [PATCH] pass tabsMenu into ctor --- cockatrice/src/client/tabs/tab_supervisor.cpp | 6 +++--- cockatrice/src/client/tabs/tab_supervisor.h | 3 ++- cockatrice/src/client/ui/window_main.cpp | 6 +++++- cockatrice/src/client/ui/window_main.h | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/cockatrice/src/client/tabs/tab_supervisor.cpp b/cockatrice/src/client/tabs/tab_supervisor.cpp index 145ff5857..271f8bab7 100644 --- a/cockatrice/src/client/tabs/tab_supervisor.cpp +++ b/cockatrice/src/client/tabs/tab_supervisor.cpp @@ -100,9 +100,9 @@ void CloseButton::paintEvent(QPaintEvent * /*event*/) style()->drawPrimitive(QStyle::PE_IndicatorTabClose, &opt, &p, this); } -TabSupervisor::TabSupervisor(AbstractClient *_client, QWidget *parent) - : QTabWidget(parent), userInfo(0), client(_client), tabServer(0), tabUserLists(0), tabDeckStorage(0), tabReplays(0), - tabAdmin(0), tabLog(0) +TabSupervisor::TabSupervisor(AbstractClient *_client, QMenu *tabsMenu, QWidget *parent) + : QTabWidget(parent), userInfo(0), client(_client), tabsMenu(tabsMenu), tabServer(0), tabUserLists(0), + tabDeckStorage(0), tabReplays(0), tabAdmin(0), tabLog(0) { setElideMode(Qt::ElideRight); setMovable(true); diff --git a/cockatrice/src/client/tabs/tab_supervisor.h b/cockatrice/src/client/tabs/tab_supervisor.h index 8b5b79c47..577cdf69d 100644 --- a/cockatrice/src/client/tabs/tab_supervisor.h +++ b/cockatrice/src/client/tabs/tab_supervisor.h @@ -69,6 +69,7 @@ private: ServerInfo_User *userInfo; AbstractClient *client; QList localClients; + QMenu *tabsMenu; TabServer *tabServer; TabUserLists *tabUserLists; TabDeckStorage *tabDeckStorage; @@ -87,7 +88,7 @@ private: bool isLocalGame; public: - explicit TabSupervisor(AbstractClient *_client, QWidget *parent = nullptr); + explicit TabSupervisor(AbstractClient *_client, QMenu *tabsMenu, QWidget *parent = nullptr); ~TabSupervisor() override; void retranslateUi(); void start(const ServerInfo_User &userInfo); diff --git a/cockatrice/src/client/ui/window_main.cpp b/cockatrice/src/client/ui/window_main.cpp index 154568bd0..11427696f 100644 --- a/cockatrice/src/client/ui/window_main.cpp +++ b/cockatrice/src/client/ui/window_main.cpp @@ -692,6 +692,8 @@ void MainWindow::retranslateUi() aAddCustomSet->setText(tr("Add custom sets/cards")); aReloadCardDatabase->setText(tr("Reload card database")); + tabsMenu->setTitle(tr("Tabs")); + helpMenu->setTitle(tr("&Help")); aAbout->setText(tr("&About Cockatrice")); aTips->setText(tr("&Tip of the Day")); @@ -824,6 +826,8 @@ void MainWindow::createMenus() dbMenu->addSeparator(); dbMenu->addAction(aReloadCardDatabase); + tabsMenu = menuBar()->addMenu(QString()); + helpMenu = menuBar()->addMenu(QString()); helpMenu->addAction(aAbout); helpMenu->addAction(aTips); @@ -871,7 +875,7 @@ MainWindow::MainWindow(QWidget *parent) createActions(); createMenus(); - tabSupervisor = new TabSupervisor(client, this); + tabSupervisor = new TabSupervisor(client, tabsMenu, this); connect(tabSupervisor, &TabSupervisor::setMenu, this, &MainWindow::updateTabMenu); connect(tabSupervisor, &TabSupervisor::localGameEnded, this, &MainWindow::localGameEnded); connect(tabSupervisor, &TabSupervisor::showWindowIfHidden, this, &MainWindow::showWindowIfHidden); diff --git a/cockatrice/src/client/ui/window_main.h b/cockatrice/src/client/ui/window_main.h index 4efed7fd5..3da79ac28 100644 --- a/cockatrice/src/client/ui/window_main.h +++ b/cockatrice/src/client/ui/window_main.h @@ -131,7 +131,7 @@ private: void startLocalGame(int numberPlayers); QList tabMenus; - QMenu *cockatriceMenu, *dbMenu, *helpMenu, *trayIconMenu; + QMenu *cockatriceMenu, *dbMenu, *tabsMenu, *helpMenu, *trayIconMenu; QAction *aConnect, *aDisconnect, *aSinglePlayer, *aWatchReplay, *aDeckEditor, *aVisualDeckStorage, *aFullScreen, *aSettings, *aExit, *aAbout, *aTips, *aCheckCardUpdates, *aRegister, *aForgotPassword, *aUpdate, *aViewLog, *aManageSets, *aEditTokens, *aOpenCustomFolder, *aOpenCustomsetsFolder, *aAddCustomSet, *aReloadCardDatabase,