#include "config.h" #include "configmastervolumedlg.h" #include "ui_configmastervolumedlg.h" #include "soundplayer.h" using namespace Define; #define MAX_MASTER_VOL 7 ConfigMasterVolumeDlg::ConfigMasterVolumeDlg(QWidget *parent) : QDialog(parent), ui(new Ui::ConfigMasterVolumeDlg) { Config* cfg = Config::getInstance(); config_item item; ui->setupUi(this); this->setWindowFlags( Qt::FramelessWindowHint); this->setAttribute( Qt::WA_DeleteOnClose); item = cfg->getConfigValue(config_marster_vol); m_nPrevMasterVol = m_nCurMasterVol = item.d32; ui->ctrProgressLight->setMaxProgress(m_nCurMasterVol,MAX_MASTER_VOL); } ConfigMasterVolumeDlg::~ConfigMasterVolumeDlg() { delete ui; } void ConfigMasterVolumeDlg::on_ctrBtnOk_clicked() { 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); SoundPlayer::playClick(); } 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); SoundPlayer::playClick(); }