#include <QtGui/QStatusBar>
#include <QtGui/QCheckBox>
#include <QtGui/QVBoxLayout>
+#include <QtGui/QListWidget>
+#include <QtGui/QListWidgetItem>
#include "editor.h"
find_text = "";
sensitive = FALSE;
- /* loglan->insertItem( "Program structure", this, SLOT(log_prog()));*/
- /* loglan->insertItem( "Unit structure", this, SLOT(log_unit()));*/
-
compiler_path.sprintf("%s/%s", HomeDir, "compile/logcomp");
gen_path.sprintf("%s/%s", HomeDir, "compile/gen");
file_path.sprintf("%s", HomeDir);
void Editor::on_actionFind_triggered()
{
QDialog dlg(this, Qt::Dialog);
- QString *txt;
- int res, line, pom;
QLineEdit *tmpQLineEdit;
tmpQLineEdit = new QLineEdit("", &dlg);
void Editor::on_actionProgram_structure_triggered()
{
- /*
- Code commented during Qt4 migration.
- Code is not used, so there is no rush with this...
- */
- /*
- QString txt;
QDialog dlg(this, "unit", TRUE);
- int cx, cy;
char uname[255];
QLineEdit *files;
files->setFrame(TRUE);
QLabel *tmpQLabel;
- tmpQLabel = new QLabel(&dlg, "Label_1");
+ tmpQLabel = new QLabel(&dlg);
tmpQLabel->setGeometry(10, 20, 100, 30);
tmpQLabel->setText("Program name:");
QPushButton* tmpQPushButton;
- tmpQPushButton = new QPushButton(&dlg, "OkBtn");
+ tmpQPushButton = new QPushButton(&dlg);
tmpQPushButton->setGeometry(40, 70, 70, 30);
tmpQPushButton->setText("Ok");
tmpQPushButton->setAutoRepeat(FALSE);
- tmpQPushButton->setAutoResize(FALSE);
connect(tmpQPushButton,SIGNAL(clicked()), &dlg, SLOT(accept()));
- tmpQPushButton = new QPushButton(&dlg, "CancelBtn");
+ tmpQPushButton = new QPushButton(&dlg);
tmpQPushButton->setGeometry(130, 70, 100, 30);
tmpQPushButton->setText("Cancel");
tmpQPushButton->setAutoRepeat(FALSE);
- tmpQPushButton->setAutoResize(FALSE);
connect(tmpQPushButton,SIGNAL(clicked()), &dlg, SLOT(reject()));
if (dlg.exec()) {
strcpy(uname, files->text());
- e->getCursorPosition(&cx, &cy);
- txt.sprintf("PROGRAM %s\n\nBEGIN\n\nEND ", uname);
- e->insertAt(txt, cx, cy);
+ QString txt;
+ txt.sprintf("PROGRAM %s\n\nBEGIN\n\nEND", uname);
+
+ editor->textCursor().insertText(txt);
}
- */
}
void Editor::on_actionUnit_structure_triggered()
{
- /*
- Code commented during Qt4 migration.
- Code is not used, so there is no rush with this...
- */
- /*
- QString txt;
QDialog dlg(this, Qt::Dialog);
- int cx, cy, i;
+ int i;
char uname[255];
QLineEdit* files;
files->setFrame(TRUE);
QLabel* tmpQLabel;
- tmpQLabel = new QLabel(&dlg, "Label_1");
+ tmpQLabel = new QLabel(&dlg);
tmpQLabel->setGeometry(10, 20, 100, 30);
tmpQLabel->setText("Unit name:");
tmpQLabel->setAlignment(289);
tmpQLabel->setMargin(-1);
QPushButton* tmpQPushButton;
- tmpQPushButton = new QPushButton(&dlg, "OkBtn");
+ tmpQPushButton = new QPushButton(&dlg);
tmpQPushButton->setGeometry(40, 170, 70, 30);
tmpQPushButton->setText("Ok");
tmpQPushButton->setAutoRepeat(FALSE);
- tmpQPushButton->setAutoResize(FALSE);
connect(tmpQPushButton,SIGNAL(clicked()), &dlg, SLOT(accept()));
- tmpQPushButton = new QPushButton(&dlg, "CancelBtn");
+ tmpQPushButton = new QPushButton(&dlg);
tmpQPushButton->setGeometry(130, 170, 100, 30);
tmpQPushButton->setText("Cancel");
tmpQPushButton->setAutoRepeat(FALSE);
- tmpQPushButton->setAutoResize(FALSE);
connect(tmpQPushButton,SIGNAL(clicked()), &dlg, SLOT(reject()));
- tmpQLabel = new QLabel(&dlg, "Label_1");
+ tmpQLabel = new QLabel(&dlg);
tmpQLabel->setGeometry(10, 50, 100, 60);
tmpQLabel->setText("Unit type:");
- QListBox lst(&dlg, "type");
+ QListWidget *listWidget = new QListWidget(&dlg);
for(i = 0; i < TYPENUM; i++) {
- lst.insertItem(UnitTypes[i]);
+ QListWidgetItem *newItem = new QListWidgetItem;
+ newItem->setText(UnitTypes[i]);
+ listWidget->insertItem(i, newItem);
}
- lst.setGeometry(130, 60, 180, 80);
- lst.setCurrentItem(0);
+ listWidget->setCurrentItem(0);
if (dlg.exec()) {
strcpy(uname, files->text());
- e->getCursorPosition(&cx, &cy);
+ QString txt;
txt.sprintf("UNIT %s : %s( <params> );\nBEGIN\n\nEND %s;",
- uname, lst.text(lst.currentItem()).ascii(), uname);
- e->insertAt(txt, cx, cy);
+ uname,
+ listWidget->currentItem()->text().toStdString().c_str(),
+ uname
+ );
+
+ editor->textCursor().insertText(txt);
}
- */
}
/**