From c353f81d59d0e6d65582d416da9cd1fd48bc5a59 Mon Sep 17 00:00:00 2001 From: Daniel Winzen Date: Wed, 24 Dec 2014 17:11:36 +0100 Subject: [PATCH] Hide windows instead of closing them when clicking on close --- include/BBEditor.h | 3 +++ include/ControllerRackView.h | 3 +++ include/FxMixerView.h | 3 +++ include/ProjectNotes.h | 2 ++ include/SongEditor.h | 2 ++ src/gui/BBEditor.cpp | 12 ++++++++++++ src/gui/FxMixerView.cpp | 15 +++++++++++++++ src/gui/SongEditor.cpp | 15 +++++++++++++++ src/gui/widgets/ControllerRackView.cpp | 12 ++++++++++++ src/gui/widgets/ProjectNotes.cpp | 13 +++++++++++++ 10 files changed, 80 insertions(+) diff --git a/include/BBEditor.h b/include/BBEditor.h index 84b99a0da..e1a286ac3 100644 --- a/include/BBEditor.h +++ b/include/BBEditor.h @@ -61,6 +61,9 @@ public slots: void addSteps(); void removeSteps(); +protected: + virtual void closeEvent( QCloseEvent * _ce ); + private: virtual void keyPressEvent( QKeyEvent * _ke ); diff --git a/include/ControllerRackView.h b/include/ControllerRackView.h index 3a64ff867..eb99ded4d 100644 --- a/include/ControllerRackView.h +++ b/include/ControllerRackView.h @@ -26,6 +26,7 @@ #define CONTROLLER_RACK_VIEW_H #include +#include #include "SerializingObject.h" #include "lmms_basics.h" @@ -56,6 +57,8 @@ public: public slots: void deleteController( ControllerView * _view ); +protected: + virtual void closeEvent( QCloseEvent * _ce ); private slots: virtual void update(); diff --git a/include/FxMixerView.h b/include/FxMixerView.h index e2cee4be6..83010c4cb 100644 --- a/include/FxMixerView.h +++ b/include/FxMixerView.h @@ -99,6 +99,9 @@ public: // make sure the display syncs up with the fx mixer. // useful for loading projects void refreshDisplay(); + +protected: + virtual void closeEvent( QCloseEvent * _ce ); private slots: void updateFaders(); diff --git a/include/ProjectNotes.h b/include/ProjectNotes.h index 80a6748da..998f47d99 100644 --- a/include/ProjectNotes.h +++ b/include/ProjectNotes.h @@ -27,6 +27,7 @@ #define PROJECT_NOTES_H #include +#include #include "JournallingObject.h" @@ -56,6 +57,7 @@ public: protected: + virtual void closeEvent( QCloseEvent * _ce ); void setupActions(); diff --git a/include/SongEditor.h b/include/SongEditor.h index bb40155eb..96dcfdfd2 100644 --- a/include/SongEditor.h +++ b/include/SongEditor.h @@ -65,6 +65,8 @@ public: public slots: void scrolled( int _new_pos ); +protected: + virtual void closeEvent( QCloseEvent * _ce ); private slots: void setHighQuality( bool ); diff --git a/src/gui/BBEditor.cpp b/src/gui/BBEditor.cpp index d57da6441..2e661bc82 100644 --- a/src/gui/BBEditor.cpp +++ b/src/gui/BBEditor.cpp @@ -322,4 +322,16 @@ void BBEditor::keyPressEvent( QKeyEvent * _ke ) +void BBEditor::closeEvent( QCloseEvent * _ce ) + { + if( parentWidget() ) + { + parentWidget()->hide(); + } + else + { + hide(); + } + _ce->ignore(); + } diff --git a/src/gui/FxMixerView.cpp b/src/gui/FxMixerView.cpp index aefdcf274..d278608c3 100644 --- a/src/gui/FxMixerView.cpp +++ b/src/gui/FxMixerView.cpp @@ -480,6 +480,21 @@ void FxMixerView::keyPressEvent(QKeyEvent * e) +void FxMixerView::closeEvent( QCloseEvent * _ce ) + { + if( parentWidget() ) + { + parentWidget()->hide(); + } + else + { + hide(); + } + _ce->ignore(); + } + + + void FxMixerView::setCurrentFxLine( int _line ) { if( _line >= 0 && _line < m_fxChannelViews.size() ) diff --git a/src/gui/SongEditor.cpp b/src/gui/SongEditor.cpp index bb477be56..f37f35c3c 100644 --- a/src/gui/SongEditor.cpp +++ b/src/gui/SongEditor.cpp @@ -576,6 +576,21 @@ void SongEditor::wheelEvent( QWheelEvent * _we ) +void SongEditor::closeEvent( QCloseEvent * _ce ) + { + if( parentWidget() ) + { + parentWidget()->hide(); + } + else + { + hide(); + } + _ce->ignore(); + } + + + void SongEditor::masterVolumeChanged( int _new_val ) { diff --git a/src/gui/widgets/ControllerRackView.cpp b/src/gui/widgets/ControllerRackView.cpp index 7ec3ab711..327ab5ab1 100644 --- a/src/gui/widgets/ControllerRackView.cpp +++ b/src/gui/widgets/ControllerRackView.cpp @@ -195,4 +195,16 @@ void ControllerRackView::addController() +void ControllerRackView::closeEvent( QCloseEvent * _ce ) + { + if( parentWidget() ) + { + parentWidget()->hide(); + } + else + { + hide(); + } + _ce->ignore(); + } diff --git a/src/gui/widgets/ProjectNotes.cpp b/src/gui/widgets/ProjectNotes.cpp index bc6908f50..5137e8311 100644 --- a/src/gui/widgets/ProjectNotes.cpp +++ b/src/gui/widgets/ProjectNotes.cpp @@ -396,4 +396,17 @@ void ProjectNotes::loadSettings( const QDomElement & _this ) +void ProjectNotes::closeEvent( QCloseEvent * _ce ) +{ + if( parentWidget() ) + { + parentWidget()->hide(); + } + else + { + hide(); + } + _ce->ignore(); + } +