summaryrefslogtreecommitdiff
path: root/library/qpeapplication.cpp
authorzecke <zecke>2004-08-24 13:38:23 (UTC)
committer zecke <zecke>2004-08-24 13:38:23 (UTC)
commit0a141c4a9719aa273867ad45c4293208545489b1 (patch) (side-by-side diff)
tree4059ae180d00d33cc31dd9083d38a14b946253a2 /library/qpeapplication.cpp
parent102bb2b65c71da12c4f9f1ce7a5d1b37b6eb50ee (diff)
downloadopie-0a141c4a9719aa273867ad45c4293208545489b1.zip
opie-0a141c4a9719aa273867ad45c4293208545489b1.tar.gz
opie-0a141c4a9719aa273867ad45c4293208545489b1.tar.bz2
Add RightOn Hold Visual Feedback and integrate it
into QPEApplication Icons and Config Option will be comitted by WIMPIE
Diffstat (limited to 'library/qpeapplication.cpp') (more/less context) (show whitespace changes)
-rw-r--r--library/qpeapplication.cpp32
1 files changed, 29 insertions, 3 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 59ca61b..acad81d 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -88,26 +88,30 @@
#include "qpemenubar.h"
#include "textcodecinterface.h"
#include "imagecodecinterface.h"
#include <unistd.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#ifndef QT_NO_SOUND
#include <sys/soundcard.h>
#endif
#include "qt_override_p.h"
+#include <qpe/rohfeedback.h>
+
+
static bool useBigPixmaps = 0;
+
class HackWidget : public QWidget
{
public:
bool needsOk()
{ return (getWState() & WState_Reserved1 ); }
QRect normalGeometry()
{ return topData()->normalGeometry; };
};
class QPEApplicationData
{
@@ -117,24 +121,25 @@ public:
notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ),
keep_running( true ), qcopQok( false ),
fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ),
bigIconSize( 32 ), qpe_main_widget( 0 )
{
Config cfg( "qpe" );
cfg.setGroup( "Appearance" );
useBigPixmaps = cfg.readBoolEntry( "useBigPixmaps", false );
fontFamily = cfg.readEntry( "FontFamily", "Vera" );
fontSize = cfg.readNumEntry( "FontSize", 10 );
smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 );
bigIconSize = cfg.readNumEntry( "BigIconSize", 32 );
+ RoH = 0;
}
int presstimer;
QWidget* presswidget;
QPoint presspos;
bool rightpressed : 1;
bool kbgrabbed : 1;
bool notbusysent : 1;
bool preloaded : 1;
bool forceshow : 1;
bool nomaximize : 1;
@@ -483,24 +488,26 @@ static void qpe_show_dialog( QDialog* d, bool nomax )
QStringList formats = iface->keys();
for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) {
(void)iface->installIOHandler(*i);
// ### it exists now; need to remember if we can delete it
}
}
else {
lib->unload();
delete lib;
}
}
}
+
+ Opie::Internal::RoHFeedback * RoH;
};
class ResourceMimeFactory : public QMimeSourceFactory
{
public:
ResourceMimeFactory() : resImage( 0 )
{
setFilePath( Global::helpPath() );
setExtensionType( "html", "text/html;charset=UTF-8" );
}
~ResourceMimeFactory() {
delete resImage;
@@ -1196,25 +1203,25 @@ bool QPEApplication::qwsEventFilter( QWSEvent * e )
/*!
Destroys the QPEApplication.
*/
QPEApplication::~QPEApplication()
{
ungrabKeyboard();
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
// Need to delete QCopChannels early, since the display will
// be gone by the time we get to ~QObject().
delete sysChannel;
delete pidChannel;
#endif
-
+ delete d->RoH;
delete d;
}
/*!
Returns <tt>$OPIEDIR/</tt>.
*/
QString QPEApplication::qpeDir()
{
const char * base = getenv( "OPIEDIR" );
if ( base )
return QString( base ) + "/";
@@ -2014,41 +2021,59 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e )
{
if ( !o->isWidgetType() )
return FALSE;
if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) {
QMouseEvent * me = ( QMouseEvent* ) e;
StylusMode mode = (StylusMode)(int)stylusDict->find(o);
switch (mode) {
case RightOnHold:
switch ( me->type() ) {
case QEvent::MouseButtonPress:
if ( me->button() == LeftButton ) {
- if (!d->presstimer )
- d->presstimer = startTimer(500); // #### pref.
d->presswidget = (QWidget*)o;
d->presspos = me->pos();
d->rightpressed = FALSE;
+ // just for the time being
+ static int pref = 500;
+#ifdef WITHROHFEEDBACK
+ if( ! d->RoH )
+ d->RoH = new Opie::Internal::RoHFeedback;
+
+ d->RoH->init( me->globalPos(), d->presswidget );
+ pref = d->RoH->delay();
+#endif
+ if (!d->presstimer )
+ d->presstimer = startTimer( pref ); // #### pref.
+
}
break;
case QEvent::MouseMove:
if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) {
killTimer(d->presstimer);
+#ifdef WITHROHFEEDBACK
+ if( d->RoH )
+ d->RoH->stop( );
+#endif
d->presstimer = 0;
}
break;
case QEvent::MouseButtonRelease:
if ( me->button() == LeftButton ) {
if ( d->presstimer ) {
killTimer(d->presstimer);
+#ifdef WITHROHFEEDBACK
+ if( d->RoH )
+ d->RoH->stop( );
+#endif
d->presstimer = 0;
}
if ( d->rightpressed && d->presswidget ) {
// Right released
postEvent( d->presswidget,
new QMouseEvent( QEvent::MouseButtonRelease, me->pos(),
RightButton, LeftButton + RightButton ) );
// Left released, off-widget
postEvent( d->presswidget,
new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1),
LeftButton, LeftButton ) );
postEvent( d->presswidget,
@@ -2084,24 +2109,25 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e )
\reimp
*/
void QPEApplication::timerEvent( QTimerEvent *e )
{
if ( e->timerId() == d->presstimer && d->presswidget ) {
// Right pressed
postEvent( d->presswidget,
new QMouseEvent( QEvent::MouseButtonPress, d->presspos,
RightButton, LeftButton ) );
killTimer( d->presstimer );
d->presstimer = 0;
d->rightpressed = TRUE;
+ d->RoH->stop();
}
}
void QPEApplication::removeSenderFromStylusDict()
{
stylusDict->remove
( ( void* ) sender() );
if ( d->presswidget == sender() )
d->presswidget = 0;
}
/*!