|
From: Tapio V. <aa...@us...> - 2011-01-25 13:48:23
|
Module: editor
Branch: master
Commit: 78289f8ecaad76fbf30cbb59bd3d0245aebf19bd
Author: Tapio Vierros <tap...@gm...>
Date: Tue Jan 25 15:47:42 2011 +0200
Ask for saving also on window's X-button click.
---
editorapp.cc | 9 ++++++++-
editorapp.hh | 4 ++++
2 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/editorapp.cc b/editorapp.cc
index 8127f9b..2a817a7 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -6,6 +6,7 @@
#include <QMimeData>
#include <QWhatsThis>
#include <QUrl>
+#include <QCloseEvent>
#include <phonon/AudioOutput>
#include <iostream>
#include "config.hh"
@@ -334,7 +335,7 @@ void EditorApp::on_actionFoFMIDI_triggered()
void EditorApp::on_actionExit_triggered()
{
- if (promptSaving()) close();
+ close();
}
void EditorApp::on_actionUndo_triggered()
@@ -560,3 +561,9 @@ void EditorApp::on_chkFloating_stateChanged(int state)
operationDone(op);
}
}
+
+void EditorApp::closeEvent(QCloseEvent *event)
+{
+ if (promptSaving()) event->accept();
+ else event->ignore();
+}
diff --git a/editorapp.hh b/editorapp.hh
index 2b2172a..d516ab9 100644
--- a/editorapp.hh
+++ b/editorapp.hh
@@ -6,6 +6,7 @@
#include "song.hh"
class QProgressBar;
+class QCloseEvent;
class NoteLabel;
class NoteGraphWidget;
namespace Phonon {
@@ -73,6 +74,9 @@ public slots:
void on_cmbNoteType_currentIndexChanged(int);
void on_chkFloating_stateChanged(int);
+protected:
+ void closeEvent(QCloseEvent *event);
+
private:
Ui::EditorApp ui;
NoteGraphWidget *noteGraph;
|