diff --git a/app/gui/oven_control/configmastervolumedlg.cpp b/app/gui/oven_control/configmastervolumedlg.cpp index c5e2dec..86206e3 100644 --- a/app/gui/oven_control/configmastervolumedlg.cpp +++ b/app/gui/oven_control/configmastervolumedlg.cpp @@ -17,7 +17,7 @@ ConfigMasterVolumeDlg::ConfigMasterVolumeDlg(QWidget *parent) : this->setAttribute( Qt::WA_DeleteOnClose); item = cfg->getConfigValue(config_marster_vol); - m_nCurMasterVol = item.d32; + m_nPrevMasterVol = m_nCurMasterVol = item.d32; ui->ctrProgressLight->setMaxProgress(m_nCurMasterVol,MAX_MASTER_VOL); } @@ -28,26 +28,34 @@ ConfigMasterVolumeDlg::~ConfigMasterVolumeDlg() void ConfigMasterVolumeDlg::on_ctrBtnOk_clicked() { - Config* cfg = Config::getInstance(); - config_item item; - item.d32 = m_nCurMasterVol; - cfg->setConfigValue(config_marster_vol,item); accept(); } void ConfigMasterVolumeDlg::on_ctrBtnCancel_clicked() { + Config* cfg = Config::getInstance(); + config_item item; + item.d32 = m_nPrevMasterVol; + cfg->setConfigValue(config_marster_vol,item); reject(); } void ConfigMasterVolumeDlg::on_ctrBtnMinus_clicked() { + Config* cfg = Config::getInstance(); + config_item item; m_nCurMasterVol = m_nCurMasterVol > 0?m_nCurMasterVol-1:0; + item.d32 = m_nCurMasterVol; + cfg->setConfigValue(config_marster_vol,item); ui->ctrProgressLight->setCurrentProgress(m_nCurMasterVol); } void ConfigMasterVolumeDlg::on_ctrBtnPlus_clicked() { + Config* cfg = Config::getInstance(); + config_item item; m_nCurMasterVol = m_nCurMasterVolsetConfigValue(config_marster_vol,item); ui->ctrProgressLight->setCurrentProgress(m_nCurMasterVol); } diff --git a/app/gui/oven_control/configmastervolumedlg.h b/app/gui/oven_control/configmastervolumedlg.h index 6be6244..29959b0 100644 --- a/app/gui/oven_control/configmastervolumedlg.h +++ b/app/gui/oven_control/configmastervolumedlg.h @@ -27,6 +27,7 @@ private slots: private: Ui::ConfigMasterVolumeDlg *ui; int m_nCurMasterVol; + int m_nPrevMasterVol; }; #endif // CONFIGMASTERVOLUMEDLG_H