summaryrefslogtreecommitdiff
path: root/core/applets/volumeapplet/volume.cpp
authorllornkcor <llornkcor>2002-05-23 02:03:12 (UTC)
committer llornkcor <llornkcor>2002-05-23 02:03:12 (UTC)
commitd295491048567c8424643b983a21dc503857d91a (patch) (unidiff)
tree54cc32b49eef8518ffbeeacb99ffcbb35ec60769 /core/applets/volumeapplet/volume.cpp
parent7cec3bc3d3b8945e80c9171b9173d3d2dbdd2eaf (diff)
downloadopie-d295491048567c8424643b983a21dc503857d91a.zip
opie-d295491048567c8424643b983a21dc503857d91a.tar.gz
opie-d295491048567c8424643b983a21dc503857d91a.tar.bz2
new sound config
Diffstat (limited to 'core/applets/volumeapplet/volume.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/volumeapplet/volume.cpp168
1 files changed, 116 insertions, 52 deletions
diff --git a/core/applets/volumeapplet/volume.cpp b/core/applets/volumeapplet/volume.cpp
index e393f0f..e8921f0 100644
--- a/core/applets/volumeapplet/volume.cpp
+++ b/core/applets/volumeapplet/volume.cpp
@@ -54,4 +54,4 @@ void VolumeControl::createView(bool showMic)
54{ 54{
55 Config cfg("Sound"); 55 Config cfg("qpe");
56 cfg.setGroup("System"); 56 cfg.setGroup("Volume");
57//showMic = TRUE; 57//showMic = TRUE;
@@ -69,2 +69,5 @@ void VolumeControl::createView(bool showMic)
69 vboxButtons->setSpacing( 2 ); 69 vboxButtons->setSpacing( 2 );
70
71 upButton->setFixedHeight(26);
72 downButton->setFixedHeight(26);
70 73
@@ -81,3 +84,3 @@ void VolumeControl::createView(bool showMic)
81 slider->setFocusPolicy( QWidget::NoFocus ); 84 slider->setFocusPolicy( QWidget::NoFocus );
82 slider->setValue(cfg.readNumEntry("Volume")); 85 slider->setValue(cfg.readNumEntry("VolumePercent"));
83 86
@@ -89,22 +92,22 @@ void VolumeControl::createView(bool showMic)
89 92
90 if (showMic == TRUE) { 93// if (showMic == TRUE) {
91 mic = new QSlider(this); 94 mic = new QSlider(this);
92 mic->setRange( 0, 100 ); 95 mic->setRange( 0, 100 );
93 mic->setTickmarks( QSlider::Both ); 96 mic->setTickmarks( QSlider::Both );
94 mic->setTickInterval( 20 ); 97 mic->setTickInterval( 20 );
95 mic->setFocusPolicy( QWidget::NoFocus ); 98 mic->setFocusPolicy( QWidget::NoFocus );
96 mic->setValue(cfg.readNumEntry("Mic")); 99 mic->setValue(cfg.readNumEntry("Mic"));
97 100
98 QVBoxLayout *mbox = new QVBoxLayout(this); 101 QVBoxLayout *mbox = new QVBoxLayout(this);
99 mbox->setMargin( 3 ); 102 mbox->setMargin( 3 );
100 mbox->setSpacing( 3 ); 103 mbox->setSpacing( 3 );
101 mbox->addWidget( new QLabel("Mic", this) , 0, Qt::AlignVCenter | Qt::AlignHCenter ); 104 mbox->addWidget( new QLabel("Mic", this) , 0, Qt::AlignVCenter | Qt::AlignHCenter );
102 mbox->addWidget( mic, 0, Qt::AlignVCenter | Qt::AlignHCenter ); 105 mbox->addWidget( mic, 0, Qt::AlignVCenter | Qt::AlignHCenter );
103 106
104 hbox = new QHBoxLayout( this ); 107 hbox = new QHBoxLayout( this );
105 hbox->setMargin( 3 ); 108 hbox->setMargin( 3 );
106 hbox->setSpacing( 3 ); 109 hbox->setSpacing( 3 );
107 hbox->addLayout( sbox, 1); 110 hbox->addLayout( sbox, 1);
108 hbox->addLayout( mbox, 1); 111 hbox->addLayout( mbox, 1);
109 } 112 // }
110 113
@@ -112,9 +115,35 @@ void VolumeControl::createView(bool showMic)
112 muteBox->setFocusPolicy( QWidget::NoFocus ); 115 muteBox->setFocusPolicy( QWidget::NoFocus );
113 116
117 QVBoxLayout *klbox = new QVBoxLayout(this);
118
119 QLabel *Label1;
120 Label1 = new QLabel( this, "Label1" );
121 Label1->setText( tr( "Enable Sounds for:" ));
122
123 alarmSound = new QCheckBox( tr("Alarm Sound"), this );
124 alarmSound->setFocusPolicy( QWidget::NoFocus );
125
126 keyclicks = new QCheckBox( tr("Key Clicks"), this );
127 keyclicks->setFocusPolicy( QWidget::NoFocus );
128
129 screentaps = new QCheckBox( tr("Screen taps"), this );
130 screentaps->setFocusPolicy( QWidget::NoFocus );
131
132
133 keyclicks->setChecked( cfg.readBoolEntry("KeySound",0));
134 screentaps->setChecked( cfg.readBoolEntry("TouchSound",0));
135 alarmSound->setChecked( cfg.readBoolEntry("AlarmSound",1));
136
137 klbox->setMargin( 3 );
138 klbox->setSpacing( 0 );
139 klbox->addWidget( Label1, 1);
140 klbox->addWidget( alarmSound, 1);
141 klbox->addWidget( keyclicks, 1);
142 klbox->addWidget( screentaps, 1);
114 vbox->setMargin( 3 ); 143 vbox->setMargin( 3 );
115 vbox->setSpacing( 0 ); 144 vbox->setSpacing( 0 );
116 if (showMic == TRUE) 145// if (showMic == TRUE)
117 vbox->addLayout( hbox, 1 ); 146 vbox->addLayout( hbox, 1 );
118 else 147// else
119 vbox->addLayout( sbox, 1); 148// vbox->addLayout( sbox, 1);
120 vbox->addWidget( muteBox, 0, Qt::AlignVCenter | Qt::AlignHCenter ); 149 vbox->addWidget( muteBox, 0, Qt::AlignVCenter | Qt::AlignHCenter );
@@ -122,6 +151,8 @@ void VolumeControl::createView(bool showMic)
122 hboxLayout->addLayout( vboxButtons ); 151 hboxLayout->addLayout( vboxButtons );
123 hboxLayout->addLayout(vbox); 152 hboxLayout->addLayout( vbox);
153 hboxLayout->addLayout( klbox);
124 154
125 setFixedHeight( 120 ); 155
126 setFixedWidth( sizeHint().width() ); 156 setFixedHeight( 120);
157// setFixedWidth( sizeHint().width() );
127 setFocusPolicy(QWidget::NoFocus); 158 setFocusPolicy(QWidget::NoFocus);
@@ -181,4 +212,4 @@ VolumeApplet::VolumeApplet( QWidget *parent, const char *name )
181{ 212{
182 Config cfg("Sound"); 213 Config cfg("qpe");
183 cfg.setGroup("System"); 214 cfg.setGroup("Volume");
184 215
@@ -189,3 +220,3 @@ VolumeApplet::VolumeApplet( QWidget *parent, const char *name )
189 220
190 volumePercent = cfg.readNumEntry("Volume",50); 221 volumePercent = cfg.readNumEntry("VolumePercent",50);
191 micPercent = cfg.readNumEntry("Mic", 50); 222 micPercent = cfg.readNumEntry("Mic", 50);
@@ -231,8 +262,7 @@ void VolumeApplet::showVolControl(bool showMic)
231{ 262{
232 Config cfg("Sound"); 263 Config cfg("qpe");
233 cfg.setGroup("System"); 264 cfg.setGroup("Volume");
234 volumePercent = cfg.readNumEntry("Volume",50); 265 volumePercent = cfg.readNumEntry("VolumePercent",50);
235 micPercent = cfg.readNumEntry("Mic", 50); 266 micPercent = cfg.readNumEntry("Mic", 50);
236 QString show = cfg.readEntry("ShowMic", "FALSE"); 267
237 if(show == "TRUE") showMic = TRUE;
238 // Create a small volume control window to adjust the volume with 268 // Create a small volume control window to adjust the volume with
@@ -240,7 +270,7 @@ void VolumeApplet::showVolControl(bool showMic)
240 vc->slider->setValue( 100 - volumePercent ); 270 vc->slider->setValue( 100 - volumePercent );
241 if (showMic) 271// if (showMic)
242 { 272// {
243 vc->mic->setValue( 100 - micPercent ); 273 vc->mic->setValue( 100 - micPercent );
244 connect( vc->mic, SIGNAL( valueChanged( int ) ), this, SLOT( micMoved( int ) ) ); 274 connect( vc->mic, SIGNAL( valueChanged( int ) ), this, SLOT( micMoved( int ) ) );
245 } 275// }
246 276
@@ -249,4 +279,16 @@ void VolumeApplet::showVolControl(bool showMic)
249 connect( vc->muteBox, SIGNAL( toggled( bool ) ), this, SLOT( mute( bool ) ) ); 279 connect( vc->muteBox, SIGNAL( toggled( bool ) ), this, SLOT( mute( bool ) ) );
280
281 Config config("qpe");
282 config.setGroup("Volume");
283
284 vc->keyclicks->setChecked( config.readBoolEntry("KeySound",0));
285 vc->screentaps->setChecked( config.readBoolEntry("TouchSound",0));
286 vc->alarmSound->setChecked( config.readBoolEntry("AlarmSound",1));
287
288 connect( vc->alarmSound, SIGNAL(toggled(bool)), this, SLOT( alarmSoundCheckToggled(bool)));
289 connect( vc->keyclicks, SIGNAL(toggled(bool)), this, SLOT( keyclicksCheckToggled(bool)));
290 connect( vc->screentaps, SIGNAL(toggled(bool)), this, SLOT( screentapsCheckToggled(bool)));
291
250 QPoint curPos = mapToGlobal( rect().topLeft() ); 292 QPoint curPos = mapToGlobal( rect().topLeft() );
251 vc->move( curPos.x()-(vc->sizeHint().width()-width())/2, curPos.y() - 120 ); 293 vc->move( curPos.x()-(vc->sizeHint().width()/2+50), curPos.y() - 120 );
252 vc->show(); 294 vc->show();
@@ -304,5 +346,5 @@ void VolumeApplet::readSystemVolume()
304{ 346{
305 Config cfg("Sound"); 347 Config cfg("qpe");
306 cfg.setGroup("System"); 348 cfg.setGroup("Volume");
307 volumePercent = cfg.readNumEntry("Volume"); 349 volumePercent = cfg.readNumEntry("VolumePercent");
308} 350}
@@ -311,4 +353,4 @@ void VolumeApplet::readSystemMic()
311{ 353{
312 Config cfg("Sound"); 354 Config cfg("qpe");
313 cfg.setGroup("System"); 355 cfg.setGroup("Volume");
314 micPercent = cfg.readNumEntry("Mic"); 356 micPercent = cfg.readNumEntry("Mic");
@@ -335,5 +377,5 @@ void VolumeApplet::writeSystemVolume()
335 { 377 {
336 Config cfg("Sound"); 378 Config cfg("qpe");
337 cfg.setGroup("System"); 379 cfg.setGroup("Volume");
338 cfg.writeEntry("Volume",volumePercent); 380 cfg.writeEntry("VolumePercent",volumePercent);
339 } 381 }
@@ -348,4 +390,4 @@ void VolumeApplet::writeSystemMic()
348 { 390 {
349 Config cfg("Sound"); 391 Config cfg("qpe");
350 cfg.setGroup("System"); 392 cfg.setGroup("Volume");
351 cfg.writeEntry("Mic",micPercent); 393 cfg.writeEntry("Mic",micPercent);
@@ -380 +422,23 @@ void VolumeApplet::paintEvent( QPaintEvent* )
380} 422}
423
424void VolumeApplet::screentapsCheckToggled(bool b) {
425 Config cfg("qpe");
426 cfg.setGroup("Volume");
427 cfg.writeEntry("TouchSound",b );
428 cfg.write();
429}
430
431void VolumeApplet::keyclicksCheckToggled(bool b) {
432 Config cfg("qpe");
433 cfg.setGroup("Volume");
434 cfg.writeEntry("KeySound",b);
435 cfg.write();
436}
437
438void VolumeApplet::alarmSoundCheckToggled(bool b) {
439 Config cfg("qpe");
440 cfg.setGroup("Volume");
441 cfg.writeEntry("AlarmSound",b);
442 cfg.write();
443}
444