author | llornkcor <llornkcor> | 2002-11-03 19:44:54 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-11-03 19:44:54 (UTC) |
commit | 88539c74ca4a6b6699df2b050a498a81d22a0793 (patch) (unidiff) | |
tree | c3ce1f6fc5107d16513e0009d41e64494a280d6e /libopie | |
parent | 7d282e8e721d4c7c71a6d308d082da7138139484 (diff) | |
download | opie-88539c74ca4a6b6699df2b050a498a81d22a0793.zip opie-88539c74ca4a6b6699df2b050a498a81d22a0793.tar.gz opie-88539c74ca4a6b6699df2b050a498a81d22a0793.tar.bz2 |
add oticker
-rw-r--r-- | libopie/libopie.pro | 30 | ||||
-rw-r--r-- | libopie/oticker.cpp | 94 | ||||
-rw-r--r-- | libopie/oticker.h | 32 |
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 | |||
@@ -1,79 +1,81 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qte warn_on release | 2 | CONFIG += qte warn_on release |
3 | HEADERS = ofontmenu.h \ | 3 | HEADERS = ofontmenu.h \ |
4 | ocolorbutton.h \ | 4 | ocolorbutton.h \ |
5 | ofiledialog.h ofileselector.h tododb.h \ | 5 | ofiledialog.h ofileselector.h tododb.h \ |
6 | ocheckitem.h todoevent.h todoresource.h \ | 6 | ocheckitem.h todoevent.h todoresource.h \ |
7 | todovcalresource.h xmltree.h \ | 7 | todovcalresource.h xmltree.h \ |
8 | colordialog.h colorpopupmenu.h \ | 8 | colordialog.h colorpopupmenu.h \ |
9 | oclickablelabel.h oprocctrl.h \ | 9 | oclickablelabel.h oprocctrl.h \ |
10 | oprocess.h odevice.h \ | 10 | oprocess.h odevice.h \ |
11 | otimepicker.h otabwidget.h \ | 11 | otimepicker.h otabwidget.h \ |
12 | otabbar.h otabinfo.h \ | 12 | otabbar.h otabinfo.h \ |
13 | ofontselector.h \ | 13 | ofontselector.h \ |
14 | pim/opimrecord.h \ | 14 | pim/opimrecord.h \ |
15 | pim/otodo.h \ | 15 | pim/otodo.h \ |
16 | pim/orecordlist.h \ | 16 | pim/orecordlist.h \ |
17 | pim/opimaccesstemplate.h \ | 17 | pim/opimaccesstemplate.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 | ||
33 | SOURCES = ofontmenu.cc \ | 34 | SOURCES = 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 | ||
57 | TARGET = opie | 59 | TARGET = opie |
58 | INCLUDEPATH += $(OPIEDIR)/include | 60 | INCLUDEPATH += $(OPIEDIR)/include |
59 | DESTDIR = $(QTDIR)/lib$(PROJMAK) | 61 | DESTDIR = $(QTDIR)/lib$(PROJMAK) |
60 | #VERSION = 1.0.0 | 62 | #VERSION = 1.0.0 |
61 | 63 | ||
62 | # LIBS += -lopiesql | 64 | # LIBS += -lopiesql |
63 | 65 | ||
64 | INTERFACES = otimepickerbase.ui orecurrancebase.ui | 66 | INTERFACES = otimepickerbase.ui orecurrancebase.ui |
65 | 67 | ||
66 | TRANSLATIONS = ../i18n/de/libopie.ts \ | 68 | TRANSLATIONS = ../i18n/de/libopie.ts \ |
67 | ../i18n/en/libopie.ts \ | 69 | ../i18n/en/libopie.ts \ |
68 | ../i18n/es/libopie.ts \ | 70 | ../i18n/es/libopie.ts \ |
69 | ../i18n/fr/libopie.ts \ | 71 | ../i18n/fr/libopie.ts \ |
70 | ../i18n/hu/libopie.ts \ | 72 | ../i18n/hu/libopie.ts \ |
71 | ../i18n/ja/libopie.ts \ | 73 | ../i18n/ja/libopie.ts \ |
72 | ../i18n/ko/libopie.ts \ | 74 | ../i18n/ko/libopie.ts \ |
73 | ../i18n/no/libopie.ts \ | 75 | ../i18n/no/libopie.ts \ |
74 | ../i18n/pl/libopie.ts \ | 76 | ../i18n/pl/libopie.ts \ |
75 | ../i18n/pt/libopie.ts \ | 77 | ../i18n/pt/libopie.ts \ |
76 | ../i18n/pt_BR/libopie.ts \ | 78 | ../i18n/pt_BR/libopie.ts \ |
77 | ../i18n/sl/libopie.ts \ | 79 | ../i18n/sl/libopie.ts \ |
78 | ../i18n/zh_CN/libopie.ts \ | 80 | ../i18n/zh_CN/libopie.ts \ |
79 | ../i18n/zh_TW/libopie.ts | 81 | ../i18n/zh_TW/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 | |||
47 | OTicker::OTicker( QWidget* parent=0 ) : QFrame( parent ) { | ||
48 | setFrameStyle( NoFrame/*WinPanel | Sunken */); | ||
49 | } | ||
50 | |||
51 | OTicker::~OTicker() { | ||
52 | } | ||
53 | |||
54 | void 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 | |||
79 | void OTicker::timerEvent( QTimerEvent * ) { | ||
80 | pos = ( pos <= 0 ) ? scrollTextPixmap.width() : pos - 1; | ||
81 | repaint( FALSE ); | ||
82 | } | ||
83 | |||
84 | void 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 | |||
91 | void 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 | |||
13 | class OTicker : public QFrame { | ||
14 | Q_OBJECT | ||
15 | |||
16 | public: | ||
17 | OTicker( QWidget* parent=0 ); | ||
18 | ~OTicker(); | ||
19 | void setText( const QString& text ) ; | ||
20 | signals: | ||
21 | void mousePressed(); | ||
22 | protected: | ||
23 | void timerEvent( QTimerEvent * ); | ||
24 | void drawContents( QPainter *p ); | ||
25 | void mouseReleaseEvent ( QMouseEvent *); | ||
26 | private: | ||
27 | QString scrollText; | ||
28 | QPixmap scrollTextPixmap; | ||
29 | int pos;//, pixelLen; | ||
30 | }; | ||
31 | |||
32 | #endif | ||