PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 6ms RepoModel.GetById 34ms app.codeStats 1ms

/src/libtomahawk/playlist/dynamic/DynamicView.h

http://github.com/tomahawk-player/tomahawk
C Header | 96 lines | 53 code | 20 blank | 23 comment | 0 complexity | 105c59c1a3c0ea97e9810d1e36f85e3a 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 *   Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
 5 *
 6 *   Tomahawk is free software: you can redistribute it and/or modify
 7 *   it under the terms of the GNU General Public License as published by
 8 *   the Free Software Foundation, either version 3 of the License, or
 9 *   (at your option) any later version.
10 *
11 *   Tomahawk is distributed in the hope that it will be useful,
12 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 *   GNU General Public License for more details.
15 *
16 *   You should have received a copy of the GNU General Public License
17 *   along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef DYNAMIC_VIEW_H
21#define DYNAMIC_VIEW_H
22
23#include "playlist/TrackView.h"
24#include <QTimer>
25#include <QPropertyAnimation>
26#include <QTimeLine>
27#include <QMutex>
28
29class PlaylistModel;
30class TrackModel;
31namespace Tomahawk
32{
33
34class DynamicModel;
35
36
37class DynamicView : public TrackView
38{
39    Q_OBJECT
40public:
41    explicit DynamicView( QWidget* parent = 0 );
42    virtual ~DynamicView();
43
44    virtual void setDynamicModel( DynamicModel* model );
45
46    void setOnDemand( bool onDemand );
47    void setReadOnly( bool readOnly );
48
49    void setDynamicWorking( bool working );
50
51    virtual void paintEvent( QPaintEvent* event );
52
53public slots:
54    void showMessageTimeout( const QString& title, const QString& body );
55    void showMessage( const QString& message );
56
57    // collapse and animate the transition
58    // there MUST be a row *after* startRow + num. that is, you can't collapse
59    // entries unless there is at least one entry after the last collapsed row
60    // optionally you can specify how  many rows are past the block of collapsed rows
61    void collapseEntries( int startRow, int num, int numToKeep = 1 );
62
63private slots:
64    void onTrackCountChanged( unsigned int );
65    void checkForOverflow();
66    void animFinished();
67
68private:
69    QPixmap backgroundBetween( QRect rect, int rowStart );
70
71    DynamicModel* m_model;
72    QString m_title;
73    QString m_body;
74
75    bool m_onDemand;
76    bool m_readOnly;
77    bool m_checkOnCollapse;
78    bool m_working;
79
80    // for collapsing animation
81    QPoint m_fadingPointAnchor;
82    QPoint m_bottomAnchor;
83    QPoint m_bottomOfAnim;
84    QPixmap m_fadingIndexes;
85    QPixmap m_slidingIndex;
86    QPixmap m_bg;
87    bool m_fadebg;
88    bool m_fadeOnly;
89    QTimeLine m_fadeOutAnim;
90    QTimeLine m_slideAnim;
91};
92
93};
94
95
96#endif