summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/libopie.pro30
-rw-r--r--libopie/oticker.cpp94
-rw-r--r--libopie/oticker.h32
3 files changed, 142 insertions, 14 deletions
diff --git a/libopie/libopie.pro b/libopie/libopie.pro
index f46a0b2..1787039 100644
--- a/libopie/libopie.pro
+++ b/libopie/libopie.pro
@@ -18,49 +18,51 @@ HEADERS = ofontmenu.h \
18 pim/opimaccessbackend.h \ 18 pim/opimaccessbackend.h \
19 pim/otodoaccess.h \ 19 pim/otodoaccess.h \
20 pim/otodacessbackend.h \ 20 pim/otodacessbackend.h \
21 pim/ocontact.h \ 21 pim/ocontact.h \
22 pim/ocontactaccess.h \ 22 pim/ocontactaccess.h \
23 pim/ocontactaccessbackend.h \ 23 pim/ocontactaccessbackend.h \
24 pim/ocontactaccessbackend_xml.h \ 24 pim/ocontactaccessbackend_xml.h \
25 pim/obackendfactory.h \ 25 pim/obackendfactory.h \
26 pim/opimcache.h \ 26 pim/opimcache.h \
27 pim/otodoaccessvcal.h \ 27 pim/otodoaccessvcal.h \
28 pim/orecur.h \ 28 pim/orecur.h \
29 pim/opimstate.h \ 29 pim/opimstate.h \
30 orecurrancewidget.h 30 orecurrancewidget.h \
31 oticker.h
31# pim/otodoaccesssql.h \ 32# pim/otodoaccesssql.h \
32 33
33SOURCES = ofontmenu.cc \ 34SOURCES = ofontmenu.cc \
34 ocolorbutton.cpp \ 35 ocolorbutton.cpp \
35 xmltree.cc \ 36 xmltree.cc \
36 ofiledialog.cc ofileselector.cc \ 37 ofiledialog.cc ofileselector.cc \
37 ocheckitem.cpp tododb.cpp todoevent.cpp \ 38 ocheckitem.cpp tododb.cpp todoevent.cpp \
38 todovcalresource.cpp colordialog.cpp \ 39 todovcalresource.cpp colordialog.cpp \
39 colorpopupmenu.cpp oclickablelabel.cpp \ 40 colorpopupmenu.cpp oclickablelabel.cpp \
40 oprocctrl.cpp oprocess.cpp \ 41 oprocctrl.cpp oprocess.cpp \
41 odevice.cpp otimepicker.cpp \ 42 odevice.cpp otimepicker.cpp \
42 otabwidget.cpp otabbar.cpp \ 43 otabwidget.cpp otabbar.cpp \
43 ofontselector.cpp \ 44 ofontselector.cpp \
44 pim/otodo.cpp \ 45 pim/otodo.cpp \
45 pim/opimrecord.cpp \ 46 pim/opimrecord.cpp \
46 pim/otodoaccess.cpp \ 47 pim/otodoaccess.cpp \
47 pim/otodoaccessbackend.cpp \ 48 pim/otodoaccessbackend.cpp \
48 pim/otodoaccessxml.cpp \ 49 pim/otodoaccessxml.cpp \
49 pim/ocontact.cpp \ 50 pim/ocontact.cpp \
50 pim/ocontactaccess.cpp \ 51 pim/ocontactaccess.cpp \
51 pim/otodoaccessvcal.cpp \ 52 pim/otodoaccessvcal.cpp \
52 pim/orecur.cpp \ 53 pim/orecur.cpp \
53 pim/opimstate.cpp \ 54 pim/opimstate.cpp \
54 orecurrancewidget.cpp 55 orecurrancewidget.cpp \
56 oticker.cpp
55# pim/otodoaccesssql.cpp \ 57# pim/otodoaccesssql.cpp \
56 58
57TARGET = opie 59TARGET = opie
58INCLUDEPATH += $(OPIEDIR)/include 60INCLUDEPATH += $(OPIEDIR)/include
59DESTDIR = $(QTDIR)/lib$(PROJMAK) 61DESTDIR = $(QTDIR)/lib$(PROJMAK)
60#VERSION = 1.0.0 62#VERSION = 1.0.0
61 63
62# LIBS += -lopiesql 64# LIBS += -lopiesql
63 65
64INTERFACES = otimepickerbase.ui orecurrancebase.ui 66INTERFACES = otimepickerbase.ui orecurrancebase.ui
65 67
66TRANSLATIONS = ../i18n/de/libopie.ts \ 68TRANSLATIONS = ../i18n/de/libopie.ts \
diff --git a/libopie/oticker.cpp b/libopie/oticker.cpp
new file mode 100644
index 0000000..774a49d
--- a/dev/null
+++ b/libopie/oticker.cpp
@@ -0,0 +1,94 @@
1/*
2                This file is part of the Opie Project
3 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
4 =.
5 .=l.
6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU General Public
10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details.
21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28
29*/
30
31#include <qpe/qpeapplication.h>
32#include <qpe/resource.h>
33#include <qpe/config.h>
34
35#include <qwidget.h>
36#include <qpixmap.h>
37#include <qbutton.h>
38#include <qpainter.h>
39#include <qframe.h>
40#include <qlayout.h>
41#include <qdir.h>
42#include <stdlib.h>
43#include <stdio.h>
44
45#include "oticker.h"
46
47OTicker::OTicker( QWidget* parent=0 ) : QFrame( parent ) {
48 setFrameStyle( NoFrame/*WinPanel | Sunken */);
49}
50
51OTicker::~OTicker() {
52}
53
54void OTicker::setText( const QString& text ) {
55 Config cfg("qpe");
56 cfg.setGroup("Appearance");
57
58 pos = 0; // reset it everytime the text is changed
59 scrollText = text;
60
61 int pixelLen = fontMetrics().width( text );
62 QPixmap pm( pixelLen, contentsRect().height() );
63// pm.fill( QColor( 167, 212, 167 ));
64
65 pm.fill( QColor( cfg.readEntry( "Background", "#E5E1D5" ) ));
66 QPainter pmp( &pm );
67 pmp.setPen( Qt::black );
68 pmp.drawText( 0, 0, pixelLen, contentsRect().height(), AlignVCenter, scrollText );
69 pmp.end();
70 scrollTextPixmap = pm;
71
72 killTimers();
73 if ( pixelLen > contentsRect().width() )
74 startTimer( 50 );
75 update();
76}
77
78
79void OTicker::timerEvent( QTimerEvent * ) {
80 pos = ( pos <= 0 ) ? scrollTextPixmap.width() : pos - 1;
81 repaint( FALSE );
82}
83
84void OTicker::drawContents( QPainter *p ) {
85 int pixelLen = scrollTextPixmap.width();
86 p->drawPixmap( pos, contentsRect().y(), scrollTextPixmap );
87 if ( pixelLen > contentsRect().width() ) // Scrolling
88 p->drawPixmap( pos - pixelLen, contentsRect().y(), scrollTextPixmap );
89}
90
91void OTicker::mouseReleaseEvent( QMouseEvent * e) {
92// qDebug("<<<<<<<>>>>>>>>>");
93 emit mousePressed();
94}
diff --git a/libopie/oticker.h b/libopie/oticker.h
new file mode 100644
index 0000000..4f0ed11
--- a/dev/null
+++ b/libopie/oticker.h
@@ -0,0 +1,32 @@
1#ifndef OTICKER_H
2#define OTICKER_H
3
4#include <qwidget.h>
5#include <qpainter.h>
6#include <qdrawutil.h>
7#include <qpixmap.h>
8#include <qstring.h>
9#include <qslider.h>
10#include <qframe.h>
11#include <qlineedit.h>
12
13class OTicker : public QFrame {
14 Q_OBJECT
15
16public:
17 OTicker( QWidget* parent=0 );
18 ~OTicker();
19 void setText( const QString& text ) ;
20signals:
21 void mousePressed();
22protected:
23 void timerEvent( QTimerEvent * );
24 void drawContents( QPainter *p );
25 void mouseReleaseEvent ( QMouseEvent *);
26private:
27 QString scrollText;
28 QPixmap scrollTextPixmap;
29 int pos;//, pixelLen;
30};
31
32#endif