]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs/plugins.hpp
Drop trailing semicolons
[vlc] / modules / gui / qt4 / dialogs / plugins.hpp
1 /*****************************************************************************
2  * plugins.hpp : Plug-ins and extensions listing
3  ****************************************************************************
4  * Copyright (C) 2008 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Jean-Baptiste Kempf <jb (at) videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #ifndef QVLC_PLUGIN_DIALOG_H_
25 #define QVLC_PLUGIN_DIALOG_H_ 1
26
27 #include "util/qvlcframe.hpp"
28 #include "util/singleton.hpp"
29
30 #include <vlc_extensions.h>
31
32 #include <QStringList>
33 #include <QTreeWidgetItem>
34 #include <QAbstractListModel>
35 #include <QStyledItemDelegate>
36
37 class QLabel;
38 class QTabWidget;
39 class QComboBox;
40 class QTreeWidget;
41 class QLineEdit;
42 class QTextBrowser;
43 class QListView;
44 class QStyleOptionViewItem;
45 class QPainter;
46 class QKeyEvent;
47 class PluginTab;
48 class ExtensionTab;
49 class ExtensionListItem;
50 class SearchLineEdit;
51 class ExtensionCopy;
52
53
54 class PluginDialog : public QVLCFrame, public Singleton<PluginDialog>
55 {
56     Q_OBJECT
57
58 private:
59     PluginDialog( intf_thread_t * );
60     virtual ~PluginDialog();
61
62     QTabWidget *tabs;
63     PluginTab *pluginTab;
64     ExtensionTab *extensionTab;
65
66     friend class Singleton<PluginDialog>;
67 };
68
69 class PluginTab : public QVLCFrame
70 {
71     Q_OBJECT
72
73 private:
74     PluginTab( intf_thread_t *p_intf );
75     virtual ~PluginTab();
76
77     void FillTree();
78     QTreeWidget *treePlugins;
79     SearchLineEdit *edit;
80
81 private slots:
82     void search( const QString& );
83
84     friend class PluginDialog;
85 };
86
87 class ExtensionTab : public QVLCFrame
88 {
89     Q_OBJECT
90
91 protected:
92     virtual void keyPressEvent( QKeyEvent *keyEvent );
93
94 private:
95     ExtensionTab( intf_thread_t *p_intf );
96     virtual ~ExtensionTab();
97
98 private slots:
99     void moreInformation();
100
101 private:
102     QListView *extList;
103     QPushButton *butMoreInfo;
104
105     friend class PluginDialog;
106 };
107
108 class PluginTreeItem : public QTreeWidgetItem
109 {
110 public:
111     PluginTreeItem(QStringList &qs_item, int Type = QTreeWidgetItem::Type)
112             : QTreeWidgetItem (qs_item, Type) {}
113     virtual ~PluginTreeItem() {}
114
115     virtual bool operator< ( const QTreeWidgetItem & other ) const;
116 };
117
118 class ExtensionListModel : public QAbstractListModel
119 {
120
121     Q_OBJECT
122
123 public:
124     ExtensionListModel( QListView *view, intf_thread_t *p_intf );
125     virtual ~ExtensionListModel();
126
127     virtual QVariant data( const QModelIndex& index, int role ) const;
128     virtual QModelIndex index( int row, int column = 0,
129                                const QModelIndex& = QModelIndex() ) const;
130     virtual int rowCount( const QModelIndex& = QModelIndex() ) const;
131
132 private slots:
133     void updateList();
134
135 private:
136     intf_thread_t *p_intf;
137     QList<ExtensionCopy*> extensions;
138 };
139
140 class ExtensionItemDelegate : public QStyledItemDelegate
141 {
142 public:
143     ExtensionItemDelegate( intf_thread_t *p_intf, QListView *view );
144     virtual ~ExtensionItemDelegate();
145
146     virtual void paint( QPainter *painter,
147                         const QStyleOptionViewItem &option,
148                         const QModelIndex &index ) const;
149     virtual QSize sizeHint( const QStyleOptionViewItem &option,
150                             const QModelIndex &index ) const;
151
152 private:
153     QListView *view;
154     intf_thread_t *p_intf;
155 };
156
157 class ExtensionInfoDialog : public QVLCDialog
158 {
159 public:
160     ExtensionInfoDialog( const ExtensionCopy& extension,
161                          intf_thread_t *p_intf, QWidget *parent );
162     virtual ~ExtensionInfoDialog();
163
164 private:
165     ExtensionCopy *extension;
166 };
167
168 #endif
169