src/edit/editor.cpp \
src/edit/editor.moc.cpp \
src/edit/ProgramStructureDialog.cpp \
- src/edit/UnitStructureDialog.cpp
+ src/edit/UnitStructureDialog.cpp \
+ src/edit/PreferencesDialog.cpp
bin_logedit_CPPFLAGS = $(bin_logedit_CFLAGS)
bin_logedit_LDADD = $(bin_logedit_LIBS)
bin_logeditdir = src/edit
src/edit/ProgramStructureDialog.h \
src/edit/ui/dialogs/ProgramStructureDialog.h \
src/edit/UnitStructureDialog.h \
- src/edit/ui/dialogs/UnitStructureDialog.h
+ src/edit/ui/dialogs/UnitStructureDialog.h \
+ src/edit/PreferencesDialog.h \
+ src/edit/ui/dialogs/PreferencesDialog.h
src/edit/editor.moc.cpp: \
src/edit/editor.h \
src/edit/ui/editor.h \
src/edit/ui/dialogs/ProgramStructureDialog.h \
- src/edit/ui/dialogs/UnitStructureDialog.h
+ src/edit/ui/dialogs/UnitStructureDialog.h \
+ src/edit/ui/dialogs/PreferencesDialog.h
moc-qt4 src/edit/editor.h -o src/edit/editor.moc.cpp
# $(MOC) src/edit/editor.h -o src/edit/editor.moc.cpp
src/edit/ui/dialogs/UnitStructureDialog.h:
uic src/edit/ui/dialogs/UnitStructureDialog.ui -o src/edit/ui/dialogs/UnitStructureDialog.h
+src/edit/ui/dialogs/PreferencesDialog.h:
+ uic src/edit/ui/dialogs/PreferencesDialog.ui -o src/edit/ui/dialogs/PreferencesDialog.h
+
clean-logedit-extra:
rm -f src/edit/ui/dialogs/*.h
--- /dev/null
+#include "PreferencesDialog.h"
+
+PreferencesDialog::PreferencesDialog(QWidget * parent)
+ : QDialog(parent)
+{
+ setupUi(this);
+
+ connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+ connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+}
+
+PreferencesDialog::~PreferencesDialog()
+{
+}
+
+QString PreferencesDialog::getCompilerPath()
+{
+ return compilerPath->text();
+}
+
+void PreferencesDialog::setCompilerPath(QString path)
+{
+ return compilerPath->setText(path);
+}
+
+QString PreferencesDialog::getFilesPath()
+{
+ return filesPath->text();
+}
+
+void PreferencesDialog::setFilesPath(QString path)
+{
+ return filesPath->setText(path);
+}
+
+QString PreferencesDialog::getGenPath()
+{
+ return genPath->text();
+}
+
+void PreferencesDialog::setGenPath(QString path)
+{
+ return genPath->setText(path);
+}
--- /dev/null
+#ifndef _VLP_EDITOR_PREFERENCESDIALOG_H
+#define _VLP_EDITOR_PREFERENCESDIALOG_H
+
+#include <QtGui/QDialog>
+#include <QtCore/QString>
+
+#include "ui/dialogs/PreferencesDialog.h"
+
+/**
+ * Program Unit Dialog class
+ * Displays dialog for generating code template for unit structure
+ */
+class PreferencesDialog : public QDialog, private Ui::PreferencesDialog {
+public:
+ /**
+ * Class constructor
+ */
+ PreferencesDialog(QWidget * parent = 0);
+
+ /**
+ * Class destuctor
+ */
+ ~PreferencesDialog();
+
+ /**
+ * Gets compiler path
+ *
+ * @return path to compiler
+ */
+ QString getCompilerPath();
+
+ /**
+ * Sets compiler path
+ *
+ * @param path compiler path
+ */
+ void setCompilerPath(QString path);
+
+ /**
+ * Gets files path
+ *
+ * @return path to files
+ */
+ QString getFilesPath();
+
+ /**
+ * Sets files path
+ *
+ * @param path files path
+ */
+ void setFilesPath(QString path);
+
+ /**
+ * Gets gen path
+ *
+ * @return path to gen
+ */
+ QString getGenPath();
+
+ /**
+ * Sets gen path
+ *
+ * @param path gen path
+ */
+ void setGenPath(QString path);
+};
+
+#endif /* _VLP_EDITOR_PREFERENCESDIALOG_H */
#include "ProgramStructureDialog.h"
#include "UnitStructureDialog.h"
+#include "PreferencesDialog.h"
#include "editor.h"
/* fn.truncate(i);*/
switch(mode) {
case COMP_MODE:
- sprintf(cmd, "%s %s > comp_data!", compiler_path.toAscii().data(),
- fname.toAscii().data());
+ sprintf(cmd, "%s %s > comp_data!", compiler_path.toStdString().c_str(),
+ fname.toStdString().c_str());
break;
case GEN_MODE:
- sprintf(cmd, "%s %s > comp_data!", gen_path.toAscii().data(),
- fname.toAscii().data());
+ sprintf(cmd, "%s %s > comp_data!", gen_path.toStdString().c_str(),
+ fname.toStdString().c_str());
break;
case ALL_MODE:
- sprintf(cmd, "%s %s > comp_data!", compiler_path.toAscii().data(),
- fname.toAscii().data());
+ sprintf(cmd, "%s %s > comp_data!", compiler_path.toStdString().c_str(),
+ fname.toStdString().c_str());
system(cmd);
- sprintf(cmd, "%s %s >> comp_data!", gen_path.toAscii().data(),
- fname.toAscii().data());
+ sprintf(cmd, "%s %s >> comp_data!", gen_path.toStdString().c_str(),
+ fname.toStdString().c_str());
break;
}
*/
void Editor::on_actionPreferences_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);
+ PreferencesDialog dialog(this);
- 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);
-
- /*
- tmpQLabel = new QLabel(&dlg, "Label_3");
- tmpQLabel->setGeometry(10, 100, 100, 30);
- tmpQLabel->setText("Path to gen:");
- tmpQLabel->setAlignment(289);
- 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->setGeometry(130, 100, 250, 30);
- genp->setText(gen_path.data());
- genp->setMaxLength(32767);
- genp->setEchoMode(QLineEdit::Normal);
- genp->setFrame(TRUE);
- */
-
- QPushButton* tmpQPushButton;
- tmpQPushButton = new QPushButton("Ok", &dlg);
- tmpQPushButton->setGeometry(90, 100, 70, 30);
- tmpQPushButton->setAutoRepeat(FALSE);
- connect(tmpQPushButton,SIGNAL(clicked()), &dlg, SLOT(accept()));
-
- tmpQPushButton = new QPushButton("Cancel", &dlg);
- tmpQPushButton->setGeometry(180, 100, 70, 30);
- tmpQPushButton->setAutoRepeat(FALSE);
- connect(tmpQPushButton,SIGNAL(clicked()), &dlg, SLOT(reject()));
-
- dlg.resize(400, 140);
+ dialog.setCompilerPath(compiler_path);
+ dialog.setFilesPath(file_path);
+ dialog.setGenPath(gen_path);
- if (dlg.exec()) {
- compiler_path.sprintf("%s", compp->text().toAscii().data());
- /* gen_path.sprintf("%s",genp->text()); */
- file_path.sprintf("%s", files->text().toAscii().data());
+ if (dialog.exec()) {
+ compiler_path.sprintf("%s", dialog.getCompilerPath().toStdString().c_str());
+ gen_path.sprintf("%s",dialog.getGenPath().toStdString().c_str());
+ file_path.sprintf("%s", dialog.getFilesPath().toStdString().c_str());
};
}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PreferencesDialog</class>
+ <widget class="QDialog" name="PreferencesDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>333</width>
+ <height>137</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <property name="bottomMargin">
+ <number>10</number>
+ </property>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Path to files</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Path to compiler</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Path to gen</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QLineEdit" name="filesPath">
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="compilerPath">
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="genPath"/>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>PreferencesDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>PreferencesDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>