mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-23 15:46:18 +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!!)
|
||||
std::string Action;
|
||||
std::string Parameters;
|
||||
std::string Conditions;
|
||||
|
||||
// A list of string/or param number => to build the final params at execution
|
||||
std::vector< CParamBlock > ParamBlocks;
|
||||
|
||||
|
|
|
@ -1796,9 +1796,15 @@ namespace NLGUI
|
|||
else
|
||||
action.Action= (const char*)name;
|
||||
if(params)
|
||||
{
|
||||
action.Parameters = (const char*)params;
|
||||
action.buildParamBlock((const char*)params);
|
||||
}
|
||||
if(cond)
|
||||
{
|
||||
action.Conditions = (const char*)cond;
|
||||
action.buildCondBlock ((const char*)cond);
|
||||
}
|
||||
newProc.Actions.push_back(action);
|
||||
}
|
||||
else if (!strcmp((char*)cur->name,"instance"))
|
||||
|
|
|
@ -16,17 +16,34 @@
|
|||
|
||||
|
||||
#include "action_editor.h"
|
||||
#include "nel/gui/proc.h"
|
||||
|
||||
namespace GUIEditor
|
||||
{
|
||||
ActionEditor::ActionEditor( QWidget *parent )
|
||||
{
|
||||
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() ) );
|
||||
}
|
||||
|
||||
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"
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
class CProcAction;
|
||||
}
|
||||
|
||||
namespace GUIEditor
|
||||
{
|
||||
class ActionEditor : public QWidget, public Ui::ActionEditor
|
||||
|
@ -27,6 +32,13 @@ namespace GUIEditor
|
|||
public:
|
||||
ActionEditor( QWidget *parent = NULL );
|
||||
~ActionEditor();
|
||||
void setCurrentAction( NLGUI::CProcAction *action );
|
||||
|
||||
private Q_SLOTS:
|
||||
void onOkButtonClicked();
|
||||
|
||||
private:
|
||||
NLGUI::CProcAction *currentAction;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>340</width>
|
||||
<height>111</height>
|
||||
<height>145</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -47,8 +47,35 @@
|
|||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
</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>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
|
@ -85,6 +112,8 @@
|
|||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>verticalSpacer</zorder>
|
||||
<zorder></zorder>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
|
@ -62,6 +62,17 @@ namespace GUIEditor
|
|||
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue