Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature/detach-window] Transfer size restrictions to embedded widget from SubWindow #7596

Open
wants to merge 4 commits into
base: feature/detach-window
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions plugins/LadspaBrowser/LadspaBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,13 @@ LadspaBrowserView::LadspaBrowserView( ToolPlugin * _tool ) :
hlayout->addWidget( ws );
hlayout->addSpacing( 10 );
hlayout->addStretch();

layout()->setSizeConstraint(QLayout::SetFixedSize);

hide();
if( parentWidget() )
{
parentWidget()->hide();
parentWidget()->layout()->setSizeConstraint(
QLayout::SetFixedSize );

Qt::WindowFlags flags = parentWidget()->windowFlags();
flags |= Qt::MSWindowsFixedSizeDialogHint;
flags &= ~Qt::WindowMaximizeButtonHint;
parentWidget()->setWindowFlags( flags );
}
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/TapTempo/TapTempoView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ TapTempoView::TapTempoView(TapTempo* plugin)
});

hide();
layout()->setSizeConstraint(QLayout::SetFixedSize);
if (parentWidget())
{
parentWidget()->hide();
parentWidget()->layout()->setSizeConstraint(QLayout::SetFixedSize);

Qt::WindowFlags flags = parentWidget()->windowFlags();
flags |= Qt::MSWindowsFixedSizeDialogHint;
Expand Down
9 changes: 3 additions & 6 deletions plugins/Vestige/Vestige.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -937,12 +937,9 @@ ManageVestigeInstrumentView::ManageVestigeInstrumentView( Instrument * _instrume
widget = new QWidget(this);
l = new QGridLayout( this );

m_vi->m_subWindow = getGUI()->mainWindow()->addWindowedWidget(nullptr, Qt::SubWindow |
Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
m_vi->m_subWindow->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::MinimumExpanding );
m_vi->m_subWindow->setFixedWidth( 960 );
m_vi->m_subWindow->setMinimumHeight( 300 );
m_vi->m_subWindow->setWidget(m_vi->m_scrollArea);
m_vi->m_subWindow = getGUI()->mainWindow()->addWindowedWidget(m_vi->m_scrollArea);
m_vi->m_scrollArea->setFixedWidth(960);
m_vi->m_scrollArea->setMinimumHeight(300);
m_vi->m_subWindow->setWindowTitle( m_vi->instrumentTrack()->name()
+ tr( " - VST plugin control" ) );
m_vi->m_subWindow->setWindowIcon( PLUGIN_NAME::getIconPixmap( "logo" ) );
Expand Down
3 changes: 2 additions & 1 deletion plugins/Vestige/Vestige.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include "Instrument.h"
#include "InstrumentView.h"
#include "SubWindow.h"


class QPixmap;
Expand Down Expand Up @@ -87,7 +88,7 @@ protected slots:
QMutex m_pluginMutex;

QString m_pluginDLL;
QMdiSubWindow * m_subWindow;
gui::SubWindow* m_subWindow;
QScrollArea * m_scrollArea;
FloatModel ** knobFModel;
QObject * p_subWindow;
Expand Down
7 changes: 1 addition & 6 deletions src/gui/ControllerRackView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,10 @@ ControllerRackView::ControllerRackView()
layout->addWidget( m_addButton );
this->setLayout( layout );

QMdiSubWindow * subWin = getGUI()->mainWindow()->addWindowedWidget( this );
SubWindow * subWin = getGUI()->mainWindow()->addWindowedWidget(this);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SubWindow * subWin = getGUI()->mainWindow()->addWindowedWidget(this);
SubWindow* subWin = getGUI()->mainWindow()->addWindowedWidget(this);


// TODO: Automate setting one of these, stop hardcoding title bar height
// Set dimensions for detached mode
setFixedWidth(350);
setMinimumHeight(200);
// Set dimensions for embedded mode
subWin->setFixedWidth(350);
subWin->setMinimumHeight(230);

// No maximize button
Qt::WindowFlags flags = subWin->windowFlags();
Expand Down
9 changes: 3 additions & 6 deletions src/gui/MicrotunerConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,10 @@ MicrotunerConfig::MicrotunerConfig() :
this->setLayout(microtunerLayout);

// Add to the main window and setup fixed size etc.
QMdiSubWindow *subWin = getGUI()->mainWindow()->addWindowedWidget(this);

SubWindow *subWin = getGUI()->mainWindow()->addWindowedWidget(this);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SubWindow *subWin = getGUI()->mainWindow()->addWindowedWidget(this);
SubWindow* subWin = getGUI()->mainWindow()->addWindowedWidget(this);

subWin->setAttribute(Qt::WA_DeleteOnClose, false);
subWin->setMinimumWidth(300);
subWin->setMinimumHeight(300);
subWin->setMaximumWidth(500);
subWin->setMaximumHeight(700);
setMinimumSize(300, 300);
setMaximumSize(500, 700);
subWin->hide();

// No maximize button
Expand Down
7 changes: 3 additions & 4 deletions src/gui/MidiCCRackView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ MidiCCRackView::MidiCCRackView(InstrumentTrack * track) :
setWindowIcon(embed::getIconPixmap("midi_cc_rack"));
setWindowTitle(tr("MIDI CC Rack - %1").arg(m_track->name()));

QMdiSubWindow * subWin = getGUI()->mainWindow()->addWindowedWidget(this);
SubWindow * subWin = getGUI()->mainWindow()->addWindowedWidget(this);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SubWindow * subWin = getGUI()->mainWindow()->addWindowedWidget(this);
SubWindow* subWin = getGUI()->mainWindow()->addWindowedWidget(this);

The asterisk should go on the left for new code


// Remove maximize button
Qt::WindowFlags flags = subWin->windowFlags();
Expand All @@ -58,9 +58,8 @@ MidiCCRackView::MidiCCRackView(InstrumentTrack * track) :

// Adjust window attributes, sizing and position
subWin->setAttribute(Qt::WA_DeleteOnClose, false);
subWin->resize(350, 300);
subWin->setFixedWidth(350);
subWin->setMinimumHeight(300);
setFixedWidth(350);
setMinimumHeight(300);
subWin->hide();

// Main window layout
Expand Down
8 changes: 1 addition & 7 deletions src/gui/MixerView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,17 +169,11 @@ MixerView::MixerView(Mixer* mixer) :
// adjust window size
layout()->invalidate();
resize(sizeHint());
if (parentWidget())
{
parentWidget()->resize(parentWidget()->sizeHint());
}
setFixedHeight(height());
layout()->setSizeConstraint(QLayout::SetMinimumSize);

// add ourself to workspace
QMdiSubWindow* subWin = mainWindow->addWindowedWidget(this);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is causing a build failure on Linux and MinGW because subWin is no longer used.
You could either remove subWin or use (void)subWin; so the compiler doesn't fail due to the unused variable.

layout()->setSizeConstraint(QLayout::SetMinimumSize);
subWin->layout()->setSizeConstraint(QLayout::SetMinAndMaxSize);
subWin->setFixedHeight(subWin->height());

parentWidget()->setAttribute(Qt::WA_DeleteOnClose, false);
parentWidget()->move(5, 310);
Expand Down
4 changes: 4 additions & 0 deletions src/gui/SubWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <QPushButton>
#include <QWindow>
#include <QStyleOption>
#include <QLayout>

#include "embed.h"

Expand Down Expand Up @@ -93,6 +94,8 @@ SubWindow::SubWindow(QWidget *parent, Qt::WindowFlags windowFlags) :
m_windowTitle->setAttribute( Qt::WA_TransparentForMouseEvents, true );
m_windowTitle->setGraphicsEffect( m_shadow );

layout()->setSizeConstraint(QLayout::SetMinAndMaxSize);

// Disable the minimize button and make sure that the custom window hint is set
setWindowFlags((this->windowFlags() & ~Qt::WindowMinimizeButtonHint) | Qt::CustomizeWindowHint);

Expand Down Expand Up @@ -518,4 +521,5 @@ bool SubWindow::eventFilter(QObject* obj, QEvent* event)
}
}


} // namespace lmms::gui
6 changes: 3 additions & 3 deletions src/gui/instrument/InstrumentTrackWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :

updateInstrumentView();

QMdiSubWindow* subWin = getGUI()->mainWindow()->addWindowedWidget( this );
SubWindow* subWin = getGUI()->mainWindow()->addWindowedWidget( this );
Qt::WindowFlags flags = subWin->windowFlags();
if (!m_instrumentView->isResizable()) {
flags |= Qt::MSWindowsFixedSizeDialogHint;
Expand All @@ -293,8 +293,8 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :
// Does the same thing, for detached detached windows, for other OSs.

} else {
subWin->setMaximumSize(m_instrumentView->maximumWidth() + 12, m_instrumentView->maximumHeight() + 208);
subWin->setMinimumSize(m_instrumentView->minimumWidth() + 12, m_instrumentView->minimumHeight() + 208);
setMaximumSize(m_instrumentView->maximumWidth() + 12, m_instrumentView->maximumHeight() + 208);
setMinimumSize(m_instrumentView->minimumWidth() + 12, m_instrumentView->minimumHeight() + 208);
}
flags &= ~Qt::WindowMaximizeButtonHint;
subWin->setWindowFlags( flags );
Expand Down
4 changes: 2 additions & 2 deletions src/gui/widgets/TempoSyncBarModelEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,11 @@ void TempoSyncBarModelEditor::showCustom()
if(m_custom == nullptr)
{
m_custom = new MeterDialog(getGUI()->mainWindow()->workspace());
QMdiSubWindow * subWindow = getGUI()->mainWindow()->addWindowedWidget(m_custom);
SubWindow * subWindow = getGUI()->mainWindow()->addWindowedWidget(m_custom);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SubWindow * subWindow = getGUI()->mainWindow()->addWindowedWidget(m_custom);
SubWindow* subWindow = getGUI()->mainWindow()->addWindowedWidget(m_custom);

Qt::WindowFlags flags = subWindow->windowFlags();
flags &= ~Qt::WindowMaximizeButtonHint;
subWindow->setWindowFlags(flags);
subWindow->setFixedSize(subWindow->size());
setFixedSize(size());
m_custom->setWindowTitle("Meter");
m_custom->setModel(&model()->getCustomMeterModel());
}
Expand Down
4 changes: 2 additions & 2 deletions src/gui/widgets/TempoSyncKnob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,11 @@ void TempoSyncKnob::showCustom()
if( m_custom == nullptr )
{
m_custom = new MeterDialog( getGUI()->mainWindow()->workspace() );
QMdiSubWindow * subWindow = getGUI()->mainWindow()->addWindowedWidget( m_custom );
SubWindow * subWindow = getGUI()->mainWindow()->addWindowedWidget(m_custom);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SubWindow * subWindow = getGUI()->mainWindow()->addWindowedWidget(m_custom);
SubWindow* subWindow = getGUI()->mainWindow()->addWindowedWidget(m_custom);

Qt::WindowFlags flags = subWindow->windowFlags();
flags &= ~Qt::WindowMaximizeButtonHint;
subWindow->setWindowFlags( flags );
subWindow->setFixedSize( subWindow->size() );
setFixedSize(size());
m_custom->setWindowTitle( "Meter" );
m_custom->setModel( &model()->m_custom );
}
Expand Down
Loading