mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-30 18:43:55 -07:00
Consolidate play/pause buttons in replays (#5131)
* Consolidate play/pause buttons in replays * always enable fast forward button * run formatter
This commit is contained in:
parent
4865269a73
commit
2d86938375
2 changed files with 19 additions and 33 deletions
|
|
@ -600,27 +600,16 @@ void TabGame::replayNextEvent()
|
||||||
|
|
||||||
void TabGame::replayFinished()
|
void TabGame::replayFinished()
|
||||||
{
|
{
|
||||||
replayStartButton->setEnabled(true);
|
replayPlayButton->setChecked(false);
|
||||||
replayPauseButton->setEnabled(false);
|
|
||||||
replayFastForwardButton->setEnabled(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabGame::replayStartButtonClicked()
|
void TabGame::replayPlayButtonToggled(bool checked)
|
||||||
{
|
{
|
||||||
replayStartButton->setEnabled(false);
|
if (checked) { // start replay
|
||||||
replayPauseButton->setEnabled(true);
|
timelineWidget->startReplay();
|
||||||
replayFastForwardButton->setEnabled(true);
|
} else { // pause replay
|
||||||
|
timelineWidget->stopReplay();
|
||||||
timelineWidget->startReplay();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void TabGame::replayPauseButtonClicked()
|
|
||||||
{
|
|
||||||
replayStartButton->setEnabled(true);
|
|
||||||
replayPauseButton->setEnabled(false);
|
|
||||||
replayFastForwardButton->setEnabled(false);
|
|
||||||
|
|
||||||
timelineWidget->stopReplay();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabGame::replayFastForwardButtonToggled(bool checked)
|
void TabGame::replayFastForwardButtonToggled(bool checked)
|
||||||
|
|
@ -1710,26 +1699,24 @@ void TabGame::createReplayDock()
|
||||||
connect(timelineWidget, SIGNAL(replayFinished()), this, SLOT(replayFinished()));
|
connect(timelineWidget, SIGNAL(replayFinished()), this, SLOT(replayFinished()));
|
||||||
connect(timelineWidget, &ReplayTimelineWidget::rewound, messageLog, &ChatView::clearChat);
|
connect(timelineWidget, &ReplayTimelineWidget::rewound, messageLog, &ChatView::clearChat);
|
||||||
|
|
||||||
replayStartButton = new QToolButton;
|
replayPlayButton = new QToolButton;
|
||||||
replayStartButton->setIconSize(QSize(32, 32));
|
replayPlayButton->setIconSize(QSize(32, 32));
|
||||||
replayStartButton->setIcon(QPixmap("theme:replay/start"));
|
QIcon playButtonIcon = QIcon();
|
||||||
connect(replayStartButton, SIGNAL(clicked()), this, SLOT(replayStartButtonClicked()));
|
playButtonIcon.addPixmap(QPixmap("theme:replay/start"), QIcon::Normal, QIcon::Off);
|
||||||
replayPauseButton = new QToolButton;
|
playButtonIcon.addPixmap(QPixmap("theme:replay/pause"), QIcon::Normal, QIcon::On);
|
||||||
replayPauseButton->setIconSize(QSize(32, 32));
|
replayPlayButton->setIcon(playButtonIcon);
|
||||||
replayPauseButton->setEnabled(false);
|
replayPlayButton->setCheckable(true);
|
||||||
replayPauseButton->setIcon(QPixmap("theme:replay/pause"));
|
connect(replayPlayButton, SIGNAL(toggled(bool)), this, SLOT(replayPlayButtonToggled(bool)));
|
||||||
connect(replayPauseButton, SIGNAL(clicked()), this, SLOT(replayPauseButtonClicked()));
|
|
||||||
replayFastForwardButton = new QToolButton;
|
replayFastForwardButton = new QToolButton;
|
||||||
replayFastForwardButton->setIconSize(QSize(32, 32));
|
replayFastForwardButton->setIconSize(QSize(32, 32));
|
||||||
replayFastForwardButton->setEnabled(false);
|
|
||||||
replayFastForwardButton->setIcon(QPixmap("theme:replay/fastforward"));
|
replayFastForwardButton->setIcon(QPixmap("theme:replay/fastforward"));
|
||||||
replayFastForwardButton->setCheckable(true);
|
replayFastForwardButton->setCheckable(true);
|
||||||
connect(replayFastForwardButton, SIGNAL(toggled(bool)), this, SLOT(replayFastForwardButtonToggled(bool)));
|
connect(replayFastForwardButton, SIGNAL(toggled(bool)), this, SLOT(replayFastForwardButtonToggled(bool)));
|
||||||
|
|
||||||
replayControlLayout = new QHBoxLayout;
|
replayControlLayout = new QHBoxLayout;
|
||||||
replayControlLayout->addWidget(timelineWidget, 10);
|
replayControlLayout->addWidget(timelineWidget, 10);
|
||||||
replayControlLayout->addWidget(replayStartButton);
|
replayControlLayout->addWidget(replayPlayButton);
|
||||||
replayControlLayout->addWidget(replayPauseButton);
|
|
||||||
replayControlLayout->addWidget(replayFastForwardButton);
|
replayControlLayout->addWidget(replayFastForwardButton);
|
||||||
|
|
||||||
replayControlWidget = new QWidget();
|
replayControlWidget = new QWidget();
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ private:
|
||||||
int currentReplayStep;
|
int currentReplayStep;
|
||||||
QList<int> replayTimeline;
|
QList<int> replayTimeline;
|
||||||
ReplayTimelineWidget *timelineWidget;
|
ReplayTimelineWidget *timelineWidget;
|
||||||
QToolButton *replayStartButton, *replayPauseButton, *replayFastForwardButton;
|
QToolButton *replayPlayButton, *replayFastForwardButton;
|
||||||
|
|
||||||
CardFrame *cardInfo;
|
CardFrame *cardInfo;
|
||||||
PlayerListWidget *playerListWidget;
|
PlayerListWidget *playerListWidget;
|
||||||
|
|
@ -220,8 +220,7 @@ signals:
|
||||||
private slots:
|
private slots:
|
||||||
void replayNextEvent();
|
void replayNextEvent();
|
||||||
void replayFinished();
|
void replayFinished();
|
||||||
void replayStartButtonClicked();
|
void replayPlayButtonToggled(bool checked);
|
||||||
void replayPauseButtonClicked();
|
|
||||||
void replayFastForwardButtonToggled(bool checked);
|
void replayFastForwardButtonToggled(bool checked);
|
||||||
|
|
||||||
void incrementGameTime();
|
void incrementGameTime();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue