-rw-r--r-- | library/backend/rohfeedback.cpp | 19 | ||||
-rw-r--r-- | library/backend/rohfeedback.h | 19 |
2 files changed, 38 insertions, 0 deletions
diff --git a/library/backend/rohfeedback.cpp b/library/backend/rohfeedback.cpp index 21aad34..9a19aac 100644 --- a/library/backend/rohfeedback.cpp +++ b/library/backend/rohfeedback.cpp | |||
@@ -1,64 +1,83 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the 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 | **********************************************************************/ | ||
1 | #ifdef OPIE_WITHROHFEEDBACK | 20 | #ifdef OPIE_WITHROHFEEDBACK |
2 | 21 | ||
3 | #include <rohfeedback.h> | 22 | #include <rohfeedback.h> |
4 | #include <stdio.h> | 23 | #include <stdio.h> |
5 | #include <qpeapplication.h> | 24 | #include <qpeapplication.h> |
6 | #include <qevent.h> | 25 | #include <qevent.h> |
7 | #include <resource.h> | 26 | #include <resource.h> |
8 | #include <qpixmap.h> | 27 | #include <qpixmap.h> |
9 | #include <qbitmap.h> | 28 | #include <qbitmap.h> |
10 | 29 | ||
11 | #define SPEED 600 | 30 | #define SPEED 600 |
12 | #define DELAY 500 | 31 | #define DELAY 500 |
13 | 32 | ||
14 | namespace Opie { | 33 | namespace Opie { |
15 | namespace Internal { | 34 | namespace Internal { |
16 | /* | 35 | /* |
17 | 36 | ||
18 | RightOnHold feedback | 37 | RightOnHold feedback |
19 | 38 | ||
20 | */ | 39 | */ |
21 | 40 | ||
22 | QPixmap * RoHFeedback::Imgs[NOOFICONS] = { 0, 0, 0, 0, 0 }; | 41 | QPixmap * RoHFeedback::Imgs[NOOFICONS] = { 0, 0, 0, 0, 0 }; |
23 | QBitmap * RoHFeedback::Masks[NOOFICONS]; | 42 | QBitmap * RoHFeedback::Masks[NOOFICONS]; |
24 | int RoHFeedback::IconWidth; | 43 | int RoHFeedback::IconWidth; |
25 | int RoHFeedback::IconHeight; | 44 | int RoHFeedback::IconHeight; |
26 | 45 | ||
27 | RoHFeedback::RoHFeedback() : | 46 | RoHFeedback::RoHFeedback() : |
28 | QLabel( 0, 0, Qt::WType_Popup ), Timer() { | 47 | QLabel( 0, 0, Qt::WType_Popup ), Timer() { |
29 | 48 | ||
30 | Receiver = 0l; | 49 | Receiver = 0l; |
31 | connect( &Timer, SIGNAL( timeout() ), this, SLOT( iconShow() ) ); | 50 | connect( &Timer, SIGNAL( timeout() ), this, SLOT( iconShow() ) ); |
32 | 51 | ||
33 | if( Imgs[0] == 0 ) { | 52 | if( Imgs[0] == 0 ) { |
34 | QString S; | 53 | QString S; |
35 | 54 | ||
36 | 55 | ||
37 | for( int i = 0; i < NOOFICONS ; i ++ ) { | 56 | for( int i = 0; i < NOOFICONS ; i ++ ) { |
38 | Imgs[i] = new QPixmap( Resource::loadPixmap( | 57 | Imgs[i] = new QPixmap( Resource::loadPixmap( |
39 | "RoH/star/"+ QString::number(i+1) + ".png" )); | 58 | "RoH/star/"+ QString::number(i+1) + ".png" )); |
40 | Masks[i] = new QBitmap(); | 59 | Masks[i] = new QBitmap(); |
41 | (*Masks[i]) = Resource::loadPixmap( | 60 | (*Masks[i]) = Resource::loadPixmap( |
42 | "RoH/star/"+QString::number(i+1) + "-mask.png" ); | 61 | "RoH/star/"+QString::number(i+1) + "-mask.png" ); |
43 | } | 62 | } |
44 | } | 63 | } |
45 | 64 | ||
46 | IconWidth = Imgs[0]->size().width(); | 65 | IconWidth = Imgs[0]->size().width(); |
47 | IconHeight = Imgs[0]->size().height(); | 66 | IconHeight = Imgs[0]->size().height(); |
48 | 67 | ||
49 | resize( IconWidth, IconHeight ); | 68 | resize( IconWidth, IconHeight ); |
50 | } | 69 | } |
51 | 70 | ||
52 | int RoHFeedback::delay( void ) { | 71 | int RoHFeedback::delay( void ) { |
53 | return DELAY+SPEED+50; | 72 | return DELAY+SPEED+50; |
54 | } | 73 | } |
55 | 74 | ||
56 | RoHFeedback::~RoHFeedback() { | 75 | RoHFeedback::~RoHFeedback() { |
57 | for ( int i = 0; i < NOOFICONS; ++i ) { | 76 | for ( int i = 0; i < NOOFICONS; ++i ) { |
58 | delete Imgs [i]; | 77 | delete Imgs [i]; |
59 | delete Masks[i]; | 78 | delete Masks[i]; |
60 | } | 79 | } |
61 | } | 80 | } |
62 | 81 | ||
63 | void RoHFeedback::init( const QPoint & P, QWidget* wid ) { | 82 | void RoHFeedback::init( const QPoint & P, QWidget* wid ) { |
64 | if( ! IconWidth ) | 83 | if( ! IconWidth ) |
diff --git a/library/backend/rohfeedback.h b/library/backend/rohfeedback.h index 9ffd35a..774ee85 100644 --- a/library/backend/rohfeedback.h +++ b/library/backend/rohfeedback.h | |||
@@ -1,64 +1,83 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the 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 | **********************************************************************/ | ||
1 | #ifndef ROHFEEDBACK_H | 20 | #ifndef ROHFEEDBACK_H |
2 | #define ROHFEEDBACK_H | 21 | #define ROHFEEDBACK_H |
3 | 22 | ||
4 | #ifdef OPIE_WITHROHFEEDBACK | 23 | #ifdef OPIE_WITHROHFEEDBACK |
5 | 24 | ||
6 | /* | 25 | /* |
7 | 26 | ||
8 | RightOnHold feedback show | 27 | RightOnHold feedback show |
9 | 28 | ||
10 | */ | 29 | */ |
11 | 30 | ||
12 | #define NOOFICONS 5 | 31 | #define NOOFICONS 5 |
13 | 32 | ||
14 | #include <qlabel.h> | 33 | #include <qlabel.h> |
15 | #include <qtimer.h> | 34 | #include <qtimer.h> |
16 | 35 | ||
17 | class QEvent; | 36 | class QEvent; |
18 | class QPixmap; | 37 | class QPixmap; |
19 | class QBitmap; | 38 | class QBitmap; |
20 | class QMouseEvent; | 39 | class QMouseEvent; |
21 | 40 | ||
22 | namespace Opie { | 41 | namespace Opie { |
23 | namespace Internal { | 42 | namespace Internal { |
24 | 43 | ||
25 | class RoHFeedback : public QLabel { | 44 | class RoHFeedback : public QLabel { |
26 | 45 | ||
27 | Q_OBJECT | 46 | Q_OBJECT |
28 | 47 | ||
29 | enum Actions { | 48 | enum Actions { |
30 | FeedbackStopped = -2, | 49 | FeedbackStopped = -2, |
31 | FeedbackTimerStart = -1, | 50 | FeedbackTimerStart = -1, |
32 | FeedbackShow = 0 | 51 | FeedbackShow = 0 |
33 | }; | 52 | }; |
34 | public : | 53 | public : |
35 | 54 | ||
36 | RoHFeedback(); | 55 | RoHFeedback(); |
37 | ~RoHFeedback(); | 56 | ~RoHFeedback(); |
38 | 57 | ||
39 | 58 | ||
40 | void init( const QPoint & P, QWidget* wid ); | 59 | void init( const QPoint & P, QWidget* wid ); |
41 | void stop( void ); | 60 | void stop( void ); |
42 | int delay( void ); | 61 | int delay( void ); |
43 | 62 | ||
44 | public slots : | 63 | public slots : |
45 | 64 | ||
46 | void iconShow( void ); | 65 | void iconShow( void ); |
47 | 66 | ||
48 | protected : | 67 | protected : |
49 | 68 | ||
50 | bool event( QEvent * E ); | 69 | bool event( QEvent * E ); |
51 | 70 | ||
52 | QTimer Timer; | 71 | QTimer Timer; |
53 | int IconNr; | 72 | int IconNr; |
54 | QWidget * Receiver; | 73 | QWidget * Receiver; |
55 | 74 | ||
56 | static int IconWidth; | 75 | static int IconWidth; |
57 | static int IconHeight; | 76 | static int IconHeight; |
58 | static QPixmap * Imgs[NOOFICONS]; | 77 | static QPixmap * Imgs[NOOFICONS]; |
59 | static QBitmap * Masks[NOOFICONS]; | 78 | static QBitmap * Masks[NOOFICONS]; |
60 | }; | 79 | }; |
61 | } | 80 | } |
62 | } | 81 | } |
63 | 82 | ||
64 | #endif | 83 | #endif |