-rw-r--r-- | core/applets/volumeapplet/opie-volumeapplet.control | 2 | ||||
-rw-r--r-- | core/applets/volumeapplet/volume.cpp | 13 |
2 files changed, 5 insertions, 10 deletions
diff --git a/core/applets/volumeapplet/opie-volumeapplet.control b/core/applets/volumeapplet/opie-volumeapplet.control index 3056520..731692a 100644 --- a/core/applets/volumeapplet/opie-volumeapplet.control +++ b/core/applets/volumeapplet/opie-volumeapplet.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: opie-volumeapplet | 1 | Package: opie-volumeapplet |
2 | Files: plugins/applets/libvolumeapplet.so* | 2 | Files: plugins/applets/libvolumeapplet.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applets | 4 | Section: opie/applets |
5 | Maintainer: L.J. Potter <lpotter@trolltech.com> | 5 | Maintainer: L.J. Potter <lpotter@trolltech.com> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal | 7 | Depends: task-opie-minimal, libopiecore2, libopieui2 |
8 | Description: Volume applet | 8 | Description: Volume applet |
9 | Volume applet for the Opie environment taskbar. | 9 | Volume applet for the Opie environment taskbar. |
10 | Version: $QPE_VERSION$EXTRAVERSION | 10 | Version: $QPE_VERSION$EXTRAVERSION |
diff --git a/core/applets/volumeapplet/volume.cpp b/core/applets/volumeapplet/volume.cpp index 7f0aca5..7d67311 100644 --- a/core/applets/volumeapplet/volume.cpp +++ b/core/applets/volumeapplet/volume.cpp | |||
@@ -3,49 +3,49 @@ | |||
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "volume.h" | 21 | #include "volume.h" |
22 | 22 | ||
23 | /* OPIE */ | 23 | /* OPIE */ |
24 | #include <opie2/oledbox.h> | 24 | #include <opie2/oledbox.h> |
25 | #include <opie2/odevice.h> | 25 | #include <opie2/odevice.h> |
26 | #include <opie2/otaskbarapplet.h> | 26 | #include <opie2/otaskbarapplet.h> |
27 | #include <qpe/resource.h> | 27 | #include <opie2/oresource.h> |
28 | #include <qpe/applnk.h> | 28 | #include <qpe/applnk.h> |
29 | #include <qpe/config.h> | 29 | #include <qpe/config.h> |
30 | #include <qpe/qcopenvelope_qws.h> | 30 | #include <qpe/qcopenvelope_qws.h> |
31 | using namespace Opie::Core; | 31 | using namespace Opie::Core; |
32 | using namespace Opie::Ui; | 32 | using namespace Opie::Ui; |
33 | 33 | ||
34 | /* QT */ | 34 | /* QT */ |
35 | #include <qpainter.h> | 35 | #include <qpainter.h> |
36 | #include <qcheckbox.h> | 36 | #include <qcheckbox.h> |
37 | #include <qslider.h> | 37 | #include <qslider.h> |
38 | #include <qlayout.h> | 38 | #include <qlayout.h> |
39 | #include <qvbox.h> | 39 | #include <qvbox.h> |
40 | #include <qlabel.h> | 40 | #include <qlabel.h> |
41 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
42 | #include <qtimer.h> | 42 | #include <qtimer.h> |
43 | 43 | ||
44 | /* STD */ | 44 | /* STD */ |
45 | #include <stdio.h> | 45 | #include <stdio.h> |
46 | 46 | ||
47 | #define RATE_TIMER_INTERVAL 100 | 47 | #define RATE_TIMER_INTERVAL 100 |
48 | // Ten times per second is fine (RATE_TIMER_INTERVAL 100). A shorter time | 48 | // Ten times per second is fine (RATE_TIMER_INTERVAL 100). A shorter time |
49 | // results in "hanging" buttons on the iPAQ due to quite high CPU consumption. | 49 | // results in "hanging" buttons on the iPAQ due to quite high CPU consumption. |
50 | 50 | ||
51 | 51 | ||
@@ -251,59 +251,56 @@ VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *pa | |||
251 | default: | 251 | default: |
252 | break; | 252 | break; |
253 | } | 253 | } |
254 | 254 | ||
255 | if ( !ODevice::inst()->modelString().contains( "Model_iPAQ" )) { | 255 | if ( !ODevice::inst()->modelString().contains( "Model_iPAQ" )) { |
256 | has_bass = false; | 256 | has_bass = false; |
257 | has_treble = false; | 257 | has_treble = false; |
258 | } | 258 | } |
259 | 259 | ||
260 | setFrameStyle ( QFrame::PopupPanel | QFrame::Raised ); | 260 | setFrameStyle ( QFrame::PopupPanel | QFrame::Raised ); |
261 | 261 | ||
262 | QGridLayout *grid = new QGridLayout ( this, 1, 1, 6, 4 ); | 262 | QGridLayout *grid = new QGridLayout ( this, 1, 1, 6, 4 ); |
263 | grid-> setSpacing ( 4 ); | 263 | grid-> setSpacing ( 4 ); |
264 | grid-> setMargin ( 6 ); | 264 | grid-> setMargin ( 6 ); |
265 | 265 | ||
266 | QVBoxLayout *vbox; | 266 | QVBoxLayout *vbox; |
267 | QLabel *l; | 267 | QLabel *l; |
268 | 268 | ||
269 | vbox = new QVBoxLayout ( ); | 269 | vbox = new QVBoxLayout ( ); |
270 | vbox-> setSpacing ( 4 ); | 270 | vbox-> setSpacing ( 4 ); |
271 | grid-> addLayout ( vbox, 1, 0 ); | 271 | grid-> addLayout ( vbox, 1, 0 ); |
272 | 272 | ||
273 | upButton = new QPushButton ( this ); | 273 | upButton = new QPushButton ( this ); |
274 | upButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding )); | 274 | upButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding )); |
275 | QPixmap pic; | 275 | upButton-> setPixmap ( Opie::Core::OResource::loadPixmap( "up", Opie::Core::OResource::SmallIcon ) ); |
276 | pic.convertFromImage( Resource::loadImage( "up" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
277 | upButton-> setPixmap ( pic ); | ||
278 | upButton-> setFocusPolicy ( QWidget::NoFocus ); | 276 | upButton-> setFocusPolicy ( QWidget::NoFocus ); |
279 | 277 | ||
280 | vbox-> addWidget ( upButton ); | 278 | vbox-> addWidget ( upButton ); |
281 | 279 | ||
282 | downButton = new QPushButton ( this ); | 280 | downButton = new QPushButton ( this ); |
283 | downButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding )); | 281 | downButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding )); |
284 | pic.convertFromImage( Resource::loadImage( "down" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | 282 | downButton-> setPixmap ( Opie::Core::OResource::loadPixmap( "down", Opie::Core::OResource::SmallIcon ) ); |
285 | downButton-> setPixmap ( pic ); | ||
286 | downButton-> setFocusPolicy ( QWidget::NoFocus ); | 283 | downButton-> setFocusPolicy ( QWidget::NoFocus ); |
287 | 284 | ||
288 | vbox-> addWidget ( downButton ); | 285 | vbox-> addWidget ( downButton ); |
289 | 286 | ||
290 | volSlider = new QSlider ( this ); | 287 | volSlider = new QSlider ( this ); |
291 | volSlider-> setRange ( 0, 100 ); | 288 | volSlider-> setRange ( 0, 100 ); |
292 | volSlider-> setTickmarks ( QSlider::Both ); | 289 | volSlider-> setTickmarks ( QSlider::Both ); |
293 | volSlider-> setTickInterval ( 20 ); | 290 | volSlider-> setTickInterval ( 20 ); |
294 | volSlider-> setFocusPolicy ( QWidget::NoFocus ); | 291 | volSlider-> setFocusPolicy ( QWidget::NoFocus ); |
295 | 292 | ||
296 | l = new QLabel ( this ); | 293 | l = new QLabel ( this ); |
297 | l-> setPixmap ( QPixmap ( vol_xpm )); | 294 | l-> setPixmap ( QPixmap ( vol_xpm )); |
298 | 295 | ||
299 | grid-> addWidget ( l, 0, 1, AlignCenter ); | 296 | grid-> addWidget ( l, 0, 1, AlignCenter ); |
300 | grid-> addWidget ( volSlider, 1, 1, AlignCenter ); | 297 | grid-> addWidget ( volSlider, 1, 1, AlignCenter ); |
301 | 298 | ||
302 | volLed = new OLedBox ( green, this ); | 299 | volLed = new OLedBox ( green, this ); |
303 | volLed-> setFocusPolicy ( QWidget::NoFocus ); | 300 | volLed-> setFocusPolicy ( QWidget::NoFocus ); |
304 | volLed-> setFixedSize ( 16, 16 ); | 301 | volLed-> setFixedSize ( 16, 16 ); |
305 | 302 | ||
306 | grid-> addWidget ( volLed, 2, 1, AlignCenter ); | 303 | grid-> addWidget ( volLed, 2, 1, AlignCenter ); |
307 | 304 | ||
308 | QVBox *basstrebleBox = new QVBox( this ); | 305 | QVBox *basstrebleBox = new QVBox( this ); |
309 | 306 | ||
@@ -706,51 +703,49 @@ void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd ) | |||
706 | } | 703 | } |
707 | case UPD_Bass: { | 704 | case UPD_Bass: { |
708 | QCopEnvelope ( "QPE/System", "bassChange(bool)" ) << true; | 705 | QCopEnvelope ( "QPE/System", "bassChange(bool)" ) << true; |
709 | break; | 706 | break; |
710 | } | 707 | } |
711 | case UPD_Treble: { | 708 | case UPD_Treble: { |
712 | QCopEnvelope ( "QPE/System", "trebleChange(bool)" ) << true; | 709 | QCopEnvelope ( "QPE/System", "trebleChange(bool)" ) << true; |
713 | break; | 710 | break; |
714 | } | 711 | } |
715 | 712 | ||
716 | case UPD_None: | 713 | case UPD_None: |
717 | break; | 714 | break; |
718 | } | 715 | } |
719 | #endif | 716 | #endif |
720 | } | 717 | } |
721 | 718 | ||
722 | //=========================================================================== | 719 | //=========================================================================== |
723 | 720 | ||
724 | VolumeApplet::VolumeApplet( QWidget *parent, const char *name ) | 721 | VolumeApplet::VolumeApplet( QWidget *parent, const char *name ) |
725 | : QWidget( parent, name ) | 722 | : QWidget( parent, name ) |
726 | { | 723 | { |
727 | setFixedWidth ( AppLnk::smallIconSize() ); | 724 | setFixedWidth ( AppLnk::smallIconSize() ); |
728 | setFixedHeight ( AppLnk::smallIconSize()+4 ); | 725 | setFixedHeight ( AppLnk::smallIconSize()+4 ); |
729 | 726 | ||
730 | QPixmap pic; | 727 | m_pixmap = new QPixmap ( Opie::Core::OResource::loadPixmap( "volume", Opie::Core::OResource::SmallIcon ) ); |
731 | pic.convertFromImage( Resource::loadImage( "volume" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
732 | m_pixmap = new QPixmap ( pic ); | ||
733 | m_dialog = new VolumeControl ( this, true, this, "volumecontrol" ); | 728 | m_dialog = new VolumeControl ( this, true, this, "volumecontrol" ); |
734 | 729 | ||
735 | connect ( qApp, SIGNAL( volumeChanged(bool)), m_dialog, SLOT( volumeChanged(bool))); | 730 | connect ( qApp, SIGNAL( volumeChanged(bool)), m_dialog, SLOT( volumeChanged(bool))); |
736 | connect ( qApp, SIGNAL( micChanged(bool)), m_dialog, SLOT ( micChanged(bool))); | 731 | connect ( qApp, SIGNAL( micChanged(bool)), m_dialog, SLOT ( micChanged(bool))); |
737 | } | 732 | } |
738 | 733 | ||
739 | VolumeApplet::~VolumeApplet() | 734 | VolumeApplet::~VolumeApplet() |
740 | { | 735 | { |
741 | delete m_pixmap; | 736 | delete m_pixmap; |
742 | } | 737 | } |
743 | 738 | ||
744 | int VolumeApplet::position() | 739 | int VolumeApplet::position() |
745 | { | 740 | { |
746 | return 6; | 741 | return 6; |
747 | } | 742 | } |
748 | 743 | ||
749 | void VolumeApplet::mousePressEvent ( QMouseEvent * ) | 744 | void VolumeApplet::mousePressEvent ( QMouseEvent * ) |
750 | { | 745 | { |
751 | if ( m_dialog-> isVisible ( )) | 746 | if ( m_dialog-> isVisible ( )) |
752 | m_dialog-> hide ( ); | 747 | m_dialog-> hide ( ); |
753 | else | 748 | else |
754 | m_dialog-> show ( true ); | 749 | m_dialog-> show ( true ); |
755 | } | 750 | } |
756 | 751 | ||