configmastervolumedlg.cpp
1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#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);
foreach (QPushButton *button, findChildren<QPushButton *>())
connect(button, &QPushButton::pressed, SoundPlayer::playClick);
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_nCurVol<MAX_VOL?m_nCurVol+1:MAX_VOL;
item.d32 = m_nCurVol;
cfg->setConfigValue(m_cfgType,item);
ui->ctrProgressLight->setCurrentProgress(m_nCurVol);
SoundPlayer::playClick();
}