From 12edb52d0c3411b841f087f9dbea60638acae2de Mon Sep 17 00:00:00 2001 From: NeoTheFox Date: Sat, 14 Mar 2015 18:28:57 +0300 Subject: [PATCH] Updated README.md More comments --- README.md | 5 +++++ main.cpp | 2 ++ mainwindow.cpp | 13 ++++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7773cb7..c571682 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,11 @@ qmake RepRaptor.pro make ``` +And if you want to install system-wide +``` +sudo make install +``` + ## Links - [Binary release downloads (Windows, Linux)](https://github.com/NeoTheFox/RepRaptor/releases) - [RepRap wiki](http://reprap.org/wiki/RepRaptor) diff --git a/main.cpp b/main.cpp index 71e10c1..e91ad25 100644 --- a/main.cpp +++ b/main.cpp @@ -5,10 +5,12 @@ int main(int argc, char *argv[]) { QApplication a(argc, argv); + //Set some props in order to fetch and save QSettings QCoreApplication::setOrganizationName("NeoTheFox"); QCoreApplication::setOrganizationDomain("https://github.com/NeoTheFox"); QCoreApplication::setApplicationName("RepRaptor"); + //Set the priority, so the OS would not mess up serial communication QThread::currentThread()->setPriority(QThread::HighestPriority); MainWindow w; diff --git a/mainwindow.cpp b/mainwindow.cpp index 6432271..2364dc8 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -38,13 +38,24 @@ MainWindow::MainWindow(QWidget *parent) : ui->baudbox->addItem(QString::number(500000)); //Create objects + //Timers need parent to be set up + //in order to be tied to its thread + //and stop right statusTimer = new QTimer(this); progressSDTimer = new QTimer(this); + //QElapsedTimers have no parents sinceLastTemp = new QElapsedTimer(); sinceLastSDStatus = new QElapsedTimer(); + //Workers would be moved to ther thread, + //so we should not set their parents. Instead, + //we should connect QThread's finished() to + //worker's deleteLater() parserWorker = new Parser(); - parserThread = new QThread(this); senderWorker = new Sender(); + //Setting the parent of QThread lets + //threads to stop right, and also makes + //them inherit parent's priority + parserThread = new QThread(this); senderThread = new QThread(this); //Restore settings