From 172215b3cb10e42a6300b4f968867576d2824fea Mon Sep 17 00:00:00 2001 From: NeoTheFox Date: Mon, 9 Mar 2015 16:03:18 +0300 Subject: [PATCH] Cleanup --- RepRaptor.pro | 1 - mainwindow.cpp | 17 ++++++----------- mainwindow.h | 1 - settingswindow.cpp | 37 +++++++++++++------------------------ 4 files changed, 19 insertions(+), 37 deletions(-) diff --git a/RepRaptor.pro b/RepRaptor.pro index 8fa61af..5eef322 100644 --- a/RepRaptor.pro +++ b/RepRaptor.pro @@ -13,7 +13,6 @@ TARGET = RepRaptor TEMPLATE = app CONFIG += static - SOURCES += main.cpp\ mainwindow.cpp \ settingswindow.cpp \ diff --git a/mainwindow.cpp b/mainwindow.cpp index c49f782..54e9f7a 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -41,15 +41,13 @@ MainWindow::MainWindow(QWidget *parent) : ui->etmpspin->setValue(settings.value("user/extrudertemp").toInt()); ui->btmpspin->setValue(settings.value("user/bedtemp").toInt()); - if(!firstrun) echo = settings.value("core/echo").toBool(); - else echo = false; + echo = settings.value("core/echo", 0).toBool(); autolock = settings.value("core/lockcontrols").toBool(); sendingChecksum = settings.value("core/checksums").toBool(); chekingSDStatus = settings.value("core/checksdstatus").toBool(); - if(firstrun) firmware = OtherFirmware; - else firmware = settings.value("printer/firmware").toInt(); + firmware = settings.value("printer/firmware", OtherFirmware).toInt(); sending = false; paused = false; @@ -90,18 +88,15 @@ MainWindow::MainWindow(QWidget *parent) : connect(parser, &Parser::recievedSDUpdate, this, &MainWindow::updateSDStatus); parserThread->start(); - if(settings.value("core/statusinterval").toInt()) statusTimer.setInterval(settings.value("core/statusinterval").toInt()); - else statusTimer.setInterval(3000); + statusTimer.setInterval(settings.value("core/statusinterval", 3000).toInt()); statusTimer.start(); - if(settings.value("core/senderinterval").toInt()) sendTimer.setInterval(settings.value("core/senderinterval").toInt()); - else sendTimer.setInterval(5); + sendTimer.setInterval(settings.value("core/senderinterval", 2).toInt()); sendTimer.start(); - progressSDTimer.setInterval(2000); - if(chekingSDStatus)progressSDTimer.start(); + progressSDTimer.setInterval(2100); - tempWarning.setInterval(10000); + if(chekingSDStatus) progressSDTimer.start(); sinceLastTemp.start(); diff --git a/mainwindow.h b/mainwindow.h index 4507878..55a4b33 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -46,7 +46,6 @@ protected: QTimer sendTimer; QTimer progressSDTimer; QTimer statusTimer; - QTimer tempWarning; QElapsedTimer sinceLastTemp; QSettings settings; QStringList recentFiles; diff --git a/settingswindow.cpp b/settingswindow.cpp index 01d6d51..2033f62 100644 --- a/settingswindow.cpp +++ b/settingswindow.cpp @@ -7,33 +7,22 @@ SettingsWindow::SettingsWindow(QWidget *parent) : { ui->setupUi(this); - bool firstrun = !settings.value("core/firstrun").toBool(); //firstrun is inverted! + //bool firstrun = !settings.value("core/firstrun").toBool(); //firstrun is inverted! - if(firstrun) ui->senderbox->setValue(4); - else ui->senderbox->setValue(settings.value("core/senderinterval").toFloat()); + ui->senderbox->setValue(settings.value("core/senderinterval", 2).toFloat()); + ui->echobox->setChecked(settings.value("core/echo", 0).toBool()); + ui->statusbox->setValue(settings.value("core/statusinterval", 2000).toInt()); + ui->bedxbox->setValue(settings.value("printer/bedx", 200).toInt()); + ui->bedybox->setValue(settings.value("printer/bedy", 200).toInt()); + ui->lockbox->setChecked(settings.value("core/lockcontrols", 0).toBool()); + ui->checksumbox->setChecked(settings.value("core/checksums", 0).toBool()); + ui->sdbox->setChecked(settings.value("core/checksdstatus", 1).toBool()); - if(firstrun) ui->echobox->setChecked(false); - else ui->echobox->setChecked(settings.value("core/echo").toBool()); + ui->firmwarecombo->addItem("Marlin"); //0 + ui->firmwarecombo->addItem("Repetier"); //1 + ui->firmwarecombo->addItem("Other"); //2 - if(settings.value("core/statusinterval").toInt()) ui->statusbox->setValue(settings.value("core/statusinterval").toInt()); - else ui->statusbox->setValue(1500); - - if(settings.value("printer/bedx").toInt()) ui->bedxbox->setValue(settings.value("printer/bedx").toInt()); - else ui->bedxbox->setValue(200); - - if(settings.value("printer/bedy").toInt()) ui->bedybox->setValue(settings.value("printer/bedy").toInt()); - else ui->bedybox->setValue(200); - - ui->lockbox->setChecked(settings.value("core/lockcontrols").toBool()); - ui->checksumbox->setChecked(settings.value("core/checksums").toBool()); - ui->sdbox->setChecked(settings.value("core/checksdstatus").toBool()); - - ui->firmwarecombo->addItem("Marlin"); - ui->firmwarecombo->addItem("Repetier"); - ui->firmwarecombo->addItem("Other"); - - if(firstrun) ui->firmwarecombo->setCurrentIndex(OtherFirmware); - else ui->firmwarecombo->setCurrentIndex(settings.value("printer/firmware").toInt()); + ui->firmwarecombo->setCurrentIndex(settings.value("printer/firmware", OtherFirmware).toInt()); #ifdef QT_DEBUG ui->checksumbox->setEnabled(true);