added icon for expiration lock button, added close button to replay tab, minor GUI fixes
This commit is contained in:
parent
acb03c2bf2
commit
b0378544c4
8 changed files with 162 additions and 18 deletions
103
cockatrice/resources/lock.svg
Normal file
103
cockatrice/resources/lock.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 316 KiB |
|
@ -63,6 +63,11 @@ QSize ReplayTimelineWidget::sizeHint() const
|
|||
return QSize(-1, 50);
|
||||
}
|
||||
|
||||
QSize ReplayTimelineWidget::minimumSizeHint() const
|
||||
{
|
||||
return QSize(400, 50);
|
||||
}
|
||||
|
||||
void ReplayTimelineWidget::replayTimerTimeout()
|
||||
{
|
||||
currentTime += 200;
|
||||
|
|
|
@ -27,6 +27,7 @@ public:
|
|||
ReplayTimelineWidget(QWidget *parent = 0);
|
||||
void setTimeline(const QList<int> &_replayTimeline);
|
||||
QSize sizeHint() const;
|
||||
QSize minimumSizeHint() const;
|
||||
void setTimeScaleFactor(qreal _timeScaleFactor);
|
||||
int getCurrentEvent() const { return currentEvent; }
|
||||
public slots:
|
||||
|
|
|
@ -213,6 +213,8 @@ TabGame::TabGame(GameReplay *_replay)
|
|||
replay(_replay),
|
||||
currentReplayStep(0)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
gameId = replay->game_info().game_id();
|
||||
gameDescription = QString::fromStdString(replay->game_info().description());
|
||||
|
||||
|
@ -323,12 +325,13 @@ TabGame::TabGame(GameReplay *_replay)
|
|||
aNextTurn = 0;
|
||||
aRemoveLocalArrows = 0;
|
||||
aConcede = 0;
|
||||
aLeaveGame = new QAction(this);
|
||||
connect(aLeaveGame, SIGNAL(triggered()), this, SLOT(actLeaveGame()));
|
||||
aLeaveGame = 0;
|
||||
aCloseReplay = new QAction(this);
|
||||
connect(aCloseReplay, SIGNAL(triggered()), this, SLOT(actLeaveGame()));
|
||||
|
||||
phasesMenu = 0;
|
||||
tabMenu = new QMenu(this);
|
||||
tabMenu->addAction(aLeaveGame);
|
||||
tabMenu->addAction(aCloseReplay);
|
||||
|
||||
retranslateUi();
|
||||
setLayout(superMainLayout);
|
||||
|
@ -424,6 +427,7 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, QList<AbstractClient *> &_client
|
|||
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) {
|
||||
|
@ -502,8 +506,14 @@ void TabGame::retranslateUi()
|
|||
aConcede->setText(tr("&Concede"));
|
||||
aConcede->setShortcut(tr("F2"));
|
||||
}
|
||||
if (aLeaveGame) {
|
||||
aLeaveGame->setText(tr("&Leave game"));
|
||||
aLeaveGame->setShortcut(tr("Ctrl+Q"));
|
||||
}
|
||||
if (aCloseReplay) {
|
||||
aCloseReplay->setText(tr("C&lose replay"));
|
||||
aCloseReplay->setShortcut(tr("Ctrl+Q"));
|
||||
}
|
||||
|
||||
if (sayLabel)
|
||||
sayLabel->setText(tr("&Say:"));
|
||||
|
@ -614,6 +624,7 @@ void TabGame::actLeaveGame()
|
|||
if (QMessageBox::question(this, tr("Leave game"), tr("Are you sure you want to leave this game?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes)
|
||||
return;
|
||||
|
||||
if (!replay)
|
||||
sendGameCommand(Command_LeaveGame());
|
||||
deleteLater();
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ private:
|
|||
ZoneViewLayout *zoneLayout;
|
||||
QAction *playersSeparator;
|
||||
QMenu *phasesMenu;
|
||||
QAction *aConcede, *aLeaveGame, *aNextPhase, *aNextTurn, *aRemoveLocalArrows;
|
||||
QAction *aConcede, *aLeaveGame, *aCloseReplay, *aNextPhase, *aNextTurn, *aRemoveLocalArrows;
|
||||
QList<QAction *> phaseActions;
|
||||
|
||||
Player *addPlayer(int playerId, const ServerInfo_User &info);
|
||||
|
|
|
@ -209,6 +209,11 @@ void TabSupervisor::stop()
|
|||
gameIterator.next().value()->deleteLater();
|
||||
gameTabs.clear();
|
||||
|
||||
QListIterator<TabGame *> replayIterator(replayTabs);
|
||||
while (replayIterator.hasNext())
|
||||
replayIterator.next()->deleteLater();
|
||||
replayTabs.clear();
|
||||
|
||||
QMapIterator<QString, TabMessage *> messageIterator(messageTabs);
|
||||
while (messageIterator.hasNext())
|
||||
messageIterator.next().value()->deleteLater();
|
||||
|
@ -272,6 +277,7 @@ void TabSupervisor::localGameJoined(const Event_GameJoined &event)
|
|||
|
||||
void TabSupervisor::gameLeft(TabGame *tab)
|
||||
{
|
||||
if (tab == currentWidget())
|
||||
emit setMenu(0);
|
||||
|
||||
gameTabs.remove(tab->getGameId());
|
||||
|
@ -295,12 +301,31 @@ void TabSupervisor::addRoomTab(const ServerInfo_Room &info, bool setCurrent)
|
|||
|
||||
void TabSupervisor::roomLeft(TabRoom *tab)
|
||||
{
|
||||
if (tab == currentWidget())
|
||||
emit setMenu(0);
|
||||
|
||||
roomTabs.remove(tab->getRoomId());
|
||||
removeTab(indexOf(tab));
|
||||
}
|
||||
|
||||
void TabSupervisor::openReplay(GameReplay *replay)
|
||||
{
|
||||
TabGame *replayTab = new TabGame(replay);
|
||||
connect(replayTab, SIGNAL(gameClosing(TabGame *)), this, SLOT(replayLeft(TabGame *)));
|
||||
int tabIndex = myAddTab(replayTab);
|
||||
addCloseButtonToTab(replayTab, tabIndex);
|
||||
replayTabs.append(replayTab);
|
||||
setCurrentWidget(replayTab);
|
||||
}
|
||||
|
||||
void TabSupervisor::replayLeft(TabGame *tab)
|
||||
{
|
||||
if (tab == currentWidget())
|
||||
emit setMenu(0);
|
||||
|
||||
replayTabs.removeAt(replayTabs.indexOf(tab));
|
||||
}
|
||||
|
||||
TabMessage *TabSupervisor::addMessageTab(const QString &receiverName, bool focus)
|
||||
{
|
||||
if (receiverName == QString::fromStdString(userInfo->name()))
|
||||
|
@ -316,14 +341,9 @@ TabMessage *TabSupervisor::addMessageTab(const QString &receiverName, bool focus
|
|||
return tab;
|
||||
}
|
||||
|
||||
void TabSupervisor::openReplay(GameReplay *replay)
|
||||
{
|
||||
TabGame *replayTab = new TabGame(replay);
|
||||
myAddTab(replayTab);
|
||||
}
|
||||
|
||||
void TabSupervisor::talkLeft(TabMessage *tab)
|
||||
{
|
||||
if (tab == currentWidget())
|
||||
emit setMenu(0);
|
||||
|
||||
messageTabs.remove(tab->getUserName());
|
||||
|
|
|
@ -50,6 +50,7 @@ private:
|
|||
TabAdmin *tabAdmin;
|
||||
QMap<int, TabRoom *> roomTabs;
|
||||
QMap<int, TabGame *> gameTabs;
|
||||
QList<TabGame *> replayTabs;
|
||||
QMap<QString, TabMessage *> messageTabs;
|
||||
int myAddTab(Tab *tab);
|
||||
void addCloseButtonToTab(Tab *tab, int tabIndex);
|
||||
|
@ -81,6 +82,7 @@ private slots:
|
|||
void roomLeft(TabRoom *tab);
|
||||
TabMessage *addMessageTab(const QString &userName, bool focus);
|
||||
void openReplay(GameReplay *replay);
|
||||
void replayLeft(TabGame *tab);
|
||||
void processUserLeft(const QString &userName);
|
||||
void processUserJoined(const QString &userName);
|
||||
void talkLeft(TabMessage *tab);
|
||||
|
|
|
@ -38,6 +38,8 @@ void SearchLineEdit::keyPressEvent(QKeyEvent *event)
|
|||
WndDeckEditor::WndDeckEditor(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
aSearch = new QAction(tr("&Search..."), this);
|
||||
aSearch->setIcon(QIcon(":/resources/icon_search.svg"));
|
||||
connect(aSearch, SIGNAL(triggered()), this, SLOT(actSearch()));
|
||||
|
|
Loading…
Reference in a new issue