Changeset View
Changeset View
Standalone View
Standalone View
statuslabel.h
Show All 11 Lines | |||||
12 | * | 12 | * | ||
13 | * You should have received a copy of the GNU General Public License along with | 13 | * You should have received a copy of the GNU General Public License along with | ||
14 | * this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | 15 | */ | ||
16 | 16 | | |||
17 | #ifndef JUK_STATUSLABEL_H | 17 | #ifndef JUK_STATUSLABEL_H | ||
18 | #define JUK_STATUSLABEL_H | 18 | #define JUK_STATUSLABEL_H | ||
19 | 19 | | |||
20 | #include <QStatusBar> | ||||
20 | #include <QWidget> | 21 | #include <QWidget> | ||
21 | 22 | | |||
22 | class KSqueezedTextLabel; | 23 | class KSqueezedTextLabel; | ||
23 | 24 | | |||
24 | class QEvent; | 25 | class QEvent; | ||
25 | class QLabel; | 26 | class QLabel; | ||
26 | 27 | | |||
27 | class FileHandle; | 28 | class FileHandle; | ||
28 | class PlaylistInterface; | 29 | class PlaylistInterface; | ||
29 | 30 | | |||
30 | class StatusLabel : public QWidget | 31 | class StatusLabel : public QWidget | ||
31 | { | 32 | { | ||
32 | Q_OBJECT | 33 | Q_OBJECT | ||
33 | 34 | | |||
34 | public: | 35 | public: | ||
35 | explicit StatusLabel(const PlaylistInterface ¤tPlaylist, QWidget *parent = nullptr); | 36 | explicit StatusLabel(const PlaylistInterface ¤tPlaylist, QStatusBar *parent = nullptr); | ||
36 | 37 | | |||
37 | public slots: | 38 | public slots: | ||
38 | void slotPlayingItemHasChanged(const FileHandle &file); | 39 | void slotPlayingItemHasChanged(const FileHandle &file); | ||
39 | void slotCurrentPlaylistHasChanged(const PlaylistInterface ¤tPlaylist); | 40 | void slotCurrentPlaylistHasChanged(const PlaylistInterface ¤tPlaylist); | ||
40 | 41 | | |||
41 | /** | 42 | /** | ||
42 | * This just sets internal variables that are used by updateTime(). | 43 | * This just sets internal variables that are used by updateTime(). | ||
43 | * Please call that method to display the time. | 44 | * Please call that method to display the time. | ||
44 | */ | 45 | */ | ||
45 | void setItemTotalTime(qint64 time_msec) { m_itemTotalTime = time_msec; } | 46 | void setItemTotalTime(qint64 time_msec) { m_itemTotalTime = time_msec; } | ||
46 | void setItemCurrentTime(qint64 time_msec) { m_itemCurrentTime = time_msec; updateTime(); } | 47 | void setItemCurrentTime(qint64 time_msec) { m_itemCurrentTime = time_msec; updateTime(); } | ||
47 | 48 | | |||
48 | private: | 49 | private: | ||
49 | void updateTime(); | 50 | void updateTime(); | ||
50 | virtual bool eventFilter(QObject *o, QEvent *e); | 51 | virtual bool eventFilter(QObject *o, QEvent *e); | ||
51 | 52 | | |||
52 | KSqueezedTextLabel *m_playlistLabel = nullptr; | 53 | KSqueezedTextLabel *m_playlistLabel = nullptr; | ||
53 | KSqueezedTextLabel *m_trackLabel = nullptr; | 54 | QLabel *m_trackLabel = nullptr; | ||
54 | QLabel *m_itemTimeLabel = nullptr; | 55 | QLabel *m_itemTimeLabel = nullptr; | ||
55 | 56 | | |||
56 | int m_itemTotalTime = 0; | 57 | int m_itemTotalTime = 0; | ||
57 | int m_itemCurrentTime = 0; | 58 | int m_itemCurrentTime = 0; | ||
58 | bool m_showTimeRemaining = false; | 59 | bool m_showTimeRemaining = false; | ||
59 | }; | 60 | }; | ||
60 | 61 | | |||
61 | #endif | 62 | #endif | ||
62 | 63 | | |||
63 | // vim: set et sw=4 tw=0 sta: | 64 | // vim: set et sw=4 tw=0 sta: |