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
CONFIG += static
SOURCES += main.cpp\
mainwindow.cpp \
settingswindow.cpp \

View File

@ -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();

View File

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

View File

@ -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);