-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 14 | ||||
-rw-r--r-- | core/applets/volumeapplet/volume.cpp | 168 | ||||
-rw-r--r-- | core/applets/volumeapplet/volume.h | 9 |
3 files changed, 130 insertions, 61 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index c27050d..7cc4062 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp | |||
@@ -264,17 +264,17 @@ void VMemo::mouseReleaseEvent( QMouseEvent * ) | |||
264 | { | 264 | { |
265 | stopRecording(); | 265 | stopRecording(); |
266 | } | 266 | } |
267 | 267 | ||
268 | bool VMemo::startRecording() { | 268 | bool VMemo::startRecording() { |
269 | 269 | ||
270 | if ( recording) | 270 | if ( recording) |
271 | return FALSE;; | 271 | return FALSE;; |
272 | Config config( "Sound" ); | 272 | Config config( "Vmemo" ); |
273 | config.setGroup( "System" ); | 273 | config.setGroup( "System" ); |
274 | useAlerts = config.readBoolEntry("Alert"); | 274 | useAlerts = config.readBoolEntry("Alert"); |
275 | 275 | ||
276 | // if(useAlerts) | 276 | // if(useAlerts) |
277 | // QMessageBox::message("VMemo","Really Record?");//) ==1) | 277 | // QMessageBox::message("VMemo","Really Record?");//) ==1) |
278 | // return; | 278 | // return; |
279 | // } else { | 279 | // } else { |
280 | if (!systemZaurus ) | 280 | if (!systemZaurus ) |
@@ -283,26 +283,24 @@ bool VMemo::startRecording() { | |||
283 | qDebug("Start recording"); | 283 | qDebug("Start recording"); |
284 | recording = TRUE; | 284 | recording = TRUE; |
285 | if (openDSP() == -1) { | 285 | if (openDSP() == -1) { |
286 | QMessageBox::critical(0, "VMemo", "Could not open dsp device.\n"+errorMsg, "Abort"); | 286 | QMessageBox::critical(0, "VMemo", "Could not open dsp device.\n"+errorMsg, "Abort"); |
287 | recording = FALSE; | 287 | recording = FALSE; |
288 | return FALSE; | 288 | return FALSE; |
289 | } | 289 | } |
290 | 290 | ||
291 | Config vmCfg("VMemo"); | 291 | config.setGroup("Defaults"); |
292 | vmCfg.setGroup("Defaults"); | ||
293 | 292 | ||
294 | QDateTime dt = QDateTime::currentDateTime(); | 293 | QDateTime dt = QDateTime::currentDateTime(); |
295 | 294 | ||
296 | QString fName; | 295 | QString fName; |
297 | Config cfg( "Sound" ); | 296 | config.setGroup( "System" ); |
298 | cfg.setGroup( "System" ); | ||
299 | fName = QPEApplication::documentDir() ; | 297 | fName = QPEApplication::documentDir() ; |
300 | fileName = cfg.readEntry("RecLocation", fName); | 298 | fileName = config.readEntry("RecLocation", fName); |
301 | 299 | ||
302 | int s; | 300 | int s; |
303 | s=fileName.find(':'); | 301 | s=fileName.find(':'); |
304 | if(s) | 302 | if(s) |
305 | fileName=fileName.right(fileName.length()-s-2); | 303 | fileName=fileName.right(fileName.length()-s-2); |
306 | qDebug("filename will be "+fileName); | 304 | qDebug("filename will be "+fileName); |
307 | if( fileName.right(1).find('/') == -1) | 305 | if( fileName.right(1).find('/') == -1) |
308 | fileName+="/"; | 306 | fileName+="/"; |
@@ -320,17 +318,17 @@ bool VMemo::startRecording() { | |||
320 | QString err("Could not open the output file\n"); | 318 | QString err("Could not open the output file\n"); |
321 | err += fileName; | 319 | err += fileName; |
322 | QMessageBox::critical(0, "VMemo", err, "Abort"); | 320 | QMessageBox::critical(0, "VMemo", err, "Abort"); |
323 | close(dsp); | 321 | close(dsp); |
324 | return FALSE; | 322 | return FALSE; |
325 | } | 323 | } |
326 | 324 | ||
327 | QArray<int> cats(1); | 325 | QArray<int> cats(1); |
328 | cats[0] = vmCfg.readNumEntry("Category", 0); | 326 | cats[0] = config.readNumEntry("Category", 0); |
329 | 327 | ||
330 | QString dlName("vm_"); | 328 | QString dlName("vm_"); |
331 | dlName += dt.toString(); | 329 | dlName += dt.toString(); |
332 | DocLnk l; | 330 | DocLnk l; |
333 | l.setFile(fileName); | 331 | l.setFile(fileName); |
334 | l.setName(dlName); | 332 | l.setName(dlName); |
335 | l.setType("audio/x-wav"); | 333 | l.setType("audio/x-wav"); |
336 | l.setCategories(cats); | 334 | l.setCategories(cats); |
@@ -341,17 +339,17 @@ bool VMemo::startRecording() { | |||
341 | } | 339 | } |
342 | 340 | ||
343 | void VMemo::stopRecording() { | 341 | void VMemo::stopRecording() { |
344 | recording = FALSE; | 342 | recording = FALSE; |
345 | } | 343 | } |
346 | 344 | ||
347 | int VMemo::openDSP() | 345 | int VMemo::openDSP() |
348 | { | 346 | { |
349 | Config cfg("Sound"); | 347 | Config cfg("Vmemo"); |
350 | cfg.setGroup("Record"); | 348 | cfg.setGroup("Record"); |
351 | 349 | ||
352 | speed = cfg.readNumEntry("SampleRate", 22050); | 350 | speed = cfg.readNumEntry("SampleRate", 22050); |
353 | channels = cfg.readNumEntry("Stereo", 1) ? 2 : 1; // 1 = stereo(2), 0 = mono(1) | 351 | channels = cfg.readNumEntry("Stereo", 1) ? 2 : 1; // 1 = stereo(2), 0 = mono(1) |
354 | if (cfg.readNumEntry("SixteenBit", 1)==1) { | 352 | if (cfg.readNumEntry("SixteenBit", 1)==1) { |
355 | format = AFMT_S16_LE; | 353 | format = AFMT_S16_LE; |
356 | resolution = 16; | 354 | resolution = 16; |
357 | } else { | 355 | } else { |
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 | |||
@@ -47,88 +47,119 @@ VolumeControl::VolumeControl( bool showMic, QWidget *parent, const char *name ) | |||
47 | : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) | 47 | : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) |
48 | { | 48 | { |
49 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); | 49 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); |
50 | createView(showMic); | 50 | createView(showMic); |
51 | } | 51 | } |
52 | 52 | ||
53 | void VolumeControl::createView(bool showMic) | 53 | 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; |
58 | QHBoxLayout *hboxLayout = new QHBoxLayout(this); | 58 | QHBoxLayout *hboxLayout = new QHBoxLayout(this); |
59 | hboxLayout->setMargin( 3 ); | 59 | hboxLayout->setMargin( 3 ); |
60 | hboxLayout->setSpacing( 0); | 60 | hboxLayout->setSpacing( 0); |
61 | 61 | ||
62 | QVBoxLayout *vboxButtons = new QVBoxLayout(this); | 62 | QVBoxLayout *vboxButtons = new QVBoxLayout(this); |
63 | upButton = new QPushButton( this ); | 63 | upButton = new QPushButton( this ); |
64 | upButton->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) ); | 64 | upButton->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) ); |
65 | upButton->setPixmap( Resource::loadPixmap( "up" ) ); | 65 | upButton->setPixmap( Resource::loadPixmap( "up" ) ); |
66 | downButton = new QPushButton( this ); | 66 | downButton = new QPushButton( this ); |
67 | downButton->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) ); | 67 | downButton->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) ); |
68 | downButton->setPixmap( Resource::loadPixmap( "down" ) ); | 68 | downButton->setPixmap( Resource::loadPixmap( "down" ) ); |
69 | vboxButtons->setSpacing( 2 ); | 69 | vboxButtons->setSpacing( 2 ); |
70 | |||
71 | upButton->setFixedHeight(26); | ||
72 | downButton->setFixedHeight(26); | ||
70 | 73 | ||
71 | vboxButtons->addWidget( upButton ); | 74 | vboxButtons->addWidget( upButton ); |
72 | vboxButtons->addWidget( downButton ); | 75 | vboxButtons->addWidget( downButton ); |
73 | 76 | ||
74 | QVBoxLayout *vbox = new QVBoxLayout( this ); | 77 | QVBoxLayout *vbox = new QVBoxLayout( this ); |
75 | QHBoxLayout *hbox = NULL; | 78 | QHBoxLayout *hbox = NULL; |
76 | 79 | ||
77 | slider = new QSlider( this ); | 80 | slider = new QSlider( this ); |
78 | slider->setRange( 0, 100 ); | 81 | slider->setRange( 0, 100 ); |
79 | slider->setTickmarks( QSlider::Both ); | 82 | slider->setTickmarks( QSlider::Both ); |
80 | slider->setTickInterval( 20 ); | 83 | slider->setTickInterval( 20 ); |
81 | slider->setFocusPolicy( QWidget::NoFocus ); | 84 | slider->setFocusPolicy( QWidget::NoFocus ); |
82 | slider->setValue(cfg.readNumEntry("Volume")); | 85 | slider->setValue(cfg.readNumEntry("VolumePercent")); |
83 | 86 | ||
84 | QVBoxLayout *sbox = new QVBoxLayout(this); | 87 | QVBoxLayout *sbox = new QVBoxLayout(this); |
85 | sbox->setMargin( 3 ); | 88 | sbox->setMargin( 3 ); |
86 | sbox->setSpacing( 3 ); | 89 | sbox->setSpacing( 3 ); |
87 | sbox->addWidget( new QLabel("Vol", this) , 0, Qt::AlignVCenter | Qt::AlignHCenter ); | 90 | sbox->addWidget( new QLabel("Vol", this) , 0, Qt::AlignVCenter | Qt::AlignHCenter ); |
88 | sbox->addWidget( slider, 0, Qt::AlignVCenter | Qt::AlignHCenter ); | 91 | sbox->addWidget( slider, 0, Qt::AlignVCenter | Qt::AlignHCenter ); |
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 | ||
111 | muteBox = new QCheckBox( tr("Mute"), this ); | 114 | muteBox = new QCheckBox( tr("Mute"), this ); |
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 ); |
121 | 150 | ||
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); |
128 | connect( upButton, SIGNAL( pressed() ), this, SLOT( ButtonChanged() ) ); | 159 | connect( upButton, SIGNAL( pressed() ), this, SLOT( ButtonChanged() ) ); |
129 | connect( upButton, SIGNAL( released() ), this, SLOT( ButtonChanged() ) ); | 160 | connect( upButton, SIGNAL( released() ), this, SLOT( ButtonChanged() ) ); |
130 | connect( downButton, SIGNAL( pressed() ), this, SLOT( ButtonChanged() ) ); | 161 | connect( downButton, SIGNAL( pressed() ), this, SLOT( ButtonChanged() ) ); |
131 | connect( downButton, SIGNAL( released() ), this, SLOT( ButtonChanged() ) ); | 162 | connect( downButton, SIGNAL( released() ), this, SLOT( ButtonChanged() ) ); |
132 | 163 | ||
133 | rateTimer = new QTimer(this); | 164 | rateTimer = new QTimer(this); |
134 | connect( rateTimer, SIGNAL( timeout() ), this, SLOT( rateTimerDone() ) ); | 165 | connect( rateTimer, SIGNAL( timeout() ), this, SLOT( rateTimerDone() ) ); |
@@ -174,25 +205,25 @@ void VolumeControl::rateTimerDone() | |||
174 | slider->setValue( slider->value() + 2 ); | 205 | slider->setValue( slider->value() + 2 ); |
175 | } | 206 | } |
176 | 207 | ||
177 | //=========================================================================== | 208 | //=========================================================================== |
178 | 209 | ||
179 | VolumeApplet::VolumeApplet( QWidget *parent, const char *name ) | 210 | VolumeApplet::VolumeApplet( QWidget *parent, const char *name ) |
180 | : QWidget( parent, name ) | 211 | : QWidget( parent, name ) |
181 | { | 212 | { |
182 | Config cfg("Sound"); | 213 | Config cfg("qpe"); |
183 | cfg.setGroup("System"); | 214 | cfg.setGroup("Volume"); |
184 | 215 | ||
185 | setFixedHeight( 18 ); | 216 | setFixedHeight( 18 ); |
186 | setFixedWidth( 14 ); | 217 | setFixedWidth( 14 ); |
187 | 218 | ||
188 | volumePixmap = Resource::loadPixmap( "volume" ); | 219 | volumePixmap = Resource::loadPixmap( "volume" ); |
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); |
192 | muted = FALSE; // ### read from pref | 223 | muted = FALSE; // ### read from pref |
193 | micMuted = FALSE; // ### read from pref | 224 | micMuted = FALSE; // ### read from pref |
194 | 225 | ||
195 | advancedTimer = new QTimer(this); | 226 | advancedTimer = new QTimer(this); |
196 | 227 | ||
197 | connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); | 228 | connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); |
198 | connect( qApp, SIGNAL( micChanged(bool) ), this, SLOT ( micChanged(bool) ) ); | 229 | connect( qApp, SIGNAL( micChanged(bool) ), this, SLOT ( micChanged(bool) ) ); |
@@ -224,36 +255,47 @@ void VolumeApplet::mouseReleaseEvent( QMouseEvent * ) | |||
224 | 255 | ||
225 | void VolumeApplet::advVolControl() | 256 | void VolumeApplet::advVolControl() |
226 | { | 257 | { |
227 | showVolControl(TRUE); | 258 | showVolControl(TRUE); |
228 | } | 259 | } |
229 | 260 | ||
230 | void VolumeApplet::showVolControl(bool showMic) | 261 | 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 |
239 | VolumeControl *vc = new VolumeControl(showMic); | 269 | VolumeControl *vc = new VolumeControl(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 | ||
247 | vc->muteBox->setChecked( muted ); | 277 | vc->muteBox->setChecked( muted ); |
248 | connect( vc->slider, SIGNAL( valueChanged( int ) ), this, SLOT( sliderMoved( int ) ) ); | 278 | connect( vc->slider, SIGNAL( valueChanged( int ) ), this, SLOT( sliderMoved( int ) ) ); |
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(); |
253 | 295 | ||
254 | advancedTimer->stop(); | 296 | advancedTimer->stop(); |
255 | } | 297 | } |
256 | 298 | ||
257 | void VolumeApplet::volumeChanged( bool nowMuted ) | 299 | void VolumeApplet::volumeChanged( bool nowMuted ) |
258 | { | 300 | { |
259 | int previousVolume = volumePercent; | 301 | int previousVolume = volumePercent; |
@@ -297,25 +339,25 @@ void VolumeApplet::sliderMoved( int percent ) | |||
297 | 339 | ||
298 | void VolumeApplet::micMoved( int percent ) | 340 | void VolumeApplet::micMoved( int percent ) |
299 | { | 341 | { |
300 | setMic( 100 - percent ); | 342 | setMic( 100 - percent ); |
301 | } | 343 | } |
302 | 344 | ||
303 | void VolumeApplet::readSystemVolume() | 345 | 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 | } |
309 | 351 | ||
310 | void VolumeApplet::readSystemMic() | 352 | 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"); |
315 | } | 357 | } |
316 | 358 | ||
317 | void VolumeApplet::setVolume( int percent ) | 359 | void VolumeApplet::setVolume( int percent ) |
318 | { | 360 | { |
319 | // clamp volume percent to be between 0 and 100 | 361 | // clamp volume percent to be between 0 and 100 |
320 | volumePercent = (percent < 0) ? 0 : ((percent > 100) ? 100 : percent); | 362 | volumePercent = (percent < 0) ? 0 : ((percent > 100) ? 100 : percent); |
321 | // repaint just the little volume rectangle | 363 | // repaint just the little volume rectangle |
@@ -328,31 +370,31 @@ void VolumeApplet::setMic( int percent ) | |||
328 | // clamp volume percent to be between 0 and 100 | 370 | // clamp volume percent to be between 0 and 100 |
329 | micPercent = (percent < 0) ? 0 : ((percent > 100) ? 100 : percent); | 371 | micPercent = (percent < 0) ? 0 : ((percent > 100) ? 100 : percent); |
330 | writeSystemMic(); | 372 | writeSystemMic(); |
331 | } | 373 | } |
332 | 374 | ||
333 | void VolumeApplet::writeSystemVolume() | 375 | void VolumeApplet::writeSystemVolume() |
334 | { | 376 | { |
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 | } |
340 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | 382 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) |
341 | // Send notification that the volume has changed | 383 | // Send notification that the volume has changed |
342 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted; | 384 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted; |
343 | #endif | 385 | #endif |
344 | } | 386 | } |
345 | 387 | ||
346 | void VolumeApplet::writeSystemMic() | 388 | void VolumeApplet::writeSystemMic() |
347 | { | 389 | { |
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); |
352 | } | 394 | } |
353 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | 395 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) |
354 | // Send notification that the volume has changed | 396 | // Send notification that the volume has changed |
355 | QCopEnvelope( "QPE/System", "micChange(bool)" ) << micMuted; | 397 | QCopEnvelope( "QPE/System", "micChange(bool)" ) << micMuted; |
356 | #endif | 398 | #endif |
357 | } | 399 | } |
358 | 400 | ||
@@ -373,8 +415,30 @@ void VolumeApplet::paintEvent( QPaintEvent* ) | |||
373 | if ( muted ) { | 415 | if ( muted ) { |
374 | p.setPen( red ); | 416 | p.setPen( red ); |
375 | p.drawLine( 1, 2, width() - 2, height() - 5 ); | 417 | p.drawLine( 1, 2, width() - 2, height() - 5 ); |
376 | p.drawLine( 1, 3, width() - 2, height() - 4 ); | 418 | p.drawLine( 1, 3, width() - 2, height() - 4 ); |
377 | p.drawLine( width() - 2, 2, 1, height() - 5 ); | 419 | p.drawLine( width() - 2, 2, 1, height() - 5 ); |
378 | p.drawLine( width() - 2, 3, 1, height() - 4 ); | 420 | p.drawLine( width() - 2, 3, 1, height() - 4 ); |
379 | } | 421 | } |
380 | } | 422 | } |
423 | |||
424 | void VolumeApplet::screentapsCheckToggled(bool b) { | ||
425 | Config cfg("qpe"); | ||
426 | cfg.setGroup("Volume"); | ||
427 | cfg.writeEntry("TouchSound",b ); | ||
428 | cfg.write(); | ||
429 | } | ||
430 | |||
431 | void VolumeApplet::keyclicksCheckToggled(bool b) { | ||
432 | Config cfg("qpe"); | ||
433 | cfg.setGroup("Volume"); | ||
434 | cfg.writeEntry("KeySound",b); | ||
435 | cfg.write(); | ||
436 | } | ||
437 | |||
438 | void VolumeApplet::alarmSoundCheckToggled(bool b) { | ||
439 | Config cfg("qpe"); | ||
440 | cfg.setGroup("Volume"); | ||
441 | cfg.writeEntry("AlarmSound",b); | ||
442 | cfg.write(); | ||
443 | } | ||
444 | |||
diff --git a/core/applets/volumeapplet/volume.h b/core/applets/volumeapplet/volume.h index 3a2da43..6e631f2 100644 --- a/core/applets/volumeapplet/volume.h +++ b/core/applets/volumeapplet/volume.h | |||
@@ -18,17 +18,16 @@ | |||
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #ifndef __VOLUME_APPLET_H__ | 21 | #ifndef __VOLUME_APPLET_H__ |
22 | #define __VOLUME_APPLET_H__ | 22 | #define __VOLUME_APPLET_H__ |
23 | 23 | ||
24 | 24 | ||
25 | #include <qwidget.h> | 25 | #include <qwidget.h> |
26 | #include <qpushbutton.h> | ||
27 | #include <qframe.h> | 26 | #include <qframe.h> |
28 | #include <qpixmap.h> | 27 | #include <qpixmap.h> |
29 | #include <qguardedptr.h> | 28 | #include <qguardedptr.h> |
30 | #include <qtimer.h> | 29 | #include <qtimer.h> |
31 | 30 | ||
32 | class QSlider; | 31 | class QSlider; |
33 | class QCheckBox; | 32 | class QCheckBox; |
34 | 33 | ||
@@ -37,16 +36,20 @@ class VolumeControl : public QFrame | |||
37 | Q_OBJECT | 36 | Q_OBJECT |
38 | public: | 37 | public: |
39 | VolumeControl( bool showMic=FALSE, QWidget *parent=0, const char *name=0 ); | 38 | VolumeControl( bool showMic=FALSE, QWidget *parent=0, const char *name=0 ); |
40 | 39 | ||
41 | public: | 40 | public: |
42 | QSlider *slider; | 41 | QSlider *slider; |
43 | QSlider *mic; | 42 | QSlider *mic; |
44 | QCheckBox *muteBox; | 43 | QCheckBox *muteBox; |
44 | QCheckBox *alarmSound; | ||
45 | QCheckBox *screentaps; | ||
46 | QCheckBox *keyclicks; | ||
47 | |||
45 | 48 | ||
46 | private: | 49 | private: |
47 | QPushButton *upButton; | 50 | QPushButton *upButton; |
48 | QPushButton *downButton; | 51 | QPushButton *downButton; |
49 | QTimer *rateTimer; | 52 | QTimer *rateTimer; |
50 | 53 | ||
51 | void keyPressEvent( QKeyEvent * ); | 54 | void keyPressEvent( QKeyEvent * ); |
52 | void createView(bool showMic = FALSE); | 55 | void createView(bool showMic = FALSE); |
@@ -89,13 +92,17 @@ private: | |||
89 | void mousePressEvent( QMouseEvent * ); | 92 | void mousePressEvent( QMouseEvent * ); |
90 | void paintEvent( QPaintEvent* ); | 93 | void paintEvent( QPaintEvent* ); |
91 | 94 | ||
92 | void readSystemMic(); | 95 | void readSystemMic(); |
93 | void keyPressEvent ( QKeyEvent * e ); | 96 | void keyPressEvent ( QKeyEvent * e ); |
94 | void mouseReleaseEvent( QMouseEvent *); | 97 | void mouseReleaseEvent( QMouseEvent *); |
95 | void writeSystemMic(); | 98 | void writeSystemMic(); |
96 | 99 | ||
100 | protected slots: | ||
101 | void alarmSoundCheckToggled(bool); | ||
102 | void keyclicksCheckToggled(bool); | ||
103 | void screentapsCheckToggled(bool); | ||
97 | }; | 104 | }; |
98 | 105 | ||
99 | 106 | ||
100 | #endif // __VOLUME_APPLET_H__ | 107 | #endif // __VOLUME_APPLET_H__ |
101 | 108 | ||