ActionList dialog can now select an action, and is used with the proc editor.

This commit is contained in:
dfighter1985 2014-07-03 00:44:38 +02:00
parent a30caef9e1
commit ed6f5d1412
6 changed files with 45 additions and 29 deletions

View file

@ -29,3 +29,21 @@ void ActionList::load()
}
}
void ActionList::accept()
{
QListWidgetItem *item = actionList->currentItem();
if( item == NULL )
return;
selectedAction = item->text();
QDialog::accept();
}
void ActionList::reject()
{
selectedAction = "";
QDialog::reject();
}

View file

@ -3,6 +3,7 @@
#include "ui_action_list.h"
#include <QString>
class ActionList : public QDialog, public Ui::ActionListDialog
@ -13,6 +14,16 @@ public:
ActionList( QDialog *parent = NULL );
~ActionList();
void load();
QString getSelectedAction(){ return selectedAction; }
public Q_SLOTS:
void accept();
void reject();
private:
QString selectedAction;
};
#endif

View file

@ -44,7 +44,6 @@
#include "editor_selection_watcher.h"
#include "editor_message_processor.h"
#include "add_widget_widget.h"
#include "action_list.h"
namespace GUIEditor
{
@ -71,8 +70,6 @@ namespace GUIEditor
widgetInfoTree = new CWidgetInfoTree;
actionList = new ActionList();
createMenus();
readSettings();
@ -118,9 +115,6 @@ namespace GUIEditor
removeMenus();
delete actionList;
actionList = NULL;
delete messageProcessor;
messageProcessor = NULL;
@ -347,12 +341,6 @@ namespace GUIEditor
}
void GUIEditorWindow::test_actionList()
{
actionList->load();
actionList->show();
}
void GUIEditorWindow::hideEvent( QHideEvent *evnt )
{
QWidget::hideEvent( evnt );
@ -411,10 +399,6 @@ 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;
}
}

View file

@ -27,7 +27,6 @@
class QtTreePropertyBrowser;
class QMenu;
class ActionList;
namespace GUIEditor
{
@ -67,7 +66,6 @@ private Q_SLOTS:
void onAddWidgetClicked();
void onTreeChanged();
void test_actionList();
protected:
void hideEvent( QHideEvent *evnt );
@ -94,7 +92,6 @@ private:
CWidgetInfoTree *widgetInfoTree;
CEditorMessageProcessor *messageProcessor;
AddWidgetWidget *addWidgetWidget;
ActionList *actionList;
CPropBrowserCtrl browserCtrl;
QString currentProject;

View file

@ -17,6 +17,7 @@
#include "proc_editor.h"
#include "action_editor.h"
#include "action_list.h"
#include <QMessageBox>
#include <QInputDialog>
#include "nel/gui/interface_group.h"
@ -35,10 +36,15 @@ namespace GUIEditor
connect( removeButton, SIGNAL( clicked( bool ) ), this, SLOT( onRemoveButtonClicked() ) );
connect( upButton, SIGNAL( clicked( bool ) ), this, SLOT( onUpButtonClicked() ) );
connect( downButton, SIGNAL( clicked( bool ) ), this, SLOT( onDownButtonClicked() ) );
alist = new ActionList();
}
ProcEditor::~ProcEditor()
{
delete alist;
alist = NULL;
delete actionEditor;
actionEditor = NULL;
}
@ -84,17 +90,13 @@ namespace GUIEditor
void ProcEditor::onAddButtonClicked()
{
bool ok;
QString name =
QInputDialog::getText( this,
tr( "Adding new Action" ),
tr( "Please specify the name of the new action handler" ),
QLineEdit::Normal,
QString(),
&ok );
if( ok )
alist->load();
int result = alist->exec();
if( result == QDialog::Accepted )
{
QString name = alist->getSelectedAction();
CProcedure *proc =
CWidgetManager::getInstance()->getParser()->getProc( currentProc.toUtf8().constData() );
if( proc != NULL )

View file

@ -20,6 +20,8 @@
#include "ui_proc_editor.h"
class ActionList;
namespace GUIEditor
{
class ActionEditor;
@ -46,6 +48,8 @@ namespace GUIEditor
ActionEditor *actionEditor;
QString currentProc;
ActionList *alist;
};
}