|
From: Tapio V. <aa...@us...> - 2011-01-11 09:13:41
|
Module: editor
Branch: master
Commit: 78e611be9255d09a1a843b342505467214fd1947
Author: Tapio Vierros <tap...@gm...>
Date: Tue Jan 11 10:49:10 2011 +0200
NoteLabel now inherits Note and setting note type is possible.
---
editorapp.cc | 11 ++++++++++-
editorapp.hh | 1 +
notelabel.hh | 3 ++-
notes.hh | 3 +--
4 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/editorapp.cc b/editorapp.cc
index 24e6ffb..b0ac4c2 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -39,6 +39,7 @@ void EditorApp::updateNoteInfo(NoteLabel *note)
ui.valNoteDuration->setText(QString::number(note->width()));
ui.valNote->setText(QString::number(note->y() / NoteGraphWidget::noteYStep));
ui.cmbNoteType->setEnabled(true);
+ ui.cmbNoteType->setCurrentIndex(note->type);
ui.chkFloating->setEnabled(true);
ui.chkFloating->setChecked(note->isFloating());
} else {
@@ -143,7 +144,8 @@ void EditorApp::on_actionLyricsFromClipboard_triggered()
}
}
-void EditorApp::on_actionWhatsThis_triggered() {
+void EditorApp::on_actionWhatsThis_triggered()
+{
QWhatsThis::enterWhatsThisMode ();
}
@@ -154,6 +156,13 @@ void EditorApp::on_actionAbout_triggered()
);
}
+
+void EditorApp::on_cmbNoteType_currentIndexChanged(int index)
+{
+ if (ui.noteGraph->selectedNote())
+ ui.noteGraph->selectedNote()->type = Note::Type(index);
+}
+
void EditorApp::on_chkFloating_stateChanged(int state)
{
if (ui.noteGraph->selectedNote())
diff --git a/editorapp.hh b/editorapp.hh
index 7992b31..30009d7 100644
--- a/editorapp.hh
+++ b/editorapp.hh
@@ -30,6 +30,7 @@ public slots:
void on_actionAbout_triggered();
// Note properties tab
+ void on_cmbNoteType_currentIndexChanged(int);
void on_chkFloating_stateChanged(int);
private:
diff --git a/notelabel.hh b/notelabel.hh
index 43e5e48..a30aeb8 100644
--- a/notelabel.hh
+++ b/notelabel.hh
@@ -1,8 +1,9 @@
#pragma once
#include <QLabel>
+#include "notes.hh"
-class NoteLabel: public QLabel
+class NoteLabel: public QLabel, public Note
{
public:
static const int resize_margin;
diff --git a/notes.hh b/notes.hh
index 6830b56..daca52f 100644
--- a/notes.hh
+++ b/notes.hh
@@ -51,8 +51,7 @@ struct Note {
Duration duration; ///< note begin/end
double phase; ///< position within a measure, [0, 1)
/// note type
- enum Type { FREESTYLE = 'F', NORMAL = ':', GOLDEN = '*', SLIDE = '+', SLEEP = '-',
- TAP = '1', HOLDBEGIN = '2', HOLDEND = '3', ROLL = '4', MINE = 'M', LIFT = 'L'} type;
+ enum Type { NORMAL = 0, GOLDEN = 1, FREESTYLE = 2 } type;
int note; ///< MIDI pitch of the note (at the end for slide notes)
int notePrev; ///< MIDI pitch of the previous note (should be same as note for everything but SLIDE)
std::string syllable; ///< lyrics syllable for that note
|