Editors: Add to workspace in MainWindow class, not in themselves
This commit is contained in:
@@ -267,6 +267,8 @@ public:
|
||||
|
||||
AutomationEditor* m_editor;
|
||||
|
||||
QSize sizeHint() const;
|
||||
|
||||
signals:
|
||||
void currentPatternChanged();
|
||||
|
||||
|
||||
@@ -43,6 +43,8 @@ public:
|
||||
BBEditor( BBTrackContainer * _tc );
|
||||
~BBEditor();
|
||||
|
||||
QSize sizeHint() const;
|
||||
|
||||
const BBTrackContainerView* trackContainerView() const {
|
||||
return m_trackContainerView;
|
||||
}
|
||||
|
||||
@@ -379,6 +379,8 @@ public:
|
||||
return "pianoroll";
|
||||
}
|
||||
|
||||
QSize sizeHint() const;
|
||||
|
||||
signals:
|
||||
void currentPatternChanged();
|
||||
|
||||
|
||||
@@ -137,6 +137,8 @@ class SongEditorWindow : public Editor
|
||||
public:
|
||||
SongEditorWindow(Song* song);
|
||||
|
||||
QSize sizeHint() const;
|
||||
|
||||
SongEditor* m_editor;
|
||||
|
||||
protected slots:
|
||||
|
||||
@@ -2280,18 +2280,6 @@ AutomationEditorWindow::AutomationEditorWindow() :
|
||||
setFocusPolicy( Qt::StrongFocus );
|
||||
setFocus();
|
||||
setWindowIcon( embed::getIconPixmap( "automation" ) );
|
||||
|
||||
// Add us to workspace
|
||||
if( Engine::mainWindow()->workspace() )
|
||||
{
|
||||
parentWidget()->resize( INITIAL_WIDTH, INITIAL_HEIGHT );
|
||||
parentWidget()->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
resize( INITIAL_WIDTH, INITIAL_HEIGHT );
|
||||
hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2335,6 +2323,11 @@ int AutomationEditorWindow::quantization() const
|
||||
return m_editor->quantization();
|
||||
}
|
||||
|
||||
QSize AutomationEditorWindow::sizeHint() const
|
||||
{
|
||||
return {INITIAL_WIDTH, INITIAL_HEIGHT};
|
||||
}
|
||||
|
||||
void AutomationEditorWindow::play()
|
||||
{
|
||||
m_editor->play();
|
||||
|
||||
@@ -114,11 +114,6 @@ BBEditor::BBEditor( BBTrackContainer* tc ) :
|
||||
m_toolBar->addWidget( add_bar );
|
||||
m_toolBar->addSeparator();
|
||||
|
||||
parentWidget()->layout()->setSizeConstraint( QLayout::SetMinimumSize );
|
||||
parentWidget()->resize( minimumWidth(), 300 );
|
||||
parentWidget()->move( 610, 5 );
|
||||
parentWidget()->show();
|
||||
|
||||
connect( &tc->m_bbComboBoxModel, SIGNAL( dataChanged() ),
|
||||
m_trackContainerView, SLOT( updatePosition() ) );
|
||||
|
||||
@@ -134,13 +129,15 @@ BBEditor::BBEditor( BBTrackContainer* tc ) :
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
BBEditor::~BBEditor()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
QSize BBEditor::sizeHint() const
|
||||
{
|
||||
return {minimumWidth(), 300};
|
||||
}
|
||||
|
||||
|
||||
void BBEditor::removeBBView( int bb )
|
||||
@@ -149,8 +146,6 @@ void BBEditor::removeBBView( int bb )
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void BBEditor::play()
|
||||
{
|
||||
if( Engine::getSong()->playMode() != Song::Mode_PlayBB )
|
||||
@@ -164,8 +159,6 @@ void BBEditor::play()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void BBEditor::stop()
|
||||
{
|
||||
Engine::getSong()->stop();
|
||||
|
||||
@@ -98,11 +98,6 @@ Editor::Editor(bool record) :
|
||||
connect(m_recordAccompanyButton, SIGNAL(clicked()), this, SLOT(recordAccompany()));
|
||||
}
|
||||
connect(m_stopButton, SIGNAL(clicked()), this, SLOT(stop()));
|
||||
|
||||
|
||||
// Add editor to main window
|
||||
Engine::mainWindow()->workspace()->addSubWindow(this);
|
||||
parentWidget()->setAttribute(Qt::WA_DeleteOnClose, false);
|
||||
}
|
||||
|
||||
Editor::~Editor()
|
||||
|
||||
@@ -530,6 +530,28 @@ void MainWindow::finalize()
|
||||
SetupDialog sd( SetupDialog::AudioSettings );
|
||||
sd.exec();
|
||||
}
|
||||
|
||||
// Add editor subwindows
|
||||
for (QWidget* widget : QList<QWidget*>{
|
||||
Engine::automationEditor(),
|
||||
Engine::getBBEditor(),
|
||||
Engine::pianoRoll(),
|
||||
Engine::songEditor()
|
||||
})
|
||||
{
|
||||
QMdiSubWindow* window = workspace()->addSubWindow(widget);
|
||||
window->setWindowIcon(widget->windowIcon());
|
||||
window->setAttribute(Qt::WA_DeleteOnClose, false);
|
||||
window->resize(widget->sizeHint());
|
||||
}
|
||||
|
||||
Engine::automationEditor()->parentWidget()->hide();
|
||||
Engine::getBBEditor()->parentWidget()->move( 610, 5 );
|
||||
Engine::getBBEditor()->parentWidget()->show();
|
||||
Engine::pianoRoll()->parentWidget()->move(5, 5);
|
||||
Engine::pianoRoll()->parentWidget()->hide();
|
||||
Engine::songEditor()->parentWidget()->move(5, 5);
|
||||
Engine::songEditor()->parentWidget()->show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4222,18 +4222,6 @@ PianoRollWindow::PianoRollWindow() :
|
||||
setWindowIcon( embed::getIconPixmap( "piano" ) );
|
||||
setCurrentPattern( NULL );
|
||||
|
||||
if( Engine::mainWindow()->workspace() )
|
||||
{
|
||||
parentWidget()->resize(m_toolBar->sizeHint().width()+10, INITIAL_PIANOROLL_HEIGHT);
|
||||
parentWidget()->move( 5, 5 );
|
||||
parentWidget()->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
resize( m_toolBar->sizeHint().width()+10, INITIAL_PIANOROLL_HEIGHT );
|
||||
hide();
|
||||
}
|
||||
|
||||
// Connections
|
||||
connect(m_editor, SIGNAL(currentPatternChanged()), this, SIGNAL(currentPatternChanged()));
|
||||
}
|
||||
@@ -4294,8 +4282,12 @@ void PianoRollWindow::saveSettings(QDomDocument & doc, QDomElement & de)
|
||||
MainWindow::saveWidgetState(this, de);
|
||||
}
|
||||
|
||||
|
||||
void PianoRollWindow::loadSettings(const QDomElement & de)
|
||||
{
|
||||
MainWindow::restoreWidgetState(this, de);
|
||||
}
|
||||
|
||||
QSize PianoRollWindow::sizeHint() const
|
||||
{
|
||||
return {m_toolBar->sizeHint().width()+10, INITIAL_PIANOROLL_HEIGHT};
|
||||
}
|
||||
|
||||
@@ -680,10 +680,11 @@ SongEditorWindow::SongEditorWindow(Song* song) :
|
||||
m_toolBar->addSeparator();
|
||||
m_toolBar->addWidget( zoom_lbl );
|
||||
m_toolBar->addWidget( m_zoomingComboBox );
|
||||
}
|
||||
|
||||
parentWidget()->resize( 600, 300 );
|
||||
parentWidget()->move( 5, 5 );
|
||||
parentWidget()->show();
|
||||
QSize SongEditorWindow::sizeHint() const
|
||||
{
|
||||
return {600, 300};
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user