From 3eb5115a0bf5ed9fef65d8d28ac9801a453e7529 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sat, 7 Jun 2014 21:07:46 +0200 Subject: [PATCH] GUI for plugin loading / unloading in the plugin dialog. --- .../src/plugins/core/plugin_view_dialog.cpp | 38 +++++++++++++++++ .../src/plugins/core/plugin_view_dialog.h | 4 ++ .../src/plugins/core/plugin_view_dialog.ui | 41 +++++++++++++------ 3 files changed, 71 insertions(+), 12 deletions(-) diff --git a/code/studio/src/plugins/core/plugin_view_dialog.cpp b/code/studio/src/plugins/core/plugin_view_dialog.cpp index 175902d39..316bb0097 100644 --- a/code/studio/src/plugins/core/plugin_view_dialog.cpp +++ b/code/studio/src/plugins/core/plugin_view_dialog.cpp @@ -25,6 +25,8 @@ #include #include #include +#include +#include // Project includes #include "../../extension_system/iplugin_spec.h" @@ -43,6 +45,10 @@ PluginView::PluginView(ExtensionSystem::IPluginManager *pluginManager, QWidget * connect(m_pluginManager, SIGNAL(pluginsChanged()), this, SLOT(updateList())); connect(this, SIGNAL(accepted()), this, SLOT(updateSettings())); + connect( m_ui.pluginTreeWidget, SIGNAL( itemClicked( QTreeWidgetItem*, int ) ), this, SLOT( onItemClicked() ) ); + connect( m_ui.unloadButton, SIGNAL( clicked( bool ) ), this, SLOT( onUnloadClicked() ) ); + connect( m_ui.loadButton, SIGNAL( clicked( bool ) ), this, SLOT( onLoadClicked() ) ); + // WhiteList is list of plugins which can not disable. m_whiteList << Constants::OVQT_CORE_PLUGIN; updateList(); @@ -105,4 +111,36 @@ void PluginView::updateSettings() } } +void PluginView::onItemClicked() +{ + m_ui.unloadButton->setEnabled( true ); +} + +void PluginView::onUnloadClicked() +{ + QTreeWidgetItem *item = m_ui.pluginTreeWidget->currentItem(); + if( item == NULL ) + { + QMessageBox::warning( this, + tr( "Plugin unload" ), + tr( "No plugin selected!" ) ); + return; + } + + +} + +void PluginView::onLoadClicked() +{ + QString f = QFileDialog::getOpenFileName( this, + tr( "Loading a plugin" ), + ".", + "Plugin specifications ( *.xml )" ); + + if( f.isEmpty() ) + { + return; + } +} + } /* namespace Core */ \ No newline at end of file diff --git a/code/studio/src/plugins/core/plugin_view_dialog.h b/code/studio/src/plugins/core/plugin_view_dialog.h index aae16749d..e11449fdd 100644 --- a/code/studio/src/plugins/core/plugin_view_dialog.h +++ b/code/studio/src/plugins/core/plugin_view_dialog.h @@ -44,6 +44,10 @@ private Q_SLOTS: void updateList(); void updateSettings(); + void onItemClicked(); + void onUnloadClicked(); + void onLoadClicked(); + private: const int m_checkStateColumn; diff --git a/code/studio/src/plugins/core/plugin_view_dialog.ui b/code/studio/src/plugins/core/plugin_view_dialog.ui index 53ee0efb8..45c4695e8 100644 --- a/code/studio/src/plugins/core/plugin_view_dialog.ui +++ b/code/studio/src/plugins/core/plugin_view_dialog.ui @@ -17,7 +17,7 @@ true - + true @@ -79,7 +79,34 @@ + + + + false + + + All objects list + + + + + + false + + + Unload plugin + + + + + + + Load plugin + + + + Qt::Horizontal @@ -92,23 +119,13 @@ - + Close - - - - false - - - All objects list - - -