Merge pull request #1753 from ctrlaltca/pr_1544
Re-Dockified the game & replay review areas
This commit is contained in:
commit
5dd20181fd
19 changed files with 988 additions and 445 deletions
|
@ -57,3 +57,43 @@ void LayoutsSettings::setDeckEditorFilterSize(const QSize &value)
|
||||||
{
|
{
|
||||||
setValue(value,"layouts/deckEditor_FilterSize");
|
setValue(value,"layouts/deckEditor_FilterSize");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LayoutsSettings::setGamePlayAreaGeometry(const QByteArray &value)
|
||||||
|
{
|
||||||
|
setValue(value,"layouts/gameplayarea_geometry");
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayoutsSettings::setGamePlayAreaState(const QByteArray &value)
|
||||||
|
{
|
||||||
|
setValue(value,"layouts/gameplayarea_state");
|
||||||
|
}
|
||||||
|
|
||||||
|
const QByteArray LayoutsSettings::getGamePlayAreaLayoutState()
|
||||||
|
{
|
||||||
|
return getValue("layouts/gameplayarea_state").toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
const QByteArray LayoutsSettings::getGamePlayAreaGeometry()
|
||||||
|
{
|
||||||
|
return getValue("layouts/gameplayarea_geometry").toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayoutsSettings::setReplayPlayAreaGeometry(const QByteArray &value)
|
||||||
|
{
|
||||||
|
setValue(value,"layouts/replayplayarea_geometry");
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayoutsSettings::setReplayPlayAreaState(const QByteArray &value)
|
||||||
|
{
|
||||||
|
setValue(value,"layouts/replayplayarea_state");
|
||||||
|
}
|
||||||
|
|
||||||
|
const QByteArray LayoutsSettings::getReplayPlayAreaLayoutState()
|
||||||
|
{
|
||||||
|
return getValue("layouts/replayplayarea_state").toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
const QByteArray LayoutsSettings::getReplayPlayAreaGeometry()
|
||||||
|
{
|
||||||
|
return getValue("layouts/replayplayarea_geometry").toByteArray();
|
||||||
|
}
|
||||||
|
|
|
@ -15,12 +15,20 @@ public:
|
||||||
void setDeckEditorCardSize(const QSize &value);
|
void setDeckEditorCardSize(const QSize &value);
|
||||||
void setDeckEditorDeckSize(const QSize &value);
|
void setDeckEditorDeckSize(const QSize &value);
|
||||||
void setDeckEditorFilterSize(const QSize &value);
|
void setDeckEditorFilterSize(const QSize &value);
|
||||||
|
void setGamePlayAreaGeometry(const QByteArray &value);
|
||||||
|
void setGamePlayAreaState(const QByteArray &value);
|
||||||
|
void setReplayPlayAreaGeometry(const QByteArray &value);
|
||||||
|
void setReplayPlayAreaState(const QByteArray &value);
|
||||||
|
|
||||||
const QByteArray getDeckEditorLayoutState();
|
const QByteArray getDeckEditorLayoutState();
|
||||||
const QByteArray getDeckEditorGeometry();
|
const QByteArray getDeckEditorGeometry();
|
||||||
const QSize getDeckEditorCardSize();
|
const QSize getDeckEditorCardSize();
|
||||||
const QSize getDeckEditorDeckSize();
|
const QSize getDeckEditorDeckSize();
|
||||||
const QSize getDeckEditorFilterSize();
|
const QSize getDeckEditorFilterSize();
|
||||||
|
const QByteArray getGamePlayAreaLayoutState();
|
||||||
|
const QByteArray getGamePlayAreaGeometry();
|
||||||
|
const QByteArray getReplayPlayAreaLayoutState();
|
||||||
|
const QByteArray getReplayPlayAreaGeometry();
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
|
@ -612,4 +612,4 @@ void SettingsCache::setNotifyAboutUpdate(int _notifyaboutupdate)
|
||||||
{
|
{
|
||||||
notifyAboutUpdates = _notifyaboutupdate;
|
notifyAboutUpdates = _notifyaboutupdate;
|
||||||
settings->setValue("personal/updatenotification", notifyAboutUpdates);
|
settings->setValue("personal/updatenotification", notifyAboutUpdates);
|
||||||
}
|
}
|
|
@ -243,4 +243,5 @@ void ShortcutsSettings::fillDefaultShorcuts()
|
||||||
defaultShortCuts["Player/phase9"] = parseSequenceString("F9");
|
defaultShortCuts["Player/phase9"] = parseSequenceString("F9");
|
||||||
defaultShortCuts["tab_room/aClearChat"] = parseSequenceString("F12");
|
defaultShortCuts["tab_room/aClearChat"] = parseSequenceString("F12");
|
||||||
defaultShortCuts["DlgLoadDeckFromClipboard/refreshButton"] = parseSequenceString("F5");
|
defaultShortCuts["DlgLoadDeckFromClipboard/refreshButton"] = parseSequenceString("F5");
|
||||||
|
defaultShortCuts["Player/aResetLayout"] = parseSequenceString("");
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,9 @@
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
Tab::Tab(TabSupervisor *_tabSupervisor, QWidget *parent)
|
Tab::Tab(TabSupervisor *_tabSupervisor, QWidget *parent)
|
||||||
: QWidget(parent), tabSupervisor(_tabSupervisor), contentsChanged(false), infoPopup(0)
|
: QMainWindow(parent), tabSupervisor(_tabSupervisor), contentsChanged(false), infoPopup(0)
|
||||||
{
|
{
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tab::showCardInfoPopup(const QPoint &pos, const QString &cardName)
|
void Tab::showCardInfoPopup(const QPoint &pos, const QString &cardName)
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
#ifndef TAB_H
|
#ifndef TAB_H
|
||||||
#define TAB_H
|
#define TAB_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QMainWindow>
|
||||||
|
|
||||||
class QMenu;
|
class QMenu;
|
||||||
class TabSupervisor;
|
class TabSupervisor;
|
||||||
class CardInfoWidget;
|
class CardInfoWidget;
|
||||||
|
|
||||||
class Tab : public QWidget {
|
class Tab : public QMainWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
signals:
|
signals:
|
||||||
void userEvent(bool globalEvent = true);
|
void userEvent(bool globalEvent = true);
|
||||||
|
|
|
@ -83,7 +83,10 @@ TabAdmin::TabAdmin(TabSupervisor *_tabSupervisor, AbstractClient *_client, bool
|
||||||
mainLayout->addWidget(lockButton);
|
mainLayout->addWidget(lockButton);
|
||||||
|
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
setLayout(mainLayout);
|
|
||||||
|
QWidget * mainWidget = new QWidget(this);
|
||||||
|
mainWidget->setLayout(mainLayout);
|
||||||
|
setCentralWidget(mainWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabAdmin::retranslateUi()
|
void TabAdmin::retranslateUi()
|
||||||
|
|
|
@ -52,30 +52,6 @@ void SearchLineEdit::keyPressEvent(QKeyEvent *event)
|
||||||
QLineEdit::keyPressEvent(event);
|
QLineEdit::keyPressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabDeckEditor::createShowHideDocksButtons()
|
|
||||||
{
|
|
||||||
btnFilter = new QPushButton(QPixmap("theme:icons/view"),QString());
|
|
||||||
btnFilter->setObjectName("btnFilter");
|
|
||||||
btnFilter->setCheckable(true);
|
|
||||||
btnFilter->setChecked(true);
|
|
||||||
btnFilter->setMaximumWidth(30);
|
|
||||||
searchLayout->addWidget(btnFilter);
|
|
||||||
|
|
||||||
btnDeck = new QPushButton(QPixmap("theme:hand"),QString());
|
|
||||||
btnDeck->setObjectName("btnDeck");
|
|
||||||
btnDeck->setCheckable(true);
|
|
||||||
btnDeck->setChecked(true);
|
|
||||||
btnDeck->setMaximumWidth(30);
|
|
||||||
searchLayout->addWidget(btnDeck);
|
|
||||||
|
|
||||||
btnCard = new QPushButton(QPixmap("theme:cardback"),QString());
|
|
||||||
btnCard->setObjectName("btnCard");
|
|
||||||
btnCard->setCheckable(true);
|
|
||||||
btnCard->setChecked(true);
|
|
||||||
btnCard->setMaximumWidth(30);
|
|
||||||
searchLayout->addWidget(btnCard);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TabDeckEditor::createDeckDock()
|
void TabDeckEditor::createDeckDock()
|
||||||
{
|
{
|
||||||
deckModel = new DeckListModel(this);
|
deckModel = new DeckListModel(this);
|
||||||
|
@ -160,7 +136,7 @@ void TabDeckEditor::createDeckDock()
|
||||||
rightFrame->addWidget(deckView, 10);
|
rightFrame->addWidget(deckView, 10);
|
||||||
rightFrame->addLayout(deckToolbarLayout);
|
rightFrame->addLayout(deckToolbarLayout);
|
||||||
|
|
||||||
deckDock = new QDockWidget(MainWindow);
|
deckDock = new QDockWidget(this);
|
||||||
deckDock->setObjectName("deckDock");
|
deckDock->setObjectName("deckDock");
|
||||||
|
|
||||||
deckDock->setMinimumSize(QSize(200, 41));
|
deckDock->setMinimumSize(QSize(200, 41));
|
||||||
|
@ -171,8 +147,8 @@ void TabDeckEditor::createDeckDock()
|
||||||
deckDockContents->setLayout(rightFrame);
|
deckDockContents->setLayout(rightFrame);
|
||||||
deckDock->setWidget(deckDockContents);
|
deckDock->setWidget(deckDockContents);
|
||||||
|
|
||||||
connect(btnDeck,SIGNAL(toggled(bool)),deckDock,SLOT(setVisible(bool)));
|
|
||||||
deckDock->installEventFilter(this);
|
deckDock->installEventFilter(this);
|
||||||
|
connect(deckDock, SIGNAL(topLevelChanged(bool)), this, SLOT(dockTopLevelChanged(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabDeckEditor::createCardInfoDock()
|
void TabDeckEditor::createCardInfoDock()
|
||||||
|
@ -183,7 +159,7 @@ void TabDeckEditor::createCardInfoDock()
|
||||||
cardInfoFrame->setObjectName("cardInfoFrame");
|
cardInfoFrame->setObjectName("cardInfoFrame");
|
||||||
cardInfoFrame->addWidget(cardInfo);
|
cardInfoFrame->addWidget(cardInfo);
|
||||||
|
|
||||||
cardInfoDock = new QDockWidget(MainWindow);
|
cardInfoDock = new QDockWidget(this);
|
||||||
cardInfoDock->setObjectName("cardInfoDock");
|
cardInfoDock->setObjectName("cardInfoDock");
|
||||||
|
|
||||||
cardInfoDock->setMinimumSize(QSize(200, 41));
|
cardInfoDock->setMinimumSize(QSize(200, 41));
|
||||||
|
@ -194,8 +170,8 @@ void TabDeckEditor::createCardInfoDock()
|
||||||
cardInfoDockContents->setLayout(cardInfoFrame);
|
cardInfoDockContents->setLayout(cardInfoFrame);
|
||||||
cardInfoDock->setWidget(cardInfoDockContents);
|
cardInfoDock->setWidget(cardInfoDockContents);
|
||||||
|
|
||||||
connect(btnCard,SIGNAL(toggled(bool)),cardInfoDock,SLOT(setVisible(bool)));
|
|
||||||
cardInfoDock->installEventFilter(this);
|
cardInfoDock->installEventFilter(this);
|
||||||
|
connect(cardInfoDock, SIGNAL(topLevelChanged(bool)), this, SLOT(dockTopLevelChanged(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabDeckEditor::createFiltersDock()
|
void TabDeckEditor::createFiltersDock()
|
||||||
|
@ -243,17 +219,17 @@ void TabDeckEditor::createFiltersDock()
|
||||||
filterFrame->setObjectName("filterFrame");
|
filterFrame->setObjectName("filterFrame");
|
||||||
filterFrame->addWidget(filterBox);
|
filterFrame->addWidget(filterBox);
|
||||||
|
|
||||||
filterDock = new QDockWidget(MainWindow);
|
filterDock = new QDockWidget(this);
|
||||||
filterDock->setObjectName("filterDock");
|
filterDock->setObjectName("filterDock");
|
||||||
|
|
||||||
filterDock->setFeatures(QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable);
|
filterDock->setFeatures(QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable);
|
||||||
QWidget *filterDockContents = new QWidget(MainWindow);
|
QWidget *filterDockContents = new QWidget(this);
|
||||||
filterDockContents->setObjectName("filterDockContents");
|
filterDockContents->setObjectName("filterDockContents");
|
||||||
filterDockContents->setLayout(filterFrame);
|
filterDockContents->setLayout(filterFrame);
|
||||||
filterDock->setWidget(filterDockContents);
|
filterDock->setWidget(filterDockContents);
|
||||||
|
|
||||||
connect(btnFilter,SIGNAL(toggled(bool)),filterDock,SLOT(setVisible(bool)));
|
|
||||||
filterDock->installEventFilter(this);
|
filterDock->installEventFilter(this);
|
||||||
|
connect(filterDock, SIGNAL(topLevelChanged(bool)), this, SLOT(dockTopLevelChanged(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabDeckEditor::createMenus()
|
void TabDeckEditor::createMenus()
|
||||||
|
@ -297,9 +273,6 @@ void TabDeckEditor::createMenus()
|
||||||
aEditTokens = new QAction(QString(), this);
|
aEditTokens = new QAction(QString(), this);
|
||||||
connect(aEditTokens, SIGNAL(triggered()), this, SLOT(actEditTokens()));
|
connect(aEditTokens, SIGNAL(triggered()), this, SLOT(actEditTokens()));
|
||||||
|
|
||||||
aResetLayout = new QAction(QString(), this);
|
|
||||||
connect(aResetLayout,SIGNAL(triggered()),this,SLOT(restartLayout()));
|
|
||||||
|
|
||||||
deckMenu = new QMenu(this);
|
deckMenu = new QMenu(this);
|
||||||
deckMenu->addAction(aNewDeck);
|
deckMenu->addAction(aNewDeck);
|
||||||
deckMenu->addAction(aLoadDeck);
|
deckMenu->addAction(aLoadDeck);
|
||||||
|
@ -313,8 +286,6 @@ void TabDeckEditor::createMenus()
|
||||||
deckMenu->addSeparator();
|
deckMenu->addSeparator();
|
||||||
deckMenu->addAction(aAnalyzeDeck);
|
deckMenu->addAction(aAnalyzeDeck);
|
||||||
deckMenu->addSeparator();
|
deckMenu->addSeparator();
|
||||||
deckMenu->addAction(aResetLayout);
|
|
||||||
deckMenu->addSeparator();
|
|
||||||
deckMenu->addAction(aClose);
|
deckMenu->addAction(aClose);
|
||||||
addTabMenu(deckMenu);
|
addTabMenu(deckMenu);
|
||||||
|
|
||||||
|
@ -338,6 +309,41 @@ void TabDeckEditor::createMenus()
|
||||||
dbMenu->addAction(aOpenCustomsetsFolder);
|
dbMenu->addAction(aOpenCustomsetsFolder);
|
||||||
#endif
|
#endif
|
||||||
addTabMenu(dbMenu);
|
addTabMenu(dbMenu);
|
||||||
|
|
||||||
|
viewMenu = new QMenu(this);
|
||||||
|
|
||||||
|
cardInfoDockMenu = viewMenu->addMenu(QString());
|
||||||
|
deckDockMenu = viewMenu->addMenu(QString());
|
||||||
|
filterDockMenu = 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()));
|
||||||
|
|
||||||
|
aDeckDockVisible = deckDockMenu->addAction(QString());
|
||||||
|
aDeckDockVisible->setCheckable(true);
|
||||||
|
connect(aDeckDockVisible,SIGNAL(triggered()),this,SLOT(dockVisibleTriggered()));
|
||||||
|
aDeckDockFloating = deckDockMenu->addAction(QString());
|
||||||
|
aDeckDockFloating->setCheckable(true);
|
||||||
|
connect(aDeckDockFloating,SIGNAL(triggered()),this,SLOT(dockFloatingTriggered()));
|
||||||
|
|
||||||
|
aFilterDockVisible = filterDockMenu->addAction(QString());
|
||||||
|
aFilterDockVisible->setCheckable(true);
|
||||||
|
connect(aFilterDockVisible,SIGNAL(triggered()),this,SLOT(dockVisibleTriggered()));
|
||||||
|
aFilterDockFloating = filterDockMenu->addAction(QString());
|
||||||
|
aFilterDockFloating->setCheckable(true);
|
||||||
|
connect(aFilterDockFloating,SIGNAL(triggered()),this,SLOT(dockFloatingTriggered()));
|
||||||
|
|
||||||
|
viewMenu->addSeparator();
|
||||||
|
|
||||||
|
aResetLayout = viewMenu->addAction(QString());
|
||||||
|
connect(aResetLayout,SIGNAL(triggered()),this,SLOT(restartLayout()));
|
||||||
|
viewMenu->addAction(aResetLayout);
|
||||||
|
|
||||||
|
addTabMenu(viewMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabDeckEditor::createCentralFrame()
|
void TabDeckEditor::createCentralFrame()
|
||||||
|
@ -414,41 +420,43 @@ void TabDeckEditor::createCentralFrame()
|
||||||
searchLayout->setObjectName("searchLayout");
|
searchLayout->setObjectName("searchLayout");
|
||||||
searchLayout->addWidget(deckEditToolBar);
|
searchLayout->addWidget(deckEditToolBar);
|
||||||
searchLayout->addWidget(searchEdit);
|
searchLayout->addWidget(searchEdit);
|
||||||
createShowHideDocksButtons();
|
|
||||||
|
|
||||||
centralFrame = new QVBoxLayout;
|
centralFrame = new QVBoxLayout;
|
||||||
centralFrame->setObjectName("centralFrame");
|
centralFrame->setObjectName("centralFrame");
|
||||||
centralFrame->addLayout(searchLayout);
|
centralFrame->addLayout(searchLayout);
|
||||||
centralFrame->addWidget(databaseView);
|
centralFrame->addWidget(databaseView);
|
||||||
|
|
||||||
centralWidget = new QWidget(MainWindow);
|
centralWidget = new QWidget(this);
|
||||||
centralWidget->setObjectName("centralWidget");
|
centralWidget->setObjectName("centralWidget");
|
||||||
centralWidget->setLayout(centralFrame);
|
centralWidget->setLayout(centralFrame);
|
||||||
MainWindow->setCentralWidget(centralWidget);
|
setCentralWidget(centralWidget);
|
||||||
MainWindow->setDockOptions(QMainWindow::AnimatedDocks|QMainWindow::AllowNestedDocks|QMainWindow::AllowTabbedDocks);
|
setDockOptions(QMainWindow::AnimatedDocks|QMainWindow::AllowNestedDocks|QMainWindow::AllowTabbedDocks);
|
||||||
|
|
||||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
|
||||||
mainLayout->setObjectName("mainLayout");
|
|
||||||
mainLayout->addWidget(MainWindow);
|
|
||||||
setLayout(mainLayout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabDeckEditor::restartLayout()
|
void TabDeckEditor::restartLayout()
|
||||||
{
|
{
|
||||||
btnDeck->setChecked(true);
|
deckDock->setVisible(true);
|
||||||
btnFilter->setChecked(true);
|
cardInfoDock->setVisible(true);
|
||||||
btnCard->setChecked(true);
|
filterDock->setVisible(true);
|
||||||
|
|
||||||
deckDock->setFloating(false);
|
deckDock->setFloating(false);
|
||||||
cardInfoDock->setFloating(false);
|
cardInfoDock->setFloating(false);
|
||||||
filterDock->setFloating(false);
|
filterDock->setFloating(false);
|
||||||
|
|
||||||
MainWindow->addDockWidget(static_cast<Qt::DockWidgetArea>(2), deckDock);
|
aCardInfoDockVisible->setChecked(true);
|
||||||
MainWindow->addDockWidget(static_cast<Qt::DockWidgetArea>(2), cardInfoDock);
|
aDeckDockVisible->setChecked(true);
|
||||||
MainWindow->addDockWidget(static_cast<Qt::DockWidgetArea>(2), filterDock);
|
aFilterDockVisible->setChecked(true);
|
||||||
|
|
||||||
MainWindow->splitDockWidget(cardInfoDock, deckDock, Qt::Horizontal);
|
aCardInfoDockFloating->setChecked(false);
|
||||||
MainWindow->splitDockWidget(cardInfoDock, filterDock, Qt::Vertical);
|
aDeckDockFloating->setChecked(false);
|
||||||
|
aFilterDockFloating->setChecked(false);
|
||||||
|
|
||||||
|
addDockWidget(static_cast<Qt::DockWidgetArea>(2), deckDock);
|
||||||
|
addDockWidget(static_cast<Qt::DockWidgetArea>(2), cardInfoDock);
|
||||||
|
addDockWidget(static_cast<Qt::DockWidgetArea>(2), filterDock);
|
||||||
|
|
||||||
|
splitDockWidget(cardInfoDock, deckDock, Qt::Horizontal);
|
||||||
|
splitDockWidget(cardInfoDock, filterDock, Qt::Vertical);
|
||||||
|
|
||||||
deckDock->setMinimumWidth(360);
|
deckDock->setMinimumWidth(360);
|
||||||
deckDock->setMaximumWidth(360);
|
deckDock->setMaximumWidth(360);
|
||||||
|
@ -496,12 +504,20 @@ void TabDeckEditor::refreshShortcuts()
|
||||||
|
|
||||||
void TabDeckEditor::loadLayout()
|
void TabDeckEditor::loadLayout()
|
||||||
{
|
{
|
||||||
MainWindow->restoreState(settingsCache->layouts().getDeckEditorLayoutState());
|
restoreState(settingsCache->layouts().getDeckEditorLayoutState());
|
||||||
MainWindow->restoreGeometry(settingsCache->layouts().getDeckEditorGeometry());
|
restoreGeometry(settingsCache->layouts().getDeckEditorGeometry());
|
||||||
|
|
||||||
btnCard->setChecked(!cardInfoDock->isHidden());
|
aCardInfoDockVisible->setChecked(cardInfoDock->isVisible());
|
||||||
btnFilter->setChecked(!filterDock->isHidden());
|
aFilterDockVisible->setChecked(filterDock->isVisible());
|
||||||
btnDeck->setChecked(!deckDock->isHidden());
|
aDeckDockVisible->setChecked(deckDock->isVisible());
|
||||||
|
|
||||||
|
aCardInfoDockFloating->setEnabled(aCardInfoDockVisible->isChecked());
|
||||||
|
aDeckDockFloating->setEnabled(aDeckDockVisible->isChecked());
|
||||||
|
aFilterDockFloating->setEnabled(aFilterDockVisible->isChecked());
|
||||||
|
|
||||||
|
aCardInfoDockFloating->setChecked(cardInfoDock->isFloating());
|
||||||
|
aFilterDockFloating->setChecked(filterDock->isFloating());
|
||||||
|
aDeckDockFloating->setChecked(deckDock->isFloating());
|
||||||
|
|
||||||
cardInfoDock->setMinimumSize(settingsCache->layouts().getDeckEditorCardSize());
|
cardInfoDock->setMinimumSize(settingsCache->layouts().getDeckEditorCardSize());
|
||||||
cardInfoDock->setMaximumSize(settingsCache->layouts().getDeckEditorCardSize());
|
cardInfoDock->setMaximumSize(settingsCache->layouts().getDeckEditorCardSize());
|
||||||
|
@ -518,8 +534,7 @@ void TabDeckEditor::loadLayout()
|
||||||
TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent)
|
TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent)
|
||||||
: Tab(_tabSupervisor, parent), modified(false)
|
: Tab(_tabSupervisor, parent), modified(false)
|
||||||
{
|
{
|
||||||
MainWindow = new QMainWindow;
|
setObjectName("TabDeckEditor");
|
||||||
MainWindow->setObjectName("MainWindow");
|
|
||||||
|
|
||||||
createMenus();
|
createMenus();
|
||||||
|
|
||||||
|
@ -587,13 +602,25 @@ void TabDeckEditor::retranslateUi()
|
||||||
aEditSets->setText(tr("&Edit sets..."));
|
aEditSets->setText(tr("&Edit sets..."));
|
||||||
aEditTokens->setText(tr("Edit &tokens..."));
|
aEditTokens->setText(tr("Edit &tokens..."));
|
||||||
|
|
||||||
btnCard->setToolTip(tr("Show/Hide card information"));
|
|
||||||
btnDeck->setToolTip(tr("Show/Hide deck"));
|
|
||||||
btnFilter->setToolTip(tr("Show/Hide filters"));
|
|
||||||
aResetLayout->setText(tr("Reset layout"));
|
|
||||||
cardInfoDock->setWindowTitle(tr("Card Info"));
|
cardInfoDock->setWindowTitle(tr("Card Info"));
|
||||||
deckDock->setWindowTitle(tr("Deck"));
|
deckDock->setWindowTitle(tr("Deck"));
|
||||||
filterDock->setWindowTitle(tr("Filters"));
|
filterDock->setWindowTitle(tr("Filters"));
|
||||||
|
|
||||||
|
viewMenu->setTitle(tr("&View"));
|
||||||
|
cardInfoDockMenu->setTitle(tr("Card Info"));
|
||||||
|
deckDockMenu->setTitle(tr("Deck"));
|
||||||
|
filterDockMenu->setTitle(tr("Filters"));
|
||||||
|
|
||||||
|
aCardInfoDockVisible->setText(tr("Visible"));
|
||||||
|
aCardInfoDockFloating->setText(tr("Floating"));
|
||||||
|
|
||||||
|
aDeckDockVisible->setText(tr("Visible"));
|
||||||
|
aDeckDockFloating->setText(tr("Floating"));
|
||||||
|
|
||||||
|
aFilterDockVisible->setText(tr("Visible"));
|
||||||
|
aFilterDockFloating->setText(tr("Floating"));
|
||||||
|
|
||||||
|
aResetLayout->setText(tr("Reset layout"));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TabDeckEditor::getTabText() const
|
QString TabDeckEditor::getTabText() const
|
||||||
|
@ -998,28 +1025,6 @@ void TabDeckEditor::setPriceTagFeatureEnabled(int /* enabled */)
|
||||||
deckModel->pricesUpdated();
|
deckModel->pricesUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TabDeckEditor::eventFilter(QObject * o, QEvent * e)
|
|
||||||
{
|
|
||||||
if(e->type() == QEvent::Close)
|
|
||||||
{
|
|
||||||
if(o == cardInfoDock)
|
|
||||||
btnCard->setChecked(false);
|
|
||||||
else if(o == deckDock)
|
|
||||||
btnDeck->setChecked(false);
|
|
||||||
else if(o == filterDock)
|
|
||||||
btnFilter->setChecked(false);
|
|
||||||
}
|
|
||||||
if( o == this && e->type() == QEvent::Hide){
|
|
||||||
settingsCache->layouts().setDeckEditorLayoutState(MainWindow->saveState());
|
|
||||||
settingsCache->layouts().setDeckEditorGeometry(MainWindow->saveGeometry());
|
|
||||||
settingsCache->layouts().setDeckEditorCardSize(cardInfoDock->size());
|
|
||||||
settingsCache->layouts().setDeckEditorFilterSize(filterDock->size());
|
|
||||||
settingsCache->layouts().setDeckEditorDeckSize(deckDock->size());
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void TabDeckEditor::actUpdatePrices()
|
void TabDeckEditor::actUpdatePrices()
|
||||||
{
|
{
|
||||||
|
@ -1105,3 +1110,99 @@ void TabDeckEditor::checkFirstRunDetected()
|
||||||
actEditSets();
|
actEditSets();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Method uses to sync docks state with menu items state
|
||||||
|
bool TabDeckEditor::eventFilter(QObject * o, QEvent * e)
|
||||||
|
{
|
||||||
|
if(e->type() == QEvent::Close)
|
||||||
|
{
|
||||||
|
if(o == cardInfoDock)
|
||||||
|
{
|
||||||
|
aCardInfoDockVisible->setChecked(false);
|
||||||
|
aCardInfoDockFloating->setEnabled(false);
|
||||||
|
} else if(o == deckDock) {
|
||||||
|
aDeckDockVisible->setChecked(false);
|
||||||
|
aDeckDockFloating->setEnabled(false);
|
||||||
|
} else if(o == filterDock) {
|
||||||
|
aFilterDockVisible->setChecked(false);
|
||||||
|
aFilterDockFloating->setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( o == this && e->type() == QEvent::Hide){
|
||||||
|
settingsCache->layouts().setDeckEditorLayoutState(saveState());
|
||||||
|
settingsCache->layouts().setDeckEditorGeometry(saveGeometry());
|
||||||
|
settingsCache->layouts().setDeckEditorCardSize(cardInfoDock->size());
|
||||||
|
settingsCache->layouts().setDeckEditorFilterSize(filterDock->size());
|
||||||
|
settingsCache->layouts().setDeckEditorDeckSize(deckDock->size());
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TabDeckEditor::dockVisibleTriggered()
|
||||||
|
{
|
||||||
|
QObject *o = sender();
|
||||||
|
if(o == aCardInfoDockVisible)
|
||||||
|
{
|
||||||
|
cardInfoDock->setVisible(aCardInfoDockVisible->isChecked());
|
||||||
|
aCardInfoDockFloating->setEnabled(aCardInfoDockVisible->isChecked());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(o == aDeckDockVisible)
|
||||||
|
{
|
||||||
|
deckDock->setVisible(aDeckDockVisible->isChecked());
|
||||||
|
aDeckDockFloating->setEnabled(aDeckDockVisible->isChecked());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(o == aFilterDockVisible)
|
||||||
|
{
|
||||||
|
filterDock->setVisible(aFilterDockVisible->isChecked());
|
||||||
|
aFilterDockFloating->setEnabled(aFilterDockVisible->isChecked());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TabDeckEditor::dockFloatingTriggered()
|
||||||
|
{
|
||||||
|
QObject *o = sender();
|
||||||
|
if(o == aCardInfoDockFloating)
|
||||||
|
{
|
||||||
|
cardInfoDock->setFloating(aCardInfoDockFloating->isChecked());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(o == aDeckDockFloating)
|
||||||
|
{
|
||||||
|
deckDock->setFloating(aDeckDockFloating->isChecked());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(o == aFilterDockFloating)
|
||||||
|
{
|
||||||
|
filterDock->setFloating(aFilterDockFloating->isChecked());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TabDeckEditor::dockTopLevelChanged(bool topLevel)
|
||||||
|
{
|
||||||
|
QObject *o = sender();
|
||||||
|
if(o == cardInfoDock)
|
||||||
|
{
|
||||||
|
aCardInfoDockFloating->setChecked(topLevel);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(o == deckDock)
|
||||||
|
{
|
||||||
|
aDeckDockFloating->setChecked(topLevel);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(o == filterDock)
|
||||||
|
{
|
||||||
|
aFilterDockFloating->setChecked(topLevel);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ class CardInfo;
|
||||||
class QGroupBox;
|
class QGroupBox;
|
||||||
class QHBoxLayout;
|
class QHBoxLayout;
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
class QMainWindow;
|
|
||||||
class QDockWidget;
|
class QDockWidget;
|
||||||
|
|
||||||
class SearchLineEdit : public QLineEdit {
|
class SearchLineEdit : public QLineEdit {
|
||||||
|
@ -79,12 +78,15 @@ class TabDeckEditor : public Tab {
|
||||||
void filterRemove(QAction *action);
|
void filterRemove(QAction *action);
|
||||||
void setPriceTagFeatureEnabled(int enabled);
|
void setPriceTagFeatureEnabled(int enabled);
|
||||||
|
|
||||||
bool eventFilter(QObject *o, QEvent *e);
|
|
||||||
void loadLayout();
|
void loadLayout();
|
||||||
void restartLayout();
|
void restartLayout();
|
||||||
void freeDocksSize();
|
void freeDocksSize();
|
||||||
void refreshShortcuts();
|
void refreshShortcuts();
|
||||||
|
|
||||||
|
bool eventFilter(QObject *o, QEvent *e);
|
||||||
|
void dockVisibleTriggered();
|
||||||
|
void dockFloatingTriggered();
|
||||||
|
void dockTopLevelChanged(bool topLevel);
|
||||||
private:
|
private:
|
||||||
CardInfo *currentCardInfo() const;
|
CardInfo *currentCardInfo() const;
|
||||||
void addCardHelper(QString zoneName);
|
void addCardHelper(QString zoneName);
|
||||||
|
@ -113,19 +115,16 @@ private:
|
||||||
QTreeView *filterView;
|
QTreeView *filterView;
|
||||||
QWidget *filterBox;
|
QWidget *filterBox;
|
||||||
|
|
||||||
QMenu *deckMenu, *dbMenu;
|
QMenu *deckMenu, *dbMenu, *viewMenu, *cardInfoDockMenu, *deckDockMenu, *filterDockMenu;
|
||||||
QAction *aNewDeck, *aLoadDeck, *aSaveDeck, *aSaveDeckAs, *aLoadDeckFromClipboard, *aSaveDeckToClipboard, *aPrintDeck, *aAnalyzeDeck, *aClose, *aOpenCustomFolder, *aOpenCustomsetsFolder;
|
QAction *aNewDeck, *aLoadDeck, *aSaveDeck, *aSaveDeckAs, *aLoadDeckFromClipboard, *aSaveDeckToClipboard, *aPrintDeck, *aAnalyzeDeck, *aClose, *aOpenCustomFolder, *aOpenCustomsetsFolder;
|
||||||
QAction *aEditSets, *aEditTokens, *aClearFilterAll, *aClearFilterOne;
|
QAction *aEditSets, *aEditTokens, *aClearFilterAll, *aClearFilterOne;
|
||||||
QAction *aAddCard, *aAddCardToSideboard, *aRemoveCard, *aIncrement, *aDecrement;// *aUpdatePrices;
|
QAction *aAddCard, *aAddCardToSideboard, *aRemoveCard, *aIncrement, *aDecrement;// *aUpdatePrices;
|
||||||
QAction *aResetLayout;
|
QAction *aResetLayout;
|
||||||
|
QAction *aCardInfoDockVisible, *aCardInfoDockFloating, *aDeckDockVisible, *aDeckDockFloating, *aFilterDockVisible, *aFilterDockFloating;
|
||||||
|
|
||||||
bool modified;
|
bool modified;
|
||||||
QMainWindow *MainWindow;
|
|
||||||
QVBoxLayout *centralFrame;
|
QVBoxLayout *centralFrame;
|
||||||
QHBoxLayout *searchLayout;
|
QHBoxLayout *searchLayout;
|
||||||
QPushButton *btnFilter;
|
|
||||||
QPushButton *btnDeck;
|
|
||||||
QPushButton *btnCard;
|
|
||||||
QDockWidget *cardInfoDock;
|
QDockWidget *cardInfoDock;
|
||||||
QDockWidget *deckDock;
|
QDockWidget *deckDock;
|
||||||
QDockWidget *filterDock;
|
QDockWidget *filterDock;
|
||||||
|
@ -138,7 +137,6 @@ public:
|
||||||
void setDeck(DeckLoader *_deckLoader);
|
void setDeck(DeckLoader *_deckLoader);
|
||||||
void setModified(bool _windowModified);
|
void setModified(bool _windowModified);
|
||||||
bool confirmClose();
|
bool confirmClose();
|
||||||
void createShowHideDocksButtons();
|
|
||||||
void createDeckDock();
|
void createDeckDock();
|
||||||
void createCardInfoDock();
|
void createCardInfoDock();
|
||||||
void createFiltersDock();
|
void createFiltersDock();
|
||||||
|
|
|
@ -110,7 +110,10 @@ TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor, AbstractClient *_c
|
||||||
rightToolBar->addAction(aDeleteRemoteDeck);
|
rightToolBar->addAction(aDeleteRemoteDeck);
|
||||||
|
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
setLayout(hbox);
|
|
||||||
|
QWidget * mainWidget = new QWidget(this);
|
||||||
|
mainWidget->setLayout(hbox);
|
||||||
|
setCentralWidget(mainWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabDeckStorage::retranslateUi()
|
void TabDeckStorage::retranslateUi()
|
||||||
|
|
|
@ -9,7 +9,9 @@
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QCompleter>
|
#include <QCompleter>
|
||||||
|
#include <QDockWidget>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <QStackedWidget>
|
||||||
|
|
||||||
#include "dlg_creategame.h"
|
#include "dlg_creategame.h"
|
||||||
#include "tab_game.h"
|
#include "tab_game.h"
|
||||||
|
@ -35,6 +37,7 @@
|
||||||
#include "pictureloader.h"
|
#include "pictureloader.h"
|
||||||
#include "replay_timeline_widget.h"
|
#include "replay_timeline_widget.h"
|
||||||
#include "lineeditcompleter.h"
|
#include "lineeditcompleter.h"
|
||||||
|
#include "window_sets.h"
|
||||||
|
|
||||||
#include <google/protobuf/descriptor.h>
|
#include <google/protobuf/descriptor.h>
|
||||||
#include "pending_command.h"
|
#include "pending_command.h"
|
||||||
|
@ -93,7 +96,7 @@ void ToggleButton::setState(bool _state)
|
||||||
}
|
}
|
||||||
|
|
||||||
DeckViewContainer::DeckViewContainer(int _playerId, TabGame *parent)
|
DeckViewContainer::DeckViewContainer(int _playerId, TabGame *parent)
|
||||||
: QWidget(parent), playerId(_playerId)
|
: QWidget(0), parentGame(parent), playerId(_playerId)
|
||||||
{
|
{
|
||||||
loadLocalButton = new QPushButton;
|
loadLocalButton = new QPushButton;
|
||||||
loadRemoteButton = new QPushButton;
|
loadRemoteButton = new QPushButton;
|
||||||
|
@ -202,6 +205,9 @@ void TabGame::refreshShortcuts()
|
||||||
if (aCloseReplay) {
|
if (aCloseReplay) {
|
||||||
aCloseReplay->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aCloseReplay"));
|
aCloseReplay->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aCloseReplay"));
|
||||||
}
|
}
|
||||||
|
if (aResetLayout) {
|
||||||
|
aResetLayout->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aResetLayout"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckViewContainer::loadLocalDeck()
|
void DeckViewContainer::loadLocalDeck()
|
||||||
|
@ -222,20 +228,20 @@ void DeckViewContainer::loadLocalDeck()
|
||||||
|
|
||||||
Command_DeckSelect cmd;
|
Command_DeckSelect cmd;
|
||||||
cmd.set_deck(deck.writeToString_Native().toStdString());
|
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 &)));
|
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()
|
void DeckViewContainer::loadRemoteDeck()
|
||||||
{
|
{
|
||||||
DlgLoadRemoteDeck dlg(static_cast<TabGame *>(parent())->getClientForPlayer(playerId));
|
DlgLoadRemoteDeck dlg(parentGame->getClientForPlayer(playerId));
|
||||||
if (dlg.exec()) {
|
if (dlg.exec()) {
|
||||||
Command_DeckSelect cmd;
|
Command_DeckSelect cmd;
|
||||||
cmd.set_deck_id(dlg.getDeckId());
|
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 &)));
|
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;
|
Command_ReadyStart cmd;
|
||||||
cmd.set_ready(!readyStartButton->getState());
|
cmd.set_ready(!readyStartButton->getState());
|
||||||
static_cast<TabGame *>(parent())->sendGameCommand(cmd, playerId);
|
parentGame->sendGameCommand(cmd, playerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckViewContainer::sideboardLockButtonClicked()
|
void DeckViewContainer::sideboardLockButtonClicked()
|
||||||
|
@ -259,7 +265,7 @@ void DeckViewContainer::sideboardLockButtonClicked()
|
||||||
Command_SetSideboardLock cmd;
|
Command_SetSideboardLock cmd;
|
||||||
cmd.set_locked(sideboardLockButton->getState());
|
cmd.set_locked(sideboardLockButton->getState());
|
||||||
|
|
||||||
static_cast<TabGame *>(parent())->sendGameCommand(cmd, playerId);
|
parentGame->sendGameCommand(cmd, playerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckViewContainer::sideboardPlanChanged()
|
void DeckViewContainer::sideboardPlanChanged()
|
||||||
|
@ -268,7 +274,7 @@ void DeckViewContainer::sideboardPlanChanged()
|
||||||
const QList<MoveCard_ToZone> &newPlan = deckView->getSideboardPlan();
|
const QList<MoveCard_ToZone> &newPlan = deckView->getSideboardPlan();
|
||||||
for (int i = 0; i < newPlan.size(); ++i)
|
for (int i = 0; i < newPlan.size(); ++i)
|
||||||
cmd.add_move_list()->CopyFrom(newPlan[i]);
|
cmd.add_move_list()->CopyFrom(newPlan[i]);
|
||||||
static_cast<TabGame *>(parent())->sendGameCommand(cmd, playerId);
|
parentGame->sendGameCommand(cmd, playerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckViewContainer::setReadyStart(bool ready)
|
void DeckViewContainer::setReadyStart(bool ready)
|
||||||
|
@ -310,11 +316,10 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, GameReplay *_replay)
|
||||||
sayLabel(0),
|
sayLabel(0),
|
||||||
sayEdit(0)
|
sayEdit(0)
|
||||||
{
|
{
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
// THIS CTOR IS USED ON REPLAY
|
||||||
|
|
||||||
gameInfo.CopyFrom(replay->game_info());
|
gameInfo.CopyFrom(replay->game_info());
|
||||||
gameInfo.set_spectators_omniscient(true);
|
gameInfo.set_spectators_omniscient(true);
|
||||||
|
|
||||||
// Create list: event number -> time [ms]
|
// Create list: event number -> time [ms]
|
||||||
// Distribute simultaneous events evenly across 1 second.
|
// Distribute simultaneous events evenly across 1 second.
|
||||||
unsigned int lastEventTimestamp = 0;
|
unsigned int lastEventTimestamp = 0;
|
||||||
|
@ -323,106 +328,41 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, GameReplay *_replay)
|
||||||
int j = i + 1;
|
int j = i + 1;
|
||||||
while ((j < eventCount) && (replay->event_list(j).seconds_elapsed() == lastEventTimestamp))
|
while ((j < eventCount) && (replay->event_list(j).seconds_elapsed() == lastEventTimestamp))
|
||||||
++j;
|
++j;
|
||||||
|
|
||||||
const int numberEventsThisSecond = j - i;
|
const int numberEventsThisSecond = j - i;
|
||||||
for (int k = 0; k < numberEventsThisSecond; ++k)
|
for (int k = 0; k < numberEventsThisSecond; ++k)
|
||||||
replayTimeline.append(replay->event_list(i + k).seconds_elapsed() * 1000 + (int) ((qreal) k / (qreal) numberEventsThisSecond * 1000));
|
replayTimeline.append(replay->event_list(i + k).seconds_elapsed() * 1000 + (int) ((qreal) k / (qreal) numberEventsThisSecond * 1000));
|
||||||
|
|
||||||
if (j < eventCount)
|
if (j < eventCount)
|
||||||
lastEventTimestamp = replay->event_list(j).seconds_elapsed();
|
lastEventTimestamp = replay->event_list(j).seconds_elapsed();
|
||||||
i += numberEventsThisSecond - 1;
|
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;
|
addDockWidget(Qt::RightDockWidgetArea, cardInfoDock);
|
||||||
messageLogLayout->setContentsMargins(0, 0, 0, 0);
|
addDockWidget(Qt::RightDockWidgetArea, playerListDock);
|
||||||
messageLogLayout->addWidget(messageLog);
|
addDockWidget(Qt::RightDockWidgetArea, messageLayoutDock);
|
||||||
|
addDockWidget(Qt::BottomDockWidgetArea, replayDock);
|
||||||
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);
|
|
||||||
|
|
||||||
mainLayout = new QHBoxLayout;
|
mainWidget = new QStackedWidget(this);
|
||||||
mainLayout->addWidget(gameView, 10);
|
mainWidget->addWidget(deckViewContainerWidget);
|
||||||
mainLayout->addLayout(deckViewContainerLayout, 10);
|
mainWidget->addWidget(gamePlayAreaWidget);
|
||||||
mainLayout->addWidget(splitter);
|
setCentralWidget(mainWidget);
|
||||||
|
|
||||||
QHBoxLayout *replayControlLayout = new QHBoxLayout;
|
createReplayMenuItems();
|
||||||
replayControlLayout->addWidget(timelineWidget, 10);
|
createViewMenuItems();
|
||||||
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);
|
|
||||||
|
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutchanged()),this,SLOT(refreshShortcuts()));
|
connect(&settingsCache->shortcuts(), SIGNAL(shortCutchanged()),this,SLOT(refreshShortcuts()));
|
||||||
refreshShortcuts();
|
refreshShortcuts();
|
||||||
setLayout(superMainLayout);
|
|
||||||
|
|
||||||
splitter->restoreState(settingsCache->getTabGameSplitterSizes());
|
|
||||||
splitter->setChildrenCollapsible(false);
|
|
||||||
|
|
||||||
messageLog->logReplayStarted(gameInfo.game_id());
|
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)
|
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),
|
currentPhase(-1),
|
||||||
activeCard(0),
|
activeCard(0),
|
||||||
gameClosed(false),
|
gameClosed(false),
|
||||||
replay(0)
|
replay(0),
|
||||||
|
replayDock(0)
|
||||||
{
|
{
|
||||||
|
// THIS CTOR IS USED ON GAMES
|
||||||
gameInfo.set_started(false);
|
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;
|
createCardInfoDock();
|
||||||
hLayout->addWidget(sayLabel);
|
createPlayerListDock();
|
||||||
hLayout->addWidget(sayEdit);
|
createMessageDock();
|
||||||
|
createPlayAreaWidget();
|
||||||
deckViewContainerLayout = new QVBoxLayout;
|
createDeckViewContainerWidget();
|
||||||
|
|
||||||
QVBoxLayout *messageLogLayout = new QVBoxLayout;
|
addDockWidget(Qt::RightDockWidgetArea, cardInfoDock);
|
||||||
messageLogLayout->setContentsMargins(0, 0, 0, 0);
|
addDockWidget(Qt::RightDockWidgetArea, playerListDock);
|
||||||
messageLogLayout->addWidget(timeElapsedLabel);
|
addDockWidget(Qt::RightDockWidgetArea, messageLayoutDock);
|
||||||
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);
|
|
||||||
|
|
||||||
mainLayout = new QHBoxLayout;
|
mainWidget = new QStackedWidget(this);
|
||||||
mainLayout->addWidget(gameView, 10);
|
mainWidget->addWidget(deckViewContainerWidget);
|
||||||
mainLayout->addLayout(deckViewContainerLayout, 10);
|
mainWidget->addWidget(gamePlayAreaWidget);
|
||||||
mainLayout->addWidget(splitter);
|
setCentralWidget(mainWidget);
|
||||||
|
|
||||||
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()));
|
|
||||||
|
|
||||||
// Menu actions
|
createMenuItems();
|
||||||
aNextPhase = new QAction(this);
|
createViewMenuItems();
|
||||||
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);
|
|
||||||
|
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutchanged()),this,SLOT(refreshShortcuts()));
|
connect(&settingsCache->shortcuts(), SIGNAL(shortCutchanged()),this,SLOT(refreshShortcuts()));
|
||||||
refreshShortcuts();
|
refreshShortcuts();
|
||||||
setLayout(mainLayout);
|
|
||||||
|
|
||||||
splitter->restoreState(settingsCache->getTabGameSplitterSizes());
|
|
||||||
splitter->setChildrenCollapsible(false);
|
|
||||||
|
|
||||||
messageLog->logGameJoined(gameInfo.game_id());
|
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--)
|
for (int i = gameInfo.game_types_size() - 1; i >= 0; i--)
|
||||||
gameTypes.append(roomGameTypes.find(gameInfo.game_types(i)).value());
|
gameTypes.append(roomGameTypes.find(gameInfo.game_types(i)).value());
|
||||||
|
|
||||||
completer = new QCompleter(autocompleteUserList, sayEdit);
|
QTimer::singleShot(0, this, SLOT(loadLayout()));
|
||||||
completer->setCaseSensitivity(Qt::CaseInsensitive);
|
|
||||||
completer->setMaxVisibleItems(5);
|
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
completer->setFilterMode(Qt::MatchStartsWith);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
sayEdit->setCompleter(completer);
|
|
||||||
actCompleterChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabGame::addMentionTag(QString value) {
|
void TabGame::addMentionTag(QString value) {
|
||||||
|
@ -585,21 +425,34 @@ void TabGame::emitUserEvent() {
|
||||||
|
|
||||||
TabGame::~TabGame()
|
TabGame::~TabGame()
|
||||||
{
|
{
|
||||||
delete replay;
|
if(replay)
|
||||||
settingsCache->setTabGameSplitterSizes(splitter->saveState());
|
{
|
||||||
|
settingsCache->layouts().setReplayPlayAreaState(saveState());
|
||||||
|
settingsCache->layouts().setReplayPlayAreaGeometry(saveGeometry());
|
||||||
|
delete replay;
|
||||||
|
} else {
|
||||||
|
settingsCache->layouts().setGamePlayAreaState(saveState());
|
||||||
|
settingsCache->layouts().setGamePlayAreaGeometry(saveGeometry());
|
||||||
|
}
|
||||||
|
|
||||||
QMapIterator<int, Player *> i(players);
|
QMapIterator<int, Player *> i(players);
|
||||||
while (i.hasNext())
|
while (i.hasNext())
|
||||||
delete i.next().value();
|
delete i.next().value();
|
||||||
players.clear();
|
players.clear();
|
||||||
|
|
||||||
delete deckViewContainerLayout;
|
|
||||||
|
|
||||||
emit gameClosing(this);
|
emit gameClosing(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabGame::retranslateUi()
|
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) {
|
if (phasesMenu) {
|
||||||
for (int i = 0; i < phaseActions.size(); ++i)
|
for (int i = 0; i < phaseActions.size(); ++i)
|
||||||
phaseActions[i]->setText(phasesToolbar->getLongPhaseName(i));
|
phaseActions[i]->setText(phasesToolbar->getLongPhaseName(i));
|
||||||
|
@ -633,9 +486,33 @@ void TabGame::retranslateUi()
|
||||||
if (aCloseReplay) {
|
if (aCloseReplay) {
|
||||||
aCloseReplay->setText(tr("C&lose replay"));
|
aCloseReplay->setText(tr("C&lose replay"));
|
||||||
}
|
}
|
||||||
|
if (sayLabel){
|
||||||
if (sayLabel)
|
|
||||||
sayLabel->setText(tr("&Say:"));
|
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();
|
cardInfo->retranslateUi();
|
||||||
|
|
||||||
QMapIterator<int, Player *> i(players);
|
QMapIterator<int, Player *> i(players);
|
||||||
|
@ -955,8 +832,9 @@ void TabGame::startGame(bool resuming)
|
||||||
i.value()->setReadyStart(false);
|
i.value()->setReadyStart(false);
|
||||||
i.value()->hide();
|
i.value()->hide();
|
||||||
}
|
}
|
||||||
mainLayout->removeItem(deckViewContainerLayout);
|
|
||||||
|
mainWidget->setCurrentWidget(gamePlayAreaWidget);
|
||||||
|
|
||||||
if (!resuming) {
|
if (!resuming) {
|
||||||
QMapIterator<int, Player *> playerIterator(players);
|
QMapIterator<int, Player *> playerIterator(players);
|
||||||
while (playerIterator.hasNext())
|
while (playerIterator.hasNext())
|
||||||
|
@ -966,7 +844,6 @@ void TabGame::startGame(bool resuming)
|
||||||
playerListWidget->setGameStarted(true, resuming);
|
playerListWidget->setGameStarted(true, resuming);
|
||||||
gameInfo.set_started(true);
|
gameInfo.set_started(true);
|
||||||
static_cast<GameScene *>(gameView->scene())->rearrange();
|
static_cast<GameScene *>(gameView->scene())->rearrange();
|
||||||
gameView->show();
|
|
||||||
if(sayEdit && players.size() > 1)
|
if(sayEdit && players.size() > 1)
|
||||||
sayEdit->setFocus();
|
sayEdit->setFocus();
|
||||||
}
|
}
|
||||||
|
@ -981,12 +858,12 @@ void TabGame::stopGame()
|
||||||
i.next();
|
i.next();
|
||||||
i.value()->show();
|
i.value()->show();
|
||||||
}
|
}
|
||||||
mainLayout->insertLayout(1, deckViewContainerLayout, 10);
|
|
||||||
|
mainWidget->setCurrentWidget(deckViewContainerWidget);
|
||||||
|
|
||||||
playerListWidget->setActivePlayer(-1);
|
playerListWidget->setActivePlayer(-1);
|
||||||
playerListWidget->setGameStarted(false, false);
|
playerListWidget->setGameStarted(false, false);
|
||||||
gameInfo.set_started(false);
|
gameInfo.set_started(false);
|
||||||
gameView->hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabGame::closeGame()
|
void TabGame::closeGame()
|
||||||
|
@ -1335,3 +1212,478 @@ void TabGame::updateCardMenu(AbstractCardItem *card)
|
||||||
p = players.value(localPlayerId);
|
p = players.value(localPlayerId);
|
||||||
p->updateCardMenu(static_cast<CardItem *>(card));
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -56,6 +56,8 @@ class GameReplay;
|
||||||
class ServerInfo_User;
|
class ServerInfo_User;
|
||||||
class PendingCommand;
|
class PendingCommand;
|
||||||
class LineEditCompleter;
|
class LineEditCompleter;
|
||||||
|
class QDockWidget;
|
||||||
|
class QStackedWidget;
|
||||||
|
|
||||||
class ToggleButton : public QPushButton {
|
class ToggleButton : public QPushButton {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -77,6 +79,7 @@ private:
|
||||||
QPushButton *loadLocalButton, *loadRemoteButton;
|
QPushButton *loadLocalButton, *loadRemoteButton;
|
||||||
ToggleButton *readyStartButton, *sideboardLockButton;
|
ToggleButton *readyStartButton, *sideboardLockButton;
|
||||||
DeckView *deckView;
|
DeckView *deckView;
|
||||||
|
TabGame *parentGame;
|
||||||
int playerId;
|
int playerId;
|
||||||
private slots:
|
private slots:
|
||||||
void loadLocalDeck();
|
void loadLocalDeck();
|
||||||
|
@ -90,7 +93,7 @@ private slots:
|
||||||
signals:
|
signals:
|
||||||
void newCardAdded(AbstractCardItem *card);
|
void newCardAdded(AbstractCardItem *card);
|
||||||
public:
|
public:
|
||||||
DeckViewContainer(int _playerId, TabGame *parent = 0);
|
DeckViewContainer(int _playerId, TabGame *parent);
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
void setButtonsVisible(bool _visible);
|
void setButtonsVisible(bool _visible);
|
||||||
void setReadyStart(bool ready);
|
void setReadyStart(bool ready);
|
||||||
|
@ -121,6 +124,7 @@ private:
|
||||||
QStringList gameTypes;
|
QStringList gameTypes;
|
||||||
QCompleter *completer;
|
QCompleter *completer;
|
||||||
QStringList autocompleteUserList;
|
QStringList autocompleteUserList;
|
||||||
|
QStackedWidget * mainWidget;
|
||||||
|
|
||||||
// Replay related members
|
// Replay related members
|
||||||
GameReplay *replay;
|
GameReplay *replay;
|
||||||
|
@ -128,8 +132,7 @@ private:
|
||||||
QList<int> replayTimeline;
|
QList<int> replayTimeline;
|
||||||
ReplayTimelineWidget *timelineWidget;
|
ReplayTimelineWidget *timelineWidget;
|
||||||
QToolButton *replayStartButton, *replayPauseButton, *replayFastForwardButton;
|
QToolButton *replayStartButton, *replayPauseButton, *replayFastForwardButton;
|
||||||
|
|
||||||
QSplitter *splitter;
|
|
||||||
CardFrame *cardInfo;
|
CardFrame *cardInfo;
|
||||||
PlayerListWidget *playerListWidget;
|
PlayerListWidget *playerListWidget;
|
||||||
QLabel *timeElapsedLabel;
|
QLabel *timeElapsedLabel;
|
||||||
|
@ -140,13 +143,14 @@ private:
|
||||||
GameScene *scene;
|
GameScene *scene;
|
||||||
GameView *gameView;
|
GameView *gameView;
|
||||||
QMap<int, DeckViewContainer *> deckViewContainers;
|
QMap<int, DeckViewContainer *> deckViewContainers;
|
||||||
QVBoxLayout *deckViewContainerLayout;
|
QVBoxLayout *cardVInfoLayout, *messageLogLayout, *gamePlayAreaVBox, *deckViewContainerLayout;
|
||||||
QHBoxLayout *mainLayout;
|
QHBoxLayout *cardHInfoLayout, *sayHLayout, *mainHLayout, *replayControlLayout;
|
||||||
ZoneViewLayout *zoneLayout;
|
QWidget *cardBoxLayoutWidget, *messageLogLayoutWidget, *gamePlayAreaWidget, *deckViewContainerWidget, *replayControlWidget;
|
||||||
|
QDockWidget *cardInfoDock, *messageLayoutDock, *playerListDock, *replayDock;
|
||||||
QAction *playersSeparator;
|
QAction *playersSeparator;
|
||||||
QMenu *gameMenu;
|
QMenu *gameMenu, *phasesMenu, *viewMenu, *cardInfoDockMenu, *messageLayoutDockMenu, *playerListDockMenu, *replayDockMenu;
|
||||||
QMenu *phasesMenu;
|
QAction *aGameInfo, *aConcede, *aLeaveGame, *aCloseReplay, *aNextPhase, *aNextTurn, *aRemoveLocalArrows, *aRotateViewCW, *aRotateViewCCW, *aResetLayout, *aResetReplayLayout;
|
||||||
QAction *aGameInfo, *aConcede, *aLeaveGame, *aCloseReplay, *aNextPhase, *aNextTurn, *aRemoveLocalArrows, *aRotateViewCW, *aRotateViewCCW;
|
QAction *aCardInfoDockVisible, *aCardInfoDockFloating, *aMessageLayoutDockVisible, *aMessageLayoutDockFloating, *aPlayerListDockVisible, *aPlayerListDockFloating, *aReplayDockVisible, *aReplayDockFloating;
|
||||||
QList<QAction *> phaseActions;
|
QList<QAction *> phaseActions;
|
||||||
|
|
||||||
Player *addPlayer(int playerId, const ServerInfo_User &info);
|
Player *addPlayer(int playerId, const ServerInfo_User &info);
|
||||||
|
@ -171,6 +175,15 @@ private:
|
||||||
void eventSetActivePhase(const Event_SetActivePhase &event, int eventPlayerId, const GameEventContext &context);
|
void eventSetActivePhase(const Event_SetActivePhase &event, int eventPlayerId, const GameEventContext &context);
|
||||||
void eventPing(const Event_Ping &event, int eventPlayerId, const GameEventContext &context);
|
void eventPing(const Event_Ping &event, int eventPlayerId, const GameEventContext &context);
|
||||||
void emitUserEvent();
|
void emitUserEvent();
|
||||||
|
void createMenuItems();
|
||||||
|
void createReplayMenuItems();
|
||||||
|
void createViewMenuItems();
|
||||||
|
void createCardInfoDock(bool bReplay=false);
|
||||||
|
void createPlayerListDock(bool bReplay=false);
|
||||||
|
void createMessageDock(bool bReplay=false);
|
||||||
|
void createPlayAreaWidget(bool bReplay=false);
|
||||||
|
void createDeckViewContainerWidget(bool bReplay=false);
|
||||||
|
void createReplayDock();
|
||||||
signals:
|
signals:
|
||||||
void gameClosing(TabGame *tab);
|
void gameClosing(TabGame *tab);
|
||||||
void playerAdded(Player *player);
|
void playerAdded(Player *player);
|
||||||
|
@ -207,7 +220,14 @@ private slots:
|
||||||
|
|
||||||
void refreshShortcuts();
|
void refreshShortcuts();
|
||||||
|
|
||||||
|
void loadLayout();
|
||||||
void actCompleterChanged();
|
void actCompleterChanged();
|
||||||
|
void actResetLayout();
|
||||||
|
|
||||||
|
bool eventFilter(QObject *o, QEvent *e);
|
||||||
|
void dockVisibleTriggered();
|
||||||
|
void dockFloatingTriggered();
|
||||||
|
void dockTopLevelChanged(bool topLevel);
|
||||||
public:
|
public:
|
||||||
TabGame(TabSupervisor *_tabSupervisor, QList<AbstractClient *> &_clients, const Event_GameJoined &event, const QMap<int, QString> &_roomGameTypes);
|
TabGame(TabSupervisor *_tabSupervisor, QList<AbstractClient *> &_clients, const Event_GameJoined &event, const QMap<int, QString> &_roomGameTypes);
|
||||||
TabGame(TabSupervisor *_tabSupervisor, GameReplay *replay);
|
TabGame(TabSupervisor *_tabSupervisor, GameReplay *replay);
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QRadioButton>
|
#include <QRadioButton>
|
||||||
|
#include <QTabWidget>
|
||||||
#include "tab_logs.h"
|
#include "tab_logs.h"
|
||||||
#include "abstractclient.h"
|
#include "abstractclient.h"
|
||||||
#include "window_sets.h"
|
#include "window_sets.h"
|
||||||
|
@ -23,7 +24,27 @@
|
||||||
TabLog::TabLog(TabSupervisor *_tabSupervisor, AbstractClient *_client, QWidget *parent)
|
TabLog::TabLog(TabSupervisor *_tabSupervisor, AbstractClient *_client, QWidget *parent)
|
||||||
: Tab(_tabSupervisor, parent), client(_client)
|
: Tab(_tabSupervisor, parent), client(_client)
|
||||||
{
|
{
|
||||||
MainWindow = new QMainWindow;
|
roomTable = new QTableWidget();
|
||||||
|
roomTable->setColumnCount(6);
|
||||||
|
roomTable->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
|
roomTable->setHorizontalHeaderLabels(QString(tr("Time;SenderName;SenderIP;Message;TargetID;TargetName")).split(";"));
|
||||||
|
|
||||||
|
gameTable = new QTableWidget();
|
||||||
|
gameTable->setColumnCount(6);
|
||||||
|
gameTable->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
|
gameTable->setHorizontalHeaderLabels(QString(tr("Time;SenderName;SenderIP;Message;TargetID;TargetName")).split(";"));
|
||||||
|
|
||||||
|
chatTable = new QTableWidget();
|
||||||
|
chatTable->setColumnCount(6);
|
||||||
|
chatTable->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
|
chatTable->setHorizontalHeaderLabels(QString(tr("Time;SenderName;SenderIP;Message;TargetID;TargetName")).split(";"));
|
||||||
|
|
||||||
|
QTabWidget *tabManager = new QTabWidget();
|
||||||
|
tabManager->addTab(roomTable, tr("Room Logs"));
|
||||||
|
tabManager->addTab(gameTable, tr("Game Logs"));
|
||||||
|
tabManager->addTab(chatTable, tr("Chat Logs"));
|
||||||
|
setCentralWidget(tabManager);
|
||||||
|
|
||||||
createDock();
|
createDock();
|
||||||
restartLayout();
|
restartLayout();
|
||||||
clearClicked();
|
clearClicked();
|
||||||
|
@ -212,7 +233,7 @@ void TabLog::createDock()
|
||||||
buttonGroupBox = new QGroupBox(tr(""));
|
buttonGroupBox = new QGroupBox(tr(""));
|
||||||
buttonGroupBox->setLayout(buttonGrid);
|
buttonGroupBox->setLayout(buttonGrid);
|
||||||
|
|
||||||
mainLayout = new QVBoxLayout(MainWindow);
|
mainLayout = new QVBoxLayout(this);
|
||||||
mainLayout->addWidget(criteriaGroupBox);
|
mainLayout->addWidget(criteriaGroupBox);
|
||||||
mainLayout->addWidget(locationGroupBox);
|
mainLayout->addWidget(locationGroupBox);
|
||||||
mainLayout->addWidget(rangeGroupBox);
|
mainLayout->addWidget(rangeGroupBox);
|
||||||
|
@ -221,116 +242,94 @@ void TabLog::createDock()
|
||||||
mainLayout->addWidget(buttonGroupBox);
|
mainLayout->addWidget(buttonGroupBox);
|
||||||
mainLayout->setAlignment(Qt::AlignCenter);
|
mainLayout->setAlignment(Qt::AlignCenter);
|
||||||
|
|
||||||
searchDockContents = new QWidget(MainWindow);
|
searchDockContents = new QWidget(this);
|
||||||
searchDockContents->setLayout(mainLayout);
|
searchDockContents->setLayout(mainLayout);
|
||||||
|
|
||||||
searchDock = new QDockWidget(MainWindow);
|
searchDock = new QDockWidget(this);
|
||||||
searchDock->setFeatures(QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable);
|
searchDock->setFeatures(QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable);
|
||||||
searchDock->setWidget(searchDockContents);
|
searchDock->setWidget(searchDockContents);
|
||||||
|
|
||||||
QVBoxLayout *mainVLayoutContent = new QVBoxLayout;
|
|
||||||
QHBoxLayout *mainHLayoutContent = new QHBoxLayout;
|
|
||||||
mainHLayoutContent->addWidget(MainWindow);
|
|
||||||
mainHLayoutContent->addLayout(mainVLayoutContent);
|
|
||||||
setLayout(mainHLayoutContent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabLog::viewLogHistory_processResponse(const Response &resp)
|
void TabLog::viewLogHistory_processResponse(const Response &resp)
|
||||||
{
|
{
|
||||||
const Response_ViewLogHistory &response = resp.GetExtension(Response_ViewLogHistory::ext);
|
const Response_ViewLogHistory &response = resp.GetExtension(Response_ViewLogHistory::ext);
|
||||||
if (resp.response_code() == Response::RespOk) {
|
if (resp.response_code() != Response::RespOk) {
|
||||||
|
|
||||||
if (response.log_message_size() > 0) {
|
|
||||||
|
|
||||||
int j = 0;
|
|
||||||
QTableWidget *roomTable = new QTableWidget();
|
|
||||||
roomTable->setWindowTitle(tr("Room Logs"));
|
|
||||||
roomTable->setRowCount(response.log_message_size());
|
|
||||||
roomTable->setColumnCount(6);
|
|
||||||
roomTable->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
||||||
roomTable->setHorizontalHeaderLabels(QString(tr("Time;SenderName;SenderIP;Message;TargetID;TargetName")).split(";"));
|
|
||||||
|
|
||||||
int k = 0;
|
|
||||||
QTableWidget *gameTable = new QTableWidget();
|
|
||||||
gameTable->setWindowTitle(tr("Game Logs"));
|
|
||||||
gameTable->setRowCount(response.log_message_size());
|
|
||||||
gameTable->setColumnCount(6);
|
|
||||||
gameTable->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
||||||
gameTable->setHorizontalHeaderLabels(QString(tr("Time;SenderName;SenderIP;Message;TargetID;TargetName")).split(";"));
|
|
||||||
|
|
||||||
int l = 0;
|
|
||||||
QTableWidget *chatTable = new QTableWidget();
|
|
||||||
chatTable->setWindowTitle(tr("Chat Logs"));
|
|
||||||
chatTable->setRowCount(response.log_message_size());
|
|
||||||
chatTable->setColumnCount(6);
|
|
||||||
chatTable->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
||||||
chatTable->setHorizontalHeaderLabels(QString(tr("Time;SenderName;SenderIP;Message;TargetID;TargetName")).split(";"));
|
|
||||||
|
|
||||||
ServerInfo_ChatMessage message; for (int i = 0; i < response.log_message_size(); ++i) {
|
|
||||||
message = response.log_message(i);
|
|
||||||
if (QString::fromStdString(message.target_type()) == "room") {
|
|
||||||
roomTable->setItem(j, 0, new QTableWidgetItem(QString::fromStdString(message.time())));
|
|
||||||
roomTable->setItem(j, 1, new QTableWidgetItem(QString::fromStdString(message.sender_name())));
|
|
||||||
roomTable->setItem(j, 2, new QTableWidgetItem(QString::fromStdString(message.sender_ip())));
|
|
||||||
roomTable->setItem(j, 3, new QTableWidgetItem(QString::fromStdString(message.message())));
|
|
||||||
roomTable->setItem(j, 4, new QTableWidgetItem(QString::fromStdString(message.target_id())));
|
|
||||||
roomTable->setItem(j, 5, new QTableWidgetItem(QString::fromStdString(message.target_name())));
|
|
||||||
++j;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (QString::fromStdString(message.target_type()) == "game") {
|
|
||||||
gameTable->setItem(k, 0, new QTableWidgetItem(QString::fromStdString(message.time())));
|
|
||||||
gameTable->setItem(k, 1, new QTableWidgetItem(QString::fromStdString(message.sender_name())));
|
|
||||||
gameTable->setItem(k, 2, new QTableWidgetItem(QString::fromStdString(message.sender_ip())));
|
|
||||||
gameTable->setItem(k, 3, new QTableWidgetItem(QString::fromStdString(message.message())));
|
|
||||||
gameTable->setItem(k, 4, new QTableWidgetItem(QString::fromStdString(message.target_id())));
|
|
||||||
gameTable->setItem(k, 5, new QTableWidgetItem(QString::fromStdString(message.target_name())));
|
|
||||||
++k;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (QString::fromStdString(message.target_type()) == "chat") {
|
|
||||||
chatTable->setItem(l, 0, new QTableWidgetItem(QString::fromStdString(message.time())));
|
|
||||||
chatTable->setItem(l, 1, new QTableWidgetItem(QString::fromStdString(message.sender_name())));
|
|
||||||
chatTable->setItem(l, 2, new QTableWidgetItem(QString::fromStdString(message.sender_ip())));
|
|
||||||
chatTable->setItem(l, 3, new QTableWidgetItem(QString::fromStdString(message.message())));
|
|
||||||
chatTable->setItem(l, 4, new QTableWidgetItem(QString::fromStdString(message.target_id())));
|
|
||||||
chatTable->setItem(l, 5, new QTableWidgetItem(QString::fromStdString(message.target_name())));
|
|
||||||
++l;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
roomTable->setRowCount(j);
|
|
||||||
roomTable->resizeColumnsToContents();
|
|
||||||
gameTable->setRowCount(k);
|
|
||||||
gameTable->resizeColumnsToContents();
|
|
||||||
chatTable->setRowCount(l);
|
|
||||||
chatTable->resizeColumnsToContents();
|
|
||||||
|
|
||||||
if (mainRoom->isChecked()) {
|
|
||||||
roomTable->resize(600, 200);
|
|
||||||
roomTable->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gameRoom->isChecked()) {
|
|
||||||
gameTable->resize(600, 200);
|
|
||||||
gameTable->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (privateChat->isChecked()) {
|
|
||||||
chatTable->resize(600, 200);
|
|
||||||
chatTable->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else
|
|
||||||
QMessageBox::information(static_cast<QWidget *>(parent()), tr("Message History"), tr("There are no messages for the selected filters."));
|
|
||||||
|
|
||||||
} else
|
|
||||||
QMessageBox::critical(static_cast<QWidget *>(parent()), tr("Message History"), tr("Failed to collect message history information."));
|
QMessageBox::critical(static_cast<QWidget *>(parent()), tr("Message History"), tr("Failed to collect message history information."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.log_message_size() == 0) {
|
||||||
|
QMessageBox::information(static_cast<QWidget *>(parent()), tr("Message History"), tr("There are no messages for the selected filters."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int roomCounter = 0, gameCounter = 0, chatCounter = 0;
|
||||||
|
roomTable->setRowCount(roomCounter);
|
||||||
|
gameTable->setRowCount(gameCounter);
|
||||||
|
chatTable->setRowCount(chatCounter);
|
||||||
|
|
||||||
|
for (int i = 0; i < response.log_message_size(); ++i)
|
||||||
|
{
|
||||||
|
ServerInfo_ChatMessage message = response.log_message(i);
|
||||||
|
if (QString::fromStdString(message.target_type()) == "room") {
|
||||||
|
roomTable->insertRow(roomCounter);
|
||||||
|
roomTable->setItem(roomCounter, 0, new QTableWidgetItem(QString::fromStdString(message.time())));
|
||||||
|
roomTable->setItem(roomCounter, 1, new QTableWidgetItem(QString::fromStdString(message.sender_name())));
|
||||||
|
roomTable->setItem(roomCounter, 2, new QTableWidgetItem(QString::fromStdString(message.sender_ip())));
|
||||||
|
roomTable->setItem(roomCounter, 3, new QTableWidgetItem(QString::fromStdString(message.message())));
|
||||||
|
roomTable->setItem(roomCounter, 4, new QTableWidgetItem(QString::fromStdString(message.target_id())));
|
||||||
|
roomTable->setItem(roomCounter, 5, new QTableWidgetItem(QString::fromStdString(message.target_name())));
|
||||||
|
++roomCounter;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (QString::fromStdString(message.target_type()) == "game") {
|
||||||
|
gameTable->insertRow(gameCounter);
|
||||||
|
gameTable->setItem(gameCounter, 0, new QTableWidgetItem(QString::fromStdString(message.time())));
|
||||||
|
gameTable->setItem(gameCounter, 1, new QTableWidgetItem(QString::fromStdString(message.sender_name())));
|
||||||
|
gameTable->setItem(gameCounter, 2, new QTableWidgetItem(QString::fromStdString(message.sender_ip())));
|
||||||
|
gameTable->setItem(gameCounter, 3, new QTableWidgetItem(QString::fromStdString(message.message())));
|
||||||
|
gameTable->setItem(gameCounter, 4, new QTableWidgetItem(QString::fromStdString(message.target_id())));
|
||||||
|
gameTable->setItem(gameCounter, 5, new QTableWidgetItem(QString::fromStdString(message.target_name())));
|
||||||
|
++gameCounter;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (QString::fromStdString(message.target_type()) == "chat") {
|
||||||
|
chatTable->insertRow(chatCounter);
|
||||||
|
chatTable->setItem(chatCounter, 0, new QTableWidgetItem(QString::fromStdString(message.time())));
|
||||||
|
chatTable->setItem(chatCounter, 1, new QTableWidgetItem(QString::fromStdString(message.sender_name())));
|
||||||
|
chatTable->setItem(chatCounter, 2, new QTableWidgetItem(QString::fromStdString(message.sender_ip())));
|
||||||
|
chatTable->setItem(chatCounter, 3, new QTableWidgetItem(QString::fromStdString(message.message())));
|
||||||
|
chatTable->setItem(chatCounter, 4, new QTableWidgetItem(QString::fromStdString(message.target_id())));
|
||||||
|
chatTable->setItem(chatCounter, 5, new QTableWidgetItem(QString::fromStdString(message.target_name())));
|
||||||
|
++chatCounter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (roomCounter) {
|
||||||
|
roomTable->show();
|
||||||
|
roomTable->resizeColumnsToContents();
|
||||||
|
} else {
|
||||||
|
roomTable->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gameCounter) {
|
||||||
|
gameTable->resizeColumnsToContents();
|
||||||
|
gameTable->show();
|
||||||
|
} else {
|
||||||
|
gameTable->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chatCounter) {
|
||||||
|
chatTable->resizeColumnsToContents();
|
||||||
|
chatTable->show();
|
||||||
|
} else {
|
||||||
|
chatTable->hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabLog::restartLayout()
|
void TabLog::restartLayout()
|
||||||
{
|
{
|
||||||
searchDock->setFloating(false);
|
searchDock->setFloating(false);
|
||||||
MainWindow->addDockWidget(Qt::TopDockWidgetArea, searchDock);
|
addDockWidget(Qt::LeftDockWidgetArea, searchDock);
|
||||||
searchDock->setVisible(true);
|
searchDock->setVisible(true);
|
||||||
}
|
}
|
|
@ -16,10 +16,10 @@ class QLabel;
|
||||||
class QDockWidget;
|
class QDockWidget;
|
||||||
class QWidget;
|
class QWidget;
|
||||||
class QGridLayout;
|
class QGridLayout;
|
||||||
|
class QTableWidget;
|
||||||
class CommandContainer;
|
class CommandContainer;
|
||||||
class Response;
|
class Response;
|
||||||
class AbstractClient;
|
class AbstractClient;
|
||||||
class QMainWindow;
|
|
||||||
|
|
||||||
class TabLog : public Tab {
|
class TabLog : public Tab {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -36,7 +36,7 @@ private:
|
||||||
QGridLayout *criteriaGrid, *locationGrid, *rangeGrid, *maxResultsGrid, *descriptionGrid, *buttonGrid;
|
QGridLayout *criteriaGrid, *locationGrid, *rangeGrid, *maxResultsGrid, *descriptionGrid, *buttonGrid;
|
||||||
QGroupBox *criteriaGroupBox, *locationGroupBox, *rangeGroupBox, *maxResultsGroupBox, *descriptionGroupBox, *buttonGroupBox;
|
QGroupBox *criteriaGroupBox, *locationGroupBox, *rangeGroupBox, *maxResultsGroupBox, *descriptionGroupBox, *buttonGroupBox;
|
||||||
QVBoxLayout *mainLayout;
|
QVBoxLayout *mainLayout;
|
||||||
QMainWindow *MainWindow;
|
QTableWidget *roomTable, *gameTable, *chatTable;
|
||||||
|
|
||||||
void createDock();
|
void createDock();
|
||||||
signals:
|
signals:
|
||||||
|
|
|
@ -39,7 +39,10 @@ TabMessage::TabMessage(TabSupervisor *_tabSupervisor, AbstractClient *_client, c
|
||||||
addTabMenu(messageMenu);
|
addTabMenu(messageMenu);
|
||||||
|
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
setLayout(vbox);
|
|
||||||
|
QWidget * mainWidget = new QWidget(this);
|
||||||
|
mainWidget->setLayout(vbox);
|
||||||
|
setCentralWidget(mainWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
TabMessage::~TabMessage()
|
TabMessage::~TabMessage()
|
||||||
|
|
|
@ -106,7 +106,10 @@ TabReplays::TabReplays(TabSupervisor *_tabSupervisor, AbstractClient *_client)
|
||||||
rightToolBar->addAction(aDeleteRemoteReplay);
|
rightToolBar->addAction(aDeleteRemoteReplay);
|
||||||
|
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
setLayout(hbox);
|
|
||||||
|
QWidget * mainWidget = new QWidget(this);
|
||||||
|
mainWidget->setLayout(hbox);
|
||||||
|
setCentralWidget(mainWidget);
|
||||||
|
|
||||||
connect(client, SIGNAL(replayAddedEventReceived(const Event_ReplayAdded &)), this, SLOT(replayAddedEventReceived(const Event_ReplayAdded &)));
|
connect(client, SIGNAL(replayAddedEventReceived(const Event_ReplayAdded &)), this, SLOT(replayAddedEventReceived(const Event_ReplayAdded &)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,9 +104,6 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, ServerI
|
||||||
roomMenu->addAction(aLeaveRoom);
|
roomMenu->addAction(aLeaveRoom);
|
||||||
addTabMenu(roomMenu);
|
addTabMenu(roomMenu);
|
||||||
|
|
||||||
retranslateUi();
|
|
||||||
setLayout(hbox);
|
|
||||||
|
|
||||||
const int userListSize = info.user_list_size();
|
const int userListSize = info.user_list_size();
|
||||||
for (int i = 0; i < userListSize; ++i){
|
for (int i = 0; i < userListSize; ++i){
|
||||||
userList->processUserInfo(info.user_list(i), true);
|
userList->processUserInfo(info.user_list(i), true);
|
||||||
|
@ -130,6 +127,12 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, ServerI
|
||||||
actCompleterChanged();
|
actCompleterChanged();
|
||||||
connect(&settingsCache->shortcuts(), SIGNAL(shortCutchanged()),this,SLOT(refreshShortcuts()));
|
connect(&settingsCache->shortcuts(), SIGNAL(shortCutchanged()),this,SLOT(refreshShortcuts()));
|
||||||
refreshShortcuts();
|
refreshShortcuts();
|
||||||
|
|
||||||
|
retranslateUi();
|
||||||
|
|
||||||
|
QWidget * mainWidget = new QWidget(this);
|
||||||
|
mainWidget->setLayout(hbox);
|
||||||
|
setCentralWidget(mainWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
TabRoom::~TabRoom()
|
TabRoom::~TabRoom()
|
||||||
|
|
|
@ -140,8 +140,12 @@ TabServer::TabServer(TabSupervisor *_tabSupervisor, AbstractClient *_client, QWi
|
||||||
QVBoxLayout *vbox = new QVBoxLayout;
|
QVBoxLayout *vbox = new QVBoxLayout;
|
||||||
vbox->addWidget(roomSelector);
|
vbox->addWidget(roomSelector);
|
||||||
vbox->addWidget(serverInfoBox);
|
vbox->addWidget(serverInfoBox);
|
||||||
|
|
||||||
setLayout(vbox);
|
retranslateUi();
|
||||||
|
|
||||||
|
QWidget * mainWidget = new QWidget(this);
|
||||||
|
mainWidget->setLayout(vbox);
|
||||||
|
setCentralWidget(mainWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabServer::retranslateUi()
|
void TabServer::retranslateUi()
|
||||||
|
|
|
@ -75,7 +75,11 @@ TabUserLists::TabUserLists(TabSupervisor *_tabSupervisor, AbstractClient *_clien
|
||||||
mainLayout->addLayout(ignorePanel);
|
mainLayout->addLayout(ignorePanel);
|
||||||
mainLayout->addLayout(vbox);
|
mainLayout->addLayout(vbox);
|
||||||
|
|
||||||
setLayout(mainLayout);
|
retranslateUi();
|
||||||
|
|
||||||
|
QWidget * mainWidget = new QWidget(this);
|
||||||
|
mainWidget->setLayout(mainLayout);
|
||||||
|
setCentralWidget(mainWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabUserLists::addToBuddyList()
|
void TabUserLists::addToBuddyList()
|
||||||
|
|
Loading…
Reference in a new issue