PageRenderTime 102ms CodeModel.GetById 60ms app.highlight 5ms RepoModel.GetById 36ms app.codeStats 0ms

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

http://github.com/tomahawk-player/tomahawk
C Header | 85 lines | 45 code | 18 blank | 22 comment | 0 complexity | b5d2329165673b6f16bc9cceb01b5d0e 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 DYNAMIC_CONTROL_WRAPPER_H
20#define DYNAMIC_CONTROL_WRAPPER_H
21
22#include <QWidget>
23#include <QPointer>
24
25#include "Typedefs.h"
26
27class QGridLayout;
28class QStackedLayout;
29class QEvent;
30class QToolButton;
31class QHBoxLayout;
32class QComboBox;
33class QLabel;;
34
35namespace Tomahawk
36{
37
38/**
39* This abstraction object manages the widgets for 1 dynamic playlist control, laid out in the desired layout
40*/
41class DynamicControlWrapper : public QObject
42{
43    Q_OBJECT
44public:
45    explicit DynamicControlWrapper( const dyncontrol_ptr& control, QGridLayout* layout, int row, QWidget* parent = 0 );
46    virtual ~DynamicControlWrapper();
47
48//     virtual void enterEvent(QEvent* );
49//     virtual void leaveEvent(QEvent* );
50
51    dyncontrol_ptr control() const;
52
53    void removeFromLayout();
54
55
56    static QToolButton* initButton( QWidget* parent );
57    static QWidget* createDummy( QWidget* fromW, QWidget* parent );
58signals:
59    void collapse();
60    void removeControl();
61    void changed();
62
63private slots:
64    void typeSelectorChanged( int selectedTypeIndex, bool firstLoad = false );
65
66private:
67    QWidget* m_parent;
68    int m_row;
69    QStackedLayout* m_plusL;
70    QToolButton* m_minusButton;
71
72    dyncontrol_ptr m_control;
73    QComboBox* m_typeSelector;
74    QPointer<QWidget> m_matchSelector;
75    QPointer<QWidget> m_entryWidget;
76    QPointer<QGridLayout> m_layout;
77};
78
79};
80
81#endif
82
83class QPaintEvent;
84
85class QMouseEvent;