Skip to content

Commit

Permalink
Add: UI changes for ScoreAccessibility panel in the properties sectio…
Browse files Browse the repository at this point in the history
…n & initial necessary settings model files
  • Loading branch information
nasehim7 committed May 31, 2024
1 parent 4e6a864 commit 7cc7dce
Show file tree
Hide file tree
Showing 8 changed files with 218 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/inspector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/models/measures/measuressettingsmodel.h
${CMAKE_CURRENT_LIST_DIR}/models/score/scoreappearancesettingsmodel.cpp
${CMAKE_CURRENT_LIST_DIR}/models/score/scoreappearancesettingsmodel.h
${CMAKE_CURRENT_LIST_DIR}/models/score/scoreaccessibilitysettingsmodel.cpp
${CMAKE_CURRENT_LIST_DIR}/models/score/scoreaccessibilitysettingsmodel.h
${CMAKE_CURRENT_LIST_DIR}/models/score/scoredisplaysettingsmodel.cpp
${CMAKE_CURRENT_LIST_DIR}/models/score/scoredisplaysettingsmodel.h
${CMAKE_CURRENT_LIST_DIR}/models/score/internal/pagetypelistmodel.cpp
Expand Down
1 change: 1 addition & 0 deletions src/inspector/models/abstractinspectormodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class AbstractInspectorModel : public QObject, public muse::async::Asyncable
SECTION_TEXT,
SECTION_SCORE_DISPLAY,
SECTION_SCORE_APPEARANCE,
SECTION_SCORE_ACCESSIBILITY,
SECTION_PARTS,
};
Q_ENUM(InspectorSectionType)
Expand Down
7 changes: 6 additions & 1 deletion src/inspector/models/inspectorlistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "text/textsettingsmodel.h"
#include "score/scoredisplaysettingsmodel.h"
#include "score/scoreappearancesettingsmodel.h"
#include "score/scoreaccessibilitysettingsmodel.h"
#include "notation/inotationinteraction.h"

#include "internal/services/elementrepositoryservice.h"
Expand Down Expand Up @@ -73,7 +74,8 @@ void InspectorListModel::buildModelsForEmptySelection()

static const InspectorSectionTypeSet persistentSections {
InspectorSectionType::SECTION_SCORE_DISPLAY,
InspectorSectionType::SECTION_SCORE_APPEARANCE
InspectorSectionType::SECTION_SCORE_APPEARANCE,
InspectorSectionType::SECTION_SCORE_ACCESSIBILITY
};

removeUnusedModels({}, false /*isRangeSelection*/, {}, persistentSections);
Expand Down Expand Up @@ -195,6 +197,9 @@ void InspectorListModel::createModelsBySectionType(const InspectorSectionTypeSet
case InspectorSectionType::SECTION_SCORE_APPEARANCE:
newModel = new ScoreAppearanceSettingsModel(this, m_repository);
break;
case InspectorSectionType::SECTION_SCORE_ACCESSIBILITY:
newModel = new ScoreAccessibilitySettingsModel(this, m_repository);
break;
case InspectorSectionType::SECTION_PARTS:
newModel = new PartsSettingsModel(this, m_repository);
break;
Expand Down
68 changes: 68 additions & 0 deletions src/inspector/models/score/scoreaccessibilitysettingsmodel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-Studio-CLA-applies
*
* MuseScore Studio
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore Limited
*
* 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 "scoreaccessibilitysettingsmodel.h"

#include "engraving/style/defaultstyle.h"
#include "translation.h"

using namespace mu::inspector;
using namespace mu::notation;

ScoreAccessibilitySettingsModel::ScoreAccessibilitySettingsModel(QObject* parent, IElementRepositoryService* repository)
: AbstractInspectorModel(parent, repository)
{
setSectionType(InspectorSectionType::SECTION_SCORE_ACCESSIBILITY);
setTitle(muse::qtrc("inspector", "Accessibility"));
}

PropertyItem* ScoreAccessibilitySettingsModel::scoreStylePreset() const
{
return m_scoreStylePreset;
}

void ScoreAccessibilitySettingsModel::setScoreStylePreset(PropertyItem* item)
{
if (m_scoreStylePreset != item) {
m_scoreStylePreset = item;
emit scoreStylePresetChanged();
}
}

void ScoreAccessibilitySettingsModel::createProperties()
{
// Placeholder
}

void ScoreAccessibilitySettingsModel::requestElements()
{
// Placeholder
}

void ScoreAccessibilitySettingsModel::loadProperties()
{
// Placeholder
}

void ScoreAccessibilitySettingsModel::resetProperties()
{
// Placeholder
}
55 changes: 55 additions & 0 deletions src/inspector/models/score/scoreaccessibilitysettingsmodel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-Studio-CLA-applies
*
* MuseScore Studio
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore Limited
*
* 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_SCOREACCESSIBILITYSETTINGSMODEL_H
#define MU_INSPECTOR_SCOREACCESSIBILITYSETTINGSMODEL_H

#include "models/abstractinspectormodel.h"
#include "models/propertyitem.h"
#include "async/asyncable.h"

namespace mu::inspector {
class ScoreAccessibilitySettingsModel : public AbstractInspectorModel
{
Q_OBJECT

Q_PROPERTY(PropertyItem * scoreStylePreset READ scoreStylePreset CONSTANT)

public:
explicit ScoreAccessibilitySettingsModel(QObject* parent, IElementRepositoryService* repository);

void createProperties() override;
void requestElements() override;
void loadProperties() override;
void resetProperties() override;

PropertyItem* scoreStylePreset() const;
void setScoreStylePreset(PropertyItem* item);

signals:
void scoreStylePresetChanged();

private:
PropertyItem* m_scoreStylePreset = nullptr;
};
}

#endif // MU_INSPECTOR_SCOREACCESSIBILITYSETTINGSMODEL_H
1 change: 1 addition & 0 deletions src/inspector/view/inspector_resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<file>qml/MuseScore/Inspector/notation/fretdiagrams/internal/FretAdvancedSettingsTab.qml</file>
<file>qml/MuseScore/Inspector/score/ScoreDisplayInspectorView.qml</file>
<file>qml/MuseScore/Inspector/score/ScoreAppearanceInspectorView.qml</file>
<file>qml/MuseScore/Inspector/score/ScoreAccessibilityInspectorView.qml</file>
<file>qml/MuseScore/Inspector/score/HideEmptyStavesSettings.qml</file>
<file>qml/MuseScore/Inspector/common/InspectorPropertyView.qml</file>
<file>qml/MuseScore/Inspector/common/TextSection.qml</file>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ ExpandableBlank {
}
case Inspector.SECTION_SCORE_DISPLAY: return scoreSection
case Inspector.SECTION_SCORE_APPEARANCE: return scoreAppearanceSection
case Inspector.SECTION_SCORE_ACCESSIBILITY: return scoreAccessibilitySection
case Inspector.SECTION_PARTS: return partsSection
}

Expand Down Expand Up @@ -206,6 +207,26 @@ ExpandableBlank {
}
}

Component {
id: scoreAccessibilitySection

ScoreAccessibilityInspectorView {
model: root.sectionModel
navigationPanel: root.navigationPanel
navigationRowStart: root.navigation.row + 1
anchorItem: root.anchorItem

onEnsureContentVisibleRequested: function(invisibleContentHeight) {
console.log("Ensure content visible requested with height: " + invisibleContentHeight)
root.ensureContentVisibleRequested(-invisibleContentHeight)
}

onPopupOpened: {
root.popupOpened(openedPopup, control)
}
}
}

Component {
id: partsSection

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-Studio-CLA-applies
*
* MuseScore Studio
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore Limited
*
* 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/>.
*/
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15

import MuseScore.Inspector 1.0
import Muse.UiComponents 1.0
import Muse.Ui 1.0

import "../common"

InspectorSectionView {
id: root
implicitHeight: contentColumn.implicitHeight

Column {
id: contentColumn
width: parent.width
spacing: 8

DropdownPropertyView {
id: scoreStylePreset

titleText: qsTrc("inspector", "Score style preset")
propertyItem: null
visible: true

model: [
{ text: qsTrc("inspector", "Default") },
{ text: qsTrc("inspector", "16mm MSN") },
{ text: qsTrc("inspector", "18mm MSN") },
{ text: qsTrc("inspector", "20mm MSN") },
{ text: qsTrc("inspector", "24mm MSN") },
{ text: qsTrc("inspector", "25mm MSN") }
]
}

FlatButton {
width: parent.width
text: qsTrc("inspector", "Customize shapes & colours")
onClicked: console.log("Customize shapes & colours button clicked")
}
}
}

0 comments on commit 7cc7dce

Please sign in to comment.