~ubuntu-branches/ubuntu/trusty/tomahawk/trusty-proposed

« back to all changes in this revision

Viewing changes to src/libtomahawk/playlist/dynamic/DynamicView.h

  • Committer: Package Import Robot
  • Author(s): Harald Sitter
  • Date: 2013-03-07 21:50:13 UTC
  • Revision ID: package-import@ubuntu.com-20130307215013-6gdjkdds7i9uenvs
Tags: upstream-0.6.0+dfsg
ImportĀ upstreamĀ versionĀ 0.6.0+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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/PlaylistView.h"
 
24
#include <QTimer>
 
25
#include <QPropertyAnimation>
 
26
#include <QTimeLine>
 
27
#include <QMutex>
 
28
 
 
29
class PlaylistModel;
 
30
class TrackModel;
 
31
namespace Tomahawk
 
32
{
 
33
 
 
34
class DynamicModel;
 
35
 
 
36
 
 
37
class DynamicView : public PlaylistView
 
38
{
 
39
    Q_OBJECT
 
40
public:
 
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
 
 
53
public 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
 
 
63
private slots:
 
64
    void onTrackCountChanged( unsigned int );
 
65
    void checkForOverflow();
 
66
    void animFinished();
 
67
 
 
68
private:
 
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