This commit is contained in:
Jonas Kvinge
2019-07-24 23:29:09 +02:00
parent da0d61f36a
commit 41484f8673
14 changed files with 135 additions and 41 deletions

View File

@@ -237,7 +237,8 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
playing_widget_(true),
doubleclick_addmode_(BehaviourSettingsPage::AddBehaviour_Append),
doubleclick_playmode_(BehaviourSettingsPage::PlayBehaviour_Never),
menu_playmode_(BehaviourSettingsPage::PlayBehaviour_Never)
menu_playmode_(BehaviourSettingsPage::PlayBehaviour_Never),
exit_count_(0)
{
qLog(Debug) << "Starting";
@@ -985,20 +986,26 @@ void MainWindow::SaveSettings() {
void MainWindow::Exit() {
++exit_count_;
SaveSettings();
if (app_->player()->engine()->is_fadeout_enabled()) {
// To shut down the application when fadeout will be finished
connect(app_->player()->engine(), SIGNAL(FadeoutFinishedSignal()), this, SLOT(DoExit()));
if (app_->player()->GetState() == Engine::Playing) {
app_->player()->Stop();
hide();
if (tray_icon_) tray_icon_->SetVisible(false);
return; // Don't quit the application now: wait for the fadeout finished signal
}
if (exit_count_ > 1) {
qApp->quit();
}
else {
if (app_->player()->engine()->is_fadeout_enabled()) {
// To shut down the application when fadeout will be finished
connect(app_->player()->engine(), SIGNAL(FadeoutFinishedSignal()), this, SLOT(DoExit()));
if (app_->player()->GetState() == Engine::Playing) {
app_->player()->Stop();
hide();
if (tray_icon_) tray_icon_->SetVisible(false);
return; // Don't quit the application now: wait for the fadeout finished signal
}
}
DoExit();
}
DoExit();
}
@@ -1323,8 +1330,8 @@ void MainWindow::closeEvent(QCloseEvent *event) {
}
else {
Exit();
QApplication::quit();
}
}
void MainWindow::SetHiddenInTray(bool hidden) {