statuslabel.h 1.88 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/**
 * Copyright (C) 2002-2004 Scott Wheeler <wheeler@kde.org>
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program.  If not, see <http://www.gnu.org/licenses/>.
 */
16

17 18
#ifndef JUK_STATUSLABEL_H
#define JUK_STATUSLABEL_H
19

20
#include <QStatusBar>
21
#include <QWidget>
22

23 24
class KSqueezedTextLabel;

25
class QEvent;
26
class QLabel;
27

28 29 30 31
class FileHandle;
class PlaylistInterface;

class StatusLabel : public QWidget
32 33 34
{
    Q_OBJECT

35
public:
36
    explicit StatusLabel(const PlaylistInterface &currentPlaylist, QStatusBar *parent = nullptr);
37

38
public slots:
39 40 41
    void slotPlayingItemHasChanged(const FileHandle &file);
    void slotCurrentPlaylistHasChanged(const PlaylistInterface &currentPlaylist);

42
    /**
43
     * This just sets internal variables that are used by updateTime().
44
     * Please call that method to display the time.
45
     */
46 47
    void setItemTotalTime(qint64 time_msec) { m_itemTotalTime = time_msec; }
    void setItemCurrentTime(qint64 time_msec) { m_itemCurrentTime = time_msec; updateTime(); }
48

49
private:
50 51
    void updateTime();
    virtual bool eventFilter(QObject *o, QEvent *e);
52

53
    KSqueezedTextLabel *m_playlistLabel = nullptr;
54
    QLabel             *m_trackLabel    = nullptr;
55
    QLabel             *m_itemTimeLabel = nullptr;
56

57 58 59
    int  m_itemTotalTime     = 0;
    int  m_itemCurrentTime   = 0;
    bool m_showTimeRemaining = false;
60 61 62
};

#endif
63 64

// vim: set et sw=4 tw=0 sta: