|
From: Tapio V. <aa...@us...> - 2011-01-25 13:59:54
|
Module: editor
Branch: master
Commit: a5df16ecc749657c2c4d9333a68f4c9f4630806e
Author: Tapio Vierros <tap...@gm...>
Date: Tue Jan 25 15:59:20 2011 +0200
Make it possible to set line breaks from the UI.
---
editor.ui | 10 ++++++++++
editorapp.cc | 16 +++++++++++++++-
editorapp.hh | 1 +
notegraphwidget.cc | 2 ++
4 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/editor.ui b/editor.ui
index 123ea52..310931e 100644
--- a/editor.ui
+++ b/editor.ui
@@ -217,6 +217,16 @@
</property>
</spacer>
</item>
+ <item row="2" column="5">
+ <widget class="QCheckBox" name="chkLineBreak">
+ <property name="layoutDirection">
+ <enum>Qt::RightToLeft</enum>
+ </property>
+ <property name="text">
+ <string>Line break after this</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<widget class="QWidget" name="tabSong">
diff --git a/editorapp.cc b/editorapp.cc
index 2a817a7..d51f23c 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -150,6 +150,8 @@ void EditorApp::updateNoteInfo(NoteLabel *note)
ui.cmbNoteType->setCurrentIndex(note->note().getTypeInt());
ui.chkFloating->setEnabled(true);
ui.chkFloating->setChecked(note->isFloating());
+ ui.chkLineBreak->setEnabled(true);
+ ui.chkLineBreak->setChecked(note->note().lineBreak);
} else {
ui.valNoteBegin->setText("-");
ui.valNoteEnd->setText("-");
@@ -157,6 +159,7 @@ void EditorApp::updateNoteInfo(NoteLabel *note)
ui.valNote->setText("-");
ui.cmbNoteType->setEnabled(false);
ui.chkFloating->setEnabled(false);
+ ui.chkLineBreak->setEnabled(false);
}
}
@@ -557,7 +560,18 @@ void EditorApp::on_chkFloating_stateChanged(int state)
if (noteGraph->selectedNote() && noteGraph->selectedNote()->isFloating() != floating) {
noteGraph->selectedNote()->setFloating(floating);
Operation op("FLOATING");
- op << noteGraph->getNoteLabelId(noteGraph->selectedNote()) << (floating);
+ op << noteGraph->getNoteLabelId(noteGraph->selectedNote()) << floating;
+ operationDone(op);
+ }
+}
+
+void EditorApp::on_chkLineBreak_stateChanged(int state)
+{
+ bool linebreak = (state != 0);
+ if (noteGraph->selectedNote() && noteGraph->selectedNote()->note().lineBreak != linebreak) {
+ noteGraph->selectedNote()->note().lineBreak = linebreak;
+ Operation op("LINEBREAK");
+ op << noteGraph->getNoteLabelId(noteGraph->selectedNote()) << linebreak;
operationDone(op);
}
}
diff --git a/editorapp.hh b/editorapp.hh
index d516ab9..bbbff64 100644
--- a/editorapp.hh
+++ b/editorapp.hh
@@ -73,6 +73,7 @@ public slots:
void on_txtYear_editingFinished();
void on_cmbNoteType_currentIndexChanged(int);
void on_chkFloating_stateChanged(int);
+ void on_chkLineBreak_stateChanged(int);
protected:
void closeEvent(QCloseEvent *event);
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 73c4c2e..6950fd1 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -506,6 +506,8 @@ void NoteGraphWidget::doOperation(const Operation& op, Operation::OperationFlags
n->setFloating(false);
} else if (action == "FLOATING") {
n->setFloating(op.b(2));
+ } else if (action == "LINEBREAK") {
+ n->note().lineBreak = op.b(2);
} else if (action == "LYRIC") {
n->setLyric(op.s(2));
} else if (action == "TYPE") {
|