From 3414eb12cfe074fb8345a092f9479c0100a48ed3 Mon Sep 17 00:00:00 2001 From: RickyRister Date: Wed, 14 May 2025 00:31:31 -0700 Subject: [PATCH] inline layouts --- cockatrice/src/client/tabs/tab_game.cpp | 25 +++++++++++++------------ cockatrice/src/client/tabs/tab_game.h | 3 +-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cockatrice/src/client/tabs/tab_game.cpp b/cockatrice/src/client/tabs/tab_game.cpp index 999b5b164..515f0e6ae 100644 --- a/cockatrice/src/client/tabs/tab_game.cpp +++ b/cockatrice/src/client/tabs/tab_game.cpp @@ -1538,7 +1538,7 @@ void TabGame::createPlayAreaWidget(bool bReplay) scene = new GameScene(phasesToolbar, this); gameView = new GameView(scene); - gamePlayAreaVBox = new QVBoxLayout; + auto gamePlayAreaVBox = new QVBoxLayout; gamePlayAreaVBox->setContentsMargins(0, 0, 0, 0); gamePlayAreaVBox->addWidget(gameView); @@ -1594,7 +1594,7 @@ void TabGame::createReplayDock() connect(replayFastForwardButton, &QToolButton::toggled, this, &TabGame::replayFastForwardButtonToggled); // putting everything together - replayControlLayout = new QHBoxLayout; + auto replayControlLayout = new QHBoxLayout; replayControlLayout->addWidget(timelineWidget, 10); replayControlLayout->addWidget(replayPlayButton); replayControlLayout->addWidget(replayFastForwardButton); @@ -1635,8 +1635,8 @@ void TabGame::createCardInfoDock(bool bReplay) Q_UNUSED(bReplay); cardInfoFrameWidget = new CardInfoFrameWidget(); - cardHInfoLayout = new QHBoxLayout; - cardVInfoLayout = new QVBoxLayout; + auto cardHInfoLayout = new QHBoxLayout; + auto cardVInfoLayout = new QVBoxLayout; cardVInfoLayout->setContentsMargins(0, 0, 0, 0); cardVInfoLayout->addWidget(cardInfoFrameWidget); cardVInfoLayout->addLayout(cardHInfoLayout); @@ -1679,12 +1679,17 @@ void TabGame::createPlayerListDock(bool bReplay) void TabGame::createMessageDock(bool bReplay) { + auto messageLogLayout = new QVBoxLayout; + messageLogLayout->setContentsMargins(0, 0, 0, 0); + messageLog = new MessageLogWidget(tabSupervisor, this); connect(messageLog, &MessageLogWidget::cardNameHovered, cardInfoFrameWidget, qOverload(&CardInfoFrameWidget::setCard)); connect(messageLog, &MessageLogWidget::showCardInfoPopup, this, &TabGame::showCardInfoPopup); connect(messageLog, &MessageLogWidget::deleteCardInfoPopup, this, &TabGame::deleteCardInfoPopup); + messageLogLayout->addWidget(messageLog); + if (!bReplay) { connect(messageLog, &MessageLogWidget::openMessageDialog, this, &TabGame::openMessageDialog); connect(messageLog, &MessageLogWidget::addMentionTag, this, &TabGame::addMentionTag); @@ -1698,6 +1703,8 @@ void TabGame::createMessageDock(bool bReplay) connect(gameTimer, &QTimer::timeout, this, &TabGame::incrementGameTime); gameTimer->start(); + messageLogLayout->addWidget(timeElapsedLabel); + sayLabel = new QLabel; sayEdit = new LineEditCompleter; sayEdit->setMaxLength(MAX_TEXT_LENGTH); @@ -1726,18 +1733,12 @@ void TabGame::createMessageDock(bool bReplay) connect(tabSupervisor, &TabSupervisor::adminLockChanged, this, &TabGame::adminLockChanged); connect(sayEdit, &LineEditCompleter::returnPressed, this, &TabGame::actSay); - sayHLayout = new QHBoxLayout; + auto sayHLayout = new QHBoxLayout; sayHLayout->addWidget(sayLabel); sayHLayout->addWidget(sayEdit); - } - messageLogLayout = new QVBoxLayout; - messageLogLayout->setContentsMargins(0, 0, 0, 0); - if (!bReplay) - messageLogLayout->addWidget(timeElapsedLabel); - messageLogLayout->addWidget(messageLog); - if (!bReplay) messageLogLayout->addLayout(sayHLayout); + } messageLogLayoutWidget = new QWidget; messageLogLayoutWidget->setLayout(messageLogLayout); diff --git a/cockatrice/src/client/tabs/tab_game.h b/cockatrice/src/client/tabs/tab_game.h index 096998728..2d0dfc83e 100644 --- a/cockatrice/src/client/tabs/tab_game.h +++ b/cockatrice/src/client/tabs/tab_game.h @@ -111,8 +111,7 @@ private: GameScene *scene; GameView *gameView; QMap deckViewContainers; - QVBoxLayout *cardVInfoLayout, *messageLogLayout, *gamePlayAreaVBox, *deckViewContainerLayout; - QHBoxLayout *cardHInfoLayout, *sayHLayout, *mainHLayout, *replayControlLayout; + QVBoxLayout *deckViewContainerLayout; QWidget *cardBoxLayoutWidget, *messageLogLayoutWidget, *gamePlayAreaWidget, *deckViewContainerWidget, *replayControlWidget; QDockWidget *cardInfoDock, *messageLayoutDock, *playerListDock, *replayDock;