pass tabsMenu into ctor

This commit is contained in:
RickyRister 2025-01-11 23:46:25 -08:00
parent 51ecb35fde
commit 088ead7522
4 changed files with 11 additions and 6 deletions

View file

@ -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);

View file

@ -69,6 +69,7 @@ private:
ServerInfo_User *userInfo;
AbstractClient *client;
QList<AbstractClient *> 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);

View file

@ -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);

View file

@ -131,7 +131,7 @@ private:
void startLocalGame(int numberPlayers);
QList<QMenu *> 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,