|
From: Tapio V. <aa...@us...> - 2011-01-31 13:31:24
|
Module: editor
Branch: master
Commit: 29d26b8c9a2a3466bb1a381fd6a92f645e6f73fd
Author: Tapio Vierros <tap...@gm...>
Date: Mon Jan 31 15:24:22 2011 +0200
Plain text lyrics import now also has line breaks in the new style.
---
notegraphwidget.cc | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index 0211b47..172274b 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -75,21 +75,23 @@ void NoteGraphWidget::setLyrics(QString lyrics)
QTextStream ts(&lyrics, QIODevice::ReadOnly);
clearNotes();
- bool first = true;
+ bool firstNote = true;
while (!ts.atEnd()) {
// We want to loop one line at the time to insert line breaks
+ bool sentenceStart = true;
QString sentence = ts.readLine();
QTextStream ts2(&sentence, QIODevice::ReadOnly);
while (!ts2.atEnd()) {
QString word;
ts2 >> word;
if (!word.isEmpty()) {
- m_notes.push_back(new NoteLabel(Note(word), this, QPoint(0, n2px(24)), QSize(), !first));
+ m_notes.push_back(new NoteLabel(Note(word), this, QPoint(0, n2px(24)), QSize(), !firstNote));
doOperation(opFromNote(*m_notes.back(), m_notes.size()-1), Operation::NO_EXEC);
- first = false;
+ if (sentenceStart) setLineBreak(m_notes.back(), true);
+ firstNote = false;
+ sentenceStart = false;
}
}
- if (!m_notes.isEmpty()) setLineBreak(m_notes.back(), true);
}
finalizeNewLyrics();
|