|
From: Tapio V. <aa...@us...> - 2011-01-19 16:42:54
|
Module: editor
Branch: master
Commit: 535176228fd02f6f8728145e5900811823bf1087
Author: Tapio Vierros <tap...@gm...>
Date: Wed Jan 19 18:41:41 2011 +0200
Added playback controls (UI not final).
---
editor.ui | 33 ++++++++++++++++++++++++++++++---
editorapp.cc | 22 +++++++++++++++++++---
editorapp.hh | 3 +++
3 files changed, 52 insertions(+), 6 deletions(-)
diff --git a/editor.ui b/editor.ui
index 3706b5c..43fb2ea 100644
--- a/editor.ui
+++ b/editor.ui
@@ -76,9 +76,6 @@
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
- <property name="currentIndex">
- <number>1</number>
- </property>
<widget class="QWidget" name="tabNote">
<attribute name="title">
<string>&Note properties</string>
@@ -318,6 +315,36 @@
</item>
</layout>
</widget>
+ <widget class="QWidget" name="tabTools">
+ <attribute name="title">
+ <string>&Tools</string>
+ </attribute>
+ <layout class="QGridLayout" name="gridLayout_6">
+ <item row="0" column="0">
+ <widget class="QPushButton" name="cmdPlay">
+ <property name="toolTip">
+ <string>Start playing the music file.</string>
+ </property>
+ <property name="text">
+ <string>Play</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QPushButton" name="cmdStop">
+ <property name="toolTip">
+ <string>Stop the music.</string>
+ </property>
+ <property name="text">
+ <string>Stop</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
</widget>
</item>
</layout>
diff --git a/editorapp.cc b/editorapp.cc
index 512bc2c..b41b60c 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -357,9 +357,6 @@ void EditorApp::on_actionMusicFile_triggered()
ui.tabWidget->setCurrentIndex(1); // Switch to song properties tab
// Metadata is updated when it becomes available (signal)
player->setCurrentSource(Phonon::MediaSource(QUrl::fromLocalFile(fileName)));
- // FIXME: Temporary test
- audioOutput->setVolume(50);
- player->play();
// Fire up analyzer
noteGraph->analyzeMusic(fileName);
}
@@ -463,6 +460,25 @@ void EditorApp::audioTick(qint64 time)
if (noteGraph) noteGraph->updateMusicPos(time);
}
+void EditorApp::on_cmdPlay_toggled(bool checked)
+{
+ if (player) {
+ if (checked) {
+ player->play();
+ ui.cmdPlay->setText(tr("Playing..."));
+ } else {
+ player->pause();
+ ui.cmdPlay->setText(tr("Play"));
+ }
+ }
+}
+
+void EditorApp::on_cmdStop_clicked()
+{
+ if (player) player->stop();
+ if (noteGraph) noteGraph->updateMusicPos(0);
+ ui.cmdPlay->setChecked(false);
+}
void EditorApp::on_txtTitle_editingFinished() { updateSongMeta(); }
void EditorApp::on_txtArtist_editingFinished() { updateSongMeta(); }
diff --git a/editorapp.hh b/editorapp.hh
index 9e64861..276030f 100644
--- a/editorapp.hh
+++ b/editorapp.hh
@@ -34,6 +34,9 @@ public slots:
// Automatic slots
+ void on_cmdPlay_toggled(bool checked);
+ void on_cmdStop_clicked();
+
// File menu
void on_actionNew_triggered();
void on_actionOpen_triggered();
|