mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-22 17:08:43 +00:00
Added facilities for viewing the loaded actions.
This commit is contained in:
parent
d52ae8cd56
commit
a30caef9e1
8 changed files with 178 additions and 0 deletions
|
@ -68,6 +68,8 @@ namespace NLGUI
|
|||
return _GlobalInstance;
|
||||
}
|
||||
|
||||
void getActionHandlers( std::vector< std::string > &handlers );
|
||||
|
||||
/// return pointer to action handler or null if it doesn't exist
|
||||
IActionHandler *getActionHandler(const std::string &name) const
|
||||
{
|
||||
|
|
|
@ -111,6 +111,18 @@ namespace NLGUI
|
|||
}
|
||||
}
|
||||
|
||||
void CAHManager::getActionHandlers( std::vector< std::string > &handlers )
|
||||
{
|
||||
handlers.clear();
|
||||
|
||||
std::map< string, IActionHandler* >::iterator itr = FactoryMap.begin();
|
||||
while( itr != FactoryMap.end() )
|
||||
{
|
||||
handlers.push_back( itr->first );
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
IActionHandler* CAHManager::getAH(const std::string &name, std::string ¶ms)
|
||||
{
|
||||
|
|
|
@ -30,6 +30,7 @@ SET(OVQT_PLUGIN_GUI_EDITOR_HDR
|
|||
add_widget_widget.h
|
||||
editor_selection_watcher.h
|
||||
editor_message_processor.h
|
||||
action_list.h
|
||||
)
|
||||
|
||||
SET(OVQT_PLUGIN_GUI_EDITOR_UIS
|
||||
|
@ -45,6 +46,7 @@ SET(OVQT_PLUGIN_GUI_EDITOR_UIS
|
|||
new_property_widget.ui
|
||||
new_widget_widget.ui
|
||||
add_widget_widget.ui
|
||||
action_list.ui
|
||||
)
|
||||
|
||||
SET(QT_USE_QTGUI TRUE)
|
||||
|
|
31
code/studio/src/plugins/gui_editor/action_list.cpp
Normal file
31
code/studio/src/plugins/gui_editor/action_list.cpp
Normal file
|
@ -0,0 +1,31 @@
|
|||
#include "action_list.h"
|
||||
#include "nel/gui/action_handler.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
ActionList::ActionList( QDialog *parent ) :
|
||||
QDialog( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
}
|
||||
|
||||
ActionList::~ActionList()
|
||||
{
|
||||
}
|
||||
|
||||
void ActionList::load()
|
||||
{
|
||||
actionList->clear();
|
||||
|
||||
NLGUI::CAHManager *am = NLGUI::CAHManager::getInstance();
|
||||
std::vector< std::string > handlers;
|
||||
am->getActionHandlers( handlers );
|
||||
|
||||
std::vector< std::string >::const_iterator itr = handlers.begin();
|
||||
while( itr != handlers.end() )
|
||||
{
|
||||
actionList->addItem( itr->c_str() );
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
|
18
code/studio/src/plugins/gui_editor/action_list.h
Normal file
18
code/studio/src/plugins/gui_editor/action_list.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifndef ACTION_LIST_H
|
||||
#define ACTION_LIST_H
|
||||
|
||||
|
||||
#include "ui_action_list.h"
|
||||
|
||||
|
||||
class ActionList : public QDialog, public Ui::ActionListDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ActionList( QDialog *parent = NULL );
|
||||
~ActionList();
|
||||
void load();
|
||||
};
|
||||
|
||||
#endif
|
94
code/studio/src/plugins/gui_editor/action_list.ui
Normal file
94
code/studio/src/plugins/gui_editor/action_list.ui
Normal file
|
@ -0,0 +1,94 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ActionListDialog</class>
|
||||
<widget class="QDialog" name="ActionListDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>359</width>
|
||||
<height>258</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Action List</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QListWidget" name="actionList"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>131</width>
|
||||
<height>31</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="okButton">
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cancelButton">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>okButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>ActionListDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>278</x>
|
||||
<y>253</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>96</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>cancelButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>ActionListDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>369</x>
|
||||
<y>253</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>179</x>
|
||||
<y>282</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -44,6 +44,7 @@
|
|||
#include "editor_selection_watcher.h"
|
||||
#include "editor_message_processor.h"
|
||||
#include "add_widget_widget.h"
|
||||
#include "action_list.h"
|
||||
|
||||
namespace GUIEditor
|
||||
{
|
||||
|
@ -70,6 +71,8 @@ namespace GUIEditor
|
|||
|
||||
widgetInfoTree = new CWidgetInfoTree;
|
||||
|
||||
actionList = new ActionList();
|
||||
|
||||
createMenus();
|
||||
readSettings();
|
||||
|
||||
|
@ -115,6 +118,9 @@ namespace GUIEditor
|
|||
|
||||
removeMenus();
|
||||
|
||||
delete actionList;
|
||||
actionList = NULL;
|
||||
|
||||
delete messageProcessor;
|
||||
messageProcessor = NULL;
|
||||
|
||||
|
@ -341,6 +347,11 @@ namespace GUIEditor
|
|||
}
|
||||
|
||||
|
||||
void GUIEditorWindow::test_actionList()
|
||||
{
|
||||
actionList->load();
|
||||
actionList->show();
|
||||
}
|
||||
|
||||
void GUIEditorWindow::hideEvent( QHideEvent *evnt )
|
||||
{
|
||||
|
@ -400,6 +411,10 @@ namespace GUIEditor
|
|||
connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onAddWidgetClicked() ) );
|
||||
m->addAction( a );
|
||||
|
||||
a = new QAction( "Test actionlist", this );
|
||||
connect( a, SIGNAL( triggered( bool ) ), this, SLOT( test_actionList() ) );
|
||||
m->addAction( a );
|
||||
|
||||
menu = m;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
class QtTreePropertyBrowser;
|
||||
|
||||
class QMenu;
|
||||
class ActionList;
|
||||
|
||||
namespace GUIEditor
|
||||
{
|
||||
|
@ -66,6 +67,8 @@ private Q_SLOTS:
|
|||
void onAddWidgetClicked();
|
||||
void onTreeChanged();
|
||||
|
||||
void test_actionList();
|
||||
|
||||
protected:
|
||||
void hideEvent( QHideEvent *evnt );
|
||||
void showEvent( QShowEvent *evnt );
|
||||
|
@ -91,6 +94,7 @@ private:
|
|||
CWidgetInfoTree *widgetInfoTree;
|
||||
CEditorMessageProcessor *messageProcessor;
|
||||
AddWidgetWidget *addWidgetWidget;
|
||||
ActionList *actionList;
|
||||
|
||||
CPropBrowserCtrl browserCtrl;
|
||||
QString currentProject;
|
||||
|
|
Loading…
Reference in a new issue