Merge pull request #7580 from RomanPudashkin/notation_stabilization

[MU4] Notation stabilization
This commit is contained in:
Elnur Ismailzada 2021-02-20 09:49:42 +02:00 committed by GitHub
commit cc3c72a459
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
44 changed files with 559 additions and 306 deletions

View file

@ -18,10 +18,6 @@ Rectangle {
title: qsTrc("appshell", "Score"),
uri: "musescore://notation"
},
{
title: qsTrc("appshell", "Sequencer"),
uri: "musescore://sequencer"
},
{
title: qsTrc("appshell", "Publish"),
uri: "musescore://publish"

View file

@ -15,6 +15,8 @@ DockPage {
objectName: "publishCentral"
Rectangle {
color: ui.theme.backgroundSecondaryColor
StyledTextLabel {
anchors.fill: parent
verticalAlignment: Text.AlignVCenter

View file

@ -52,7 +52,7 @@ DockWindow {
toolbars: [
DockToolBar {
objectName: "mainToolBar"
minimumWidth: 376
minimumWidth: 282
minimumHeight: dockWindow.toolbarHeight
color: dockWindow.color
@ -70,7 +70,7 @@ DockWindow {
DockToolBar {
objectName: "notationToolBar"
minimumWidth: 188
minimumWidth: 192
minimumHeight: dockWindow.toolbarHeight
color: dockWindow.color
@ -86,7 +86,7 @@ DockWindow {
id: playbackToolBar
objectName: "playbackToolBar"
minimumWidth: floating ? 492 : 420
minimumWidth: floating ? 508 : 430
minimumHeight: floating ? 76 : dockWindow.toolbarHeight
color: dockWindow.color

View file

@ -93,7 +93,6 @@ void DockWindow::componentComplete()
togglePage(nullptr, currentPage());
m_window->show();
updateStyle();
m_isComponentComplete = true;
}
@ -161,6 +160,8 @@ void DockWindow::togglePage(DockPage* old, DockPage* current)
if (current) {
showPage(current);
}
updateStyle();
}
void DockWindow::hidePage(DockPage* page)

View file

@ -71,6 +71,11 @@ void Sequencer::pause()
void Sequencer::stop()
{
ONLY_AUDIO_WORKER_THREAD;
if (m_status == STOPED) {
return;
}
m_nextStatus = STOPED;
rewind();
}

View file

@ -130,9 +130,14 @@ std::string UiConfiguration::iconsFontFamily() const
return settings()->value(UI_ICONS_FONT_FAMILY_KEY).toString();
}
int UiConfiguration::iconsFontSize() const
int UiConfiguration::iconsFontSize(IconSizeType type) const
{
return fontSize(FontSizeType::TAB);
switch (type) {
case IconSizeType::Regular: return 16;
case IconSizeType::Toolbar: return 20;
}
return 16;
}
Notification UiConfiguration::iconsFontChanged() const

View file

@ -48,7 +48,7 @@ public:
async::Notification fontChanged() const override;
std::string iconsFontFamily() const override;
int iconsFontSize() const override;
int iconsFontSize(IconSizeType type) const override;
async::Notification iconsFontChanged() const override;
std::string musicalFontFamily() const override;

View file

@ -55,6 +55,7 @@ public:
virtual QFont titleBoldFont() const = 0;
virtual QFont iconsFont() const = 0;
virtual QFont toolbarIconsFont() const = 0;
virtual QFont musicalFont() const = 0;
virtual qreal accentOpacityNormal() const = 0;

View file

@ -54,12 +54,17 @@ public:
TITLE
};
enum class IconSizeType {
Regular,
Toolbar
};
virtual std::string fontFamily() const = 0;
virtual int fontSize(FontSizeType type) const = 0;
virtual async::Notification fontChanged() const = 0;
virtual std::string iconsFontFamily() const = 0;
virtual int iconsFontSize() const = 0;
virtual int iconsFontSize(IconSizeType type) const = 0;
virtual async::Notification iconsFontChanged() const = 0;
virtual std::string musicalFontFamily() const = 0;

View file

@ -221,6 +221,11 @@ QFont Theme::iconsFont() const
return m_iconsFont;
}
QFont Theme::toolbarIconsFont() const
{
return m_toolbarIconsFont;
}
QFont Theme::musicalFont() const
{
return m_musicalFont;
@ -335,8 +340,13 @@ void Theme::setupUiFonts()
void Theme::setupIconsFont()
{
m_iconsFont.setFamily(QString::fromStdString(configuration()->iconsFontFamily()));
m_iconsFont.setPixelSize(configuration()->iconsFontSize());
QString family = QString::fromStdString(configuration()->iconsFontFamily());
m_iconsFont.setFamily(family);
m_iconsFont.setPixelSize(configuration()->iconsFontSize(IUiConfiguration::IconSizeType::Regular));
m_toolbarIconsFont.setFamily(family);
m_toolbarIconsFont.setPixelSize(configuration()->iconsFontSize(IUiConfiguration::IconSizeType::Toolbar));
}
void Theme::setupMusicFont()

View file

@ -67,6 +67,8 @@ class Theme : public QObject, public ITheme, public async::Asyncable
Q_PROPERTY(QFont titleBoldFont READ titleBoldFont NOTIFY dataChanged)
Q_PROPERTY(QFont iconsFont READ iconsFont NOTIFY dataChanged)
Q_PROPERTY(QFont toolbarIconsFont READ toolbarIconsFont NOTIFY dataChanged)
Q_PROPERTY(QFont musicalFont READ musicalFont NOTIFY dataChanged)
public:
@ -96,6 +98,7 @@ public:
QFont titleBoldFont() const override;
QFont iconsFont() const override;
QFont toolbarIconsFont() const override;
QFont musicalFont() const override;
qreal accentOpacityNormal() const override;
@ -138,6 +141,7 @@ private:
QFont m_headerBoldFont;
QFont m_titleBoldFont;
QFont m_iconsFont;
QFont m_toolbarIconsFont;
QFont m_musicalFont;
async::Notification m_themeChanged;

View file

@ -10,6 +10,9 @@ Item {
property int maxValue: 999
property int value: 0
property bool addLeadingZeros: true
property int displayedNumberLength: maxValue.toString().length
property alias font: textField.font
signal valueEdited(var newValue)
@ -22,12 +25,14 @@ Item {
QtObject {
id: privateProperties
property int maxNumberLength: root.maxValue.toString().length
function pad(value) {
var str = value.toString()
while (str.length < maxNumberLength) {
if (!addLeadingZeros) {
return str;
}
while (str.length < root.displayedNumberLength) {
str = "0" + str
}
@ -48,22 +53,20 @@ Item {
text: privateProperties.pad(root.value)
onTextEdited: {
var currentValue = parseInt(text)
var currentValue = text.length > 0 ? parseInt(text) : 0
var str = currentValue.toString()
var newValue = 0
if (str.length > privateProperties.maxNumberLength || currentValue > root.maxValue) {
if (str.length > privateProperties.displayedNumberLength || currentValue > root.maxValue) {
var lastDigit = str.charAt(str.length - 1)
newValue = parseInt(lastDigit)
} else {
newValue = currentValue
}
if (newValue > root.maxValue) {
newValue = value
}
newValue = Math.min(newValue, root.maxValue)
text = privateProperties.pad(newValue)
root.valueEdited(newValue)
}
@ -73,7 +76,6 @@ Item {
color: "transparent"
}
cursorDelegate: Item {}
selectByMouse: false
color: ui.theme.fontPrimaryColor
@ -95,6 +97,7 @@ Item {
onClicked: {
textField.forceActiveFocus()
textField.cursorPosition = textField.text.length
}
}

View file

@ -44,6 +44,7 @@ Row {
maxValue: hoursField.value === root.maxTime.getHours() ? root.maxTime.getMinutes() : 60
value: root.time.getMinutes()
displayedNumberLength: 2
font: root.font
onValueEdited: {
@ -65,6 +66,7 @@ Row {
maxValue: minutesField.value === root.maxTime.getMinutes() ? root.maxTime.getSeconds() : 60
value: root.time.getSeconds()
displayedNumberLength: 2
font: root.font
onValueEdited: {

View file

@ -174,7 +174,7 @@ Fraction Score::pos()
break;
}
}
return Fraction(-1, 1);
return Fraction(0, 1);
}
//---------------------------------------------------------

View file

@ -92,8 +92,8 @@ public:
virtual ValCh<bool> isNavigatorVisible() const = 0;
virtual void setNavigatorVisible(bool visible) = 0;
virtual ValCh<framework::Orientation> navigatorOrientation() const = 0;
virtual void setNavigatorOrientation(framework::Orientation orientation) = 0;
virtual ValCh<framework::Orientation> canvasOrientation() const = 0;
virtual void setCanvasOrientation(framework::Orientation orientation) = 0;
};
}

View file

@ -55,8 +55,8 @@ public:
};
virtual void addLoopBoundary(LoopBoundaryType boundaryType, int tick) = 0;
virtual void removeLoopBoundaries() = 0;
virtual async::Channel<LoopBoundaries> loopBoundariesChanged() const = 0;
virtual void setLoopBoundariesVisible(bool visible) = 0;
virtual ValCh<LoopBoundaries> loopBoundaries() const = 0;
virtual Tempo tempo(int tick) const = 0;
virtual MeasureBeat beat(int tick) const = 0;

View file

@ -134,7 +134,7 @@ void Notation::init()
Ms::MScore::setNudgeStep10(1.0); // Ctrl + cursor key (default 1.0)
Ms::MScore::setNudgeStep50(0.01); // Alt + cursor key (default 0.01)
bool isVertical = configuration()->navigatorOrientation().val == framework::Orientation::Vertical;
bool isVertical = configuration()->canvasOrientation().val == framework::Orientation::Vertical;
Ms::MScore::setVerticalOrientation(isVertical);
Ms::MScore::pixelRatio = Ms::DPI / QGuiApplication::primaryScreen()->logicalDotsPerInch();

View file

@ -194,6 +194,7 @@ void NotationActionController::init()
dispatcher()->reg(this, "tempo", [this]() { addText(TextType::TEMPO); });
dispatcher()->reg(this, "toggle-navigator", this, &NotationActionController::toggleNavigator);
dispatcher()->reg(this, "toggle-mixer", this, &NotationActionController::toggleMixer);
for (int i = MIN_NOTES_INTERVAL; i <= MAX_NOTES_INTERVAL; ++i) {
if (isNotesIntervalValid(i)) {
@ -984,6 +985,11 @@ void NotationActionController::toggleNavigator()
configuration()->setNavigatorVisible(!visible);
}
void NotationActionController::toggleMixer()
{
NOT_IMPLEMENTED;
}
void NotationActionController::startNoteInputIfNeed()
{
auto interaction = currentNotationInteraction();

View file

@ -111,6 +111,7 @@ private:
void openTupletOtherDialog();
void toggleNavigator();
void toggleMixer();
bool isTextEditting() const;

View file

@ -110,65 +110,86 @@ const ActionList NotationActions::m_actions = {
),
ActionItem("paste-half",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Paste Half Duration")
QT_TRANSLATE_NOOP("action", "Paste Half Duration"),
QT_TRANSLATE_NOOP("action", "Paste half duration")
),
ActionItem("paste-double",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Paste Double Duration")
QT_TRANSLATE_NOOP("action", "Paste Double Duration"),
QT_TRANSLATE_NOOP("action", "Paste double duration")
),
ActionItem("paste-special",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Paste Special")
QT_TRANSLATE_NOOP("action", "Paste Special"),
QT_TRANSLATE_NOOP("action", "Paste special")
),
ActionItem("swap",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Swap with Clipboard")
QT_TRANSLATE_NOOP("action", "Swap with Clipboard"),
QT_TRANSLATE_NOOP("action", "Swap with clipboard")
),
ActionItem("select-all",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Select All")
QT_TRANSLATE_NOOP("action", "Select All"),
QT_TRANSLATE_NOOP("action", "Select all")
),
ActionItem("delete",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Delete"),
QT_TRANSLATE_NOOP("action", "Delete the selected element(s)"),
IconCode::Code::DELETE_TANK
),
ActionItem("select-similar",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Select: similar")
QT_TRANSLATE_NOOP("action", "Select: similar"),
QT_TRANSLATE_NOOP("action", "Select all similar elements")
),
ActionItem("select-similar-staff",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Select: in same staff")
QT_TRANSLATE_NOOP("action", "Select: in same staff"),
QT_TRANSLATE_NOOP("action", "Select all similar elements in same staff")
),
ActionItem("select-similar-range",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Select: in the range")
QT_TRANSLATE_NOOP("action", "Select: in the range"),
QT_TRANSLATE_NOOP("action", "Select all similar elements in the range selection")
),
ActionItem("select-dialog",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Select Dialog")
QT_TRANSLATE_NOOP("action", "Select Dialog"),
QT_TRANSLATE_NOOP("action", "Select all similar elements with more options")
),
ActionItem("edit-style",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Style")
QT_TRANSLATE_NOOP("action", "Style…"),
QT_TRANSLATE_NOOP("action", "Edit style")
),
ActionItem("page-settings",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Page Settings")
QT_TRANSLATE_NOOP("action", "Page Settings…"),
QT_TRANSLATE_NOOP("action", "Page settings")
),
ActionItem("load-style",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Load Style")
QT_TRANSLATE_NOOP("action","Load Style…"),
QT_TRANSLATE_NOOP("action","Load style")
),
ActionItem("transpose",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "&Transpose…"),
QT_TRANSLATE_NOOP("action", "Transpose")
),
ActionItem("parts",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Parts"),
QT_TRANSLATE_NOOP("action", "Manage parts")
QT_TRANSLATE_NOOP("action", "Manage parts"),
IconCode::Code::PAGE
),
ActionItem("toggle-mixer",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Mixer"),
QT_TRANSLATE_NOOP("action", "Toggle mixer"),
IconCode::Code::MIXER
),
ActionItem("view-mode-page",
ShortcutContext::NotationActive,
@ -192,11 +213,13 @@ const ActionList NotationActions::m_actions = {
),
ActionItem("add-remove-breaks",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Add/Remove System Breaks…"),
QT_TRANSLATE_NOOP("action", "Add/remove system breaks")
),
ActionItem("edit-info",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Score Properties")
QT_TRANSLATE_NOOP("action", "Score Properties…"),
QT_TRANSLATE_NOOP("action", "Edit score properties")
),
ActionItem("undo",
ShortcutContext::NotationActive,
@ -212,360 +235,448 @@ const ActionList NotationActions::m_actions = {
),
ActionItem("voice-x12",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Exchange Voice 1-2")
QT_TRANSLATE_NOOP("action", "Exchange Voice 1-2"),
QT_TRANSLATE_NOOP("action", "Exchange voice 1-2")
),
ActionItem("voice-x13",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Exchange Voice 1-3")
QT_TRANSLATE_NOOP("action", "Exchange Voice 1-3"),
QT_TRANSLATE_NOOP("action", "Exchange voice 1-3")
),
ActionItem("voice-x14",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Exchange Voice 1-4")
QT_TRANSLATE_NOOP("action", "Exchange Voice 1-4"),
QT_TRANSLATE_NOOP("action", "Exchange voice 1-4")
),
ActionItem("voice-x23",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Exchange Voice 2-3")
QT_TRANSLATE_NOOP("action", "Exchange Voice 2-3"),
QT_TRANSLATE_NOOP("action", "Exchange voice 2-3")
),
ActionItem("voice-x24",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Exchange Voice 2-4")
QT_TRANSLATE_NOOP("action", "Exchange Voice 2-4"),
QT_TRANSLATE_NOOP("action", "Exchange voice 2-4")
),
ActionItem("voice-x34",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Exchange Voice 3-4")
QT_TRANSLATE_NOOP("action", "Exchange Voice 3-4"),
QT_TRANSLATE_NOOP("action", "Exchange voice 3-4")
),
ActionItem("split-measure",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Split measure"),
QT_TRANSLATE_NOOP("action", "Split Measure Before Selected Note/Rest"),
QT_TRANSLATE_NOOP("action", "Split measure before selected note/rest")
),
ActionItem("join-measures",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Join Selected Measures")
QT_TRANSLATE_NOOP("action", "Join Selected Measures"),
QT_TRANSLATE_NOOP("action", "Join selected measures")
),
ActionItem("insert-measure",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Insert Measure")
QT_TRANSLATE_NOOP("action", "Insert One Measure"),
QT_TRANSLATE_NOOP("action", "Insert one measure")
),
ActionItem("insert-measures",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Insert Measures")
QT_TRANSLATE_NOOP("action", "Insert Measures"),
QT_TRANSLATE_NOOP("action", "Insert measures")
),
ActionItem("append-measure",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Append Measure")
QT_TRANSLATE_NOOP("action", "Append One Measure"),
QT_TRANSLATE_NOOP("action", "Append one measure")
),
ActionItem("append-measures",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Append Measures")
QT_TRANSLATE_NOOP("action", "Append Measures"),
QT_TRANSLATE_NOOP("action", "Append measures")
),
ActionItem("insert-hbox",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Insert Horizontal Frame")
QT_TRANSLATE_NOOP("action", "Insert Horizontal Frame"),
QT_TRANSLATE_NOOP("action", "Insert horizontal frame")
),
ActionItem("insert-vbox",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Insert Vertical Frame")
QT_TRANSLATE_NOOP("action", "Insert Vertical Frame"),
QT_TRANSLATE_NOOP("action", "Insert vertical frame")
),
ActionItem("insert-textframe",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Insert Text Frame")
QT_TRANSLATE_NOOP("action", "Insert Text Frame"),
QT_TRANSLATE_NOOP("action", "Insert text frame")
),
ActionItem("append-hbox",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Append Horizontal Frame")
QT_TRANSLATE_NOOP("action", "Append Horizontal Frame"),
QT_TRANSLATE_NOOP("action", "Append horizontal frame")
),
ActionItem("append-vbox",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Append Vertical Frame")
QT_TRANSLATE_NOOP("action", "Append Vertical Frame"),
QT_TRANSLATE_NOOP("action", "Append vertical frame")
),
ActionItem("append-textframe",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Append Text Frame")
QT_TRANSLATE_NOOP("action", "Append Text Frame"),
QT_TRANSLATE_NOOP("action", "Append text frame")
),
ActionItem("interval1",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Unison Above")
QT_TRANSLATE_NOOP("action", "Unison Above"),
QT_TRANSLATE_NOOP("action", "Enter unison above")
),
ActionItem("interval2",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Second Above")
QT_TRANSLATE_NOOP("action", "Second Above"),
QT_TRANSLATE_NOOP("action", "Enter second above")
),
ActionItem("interval3",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Third Above")
QT_TRANSLATE_NOOP("action", "Third Above"),
QT_TRANSLATE_NOOP("action", "Enter third above")
),
ActionItem("interval4",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Fourth Above")
QT_TRANSLATE_NOOP("action", "Fourth Above"),
QT_TRANSLATE_NOOP("action", "Enter fourth above")
),
ActionItem("interval5",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Fifth Above")
QT_TRANSLATE_NOOP("action", "Fifth Above"),
QT_TRANSLATE_NOOP("action", "Enter fifth above")
),
ActionItem("interval6",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Sixth Above")
QT_TRANSLATE_NOOP("action", "Sixth Above"),
QT_TRANSLATE_NOOP("action", "Enter sixth above")
),
ActionItem("interval7",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Seventh Above")
QT_TRANSLATE_NOOP("action", "Seventh Above"),
QT_TRANSLATE_NOOP("action", "Enter seventh above")
),
ActionItem("interval8",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Octave Above")
QT_TRANSLATE_NOOP("action", "Octave Above"),
QT_TRANSLATE_NOOP("action", "Enter octave above")
),
ActionItem("interval9",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Ninth Above")
QT_TRANSLATE_NOOP("action", "Ninth Above"),
QT_TRANSLATE_NOOP("action", "Enter ninth above")
),
ActionItem("interval-2",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Second Below")
QT_TRANSLATE_NOOP("action", "Second Below"),
QT_TRANSLATE_NOOP("action", "Enter second below")
),
ActionItem("interval-3",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Third Below")
QT_TRANSLATE_NOOP("action", "Third Below"),
QT_TRANSLATE_NOOP("action", "Enter third below")
),
ActionItem("interval-4",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Fourth Below")
QT_TRANSLATE_NOOP("action", "Fourth Below"),
QT_TRANSLATE_NOOP("action", "Enter fourth below")
),
ActionItem("interval-5",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Fifth Below")
QT_TRANSLATE_NOOP("action", "Fifth Below"),
QT_TRANSLATE_NOOP("action", "Enter fifth below")
),
ActionItem("interval-6",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Sixth Below")
QT_TRANSLATE_NOOP("action", "Sixth Below"),
QT_TRANSLATE_NOOP("action", "Enter sixth below")
),
ActionItem("interval-7",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Seventh Below")
QT_TRANSLATE_NOOP("action", "Seventh Below"),
QT_TRANSLATE_NOOP("action", "Enter seventh below")
),
ActionItem("interval-8",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Octave Below")
QT_TRANSLATE_NOOP("action", "Octave Below"),
QT_TRANSLATE_NOOP("action", "Enter octave below")
),
ActionItem("interval-9",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Ninth Below")
QT_TRANSLATE_NOOP("action", "Ninth Below"),
QT_TRANSLATE_NOOP("action", "Enter ninth below")
),
ActionItem("note-c",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "C")
QT_TRANSLATE_NOOP("action", "C"),
QT_TRANSLATE_NOOP("action", "Enter note C")
),
ActionItem("note-d",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "D")
QT_TRANSLATE_NOOP("action", "D"),
QT_TRANSLATE_NOOP("action", "Enter note D")
),
ActionItem("note-e",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "E")
QT_TRANSLATE_NOOP("action", "E"),
QT_TRANSLATE_NOOP("action", "Enter note E")
),
ActionItem("note-f",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "F")
QT_TRANSLATE_NOOP("action", "F"),
QT_TRANSLATE_NOOP("action", "Enter note F")
),
ActionItem("note-g",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "G")
QT_TRANSLATE_NOOP("action", "G"),
QT_TRANSLATE_NOOP("action", "Enter note G")
),
ActionItem("note-a",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "A")
QT_TRANSLATE_NOOP("action", "A"),
QT_TRANSLATE_NOOP("action", "Enter note A")
),
ActionItem("note-b",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "B")
QT_TRANSLATE_NOOP("action", "B"),
QT_TRANSLATE_NOOP("action", "Enter note B")
),
ActionItem("chord-c",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Add C to Chord")
QT_TRANSLATE_NOOP("action", "Add C to Chord"),
QT_TRANSLATE_NOOP("action", "Add note C to chord")
),
ActionItem("chord-d",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Add D to Chord")
QT_TRANSLATE_NOOP("action", "Add D to Chord"),
QT_TRANSLATE_NOOP("action", "Add note D to chord")
),
ActionItem("chord-e",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Add E to Chord")
QT_TRANSLATE_NOOP("action", "Add E to Chord"),
QT_TRANSLATE_NOOP("action", "Add note E to chord")
),
ActionItem("chord-f",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Add F to Chord")
QT_TRANSLATE_NOOP("action", "Add F to Chord"),
QT_TRANSLATE_NOOP("action", "Add note F to chord")
),
ActionItem("chord-g",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Add G to Chord")
QT_TRANSLATE_NOOP("action", "Add G to Chord"),
QT_TRANSLATE_NOOP("action", "Add note G to chord")
),
ActionItem("chord-a",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Add A to Chord")
QT_TRANSLATE_NOOP("action", "Add A to Chord"),
QT_TRANSLATE_NOOP("action", "Add note A to chord")
),
ActionItem("chord-b",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Add B to Chord")
QT_TRANSLATE_NOOP("action", "Add B to Chord"),
QT_TRANSLATE_NOOP("action", "Add note B to chord")
),
ActionItem("insert-c",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Insert C")
QT_TRANSLATE_NOOP("action", "Insert C"),
QT_TRANSLATE_NOOP("action", "Insert note C")
),
ActionItem("insert-d",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Insert D")
QT_TRANSLATE_NOOP("action", "Insert D"),
QT_TRANSLATE_NOOP("action", "Insert note D")
),
ActionItem("insert-e",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Insert E")
QT_TRANSLATE_NOOP("action", "Insert E"),
QT_TRANSLATE_NOOP("action", "Insert note E")
),
ActionItem("insert-f",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Insert F")
QT_TRANSLATE_NOOP("action", "Insert F"),
QT_TRANSLATE_NOOP("action", "Insert note F")
),
ActionItem("insert-g",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Insert G")
QT_TRANSLATE_NOOP("action", "Insert G"),
QT_TRANSLATE_NOOP("action", "Insert note G")
),
ActionItem("insert-a",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Insert A")
QT_TRANSLATE_NOOP("action", "Insert A"),
QT_TRANSLATE_NOOP("action", "Insert note A")
),
ActionItem("insert-b",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Insert B")
QT_TRANSLATE_NOOP("action", "Insert B"),
QT_TRANSLATE_NOOP("action", "Insert note B")
),
ActionItem("add-8va",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Ottava 8va alta")
QT_TRANSLATE_NOOP("action", "Ottava 8va alta"),
QT_TRANSLATE_NOOP("action", "Add ottava 8va alta")
),
ActionItem("add-8vb",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Ottava 8va bassa")
QT_TRANSLATE_NOOP("action", "Ottava 8va bassa"),
QT_TRANSLATE_NOOP("action", "Add ottava 8va bassa")
),
ActionItem("add-hairpin",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Crescendo")
QT_TRANSLATE_NOOP("action", "Crescendo"),
QT_TRANSLATE_NOOP("action", "Add crescendo")
),
ActionItem("add-hairpin-reverse",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Decrescendo")
QT_TRANSLATE_NOOP("action", "Decrescendo"),
QT_TRANSLATE_NOOP("action", "Add decrescendo")
),
ActionItem("add-noteline",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Note Anchored Line")
QT_TRANSLATE_NOOP("action","Note Anchored Line"),
QT_TRANSLATE_NOOP("action","Note anchored line")
),
ActionItem("title-text",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Title")
QT_TRANSLATE_NOOP("action", "Title"),
QT_TRANSLATE_NOOP("action", "Add title text")
),
ActionItem("subtitle-text",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Subtitle")
QT_TRANSLATE_NOOP("action", "Subtitle"),
QT_TRANSLATE_NOOP("action", "Add subtitle text")
),
ActionItem("composer-text",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Composer")
QT_TRANSLATE_NOOP("action", "Composer"),
QT_TRANSLATE_NOOP("action", "Add composer text")
),
ActionItem("poet-text",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Lirycist")
QT_TRANSLATE_NOOP("action", "Lirycist"),
QT_TRANSLATE_NOOP("action", "Add lirycist text")
),
ActionItem("part-text",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Part Name")
QT_TRANSLATE_NOOP("action", "Part Name"),
QT_TRANSLATE_NOOP("action", "Add part name")
),
ActionItem("system-text",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "System Text")
QT_TRANSLATE_NOOP("action", "System Text"),
QT_TRANSLATE_NOOP("action", "Add system text")
),
ActionItem("staff-text",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Staff Text")
QT_TRANSLATE_NOOP("action", "Staff Text"),
QT_TRANSLATE_NOOP("action", "Add staff text")
),
ActionItem("expression-text",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Expression Text")
QT_TRANSLATE_NOOP("action", "Expression Text"),
QT_TRANSLATE_NOOP("action", "Add expression text")
),
ActionItem("rehearsalmark-text",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Rehearsal Mark")
QT_TRANSLATE_NOOP("action", "Rehearsal Mark"),
QT_TRANSLATE_NOOP("action", "Add rehearsal mark")
),
ActionItem("instrument-change-text",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Instrument Change")
QT_TRANSLATE_NOOP("action", "Instrument Change"),
QT_TRANSLATE_NOOP("action", "Add instrument change")
),
ActionItem("fingering-text",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Fingering")
QT_TRANSLATE_NOOP("action", "Fingering"),
QT_TRANSLATE_NOOP("action", "Add fingering")
),
ActionItem("sticking-text",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Sticking")
QT_TRANSLATE_NOOP("action", "Sticking"),
QT_TRANSLATE_NOOP("action", "Add sticking")
),
ActionItem("chord-text",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Chord Symbol")
QT_TRANSLATE_NOOP("action", "Chord Symbol"),
QT_TRANSLATE_NOOP("action", "Add chord symbol")
),
ActionItem("roman-numeral-text",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Roman Numeral Analysis")
QT_TRANSLATE_NOOP("action", "Roman Numeral Analysis"),
QT_TRANSLATE_NOOP("action", "Add Roman numeral analysis")
),
ActionItem("nashville-number-text",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Nashville Number")
QT_TRANSLATE_NOOP("action", "Nashville Number"),
QT_TRANSLATE_NOOP("action", "Add Nashville number")
),
ActionItem("lyrics",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Lyrics")
QT_TRANSLATE_NOOP("action", "Lyrics"),
QT_TRANSLATE_NOOP("action", "Add lyrics")
),
ActionItem("figured-bass",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Figured Bass")
QT_TRANSLATE_NOOP("action", "Figured Bass"),
QT_TRANSLATE_NOOP("action", "Add figured bass")
),
ActionItem("tempo",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Tempo Marking")
QT_TRANSLATE_NOOP("action", "Tempo Marking"),
QT_TRANSLATE_NOOP("action", "Add tempo marking")
),
ActionItem("duplet",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Duplet")
QT_TRANSLATE_NOOP("action", "Duplet"),
QT_TRANSLATE_NOOP("action", "Add duplet")
),
ActionItem("triplet",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Triplet")
QT_TRANSLATE_NOOP("action", "Triplet"),
QT_TRANSLATE_NOOP("action", "Add triplet")
),
ActionItem("quadruplet",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Quadruplet")
QT_TRANSLATE_NOOP("action", "Quadruplet"),
QT_TRANSLATE_NOOP("action", "Add quadruplet")
),
ActionItem("quintuplet",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Quintuplet")
QT_TRANSLATE_NOOP("action", "Quintuplet"),
QT_TRANSLATE_NOOP("action", "Add quintuplet")
),
ActionItem("sextuplet",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "sextuplet")
QT_TRANSLATE_NOOP("action", "sextuplet"),
QT_TRANSLATE_NOOP("action", "Add sextuplet")
),
ActionItem("septuplet",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Septuplet")
QT_TRANSLATE_NOOP("action", "Septuplet"),
QT_TRANSLATE_NOOP("action", "Add septuplet")
),
ActionItem("octuplet",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Octuplet")
QT_TRANSLATE_NOOP("action", "Octuplet"),
QT_TRANSLATE_NOOP("action", "Add octuplet")
),
ActionItem("nonuplet",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Nontuplet")
QT_TRANSLATE_NOOP("action", "Nontuplet"),
QT_TRANSLATE_NOOP("action", "Add nontuplet")
),
ActionItem("tuplet-dialog",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Other")
QT_TRANSLATE_NOOP("action", "Other…"),
QT_TRANSLATE_NOOP("action", "Other tuplets")
),
ActionItem("toggle-navigator",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Toggle Navigator")
QT_TRANSLATE_NOOP("action", "Navigator"),
QT_TRANSLATE_NOOP("action", "Toggle 'Navigator'")
)
};
@ -609,146 +720,175 @@ const ActionList NotationActions::m_noteInputActions = {
ActionItem("note-longa",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Longo"),
QT_TRANSLATE_NOOP("action", "Note duration: Longa"),
IconCode::Code::LONGO
),
ActionItem("note-breve",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Double whole note"),
QT_TRANSLATE_NOOP("action", "Note duration: double whole note"),
IconCode::Code::NOTE_WHOLE_DOUBLE
),
ActionItem("pad-note-1",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Whole note"),
QT_TRANSLATE_NOOP("action", "Note duration: whole note"),
IconCode::Code::NOTE_WHOLE
),
ActionItem("pad-note-2",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Half note"),
QT_TRANSLATE_NOOP("action", "Note duration: half note"),
IconCode::Code::NOTE_HALF
),
ActionItem("pad-note-4",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Quarter note"),
QT_TRANSLATE_NOOP("action", "Note duration: quarter note"),
IconCode::Code::NOTE_QUARTER
),
ActionItem("pad-note-8",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "8th note"),
QT_TRANSLATE_NOOP("action", "Note duration: 8th note"),
IconCode::Code::NOTE_8TH
),
ActionItem("pad-note-16",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "16th note"),
QT_TRANSLATE_NOOP("action", "Note duration: 16th note"),
IconCode::Code::NOTE_16TH
),
ActionItem("pad-note-32",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "32th note"),
QT_TRANSLATE_NOOP("action", "Note duration: 32th note"),
IconCode::Code::NOTE_32TH
),
ActionItem("pad-note-64",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "64th note"),
QT_TRANSLATE_NOOP("action", "Note duration: 64th note"),
IconCode::Code::NOTE_64TH
),
ActionItem("pad-note-128",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "128th note"),
QT_TRANSLATE_NOOP("action", "Note duration: 128th note"),
IconCode::Code::NOTE_128TH
),
ActionItem("pad-note-256",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "256th note"),
QT_TRANSLATE_NOOP("action", "Note duration: 256th note"),
IconCode::Code::NOTE_256TH
),
ActionItem("pad-note-512",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "512th note"),
QT_TRANSLATE_NOOP("action", "Note duration: 512th note"),
IconCode::Code::NOTE_512TH
),
ActionItem("pad-note-1024",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "1024th note"),
QT_TRANSLATE_NOOP("action", "Note duration: 1024th note"),
IconCode::Code::NOTE_1024TH
),
ActionItem("pad-dot",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Dotted note"),
QT_TRANSLATE_NOOP("action", "Augmentation Dot"),
QT_TRANSLATE_NOOP("action", "Note duration: augmentation dot"),
IconCode::Code::NOTE_DOTTED
),
ActionItem("pad-dotdot",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Double dotted note"),
QT_TRANSLATE_NOOP("action", "Double Augmentation Dot"),
QT_TRANSLATE_NOOP("action", "Note duration: double augmentation dot"),
IconCode::Code::NOTE_DOTTED_2
),
ActionItem("pad-dot3",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Triple dotted note"),
QT_TRANSLATE_NOOP("action", "Triple Augmentation Dot"),
QT_TRANSLATE_NOOP("action", "Note duration: triple augmentation dot"),
IconCode::Code::NOTE_DOTTED_3
),
ActionItem("pad-dot4",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Quadruple dotted note"),
QT_TRANSLATE_NOOP("action", "Quadruple Augmentation Dot"),
QT_TRANSLATE_NOOP("action", "Note duration: quadruple augmentation dot"),
IconCode::Code::NOTE_DOTTED_4
),
ActionItem("pad-rest",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Rest"),
QT_TRANSLATE_NOOP("action", "Note input: Rest"),
IconCode::Code::REST
),
ActionItem("flat",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Flat"),
QT_TRANSLATE_NOOP("action", ""),
QT_TRANSLATE_NOOP("action", "Note input: ♭"),
IconCode::Code::FLAT
),
ActionItem("flat2",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Double flat"),
QT_TRANSLATE_NOOP("action", "Double ♭"),
QT_TRANSLATE_NOOP("action", "Note input: Double ♭"),
IconCode::Code::FLAT_DOUBLE
),
ActionItem("nat",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Natural"),
QT_TRANSLATE_NOOP("action", ""),
QT_TRANSLATE_NOOP("action", "Note input: ♮"),
IconCode::Code::NATURAL
),
ActionItem("sharp",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Sharp"),
QT_TRANSLATE_NOOP("action", ""),
QT_TRANSLATE_NOOP("action", "Note input: ♯"),
IconCode::Code::SHARP
),
ActionItem("sharp2",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Double sharp"),
QT_TRANSLATE_NOOP("action", "Double ♯"),
QT_TRANSLATE_NOOP("action", "Note input: Double ♯"),
IconCode::Code::SHARP_DOUBLE
),
ActionItem("tie",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Tie"),
QT_TRANSLATE_NOOP("action", "Note duration: Tie"),
IconCode::Code::NOTE_TIE
),
ActionItem("add-slur",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Slur"),
QT_TRANSLATE_NOOP("action", "Add slur"),
IconCode::Code::NOTE_SLUR
),
ActionItem("add-marcato",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Marcato"),
QT_TRANSLATE_NOOP("action", "Toggle marcato"),
IconCode::Code::MARCATO
),
ActionItem("add-sforzato", // TODO
ActionItem("add-sforzato",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Accent"),
QT_TRANSLATE_NOOP("action", "Toggle accent"),
IconCode::Code::ACCENT
),
ActionItem("add-tenuto",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Tenuto"),
QT_TRANSLATE_NOOP("action", "Toggle tenuto"),
IconCode::Code::TENUTO
),
ActionItem("add-staccato",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Staccato"),
QT_TRANSLATE_NOOP("action", "Toggle staccato"),
IconCode::Code::STACCATO
),
ActionItem("tuplet",
@ -759,26 +899,31 @@ const ActionList NotationActions::m_noteInputActions = {
ActionItem("voice-1",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Voice 1"),
QT_TRANSLATE_NOOP("action", "Voice 1"),
IconCode::Code::VOICE_1
),
ActionItem("voice-2",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Voice 2"),
QT_TRANSLATE_NOOP("action", "Voice 2"),
IconCode::Code::VOICE_2
),
ActionItem("voice-3",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Voice 3"),
QT_TRANSLATE_NOOP("action", "Voice 3"),
IconCode::Code::VOICE_3
),
ActionItem("voice-4",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Voice 4"),
QT_TRANSLATE_NOOP("action", "Voice 4"),
IconCode::Code::VOICE_4
),
ActionItem("flip",
ShortcutContext::NotationActive,
QT_TRANSLATE_NOOP("action", "Flip"),
QT_TRANSLATE_NOOP("action", "Flip Direction"),
QT_TRANSLATE_NOOP("action", "Flip direction"),
IconCode::Code::NOTE_FLIP
),
};

View file

@ -66,30 +66,24 @@ static const Settings::Key IS_COUNT_IN_ENABLED(module_name, "application/playbac
static const Settings::Key TOOLBAR_KEY(module_name, "ui/toolbar/");
static const Settings::Key NAVIGATOR_VISIBLE_KEY(module_name, "ui/application/startup/showNavigator");
static const Settings::Key NAVIGATOR_ORIENTATION(module_name, "ui/canvas/scroll/verticalOrientation");
static const bool NAVIGATOR_ORIENTATION_VERTICAL(true);
static const Settings::Key IS_CANVAS_ORIENTATION_VERTICAL_KEY(module_name, "ui/canvas/scroll/verticalOrientation");
void NotationConfiguration::init()
{
settings()->setDefaultValue(ANCHORLINE_COLOR, Val(QColor("#C31989")));
settings()->setDefaultValue(BACKGROUND_COLOR, Val(theme()->backgroundSecondaryColor()));
settings()->setDefaultValue(BACKGROUND_COLOR, Val(QColor("#385f94")));
settings()->valueChanged(BACKGROUND_COLOR).onReceive(nullptr, [this](const Val& val) {
LOGD() << "BACKGROUND_COLOR changed: " << val.toString();
m_backgroundColorChanged.send(val.toQColor());
});
settings()->setDefaultValue(FOREGROUND_COLOR, Val(theme()->backgroundPrimaryColor()));
settings()->setDefaultValue(FOREGROUND_COLOR, Val(QColor("#f9f9f9")));
settings()->valueChanged(FOREGROUND_COLOR).onReceive(nullptr, [this](const Val& val) {
LOGD() << "FOREGROUND_COLOR changed: " << val.toString();
m_foregroundColorChanged.send(foregroundColor());
});
theme()->themeChanged().onNotify(this, [this]() {
m_backgroundColorChanged.send(backgroundColor());
m_foregroundColorChanged.send(foregroundColor());
});
settings()->setDefaultValue(FOREGROUND_USE_USER_COLOR, Val(true));
settings()->valueChanged(FOREGROUND_USE_USER_COLOR).onReceive(nullptr, [this](const Val& val) {
LOGD() << "FOREGROUND_USE_USER_COLOR changed: " << val.toString();
@ -113,9 +107,9 @@ void NotationConfiguration::init()
m_navigatorVisibleChanged.send(isNavigatorVisible().val);
});
settings()->setDefaultValue(NAVIGATOR_ORIENTATION, Val(NAVIGATOR_ORIENTATION_VERTICAL));
settings()->valueChanged(NAVIGATOR_ORIENTATION).onReceive(nullptr, [this](const Val&) {
m_navigatorOrientationChanged.send(navigatorOrientation().val);
settings()->setDefaultValue(IS_CANVAS_ORIENTATION_VERTICAL_KEY, Val(false));
settings()->valueChanged(IS_CANVAS_ORIENTATION_VERTICAL_KEY).onReceive(nullptr, [this](const Val&) {
m_canvasOrientationChanged.send(canvasOrientation().val);
});
// libmscore
@ -129,12 +123,7 @@ QColor NotationConfiguration::anchorLineColor() const
QColor NotationConfiguration::backgroundColor() const
{
QColor color = resolveColor(BACKGROUND_COLOR);
if (!color.isValid()) {
color = theme()->backgroundSecondaryColor();
}
return color;
return settings()->value(BACKGROUND_COLOR).toQColor();
}
async::Channel<QColor> NotationConfiguration::backgroundColorChanged() const
@ -168,12 +157,7 @@ QColor NotationConfiguration::foregroundColor() const
return settings()->value(FOREGROUND_COLOR).toQColor();
}
QColor color = resolveColor(FOREGROUND_COLOR);
if (!color.isValid()) {
color = theme()->backgroundSecondaryColor();
}
return color;
return settings()->defaultValue(FOREGROUND_COLOR).toQColor();
}
async::Channel<QColor> NotationConfiguration::foregroundColorChanged() const
@ -341,20 +325,20 @@ void NotationConfiguration::setNavigatorVisible(bool visible)
settings()->setValue(NAVIGATOR_VISIBLE_KEY, Val(visible));
}
ValCh<Orientation> NotationConfiguration::navigatorOrientation() const
ValCh<Orientation> NotationConfiguration::canvasOrientation() const
{
ValCh<Orientation> orientation;
orientation.ch = m_navigatorOrientationChanged;
bool isVertical = settings()->value(NAVIGATOR_ORIENTATION).toBool() == NAVIGATOR_ORIENTATION_VERTICAL;
orientation.ch = m_canvasOrientationChanged;
bool isVertical = settings()->value(IS_CANVAS_ORIENTATION_VERTICAL_KEY).toBool();
orientation.val = isVertical ? Orientation::Vertical : Orientation::Horizontal;
return orientation;
}
void NotationConfiguration::setNavigatorOrientation(Orientation orientation)
void NotationConfiguration::setCanvasOrientation(Orientation orientation)
{
bool isVertical = orientation == Orientation::Vertical;
settings()->setValue(NAVIGATOR_ORIENTATION, Val(isVertical));
settings()->setValue(IS_CANVAS_ORIENTATION_VERTICAL_KEY, Val(isVertical));
}
std::vector<std::string> NotationConfiguration::parseToolbarActions(const std::string& actions) const
@ -379,14 +363,3 @@ Settings::Key NotationConfiguration::toolbarSettingsKey(const std::string& toolb
toolbarKey.key += toolbarName;
return toolbarKey;
}
QColor NotationConfiguration::resolveColor(const Settings::Key& key) const
{
QColor color = settings()->value(key).toQColor();
QColor defaultColor = settings()->defaultValue(key).toQColor();
if (!color.isValid() || color == defaultColor) {
return QColor();
}
return color;
}

View file

@ -25,14 +25,12 @@
#include "ui/iuiconfiguration.h"
#include "iglobalconfiguration.h"
#include "settings.h"
#include "ui/itheme.h"
namespace mu::notation {
class NotationConfiguration : public INotationConfiguration, public async::Asyncable
{
INJECT(notation, ui::IUiConfiguration, uiConfiguration)
INJECT(notation, framework::IGlobalConfiguration, globalConfiguration)
INJECT(notation, ui::ITheme, theme)
public:
void init();
@ -93,21 +91,19 @@ public:
ValCh<bool> isNavigatorVisible() const override;
void setNavigatorVisible(bool visible) override;
ValCh<framework::Orientation> navigatorOrientation() const override;
void setNavigatorOrientation(framework::Orientation orientation) override;
ValCh<framework::Orientation> canvasOrientation() const override;
void setCanvasOrientation(framework::Orientation orientation) override;
private:
std::vector<std::string> parseToolbarActions(const std::string& actions) const;
framework::Settings::Key toolbarSettingsKey(const std::string& toolbarName) const;
QColor resolveColor(const framework::Settings::Key& key) const;
async::Channel<QColor> m_backgroundColorChanged;
async::Channel<QColor> m_foregroundColorChanged;
async::Channel<int> m_currentZoomChanged;
async::Channel<bool> m_navigatorVisibleChanged;
async::Channel<framework::Orientation> m_navigatorOrientationChanged;
async::Channel<framework::Orientation> m_canvasOrientationChanged;
};
}

View file

@ -311,7 +311,7 @@ QRectF NotationNoteInput::cursorRect() const
QRectF result = QRectF(x, y, w, h);
if (configuration()->navigatorOrientation().val == framework::Orientation::Horizontal) {
if (configuration()->canvasOrientation().val == framework::Orientation::Horizontal) {
result.translate(system->page()->pos());
}

View file

@ -96,6 +96,7 @@ void NotationPlayback::updateLoopBoundaries()
boundaries.loopOutTick = score()->loopOutTick().ticks();
boundaries.loopInRect = loopBoundaryRectByTick(LoopBoundaryType::LoopIn, boundaries.loopInTick);
boundaries.loopOutRect = loopBoundaryRectByTick(LoopBoundaryType::LoopOut, boundaries.loopOutTick);
boundaries.visible = m_loopBoundaries.val.visible;
if (m_loopBoundaries.val != boundaries) {
m_loopBoundaries.set(boundaries);
@ -636,11 +637,14 @@ void NotationPlayback::addLoopOut(int _tick)
score()->setLoopOutTick(tick);
}
void NotationPlayback::removeLoopBoundaries()
void NotationPlayback::setLoopBoundariesVisible(bool visible)
{
Fraction null = Fraction::fromTicks(0);
score()->setLoopInTick(null);
score()->setLoopOutTick(null);
if (m_loopBoundaries.val.visible == visible) {
return;
}
m_loopBoundaries.val.visible = visible;
m_loopBoundaries.set(m_loopBoundaries.val);
}
QRect NotationPlayback::loopBoundaryRectByTick(LoopBoundaryType boundaryType, int _tick) const
@ -723,9 +727,9 @@ QRect NotationPlayback::loopBoundaryRectByTick(LoopBoundaryType boundaryType, in
return QRect(x, y, width, height);
}
mu::async::Channel<LoopBoundaries> NotationPlayback::loopBoundariesChanged() const
mu::ValCh<LoopBoundaries> NotationPlayback::loopBoundaries() const
{
return m_loopBoundaries.ch;
return m_loopBoundaries;
}
Tempo NotationPlayback::tempo(int tick) const
@ -737,13 +741,14 @@ Tempo NotationPlayback::tempo(int tick) const
}
const Ms::TempoText* tempoText = this->tempoText(tick);
if (!tempoText) {
tempo.valueBpm = score()->tempo(Fraction::fromTicks(tick)) * 60;
Ms::TDuration duration = tempoText ? tempoText->duration() : Ms::TDuration();
if (!tempoText || !duration.isValid()) {
tempo.duration = DurationType::V_QUARTER;
tempo.valueBpm = std::round(score()->tempo(Fraction::fromTicks(tick)) * 60.);
return tempo;
}
Ms::TDuration duration = tempoText->duration();
tempo.valueBpm = tempoText->tempoBpm();
tempo.duration = duration.type();
tempo.withDot = duration.dots() > 0;

View file

@ -61,8 +61,8 @@ public:
midi::MidiData playElementMidiData(const Element* element) const override;
void addLoopBoundary(LoopBoundaryType boundaryType, int tick) override;
void removeLoopBoundaries() override;
async::Channel<LoopBoundaries> loopBoundariesChanged() const override;
void setLoopBoundariesVisible(bool visible) override;
ValCh<LoopBoundaries> loopBoundaries() const override;
Tempo tempo(int tick) const override;
MeasureBeat beat(int tick) const override;

View file

@ -347,6 +347,8 @@ struct LoopBoundaries
QRect loopInRect;
QRect loopOutRect;
bool visible = false;
bool isNull() const
{
return loopInTick == 0 && loopOutTick == 0;
@ -360,6 +362,7 @@ struct LoopBoundaries
equals &= loopOutTick == boundaries.loopOutTick;
equals &= loopInRect == boundaries.loopInRect;
equals &= loopOutRect == boundaries.loopOutRect;
equals &= visible == boundaries.visible;
return equals;
}

View file

@ -31,6 +31,9 @@ Rectangle {
delegate: FlatButton {
text: model.title
icon: model.icon
iconFont: ui.theme.toolbarIconsFont
hint: model.hint
enabled: model.enabled
textFont: ui.theme.tabFont
@ -38,7 +41,7 @@ Rectangle {
orientation: Qt.Horizontal
onClicked: {
toolbarModel.open(model.index)
toolbarModel.handleAction(model.code)
}
}
}

View file

@ -33,6 +33,10 @@ FocusScope {
orientation: notationNavigator.orientation
background: Rectangle {
color: notationView.backgroundColor
}
NotationPaintView {
id: notationView

View file

@ -38,7 +38,9 @@ Rectangle {
normalStateColor: Boolean(item) && item.checkedRole ? ui.theme.accentColor : "transparent"
icon: Boolean(item) ? item.iconRole : IconCode.NONE
iconFont.pixelSize: 20
hint: Boolean(item) ? item.hintRole : ""
iconFont: ui.theme.toolbarIconsFont
width: gridView.cellWidth
height: gridView.cellWidth

View file

@ -22,6 +22,8 @@ Rectangle {
FlatButton {
icon: model.undoItem.icon
iconFont: ui.theme.toolbarIconsFont
hint: model.undoItem.description
enabled: model.undoItem.enabled
normalStateColor: "transparent"
@ -33,6 +35,8 @@ Rectangle {
FlatButton {
icon: model.redoItem.icon
iconFont: ui.theme.toolbarIconsFont
hint: model.redoItem.description
enabled: model.redoItem.enabled
normalStateColor: "transparent"

View file

@ -25,20 +25,24 @@ using namespace mu::notation;
NotationNavigator::NotationNavigator(QQuickItem* parent)
: NotationPaintView(parent)
{
setAcceptedMouseButtons(Qt::AllButtons);
setReadonly(true);
}
void NotationNavigator::load()
{
initOrientation();
initVisible();
theme()->themeChanged().onNotify(this, [this]() {
update();
});
NotationPaintView::load();
}
bool NotationNavigator::isVerticalOrientation() const
{
return configuration()->navigatorOrientation().val == framework::Orientation::Vertical;
return configuration()->canvasOrientation().val == framework::Orientation::Vertical;
}
QRectF NotationNavigator::notationContentRect() const
@ -180,7 +184,7 @@ void NotationNavigator::setCursorRect(const QRect& rect)
int NotationNavigator::orientation() const
{
return static_cast<int>(configuration()->navigatorOrientation().val);
return static_cast<int>(configuration()->canvasOrientation().val);
}
INotationPtr NotationNavigator::currentNotation() const
@ -190,7 +194,7 @@ INotationPtr NotationNavigator::currentNotation() const
void NotationNavigator::initOrientation()
{
ValCh<framework::Orientation> orientation = configuration()->navigatorOrientation();
ValCh<framework::Orientation> orientation = configuration()->canvasOrientation();
orientation.ch.onReceive(this, [this](framework::Orientation) {
moveCanvasToPosition(QPoint(0, 0));
emit orientationChanged();

View file

@ -43,6 +43,7 @@ class NotationNavigator : public NotationPaintView
public:
NotationNavigator(QQuickItem* parent = nullptr);
Q_INVOKABLE void load() override;
Q_INVOKABLE void setCursorRect(const QRect& rect);
int orientation() const;

View file

@ -83,17 +83,17 @@ void NotationPaintView::load()
void NotationPaintView::initBackground()
{
m_backgroundColor = configuration()->backgroundColor();
setBackgroundColor(configuration()->backgroundColor());
configuration()->backgroundColorChanged().onReceive(this, [this](const QColor& color) {
m_backgroundColor = color;
setBackgroundColor(color);
update();
});
}
void NotationPaintView::initNavigatorOrientation()
{
configuration()->navigatorOrientation().ch.onReceive(this, [this](framework::Orientation) {
configuration()->canvasOrientation().ch.onReceive(this, [this](framework::Orientation) {
moveCanvasToPosition(QPoint(0, 0));
});
}
@ -197,7 +197,7 @@ void NotationPaintView::onCurrentNotationChanged()
}
});
notationPlayback()->loopBoundariesChanged().onReceive(this, [this](const LoopBoundaries& boundaries) {
notationPlayback()->loopBoundaries().ch.onReceive(this, [this](const LoopBoundaries& boundaries) {
updateLoopMarkers(boundaries);
});
@ -225,8 +225,8 @@ void NotationPaintView::updateLoopMarkers(const LoopBoundaries& boundaries)
m_loopInMarker->setRect(boundaries.loopInRect);
m_loopOutMarker->setRect(boundaries.loopOutRect);
m_loopInMarker->setVisible(!boundaries.isNull());
m_loopOutMarker->setVisible(!boundaries.isNull());
m_loopInMarker->setVisible(boundaries.visible);
m_loopOutMarker->setVisible(boundaries.visible);
update();
}
@ -336,6 +336,11 @@ void NotationPaintView::paint(QPainter* painter)
m_loopOutMarker->paint(painter);
}
QColor NotationPaintView::backgroundColor() const
{
return m_backgroundColor;
}
QRect NotationPaintView::viewport() const
{
return toLogical(QRect(0, 0, width(), height()));
@ -628,6 +633,16 @@ void NotationPaintView::setReadonly(bool readonly)
m_inputController->setReadonly(readonly);
}
void NotationPaintView::setBackgroundColor(const QColor& color)
{
if (m_backgroundColor == color) {
return;
}
m_backgroundColor = color;
emit backgroundColorChanged(color);
}
void NotationPaintView::clear()
{
m_matrix = QTransform();

View file

@ -52,6 +52,8 @@ class NotationPaintView : public QQuickPaintedItem, public IControlledView, publ
Q_PROPERTY(qreal horizontalScrollSize READ horizontalScrollSize NOTIFY horizontalScrollChanged)
Q_PROPERTY(qreal startVerticalScrollPosition READ startVerticalScrollPosition NOTIFY verticalScrollChanged)
Q_PROPERTY(qreal verticalScrollSize READ verticalScrollSize NOTIFY verticalScrollChanged)
Q_PROPERTY(QColor backgroundColor READ backgroundColor NOTIFY backgroundColorChanged)
Q_PROPERTY(QRect viewport READ viewport NOTIFY viewportChanged)
public:
@ -89,6 +91,7 @@ public:
qreal startVerticalScrollPosition() const;
qreal verticalScrollSize() const;
QColor backgroundColor() const;
QRect viewport() const;
signals:
@ -98,11 +101,13 @@ signals:
void horizontalScrollChanged();
void verticalScrollChanged();
void backgroundColorChanged(QColor color);
void viewportChanged(QRect viewport);
protected:
void setNotation(INotationPtr notation);
void setReadonly(bool readonly);
void setBackgroundColor(const QColor& color);
void moveCanvasToCenter();
void moveCanvasToPosition(const QPoint& logicPos);

View file

@ -25,6 +25,8 @@
using namespace mu::notation;
using namespace mu::ui;
using namespace mu::uicomponents;
using namespace mu::actions;
NotationToolBarModel::NotationToolBarModel(QObject* parent)
: QAbstractListModel(parent)
@ -42,11 +44,13 @@ QVariant NotationToolBarModel::data(const QModelIndex& index, int role) const
return QVariant();
}
ToolbarItem item = m_items[index.row()];
MenuItem item = m_items[index.row()];
switch (role) {
case TitleRole: return item.title;
case IconRole: return item.icon;
case TitleRole: return QString::fromStdString(item.title);
case CodeRole: return QString::fromStdString(item.code);
case HintRole: return QString::fromStdString(item.description);
case IconRole: return static_cast<int>(item.iconCode);
case EnabledRole: return item.enabled;
}
@ -57,8 +61,10 @@ QHash<int, QByteArray> NotationToolBarModel::roleNames() const
{
static const QHash<int, QByteArray> roles {
{ TitleRole, "title" },
{ CodeRole, "code" },
{ IconRole, "icon" },
{ EnabledRole, "enabled" }
{ EnabledRole, "enabled" },
{ HintRole, "hint" }
};
return roles;
@ -70,8 +76,8 @@ void NotationToolBarModel::load()
m_items.clear();
m_items << makeItem("Parts", IconCode::Code::PAGE, "musescore://notation/parts", hasNotation());
m_items << makeItem("Mixer", IconCode::Code::MIXER, "musescore://notation/mixer");
m_items << makeItem("parts");
m_items << makeItem("toggle-mixer");
endResetModel();
@ -80,33 +86,15 @@ void NotationToolBarModel::load()
});
}
void NotationToolBarModel::open(int index)
void NotationToolBarModel::handleAction(const QString& actionCode)
{
if (index < 0 || index >= m_items.size()) {
return;
}
Ret ret = interactive()->open(m_items[index].uri).ret;
if (!ret) {
LOGE() << ret.toString();
}
dispatcher()->dispatch(actions::codeFromQString(actionCode));
}
NotationToolBarModel::ToolbarItem NotationToolBarModel::makeItem(std::string_view title, IconCode::Code icon, std::string uri,
bool enabled) const
MenuItem NotationToolBarModel::makeItem(const ActionCode& actionCode) const
{
ToolbarItem item;
item.title = qtrc("notation", title.data());
item.icon = static_cast<int>(icon);
item.uri = std::move(uri);
item.enabled = enabled;
MenuItem item = actionsRegister()->action(actionCode);
item.enabled = context()->currentNotation() != nullptr;
return item;
}
bool NotationToolBarModel::hasNotation() const
{
return context()->currentNotation() != nullptr;
}

View file

@ -23,11 +23,13 @@
#include <QAbstractListModel>
#include "context/iglobalcontext.h"
#include "iinteractive.h"
#include "modularity/ioc.h"
#include "async/asyncable.h"
#include "actions/iactionsregister.h"
#include "actions/iactionsdispatcher.h"
#include "framework/ui/view/iconcodes.h"
#include "framework/uicomponents/uicomponentstypes.h"
namespace mu::notation {
class NotationToolBarModel : public QAbstractListModel, public async::Asyncable
@ -35,37 +37,31 @@ class NotationToolBarModel : public QAbstractListModel, public async::Asyncable
Q_OBJECT
INJECT(notation, context::IGlobalContext, context)
INJECT(notation, framework::IInteractive, interactive)
INJECT(notation, actions::IActionsRegister, actionsRegister)
INJECT(notation, actions::IActionsDispatcher, dispatcher)
public:
explicit NotationToolBarModel(QObject* parent = nullptr);
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
QVariant data(const QModelIndex& index, int role) const override;
QHash<int,QByteArray> roleNames() const override;
QHash<int, QByteArray> roleNames() const override;
Q_INVOKABLE void load();
Q_INVOKABLE void open(int index);
Q_INVOKABLE void handleAction(const QString& actionCode);
private:
bool hasNotation() const;
enum Roles {
TitleRole = Qt::UserRole + 1,
CodeRole,
IconRole,
EnabledRole
EnabledRole,
HintRole
};
struct ToolbarItem {
QString title;
int icon = 0;
bool enabled = false;
std::string uri;
};
uicomponents::MenuItem makeItem(const actions::ActionCode& actionCode) const;
ToolbarItem makeItem(std::string_view title, ui::IconCode::Code, std::string uri, bool enabled = true) const;
QList<ToolbarItem> m_items;
QList<uicomponents::MenuItem> m_items;
};
}

View file

@ -57,6 +57,7 @@ QVariant NoteInputBarModel::data(const QModelIndex& index, int role) const
case SectionRole: return QString::fromStdString(item.section);
case CodeRole: return QString::fromStdString(item.code);
case CheckedRole: return item.checked;
case HintRole: return QString::fromStdString(item.description);
}
return QVariant();
}
@ -72,7 +73,8 @@ QHash<int,QByteArray> NoteInputBarModel::roleNames() const
{ IconRole, "iconRole" },
{ SectionRole, "sectionRole" },
{ CodeRole, "codeRole" },
{ CheckedRole, "checkedRole" }
{ CheckedRole, "checkedRole" },
{ HintRole, "hintRole" }
};
return roles;
}

View file

@ -66,7 +66,8 @@ private:
CodeRole = Qt::UserRole + 1,
IconRole,
SectionRole,
CheckedRole
CheckedRole,
HintRole
};
INotationPtr notation() const;

View file

@ -66,9 +66,7 @@ void PlaybackController::init()
sequencer()->positionChanged().onNotify(this, [this]() {
if (configuration()->cursorType() == PlaybackCursorType::SMOOTH) {
float seconds = sequencer()->playbackPositionInSeconds();
int tick = m_notation->playback()->secToTick(seconds);
m_tickPlayed.set(tick);
m_tickPlayed.send(currentTick());
}
m_playbackPositionChanged.notify();
@ -76,13 +74,19 @@ void PlaybackController::init()
if (configuration()->cursorType() == PlaybackCursorType::STEPPED) {
sequencer()->midiTickPlayed(MIDI_TRACK).onReceive(this, [this](midi::tick_t tick) {
m_tickPlayed.set(tick);
m_tickPlayed.send(tick);
});
}
m_needRewindBeforePlay = true;
}
int PlaybackController::currentTick() const
{
float seconds = sequencer()->playbackPositionInSeconds();
return m_notation ? m_notation->playback()->secToTick(seconds) : 0;
}
bool PlaybackController::isPlayAllowed() const
{
return m_notation != nullptr;
@ -103,6 +107,16 @@ bool PlaybackController::isPaused() const
return sequencer()->status() == ISequencer::PAUSED;
}
bool PlaybackController::isLoopVisible() const
{
return playback() ? playback()->loopBoundaries().val.visible : false;
}
bool PlaybackController::isPlaybackLooped() const
{
return playback() ? !playback()->loopBoundaries().val.isNull() : false;
}
Notification PlaybackController::isPlayingChanged() const
{
return m_isPlayingChanged;
@ -115,7 +129,7 @@ Notification PlaybackController::playbackPositionChanged() const
Channel<uint32_t> PlaybackController::midiTickPlayed() const
{
return m_tickPlayed.ch;
return m_tickPlayed;
}
float PlaybackController::playbackPositionInSeconds() const
@ -158,6 +172,8 @@ INotationSelectionPtr PlaybackController::selection() const
void PlaybackController::onNotationChanged()
{
sequencer()->stop();
if (m_notation) {
m_notation->playback()->playPositionTickChanged().resetOnReceive(this);
}
@ -168,8 +184,8 @@ void PlaybackController::onNotationChanged()
seek(tick);
});
m_notation->playback()->loopBoundariesChanged().onReceive(this, [this](const LoopBoundaries& boundary) {
setLoop(boundary);
m_notation->playback()->loopBoundaries().ch.onReceive(this, [this](const LoopBoundaries& boundaries) {
setLoop(boundaries);
});
}
@ -285,8 +301,13 @@ void PlaybackController::toggleCountIn()
void PlaybackController::toggleLoopPlayback()
{
if (m_isPlaybackLooped) {
unsetLoop();
if (isLoopVisible()) {
hideLoop();
return;
}
if (isPlaybackLooped() && !selection()->isRange()) {
showLoop();
return;
}
@ -298,47 +319,55 @@ void PlaybackController::toggleLoopPlayback()
loopOutTick = selection()->range()->endTick().ticks();
}
playback()->addLoopBoundary(LoopBoundaryType::LoopIn, loopInTick);
playback()->addLoopBoundary(LoopBoundaryType::LoopOut, loopOutTick);
m_isPlaybackLooped = true;
addLoopBoundaryToTick(LoopBoundaryType::LoopIn, loopInTick);
addLoopBoundaryToTick(LoopBoundaryType::LoopOut, loopOutTick);
}
void PlaybackController::addLoopBoundary(LoopBoundaryType type)
{
if (!playback()) {
return;
}
if (isPlaying()) {
playback()->addLoopBoundary(type, m_tickPlayed.val);
addLoopBoundaryToTick(type, currentTick());
} else {
playback()->addLoopBoundary(type, INotationPlayback::SelectedNoteTick);
addLoopBoundaryToTick(type, INotationPlayback::SelectedNoteTick);
}
}
void PlaybackController::setLoop(const LoopBoundaries& boundary)
void PlaybackController::addLoopBoundaryToTick(LoopBoundaryType type, int tick)
{
if (boundary.isNull()) {
unsetLoop();
if (playback()) {
playback()->addLoopBoundary(type, tick);
showLoop();
}
}
void PlaybackController::setLoop(const LoopBoundaries& boundaries)
{
if (!boundaries.visible) {
hideLoop();
return;
}
uint64_t fromMilliseconds = secondsToMilliseconds(playback()->tickToSec(boundary.loopInTick));
uint64_t toMilliseconds = secondsToMilliseconds(playback()->tickToSec(boundary.loopOutTick));
uint64_t fromMilliseconds = secondsToMilliseconds(playback()->tickToSec(boundaries.loopInTick));
uint64_t toMilliseconds = secondsToMilliseconds(playback()->tickToSec(boundaries.loopOutTick));
sequencer()->setLoop(fromMilliseconds, toMilliseconds);
showLoop();
m_isPlaybackLooped = true;
notifyActionEnabledChanged(LOOP_CODE);
}
void PlaybackController::unsetLoop()
void PlaybackController::showLoop()
{
if (playback() && m_isPlaybackLooped) {
m_isPlaybackLooped = false;
if (playback()) {
playback()->setLoopBoundariesVisible(true);
}
}
void PlaybackController::hideLoop()
{
if (playback()) {
sequencer()->unsetLoop();
playback()->removeLoopBoundaries();
playback()->setLoopBoundariesVisible(false);
notifyActionEnabledChanged(LOOP_CODE);
}
}
@ -351,7 +380,7 @@ void PlaybackController::notifyActionEnabledChanged(const ActionCode& actionCode
bool PlaybackController::isActionEnabled(const ActionCode& actionCode) const
{
QMap<std::string, bool> isEnabled {
{ LOOP_CODE, m_isPlaybackLooped },
{ LOOP_CODE, isLoopVisible() },
{ MIDI_ON_CODE, notationConfiguration()->isMidiInputEnabled() },
{ REPEAT_CODE, notationConfiguration()->isPlayRepeatsEnabled() },
{ PAN_CODE, notationConfiguration()->isAutomaticallyPanEnabled() },
@ -374,12 +403,12 @@ QTime PlaybackController::totalPlayTime() const
Tempo PlaybackController::currentTempo() const
{
return playback() ? playback()->tempo(m_tickPlayed.val) : Tempo();
return playback() ? playback()->tempo(currentTick()) : Tempo();
}
MeasureBeat PlaybackController::currentBeat() const
{
return playback() ? playback()->beat(m_tickPlayed.val) : MeasureBeat();
return playback() ? playback()->beat(currentTick()) : MeasureBeat();
}
uint64_t PlaybackController::beatToMilliseconds(int measureIndex, int beatIndex) const

View file

@ -69,8 +69,12 @@ private:
notation::INotationPlaybackPtr playback() const;
notation::INotationSelectionPtr selection() const;
int currentTick() const;
bool isPaused() const;
bool isLoopVisible() const;
bool isPlaybackLooped() const;
void onNotationChanged();
void togglePlay();
void rewind(const actions::ActionData& args);
@ -87,8 +91,12 @@ private:
void toggleLoopPlayback();
void addLoopBoundary(notation::LoopBoundaryType type);
void setLoop(const notation::LoopBoundaries& boundary);
void unsetLoop();
void addLoopBoundaryToTick(notation::LoopBoundaryType type, int tick);
void setLoop(const notation::LoopBoundaries& boundaries);
void showLoop();
void hideLoop();
void notifyActionEnabledChanged(const actions::ActionCode& actionCode);
@ -96,11 +104,10 @@ private:
async::Notification m_isPlayAllowedChanged;
async::Notification m_isPlayingChanged;
async::Notification m_playbackPositionChanged;
ValCh<uint32_t> m_tickPlayed;
async::Channel<uint32_t> m_tickPlayed;
async::Channel<actions::ActionCode> m_actionEnabledChanged;
bool m_needRewindBeforePlay = false;
bool m_isPlaybackLooped = false;
};
}

View file

@ -63,7 +63,7 @@ Rectangle {
delegate: FlatButton {
icon: model.icon
hint: model.hint
enabled: model.enabled
iconFont: ui.theme.toolbarIconsFont
normalStateColor: model.checked || playbackSettings.isOpened ? ui.theme.accentColor : "transparent"
@ -82,7 +82,7 @@ Rectangle {
}
}
SeparatorLine { orientation: Qt.Vertical }
SeparatorLine { orientation: Qt.Vertical; visible: !root.floating }
TimeInputField {
id: timeField
@ -105,6 +105,9 @@ Rectangle {
minValue: 1
maxValue: playbackModel.maxMeasureNumber
addLeadingZeros: false
value: playbackModel.measureNumber
onValueEdited: {
@ -124,6 +127,9 @@ Rectangle {
minValue: 1
maxValue: playbackModel.maxBeatNumber
addLeadingZeros: false
value: playbackModel.beatNumber
onValueEdited: {
@ -152,7 +158,7 @@ Rectangle {
font: timeField.font
}
SeparatorLine { orientation: Qt.Vertical }
SeparatorLine { orientation: Qt.Vertical; visible: !root.floating }
}
StyledSlider {

View file

@ -99,16 +99,31 @@ void PlaybackToolBarModel::load()
beginResetModel();
m_items.clear();
ActionList additionalActions;
for (const ActionItem& action : currentWorkspaceActions()) {
if (isAdditionalAction(action.code)) {
additionalActions.push_back(action);
continue;
}
m_items << action;
}
m_items << settingsItem();
for (const ActionItem& action : additionalActions) {
m_items << action;
}
endResetModel();
updateState();
setupConnections();
}
void PlaybackToolBarModel::setupConnections()
{
playbackController()->isPlayAllowedChanged().onNotify(this, [this]() {
updateState();
updatePlayTime();
@ -309,11 +324,13 @@ void PlaybackToolBarModel::handleAction(const QString& actionCode)
void PlaybackToolBarModel::updateState()
{
bool playAllowed = isPlayAllowed();
for (MenuItem& item : m_items) {
item.checked = playbackController()->isActionEnabled(item.code);
item.checked = playAllowed && playbackController()->isActionEnabled(item.code);
}
if (isPlayAllowed()) {
if (playAllowed) {
bool isPlaying = playbackController()->isPlaying();
item("play").iconCode = isPlaying ? IconCode::Code::PAUSE : IconCode::Code::PLAY;
}

View file

@ -98,6 +98,8 @@ private:
IsPlaybackSettingsRole,
};
void setupConnections();
QTime totalPlayTime() const;
uint64_t totalPlayTimeMilliseconds() const;
notation::MeasureBeat measureBeat() const;

View file

@ -209,15 +209,19 @@ void WorkspaceManager::setupCurrentWorkspace()
saveCurrentWorkspace();
std::string workspaceName = configuration()->currentWorkspaceName().val;
WorkspacePtr workspace = findAndInit(workspaceName);
if (!workspace) {
std::string defaultWorkspaceName(DEFAULT_WORKSPACE_NAME);
LOGW() << "failed get workspace: " << workspaceName << ", will use " << defaultWorkspaceName;
workspace = findAndInit(defaultWorkspaceName);
if (workspace) {
configuration()->setCurrentWorkspaceName(defaultWorkspaceName);
}
}
if (workspace) {
if (workspace && workspace != m_currentWorkspace) {
m_currentWorkspace = workspace;
m_currentWorkspaceChanged.send(workspace);
}