summaryrefslogtreecommitdiff
path: root/core/settings/citytime/stylusnormalizer.cpp
Unidiff
Diffstat (limited to 'core/settings/citytime/stylusnormalizer.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/settings/citytime/stylusnormalizer.cpp1
1 files changed, 0 insertions, 1 deletions
diff --git a/core/settings/citytime/stylusnormalizer.cpp b/core/settings/citytime/stylusnormalizer.cpp
index c6c65d2..281a0bc 100644
--- a/core/settings/citytime/stylusnormalizer.cpp
+++ b/core/settings/citytime/stylusnormalizer.cpp
@@ -1,69 +1,68 @@
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 <qpoint.h>
22#include <qtimer.h> 21#include <qtimer.h>
23 22
24#include "stylusnormalizer.h" 23#include "stylusnormalizer.h"
25 24
26static const int FLUSHTIME = 100; 25static const int FLUSHTIME = 100;
27 26
28_StylusEvent::_StylusEvent( const QPoint& newPt ) 27_StylusEvent::_StylusEvent( const QPoint& newPt )
29 : _pt( newPt ), 28 : _pt( newPt ),
30 _t( QTime::currentTime() ) 29 _t( QTime::currentTime() )
31{ 30{
32} 31}
33 32
34_StylusEvent::~_StylusEvent() 33_StylusEvent::~_StylusEvent()
35{ 34{
36} 35}
37 36
38StylusNormalizer::StylusNormalizer( QWidget *parent, const char* name ) 37StylusNormalizer::StylusNormalizer( QWidget *parent, const char* name )
39 : QWidget( parent, name ), 38 : QWidget( parent, name ),
40 _next( 0 ), 39 _next( 0 ),
41 bFirst( true ) 40 bFirst( true )
42{ 41{
43 // initialize _ptList 42 // initialize _ptList
44 int i; 43 int i;
45 for (i = 0; i < SAMPLES; i++ ) { 44 for (i = 0; i < SAMPLES; i++ ) {
46 _ptList[i].setPoint( -1, -1 ); 45 _ptList[i].setPoint( -1, -1 );
47 } 46 }
48 _tExpire = new QTimer( this ); 47 _tExpire = new QTimer( this );
49 QObject::connect( _tExpire, SIGNAL( timeout() ), 48 QObject::connect( _tExpire, SIGNAL( timeout() ),
50 this, SLOT( slotAveragePoint() ) ); 49 this, SLOT( slotAveragePoint() ) );
51} 50}
52 51
53StylusNormalizer::~StylusNormalizer() 52StylusNormalizer::~StylusNormalizer()
54{ 53{
55} 54}
56 55
57void StylusNormalizer::addEvent( const QPoint& pt ) 56void StylusNormalizer::addEvent( const QPoint& pt )
58{ 57{
59 _ptList[_next].setPoint( pt ); 58 _ptList[_next].setPoint( pt );
60 _ptList[_next++].setTime( QTime::currentTime() ); 59 _ptList[_next++].setTime( QTime::currentTime() );
61 if ( _next >= SAMPLES ) { 60 if ( _next >= SAMPLES ) {
62 _next = 0; 61 _next = 0;
63 } 62 }
64 // make a single mouse click work 63 // make a single mouse click work
65 if ( bFirst ) { 64 if ( bFirst ) {
66 slotAveragePoint(); 65 slotAveragePoint();
67 bFirst = false; 66 bFirst = false;
68 } 67 }
69} 68}