This commit is contained in:
NeoTheFox 2015-03-09 16:03:18 +03:00
parent 32cece30fb
commit 172215b3cb
4 changed files with 19 additions and 37 deletions

View File

@ -13,7 +13,6 @@ TARGET = RepRaptor
TEMPLATE = app TEMPLATE = app
CONFIG += static CONFIG += static
SOURCES += main.cpp\ SOURCES += main.cpp\
mainwindow.cpp \ mainwindow.cpp \
settingswindow.cpp \ settingswindow.cpp \

View File

@ -41,15 +41,13 @@ MainWindow::MainWindow(QWidget *parent) :
ui->etmpspin->setValue(settings.value("user/extrudertemp").toInt()); ui->etmpspin->setValue(settings.value("user/extrudertemp").toInt());
ui->btmpspin->setValue(settings.value("user/bedtemp").toInt()); ui->btmpspin->setValue(settings.value("user/bedtemp").toInt());
if(!firstrun) echo = settings.value("core/echo").toBool(); echo = settings.value("core/echo", 0).toBool();
else echo = false;
autolock = settings.value("core/lockcontrols").toBool(); autolock = settings.value("core/lockcontrols").toBool();
sendingChecksum = settings.value("core/checksums").toBool(); sendingChecksum = settings.value("core/checksums").toBool();
chekingSDStatus = settings.value("core/checksdstatus").toBool(); chekingSDStatus = settings.value("core/checksdstatus").toBool();
if(firstrun) firmware = OtherFirmware; firmware = settings.value("printer/firmware", OtherFirmware).toInt();
else firmware = settings.value("printer/firmware").toInt();
sending = false; sending = false;
paused = false; paused = false;
@ -90,18 +88,15 @@ MainWindow::MainWindow(QWidget *parent) :
connect(parser, &Parser::recievedSDUpdate, this, &MainWindow::updateSDStatus); connect(parser, &Parser::recievedSDUpdate, this, &MainWindow::updateSDStatus);
parserThread->start(); parserThread->start();
if(settings.value("core/statusinterval").toInt()) statusTimer.setInterval(settings.value("core/statusinterval").toInt()); statusTimer.setInterval(settings.value("core/statusinterval", 3000).toInt());
else statusTimer.setInterval(3000);
statusTimer.start(); statusTimer.start();
if(settings.value("core/senderinterval").toInt()) sendTimer.setInterval(settings.value("core/senderinterval").toInt()); sendTimer.setInterval(settings.value("core/senderinterval", 2).toInt());
else sendTimer.setInterval(5);
sendTimer.start(); sendTimer.start();
progressSDTimer.setInterval(2000); progressSDTimer.setInterval(2100);
if(chekingSDStatus)progressSDTimer.start();
tempWarning.setInterval(10000); if(chekingSDStatus) progressSDTimer.start();
sinceLastTemp.start(); sinceLastTemp.start();

View File

@ -46,7 +46,6 @@ protected:
QTimer sendTimer; QTimer sendTimer;
QTimer progressSDTimer; QTimer progressSDTimer;
QTimer statusTimer; QTimer statusTimer;
QTimer tempWarning;
QElapsedTimer sinceLastTemp; QElapsedTimer sinceLastTemp;
QSettings settings; QSettings settings;
QStringList recentFiles; QStringList recentFiles;

View File

@ -7,33 +7,22 @@ SettingsWindow::SettingsWindow(QWidget *parent) :
{ {
ui->setupUi(this); 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); ui->senderbox->setValue(settings.value("core/senderinterval", 2).toFloat());
else ui->senderbox->setValue(settings.value("core/senderinterval").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); ui->firmwarecombo->addItem("Marlin"); //0
else ui->echobox->setChecked(settings.value("core/echo").toBool()); ui->firmwarecombo->addItem("Repetier"); //1
ui->firmwarecombo->addItem("Other"); //2
if(settings.value("core/statusinterval").toInt()) ui->statusbox->setValue(settings.value("core/statusinterval").toInt()); ui->firmwarecombo->setCurrentIndex(settings.value("printer/firmware", OtherFirmware).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());
#ifdef QT_DEBUG #ifdef QT_DEBUG
ui->checksumbox->setEnabled(true); ui->checksumbox->setEnabled(true);