src/edit/editor.moc.cpp \
src/edit/ProgramStructureDialog.cpp \
src/edit/UnitStructureDialog.cpp \
- src/edit/PreferencesDialog.cpp
+ src/edit/PreferencesDialog.cpp \
+ src/edit/FindDialog.cpp
bin_logedit_CPPFLAGS = $(bin_logedit_CFLAGS)
bin_logedit_LDADD = $(bin_logedit_LIBS)
bin_logeditdir = src/edit
src/edit/UnitStructureDialog.h \
src/edit/ui/dialogs/UnitStructureDialog.h \
src/edit/PreferencesDialog.h \
- src/edit/ui/dialogs/PreferencesDialog.h
+ src/edit/ui/dialogs/PreferencesDialog.h \
+ src/edit/FindDialog.h \
+ src/edit/ui/dialogs/FindDialog.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/PreferencesDialog.h
+ src/edit/ui/dialogs/PreferencesDialog.h \
+ src/edit/ui/dialogs/FindDialog.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/PreferencesDialog.h:
uic src/edit/ui/dialogs/PreferencesDialog.ui -o src/edit/ui/dialogs/PreferencesDialog.h
+src/edit/ui/dialogs/FindDialog.h:
+ uic src/edit/ui/dialogs/FindDialog.ui -o src/edit/ui/dialogs/FindDialog.h
+
clean-logedit-extra:
rm -f src/edit/ui/dialogs/*.h
--- /dev/null
+#include "FindDialog.h"
+
+namespace loglan {
+namespace vlp {
+namespace dialog {
+
+
+FindDialog::FindDialog(QWidget * parent)
+ : QDialog(parent)
+{
+ setupUi(this);
+
+ connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+ connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+}
+
+FindDialog::~FindDialog()
+{
+}
+
+bool FindDialog::isCaseSensitive()
+{
+ return caseSensitive->isChecked();
+}
+
+QString FindDialog::getSearchText()
+{
+ return lineEdit->text();
+}
+
+}
+}
+}
--- /dev/null
+#ifndef _VLP_EDITOR_FINDEDIALOG_H
+#define _VLP_EDITOR_FINDEDIALOG_H
+
+#include <QtGui/QDialog>
+#include <QtCore/QString>
+
+
+#include "ui/dialogs/FindDialog.h"
+
+namespace loglan {
+namespace vlp {
+namespace dialog {
+
+/**
+ * Find Dialog class
+ * Displays dialog for findinf text in source code
+ */
+class FindDialog : public QDialog, private Ui::FindDialog {
+public:
+ /**
+ * Class constructor
+ */
+ FindDialog(QWidget * parent = 0);
+
+ /**
+ * Class destuctor
+ */
+ ~FindDialog();
+
+ /**
+ * Gets user-passed program name
+ *
+ * @return program name entered in dialog
+ */
+ bool isCaseSensitive();
+
+ /**
+ * Gets program code template
+ *
+ * @return program code template with program name
+ */
+ QString getSearchText();
+};
+
+}
+}
+}
+
+#endif /* _VLP_EDITOR_FINDEDIALOG_H */
#include "ProgramStructureDialog.h"
#include "UnitStructureDialog.h"
#include "PreferencesDialog.h"
+#include "FindDialog.h"
#include "editor.h"
*/
void Editor::on_actionFind_triggered()
{
- QDialog dlg(this, Qt::Dialog);
+ dialog::FindDialog dialog(this);
- QLineEdit *tmpQLineEdit;
- tmpQLineEdit = new QLineEdit("", &dlg);
- tmpQLineEdit->setGeometry(60, 10, 180, 30);
-
- QLabel *tmpQLabel;
- tmpQLabel = new QLabel(&dlg);
- tmpQLabel->setGeometry(10, 10, 50, 30);
-
- tmpQLabel->setText("Text:");
-
- QCheckBox *tmpQRadioButton;
- tmpQRadioButton = new QCheckBox("Case sensitive", &dlg);
- tmpQRadioButton->setGeometry(70, 50, 150, 30);
- tmpQRadioButton->setAutoRepeat(FALSE);
-
- QPushButton *okbtn, *cbtn;
- okbtn = new QPushButton("Find", &dlg);
- okbtn->setGeometry(260, 10, 100, 30);
- okbtn->setDefault(TRUE);
- connect(okbtn,SIGNAL(clicked()), &dlg, SLOT(accept()));
-
- cbtn = new QPushButton("Close", &dlg);
- cbtn->setGeometry(260, 50, 100, 30);
- connect(cbtn, SIGNAL(clicked()), &dlg, SLOT(reject()));
-
- dlg.resize(380, 90);
-
- if (dlg.exec()) {
- sensitive = tmpQRadioButton->isChecked();
- find_text = tmpQLineEdit->text();
+ if (dialog.exec()) {
+ sensitive = dialog.isCaseSensitive();
+ find_text = dialog.getSearchText();
QTextDocument::FindFlags flags = 0;
if (sensitive) {
flags |= QTextDocument::FindCaseSensitively;
}
+
editor->find(find_text, flags);
}
}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>FindDialog</class>
+ <widget class="QDialog" name="FindDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>355</width>
+ <height>80</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="leftMargin">
+ <number>7</number>
+ </property>
+ <property name="topMargin">
+ <number>6</number>
+ </property>
+ <property name="rightMargin">
+ <number>6</number>
+ </property>
+ <property name="bottomMargin">
+ <number>6</number>
+ </property>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <property name="spacing">
+ <number>10</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Text</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="lineEdit">
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="caseSensitive">
+ <property name="text">
+ <string>Case sensitive</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Close|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>FindDialog</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>FindDialog</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>