Eliminate InspectorAdapter
This was a temporary thing to make the new Inspector usable in both the MU3 and MU4 UI. But now that the MU3 UI is removed, the Adapter is not much more than an extra layer making things complicated.
This commit is contained in:
parent
45fe99af08
commit
8d81709214
17 changed files with 167 additions and 443 deletions
|
@ -26,7 +26,6 @@ set(MODULE_QML_IMPORT ${CMAKE_CURRENT_LIST_DIR}/view/qml)
|
|||
set(MODULE_SRC
|
||||
${CMAKE_CURRENT_LIST_DIR}/inspectormodule.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/inspectormodule.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/iinspectoradapter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/types/accidentaltypes.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/types/ambitustypes.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/types/articulationtypes.h
|
||||
|
@ -177,8 +176,6 @@ set(MODULE_SRC
|
|||
${CMAKE_CURRENT_LIST_DIR}/internal/services/elementrepositoryservice.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal/services/elementrepositoryservice.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal/interfaces/ielementrepositoryservice.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal/compatibility/mu4inspectoradapter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal/compatibility/mu4inspectoradapter.h
|
||||
)
|
||||
|
||||
set(MODULE_UI ${inspector_UI} )
|
||||
|
|
|
@ -1,80 +0,0 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: GPL-3.0-only
|
||||
* MuseScore-CLA-applies
|
||||
*
|
||||
* MuseScore
|
||||
* Music Composition & Notation
|
||||
*
|
||||
* Copyright (C) 2021 MuseScore BVBA and others
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 3 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MU_INSPECTOR_IINSPECTORADAPTER_H
|
||||
#define MU_INSPECTOR_IINSPECTORADAPTER_H
|
||||
|
||||
#include <QVariant>
|
||||
|
||||
#include "modularity/imoduleexport.h"
|
||||
|
||||
#include "libmscore/style.h"
|
||||
#include "notation/notationtypes.h"
|
||||
#include "async/channel.h"
|
||||
#include "async/notification.h"
|
||||
|
||||
namespace mu::inspector {
|
||||
class IInspectorAdapter : MODULE_EXPORT_INTERFACE
|
||||
{
|
||||
INTERFACE_ID(IInspectorAdapter)
|
||||
|
||||
public:
|
||||
virtual ~IInspectorAdapter() = default;
|
||||
|
||||
virtual bool isNotationExisting() const = 0;
|
||||
virtual bool isTextEditingStarted() const = 0;
|
||||
virtual async::Notification isTextEditingChanged() const = 0;
|
||||
virtual notation::ScoreConfig scoreConfig() const = 0;
|
||||
virtual async::Channel<notation::ScoreConfigType> scoreConfigChanged() const = 0;
|
||||
|
||||
// notation commands
|
||||
virtual void beginCommand() = 0;
|
||||
virtual void endCommand() = 0;
|
||||
|
||||
// notation styling
|
||||
virtual void updateStyleValue(const Ms::Sid& styleId, const QVariant& newValue) = 0;
|
||||
virtual QVariant styleValue(const Ms::Sid& styleId) = 0;
|
||||
|
||||
// dialogs
|
||||
virtual void showSpecialCharactersDialog() = 0;
|
||||
virtual void showStaffTextPropertiesDialog() = 0;
|
||||
virtual void showPageSettingsDialog() = 0;
|
||||
virtual void showStyleSettingsDialog() = 0;
|
||||
virtual void showTimeSignaturePropertiesDialog() = 0;
|
||||
virtual void showArticulationPropertiesDialog() = 0;
|
||||
virtual void showGridConfigurationDialog() = 0;
|
||||
|
||||
// actions
|
||||
virtual void updateHorizontalGridSnapping(const bool isSnapped) = 0;
|
||||
virtual void updateVerticalGridSnapping(const bool isSnapped) = 0;
|
||||
virtual void toggleInvisibleElementsDisplaying() = 0; //!Note Invisible elements can be displayed as a semi-transparent elements
|
||||
virtual void toggleUnprintableElementsVisibility() = 0;
|
||||
virtual void toggleFramesVisibility() = 0;
|
||||
virtual void togglePageMarginsVisibility() = 0;
|
||||
|
||||
// notation layout
|
||||
virtual void updateNotation() = 0;
|
||||
virtual async::Notification currentNotationChanged() const = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // MU_INSPECTOR_IINSPECTORADAPTER_H
|
|
@ -54,9 +54,6 @@
|
|||
#include "types/tremolobartypes.h"
|
||||
#include "types/tremolotypes.h"
|
||||
|
||||
#include "iinspectoradapter.h"
|
||||
#include "internal/compatibility/mu4inspectoradapter.h"
|
||||
|
||||
using namespace mu::inspector;
|
||||
|
||||
static void inspector_init_qrc()
|
||||
|
@ -69,13 +66,6 @@ std::string InspectorModule::moduleName() const
|
|||
return "inspector";
|
||||
}
|
||||
|
||||
void InspectorModule::registerExports()
|
||||
{
|
||||
static std::shared_ptr<MU4InspectorAdapter> adapter = std::make_shared<MU4InspectorAdapter>();
|
||||
|
||||
mu::framework::ioc()->registerExport<mu::inspector::IInspectorAdapter>(moduleName(), adapter);
|
||||
}
|
||||
|
||||
void InspectorModule::registerResources()
|
||||
{
|
||||
inspector_init_qrc();
|
||||
|
|
|
@ -31,7 +31,6 @@ public:
|
|||
InspectorModule() = default;
|
||||
|
||||
std::string moduleName() const override;
|
||||
void registerExports() override;
|
||||
void registerResources() override;
|
||||
void registerUiTypes() override;
|
||||
};
|
||||
|
|
|
@ -1,195 +0,0 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: GPL-3.0-only
|
||||
* MuseScore-CLA-applies
|
||||
*
|
||||
* MuseScore
|
||||
* Music Composition & Notation
|
||||
*
|
||||
* Copyright (C) 2021 MuseScore BVBA and others
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 3 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "mu4inspectoradapter.h"
|
||||
|
||||
#include "log.h"
|
||||
|
||||
using namespace mu::inspector;
|
||||
using namespace mu::notation;
|
||||
|
||||
bool MU4InspectorAdapter::isNotationExisting() const
|
||||
{
|
||||
return !context()->masterNotations().empty();
|
||||
}
|
||||
|
||||
bool MU4InspectorAdapter::isTextEditingStarted() const
|
||||
{
|
||||
IF_ASSERT_FAILED(context() && context()->currentNotation()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return context()->currentNotation()->interaction()->isTextEditingStarted();
|
||||
}
|
||||
|
||||
mu::async::Notification MU4InspectorAdapter::isTextEditingChanged() const
|
||||
{
|
||||
IF_ASSERT_FAILED(context() && context()->currentNotation()) {
|
||||
return mu::async::Notification();
|
||||
}
|
||||
|
||||
return context()->currentNotation()->interaction()->textEditingChanged();
|
||||
}
|
||||
|
||||
mu::notation::ScoreConfig MU4InspectorAdapter::scoreConfig() const
|
||||
{
|
||||
IF_ASSERT_FAILED(context() && context()->currentNotation()) {
|
||||
return mu::notation::ScoreConfig();
|
||||
}
|
||||
|
||||
return context()->currentNotation()->interaction()->scoreConfig();
|
||||
}
|
||||
|
||||
mu::async::Channel<mu::notation::ScoreConfigType> MU4InspectorAdapter::scoreConfigChanged() const
|
||||
{
|
||||
IF_ASSERT_FAILED(context() && context()->currentNotation()) {
|
||||
return mu::async::Channel<ScoreConfigType>();
|
||||
}
|
||||
|
||||
return context()->currentNotation()->interaction()->scoreConfigChanged();
|
||||
}
|
||||
|
||||
void MU4InspectorAdapter::beginCommand()
|
||||
{
|
||||
if (undoStack()) {
|
||||
undoStack()->prepareChanges();
|
||||
}
|
||||
}
|
||||
|
||||
void MU4InspectorAdapter::endCommand()
|
||||
{
|
||||
if (undoStack()) {
|
||||
undoStack()->commitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
void MU4InspectorAdapter::updateStyleValue(const Ms::Sid& styleId, const QVariant& newValue)
|
||||
{
|
||||
if (style()) {
|
||||
style()->setStyleValue(styleId, newValue);
|
||||
}
|
||||
}
|
||||
|
||||
QVariant MU4InspectorAdapter::styleValue(const Ms::Sid& styleId)
|
||||
{
|
||||
return style() ? style()->styleValue(styleId) : QVariant();
|
||||
}
|
||||
|
||||
void MU4InspectorAdapter::showSpecialCharactersDialog()
|
||||
{
|
||||
NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
void MU4InspectorAdapter::showStaffTextPropertiesDialog()
|
||||
{
|
||||
NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
void MU4InspectorAdapter::showPageSettingsDialog()
|
||||
{
|
||||
NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
void MU4InspectorAdapter::showStyleSettingsDialog()
|
||||
{
|
||||
interactive()->open("musescore://notation/style");
|
||||
}
|
||||
|
||||
void MU4InspectorAdapter::showTimeSignaturePropertiesDialog()
|
||||
{
|
||||
NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
void MU4InspectorAdapter::showArticulationPropertiesDialog()
|
||||
{
|
||||
NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
void MU4InspectorAdapter::showGridConfigurationDialog()
|
||||
{
|
||||
NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
void MU4InspectorAdapter::updateHorizontalGridSnapping(const bool /*isSnapped*/)
|
||||
{
|
||||
NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
void MU4InspectorAdapter::updateVerticalGridSnapping(const bool /*isSnapped*/)
|
||||
{
|
||||
NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
void MU4InspectorAdapter::toggleInvisibleElementsDisplaying()
|
||||
{
|
||||
dispatcher()->dispatch("show-invisible");
|
||||
}
|
||||
|
||||
void MU4InspectorAdapter::toggleUnprintableElementsVisibility()
|
||||
{
|
||||
dispatcher()->dispatch("show-unprintable");
|
||||
}
|
||||
|
||||
void MU4InspectorAdapter::toggleFramesVisibility()
|
||||
{
|
||||
dispatcher()->dispatch("show-frames");
|
||||
}
|
||||
|
||||
void MU4InspectorAdapter::togglePageMarginsVisibility()
|
||||
{
|
||||
dispatcher()->dispatch("show-pageborders");
|
||||
}
|
||||
|
||||
void MU4InspectorAdapter::updateNotation()
|
||||
{
|
||||
IF_ASSERT_FAILED(context() && context()->currentNotation()) {
|
||||
return;
|
||||
}
|
||||
|
||||
return context()->currentNotation()->notationChanged().notify();
|
||||
}
|
||||
|
||||
mu::async::Notification MU4InspectorAdapter::currentNotationChanged() const
|
||||
{
|
||||
IF_ASSERT_FAILED(context()) {
|
||||
return mu::async::Notification();
|
||||
}
|
||||
|
||||
return context()->currentNotationChanged();
|
||||
}
|
||||
|
||||
INotationUndoStackPtr MU4InspectorAdapter::undoStack() const
|
||||
{
|
||||
if (!context() || !context()->currentNotation()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return context()->currentNotation()->undoStack();
|
||||
}
|
||||
|
||||
INotationStylePtr MU4InspectorAdapter::style() const
|
||||
{
|
||||
if (!context() || !context()->currentNotation()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return context()->currentNotation()->style();
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: GPL-3.0-only
|
||||
* MuseScore-CLA-applies
|
||||
*
|
||||
* MuseScore
|
||||
* Music Composition & Notation
|
||||
*
|
||||
* Copyright (C) 2021 MuseScore BVBA and others
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 3 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef MU_INSPECTOR_MU4INSPECTORADAPTER_H
|
||||
#define MU_INSPECTOR_MU4INSPECTORADAPTER_H
|
||||
|
||||
#include "iinspectoradapter.h"
|
||||
|
||||
#include "modularity/ioc.h"
|
||||
#include "context/iglobalcontext.h"
|
||||
#include "notation/inotation.h"
|
||||
#include "notation/notationtypes.h"
|
||||
#include "iinteractive.h"
|
||||
#include "actions/iactionsdispatcher.h"
|
||||
|
||||
namespace mu::inspector {
|
||||
class MU4InspectorAdapter : public IInspectorAdapter
|
||||
{
|
||||
INJECT(inspector, mu::context::IGlobalContext, context)
|
||||
INJECT(inspector, mu::framework::IInteractive, interactive)
|
||||
INJECT(inspector, mu::actions::IActionsDispatcher, dispatcher)
|
||||
|
||||
public:
|
||||
MU4InspectorAdapter() = default;
|
||||
|
||||
bool isNotationExisting() const override;
|
||||
bool isTextEditingStarted() const override;
|
||||
async::Notification isTextEditingChanged() const override;
|
||||
notation::ScoreConfig scoreConfig() const override;
|
||||
async::Channel<notation::ScoreConfigType> scoreConfigChanged() const override;
|
||||
|
||||
// notation commands
|
||||
void beginCommand() override;
|
||||
void endCommand() override;
|
||||
|
||||
// notation styling
|
||||
void updateStyleValue(const Ms::Sid& styleId, const QVariant& newValue) override;
|
||||
QVariant styleValue(const Ms::Sid& styleId) override;
|
||||
|
||||
// dialogs
|
||||
void showSpecialCharactersDialog() override;
|
||||
void showStaffTextPropertiesDialog() override;
|
||||
void showPageSettingsDialog() override;
|
||||
void showStyleSettingsDialog() override;
|
||||
void showTimeSignaturePropertiesDialog() override;
|
||||
void showArticulationPropertiesDialog() override;
|
||||
void showGridConfigurationDialog() override;
|
||||
|
||||
// actions
|
||||
void updateHorizontalGridSnapping(const bool isSnapped) override;
|
||||
void updateVerticalGridSnapping(const bool isSnapped) override;
|
||||
void toggleInvisibleElementsDisplaying() override;
|
||||
void toggleUnprintableElementsVisibility() override;
|
||||
void toggleFramesVisibility() override;
|
||||
void togglePageMarginsVisibility() override;
|
||||
|
||||
// notation layout
|
||||
void updateNotation() override;
|
||||
async::Notification currentNotationChanged() const override;
|
||||
|
||||
private:
|
||||
mu::notation::INotationUndoStackPtr undoStack() const;
|
||||
mu::notation::INotationStylePtr style() const;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // MU_INSPECTOR_MU4INSPECTORADAPTER_H
|
|
@ -25,6 +25,7 @@
|
|||
#include "log.h"
|
||||
|
||||
using namespace mu::inspector;
|
||||
using namespace mu::notation;
|
||||
|
||||
static const QList<Ms::ElementType> NOTATION_ELEMENT_TYPES = {
|
||||
Ms::ElementType::NOTE,
|
||||
|
@ -170,7 +171,7 @@ void AbstractInspectorModel::onPropertyValueChanged(const Ms::Pid pid, const QVa
|
|||
return;
|
||||
}
|
||||
|
||||
adapter()->beginCommand();
|
||||
beginCommand();
|
||||
|
||||
QVariant convertedValue;
|
||||
|
||||
|
@ -190,8 +191,8 @@ void AbstractInspectorModel::onPropertyValueChanged(const Ms::Pid pid, const QVa
|
|||
element->undoChangeProperty(pid, convertedValue, ps);
|
||||
}
|
||||
|
||||
adapter()->updateNotation();
|
||||
adapter()->endCommand();
|
||||
updateNotation();
|
||||
endCommand();
|
||||
|
||||
emit elementsModified();
|
||||
}
|
||||
|
@ -234,14 +235,16 @@ Ms::Sid AbstractInspectorModel::styleIdByPropertyId(const Ms::Pid pid) const
|
|||
|
||||
void AbstractInspectorModel::updateStyleValue(const Ms::Sid& sid, const QVariant& newValue)
|
||||
{
|
||||
adapter()->beginCommand();
|
||||
adapter()->updateStyleValue(sid, newValue);
|
||||
adapter()->endCommand();
|
||||
if (style()) {
|
||||
beginCommand();
|
||||
style()->setStyleValue(sid, newValue);
|
||||
endCommand();
|
||||
}
|
||||
}
|
||||
|
||||
QVariant AbstractInspectorModel::styleValue(const Ms::Sid& sid) const
|
||||
{
|
||||
return adapter()->styleValue(sid);
|
||||
return style() ? style()->styleValue(sid) : QVariant();
|
||||
}
|
||||
|
||||
void AbstractInspectorModel::onResetToDefaults(const QList<Ms::Pid>& pidList)
|
||||
|
@ -250,7 +253,7 @@ void AbstractInspectorModel::onResetToDefaults(const QList<Ms::Pid>& pidList)
|
|||
return;
|
||||
}
|
||||
|
||||
adapter()->beginCommand();
|
||||
beginCommand();
|
||||
|
||||
for (Ms::Element* element : m_elementList) {
|
||||
IF_ASSERT_FAILED(element) {
|
||||
|
@ -262,9 +265,8 @@ void AbstractInspectorModel::onResetToDefaults(const QList<Ms::Pid>& pidList)
|
|||
}
|
||||
}
|
||||
|
||||
adapter()->endCommand();
|
||||
|
||||
adapter()->updateNotation();
|
||||
endCommand();
|
||||
updateNotation();
|
||||
|
||||
emit elementsModified();
|
||||
emit modelReseted();
|
||||
|
@ -451,10 +453,60 @@ void AbstractInspectorModel::loadPropertyItem(PropertyItem* propertyItem, std::f
|
|||
|
||||
bool AbstractInspectorModel::isNotationExisting() const
|
||||
{
|
||||
return adapter()->isNotationExisting();
|
||||
return !context()->masterNotations().empty();
|
||||
}
|
||||
|
||||
bool AbstractInspectorModel::hasAcceptableElements() const
|
||||
{
|
||||
return !m_elementList.isEmpty();
|
||||
}
|
||||
|
||||
INotationStylePtr AbstractInspectorModel::style() const
|
||||
{
|
||||
if (!context() || !context()->currentNotation()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return context()->currentNotation()->style();
|
||||
}
|
||||
|
||||
INotationUndoStackPtr AbstractInspectorModel::undoStack() const
|
||||
{
|
||||
if (!context() || !context()->currentNotation()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return context()->currentNotation()->undoStack();
|
||||
}
|
||||
|
||||
void AbstractInspectorModel::beginCommand()
|
||||
{
|
||||
if (undoStack()) {
|
||||
undoStack()->prepareChanges();
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractInspectorModel::endCommand()
|
||||
{
|
||||
if (undoStack()) {
|
||||
undoStack()->commitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
mu::async::Notification AbstractInspectorModel::currentNotationChanged() const
|
||||
{
|
||||
IF_ASSERT_FAILED(context()) {
|
||||
return mu::async::Notification();
|
||||
}
|
||||
|
||||
return context()->currentNotationChanged();
|
||||
}
|
||||
|
||||
void AbstractInspectorModel::updateNotation()
|
||||
{
|
||||
IF_ASSERT_FAILED(context() && context()->currentNotation()) {
|
||||
return;
|
||||
}
|
||||
|
||||
context()->currentNotation()->notationChanged().notify();
|
||||
}
|
||||
|
|
|
@ -30,8 +30,9 @@
|
|||
#include "libmscore/property.h"
|
||||
|
||||
#include "internal/interfaces/ielementrepositoryservice.h"
|
||||
#include "iinspectoradapter.h"
|
||||
#include "notation/inotation.h"
|
||||
#include "context/iglobalcontext.h"
|
||||
#include "actions/iactionsdispatcher.h"
|
||||
#include "modularity/ioc.h"
|
||||
#include "models/propertyitem.h"
|
||||
|
||||
|
@ -40,16 +41,14 @@ class AbstractInspectorModel : public QObject
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
INJECT(inspector, mu::inspector::IInspectorAdapter, adapter)
|
||||
INJECT(inspector, mu::context::IGlobalContext, context)
|
||||
INJECT(inspector, actions::IActionsDispatcher, dispatcher)
|
||||
|
||||
Q_PROPERTY(QString title READ title CONSTANT)
|
||||
Q_PROPERTY(InspectorSectionType sectionType READ sectionType CONSTANT)
|
||||
Q_PROPERTY(InspectorModelType modelType READ modelType CONSTANT)
|
||||
Q_PROPERTY(bool isEmpty READ isEmpty NOTIFY isEmptyChanged)
|
||||
|
||||
Q_ENUMS(InspectorSectionType)
|
||||
Q_ENUMS(InspectorModelType)
|
||||
|
||||
public:
|
||||
enum class InspectorSectionType {
|
||||
SECTION_UNDEFINED = -1,
|
||||
|
@ -59,6 +58,7 @@ public:
|
|||
SECTION_SCORE_DISPLAY,
|
||||
SECTION_SCORE_APPEARANCE
|
||||
};
|
||||
Q_ENUM(InspectorSectionType)
|
||||
|
||||
enum class InspectorModelType {
|
||||
TYPE_UNDEFINED = -1,
|
||||
|
@ -101,6 +101,7 @@ public:
|
|||
TYPE_TREMOLO,
|
||||
TYPE_MEASURE_REPEAT
|
||||
};
|
||||
Q_ENUM(InspectorModelType)
|
||||
|
||||
explicit AbstractInspectorModel(QObject* parent, IElementRepositoryService* repository = nullptr);
|
||||
|
||||
|
@ -146,9 +147,17 @@ protected:
|
|||
QVariant valueToElementUnits(const Ms::Pid& pid, const QVariant& value, const Ms::Element* element) const;
|
||||
QVariant valueFromElementUnits(const Ms::Pid& pid, const QVariant& value, const Ms::Element* element) const;
|
||||
|
||||
notation::INotationStylePtr style() const;
|
||||
void updateStyleValue(const Ms::Sid& sid, const QVariant& newValue);
|
||||
QVariant styleValue(const Ms::Sid& sid) const;
|
||||
|
||||
notation::INotationUndoStackPtr undoStack() const;
|
||||
void beginCommand();
|
||||
void endCommand();
|
||||
|
||||
void updateNotation();
|
||||
async::Notification currentNotationChanged() const;
|
||||
|
||||
IElementRepositoryService* m_repository;
|
||||
|
||||
QList<Ms::Element*> m_elementList;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "appearancesettingsmodel.h"
|
||||
|
||||
#include "dataformatter.h"
|
||||
|
||||
#include "log.h"
|
||||
#include "translation.h"
|
||||
|
||||
using namespace mu::inspector;
|
||||
|
@ -104,7 +104,7 @@ void AppearanceSettingsModel::pushFrontInOrder()
|
|||
|
||||
void AppearanceSettingsModel::configureGrid()
|
||||
{
|
||||
adapter()->showGridConfigurationDialog();
|
||||
NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
PropertyItem* AppearanceSettingsModel::leadingSpace() const
|
||||
|
@ -156,8 +156,9 @@ void AppearanceSettingsModel::setIsSnappedToGrid(bool isSnapped)
|
|||
m_horizontallySnapToGrid = isSnapped;
|
||||
m_verticallySnapToGrid = isSnapped;
|
||||
|
||||
adapter()->updateHorizontalGridSnapping(isSnapped);
|
||||
adapter()->updateVerticalGridSnapping(isSnapped);
|
||||
NOT_IMPLEMENTED;
|
||||
//updateHorizontalGridSnapping(isSnapped);
|
||||
//updateVerticalGridSnapping(isSnapped);
|
||||
|
||||
emit isSnappedToGridChanged(isSnappedToGrid());
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ ArticulationSettingsModel::ArticulationSettingsModel(QObject* parent, IElementRe
|
|||
|
||||
void ArticulationSettingsModel::openChannelAndMidiProperties()
|
||||
{
|
||||
adapter()->showArticulationPropertiesDialog();
|
||||
NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
void ArticulationSettingsModel::createProperties()
|
||||
|
@ -47,8 +47,7 @@ void ArticulationSettingsModel::createProperties()
|
|||
|
||||
void ArticulationSettingsModel::requestElements()
|
||||
{
|
||||
m_elementList = m_repository->findElementsByType(Ms::ElementType::ARTICULATION, [](
|
||||
const Ms::Element* element) -> bool {
|
||||
m_elementList = m_repository->findElementsByType(Ms::ElementType::ARTICULATION, [](const Ms::Element* element) -> bool {
|
||||
IF_ASSERT_FAILED(element) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
*/
|
||||
#include "ornamentsettingsmodel.h"
|
||||
|
||||
#include "log.h"
|
||||
#include "articulation.h"
|
||||
#include "log.h"
|
||||
|
||||
using namespace mu::inspector;
|
||||
|
||||
|
@ -36,7 +36,7 @@ OrnamentSettingsModel::OrnamentSettingsModel(QObject* parent, IElementRepository
|
|||
|
||||
void OrnamentSettingsModel::openChannelAndMidiProperties()
|
||||
{
|
||||
adapter()->showArticulationPropertiesDialog();
|
||||
NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
void OrnamentSettingsModel::createProperties()
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <QSizeF>
|
||||
|
||||
#include "dataformatter.h"
|
||||
|
||||
#include "log.h"
|
||||
#include "translation.h"
|
||||
|
||||
using namespace mu::inspector;
|
||||
|
@ -77,7 +77,7 @@ void TimeSignatureSettingsModel::resetProperties()
|
|||
|
||||
void TimeSignatureSettingsModel::showTimeSignatureProperties()
|
||||
{
|
||||
adapter()->showTimeSignaturePropertiesDialog();
|
||||
NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
PropertyItem* TimeSignatureSettingsModel::horizontalScale() const
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "types/scoreappearancetypes.h"
|
||||
#include "dataformatter.h"
|
||||
#include "log.h"
|
||||
|
||||
using namespace mu::inspector;
|
||||
|
||||
|
@ -82,12 +83,12 @@ PageTypeListModel* ScoreAppearanceSettingsModel::pageTypeListModel() const
|
|||
|
||||
void ScoreAppearanceSettingsModel::showPageSettings()
|
||||
{
|
||||
adapter()->showPageSettingsDialog();
|
||||
dispatcher()->dispatch("page-settings");
|
||||
}
|
||||
|
||||
void ScoreAppearanceSettingsModel::showStyleSettings()
|
||||
{
|
||||
adapter()->showStyleSettingsDialog();
|
||||
dispatcher()->dispatch("edit-style");
|
||||
}
|
||||
|
||||
int ScoreAppearanceSettingsModel::orientationType() const
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "scoredisplaysettingsmodel.h"
|
||||
|
||||
using namespace mu::inspector;
|
||||
using namespace mu::notation;
|
||||
|
||||
ScoreSettingsModel::ScoreSettingsModel(QObject* parent, IElementRepositoryService* repository)
|
||||
: AbstractInspectorModel(parent, repository)
|
||||
|
@ -30,10 +31,10 @@ ScoreSettingsModel::ScoreSettingsModel(QObject* parent, IElementRepositoryServic
|
|||
setTitle(qtrc("inspector", "Show"));
|
||||
createProperties();
|
||||
|
||||
m_shouldShowInvisible = adapter()->isNotationExisting() ? adapter()->scoreConfig().isShowInvisibleElements : true;
|
||||
m_shouldShowUnprintable = adapter()->isNotationExisting() ? adapter()->scoreConfig().isShowUnprintableElements : true;
|
||||
m_shouldShowFrames = adapter()->isNotationExisting() ? adapter()->scoreConfig().isShowFrames : true;
|
||||
m_shouldShowPageMargins = adapter()->isNotationExisting() ? adapter()->scoreConfig().isShowPageMargins : false;
|
||||
m_shouldShowInvisible = isNotationExisting() ? scoreConfig().isShowInvisibleElements : true;
|
||||
m_shouldShowUnprintable = isNotationExisting() ? scoreConfig().isShowUnprintableElements : true;
|
||||
m_shouldShowFrames = isNotationExisting() ? scoreConfig().isShowFrames : true;
|
||||
m_shouldShowPageMargins = isNotationExisting() ? scoreConfig().isShowPageMargins : false;
|
||||
|
||||
setupConnections();
|
||||
}
|
||||
|
@ -72,6 +73,24 @@ void ScoreSettingsModel::resetProperties()
|
|||
setShouldShowPageMargins(false);
|
||||
}
|
||||
|
||||
ScoreConfig ScoreSettingsModel::scoreConfig() const
|
||||
{
|
||||
IF_ASSERT_FAILED(context() && context()->currentNotation()) {
|
||||
return ScoreConfig();
|
||||
}
|
||||
|
||||
return context()->currentNotation()->interaction()->scoreConfig();
|
||||
}
|
||||
|
||||
mu::async::Channel<ScoreConfigType> ScoreSettingsModel::scoreConfigChanged() const
|
||||
{
|
||||
IF_ASSERT_FAILED(context() && context()->currentNotation()) {
|
||||
return mu::async::Channel<ScoreConfigType>();
|
||||
}
|
||||
|
||||
return context()->currentNotation()->interaction()->scoreConfigChanged();
|
||||
}
|
||||
|
||||
bool ScoreSettingsModel::shouldShowInvisible() const
|
||||
{
|
||||
return m_shouldShowInvisible;
|
||||
|
@ -98,8 +117,7 @@ void ScoreSettingsModel::setShouldShowInvisible(bool shouldShowInvisible)
|
|||
return;
|
||||
}
|
||||
|
||||
adapter()->toggleInvisibleElementsDisplaying();
|
||||
|
||||
dispatcher()->dispatch("show-invisible");
|
||||
updateShouldShowInvisible(shouldShowInvisible);
|
||||
}
|
||||
|
||||
|
@ -109,8 +127,7 @@ void ScoreSettingsModel::setShouldShowUnprintable(bool shouldShowUnprintable)
|
|||
return;
|
||||
}
|
||||
|
||||
adapter()->toggleUnprintableElementsVisibility();
|
||||
|
||||
dispatcher()->dispatch("show-unprintable");
|
||||
updateShouldShowUnprintable(shouldShowUnprintable);
|
||||
}
|
||||
|
||||
|
@ -120,8 +137,7 @@ void ScoreSettingsModel::setShouldShowFrames(bool shouldShowFrames)
|
|||
return;
|
||||
}
|
||||
|
||||
adapter()->toggleFramesVisibility();
|
||||
|
||||
dispatcher()->dispatch("show-frames");
|
||||
updateShouldShowFrames(shouldShowFrames);
|
||||
}
|
||||
|
||||
|
@ -131,8 +147,7 @@ void ScoreSettingsModel::setShouldShowPageMargins(bool shouldShowPageMargins)
|
|||
return;
|
||||
}
|
||||
|
||||
adapter()->togglePageMarginsVisibility();
|
||||
|
||||
dispatcher()->dispatch("show-pageborders");
|
||||
updateShouldShowPageMargins(shouldShowPageMargins);
|
||||
}
|
||||
|
||||
|
@ -176,20 +191,20 @@ void ScoreSettingsModel::updateShouldShowPageMargins(bool isVisible)
|
|||
emit shouldShowPageMarginsChanged(isVisible);
|
||||
}
|
||||
|
||||
void ScoreSettingsModel::updateFromConfig(notation::ScoreConfigType configType)
|
||||
void ScoreSettingsModel::updateFromConfig(ScoreConfigType configType)
|
||||
{
|
||||
switch (configType) {
|
||||
case notation::ScoreConfigType::ShowInvisibleElements:
|
||||
updateShouldShowInvisible(adapter()->scoreConfig().isShowInvisibleElements);
|
||||
updateShouldShowInvisible(scoreConfig().isShowInvisibleElements);
|
||||
break;
|
||||
case notation::ScoreConfigType::ShowUnprintableElements:
|
||||
updateShouldShowUnprintable(adapter()->scoreConfig().isShowUnprintableElements);
|
||||
updateShouldShowUnprintable(scoreConfig().isShowUnprintableElements);
|
||||
break;
|
||||
case notation::ScoreConfigType::ShowFrames:
|
||||
updateShouldShowFrames(adapter()->scoreConfig().isShowFrames);
|
||||
updateShouldShowFrames(scoreConfig().isShowFrames);
|
||||
break;
|
||||
case notation::ScoreConfigType::ShowPageMargins:
|
||||
updateShouldShowPageMargins(adapter()->scoreConfig().isShowPageMargins);
|
||||
updateShouldShowPageMargins(scoreConfig().isShowPageMargins);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -198,30 +213,26 @@ void ScoreSettingsModel::updateFromConfig(notation::ScoreConfigType configType)
|
|||
|
||||
void ScoreSettingsModel::updateAll()
|
||||
{
|
||||
updateShouldShowInvisible(adapter()->scoreConfig().isShowInvisibleElements);
|
||||
updateShouldShowUnprintable(adapter()->scoreConfig().isShowUnprintableElements);
|
||||
updateShouldShowFrames(adapter()->scoreConfig().isShowFrames);
|
||||
updateShouldShowPageMargins(adapter()->scoreConfig().isShowPageMargins);
|
||||
updateShouldShowInvisible(scoreConfig().isShowInvisibleElements);
|
||||
updateShouldShowUnprintable(scoreConfig().isShowUnprintableElements);
|
||||
updateShouldShowFrames(scoreConfig().isShowFrames);
|
||||
updateShouldShowPageMargins(scoreConfig().isShowPageMargins);
|
||||
}
|
||||
|
||||
void ScoreSettingsModel::setupConnections()
|
||||
{
|
||||
if (adapter()->isNotationExisting()) {
|
||||
adapter()->currentNotationChanged().onNotify(this, [this]() {
|
||||
updateAll();
|
||||
});
|
||||
|
||||
adapter()->scoreConfigChanged().onReceive(this, [this](notation::ScoreConfigType configType) {
|
||||
updateFromConfig(configType);
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
adapter()->currentNotationChanged().onNotify(this, [this]() {
|
||||
if (isNotationExisting()) {
|
||||
updateAll();
|
||||
|
||||
adapter()->scoreConfigChanged().onReceive(this, [this](notation::ScoreConfigType configType) {
|
||||
scoreConfigChanged().onReceive(this, [this](ScoreConfigType configType) {
|
||||
updateFromConfig(configType);
|
||||
});
|
||||
}
|
||||
|
||||
currentNotationChanged().onNotify(this, [this]() {
|
||||
updateAll();
|
||||
|
||||
scoreConfigChanged().onReceive(this, [this](ScoreConfigType configType) {
|
||||
updateFromConfig(configType);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -35,6 +35,7 @@ class ScoreSettingsModel : public AbstractInspectorModel, public mu::async::Asyn
|
|||
Q_PROPERTY(bool shouldShowUnprintable READ shouldShowUnprintable WRITE setShouldShowUnprintable NOTIFY shouldShowUnprintableChanged)
|
||||
Q_PROPERTY(bool shouldShowFrames READ shouldShowFrames WRITE setShouldShowFrames NOTIFY shouldShowFramesChanged)
|
||||
Q_PROPERTY(bool shouldShowPageMargins READ shouldShowPageMargins WRITE setShouldShowPageMargins NOTIFY shouldShowPageMarginsChanged)
|
||||
|
||||
public:
|
||||
explicit ScoreSettingsModel(QObject* parent, IElementRepositoryService* repository);
|
||||
|
||||
|
@ -68,6 +69,9 @@ private:
|
|||
void updateShouldShowFrames(bool isVisible);
|
||||
void updateShouldShowPageMargins(bool isVisible);
|
||||
|
||||
notation::ScoreConfig scoreConfig() const;
|
||||
async::Channel<notation::ScoreConfigType> scoreConfigChanged() const;
|
||||
|
||||
void updateFromConfig(mu::notation::ScoreConfigType configType);
|
||||
void updateAll();
|
||||
void setupConnections();
|
||||
|
|
|
@ -36,8 +36,8 @@ TextSettingsModel::TextSettingsModel(QObject* parent, IElementRepositoryService*
|
|||
setTitle(qtrc("inspector", "Text"));
|
||||
createProperties();
|
||||
|
||||
adapter()->isTextEditingChanged().onNotify(this, [this]() {
|
||||
setIsSpecialCharactersInsertionAvailable(adapter()->isTextEditingStarted());
|
||||
isTextEditingChanged().onNotify(this, [this]() {
|
||||
setIsSpecialCharactersInsertionAvailable(isTextEditingStarted());
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -166,12 +166,12 @@ void TextSettingsModel::resetProperties()
|
|||
|
||||
void TextSettingsModel::insertSpecialCharacters()
|
||||
{
|
||||
adapter()->showSpecialCharactersDialog();
|
||||
NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
void TextSettingsModel::showStaffTextProperties()
|
||||
{
|
||||
adapter()->showStaffTextPropertiesDialog();
|
||||
NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
PropertyItem* TextSettingsModel::fontFamily() const
|
||||
|
@ -299,3 +299,21 @@ void TextSettingsModel::updateStaffPropertiesAvailability()
|
|||
|
||||
setAreStaffTextPropertiesAvailable(isAvailable && !m_textType->isUndefined());
|
||||
}
|
||||
|
||||
bool TextSettingsModel::isTextEditingStarted() const
|
||||
{
|
||||
IF_ASSERT_FAILED(context() && context()->currentNotation()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return context()->currentNotation()->interaction()->isTextEditingStarted();
|
||||
}
|
||||
|
||||
mu::async::Notification TextSettingsModel::isTextEditingChanged() const
|
||||
{
|
||||
IF_ASSERT_FAILED(context() && context()->currentNotation()) {
|
||||
return mu::async::Notification();
|
||||
}
|
||||
|
||||
return context()->currentNotation()->interaction()->textEditingChanged();
|
||||
}
|
||||
|
|
|
@ -94,6 +94,9 @@ signals:
|
|||
void isSpecialCharactersInsertionAvailableChanged(bool isSpecialCharactersInsertionAvailable);
|
||||
|
||||
private:
|
||||
bool isTextEditingStarted() const;
|
||||
async::Notification isTextEditingChanged() const;
|
||||
|
||||
void updateFramePropertiesAvailability();
|
||||
void updateStaffPropertiesAvailability();
|
||||
|
||||
|
|
Loading…
Reference in a new issue