From ec902e01b6c23a225657e4dbe3129bad262bda9a Mon Sep 17 00:00:00 2001 From: NeoTheFox Date: Sun, 22 Mar 2015 14:42:25 +0300 Subject: [PATCH] Update settings on change --- mainwindow.cpp | 13 +++++++++++++ mainwindow.h | 1 + settingswindow.cpp | 2 ++ settingswindow.h | 4 ++++ 4 files changed, 20 insertions(+) diff --git a/mainwindow.cpp b/mainwindow.cpp index c67f07f..47c1b40 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -553,6 +553,8 @@ void MainWindow::on_actionSettings_triggered() { SettingsWindow settingswindow(this); + connect(&settingswindow, &SettingsWindow::updatesettings, this, &MainWindow::updatesettings); + settingswindow.exec(); } @@ -882,6 +884,17 @@ void MainWindow::baudrateSetFailed(int b) errorwindow.show(); } +void MainWindow::updatesettings() +{ + echo = settings.value("core/echo", 0).toBool(); + autolock = settings.value("core/lockcontrols", 0).toBool(); + chekingSDStatus = settings.value("core/checksdstatus", 1).toBool(); + firmware = settings.value("printer/firmware", OtherFirmware).toInt(); + statusTimer->setInterval(settings.value("core/statusinterval", 3000).toInt()); + feedrate = settings.value("feedrate", 1500).toInt(); + extruderFeedrate = settings.value("extruderfeedrate", 200).toInt(); +} + //Needed for keypress handling bool MainWindow::eventFilter(QObject *obj, QEvent *event) { diff --git a/mainwindow.h b/mainwindow.h index bb7a2ca..fc3c1da 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -82,6 +82,7 @@ private slots: void open(); void serialconnect(); void serialupdate(); + void updatesettings(); void readSerial(QByteArray data); void printMsg(QString text); void checkStatus(); diff --git a/settingswindow.cpp b/settingswindow.cpp index 74e26dd..79dd40a 100644 --- a/settingswindow.cpp +++ b/settingswindow.cpp @@ -59,4 +59,6 @@ void SettingsWindow::on_buttonBox_accepted() settings.setValue("core/checksdstatus", ui->sdbox->isChecked()); settings.setValue("core/dtr", ui->dtrbox->isChecked()); settings.setValue("printer/firmware", ui->firmwarecombo->currentIndex()); + + emit updatesettings(); } diff --git a/settingswindow.h b/settingswindow.h index 4dd6dba..ad03d5e 100644 --- a/settingswindow.h +++ b/settingswindow.h @@ -27,6 +27,10 @@ private slots: private: Ui::SettingsWindow *ui; + +signals: + void updatesettings(); + }; #endif // SETTINGSWINDOW_H