vlp-27 Made Editor Properties dialog using QtDesigner files.
[vlp.git] / src / edit / editor.cpp
index f6808a431810f29e83b2407ecbdd94a2b7e60e1f..b57a59bc70325b975bd985a973aaa6060253a721 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "editor.h"
 #include "my_edit.h"
+#include "editor-properties.h"
 
 #define TYPENUM        5
 
@@ -327,27 +328,10 @@ void Editor::compile(int mode)
  */
 void Editor::on_actionProperties_triggered()
 {
-       QDialog dlg(this, Qt::Dialog);
-
-       QLineEdit *files;
-       files = new QLineEdit(&dlg);
-       files->setGeometry(130, 20, 250, 30);
-       files->setText(file_path);
-       files->setMaxLength(32767);
-       files->setEchoMode(QLineEdit::Normal);
-       files->setFrame(TRUE);
-
-       QLabel *tmpQLabel;
-       tmpQLabel = new QLabel("Path to files:", &dlg);
-       tmpQLabel->setGeometry(10, 20, 100, 30);
-       tmpQLabel->setAlignment(Qt::AlignLeft);
-       tmpQLabel->setMargin(-1);
-
-       tmpQLabel = new QLabel("Path to compiler:", &dlg);
-       tmpQLabel->setGeometry(10, 60, 100, 30);
-       tmpQLabel->setAlignment(Qt::AlignLeft);
-       tmpQLabel->setMargin(-1);
+       EditorProperties *dlg = new EditorProperties(this, Qt::Dialog);
 
+       dlg->setDefaultCompilerPath(compiler_path);
+       dlg->setDefaultFilesPath(file_path);
        /*
        tmpQLabel = new QLabel(&dlg, "Label_3");
        tmpQLabel->setGeometry(10, 100, 100, 30);
@@ -356,13 +340,6 @@ void Editor::on_actionProperties_triggered()
        tmpQLabel->setMargin(-1);
        */
 
-       QLineEdit *compp;
-       compp = new QLineEdit(compiler_path, &dlg);
-       compp->setGeometry(130, 60, 250, 30);
-       compp->setMaxLength(32767);
-       compp->setEchoMode(QLineEdit::Normal);
-       compp->setFrame(TRUE);
-
        /*
        QLineEdit* genp;
        genp = new QLineEdit(&dlg, "g_path");
@@ -373,28 +350,10 @@ void Editor::on_actionProperties_triggered()
        genp->setFrame(TRUE);
        */
 
-       QPushButton* tmpQPushButton;
-       tmpQPushButton = new QPushButton("Ok", &dlg);
-       tmpQPushButton->setGeometry(90, 100, 70, 30);
-       tmpQPushButton->setAutoRepeat(FALSE);
-/*TODO: Does not exists in Qt4. Use layout and set the size policy (https://qt-project.org/forums/viewthread/2112)
-       tmpQPushButton->setAutoResize(FALSE);
-*/
-       connect(tmpQPushButton,SIGNAL(clicked()), &dlg, SLOT(accept()));
-
-       tmpQPushButton = new QPushButton("Cancel", &dlg);
-       tmpQPushButton->setGeometry(180, 100, 70, 30);
-       tmpQPushButton->setAutoRepeat(FALSE);
-/*TODO: Does not exists in Qt4. Use layout and set the size policy (https://qt-project.org/forums/viewthread/2112)
-       tmpQPushButton->setAutoResize(FALSE);
-*/
-       connect(tmpQPushButton,SIGNAL(clicked()), &dlg, SLOT(reject()));
-       dlg.resize(400, 140);
-
-       if (dlg.exec()) {
-               compiler_path.sprintf("%s", compp->text().toAscii().data());
+       if (dlg->exec()) {
+               compiler_path.sprintf("%s", dlg->getCompilerPath().toAscii().data());
                /* gen_path.sprintf("%s",genp->text()); */
-               file_path.sprintf("%s", files->text().toAscii().data());
+               file_path.sprintf("%s", dlg->getFilesPath().toAscii().data());
        };
 }