summaryrefslogtreecommitdiff
authorzecke <zecke>2004-08-25 21:27:14 (UTC)
committer zecke <zecke>2004-08-25 21:27:14 (UTC)
commit656d233aa88a92b461abaa618e52db11c1f9d625 (patch) (unidiff)
tree93309884e5b5765a1750074125c437a067d5421f
parent834a1cfd0367f7c2ed6e250666624104c450d542 (diff)
downloadopie-656d233aa88a92b461abaa618e52db11c1f9d625.zip
opie-656d233aa88a92b461abaa618e52db11c1f9d625.tar.gz
opie-656d233aa88a92b461abaa618e52db11c1f9d625.tar.bz2
Do not make the files depend on external defines. This confuses
the 'moc' as it doesn't have a preprocessor in Qt2 and Qt3
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/backend/rohfeedback.cpp2
-rw-r--r--library/backend/rohfeedback.h2
2 files changed, 0 insertions, 4 deletions
diff --git a/library/backend/rohfeedback.cpp b/library/backend/rohfeedback.cpp
index 9a19aac..fa2a636 100644
--- a/library/backend/rohfeedback.cpp
+++ b/library/backend/rohfeedback.cpp
@@ -1,68 +1,67 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the 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#ifdef OPIE_WITHROHFEEDBACK
21 20
22#include <rohfeedback.h> 21#include <rohfeedback.h>
23#include <stdio.h> 22#include <stdio.h>
24#include <qpeapplication.h> 23#include <qpeapplication.h>
25#include <qevent.h> 24#include <qevent.h>
26#include <resource.h> 25#include <resource.h>
27#include <qpixmap.h> 26#include <qpixmap.h>
28#include <qbitmap.h> 27#include <qbitmap.h>
29 28
30#define SPEED 600 29#define SPEED 600
31#define DELAY 500 30#define DELAY 500
32 31
33namespace Opie { 32namespace Opie {
34namespace Internal { 33namespace Internal {
35/* 34/*
36 35
37 RightOnHold feedback 36 RightOnHold feedback
38 37
39*/ 38*/
40 39
41QPixmap * RoHFeedback::Imgs[NOOFICONS] = { 0, 0, 0, 0, 0 }; 40QPixmap * RoHFeedback::Imgs[NOOFICONS] = { 0, 0, 0, 0, 0 };
42QBitmap * RoHFeedback::Masks[NOOFICONS]; 41QBitmap * RoHFeedback::Masks[NOOFICONS];
43int RoHFeedback::IconWidth; 42int RoHFeedback::IconWidth;
44int RoHFeedback::IconHeight; 43int RoHFeedback::IconHeight;
45 44
46RoHFeedback::RoHFeedback() : 45RoHFeedback::RoHFeedback() :
47 QLabel( 0, 0, Qt::WType_Popup ), Timer() { 46 QLabel( 0, 0, Qt::WType_Popup ), Timer() {
48 47
49 Receiver = 0l; 48 Receiver = 0l;
50 connect( &Timer, SIGNAL( timeout() ), this, SLOT( iconShow() ) ); 49 connect( &Timer, SIGNAL( timeout() ), this, SLOT( iconShow() ) );
51 50
52 if( Imgs[0] == 0 ) { 51 if( Imgs[0] == 0 ) {
53 QString S; 52 QString S;
54 53
55 54
56 for( int i = 0; i < NOOFICONS ; i ++ ) { 55 for( int i = 0; i < NOOFICONS ; i ++ ) {
57 Imgs[i] = new QPixmap( Resource::loadPixmap( 56 Imgs[i] = new QPixmap( Resource::loadPixmap(
58 "RoH/star/"+ QString::number(i+1) + ".png" )); 57 "RoH/star/"+ QString::number(i+1) + ".png" ));
59 Masks[i] = new QBitmap(); 58 Masks[i] = new QBitmap();
60 (*Masks[i]) = Resource::loadPixmap( 59 (*Masks[i]) = Resource::loadPixmap(
61 "RoH/star/"+QString::number(i+1) + "-mask.png" ); 60 "RoH/star/"+QString::number(i+1) + "-mask.png" );
62 } 61 }
63 } 62 }
64 63
65 IconWidth = Imgs[0]->size().width(); 64 IconWidth = Imgs[0]->size().width();
66 IconHeight = Imgs[0]->size().height(); 65 IconHeight = Imgs[0]->size().height();
67 66
68 resize( IconWidth, IconHeight ); 67 resize( IconWidth, IconHeight );
@@ -96,49 +95,48 @@ void RoHFeedback::stop( void ) {
96 95
97bool RoHFeedback::event( QEvent * E ) { 96bool RoHFeedback::event( QEvent * E ) {
98 97
99 if( E->type() >= QEvent::MouseButtonPress && 98 if( E->type() >= QEvent::MouseButtonPress &&
100 E->type() <= QEvent::MouseMove ) { 99 E->type() <= QEvent::MouseMove ) {
101 // pass the event to the receiver with translated coord 100 // pass the event to the receiver with translated coord
102 QMouseEvent QME( ((QMouseEvent *)E)->type(), 101 QMouseEvent QME( ((QMouseEvent *)E)->type(),
103 Receiver->mapFromGlobal( 102 Receiver->mapFromGlobal(
104 ((QMouseEvent *)E)->globalPos() ), 103 ((QMouseEvent *)E)->globalPos() ),
105 ((QMouseEvent *)E)->globalPos(), 104 ((QMouseEvent *)E)->globalPos(),
106 ((QMouseEvent *)E)->button(), 105 ((QMouseEvent *)E)->button(),
107 ((QMouseEvent *)E)->state() 106 ((QMouseEvent *)E)->state()
108 ); 107 );
109 return QPEApplication::sendEvent( Receiver, &QME ); 108 return QPEApplication::sendEvent( Receiver, &QME );
110 } 109 }
111 110
112 // first let the label treat the event 111 // first let the label treat the event
113 return QLabel::event( E ); 112 return QLabel::event( E );
114} 113}
115 114
116void RoHFeedback::iconShow( void ) { 115void RoHFeedback::iconShow( void ) {
117 switch( IconNr ) { 116 switch( IconNr ) {
118 case FeedbackTimerStart: 117 case FeedbackTimerStart:
119 IconNr = FeedbackShow; 118 IconNr = FeedbackShow;
120 Timer.start( SPEED/NOOFICONS ); 119 Timer.start( SPEED/NOOFICONS );
121 break; 120 break;
122 case FeedbackStopped: 121 case FeedbackStopped:
123 // stopped 122 // stopped
124 IconNr = FeedbackTimerStart; 123 IconNr = FeedbackTimerStart;
125 hide(); 124 hide();
126 Timer.stop(); 125 Timer.stop();
127 break; 126 break;
128 case FeedbackShow: // first 127 case FeedbackShow: // first
129 show(); 128 show();
130 // FT 129 // FT
131 default : 130 default :
132 // show 131 // show
133 132
134 setPixmap( *(Imgs[IconNr]) ); 133 setPixmap( *(Imgs[IconNr]) );
135 setMask( *(Masks[IconNr]) ); 134 setMask( *(Masks[IconNr]) );
136 IconNr = (IconNr+1)%NOOFICONS; // rotate 135 IconNr = (IconNr+1)%NOOFICONS; // rotate
137 break; 136 break;
138 } 137 }
139} 138}
140 139
141} 140}
142} 141}
143 142
144#endif
diff --git a/library/backend/rohfeedback.h b/library/backend/rohfeedback.h
index 774ee85..2961d0e 100644
--- a/library/backend/rohfeedback.h
+++ b/library/backend/rohfeedback.h
@@ -1,84 +1,82 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the 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 ROHFEEDBACK_H 20#ifndef ROHFEEDBACK_H
21#define ROHFEEDBACK_H 21#define ROHFEEDBACK_H
22 22
23#ifdef OPIE_WITHROHFEEDBACK
24 23
25/* 24/*
26 25
27 RightOnHold feedback show 26 RightOnHold feedback show
28 27
29*/ 28*/
30 29
31#define NOOFICONS 5 30#define NOOFICONS 5
32 31
33#include <qlabel.h> 32#include <qlabel.h>
34#include <qtimer.h> 33#include <qtimer.h>
35 34
36class QEvent; 35class QEvent;
37class QPixmap; 36class QPixmap;
38class QBitmap; 37class QBitmap;
39class QMouseEvent; 38class QMouseEvent;
40 39
41namespace Opie { 40namespace Opie {
42namespace Internal { 41namespace Internal {
43 42
44class RoHFeedback : public QLabel { 43class RoHFeedback : public QLabel {
45 44
46 Q_OBJECT 45 Q_OBJECT
47 46
48 enum Actions { 47 enum Actions {
49 FeedbackStopped = -2, 48 FeedbackStopped = -2,
50 FeedbackTimerStart = -1, 49 FeedbackTimerStart = -1,
51 FeedbackShow = 0 50 FeedbackShow = 0
52 }; 51 };
53public : 52public :
54 53
55 RoHFeedback(); 54 RoHFeedback();
56 ~RoHFeedback(); 55 ~RoHFeedback();
57 56
58 57
59 void init( const QPoint & P, QWidget* wid ); 58 void init( const QPoint & P, QWidget* wid );
60 void stop( void ); 59 void stop( void );
61 int delay( void ); 60 int delay( void );
62 61
63public slots : 62public slots :
64 63
65 void iconShow( void ); 64 void iconShow( void );
66 65
67protected : 66protected :
68 67
69 bool event( QEvent * E ); 68 bool event( QEvent * E );
70 69
71 QTimer Timer; 70 QTimer Timer;
72 int IconNr; 71 int IconNr;
73 QWidget * Receiver; 72 QWidget * Receiver;
74 73
75 static int IconWidth; 74 static int IconWidth;
76 static int IconHeight; 75 static int IconHeight;
77 static QPixmap * Imgs[NOOFICONS]; 76 static QPixmap * Imgs[NOOFICONS];
78 static QBitmap * Masks[NOOFICONS]; 77 static QBitmap * Masks[NOOFICONS];
79}; 78};
80} 79}
81} 80}
82 81
83#endif 82#endif
84#endif