Skip to content

Commit

Permalink
Fix some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
PhysSong committed Jun 17, 2018
1 parent 61605ce commit 0b5eae1
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 14 deletions.
1 change: 1 addition & 0 deletions include/SubWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public slots:
virtual void paintEvent( QPaintEvent * pe );
virtual void changeEvent( QEvent * event );
virtual void showEvent( QShowEvent* event );
virtual bool eventFilter( QObject * obj, QEvent * event ) override;

bool isDetached() const;

Expand Down
11 changes: 9 additions & 2 deletions plugins/vestige/vestige.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,15 @@ class vstSubWin : public QMdiSubWindow
{
// ignore close-events - for some reason otherwise the VST GUI
// remains hidden when re-opening
hide();
e->ignore();
if (windowFlags().testFlag(Qt::Window))
{
e->accept();
}
else
{
hide();
e->ignore();
}
}
};

Expand Down
17 changes: 16 additions & 1 deletion src/gui/ControllerDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

#include "ControllerDialog.h"
#include "Controller.h"
#include "GuiApplication.h"
#include "MainWindow.h"


ControllerDialog::ControllerDialog( Controller * _controller,
Expand All @@ -46,7 +48,20 @@ ControllerDialog::~ControllerDialog()

void ControllerDialog::closeEvent( QCloseEvent * _ce )
{
_ce->ignore();
if (windowFlags().testFlag(Qt::Window))
{
_ce->accept();
}
else if (gui->mainWindow()->workspace())
{
parentWidget()->hide();
_ce->ignore();
}
else
{
hide();
_ce->ignore();
}
emit closed();
}

Expand Down
17 changes: 16 additions & 1 deletion src/gui/EffectControlDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

#include "EffectControlDialog.h"
#include "EffectControls.h"
#include "GuiApplication.h"
#include "MainWindow.h"


EffectControlDialog::EffectControlDialog( EffectControls * _controls ) :
Expand All @@ -50,7 +52,20 @@ EffectControlDialog::~EffectControlDialog()

void EffectControlDialog::closeEvent( QCloseEvent * _ce )
{
_ce->ignore();
if (windowFlags().testFlag(Qt::Window))
{
_ce->accept();
}
else if (gui->mainWindow()->workspace())
{
parentWidget()->hide();
_ce->ignore();
}
else
{
hide();
_ce->ignore();
}
emit closed();
}

Expand Down
11 changes: 8 additions & 3 deletions src/gui/FxMixerView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,16 +544,21 @@ void FxMixerView::keyPressEvent(QKeyEvent * e)


void FxMixerView::closeEvent( QCloseEvent * _ce )
{
if( parentWidget() )
{
if (windowFlags().testFlag(Qt::Window))
{
_ce->accept();
}
else if (gui->mainWindow()->workspace())
{
parentWidget()->hide();
_ce->ignore();
}
else
{
hide();
_ce->ignore();
}
_ce->ignore();
}


Expand Down
15 changes: 15 additions & 0 deletions src/gui/SubWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ void SubWindow::detach()
if (isDetached()) {
return;
}

auto pos = mapToGlobal(widget()->pos());
widget()->setWindowFlags(Qt::Window);
widget()->show();
Expand Down Expand Up @@ -455,3 +456,17 @@ void SubWindow::resizeEvent( QResizeEvent * event )
m_trackedNormalGeom.setSize( event->size() );
}
}

bool SubWindow::eventFilter(QObject * obj, QEvent * event)
{
if (obj != static_cast<QObject *>(widget())) {
return QMdiSubWindow::eventFilter(obj, event);
}
switch (event->type()) {
case QEvent::WindowStateChange:
event->accept();
return true;
default:
return QMdiSubWindow::eventFilter(obj, event);
}
}
9 changes: 7 additions & 2 deletions src/gui/widgets/ControllerRackView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,19 @@ void ControllerRackView::addController()

void ControllerRackView::closeEvent( QCloseEvent * _ce )
{
if( parentWidget() )
if (windowFlags().testFlag(Qt::Window))
{
_ce->accept();
}
else if (gui->mainWindow()->workspace())
{
parentWidget()->hide();
_ce->ignore();
}
else
{
hide();
_ce->ignore();
}
_ce->ignore();
}

9 changes: 7 additions & 2 deletions src/gui/widgets/ProjectNotes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,13 +398,18 @@ void ProjectNotes::loadSettings( const QDomElement & _this )

void ProjectNotes::closeEvent( QCloseEvent * _ce )
{
if( parentWidget() )
if (windowFlags().testFlag(Qt::Window))
{
_ce->accept();
}
else if (gui->mainWindow()->workspace())
{
parentWidget()->hide();
_ce->ignore();
}
else
{
hide();
_ce->ignore();
}
_ce->ignore();
}
10 changes: 7 additions & 3 deletions src/tracks/InstrumentTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1686,15 +1686,19 @@ void InstrumentTrackWindow::toggleVisibility( bool on )

void InstrumentTrackWindow::closeEvent( QCloseEvent* event )
{
event->ignore();

if( gui->mainWindow()->workspace() )
if (windowFlags().testFlag(Qt::Window))
{
event->accept();
}
else if (gui->mainWindow()->workspace())
{
parentWidget()->hide();
event->ignore();
}
else
{
hide();
event->ignore();
}

m_itv->m_tlb->setFocus();
Expand Down

0 comments on commit 0b5eae1

Please sign in to comment.