author | sandman <sandman> | 2002-09-30 21:10:05 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-09-30 21:10:05 (UTC) |
commit | f49ad5cf3bdc1d1c06be4615a649b6be6f179b83 (patch) (side-by-side diff) | |
tree | 77ad6928937375e116529fab2e5a746fce5ba936 | |
parent | 3ff016b281a3c059e6ecb728c60fd6847756f291 (diff) | |
download | opie-f49ad5cf3bdc1d1c06be4615a649b6be6f179b83.zip opie-f49ad5cf3bdc1d1c06be4615a649b6be6f179b83.tar.gz opie-f49ad5cf3bdc1d1c06be4615a649b6be6f179b83.tar.bz2 |
- small cleanup
- changed to work with the new ODevice API
-rw-r--r-- | core/applets/volumeapplet/volume.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/applets/volumeapplet/volume.cpp b/core/applets/volumeapplet/volume.cpp index eedc749..aec346b 100644 --- a/core/applets/volumeapplet/volume.cpp +++ b/core/applets/volumeapplet/volume.cpp @@ -16,64 +16,66 @@ ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include <stdio.h> #include "volume.h" #include <qpe/resource.h> #include <qpe/qpeapplication.h> #include <qpe/config.h> #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) #include <qpe/qcopenvelope_qws.h> #endif #include <qpainter.h> #include <qcheckbox.h> #include <qslider.h> #include <qlayout.h> #include <qframe.h> #include <qpixmap.h> #include <qlabel.h> #include <qtoolbutton.h> #include <qpushbutton.h> #include <qtimer.h> #include <opie/odevice.h> #include "oledbox.h" +using namespace Opie; + #define RATE_TIMER_INTERVAL 100 // Ten times per second is fine (RATE_TIMER_INTERVAL 100). A shorter time // results in "hanging" buttons on the iPAQ due to quite high CPU consumption. /* XPM */ static const char * vol_xpm[] = { "20 20 3 1", " c None", ". c #0000FF", "+ c #000000", " ", " . ", " . . . . ", " . . . . . . ", " . . . . . . . ", " . . ..... . . ", " . ... ..... ... ", " ........... .... ", " ................. ", "++++++++++++++++++++", " .................. ", " . ............. . ", " . ..... ....... ", " . ... ..... . ", " . ... ..... . ", " . ... ..... ", " . . . . . ", " . . . ", " . . . ", " "}; /* XPM */ @@ -157,67 +159,69 @@ static const char * alarm_xpm[] = { "2 c #B1AC6B", "3 c #F7F710", "4 c #838204", " ", " ", " 4'4/ ", " /-^= ", " 42{4>4 ", " '2|+*$44 ", " +2&3+$1*44 ", " (%_}_+/$:>/4 ", " 4%_}3+#;>:*4 ", " 4%_}&+#[1$/4 ", " 4%_,2')[~~>4 ", " 4%33'4#@~1>4 ", " 4%3344#[:>/4 ", " 42&_3'4#@>:*44 ", " 42|}}3'4#[;$)$44 ", "444{]]2^~~:!!#.@##/ ", "4444-%*:==!!=...../ ", " /:[.. ", " /@. ", " "}; VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *parent, const char *name ) : QFrame ( parent, name, WStyle_StaysOnTop | WType_Popup ) { m_icon = icon; bool has_wav_alarm = true; switch ( ODevice::inst ( )-> model ( )) { // we need to add other devices eventually - case OMODEL_Zaurus_SL5000: + case Model_Zaurus_SL5000: has_wav_alarm = false; //poor guys probably feeling left out... break; + default: + break; } setFrameStyle ( QFrame::PopupPanel | QFrame::Raised ); QGridLayout *grid = new QGridLayout ( this, 1, 1, 6, 4 ); grid-> setSpacing ( 4 ); grid-> setMargin ( 6 ); QVBoxLayout *vbox; QLabel *l; vbox = new QVBoxLayout ( ); vbox-> setSpacing ( 4 ); grid-> addLayout ( vbox, 1, 0 ); upButton = new QPushButton ( this ); upButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding )); upButton-> setPixmap ( Resource::loadPixmap ( "up" )); upButton-> setFocusPolicy ( QWidget::NoFocus ); vbox-> addWidget ( upButton ); downButton = new QPushButton ( this ); downButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding )); downButton-> setPixmap ( Resource::loadPixmap ( "down" )); downButton-> setFocusPolicy ( QWidget::NoFocus ); vbox-> addWidget ( downButton ); volSlider = new QSlider ( this ); volSlider-> setRange ( 0, 100 ); @@ -428,65 +432,65 @@ void VolumeControl::readConfig ( bool force ) m_vol_percent = cfg. readNumEntry ( "VolumePercent", 50 ); m_mic_percent = cfg. readNumEntry ( "Mic", 50 ); m_vol_muted = cfg. readBoolEntry ( "Mute", 0 ); m_mic_muted = cfg. readBoolEntry ( "MicMute", 0 ); m_snd_key = cfg. readBoolEntry ( "KeySound", 0 ); m_snd_touch = cfg. readBoolEntry ( "TouchSound", 0 ); m_snd_alarm = cfg. readBoolEntry ( "AlarmSound", 1 ); m_alarm_percent = cfg. readNumEntry ( "AlarmPercent", 65 ); if ( force || ( m_vol_percent != old_vp )) volSlider-> setValue ( 100 - m_vol_percent ); if ( force || ( m_mic_percent != old_mp )) micSlider-> setValue ( 100 - m_mic_percent ); if ( force || ( m_alarm_percent != old_ap )) alarmSlider-> setValue ( 100 - m_alarm_percent ); if ( force || ( m_vol_muted != old_vm )) volLed-> setOn ( !m_vol_muted ); if ( force || ( m_mic_muted != old_mm )) micLed-> setOn ( !m_mic_muted ); if ( force || ( m_snd_alarm != old_sa )) alarmLed-> setOn ( m_snd_alarm ); if ( force || ( m_snd_key != old_sk )) keyBox-> setChecked ( m_snd_key ); if ( force || ( m_snd_touch != old_st )) tapBox-> setChecked ( m_snd_touch ); if ( force || ( m_snd_alarm != old_sa )) alarmBox-> setChecked ( m_snd_alarm ); } -void VolumeControl::volumeChanged ( bool nowMuted ) +void VolumeControl::volumeChanged ( bool /*nowMuted*/ ) { int prevVol = m_vol_percent; bool prevMute = m_vol_muted; readConfig ( ); // Handle case where muting it toggled if ( m_vol_muted != prevMute ) m_icon-> redraw ( true ); else if ( prevVol != m_vol_percent ) // Avoid over repainting m_icon-> redraw ( false ); } void VolumeControl::micChanged ( bool nowMuted ) { if ( !nowMuted ) readConfig ( ); m_mic_muted = nowMuted; } void VolumeControl::screenTapToggled ( bool b ) { m_snd_touch = b; writeConfigEntry ( "TouchSound", m_snd_touch, UPD_Vol ); } void VolumeControl::keyClickToggled ( bool b ) { m_snd_key = b; writeConfigEntry ( "KeySound", m_snd_key, UPD_Vol ); } |