PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 5ms RepoModel.GetById 35ms app.codeStats 0ms

/src/libtomahawk/playlist/dynamic/widgets/CollapsibleControls.h

http://github.com/tomahawk-player/tomahawk
C Header | 83 lines | 48 code | 16 blank | 19 comment | 0 complexity | 7b5a6add41cae6738abd7e3351130c1d 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 COLLAPSIBLE_CONTROLS_H
21#define COLLAPSIBLE_CONTROLS_H
22
23#include "Typedefs.h"
24
25#include <QWidget>
26
27class QPaintEvent;
28class QHBoxLayout;
29class QTimeLine;
30class QToolButton;
31class ElidedLabel;
32class QStackedLayout;
33
34namespace Tomahawk
35{
36
37class DynamicControlWrapper;
38class DynamicControlList;
39
40class CollapsibleControls : public QWidget
41{
42    Q_OBJECT
43public:
44    CollapsibleControls( QWidget* parent );
45    CollapsibleControls( const dynplaylist_ptr& playlist, bool isLocal, QWidget* parent = 0 );
46    virtual ~CollapsibleControls();
47
48    void setControls( const dynplaylist_ptr& playlist, bool isLocal );
49    QList< DynamicControlWrapper* > controls() const;
50
51    virtual QSize sizeHint() const;
52signals:
53    void controlsChanged( bool added );
54    void controlChanged( const Tomahawk::dyncontrol_ptr& control );
55
56private slots:
57    void toggleCollapse();
58
59    void onAnimationStep( int );
60    void onAnimationFinished();
61
62private:
63    void init();
64
65    dynplaylist_ptr m_dynplaylist;
66    QStackedLayout* m_layout;
67    DynamicControlList* m_controls;
68    bool m_isLocal;
69
70    QWidget* m_summaryWidget;
71    QHBoxLayout* m_summaryLayout;
72    ElidedLabel* m_summary;
73    QStackedLayout* m_expandL;
74    QToolButton* m_summaryExpand;
75
76    // animations!
77    QTimeLine* m_timeline;
78    int m_animHeight;
79    bool m_collapseAnimation;
80};
81
82}
83#endif