GUI for plugin loading / unloading in the plugin dialog.
This commit is contained in:
parent
6da11abef2
commit
3eb5115a0b
3 changed files with 71 additions and 12 deletions
|
@ -25,6 +25,8 @@
|
||||||
#include <QtGui/QIcon>
|
#include <QtGui/QIcon>
|
||||||
#include <QtGui/QStyle>
|
#include <QtGui/QStyle>
|
||||||
#include <QtGui/QTreeWidgetItem>
|
#include <QtGui/QTreeWidgetItem>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "../../extension_system/iplugin_spec.h"
|
#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(m_pluginManager, SIGNAL(pluginsChanged()), this, SLOT(updateList()));
|
||||||
connect(this, SIGNAL(accepted()), this, SLOT(updateSettings()));
|
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.
|
// WhiteList is list of plugins which can not disable.
|
||||||
m_whiteList << Constants::OVQT_CORE_PLUGIN;
|
m_whiteList << Constants::OVQT_CORE_PLUGIN;
|
||||||
updateList();
|
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 */
|
} /* namespace Core */
|
|
@ -44,6 +44,10 @@ private Q_SLOTS:
|
||||||
void updateList();
|
void updateList();
|
||||||
void updateSettings();
|
void updateSettings();
|
||||||
|
|
||||||
|
void onItemClicked();
|
||||||
|
void onUnloadClicked();
|
||||||
|
void onLoadClicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
const int m_checkStateColumn;
|
const int m_checkStateColumn;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0" colspan="5">
|
<item row="0" column="0" colspan="7">
|
||||||
<widget class="QTreeWidget" name="pluginTreeWidget">
|
<widget class="QTreeWidget" name="pluginTreeWidget">
|
||||||
<property name="alternatingRowColors">
|
<property name="alternatingRowColors">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
@ -79,7 +79,34 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QPushButton" name="allObjectsPushButton">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>All objects list</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="1" column="3">
|
<item row="1" column="3">
|
||||||
|
<widget class="QPushButton" name="unloadButton">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Unload plugin</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="4">
|
||||||
|
<widget class="QPushButton" name="loadButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Load plugin</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="5">
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
|
@ -92,23 +119,13 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="4">
|
<item row="1" column="6">
|
||||||
<widget class="QPushButton" name="closePushButton">
|
<widget class="QPushButton" name="closePushButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Close</string>
|
<string>Close</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QPushButton" name="allObjectsPushButton">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>All objects list</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
Loading…
Reference in a new issue