-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add: Accessibility Panel - Score Style Preset option
- Loading branch information
Showing
14 changed files
with
390 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
install(FILES | ||
16mm_MSN.mss | ||
18mm_MSN.mss | ||
20mm_MSN.mss | ||
22mm_MSN.mss | ||
25mm_MSN.mss | ||
DESTINATION ${Mscore_SHARE_NAME}${Mscore_INSTALL_NAME}styles/MSN | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* 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_ENGRAVING_ACCESSIBILITYSTYLEPRESET_H | ||
#define MU_ENGRAVING_ACCESSIBILITYSTYLEPRESET_H | ||
|
||
namespace mu::engraving { | ||
enum class AccessibilityStylePreset { | ||
DEFAULT = 0, | ||
DEFAULT_EDITED, | ||
MSN_16MM, | ||
MSN_16MM_EDITED, | ||
MSN_18MM, | ||
MSN_18MM_EDITED, | ||
MSN_20MM, | ||
MSN_20MM_EDITED, | ||
MSN_22MM, | ||
MSN_22MM_EDITED, | ||
MSN_25MM, | ||
MSN_25MM_EDITED | ||
}; | ||
} | ||
|
||
#endif // MU_ENGRAVING_ACCESSIBILITYSTYLEPRESET_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
153 changes: 153 additions & 0 deletions
153
src/inspector/models/score/scoreaccessibilitysettingsmodel.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
/* | ||
* 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 "translation.h" | ||
#include "log.h" | ||
|
||
using namespace mu::inspector; | ||
using namespace mu::engraving; | ||
|
||
ScoreAccessibilitySettingsModel::ScoreAccessibilitySettingsModel(QObject* parent, IElementRepositoryService* repository) | ||
: AbstractInspectorModel(parent, repository) | ||
{ | ||
setSectionType(InspectorSectionType::SECTION_SCORE_ACCESSIBILITY); | ||
setTitle(muse::qtrc("inspector", "Accessibility")); | ||
} | ||
|
||
void ScoreAccessibilitySettingsModel::createProperties() | ||
{ | ||
// Placeholder | ||
} | ||
|
||
void ScoreAccessibilitySettingsModel::requestElements() | ||
{ | ||
// Placeholder | ||
} | ||
|
||
void ScoreAccessibilitySettingsModel::loadProperties() | ||
{ | ||
// Placeholder | ||
} | ||
|
||
void ScoreAccessibilitySettingsModel::resetProperties() | ||
{ | ||
// Placeholder | ||
} | ||
|
||
muse::io::path_t ScoreAccessibilitySettingsModel::getStyleFilePath(int preset) const | ||
{ | ||
muse::io::path_t basePath = globalConfiguration()->appDataPath() + "styles/MSN/"; | ||
switch (static_cast<AccessibilityStylePreset>(preset)) { | ||
case AccessibilityStylePreset::DEFAULT: | ||
return engravingConfiguration()->defaultStyleFilePath(); | ||
case AccessibilityStylePreset::MSN_16MM: | ||
return basePath + "16mm_MSN.mss"; | ||
case AccessibilityStylePreset::MSN_18MM: | ||
return basePath + "18mm_MSN.mss"; | ||
case AccessibilityStylePreset::MSN_20MM: | ||
return basePath + "20mm_MSN.mss"; | ||
case AccessibilityStylePreset::MSN_22MM: | ||
return basePath + "22mm_MSN.mss"; | ||
case AccessibilityStylePreset::MSN_25MM: | ||
return basePath + "25mm_MSN.mss"; | ||
default: | ||
return muse::io::path_t(); | ||
} | ||
} | ||
|
||
QVariantList ScoreAccessibilitySettingsModel::possibleScoreStylePreset() const | ||
{ | ||
QString text = "text"; | ||
QString value = "value"; | ||
|
||
return QVariantList { | ||
QVariantMap { | ||
{ text, muse::qtrc("inspector", "Default") }, | ||
{ value, static_cast<int>(AccessibilityStylePreset::DEFAULT) }, | ||
}, | ||
QVariantMap { | ||
//: Modified Stave Notation (MSN) with 16mm staff size. Intended for visually-impaired musicians. | ||
{ text, muse::qtrc("inspector", "16mm MSN") }, | ||
{ value, static_cast<int>(AccessibilityStylePreset::MSN_16MM) }, | ||
}, | ||
QVariantMap { | ||
//: Modified Stave Notation (MSN) with 18mm staff size. Intended for visually-impaired musicians. | ||
{ text, muse::qtrc("inspector", "18mm MSN") }, | ||
{ value, static_cast<int>(AccessibilityStylePreset::MSN_18MM) }, | ||
}, | ||
QVariantMap { | ||
//: Modified Stave Notation (MSN) with 20mm staff size. Intended for visually-impaired musicians. | ||
{ text, muse::qtrc("inspector", "20mm MSN") }, | ||
{ value, static_cast<int>(AccessibilityStylePreset::MSN_20MM) }, | ||
}, | ||
QVariantMap { | ||
//: Modified Stave Notation (MSN) with 22mm staff size. Intended for visually-impaired musicians. | ||
{ text, muse::qtrc("inspector", "22mm MSN") }, | ||
{ value, static_cast<int>(AccessibilityStylePreset::MSN_22MM) }, | ||
}, | ||
QVariantMap { | ||
//: Modified Stave Notation (MSN) with 25mm staff size. Intended for visually-impaired musicians. | ||
{ text, muse::qtrc("inspector", "25mm MSN") }, | ||
{ value, static_cast<int>(AccessibilityStylePreset::MSN_25MM) }, | ||
}, | ||
}; | ||
} | ||
|
||
void ScoreAccessibilitySettingsModel::loadStyle(int preset) const | ||
{ | ||
muse::io::path_t filePath = getStyleFilePath(preset); | ||
AccessibilityStylePreset presetName = static_cast<AccessibilityStylePreset>(preset); | ||
|
||
if (presetName == AccessibilityStylePreset::DEFAULT) { | ||
if (filePath.empty()) { | ||
StyleIdSet emptySet; | ||
globalContext()->currentNotation()->style()->resetAllStyleValues(emptySet); | ||
} else { | ||
globalContext()->currentNotation()->style()->loadStyle(filePath, true); | ||
} | ||
} else if (!filePath.empty()) { | ||
LOGI() << "Loading style from filePath:" << filePath; | ||
globalContext()->currentNotation()->style()->loadStyle(filePath, true); | ||
} else { | ||
LOGI() << "filePath is empty"; | ||
} | ||
globalContext()->currentNotation()->elements()->msScore()->score()->style().setStylePreset(presetName); | ||
} | ||
|
||
int ScoreAccessibilitySettingsModel::scoreStylePreset() const | ||
{ | ||
String presetValue = globalContext()->currentNotation()->elements()->msScore()->score()->style().stylePreset(); | ||
if (presetValue == "Default") { | ||
return 0; | ||
} else if (presetValue == "16mm MSN") { | ||
return 1; | ||
} else if (presetValue == "18mm MSN") { | ||
return 2; | ||
} else if (presetValue == "20mm MSN") { | ||
return 3; | ||
} else if (presetValue == "22mm MSN") { | ||
return 4; | ||
} else if (presetValue == "25mm MSN") { | ||
return 5; | ||
} | ||
} |
Oops, something went wrong.