Possibility to set directory by file dialog in lgconfig
authorRafał Długołęcki <rafal@dlugolecki.net.pl>
Sat, 30 Jan 2016 15:06:41 +0000 (16:06 +0100)
committerRafał Długołęcki <rafal@dlugolecki.net.pl>
Sat, 30 Jan 2016 15:06:41 +0000 (16:06 +0100)
Makefile.am
src/kernel/kernel.cpp
src/lgconfig/AddNodeDialog.cpp
src/lgconfig/AddNodeDialog.h
src/lgconfig/ui/dialogs/AddNodeDialog.ui

index 9e6414c774a73c4f536a2d9ed36a40a59c485f48..5a43ea4405f54a63c7a255d4c5b512dd08a35414 100644 (file)
@@ -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
index 89b4aab9067c8f4304d745097870706a5a9500aa..1f7d383ebc8f6500ef184fe7943a5d64d4753574 100644 (file)
@@ -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);
index f8d00584ee59f7f945cce1625c441358ea5d9236..ce8fc6fb503a101b34cd30f6175cbdd3b6a4e419 100644 (file)
@@ -1,4 +1,5 @@
 #include <QtGui/QListWidgetItem>
+#include <QtGui/QFileDialog>
 
 #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());
+       }
+}
+
 
 }
 }
index 912f28f86014bb8d62b1242b661ff7e2a74a8ef4..14e1bca13dca61b39e51ed734d11a157b6860a2a 100644 (file)
@@ -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();
 };
 
 }
index 4d45946ed5ef6bf857e79928e21ec231e078903f..bee57ad094bc6b4fcfc980e3788c36b47b09bc85 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>258</width>
-    <height>185</height>
+    <width>539</width>
+    <height>189</height>
    </rect>
   </property>
   <property name="windowTitle">
         </widget>
        </item>
        <item>
-        <widget class="QLineEdit" name="programsDirectory">
-         <property name="minimumSize">
-          <size>
-           <width>300</width>
-           <height>0</height>
-          </size>
-         </property>
-        </widget>
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
+         <item>
+          <widget class="QLineEdit" name="programsDirectory">
+           <property name="minimumSize">
+            <size>
+             <width>300</width>
+             <height>0</height>
+            </size>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="programsDirButton">
+           <property name="text">
+            <string>Choose</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
        </item>
        <item>
-        <widget class="QLineEdit" name="vlpDirectory">
-         <property name="minimumSize">
-          <size>
-           <width>300</width>
-           <height>0</height>
-          </size>
-         </property>
-        </widget>
+        <layout class="QHBoxLayout" name="horizontalLayout_3">
+         <item>
+          <widget class="QLineEdit" name="vlpDirectory">
+           <property name="minimumSize">
+            <size>
+             <width>300</width>
+             <height>0</height>
+            </size>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="vlpDirButton">
+           <property name="text">
+            <string>Choose</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
        </item>
       </layout>
      </item>