Skip to content

Commit

Permalink
Rename ScoreTreeView and move to class MuseScore
Browse files Browse the repository at this point in the history
Rename ScoreTreeView -> ScoreTreeWidget and move to class MuseScore
  • Loading branch information
krkartikay committed Jun 17, 2020
1 parent 394f290 commit 01e6174
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 31 deletions.
2 changes: 1 addition & 1 deletion mscore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ add_library(mscoreapp STATIC
recordbutton.h greendotbutton prefsdialog.h prefsdialog.cpp
stringutils.h stringutils.cpp
scoreview.cpp editharmony.cpp editfiguredbass.cpp events.cpp
scoreitemmodel.cpp scoretreeview.cpp
scoreitemmodel.cpp scoretreewidget.cpp
editinstrument.cpp editstyle.cpp
icons.cpp
instrdialog.cpp instrwidget.cpp
Expand Down
17 changes: 17 additions & 0 deletions mscore/musescore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "libmscore/sym.h"
#include "pagesettings.h"
#include "debugger/debugger.h"
#include "scoretreewidget.h"
#include "editstyle.h"
#include "playpanel.h"
#include "libmscore/page.h"
Expand Down Expand Up @@ -1861,6 +1862,8 @@ MuseScore::MuseScore()
menuDebug->addAction(a);
a = getAction("qml-reload-source");
menuDebug->addAction(a);
a = getAction("show-tree-debugger");
menuDebug->addAction(a);
Workspace::addMenuAndString(menuDebug, "menu-debug");
#endif

Expand Down Expand Up @@ -2789,6 +2792,9 @@ void MuseScore::setCurrentScoreView(ScoreView* view)
if (mixer) {
mixer->setScore(cs);
}
if (scoreTreeWidget) {
scoreTreeWidget->setScore(cs);
}
#ifdef OMR
if (omrPanel) {
if (cv && cv->omrView()) {
Expand Down Expand Up @@ -6400,6 +6406,10 @@ void MuseScore::endCmd(const bool isCmdFromInspector, const bool undoRedo)
}
updateViewModeCombo();
ScoreAccessibility::instance()->updateAccessibilityInfo();
// update score tree debugger
if (scoreTreeWidget) {
scoreTreeWidget->setScore(cs);
}
} else {
selectionChanged(SelState::NONE);
}
Expand Down Expand Up @@ -6861,6 +6871,13 @@ void MuseScore::cmd(QAction* a, const QString& cmd)
const QString urlString = w->source().toString().replace(oldPrefix, newPrefix);
w->setSource(QUrl(urlString));
}
} else if (cmd == "show-tree-debugger") {
if (!scoreTreeWidget){
scoreTreeWidget = new ScoreTreeWidget(mscore);
} else {
scoreTreeWidget->setVisible(true);
}
scoreTreeWidget->setScore(cs);
}
#endif
else {
Expand Down
2 changes: 2 additions & 0 deletions mscore/musescore.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class PlayPanel;
class IPlayPanel;
class Mixer;
class Debugger;
class ScoreTreeWidget;
class MeasureListEditor;
class MasterScore;
class Score;
Expand Down Expand Up @@ -298,6 +299,7 @@ class MuseScore : public QMainWindow, public MuseScoreCore
Mixer* mixer { 0 };
SynthControl* synthControl { 0 };
Debugger* debugger { 0 };
ScoreTreeWidget* scoreTreeWidget { 0 };
MeasureListEditor* measureListEdit { 0 };
PageSettings* pageSettings { 0 };

Expand Down
30 changes: 15 additions & 15 deletions mscore/scoretreeview.cpp → mscore/scoretreewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,40 @@
// the file LICENCE.GPL
//=============================================================================

#include "scoretreeview.h"
#include "scoretreewidget.h"

namespace Ms {

//---------------------------------------------------------
// ScoreTreeView
// ScoreTreeWidget
//---------------------------------------------------------

ScoreTreeView::ScoreTreeView()
ScoreTreeWidget::ScoreTreeWidget(QWidget* parent)
: QDockWidget("Score Tree", parent)
{
_dock = new QDockWidget("Score Tree", mscore);
_dock->setAllowedAreas(Qt::RightDockWidgetArea);
_treeView = new QTreeView(_dock);
_dock->setWidget(_treeView);
mscore->addDockWidget(Qt::RightDockWidgetArea, _dock);
setAllowedAreas(Qt::RightDockWidgetArea);

connect(_treeView, &QTreeView::clicked, this, &ScoreTreeView::clicked);
_treeView = new QTreeView(this);
setWidget(_treeView);

mscore->addDockWidget(Qt::RightDockWidgetArea, this);

connect(_treeView, &QTreeView::clicked, this, &ScoreTreeWidget::clicked);
}

//---------------------------------------------------------
// ~ScoreTreeView
// ~ScoreTreeWidget
//---------------------------------------------------------

ScoreTreeView::~ScoreTreeView()
ScoreTreeWidget::~ScoreTreeWidget()
{
mscore->removeDockWidget(_dock);
delete _dock;
}

//---------------------------------------------------------
// setScore
//---------------------------------------------------------

void ScoreTreeView::setScore(Score* s)
void ScoreTreeWidget::setScore(Score* s)
{
_score = s;

Expand All @@ -57,7 +57,7 @@ void ScoreTreeView::setScore(Score* s)
// clicked
//---------------------------------------------------------

void ScoreTreeView::clicked(const QModelIndex& cur)
void ScoreTreeWidget::clicked(const QModelIndex& cur)
{
ScoreElement* s = (ScoreElement*) cur.internalPointer();

Expand Down
7 changes: 3 additions & 4 deletions mscore/scoretreeview.h → mscore/scoretreewidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,16 @@

namespace Ms {

class ScoreTreeView : public QObject
class ScoreTreeWidget : public QDockWidget
{
Q_OBJECT

QDockWidget* _dock;
QTreeView* _treeView;
Score* _score;

public:
ScoreTreeView();
~ScoreTreeView();
ScoreTreeWidget(QWidget* parent);
~ScoreTreeWidget();
void setScore(Score* s);

public slots:
Expand Down
8 changes: 0 additions & 8 deletions mscore/scoreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "navigator.h"
#include "preferences.h"
#include "scoreaccessibility.h"
#include "scoretreeview.h"
#include "scoretab.h"
#include "seq.h"
#include "splitstaff.h"
Expand Down Expand Up @@ -206,8 +205,6 @@ ScoreView::ScoreView(QWidget* parent)
if (seq) {
connect(seq, SIGNAL(stopped()), SLOT(seqStopped()));
}

_scoreTreeView = new ScoreTreeView();
}

//---------------------------------------------------------
Expand Down Expand Up @@ -257,8 +254,6 @@ void ScoreView::setScore(Score* s)

connect(s, SIGNAL(posChanged(POS,unsigned)), SLOT(posChanged(POS,unsigned)));
connect(this, SIGNAL(viewRectChanged()), this, SLOT(updateContinuousPanel()));

_scoreTreeView->setScore(_score);
}
}

Expand All @@ -281,7 +276,6 @@ ScoreView::~ScoreView()
delete _bgPixmap;
delete _fgPixmap;
delete shadowNote;
delete _scoreTreeView;
}

//---------------------------------------------------------
Expand Down Expand Up @@ -5073,8 +5067,6 @@ void ScoreView::layoutChanged()
if (mscore->navigator()) {
mscore->navigator()->layoutChanged();
}
_scoreTreeView->setScore(_score);

_curLoopIn->move(_score->pos(POS::LEFT));
Measure* lm = _score->lastMeasure();
if (lm && _score->pos(POS::RIGHT) > lm->endTick()) {
Expand Down
2 changes: 0 additions & 2 deletions mscore/scoreview.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class Measure;
class System;
class Score;
class ScoreView;
class ScoreTreeView;
class Text;
class MeasureBase;
class Staff;
Expand Down Expand Up @@ -128,7 +127,6 @@ class ScoreView : public QWidget, public MuseScoreView
{
Q_OBJECT

ScoreTreeView* _scoreTreeView;
ViewState state;
OmrView* _omrView;

Expand Down
9 changes: 8 additions & 1 deletion mscore/shortcut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3963,7 +3963,14 @@ Shortcut Shortcut::_sc[] = {
0,
Icons::Invalid_ICON,
Qt::ApplicationShortcut
}
},
{
MsWidget::MAIN_WINDOW,
STATE_ALL,
"show-tree-debugger",
QT_TRANSLATE_NOOP("action", "Show Tree Debugger"),
QT_TRANSLATE_NOOP("action", "Show tree debugger"),
},
#endif
};

Expand Down

0 comments on commit 01e6174

Please sign in to comment.