diff options
| -rw-r--r-- | src/ui/builtincommandlineoption.cpp | 1 | ||||
| -rw-r--r-- | src/ui/display.cpp | 8 | ||||
| -rw-r--r-- | src/ui/display.h | 1 | ||||
| -rw-r--r-- | src/ui/timeindicator.cpp | 15 | ||||
| -rw-r--r-- | src/ui/timeindicator.h | 9 |
5 files changed, 19 insertions, 15 deletions
diff --git a/src/ui/builtincommandlineoption.cpp b/src/ui/builtincommandlineoption.cpp index 6baeb2429..8a6762897 100644 --- a/src/ui/builtincommandlineoption.cpp +++ b/src/ui/builtincommandlineoption.cpp @@ -82,7 +82,6 @@ void BuiltinCommandLineOption::executeCommand(const QString &option_string, Main else if (option_string == "--stop" || option_string == "-s") { mw->stop(); - mw->mainDisplay()->hideTimeDisplay(); } else if (option_string == "--pause" || option_string == "-u") { diff --git a/src/ui/display.cpp b/src/ui/display.cpp index fc9b2b9bb..d9967b74b 100644 --- a/src/ui/display.cpp +++ b/src/ui/display.cpp @@ -68,7 +68,6 @@ MainDisplay::MainDisplay (QWidget *parent) Button *stop = new Button (this, Skin::BT_STOP_N,Skin::BT_STOP_P); stop->move (85, 88); connect (stop,SIGNAL (clicked()),parent,SLOT (stop())); - connect (stop,SIGNAL (clicked()),this,SLOT (hideTimeDisplay())); Button *next = new Button (this, Skin::BT_NEXT_N,Skin::BT_NEXT_P); next->move (108, 88); connect (next,SIGNAL (clicked()),parent,SLOT (next())); @@ -274,13 +273,6 @@ void MainDisplay::setIsShuffle(bool yes) m_shuffleButton->setON(yes); } - -void MainDisplay::hideTimeDisplay() -{ - m_timeIndicator->setNeedToShowTime(false); -} - - void MainDisplay::mousePressEvent(QMouseEvent *e) { if (e->button() == Qt::RightButton) diff --git a/src/ui/display.h b/src/ui/display.h index 43ee35c5d..d1f12fdc6 100644 --- a/src/ui/display.h +++ b/src/ui/display.h @@ -65,7 +65,6 @@ public: void setIsShuffle(bool); public slots: - void hideTimeDisplay(); void setDuration(qint64); signals: diff --git a/src/ui/timeindicator.cpp b/src/ui/timeindicator.cpp index 111ed2d07..ee979a94d 100644 --- a/src/ui/timeindicator.cpp +++ b/src/ui/timeindicator.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2006 by Ilya Kotov * + * Copyright (C) 2006-2009 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -20,6 +20,7 @@ #include <QPainter> #include <QSettings> #include <QMouseEvent> +#include <QTimer> #include <qmmp/qmmp.h> #include "skin.h" @@ -37,6 +38,10 @@ TimeIndicator::TimeIndicator ( QWidget *parent ) updateSkin(); reset(); connect(m_skin, SIGNAL(skinChanged()), this, SLOT(updateSkin())); + m_timer = new QTimer(this); + m_timer->setInterval(125); + m_timer->setSingleShot (TRUE); + connect(m_timer, SIGNAL(timeout()),SLOT(reset())); } void TimeIndicator::setTime ( int t ) @@ -50,7 +55,7 @@ void TimeIndicator::setTime ( int t ) t = m_songDuration - t; paint.drawPixmap(QPoint(2,0),m_skin->getNumber( 10 )); } - if(t < 0) + if (t < 0) t = 0; paint.drawPixmap(QPoint(13,0),m_skin->getNumber( t/600%10 )); @@ -117,7 +122,11 @@ void TimeIndicator::writeSettings() void TimeIndicator::setNeedToShowTime(bool need) { m_needToShowTime = need; - if (!need) reset(); + //if (!need) reset(); + if (!need) + m_timer->start(); + else + m_timer->stop(); } void TimeIndicator::mouseMoveEvent(QMouseEvent *) diff --git a/src/ui/timeindicator.h b/src/ui/timeindicator.h index 19981a4b3..f5608b21c 100644 --- a/src/ui/timeindicator.h +++ b/src/ui/timeindicator.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2006 by Ilya Kotov * + * Copyright (C) 2006-2009 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -23,6 +23,7 @@ #include <pixmapwidget.h> class QMouseEvent; +class QTimer; class Skin; @@ -42,15 +43,18 @@ public: void setTime ( int t ); void setSongDuration(int); void setNeedToShowTime(bool); + protected: virtual void mousePressEvent(QMouseEvent*); virtual void mouseMoveEvent(QMouseEvent*); virtual void mouseReleaseEvent(QMouseEvent*); void writeSettings(); void readSettings(); - void reset(); + private slots: void updateSkin(); + void reset(); + private: QPixmap m_pixmap; Skin *m_skin; @@ -58,6 +62,7 @@ private: int m_songDuration; bool m_elapsed; bool m_needToShowTime; + QTimer *m_timer; }; #endif |
