bin_logedit_HEADERS =\
src/edit/editor.h \
src/edit/my_edit.h \
- src/edit/ui/editor-window.h
+ src/edit/editor-properties.h \
+ src/edit/ui/editor-window.h \
+ src/edit/ui/editor-properties-dialog.h
src/edit/ui/editor-window.h: data/editor/editor-window.ui
if [ ! -d src/edit/ui ]; then mkdir -p src/edit/ui; fi
uic-qt4 data/editor/editor-window.ui -o src/edit/ui/editor-window.h
+src/edit/ui/editor-properties-dialog.h: data/editor/editor-properties-dialog.ui
+ if [ ! -d src/edit/ui ]; then mkdir -p src/edit/ui; fi
+ uic-qt4 data/editor/editor-properties-dialog.ui -o src/edit/ui/editor-properties-dialog.h
+
src/edit/editor.moc.cpp: $(bin_logedit_HEADERS)
moc-qt4 src/edit/editor.h -o src/edit/editor.moc.cpp
# $(MOC) src/edit/editor.h -o src/edit/editor.moc.cpp
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>EditorProperties</class>
+ <widget class="QDialog" name="EditorProperties">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>332</width>
+ <height>136</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Path to files</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="filesPath"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Path to compiler</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="compilerPath"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
--- /dev/null
+/**************************************************************
+
+ Copyright (C) 2013 Rafał Długołęcki
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+
+
+ NOTE: This software is using the free software license of
+ the QT library v.1.30 from Troll Tech AS.
+ See the file LICENSE.QT.
+
+************************************************************/
+
+#ifndef VLP_SEND_MESSAGE_H
+#define VLP_SEND_MESSAGE_H
+
+#include <QtGui/QDialog>
+#include <QtCore/QString>
+#include <QtGui/QLineEdit>
+
+#include "ui/editor-properties-dialog.h"
+
+/**
+ * Class responsible for displaying dialog with editor properties
+ */
+class EditorProperties : public QDialog, private Ui::EditorProperties {
+public:
+ /**
+ * Constructs an EditorProperties with parent 'parent'.
+ * The widget flags flags are passed on to the QDialog constructor.
+ *
+ * @param parent parent widget of this dialog
+ * @param flags QDialog flags of this dialog
+ */
+ EditorProperties(QWidget * parent = 0, Qt::WindowFlags flags = 0 ) :
+ QDialog(parent, flags)
+ {
+ setupUi(this);
+ connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+ connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+ }
+
+ /**
+ * Returns entered in dialog Compiler Path
+ * @return Compiler Path from this dialog textfield
+ */
+ QString getCompilerPath()
+ {
+ return compilerPath->text();
+ }
+
+ /**
+ * Returns entered in dialog Files Path
+ * @return Files Path from this dialog textfield
+ */
+ QString getFilesPath()
+ {
+ return filesPath->text();
+ }
+
+ /**
+ * Sets default value for Compiler Path textfield
+ */
+ void setDefaultCompilerPath(QString path)
+ {
+ compilerPath->setText(path);
+ }
+
+ /**
+ * Sets default value for Files Path textfield
+ */
+ void setDefaultFilesPath(QString path)
+ {
+ filesPath->setText(path);
+ }
+};
+
+
+#endif /* VLP_SEND_MESSAGE_H */
#include "editor.h"
#include "my_edit.h"
+#include "editor-properties.h"
#define TYPENUM 5
*/
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);
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");
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());
};
}