Skip to content

Commit

Permalink
Revert "Merge pull request #5011 from Obliquely/palette-docking-issue"
Browse files Browse the repository at this point in the history
This reverts commit 19f51cf.
  • Loading branch information
anatoly-os committed May 28, 2019
1 parent 6c17d52 commit 0eb3bb5
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 82 deletions.
2 changes: 1 addition & 1 deletion mscore/inspector/inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void MuseScore::showInspector(bool visible)
addDockWidget(Qt::RightDockWidgetArea, _inspector);
}
if (_inspector)
reDisplayDockWidget(_inspector, visible);
_inspector->setVisible(visible);
if (visible)
updateInspector();
}
Expand Down
2 changes: 1 addition & 1 deletion mscore/menus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,7 @@ void MuseScore::showPalette(bool visible)
updateIcons();
}
if (paletteBox) // read failed?
reDisplayDockWidget(paletteBox, visible);
paletteBox->setVisible(visible);
a->setChecked(visible);
}

Expand Down
67 changes: 37 additions & 30 deletions mscore/mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,19 @@ Mixer::Mixer(QWidget* parent)
showDetails(true),
trackHolder(nullptr)
{

// note: because of setupUi side-effects (generating a showEvent) it's critical
// that enablePlay is created first.
enablePlay = new EnablePlayForWidget(this);
setupUi(this);

setupUi(this); //
setWindowFlags(Qt::Tool);
setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
setAllowedAreas(Qt::DockWidgetAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea));

trackAreaLayout = new QHBoxLayout;
trackAreaLayout->setMargin(0);
trackAreaLayout->setSpacing(0);
trackArea->setLayout(trackAreaLayout);

mixerDetails = new MixerDetails(this);
detailsLayout = new QGridLayout();
detailsLayout = new QGridLayout(this);

detailsLayout->addWidget(mixerDetails);
detailsLayout->setContentsMargins(0, 0, 0, 0);
Expand Down Expand Up @@ -121,6 +120,8 @@ Mixer::Mixer(QWidget* parent)
connect(tracks_scrollArea->horizontalScrollBar(), SIGNAL(rangeChanged(int, int)), SLOT(adjustScrollPosition(int, int)));
connect(tracks_scrollArea->horizontalScrollBar(), SIGNAL(valueChanged(int)), SLOT(checkKeptScrollValue(int)));

enablePlay = new EnablePlayForWidget(this);
readSettings();
retranslate(true);
}

Expand Down Expand Up @@ -199,10 +200,6 @@ void Mixer::masterVolumeChanged(double decibels)

void Mixer::on_partOnlyCheckBox_toggled(bool checked)
{

if (!_activeScore) // cope with case of no score being present
return;

if (!_activeScore->excerpt())
return;

Expand Down Expand Up @@ -250,17 +247,8 @@ void Mixer::showEvent(QShowEvent* e)
{
enablePlay->showEvent(e);
QWidget::showEvent(e);
getAction("toggle-mixer")->setChecked(true);
}

//---------------------------------------------------------
// hideEvent
//---------------------------------------------------------

void Mixer::hideEvent(QHideEvent* e)
{
QWidget::hideEvent(e);
getAction("toggle-mixer")->setChecked(false);
activateWindow();
setFocus();
}

//---------------------------------------------------------
Expand Down Expand Up @@ -473,28 +461,47 @@ void Mixer::notifyTrackSelected(MixerTrack* track)
mixerDetails->setTrack(track->mti());
}


//---------------------------------------------------------
// writeSettings
//---------------------------------------------------------

void Mixer::writeSettings()
{
MuseScore::saveGeometry(this);
}

//---------------------------------------------------------
// readSettings
//---------------------------------------------------------

void Mixer::readSettings()
{
resize(QSize(480, 600)); //ensure default size if no geometry in settings
MuseScore::restoreGeometry(this);
}


//---------------------------------------------------------
// showMixer
//---------------------------------------------------------

void MuseScore::showMixer(bool visible)
void MuseScore::showMixer(bool val)
{
if (!cs)
return;

QAction* toggleMixerAction = getAction("toggle-mixer");
QAction* a = getAction("toggle-mixer");
if (mixer == 0) {
mixer = new Mixer(this);
mscore->stackUnder(mixer);
if (synthControl)
connect(synthControl, SIGNAL(soundFontChanged()), mixer, SLOT(updateTrack()));
connect(synti, SIGNAL(soundFontChanged()), mixer, SLOT(updateTracks()));
connect(mixer, SIGNAL(closed(bool)), toggleMixerAction, SLOT(setChecked(bool)));
mixer->setFloating(false);
addDockWidget(Qt::RightDockWidgetArea, mixer);
}

reDisplayDockWidget(mixer, visible);
toggleMixerAction->setChecked(visible);
connect(mixer, SIGNAL(closed(bool)), a, SLOT(setChecked(bool)));
}
mixer->setScore(cs);
mixer->setVisible(val);
}

}
3 changes: 2 additions & 1 deletion mscore/mixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ class Mixer : public QDockWidget, public Ui::Mixer, public MixerTrackGroup

virtual void closeEvent(QCloseEvent*) override;
virtual void showEvent(QShowEvent*) override;
virtual void hideEvent(QHideEvent*) override;
virtual bool eventFilter(QObject*, QEvent*) override;
virtual void keyPressEvent(QKeyEvent*) override;
void readSettings();
void keepScrollPosition();
void setPlaybackScore(Score*);

Expand All @@ -109,6 +109,7 @@ class Mixer : public QDockWidget, public Ui::Mixer, public MixerTrackGroup
Mixer(QWidget* parent);
void setScore(Score*);
PartEdit* getPartAtIndex(int index);
void writeSettings();
void expandToggled(Part* part, bool expanded) override;
void notifyTrackSelected(MixerTrack* track) override;
void showDetailsToggled(bool shown);
Expand Down
23 changes: 10 additions & 13 deletions mscore/mixer.ui
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,25 @@
<property name="enabled">
<bool>true</bool>
</property>
<property name="floating">
<bool>false</bool>
</property>
<property name="features">
<set>QDockWidget::AllDockWidgetFeatures</set>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>648</width>
<height>495</height>
<height>431</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::ClickFocus</enum>
</property>
<property name="floating">
<bool>false</bool>
</property>
<property name="features">
<set>QDockWidget::AllDockWidgetFeatures</set>
</property>
<property name="allowedAreas">
<set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
</property>
<property name="windowTitle">
<string>Mixer</string>
<string/>
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QVBoxLayout" name="verticalLayout">
Expand Down Expand Up @@ -149,8 +146,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>528</width>
<height>368</height>
<width>554</width>
<height>371</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
Expand Down
42 changes: 11 additions & 31 deletions mscore/musescore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2812,24 +2812,6 @@ void MuseScore::showElementContext(Element* el)
debugger->setElement(el);
}


//---------------------------------------------------------
// reDisplayDockWidget
//
// Helper function to ensure when un-docked widgets are
// re-displayed, they are also re-dockable
//---------------------------------------------------------

void MuseScore::reDisplayDockWidget(QDockWidget* widget, bool visible)
{
widget->setVisible(visible);
if (widget->isFloating()) {
// Ensure the widget is re-dockable if it has been closed and re-opened when un-docked
widget->setFloating(false);
widget->setFloating(true);
}
}

//---------------------------------------------------------
// showPlayPanel
//---------------------------------------------------------
Expand Down Expand Up @@ -2858,7 +2840,7 @@ void MuseScore::showPlayPanel(bool visible)
playPanel->setFloating(false);
}
else
reDisplayDockWidget(playPanel, visible);
playPanel->setVisible(visible);
playId->setChecked(visible);
}

Expand Down Expand Up @@ -4392,6 +4374,8 @@ void MuseScore::writeSettings()
if (synthControl)
synthControl->writeSettings();
settings.setValue("synthControlVisible", synthControl && synthControl->isVisible());
if (mixer)
mixer->writeSettings();
settings.setValue("mixerVisible", mixer && mixer->isVisible());
if (seq) {
seq->exit();
Expand Down Expand Up @@ -4439,12 +4423,7 @@ void MuseScore::readSettings()
}

MuseScore::restoreGeometry(this);

// grab the visible state before the beginGroup
// this awkwardness to ensure state saved before code changes should
// still work OK.
bool mixerVisibleFlag = settings.value("mixerVisible", "0").toBool();


settings.beginGroup("MainWindow");
mainWindow->restoreState(settings.value("debuggerSplitter").toByteArray());
mainWindow->setOpaqueResize(false);
Expand All @@ -4459,8 +4438,7 @@ void MuseScore::readSettings()
mscore->showInspector(settings.value("showInspector", "1").toBool());
mscore->showPianoKeyboard(settings.value("showPianoKeyboard", "0").toBool());
mscore->showSelectionWindow(settings.value("showSelectionWindow", "0").toBool());
mscore->showMixer(mixerVisibleFlag);


restoreState(settings.value("state").toByteArray());
//if we were in full screen mode, go to maximized mode
if (isFullScreen()) {
Expand Down Expand Up @@ -5261,7 +5239,7 @@ void MuseScore::editRaster()
// showPianoKeyboard
//---------------------------------------------------------

void MuseScore::showPianoKeyboard(bool visible)
void MuseScore::showPianoKeyboard(bool on)
{
if (_pianoTools == 0) {
QAction* a = getAction("toggle-piano");
Expand All @@ -5271,8 +5249,8 @@ void MuseScore::showPianoKeyboard(bool visible)
connect(_pianoTools, SIGNAL(keyReleased(int, bool, int)), SLOT(midiNoteReceived(int, bool, int)));
connect(_pianoTools, SIGNAL(visibilityChanged(bool)), a, SLOT(setChecked(bool)));
}
if (visible) {
reDisplayDockWidget(_pianoTools, visible);
if (on) {
_pianoTools->show();
if (currentScore())
_pianoTools->changeSelection(currentScore()->selection());
else
Expand Down Expand Up @@ -6087,7 +6065,7 @@ void MuseScore::cmd(QAction* a, const QString& cmd)
else if (cmd == "toggle-piano")
showPianoKeyboard(a->isChecked());
else if (cmd == "toggle-scorecmp-tool")
reDisplayDockWidget(scoreCmpTool, a->isChecked());
scoreCmpTool->setVisible(a->isChecked());
#ifdef MSCORE_UNSTABLE
else if (cmd == "toggle-script-recorder")
scriptRecorder->setVisible(a->isChecked());
Expand Down Expand Up @@ -7685,6 +7663,8 @@ int main(int argc, char* av[])
QSettings settings;
if (settings.value("synthControlVisible", false).toBool())
mscore->showSynthControl(true);
if (settings.value("mixerVisible", false).toBool())
mscore->showMixer(true);

return qApp->exec();
}
Expand Down
1 change: 0 additions & 1 deletion mscore/musescore.h
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,6 @@ class MuseScore : public QMainWindow, public MuseScoreCore {
void unregisterPlugin(PluginDescription*);

Q_INVOKABLE void showStartcenter(bool);
void reDisplayDockWidget(QDockWidget* widget, bool visible);
void showPlayPanel(bool);

QFileInfoList recentScores() const;
Expand Down
6 changes: 3 additions & 3 deletions mscore/selectionwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ void SelectionWindow::changeCheckbox(QListWidgetItem* item)
// showSelectionWindow
//---------------------------------------------------------

void MuseScore::showSelectionWindow(bool visible)
void MuseScore::showSelectionWindow(bool val)
{
QAction* a = getAction("toggle-selection-window");
if (selectionWindow == 0) {
Expand All @@ -189,8 +189,8 @@ void MuseScore::showSelectionWindow(bool visible)
tabifyDockWidget(paletteBox, selectionWindow);
}
}
reDisplayDockWidget(selectionWindow, visible);
if (visible) {
selectionWindow->setVisible(val);
if (val) {
selectionWindow->raise();
}
}
Expand Down
2 changes: 1 addition & 1 deletion mscore/timeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void MuseScore::showTimeline(bool visible)
}
connect(_timeline, SIGNAL(visibilityChanged(bool)), act, SLOT(setChecked(bool)));
connect(_timeline, SIGNAL(closed(bool)), act, SLOT(setChecked(bool)));
reDisplayDockWidget(_timeline, visible);
_timeline->setVisible(visible);

getAction("toggle-timeline")->setChecked(visible);
if (visible)
Expand Down

0 comments on commit 0eb3bb5

Please sign in to comment.