summaryrefslogtreecommitdiff
path: root/library
authorwimpie <wimpie>2004-08-25 01:47:35 (UTC)
committer wimpie <wimpie>2004-08-25 01:47:35 (UTC)
commitf6a6fe57c9e0047379f4b8b40da4776f1c4d7b25 (patch) (side-by-side diff)
tree2db64e885b1a67058fa45533819993c8dcb4fb96 /library
parent49c47e98bed6e35d0bdc8e1e4cc40bdbb07eab06 (diff)
downloadopie-f6a6fe57c9e0047379f4b8b40da4776f1c4d7b25.zip
opie-f6a6fe57c9e0047379f4b8b40da4776f1c4d7b25.tar.gz
opie-f6a6fe57c9e0047379f4b8b40da4776f1c4d7b25.tar.bz2
Final changes for RoH Feedback
- changed *.pro file to compile in backend - some more fixes to rohfeedback and qpeapplication
Diffstat (limited to 'library') (more/less context) (show whitespace changes)
-rw-r--r--library/backend/rohfeedback.cpp26
-rw-r--r--library/backend/rohfeedback.h3
-rw-r--r--library/config.in4
-rw-r--r--library/library.pro6
-rw-r--r--library/qpeapplication.cpp36
-rw-r--r--library/qpeapplication.h2
6 files changed, 45 insertions, 32 deletions
diff --git a/library/backend/rohfeedback.cpp b/library/backend/rohfeedback.cpp
index ff76a36..21aad34 100644
--- a/library/backend/rohfeedback.cpp
+++ b/library/backend/rohfeedback.cpp
@@ -1,6 +1,6 @@
-#include <rohfeedback.h>
-
+#ifdef OPIE_WITHROHFEEDBACK
+#include <rohfeedback.h>
#include <stdio.h>
#include <qpeapplication.h>
#include <qevent.h>
@@ -35,12 +35,11 @@ RoHFeedback::RoHFeedback() :
for( int i = 0; i < NOOFICONS ; i ++ ) {
- Imgs[i] = new QPixmap( Resource::loadPixmap("RoH/star/"+
- QString::number(i+1) +
- ".png" ));
+ Imgs[i] = new QPixmap( Resource::loadPixmap(
+ "RoH/star/"+ QString::number(i+1) + ".png" ));
Masks[i] = new QBitmap();
- (*Masks[i]) = Resource::loadPixmap("RoH/star/"+QString::number(i+1) +
- ".png" );
+ (*Masks[i]) = Resource::loadPixmap(
+ "RoH/star/"+QString::number(i+1) + "-mask.png" );
}
}
@@ -66,16 +65,14 @@ void RoHFeedback::init( const QPoint & P, QWidget* wid ) {
return;
Receiver = wid;
- IconNr = -1;
+ IconNr = FeedbackTimerStart;
move( P.x()-IconWidth/2, P.y() - IconHeight/2 );
// to initialize
- Timer.start( DELAY - SPEED/NOOFICONS );
+ Timer.start( DELAY );
}
void RoHFeedback::stop( void ) {
- IconNr = -2; // stop
- hide();
- Timer.stop();
+ IconNr = FeedbackStopped; // stop
}
bool RoHFeedback::event( QEvent * E ) {
@@ -100,13 +97,14 @@ bool RoHFeedback::event( QEvent * E ) {
void RoHFeedback::iconShow( void ) {
switch( IconNr ) {
case FeedbackTimerStart:
- IconNr = 0;
+ IconNr = FeedbackShow;
Timer.start( SPEED/NOOFICONS );
break;
case FeedbackStopped:
// stopped
IconNr = FeedbackTimerStart;
hide();
+ Timer.stop();
break;
case FeedbackShow: // first
show();
@@ -123,3 +121,5 @@ void RoHFeedback::iconShow( void ) {
}
} \ No newline at end of file
+
+#endif
diff --git a/library/backend/rohfeedback.h b/library/backend/rohfeedback.h
index f38a095..9ffd35a 100644
--- a/library/backend/rohfeedback.h
+++ b/library/backend/rohfeedback.h
@@ -1,6 +1,8 @@
#ifndef ROHFEEDBACK_H
#define ROHFEEDBACK_H
+#ifdef OPIE_WITHROHFEEDBACK
+
/*
RightOnHold feedback show
@@ -60,3 +62,4 @@ protected :
}
#endif
+#endif
diff --git a/library/config.in b/library/config.in
index ea69ccb..5273976 100644
--- a/library/config.in
+++ b/library/config.in
@@ -1,2 +1,6 @@
config LIBQPE
boolean "Qpe Library (Qt/Embedded version)"
+
+config LIBQPE_WITHROHFEEDBACK
+ boolean "Give visual feedback for RightOnHold"
+ depends LIBQPE
diff --git a/library/library.pro b/library/library.pro
index eb4bde3..af07fa3 100644
--- a/library/library.pro
+++ b/library/library.pro
@@ -47,6 +47,7 @@ HEADERS = calendar.h \
backend/task.h \
backend/event.h \
backend/contact.h\
+ backend/rohfeedback.h \
categorymenu.h \
categoryedit_p.h \
categoryselect.h \
@@ -106,6 +107,7 @@ SOURCES = calendar.cpp \
backend/task.cpp \
backend/event.cpp \
backend/contact.cpp \
+ backend/rohfeedback.cpp \
categorymenu.cpp \
categoryedit_p.cpp \
categoryselect.cpp \
@@ -135,3 +137,7 @@ include ( $(OPIEDIR)/include.pro )
contains( CONFIG, no-override ){
DEFINES += OPIE_NO_OVERRIDE_QT
}
+
+contains( CONFIG, LIBQPE_WITHROHFEEDBACK ){
+ DEFINES += WITHROHFEEDBACK
+}
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 35f433c..c6d9cfd 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -97,12 +97,11 @@
#endif
#include "qt_override_p.h"
-#include <qpe/rohfeedback.h>
+#include <backend/rohfeedback.h>
static bool useBigPixmaps = 0;
-
class HackWidget : public QWidget
{
public:
@@ -116,8 +115,8 @@ public:
class QPEApplicationData
{
public:
- QPEApplicationData ( )
- : presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ),
+ QPEApplicationData ( ) :
+ presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ),
notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ),
keep_running( true ), qcopQok( false ),
fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ),
@@ -130,7 +129,7 @@ public:
fontSize = cfg.readNumEntry( "FontSize", 10 );
smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 );
bigIconSize = cfg.readNumEntry( "BigIconSize", 32 );
-#ifdef OPIE_ROHFEEDBACK
+#ifdef OPIE_WITHROHFEEDBACK
RoH = 0;
#endif
}
@@ -138,7 +137,7 @@ public:
int presstimer;
QWidget* presswidget;
QPoint presspos;
-#ifdef OPIE_ROHFEEDBACK
+#ifdef OPIE_WITHROHFEEDBACK
Opie::Internal::RoHFeedback *RoH;
#endif
@@ -502,6 +501,7 @@ static void qpe_show_dialog( QDialog* d, bool nomax )
}
}
}
+
};
class ResourceMimeFactory : public QMimeSourceFactory
@@ -1215,7 +1215,9 @@ QPEApplication::~QPEApplication()
delete sysChannel;
delete pidChannel;
#endif
-#ifdef OPIE_ROHFEEDBACK
+
+#ifdef OPIE_WITHROHFEEDBACK
+ if( d->RoH )
delete d->RoH;
#endif
delete d;
@@ -2035,28 +2037,27 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e )
switch ( me->type() ) {
case QEvent::MouseButtonPress:
if ( me->button() == LeftButton ) {
+ static long Pref = 500; // #### pref.
d->presswidget = (QWidget*)o;
d->presspos = me->pos();
d->rightpressed = FALSE;
- // just for the time being
- static int pref = 500;
-#ifdef OPIE_ROHFEEDBACK
+#ifdef OPIE_WITHROHFEEDBACK
if( ! d->RoH )
d->RoH = new Opie::Internal::RoHFeedback;
d->RoH->init( me->globalPos(), d->presswidget );
- pref = d->RoH->delay();
+ Pref = d->RoH->delay();
+
#endif
if (!d->presstimer )
- d->presstimer = startTimer( pref ); // #### pref.
+ d->presstimer = startTimer( Pref ); // #### pref.
}
break;
case QEvent::MouseMove:
if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) {
killTimer(d->presstimer);
-#ifdef OPIE_ROHFEEDBACK
- if( d->RoH )
+#ifdef OPIE_WITHROHFEEDBACK
d->RoH->stop( );
#endif
d->presstimer = 0;
@@ -2066,13 +2067,13 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e )
if ( me->button() == LeftButton ) {
if ( d->presstimer ) {
killTimer(d->presstimer);
-#ifdef OPIE_ROHFEEDBACK
- if( d->RoH )
+#ifdef OPIE_WITHROHFEEDBACK
d->RoH->stop( );
#endif
d->presstimer = 0;
}
if ( d->rightpressed && d->presswidget ) {
+ printf( "Send ButtonRelease\n" );
// Right released
postEvent( d->presswidget,
new QMouseEvent( QEvent::MouseButtonRelease, me->pos(),
@@ -2116,6 +2117,7 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e )
void QPEApplication::timerEvent( QTimerEvent *e )
{
if ( e->timerId() == d->presstimer && d->presswidget ) {
+
// Right pressed
postEvent( d->presswidget,
new QMouseEvent( QEvent::MouseButtonPress, d->presspos,
@@ -2123,7 +2125,7 @@ void QPEApplication::timerEvent( QTimerEvent *e )
killTimer( d->presstimer );
d->presstimer = 0;
d->rightpressed = TRUE;
-#ifdef OPIE_ROHFEEDBACK
+#ifdef OPIE_WITHROHFEEDBACK
d->RoH->stop();
#endif
}
diff --git a/library/qpeapplication.h b/library/qpeapplication.h
index d2782e4..b07802f 100644
--- a/library/qpeapplication.h
+++ b/library/qpeapplication.h
@@ -184,8 +184,6 @@ private:
bool reserved_sh;
-
-
};
inline void QPEApplication::showDialog( QDialog* d, bool nomax )