diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2008-03-18 11:47:14 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2008-03-18 11:47:14 +0000 |
| commit | 6925380098f9de4841534db7e8285ba0c18c2ca2 (patch) | |
| tree | a29374713c232d31b49afead88707f924e8c9f76 /src | |
| parent | 625b2712c1c9fa46ba43684a24a477aa60d88089 (diff) | |
| download | qmmp-6925380098f9de4841534db7e8285ba0c18c2ca2.tar.gz qmmp-6925380098f9de4841534db7e8285ba0c18c2ca2.tar.bz2 qmmp-6925380098f9de4841534db7e8285ba0c18c2ca2.zip | |
make seek and time accessible by general plugins
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@278 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src')
| -rw-r--r-- | src/qmmpui/control.cpp | 5 | ||||
| -rw-r--r-- | src/qmmpui/control.h | 2 | ||||
| -rw-r--r-- | src/qmmpui/general.cpp | 3 | ||||
| -rw-r--r-- | src/qmmpui/general.h | 1 | ||||
| -rw-r--r-- | src/qmmpui/generalhandler.cpp | 18 | ||||
| -rw-r--r-- | src/qmmpui/generalhandler.h | 4 | ||||
| -rw-r--r-- | src/ui/mainwindow.cpp | 2 |
7 files changed, 35 insertions, 0 deletions
diff --git a/src/qmmpui/control.cpp b/src/qmmpui/control.cpp index 4b734f824..161d23a6c 100644 --- a/src/qmmpui/control.cpp +++ b/src/qmmpui/control.cpp @@ -54,6 +54,11 @@ void Control::previous() emit commandCalled(Previous); } +void Control::seek(int pos) +{ + emit seekCalled(pos); +} + void Control::exit() { emit commandCalled(Exit); diff --git a/src/qmmpui/control.h b/src/qmmpui/control.h index 3ac856327..14171c84e 100644 --- a/src/qmmpui/control.h +++ b/src/qmmpui/control.h @@ -46,6 +46,7 @@ public: signals: void commandCalled(uint command); + void seekCalled(int pos); void volumeChanged(int left, int right); public slots: @@ -54,6 +55,7 @@ public slots: void stop(); void next(); void previous(); + void seek(int pos); void exit(); void toggleVisibility(); void setVolume(int left, int right); diff --git a/src/qmmpui/general.cpp b/src/qmmpui/general.cpp index a9791731b..e072344a0 100644 --- a/src/qmmpui/general.cpp +++ b/src/qmmpui/general.cpp @@ -77,6 +77,9 @@ void General::setState(const uint&) void General::setSongInfo(const SongInfo &song) {} +void General::setTime(int) +{} + QList<GeneralFactory*> *General::generalFactories() { diff --git a/src/qmmpui/general.h b/src/qmmpui/general.h index 8c26866ec..f35686903 100644 --- a/src/qmmpui/general.h +++ b/src/qmmpui/general.h @@ -50,6 +50,7 @@ public: virtual void setState(const uint &state); virtual void setSongInfo(const SongInfo &song); virtual void setVolume(int left, int right); + virtual void setTime(int time); //static methods static QList<GeneralFactory*> *generalFactories(); diff --git a/src/qmmpui/generalhandler.cpp b/src/qmmpui/generalhandler.cpp index a70068a02..54e5a8652 100644 --- a/src/qmmpui/generalhandler.cpp +++ b/src/qmmpui/generalhandler.cpp @@ -33,10 +33,12 @@ GeneralHandler::GeneralHandler(QObject *parent) m_instance = this; m_left = 0; m_right = 0; + m_time = 0; m_state = General::Stopped; GeneralFactory* factory; m_control = new Control(this); connect(m_control, SIGNAL(commandCalled(uint)), SLOT(processCommand(uint))); + connect(m_control, SIGNAL(seekCalled(int)), SIGNAL(seekCalled(int))); connect(m_control, SIGNAL(volumeChanged(int, int)), SIGNAL(volumeChanged(int, int))); foreach(factory, *General::generalFactories()) { @@ -58,7 +60,10 @@ void GeneralHandler::setState(uint state) m_state = state; General *general; if (state == General::Stopped) + { m_songInfo.clear(); + m_time = 0; + } foreach(general, m_generals.values()) { @@ -92,6 +97,18 @@ void GeneralHandler::setVolume(int left, int right) } } +void GeneralHandler::setTime(int time) +{ + if(m_time == time) + return; + m_time = time; + General *general; + foreach(general, m_generals.values()) + { + general->setTime(time); + } +} + void GeneralHandler::setEnabled(GeneralFactory* factory, bool enable) { if (enable == m_generals.keys().contains(factory)) @@ -105,6 +122,7 @@ void GeneralHandler::setEnabled(GeneralFactory* factory, bool enable) { general->setState(m_state); general->setSongInfo(m_songInfo); + general->setTime(m_time); } } else diff --git a/src/qmmpui/generalhandler.h b/src/qmmpui/generalhandler.h index 7af0f8171..0fb57c0de 100644 --- a/src/qmmpui/generalhandler.h +++ b/src/qmmpui/generalhandler.h @@ -41,6 +41,8 @@ public: void setSongInfo(const SongInfo &info); void setVolume(int left, int right); + void setTime(int time); + void setEnabled(GeneralFactory* factory, bool enable); void showSettings(GeneralFactory* factory, QWidget* parentWidget); bool visibilityControl(); @@ -52,6 +54,7 @@ signals: void stopCalled(); void nextCalled(); void previousCalled(); + void seekCalled(int); void exitCalled(); void toggleVisibilityCalled(); void volumeChanged(int left, int right); @@ -67,6 +70,7 @@ private: QMap <GeneralFactory*, General*> m_generals; SongInfo m_songInfo; Control* m_control; + int m_time; uint m_state; int m_left, m_right; static GeneralHandler* m_instance; diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 46bf23c65..64996785e 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -146,6 +146,7 @@ MainWindow::MainWindow(const QStringList& args,CommandLineOptionManager* option_ connect(m_generalHandler, SIGNAL(previousCalled()), SLOT(previous())); connect(m_generalHandler, SIGNAL(stopCalled()), SLOT(stop())); connect(m_generalHandler, SIGNAL(pauseCalled()), SLOT(pause())); + connect(m_generalHandler, SIGNAL(seekCalled(int)), SLOT(seek(int))); connect(m_generalHandler, SIGNAL(toggleVisibilityCalled()), SLOT(toggleVisibility())); connect(m_generalHandler, SIGNAL(exitCalled()), SLOT(close())); connect(m_generalHandler, SIGNAL(volumeChanged(int, int)), @@ -324,6 +325,7 @@ void MainWindow::showOutputState(const OutputState &st) case OutputState::Playing: { m_generalHandler->setState(General::Playing); + m_generalHandler->setTime(st.elapsedSeconds()); if (m_playListModel->currentItem()) { SongInfo info; |
