added icon for expiration lock button, added close button to replay tab, minor GUI fixes

This commit is contained in:
Max-Wilhelm Bruker 2012-03-04 12:05:28 +01:00
parent acb03c2bf2
commit b0378544c4
8 changed files with 162 additions and 18 deletions

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 316 KiB

View file

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

View file

@ -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:

View file

@ -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"));
}
aLeaveGame->setText(tr("&Leave game"));
aLeaveGame->setShortcut(tr("Ctrl+Q"));
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:"));
@ -613,8 +623,9 @@ void TabGame::actLeaveGame()
if (!spectator)
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;
sendGameCommand(Command_LeaveGame());
if (!replay)
sendGameCommand(Command_LeaveGame());
deleteLater();
}

View file

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

View file

@ -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,7 +277,8 @@ void TabSupervisor::localGameJoined(const Event_GameJoined &event)
void TabSupervisor::gameLeft(TabGame *tab)
{
emit setMenu(0);
if (tab == currentWidget())
emit setMenu(0);
gameTabs.remove(tab->getGameId());
removeTab(indexOf(tab));
@ -295,12 +301,31 @@ void TabSupervisor::addRoomTab(const ServerInfo_Room &info, bool setCurrent)
void TabSupervisor::roomLeft(TabRoom *tab)
{
emit setMenu(0);
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,15 +341,10 @@ 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)
{
emit setMenu(0);
if (tab == currentWidget())
emit setMenu(0);
messageTabs.remove(tab->getUserName());
removeTab(indexOf(tab));

View file

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

View file

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