[vlc-commits] Qt: ExtensionsModel: do DI
Francois Cartegnie
git at videolan.org
Sat Feb 8 23:04:14 CET 2014
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Jan 18 03:26:24 2014 +0100| [c875b9ea2c1ad5f00ed09d919deb3b144aaac7c0] | committer: Francois Cartegnie
Qt: ExtensionsModel: do DI
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c875b9ea2c1ad5f00ed09d919deb3b144aaac7c0
---
modules/gui/qt4/dialogs/plugins.cpp | 10 ++++------
modules/gui/qt4/dialogs/plugins.hpp | 6 +++---
2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/modules/gui/qt4/dialogs/plugins.cpp b/modules/gui/qt4/dialogs/plugins.cpp
index ce79016..81150cf 100644
--- a/modules/gui/qt4/dialogs/plugins.cpp
+++ b/modules/gui/qt4/dialogs/plugins.cpp
@@ -227,7 +227,8 @@ ExtensionTab::ExtensionTab( intf_thread_t *p_intf_ )
extList->setSelectionMode( QAbstractItemView::SingleSelection );
// Model
- ExtensionListModel *model = new ExtensionListModel( extList, p_intf );
+ ExtensionListModel *model =
+ new ExtensionListModel( extList, ExtensionsManager::getInstance( p_intf ) );
extList->setModel( model );
// Buttons' layout
@@ -336,11 +337,10 @@ QVariant ExtensionListModel::ExtensionCopy::data( int role ) const
/* Extensions list model for the QListView */
-ExtensionListModel::ExtensionListModel( QObject *parent, intf_thread_t *intf )
- : QAbstractListModel( parent ), p_intf( intf )
+ExtensionListModel::ExtensionListModel( QObject *parent, ExtensionsManager* EM_ )
+ : QAbstractListModel( parent ), EM( EM_ )
{
// Connect to ExtensionsManager::extensionsUpdated()
- ExtensionsManager* EM = ExtensionsManager::getInstance( p_intf );
CONNECT( EM, extensionsUpdated(), this, updateList() );
// Load extensions now if not already loaded
@@ -366,7 +366,6 @@ void ExtensionListModel::updateList()
}
// Find new extensions
- ExtensionsManager *EM = ExtensionsManager::getInstance( p_intf );
extensions_manager_t *p_mgr = EM->getManager();
if( !p_mgr )
return;
@@ -388,7 +387,6 @@ void ExtensionListModel::updateList()
int ExtensionListModel::rowCount( const QModelIndex& ) const
{
int count = 0;
- ExtensionsManager *EM = ExtensionsManager::getInstance( p_intf );
extensions_manager_t *p_mgr = EM->getManager();
if( !p_mgr )
return 0;
diff --git a/modules/gui/qt4/dialogs/plugins.hpp b/modules/gui/qt4/dialogs/plugins.hpp
index cb118b1..5f673bb 100644
--- a/modules/gui/qt4/dialogs/plugins.hpp
+++ b/modules/gui/qt4/dialogs/plugins.hpp
@@ -49,7 +49,7 @@ class ExtensionTab;
class ExtensionListItem;
class SearchLineEdit;
class ExtensionCopy;
-
+class ExtensionsManager;
class PluginDialog : public QVLCFrame, public Singleton<PluginDialog>
{
@@ -146,7 +146,7 @@ public:
QPixmap *icon;
};
- ExtensionListModel( QObject *parent, intf_thread_t *p_intf );
+ ExtensionListModel( QObject *parent, ExtensionsManager *EM );
virtual ~ExtensionListModel();
enum
@@ -168,7 +168,7 @@ private slots:
private:
- intf_thread_t *p_intf;
+ ExtensionsManager *EM;
QList<ExtensionCopy*> extensions;
};
More information about the vlc-commits
mailing list