Skip to content

Commit

Permalink
Clear pause state before removing all files in widgets app
Browse files Browse the repository at this point in the history
  • Loading branch information
adolby committed Oct 4, 2019
1 parent 228d86f commit 85ac356
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
15 changes: 11 additions & 4 deletions src/widgets/HeaderFrame.cpp
Expand Up @@ -73,11 +73,11 @@ Kryvo::HeaderFrame::HeaderFrame(QWidget* parent)
connect(d->pauseButton, &QPushButton::toggled,
this, &HeaderFrame::pause);
connect(d->pauseButton, &QPushButton::toggled,
this, &HeaderFrame::togglePauseIcon);
this, &HeaderFrame::pauseIconChecked);
connect(d->addFilesButton, &QPushButton::clicked,
this, &HeaderFrame::addFiles);
connect(d->clearFilesButton, &QPushButton::clicked,
this, &HeaderFrame::removeFiles);
this, &HeaderFrame::removeAllFiles);
connect(d->settingsButton, &QPushButton::clicked,
this, &HeaderFrame::switchFrame);
}
Expand All @@ -97,11 +97,18 @@ void Kryvo::HeaderFrame::setIconSize(const QSize& iconSize) {
d->clearFilesButton->setIconSize(d->iconSize);
}

void Kryvo::HeaderFrame::togglePauseIcon(const bool toggle) {
void Kryvo::HeaderFrame::removeAllFiles() {
Q_D(HeaderFrame);

d->pauseButton->setChecked(false);
emit removeFiles();
}

void Kryvo::HeaderFrame::pauseIconChecked(const bool checked) {
Q_D(HeaderFrame);
Q_ASSERT(d->pauseButton);

if (toggle) {
if (checked) {
d->pauseButton->setIcon(QIcon(QStringLiteral(":/images/resumeIcon.png")));
d->pauseButton->setText(tr(" Resume"));
} else {
Expand Down
7 changes: 2 additions & 5 deletions src/widgets/HeaderFrame.hpp
Expand Up @@ -58,11 +58,8 @@ class HeaderFrame : public QFrame {
void switchFrame();

private slots:
/*!
* \brief togglePauseIcon Toggles the pause button icon and text when the
* paused button is checked
*/
void togglePauseIcon(bool toggle);
void removeAllFiles();
void pauseIconChecked(bool checked);
};

} // namespace Kryvo
Expand Down

0 comments on commit 85ac356

Please sign in to comment.