|
From: Tapio V. <aa...@us...> - 2011-02-24 08:04:46
|
Author: Tapio Vierros <tap...@gm...>
Date: Thu Feb 24 10:03:21 2011 +0200
GettingStarted dialog now highlights some labels for a while.
---
editor.ui | 8 ++++----
editorapp.cc | 31 +++++++++++++++++++++++++++++++
editorapp.hh | 3 ++-
gettingstarted.hh | 8 +++-----
4 files changed, 40 insertions(+), 10 deletions(-)
diff --git a/editor.ui b/editor.ui
index 2267501..8153983 100644
--- a/editor.ui
+++ b/editor.ui
@@ -89,28 +89,28 @@
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
- <widget class="QLabel" name="label_11">
+ <widget class="QLabel" name="lblPlayback">
<property name="text">
<string>Playback</string>
</property>
</widget>
</item>
<item row="0" column="1">
- <widget class="QLabel" name="label_12">
+ <widget class="QLabel" name="lblTiming">
<property name="text">
<string>Timing</string>
</property>
</widget>
</item>
<item row="0" column="2">
- <widget class="QLabel" name="label_3">
+ <widget class="QLabel" name="lblTools">
<property name="text">
<string>Tools</string>
</property>
</widget>
</item>
<item row="0" column="3">
- <widget class="QLabel" name="label_4">
+ <widget class="QLabel" name="lblNoteProperties">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
diff --git a/editorapp.cc b/editorapp.cc
index e7d35b9..ec3d7db 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -11,6 +11,7 @@
#include <QCloseEvent>
#include <QPainter>
#include <QSettings>
+#include <QTimer>
#include <phonon/AudioOutput>
#include <phonon/VideoPlayer>
#include <iostream>
@@ -853,6 +854,36 @@ void EditorApp::on_chkLineBreak_clicked(bool checked)
if (noteGraph) noteGraph->setLineBreak(noteGraph->selectedNote(), checked);
}
+void EditorApp::highlightLabel(QString id)
+{
+ const QString style = "background-color: #f00; font-weight: bold";
+ clearLabelHighlights();
+
+ // Set correct tab
+ if (id == "SONG") ui.tabWidget->setCurrentIndex(1);
+ else ui.tabWidget->setCurrentIndex(0);
+
+ // Color the labels
+ if (id == "TIMING") {
+ ui.lblPlayback->setStyleSheet(style);
+ ui.lblTiming->setStyleSheet(style);
+ } else if (id == "TUNING") {
+ ui.lblTools->setStyleSheet(style);
+ ui.lblNoteProperties->setStyleSheet(style);
+ }
+
+ // Clear highlights after a while
+ QTimer::singleShot(4000, this, SLOT(clearLabelHighlights()));
+}
+
+void EditorApp::clearLabelHighlights()
+{
+ ui.lblPlayback->setStyleSheet("");
+ ui.lblTiming->setStyleSheet("");
+ ui.lblTools->setStyleSheet("");
+ ui.lblNoteProperties->setStyleSheet("");
+}
+
void EditorApp::closeEvent(QCloseEvent *event)
{
if (promptSaving()) event->accept();
diff --git a/editorapp.hh b/editorapp.hh
index 66e273c..1f8437d 100644
--- a/editorapp.hh
+++ b/editorapp.hh
@@ -48,7 +48,7 @@ public:
void updateSongMeta(bool readFromSongToUI = false);
void updateMenuStates();
void updateTitle();
- void showTab(int tab) { ui.tabWidget->setCurrentIndex(tab); }
+ void highlightLabel(QString id);
void showExportMenu() { ui.menuExport->exec(pos() + QPoint(0, ui.menubar->height())); }
private:
@@ -71,6 +71,7 @@ public slots:
void playerStateChanged(Phonon::State newstate, Phonon::State olstate);
void statusBarMessage(const QString& message);
void updatePiano(int y);
+ void clearLabelHighlights();
// Automatic slots
diff --git a/gettingstarted.hh b/gettingstarted.hh
index dd71a9d..7cb7762 100644
--- a/gettingstarted.hh
+++ b/gettingstarted.hh
@@ -39,17 +39,15 @@ public slots:
}
void on_cmdTimeLyrics_clicked(bool) {
- // TODO: Add some coloring to labels or something
- m_editorApp->showTab(0);
+ m_editorApp->highlightLabel("TIMING");
}
void on_cmdFineTuneLyrics_clicked(bool) {
- // TODO: Add some coloring to labels or something
- m_editorApp->showTab(0);
+ m_editorApp->highlightLabel("TUNING");
}
void on_cmdMetadata_clicked(bool) {
- m_editorApp->showTab(1);
+ m_editorApp->highlightLabel("SONG");
}
void on_cmdExport_clicked(bool) {
|