Commit a3120aa5 authored by Jean-Philippe André's avatar Jean-Philippe André Committed by Jean-Philippe André

Extensions/Qt: Use a custom QListView in Plugins & Extensions panel

parent 3990277e
This diff is collapsed.
...@@ -31,7 +31,8 @@ ...@@ -31,7 +31,8 @@
#include <QStringList> #include <QStringList>
#include <QTreeWidgetItem> #include <QTreeWidgetItem>
#include <QListWidgetItem> #include <QAbstractListModel>
#include <QStyledItemDelegate>
class QLabel; class QLabel;
class QTabWidget; class QTabWidget;
...@@ -39,10 +40,16 @@ class QComboBox; ...@@ -39,10 +40,16 @@ class QComboBox;
class QTreeWidget; class QTreeWidget;
class QLineEdit; class QLineEdit;
class QTextBrowser; class QTextBrowser;
class QListView;
class QStyleOptionViewItem;
class QPainter;
class QKeyEvent;
class PluginTab; class PluginTab;
class ExtensionTab; class ExtensionTab;
class ExtensionListItem; class ExtensionListItem;
class SearchLineEdit; class SearchLineEdit;
class ExtensionCopy;
class PluginDialog : public QVLCFrame, public Singleton<PluginDialog> class PluginDialog : public QVLCFrame, public Singleton<PluginDialog>
{ {
...@@ -81,19 +88,15 @@ class ExtensionTab : public QVLCFrame ...@@ -81,19 +88,15 @@ class ExtensionTab : public QVLCFrame
{ {
Q_OBJECT; Q_OBJECT;
protected:
virtual void keyPressEvent( QKeyEvent *keyEvent );
private: private:
ExtensionTab( intf_thread_t *p_intf ); ExtensionTab( intf_thread_t *p_intf );
virtual ~ExtensionTab(); virtual ~ExtensionTab();
QComboBox *extList; QListView *extList;
QLabel *author, *version, *url; QPushButton *butMoreInfo;
QTextBrowser *description;
QLineEdit *name;
private slots:
void fillList();
void selectionChanged( int index );
void reloadExtensions();
friend class PluginDialog; friend class PluginDialog;
}; };
...@@ -108,5 +111,44 @@ public: ...@@ -108,5 +111,44 @@ public:
virtual bool operator< ( const QTreeWidgetItem & other ) const; virtual bool operator< ( const QTreeWidgetItem & other ) const;
}; };
class ExtensionListModel : public QAbstractListModel
{
Q_OBJECT
public:
ExtensionListModel( QListView *view, intf_thread_t *p_intf );
virtual ~ExtensionListModel();
virtual QVariant data( const QModelIndex& index, int role ) const;
virtual QModelIndex index( int row, int column = 0,
const QModelIndex& = QModelIndex() ) const;
virtual int rowCount( const QModelIndex& = QModelIndex() ) const;
private slots:
void updateList();
private:
intf_thread_t *p_intf;
QList<ExtensionCopy*> extensions;
};
class ExtensionItemDelegate : public QStyledItemDelegate
{
public:
ExtensionItemDelegate( intf_thread_t *p_intf, QListView *view );
virtual ~ExtensionItemDelegate();
virtual void paint( QPainter *painter,
const QStyleOptionViewItem &option,
const QModelIndex &index ) const;
virtual QSize sizeHint( const QStyleOptionViewItem &option,
const QModelIndex &index ) const;
private:
QListView *view;
intf_thread_t *p_intf;
};
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment