File indexing completed on 2023-05-30 11:30:51
0001 /** 0002 * Copyright (C) 2002-2004 Scott Wheeler <wheeler@kde.org> 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 JUK_STATUSLABEL_H 0018 #define JUK_STATUSLABEL_H 0019 0020 #include <QWidget> 0021 0022 class KSqueezedTextLabel; 0023 0024 class QEvent; 0025 class QLabel; 0026 class QStatusBar; 0027 class QToolButton; 0028 0029 class FileHandle; 0030 class PlaylistInterface; 0031 0032 class StatusLabel : public QWidget 0033 { 0034 Q_OBJECT 0035 0036 public: 0037 explicit StatusLabel(const PlaylistInterface ¤tPlaylist, QStatusBar *parent = nullptr); 0038 0039 public slots: 0040 void slotPlayingItemHasChanged(const FileHandle &file); 0041 void slotCurrentPlaylistHasChanged(const PlaylistInterface ¤tPlaylist); 0042 0043 /** 0044 * This just sets internal variables that are used by updateTime(). 0045 * Please call that method to display the time. 0046 */ 0047 void setItemTotalTime(qint64 time_msec) { m_itemTotalTime = time_msec; } 0048 void setItemCurrentTime(qint64 time_msec) { m_itemCurrentTime = time_msec; updateTime(); } 0049 0050 protected: 0051 void mouseReleaseEvent(QMouseEvent *) override; 0052 0053 private: 0054 void updateTime(); 0055 0056 KSqueezedTextLabel *m_playlistLabel = nullptr; 0057 QLabel *m_trackLabel = nullptr; 0058 QToolButton *m_itemTimeLabel = nullptr; 0059 0060 int m_itemTotalTime = 0; 0061 int m_itemCurrentTime = 0; 0062 bool m_showTimeRemaining = false; 0063 }; 0064 0065 #endif 0066 0067 // vim: set et sw=4 tw=0 sta: