mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-09 15:54:47 -07:00
Dockified the game & replay review areas
This commit is contained in:
parent
924bbb2245
commit
f57e0454bb
19 changed files with 988 additions and 445 deletions
|
|
@ -9,7 +9,9 @@
|
|||
#include <QToolButton>
|
||||
#include <QDebug>
|
||||
#include <QCompleter>
|
||||
#include <QDockWidget>
|
||||
#include <QWidget>
|
||||
#include <QStackedWidget>
|
||||
|
||||
#include "dlg_creategame.h"
|
||||
#include "tab_game.h"
|
||||
|
|
@ -35,6 +37,7 @@
|
|||
#include "pictureloader.h"
|
||||
#include "replay_timeline_widget.h"
|
||||
#include "lineeditcompleter.h"
|
||||
#include "window_sets.h"
|
||||
|
||||
#include <google/protobuf/descriptor.h>
|
||||
#include "pending_command.h"
|
||||
|
|
@ -93,7 +96,7 @@ void ToggleButton::setState(bool _state)
|
|||
}
|
||||
|
||||
DeckViewContainer::DeckViewContainer(int _playerId, TabGame *parent)
|
||||
: QWidget(parent), playerId(_playerId)
|
||||
: QWidget(0), parentGame(parent), playerId(_playerId)
|
||||
{
|
||||
loadLocalButton = new QPushButton;
|
||||
loadRemoteButton = new QPushButton;
|
||||
|
|
@ -202,6 +205,9 @@ void TabGame::refreshShortcuts()
|
|||
if (aCloseReplay) {
|
||||
aCloseReplay->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aCloseReplay"));
|
||||
}
|
||||
if (aResetLayout) {
|
||||
aResetLayout->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aResetLayout"));
|
||||
}
|
||||
}
|
||||
|
||||
void DeckViewContainer::loadLocalDeck()
|
||||
|
|
@ -222,20 +228,20 @@ void DeckViewContainer::loadLocalDeck()
|
|||
|
||||
Command_DeckSelect cmd;
|
||||
cmd.set_deck(deck.writeToString_Native().toStdString());
|
||||
PendingCommand *pend = static_cast<TabGame *>(parent())->prepareGameCommand(cmd);
|
||||
PendingCommand *pend = parentGame->prepareGameCommand(cmd);
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(deckSelectFinished(const Response &)));
|
||||
static_cast<TabGame *>(parent())->sendGameCommand(pend, playerId);
|
||||
parentGame->sendGameCommand(pend, playerId);
|
||||
}
|
||||
|
||||
void DeckViewContainer::loadRemoteDeck()
|
||||
{
|
||||
DlgLoadRemoteDeck dlg(static_cast<TabGame *>(parent())->getClientForPlayer(playerId));
|
||||
DlgLoadRemoteDeck dlg(parentGame->getClientForPlayer(playerId));
|
||||
if (dlg.exec()) {
|
||||
Command_DeckSelect cmd;
|
||||
cmd.set_deck_id(dlg.getDeckId());
|
||||
PendingCommand *pend = static_cast<TabGame *>(parent())->prepareGameCommand(cmd);
|
||||
PendingCommand *pend = parentGame->prepareGameCommand(cmd);
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(deckSelectFinished(const Response &)));
|
||||
static_cast<TabGame *>(parent())->sendGameCommand(pend, playerId);
|
||||
parentGame->sendGameCommand(pend, playerId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -251,7 +257,7 @@ void DeckViewContainer::readyStart()
|
|||
{
|
||||
Command_ReadyStart cmd;
|
||||
cmd.set_ready(!readyStartButton->getState());
|
||||
static_cast<TabGame *>(parent())->sendGameCommand(cmd, playerId);
|
||||
parentGame->sendGameCommand(cmd, playerId);
|
||||
}
|
||||
|
||||
void DeckViewContainer::sideboardLockButtonClicked()
|
||||
|
|
@ -259,7 +265,7 @@ void DeckViewContainer::sideboardLockButtonClicked()
|
|||
Command_SetSideboardLock cmd;
|
||||
cmd.set_locked(sideboardLockButton->getState());
|
||||
|
||||
static_cast<TabGame *>(parent())->sendGameCommand(cmd, playerId);
|
||||
parentGame->sendGameCommand(cmd, playerId);
|
||||
}
|
||||
|
||||
void DeckViewContainer::sideboardPlanChanged()
|
||||
|
|
@ -268,7 +274,7 @@ void DeckViewContainer::sideboardPlanChanged()
|
|||
const QList<MoveCard_ToZone> &newPlan = deckView->getSideboardPlan();
|
||||
for (int i = 0; i < newPlan.size(); ++i)
|
||||
cmd.add_move_list()->CopyFrom(newPlan[i]);
|
||||
static_cast<TabGame *>(parent())->sendGameCommand(cmd, playerId);
|
||||
parentGame->sendGameCommand(cmd, playerId);
|
||||
}
|
||||
|
||||
void DeckViewContainer::setReadyStart(bool ready)
|
||||
|
|
@ -310,11 +316,10 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, GameReplay *_replay)
|
|||
sayLabel(0),
|
||||
sayEdit(0)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
// THIS CTOR IS USED ON REPLAY
|
||||
gameInfo.CopyFrom(replay->game_info());
|
||||
gameInfo.set_spectators_omniscient(true);
|
||||
|
||||
|
||||
// Create list: event number -> time [ms]
|
||||
// Distribute simultaneous events evenly across 1 second.
|
||||
unsigned int lastEventTimestamp = 0;
|
||||
|
|
@ -323,106 +328,41 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, GameReplay *_replay)
|
|||
int j = i + 1;
|
||||
while ((j < eventCount) && (replay->event_list(j).seconds_elapsed() == lastEventTimestamp))
|
||||
++j;
|
||||
|
||||
|
||||
const int numberEventsThisSecond = j - i;
|
||||
for (int k = 0; k < numberEventsThisSecond; ++k)
|
||||
replayTimeline.append(replay->event_list(i + k).seconds_elapsed() * 1000 + (int) ((qreal) k / (qreal) numberEventsThisSecond * 1000));
|
||||
|
||||
|
||||
if (j < eventCount)
|
||||
lastEventTimestamp = replay->event_list(j).seconds_elapsed();
|
||||
i += numberEventsThisSecond - 1;
|
||||
}
|
||||
|
||||
phasesToolbar = new PhasesToolbar;
|
||||
|
||||
scene = new GameScene(phasesToolbar, this);
|
||||
gameView = new GameView(scene);
|
||||
gameView->hide();
|
||||
|
||||
cardInfo = new CardFrame();
|
||||
playerListWidget = new PlayerListWidget(0, 0, this);
|
||||
playerListWidget->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
messageLog = new MessageLogWidget(tabSupervisor, this);
|
||||
connect(messageLog, SIGNAL(cardNameHovered(QString)), cardInfo, SLOT(setCard(QString)));
|
||||
connect(messageLog, SIGNAL(showCardInfoPopup(QPoint, QString)), this, SLOT(showCardInfoPopup(QPoint, QString)));
|
||||
connect(messageLog, SIGNAL(deleteCardInfoPopup(QString)), this, SLOT(deleteCardInfoPopup(QString)));
|
||||
|
||||
deckViewContainerLayout = new QVBoxLayout;
|
||||
createCardInfoDock(true);
|
||||
createPlayerListDock(true);
|
||||
createMessageDock(true);
|
||||
createPlayAreaWidget(true);
|
||||
createDeckViewContainerWidget(true);
|
||||
createReplayDock();
|
||||
|
||||
QVBoxLayout *messageLogLayout = new QVBoxLayout;
|
||||
messageLogLayout->setContentsMargins(0, 0, 0, 0);
|
||||
messageLogLayout->addWidget(messageLog);
|
||||
|
||||
QWidget *messageLogLayoutWidget = new QWidget;
|
||||
messageLogLayoutWidget->setLayout(messageLogLayout);
|
||||
|
||||
timelineWidget = new ReplayTimelineWidget;
|
||||
timelineWidget->setTimeline(replayTimeline);
|
||||
connect(timelineWidget, SIGNAL(processNextEvent()), this, SLOT(replayNextEvent()));
|
||||
connect(timelineWidget, SIGNAL(replayFinished()), this, SLOT(replayFinished()));
|
||||
|
||||
replayStartButton = new QToolButton;
|
||||
replayStartButton->setIconSize(QSize(32, 32));
|
||||
replayStartButton->setIcon(QPixmap("theme:replay/start"));
|
||||
connect(replayStartButton, SIGNAL(clicked()), this, SLOT(replayStartButtonClicked()));
|
||||
replayPauseButton = new QToolButton;
|
||||
replayPauseButton->setIconSize(QSize(32, 32));
|
||||
replayPauseButton->setEnabled(false);
|
||||
replayPauseButton->setIcon(QPixmap("theme:replay/pause"));
|
||||
connect(replayPauseButton, SIGNAL(clicked()), this, SLOT(replayPauseButtonClicked()));
|
||||
replayFastForwardButton = new QToolButton;
|
||||
replayFastForwardButton->setIconSize(QSize(32, 32));
|
||||
replayFastForwardButton->setEnabled(false);
|
||||
replayFastForwardButton->setIcon(QPixmap("theme:replay/fastforward"));
|
||||
replayFastForwardButton->setCheckable(true);
|
||||
connect(replayFastForwardButton, SIGNAL(toggled(bool)), this, SLOT(replayFastForwardButtonToggled(bool)));
|
||||
|
||||
splitter = new QSplitter(Qt::Vertical);
|
||||
splitter->addWidget(cardInfo);
|
||||
splitter->addWidget(playerListWidget);
|
||||
splitter->addWidget(messageLogLayoutWidget);
|
||||
addDockWidget(Qt::RightDockWidgetArea, cardInfoDock);
|
||||
addDockWidget(Qt::RightDockWidgetArea, playerListDock);
|
||||
addDockWidget(Qt::RightDockWidgetArea, messageLayoutDock);
|
||||
addDockWidget(Qt::BottomDockWidgetArea, replayDock);
|
||||
|
||||
mainLayout = new QHBoxLayout;
|
||||
mainLayout->addWidget(gameView, 10);
|
||||
mainLayout->addLayout(deckViewContainerLayout, 10);
|
||||
mainLayout->addWidget(splitter);
|
||||
|
||||
QHBoxLayout *replayControlLayout = new QHBoxLayout;
|
||||
replayControlLayout->addWidget(timelineWidget, 10);
|
||||
replayControlLayout->addWidget(replayStartButton);
|
||||
replayControlLayout->addWidget(replayPauseButton);
|
||||
replayControlLayout->addWidget(replayFastForwardButton);
|
||||
|
||||
QVBoxLayout *superMainLayout = new QVBoxLayout;
|
||||
superMainLayout->addLayout(mainLayout);
|
||||
superMainLayout->addLayout(replayControlLayout);
|
||||
|
||||
aNextPhase = 0;
|
||||
aNextTurn = 0;
|
||||
aRemoveLocalArrows = 0;
|
||||
aRotateViewCW = 0;
|
||||
aRotateViewCCW = 0;
|
||||
aGameInfo = 0;
|
||||
aConcede = 0;
|
||||
aLeaveGame = 0;
|
||||
aCloseReplay = new QAction(this);
|
||||
connect(aCloseReplay, SIGNAL(triggered()), this, SLOT(actLeaveGame()));
|
||||
|
||||
phasesMenu = 0;
|
||||
gameMenu = new QMenu(this);
|
||||
gameMenu->addAction(aCloseReplay);
|
||||
addTabMenu(gameMenu);
|
||||
|
||||
mainWidget = new QStackedWidget(this);
|
||||
mainWidget->addWidget(deckViewContainerWidget);
|
||||
mainWidget->addWidget(gamePlayAreaWidget);
|
||||
setCentralWidget(mainWidget);
|
||||
|
||||
createReplayMenuItems();
|
||||
createViewMenuItems();
|
||||
retranslateUi();
|
||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutchanged()),this,SLOT(refreshShortcuts()));
|
||||
refreshShortcuts();
|
||||
setLayout(superMainLayout);
|
||||
|
||||
splitter->restoreState(settingsCache->getTabGameSplitterSizes());
|
||||
splitter->setChildrenCollapsible(false);
|
||||
|
||||
messageLog->logReplayStarted(gameInfo.game_id());
|
||||
|
||||
QTimer::singleShot(0, this, SLOT(loadLayout()));
|
||||
}
|
||||
|
||||
TabGame::TabGame(TabSupervisor *_tabSupervisor, QList<AbstractClient *> &_clients, const Event_GameJoined &event, const QMap<int, QString> &_roomGameTypes)
|
||||
|
|
@ -438,139 +378,39 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, QList<AbstractClient *> &_client
|
|||
currentPhase(-1),
|
||||
activeCard(0),
|
||||
gameClosed(false),
|
||||
replay(0)
|
||||
replay(0),
|
||||
replayDock(0)
|
||||
{
|
||||
// THIS CTOR IS USED ON GAMES
|
||||
gameInfo.set_started(false);
|
||||
|
||||
gameTimer = new QTimer(this);
|
||||
gameTimer->setInterval(1000);
|
||||
connect(gameTimer, SIGNAL(timeout()), this, SLOT(incrementGameTime()));
|
||||
gameTimer->start();
|
||||
|
||||
phasesToolbar = new PhasesToolbar;
|
||||
connect(phasesToolbar, SIGNAL(sendGameCommand(const ::google::protobuf::Message &, int)), this, SLOT(sendGameCommand(const ::google::protobuf::Message &, int)));
|
||||
|
||||
scene = new GameScene(phasesToolbar, this);
|
||||
gameView = new GameView(scene);
|
||||
gameView->hide();
|
||||
|
||||
cardInfo = new CardFrame();
|
||||
playerListWidget = new PlayerListWidget(tabSupervisor, clients.first(), this);
|
||||
playerListWidget->setFocusPolicy(Qt::NoFocus);
|
||||
connect(playerListWidget, SIGNAL(openMessageDialog(QString, bool)), this, SIGNAL(openMessageDialog(QString, bool)));
|
||||
|
||||
timeElapsedLabel = new QLabel;
|
||||
timeElapsedLabel->setAlignment(Qt::AlignCenter);
|
||||
messageLog = new MessageLogWidget(tabSupervisor, this);
|
||||
connect(messageLog, SIGNAL(openMessageDialog(QString, bool)), this, SIGNAL(openMessageDialog(QString, bool)));
|
||||
connect(messageLog, SIGNAL(cardNameHovered(QString)), cardInfo, SLOT(setCard(QString)));
|
||||
connect(messageLog, SIGNAL(showCardInfoPopup(QPoint, QString)), this, SLOT(showCardInfoPopup(QPoint, QString)));
|
||||
connect(messageLog, SIGNAL(deleteCardInfoPopup(QString)), this, SLOT(deleteCardInfoPopup(QString)));
|
||||
connect(messageLog, SIGNAL(addMentionTag(QString)), this, SLOT(addMentionTag(QString)));
|
||||
connect(settingsCache, SIGNAL(chatMentionCompleterChanged()), this, SLOT(actCompleterChanged()));
|
||||
sayLabel = new QLabel;
|
||||
sayEdit = new LineEditCompleter;
|
||||
sayLabel->setBuddy(sayEdit);
|
||||
|
||||
QHBoxLayout *hLayout = new QHBoxLayout;
|
||||
hLayout->addWidget(sayLabel);
|
||||
hLayout->addWidget(sayEdit);
|
||||
|
||||
deckViewContainerLayout = new QVBoxLayout;
|
||||
createCardInfoDock();
|
||||
createPlayerListDock();
|
||||
createMessageDock();
|
||||
createPlayAreaWidget();
|
||||
createDeckViewContainerWidget();
|
||||
|
||||
QVBoxLayout *messageLogLayout = new QVBoxLayout;
|
||||
messageLogLayout->setContentsMargins(0, 0, 0, 0);
|
||||
messageLogLayout->addWidget(timeElapsedLabel);
|
||||
messageLogLayout->addWidget(messageLog);
|
||||
messageLogLayout->addLayout(hLayout);
|
||||
|
||||
QWidget *messageLogLayoutWidget = new QWidget;
|
||||
messageLogLayoutWidget->setLayout(messageLogLayout);
|
||||
|
||||
splitter = new QSplitter(Qt::Vertical);
|
||||
splitter->addWidget(cardInfo);
|
||||
splitter->addWidget(playerListWidget);
|
||||
splitter->addWidget(messageLogLayoutWidget);
|
||||
addDockWidget(Qt::RightDockWidgetArea, cardInfoDock);
|
||||
addDockWidget(Qt::RightDockWidgetArea, playerListDock);
|
||||
addDockWidget(Qt::RightDockWidgetArea, messageLayoutDock);
|
||||
|
||||
mainLayout = new QHBoxLayout;
|
||||
mainLayout->addWidget(gameView, 10);
|
||||
mainLayout->addLayout(deckViewContainerLayout, 10);
|
||||
mainLayout->addWidget(splitter);
|
||||
|
||||
if (spectator && !gameInfo.spectators_can_chat() && tabSupervisor->getAdminLocked()) {
|
||||
sayLabel->hide();
|
||||
sayEdit->hide();
|
||||
}
|
||||
connect(tabSupervisor, SIGNAL(adminLockChanged(bool)), this, SLOT(adminLockChanged(bool)));
|
||||
connect(sayEdit, SIGNAL(returnPressed()), this, SLOT(actSay()));
|
||||
mainWidget = new QStackedWidget(this);
|
||||
mainWidget->addWidget(deckViewContainerWidget);
|
||||
mainWidget->addWidget(gamePlayAreaWidget);
|
||||
setCentralWidget(mainWidget);
|
||||
|
||||
// Menu actions
|
||||
aNextPhase = new QAction(this);
|
||||
connect(aNextPhase, SIGNAL(triggered()), this, SLOT(actNextPhase()));
|
||||
aNextTurn = new QAction(this);
|
||||
connect(aNextTurn, SIGNAL(triggered()), this, SLOT(actNextTurn()));
|
||||
aRemoveLocalArrows = new QAction(this);
|
||||
connect(aRemoveLocalArrows, SIGNAL(triggered()), this, SLOT(actRemoveLocalArrows()));
|
||||
aRotateViewCW = new QAction(this);
|
||||
connect(aRotateViewCW, SIGNAL(triggered()), this, SLOT(actRotateViewCW()));
|
||||
aRotateViewCCW = new QAction(this);
|
||||
connect(aRotateViewCCW, SIGNAL(triggered()), this, SLOT(actRotateViewCCW()));
|
||||
aGameInfo = new QAction(this);
|
||||
connect(aGameInfo, SIGNAL(triggered()), this, SLOT(actGameInfo()));
|
||||
aConcede = new QAction(this);
|
||||
connect(aConcede, SIGNAL(triggered()), this, SLOT(actConcede()));
|
||||
aLeaveGame = new QAction(this);
|
||||
connect(aLeaveGame, SIGNAL(triggered()), this, SLOT(actLeaveGame()));
|
||||
aCloseReplay = 0;
|
||||
|
||||
phasesMenu = new QMenu(this);
|
||||
for (int i = 0; i < phasesToolbar->phaseCount(); ++i) {
|
||||
QAction *temp = new QAction(QString(), this);
|
||||
connect(temp, SIGNAL(triggered()), this, SLOT(actPhaseAction()));
|
||||
phasesMenu->addAction(temp);
|
||||
phaseActions.append(temp);
|
||||
}
|
||||
|
||||
phasesMenu->addSeparator();
|
||||
phasesMenu->addAction(aNextPhase);
|
||||
|
||||
gameMenu = new QMenu(this);
|
||||
playersSeparator = gameMenu->addSeparator();
|
||||
gameMenu->addMenu(phasesMenu);
|
||||
gameMenu->addAction(aNextTurn);
|
||||
gameMenu->addSeparator();
|
||||
gameMenu->addAction(aRemoveLocalArrows);
|
||||
gameMenu->addAction(aRotateViewCW);
|
||||
gameMenu->addAction(aRotateViewCCW);
|
||||
gameMenu->addSeparator();
|
||||
gameMenu->addAction(aGameInfo);
|
||||
gameMenu->addAction(aConcede);
|
||||
gameMenu->addAction(aLeaveGame);
|
||||
addTabMenu(gameMenu);
|
||||
|
||||
createMenuItems();
|
||||
createViewMenuItems();
|
||||
retranslateUi();
|
||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutchanged()),this,SLOT(refreshShortcuts()));
|
||||
refreshShortcuts();
|
||||
setLayout(mainLayout);
|
||||
|
||||
splitter->restoreState(settingsCache->getTabGameSplitterSizes());
|
||||
splitter->setChildrenCollapsible(false);
|
||||
|
||||
messageLog->logGameJoined(gameInfo.game_id());
|
||||
|
||||
// append game to rooms game list for others to see
|
||||
for (int i = gameInfo.game_types_size() - 1; i >= 0; i--)
|
||||
gameTypes.append(roomGameTypes.find(gameInfo.game_types(i)).value());
|
||||
|
||||
completer = new QCompleter(autocompleteUserList, sayEdit);
|
||||
completer->setCaseSensitivity(Qt::CaseInsensitive);
|
||||
completer->setMaxVisibleItems(5);
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
completer->setFilterMode(Qt::MatchStartsWith);
|
||||
#endif
|
||||
|
||||
sayEdit->setCompleter(completer);
|
||||
actCompleterChanged();
|
||||
QTimer::singleShot(0, this, SLOT(loadLayout()));
|
||||
}
|
||||
|
||||
void TabGame::addMentionTag(QString value) {
|
||||
|
|
@ -585,21 +425,34 @@ void TabGame::emitUserEvent() {
|
|||
|
||||
TabGame::~TabGame()
|
||||
{
|
||||
delete replay;
|
||||
settingsCache->setTabGameSplitterSizes(splitter->saveState());
|
||||
if(replay)
|
||||
{
|
||||
settingsCache->layouts().setReplayPlayAreaState(saveState());
|
||||
settingsCache->layouts().setReplayPlayAreaGeometry(saveGeometry());
|
||||
delete replay;
|
||||
} else {
|
||||
settingsCache->layouts().setGamePlayAreaState(saveState());
|
||||
settingsCache->layouts().setGamePlayAreaGeometry(saveGeometry());
|
||||
}
|
||||
|
||||
QMapIterator<int, Player *> i(players);
|
||||
while (i.hasNext())
|
||||
delete i.next().value();
|
||||
players.clear();
|
||||
|
||||
delete deckViewContainerLayout;
|
||||
|
||||
emit gameClosing(this);
|
||||
}
|
||||
|
||||
void TabGame::retranslateUi()
|
||||
{
|
||||
QString tabText = getTabText() + " - ";
|
||||
|
||||
cardInfoDock->setWindowTitle((cardInfoDock->isWindow() ? tabText : QString()) + tr("Card Info"));
|
||||
playerListDock->setWindowTitle((playerListDock->isWindow() ? tabText : QString()) + tr("Player List"));
|
||||
messageLayoutDock->setWindowTitle((messageLayoutDock->isWindow() ? tabText : QString()) + tr("Messages"));
|
||||
if(replayDock)
|
||||
replayDock->setWindowTitle((replayDock->isWindow() ? tabText : QString()) + tr("Replay Timeline"));
|
||||
|
||||
if (phasesMenu) {
|
||||
for (int i = 0; i < phaseActions.size(); ++i)
|
||||
phaseActions[i]->setText(phasesToolbar->getLongPhaseName(i));
|
||||
|
|
@ -633,9 +486,33 @@ void TabGame::retranslateUi()
|
|||
if (aCloseReplay) {
|
||||
aCloseReplay->setText(tr("C&lose replay"));
|
||||
}
|
||||
|
||||
if (sayLabel)
|
||||
if (sayLabel){
|
||||
sayLabel->setText(tr("&Say:"));
|
||||
}
|
||||
|
||||
viewMenu->setTitle(tr("&View"));
|
||||
cardInfoDockMenu->setTitle(tr("Card Info"));
|
||||
messageLayoutDockMenu->setTitle(tr("Messages"));
|
||||
playerListDockMenu->setTitle(tr("Player List"));
|
||||
|
||||
aCardInfoDockVisible->setText(tr("Visible"));
|
||||
aCardInfoDockFloating->setText(tr("Floating"));
|
||||
|
||||
aMessageLayoutDockVisible->setText(tr("Visible"));
|
||||
aMessageLayoutDockFloating->setText(tr("Floating"));
|
||||
|
||||
aPlayerListDockVisible->setText(tr("Visible"));
|
||||
aPlayerListDockFloating->setText(tr("Floating"));
|
||||
|
||||
if(replayDock)
|
||||
{
|
||||
replayDockMenu->setTitle(tr("Replay Timeline"));
|
||||
aReplayDockVisible->setText(tr("Visible"));
|
||||
aReplayDockFloating->setText(tr("Floating"));
|
||||
}
|
||||
|
||||
aResetLayout->setText(tr("Reset layout"));
|
||||
|
||||
cardInfo->retranslateUi();
|
||||
|
||||
QMapIterator<int, Player *> i(players);
|
||||
|
|
@ -955,8 +832,9 @@ void TabGame::startGame(bool resuming)
|
|||
i.value()->setReadyStart(false);
|
||||
i.value()->hide();
|
||||
}
|
||||
mainLayout->removeItem(deckViewContainerLayout);
|
||||
|
||||
|
||||
mainWidget->setCurrentWidget(gamePlayAreaWidget);
|
||||
|
||||
if (!resuming) {
|
||||
QMapIterator<int, Player *> playerIterator(players);
|
||||
while (playerIterator.hasNext())
|
||||
|
|
@ -966,7 +844,6 @@ void TabGame::startGame(bool resuming)
|
|||
playerListWidget->setGameStarted(true, resuming);
|
||||
gameInfo.set_started(true);
|
||||
static_cast<GameScene *>(gameView->scene())->rearrange();
|
||||
gameView->show();
|
||||
if(sayEdit && players.size() > 1)
|
||||
sayEdit->setFocus();
|
||||
}
|
||||
|
|
@ -981,12 +858,12 @@ void TabGame::stopGame()
|
|||
i.next();
|
||||
i.value()->show();
|
||||
}
|
||||
mainLayout->insertLayout(1, deckViewContainerLayout, 10);
|
||||
|
||||
mainWidget->setCurrentWidget(deckViewContainerWidget);
|
||||
|
||||
playerListWidget->setActivePlayer(-1);
|
||||
playerListWidget->setGameStarted(false, false);
|
||||
gameInfo.set_started(false);
|
||||
gameView->hide();
|
||||
}
|
||||
|
||||
void TabGame::closeGame()
|
||||
|
|
@ -1335,3 +1212,478 @@ void TabGame::updateCardMenu(AbstractCardItem *card)
|
|||
p = players.value(localPlayerId);
|
||||
p->updateCardMenu(static_cast<CardItem *>(card));
|
||||
}
|
||||
|
||||
void TabGame::createMenuItems()
|
||||
{
|
||||
aNextPhase = new QAction(this);
|
||||
connect(aNextPhase, SIGNAL(triggered()), this, SLOT(actNextPhase()));
|
||||
aNextTurn = new QAction(this);
|
||||
connect(aNextTurn, SIGNAL(triggered()), this, SLOT(actNextTurn()));
|
||||
aRemoveLocalArrows = new QAction(this);
|
||||
connect(aRemoveLocalArrows, SIGNAL(triggered()), this, SLOT(actRemoveLocalArrows()));
|
||||
aRotateViewCW = new QAction(this);
|
||||
connect(aRotateViewCW, SIGNAL(triggered()), this, SLOT(actRotateViewCW()));
|
||||
aRotateViewCCW = new QAction(this);
|
||||
connect(aRotateViewCCW, SIGNAL(triggered()), this, SLOT(actRotateViewCCW()));
|
||||
aGameInfo = new QAction(this);
|
||||
connect(aGameInfo, SIGNAL(triggered()), this, SLOT(actGameInfo()));
|
||||
aConcede = new QAction(this);
|
||||
connect(aConcede, SIGNAL(triggered()), this, SLOT(actConcede()));
|
||||
aLeaveGame = new QAction(this);
|
||||
connect(aLeaveGame, SIGNAL(triggered()), this, SLOT(actLeaveGame()));
|
||||
aCloseReplay = 0;
|
||||
|
||||
phasesMenu = new QMenu(this);
|
||||
for (int i = 0; i < phasesToolbar->phaseCount(); ++i) {
|
||||
QAction *temp = new QAction(QString(), this);
|
||||
connect(temp, SIGNAL(triggered()), this, SLOT(actPhaseAction()));
|
||||
phasesMenu->addAction(temp);
|
||||
phaseActions.append(temp);
|
||||
}
|
||||
|
||||
phasesMenu->addSeparator();
|
||||
phasesMenu->addAction(aNextPhase);
|
||||
|
||||
gameMenu = new QMenu(this);
|
||||
playersSeparator = gameMenu->addSeparator();
|
||||
gameMenu->addMenu(phasesMenu);
|
||||
gameMenu->addAction(aNextTurn);
|
||||
gameMenu->addSeparator();
|
||||
gameMenu->addAction(aRemoveLocalArrows);
|
||||
gameMenu->addAction(aRotateViewCW);
|
||||
gameMenu->addAction(aRotateViewCCW);
|
||||
gameMenu->addSeparator();
|
||||
gameMenu->addAction(aGameInfo);
|
||||
gameMenu->addAction(aConcede);
|
||||
gameMenu->addAction(aLeaveGame);
|
||||
addTabMenu(gameMenu);
|
||||
}
|
||||
|
||||
void TabGame::createReplayMenuItems()
|
||||
{
|
||||
aNextPhase = 0;
|
||||
aNextTurn = 0;
|
||||
aRemoveLocalArrows = 0;
|
||||
aRotateViewCW = 0;
|
||||
aRotateViewCCW = 0;
|
||||
aResetLayout = 0;
|
||||
aGameInfo = 0;
|
||||
aConcede = 0;
|
||||
aLeaveGame = 0;
|
||||
aCloseReplay = new QAction(this);
|
||||
connect(aCloseReplay, SIGNAL(triggered()), this, SLOT(actLeaveGame()));
|
||||
|
||||
phasesMenu = 0;
|
||||
gameMenu = new QMenu(this);
|
||||
gameMenu->addAction(aCloseReplay);
|
||||
addTabMenu(gameMenu);
|
||||
}
|
||||
|
||||
void TabGame::createViewMenuItems()
|
||||
{
|
||||
viewMenu = new QMenu(this);
|
||||
|
||||
cardInfoDockMenu = viewMenu->addMenu(QString());
|
||||
messageLayoutDockMenu = viewMenu->addMenu(QString());
|
||||
playerListDockMenu = viewMenu->addMenu(QString());
|
||||
|
||||
aCardInfoDockVisible = cardInfoDockMenu->addAction(QString());
|
||||
aCardInfoDockVisible->setCheckable(true);
|
||||
connect(aCardInfoDockVisible,SIGNAL(triggered()),this,SLOT(dockVisibleTriggered()));
|
||||
aCardInfoDockFloating = cardInfoDockMenu->addAction(QString());
|
||||
aCardInfoDockFloating->setCheckable(true);
|
||||
connect(aCardInfoDockFloating,SIGNAL(triggered()),this,SLOT(dockFloatingTriggered()));
|
||||
|
||||
aMessageLayoutDockVisible = messageLayoutDockMenu->addAction(QString());
|
||||
aMessageLayoutDockVisible->setCheckable(true);
|
||||
connect(aMessageLayoutDockVisible,SIGNAL(triggered()),this,SLOT(dockVisibleTriggered()));
|
||||
aMessageLayoutDockFloating = messageLayoutDockMenu->addAction(QString());
|
||||
aMessageLayoutDockFloating->setCheckable(true);
|
||||
connect(aMessageLayoutDockFloating,SIGNAL(triggered()),this,SLOT(dockFloatingTriggered()));
|
||||
|
||||
aPlayerListDockVisible = playerListDockMenu->addAction(QString());
|
||||
aPlayerListDockVisible->setCheckable(true);
|
||||
connect(aPlayerListDockVisible,SIGNAL(triggered()),this,SLOT(dockVisibleTriggered()));
|
||||
aPlayerListDockFloating = playerListDockMenu->addAction(QString());
|
||||
aPlayerListDockFloating->setCheckable(true);
|
||||
connect(aPlayerListDockFloating,SIGNAL(triggered()),this,SLOT(dockFloatingTriggered()));
|
||||
|
||||
if(replayDock)
|
||||
{
|
||||
replayDockMenu = viewMenu->addMenu(QString());
|
||||
|
||||
aReplayDockVisible = replayDockMenu->addAction(QString());
|
||||
aReplayDockVisible->setCheckable(true);
|
||||
connect(aReplayDockVisible,SIGNAL(triggered()),this,SLOT(dockVisibleTriggered()));
|
||||
aReplayDockFloating = replayDockMenu->addAction(QString());
|
||||
aReplayDockFloating->setCheckable(true);
|
||||
connect(aReplayDockFloating,SIGNAL(triggered()),this,SLOT(dockFloatingTriggered()));
|
||||
}
|
||||
|
||||
viewMenu->addSeparator();
|
||||
|
||||
aResetLayout = viewMenu->addAction(QString());
|
||||
connect(aResetLayout,SIGNAL(triggered()),this,SLOT(actResetLayout()));
|
||||
viewMenu->addAction(aResetLayout);
|
||||
|
||||
addTabMenu(viewMenu);
|
||||
}
|
||||
|
||||
void TabGame::loadLayout()
|
||||
{
|
||||
if(replayDock)
|
||||
{
|
||||
restoreGeometry(settingsCache->layouts().getReplayPlayAreaGeometry());
|
||||
restoreState(settingsCache->layouts().getReplayPlayAreaLayoutState());
|
||||
} else {
|
||||
restoreGeometry(settingsCache->layouts().getGamePlayAreaGeometry());
|
||||
restoreState(settingsCache->layouts().getGamePlayAreaLayoutState());
|
||||
}
|
||||
|
||||
aCardInfoDockVisible->setChecked(cardInfoDock->isVisible());
|
||||
aMessageLayoutDockVisible->setChecked(messageLayoutDock->isVisible());
|
||||
aPlayerListDockVisible->setChecked(playerListDock->isVisible());
|
||||
|
||||
aCardInfoDockFloating->setEnabled(aCardInfoDockVisible->isChecked());
|
||||
aMessageLayoutDockFloating->setEnabled(aMessageLayoutDockVisible->isChecked());
|
||||
aPlayerListDockFloating->setEnabled(aPlayerListDockVisible->isChecked());
|
||||
|
||||
aCardInfoDockFloating->setChecked(cardInfoDock->isFloating());
|
||||
aMessageLayoutDockFloating->setChecked(messageLayoutDock->isFloating());
|
||||
aPlayerListDockFloating->setChecked(playerListDock->isFloating());
|
||||
|
||||
if(replayDock)
|
||||
{
|
||||
aReplayDockVisible->setChecked(replayDock->isVisible());
|
||||
aReplayDockFloating->setEnabled(aReplayDockVisible->isChecked());
|
||||
aReplayDockFloating->setChecked(replayDock->isFloating());
|
||||
}
|
||||
}
|
||||
|
||||
void TabGame::actResetLayout()
|
||||
{
|
||||
cardInfoDock->setVisible(true);
|
||||
playerListDock->setVisible(true);
|
||||
messageLayoutDock->setVisible(true);
|
||||
|
||||
cardInfoDock->setFloating(false);
|
||||
playerListDock->setFloating(false);
|
||||
messageLayoutDock->setFloating(false);
|
||||
|
||||
aCardInfoDockVisible->setChecked(true);
|
||||
aPlayerListDockVisible->setChecked(true);
|
||||
aMessageLayoutDockVisible->setChecked(true);
|
||||
|
||||
aCardInfoDockFloating->setChecked(false);
|
||||
aPlayerListDockFloating->setChecked(false);
|
||||
aMessageLayoutDockFloating->setChecked(false);
|
||||
|
||||
addDockWidget(Qt::RightDockWidgetArea, cardInfoDock);
|
||||
addDockWidget(Qt::RightDockWidgetArea, playerListDock);
|
||||
addDockWidget(Qt::RightDockWidgetArea, messageLayoutDock);
|
||||
|
||||
if(replayDock)
|
||||
{
|
||||
replayDock->setVisible(true);
|
||||
replayDock->setFloating(false);
|
||||
addDockWidget(Qt::BottomDockWidgetArea, replayDock);
|
||||
aReplayDockVisible->setChecked(true);
|
||||
aReplayDockFloating->setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
void TabGame::createPlayAreaWidget(bool bReplay)
|
||||
{
|
||||
phasesToolbar = new PhasesToolbar;
|
||||
if(!bReplay)
|
||||
connect(phasesToolbar, SIGNAL(sendGameCommand(const ::google::protobuf::Message &, int)), this, SLOT(sendGameCommand(const ::google::protobuf::Message &, int)));
|
||||
scene = new GameScene(phasesToolbar, this);
|
||||
gameView = new GameView(scene);
|
||||
|
||||
gamePlayAreaVBox = new QVBoxLayout;
|
||||
gamePlayAreaVBox->addWidget(gameView);
|
||||
|
||||
gamePlayAreaWidget = new QWidget;
|
||||
gamePlayAreaWidget->setObjectName("gamePlayAreaWidget");
|
||||
gamePlayAreaWidget->setLayout(gamePlayAreaVBox);
|
||||
}
|
||||
|
||||
void TabGame::createReplayDock()
|
||||
{
|
||||
timelineWidget = new ReplayTimelineWidget;
|
||||
timelineWidget->setTimeline(replayTimeline);
|
||||
connect(timelineWidget, SIGNAL(processNextEvent()), this, SLOT(replayNextEvent()));
|
||||
connect(timelineWidget, SIGNAL(replayFinished()), this, SLOT(replayFinished()));
|
||||
|
||||
replayStartButton = new QToolButton;
|
||||
replayStartButton->setIconSize(QSize(32, 32));
|
||||
replayStartButton->setIcon(QPixmap("theme:replay/start"));
|
||||
connect(replayStartButton, SIGNAL(clicked()), this, SLOT(replayStartButtonClicked()));
|
||||
replayPauseButton = new QToolButton;
|
||||
replayPauseButton->setIconSize(QSize(32, 32));
|
||||
replayPauseButton->setEnabled(false);
|
||||
replayPauseButton->setIcon(QPixmap("theme:replay/pause"));
|
||||
connect(replayPauseButton, SIGNAL(clicked()), this, SLOT(replayPauseButtonClicked()));
|
||||
replayFastForwardButton = new QToolButton;
|
||||
replayFastForwardButton->setIconSize(QSize(32, 32));
|
||||
replayFastForwardButton->setEnabled(false);
|
||||
replayFastForwardButton->setIcon(QPixmap("theme:replay/fastforward"));
|
||||
replayFastForwardButton->setCheckable(true);
|
||||
connect(replayFastForwardButton, SIGNAL(toggled(bool)), this, SLOT(replayFastForwardButtonToggled(bool)));
|
||||
|
||||
replayControlLayout = new QHBoxLayout;
|
||||
replayControlLayout->addWidget(timelineWidget, 10);
|
||||
replayControlLayout->addWidget(replayStartButton);
|
||||
replayControlLayout->addWidget(replayPauseButton);
|
||||
replayControlLayout->addWidget(replayFastForwardButton);
|
||||
|
||||
replayControlWidget = new QWidget();
|
||||
replayControlWidget->setObjectName("replayControlWidget");
|
||||
replayControlWidget->setLayout(replayControlLayout);
|
||||
|
||||
replayDock = new QDockWidget(this);
|
||||
replayDock->setObjectName("replayDock");
|
||||
replayDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetMovable);
|
||||
replayDock->setWidget(replayControlWidget);
|
||||
replayDock->setFloating(false);
|
||||
|
||||
replayDock->installEventFilter(this);
|
||||
connect(replayDock, SIGNAL(topLevelChanged(bool)), this, SLOT(dockTopLevelChanged(bool)));
|
||||
}
|
||||
|
||||
void TabGame::createDeckViewContainerWidget(bool bReplay)
|
||||
{
|
||||
Q_UNUSED(bReplay);
|
||||
|
||||
deckViewContainerWidget = new QWidget();
|
||||
deckViewContainerWidget->setObjectName("deckViewContainerWidget");
|
||||
deckViewContainerLayout = new QVBoxLayout;
|
||||
deckViewContainerWidget->setLayout(deckViewContainerLayout);
|
||||
}
|
||||
|
||||
void TabGame::createCardInfoDock(bool bReplay)
|
||||
{
|
||||
Q_UNUSED(bReplay);
|
||||
|
||||
cardInfo = new CardFrame();
|
||||
cardHInfoLayout = new QHBoxLayout;
|
||||
cardVInfoLayout = new QVBoxLayout;
|
||||
cardVInfoLayout->setContentsMargins(0, 0, 0, 0);
|
||||
cardVInfoLayout->addWidget(cardInfo);
|
||||
cardVInfoLayout->addLayout(cardHInfoLayout);
|
||||
|
||||
cardBoxLayoutWidget = new QWidget;
|
||||
cardBoxLayoutWidget->setLayout(cardVInfoLayout);
|
||||
|
||||
cardInfoDock = new QDockWidget(this);
|
||||
cardInfoDock->setObjectName("cardInfoDock");
|
||||
cardInfoDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetMovable);
|
||||
cardInfoDock->setWidget(cardBoxLayoutWidget);
|
||||
cardInfoDock->setFloating(false);
|
||||
|
||||
cardInfoDock->installEventFilter(this);
|
||||
connect(cardInfoDock, SIGNAL(topLevelChanged(bool)), this, SLOT(dockTopLevelChanged(bool)));
|
||||
}
|
||||
|
||||
void TabGame::createPlayerListDock(bool bReplay)
|
||||
{
|
||||
if(bReplay)
|
||||
{
|
||||
playerListWidget = new PlayerListWidget(0, 0, this);
|
||||
} else {
|
||||
playerListWidget = new PlayerListWidget(tabSupervisor, clients.first(), this);
|
||||
connect(playerListWidget, SIGNAL(openMessageDialog(QString, bool)), this, SIGNAL(openMessageDialog(QString, bool)));
|
||||
}
|
||||
playerListWidget->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
playerListDock = new QDockWidget(this);
|
||||
playerListDock->setObjectName("playerListDock");
|
||||
playerListDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetMovable);
|
||||
playerListDock->setWidget(playerListWidget);
|
||||
playerListDock->setFloating(false);
|
||||
|
||||
playerListDock->installEventFilter(this);
|
||||
connect(playerListDock, SIGNAL(topLevelChanged(bool)), this, SLOT(dockTopLevelChanged(bool)));
|
||||
}
|
||||
|
||||
void TabGame::createMessageDock(bool bReplay)
|
||||
{
|
||||
messageLog = new MessageLogWidget(tabSupervisor, this);
|
||||
connect(messageLog, SIGNAL(cardNameHovered(QString)), cardInfo, SLOT(setCard(QString)));
|
||||
connect(messageLog, SIGNAL(showCardInfoPopup(QPoint, QString)), this, SLOT(showCardInfoPopup(QPoint, QString)));
|
||||
connect(messageLog, SIGNAL(deleteCardInfoPopup(QString)), this, SLOT(deleteCardInfoPopup(QString)));
|
||||
|
||||
if(!bReplay)
|
||||
{
|
||||
connect(messageLog, SIGNAL(openMessageDialog(QString, bool)), this, SIGNAL(openMessageDialog(QString, bool)));
|
||||
connect(messageLog, SIGNAL(addMentionTag(QString)), this, SLOT(addMentionTag(QString)));
|
||||
connect(settingsCache, SIGNAL(chatMentionCompleterChanged()), this, SLOT(actCompleterChanged()));
|
||||
|
||||
timeElapsedLabel = new QLabel;
|
||||
timeElapsedLabel->setAlignment(Qt::AlignCenter);
|
||||
gameTimer = new QTimer(this);
|
||||
gameTimer->setInterval(1000);
|
||||
connect(gameTimer, SIGNAL(timeout()), this, SLOT(incrementGameTime()));
|
||||
gameTimer->start();
|
||||
|
||||
sayLabel = new QLabel;
|
||||
sayEdit = new LineEditCompleter;
|
||||
sayLabel->setBuddy(sayEdit);
|
||||
completer = new QCompleter(autocompleteUserList, sayEdit);
|
||||
completer->setCaseSensitivity(Qt::CaseInsensitive);
|
||||
completer->setMaxVisibleItems(5);
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
completer->setFilterMode(Qt::MatchStartsWith);
|
||||
#endif
|
||||
|
||||
sayEdit->setCompleter(completer);
|
||||
actCompleterChanged();
|
||||
|
||||
if (spectator && !gameInfo.spectators_can_chat() && tabSupervisor->getAdminLocked()) {
|
||||
sayLabel->hide();
|
||||
sayEdit->hide();
|
||||
}
|
||||
connect(tabSupervisor, SIGNAL(adminLockChanged(bool)), this, SLOT(adminLockChanged(bool)));
|
||||
connect(sayEdit, SIGNAL(returnPressed()), this, SLOT(actSay()));
|
||||
|
||||
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);
|
||||
|
||||
messageLayoutDock = new QDockWidget(this);
|
||||
messageLayoutDock->setObjectName("messageLayoutDock");
|
||||
messageLayoutDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetMovable);
|
||||
messageLayoutDock->setWidget(messageLogLayoutWidget);
|
||||
messageLayoutDock->setFloating(false);
|
||||
|
||||
messageLayoutDock->installEventFilter(this);
|
||||
connect(messageLayoutDock, SIGNAL(topLevelChanged(bool)), this, SLOT(dockTopLevelChanged(bool)));
|
||||
}
|
||||
|
||||
// Method uses to sync docks state with menu items state
|
||||
bool TabGame::eventFilter(QObject * o, QEvent * e)
|
||||
{
|
||||
if(e->type() == QEvent::Close)
|
||||
{
|
||||
if(o == cardInfoDock)
|
||||
{
|
||||
aCardInfoDockVisible->setChecked(false);
|
||||
aCardInfoDockFloating->setEnabled(false);
|
||||
} else if(o == messageLayoutDock) {
|
||||
aMessageLayoutDockVisible->setChecked(false);
|
||||
aMessageLayoutDockFloating->setEnabled(false);
|
||||
} else if(o == playerListDock) {
|
||||
aPlayerListDockVisible->setChecked(false);
|
||||
aPlayerListDockFloating->setEnabled(false);
|
||||
} else if(o == replayDock) {
|
||||
aReplayDockVisible->setChecked(false);
|
||||
aReplayDockFloating->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void TabGame::dockVisibleTriggered()
|
||||
{
|
||||
QObject *o = sender();
|
||||
if(o == aCardInfoDockVisible)
|
||||
{
|
||||
cardInfoDock->setVisible(aCardInfoDockVisible->isChecked());
|
||||
aCardInfoDockFloating->setEnabled(aCardInfoDockVisible->isChecked());
|
||||
return;
|
||||
}
|
||||
|
||||
if(o == aMessageLayoutDockVisible)
|
||||
{
|
||||
messageLayoutDock->setVisible(aMessageLayoutDockVisible->isChecked());
|
||||
aMessageLayoutDockFloating->setEnabled(aMessageLayoutDockVisible->isChecked());
|
||||
return;
|
||||
}
|
||||
|
||||
if(o == aPlayerListDockVisible)
|
||||
{
|
||||
playerListDock->setVisible(aPlayerListDockVisible->isChecked());
|
||||
aPlayerListDockFloating->setEnabled(aPlayerListDockVisible->isChecked());
|
||||
return;
|
||||
}
|
||||
|
||||
if(o == aReplayDockVisible)
|
||||
{
|
||||
replayDock->setVisible(aReplayDockVisible->isChecked());
|
||||
aReplayDockFloating->setEnabled(aReplayDockVisible->isChecked());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void TabGame::dockFloatingTriggered()
|
||||
{
|
||||
QObject *o = sender();
|
||||
if(o == aCardInfoDockFloating)
|
||||
{
|
||||
cardInfoDock->setFloating(aCardInfoDockFloating->isChecked());
|
||||
return;
|
||||
}
|
||||
|
||||
if(o == aMessageLayoutDockFloating)
|
||||
{
|
||||
messageLayoutDock->setFloating(aMessageLayoutDockFloating->isChecked());
|
||||
return;
|
||||
}
|
||||
|
||||
if(o == aPlayerListDockFloating)
|
||||
{
|
||||
playerListDock->setFloating(aPlayerListDockFloating->isChecked());
|
||||
return;
|
||||
}
|
||||
|
||||
if(o == aReplayDockFloating)
|
||||
{
|
||||
replayDock->setFloating(aReplayDockFloating->isChecked());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void TabGame::dockTopLevelChanged(bool topLevel)
|
||||
{
|
||||
retranslateUi();
|
||||
|
||||
QObject *o = sender();
|
||||
if(o == cardInfoDock)
|
||||
{
|
||||
aCardInfoDockFloating->setChecked(topLevel);
|
||||
return;
|
||||
}
|
||||
|
||||
if(o == messageLayoutDock)
|
||||
{
|
||||
aMessageLayoutDockFloating->setChecked(topLevel);
|
||||
return;
|
||||
}
|
||||
|
||||
if(o == playerListDock)
|
||||
{
|
||||
aPlayerListDockFloating->setChecked(topLevel);
|
||||
return;
|
||||
}
|
||||
|
||||
if(o == replayDock)
|
||||
{
|
||||
aReplayDockFloating->setChecked(topLevel);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue