diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2012-08-23 20:23:19 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2012-08-23 20:23:19 +0200 |
commit | dcecacbf52121d6f8adf076d2cebaeec1e141339 (patch) | |
tree | 04f36b2a55f221985108c1a3d701b184ac5dc52d /src/mainwindow.cc | |
parent | 1fc6eb2c1a8500602f2c45662dabbf164210a5b3 (diff) |
Implement automatic reset/reload when script file changes on disc.
Diffstat (limited to 'src/mainwindow.cc')
-rw-r--r-- | src/mainwindow.cc | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 784bfbb..c8036ca 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -29,11 +29,31 @@ #include "outputwindow.h" -MainWindow::MainWindow(QString program) +#include <QApplication> + +MainWindow::MainWindow(QString p) { + program = p; + + connect(&watcher, SIGNAL(fileChanged(const QString &)), + this, SLOT(reset())); + + watcher.addPath(program); + out = new OutputWindow(); out->show(); - l = new LUAScript(out); - l->addFile(program.toStdString()); + + l = new LUAScript(out, program); + + reset(); +} + +void MainWindow::reset() +{ + printf("Resetting...\n"); + out->stopScript(); + l->stopScript(); + out->reset(); l->start(); + printf("Reset done\n"); } |