summaryrefslogtreecommitdiff
path: root/src/mainwindow.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow.cc')
-rw-r--r--src/mainwindow.cc72
1 files changed, 35 insertions, 37 deletions
diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index 8271eb6..bd52c0c 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -37,53 +37,51 @@
MainWindow::MainWindow(QString p)
{
- program = p;
+ program = p;
- /* // Watch file on disk?
- connect(&watcher, SIGNAL(fileChanged(const QString &)),
- this, SLOT(reset()));
+ // Watch file on disk?
+ //connect(&watcher, SIGNAL(fileChanged(const QString &)),
+ // this, SLOT(reset()));
+ //watcher.addPath(program);
- watcher.addPath(program);
- */
+ QSplitter *splitter = new QSplitter();
+ setCentralWidget(splitter);
- QSplitter *splitter = new QSplitter();
- setCentralWidget(splitter);
+ editor = new CodeEditor();
+ splitter->addWidget(editor);
+ QFile file(program);
+ file.open(QIODevice::ReadOnly);
+ editor->setPlainText(file.readAll());
+ file.close();
- editor = new CodeEditor();
- splitter->addWidget(editor);
- QFile file(program);
- file.open(QIODevice::ReadOnly);
- editor->setPlainText(file.readAll());
- file.close();
+ out = new OutputWindow();
+ splitter->addWidget(out);
- out = new OutputWindow();
- splitter->addWidget(out);
+ l = new LUAScript(out, program);
+ connect(l, SIGNAL(lineChanged(int)), editor, SLOT(runningLine(int)));
- l = new LUAScript(out, program);
- connect(l, SIGNAL(lineChanged(int)), editor, SLOT(runningLine(int)));
+ QToolBar *toolbar = new QToolBar();
+ addToolBar(Qt::TopToolBarArea, toolbar);
+ QAction *act_run = toolbar->addAction("Run");
+ connect(act_run, SIGNAL(triggered()), this, SLOT(reset()));
- QToolBar *toolbar = new QToolBar();
- addToolBar(Qt::TopToolBarArea, toolbar);
- QAction *act_run = toolbar->addAction("Run");
- connect(act_run, SIGNAL(triggered()), this, SLOT(reset()));
+ QAction *act_stop = toolbar->addAction("Stop");
+ connect(act_stop, SIGNAL(triggered()), l, SLOT(stopScript()));
- QAction *act_stop = toolbar->addAction("Stop");
- connect(act_stop, SIGNAL(triggered()), l, SLOT(stopScript()));
-
- reset();
+ reset();
}
void MainWindow::reset()
{
- printf("Resetting...\n");
- QFile file(program);
- file.open(QIODevice::WriteOnly);
- QString code = editor->toPlainText();
- file.write(code.toLocal8Bit());
- file.close();
- out->stopScript();
- l->stopScript();
- out->reset();
- l->start();
- printf("Reset done\n");
+ printf("Resetting...\n");
+ QFile file(program);
+ file.open(QIODevice::WriteOnly);
+ QString code = editor->toPlainText();
+ file.write(code.toLocal8Bit());
+ file.close();
+ out->stopScript();
+ l->stopScript();
+ out->reset();
+ l->start();
+ printf("Reset done\n");
}