diff options
| author | vovanec <vovanec@90c681e8-e032-0410-971d-27865f9a5e38> | 2007-07-29 09:19:41 +0000 |
|---|---|---|
| committer | vovanec <vovanec@90c681e8-e032-0410-971d-27865f9a5e38> | 2007-07-29 09:19:41 +0000 |
| commit | 080507d3a2bc4c1679d1a2cd639e532fb4adbd31 (patch) | |
| tree | 7ac58e4cea61a0f836c326af448eaaa334ecb54e | |
| parent | 8a503d69ecb35d2e9c95885e4d1247011d788442 (diff) | |
| download | qmmp-080507d3a2bc4c1679d1a2cd639e532fb4adbd31.tar.gz qmmp-080507d3a2bc4c1679d1a2cd639e532fb4adbd31.tar.bz2 qmmp-080507d3a2bc4c1679d1a2cd639e532fb4adbd31.zip | |
added song position navigation, context menu over main display
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@45 90c681e8-e032-0410-971d-27865f9a5e38
| -rw-r--r-- | ChangeLog | 2 | ||||
| -rw-r--r-- | src/display.cpp | 14 | ||||
| -rw-r--r-- | src/display.h | 2 | ||||
| -rw-r--r-- | src/filedialog.cpp | 6 | ||||
| -rw-r--r-- | src/mainwindow.cpp | 73 | ||||
| -rw-r--r-- | src/mainwindow.h | 6 | ||||
| -rw-r--r-- | src/playlistmodel.cpp | 1 | ||||
| -rw-r--r-- | src/positionbar.h | 1 | ||||
| -rw-r--r-- | src/timeindicator.cpp | 5 | ||||
| -rw-r--r-- | src/titlebar.cpp | 6 | ||||
| -rw-r--r-- | src/titlebar.h | 1 | ||||
| -rw-r--r-- | src/version.h | 4 |
12 files changed, 92 insertions, 29 deletions
@@ -102,3 +102,5 @@ Version 0.1.3 * added Shift+N hotkey for all windows * set using UTF-8 by default in mad plugin * fixed russian translation in the flac plugin +* added current song position navigation with Left/Right cursor buttons +* added main menu popup on main display diff --git a/src/display.cpp b/src/display.cpp index f401d2f54..11e4d71fa 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -22,6 +22,7 @@ #include <QPushButton> #include <QLabel> #include <QSettings> +#include <QMenu> #include <output.h> #include "skin.h" @@ -157,6 +158,7 @@ void MainDisplay::setMaxTime ( long mt ) // TODO: should be removed m_timeIndicator->setSongDuration(mt); } + void MainDisplay::updateSkin() { setPixmap ( m_skin->getMain() ); @@ -273,3 +275,15 @@ void MainDisplay::hideTimeDisplay() m_timeIndicator->setNeedToShowTime(false); } + + +void MainDisplay::mousePressEvent(QMouseEvent *e) +{ + if( e->button() == Qt::RightButton) + { + m_mw->menu()->exec(e->globalPos()); + } + PixmapWidget::mousePressEvent(e); +} + + diff --git a/src/display.h b/src/display.h index 7ab2074bc..15e0111d6 100644 --- a/src/display.h +++ b/src/display.h @@ -24,6 +24,7 @@ class TimeIndicator; + #include "pixmapwidget.h" /** @@ -73,6 +74,7 @@ signals: void shuffleToggled(bool); protected: void wheelEvent(QWheelEvent *); + void mousePressEvent(QMouseEvent*); private slots: void updateSkin(); diff --git a/src/filedialog.cpp b/src/filedialog.cpp index 744f4726b..4c5d87663 100644 --- a/src/filedialog.cpp +++ b/src/filedialog.cpp @@ -28,6 +28,7 @@ bool FileDialog::isModal() void FileDialog::init(QObject* o) { + qWarning("void FileDialog::init(QObject* o)"); if(!m_initialized && !instance()->modal()) { PlayListModel* model = NULL; @@ -200,9 +201,9 @@ FileDialog* FileDialog::instance() if(!_instance) _instance = factories[QtFileDialogFactory::QtFileDialogFactoryName]->create(); } - else if(!_instance->modal()) + //else if(!_instance->modal()) //return _instance; - _instance->raise(); + // _instance->raise(); return _instance; @@ -240,6 +241,7 @@ QStringList FileDialog::registeredFactories() void FileDialog::popup(QObject* o,const QString& d,Mode m,const QStringList& f) { + qWarning("void FileDialog::popup(QObject* o,const QString& d,Mode m,const QStringList& f)"); instance()->init(o); instance()->raise(d,m,f); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b6243fb71..3abcdbfe1 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -45,6 +45,8 @@ #include <addurldialog.h> #include "filedialog.h" +#define KEY_OFFSET 10 + MainWindow::MainWindow(const QStringList& args, QWidget *parent) : QMainWindow(parent) { @@ -52,6 +54,7 @@ MainWindow::MainWindow(const QStringList& args, QWidget *parent) seeking = FALSE; m_update = FALSE; m_paused = FALSE; + m_elapsed = 0; setWindowIcon( QIcon(":/qmmp.xpm") ); @@ -212,7 +215,19 @@ void MainWindow::replay() void MainWindow::seek(int pos) { - m_core->seek(pos); + if(!seeking) + m_core->seek(pos); +} + + +void MainWindow::forward() +{ + seek(m_elapsed + KEY_OFFSET); +} + +void MainWindow::backward() +{ + seek(m_elapsed - KEY_OFFSET); } void MainWindow::setVolume(int volume, int balance) @@ -247,6 +262,7 @@ void MainWindow::next() if (m_core->isInitialized()) { stop(); + m_elapsed = 0; play(); } else @@ -295,27 +311,31 @@ void MainWindow::showOutputState(const OutputState &st) m_playlist->setInfo(st, m_core->length(), m_playListModel->totalLength()); switch ((int) st.type()) { - case OutputState::Playing: - { - m_tray->setIcon ( QIcon(":/play.png") ); - if (m_showMessage && m_playListModel->currentItem()) - m_tray->showMessage ( tr("Now Playing"), - m_playListModel->currentItem()->title(), - QSystemTrayIcon::Information, m_messageDelay ); - if (m_showToolTip && m_playListModel->currentItem()) - m_tray->setToolTip (m_playListModel->currentItem()->title()); - break; - } - case OutputState::Paused: - { - m_tray->setIcon ( QIcon(":/pause.png") ); - break; - } - case OutputState::Stopped: - { - m_tray->setIcon ( QIcon(":/stop.png") ); - break; - } + case OutputState::Playing: + { + m_tray->setIcon ( QIcon(":/play.png") ); + if (m_showMessage && m_playListModel->currentItem()) + m_tray->showMessage ( tr("Now Playing"), + m_playListModel->currentItem()->title(), + QSystemTrayIcon::Information, m_messageDelay ); + if (m_showToolTip && m_playListModel->currentItem()) + m_tray->setToolTip (m_playListModel->currentItem()->title()); + break; + } + case OutputState::Paused: + { + m_tray->setIcon ( QIcon(":/pause.png") ); + break; + } + case OutputState::Stopped: + { + m_tray->setIcon ( QIcon(":/stop.png") ); + break; + } + case OutputState::Info: + { + m_elapsed = st.elapsedSeconds(); + } } } @@ -556,6 +576,15 @@ void MainWindow::createActions() Dock::getPointer()->addActions(m_mainMenu->actions()); m_mainMenu->addSeparator(); m_mainMenu->addAction(tr("&Exit"),this, SLOT(close ()), tr("Ctrl+Q")); + + QAction* forward = new QAction(this); + forward->setShortcut(QKeySequence(Qt::Key_Right)); + connect(forward,SIGNAL(triggered(bool)),this,SLOT(forward())); + QAction* backward = new QAction(this); + backward->setShortcut(QKeySequence(Qt::Key_Left)); + connect(backward,SIGNAL(triggered(bool)),this,SLOT(backward())); + + Dock::getPointer()->addActions( QList<QAction*>() << forward << backward ); Dock::getPointer()->addActions(m_mainMenu->actions()); } diff --git a/src/mainwindow.h b/src/mainwindow.h index cece1afcf..d121fc1d1 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -98,6 +98,9 @@ private slots: void updateEQ(); void updatePreset(); void updateSkin(); + + void forward(); + void backward(); void jumpToFile(); @@ -132,7 +135,8 @@ private: Skin *m_skin; QString m_playlistName; JumpToTrackDialog* m_jumpDialog; - bool m_hide_on_titlebar_close; + bool m_hide_on_titlebar_close; + int m_elapsed; }; #endif diff --git a/src/playlistmodel.cpp b/src/playlistmodel.cpp index 06915daf1..092168dd3 100644 --- a/src/playlistmodel.cpp +++ b/src/playlistmodel.cpp @@ -363,6 +363,7 @@ void PlayListModel::addDirectory(const QString& s) void PlayListModel::addFileList(const QStringList &l) { + qWarning("void PlayListModel::addFileList(const QStringList &l)"); foreach(QString str,l) { QFileInfo f_info(str); diff --git a/src/positionbar.h b/src/positionbar.h index 7bb822f6e..ea03ef14a 100644 --- a/src/positionbar.h +++ b/src/positionbar.h @@ -42,6 +42,7 @@ public: public slots: void setValue(int); + int value()const{return m_value;} void setMax(int); signals: diff --git a/src/timeindicator.cpp b/src/timeindicator.cpp index 3e2b04ee0..d90d03b13 100644 --- a/src/timeindicator.cpp +++ b/src/timeindicator.cpp @@ -19,6 +19,7 @@ ***************************************************************************/ #include <QPainter> #include <QSettings> +#include <QMouseEvent> #include "skin.h" #include "timeindicator.h" @@ -68,12 +69,12 @@ void TimeIndicator::reset() void TimeIndicator::mousePressEvent(QMouseEvent* e ) { - if (m_needToShowTime) + if (m_needToShowTime && e->button() & Qt::LeftButton) { m_elapsed = m_elapsed ? false : true; setTime(m_time); - PixmapWidget::mousePressEvent(e); } + PixmapWidget::mousePressEvent(e); } void TimeIndicator::setSongDuration(int d) diff --git a/src/titlebar.cpp b/src/titlebar.cpp index db9b272fc..dad38a54c 100644 --- a/src/titlebar.cpp +++ b/src/titlebar.cpp @@ -36,6 +36,7 @@ TitleBar::TitleBar(QWidget *parent) mw = qobject_cast<MainWindow*>(parent); //buttons menu = new Button(this,Skin::BT_MENU_N,Skin::BT_MENU_P); + connect(menu,SIGNAL(clicked()),this,SLOT(showMainMenu())); menu->move(6,3); minimize = new Button(this,Skin::BT_MINIMIZE_N,Skin::BT_MINIMIZE_P); minimize->move(244,3); @@ -109,3 +110,8 @@ void TitleBar::updateSkin() { setActive(FALSE); } + +void TitleBar::showMainMenu() +{ + mw->menu()->exec(menu->mapToGlobal(menu->pos())); +} diff --git a/src/titlebar.h b/src/titlebar.h index 7b8874f17..44c1e51f0 100644 --- a/src/titlebar.h +++ b/src/titlebar.h @@ -48,6 +48,7 @@ public: private slots: void updateSkin(); + void showMainMenu(); private: Skin *skin; diff --git a/src/version.h b/src/version.h index 8d6fabe5b..0d621bacf 100644 --- a/src/version.h +++ b/src/version.h @@ -1,9 +1,9 @@ #ifndef _QMMP_VERSION_H #define _QMMP_VERSION_H -#define QMMP_VERSION 0.1.2 +#define QMMP_VERSION 0.2.0 -#define QMMP_STR_VERSION "0.1.2" +#define QMMP_STR_VERSION "0.2.0" #define TCPSERVER_PORT_NUMBER 33000 |
