|
From: Tapio V. <aa...@us...> - 2011-02-01 13:27:44
|
Module: editor
Branch: master
Commit: 842d5dcddadb17444fad3db63baa728d011b51ee
Author: Tapio Vierros <tap...@gm...>
Date: Tue Feb 1 15:27:05 2011 +0200
Display current sentence (or what's left of it) in the Tools tab.
---
editor.ui | 9 ++++++++-
editorapp.cc | 2 ++
notegraphwidget.cc | 14 ++++++++++++++
notegraphwidget.hh | 1 +
4 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/editor.ui b/editor.ui
index 3d29af1..040d86a 100644
--- a/editor.ui
+++ b/editor.ui
@@ -393,7 +393,7 @@
</property>
</widget>
</item>
- <item row="3" column="0">
+ <item row="4" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -406,6 +406,13 @@
</property>
</spacer>
</item>
+ <item row="3" column="0" colspan="2">
+ <widget class="QLabel" name="lblCurrentSentence">
+ <property name="text">
+ <string>Current sentence:</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<widget class="QWidget" name="tabLyrics">
diff --git a/editorapp.cc b/editorapp.cc
index eb40d35..3811cff 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -159,6 +159,7 @@ void EditorApp::updateNoteInfo(NoteLabel *note)
ui.chkFloating->setChecked(note->isFloating());
ui.chkLineBreak->setEnabled(true);
ui.chkLineBreak->setChecked(note->note().lineBreak);
+ ui.lblCurrentSentence->setText(tr("Current sentence:") + " <b>" + noteGraph->getCurrentSentence() + "</b>");
} else {
ui.valNoteBegin->setText("-");
ui.valNoteEnd->setText("-");
@@ -167,6 +168,7 @@ void EditorApp::updateNoteInfo(NoteLabel *note)
ui.cmbNoteType->setEnabled(false);
ui.chkFloating->setEnabled(false);
ui.chkLineBreak->setEnabled(false);
+ ui.lblCurrentSentence->setText(tr("Current sentence:") + " -");
}
}
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index dcdf47f..2c91c0a 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -615,6 +615,20 @@ VocalTrack NoteGraphWidget::getVocalTrack() const
return track;
}
+QString NoteGraphWidget::getCurrentSentence() const
+{
+ QString lyrics;
+ if (!m_notes.isEmpty() && m_selectedNote) {
+ int id = getNoteLabelId(m_selectedNote);
+ for (int i = id; i < m_notes.size(); ++i) {
+ if (i != id && m_notes[i]->note().lineBreak) break;
+ lyrics += m_notes[i]->lyric() + " ";
+ }
+ lyrics = lyrics.left(lyrics.size() - 1);
+ }
+ return lyrics;
+}
+
QString NoteGraphWidget::dumpLyrics() const
{
QString lyrics;
diff --git a/notegraphwidget.hh b/notegraphwidget.hh
index 7ef5ba5..56e5851 100644
--- a/notegraphwidget.hh
+++ b/notegraphwidget.hh
@@ -62,6 +62,7 @@ public:
int h() const { return m_pitch->height; }
VocalTrack getVocalTrack() const;
+ QString getCurrentSentence() const;
QString dumpLyrics() const;
public slots:
|