Skip to content

Commit 841092b

Browse files
committed
Merge branch 'master' into wip-translator
2 parents 41826ca + e2dfef9 commit 841092b

File tree

7 files changed

+19
-8
lines changed

7 files changed

+19
-8
lines changed

.github/workflows/macos-ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
pull_request:
1010
branches:
1111
- master
12+
workflow_dispatch:
1213

1314
concurrency:
1415
group: ${{ github.workflow }}-${{ github.ref }}

.github/workflows/ubuntu-ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
pull_request:
1111
branches:
1212
- master
13+
workflow_dispatch:
1314

1415
concurrency:
1516
group: ${{ github.workflow }}-${{ github.ref }}

.github/workflows/windows-ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
pull_request:
1010
branches:
1111
- master
12+
workflow_dispatch:
1213

1314
concurrency:
1415
group: ${{ github.workflow }}-${{ github.ref }}

MusicPlayer/MainWindow/musplayer_qt.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <QUrl>
1111
#include <QMoveEvent>
1212
#include <QToolTip>
13+
#include <QElapsedTimer>
1314
#include <cmath>
1415

1516
#include "ui_player_main.h"
@@ -119,9 +120,9 @@ MusPlayer_Qt::MusPlayer_Qt(QWidget *parent) : QMainWindow(parent),
119120
Qt::WindowCloseButtonHint |
120121
Qt::WindowMinimizeButtonHint |
121122
Qt::MSWindowsFixedSizeDialogHint);
122-
QObject::connect(&m_blinker, SIGNAL(timeout()), this, SLOT(_blink_red()));
123-
QObject::connect(&m_positionWatcher, SIGNAL(timeout()), this, SLOT(updatePositionSlider()));
124-
QObject::connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
123+
QObject::connect(&m_blinker, &QTimer::timeout, this, &MusPlayer_Qt::_blink_red);
124+
QObject::connect(&m_positionWatcher, &QTimer::timeout, this, &MusPlayer_Qt::updatePositionSlider);
125+
QObject::connect(this, &QWidget::customContextMenuRequested, this, &MusPlayer_Qt::contextMenu);
125126
QObject::connect(ui->volume, &QSlider::valueChanged, [this](int x)
126127
{
127128
on_volume_valueChanged(x);
@@ -372,6 +373,8 @@ void MusPlayer_Qt::musicStopped()
372373
m_blinker.stop();
373374
ui->recordWav->setStyleSheet("");
374375
}
376+
377+
m_musicStopped = true;
375378
}
376379

377380
void MusPlayer_Qt::on_open_clicked()
@@ -388,15 +391,19 @@ void MusPlayer_Qt::on_open_clicked()
388391
return;
389392

390393
m_currentMusic = file;
391-
PGE_MusicPlayer::stopMusic();
392-
qApp->processEvents();
394+
on_stop_clicked();
393395
on_play_clicked();
394396
}
395397

396398
void MusPlayer_Qt::on_stop_clicked()
397399
{
398-
musicStopped();
400+
m_musicStopped = false;
399401
PGE_MusicPlayer::stopMusic();
402+
403+
// Wait until stop event will really happen, or finish on timeout
404+
QElapsedTimer waiter;
405+
while(!m_musicStopped && waiter.elapsed() < 1000)
406+
qApp->processEvents();
400407
}
401408

402409
void MusPlayer_Qt::on_play_clicked()

MusicPlayer/MainWindow/musplayer_qt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ private slots:
130130
bool m_positionWatcherLock = false;
131131
//! UI form class pointer
132132
Ui::MusPlayerQt *ui = nullptr;
133+
bool m_musicStopped = false;
133134

134135
QPoint m_oldWindowPos;
135136

0 commit comments

Comments
 (0)