PageRenderTime 51ms CodeModel.GetById 30ms app.highlight 4ms RepoModel.GetById 16ms app.codeStats 0ms

/src/libtomahawk/jobview/LatchedStatusItem.h

http://github.com/tomahawk-player/tomahawk
C Header | 67 lines | 38 code | 12 blank | 17 comment | 0 complexity | daaba56a1b17d92361cc91d3a1c48985 MD5 | raw file
 1/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
 2 *
 3 *   Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
 4 *
 5 *   Tomahawk is free software: you can redistribute it and/or modify
 6 *   it under the terms of the GNU General Public License as published by
 7 *   the Free Software Foundation, either version 3 of the License, or
 8 *   (at your option) any later version.
 9 *
10 *   Tomahawk is distributed in the hope that it will be useful,
11 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 *   GNU General Public License for more details.
14 *
15 *   You should have received a copy of the GNU General Public License
16 *   along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef LATCHEDSTATUSITEM_H
20#define LATCHEDSTATUSITEM_H
21
22#include "JobStatusItem.h"
23#include "Typedefs.h"
24
25#include <QHash>
26#include <QPixmap>
27
28class LatchedStatusManager;
29
30class LatchedStatusItem : public JobStatusItem
31{
32    Q_OBJECT
33public:
34    explicit LatchedStatusItem( const Tomahawk::source_ptr& from, const Tomahawk::source_ptr& to, LatchedStatusManager* );
35    virtual ~LatchedStatusItem();
36
37    virtual QString rightColumnText() const { return QString(); }
38    virtual QString mainText() const;
39    virtual QPixmap icon() const;
40    virtual QString type() const;
41
42    void stop();
43private:
44    Tomahawk::source_ptr m_from, m_to;
45    QString m_text;
46    LatchedStatusManager* m_parent;
47};
48
49class LatchedStatusManager : public QObject
50{
51    Q_OBJECT
52public:
53    explicit LatchedStatusManager( QObject* parent = 0 );
54    virtual ~LatchedStatusManager() {}
55
56    QPixmap pixmap() const;
57
58private slots:
59    void latchedOn( const Tomahawk::source_ptr&, const Tomahawk::source_ptr& );
60    void latchedOff( const Tomahawk::source_ptr&, const Tomahawk::source_ptr& );
61    void sourceOffline();
62
63private:
64    QHash< QString, QPointer< LatchedStatusItem > > m_jobs;
65};
66
67#endif // LATCHEDSTATUSITEM_H