Skip to content

Commit

Permalink
Fix musescore#13761: Implement Lyrics Properties in Inspector
Browse files Browse the repository at this point in the history
  • Loading branch information
HemantAntony committed Oct 17, 2022
1 parent 644cc12 commit 9a05f80
Show file tree
Hide file tree
Showing 11 changed files with 186 additions and 2 deletions.
Binary file modified fonts/mscore/MusescoreIcon.ttf
Binary file not shown.
1 change: 1 addition & 0 deletions src/framework/ui/view/iconcodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ class IconCode
TEMPO_CHANGE = 0xF43F,

PLUGIN = 0xF440,
LYRICS = 0xF441,

NONE = 0xFFFF
};
Expand Down
2 changes: 2 additions & 0 deletions src/inspector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/models/notation/ornaments/ornamentsettingsmodel.h
${CMAKE_CURRENT_LIST_DIR}/models/notation/lines/pedalsettingsmodel.cpp
${CMAKE_CURRENT_LIST_DIR}/models/notation/lines/pedalsettingsmodel.h
${CMAKE_CURRENT_LIST_DIR}/models/notation/lyrics/lyricssettingsmodel.cpp
${CMAKE_CURRENT_LIST_DIR}/models/notation/lyrics/lyricssettingsmodel.h
${CMAKE_CURRENT_LIST_DIR}/models/notation/sectionbreaks/sectionbreaksettingsmodel.cpp
${CMAKE_CURRENT_LIST_DIR}/models/notation/sectionbreaks/sectionbreaksettingsmodel.h
${CMAKE_CURRENT_LIST_DIR}/models/notation/spacers/spacersettingsmodel.cpp
Expand Down
3 changes: 2 additions & 1 deletion src/inspector/models/abstractinspectormodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ static const QMap<mu::engraving::ElementType, InspectorModelType> NOTATION_ELEME
{ mu::engraving::ElementType::TEXTLINE_SEGMENT, InspectorModelType::TYPE_TEXT_LINE },
{ mu::engraving::ElementType::GRADUAL_TEMPO_CHANGE, InspectorModelType::TYPE_GRADUAL_TEMPO_CHANGE },
{ mu::engraving::ElementType::GRADUAL_TEMPO_CHANGE_SEGMENT, InspectorModelType::TYPE_GRADUAL_TEMPO_CHANGE },
{ mu::engraving::ElementType::INSTRUMENT_NAME, InspectorModelType::TYPE_INSTRUMENT_NAME }
{ mu::engraving::ElementType::INSTRUMENT_NAME, InspectorModelType::TYPE_INSTRUMENT_NAME },
{ mu::engraving::ElementType::LYRICS, InspectorModelType::TYPE_LYRICS }
};

static QMap<mu::engraving::HairpinType, InspectorModelType> HAIRPIN_ELEMENT_MODEL_TYPES = {
Expand Down
3 changes: 2 additions & 1 deletion src/inspector/models/abstractinspectormodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ class AbstractInspectorModel : public QObject, public async::Asyncable
TYPE_TUPLET,
TYPE_TEXT_LINE,
TYPE_GRADUAL_TEMPO_CHANGE,
TYPE_INSTRUMENT_NAME
TYPE_INSTRUMENT_NAME,
TYPE_LYRICS,
};
Q_ENUM(InspectorModelType)

Expand Down
3 changes: 3 additions & 0 deletions src/inspector/models/inspectormodelcreator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
#include "notation/measurerepeats/measurerepeatsettingsmodel.h"
#include "notation/tuplets/tupletsettingsmodel.h"
#include "notation/instrumentname/instrumentnamesettingsmodel.h"
#include "notation/lyrics/lyricssettingsmodel.h"

using namespace mu::inspector;

Expand Down Expand Up @@ -172,6 +173,8 @@ AbstractInspectorModel* InspectorModelCreator::newInspectorModel(InspectorModelT
return new TupletSettingsModel(parent, repository);
case InspectorModelType::TYPE_INSTRUMENT_NAME:
return new InstrumentNameSettingsModel(parent, repository);
case InspectorModelType::TYPE_LYRICS:
return new LyricsSettingsModel(parent, repository);
case InspectorModelType::TYPE_BREATH:
case InspectorModelType::TYPE_ARPEGGIO:
case InspectorModelType::TYPE_DYNAMIC:
Expand Down
60 changes: 60 additions & 0 deletions src/inspector/models/notation/lyrics/lyricssettingsmodel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* 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 "lyricssettingsmodel.h"

#include "translation.h"

using namespace mu::inspector;

LyricsSettingsModel::LyricsSettingsModel(QObject* parent, IElementRepositoryService* repository)
: AbstractInspectorModel(parent, repository)
{
setModelType(InspectorModelType::TYPE_LYRICS);
setTitle(qtrc("inspector", "Lyrics"));
setIcon(ui::IconCode::Code::LYRICS);
createProperties();
}

void LyricsSettingsModel::createProperties()
{
m_verse = buildPropertyItem(mu::engraving::Pid::VERSE);
}

void LyricsSettingsModel::requestElements()
{
m_elementList = m_repository->findElementsByType(mu::engraving::ElementType::LYRICS);
}

void LyricsSettingsModel::loadProperties()
{
loadPropertyItem(m_verse);
}

void LyricsSettingsModel::resetProperties()
{
m_verse->resetToDefault();
}

PropertyItem* LyricsSettingsModel::verse() const
{
return m_verse;
}
48 changes: 48 additions & 0 deletions src/inspector/models/notation/lyrics/lyricssettingsmodel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* 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_LYRICSSETTINGSMODEL_H
#define MU_INSPECTOR_LYRICSSETTINGSMODEL_H

#include "models/abstractinspectormodel.h"

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

Q_PROPERTY(PropertyItem * verse READ verse CONSTANT)
public:
explicit LyricsSettingsModel(QObject* parent, IElementRepositoryService* repository);

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

PropertyItem* verse() const;

private:
PropertyItem* m_verse = nullptr;
};
}

#endif // MU_INSPECTOR_LYRICSSETTINGSMODEL_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 @@ -99,5 +99,6 @@
<file>qml/MuseScore/Inspector/notation/instrumentname/InstrumentNameSettings.qml</file>
<file>qml/MuseScore/Inspector/general/appearance/AppearanceSettings.qml</file>
<file>qml/MuseScore/Inspector/text/TextSettings.qml</file>
<file>qml/MuseScore/Inspector/notation/lyrics/LyricsSettings.qml</file>
</qresource>
</RCC>
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import "tremolos"
import "measurerepeats"
import "tuplets"
import "instrumentname"
import "lyrics"

Loader {
id: root
Expand Down Expand Up @@ -124,6 +125,7 @@ Loader {
case Inspector.TYPE_MEASURE_REPEAT: return measureRepeatComp
case Inspector.TYPE_TUPLET: return tupletComp
case Inspector.TYPE_INSTRUMENT_NAME: return instrumentNameComp
case Inspector.TYPE_LYRICS: return lyricsComp
}

return null
Expand Down Expand Up @@ -312,4 +314,9 @@ Loader {
id: instrumentNameComp
InstrumentNameSettings {}
}

Component {
id: lyricsComp
LyricsSettings {}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* 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/>.
*/
import QtQuick 2.15
import QtQuick.Controls 2.15

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

import "../../common"

Column {
id: root

property QtObject model: null

property NavigationPanel navigationPanel: null
property int navigationRowStart: 1

objectName: "LyricsSettings"

spacing: 12

function focusOnFirst() {
setVerse.focusOnFirst()
}

SpinBoxPropertyView {
id: setVerse
titleText: qsTrc("inspector", "Set to verse")
propertyItem: root.model ? root.model.verse : null

decimals: 0
step: 1
minValue: 1

navigationName: "SpanFrom"
navigationPanel: root.navigationPanel
navigationRowStart: root.navigationRowStart
}
}

0 comments on commit 9a05f80

Please sign in to comment.