summaryrefslogtreecommitdiff
path: root/core/applets/volumeapplet
Unidiff
Diffstat (limited to 'core/applets/volumeapplet') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/volumeapplet/volume.cpp20
-rw-r--r--core/applets/volumeapplet/volume.h1
-rw-r--r--core/applets/volumeapplet/volumeapplet.pro4
-rw-r--r--core/applets/volumeapplet/volumeappletimpl.cpp65
-rw-r--r--core/applets/volumeapplet/volumeappletimpl.h43
5 files changed, 15 insertions, 118 deletions
diff --git a/core/applets/volumeapplet/volume.cpp b/core/applets/volumeapplet/volume.cpp
index c736437..8fd88f6 100644
--- a/core/applets/volumeapplet/volume.cpp
+++ b/core/applets/volumeapplet/volume.cpp
@@ -9,48 +9,44 @@
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 <stdio.h>
22
23#include "volume.h" 21#include "volume.h"
22#include "oledbox.h"
24 23
24#include <opie2/odevice.h>
25#include <opie2/otaskbarapplet.h>
25#include <qpe/resource.h> 26#include <qpe/resource.h>
26#include <qpe/applnk.h> 27#include <qpe/applnk.h>
27#include <qpe/config.h> 28#include <qpe/config.h>
28#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
29#include <qpe/qcopenvelope_qws.h> 29#include <qpe/qcopenvelope_qws.h>
30#endif
31 30
32#include <qpainter.h> 31#include <qpainter.h>
33#include <qcheckbox.h> 32#include <qcheckbox.h>
34#include <qslider.h> 33#include <qslider.h>
35#include <qlayout.h> 34#include <qlayout.h>
36#include <qvbox.h> 35#include <qvbox.h>
37#include <qlabel.h> 36#include <qlabel.h>
38
39#include <qpushbutton.h> 37#include <qpushbutton.h>
40#include <qtimer.h> 38#include <qtimer.h>
41 39
42#include <opie/odevice.h> 40#include <stdio.h>
43
44#include "oledbox.h"
45 41
46using namespace Opie; 42using namespace Opie;
47 43
48#define RATE_TIMER_INTERVAL 100 44#define RATE_TIMER_INTERVAL 100
49// Ten times per second is fine (RATE_TIMER_INTERVAL 100). A shorter time 45// Ten times per second is fine (RATE_TIMER_INTERVAL 100). A shorter time
50// results in "hanging" buttons on the iPAQ due to quite high CPU consumption. 46// results in "hanging" buttons on the iPAQ due to quite high CPU consumption.
51 47
52 48
53/* XPM */ 49/* XPM */
54static const char * vol_xpm[] = { 50static const char * vol_xpm[] = {
55"20 20 3 1", 51"20 20 3 1",
56" c None", 52" c None",
@@ -728,24 +724,28 @@ VolumeApplet::VolumeApplet( QWidget *parent, const char *name )
728 m_pixmap = new QPixmap ( Resource::loadPixmap ( "volume" )); 724 m_pixmap = new QPixmap ( Resource::loadPixmap ( "volume" ));
729 m_dialog = new VolumeControl ( this, true, this, "volumecontrol" ); 725 m_dialog = new VolumeControl ( this, true, this, "volumecontrol" );
730 726
731 connect ( qApp, SIGNAL( volumeChanged ( bool )), m_dialog, SLOT( volumeChanged( bool ))); 727 connect ( qApp, SIGNAL( volumeChanged ( bool )), m_dialog, SLOT( volumeChanged( bool )));
732 connect ( qApp, SIGNAL( micChanged ( bool )), m_dialog, SLOT ( micChanged( bool ))); 728 connect ( qApp, SIGNAL( micChanged ( bool )), m_dialog, SLOT ( micChanged( bool )));
733} 729}
734 730
735VolumeApplet::~VolumeApplet() 731VolumeApplet::~VolumeApplet()
736{ 732{
737 delete m_pixmap; 733 delete m_pixmap;
738} 734}
739 735
736int VolumeApplet::position()
737{
738 return 6;
739}
740 740
741void VolumeApplet::mousePressEvent ( QMouseEvent * ) 741void VolumeApplet::mousePressEvent ( QMouseEvent * )
742{ 742{
743 if ( m_dialog-> isVisible ( )) 743 if ( m_dialog-> isVisible ( ))
744 m_dialog-> hide ( ); 744 m_dialog-> hide ( );
745 else 745 else
746 m_dialog-> show ( true ); 746 m_dialog-> show ( true );
747} 747}
748 748
749void VolumeApplet::redraw ( bool all ) 749void VolumeApplet::redraw ( bool all )
750{ 750{
751 if ( all ) 751 if ( all )
@@ -768,12 +768,16 @@ void VolumeApplet::paintEvent ( QPaintEvent * )
768 p. fillRect ( pixelsWide + 2, height() - 3, width() - 4 - pixelsWide, 2, lightGray ); 768 p. fillRect ( pixelsWide + 2, height() - 3, width() - 4 - pixelsWide, 2, lightGray );
769 769
770 if ( m_dialog-> volMuted ( )) { 770 if ( m_dialog-> volMuted ( )) {
771 p. setPen ( red ); 771 p. setPen ( red );
772 p. drawLine ( 1, 2, width() - 2, height() - 5 ); 772 p. drawLine ( 1, 2, width() - 2, height() - 5 );
773 p. drawLine ( 1, 3, width() - 2, height() - 4 ); 773 p. drawLine ( 1, 3, width() - 2, height() - 4 );
774 p. drawLine ( width() - 2, 2, 1, height() - 5 ); 774 p. drawLine ( width() - 2, 2, 1, height() - 5 );
775 p. drawLine ( width() - 2, 3, 1, height() - 4 ); 775 p. drawLine ( width() - 2, 3, 1, height() - 4 );
776 } 776 }
777} 777}
778 778
779 779
780Q_EXPORT_INTERFACE()
781{
782 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<VolumeApplet> );
783}
diff --git a/core/applets/volumeapplet/volume.h b/core/applets/volumeapplet/volume.h
index d2345b5..454a688 100644
--- a/core/applets/volumeapplet/volume.h
+++ b/core/applets/volumeapplet/volume.h
@@ -108,24 +108,25 @@ private:
108 bool m_snd_touch; 108 bool m_snd_touch;
109 bool m_snd_key; 109 bool m_snd_key;
110 110
111 VolumeApplet *m_icon; 111 VolumeApplet *m_icon;
112}; 112};
113 113
114class VolumeApplet : public QWidget { 114class VolumeApplet : public QWidget {
115 Q_OBJECT 115 Q_OBJECT
116 116
117public: 117public:
118 VolumeApplet ( QWidget *parent = 0, const char *name=0 ); 118 VolumeApplet ( QWidget *parent = 0, const char *name=0 );
119 ~VolumeApplet ( ); 119 ~VolumeApplet ( );
120 static int position();
120 121
121 void redraw ( bool all = true ); 122 void redraw ( bool all = true );
122 123
123protected: 124protected:
124 virtual void mousePressEvent ( QMouseEvent * ); 125 virtual void mousePressEvent ( QMouseEvent * );
125 virtual void paintEvent ( QPaintEvent* ); 126 virtual void paintEvent ( QPaintEvent* );
126 127
127private: 128private:
128 QPixmap * m_pixmap; 129 QPixmap * m_pixmap;
129 VolumeControl *m_dialog; 130 VolumeControl *m_dialog;
130}; 131};
131 132
diff --git a/core/applets/volumeapplet/volumeapplet.pro b/core/applets/volumeapplet/volumeapplet.pro
index 92c6b0a..b14956e 100644
--- a/core/applets/volumeapplet/volumeapplet.pro
+++ b/core/applets/volumeapplet/volumeapplet.pro
@@ -1,13 +1,13 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt plugin warn_on release 2 CONFIG += qt plugin warn_on release
3 HEADERS= volume.h volumeappletimpl.h oledbox.h 3 HEADERS = volume.h oledbox.h
4 SOURCES= volume.cpp volumeappletimpl.cpp oledbox.cpp 4 SOURCES = volume.cpp oledbox.cpp
5 TARGET = volumeapplet 5 TARGET = volumeapplet
6 DESTDIR = $(OPIEDIR)/plugins/applets 6 DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += ../$(OPIEDIR)/include 8DEPENDPATH += ../$(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe
10 VERSION = 1.0.0 10 VERSION = 1.0.0
11 11
12include ( $(OPIEDIR)/include.pro ) 12include ( $(OPIEDIR)/include.pro )
13target.path = $$prefix/plugins/applets 13target.path = $$prefix/plugins/applets
diff --git a/core/applets/volumeapplet/volumeappletimpl.cpp b/core/applets/volumeapplet/volumeappletimpl.cpp
deleted file mode 100644
index 9c7dea3..0000000
--- a/core/applets/volumeapplet/volumeappletimpl.cpp
+++ b/dev/null
@@ -1,65 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#include "volume.h"
21#include "volumeappletimpl.h"
22
23VolumeAppletImpl::VolumeAppletImpl()
24 : volume(0)
25{
26}
27
28VolumeAppletImpl::~VolumeAppletImpl()
29{
30 delete volume;
31}
32
33QWidget *VolumeAppletImpl::applet( QWidget *parent )
34{
35 if ( !volume )
36 volume = new VolumeApplet( parent );
37 return volume;
38}
39
40int VolumeAppletImpl::position() const
41{
42 return 6;
43}
44
45QRESULT VolumeAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
46{
47 *iface = 0;
48 if ( uuid == IID_QUnknown )
49 *iface = this;
50 else if ( uuid == IID_TaskbarApplet )
51 *iface = this;
52 else
53 return QS_FALSE;
54
55 if ( *iface )
56 (*iface)->addRef();
57 return QS_OK;
58}
59
60Q_EXPORT_INTERFACE()
61{
62 Q_CREATE_INSTANCE( VolumeAppletImpl )
63}
64
65
diff --git a/core/applets/volumeapplet/volumeappletimpl.h b/core/applets/volumeapplet/volumeappletimpl.h
deleted file mode 100644
index a9221c6..0000000
--- a/core/applets/volumeapplet/volumeappletimpl.h
+++ b/dev/null
@@ -1,43 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#ifndef VOLUMEAPPLETIMPL_H
21#define VOLUMEAPPLETIMPL_H
22
23#include <qpe/taskbarappletinterface.h>
24
25class VolumeApplet;
26
27class VolumeAppletImpl : public TaskbarAppletInterface
28{
29public:
30 VolumeAppletImpl();
31 virtual ~VolumeAppletImpl();
32
33 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
34 Q_REFCOUNT
35
36 virtual QWidget *applet( QWidget *parent );
37 virtual int position() const;
38
39private:
40 VolumeApplet *volume;
41};
42
43#endif