From 32aaa65caf501e87b2468acba3feceb62118dc23 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20D=C5=82ugo=C5=82=C4=99cki?= Date: Sat, 30 Jan 2016 16:06:41 +0100 Subject: [PATCH] Possibility to set directory by file dialog in lgconfig --- Makefile.am | 5 ++ src/kernel/kernel.cpp | 3 +- src/lgconfig/AddNodeDialog.cpp | 19 ++++++++ src/lgconfig/AddNodeDialog.h | 5 ++ src/lgconfig/ui/dialogs/AddNodeDialog.ui | 58 ++++++++++++++++-------- 5 files changed, 70 insertions(+), 20 deletions(-) diff --git a/Makefile.am b/Makefile.am index 9e6414c..5a43ea4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -232,6 +232,7 @@ bin_lgconfig_SOURCES = \ src/lgconfig/lgconfig.cpp \ src/lgconfig/lgconfig.moc.cpp \ src/lgconfig/AddNodeDialog.cpp \ + src/lgconfig/AddNodeDialog.moc.cpp \ src/lgconfig/NodeListDialog.cpp \ src/lgconfig/NodeListDialog.moc.cpp bin_lgconfig_CPPFLAGS = $(bin_lgconfig_CFLAGS) @@ -248,6 +249,10 @@ src/lgconfig/lgconfig.moc.cpp: \ src/lgconfig/ui/dialogs/NodeListDialog.h $(MOC) src/lgconfig/lgconfig.h -o src/lgconfig/lgconfig.moc.cpp +src/lgconfig/AddNodeDialog.moc.cpp: \ + src/lgconfig/ui/dialogs/AddNodeDialog.h + $(MOC) src/lgconfig/AddNodeDialog.h -o src/lgconfig/AddNodeDialog.moc.cpp + src/lgconfig/NodeListDialog.moc.cpp: \ src/lgconfig/ui/dialogs/NodeListDialog.h $(MOC) src/lgconfig/NodeListDialog.h -o src/lgconfig/NodeListDialog.moc.cpp diff --git a/src/kernel/kernel.cpp b/src/kernel/kernel.cpp index 89b4aab..1f7d383 100644 --- a/src/kernel/kernel.cpp +++ b/src/kernel/kernel.cpp @@ -674,8 +674,6 @@ void QKernel::IntMessage(int sock) case MSG_INT: switch(msg.param.pword[0]) { case INT_EXITING: - char ss[255]; - MESSAGE m; m.msg_type = MSG_VLP; m.param.pword[0] = VLP_INTERPRETER_DOWN; @@ -690,6 +688,7 @@ void QKernel::IntMessage(int sock) delete e; if (info_messages) { + char ss[255]; sprintf(ss, "%s : End of program " "execution", msg.param.pstr); WriteMessage(ss); diff --git a/src/lgconfig/AddNodeDialog.cpp b/src/lgconfig/AddNodeDialog.cpp index f8d0058..ce8fc6f 100644 --- a/src/lgconfig/AddNodeDialog.cpp +++ b/src/lgconfig/AddNodeDialog.cpp @@ -1,4 +1,5 @@ #include +#include #include "AddNodeDialog.h" @@ -44,6 +45,24 @@ QString AddNodeDialog::getVLPDirectory() return vlpDirectory->text(); } +void AddNodeDialog::on_programsDirButton_clicked() +{ + QFileDialog dialog(this); + dialog.setFileMode(QFileDialog::Directory); + if(dialog.exec()) { + programsDirectory->setText(dialog.directory().absolutePath() + QDir::separator()); + } +} + +void AddNodeDialog::on_vlpDirButton_clicked() +{ + QFileDialog dialog(this); + dialog.setFileMode(QFileDialog::Directory); + if(dialog.exec()) { + vlpDirectory->setText(dialog.directory().absolutePath() + QDir::separator()); + } +} + } } diff --git a/src/lgconfig/AddNodeDialog.h b/src/lgconfig/AddNodeDialog.h index 912f28f..14e1bca 100644 --- a/src/lgconfig/AddNodeDialog.h +++ b/src/lgconfig/AddNodeDialog.h @@ -15,6 +15,7 @@ namespace dialog { * Displays dialog for generating code template for unit structure */ class AddNodeDialog : public QDialog, private Ui::AddNodeDialog { + Q_OBJECT public: /** * Class constructor @@ -60,6 +61,10 @@ public: * @return VLP directory entered in dialog */ QString getVLPDirectory(); + +private slots: + void on_programsDirButton_clicked(); + void on_vlpDirButton_clicked(); }; } diff --git a/src/lgconfig/ui/dialogs/AddNodeDialog.ui b/src/lgconfig/ui/dialogs/AddNodeDialog.ui index 4d45946..bee57ad 100644 --- a/src/lgconfig/ui/dialogs/AddNodeDialog.ui +++ b/src/lgconfig/ui/dialogs/AddNodeDialog.ui @@ -6,8 +6,8 @@ 0 0 - 258 - 185 + 539 + 189 @@ -88,24 +88,46 @@ - - - - 300 - 0 - - - + + + + + + 300 + 0 + + + + + + + + Choose + + + + - - - - 300 - 0 - - - + + + + + + 300 + 0 + + + + + + + + Choose + + + + -- 2.30.2