author | mickeyl <mickeyl> | 2004-03-01 19:19:37 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-03-01 19:19:37 (UTC) |
commit | ddc3d749af5f7afebf69488b79641771fe246b5b (patch) (unidiff) | |
tree | 8ea8614906c568e4677493ef09040724d60dd2d4 | |
parent | fb0981f47e529f9d1dd77fa005ffa3c3ecedff67 (diff) | |
download | opie-ddc3d749af5f7afebf69488b79641771fe246b5b.zip opie-ddc3d749af5f7afebf69488b79641771fe246b5b.tar.gz opie-ddc3d749af5f7afebf69488b79641771fe246b5b.tar.bz2 |
remove duplicated boiler plate code in favour of the OTaskbarApplet template
31 files changed, 107 insertions, 688 deletions
diff --git a/core/applets/clipboardapplet/clipboard.cpp b/core/applets/clipboardapplet/clipboard.cpp index bb0db9b..34d151e 100644 --- a/core/applets/clipboardapplet/clipboard.cpp +++ b/core/applets/clipboardapplet/clipboard.cpp | |||
@@ -1,178 +1,189 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
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 "clipboard.h" | 21 | #include "clipboard.h" |
22 | 22 | ||
23 | #include <opie2/otaskbarapplet.h> | ||
23 | #include <qpe/resource.h> | 24 | #include <qpe/resource.h> |
24 | #include <qpe/applnk.h> | 25 | #include <qpe/applnk.h> |
25 | 26 | ||
26 | #include <qpainter.h> | 27 | #include <qpainter.h> |
27 | #include <qpopupmenu.h> | 28 | #include <qpopupmenu.h> |
28 | #include <qwindowsystem_qws.h> | 29 | #include <qwindowsystem_qws.h> |
29 | #include <qapplication.h> | 30 | #include <qapplication.h> |
30 | #include <qclipboard.h> | 31 | #include <qclipboard.h> |
31 | #include <qtimer.h> | 32 | #include <qtimer.h> |
32 | 33 | ||
33 | //=========================================================================== | 34 | //=========================================================================== |
34 | 35 | ||
35 | 36 | ||
36 | ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) | 37 | ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) |
37 | { | 38 | { |
38 | setFixedWidth ( AppLnk::smallIconSize() ); | 39 | setFixedWidth ( AppLnk::smallIconSize() ); |
39 | setFixedHeight ( AppLnk::smallIconSize() ); | 40 | setFixedHeight ( AppLnk::smallIconSize() ); |
40 | 41 | ||
41 | QImage img = Resource::loadImage( "paste"); | 42 | QImage img = Resource::loadImage( "paste"); |
42 | img = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 43 | img = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
43 | 44 | ||
44 | m_clipboardPixmap.convertFromImage( img ); | 45 | m_clipboardPixmap.convertFromImage( img ); |
45 | 46 | ||
46 | m_timer = new QTimer ( this ); | 47 | m_timer = new QTimer ( this ); |
47 | 48 | ||
48 | connect ( QApplication::clipboard ( ), SIGNAL( dataChanged ( )), this, SLOT( newData ( ))); | 49 | connect ( QApplication::clipboard ( ), SIGNAL( dataChanged ( )), this, SLOT( newData ( ))); |
49 | connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( newData ( ))); | 50 | connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( newData ( ))); |
50 | connect ( qApp, SIGNAL( aboutToQuit ( )), this, SLOT( shutdown ( ))); | 51 | connect ( qApp, SIGNAL( aboutToQuit ( )), this, SLOT( shutdown ( ))); |
51 | 52 | ||
52 | m_menu = 0; | 53 | m_menu = 0; |
53 | m_dirty = true; | 54 | m_dirty = true; |
54 | m_lasttext = QString::null; | 55 | m_lasttext = QString::null; |
55 | 56 | ||
56 | m_timer-> start ( 0, true ); | 57 | m_timer-> start ( 0, true ); |
57 | } | 58 | } |
58 | 59 | ||
59 | ClipboardApplet::~ClipboardApplet ( ) | 60 | ClipboardApplet::~ClipboardApplet ( ) |
60 | { | 61 | { |
61 | } | 62 | } |
62 | 63 | ||
64 | int ClipboardApplet::position() | ||
65 | { | ||
66 | return 6; | ||
67 | } | ||
68 | |||
63 | void ClipboardApplet::shutdown ( ) | 69 | void ClipboardApplet::shutdown ( ) |
64 | { | 70 | { |
65 | // the timer has to be stopped, or Qt/E will hang on quit() | 71 | // the timer has to be stopped, or Qt/E will hang on quit() |
66 | // see launcher/desktop.cpp | 72 | // see launcher/desktop.cpp |
67 | 73 | ||
68 | m_timer-> stop ( ); | 74 | m_timer-> stop ( ); |
69 | } | 75 | } |
70 | 76 | ||
71 | void ClipboardApplet::mousePressEvent ( QMouseEvent *) | 77 | void ClipboardApplet::mousePressEvent ( QMouseEvent *) |
72 | { | 78 | { |
73 | if ( m_dirty ) { | 79 | if ( m_dirty ) { |
74 | delete m_menu; | 80 | delete m_menu; |
75 | 81 | ||
76 | m_menu = new QPopupMenu ( this ); | 82 | m_menu = new QPopupMenu ( this ); |
77 | m_menu-> setCheckable ( true ); | 83 | m_menu-> setCheckable ( true ); |
78 | 84 | ||
79 | if ( m_history. count ( )) { | 85 | if ( m_history. count ( )) { |
80 | for ( unsigned int i = 0; i < m_history. count ( ); i++ ) { | 86 | for ( unsigned int i = 0; i < m_history. count ( ); i++ ) { |
81 | QString str = m_history [i]; | 87 | QString str = m_history [i]; |
82 | 88 | ||
83 | if ( str. length ( ) > 20 ) | 89 | if ( str. length ( ) > 20 ) |
84 | str = str. left ( 20 ) + "..."; | 90 | str = str. left ( 20 ) + "..."; |
85 | 91 | ||
86 | m_menu-> insertItem ( QString ( "%1: %2" ). arg ( i + 1 ). arg ( str ), i ); | 92 | m_menu-> insertItem ( QString ( "%1: %2" ). arg ( i + 1 ). arg ( str ), i ); |
87 | m_menu-> setItemChecked ( i, false ); | 93 | m_menu-> setItemChecked ( i, false ); |
88 | } | 94 | } |
89 | m_menu-> setItemChecked ( m_history. count ( ) - 1, true ); | 95 | m_menu-> setItemChecked ( m_history. count ( ) - 1, true ); |
90 | m_menu-> insertSeparator ( ); | 96 | m_menu-> insertSeparator ( ); |
91 | } | 97 | } |
92 | m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "cut" )), tr( "Cut" ), 100 ); | 98 | m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "cut" )), tr( "Cut" ), 100 ); |
93 | m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "copy" )), tr( "Copy" ), 101 ); | 99 | m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "copy" )), tr( "Copy" ), 101 ); |
94 | m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "paste" )), tr( "Paste" ), 102 ); | 100 | m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "paste" )), tr( "Paste" ), 102 ); |
95 | 101 | ||
96 | connect ( m_menu, SIGNAL( activated ( int )), this, SLOT( action ( int ))); | 102 | connect ( m_menu, SIGNAL( activated ( int )), this, SLOT( action ( int ))); |
97 | 103 | ||
98 | m_dirty = false; | 104 | m_dirty = false; |
99 | } | 105 | } |
100 | QPoint p = mapToGlobal ( QPoint ( 0, 0 )); | 106 | QPoint p = mapToGlobal ( QPoint ( 0, 0 )); |
101 | QSize s = m_menu-> sizeHint ( ); | 107 | QSize s = m_menu-> sizeHint ( ); |
102 | 108 | ||
103 | m_menu-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( ))); | 109 | m_menu-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( ))); |
104 | } | 110 | } |
105 | 111 | ||
106 | void ClipboardApplet::action(int id) | 112 | void ClipboardApplet::action(int id) |
107 | { | 113 | { |
108 | ushort unicode = 0; | 114 | ushort unicode = 0; |
109 | int scan = 0; | 115 | int scan = 0; |
110 | 116 | ||
111 | switch ( id ) { | 117 | switch ( id ) { |
112 | case 100: | 118 | case 100: |
113 | unicode = 'X' - '@'; | 119 | unicode = 'X' - '@'; |
114 | scan = Key_X; // Cut | 120 | scan = Key_X; // Cut |
115 | break; | 121 | break; |
116 | case 101: | 122 | case 101: |
117 | unicode = 'C' - '@'; | 123 | unicode = 'C' - '@'; |
118 | scan = Key_C; // Copy | 124 | scan = Key_C; // Copy |
119 | break; | 125 | break; |
120 | case 102: | 126 | case 102: |
121 | unicode = 'V' - '@'; | 127 | unicode = 'V' - '@'; |
122 | scan = Key_V; // Paste | 128 | scan = Key_V; // Paste |
123 | break; | 129 | break; |
124 | 130 | ||
125 | default: | 131 | default: |
126 | if (( id >= 0 ) && ( uint( id ) < m_history. count ( ))) { | 132 | if (( id >= 0 ) && ( uint( id ) < m_history. count ( ))) { |
127 | QApplication::clipboard ( )-> setText ( m_history [id] ); | 133 | QApplication::clipboard ( )-> setText ( m_history [id] ); |
128 | 134 | ||
129 | for ( uint i = 0; i < m_history. count ( ); i++ ) | 135 | for ( uint i = 0; i < m_history. count ( ); i++ ) |
130 | m_menu-> setItemChecked ( i, i == uint( id )); | 136 | m_menu-> setItemChecked ( i, i == uint( id )); |
131 | 137 | ||
132 | unicode = 'V' - '@'; | 138 | unicode = 'V' - '@'; |
133 | scan = Key_V; | 139 | scan = Key_V; |
134 | } | 140 | } |
135 | break; | 141 | break; |
136 | } | 142 | } |
137 | 143 | ||
138 | if ( scan ) { | 144 | if ( scan ) { |
139 | qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, true, false ); | 145 | qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, true, false ); |
140 | qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, false, false ); | 146 | qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, false, false ); |
141 | } | 147 | } |
142 | } | 148 | } |
143 | 149 | ||
144 | void ClipboardApplet::paintEvent ( QPaintEvent* ) | 150 | void ClipboardApplet::paintEvent ( QPaintEvent* ) |
145 | { | 151 | { |
146 | QPainter p ( this ); | 152 | QPainter p ( this ); |
147 | /* center the height but our pixmap is as big as the height ;)*/ | 153 | /* center the height but our pixmap is as big as the height ;)*/ |
148 | p. drawPixmap( 0, 0, | 154 | p. drawPixmap( 0, 0, |
149 | m_clipboardPixmap ); | 155 | m_clipboardPixmap ); |
150 | } | 156 | } |
151 | 157 | ||
152 | void ClipboardApplet::newData ( ) | 158 | void ClipboardApplet::newData ( ) |
153 | { | 159 | { |
154 | static bool excllock = false; | 160 | static bool excllock = false; |
155 | 161 | ||
156 | if ( excllock ) | 162 | if ( excllock ) |
157 | return; | 163 | return; |
158 | else | 164 | else |
159 | excllock = true; | 165 | excllock = true; |
160 | 166 | ||
161 | m_timer-> stop ( ); | 167 | m_timer-> stop ( ); |
162 | 168 | ||
163 | QCString type = "plain"; | 169 | QCString type = "plain"; |
164 | QString txt = QApplication::clipboard ( )-> text ( type ); | 170 | QString txt = QApplication::clipboard ( )-> text ( type ); |
165 | 171 | ||
166 | if ( !txt. isEmpty ( ) && !m_history. contains ( txt )) { | 172 | if ( !txt. isEmpty ( ) && !m_history. contains ( txt )) { |
167 | m_history. append ( txt ); | 173 | m_history. append ( txt ); |
168 | 174 | ||
169 | if ( m_history. count ( ) > 5 ) | 175 | if ( m_history. count ( ) > 5 ) |
170 | m_history. remove ( m_history. begin ( )); | 176 | m_history. remove ( m_history. begin ( )); |
171 | 177 | ||
172 | m_dirty = true; | 178 | m_dirty = true; |
173 | } | 179 | } |
174 | 180 | ||
175 | m_timer-> start ( 1500, true ); | 181 | m_timer-> start ( 1500, true ); |
176 | 182 | ||
177 | excllock = false; | 183 | excllock = false; |
178 | } | 184 | } |
185 | |||
186 | Q_EXPORT_INTERFACE() | ||
187 | { | ||
188 | Q_CREATE_INSTANCE( OTaskbarAppletWrapper<ClipboardApplet> ); | ||
189 | } | ||
diff --git a/core/applets/clipboardapplet/clipboard.h b/core/applets/clipboardapplet/clipboard.h index ec87d39..bbda0ff 100644 --- a/core/applets/clipboardapplet/clipboard.h +++ b/core/applets/clipboardapplet/clipboard.h | |||
@@ -1,57 +1,58 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
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 | #ifndef __CLIPBOARD_APPLET_H__ | 20 | #ifndef __CLIPBOARD_APPLET_H__ |
21 | #define __CLIPBOARD_APPLET_H__ | 21 | #define __CLIPBOARD_APPLET_H__ |
22 | 22 | ||
23 | #include <qwidget.h> | 23 | #include <qwidget.h> |
24 | #include <qpixmap.h> | 24 | #include <qpixmap.h> |
25 | #include <qstringlist.h> | 25 | #include <qstringlist.h> |
26 | 26 | ||
27 | class QTimer; | 27 | class QTimer; |
28 | 28 | ||
29 | class ClipboardApplet : public QWidget | 29 | class ClipboardApplet : public QWidget |
30 | { | 30 | { |
31 | Q_OBJECT | 31 | Q_OBJECT |
32 | public: | 32 | public: |
33 | ClipboardApplet ( QWidget *parent = 0, const char *name=0 ); | 33 | ClipboardApplet ( QWidget *parent = 0, const char *name=0 ); |
34 | ~ClipboardApplet ( ); | 34 | ~ClipboardApplet ( ); |
35 | static int position(); | ||
35 | 36 | ||
36 | protected: | 37 | protected: |
37 | void mousePressEvent ( QMouseEvent *); | 38 | void mousePressEvent ( QMouseEvent *); |
38 | void paintEvent ( QPaintEvent* ); | 39 | void paintEvent ( QPaintEvent* ); |
39 | 40 | ||
40 | private slots: | 41 | private slots: |
41 | void action ( int ); | 42 | void action ( int ); |
42 | void newData ( ); | 43 | void newData ( ); |
43 | void shutdown ( ); | 44 | void shutdown ( ); |
44 | 45 | ||
45 | private: | 46 | private: |
46 | QPopupMenu * m_menu; | 47 | QPopupMenu * m_menu; |
47 | QStringList m_history; | 48 | QStringList m_history; |
48 | bool m_dirty; | 49 | bool m_dirty; |
49 | QString m_lasttext; | 50 | QString m_lasttext; |
50 | QTimer * m_timer; | 51 | QTimer * m_timer; |
51 | 52 | ||
52 | QPixmap m_clipboardPixmap; | 53 | QPixmap m_clipboardPixmap; |
53 | }; | 54 | }; |
54 | 55 | ||
55 | 56 | ||
56 | #endif // __CLIPBOARD_APPLET_H__ | 57 | #endif // __CLIPBOARD_APPLET_H__ |
57 | 58 | ||
diff --git a/core/applets/clipboardapplet/clipboardapplet.pro b/core/applets/clipboardapplet/clipboardapplet.pro index f6842a2..74cf48c 100644 --- a/core/applets/clipboardapplet/clipboardapplet.pro +++ b/core/applets/clipboardapplet/clipboardapplet.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= clipboard.h clipboardappletimpl.h | 3 | HEADERS = clipboard.h |
4 | SOURCES= clipboard.cpp clipboardappletimpl.cpp | 4 | SOURCES = clipboard.cpp |
5 | TARGET = clipboardapplet | 5 | TARGET = clipboardapplet |
6 | DESTDIR = $(OPIEDIR)/plugins/applets | 6 | DESTDIR = $(OPIEDIR)/plugins/applets |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += ../$(OPIEDIR)/include | 8 | DEPENDPATH += ../$(OPIEDIR)/include |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe |
10 | VERSION = 1.0.0 | 10 | VERSION = 1.0.0 |
11 | 11 | ||
12 | include ( $(OPIEDIR)/include.pro ) | 12 | include ( $(OPIEDIR)/include.pro ) |
13 | target.path = $$prefix/plugins/applets | 13 | target.path = $$prefix/plugins/applets |
diff --git a/core/applets/clipboardapplet/clipboardappletimpl.cpp b/core/applets/clipboardapplet/clipboardappletimpl.cpp deleted file mode 100644 index f454529..0000000 --- a/core/applets/clipboardapplet/clipboardappletimpl.cpp +++ b/dev/null | |||
@@ -1,66 +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 "clipboard.h" | ||
21 | #include "clipboardappletimpl.h" | ||
22 | |||
23 | |||
24 | ClipboardAppletImpl::ClipboardAppletImpl() | ||
25 | : clipboard(0) | ||
26 | { | ||
27 | } | ||
28 | |||
29 | ClipboardAppletImpl::~ClipboardAppletImpl() | ||
30 | { | ||
31 | delete clipboard; | ||
32 | } | ||
33 | |||
34 | QWidget *ClipboardAppletImpl::applet( QWidget *parent ) | ||
35 | { | ||
36 | if ( !clipboard ) | ||
37 | clipboard = new ClipboardApplet( parent ); | ||
38 | return clipboard; | ||
39 | } | ||
40 | |||
41 | int ClipboardAppletImpl::position() const | ||
42 | { | ||
43 | return 6; | ||
44 | } | ||
45 | |||
46 | QRESULT ClipboardAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | ||
47 | { | ||
48 | *iface = 0; | ||
49 | if ( uuid == IID_QUnknown ) | ||
50 | *iface = this; | ||
51 | else if ( uuid == IID_TaskbarApplet ) | ||
52 | *iface = this; | ||
53 | else | ||
54 | return QS_FALSE; | ||
55 | |||
56 | if ( *iface ) | ||
57 | (*iface)->addRef(); | ||
58 | return QS_OK; | ||
59 | } | ||
60 | |||
61 | Q_EXPORT_INTERFACE() | ||
62 | { | ||
63 | Q_CREATE_INSTANCE( ClipboardAppletImpl ) | ||
64 | } | ||
65 | |||
66 | |||
diff --git a/core/applets/clipboardapplet/clipboardappletimpl.h b/core/applets/clipboardapplet/clipboardappletimpl.h deleted file mode 100644 index 497360c..0000000 --- a/core/applets/clipboardapplet/clipboardappletimpl.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 CLIPBOARDAPPLETIMPL_H | ||
21 | #define CLIPBOARDAPPLETIMPL_H | ||
22 | |||
23 | #include <qpe/taskbarappletinterface.h> | ||
24 | |||
25 | class ClipboardApplet; | ||
26 | |||
27 | class ClipboardAppletImpl : public TaskbarAppletInterface | ||
28 | { | ||
29 | public: | ||
30 | ClipboardAppletImpl(); | ||
31 | virtual ~ClipboardAppletImpl(); | ||
32 | |||
33 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | ||
34 | Q_REFCOUNT | ||
35 | |||
36 | virtual QWidget *applet( QWidget *parent ); | ||
37 | virtual int position() const; | ||
38 | |||
39 | private: | ||
40 | ClipboardApplet *clipboard; | ||
41 | }; | ||
42 | |||
43 | #endif | ||
diff --git a/core/applets/clockapplet/clock.cpp b/core/applets/clockapplet/clock.cpp index aadd9b6..9fead03 100644 --- a/core/applets/clockapplet/clock.cpp +++ b/core/applets/clockapplet/clock.cpp | |||
@@ -1,109 +1,121 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
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 "clock.h" | 21 | #include "clock.h" |
22 | 22 | ||
23 | #include <opie2/otaskbarapplet.h> | ||
23 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
24 | #include <qpe/qcopenvelope_qws.h> | 25 | #include <qpe/qcopenvelope_qws.h> |
25 | #include <qpe/config.h> | 26 | #include <qpe/config.h> |
26 | 27 | ||
27 | LauncherClock::LauncherClock( QWidget *parent ) : QLabel( parent ) | 28 | LauncherClock::LauncherClock( QWidget *parent ) : QLabel( parent ) |
28 | { | 29 | { |
29 | // If you want a sunken border around the clock do this: | 30 | // If you want a sunken border around the clock do this: |
30 | // setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 31 | // setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
31 | //setFont( QFont( "Helvetica", , QFont::Normal ) ); | 32 | //setFont( QFont( "Helvetica", , QFont::Normal ) ); |
32 | connect( qApp, SIGNAL( timeChanged() ), this, SLOT( updateTime( ) ) ); | 33 | connect( qApp, SIGNAL( timeChanged() ), this, SLOT( updateTime( ) ) ); |
33 | connect( qApp, SIGNAL( clockChanged( bool ) ), | 34 | connect( qApp, SIGNAL( clockChanged( bool ) ), |
34 | this, SLOT( slotClockChanged( bool ) ) ); | 35 | this, SLOT( slotClockChanged( bool ) ) ); |
35 | readConfig(); | 36 | readConfig(); |
36 | timerId = 0; | 37 | timerId = 0; |
37 | timerEvent( 0 ); | 38 | timerEvent( 0 ); |
38 | show(); | 39 | show(); |
39 | } | 40 | } |
40 | 41 | ||
42 | int LauncherClock::position() | ||
43 | { | ||
44 | return 10; | ||
45 | } | ||
46 | |||
41 | void LauncherClock::readConfig() { | 47 | void LauncherClock::readConfig() { |
42 | Config config( "qpe" ); | 48 | Config config( "qpe" ); |
43 | config.setGroup( "Time" ); | 49 | config.setGroup( "Time" ); |
44 | ampmFormat = config.readBoolEntry( "AMPM", TRUE ); | 50 | ampmFormat = config.readBoolEntry( "AMPM", TRUE ); |
45 | config.setGroup( "Date" ); | 51 | config.setGroup( "Date" ); |
46 | format = config.readNumEntry("ClockApplet",0); | 52 | format = config.readNumEntry("ClockApplet",0); |
47 | } | 53 | } |
48 | 54 | ||
49 | void LauncherClock::mouseReleaseEvent( QMouseEvent * ) | 55 | void LauncherClock::mouseReleaseEvent( QMouseEvent * ) |
50 | { | 56 | { |
51 | QCString setTimeApp; | 57 | QCString setTimeApp; |
52 | setTimeApp="systemtime"; | 58 | setTimeApp="systemtime"; |
53 | QCopEnvelope e("QPE/Application/"+setTimeApp, "raise()"); | 59 | QCopEnvelope e("QPE/Application/"+setTimeApp, "raise()"); |
54 | } | 60 | } |
55 | 61 | ||
56 | 62 | ||
57 | void LauncherClock::timerEvent( QTimerEvent *e ) | 63 | void LauncherClock::timerEvent( QTimerEvent *e ) |
58 | { | 64 | { |
59 | if ( !e || e->timerId() == timerId ) { | 65 | if ( !e || e->timerId() == timerId ) { |
60 | killTimer( timerId ); | 66 | killTimer( timerId ); |
61 | changeTime(); | 67 | changeTime(); |
62 | QTime t = QTime::currentTime(); | 68 | QTime t = QTime::currentTime(); |
63 | int ms = (60 - t.second())*1000 - t.msec(); | 69 | int ms = (60 - t.second())*1000 - t.msec(); |
64 | timerId = startTimer( ms ); | 70 | timerId = startTimer( ms ); |
65 | } else { | 71 | } else { |
66 | QLabel::timerEvent( e ); | 72 | QLabel::timerEvent( e ); |
67 | } | 73 | } |
68 | } | 74 | } |
69 | 75 | ||
70 | void LauncherClock::updateTime( void ) | 76 | void LauncherClock::updateTime( void ) |
71 | { | 77 | { |
72 | changeTime(); | 78 | changeTime(); |
73 | } | 79 | } |
74 | 80 | ||
75 | void LauncherClock::changeTime( void ) | 81 | void LauncherClock::changeTime( void ) |
76 | { | 82 | { |
77 | QTime tm = QDateTime::currentDateTime().time(); | 83 | QTime tm = QDateTime::currentDateTime().time(); |
78 | QString s; | 84 | QString s; |
79 | if( ampmFormat ) { | 85 | if( ampmFormat ) { |
80 | int hour = tm.hour(); | 86 | int hour = tm.hour(); |
81 | if (hour == 0) | 87 | if (hour == 0) |
82 | hour = 12; | 88 | hour = 12; |
83 | if (hour > 12) | 89 | if (hour > 12) |
84 | hour -= 12; | 90 | hour -= 12; |
85 | s.sprintf( "%2d:%02d %s", hour, tm.minute(), | 91 | s.sprintf( "%2d:%02d %s", hour, tm.minute(), |
86 | (tm.hour() >= 12) ? "PM" : "AM" ); | 92 | (tm.hour() >= 12) ? "PM" : "AM" ); |
87 | } else | 93 | } else |
88 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); | 94 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); |
89 | 95 | ||
90 | if (format==1) { | 96 | if (format==1) { |
91 | QDate dm = QDate::currentDate(); | 97 | QDate dm = QDate::currentDate(); |
92 | QString d; | 98 | QString d; |
93 | d.sprintf("%d/%d ", dm.day(), dm.month()); | 99 | d.sprintf("%d/%d ", dm.day(), dm.month()); |
94 | setText( d+s ); | 100 | setText( d+s ); |
95 | } else if (format==2) { | 101 | } else if (format==2) { |
96 | QDate dm = QDate::currentDate(); | 102 | QDate dm = QDate::currentDate(); |
97 | QString d; | 103 | QString d; |
98 | d.sprintf("%d/%d ", dm.month(), dm.day()); | 104 | d.sprintf("%d/%d ", dm.month(), dm.day()); |
99 | setText( d+s ); | 105 | setText( d+s ); |
100 | } else { | 106 | } else { |
101 | setText( s ); | 107 | setText( s ); |
102 | } | 108 | } |
103 | } | 109 | } |
104 | 110 | ||
105 | void LauncherClock::slotClockChanged( bool pm ) | 111 | void LauncherClock::slotClockChanged( bool pm ) |
106 | { | 112 | { |
107 | readConfig(); | 113 | readConfig(); |
108 | updateTime(); | 114 | updateTime(); |
109 | } | 115 | } |
116 | |||
117 | Q_EXPORT_INTERFACE() | ||
118 | { | ||
119 | Q_CREATE_INSTANCE( OTaskbarAppletWrapper<LauncherClock> ); | ||
120 | } | ||
121 | |||
diff --git a/core/applets/clockapplet/clock.h b/core/applets/clockapplet/clock.h index caa0c5f..996fb56 100644 --- a/core/applets/clockapplet/clock.h +++ b/core/applets/clockapplet/clock.h | |||
@@ -1,48 +1,49 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
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 | #ifndef __LAUNCHER_CLOCK_H__ | 20 | #ifndef __LAUNCHER_CLOCK_H__ |
21 | #define __LAUNCHER_CLOCK_H__ | 21 | #define __LAUNCHER_CLOCK_H__ |
22 | 22 | ||
23 | 23 | ||
24 | #include <qlabel.h> | 24 | #include <qlabel.h> |
25 | #include <qdatetime.h> | 25 | #include <qdatetime.h> |
26 | 26 | ||
27 | class LauncherClock : public QLabel | 27 | class LauncherClock : public QLabel |
28 | { | 28 | { |
29 | Q_OBJECT | 29 | Q_OBJECT |
30 | public: | 30 | public: |
31 | LauncherClock( QWidget *parent ); | 31 | LauncherClock( QWidget *parent ); |
32 | static int position(); | ||
32 | 33 | ||
33 | protected slots: | 34 | protected slots: |
34 | void updateTime( void ); | 35 | void updateTime( void ); |
35 | void slotClockChanged( bool pm ); | 36 | void slotClockChanged( bool pm ); |
36 | 37 | ||
37 | protected: | 38 | protected: |
38 | void mouseReleaseEvent( QMouseEvent * ); | 39 | void mouseReleaseEvent( QMouseEvent * ); |
39 | void timerEvent( QTimerEvent * ); | 40 | void timerEvent( QTimerEvent * ); |
40 | void changeTime( void ); | 41 | void changeTime( void ); |
41 | void readConfig(); | 42 | void readConfig(); |
42 | bool ampmFormat; | 43 | bool ampmFormat; |
43 | int timerId; | 44 | int timerId; |
44 | int format; | 45 | int format; |
45 | }; | 46 | }; |
46 | 47 | ||
47 | 48 | ||
48 | #endif // __LAUNCHER_CLOCK_H__ | 49 | #endif // __LAUNCHER_CLOCK_H__ |
diff --git a/core/applets/clockapplet/clockapplet.pro b/core/applets/clockapplet/clockapplet.pro index 057e332..8ce3f6f 100644 --- a/core/applets/clockapplet/clockapplet.pro +++ b/core/applets/clockapplet/clockapplet.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= clock.h clockappletimpl.h | 3 | HEADERS = clock.h |
4 | SOURCES= clock.cpp clockappletimpl.cpp | 4 | SOURCES = clock.cpp |
5 | TARGET = clockapplet | 5 | TARGET = clockapplet |
6 | DESTDIR = $(OPIEDIR)/plugins/applets | 6 | DESTDIR = $(OPIEDIR)/plugins/applets |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += ../$(OPIEDIR)/include .. | 8 | DEPENDPATH += ../$(OPIEDIR)/include .. |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe |
10 | VERSION = 1.0.0 | 10 | VERSION = 1.0.0 |
11 | 11 | ||
12 | include ( $(OPIEDIR)/include.pro ) | 12 | include ( $(OPIEDIR)/include.pro ) |
13 | target.path = $$prefix/plugins/applets | 13 | target.path = $$prefix/plugins/applets |
diff --git a/core/applets/clockapplet/clockappletimpl.cpp b/core/applets/clockapplet/clockappletimpl.cpp deleted file mode 100644 index 7481f19..0000000 --- a/core/applets/clockapplet/clockappletimpl.cpp +++ b/dev/null | |||
@@ -1,67 +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 "clock.h" | ||
21 | #include "clockappletimpl.h" | ||
22 | |||
23 | |||
24 | ClockAppletImpl::ClockAppletImpl() | ||
25 | : clock(0) | ||
26 | { | ||
27 | } | ||
28 | |||
29 | ClockAppletImpl::~ClockAppletImpl() | ||
30 | { | ||
31 | delete clock; | ||
32 | } | ||
33 | |||
34 | QWidget *ClockAppletImpl::applet( QWidget *parent ) | ||
35 | { | ||
36 | if ( !clock ) | ||
37 | clock = new LauncherClock( parent ); | ||
38 | return clock; | ||
39 | } | ||
40 | |||
41 | int ClockAppletImpl::position() const | ||
42 | { | ||
43 | return 10; | ||
44 | } | ||
45 | |||
46 | #ifndef QT_NO_COMPONENT | ||
47 | QRESULT ClockAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | ||
48 | { | ||
49 | *iface = 0; | ||
50 | if ( uuid == IID_QUnknown ) | ||
51 | *iface = this; | ||
52 | else if ( uuid == IID_TaskbarApplet ) | ||
53 | *iface = this; | ||
54 | else | ||
55 | return QS_FALSE; | ||
56 | |||
57 | if ( *iface ) | ||
58 | (*iface)->addRef(); | ||
59 | return QS_OK; | ||
60 | } | ||
61 | |||
62 | Q_EXPORT_INTERFACE() | ||
63 | { | ||
64 | Q_CREATE_INSTANCE( ClockAppletImpl ) | ||
65 | } | ||
66 | #endif | ||
67 | |||
diff --git a/core/applets/clockapplet/clockappletimpl.h b/core/applets/clockapplet/clockappletimpl.h deleted file mode 100644 index 1f9c8f0..0000000 --- a/core/applets/clockapplet/clockappletimpl.h +++ b/dev/null | |||
@@ -1,45 +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 CLOCKAPPLETIMPL_H | ||
21 | #define CLOCKAPPLETIMPL_H | ||
22 | |||
23 | #include <qpe/taskbarappletinterface.h> | ||
24 | |||
25 | class LauncherClock; | ||
26 | |||
27 | class ClockAppletImpl : public TaskbarAppletInterface | ||
28 | { | ||
29 | public: | ||
30 | ClockAppletImpl(); | ||
31 | virtual ~ClockAppletImpl(); | ||
32 | |||
33 | #ifndef QT_NO_COMPONENT | ||
34 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | ||
35 | Q_REFCOUNT | ||
36 | #endif | ||
37 | |||
38 | virtual QWidget *applet( QWidget *parent ); | ||
39 | virtual int position() const; | ||
40 | |||
41 | private: | ||
42 | LauncherClock *clock; | ||
43 | }; | ||
44 | |||
45 | #endif | ||
diff --git a/core/applets/irdaapplet/irda.cpp b/core/applets/irdaapplet/irda.cpp index a47f33d..afc0592 100644 --- a/core/applets/irdaapplet/irda.cpp +++ b/core/applets/irdaapplet/irda.cpp | |||
@@ -1,352 +1,365 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 David Woodhouse <dwmw2@infradead.org> | 2 | ** Copyright (C) 2002 David Woodhouse <dwmw2@infradead.org> |
3 | ** Max Reiss <harlekin@handhelds.org> [trivial stuff] | 3 | ** Max Reiss <harlekin@handhelds.org> [trivial stuff] |
4 | ** Robert Griebl <sandman@handhelds.org> | 4 | ** Robert Griebl <sandman@handhelds.org> |
5 | ** Holger Freyther <zecke@handhelds.org> QCOP Interface | 5 | ** Holger Freyther <zecke@handhelds.org> QCOP Interface |
6 | ** | 6 | ** |
7 | ** This file may be distributed and/or modified under the terms of the | 7 | ** This file may be distributed and/or modified under the terms of the |
8 | ** GNU General Public License version 2 as published by the Free Software | 8 | ** GNU General Public License version 2 as published by the Free Software |
9 | ** Foundation and appearing in the file LICENSE.GPL included in the | 9 | ** Foundation and appearing in the file LICENSE.GPL included in the |
10 | ** packaging of this file. | 10 | ** packaging of this file. |
11 | ** | 11 | ** |
12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | ** | 14 | ** |
15 | **********************************************************************/ | 15 | **********************************************************************/ |
16 | 16 | ||
17 | #include "irda.h" | ||
17 | 18 | ||
19 | /* OPIE */ | ||
20 | #include <opie2/otaskbarapplet.h> | ||
18 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
19 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
20 | 23 | ||
24 | /* QT */ | ||
21 | #include <qpainter.h> | 25 | #include <qpainter.h> |
22 | #include <qfile.h> | 26 | #include <qfile.h> |
23 | #include <qtimer.h> | 27 | #include <qtimer.h> |
24 | #include <qtextstream.h> | 28 | #include <qtextstream.h> |
25 | 29 | ||
30 | /* STD */ | ||
26 | #include <unistd.h> | 31 | #include <unistd.h> |
27 | #include <net/if.h> | 32 | #include <net/if.h> |
28 | #include <netinet/in.h> | 33 | #include <netinet/in.h> |
29 | #include <sys/types.h> | 34 | #include <sys/types.h> |
30 | #include <sys/socket.h> | 35 | #include <sys/socket.h> |
31 | #include <sys/ioctl.h> | 36 | #include <sys/ioctl.h> |
32 | 37 | ||
33 | #include "irda.h" | ||
34 | |||
35 | //=========================================================================== | 38 | //=========================================================================== |
36 | 39 | ||
37 | IrdaApplet::IrdaApplet ( QWidget *parent, const char *name ) | 40 | IrdaApplet::IrdaApplet ( QWidget *parent, const char *name ) |
38 | : QWidget ( parent, name ) | 41 | : QWidget ( parent, name ) |
39 | { | 42 | { |
40 | setFixedHeight ( 18 ); | 43 | setFixedHeight ( 18 ); |
41 | setFixedWidth ( 14 ); | 44 | setFixedWidth ( 14 ); |
42 | 45 | ||
43 | m_sockfd = ::socket ( PF_INET, SOCK_DGRAM, IPPROTO_IP ); | 46 | m_sockfd = ::socket ( PF_INET, SOCK_DGRAM, IPPROTO_IP ); |
44 | 47 | ||
45 | m_irdaOnPixmap = Resource::loadPixmap( "irdaapplet/irdaon" ); | 48 | m_irdaOnPixmap = Resource::loadPixmap( "irdaapplet/irdaon" ); |
46 | m_irdaOffPixmap = Resource::loadPixmap( "irdaapplet/irdaoff" ); | 49 | m_irdaOffPixmap = Resource::loadPixmap( "irdaapplet/irdaoff" ); |
47 | m_irdaDiscoveryOnPixmap = Resource::loadPixmap( "irdaapplet/magglass" ); | 50 | m_irdaDiscoveryOnPixmap = Resource::loadPixmap( "irdaapplet/magglass" ); |
48 | m_receiveActivePixmap = Resource::loadPixmap( "irdaapplet/receive" ); | 51 | m_receiveActivePixmap = Resource::loadPixmap( "irdaapplet/receive" ); |
49 | 52 | ||
50 | m_irda_active = false; | 53 | m_irda_active = false; |
51 | m_irda_discovery_active = false; | 54 | m_irda_discovery_active = false; |
52 | m_receive_active = false; | 55 | m_receive_active = false; |
53 | m_receive_state_changed = false; | 56 | m_receive_state_changed = false; |
54 | m_popup = 0; | 57 | m_popup = 0; |
55 | m_wasOn = false; | 58 | m_wasOn = false; |
56 | m_wasDiscover = false; | 59 | m_wasDiscover = false; |
57 | 60 | ||
58 | QCopChannel* chan = new QCopChannel("QPE/IrDaApplet", this ); | 61 | QCopChannel* chan = new QCopChannel("QPE/IrDaApplet", this ); |
59 | connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), | 62 | connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), |
60 | this, SLOT(slotMessage(const QCString&, const QByteArray& ) ) ); | 63 | this, SLOT(slotMessage(const QCString&, const QByteArray& ) ) ); |
61 | } | 64 | } |
62 | 65 | ||
66 | int IrdaApplet::position() | ||
67 | { | ||
68 | return 6; | ||
69 | } | ||
70 | |||
63 | void IrdaApplet::show() | 71 | void IrdaApplet::show() |
64 | { | 72 | { |
65 | QWidget::show ( ); | 73 | QWidget::show ( ); |
66 | startTimer ( 2000 ); | 74 | startTimer ( 2000 ); |
67 | } | 75 | } |
68 | 76 | ||
69 | IrdaApplet::~IrdaApplet() | 77 | IrdaApplet::~IrdaApplet() |
70 | { | 78 | { |
71 | if ( m_sockfd >= 0 ) | 79 | if ( m_sockfd >= 0 ) |
72 | ::close ( m_sockfd ); | 80 | ::close ( m_sockfd ); |
73 | } | 81 | } |
74 | 82 | ||
75 | void IrdaApplet::popup ( QString message, QString icon ) | 83 | void IrdaApplet::popup ( QString message, QString icon ) |
76 | { | 84 | { |
77 | if ( !m_popup ) | 85 | if ( !m_popup ) |
78 | m_popup = new QPopupMenu ( this ); | 86 | m_popup = new QPopupMenu ( this ); |
79 | 87 | ||
80 | m_popup-> clear ( ); | 88 | m_popup-> clear ( ); |
81 | 89 | ||
82 | if ( icon. isEmpty ( )) | 90 | if ( icon. isEmpty ( )) |
83 | m_popup-> insertItem ( message, 0 ); | 91 | m_popup-> insertItem ( message, 0 ); |
84 | else | 92 | else |
85 | m_popup-> insertItem ( QIconSet ( Resource::loadPixmap ( icon )), message, 0 ); | 93 | m_popup-> insertItem ( QIconSet ( Resource::loadPixmap ( icon )), message, 0 ); |
86 | 94 | ||
87 | QPoint p = mapToGlobal ( QPoint ( 0, 0 )); | 95 | QPoint p = mapToGlobal ( QPoint ( 0, 0 )); |
88 | QSize s = m_popup-> sizeHint ( ); | 96 | QSize s = m_popup-> sizeHint ( ); |
89 | m_popup-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), | 97 | m_popup-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), |
90 | p. y ( ) - s. height ( ))); | 98 | p. y ( ) - s. height ( ))); |
91 | 99 | ||
92 | QTimer::singleShot ( 2000, this, SLOT( popupTimeout ( ))); | 100 | QTimer::singleShot ( 2000, this, SLOT( popupTimeout ( ))); |
93 | } | 101 | } |
94 | 102 | ||
95 | void IrdaApplet::popupTimeout ( ) | 103 | void IrdaApplet::popupTimeout ( ) |
96 | { | 104 | { |
97 | m_popup-> hide ( ); | 105 | m_popup-> hide ( ); |
98 | } | 106 | } |
99 | 107 | ||
100 | bool IrdaApplet::checkIrdaStatus ( ) | 108 | bool IrdaApplet::checkIrdaStatus ( ) |
101 | { | 109 | { |
102 | struct ifreq ifr; | 110 | struct ifreq ifr; |
103 | strcpy ( ifr. ifr_name, "irda0" ); | 111 | strcpy ( ifr. ifr_name, "irda0" ); |
104 | 112 | ||
105 | if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 ) | 113 | if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 ) |
106 | return false; | 114 | return false; |
107 | 115 | ||
108 | return ( ifr. ifr_flags & IFF_UP ); | 116 | return ( ifr. ifr_flags & IFF_UP ); |
109 | } | 117 | } |
110 | 118 | ||
111 | bool IrdaApplet::setIrdaStatus ( bool b ) | 119 | bool IrdaApplet::setIrdaStatus ( bool b ) |
112 | { | 120 | { |
113 | struct ifreq ifr; | 121 | struct ifreq ifr; |
114 | strcpy ( ifr. ifr_name, "irda0" ); | 122 | strcpy ( ifr. ifr_name, "irda0" ); |
115 | 123 | ||
116 | if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 ) | 124 | if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 ) |
117 | return false; | 125 | return false; |
118 | 126 | ||
119 | if ( b ) { | 127 | if ( b ) { |
120 | ifr. ifr_flags |= IFF_UP; | 128 | ifr. ifr_flags |= IFF_UP; |
121 | } | 129 | } |
122 | else { | 130 | else { |
123 | setIrdaDiscoveryStatus ( 0 ); | 131 | setIrdaDiscoveryStatus ( 0 ); |
124 | setIrdaReceiveStatus ( 0 ); | 132 | setIrdaReceiveStatus ( 0 ); |
125 | ifr. ifr_flags &= ~IFF_UP; | 133 | ifr. ifr_flags &= ~IFF_UP; |
126 | } | 134 | } |
127 | 135 | ||
128 | if ( ::ioctl ( m_sockfd, SIOCSIFFLAGS, &ifr ) < 0 ) | 136 | if ( ::ioctl ( m_sockfd, SIOCSIFFLAGS, &ifr ) < 0 ) |
129 | return false; | 137 | return false; |
130 | 138 | ||
131 | return true; | 139 | return true; |
132 | } | 140 | } |
133 | 141 | ||
134 | bool IrdaApplet::checkIrdaDiscoveryStatus ( ) | 142 | bool IrdaApplet::checkIrdaDiscoveryStatus ( ) |
135 | { | 143 | { |
136 | QFile discovery ( "/proc/sys/net/irda/discovery" ); | 144 | QFile discovery ( "/proc/sys/net/irda/discovery" ); |
137 | 145 | ||
138 | QString streamIn = "0"; | 146 | QString streamIn = "0"; |
139 | 147 | ||
140 | if ( discovery. open ( IO_ReadOnly )) { | 148 | if ( discovery. open ( IO_ReadOnly )) { |
141 | QTextStream stream ( &discovery ); | 149 | QTextStream stream ( &discovery ); |
142 | streamIn = stream. read ( ); | 150 | streamIn = stream. read ( ); |
143 | } | 151 | } |
144 | 152 | ||
145 | return streamIn. toInt ( ) > 0; | 153 | return streamIn. toInt ( ) > 0; |
146 | } | 154 | } |
147 | 155 | ||
148 | 156 | ||
149 | bool IrdaApplet::setIrdaDiscoveryStatus ( bool d ) | 157 | bool IrdaApplet::setIrdaDiscoveryStatus ( bool d ) |
150 | { | 158 | { |
151 | QFile discovery ( "/proc/sys/net/irda/discovery" ); | 159 | QFile discovery ( "/proc/sys/net/irda/discovery" ); |
152 | 160 | ||
153 | if ( discovery. open ( IO_WriteOnly | IO_Raw )) { | 161 | if ( discovery. open ( IO_WriteOnly | IO_Raw )) { |
154 | discovery.putch ( d ? '1' : '0' ); | 162 | discovery.putch ( d ? '1' : '0' ); |
155 | return true; | 163 | return true; |
156 | } | 164 | } |
157 | return false; | 165 | return false; |
158 | } | 166 | } |
159 | 167 | ||
160 | 168 | ||
161 | bool IrdaApplet::setIrdaReceiveStatus ( bool d ) | 169 | bool IrdaApplet::setIrdaReceiveStatus ( bool d ) |
162 | { | 170 | { |
163 | QCopEnvelope e ( "QPE/Obex", "receive(int)" ); | 171 | QCopEnvelope e ( "QPE/Obex", "receive(int)" ); |
164 | e << ( d ? 1 : 0 ); | 172 | e << ( d ? 1 : 0 ); |
165 | 173 | ||
166 | m_receive_active = d; | 174 | m_receive_active = d; |
167 | m_receive_state_changed = true; | 175 | m_receive_state_changed = true; |
168 | 176 | ||
169 | return true; | 177 | return true; |
170 | } | 178 | } |
171 | 179 | ||
172 | 180 | ||
173 | void IrdaApplet::showDiscovered ( ) | 181 | void IrdaApplet::showDiscovered ( ) |
174 | { | 182 | { |
175 | //static Sound snd_found ( "irdaapplet/irdaon" ); | 183 | //static Sound snd_found ( "irdaapplet/irdaon" ); |
176 | //static Sound snd_lost ( "irdaapplet/irdaoff" ); | 184 | //static Sound snd_lost ( "irdaapplet/irdaoff" ); |
177 | 185 | ||
178 | QFile discovery ( "/proc/net/irda/discovery" ); | 186 | QFile discovery ( "/proc/net/irda/discovery" ); |
179 | 187 | ||
180 | if ( discovery. open ( IO_ReadOnly )) { | 188 | if ( discovery. open ( IO_ReadOnly )) { |
181 | bool qcopsend = false; | 189 | bool qcopsend = false; |
182 | 190 | ||
183 | QString discoveredDevice; | 191 | QString discoveredDevice; |
184 | QString deviceAddr; | 192 | QString deviceAddr; |
185 | 193 | ||
186 | // since it is /proc we _must_ use QTextStream | 194 | // since it is /proc we _must_ use QTextStream |
187 | QStringList list = QStringList::split ( "\n", QTextStream ( &discovery ). read ( )); | 195 | QStringList list = QStringList::split ( "\n", QTextStream ( &discovery ). read ( )); |
188 | 196 | ||
189 | QMap <QString, QString>::Iterator it; | 197 | QMap <QString, QString>::Iterator it; |
190 | 198 | ||
191 | for ( it = m_devices. begin ( ); it != m_devices. end ( ); ++it ) | 199 | for ( it = m_devices. begin ( ); it != m_devices. end ( ); ++it ) |
192 | it. data ( ). prepend ( "+++" ); | 200 | it. data ( ). prepend ( "+++" ); |
193 | 201 | ||
194 | for ( QStringList::Iterator lit = list. begin ( ); lit != list. end ( ); ++lit ) { | 202 | for ( QStringList::Iterator lit = list. begin ( ); lit != list. end ( ); ++lit ) { |
195 | const QString &line = *lit; | 203 | const QString &line = *lit; |
196 | 204 | ||
197 | if ( line. startsWith ( "nickname:" )) { | 205 | if ( line. startsWith ( "nickname:" )) { |
198 | discoveredDevice = line. mid ( line. find ( ':' ) + 2, line. find ( ',' ) - line. find ( ':' ) - 2 ); | 206 | discoveredDevice = line. mid ( line. find ( ':' ) + 2, line. find ( ',' ) - line. find ( ':' ) - 2 ); |
199 | deviceAddr = line. mid ( line. find ( "daddr:" ) + 9, 8 ); | 207 | deviceAddr = line. mid ( line. find ( "daddr:" ) + 9, 8 ); |
200 | 208 | ||
201 | // qDebug(discoveredDevice + "(" + deviceAddr + ")"); | 209 | // qDebug(discoveredDevice + "(" + deviceAddr + ")"); |
202 | 210 | ||
203 | if ( !m_devices. contains ( deviceAddr )) { | 211 | if ( !m_devices. contains ( deviceAddr )) { |
204 | popup ( tr( "Found:" ) + " " + discoveredDevice ); | 212 | popup ( tr( "Found:" ) + " " + discoveredDevice ); |
205 | //snd_found. play ( ); | 213 | //snd_found. play ( ); |
206 | qcopsend = true; | 214 | qcopsend = true; |
207 | } | 215 | } |
208 | m_devices. replace ( deviceAddr, discoveredDevice ); | 216 | m_devices. replace ( deviceAddr, discoveredDevice ); |
209 | } | 217 | } |
210 | } | 218 | } |
211 | 219 | ||
212 | for ( it = m_devices. begin ( ); it != m_devices. end ( ); ) { | 220 | for ( it = m_devices. begin ( ); it != m_devices. end ( ); ) { |
213 | // qDebug("IrdaMon: delete " + it.currentKey() + "=" + *devicesAvailable[it.currentKey()] + "?"); | 221 | // qDebug("IrdaMon: delete " + it.currentKey() + "=" + *devicesAvailable[it.currentKey()] + "?"); |
214 | 222 | ||
215 | if ( it. data ( ). left ( 3 ) == "+++" ) { | 223 | if ( it. data ( ). left ( 3 ) == "+++" ) { |
216 | popup ( tr( "Lost:" ) + " " + it. data ( ). mid ( 3 )); | 224 | popup ( tr( "Lost:" ) + " " + it. data ( ). mid ( 3 )); |
217 | //snd_lost. play ( ); | 225 | //snd_lost. play ( ); |
218 | 226 | ||
219 | QMap <QString, QString>::Iterator tmp = it; | 227 | QMap <QString, QString>::Iterator tmp = it; |
220 | tmp++; | 228 | tmp++; |
221 | m_devices. remove ( it ); // in contrast to QValueListIterator this remove doesn't return the next Iterator | 229 | m_devices. remove ( it ); // in contrast to QValueListIterator this remove doesn't return the next Iterator |
222 | it = tmp; | 230 | it = tmp; |
223 | 231 | ||
224 | qcopsend = true; | 232 | qcopsend = true; |
225 | } | 233 | } |
226 | else | 234 | else |
227 | it++; | 235 | it++; |
228 | } | 236 | } |
229 | // XXX if( qcopsend ) { | 237 | // XXX if( qcopsend ) { |
230 | QCopEnvelope e ( "QPE/Network", "irdaSend(bool)" ); | 238 | QCopEnvelope e ( "QPE/Network", "irdaSend(bool)" ); |
231 | e << ( m_devices. count ( ) > 0 ); | 239 | e << ( m_devices. count ( ) > 0 ); |
232 | // } | 240 | // } |
233 | } | 241 | } |
234 | } | 242 | } |
235 | 243 | ||
236 | void IrdaApplet::mousePressEvent ( QMouseEvent * ) | 244 | void IrdaApplet::mousePressEvent ( QMouseEvent * ) |
237 | { | 245 | { |
238 | QPopupMenu *menu = new QPopupMenu ( this ); | 246 | QPopupMenu *menu = new QPopupMenu ( this ); |
239 | QString cmd; | 247 | QString cmd; |
240 | 248 | ||
241 | /* Refresh active state */ | 249 | /* Refresh active state */ |
242 | timerEvent ( 0 ); | 250 | timerEvent ( 0 ); |
243 | 251 | ||
244 | //menu->insertItem( tr("More..."), 4 ); | 252 | //menu->insertItem( tr("More..."), 4 ); |
245 | 253 | ||
246 | if ( m_irda_active && !m_devices. isEmpty ( )) { | 254 | if ( m_irda_active && !m_devices. isEmpty ( )) { |
247 | menu-> insertItem ( tr( "Discovered Device:" ), 9 ); | 255 | menu-> insertItem ( tr( "Discovered Device:" ), 9 ); |
248 | 256 | ||
249 | for ( QMap<QString, QString>::Iterator it = m_devices. begin ( ); it != m_devices. end ( ); ++it ) | 257 | for ( QMap<QString, QString>::Iterator it = m_devices. begin ( ); it != m_devices. end ( ); ++it ) |
250 | menu-> insertItem ( *it ); | 258 | menu-> insertItem ( *it ); |
251 | 259 | ||
252 | menu-> insertSeparator ( ); | 260 | menu-> insertSeparator ( ); |
253 | } | 261 | } |
254 | 262 | ||
255 | menu-> insertItem ( m_irda_active ? tr( "Disable IrDA" ) : tr( "Enable IrDA" ), 0 ); | 263 | menu-> insertItem ( m_irda_active ? tr( "Disable IrDA" ) : tr( "Enable IrDA" ), 0 ); |
256 | 264 | ||
257 | if ( m_irda_active ) { | 265 | if ( m_irda_active ) { |
258 | menu-> insertItem ( m_irda_discovery_active ? tr( "Disable Discovery" ) : tr( "Enable Discovery" ), 1 ); | 266 | menu-> insertItem ( m_irda_discovery_active ? tr( "Disable Discovery" ) : tr( "Enable Discovery" ), 1 ); |
259 | menu-> insertItem ( m_receive_active ? tr( "Disable Receive" ) : tr( "Enable Receive" ), 2 ); | 267 | menu-> insertItem ( m_receive_active ? tr( "Disable Receive" ) : tr( "Enable Receive" ), 2 ); |
260 | } | 268 | } |
261 | 269 | ||
262 | QPoint p = mapToGlobal ( QPoint ( 0, 0 ) ); | 270 | QPoint p = mapToGlobal ( QPoint ( 0, 0 ) ); |
263 | QSize s = menu-> sizeHint ( ); | 271 | QSize s = menu-> sizeHint ( ); |
264 | 272 | ||
265 | p = QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( )); | 273 | p = QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( )); |
266 | 274 | ||
267 | switch ( menu-> exec ( p )) { | 275 | switch ( menu-> exec ( p )) { |
268 | case 0: | 276 | case 0: |
269 | setIrdaStatus ( !m_irda_active ); | 277 | setIrdaStatus ( !m_irda_active ); |
270 | timerEvent ( 0 ); | 278 | timerEvent ( 0 ); |
271 | break; | 279 | break; |
272 | case 1: | 280 | case 1: |
273 | setIrdaDiscoveryStatus ( !m_irda_discovery_active ); | 281 | setIrdaDiscoveryStatus ( !m_irda_discovery_active ); |
274 | timerEvent ( 0 ); | 282 | timerEvent ( 0 ); |
275 | break; | 283 | break; |
276 | case 2: | 284 | case 2: |
277 | setIrdaReceiveStatus ( !m_receive_active ); | 285 | setIrdaReceiveStatus ( !m_receive_active ); |
278 | timerEvent( 0 ); | 286 | timerEvent( 0 ); |
279 | break; | 287 | break; |
280 | } | 288 | } |
281 | 289 | ||
282 | delete menu; | 290 | delete menu; |
283 | } | 291 | } |
284 | 292 | ||
285 | void IrdaApplet::timerEvent ( QTimerEvent * ) | 293 | void IrdaApplet::timerEvent ( QTimerEvent * ) |
286 | { | 294 | { |
287 | bool oldactive = m_irda_active; | 295 | bool oldactive = m_irda_active; |
288 | bool olddiscovery = m_irda_discovery_active; | 296 | bool olddiscovery = m_irda_discovery_active; |
289 | bool receiveUpdate = false; | 297 | bool receiveUpdate = false; |
290 | 298 | ||
291 | if ( m_receive_state_changed ) { | 299 | if ( m_receive_state_changed ) { |
292 | receiveUpdate = true; | 300 | receiveUpdate = true; |
293 | m_receive_state_changed = false; | 301 | m_receive_state_changed = false; |
294 | } | 302 | } |
295 | 303 | ||
296 | m_irda_active = checkIrdaStatus ( ); | 304 | m_irda_active = checkIrdaStatus ( ); |
297 | m_irda_discovery_active = checkIrdaDiscoveryStatus ( ); | 305 | m_irda_discovery_active = checkIrdaDiscoveryStatus ( ); |
298 | 306 | ||
299 | if ( m_irda_discovery_active ) | 307 | if ( m_irda_discovery_active ) |
300 | showDiscovered ( ); | 308 | showDiscovered ( ); |
301 | 309 | ||
302 | if (( m_irda_active != oldactive ) || ( m_irda_discovery_active != olddiscovery ) || receiveUpdate ) | 310 | if (( m_irda_active != oldactive ) || ( m_irda_discovery_active != olddiscovery ) || receiveUpdate ) |
303 | update ( ); | 311 | update ( ); |
304 | } | 312 | } |
305 | 313 | ||
306 | void IrdaApplet::paintEvent ( QPaintEvent * ) | 314 | void IrdaApplet::paintEvent ( QPaintEvent * ) |
307 | { | 315 | { |
308 | QPainter p ( this ); | 316 | QPainter p ( this ); |
309 | 317 | ||
310 | p. drawPixmap ( 0, 1, m_irda_active ? m_irdaOnPixmap : m_irdaOffPixmap ); | 318 | p. drawPixmap ( 0, 1, m_irda_active ? m_irdaOnPixmap : m_irdaOffPixmap ); |
311 | 319 | ||
312 | if ( m_irda_discovery_active ) | 320 | if ( m_irda_discovery_active ) |
313 | p. drawPixmap( 0, 1, m_irdaDiscoveryOnPixmap ); | 321 | p. drawPixmap( 0, 1, m_irdaDiscoveryOnPixmap ); |
314 | 322 | ||
315 | if ( m_receive_active ) | 323 | if ( m_receive_active ) |
316 | p. drawPixmap( 0, 1, m_receiveActivePixmap ); | 324 | p. drawPixmap( 0, 1, m_receiveActivePixmap ); |
317 | } | 325 | } |
318 | /* | 326 | /* |
319 | * We know 3 calls | 327 | * We know 3 calls |
320 | * a) enable | 328 | * a) enable |
321 | * b) disable | 329 | * b) disable |
322 | * a and b will temp enable the IrDa device and disable will disable it again if it wasn't on | 330 | * a and b will temp enable the IrDa device and disable will disable it again if it wasn't on |
323 | * c) listDevices: We will return a list of known devices | 331 | * c) listDevices: We will return a list of known devices |
324 | */ | 332 | */ |
325 | void IrdaApplet::slotMessage( const QCString& str, const QByteArray& ar ) { | 333 | void IrdaApplet::slotMessage( const QCString& str, const QByteArray& ar ) { |
326 | if ( str == "enableIrda()") { | 334 | if ( str == "enableIrda()") { |
327 | m_wasOn = checkIrdaStatus(); | 335 | m_wasOn = checkIrdaStatus(); |
328 | m_wasDiscover = checkIrdaDiscoveryStatus(); | 336 | m_wasDiscover = checkIrdaDiscoveryStatus(); |
329 | if (!m_wasOn) { | 337 | if (!m_wasOn) { |
330 | setIrdaStatus( true ); | 338 | setIrdaStatus( true ); |
331 | } | 339 | } |
332 | if ( !m_wasDiscover ) { | 340 | if ( !m_wasDiscover ) { |
333 | setIrdaDiscoveryStatus ( true ); | 341 | setIrdaDiscoveryStatus ( true ); |
334 | } | 342 | } |
335 | } else if ( str == "disableIrda()") { | 343 | } else if ( str == "disableIrda()") { |
336 | if (!m_wasOn) { | 344 | if (!m_wasOn) { |
337 | setIrdaStatus( false ); | 345 | setIrdaStatus( false ); |
338 | } | 346 | } |
339 | if ( !m_wasDiscover ) { | 347 | if ( !m_wasDiscover ) { |
340 | setIrdaDiscoveryStatus ( false ); | 348 | setIrdaDiscoveryStatus ( false ); |
341 | } | 349 | } |
342 | } else if ( str == "listDevices()") { | 350 | } else if ( str == "listDevices()") { |
343 | QCopEnvelope e("QPE/IrDaAppletBack", "devices(QStringList)"); | 351 | QCopEnvelope e("QPE/IrDaAppletBack", "devices(QStringList)"); |
344 | 352 | ||
345 | QStringList list; | 353 | QStringList list; |
346 | QMap<QString, QString>::Iterator it; | 354 | QMap<QString, QString>::Iterator it; |
347 | for (it = m_devices.begin(); it != m_devices.end(); ++it ) | 355 | for (it = m_devices.begin(); it != m_devices.end(); ++it ) |
348 | list << (*it); | 356 | list << (*it); |
349 | 357 | ||
350 | e << list; | 358 | e << list; |
351 | } | 359 | } |
352 | } | 360 | } |
361 | |||
362 | Q_EXPORT_INTERFACE() | ||
363 | { | ||
364 | Q_CREATE_INSTANCE( OTaskbarAppletWrapper<IrdaApplet> ); | ||
365 | } | ||
diff --git a/core/applets/irdaapplet/irda.h b/core/applets/irdaapplet/irda.h index ec1d32c..f713bbe 100644 --- a/core/applets/irdaapplet/irda.h +++ b/core/applets/irdaapplet/irda.h | |||
@@ -1,76 +1,77 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com, | 2 | ** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com, |
3 | ** Robert Griebl sandman@handhelds.org | 3 | ** Robert Griebl sandman@handhelds.org |
4 | ** All rights reserved. | 4 | ** All rights reserved. |
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 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #ifndef __OPIE_IRDA_APPLET_H__ | 16 | #ifndef __OPIE_IRDA_APPLET_H__ |
17 | #define __OPIE_IRDA_APPLET_H__ | 17 | #define __OPIE_IRDA_APPLET_H__ |
18 | 18 | ||
19 | #include <qwidget.h> | 19 | #include <qwidget.h> |
20 | #include <qpixmap.h> | 20 | #include <qpixmap.h> |
21 | #include <qpopupmenu.h> | 21 | #include <qpopupmenu.h> |
22 | #include <qmap.h> | 22 | #include <qmap.h> |
23 | 23 | ||
24 | class IrdaApplet : public QWidget | 24 | class IrdaApplet : public QWidget |
25 | { | 25 | { |
26 | Q_OBJECT | 26 | Q_OBJECT |
27 | 27 | ||
28 | public: | 28 | public: |
29 | IrdaApplet( QWidget *parent = 0, const char *name = 0 ); | 29 | IrdaApplet( QWidget *parent = 0, const char *name = 0 ); |
30 | ~IrdaApplet(); | 30 | ~IrdaApplet(); |
31 | static int position(); | ||
31 | 32 | ||
32 | virtual void show ( ); | 33 | virtual void show ( ); |
33 | 34 | ||
34 | protected: | 35 | protected: |
35 | virtual void timerEvent ( QTimerEvent * ); | 36 | virtual void timerEvent ( QTimerEvent * ); |
36 | virtual void mousePressEvent ( QMouseEvent * ); | 37 | virtual void mousePressEvent ( QMouseEvent * ); |
37 | virtual void paintEvent ( QPaintEvent* ); | 38 | virtual void paintEvent ( QPaintEvent* ); |
38 | 39 | ||
39 | private slots: | 40 | private slots: |
40 | void popupTimeout ( ); | 41 | void popupTimeout ( ); |
41 | void slotMessage( const QCString& , const QByteArray& ); | 42 | void slotMessage( const QCString& , const QByteArray& ); |
42 | 43 | ||
43 | private: | 44 | private: |
44 | void popup( QString message, QString icon = QString::null ); | 45 | void popup( QString message, QString icon = QString::null ); |
45 | 46 | ||
46 | bool checkIrdaStatus ( ); | 47 | bool checkIrdaStatus ( ); |
47 | bool setIrdaStatus ( bool ); | 48 | bool setIrdaStatus ( bool ); |
48 | bool checkIrdaDiscoveryStatus (); | 49 | bool checkIrdaDiscoveryStatus (); |
49 | bool setIrdaDiscoveryStatus ( bool ); | 50 | bool setIrdaDiscoveryStatus ( bool ); |
50 | bool setIrdaReceiveStatus ( bool ); | 51 | bool setIrdaReceiveStatus ( bool ); |
51 | 52 | ||
52 | void showDiscovered(); | 53 | void showDiscovered(); |
53 | 54 | ||
54 | private: | 55 | private: |
55 | QPixmap m_irdaOnPixmap; | 56 | QPixmap m_irdaOnPixmap; |
56 | QPixmap m_irdaOffPixmap; | 57 | QPixmap m_irdaOffPixmap; |
57 | QPixmap m_irdaDiscoveryOnPixmap; | 58 | QPixmap m_irdaDiscoveryOnPixmap; |
58 | QPixmap m_receiveActivePixmap; | 59 | QPixmap m_receiveActivePixmap; |
59 | 60 | ||
60 | bool m_irda_active; | 61 | bool m_irda_active; |
61 | bool m_irda_discovery_active; | 62 | bool m_irda_discovery_active; |
62 | bool m_receive_active; | 63 | bool m_receive_active; |
63 | bool m_receive_state_changed; | 64 | bool m_receive_state_changed; |
64 | 65 | ||
65 | QPopupMenu *m_popup; | 66 | QPopupMenu *m_popup; |
66 | 67 | ||
67 | int m_sockfd; | 68 | int m_sockfd; |
68 | 69 | ||
69 | QMap <QString, QString> m_devices; | 70 | QMap <QString, QString> m_devices; |
70 | 71 | ||
71 | bool m_wasOn; // if IrDa was enabled | 72 | bool m_wasOn; // if IrDa was enabled |
72 | bool m_wasDiscover; | 73 | bool m_wasDiscover; |
73 | }; | 74 | }; |
74 | 75 | ||
75 | 76 | ||
76 | #endif // __OPIE_IRDA_APPLET_H__ | 77 | #endif // __OPIE_IRDA_APPLET_H__ |
diff --git a/core/applets/irdaapplet/irdaapplet.pro b/core/applets/irdaapplet/irdaapplet.pro index 4e94dfb..31e8691 100644 --- a/core/applets/irdaapplet/irdaapplet.pro +++ b/core/applets/irdaapplet/irdaapplet.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 = irda.h irdaappletimpl.h | 3 | HEADERS = irda.h |
4 | SOURCES = irda.cpp irdaappletimpl.cpp | 4 | SOURCES = irda.cpp |
5 | TARGET = irdaapplet | 5 | TARGET = irdaapplet |
6 | DESTDIR = $(OPIEDIR)/plugins/applets | 6 | DESTDIR = $(OPIEDIR)/plugins/applets |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH+= $(OPIEDIR)/include |
8 | DEPENDPATH += ../$(OPIEDIR)/include | 8 | DEPENDPATH += ../$(OPIEDIR)/include |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe |
10 | VERSION = 1.0.0 | 10 | VERSION = 1.0.0 |
11 | 11 | ||
12 | include ( $(OPIEDIR)/include.pro ) | 12 | include ( $(OPIEDIR)/include.pro ) |
13 | target.path = $$prefix/plugins/applets | 13 | target.path = $$prefix/plugins/applets |
diff --git a/core/applets/irdaapplet/irdaappletimpl.cpp b/core/applets/irdaapplet/irdaappletimpl.cpp deleted file mode 100644 index 33d98af..0000000 --- a/core/applets/irdaapplet/irdaappletimpl.cpp +++ b/dev/null | |||
@@ -1,66 +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 "irda.h" | ||
21 | #include "irdaappletimpl.h" | ||
22 | |||
23 | |||
24 | IrdaAppletImpl::IrdaAppletImpl() | ||
25 | : irda(0) | ||
26 | { | ||
27 | } | ||
28 | |||
29 | IrdaAppletImpl::~IrdaAppletImpl() | ||
30 | { | ||
31 | delete irda; | ||
32 | } | ||
33 | |||
34 | QWidget *IrdaAppletImpl::applet( QWidget *parent ) | ||
35 | { | ||
36 | if ( !irda ) | ||
37 | irda = new IrdaApplet( parent ); | ||
38 | return irda; | ||
39 | } | ||
40 | |||
41 | int IrdaAppletImpl::position() const | ||
42 | { | ||
43 | return 6; | ||
44 | } | ||
45 | |||
46 | QRESULT IrdaAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | ||
47 | { | ||
48 | *iface = 0; | ||
49 | if ( uuid == IID_QUnknown ) | ||
50 | *iface = this; | ||
51 | else if ( uuid == IID_TaskbarApplet ) | ||
52 | *iface = this; | ||
53 | else | ||
54 | return QS_FALSE; | ||
55 | |||
56 | if ( *iface ) | ||
57 | (*iface)->addRef(); | ||
58 | return QS_OK; | ||
59 | } | ||
60 | |||
61 | Q_EXPORT_INTERFACE() | ||
62 | { | ||
63 | Q_CREATE_INSTANCE( IrdaAppletImpl ) | ||
64 | } | ||
65 | |||
66 | |||
diff --git a/core/applets/irdaapplet/irdaappletimpl.h b/core/applets/irdaapplet/irdaappletimpl.h deleted file mode 100644 index 024cc06..0000000 --- a/core/applets/irdaapplet/irdaappletimpl.h +++ b/dev/null | |||
@@ -1,45 +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 IRDAAPPLETIMPL_H | ||
21 | #define IRDAAPPLETIMPL_H | ||
22 | |||
23 | #include <qwidget.h> | ||
24 | |||
25 | #include <qpe/taskbarappletinterface.h> | ||
26 | |||
27 | class IrdaApplet; | ||
28 | |||
29 | class IrdaAppletImpl : public TaskbarAppletInterface | ||
30 | { | ||
31 | public: | ||
32 | IrdaAppletImpl(); | ||
33 | virtual ~IrdaAppletImpl(); | ||
34 | |||
35 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | ||
36 | Q_REFCOUNT | ||
37 | |||
38 | virtual QWidget *applet( QWidget *parent ); | ||
39 | virtual int position() const; | ||
40 | |||
41 | private: | ||
42 | IrdaApplet *irda; | ||
43 | }; | ||
44 | |||
45 | #endif | ||
diff --git a/core/applets/screenshotapplet/screenshot.cpp b/core/applets/screenshotapplet/screenshot.cpp index 56a031c..5d6bce4 100644 --- a/core/applets/screenshotapplet/screenshot.cpp +++ b/core/applets/screenshotapplet/screenshot.cpp | |||
@@ -1,530 +1,543 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com | 2 | ** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com |
3 | ** All rights reserved. | 3 | ** All rights reserved. |
4 | ** | 4 | ** |
5 | ** This file may be distributed and/or modified under the terms of the | 5 | ** This file may be distributed and/or modified under the terms of the |
6 | ** GNU General Public License version 2 as published by the Free Software | 6 | ** GNU General Public License version 2 as published by the Free Software |
7 | ** Foundation and appearing in the file LICENSE.GPL included in the | 7 | ** Foundation and appearing in the file LICENSE.GPL included in the |
8 | ** packaging of this file. | 8 | ** packaging of this file. |
9 | ** | 9 | ** |
10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
12 | ** | 12 | ** |
13 | **********************************************************************/ | 13 | **********************************************************************/ |
14 | 14 | ||
15 | #include "screenshot.h" | 15 | #include "screenshot.h" |
16 | #include "inputDialog.h" | 16 | #include "inputDialog.h" |
17 | 17 | ||
18 | #include <stdlib.h> | 18 | /* OPIE */ |
19 | #include <sys/socket.h> | 19 | #include <opie2/otaskbarapplet.h> |
20 | #include <netinet/in.h> | ||
21 | #include <netdb.h> | ||
22 | #include <unistd.h> | ||
23 | |||
24 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/applnk.h> | 21 | #include <qpe/applnk.h> |
26 | 22 | ||
23 | /* QT */ | ||
27 | #include <qlineedit.h> | 24 | #include <qlineedit.h> |
28 | #include <qdir.h> | 25 | #include <qdir.h> |
29 | #include <qlabel.h> | 26 | #include <qlabel.h> |
30 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
31 | #include <qpainter.h> | 28 | #include <qpainter.h> |
32 | #include <qspinbox.h> | 29 | #include <qspinbox.h> |
33 | #include <qlayout.h> | 30 | #include <qlayout.h> |
34 | #include <qcheckbox.h> | 31 | #include <qcheckbox.h> |
35 | #include <qmessagebox.h> | 32 | #include <qmessagebox.h> |
36 | 33 | ||
34 | /* STD */ | ||
35 | #include <stdlib.h> | ||
36 | #include <sys/socket.h> | ||
37 | #include <netinet/in.h> | ||
38 | #include <netdb.h> | ||
39 | #include <unistd.h> | ||
37 | 40 | ||
38 | /* XPM */ | 41 | /* XPM */ |
39 | static char * snapshot_xpm[] = { | 42 | static char * snapshot_xpm[] = { |
40 | "32 32 177 2", | 43 | "32 32 177 2", |
41 | " c None", | 44 | " c None", |
42 | ". c #042045", | 45 | ". c #042045", |
43 | "+ c #0D2B47", | 46 | "+ c #0D2B47", |
44 | "@ c #0E325E", | 47 | "@ c #0E325E", |
45 | "# c #0D2E50", | 48 | "# c #0D2E50", |
46 | "$ c #0A1C32", | 49 | "$ c #0A1C32", |
47 | "% c #0F3A69", | 50 | "% c #0F3A69", |
48 | "& c #164680", | 51 | "& c #164680", |
49 | "* c #165EAE", | 52 | "* c #165EAE", |
50 | "= c #134D89", | 53 | "= c #134D89", |
51 | "- c #0A3A6E", | 54 | "- c #0A3A6E", |
52 | "; c #031024", | 55 | "; c #031024", |
53 | "> c #031B36", | 56 | "> c #031B36", |
54 | ", c #1A5EA3", | 57 | ", c #1A5EA3", |
55 | "' c #1862B1", | 58 | "' c #1862B1", |
56 | ") c #1866B9", | 59 | ") c #1866B9", |
57 | "! c #0F5AAC", | 60 | "! c #0F5AAC", |
58 | "~ c #0F56A8", | 61 | "~ c #0F56A8", |
59 | "{ c #0C4C96", | 62 | "{ c #0C4C96", |
60 | "] c #030918", | 63 | "] c #030918", |
61 | "^ c #060206", | 64 | "^ c #060206", |
62 | "/ c #20242C", | 65 | "/ c #20242C", |
63 | "( c #3E3B3B", | 66 | "( c #3E3B3B", |
64 | "_ c #186ABD", | 67 | "_ c #186ABD", |
65 | ": c #115EB3", | 68 | ": c #115EB3", |
66 | "< c #082644", | 69 | "< c #082644", |
67 | "[ c #222C38", | 70 | "[ c #222C38", |
68 | "} c #5A5859", | 71 | "} c #5A5859", |
69 | "| c #091921", | 72 | "| c #091921", |
70 | "1 c #1E7EDE", | 73 | "1 c #1E7EDE", |
71 | "2 c #1A7ADA", | 74 | "2 c #1A7ADA", |
72 | "3 c #1970CD", | 75 | "3 c #1970CD", |
73 | "4 c #1758A1", | 76 | "4 c #1758A1", |
74 | "5 c #0E529A", | 77 | "5 c #0E529A", |
75 | "6 c #094388", | 78 | "6 c #094388", |
76 | "7 c #22364E", | 79 | "7 c #22364E", |
77 | "8 c #384454", | 80 | "8 c #384454", |
78 | "9 c #04162C", | 81 | "9 c #04162C", |
79 | "0 c #123451", | 82 | "0 c #123451", |
80 | "a c #3296B4", | 83 | "a c #3296B4", |
81 | "b c #298AB1", | 84 | "b c #298AB1", |
82 | "c c #2484AC", | 85 | "c c #2484AC", |
83 | "d c #033D86", | 86 | "d c #033D86", |
84 | "e c #033677", | 87 | "e c #033677", |
85 | "f c #072C58", | 88 | "f c #072C58", |
86 | "g c #525862", | 89 | "g c #525862", |
87 | "h c #5E5E5E", | 90 | "h c #5E5E5E", |
88 | "i c #23492A", | 91 | "i c #23492A", |
89 | "j c #4FBD3F", | 92 | "j c #4FBD3F", |
90 | "k c #50B24C", | 93 | "k c #50B24C", |
91 | "l c #51C72E", | 94 | "l c #51C72E", |
92 | "m c #42C64A", | 95 | "m c #42C64A", |
93 | "n c #2686CA", | 96 | "n c #2686CA", |
94 | "o c #0B52A4", | 97 | "o c #0B52A4", |
95 | "p c #054A9A", | 98 | "p c #054A9A", |
96 | "q c #053B7C", | 99 | "q c #053B7C", |
97 | "r c #2B2325", | 100 | "r c #2B2325", |
98 | "s c #6E7070", | 101 | "s c #6E7070", |
99 | "t c #0D240E", | 102 | "t c #0D240E", |
100 | "u c #1E423E", | 103 | "u c #1E423E", |
101 | "v c #468ABE", | 104 | "v c #468ABE", |
102 | "w c #6A8AC2", | 105 | "w c #6A8AC2", |
103 | "x c #7EAA8E", | 106 | "x c #7EAA8E", |
104 | "y c #84BE4E", | 107 | "y c #84BE4E", |
105 | "z c #65C639", | 108 | "z c #65C639", |
106 | "A c #064EA0", | 109 | "A c #064EA0", |
107 | "B c #0A4DA0", | 110 | "B c #0A4DA0", |
108 | "C c #4E5242", | 111 | "C c #4E5242", |
109 | "D c #62362E", | 112 | "D c #62362E", |
110 | "E c #721A1A", | 113 | "E c #721A1A", |
111 | "F c #6E0A0A", | 114 | "F c #6E0A0A", |
112 | "G c #3E0E0E", | 115 | "G c #3E0E0E", |
113 | "H c #6AB85E", | 116 | "H c #6AB85E", |
114 | "I c #7E8ECA", | 117 | "I c #7E8ECA", |
115 | "J c #929CD4", | 118 | "J c #929CD4", |
116 | "K c #9EAECA", | 119 | "K c #9EAECA", |
117 | "L c #9EBEAE", | 120 | "L c #9EBEAE", |
118 | "M c #8EC26A", | 121 | "M c #8EC26A", |
119 | "N c #32A276", | 122 | "N c #32A276", |
120 | "O c #20518C", | 123 | "O c #20518C", |
121 | "P c #46566E", | 124 | "P c #46566E", |
122 | "Q c #614A51", | 125 | "Q c #614A51", |
123 | "R c #AE2A26", | 126 | "R c #AE2A26", |
124 | "S c #C41C1A", | 127 | "S c #C41C1A", |
125 | "T c #CE0A0A", | 128 | "T c #CE0A0A", |
126 | "U c #A60606", | 129 | "U c #A60606", |
127 | "V c #921616", | 130 | "V c #921616", |
128 | "W c #863735", | 131 | "W c #863735", |
129 | "X c #866A66", | 132 | "X c #866A66", |
130 | "Y c #9E9EA2", | 133 | "Y c #9E9EA2", |
131 | "Z c #1E5212", | 134 | "Z c #1E5212", |
132 | "` c #7EC652", | 135 | "` c #7EC652", |
133 | " .c #B2B2F2", | 136 | " .c #B2B2F2", |
134 | "..c #CACAF6", | 137 | "..c #CACAF6", |
135 | "+.c #AECEC6", | 138 | "+.c #AECEC6", |
136 | "@.c #92CE72", | 139 | "@.c #92CE72", |
137 | "#.c #42AA86", | 140 | "#.c #42AA86", |
138 | "$.c #365E96", | 141 | "$.c #365E96", |
139 | "%.c #B82420", | 142 | "%.c #B82420", |
140 | "&.c #E20E0E", | 143 | "&.c #E20E0E", |
141 | "*.c #EF0E0B", | 144 | "*.c #EF0E0B", |
142 | "=.c #566A86", | 145 | "=.c #566A86", |
143 | "-.c #92929A", | 146 | "-.c #92929A", |
144 | ";.c #16260E", | 147 | ";.c #16260E", |
145 | ">.c #2E571A", | 148 | ">.c #2E571A", |
146 | ",.c #7ED64E", | 149 | ",.c #7ED64E", |
147 | "'.c #9ECEB2", | 150 | "'.c #9ECEB2", |
148 | ").c #C6D5EF", | 151 | ").c #C6D5EF", |
149 | "!.c #E2E0FE", | 152 | "!.c #E2E0FE", |
150 | "~.c #A2DE8A", | 153 | "~.c #A2DE8A", |
151 | "{.c #4AAA5B", | 154 | "{.c #4AAA5B", |
152 | "].c #2A6AB2", | 155 | "].c #2A6AB2", |
153 | "^.c #9A7A6E", | 156 | "^.c #9A7A6E", |
154 | "/.c #D25A52", | 157 | "/.c #D25A52", |
155 | "(.c #F62626", | 158 | "(.c #F62626", |
156 | "_.c #FA0206", | 159 | "_.c #FA0206", |
157 | ":.c #DE1E16", | 160 | ":.c #DE1E16", |
158 | "<.c #B63A26", | 161 | "<.c #B63A26", |
159 | "[.c #865A2E", | 162 | "[.c #865A2E", |
160 | "}.c #26568E", | 163 | "}.c #26568E", |
161 | "|.c #435F7D", | 164 | "|.c #435F7D", |
162 | "1.c #7AE246", | 165 | "1.c #7AE246", |
163 | "2.c #96EA6E", | 166 | "2.c #96EA6E", |
164 | "3.c #BEEAAE", | 167 | "3.c #BEEAAE", |
165 | "4.c #D0EADC", | 168 | "4.c #D0EADC", |
166 | "5.c #B6CEFE", | 169 | "5.c #B6CEFE", |
167 | "6.c #9ADE8A", | 170 | "6.c #9ADE8A", |
168 | "7.c #2A609A", | 171 | "7.c #2A609A", |
169 | "8.c #7E623E", | 172 | "8.c #7E623E", |
170 | "9.c #CA7A72", | 173 | "9.c #CA7A72", |
171 | "0.c #F26E6E", | 174 | "0.c #F26E6E", |
172 | "a.c #FE5252", | 175 | "a.c #FE5252", |
173 | "b.c #FA3638", | 176 | "b.c #FA3638", |
174 | "c.c #DA2E28", | 177 | "c.c #DA2E28", |
175 | "d.c #9E3E3A", | 178 | "d.c #9E3E3A", |
176 | "e.c #3E7656", | 179 | "e.c #3E7656", |
177 | "f.c #76CB3A", | 180 | "f.c #76CB3A", |
178 | "g.c #90DE44", | 181 | "g.c #90DE44", |
179 | "h.c #A2EE6A", | 182 | "h.c #A2EE6A", |
180 | "i.c #9EEA9A", | 183 | "i.c #9EEA9A", |
181 | "j.c #92BEDE", | 184 | "j.c #92BEDE", |
182 | "k.c #7ADA7E", | 185 | "k.c #7ADA7E", |
183 | "l.c #5ECE52", | 186 | "l.c #5ECE52", |
184 | "m.c #6A5E52", | 187 | "m.c #6A5E52", |
185 | "n.c #A83238", | 188 | "n.c #A83238", |
186 | "o.c #FA5656", | 189 | "o.c #FA5656", |
187 | "p.c #F29A92", | 190 | "p.c #F29A92", |
188 | "q.c #D29E92", | 191 | "q.c #D29E92", |
189 | "r.c #8A7A62", | 192 | "r.c #8A7A62", |
190 | "s.c #05336B", | 193 | "s.c #05336B", |
191 | "t.c #59C631", | 194 | "t.c #59C631", |
192 | "u.c #8AD23A", | 195 | "u.c #8AD23A", |
193 | "v.c #66E242", | 196 | "v.c #66E242", |
194 | "w.c #1D6FC1", | 197 | "w.c #1D6FC1", |
195 | "x.c #E61212", | 198 | "x.c #E61212", |
196 | "y.c #CA261E", | 199 | "y.c #CA261E", |
197 | "z.c #5A763E", | 200 | "z.c #5A763E", |
198 | "A.c #1E6E9A", | 201 | "A.c #1E6E9A", |
199 | "B.c #023272", | 202 | "B.c #023272", |
200 | "C.c #329696", | 203 | "C.c #329696", |
201 | "D.c #2074B6", | 204 | "D.c #2074B6", |
202 | "E.c #3E4E76", | 205 | "E.c #3E4E76", |
203 | "F.c #5A525E", | 206 | "F.c #5A525E", |
204 | "G.c #425868", | 207 | "G.c #425868", |
205 | "H.c #04448E", | 208 | "H.c #04448E", |
206 | "I.c #28828A", | 209 | "I.c #28828A", |
207 | "J.c #2D8593", | 210 | "J.c #2D8593", |
208 | "K.c #12427A", | 211 | "K.c #12427A", |
209 | "L.c #054696", | 212 | "L.c #054696", |
210 | "M.c #042B5E", | 213 | "M.c #042B5E", |
211 | "N.c #134F95", | 214 | "N.c #134F95", |
212 | "O.c #1E6ABB", | 215 | "O.c #1E6ABB", |
213 | "P.c #1A5E96", | 216 | "P.c #1A5E96", |
214 | "Q.c #022E67", | 217 | "Q.c #022E67", |
215 | "R.c #0C3E7C", | 218 | "R.c #0C3E7C", |
216 | "S.c #023E8A", | 219 | "S.c #023E8A", |
217 | "T.c #021A3E", | 220 | "T.c #021A3E", |
218 | " ", | 221 | " ", |
219 | " ", | 222 | " ", |
220 | " ", | 223 | " ", |
221 | " . + @ # + ", | 224 | " . + @ # + ", |
222 | " $ # % & * * = - # $ ", | 225 | " $ # % & * * = - # $ ", |
223 | "; > % @ = , ' ) ' ! ~ { % @ . ] ^ / ( ", | 226 | "; > % @ = , ' ) ' ! ~ { % @ . ] ^ / ( ", |
224 | "; + ' * ) _ ) ) ' : : ! { { % < . [ ( } ", | 227 | "; + ' * ) _ ) ) ' : : ! { { % < . [ ( } ", |
225 | "| @ 1 2 3 _ _ ) ' : : : : 4 5 6 6 # 7 8 } ", | 228 | "| @ 1 2 3 _ _ ) ' : : : : 4 5 6 6 # 7 8 } ", |
226 | "9 0 a b b b c _ ) : : ! ! ~ ~ 5 ~ d e f [ 8 g h h } ", | 229 | "9 0 a b b b c _ ) : : ! ! ~ ~ 5 ~ d e f [ 8 g h h } ", |
227 | "| i j k j l m n 3 ) : ! ! ! ~ o o o p 6 q f / r r r s ", | 230 | "| i j k j l m n 3 ) : ! ! ! ~ o o o p 6 q f / r r r s ", |
228 | "t u v w x y y z a 1 3 ' : ! ~ A A B A p = C D E F G ( s ", | 231 | "t u v w x y y z a 1 3 ' : ! ~ A A B A p = C D E F G ( s ", |
229 | "| u H I J K L M H k N 3 3 : ~ o o 5 O P Q R S T T U V W X Y ", | 232 | "| u H I J K L M H k N 3 3 : ~ o o 5 O P Q R S T T U V W X Y ", |
230 | "| Z ` J .....+.@.z #.3 _ 3 3 ) $.P W %.S &.*.*.&.S W Q P =.-. ", | 233 | "| Z ` J .....+.@.z #.3 _ 3 3 ) $.P W %.S &.*.*.&.S W Q P =.-. ", |
231 | ";.>.,.'.).!.!.).~.,.{.) : ) 3 ].h ^./.(._._._.:.<.[.g }.= & |. ", | 234 | ";.>.,.'.).!.!.).~.,.{.) : ) 3 ].h ^./.(._._._.:.<.[.g }.= & |. ", |
232 | ";.>.1.2.3.4.4.5.6.,.{._ : : : 7.8.9.0.a.b.b.c.d.} e.4 = 6 q # ", | 235 | ";.>.1.2.3.4.4.5.6.,.{._ : : : 7.8.9.0.a.b.b.c.d.} e.4 = 6 q # ", |
233 | ";.>.z f.g.h.i.j.k.l.N ) : ! ! 4 m.n.c.o.p.q.r.|.5 { d e e s.. ", | 236 | ";.>.z f.g.h.i.j.k.l.N ) : ! ! 4 m.n.c.o.p.q.r.|.5 { d e e s.. ", |
234 | "t Z l t.f.u.g.1.v.#.w.' : ! ~ ~ 7.|.n.x.y.z.A.A q - e e e B.> ", | 237 | "t Z l t.f.u.g.1.v.#.w.' : ! ~ ~ 7.|.n.x.y.z.A.A q - e e e B.> ", |
235 | "| 0 c k t.t.l l C.D.) * * ! 5 { B o E.F.F.G.= H.e e e e q B.. ", | 238 | "| 0 c k t.t.l l C.D.) * * ! 5 { B o E.F.F.G.= H.e e e e q B.. ", |
236 | "; + D.I.J.I.I.I.w.) : : * o K.7 - L.= O = }.6 6 e q q e q s.> ", | 239 | "; + D.I.J.I.I.I.w.) : : * o K.7 - L.= O = }.6 6 e q q e q s.> ", |
237 | "9 + ) ) ) ) ' ' , * : ! ! ! K.< . M.q 6 B N.{ d q e e e e s.9 ", | 240 | "9 + ) ) ) ) ' ' , * : ! ! ! K.< . M.q 6 B N.{ d q e e e e s.9 ", |
238 | "9 # O.) ) ' , , P.* ! ! ! ! = % . . M.e d p L.d B.B.e B.B.Q.9 ", | 241 | "9 # O.) ) ' , , P.* ! ! ! ! = % . . M.e d p L.d B.B.e B.B.Q.9 ", |
239 | "; < ' ' ' ' , , 4 4 ~ ! ! ~ ! 5 e q e e q A H.d q q e e B.Q.9 ", | 242 | "; < ' ' ' ' , , 4 4 ~ ! ! ~ ! 5 e q e e q A H.d q q e e B.Q.9 ", |
240 | "; $ R.K.5 4 4 ' ! ! 4 ~ ! ~ ~ ~ o { B o A A L.S.B.B.B.B.B.Q.> ", | 243 | "; $ R.K.5 4 4 ' ! ! 4 ~ ! ~ ~ ~ o { B o A A L.S.B.B.B.B.B.Q.> ", |
241 | " ] $ 0 R.= ' ' 4 4 5 4 5 5 o B o B p A A L.d e e B.B.B.Q.9 ", | 244 | " ] $ 0 R.= ' ' 4 4 5 4 5 5 o B o B p A A L.d e e B.B.B.Q.9 ", |
242 | " # + - { 4 4 ~ ! o { o L.p p p p p H.S.B.B.s.Q.Q.M.T. ", | 245 | " # + - { 4 4 ~ ! o { o L.p p p p p H.S.B.B.s.Q.Q.M.T. ", |
243 | " + s.6 B o o 5 B p L.p p L.p H.q B.Q.Q.Q.Q.M.; ", | 246 | " + s.6 B o o 5 B p L.p p L.p H.q B.Q.Q.Q.Q.M.; ", |
244 | " < # s.- B o B p p L.L.H.L.H.d B.Q.Q.Q.Q.Q.9 ", | 247 | " < # s.- B o B p p L.L.H.L.H.d B.Q.Q.Q.Q.Q.9 ", |
245 | " $ . s.d 6 B A p H.S.L.H.q B.Q.Q.M.M.. ; ", | 248 | " $ . s.d 6 B A p H.S.L.H.q B.Q.Q.M.M.. ; ", |
246 | " ; 9 . 6 L.p L.d L.H.d Q.M.M.. 9 ; ] ", | 249 | " ; 9 . 6 L.p L.d L.H.d Q.M.M.. 9 ; ] ", |
247 | " | > e L.d L.H.e M.. ; ] ] ", | 250 | " | > e L.d L.H.e M.. ; ] ] ", |
248 | " > 9 . S.Q.. ; ] ", | 251 | " > 9 . S.Q.. ; ] ", |
249 | " T.; ] "}; | 252 | " T.; ] "}; |
250 | 253 | ||
251 | static const char *SCAP_hostname = "www.handhelds.org"; | 254 | static const char *SCAP_hostname = "www.handhelds.org"; |
252 | static const int SCAP_port = 80; | 255 | static const int SCAP_port = 80; |
253 | 256 | ||
254 | 257 | ||
255 | ScreenshotControl::ScreenshotControl( QWidget *parent, const char *name ) | 258 | ScreenshotControl::ScreenshotControl( QWidget *parent, const char *name ) |
256 | : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) | 259 | : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) |
257 | { | 260 | { |
258 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); | 261 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); |
259 | QVBoxLayout *vbox = new QVBoxLayout ( this, 5, 3 ); | 262 | QVBoxLayout *vbox = new QVBoxLayout ( this, 5, 3 ); |
260 | QHBoxLayout *hbox; | 263 | QHBoxLayout *hbox; |
261 | 264 | ||
262 | hbox = new QHBoxLayout ( vbox ); | 265 | hbox = new QHBoxLayout ( vbox ); |
263 | 266 | ||
264 | QLabel *l = new QLabel ( tr( "Delay" ), this ); | 267 | QLabel *l = new QLabel ( tr( "Delay" ), this ); |
265 | hbox-> addWidget ( l ); | 268 | hbox-> addWidget ( l ); |
266 | 269 | ||
267 | delaySpin = new QSpinBox( 0, 60, 1, this, "Spinner" ); | 270 | delaySpin = new QSpinBox( 0, 60, 1, this, "Spinner" ); |
268 | delaySpin-> setButtonSymbols ( QSpinBox::PlusMinus ); | 271 | delaySpin-> setButtonSymbols ( QSpinBox::PlusMinus ); |
269 | delaySpin-> setSuffix ( tr( "sec" )); | 272 | delaySpin-> setSuffix ( tr( "sec" )); |
270 | delaySpin-> setFocusPolicy( QWidget::NoFocus ); | 273 | delaySpin-> setFocusPolicy( QWidget::NoFocus ); |
271 | delaySpin-> setValue ( 1 ); | 274 | delaySpin-> setValue ( 1 ); |
272 | hbox-> addWidget ( delaySpin ); | 275 | hbox-> addWidget ( delaySpin ); |
273 | 276 | ||
274 | saveNamedCheck = new QCheckBox ( tr( "Save named" ), this); | 277 | saveNamedCheck = new QCheckBox ( tr( "Save named" ), this); |
275 | saveNamedCheck-> setFocusPolicy ( QWidget::NoFocus ); | 278 | saveNamedCheck-> setFocusPolicy ( QWidget::NoFocus ); |
276 | vbox->addWidget( saveNamedCheck); | 279 | vbox->addWidget( saveNamedCheck); |
277 | 280 | ||
278 | vbox-> addSpacing ( 3 ); | 281 | vbox-> addSpacing ( 3 ); |
279 | 282 | ||
280 | l = new QLabel ( tr( "Save screenshot as..." ), this ); | 283 | l = new QLabel ( tr( "Save screenshot as..." ), this ); |
281 | vbox-> addWidget ( l, AlignCenter ); | 284 | vbox-> addWidget ( l, AlignCenter ); |
282 | 285 | ||
283 | hbox = new QHBoxLayout ( vbox ); | 286 | hbox = new QHBoxLayout ( vbox ); |
284 | 287 | ||
285 | grabItButton = new QPushButton( tr( "File" ), this, "GrabButton" ); | 288 | grabItButton = new QPushButton( tr( "File" ), this, "GrabButton" ); |
286 | grabItButton ->setFocusPolicy( QWidget::TabFocus ); | 289 | grabItButton ->setFocusPolicy( QWidget::TabFocus ); |
287 | hbox-> addWidget ( grabItButton ); | 290 | hbox-> addWidget ( grabItButton ); |
288 | 291 | ||
289 | scapButton = new QPushButton( tr( "Scap" ), this, "ScapButton" ); | 292 | scapButton = new QPushButton( tr( "Scap" ), this, "ScapButton" ); |
290 | scapButton ->setFocusPolicy( QWidget::TabFocus ); | 293 | scapButton ->setFocusPolicy( QWidget::TabFocus ); |
291 | hbox-> addWidget ( scapButton ); | 294 | hbox-> addWidget ( scapButton ); |
292 | 295 | ||
293 | setFixedSize ( sizeHint ( )); | 296 | setFixedSize ( sizeHint ( )); |
294 | setFocusPolicy ( QWidget::NoFocus ); | 297 | setFocusPolicy ( QWidget::NoFocus ); |
295 | 298 | ||
296 | 299 | ||
297 | grabTimer = new QTimer ( this, "grab timer"); | 300 | grabTimer = new QTimer ( this, "grab timer"); |
298 | 301 | ||
299 | connect ( grabTimer, SIGNAL( timeout ( )), this, SLOT( performGrab ( ))); | 302 | connect ( grabTimer, SIGNAL( timeout ( )), this, SLOT( performGrab ( ))); |
300 | connect ( grabItButton, SIGNAL( clicked ( )), SLOT( slotGrab ( ))); | 303 | connect ( grabItButton, SIGNAL( clicked ( )), SLOT( slotGrab ( ))); |
301 | connect ( scapButton, SIGNAL( clicked ( )), SLOT( slotScap ( ))); | 304 | connect ( scapButton, SIGNAL( clicked ( )), SLOT( slotScap ( ))); |
302 | } | 305 | } |
303 | 306 | ||
304 | void ScreenshotControl::slotGrab() | 307 | void ScreenshotControl::slotGrab() |
305 | { | 308 | { |
306 | buttonPushed = 1; | 309 | buttonPushed = 1; |
307 | hide(); | 310 | hide(); |
308 | 311 | ||
309 | setFileName = FALSE; | 312 | setFileName = FALSE; |
310 | if ( saveNamedCheck->isChecked()) { | 313 | if ( saveNamedCheck->isChecked()) { |
311 | setFileName = TRUE; | 314 | setFileName = TRUE; |
312 | InputDialog *fileDlg; | 315 | InputDialog *fileDlg; |
313 | 316 | ||
314 | fileDlg = new InputDialog( 0 , tr("Name of screenshot "), TRUE, 0); | 317 | fileDlg = new InputDialog( 0 , tr("Name of screenshot "), TRUE, 0); |
315 | fileDlg->exec(); | 318 | fileDlg->exec(); |
316 | fileDlg->raise(); | 319 | fileDlg->raise(); |
317 | QString fileName, list; | 320 | QString fileName, list; |
318 | if ( fileDlg->result() == 1 ) { | 321 | if ( fileDlg->result() == 1 ) { |
319 | fileName = fileDlg->LineEdit1->text(); | 322 | fileName = fileDlg->LineEdit1->text(); |
320 | 323 | ||
321 | if (fileName.find("/", 0, TRUE) == -1) | 324 | if (fileName.find("/", 0, TRUE) == -1) |
322 | FileNamePath = QDir::homeDirPath() + "/Documents/image/png/" + fileName; | 325 | FileNamePath = QDir::homeDirPath() + "/Documents/image/png/" + fileName; |
323 | else | 326 | else |
324 | FileNamePath = fileName; | 327 | FileNamePath = fileName; |
325 | 328 | ||
326 | } | 329 | } |
327 | delete fileDlg; | 330 | delete fileDlg; |
328 | } | 331 | } |
329 | 332 | ||
330 | if ( delaySpin->value() ) | 333 | if ( delaySpin->value() ) |
331 | grabTimer->start( delaySpin->value() * 1000, true ); | 334 | grabTimer->start( delaySpin->value() * 1000, true ); |
332 | else | 335 | else |
333 | show(); | 336 | show(); |
334 | } | 337 | } |
335 | 338 | ||
336 | void ScreenshotControl::slotScap() | 339 | void ScreenshotControl::slotScap() |
337 | { | 340 | { |
338 | buttonPushed = 2; | 341 | buttonPushed = 2; |
339 | hide(); | 342 | hide(); |
340 | 343 | ||
341 | if ( delaySpin->value() ) | 344 | if ( delaySpin->value() ) |
342 | grabTimer->start( delaySpin->value() * 1000, true ); | 345 | grabTimer->start( delaySpin->value() * 1000, true ); |
343 | else | 346 | else |
344 | show(); | 347 | show(); |
345 | } | 348 | } |
346 | 349 | ||
347 | 350 | ||
348 | void ScreenshotControl::savePixmap() | 351 | void ScreenshotControl::savePixmap() |
349 | { | 352 | { |
350 | DocLnk lnk; | 353 | DocLnk lnk; |
351 | QString fileName; | 354 | QString fileName; |
352 | 355 | ||
353 | if ( setFileName) { | 356 | if ( setFileName) { |
354 | fileName = FileNamePath; | 357 | fileName = FileNamePath; |
355 | //not sure why this is needed here, but it forgets fileName | 358 | //not sure why this is needed here, but it forgets fileName |
356 | // if this is below the braces | 359 | // if this is below the braces |
357 | 360 | ||
358 | if (fileName.right(3) != "png") | 361 | if (fileName.right(3) != "png") |
359 | fileName = fileName + ".png"; | 362 | fileName = fileName + ".png"; |
360 | lnk.setFile(fileName); //sets File property | 363 | lnk.setFile(fileName); //sets File property |
361 | qDebug("saving file " + fileName); | 364 | qDebug("saving file " + fileName); |
362 | snapshot.save( fileName, "PNG"); | 365 | snapshot.save( fileName, "PNG"); |
363 | QFileInfo fi( fileName); | 366 | QFileInfo fi( fileName); |
364 | lnk.setName( fi.fileName()); //sets file name | 367 | lnk.setName( fi.fileName()); //sets file name |
365 | 368 | ||
366 | if (!lnk.writeLink()) | 369 | if (!lnk.writeLink()) |
367 | qDebug("Writing doclink did not work"); | 370 | qDebug("Writing doclink did not work"); |
368 | } | 371 | } |
369 | else { | 372 | else { |
370 | 373 | ||
371 | fileName = "sc_" + QDateTime::currentDateTime().toString(); | 374 | fileName = "sc_" + QDateTime::currentDateTime().toString(); |
372 | fileName.replace(QRegExp("'"), ""); | 375 | fileName.replace(QRegExp("'"), ""); |
373 | fileName.replace(QRegExp(" "), "_"); | 376 | fileName.replace(QRegExp(" "), "_"); |
374 | fileName.replace(QRegExp(":"), "."); | 377 | fileName.replace(QRegExp(":"), "."); |
375 | fileName.replace(QRegExp(","), ""); | 378 | fileName.replace(QRegExp(","), ""); |
376 | QString dirName = QDir::homeDirPath() + "/Documents/image/png/"; | 379 | QString dirName = QDir::homeDirPath() + "/Documents/image/png/"; |
377 | 380 | ||
378 | if ( !QDir( dirName).exists() ) { | 381 | if ( !QDir( dirName).exists() ) { |
379 | qDebug("making dir " + dirName); | 382 | qDebug("making dir " + dirName); |
380 | QString msg = "mkdir -p " + dirName; | 383 | QString msg = "mkdir -p " + dirName; |
381 | system(msg.latin1()); | 384 | system(msg.latin1()); |
382 | } | 385 | } |
383 | fileName = dirName + fileName; | 386 | fileName = dirName + fileName; |
384 | if (fileName.right(3) != "png") | 387 | if (fileName.right(3) != "png") |
385 | fileName = fileName + ".png"; | 388 | fileName = fileName + ".png"; |
386 | lnk.setFile(fileName); //sets File property | 389 | lnk.setFile(fileName); //sets File property |
387 | qDebug("saving file " + fileName); | 390 | qDebug("saving file " + fileName); |
388 | snapshot.save( fileName, "PNG"); | 391 | snapshot.save( fileName, "PNG"); |
389 | QFileInfo fi( fileName); | 392 | QFileInfo fi( fileName); |
390 | lnk.setName( fi.fileName()); //sets file name | 393 | lnk.setName( fi.fileName()); //sets file name |
391 | 394 | ||
392 | if (!lnk.writeLink()) | 395 | if (!lnk.writeLink()) |
393 | qDebug("Writing doclink did not work"); | 396 | qDebug("Writing doclink did not work"); |
394 | 397 | ||
395 | } | 398 | } |
396 | 399 | ||
397 | QPEApplication::beep(); | 400 | QPEApplication::beep(); |
398 | } | 401 | } |
399 | 402 | ||
400 | void ScreenshotControl::performGrab() | 403 | void ScreenshotControl::performGrab() |
401 | { | 404 | { |
402 | snapshot = QPixmap::grabWindow( QPEApplication::desktop()->winId(), 0, 0, QApplication::desktop()->width(), QApplication::desktop()->height() ); | 405 | snapshot = QPixmap::grabWindow( QPEApplication::desktop()->winId(), 0, 0, QApplication::desktop()->width(), QApplication::desktop()->height() ); |
403 | 406 | ||
404 | if (buttonPushed == 1) { | 407 | if (buttonPushed == 1) { |
405 | qDebug("grabbing screen"); | 408 | qDebug("grabbing screen"); |
406 | grabTimer->stop(); | 409 | grabTimer->stop(); |
407 | show(); | 410 | show(); |
408 | qApp->processEvents(); | 411 | qApp->processEvents(); |
409 | savePixmap(); | 412 | savePixmap(); |
410 | } else { | 413 | } else { |
411 | grabTimer->stop(); | 414 | grabTimer->stop(); |
412 | 415 | ||
413 | struct sockaddr_in raddr; | 416 | struct sockaddr_in raddr; |
414 | struct hostent *rhost_info; | 417 | struct hostent *rhost_info; |
415 | int sock = -1; | 418 | int sock = -1; |
416 | bool ok = false; | 419 | bool ok = false; |
417 | 420 | ||
418 | QString displayEnv = getenv("QWS_DISPLAY"); | 421 | QString displayEnv = getenv("QWS_DISPLAY"); |
419 | qDebug(displayEnv); | 422 | qDebug(displayEnv); |
420 | 423 | ||
421 | if(( displayEnv.left(2) != ":0" ) && (!displayEnv.isEmpty())) { | 424 | if(( displayEnv.left(2) != ":0" ) && (!displayEnv.isEmpty())) { |
422 | 425 | ||
423 | if (( rhost_info = (struct hostent *) ::gethostbyname ((char *) SCAP_hostname )) != 0 ) { | 426 | if (( rhost_info = (struct hostent *) ::gethostbyname ((char *) SCAP_hostname )) != 0 ) { |
424 | ::memset ( &raddr, 0, sizeof (struct sockaddr_in)); | 427 | ::memset ( &raddr, 0, sizeof (struct sockaddr_in)); |
425 | ::memcpy ( &raddr. sin_addr, rhost_info-> h_addr, rhost_info-> h_length ); | 428 | ::memcpy ( &raddr. sin_addr, rhost_info-> h_addr, rhost_info-> h_length ); |
426 | raddr. sin_family = rhost_info-> h_addrtype; | 429 | raddr. sin_family = rhost_info-> h_addrtype; |
427 | raddr. sin_port = htons ( SCAP_port ); | 430 | raddr. sin_port = htons ( SCAP_port ); |
428 | 431 | ||
429 | if (( sock = ::socket ( AF_INET, SOCK_STREAM, 0 )) >= 0 ) { | 432 | if (( sock = ::socket ( AF_INET, SOCK_STREAM, 0 )) >= 0 ) { |
430 | if ( ::connect ( sock, (struct sockaddr *) & raddr, sizeof (struct sockaddr)) >= 0 ) { | 433 | if ( ::connect ( sock, (struct sockaddr *) & raddr, sizeof (struct sockaddr)) >= 0 ) { |
431 | 434 | ||
432 | QString header; | 435 | QString header; |
433 | 436 | ||
434 | QPixmap pix; | 437 | QPixmap pix; |
435 | 438 | ||
436 | QString SCAP_model=""; | 439 | QString SCAP_model=""; |
437 | #warning FIXME: model string should be filled with actual device model | 440 | #warning FIXME: model string should be filled with actual device model |
438 | if( snapshot.width() > 320) | 441 | if( snapshot.width() > 320) |
439 | SCAP_model ="Corgi"; | 442 | SCAP_model ="Corgi"; |
440 | 443 | ||
441 | if(displayEnv == "QVFb:0") {//set this if you plan on using this app in qvfb!! | 444 | if(displayEnv == "QVFb:0") {//set this if you plan on using this app in qvfb!! |
442 | pix = snapshot.xForm(QWMatrix().rotate(90)); | 445 | pix = snapshot.xForm(QWMatrix().rotate(90)); |
443 | } else | 446 | } else |
444 | pix = ( snapshot.width() > snapshot.height() ) ? snapshot : snapshot.xForm( QWMatrix().rotate(90) ); | 447 | pix = ( snapshot.width() > snapshot.height() ) ? snapshot : snapshot.xForm( QWMatrix().rotate(90) ); |
445 | 448 | ||
446 | QImage img = pix.convertToImage().convertDepth( 16 ); // could make that also depth independent, if hh.org/scap can handle it | 449 | QImage img = pix.convertToImage().convertDepth( 16 ); // could make that also depth independent, if hh.org/scap can handle it |
447 | 450 | ||
448 | header = "POST /scap/capture.cgi?%1+%2 HTTP/1.1\n" // 1: model / 2: user | 451 | header = "POST /scap/capture.cgi?%1+%2 HTTP/1.1\n" // 1: model / 2: user |
449 | "Content-length: %3\n" // 3: content length | 452 | "Content-length: %3\n" // 3: content length |
450 | "Content-Type: image/png\n" | 453 | "Content-Type: image/png\n" |
451 | "Host: %4\n" // 4: scap host | 454 | "Host: %4\n" // 4: scap host |
452 | "\n"; | 455 | "\n"; |
453 | 456 | ||
454 | 457 | ||
455 | header = header.arg( SCAP_model).arg( ::getenv( "USER" ) ).arg( img.numBytes() ).arg( SCAP_hostname ); | 458 | header = header.arg( SCAP_model).arg( ::getenv( "USER" ) ).arg( img.numBytes() ).arg( SCAP_hostname ); |
456 | qDebug(header); | 459 | qDebug(header); |
457 | 460 | ||
458 | if ( !pix.isNull() ) { | 461 | if ( !pix.isNull() ) { |
459 | const char *ascii = header.latin1( ); | 462 | const char *ascii = header.latin1( ); |
460 | uint ascii_len = ::strlen( ascii ); | 463 | uint ascii_len = ::strlen( ascii ); |
461 | ::write ( sock, ascii, ascii_len ); | 464 | ::write ( sock, ascii, ascii_len ); |
462 | ::write ( sock, img.bits(), img.numBytes() ); | 465 | ::write ( sock, img.bits(), img.numBytes() ); |
463 | 466 | ||
464 | ok = true; | 467 | ok = true; |
465 | } | 468 | } |
466 | } | 469 | } |
467 | ::close ( sock ); | 470 | ::close ( sock ); |
468 | } | 471 | } |
469 | } | 472 | } |
470 | if ( ok ) { | 473 | if ( ok ) { |
471 | QMessageBox::information( 0, tr( "Success" ), QString( "<p>%1</p>" ).arg ( tr( "Screenshot was uploaded to %1" )).arg( SCAP_hostname )); | 474 | QMessageBox::information( 0, tr( "Success" ), QString( "<p>%1</p>" ).arg ( tr( "Screenshot was uploaded to %1" )).arg( SCAP_hostname )); |
472 | } else { | 475 | } else { |
473 | QMessageBox::warning( 0, tr( "Error" ), QString( "<p>%1</p>" ).arg( tr( "Connection to %1 failed." )).arg( SCAP_hostname )); | 476 | QMessageBox::warning( 0, tr( "Error" ), QString( "<p>%1</p>" ).arg( tr( "Connection to %1 failed." )).arg( SCAP_hostname )); |
474 | } | 477 | } |
475 | } else { | 478 | } else { |
476 | QMessageBox::warning( 0, tr( "Error" ),tr("Please set <b>QWS_DISPLAY</b> environmental variable.")); | 479 | QMessageBox::warning( 0, tr( "Error" ),tr("Please set <b>QWS_DISPLAY</b> environmental variable.")); |
477 | } | 480 | } |
478 | } | 481 | } |
479 | 482 | ||
480 | } | 483 | } |
481 | 484 | ||
482 | 485 | ||
483 | 486 | ||
484 | //=========================================================================== | 487 | //=========================================================================== |
485 | 488 | ||
486 | ScreenshotApplet::ScreenshotApplet( QWidget *parent, const char *name ) | 489 | ScreenshotApplet::ScreenshotApplet( QWidget *parent, const char *name ) |
487 | : QWidget( parent, name ) | 490 | : QWidget( parent, name ) |
488 | { | 491 | { |
489 | setFixedWidth( AppLnk::smallIconSize()); | 492 | setFixedWidth( AppLnk::smallIconSize()); |
490 | 493 | ||
491 | QImage img = (const char **)snapshot_xpm; | 494 | QImage img = (const char **)snapshot_xpm; |
492 | img = img.smoothScale(AppLnk::smallIconSize(), AppLnk::smallIconSize()); | 495 | img = img.smoothScale(AppLnk::smallIconSize(), AppLnk::smallIconSize()); |
493 | m_icon.convertFromImage(img); | 496 | m_icon.convertFromImage(img); |
494 | } | 497 | } |
495 | 498 | ||
496 | ScreenshotApplet::~ScreenshotApplet() | 499 | ScreenshotApplet::~ScreenshotApplet() |
497 | { | 500 | { |
498 | } | 501 | } |
499 | 502 | ||
503 | int ScreenshotApplet::position() | ||
504 | { | ||
505 | return 6; | ||
506 | } | ||
507 | |||
500 | void ScreenshotApplet::mousePressEvent( QMouseEvent *) | 508 | void ScreenshotApplet::mousePressEvent( QMouseEvent *) |
501 | { | 509 | { |
502 | ScreenshotControl *sc = new ScreenshotControl ( ); | 510 | ScreenshotControl *sc = new ScreenshotControl ( ); |
503 | QPoint curPos = mapToGlobal ( QPoint ( 0, 0 )); | 511 | QPoint curPos = mapToGlobal ( QPoint ( 0, 0 )); |
504 | 512 | ||
505 | // windowPosX is the windows position centered above the applets icon. | 513 | // windowPosX is the windows position centered above the applets icon. |
506 | // If the icon is near the edge of the screen, the window would leave the visible area | 514 | // If the icon is near the edge of the screen, the window would leave the visible area |
507 | // so we check the position against the screen width and correct the difference if needed | 515 | // so we check the position against the screen width and correct the difference if needed |
508 | 516 | ||
509 | int screenWidth = qApp->desktop()->width(); | 517 | int screenWidth = qApp->desktop()->width(); |
510 | int windowPosX = curPos. x ( ) - ( sc-> sizeHint ( ). width ( ) - width ( )) / 2 ; | 518 | int windowPosX = curPos. x ( ) - ( sc-> sizeHint ( ). width ( ) - width ( )) / 2 ; |
511 | int ZwindowPosX, XwindowPosX; | 519 | int ZwindowPosX, XwindowPosX; |
512 | 520 | ||
513 | // the window would be placed beyond the screen wich doesn't look tooo good | 521 | // the window would be placed beyond the screen wich doesn't look tooo good |
514 | if ( (windowPosX + sc-> sizeHint ( ). width ( )) > screenWidth ) { | 522 | if ( (windowPosX + sc-> sizeHint ( ). width ( )) > screenWidth ) { |
515 | XwindowPosX = windowPosX + sc-> sizeHint ( ). width ( ) - screenWidth; | 523 | XwindowPosX = windowPosX + sc-> sizeHint ( ). width ( ) - screenWidth; |
516 | ZwindowPosX = windowPosX - XwindowPosX - 1; | 524 | ZwindowPosX = windowPosX - XwindowPosX - 1; |
517 | } else { | 525 | } else { |
518 | ZwindowPosX = windowPosX; | 526 | ZwindowPosX = windowPosX; |
519 | } | 527 | } |
520 | 528 | ||
521 | sc-> move ( ZwindowPosX, curPos. y ( ) - sc-> sizeHint ( ). height ( ) ); | 529 | sc-> move ( ZwindowPosX, curPos. y ( ) - sc-> sizeHint ( ). height ( ) ); |
522 | sc-> show ( ); | 530 | sc-> show ( ); |
523 | } | 531 | } |
524 | 532 | ||
525 | void ScreenshotApplet::paintEvent( QPaintEvent* ) | 533 | void ScreenshotApplet::paintEvent( QPaintEvent* ) |
526 | { | 534 | { |
527 | QPainter p ( this ); | 535 | QPainter p ( this ); |
528 | p.drawPixmap( 0,0, m_icon ); | 536 | p.drawPixmap( 0,0, m_icon ); |
529 | } | 537 | } |
530 | 538 | ||
539 | Q_EXPORT_INTERFACE() | ||
540 | { | ||
541 | Q_CREATE_INSTANCE( OTaskbarAppletWrapper<ScreenshotApplet> ); | ||
542 | } | ||
543 | |||
diff --git a/core/applets/screenshotapplet/screenshot.h b/core/applets/screenshotapplet/screenshot.h index 74cc5e6..b753583 100644 --- a/core/applets/screenshotapplet/screenshot.h +++ b/core/applets/screenshotapplet/screenshot.h | |||
@@ -1,70 +1,71 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com | 2 | ** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com |
3 | ** All rights reserved. | 3 | ** All rights reserved. |
4 | ** | 4 | ** |
5 | ** This file may be distributed and/or modified under the terms of the | 5 | ** This file may be distributed and/or modified under the terms of the |
6 | ** GNU General Public License version 2 as published by the Free Software | 6 | ** GNU General Public License version 2 as published by the Free Software |
7 | ** Foundation and appearing in the file LICENSE.GPL included in the | 7 | ** Foundation and appearing in the file LICENSE.GPL included in the |
8 | ** packaging of this file. | 8 | ** packaging of this file. |
9 | ** | 9 | ** |
10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
12 | ** | 12 | ** |
13 | **********************************************************************/ | 13 | **********************************************************************/ |
14 | 14 | ||
15 | #ifndef __SCREENSHOT_APPLET_H__ | 15 | #ifndef __SCREENSHOT_APPLET_H__ |
16 | #define __SCREENSHOT_APPLET_H__ | 16 | #define __SCREENSHOT_APPLET_H__ |
17 | 17 | ||
18 | 18 | ||
19 | 19 | ||
20 | #include <qwidget.h> | 20 | #include <qwidget.h> |
21 | #include <qframe.h> | 21 | #include <qframe.h> |
22 | #include <qpixmap.h> | 22 | #include <qpixmap.h> |
23 | #include <qguardedptr.h> | 23 | #include <qguardedptr.h> |
24 | #include <qtimer.h> | 24 | #include <qtimer.h> |
25 | 25 | ||
26 | class QComboBox; | 26 | class QComboBox; |
27 | class QCheckBox; | 27 | class QCheckBox; |
28 | class QSpinBox; | 28 | class QSpinBox; |
29 | class QPushButton; | 29 | class QPushButton; |
30 | //class QImage; | 30 | //class QImage; |
31 | 31 | ||
32 | class ScreenshotControl : public QFrame | 32 | class ScreenshotControl : public QFrame |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | public: | 35 | public: |
36 | ScreenshotControl( QWidget *parent=0, const char *name=0 ); | 36 | ScreenshotControl( QWidget *parent=0, const char *name=0 ); |
37 | 37 | ||
38 | private: | 38 | private: |
39 | QPushButton *grabItButton, *scapButton; | 39 | QPushButton *grabItButton, *scapButton; |
40 | QPixmap snapshot; | 40 | QPixmap snapshot; |
41 | QTimer* grabTimer; | 41 | QTimer* grabTimer; |
42 | QCheckBox *saveNamedCheck; | 42 | QCheckBox *saveNamedCheck; |
43 | QString FileNamePath; | 43 | QString FileNamePath; |
44 | bool setFileName; | 44 | bool setFileName; |
45 | QSpinBox *delaySpin; | 45 | QSpinBox *delaySpin; |
46 | int buttonPushed; | 46 | int buttonPushed; |
47 | 47 | ||
48 | private slots: | 48 | private slots: |
49 | void slotGrab(); | 49 | void slotGrab(); |
50 | void slotScap(); | 50 | void slotScap(); |
51 | void savePixmap(); | 51 | void savePixmap(); |
52 | void performGrab(); | 52 | void performGrab(); |
53 | }; | 53 | }; |
54 | 54 | ||
55 | class ScreenshotApplet : public QWidget { | 55 | class ScreenshotApplet : public QWidget { |
56 | public: | 56 | public: |
57 | ScreenshotApplet( QWidget *parent = 0, const char *name=0 ); | 57 | ScreenshotApplet( QWidget *parent = 0, const char *name=0 ); |
58 | ~ScreenshotApplet(); | 58 | ~ScreenshotApplet(); |
59 | static int position(); | ||
59 | 60 | ||
60 | protected: | 61 | protected: |
61 | void mousePressEvent( QMouseEvent * ); | 62 | void mousePressEvent( QMouseEvent * ); |
62 | void paintEvent( QPaintEvent* ); | 63 | void paintEvent( QPaintEvent* ); |
63 | 64 | ||
64 | private: | 65 | private: |
65 | QPixmap m_icon; | 66 | QPixmap m_icon; |
66 | }; | 67 | }; |
67 | 68 | ||
68 | 69 | ||
69 | #endif // __SCREENSHOT_APPLET_H__ | 70 | #endif // __SCREENSHOT_APPLET_H__ |
70 | 71 | ||
diff --git a/core/applets/screenshotapplet/screenshotapplet.pro b/core/applets/screenshotapplet/screenshotapplet.pro index 45a5759..c7fcc3e 100644 --- a/core/applets/screenshotapplet/screenshotapplet.pro +++ b/core/applets/screenshotapplet/screenshotapplet.pro | |||
@@ -1,15 +1,13 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt plugin warn_on release | 2 | CONFIG += qt plugin warn_on release |
3 | HEADERS = screenshot.h inputDialog.h screenshotappletimpl.h | 3 | HEADERS = screenshot.h inputDialog.h |
4 | SOURCES = screenshot.cpp inputDialog.cpp screenshotappletimpl.cpp | 4 | SOURCES = screenshot.cpp inputDialog.cpp |
5 | TARGET = screenshotapplet | 5 | TARGET = screenshotapplet |
6 | DESTDIR = $(OPIEDIR)/plugins/applets | 6 | DESTDIR = $(OPIEDIR)/plugins/applets |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += ../$(OPIEDIR)/include | 8 | DEPENDPATH += ../$(OPIEDIR)/include |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe |
10 | VERSION = 1.0.0 | 10 | VERSION = 1.0.0 |
11 | MOC_DIR=opieobj | ||
12 | OBJECTS_DIR=opieobj | ||
13 | 11 | ||
14 | include ( $(OPIEDIR)/include.pro ) | 12 | include ( $(OPIEDIR)/include.pro ) |
15 | target.path = $$prefix/plugins/applets | 13 | target.path = $$prefix/plugins/applets |
diff --git a/core/applets/screenshotapplet/screenshotappletimpl.cpp b/core/applets/screenshotapplet/screenshotappletimpl.cpp deleted file mode 100644 index e99ecb0..0000000 --- a/core/applets/screenshotapplet/screenshotappletimpl.cpp +++ b/dev/null | |||
@@ -1,66 +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 "screenshot.h" | ||
21 | #include "screenshotappletimpl.h" | ||
22 | |||
23 | |||
24 | ScreenshotAppletImpl::ScreenshotAppletImpl() | ||
25 | : screenshot(0) | ||
26 | { | ||
27 | } | ||
28 | |||
29 | ScreenshotAppletImpl::~ScreenshotAppletImpl() | ||
30 | { | ||
31 | delete screenshot; | ||
32 | } | ||
33 | |||
34 | QWidget *ScreenshotAppletImpl::applet( QWidget *parent ) | ||
35 | { | ||
36 | if ( !screenshot ) | ||
37 | screenshot = new ScreenshotApplet( parent ); | ||
38 | return screenshot; | ||
39 | } | ||
40 | |||
41 | int ScreenshotAppletImpl::position() const | ||
42 | { | ||
43 | return 6; | ||
44 | } | ||
45 | |||
46 | QRESULT ScreenshotAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | ||
47 | { | ||
48 | *iface = 0; | ||
49 | if ( uuid == IID_QUnknown ) | ||
50 | *iface = this; | ||
51 | else if ( uuid == IID_TaskbarApplet ) | ||
52 | *iface = this; | ||
53 | else | ||
54 | return QS_FALSE; | ||
55 | |||
56 | if ( *iface ) | ||
57 | (*iface)->addRef(); | ||
58 | return QS_OK; | ||
59 | } | ||
60 | |||
61 | Q_EXPORT_INTERFACE() | ||
62 | { | ||
63 | Q_CREATE_INSTANCE( ScreenshotAppletImpl ) | ||
64 | } | ||
65 | |||
66 | |||
diff --git a/core/applets/screenshotapplet/screenshotappletimpl.h b/core/applets/screenshotapplet/screenshotappletimpl.h deleted file mode 100644 index 988a34c..0000000 --- a/core/applets/screenshotapplet/screenshotappletimpl.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 SCREENSHOTAPPLETIMPL_H | ||
21 | #define SCREENSHOTAPPLETIMPL_H | ||
22 | |||
23 | #include <qpe/taskbarappletinterface.h> | ||
24 | |||
25 | class ScreenshotApplet; | ||
26 | |||
27 | class ScreenshotAppletImpl : public TaskbarAppletInterface | ||
28 | { | ||
29 | public: | ||
30 | ScreenshotAppletImpl(); | ||
31 | virtual ~ScreenshotAppletImpl(); | ||
32 | |||
33 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | ||
34 | Q_REFCOUNT | ||
35 | |||
36 | virtual QWidget *applet( QWidget *parent ); | ||
37 | virtual int position() const; | ||
38 | |||
39 | private: | ||
40 | ScreenshotApplet *screenshot; | ||
41 | }; | ||
42 | |||
43 | #endif | ||
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index fe8ebfd..563d110 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp | |||
@@ -1,633 +1,645 @@ | |||
1 | /************************************************************************************ | 1 | /************************************************************************************ |
2 | ** | 2 | ** |
3 | ** This file may be distributed and/or modified under the terms of the | 3 | ** This file may be distributed and/or modified under the terms of the |
4 | ** GNU General Public License version 2 as published by the Free Software | 4 | ** GNU General Public License version 2 as published by the Free Software |
5 | ** Foundation and appearing in the file LICENSE.GPL included in the | 5 | ** Foundation and appearing in the file LICENSE.GPL included in the |
6 | ** packaging of this file. | 6 | ** packaging of this file. |
7 | ** | 7 | ** |
8 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 8 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
10 | ** | 10 | ** |
11 | ************************************************************************************/ | 11 | ************************************************************************************/ |
12 | // copyright 2002 Jeremy Cowgar <jc@cowgar.com> | 12 | // copyright 2002 Jeremy Cowgar <jc@cowgar.com> |
13 | // copyright 2002 and 2003 L.J.Potter <ljp@llornkcor.com> | 13 | // copyright 2002 and 2003 L.J.Potter <ljp@llornkcor.com> |
14 | 14 | ||
15 | extern "C" { | 15 | extern "C" { |
16 | #include "adpcm.h" | 16 | #include "adpcm.h" |
17 | } | 17 | } |
18 | 18 | ||
19 | #include <unistd.h> | 19 | #include <unistd.h> |
20 | #include <stdio.h> | 20 | #include <stdio.h> |
21 | #include <fcntl.h> | 21 | #include <fcntl.h> |
22 | #include <sys/ioctl.h> | 22 | #include <sys/ioctl.h> |
23 | #include <linux/soundcard.h> | 23 | #include <linux/soundcard.h> |
24 | 24 | ||
25 | #include <errno.h> | 25 | #include <errno.h> |
26 | 26 | ||
27 | typedef struct _waveheader { | 27 | typedef struct _waveheader { |
28 | u_long main_chunk; /* 'RIFF' */ | 28 | u_long main_chunk; /* 'RIFF' */ |
29 | u_long length; /* filelen */ | 29 | u_long length; /* filelen */ |
30 | u_long chunk_type; /* 'WAVE' */ | 30 | u_long chunk_type; /* 'WAVE' */ |
31 | u_long sub_chunk; /* 'fmt ' */ | 31 | u_long sub_chunk; /* 'fmt ' */ |
32 | u_long sc_len; /* length of sub_chunk, =16 | 32 | u_long sc_len; /* length of sub_chunk, =16 |
33 | (chunckSize) format len */ | 33 | (chunckSize) format len */ |
34 | u_short format; /* should be 1 for PCM-code (formatTag) */ | 34 | u_short format; /* should be 1 for PCM-code (formatTag) */ |
35 | 35 | ||
36 | u_short modus; /* 1 Mono, 2 Stereo (channels) */ | 36 | u_short modus; /* 1 Mono, 2 Stereo (channels) */ |
37 | u_long sample_fq; /* samples per second (samplesPerSecond) */ | 37 | u_long sample_fq; /* samples per second (samplesPerSecond) */ |
38 | u_long byte_p_sec; /* avg bytes per second (avgBytePerSecond) */ | 38 | u_long byte_p_sec; /* avg bytes per second (avgBytePerSecond) */ |
39 | u_short byte_p_spl; /* samplesize; 1 or 2 bytes (blockAlign) */ | 39 | u_short byte_p_spl; /* samplesize; 1 or 2 bytes (blockAlign) */ |
40 | u_short bit_p_spl; /* 8, 12 or 16 bit (bitsPerSample) */ | 40 | u_short bit_p_spl; /* 8, 12 or 16 bit (bitsPerSample) */ |
41 | 41 | ||
42 | u_long data_chunk; /* 'data' */ | 42 | u_long data_chunk; /* 'data' */ |
43 | 43 | ||
44 | u_long data_length;/* samplecount */ | 44 | u_long data_length;/* samplecount */ |
45 | } WaveHeader; | 45 | } WaveHeader; |
46 | 46 | ||
47 | #define RIFF 0x46464952 | 47 | #define RIFF 0x46464952 |
48 | #define WAVE 0x45564157 | 48 | #define WAVE 0x45564157 |
49 | #define FMT 0x20746D66 | 49 | #define FMT 0x20746D66 |
50 | #define DATA 0x61746164 | 50 | #define DATA 0x61746164 |
51 | #define PCM_CODE 1 | 51 | #define PCM_CODE 1 |
52 | #define WAVE_MONO 1 | 52 | #define WAVE_MONO 1 |
53 | #define WAVE_STEREO 2 | 53 | #define WAVE_STEREO 2 |
54 | 54 | ||
55 | struct adpcm_state encoder_state; | 55 | struct adpcm_state encoder_state; |
56 | //struct adpcm_state decoder_state; | 56 | //struct adpcm_state decoder_state; |
57 | 57 | ||
58 | #define WAVE_FORMAT_DVI_ADPCM (0x0011) | 58 | #define WAVE_FORMAT_DVI_ADPCM (0x0011) |
59 | #define WAVE_FORMAT_PCM (0x0001) | 59 | #define WAVE_FORMAT_PCM (0x0001) |
60 | 60 | ||
61 | 61 | ||
62 | #include "vmemo.h" | 62 | #include "vmemo.h" |
63 | 63 | ||
64 | #include <opie2/otaskbarapplet.h> | ||
64 | #include <qpe/qpeapplication.h> | 65 | #include <qpe/qpeapplication.h> |
65 | #include <qpe/config.h> | 66 | #include <qpe/config.h> |
66 | 67 | ||
67 | #include <qpainter.h> | 68 | #include <qpainter.h> |
68 | #include <qmessagebox.h> | 69 | #include <qmessagebox.h> |
69 | 70 | ||
70 | int seq = 0; | 71 | int seq = 0; |
71 | 72 | ||
72 | /* XPM */ | 73 | /* XPM */ |
73 | static char * vmemo_xpm[] = { | 74 | static char * vmemo_xpm[] = { |
74 | "16 16 102 2", | 75 | "16 16 102 2", |
75 | " c None", | 76 | " c None", |
76 | ". c #60636A", | 77 | ". c #60636A", |
77 | "+ c #6E6E72", | 78 | "+ c #6E6E72", |
78 | "@ c #68696E", | 79 | "@ c #68696E", |
79 | "# c #4D525C", | 80 | "# c #4D525C", |
80 | "$ c #6B6C70", | 81 | "$ c #6B6C70", |
81 | "% c #E3E3E8", | 82 | "% c #E3E3E8", |
82 | "& c #EEEEF2", | 83 | "& c #EEEEF2", |
83 | "* c #EAEAEF", | 84 | "* c #EAEAEF", |
84 | "= c #CACAD0", | 85 | "= c #CACAD0", |
85 | "- c #474A51", | 86 | "- c #474A51", |
86 | "; c #171819", | 87 | "; c #171819", |
87 | "> c #9B9B9F", | 88 | "> c #9B9B9F", |
88 | ", c #EBEBF0", | 89 | ", c #EBEBF0", |
89 | "' c #F4F4F7", | 90 | "' c #F4F4F7", |
90 | ") c #F1F1F5", | 91 | ") c #F1F1F5", |
91 | "! c #DEDEE4", | 92 | "! c #DEDEE4", |
92 | "~ c #57575C", | 93 | "~ c #57575C", |
93 | "{ c #010101", | 94 | "{ c #010101", |
94 | "] c #A2A2A6", | 95 | "] c #A2A2A6", |
95 | "^ c #747477", | 96 | "^ c #747477", |
96 | "/ c #B5B5B8", | 97 | "/ c #B5B5B8", |
97 | "( c #AEAEB2", | 98 | "( c #AEAEB2", |
98 | "_ c #69696D", | 99 | "_ c #69696D", |
99 | ": c #525256", | 100 | ": c #525256", |
100 | "< c #181C24", | 101 | "< c #181C24", |
101 | "[ c #97979B", | 102 | "[ c #97979B", |
102 | "} c #A7A7AC", | 103 | "} c #A7A7AC", |
103 | "| c #B0B0B4", | 104 | "| c #B0B0B4", |
104 | "1 c #C8C8D1", | 105 | "1 c #C8C8D1", |
105 | "2 c #75757B", | 106 | "2 c #75757B", |
106 | "3 c #46464A", | 107 | "3 c #46464A", |
107 | "4 c #494A4F", | 108 | "4 c #494A4F", |
108 | "5 c #323234", | 109 | "5 c #323234", |
109 | "6 c #909095", | 110 | "6 c #909095", |
110 | "7 c #39393B", | 111 | "7 c #39393B", |
111 | "8 c #757578", | 112 | "8 c #757578", |
112 | "9 c #87878E", | 113 | "9 c #87878E", |
113 | "0 c #222224", | 114 | "0 c #222224", |
114 | "a c #414144", | 115 | "a c #414144", |
115 | "b c #6A6A6E", | 116 | "b c #6A6A6E", |
116 | "c c #020C16", | 117 | "c c #020C16", |
117 | "d c #6B6B6F", | 118 | "d c #6B6B6F", |
118 | "e c #68686D", | 119 | "e c #68686D", |
119 | "f c #5B5B60", | 120 | "f c #5B5B60", |
120 | "g c #8A8A8F", | 121 | "g c #8A8A8F", |
121 | "h c #6B6B6E", | 122 | "h c #6B6B6E", |
122 | "i c #ADADB2", | 123 | "i c #ADADB2", |
123 | "j c #828289", | 124 | "j c #828289", |
124 | "k c #3E3E41", | 125 | "k c #3E3E41", |
125 | "l c #CFCFD7", | 126 | "l c #CFCFD7", |
126 | "m c #4C4C50", | 127 | "m c #4C4C50", |
127 | "n c #000000", | 128 | "n c #000000", |
128 | "o c #66666A", | 129 | "o c #66666A", |
129 | "p c #505054", | 130 | "p c #505054", |
130 | "q c #838388", | 131 | "q c #838388", |
131 | "r c #A1A1A7", | 132 | "r c #A1A1A7", |
132 | "s c #A9A9AE", | 133 | "s c #A9A9AE", |
133 | "t c #A8A8B0", | 134 | "t c #A8A8B0", |
134 | "u c #5E5E63", | 135 | "u c #5E5E63", |
135 | "v c #3A3A3E", | 136 | "v c #3A3A3E", |
136 | "w c #BDBDC6", | 137 | "w c #BDBDC6", |
137 | "x c #59595E", | 138 | "x c #59595E", |
138 | "y c #76767C", | 139 | "y c #76767C", |
139 | "z c #373738", | 140 | "z c #373738", |
140 | "A c #717174", | 141 | "A c #717174", |
141 | "B c #727278", | 142 | "B c #727278", |
142 | "C c #1C1C1E", | 143 | "C c #1C1C1E", |
143 | "D c #3C3C3F", | 144 | "D c #3C3C3F", |
144 | "E c #ADADB6", | 145 | "E c #ADADB6", |
145 | "F c #54555A", | 146 | "F c #54555A", |
146 | "G c #8B8C94", | 147 | "G c #8B8C94", |
147 | "H c #5A5A5F", | 148 | "H c #5A5A5F", |
148 | "I c #BBBBC3", | 149 | "I c #BBBBC3", |
149 | "J c #C4C4CB", | 150 | "J c #C4C4CB", |
150 | "K c #909098", | 151 | "K c #909098", |
151 | "L c #737379", | 152 | "L c #737379", |
152 | "M c #343437", | 153 | "M c #343437", |
153 | "N c #8F8F98", | 154 | "N c #8F8F98", |
154 | "O c #000407", | 155 | "O c #000407", |
155 | "P c #2D3137", | 156 | "P c #2D3137", |
156 | "Q c #B0B1BC", | 157 | "Q c #B0B1BC", |
157 | "R c #3B3C40", | 158 | "R c #3B3C40", |
158 | "S c #6E6E74", | 159 | "S c #6E6E74", |
159 | "T c #95959C", | 160 | "T c #95959C", |
160 | "U c #74747A", | 161 | "U c #74747A", |
161 | "V c #1D1D1E", | 162 | "V c #1D1D1E", |
162 | "W c #91929A", | 163 | "W c #91929A", |
163 | "X c #42444A", | 164 | "X c #42444A", |
164 | "Y c #22282E", | 165 | "Y c #22282E", |
165 | "Z c #B0B2BC", | 166 | "Z c #B0B2BC", |
166 | "` c #898A90", | 167 | "` c #898A90", |
167 | " . c #65656A", | 168 | " . c #65656A", |
168 | ".. c #999AA2", | 169 | ".. c #999AA2", |
169 | "+. c #52535A", | 170 | "+. c #52535A", |
170 | "@. c #151B21", | 171 | "@. c #151B21", |
171 | "#. c #515257", | 172 | "#. c #515257", |
172 | "$. c #B5B5BE", | 173 | "$. c #B5B5BE", |
173 | "%. c #616167", | 174 | "%. c #616167", |
174 | "&. c #1A1D22", | 175 | "&. c #1A1D22", |
175 | "*. c #000713", | 176 | "*. c #000713", |
176 | "=. c #1F1F21", | 177 | "=. c #1F1F21", |
177 | " ", | 178 | " ", |
178 | " . + @ # ", | 179 | " . + @ # ", |
179 | " $ % & * = - ", | 180 | " $ % & * = - ", |
180 | " ; > , ' ) ! ~ ", | 181 | " ; > , ' ) ! ~ ", |
181 | " { ] ^ / ( _ : ", | 182 | " { ] ^ / ( _ : ", |
182 | " < [ } | 1 2 3 ", | 183 | " < [ } | 1 2 3 ", |
183 | " 4 5 6 7 8 9 0 a b c ", | 184 | " 4 5 6 7 8 9 0 a b c ", |
184 | " d e f g h i j 3 k l m n ", | 185 | " d e f g h i j 3 k l m n ", |
185 | " o p q r s t u v w n ", | 186 | " o p q r s t u v w n ", |
186 | " o x y z A B C D E n ", | 187 | " o x y z A B C D E n ", |
187 | " F G H I J K L M N O ", | 188 | " F G H I J K L M N O ", |
188 | " P Q R S T U V W X ", | 189 | " P Q R S T U V W X ", |
189 | " Y Z ` b ...+. ", | 190 | " Y Z ` b ...+. ", |
190 | " @.#.$.%.&. ", | 191 | " @.#.$.%.&. ", |
191 | " *.B =. ", | 192 | " *.B =. ", |
192 | " n n n n n n n n n "}; | 193 | " n n n n n n n n n "}; |
193 | 194 | ||
194 | 195 | ||
195 | VMemo::VMemo( QWidget *parent, const char *_name ) | 196 | VMemo::VMemo( QWidget *parent, const char *_name ) |
196 | : QWidget( parent, _name ) { | 197 | : QWidget( parent, _name ) { |
197 | setFixedHeight( 18 ); | 198 | setFixedHeight( 18 ); |
198 | setFixedWidth( 14 ); | 199 | setFixedWidth( 14 ); |
199 | 200 | ||
200 | t_timer = new QTimer( this ); | 201 | t_timer = new QTimer( this ); |
201 | connect( t_timer, SIGNAL( timeout() ), SLOT( timerBreak() ) ); | 202 | connect( t_timer, SIGNAL( timeout() ), SLOT( timerBreak() ) ); |
202 | 203 | ||
203 | Config vmCfg("Vmemo"); | 204 | Config vmCfg("Vmemo"); |
204 | vmCfg.setGroup("Defaults"); | 205 | vmCfg.setGroup("Defaults"); |
205 | int toggleKey = setToggleButton(vmCfg.readNumEntry("toggleKey", -1)); | 206 | int toggleKey = setToggleButton(vmCfg.readNumEntry("toggleKey", -1)); |
206 | useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0); | 207 | useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0); |
207 | 208 | ||
208 | qDebug("toggleKey %d", toggleKey); | 209 | qDebug("toggleKey %d", toggleKey); |
209 | if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) | 210 | if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) |
210 | systemZaurus=TRUE; | 211 | systemZaurus=TRUE; |
211 | else | 212 | else |
212 | systemZaurus=FALSE; | 213 | systemZaurus=FALSE; |
213 | 214 | ||
214 | myChannel = new QCopChannel( "QPE/VMemo", this ); | 215 | myChannel = new QCopChannel( "QPE/VMemo", this ); |
215 | connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)), | 216 | connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)), |
216 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 217 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
217 | 218 | ||
218 | if( toggleKey != -1 ) { | 219 | if( toggleKey != -1 ) { |
219 | // keyRegister(key, channel, message) | 220 | // keyRegister(key, channel, message) |
220 | QCopEnvelope e("QPE/Launcher", "keyRegister(int,QCString,QCString)"); | 221 | QCopEnvelope e("QPE/Launcher", "keyRegister(int,QCString,QCString)"); |
221 | // e << 4096; // Key_Escape | 222 | // e << 4096; // Key_Escape |
222 | // e << Key_F5; //4148 | 223 | // e << Key_F5; //4148 |
223 | e << toggleKey; | 224 | e << toggleKey; |
224 | e << QString("QPE/VMemo"); | 225 | e << QString("QPE/VMemo"); |
225 | e << QString("toggleRecord()"); | 226 | e << QString("toggleRecord()"); |
226 | } | 227 | } |
227 | if(toggleKey == 1) | 228 | if(toggleKey == 1) |
228 | usingIcon=TRUE; | 229 | usingIcon=TRUE; |
229 | else | 230 | else |
230 | usingIcon=FALSE; | 231 | usingIcon=FALSE; |
231 | if( vmCfg.readNumEntry("hideIcon",0) == 1) | 232 | if( vmCfg.readNumEntry("hideIcon",0) == 1) |
232 | hide(); | 233 | hide(); |
233 | recording = FALSE; | 234 | recording = FALSE; |
234 | // } | 235 | // } |
235 | } | 236 | } |
236 | 237 | ||
237 | VMemo::~VMemo() { | 238 | VMemo::~VMemo() { |
238 | } | 239 | } |
239 | 240 | ||
241 | int VMemo::position() | ||
242 | { | ||
243 | return 6; | ||
244 | } | ||
245 | |||
240 | void VMemo::receive( const QCString &msg, const QByteArray &data ) { | 246 | void VMemo::receive( const QCString &msg, const QByteArray &data ) { |
241 | qDebug("receive"); | 247 | qDebug("receive"); |
242 | QDataStream stream( data, IO_ReadOnly ); | 248 | QDataStream stream( data, IO_ReadOnly ); |
243 | 249 | ||
244 | if (msg == "toggleRecord()") { | 250 | if (msg == "toggleRecord()") { |
245 | if (recording) { | 251 | if (recording) { |
246 | fromToggle = TRUE; | 252 | fromToggle = TRUE; |
247 | stopRecording(); | 253 | stopRecording(); |
248 | } else { | 254 | } else { |
249 | fromToggle = TRUE; | 255 | fromToggle = TRUE; |
250 | startRecording(); | 256 | startRecording(); |
251 | } | 257 | } |
252 | } | 258 | } |
253 | } | 259 | } |
254 | 260 | ||
255 | void VMemo::paintEvent( QPaintEvent* ) { | 261 | void VMemo::paintEvent( QPaintEvent* ) { |
256 | QPainter p(this); | 262 | QPainter p(this); |
257 | p.drawPixmap( 0, 1,( const char** ) vmemo_xpm ); | 263 | p.drawPixmap( 0, 1,( const char** ) vmemo_xpm ); |
258 | } | 264 | } |
259 | 265 | ||
260 | void VMemo::mousePressEvent( QMouseEvent * me) { | 266 | void VMemo::mousePressEvent( QMouseEvent * me) { |
261 | /* No mousePress/mouseRelease recording on the iPAQ. The REC button on the iPAQ calls these functions | 267 | /* No mousePress/mouseRelease recording on the iPAQ. The REC button on the iPAQ calls these functions |
262 | mousePressEvent and mouseReleaseEvent with a NULL parameter. */ | 268 | mousePressEvent and mouseReleaseEvent with a NULL parameter. */ |
263 | 269 | ||
264 | // if (!systemZaurus && me != NULL) | 270 | // if (!systemZaurus && me != NULL) |
265 | // return; | 271 | // return; |
266 | // } | 272 | // } |
267 | 273 | ||
268 | if(!recording) | 274 | if(!recording) |
269 | startRecording(); | 275 | startRecording(); |
270 | else | 276 | else |
271 | stopRecording(); | 277 | stopRecording(); |
272 | } | 278 | } |
273 | 279 | ||
274 | void VMemo::mouseReleaseEvent( QMouseEvent * ) { | 280 | void VMemo::mouseReleaseEvent( QMouseEvent * ) { |
275 | } | 281 | } |
276 | 282 | ||
277 | bool VMemo::startRecording() { | 283 | bool VMemo::startRecording() { |
278 | Config config( "Vmemo" ); | 284 | Config config( "Vmemo" ); |
279 | config.setGroup( "System" ); | 285 | config.setGroup( "System" ); |
280 | 286 | ||
281 | useAlerts = config.readBoolEntry("Alert",1); | 287 | useAlerts = config.readBoolEntry("Alert",1); |
282 | if(useAlerts) { | 288 | if(useAlerts) { |
283 | 289 | ||
284 | msgLabel = new QLabel( 0, "alertLabel" ); | 290 | msgLabel = new QLabel( 0, "alertLabel" ); |
285 | msgLabel->setText("<B><P><font size=+2>VMemo-Recording</font></B>"); | 291 | msgLabel->setText("<B><P><font size=+2>VMemo-Recording</font></B>"); |
286 | msgLabel->show(); | 292 | msgLabel->show(); |
287 | } | 293 | } |
288 | 294 | ||
289 | qDebug("Start recording engines"); | 295 | qDebug("Start recording engines"); |
290 | recording = TRUE; | 296 | recording = TRUE; |
291 | 297 | ||
292 | if (openDSP() == -1) { | 298 | if (openDSP() == -1) { |
293 | recording = FALSE; | 299 | recording = FALSE; |
294 | return FALSE; | 300 | return FALSE; |
295 | } | 301 | } |
296 | 302 | ||
297 | config.setGroup("Defaults"); | 303 | config.setGroup("Defaults"); |
298 | 304 | ||
299 | date = TimeString::dateString( QDateTime::currentDateTime(),false,true); | 305 | date = TimeString::dateString( QDateTime::currentDateTime(),false,true); |
300 | date.replace(QRegExp("'"),""); | 306 | date.replace(QRegExp("'"),""); |
301 | date.replace(QRegExp(" "),"_"); | 307 | date.replace(QRegExp(" "),"_"); |
302 | date.replace(QRegExp(":"),"."); | 308 | date.replace(QRegExp(":"),"."); |
303 | date.replace(QRegExp(","),""); | 309 | date.replace(QRegExp(","),""); |
304 | 310 | ||
305 | QString fName; | 311 | QString fName; |
306 | config.setGroup( "System" ); | 312 | config.setGroup( "System" ); |
307 | fName = QPEApplication::documentDir() ; | 313 | fName = QPEApplication::documentDir() ; |
308 | fileName = config.readEntry("RecLocation", fName); | 314 | fileName = config.readEntry("RecLocation", fName); |
309 | 315 | ||
310 | int s; | 316 | int s; |
311 | s=fileName.find(':'); | 317 | s=fileName.find(':'); |
312 | if(s) | 318 | if(s) |
313 | fileName=fileName.right(fileName.length()-s-2); | 319 | fileName=fileName.right(fileName.length()-s-2); |
314 | qDebug("pathname will be "+fileName); | 320 | qDebug("pathname will be "+fileName); |
315 | 321 | ||
316 | if( fileName.left(1).find('/') == -1) | 322 | if( fileName.left(1).find('/') == -1) |
317 | fileName="/"+fileName; | 323 | fileName="/"+fileName; |
318 | if( fileName.right(1).find('/') == -1) | 324 | if( fileName.right(1).find('/') == -1) |
319 | fileName+="/"; | 325 | fileName+="/"; |
320 | fName = "vm_"+ date+ ".wav"; | 326 | fName = "vm_"+ date+ ".wav"; |
321 | 327 | ||
322 | fileName+=fName; | 328 | fileName+=fName; |
323 | qDebug("filename is "+fileName); | 329 | qDebug("filename is "+fileName); |
324 | // open tmp file here | 330 | // open tmp file here |
325 | char *pointer; | 331 | char *pointer; |
326 | pointer=tmpnam(NULL); | 332 | pointer=tmpnam(NULL); |
327 | qDebug("Opening tmp file %s",pointer); | 333 | qDebug("Opening tmp file %s",pointer); |
328 | 334 | ||
329 | if(openWAV(pointer ) == -1) { | 335 | if(openWAV(pointer ) == -1) { |
330 | 336 | ||
331 | QString err("Could not open the temp file\n"); | 337 | QString err("Could not open the temp file\n"); |
332 | err += fileName; | 338 | err += fileName; |
333 | QMessageBox::critical(0, "vmemo", err, "Abort"); | 339 | QMessageBox::critical(0, "vmemo", err, "Abort"); |
334 | ::close(dsp); | 340 | ::close(dsp); |
335 | return FALSE; | 341 | return FALSE; |
336 | } | 342 | } |
337 | if( record() ) { | 343 | if( record() ) { |
338 | 344 | ||
339 | QString cmd; | 345 | QString cmd; |
340 | if( fileName.find(".wav",0,TRUE) == -1) | 346 | if( fileName.find(".wav",0,TRUE) == -1) |
341 | fileName += ".wav"; | 347 | fileName += ".wav"; |
342 | 348 | ||
343 | cmd.sprintf("mv %s "+fileName, pointer); | 349 | cmd.sprintf("mv %s "+fileName, pointer); |
344 | // move tmp file to regular file here | 350 | // move tmp file to regular file here |
345 | 351 | ||
346 | system(cmd.latin1()); | 352 | system(cmd.latin1()); |
347 | 353 | ||
348 | QArray<int> cats(1); | 354 | QArray<int> cats(1); |
349 | cats[0] = config.readNumEntry("Category", 0); | 355 | cats[0] = config.readNumEntry("Category", 0); |
350 | 356 | ||
351 | QString dlName("vm_"); | 357 | QString dlName("vm_"); |
352 | dlName += date; | 358 | dlName += date; |
353 | DocLnk l; | 359 | DocLnk l; |
354 | l.setFile(fileName); | 360 | l.setFile(fileName); |
355 | l.setName(dlName); | 361 | l.setName(dlName); |
356 | l.setType("audio/x-wav"); | 362 | l.setType("audio/x-wav"); |
357 | l.setCategories(cats); | 363 | l.setCategories(cats); |
358 | l.writeLink(); | 364 | l.writeLink(); |
359 | return TRUE; | 365 | return TRUE; |
360 | } else | 366 | } else |
361 | return FALSE; | 367 | return FALSE; |
362 | 368 | ||
363 | } | 369 | } |
364 | 370 | ||
365 | void VMemo::stopRecording() { | 371 | void VMemo::stopRecording() { |
366 | show(); | 372 | show(); |
367 | qDebug("Stopped recording"); | 373 | qDebug("Stopped recording"); |
368 | recording = FALSE; | 374 | recording = FALSE; |
369 | if(useAlerts) { | 375 | if(useAlerts) { |
370 | msgLabel->close(); | 376 | msgLabel->close(); |
371 | msgLabel=0; | 377 | msgLabel=0; |
372 | delete msgLabel; | 378 | delete msgLabel; |
373 | } | 379 | } |
374 | t_timer->stop(); | 380 | t_timer->stop(); |
375 | Config cfg("Vmemo"); | 381 | Config cfg("Vmemo"); |
376 | cfg.setGroup("Defaults"); | 382 | cfg.setGroup("Defaults"); |
377 | if( cfg.readNumEntry("hideIcon",0) == 1 ) | 383 | if( cfg.readNumEntry("hideIcon",0) == 1 ) |
378 | hide(); | 384 | hide(); |
379 | } | 385 | } |
380 | 386 | ||
381 | int VMemo::openDSP() { | 387 | int VMemo::openDSP() { |
382 | Config cfg("Vmemo"); | 388 | Config cfg("Vmemo"); |
383 | cfg.setGroup("Record"); | 389 | cfg.setGroup("Record"); |
384 | 390 | ||
385 | speed = cfg.readNumEntry("SampleRate", 22050); | 391 | speed = cfg.readNumEntry("SampleRate", 22050); |
386 | channels = cfg.readNumEntry("Stereo", 1) ? 2 : 1; // 1 = stereo(2), 0 = mono(1) | 392 | channels = cfg.readNumEntry("Stereo", 1) ? 2 : 1; // 1 = stereo(2), 0 = mono(1) |
387 | if (cfg.readNumEntry("SixteenBit", 1)==1) { | 393 | if (cfg.readNumEntry("SixteenBit", 1)==1) { |
388 | format = AFMT_S16_LE; | 394 | format = AFMT_S16_LE; |
389 | resolution = 16; | 395 | resolution = 16; |
390 | } else { | 396 | } else { |
391 | format = AFMT_U8; | 397 | format = AFMT_U8; |
392 | resolution = 8; | 398 | resolution = 8; |
393 | } | 399 | } |
394 | 400 | ||
395 | qDebug("samplerate: %d, channels %d, resolution %d", speed, channels, resolution); | 401 | qDebug("samplerate: %d, channels %d, resolution %d", speed, channels, resolution); |
396 | 402 | ||
397 | if(systemZaurus) { | 403 | if(systemZaurus) { |
398 | dsp = open("/dev/dsp1", O_RDONLY); //Zaurus needs /dev/dsp1 | 404 | dsp = open("/dev/dsp1", O_RDONLY); //Zaurus needs /dev/dsp1 |
399 | channels=1; //zaurus has one input channel | 405 | channels=1; //zaurus has one input channel |
400 | } else { | 406 | } else { |
401 | dsp = open("/dev/dsp", O_RDONLY); | 407 | dsp = open("/dev/dsp", O_RDONLY); |
402 | } | 408 | } |
403 | 409 | ||
404 | if(dsp == -1) { | 410 | if(dsp == -1) { |
405 | msgLabel->close(); | 411 | msgLabel->close(); |
406 | msgLabel=0; | 412 | msgLabel=0; |
407 | delete msgLabel; | 413 | delete msgLabel; |
408 | 414 | ||
409 | perror("open(\"/dev/dsp\")"); | 415 | perror("open(\"/dev/dsp\")"); |
410 | errorMsg="open(\"/dev/dsp\")\n "+(QString)strerror(errno); | 416 | errorMsg="open(\"/dev/dsp\")\n "+(QString)strerror(errno); |
411 | QMessageBox::critical(0, "vmemo", errorMsg, "Abort"); | 417 | QMessageBox::critical(0, "vmemo", errorMsg, "Abort"); |
412 | return -1; | 418 | return -1; |
413 | } | 419 | } |
414 | 420 | ||
415 | if(ioctl(dsp, SNDCTL_DSP_SETFMT , &format)==-1) { | 421 | if(ioctl(dsp, SNDCTL_DSP_SETFMT , &format)==-1) { |
416 | perror("ioctl(\"SNDCTL_DSP_SETFMT\")"); | 422 | perror("ioctl(\"SNDCTL_DSP_SETFMT\")"); |
417 | return -1; | 423 | return -1; |
418 | } | 424 | } |
419 | if(ioctl(dsp, SNDCTL_DSP_CHANNELS , &channels)==-1) { | 425 | if(ioctl(dsp, SNDCTL_DSP_CHANNELS , &channels)==-1) { |
420 | perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); | 426 | perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); |
421 | return -1; | 427 | return -1; |
422 | } | 428 | } |
423 | if(ioctl(dsp, SNDCTL_DSP_SPEED , &speed)==-1) { | 429 | if(ioctl(dsp, SNDCTL_DSP_SPEED , &speed)==-1) { |
424 | perror("ioctl(\"SNDCTL_DSP_SPEED\")"); | 430 | perror("ioctl(\"SNDCTL_DSP_SPEED\")"); |
425 | return -1; | 431 | return -1; |
426 | } | 432 | } |
427 | if(ioctl(dsp, SOUND_PCM_READ_RATE , &rate)==-1) { | 433 | if(ioctl(dsp, SOUND_PCM_READ_RATE , &rate)==-1) { |
428 | perror("ioctl(\"SOUND_PCM_READ_RATE\")"); | 434 | perror("ioctl(\"SOUND_PCM_READ_RATE\")"); |
429 | return -1; | 435 | return -1; |
430 | } | 436 | } |
431 | 437 | ||
432 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; //mute | 438 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; //mute |
433 | 439 | ||
434 | return 1; | 440 | return 1; |
435 | } | 441 | } |
436 | 442 | ||
437 | int VMemo::openWAV(const char *filename) { | 443 | int VMemo::openWAV(const char *filename) { |
438 | track.setName(filename); | 444 | track.setName(filename); |
439 | if(!track.open(IO_WriteOnly|IO_Truncate|IO_Raw)) { | 445 | if(!track.open(IO_WriteOnly|IO_Truncate|IO_Raw)) { |
440 | errorMsg=filename; | 446 | errorMsg=filename; |
441 | return -1; | 447 | return -1; |
442 | } | 448 | } |
443 | 449 | ||
444 | wav=track.handle(); | 450 | wav=track.handle(); |
445 | Config vmCfg("Vmemo"); | 451 | Config vmCfg("Vmemo"); |
446 | vmCfg.setGroup("Defaults"); | 452 | vmCfg.setGroup("Defaults"); |
447 | useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0); | 453 | useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0); |
448 | 454 | ||
449 | WaveHeader wh; | 455 | WaveHeader wh; |
450 | 456 | ||
451 | wh.main_chunk = RIFF; | 457 | wh.main_chunk = RIFF; |
452 | wh.length=0; | 458 | wh.length=0; |
453 | wh.chunk_type = WAVE; | 459 | wh.chunk_type = WAVE; |
454 | wh.sub_chunk = FMT; | 460 | wh.sub_chunk = FMT; |
455 | wh.sc_len = 16; | 461 | wh.sc_len = 16; |
456 | if(useADPCM) | 462 | if(useADPCM) |
457 | wh.format = WAVE_FORMAT_DVI_ADPCM;//PCM_CODE; | 463 | wh.format = WAVE_FORMAT_DVI_ADPCM;//PCM_CODE; |
458 | else | 464 | else |
459 | wh.format = PCM_CODE; | 465 | wh.format = PCM_CODE; |
460 | wh.modus = channels; | 466 | wh.modus = channels; |
461 | wh.sample_fq = speed; | 467 | wh.sample_fq = speed; |
462 | wh.byte_p_sec = speed * channels * resolution/8; | 468 | wh.byte_p_sec = speed * channels * resolution/8; |
463 | wh.byte_p_spl = channels * (resolution / 8); | 469 | wh.byte_p_spl = channels * (resolution / 8); |
464 | wh.bit_p_spl = resolution; | 470 | wh.bit_p_spl = resolution; |
465 | wh.data_chunk = DATA; | 471 | wh.data_chunk = DATA; |
466 | wh.data_length= 0; | 472 | wh.data_length= 0; |
467 | // qDebug("Write header channels %d, speed %d, b/s %d, blockalign %d, bitrate %d" | 473 | // qDebug("Write header channels %d, speed %d, b/s %d, blockalign %d, bitrate %d" |
468 | // , wh.modus, wh.sample_fq, wh.byte_p_sec, wh.byte_p_spl, wh.bit_p_spl ); | 474 | // , wh.modus, wh.sample_fq, wh.byte_p_sec, wh.byte_p_spl, wh.bit_p_spl ); |
469 | write (wav, &wh, sizeof(WaveHeader)); | 475 | write (wav, &wh, sizeof(WaveHeader)); |
470 | 476 | ||
471 | return 1; | 477 | return 1; |
472 | } | 478 | } |
473 | 479 | ||
474 | bool VMemo::record() { | 480 | bool VMemo::record() { |
475 | length=0; | 481 | length=0; |
476 | int result, value; | 482 | int result, value; |
477 | QString msg; | 483 | QString msg; |
478 | msg.sprintf("Recording format %d", format); | 484 | msg.sprintf("Recording format %d", format); |
479 | qDebug(msg); | 485 | qDebug(msg); |
480 | Config config("Vmemo"); | 486 | Config config("Vmemo"); |
481 | config.setGroup("Record"); | 487 | config.setGroup("Record"); |
482 | int sRate=config.readNumEntry("SizeLimit", 30); | 488 | int sRate=config.readNumEntry("SizeLimit", 30); |
483 | if(sRate > 0) | 489 | if(sRate > 0) |
484 | t_timer->start( sRate * 1000+1000, TRUE); | 490 | t_timer->start( sRate * 1000+1000, TRUE); |
485 | 491 | ||
486 | // if(systemZaurus) { | 492 | // if(systemZaurus) { |
487 | // } else { // 16 bit only capabilities | 493 | // } else { // 16 bit only capabilities |
488 | 494 | ||
489 | msg.sprintf("Recording format other"); | 495 | msg.sprintf("Recording format other"); |
490 | qDebug(msg); | 496 | qDebug(msg); |
491 | 497 | ||
492 | int bufsize=1024; | 498 | int bufsize=1024; |
493 | int bytesWritten=0; | 499 | int bytesWritten=0; |
494 | signed short sound[1024], monoBuffer[1024]; | 500 | signed short sound[1024], monoBuffer[1024]; |
495 | char abuf[bufsize/2]; | 501 | char abuf[bufsize/2]; |
496 | short sbuf[bufsize]; | 502 | short sbuf[bufsize]; |
497 | Config vmCfg("Vmemo"); | 503 | Config vmCfg("Vmemo"); |
498 | vmCfg.setGroup("Defaults"); | 504 | vmCfg.setGroup("Defaults"); |
499 | useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0); | 505 | useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0); |
500 | 506 | ||
501 | while(recording) { | 507 | while(recording) { |
502 | 508 | ||
503 | if(useADPCM) | 509 | if(useADPCM) |
504 | result = read( dsp, sbuf, bufsize); // 8192 | 510 | result = read( dsp, sbuf, bufsize); // 8192 |
505 | else | 511 | else |
506 | result = read(dsp, sound, 1024); // 8192 | 512 | result = read(dsp, sound, 1024); // 8192 |
507 | if( result <= 0) { | 513 | if( result <= 0) { |
508 | perror("recording error "); | 514 | perror("recording error "); |
509 | // qDebug(currentFileName); | 515 | // qDebug(currentFileName); |
510 | QMessageBox::message(tr("Note"),tr("error recording")); | 516 | QMessageBox::message(tr("Note"),tr("error recording")); |
511 | recording=FALSE; | 517 | recording=FALSE; |
512 | break; | 518 | break; |
513 | return FALSE; | 519 | return FALSE; |
514 | } | 520 | } |
515 | 521 | ||
516 | if(useADPCM) { | 522 | if(useADPCM) { |
517 | adpcm_coder( sbuf, abuf, result/2, &encoder_state); | 523 | adpcm_coder( sbuf, abuf, result/2, &encoder_state); |
518 | bytesWritten = ::write(wav, abuf, result/4); | 524 | bytesWritten = ::write(wav, abuf, result/4); |
519 | 525 | ||
520 | } else { | 526 | } else { |
521 | for (int i = 0; i < result; i++) { //since Z is mono do normally | 527 | for (int i = 0; i < result; i++) { //since Z is mono do normally |
522 | monoBuffer[i] = sound[i]; | 528 | monoBuffer[i] = sound[i]; |
523 | } | 529 | } |
524 | 530 | ||
525 | length+=write(wav, monoBuffer, result); | 531 | length+=write(wav, monoBuffer, result); |
526 | } | 532 | } |
527 | length +=bytesWritten; | 533 | length +=bytesWritten; |
528 | 534 | ||
529 | if(length<0) { | 535 | if(length<0) { |
530 | recording=false; | 536 | recording=false; |
531 | perror("dev/dsp's is a lookin' messy"); | 537 | perror("dev/dsp's is a lookin' messy"); |
532 | QMessageBox::message("Vmemo","Error writing to file\n"+ fileName); | 538 | QMessageBox::message("Vmemo","Error writing to file\n"+ fileName); |
533 | break; | 539 | break; |
534 | return FALSE; | 540 | return FALSE; |
535 | } | 541 | } |
536 | // printf("%d\r",length); | 542 | // printf("%d\r",length); |
537 | // fflush(stdout); | 543 | // fflush(stdout); |
538 | qApp->processEvents(); | 544 | qApp->processEvents(); |
539 | } | 545 | } |
540 | // qDebug("file has length of %d lasting %d seconds", | 546 | // qDebug("file has length of %d lasting %d seconds", |
541 | // length, (( length / speed) / channels) / 2 ); | 547 | // length, (( length / speed) / channels) / 2 ); |
542 | // } | 548 | // } |
543 | 549 | ||
544 | //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<// | 550 | //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<// |
545 | 551 | ||
546 | value = length+36; | 552 | value = length+36; |
547 | 553 | ||
548 | lseek(wav, 4, SEEK_SET); | 554 | lseek(wav, 4, SEEK_SET); |
549 | write(wav, &value, 4); | 555 | write(wav, &value, 4); |
550 | lseek(wav, 40, SEEK_SET); | 556 | lseek(wav, 40, SEEK_SET); |
551 | 557 | ||
552 | write(wav, &length, 4); | 558 | write(wav, &length, 4); |
553 | 559 | ||
554 | track.close(); | 560 | track.close(); |
555 | qDebug("Track closed"); | 561 | qDebug("Track closed"); |
556 | 562 | ||
557 | if( ioctl( dsp, SNDCTL_DSP_RESET,0) == -1) | 563 | if( ioctl( dsp, SNDCTL_DSP_RESET,0) == -1) |
558 | perror("ioctl(\"SNDCTL_DSP_RESET\")"); | 564 | perror("ioctl(\"SNDCTL_DSP_RESET\")"); |
559 | 565 | ||
560 | ::close(dsp); | 566 | ::close(dsp); |
561 | 567 | ||
562 | Config cfgO("OpieRec"); | 568 | Config cfgO("OpieRec"); |
563 | cfgO.setGroup("Sounds"); | 569 | cfgO.setGroup("Sounds"); |
564 | 570 | ||
565 | int nFiles = cfgO.readNumEntry( "NumberofFiles",0); | 571 | int nFiles = cfgO.readNumEntry( "NumberofFiles",0); |
566 | 572 | ||
567 | QString currentFileName = fileName; | 573 | QString currentFileName = fileName; |
568 | QString currentFile = "vm_"+ date; | 574 | QString currentFile = "vm_"+ date; |
569 | 575 | ||
570 | float numberOfRecordedSeconds=(float) length / (float)speed * (float)2; | 576 | float numberOfRecordedSeconds=(float) length / (float)speed * (float)2; |
571 | 577 | ||
572 | cfgO.writeEntry( "NumberofFiles", nFiles + 1); | 578 | cfgO.writeEntry( "NumberofFiles", nFiles + 1); |
573 | cfgO.writeEntry( QString::number( nFiles + 1), currentFile); | 579 | cfgO.writeEntry( QString::number( nFiles + 1), currentFile); |
574 | cfgO.writeEntry( currentFile, currentFileName); | 580 | cfgO.writeEntry( currentFile, currentFileName); |
575 | 581 | ||
576 | QString time; | 582 | QString time; |
577 | time.sprintf("%.2f", numberOfRecordedSeconds); | 583 | time.sprintf("%.2f", numberOfRecordedSeconds); |
578 | cfgO.writeEntry( currentFileName, time ); | 584 | cfgO.writeEntry( currentFileName, time ); |
579 | // qDebug("writing config numberOfRecordedSeconds "+time); | 585 | // qDebug("writing config numberOfRecordedSeconds "+time); |
580 | 586 | ||
581 | cfgO.write(); | 587 | cfgO.write(); |
582 | 588 | ||
583 | qDebug("done recording "+fileName); | 589 | qDebug("done recording "+fileName); |
584 | 590 | ||
585 | Config cfg("qpe"); | 591 | Config cfg("qpe"); |
586 | cfg.setGroup("Volume"); | 592 | cfg.setGroup("Volume"); |
587 | QString foo = cfg.readEntry("Mute","TRUE"); | 593 | QString foo = cfg.readEntry("Mute","TRUE"); |
588 | if(foo.find("TRUE",0,TRUE) != -1) | 594 | if(foo.find("TRUE",0,TRUE) != -1) |
589 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; //mute | 595 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; //mute |
590 | return TRUE; | 596 | return TRUE; |
591 | } | 597 | } |
592 | 598 | ||
593 | int VMemo::setToggleButton(int tog) { | 599 | int VMemo::setToggleButton(int tog) { |
594 | 600 | ||
595 | for( int i=0; i < 10;i++) { | 601 | for( int i=0; i < 10;i++) { |
596 | switch (tog) { | 602 | switch (tog) { |
597 | case 0: | 603 | case 0: |
598 | return -1; | 604 | return -1; |
599 | break; | 605 | break; |
600 | case 1: | 606 | case 1: |
601 | return 0; | 607 | return 0; |
602 | break; | 608 | break; |
603 | case 2: | 609 | case 2: |
604 | return Key_F24; //was Escape | 610 | return Key_F24; //was Escape |
605 | break; | 611 | break; |
606 | case 3: | 612 | case 3: |
607 | return Key_Space; | 613 | return Key_Space; |
608 | break; | 614 | break; |
609 | case 4: | 615 | case 4: |
610 | return Key_F12; | 616 | return Key_F12; |
611 | break; | 617 | break; |
612 | case 5: | 618 | case 5: |
613 | return Key_F9; | 619 | return Key_F9; |
614 | break; | 620 | break; |
615 | case 6: | 621 | case 6: |
616 | return Key_F10; | 622 | return Key_F10; |
617 | break; | 623 | break; |
618 | case 7: | 624 | case 7: |
619 | return Key_F11; | 625 | return Key_F11; |
620 | break; | 626 | break; |
621 | case 8: | 627 | case 8: |
622 | return Key_F13; | 628 | return Key_F13; |
623 | break; | 629 | break; |
624 | }; | 630 | }; |
625 | } | 631 | } |
626 | return -1; | 632 | return -1; |
627 | } | 633 | } |
628 | 634 | ||
629 | void VMemo::timerBreak() { | 635 | void VMemo::timerBreak() { |
630 | //stop | 636 | //stop |
631 | stopRecording(); | 637 | stopRecording(); |
632 | QMessageBox::message("Vmemo","Vmemo recording has ended"); | 638 | QMessageBox::message("Vmemo","Vmemo recording has ended"); |
633 | } | 639 | } |
640 | |||
641 | Q_EXPORT_INTERFACE() | ||
642 | { | ||
643 | Q_CREATE_INSTANCE( OTaskbarAppletWrapper<VMemo> ); | ||
644 | } | ||
645 | |||
diff --git a/core/applets/vmemo/vmemo.h b/core/applets/vmemo/vmemo.h index 31d0a25..1bd735f 100644 --- a/core/applets/vmemo/vmemo.h +++ b/core/applets/vmemo/vmemo.h | |||
@@ -1,64 +1,65 @@ | |||
1 | /**************************************************************************************94x78** | 1 | /**************************************************************************************94x78** |
2 | ** | 2 | ** |
3 | ** This file may be distributed and/or modified under the terms of the | 3 | ** This file may be distributed and/or modified under the terms of the |
4 | ** GNU General Public License version 2 as published by the Free Software | 4 | ** GNU General Public License version 2 as published by the Free Software |
5 | ** Foundation and appearing in the file LICENSE.GPL included in the | 5 | ** Foundation and appearing in the file LICENSE.GPL included in the |
6 | ** packaging of this file. | 6 | ** packaging of this file. |
7 | ** | 7 | ** |
8 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 8 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
10 | ** | 10 | ** |
11 | *********************************************************************************************/ | 11 | *********************************************************************************************/ |
12 | 12 | ||
13 | /* | 13 | /* |
14 | * $Id$ | 14 | * $Id$ |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #ifndef __VMEMO_H__ | 17 | #ifndef __VMEMO_H__ |
18 | #define __VMEMO_H__ | 18 | #define __VMEMO_H__ |
19 | 19 | ||
20 | 20 | ||
21 | #include <qwidget.h> | 21 | #include <qwidget.h> |
22 | #include <qpixmap.h> | 22 | #include <qpixmap.h> |
23 | #include <qpe/applnk.h> | 23 | #include <qpe/applnk.h> |
24 | #include <qfile.h> | 24 | #include <qfile.h> |
25 | #include <qpe/qcopenvelope_qws.h> | 25 | #include <qpe/qcopenvelope_qws.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qtimer.h> | 27 | #include <qtimer.h> |
28 | 28 | ||
29 | class VMemo : public QWidget | 29 | class VMemo : public QWidget |
30 | { | 30 | { |
31 | Q_OBJECT | 31 | Q_OBJECT |
32 | public: | 32 | public: |
33 | VMemo( QWidget *parent, const char *name = NULL); | 33 | VMemo( QWidget *parent, const char *name = NULL); |
34 | ~VMemo(); | 34 | ~VMemo(); |
35 | static int position(); | ||
35 | QFile track; | 36 | QFile track; |
36 | int length; | 37 | int length; |
37 | QString fileName, errorMsg, date; | 38 | QString fileName, errorMsg, date; |
38 | QLabel* msgLabel; | 39 | QLabel* msgLabel; |
39 | QTimer *t_timer; | 40 | QTimer *t_timer; |
40 | bool usingIcon, useADPCM; | 41 | bool usingIcon, useADPCM; |
41 | public slots: | 42 | public slots: |
42 | bool record(); | 43 | bool record(); |
43 | void mousePressEvent( QMouseEvent * ); | 44 | void mousePressEvent( QMouseEvent * ); |
44 | void mouseReleaseEvent( QMouseEvent * ); | 45 | void mouseReleaseEvent( QMouseEvent * ); |
45 | void receive( const QCString &msg, const QByteArray &data ); | 46 | void receive( const QCString &msg, const QByteArray &data ); |
46 | bool startRecording(); | 47 | bool startRecording(); |
47 | void stopRecording(); | 48 | void stopRecording(); |
48 | void timerBreak(); | 49 | void timerBreak(); |
49 | private: | 50 | private: |
50 | bool useAlerts; | 51 | bool useAlerts; |
51 | void paintEvent( QPaintEvent* ); | 52 | void paintEvent( QPaintEvent* ); |
52 | int setToggleButton(int); | 53 | int setToggleButton(int); |
53 | int openDSP(); | 54 | int openDSP(); |
54 | int openWAV(const char *filename); | 55 | int openWAV(const char *filename); |
55 | bool fromToggle; | 56 | bool fromToggle; |
56 | QPixmap vmemoPixmap; | 57 | QPixmap vmemoPixmap; |
57 | QCopChannel *myChannel; | 58 | QCopChannel *myChannel; |
58 | bool systemZaurus; | 59 | bool systemZaurus; |
59 | int dsp, wav, rate, speed, channels, format, resolution; | 60 | int dsp, wav, rate, speed, channels, format, resolution; |
60 | bool recording; | 61 | bool recording; |
61 | }; | 62 | }; |
62 | 63 | ||
63 | #endif // __VMEMO_H__ | 64 | #endif // __VMEMO_H__ |
64 | 65 | ||
diff --git a/core/applets/vmemo/vmemo.pro b/core/applets/vmemo/vmemo.pro index f83a53f..2deedfd 100644 --- a/core/applets/vmemo/vmemo.pro +++ b/core/applets/vmemo/vmemo.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 = vmemo.h vmemoimpl.h adpcm.h | 3 | HEADERS = vmemo.h adpcm.h |
4 | SOURCES = vmemo.cpp vmemoimpl.cpp adpcm.c | 4 | SOURCES = vmemo.cpp adpcm.c |
5 | TARGET = vmemoapplet | 5 | TARGET = vmemoapplet |
6 | DESTDIR =$(OPIEDIR)/plugins/applets | 6 | DESTDIR =$(OPIEDIR)/plugins/applets |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += $(OPIEDIR)/include | 8 | DEPENDPATH += $(OPIEDIR)/include |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe |
10 | VERSION = 1.0.0 | 10 | VERSION = 1.0.0 |
11 | 11 | ||
12 | include ( $(OPIEDIR)/include.pro ) | 12 | include ( $(OPIEDIR)/include.pro ) |
13 | target.path = $$prefix/plugins/applets | 13 | target.path = $$prefix/plugins/applets |
diff --git a/core/applets/vmemo/vmemoimpl.cpp b/core/applets/vmemo/vmemoimpl.cpp deleted file mode 100644 index 7779b83..0000000 --- a/core/applets/vmemo/vmemoimpl.cpp +++ b/dev/null | |||
@@ -1,61 +0,0 @@ | |||
1 | /**************************************************************************************94x78** | ||
2 | ** | ||
3 | ** This file may be distributed and/or modified under the terms of the | ||
4 | ** GNU General Public License version 2 as published by the Free Software | ||
5 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
6 | ** packaging of this file. | ||
7 | ** | ||
8 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
10 | ** | ||
11 | *********************************************************************************************/ | ||
12 | |||
13 | /* | ||
14 | * $Id$ | ||
15 | */ | ||
16 | |||
17 | #include "vmemo.h" | ||
18 | #include "vmemoimpl.h" | ||
19 | |||
20 | |||
21 | VMemoAppletImpl::VMemoAppletImpl() | ||
22 | : vmemo(0) | ||
23 | { | ||
24 | } | ||
25 | |||
26 | VMemoAppletImpl::~VMemoAppletImpl() | ||
27 | { | ||
28 | delete vmemo; | ||
29 | } | ||
30 | |||
31 | QWidget *VMemoAppletImpl::applet( QWidget *parent ) | ||
32 | { | ||
33 | if ( !vmemo ) | ||
34 | vmemo = new VMemo( parent ); | ||
35 | return vmemo; | ||
36 | } | ||
37 | |||
38 | int VMemoAppletImpl::position() const | ||
39 | { | ||
40 | return 6; | ||
41 | } | ||
42 | |||
43 | QRESULT VMemoAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | ||
44 | { | ||
45 | *iface = 0; | ||
46 | if ( uuid == IID_QUnknown ) | ||
47 | *iface = this; | ||
48 | else if ( uuid == IID_TaskbarApplet ) | ||
49 | *iface = this; | ||
50 | else | ||
51 | return QS_FALSE; | ||
52 | |||
53 | if ( *iface ) | ||
54 | (*iface)->addRef(); | ||
55 | return QS_OK; | ||
56 | } | ||
57 | |||
58 | Q_EXPORT_INTERFACE() | ||
59 | { | ||
60 | Q_CREATE_INSTANCE( VMemoAppletImpl ) | ||
61 | } | ||
diff --git a/core/applets/vmemo/vmemoimpl.h b/core/applets/vmemo/vmemoimpl.h deleted file mode 100644 index 985138b..0000000 --- a/core/applets/vmemo/vmemoimpl.h +++ b/dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | /**************************************************************************************94x78** | ||
2 | ** | ||
3 | ** This file may be distributed and/or modified under the terms of the | ||
4 | ** GNU General Public License version 2 as published by the Free Software | ||
5 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
6 | ** packaging of this file. | ||
7 | ** | ||
8 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
10 | ** | ||
11 | *********************************************************************************************/ | ||
12 | |||
13 | /* | ||
14 | * $Id$ | ||
15 | */ | ||
16 | |||
17 | #ifndef __VMEMOIMPLAPPLETIMPL_H__ | ||
18 | #define __VMEMOIMPLAPPLETIMPL_H__ | ||
19 | |||
20 | #include <qpe/taskbarappletinterface.h> | ||
21 | |||
22 | class VMemo; | ||
23 | |||
24 | class VMemoAppletImpl : public TaskbarAppletInterface | ||
25 | { | ||
26 | public: | ||
27 | VMemoAppletImpl(); | ||
28 | virtual ~VMemoAppletImpl(); | ||
29 | |||
30 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | ||
31 | Q_REFCOUNT | ||
32 | |||
33 | virtual QWidget *applet( QWidget *parent ); | ||
34 | virtual int position() const; | ||
35 | |||
36 | private: | ||
37 | VMemo *vmemo; | ||
38 | }; | ||
39 | |||
40 | #endif | ||
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 | |||
@@ -1,779 +1,783 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
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 <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 | ||
46 | using namespace Opie; | 42 | using 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 */ |
54 | static const char * vol_xpm[] = { | 50 | static const char * vol_xpm[] = { |
55 | "20 20 3 1", | 51 | "20 20 3 1", |
56 | " c None", | 52 | " c None", |
57 | ". c #0000FF", | 53 | ". c #0000FF", |
58 | "+ c #000000", | 54 | "+ c #000000", |
59 | " ", | 55 | " ", |
60 | " . ", | 56 | " . ", |
61 | " . . . . ", | 57 | " . . . . ", |
62 | " . . . . . . ", | 58 | " . . . . . . ", |
63 | " . . . . . . . ", | 59 | " . . . . . . . ", |
64 | " . . ..... . . ", | 60 | " . . ..... . . ", |
65 | " . ... ..... ... ", | 61 | " . ... ..... ... ", |
66 | " ........... .... ", | 62 | " ........... .... ", |
67 | " ................. ", | 63 | " ................. ", |
68 | "++++++++++++++++++++", | 64 | "++++++++++++++++++++", |
69 | " .................. ", | 65 | " .................. ", |
70 | " . ............. . ", | 66 | " . ............. . ", |
71 | " . ..... ....... ", | 67 | " . ..... ....... ", |
72 | " . ... ..... . ", | 68 | " . ... ..... . ", |
73 | " . ... ..... . ", | 69 | " . ... ..... . ", |
74 | " . ... ..... ", | 70 | " . ... ..... ", |
75 | " . . . . . ", | 71 | " . . . . . ", |
76 | " . . . ", | 72 | " . . . ", |
77 | " . . . ", | 73 | " . . . ", |
78 | " "}; | 74 | " "}; |
79 | /* XPM */ | 75 | /* XPM */ |
80 | static const char * mic_xpm[] = { | 76 | static const char * mic_xpm[] = { |
81 | "20 20 21 1", | 77 | "20 20 21 1", |
82 | " c None", | 78 | " c None", |
83 | ". c #000000", | 79 | ". c #000000", |
84 | "+ c #EEEEEE", | 80 | "+ c #EEEEEE", |
85 | "@ c #B4B6B4", | 81 | "@ c #B4B6B4", |
86 | "# c #8B8D8B", | 82 | "# c #8B8D8B", |
87 | "$ c #D5D6D5", | 83 | "$ c #D5D6D5", |
88 | "% c #E6E6E6", | 84 | "% c #E6E6E6", |
89 | "& c #9C9D9C", | 85 | "& c #9C9D9C", |
90 | "* c #6A696A", | 86 | "* c #6A696A", |
91 | "= c #E6E2E6", | 87 | "= c #E6E2E6", |
92 | "- c #F6F2F6", | 88 | "- c #F6F2F6", |
93 | "; c #CDC6CD", | 89 | "; c #CDC6CD", |
94 | "> c #737573", | 90 | "> c #737573", |
95 | ", c #4A484A", | 91 | ", c #4A484A", |
96 | "' c #DEDEDE", | 92 | "' c #DEDEDE", |
97 | ") c #F6EEF6", | 93 | ") c #F6EEF6", |
98 | "! c #414041", | 94 | "! c #414041", |
99 | "~ c #202020", | 95 | "~ c #202020", |
100 | "{ c #ACAEAC", | 96 | "{ c #ACAEAC", |
101 | "] c #838583", | 97 | "] c #838583", |
102 | "^ c #6A656A", | 98 | "^ c #6A656A", |
103 | " ", | 99 | " ", |
104 | " .... ", | 100 | " .... ", |
105 | " .+@+#. ", | 101 | " .+@+#. ", |
106 | " ..$%&%*. ", | 102 | " ..$%&%*. ", |
107 | " .=-.;=>=,. ", | 103 | " .=-.;=>=,. ", |
108 | " .'+).&+!+. ", | 104 | " .'+).&+!+. ", |
109 | " .+;+;.~+~. ", | 105 | " .+;+;.~+~. ", |
110 | " ..%{%,.... ", | 106 | " ..%{%,.... ", |
111 | " ..&=>=~.. ", | 107 | " ..&=>=~.. ", |
112 | " .+..]^,.. ", | 108 | " .+..]^,.. ", |
113 | " .+....... ", | 109 | " .+....... ", |
114 | " .%... ", | 110 | " .%... ", |
115 | " .=... ", | 111 | " .=... ", |
116 | " .+... ", | 112 | " .+... ", |
117 | " .+... ", | 113 | " .+... ", |
118 | " .... ", | 114 | " .... ", |
119 | " .... ", | 115 | " .... ", |
120 | " .. ", | 116 | " .. ", |
121 | " . ", | 117 | " . ", |
122 | ". "}; | 118 | ". "}; |
123 | 119 | ||
124 | 120 | ||
125 | static const char * bass_xpm[] = { | 121 | static const char * bass_xpm[] = { |
126 | "20 20 3 1", | 122 | "20 20 3 1", |
127 | " c None", | 123 | " c None", |
128 | ". c #000000", | 124 | ". c #000000", |
129 | "+ c #0000FF", | 125 | "+ c #0000FF", |
130 | " ", | 126 | " ", |
131 | " ", | 127 | " ", |
132 | " ", | 128 | " ", |
133 | "..... +++ ......", | 129 | "..... +++ ......", |
134 | " +++++++ ", | 130 | " +++++++ ", |
135 | " ++ ++ ", | 131 | " ++ ++ ", |
136 | "... ++ ... ++ ++ .", | 132 | "... ++ ... ++ ++ .", |
137 | " +++ ++ ++ ", | 133 | " +++ ++ ++ ", |
138 | " ++++ ++ ", | 134 | " ++++ ++ ", |
139 | "... ++++ .. ++ .....", | 135 | "... ++++ .. ++ .....", |
140 | " ++ ++ ", | 136 | " ++ ++ ", |
141 | " ++ ++ ", | 137 | " ++ ++ ", |
142 | "..........++ ++ .", | 138 | "..........++ ++ .", |
143 | " ++ ", | 139 | " ++ ", |
144 | " ++ ", | 140 | " ++ ", |
145 | "...... ++ .........", | 141 | "...... ++ .........", |
146 | " + ", | 142 | " + ", |
147 | " ", | 143 | " ", |
148 | " ", | 144 | " ", |
149 | " "}; | 145 | " "}; |
150 | 146 | ||
151 | 147 | ||
152 | static const char * treble_xpm[] = { | 148 | static const char * treble_xpm[] = { |
153 | "20 20 3 1", | 149 | "20 20 3 1", |
154 | " c None", | 150 | " c None", |
155 | ". c #0000FF", | 151 | ". c #0000FF", |
156 | "+ c #000000", | 152 | "+ c #000000", |
157 | " .. ", | 153 | " .. ", |
158 | " . .. ", | 154 | " . .. ", |
159 | " . .. ", | 155 | " . .. ", |
160 | "++++++++ . .. ++++++", | 156 | "++++++++ . .. ++++++", |
161 | " . . ", | 157 | " . . ", |
162 | " ... ", | 158 | " ... ", |
163 | "++++++++ . +++++++", | 159 | "++++++++ . +++++++", |
164 | " .. ", | 160 | " .. ", |
165 | " .. . ", | 161 | " .. . ", |
166 | "+++ .. ... +++++++", | 162 | "+++ .. ... +++++++", |
167 | " .. .. .. ", | 163 | " .. .. .. ", |
168 | " .. . . .. ", | 164 | " .. . . .. ", |
169 | "+++ .. . . + . +++++", | 165 | "+++ .. . . + . +++++", |
170 | " .. . .. ", | 166 | " .. . .. ", |
171 | " .. . .. ", | 167 | " .. . .. ", |
172 | "++++ ...... +++++++", | 168 | "++++ ...... +++++++", |
173 | " . ", | 169 | " . ", |
174 | " .. . ", | 170 | " .. . ", |
175 | " .. . ", | 171 | " .. . ", |
176 | " .. "}; | 172 | " .. "}; |
177 | 173 | ||
178 | 174 | ||
179 | 175 | ||
180 | 176 | ||
181 | /* XPM */ | 177 | /* XPM */ |
182 | static const char * alarm_xpm[] = { | 178 | static const char * alarm_xpm[] = { |
183 | "20 20 33 1", | 179 | "20 20 33 1", |
184 | " c None", | 180 | " c None", |
185 | ". c #080602", | 181 | ". c #080602", |
186 | "+ c #AAA602", | 182 | "+ c #AAA602", |
187 | "@ c #252002", | 183 | "@ c #252002", |
188 | "# c #434202", | 184 | "# c #434202", |
189 | "$ c #795602", | 185 | "$ c #795602", |
190 | "% c #C3C20D", | 186 | "% c #C3C20D", |
191 | "& c #DADAC2", | 187 | "& c #DADAC2", |
192 | "* c #826002", | 188 | "* c #826002", |
193 | "= c #740502", | 189 | "= c #740502", |
194 | "- c #D6D602", | 190 | "- c #D6D602", |
195 | "; c #322E02", | 191 | "; c #322E02", |
196 | "> c #826A02", | 192 | "> c #826A02", |
197 | ", c #F1F195", | 193 | ", c #F1F195", |
198 | "' c #959215", | 194 | "' c #959215", |
199 | ") c #423602", | 195 | ") c #423602", |
200 | "! c #4B0302", | 196 | "! c #4B0302", |
201 | "~ c #844315", | 197 | "~ c #844315", |
202 | "{ c #AAAA2A", | 198 | "{ c #AAAA2A", |
203 | "] c #E2DE42", | 199 | "] c #E2DE42", |
204 | "^ c #BA7E04", | 200 | "^ c #BA7E04", |
205 | "/ c #7F7502", | 201 | "/ c #7F7502", |
206 | "( c #828276", | 202 | "( c #828276", |
207 | "_ c #FEFE4E", | 203 | "_ c #FEFE4E", |
208 | ": c #7D1902", | 204 | ": c #7D1902", |
209 | "< c #989656", | 205 | "< c #989656", |
210 | "[ c #260B02", | 206 | "[ c #260B02", |
211 | "} c #F7F7D8", | 207 | "} c #F7F7D8", |
212 | "| c #DCDA5A", | 208 | "| c #DCDA5A", |
213 | "1 c #823102", | 209 | "1 c #823102", |
214 | "2 c #B1AC6B", | 210 | "2 c #B1AC6B", |
215 | "3 c #F7F710", | 211 | "3 c #F7F710", |
216 | "4 c #838204", | 212 | "4 c #838204", |
217 | " ", | 213 | " ", |
218 | " ", | 214 | " ", |
219 | " 4'4/ ", | 215 | " 4'4/ ", |
220 | " /-^= ", | 216 | " /-^= ", |
221 | " 42{4>4 ", | 217 | " 42{4>4 ", |
222 | " '2|+*$44 ", | 218 | " '2|+*$44 ", |
223 | " +2&3+$1*44 ", | 219 | " +2&3+$1*44 ", |
224 | " (%_}_+/$:>/4 ", | 220 | " (%_}_+/$:>/4 ", |
225 | " 4%_}3+#;>:*4 ", | 221 | " 4%_}3+#;>:*4 ", |
226 | " 4%_}&+#[1$/4 ", | 222 | " 4%_}&+#[1$/4 ", |
227 | " 4%_,2')[~~>4 ", | 223 | " 4%_,2')[~~>4 ", |
228 | " 4%33'4#@~1>4 ", | 224 | " 4%33'4#@~1>4 ", |
229 | " 4%3344#[:>/4 ", | 225 | " 4%3344#[:>/4 ", |
230 | " 42&_3'4#@>:*44 ", | 226 | " 42&_3'4#@>:*44 ", |
231 | " 42|}}3'4#[;$)$44 ", | 227 | " 42|}}3'4#[;$)$44 ", |
232 | "444{]]2^~~:!!#.@##/ ", | 228 | "444{]]2^~~:!!#.@##/ ", |
233 | "4444-%*:==!!=...../ ", | 229 | "4444-%*:==!!=...../ ", |
234 | " /:[.. ", | 230 | " /:[.. ", |
235 | " /@. ", | 231 | " /@. ", |
236 | " "}; | 232 | " "}; |
237 | 233 | ||
238 | VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *parent, const char *name ) | 234 | VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *parent, const char *name ) |
239 | : QFrame ( parent, name, WStyle_StaysOnTop | WType_Popup ) | 235 | : QFrame ( parent, name, WStyle_StaysOnTop | WType_Popup ) |
240 | { | 236 | { |
241 | m_icon = icon; | 237 | m_icon = icon; |
242 | 238 | ||
243 | bool has_wav_alarm = true; | 239 | bool has_wav_alarm = true; |
244 | bool has_bass = true; | 240 | bool has_bass = true; |
245 | bool has_treble = true; | 241 | bool has_treble = true; |
246 | 242 | ||
247 | switch ( ODevice::inst ( )-> model ( )) { // we need to add other devices eventually | 243 | switch ( ODevice::inst ( )-> model ( )) { // we need to add other devices eventually |
248 | case Model_Zaurus_SL5000: | 244 | case Model_Zaurus_SL5000: |
249 | has_wav_alarm = false; //poor guys probably feeling left out... | 245 | has_wav_alarm = false; //poor guys probably feeling left out... |
250 | break; | 246 | break; |
251 | default: | 247 | default: |
252 | break; | 248 | break; |
253 | } | 249 | } |
254 | 250 | ||
255 | if ( !ODevice::inst ( )-> series ( ) == Model_iPAQ ) { | 251 | if ( !ODevice::inst ( )-> series ( ) == Model_iPAQ ) { |
256 | has_bass = false; | 252 | has_bass = false; |
257 | has_treble = false; | 253 | has_treble = false; |
258 | } | 254 | } |
259 | 255 | ||
260 | 256 | ||
261 | setFrameStyle ( QFrame::PopupPanel | QFrame::Raised ); | 257 | setFrameStyle ( QFrame::PopupPanel | QFrame::Raised ); |
262 | 258 | ||
263 | QGridLayout *grid = new QGridLayout ( this, 1, 1, 6, 4 ); | 259 | QGridLayout *grid = new QGridLayout ( this, 1, 1, 6, 4 ); |
264 | grid-> setSpacing ( 4 ); | 260 | grid-> setSpacing ( 4 ); |
265 | grid-> setMargin ( 6 ); | 261 | grid-> setMargin ( 6 ); |
266 | 262 | ||
267 | QVBoxLayout *vbox; | 263 | QVBoxLayout *vbox; |
268 | QLabel *l; | 264 | QLabel *l; |
269 | 265 | ||
270 | vbox = new QVBoxLayout ( ); | 266 | vbox = new QVBoxLayout ( ); |
271 | vbox-> setSpacing ( 4 ); | 267 | vbox-> setSpacing ( 4 ); |
272 | grid-> addLayout ( vbox, 1, 0 ); | 268 | grid-> addLayout ( vbox, 1, 0 ); |
273 | 269 | ||
274 | upButton = new QPushButton ( this ); | 270 | upButton = new QPushButton ( this ); |
275 | upButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding )); | 271 | upButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding )); |
276 | upButton-> setPixmap ( Resource::loadPixmap ( "up" )); | 272 | upButton-> setPixmap ( Resource::loadPixmap ( "up" )); |
277 | upButton-> setFocusPolicy ( QWidget::NoFocus ); | 273 | upButton-> setFocusPolicy ( QWidget::NoFocus ); |
278 | 274 | ||
279 | vbox-> addWidget ( upButton ); | 275 | vbox-> addWidget ( upButton ); |
280 | 276 | ||
281 | downButton = new QPushButton ( this ); | 277 | downButton = new QPushButton ( this ); |
282 | downButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding )); | 278 | downButton-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding )); |
283 | downButton-> setPixmap ( Resource::loadPixmap ( "down" )); | 279 | downButton-> setPixmap ( Resource::loadPixmap ( "down" )); |
284 | downButton-> setFocusPolicy ( QWidget::NoFocus ); | 280 | downButton-> setFocusPolicy ( QWidget::NoFocus ); |
285 | 281 | ||
286 | vbox-> addWidget ( downButton ); | 282 | vbox-> addWidget ( downButton ); |
287 | 283 | ||
288 | volSlider = new QSlider ( this ); | 284 | volSlider = new QSlider ( this ); |
289 | volSlider-> setRange ( 0, 100 ); | 285 | volSlider-> setRange ( 0, 100 ); |
290 | volSlider-> setTickmarks ( QSlider::Both ); | 286 | volSlider-> setTickmarks ( QSlider::Both ); |
291 | volSlider-> setTickInterval ( 20 ); | 287 | volSlider-> setTickInterval ( 20 ); |
292 | volSlider-> setFocusPolicy ( QWidget::NoFocus ); | 288 | volSlider-> setFocusPolicy ( QWidget::NoFocus ); |
293 | 289 | ||
294 | l = new QLabel ( this ); | 290 | l = new QLabel ( this ); |
295 | l-> setPixmap ( QPixmap ( vol_xpm )); | 291 | l-> setPixmap ( QPixmap ( vol_xpm )); |
296 | 292 | ||
297 | grid-> addWidget ( l, 0, 1, AlignCenter ); | 293 | grid-> addWidget ( l, 0, 1, AlignCenter ); |
298 | grid-> addWidget ( volSlider, 1, 1, AlignCenter ); | 294 | grid-> addWidget ( volSlider, 1, 1, AlignCenter ); |
299 | 295 | ||
300 | volLed = new OLedBox ( green, this ); | 296 | volLed = new OLedBox ( green, this ); |
301 | volLed-> setFocusPolicy ( QWidget::NoFocus ); | 297 | volLed-> setFocusPolicy ( QWidget::NoFocus ); |
302 | volLed-> setFixedSize ( 16, 16 ); | 298 | volLed-> setFixedSize ( 16, 16 ); |
303 | 299 | ||
304 | grid-> addWidget ( volLed, 2, 1, AlignCenter ); | 300 | grid-> addWidget ( volLed, 2, 1, AlignCenter ); |
305 | 301 | ||
306 | QVBox *basstrebleBox = new QVBox( this ); | 302 | QVBox *basstrebleBox = new QVBox( this ); |
307 | 303 | ||
308 | trebleSlider = new QSlider ( basstrebleBox ); | 304 | trebleSlider = new QSlider ( basstrebleBox ); |
309 | trebleSlider-> setRange ( 0, 100 ); | 305 | trebleSlider-> setRange ( 0, 100 ); |
310 | trebleSlider-> setTickmarks ( QSlider::Both ); | 306 | trebleSlider-> setTickmarks ( QSlider::Both ); |
311 | trebleSlider-> setTickInterval ( 20 ); | 307 | trebleSlider-> setTickInterval ( 20 ); |
312 | trebleSlider->setMaximumHeight( 40 ); | 308 | trebleSlider->setMaximumHeight( 40 ); |
313 | trebleSlider-> setFocusPolicy ( QWidget::NoFocus ); | 309 | trebleSlider-> setFocusPolicy ( QWidget::NoFocus ); |
314 | 310 | ||
315 | bassSlider = new QSlider ( basstrebleBox ); | 311 | bassSlider = new QSlider ( basstrebleBox ); |
316 | bassSlider-> setRange ( 0, 100 ); | 312 | bassSlider-> setRange ( 0, 100 ); |
317 | bassSlider-> setTickmarks ( QSlider::Both ); | 313 | bassSlider-> setTickmarks ( QSlider::Both ); |
318 | bassSlider-> setTickInterval ( 20 ); | 314 | bassSlider-> setTickInterval ( 20 ); |
319 | bassSlider->setMaximumHeight( 40 ); | 315 | bassSlider->setMaximumHeight( 40 ); |
320 | bassSlider-> setFocusPolicy ( QWidget::NoFocus ); | 316 | bassSlider-> setFocusPolicy ( QWidget::NoFocus ); |
321 | 317 | ||
322 | QLabel *bassLabel = new QLabel ( this ); | 318 | QLabel *bassLabel = new QLabel ( this ); |
323 | bassLabel-> setPixmap ( QPixmap ( bass_xpm )); | 319 | bassLabel-> setPixmap ( QPixmap ( bass_xpm )); |
324 | 320 | ||
325 | QLabel *trebleLabel = new QLabel( this ); | 321 | QLabel *trebleLabel = new QLabel( this ); |
326 | trebleLabel->setPixmap( QPixmap ( treble_xpm ) ); | 322 | trebleLabel->setPixmap( QPixmap ( treble_xpm ) ); |
327 | 323 | ||
328 | grid->addWidget( trebleLabel, 0, 4, AlignCenter ); | 324 | grid->addWidget( trebleLabel, 0, 4, AlignCenter ); |
329 | grid->addWidget( basstrebleBox, 1, 4, AlignCenter ); | 325 | grid->addWidget( basstrebleBox, 1, 4, AlignCenter ); |
330 | grid-> addWidget ( bassLabel, 2, 4, AlignCenter ); | 326 | grid-> addWidget ( bassLabel, 2, 4, AlignCenter ); |
331 | 327 | ||
332 | if ( !has_bass ) { | 328 | if ( !has_bass ) { |
333 | bassSlider->hide(); | 329 | bassSlider->hide(); |
334 | bassLabel->hide(); | 330 | bassLabel->hide(); |
335 | } | 331 | } |
336 | 332 | ||
337 | if ( !has_treble ) { | 333 | if ( !has_treble ) { |
338 | trebleSlider->hide(); | 334 | trebleSlider->hide(); |
339 | trebleLabel->hide(); | 335 | trebleLabel->hide(); |
340 | } | 336 | } |
341 | 337 | ||
342 | micSlider = new QSlider ( this ); | 338 | micSlider = new QSlider ( this ); |
343 | micSlider-> setRange ( 0, 100 ); | 339 | micSlider-> setRange ( 0, 100 ); |
344 | micSlider-> setTickmarks ( QSlider::Both ); | 340 | micSlider-> setTickmarks ( QSlider::Both ); |
345 | micSlider-> setTickInterval ( 20 ); | 341 | micSlider-> setTickInterval ( 20 ); |
346 | micSlider-> setFocusPolicy ( QWidget::NoFocus ); | 342 | micSlider-> setFocusPolicy ( QWidget::NoFocus ); |
347 | 343 | ||
348 | l = new QLabel ( this ); | 344 | l = new QLabel ( this ); |
349 | l-> setPixmap ( QPixmap ( mic_xpm )); | 345 | l-> setPixmap ( QPixmap ( mic_xpm )); |
350 | 346 | ||
351 | grid-> addWidget ( l, 0, 2, AlignCenter ); | 347 | grid-> addWidget ( l, 0, 2, AlignCenter ); |
352 | grid-> addWidget ( micSlider, 1, 2, AlignCenter ); | 348 | grid-> addWidget ( micSlider, 1, 2, AlignCenter ); |
353 | 349 | ||
354 | micLed = new OLedBox ( red, this ); | 350 | micLed = new OLedBox ( red, this ); |
355 | micLed-> setFocusPolicy ( QWidget::NoFocus ); | 351 | micLed-> setFocusPolicy ( QWidget::NoFocus ); |
356 | micLed-> setFixedSize ( 16, 16 ); | 352 | micLed-> setFixedSize ( 16, 16 ); |
357 | 353 | ||
358 | grid-> addWidget ( micLed, 2, 2, AlignCenter ); | 354 | grid-> addWidget ( micLed, 2, 2, AlignCenter ); |
359 | 355 | ||
360 | alarmSlider = new QSlider ( this ); | 356 | alarmSlider = new QSlider ( this ); |
361 | alarmSlider-> setRange ( 0, 100 ); | 357 | alarmSlider-> setRange ( 0, 100 ); |
362 | alarmSlider-> setTickmarks ( QSlider::Both ); | 358 | alarmSlider-> setTickmarks ( QSlider::Both ); |
363 | alarmSlider-> setTickInterval ( 20 ); | 359 | alarmSlider-> setTickInterval ( 20 ); |
364 | alarmSlider-> setFocusPolicy ( QWidget::NoFocus ); | 360 | alarmSlider-> setFocusPolicy ( QWidget::NoFocus ); |
365 | 361 | ||
366 | QLabel *alarmLabel = new QLabel ( this ); | 362 | QLabel *alarmLabel = new QLabel ( this ); |
367 | alarmLabel-> setPixmap ( QPixmap ( alarm_xpm )); | 363 | alarmLabel-> setPixmap ( QPixmap ( alarm_xpm )); |
368 | 364 | ||
369 | grid-> addWidget ( alarmLabel, 0, 3, AlignCenter ); | 365 | grid-> addWidget ( alarmLabel, 0, 3, AlignCenter ); |
370 | grid-> addWidget ( alarmSlider, 1, 3, AlignCenter ); | 366 | grid-> addWidget ( alarmSlider, 1, 3, AlignCenter ); |
371 | 367 | ||
372 | alarmLed = new OLedBox ( yellow, this ); | 368 | alarmLed = new OLedBox ( yellow, this ); |
373 | alarmLed-> setFocusPolicy ( QWidget::NoFocus ); | 369 | alarmLed-> setFocusPolicy ( QWidget::NoFocus ); |
374 | alarmLed-> setFixedSize ( 16, 16 ); | 370 | alarmLed-> setFixedSize ( 16, 16 ); |
375 | 371 | ||
376 | grid-> addWidget ( alarmLed, 2, 3, AlignCenter ); | 372 | grid-> addWidget ( alarmLed, 2, 3, AlignCenter ); |
377 | 373 | ||
378 | if ( !has_wav_alarm ) { | 374 | if ( !has_wav_alarm ) { |
379 | alarmSlider-> hide ( ); | 375 | alarmSlider-> hide ( ); |
380 | alarmLabel-> hide ( ); | 376 | alarmLabel-> hide ( ); |
381 | alarmLed-> hide ( ); | 377 | alarmLed-> hide ( ); |
382 | } | 378 | } |
383 | 379 | ||
384 | grid-> addWidget ( new QLabel ( tr( "Enable Sounds for:" ), this ), 0, 6, AlignVCenter | AlignLeft ); | 380 | grid-> addWidget ( new QLabel ( tr( "Enable Sounds for:" ), this ), 0, 6, AlignVCenter | AlignLeft ); |
385 | 381 | ||
386 | vbox = new QVBoxLayout ( ); | 382 | vbox = new QVBoxLayout ( ); |
387 | vbox-> setSpacing ( 4 ); | 383 | vbox-> setSpacing ( 4 ); |
388 | grid-> addMultiCellLayout ( vbox, 1, 2, 6, 6 ); | 384 | grid-> addMultiCellLayout ( vbox, 1, 2, 6, 6 ); |
389 | 385 | ||
390 | tapBox = new QCheckBox ( tr( "Screen Taps" ), this ); | 386 | tapBox = new QCheckBox ( tr( "Screen Taps" ), this ); |
391 | tapBox-> setFocusPolicy ( QWidget::NoFocus ); | 387 | tapBox-> setFocusPolicy ( QWidget::NoFocus ); |
392 | 388 | ||
393 | vbox-> addWidget ( tapBox, AlignVCenter | AlignLeft ); | 389 | vbox-> addWidget ( tapBox, AlignVCenter | AlignLeft ); |
394 | 390 | ||
395 | keyBox = new QCheckBox ( tr( "Key Clicks" ), this ); | 391 | keyBox = new QCheckBox ( tr( "Key Clicks" ), this ); |
396 | keyBox-> setFocusPolicy ( QWidget::NoFocus ); | 392 | keyBox-> setFocusPolicy ( QWidget::NoFocus ); |
397 | 393 | ||
398 | vbox-> addWidget ( keyBox, AlignVCenter | AlignLeft ); | 394 | vbox-> addWidget ( keyBox, AlignVCenter | AlignLeft ); |
399 | 395 | ||
400 | alarmBox = new QCheckBox ( tr( "Alarm Sound" ), this ); | 396 | alarmBox = new QCheckBox ( tr( "Alarm Sound" ), this ); |
401 | alarmBox-> setFocusPolicy ( QWidget::NoFocus ); | 397 | alarmBox-> setFocusPolicy ( QWidget::NoFocus ); |
402 | 398 | ||
403 | vbox-> addWidget ( alarmBox, AlignVCenter | AlignLeft ); | 399 | vbox-> addWidget ( alarmBox, AlignVCenter | AlignLeft ); |
404 | 400 | ||
405 | if ( has_wav_alarm ) { | 401 | if ( has_wav_alarm ) { |
406 | alarmBox-> hide ( ); | 402 | alarmBox-> hide ( ); |
407 | } | 403 | } |
408 | 404 | ||
409 | vbox-> addStretch ( 100 ); | 405 | vbox-> addStretch ( 100 ); |
410 | 406 | ||
411 | setFixedSize ( sizeHint ( )); | 407 | setFixedSize ( sizeHint ( )); |
412 | setFocusPolicy ( QWidget::NoFocus ); | 408 | setFocusPolicy ( QWidget::NoFocus ); |
413 | 409 | ||
414 | rateTimer = new QTimer( this ); | 410 | rateTimer = new QTimer( this ); |
415 | connect ( rateTimer, SIGNAL( timeout ( )), this, SLOT( rateTimerDone ( ))); | 411 | connect ( rateTimer, SIGNAL( timeout ( )), this, SLOT( rateTimerDone ( ))); |
416 | 412 | ||
417 | connect ( upButton, SIGNAL( pressed ( )), this, SLOT( buttonChanged ( ))); | 413 | connect ( upButton, SIGNAL( pressed ( )), this, SLOT( buttonChanged ( ))); |
418 | connect ( upButton, SIGNAL( released ( )), this, SLOT( buttonChanged ( ))); | 414 | connect ( upButton, SIGNAL( released ( )), this, SLOT( buttonChanged ( ))); |
419 | connect ( downButton, SIGNAL( pressed ( )), this, SLOT( buttonChanged ( ))); | 415 | connect ( downButton, SIGNAL( pressed ( )), this, SLOT( buttonChanged ( ))); |
420 | connect ( downButton, SIGNAL( released ( )), this, SLOT( buttonChanged ( ))); | 416 | connect ( downButton, SIGNAL( released ( )), this, SLOT( buttonChanged ( ))); |
421 | 417 | ||
422 | connect ( micSlider, SIGNAL( valueChanged ( int )), this, SLOT( micMoved( int ))); | 418 | connect ( micSlider, SIGNAL( valueChanged ( int )), this, SLOT( micMoved( int ))); |
423 | connect ( volSlider, SIGNAL( valueChanged ( int )), this, SLOT( volMoved( int ))); | 419 | connect ( volSlider, SIGNAL( valueChanged ( int )), this, SLOT( volMoved( int ))); |
424 | connect ( alarmSlider, SIGNAL( valueChanged ( int )), this, SLOT( alarmMoved( int ))); | 420 | connect ( alarmSlider, SIGNAL( valueChanged ( int )), this, SLOT( alarmMoved( int ))); |
425 | connect ( bassSlider, SIGNAL( valueChanged ( int )), this, SLOT( bassMoved( int ))); | 421 | connect ( bassSlider, SIGNAL( valueChanged ( int )), this, SLOT( bassMoved( int ))); |
426 | connect ( trebleSlider, SIGNAL( valueChanged ( int )), this, SLOT( trebleMoved( int ))); | 422 | connect ( trebleSlider, SIGNAL( valueChanged ( int )), this, SLOT( trebleMoved( int ))); |
427 | 423 | ||
428 | 424 | ||
429 | connect ( volLed, SIGNAL( toggled ( bool )), this, SLOT( volMuteToggled ( bool ))); | 425 | connect ( volLed, SIGNAL( toggled ( bool )), this, SLOT( volMuteToggled ( bool ))); |
430 | connect ( micLed, SIGNAL( toggled ( bool )), this, SLOT( micMuteToggled ( bool ))); | 426 | connect ( micLed, SIGNAL( toggled ( bool )), this, SLOT( micMuteToggled ( bool ))); |
431 | connect ( alarmLed, SIGNAL( toggled ( bool )), this, SLOT( alarmSoundToggled ( bool ))); | 427 | connect ( alarmLed, SIGNAL( toggled ( bool )), this, SLOT( alarmSoundToggled ( bool ))); |
432 | 428 | ||
433 | connect ( alarmBox, SIGNAL( toggled ( bool )), this, SLOT( alarmSoundToggled ( bool ))); | 429 | connect ( alarmBox, SIGNAL( toggled ( bool )), this, SLOT( alarmSoundToggled ( bool ))); |
434 | connect ( keyBox, SIGNAL( toggled ( bool )), this, SLOT( keyClickToggled ( bool ))); | 430 | connect ( keyBox, SIGNAL( toggled ( bool )), this, SLOT( keyClickToggled ( bool ))); |
435 | connect ( tapBox, SIGNAL( toggled ( bool )), this, SLOT( screenTapToggled ( bool ))); | 431 | connect ( tapBox, SIGNAL( toggled ( bool )), this, SLOT( screenTapToggled ( bool ))); |
436 | 432 | ||
437 | // initialize variables | 433 | // initialize variables |
438 | 434 | ||
439 | readConfig ( true ); | 435 | readConfig ( true ); |
440 | 436 | ||
441 | // initialize the config file, in case some entries are missing | 437 | // initialize the config file, in case some entries are missing |
442 | 438 | ||
443 | writeConfigEntry ( "VolumePercent", m_vol_percent, UPD_None ); | 439 | writeConfigEntry ( "VolumePercent", m_vol_percent, UPD_None ); |
444 | writeConfigEntry ( "BassPercent", m_vol_percent, UPD_None ); | 440 | writeConfigEntry ( "BassPercent", m_vol_percent, UPD_None ); |
445 | writeConfigEntry ( "TreblePercent", m_vol_percent, UPD_None ); | 441 | writeConfigEntry ( "TreblePercent", m_vol_percent, UPD_None ); |
446 | writeConfigEntry ( "Mute", m_vol_muted, UPD_None ); | 442 | writeConfigEntry ( "Mute", m_vol_muted, UPD_None ); |
447 | writeConfigEntry ( "AlarmPercent", m_alarm_percent, UPD_None ); | 443 | writeConfigEntry ( "AlarmPercent", m_alarm_percent, UPD_None ); |
448 | writeConfigEntry ( "TouchSound", m_snd_touch, UPD_None ); | 444 | writeConfigEntry ( "TouchSound", m_snd_touch, UPD_None ); |
449 | writeConfigEntry ( "KeySound", m_snd_key, UPD_None ); | 445 | writeConfigEntry ( "KeySound", m_snd_key, UPD_None ); |
450 | writeConfigEntry ( "AlarmSound", m_snd_alarm, UPD_Vol ); | 446 | writeConfigEntry ( "AlarmSound", m_snd_alarm, UPD_Vol ); |
451 | 447 | ||
452 | writeConfigEntry ( "Mic", m_mic_percent, UPD_None ); | 448 | writeConfigEntry ( "Mic", m_mic_percent, UPD_None ); |
453 | writeConfigEntry ( "MicMute", m_mic_muted, UPD_Mic ); | 449 | writeConfigEntry ( "MicMute", m_mic_muted, UPD_Mic ); |
454 | } | 450 | } |
455 | 451 | ||
456 | bool VolumeControl::volMuted ( ) const | 452 | bool VolumeControl::volMuted ( ) const |
457 | { | 453 | { |
458 | return m_vol_muted; | 454 | return m_vol_muted; |
459 | } | 455 | } |
460 | 456 | ||
461 | int VolumeControl::volPercent ( ) const | 457 | int VolumeControl::volPercent ( ) const |
462 | { | 458 | { |
463 | return m_vol_percent; | 459 | return m_vol_percent; |
464 | } | 460 | } |
465 | 461 | ||
466 | void VolumeControl::keyPressEvent ( QKeyEvent *e ) | 462 | void VolumeControl::keyPressEvent ( QKeyEvent *e ) |
467 | { | 463 | { |
468 | switch ( e-> key ( )) { | 464 | switch ( e-> key ( )) { |
469 | case Key_Up: | 465 | case Key_Up: |
470 | volSlider-> subtractStep ( ); | 466 | volSlider-> subtractStep ( ); |
471 | break; | 467 | break; |
472 | case Key_Down: | 468 | case Key_Down: |
473 | volSlider-> addStep ( ); | 469 | volSlider-> addStep ( ); |
474 | break; | 470 | break; |
475 | case Key_Space: | 471 | case Key_Space: |
476 | volLed-> toggle ( ); | 472 | volLed-> toggle ( ); |
477 | break; | 473 | break; |
478 | case Key_Escape: | 474 | case Key_Escape: |
479 | hide ( ); | 475 | hide ( ); |
480 | break; | 476 | break; |
481 | } | 477 | } |
482 | } | 478 | } |
483 | 479 | ||
484 | void VolumeControl::buttonChanged ( ) | 480 | void VolumeControl::buttonChanged ( ) |
485 | { | 481 | { |
486 | if ( upButton-> isDown ( ) || downButton->isDown ( )) { | 482 | if ( upButton-> isDown ( ) || downButton->isDown ( )) { |
487 | rateTimerDone ( ); // Call it one time manually, otherwise it wont get | 483 | rateTimerDone ( ); // Call it one time manually, otherwise it wont get |
488 | // called at all when a button is pressed for a time | 484 | // called at all when a button is pressed for a time |
489 | // shorter than RATE_TIMER_INTERVAL. | 485 | // shorter than RATE_TIMER_INTERVAL. |
490 | rateTimer-> start ( RATE_TIMER_INTERVAL, false ); | 486 | rateTimer-> start ( RATE_TIMER_INTERVAL, false ); |
491 | } | 487 | } |
492 | else | 488 | else |
493 | rateTimer-> stop ( ); | 489 | rateTimer-> stop ( ); |
494 | } | 490 | } |
495 | 491 | ||
496 | void VolumeControl::rateTimerDone ( ) | 492 | void VolumeControl::rateTimerDone ( ) |
497 | { | 493 | { |
498 | if ( upButton-> isDown ( )) | 494 | if ( upButton-> isDown ( )) |
499 | volSlider-> setValue ( volSlider-> value ( ) - 2 ); | 495 | volSlider-> setValue ( volSlider-> value ( ) - 2 ); |
500 | else // if ( downButton-> isDown ( )) | 496 | else // if ( downButton-> isDown ( )) |
501 | volSlider-> setValue ( volSlider-> value ( ) + 2 ); | 497 | volSlider-> setValue ( volSlider-> value ( ) + 2 ); |
502 | } | 498 | } |
503 | 499 | ||
504 | void VolumeControl::show ( bool /*showMic*/ ) | 500 | void VolumeControl::show ( bool /*showMic*/ ) |
505 | { | 501 | { |
506 | readConfig ( ); | 502 | readConfig ( ); |
507 | 503 | ||
508 | QPoint curPos = m_icon-> mapToGlobal ( QPoint ( 0, 0 )); | 504 | QPoint curPos = m_icon-> mapToGlobal ( QPoint ( 0, 0 )); |
509 | 505 | ||
510 | int w = sizeHint ( ). width ( ); | 506 | int w = sizeHint ( ). width ( ); |
511 | int x = curPos.x ( ) - ( w / 2 ); | 507 | int x = curPos.x ( ) - ( w / 2 ); |
512 | 508 | ||
513 | if (( x + w ) > QPEApplication::desktop ( )-> width ( )) | 509 | if (( x + w ) > QPEApplication::desktop ( )-> width ( )) |
514 | x = QPEApplication::desktop ( )-> width ( ) - w; | 510 | x = QPEApplication::desktop ( )-> width ( ) - w; |
515 | 511 | ||
516 | move ( x, curPos. y ( ) - sizeHint ( ). height ( )); | 512 | move ( x, curPos. y ( ) - sizeHint ( ). height ( )); |
517 | QFrame::show ( ); | 513 | QFrame::show ( ); |
518 | 514 | ||
519 | } | 515 | } |
520 | 516 | ||
521 | void VolumeControl::readConfig ( bool force ) | 517 | void VolumeControl::readConfig ( bool force ) |
522 | { | 518 | { |
523 | Config cfg ( "qpe" ); | 519 | Config cfg ( "qpe" ); |
524 | cfg. setGroup ( "Volume" ); | 520 | cfg. setGroup ( "Volume" ); |
525 | 521 | ||
526 | int old_vp = m_vol_percent; | 522 | int old_vp = m_vol_percent; |
527 | int old_mp = m_mic_percent; | 523 | int old_mp = m_mic_percent; |
528 | int old_bass = m_bass_percent; | 524 | int old_bass = m_bass_percent; |
529 | int old_treble = m_treble_percent; | 525 | int old_treble = m_treble_percent; |
530 | bool old_vm = m_vol_muted; | 526 | bool old_vm = m_vol_muted; |
531 | bool old_mm = m_mic_muted; | 527 | bool old_mm = m_mic_muted; |
532 | bool old_sk = m_snd_key; | 528 | bool old_sk = m_snd_key; |
533 | bool old_st = m_snd_touch; | 529 | bool old_st = m_snd_touch; |
534 | bool old_sa = m_snd_alarm; | 530 | bool old_sa = m_snd_alarm; |
535 | int old_ap = m_alarm_percent; | 531 | int old_ap = m_alarm_percent; |
536 | 532 | ||
537 | m_vol_percent = cfg. readNumEntry ( "VolumePercent", 50 ); | 533 | m_vol_percent = cfg. readNumEntry ( "VolumePercent", 50 ); |
538 | m_mic_percent = cfg. readNumEntry ( "Mic", 50 ); | 534 | m_mic_percent = cfg. readNumEntry ( "Mic", 50 ); |
539 | m_bass_percent = cfg. readNumEntry ( "BassPercent", 50 ); | 535 | m_bass_percent = cfg. readNumEntry ( "BassPercent", 50 ); |
540 | m_treble_percent = cfg. readNumEntry ( "TreblePercent", 50 ); | 536 | m_treble_percent = cfg. readNumEntry ( "TreblePercent", 50 ); |
541 | m_vol_muted = cfg. readBoolEntry ( "Mute", 0 ); | 537 | m_vol_muted = cfg. readBoolEntry ( "Mute", 0 ); |
542 | m_mic_muted = cfg. readBoolEntry ( "MicMute", 0 ); | 538 | m_mic_muted = cfg. readBoolEntry ( "MicMute", 0 ); |
543 | m_snd_key = cfg. readBoolEntry ( "KeySound", 0 ); | 539 | m_snd_key = cfg. readBoolEntry ( "KeySound", 0 ); |
544 | m_snd_touch = cfg. readBoolEntry ( "TouchSound", 0 ); | 540 | m_snd_touch = cfg. readBoolEntry ( "TouchSound", 0 ); |
545 | m_snd_alarm = cfg. readBoolEntry ( "AlarmSound", 1 ); | 541 | m_snd_alarm = cfg. readBoolEntry ( "AlarmSound", 1 ); |
546 | m_alarm_percent = cfg. readNumEntry ( "AlarmPercent", 65 ); | 542 | m_alarm_percent = cfg. readNumEntry ( "AlarmPercent", 65 ); |
547 | 543 | ||
548 | if ( force || ( m_vol_percent != old_vp )) | 544 | if ( force || ( m_vol_percent != old_vp )) |
549 | volSlider-> setValue ( 100 - m_vol_percent ); | 545 | volSlider-> setValue ( 100 - m_vol_percent ); |
550 | if ( force || ( m_mic_percent != old_mp )) | 546 | if ( force || ( m_mic_percent != old_mp )) |
551 | micSlider-> setValue ( 100 - m_mic_percent ); | 547 | micSlider-> setValue ( 100 - m_mic_percent ); |
552 | if ( force || ( m_alarm_percent != old_ap )) | 548 | if ( force || ( m_alarm_percent != old_ap )) |
553 | alarmSlider-> setValue ( 100 - m_alarm_percent ); | 549 | alarmSlider-> setValue ( 100 - m_alarm_percent ); |
554 | if ( force || ( m_bass_percent != old_bass )) | 550 | if ( force || ( m_bass_percent != old_bass )) |
555 | bassSlider-> setValue ( 100 - m_bass_percent ); | 551 | bassSlider-> setValue ( 100 - m_bass_percent ); |
556 | if ( force || ( m_treble_percent != old_treble )) | 552 | if ( force || ( m_treble_percent != old_treble )) |
557 | trebleSlider-> setValue ( 100 - m_treble_percent ); | 553 | trebleSlider-> setValue ( 100 - m_treble_percent ); |
558 | 554 | ||
559 | 555 | ||
560 | if ( force || ( m_vol_muted != old_vm )) | 556 | if ( force || ( m_vol_muted != old_vm )) |
561 | volLed-> setOn ( !m_vol_muted ); | 557 | volLed-> setOn ( !m_vol_muted ); |
562 | if ( force || ( m_mic_muted != old_mm )) | 558 | if ( force || ( m_mic_muted != old_mm )) |
563 | micLed-> setOn ( !m_mic_muted ); | 559 | micLed-> setOn ( !m_mic_muted ); |
564 | if ( force || ( m_snd_alarm != old_sa )) | 560 | if ( force || ( m_snd_alarm != old_sa )) |
565 | alarmLed-> setOn ( m_snd_alarm ); | 561 | alarmLed-> setOn ( m_snd_alarm ); |
566 | 562 | ||
567 | if ( force || ( m_snd_key != old_sk )) | 563 | if ( force || ( m_snd_key != old_sk )) |
568 | keyBox-> setChecked ( m_snd_key ); | 564 | keyBox-> setChecked ( m_snd_key ); |
569 | if ( force || ( m_snd_touch != old_st )) | 565 | if ( force || ( m_snd_touch != old_st )) |
570 | tapBox-> setChecked ( m_snd_touch ); | 566 | tapBox-> setChecked ( m_snd_touch ); |
571 | if ( force || ( m_snd_alarm != old_sa )) | 567 | if ( force || ( m_snd_alarm != old_sa )) |
572 | alarmBox-> setChecked ( m_snd_alarm ); | 568 | alarmBox-> setChecked ( m_snd_alarm ); |
573 | } | 569 | } |
574 | 570 | ||
575 | 571 | ||
576 | void VolumeControl::volumeChanged ( bool /*nowMuted*/ ) | 572 | void VolumeControl::volumeChanged ( bool /*nowMuted*/ ) |
577 | { | 573 | { |
578 | int prevVol = m_vol_percent; | 574 | int prevVol = m_vol_percent; |
579 | bool prevMute = m_vol_muted; | 575 | bool prevMute = m_vol_muted; |
580 | 576 | ||
581 | readConfig ( ); | 577 | readConfig ( ); |
582 | 578 | ||
583 | // Handle case where muting it toggled | 579 | // Handle case where muting it toggled |
584 | if ( m_vol_muted != prevMute ) | 580 | if ( m_vol_muted != prevMute ) |
585 | m_icon-> redraw ( true ); | 581 | m_icon-> redraw ( true ); |
586 | else if ( prevVol != m_vol_percent ) // Avoid over repainting | 582 | else if ( prevVol != m_vol_percent ) // Avoid over repainting |
587 | m_icon-> redraw ( false ); | 583 | m_icon-> redraw ( false ); |
588 | } | 584 | } |
589 | 585 | ||
590 | void VolumeControl::micChanged ( bool nowMuted ) | 586 | void VolumeControl::micChanged ( bool nowMuted ) |
591 | { | 587 | { |
592 | if ( !nowMuted ) | 588 | if ( !nowMuted ) |
593 | readConfig ( ); | 589 | readConfig ( ); |
594 | m_mic_muted = nowMuted; | 590 | m_mic_muted = nowMuted; |
595 | } | 591 | } |
596 | 592 | ||
597 | void VolumeControl::screenTapToggled ( bool b ) | 593 | void VolumeControl::screenTapToggled ( bool b ) |
598 | { | 594 | { |
599 | m_snd_touch = b; | 595 | m_snd_touch = b; |
600 | writeConfigEntry ( "TouchSound", m_snd_touch, UPD_Vol ); | 596 | writeConfigEntry ( "TouchSound", m_snd_touch, UPD_Vol ); |
601 | } | 597 | } |
602 | 598 | ||
603 | void VolumeControl::keyClickToggled ( bool b ) | 599 | void VolumeControl::keyClickToggled ( bool b ) |
604 | { | 600 | { |
605 | m_snd_key = b; | 601 | m_snd_key = b; |
606 | writeConfigEntry ( "KeySound", m_snd_key, UPD_Vol ); | 602 | writeConfigEntry ( "KeySound", m_snd_key, UPD_Vol ); |
607 | } | 603 | } |
608 | 604 | ||
609 | void VolumeControl::alarmSoundToggled ( bool b ) | 605 | void VolumeControl::alarmSoundToggled ( bool b ) |
610 | { | 606 | { |
611 | m_snd_alarm = b; | 607 | m_snd_alarm = b; |
612 | writeConfigEntry ( "AlarmSound", m_snd_alarm, UPD_Vol ); | 608 | writeConfigEntry ( "AlarmSound", m_snd_alarm, UPD_Vol ); |
613 | } | 609 | } |
614 | 610 | ||
615 | void VolumeControl::volMuteToggled ( bool b ) | 611 | void VolumeControl::volMuteToggled ( bool b ) |
616 | { | 612 | { |
617 | m_vol_muted = !b; | 613 | m_vol_muted = !b; |
618 | 614 | ||
619 | m_icon-> redraw ( true ); | 615 | m_icon-> redraw ( true ); |
620 | 616 | ||
621 | writeConfigEntry ( "Mute", m_vol_muted, UPD_Vol ); | 617 | writeConfigEntry ( "Mute", m_vol_muted, UPD_Vol ); |
622 | } | 618 | } |
623 | 619 | ||
624 | void VolumeControl::micMuteToggled ( bool b ) | 620 | void VolumeControl::micMuteToggled ( bool b ) |
625 | { | 621 | { |
626 | m_mic_muted = !b; | 622 | m_mic_muted = !b; |
627 | writeConfigEntry ( "MicMute", m_mic_muted, UPD_Mic ); | 623 | writeConfigEntry ( "MicMute", m_mic_muted, UPD_Mic ); |
628 | } | 624 | } |
629 | 625 | ||
630 | 626 | ||
631 | void VolumeControl::volMoved ( int percent ) | 627 | void VolumeControl::volMoved ( int percent ) |
632 | { | 628 | { |
633 | m_vol_percent = 100 - percent; | 629 | m_vol_percent = 100 - percent; |
634 | 630 | ||
635 | // clamp volume percent to be between 0 and 100 | 631 | // clamp volume percent to be between 0 and 100 |
636 | m_vol_percent = ( m_vol_percent < 0 ) ? 0 : (( m_vol_percent > 100 ) ? 100 : m_vol_percent ); | 632 | m_vol_percent = ( m_vol_percent < 0 ) ? 0 : (( m_vol_percent > 100 ) ? 100 : m_vol_percent ); |
637 | // repaint just the little volume rectangle | 633 | // repaint just the little volume rectangle |
638 | m_icon-> redraw ( false ); | 634 | m_icon-> redraw ( false ); |
639 | 635 | ||
640 | writeConfigEntry ( "VolumePercent", m_vol_percent, UPD_Vol ); | 636 | writeConfigEntry ( "VolumePercent", m_vol_percent, UPD_Vol ); |
641 | } | 637 | } |
642 | 638 | ||
643 | void VolumeControl::micMoved ( int percent ) | 639 | void VolumeControl::micMoved ( int percent ) |
644 | { | 640 | { |
645 | m_mic_percent = 100 - percent; | 641 | m_mic_percent = 100 - percent; |
646 | 642 | ||
647 | // clamp volume percent to be between 0 and 100 | 643 | // clamp volume percent to be between 0 and 100 |
648 | m_mic_percent = ( m_mic_percent < 0 ) ? 0 : (( m_mic_percent > 100 ) ? 100 : m_mic_percent ); | 644 | m_mic_percent = ( m_mic_percent < 0 ) ? 0 : (( m_mic_percent > 100 ) ? 100 : m_mic_percent ); |
649 | 645 | ||
650 | writeConfigEntry ( "Mic", m_mic_percent, UPD_Mic ); | 646 | writeConfigEntry ( "Mic", m_mic_percent, UPD_Mic ); |
651 | } | 647 | } |
652 | 648 | ||
653 | void VolumeControl::alarmMoved ( int percent ) | 649 | void VolumeControl::alarmMoved ( int percent ) |
654 | { | 650 | { |
655 | m_alarm_percent = 100 - percent; | 651 | m_alarm_percent = 100 - percent; |
656 | 652 | ||
657 | // clamp volume percent to be between 0 and 100 | 653 | // clamp volume percent to be between 0 and 100 |
658 | m_alarm_percent = ( m_alarm_percent < 0 ) ? 0 : (( m_alarm_percent > 100 ) ? 100 : m_alarm_percent ); | 654 | m_alarm_percent = ( m_alarm_percent < 0 ) ? 0 : (( m_alarm_percent > 100 ) ? 100 : m_alarm_percent ); |
659 | 655 | ||
660 | writeConfigEntry ( "AlarmPercent", m_alarm_percent, UPD_None ); | 656 | writeConfigEntry ( "AlarmPercent", m_alarm_percent, UPD_None ); |
661 | } | 657 | } |
662 | 658 | ||
663 | 659 | ||
664 | void VolumeControl::bassMoved ( int percent ) | 660 | void VolumeControl::bassMoved ( int percent ) |
665 | { | 661 | { |
666 | m_bass_percent = 100 - percent; | 662 | m_bass_percent = 100 - percent; |
667 | 663 | ||
668 | // clamp bass percent to be between 0 and 100 | 664 | // clamp bass percent to be between 0 and 100 |
669 | m_bass_percent = ( m_bass_percent < 0 ) ? 0 : (( m_bass_percent > 100 ) ? 100 : m_bass_percent ); | 665 | m_bass_percent = ( m_bass_percent < 0 ) ? 0 : (( m_bass_percent > 100 ) ? 100 : m_bass_percent ); |
670 | 666 | ||
671 | writeConfigEntry ( "BassPercent", m_bass_percent, UPD_Bass ); | 667 | writeConfigEntry ( "BassPercent", m_bass_percent, UPD_Bass ); |
672 | } | 668 | } |
673 | 669 | ||
674 | 670 | ||
675 | 671 | ||
676 | void VolumeControl::trebleMoved ( int percent ) | 672 | void VolumeControl::trebleMoved ( int percent ) |
677 | { | 673 | { |
678 | m_treble_percent = 100 - percent; | 674 | m_treble_percent = 100 - percent; |
679 | 675 | ||
680 | // clamp treble percent to be between 0 and 100 | 676 | // clamp treble percent to be between 0 and 100 |
681 | m_treble_percent = ( m_treble_percent < 0 ) ? 0 : (( m_treble_percent > 100 ) ? 100 : m_treble_percent ); | 677 | m_treble_percent = ( m_treble_percent < 0 ) ? 0 : (( m_treble_percent > 100 ) ? 100 : m_treble_percent ); |
682 | 678 | ||
683 | writeConfigEntry ( "TreblePercent", m_treble_percent, UPD_Treble ); | 679 | writeConfigEntry ( "TreblePercent", m_treble_percent, UPD_Treble ); |
684 | } | 680 | } |
685 | 681 | ||
686 | 682 | ||
687 | 683 | ||
688 | void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd ) | 684 | void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd ) |
689 | { | 685 | { |
690 | Config cfg ( "qpe" ); | 686 | Config cfg ( "qpe" ); |
691 | cfg. setGroup ( "Volume" ); | 687 | cfg. setGroup ( "Volume" ); |
692 | cfg. writeEntry ( entry, val ); | 688 | cfg. writeEntry ( entry, val ); |
693 | // cfg. write ( ); | 689 | // cfg. write ( ); |
694 | 690 | ||
695 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | 691 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) |
696 | switch ( upd ) { | 692 | switch ( upd ) { |
697 | case UPD_Vol: { | 693 | case UPD_Vol: { |
698 | QCopEnvelope ( "QPE/System", "volumeChange(bool)" ) << m_vol_muted; | 694 | QCopEnvelope ( "QPE/System", "volumeChange(bool)" ) << m_vol_muted; |
699 | break; | 695 | break; |
700 | } | 696 | } |
701 | case UPD_Mic: { | 697 | case UPD_Mic: { |
702 | QCopEnvelope ( "QPE/System", "micChange(bool)" ) << m_mic_muted; | 698 | QCopEnvelope ( "QPE/System", "micChange(bool)" ) << m_mic_muted; |
703 | break; | 699 | break; |
704 | } | 700 | } |
705 | case UPD_Bass: { | 701 | case UPD_Bass: { |
706 | QCopEnvelope ( "QPE/System", "bassChange(bool)" ) << true; | 702 | QCopEnvelope ( "QPE/System", "bassChange(bool)" ) << true; |
707 | break; | 703 | break; |
708 | } | 704 | } |
709 | case UPD_Treble: { | 705 | case UPD_Treble: { |
710 | QCopEnvelope ( "QPE/System", "trebleChange(bool)" ) << true; | 706 | QCopEnvelope ( "QPE/System", "trebleChange(bool)" ) << true; |
711 | break; | 707 | break; |
712 | } | 708 | } |
713 | 709 | ||
714 | case UPD_None: | 710 | case UPD_None: |
715 | break; | 711 | break; |
716 | } | 712 | } |
717 | #endif | 713 | #endif |
718 | } | 714 | } |
719 | 715 | ||
720 | //=========================================================================== | 716 | //=========================================================================== |
721 | 717 | ||
722 | VolumeApplet::VolumeApplet( QWidget *parent, const char *name ) | 718 | VolumeApplet::VolumeApplet( QWidget *parent, const char *name ) |
723 | : QWidget( parent, name ) | 719 | : QWidget( parent, name ) |
724 | { | 720 | { |
725 | setFixedWidth ( AppLnk::smallIconSize() ); | 721 | setFixedWidth ( AppLnk::smallIconSize() ); |
726 | setFixedHeight ( AppLnk::smallIconSize()+4 ); | 722 | setFixedHeight ( AppLnk::smallIconSize()+4 ); |
727 | 723 | ||
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 | ||
735 | VolumeApplet::~VolumeApplet() | 731 | VolumeApplet::~VolumeApplet() |
736 | { | 732 | { |
737 | delete m_pixmap; | 733 | delete m_pixmap; |
738 | } | 734 | } |
739 | 735 | ||
736 | int VolumeApplet::position() | ||
737 | { | ||
738 | return 6; | ||
739 | } | ||
740 | 740 | ||
741 | void VolumeApplet::mousePressEvent ( QMouseEvent * ) | 741 | void 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 | ||
749 | void VolumeApplet::redraw ( bool all ) | 749 | void VolumeApplet::redraw ( bool all ) |
750 | { | 750 | { |
751 | if ( all ) | 751 | if ( all ) |
752 | repaint ( true ); | 752 | repaint ( true ); |
753 | else | 753 | else |
754 | repaint ( 2, height ( ) - 3, width ( ) - 4, 2, false ); | 754 | repaint ( 2, height ( ) - 3, width ( ) - 4, 2, false ); |
755 | } | 755 | } |
756 | 756 | ||
757 | 757 | ||
758 | void VolumeApplet::paintEvent ( QPaintEvent * ) | 758 | void VolumeApplet::paintEvent ( QPaintEvent * ) |
759 | { | 759 | { |
760 | QPainter p ( this ); | 760 | QPainter p ( this ); |
761 | 761 | ||
762 | p. drawPixmap ( (width()- m_pixmap->width())/2, QMAX( (height()-4-m_pixmap->height() )/2, 1), *m_pixmap ); | 762 | p. drawPixmap ( (width()- m_pixmap->width())/2, QMAX( (height()-4-m_pixmap->height() )/2, 1), *m_pixmap ); |
763 | p. setPen ( darkGray ); | 763 | p. setPen ( darkGray ); |
764 | p. drawRect ( 1, height() - 4, width() - 2, 4 ); | 764 | p. drawRect ( 1, height() - 4, width() - 2, 4 ); |
765 | 765 | ||
766 | int pixelsWide = m_dialog-> volPercent ( ) * ( width() - 4 ) / 100; | 766 | int pixelsWide = m_dialog-> volPercent ( ) * ( width() - 4 ) / 100; |
767 | p. fillRect ( 2, height() - 3, pixelsWide, 2, red ); | 767 | p. fillRect ( 2, height() - 3, pixelsWide, 2, red ); |
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 | ||
780 | Q_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 | |||
@@ -1,134 +1,135 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
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 | #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 <qframe.h> | 25 | #include <qframe.h> |
26 | 26 | ||
27 | class QPixmap; | 27 | class QPixmap; |
28 | class QTimer; | 28 | class QTimer; |
29 | class QSlider; | 29 | class QSlider; |
30 | class QCheckBox; | 30 | class QCheckBox; |
31 | class QButton; | 31 | class QButton; |
32 | class OLedBox; | 32 | class OLedBox; |
33 | 33 | ||
34 | class VolumeApplet; | 34 | class VolumeApplet; |
35 | 35 | ||
36 | class VolumeControl : public QFrame { | 36 | class VolumeControl : public QFrame { |
37 | Q_OBJECT | 37 | Q_OBJECT |
38 | 38 | ||
39 | public: | 39 | public: |
40 | VolumeControl ( VolumeApplet *icon, bool showMic = false, QWidget *parent=0, const char *name=0 ); | 40 | VolumeControl ( VolumeApplet *icon, bool showMic = false, QWidget *parent=0, const char *name=0 ); |
41 | 41 | ||
42 | bool volMuted ( ) const; | 42 | bool volMuted ( ) const; |
43 | int volPercent ( ) const; | 43 | int volPercent ( ) const; |
44 | 44 | ||
45 | virtual void show ( bool showmic ); | 45 | virtual void show ( bool showmic ); |
46 | 46 | ||
47 | protected: | 47 | protected: |
48 | virtual void keyPressEvent ( QKeyEvent * e ); | 48 | virtual void keyPressEvent ( QKeyEvent * e ); |
49 | 49 | ||
50 | protected slots: | 50 | protected slots: |
51 | void volumeChanged ( bool muted ); | 51 | void volumeChanged ( bool muted ); |
52 | void micChanged ( bool muted ); | 52 | void micChanged ( bool muted ); |
53 | 53 | ||
54 | private slots: | 54 | private slots: |
55 | void volMoved ( int percent ); | 55 | void volMoved ( int percent ); |
56 | void micMoved ( int percent ); | 56 | void micMoved ( int percent ); |
57 | void alarmMoved ( int percent ); | 57 | void alarmMoved ( int percent ); |
58 | void bassMoved( int percent ); | 58 | void bassMoved( int percent ); |
59 | void trebleMoved( int percent ); | 59 | void trebleMoved( int percent ); |
60 | 60 | ||
61 | void volMuteToggled ( bool ); | 61 | void volMuteToggled ( bool ); |
62 | void micMuteToggled ( bool ); | 62 | void micMuteToggled ( bool ); |
63 | void alarmSoundToggled ( bool ); | 63 | void alarmSoundToggled ( bool ); |
64 | void keyClickToggled ( bool ); | 64 | void keyClickToggled ( bool ); |
65 | void screenTapToggled ( bool ); | 65 | void screenTapToggled ( bool ); |
66 | 66 | ||
67 | void buttonChanged ( ); | 67 | void buttonChanged ( ); |
68 | void rateTimerDone ( ); | 68 | void rateTimerDone ( ); |
69 | 69 | ||
70 | private: | 70 | private: |
71 | void readConfig ( bool force = false ); | 71 | void readConfig ( bool force = false ); |
72 | 72 | ||
73 | enum eUpdate { | 73 | enum eUpdate { |
74 | UPD_None, | 74 | UPD_None, |
75 | UPD_Vol, | 75 | UPD_Vol, |
76 | UPD_Mic, | 76 | UPD_Mic, |
77 | UPD_Bass, | 77 | UPD_Bass, |
78 | UPD_Treble | 78 | UPD_Treble |
79 | }; | 79 | }; |
80 | void writeConfigEntry ( const char *entry, int val, eUpdate upd ); | 80 | void writeConfigEntry ( const char *entry, int val, eUpdate upd ); |
81 | 81 | ||
82 | 82 | ||
83 | private: | 83 | private: |
84 | QSlider *volSlider; | 84 | QSlider *volSlider; |
85 | QSlider *bassSlider; | 85 | QSlider *bassSlider; |
86 | QSlider *trebleSlider; | 86 | QSlider *trebleSlider; |
87 | QSlider *micSlider; | 87 | QSlider *micSlider; |
88 | QSlider *alarmSlider; | 88 | QSlider *alarmSlider; |
89 | OLedBox *volLed; | 89 | OLedBox *volLed; |
90 | OLedBox *micLed; | 90 | OLedBox *micLed; |
91 | OLedBox *alarmLed; | 91 | OLedBox *alarmLed; |
92 | 92 | ||
93 | QCheckBox *alarmBox; | 93 | QCheckBox *alarmBox; |
94 | QCheckBox *tapBox; | 94 | QCheckBox *tapBox; |
95 | QCheckBox *keyBox; | 95 | QCheckBox *keyBox; |
96 | QPushButton *upButton; | 96 | QPushButton *upButton; |
97 | QPushButton *downButton; | 97 | QPushButton *downButton; |
98 | QTimer *rateTimer; | 98 | QTimer *rateTimer; |
99 | 99 | ||
100 | int m_vol_percent; | 100 | int m_vol_percent; |
101 | int m_mic_percent; | 101 | int m_mic_percent; |
102 | int m_alarm_percent; | 102 | int m_alarm_percent; |
103 | int m_bass_percent; | 103 | int m_bass_percent; |
104 | int m_treble_percent; | 104 | int m_treble_percent; |
105 | bool m_vol_muted; | 105 | bool m_vol_muted; |
106 | bool m_mic_muted; | 106 | bool m_mic_muted; |
107 | bool m_snd_alarm; | 107 | bool m_snd_alarm; |
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 | ||
114 | class VolumeApplet : public QWidget { | 114 | class VolumeApplet : public QWidget { |
115 | Q_OBJECT | 115 | Q_OBJECT |
116 | 116 | ||
117 | public: | 117 | public: |
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 | ||
123 | protected: | 124 | protected: |
124 | virtual void mousePressEvent ( QMouseEvent * ); | 125 | virtual void mousePressEvent ( QMouseEvent * ); |
125 | virtual void paintEvent ( QPaintEvent* ); | 126 | virtual void paintEvent ( QPaintEvent* ); |
126 | 127 | ||
127 | private: | 128 | private: |
128 | QPixmap * m_pixmap; | 129 | QPixmap * m_pixmap; |
129 | VolumeControl *m_dialog; | 130 | VolumeControl *m_dialog; |
130 | }; | 131 | }; |
131 | 132 | ||
132 | 133 | ||
133 | #endif // __VOLUME_APPLET_H__ | 134 | #endif // __VOLUME_APPLET_H__ |
134 | 135 | ||
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 |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += ../$(OPIEDIR)/include | 8 | DEPENDPATH += ../$(OPIEDIR)/include |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe |
10 | VERSION = 1.0.0 | 10 | VERSION = 1.0.0 |
11 | 11 | ||
12 | include ( $(OPIEDIR)/include.pro ) | 12 | include ( $(OPIEDIR)/include.pro ) |
13 | target.path = $$prefix/plugins/applets | 13 | target.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 | |||
23 | VolumeAppletImpl::VolumeAppletImpl() | ||
24 | : volume(0) | ||
25 | { | ||
26 | } | ||
27 | |||
28 | VolumeAppletImpl::~VolumeAppletImpl() | ||
29 | { | ||
30 | delete volume; | ||
31 | } | ||
32 | |||
33 | QWidget *VolumeAppletImpl::applet( QWidget *parent ) | ||
34 | { | ||
35 | if ( !volume ) | ||
36 | volume = new VolumeApplet( parent ); | ||
37 | return volume; | ||
38 | } | ||
39 | |||
40 | int VolumeAppletImpl::position() const | ||
41 | { | ||
42 | return 6; | ||
43 | } | ||
44 | |||
45 | QRESULT 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 | |||
60 | Q_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 | |||
25 | class VolumeApplet; | ||
26 | |||
27 | class VolumeAppletImpl : public TaskbarAppletInterface | ||
28 | { | ||
29 | public: | ||
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 | |||
39 | private: | ||
40 | VolumeApplet *volume; | ||
41 | }; | ||
42 | |||
43 | #endif | ||
diff --git a/core/obex/obex.pro b/core/obex/obex.pro index 6f0e6d1..a296b2c 100644 --- a/core/obex/obex.pro +++ b/core/obex/obex.pro | |||
@@ -1,13 +1,13 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | HEADERS= obex.h obeximpl.h obexhandler.h obexsend.h receiver.h | 3 | HEADERS= obex.h obexhandler.h obexsend.h receiver.h |
4 | SOURCES= obex.cc obeximpl.cpp obexsend.cpp obexhandler.cpp receiver.cpp | 4 | SOURCES= obex.cc obexsend.cpp obexhandler.cpp receiver.cpp |
5 | TARGET = opieobex | 5 | TARGET = opieobex |
6 | DESTDIR = $(OPIEDIR)/plugins/obex | 6 | DESTDIR = $(OPIEDIR)/plugins/obex |
7 | INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/core/launcher | 7 | INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/core/launcher |
8 | DEPENDPATH += ../$(OPIEDIR)/include | 8 | DEPENDPATH += ../$(OPIEDIR)/include |
9 | LIBS += -lqpe -lopie | 9 | LIBS += -lqpe -lopiecore2 |
10 | VERSION = 0.0.2 | 10 | VERSION = 0.0.2 |
11 | 11 | ||
12 | include ( $(OPIEDIR)/include.pro ) | 12 | include ( $(OPIEDIR)/include.pro ) |
13 | target.path = $$prefix/plugins/applets | 13 | target.path = $$prefix/plugins/applets |