From 41c30cdf376730a68fcda69b57b1139f143a5543 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 26 Dec 2018 19:53:20 +0100 Subject: Fix indentation and code-style. --- src/mainwindow.cc | 72 +++++++++++++++++++++++++++---------------------------- 1 file changed, 35 insertions(+), 37 deletions(-) (limited to 'src/mainwindow.cc') 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"); } -- cgit v1.2.3