Update settings on change

This commit is contained in:
NeoTheFox 2015-03-22 14:42:25 +03:00
parent 2e24c28bbf
commit ec902e01b6
4 changed files with 20 additions and 0 deletions

View File

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

View File

@ -82,6 +82,7 @@ private slots:
void open();
void serialconnect();
void serialupdate();
void updatesettings();
void readSerial(QByteArray data);
void printMsg(QString text);
void checkStatus();

View File

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

View File

@ -27,6 +27,10 @@ private slots:
private:
Ui::SettingsWindow *ui;
signals:
void updatesettings();
};
#endif // SETTINGSWINDOW_H