File indexing completed on 2024-05-05 04:49:28

0001 /****************************************************************************************
0002  * Copyright (c) 2007 Dan Meltzer <parallelgrapefruit@gmail.com>                        *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 #ifndef AMAROK_PROGRESSWIDGET_H
0018 #define AMAROK_PROGRESSWIDGET_H
0019 
0020 #include "core/meta/forward_declarations.h"
0021 
0022 #include <phonon/Global>
0023 
0024 #include <QHash>
0025 #include <QPainter>
0026 #include <QPolygon>
0027 #include <QWidget>
0028 
0029 class TimeLabel;
0030 namespace Amarok { class TimeSlider; }
0031 
0032 class ProgressWidget : public QWidget
0033 {
0034     Q_OBJECT
0035 
0036     public:
0037         explicit ProgressWidget( QWidget* );
0038 
0039         QSize sizeHint() const override;
0040         void addBookmark( const QString &name, int milliSeconds , bool instantDisplayPopUp );
0041         Amarok::TimeSlider* slider() const { return m_slider; }
0042 
0043     public Q_SLOTS:
0044         void drawTimeDisplay( int position );
0045 
0046     protected Q_SLOTS:
0047         void stopped();
0048         void paused();
0049         void trackPlaying();
0050         void trackLengthChanged( qint64 milliseconds );
0051         void trackPositionChanged( qint64 position );
0052 
0053     protected:
0054         void mousePressEvent( QMouseEvent * ) override;
0055 
0056     private Q_SLOTS:
0057         void addBookmarkNoPopup( const QString &name, int milliSeconds );
0058         void redrawBookmarks(const QString *BookmarkName = nullptr);
0059 
0060     private:
0061         void updateTimeLabelTooltips();
0062 
0063         TimeLabel *m_timeLabelLeft;
0064         TimeLabel *m_timeLabelRight;
0065         Amarok::TimeSlider *m_slider;
0066         QString m_currentUrlId;
0067 };
0068 
0069 #endif
0070