#include "configmastervolumedlg.h" #include "ui_configmastervolumedlg.h" #include "soundplayer.h" using namespace Define; #define MAX_VOL 7 ConfigVolumeDlg::ConfigVolumeDlg(QWidget *parent, ConfigType type) : 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); if(type == config_keypad_sound2){ ui->ctrLbTitle->setText(tr("키패드 볼륨")); } m_cfgType = type; item = cfg->getConfigValue(m_cfgType); m_nPrevVol = m_nCurVol = item.d32; ui->ctrProgressLight->setMaxProgress(m_nCurVol,MAX_VOL); } ConfigVolumeDlg::~ConfigVolumeDlg() { delete ui; } void ConfigVolumeDlg::on_ctrBtnOk_clicked() { accept(); } void ConfigVolumeDlg::on_ctrBtnCancel_clicked() { Config* cfg = Config::getInstance(); config_item item; item.d32 = m_nPrevVol; cfg->setConfigValue(m_cfgType,item); reject(); } void ConfigVolumeDlg::on_ctrBtnMinus_clicked() { Config* cfg = Config::getInstance(); config_item item; m_nCurVol = m_nCurVol > 0?m_nCurVol-1:0; item.d32 = m_nCurVol; cfg->setConfigValue(m_cfgType,item); ui->ctrProgressLight->setCurrentProgress(m_nCurVol); SoundPlayer::playClick(); } void ConfigVolumeDlg::on_ctrBtnPlus_clicked() { Config* cfg = Config::getInstance(); config_item item; m_nCurVol = m_nCurVolsetConfigValue(m_cfgType,item); ui->ctrProgressLight->setCurrentProgress(m_nCurVol); SoundPlayer::playClick(); }