mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-30 04:40:53 +00:00
CHANGED: #1471 ActionEditor is now implemented.
This commit is contained in:
parent
3ad60b477e
commit
f3abf43368
6 changed files with 80 additions and 2 deletions
|
@ -47,6 +47,9 @@ namespace NLGUI
|
||||||
|
|
||||||
// the action handler (may be proc!!)
|
// the action handler (may be proc!!)
|
||||||
std::string Action;
|
std::string Action;
|
||||||
|
std::string Parameters;
|
||||||
|
std::string Conditions;
|
||||||
|
|
||||||
// A list of string/or param number => to build the final params at execution
|
// A list of string/or param number => to build the final params at execution
|
||||||
std::vector< CParamBlock > ParamBlocks;
|
std::vector< CParamBlock > ParamBlocks;
|
||||||
|
|
||||||
|
|
|
@ -1796,9 +1796,15 @@ namespace NLGUI
|
||||||
else
|
else
|
||||||
action.Action= (const char*)name;
|
action.Action= (const char*)name;
|
||||||
if(params)
|
if(params)
|
||||||
|
{
|
||||||
|
action.Parameters = (const char*)params;
|
||||||
action.buildParamBlock((const char*)params);
|
action.buildParamBlock((const char*)params);
|
||||||
|
}
|
||||||
if(cond)
|
if(cond)
|
||||||
|
{
|
||||||
|
action.Conditions = (const char*)cond;
|
||||||
action.buildCondBlock ((const char*)cond);
|
action.buildCondBlock ((const char*)cond);
|
||||||
|
}
|
||||||
newProc.Actions.push_back(action);
|
newProc.Actions.push_back(action);
|
||||||
}
|
}
|
||||||
else if (!strcmp((char*)cur->name,"instance"))
|
else if (!strcmp((char*)cur->name,"instance"))
|
||||||
|
|
|
@ -16,17 +16,34 @@
|
||||||
|
|
||||||
|
|
||||||
#include "action_editor.h"
|
#include "action_editor.h"
|
||||||
|
#include "nel/gui/proc.h"
|
||||||
|
|
||||||
namespace GUIEditor
|
namespace GUIEditor
|
||||||
{
|
{
|
||||||
ActionEditor::ActionEditor( QWidget *parent )
|
ActionEditor::ActionEditor( QWidget *parent )
|
||||||
{
|
{
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
connect( okButton, SIGNAL( clicked( bool ) ), this, SLOT( hide() ) );
|
connect( okButton, SIGNAL( clicked( bool ) ), this, SLOT( onOkButtonClicked() ) );
|
||||||
connect( cancelButton, SIGNAL( clicked( bool ) ), this, SLOT( hide() ) );
|
connect( cancelButton, SIGNAL( clicked( bool ) ), this, SLOT( hide() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionEditor::~ActionEditor()
|
ActionEditor::~ActionEditor()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ActionEditor::setCurrentAction( NLGUI::CProcAction *action )
|
||||||
|
{
|
||||||
|
currentAction = action;
|
||||||
|
handlerEdit->setText( currentAction->Action.c_str() );
|
||||||
|
handlerEdit->setEnabled( false );
|
||||||
|
paramsEdit->setText( currentAction->Parameters.c_str() );
|
||||||
|
condEdit->setText( currentAction->Conditions.c_str() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ActionEditor::onOkButtonClicked()
|
||||||
|
{
|
||||||
|
currentAction->Parameters = paramsEdit->text().toStdString();
|
||||||
|
currentAction->Conditions = condEdit->text().toStdString();
|
||||||
|
hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,11 @@
|
||||||
|
|
||||||
#include "ui_action_editor.h"
|
#include "ui_action_editor.h"
|
||||||
|
|
||||||
|
namespace NLGUI
|
||||||
|
{
|
||||||
|
class CProcAction;
|
||||||
|
}
|
||||||
|
|
||||||
namespace GUIEditor
|
namespace GUIEditor
|
||||||
{
|
{
|
||||||
class ActionEditor : public QWidget, public Ui::ActionEditor
|
class ActionEditor : public QWidget, public Ui::ActionEditor
|
||||||
|
@ -27,6 +32,13 @@ namespace GUIEditor
|
||||||
public:
|
public:
|
||||||
ActionEditor( QWidget *parent = NULL );
|
ActionEditor( QWidget *parent = NULL );
|
||||||
~ActionEditor();
|
~ActionEditor();
|
||||||
|
void setCurrentAction( NLGUI::CProcAction *action );
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void onOkButtonClicked();
|
||||||
|
|
||||||
|
private:
|
||||||
|
NLGUI::CProcAction *currentAction;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>340</width>
|
<width>340</width>
|
||||||
<height>111</height>
|
<height>145</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -47,8 +47,35 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Conditions</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLineEdit" name="condEdit">
|
||||||
|
<property name="text">
|
||||||
|
<string>Conditions</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>11</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
|
@ -85,6 +112,8 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
<zorder>verticalSpacer</zorder>
|
||||||
|
<zorder></zorder>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|
|
@ -62,6 +62,17 @@ namespace GUIEditor
|
||||||
|
|
||||||
void ProcEditor::onEditButtonClicked()
|
void ProcEditor::onEditButtonClicked()
|
||||||
{
|
{
|
||||||
|
int row = actionList->currentRow();
|
||||||
|
QListWidgetItem *item = actionList->item( row );
|
||||||
|
if( item == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
|
CProcedure *proc =
|
||||||
|
CWidgetManager::getInstance()->getParser()->getProc( currentProc.toStdString() );
|
||||||
|
if( proc == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
|
actionEditor->setCurrentAction( &( proc->Actions[ row ] ) );
|
||||||
actionEditor->show();
|
actionEditor->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue