mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-26 18:40:54 +00:00
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/QStyle>
|
||||
#include <QtGui/QTreeWidgetItem>
|
||||
#include <QMessageBox>
|
||||
#include <QFileDialog>
|
||||
|
||||
// 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 */
|
|
@ -44,6 +44,10 @@ private Q_SLOTS:
|
|||
void updateList();
|
||||
void updateSettings();
|
||||
|
||||
void onItemClicked();
|
||||
void onUnloadClicked();
|
||||
void onLoadClicked();
|
||||
|
||||
private:
|
||||
|
||||
const int m_checkStateColumn;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="5">
|
||||
<item row="0" column="0" colspan="7">
|
||||
<widget class="QTreeWidget" name="pluginTreeWidget">
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
|
@ -79,7 +79,34 @@
|
|||
</property>
|
||||
</widget>
|
||||
</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">
|
||||
<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">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
|
@ -92,23 +119,13 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<item row="1" column="6">
|
||||
<widget class="QPushButton" name="closePushButton">
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
</widget>
|
||||
<resources>
|
||||
|
|
Loading…
Reference in a new issue