summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-11-03 19:45:33 (UTC)
committer llornkcor <llornkcor>2002-11-03 19:45:33 (UTC)
commitfe933da66a39ae964f44d0f057fabece5bdf077b (patch) (unidiff)
tree8e2bb1cfb4f52da40da9efc8834f8967da4bf080
parent88539c74ca4a6b6699df2b050a498a81d22a0793 (diff)
downloadopie-fe933da66a39ae964f44d0f057fabece5bdf077b.zip
opie-fe933da66a39ae964f44d0f057fabece5bdf077b.tar.gz
opie-fe933da66a39ae964f44d0f057fabece5bdf077b.tar.bz2
moved ticker to oticker
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro4
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp12
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h5
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/ticker.cpp97
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/ticker.h32
5 files changed, 8 insertions, 142 deletions
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro
index 5281373..4b7b177 100644
--- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro
+++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro
@@ -2,12 +2,12 @@ TEMPLATE = lib
2CONFIG -= moc 2CONFIG -= moc
3CONFIG += qt debug 3CONFIG += qt debug
4 4
5HEADERS = stocktickerplugin.h stocktickeruginimpl.h stocktickerpluginwidget.h ticker.h stocktickerconfig.h \ 5HEADERS = stocktickerplugin.h stocktickeruginimpl.h stocktickerpluginwidget.h stocktickerconfig.h \
6 ../libstocks/csv.h \ 6 ../libstocks/csv.h \
7 ../libstocks/http.h \ 7 ../libstocks/http.h \
8 ../libstocks/lists.h \ 8 ../libstocks/lists.h \
9 ../libstocks/stocks.h 9 ../libstocks/stocks.h
10SOURCES = stocktickerplugin.cpp stocktickerpluginimpl.cpp stocktickerpluginwidget.cpp ticker.cpp stocktickerconfig.cpp \ 10SOURCES = stocktickerplugin.cpp stocktickerpluginimpl.cpp stocktickerpluginwidget.cpp stocktickerconfig.cpp \
11 ../libstocks/csv.c \ 11 ../libstocks/csv.c \
12 ../libstocks/currency.c \ 12 ../libstocks/currency.c \
13 ../libstocks/history.c \ 13 ../libstocks/history.c \
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp
index a7f98be..8830472 100644
--- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp
+++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp
@@ -28,7 +28,8 @@
28#include <qpe/timestring.h> 28#include <qpe/timestring.h>
29#include <qpe/qcopenvelope_qws.h> 29#include <qpe/qcopenvelope_qws.h>
30 30
31#include "ticker.h" 31#include <opie/oticker.h>
32//#include "ticker.h"
32 33
33extern "C" { 34extern "C" {
34#include "libstocks/stocks.h" 35#include "libstocks/stocks.h"
@@ -49,23 +50,16 @@ void StockTickerPluginWidget::init() {
49 50
50 QHBoxLayout* layout = new QHBoxLayout( this ); 51 QHBoxLayout* layout = new QHBoxLayout( this );
51 52
52 stocktickerTicker = new Ticker(this); 53 stocktickerTicker = new OTicker(this);
53 stocktickerTicker->setMinimumHeight(15); 54 stocktickerTicker->setMinimumHeight(15);
54 connect( stocktickerTicker, SIGNAL( mousePressed()), this, SLOT( doStocks() )); 55 connect( stocktickerTicker, SIGNAL( mousePressed()), this, SLOT( doStocks() ));
55 56
56 layout->addWidget( stocktickerTicker); 57 layout->addWidget( stocktickerTicker);
57// Config cfg( "stockticker");
58// cfg.setGroup("Timer");
59// timerDelay= cfg.readNumEntry("Delay",0);
60// if(timerDelay > 0 )
61// startTimer(timerDelay*60000);
62// qDebug("timer ^ set for %d",(timerDelay*60000)/60000);
63 58
64} 59}
65 60
66void StockTickerPluginWidget::doStocks() { 61void StockTickerPluginWidget::doStocks() {
67 Config cfg( "stockticker"); 62 Config cfg( "stockticker");
68
69 cfg.setGroup( "Symbols" ); 63 cfg.setGroup( "Symbols" );
70 QString symbollist; 64 QString symbollist;
71 symbollist = cfg.readEntry("Symbols", ""); 65 symbollist = cfg.readEntry("Symbols", "");
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h
index 8f3441d..26472fa 100644
--- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h
+++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h
@@ -24,6 +24,7 @@
24 24
25#include <opie/tododb.h> 25#include <opie/tododb.h>
26#include <opie/oclickablelabel.h> 26#include <opie/oclickablelabel.h>
27#include <opie/oticker.h>
27 28
28#include <sys/types.h> 29#include <sys/types.h>
29#include <sys/uio.h> 30#include <sys/uio.h>
@@ -32,7 +33,7 @@
32#include <stdlib.h> 33#include <stdlib.h>
33#include <string.h> 34#include <string.h>
34 35
35#include "ticker.h" 36//#include "ticker.h"
36 37
37/* extern "C" { */ 38/* extern "C" { */
38/* #include "stocks.h" */ 39/* #include "stocks.h" */
@@ -53,7 +54,7 @@ protected slots:
53 void doStocks(); 54 void doStocks();
54 55
55private: 56private:
56 Ticker *stocktickerTicker; 57 OTicker *stocktickerTicker;
57 void timerEvent( QTimerEvent * ); 58 void timerEvent( QTimerEvent * );
58 void init(); 59 void init();
59 void getStocks( const char *stock_liste); 60 void getStocks( const char *stock_liste);
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/ticker.cpp b/noncore/todayplugins/stockticker/stocktickerlib/ticker.cpp
deleted file mode 100644
index 3bdc820..0000000
--- a/noncore/todayplugins/stockticker/stocktickerlib/ticker.cpp
+++ b/dev/null
@@ -1,97 +0,0 @@
1/*
2                This file is part of the Opie Project
3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =.
8 .=l.
9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details.
24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA.
31
32*/
33
34#include <qpe/qpeapplication.h>
35#include <qpe/resource.h>
36#include <qpe/config.h>
37
38#include <qwidget.h>
39#include <qpixmap.h>
40#include <qbutton.h>
41#include <qpainter.h>
42#include <qframe.h>
43#include <qlayout.h>
44#include <qdir.h>
45#include <stdlib.h>
46#include <stdio.h>
47
48#include "ticker.h"
49
50Ticker::Ticker( QWidget* parent=0 ) : QFrame( parent ) {
51 setFrameStyle( NoFrame/*WinPanel | Sunken */);
52}
53
54Ticker::~Ticker() {
55}
56
57void Ticker::setText( const QString& text ) {
58 Config cfg("qpe");
59 cfg.setGroup("Appearance");
60
61 pos = 0; // reset it everytime the text is changed
62 scrollText = text;
63
64 int pixelLen = fontMetrics().width( text );
65 QPixmap pm( pixelLen, contentsRect().height() );
66// pm.fill( QColor( 167, 212, 167 ));
67
68 pm.fill( QColor( cfg.readEntry( "Background", "#E5E1D5" ) ));
69 QPainter pmp( &pm );
70 pmp.setPen( Qt::black );
71 pmp.drawText( 0, 0, pixelLen, contentsRect().height(), AlignVCenter, scrollText );
72 pmp.end();
73 scrollTextPixmap = pm;
74
75 killTimers();
76 if ( pixelLen > contentsRect().width() )
77 startTimer( 50 );
78 update();
79}
80
81
82void Ticker::timerEvent( QTimerEvent * ) {
83 pos = ( pos <= 0 ) ? scrollTextPixmap.width() : pos - 1;
84 repaint( FALSE );
85}
86
87void Ticker::drawContents( QPainter *p ) {
88 int pixelLen = scrollTextPixmap.width();
89 p->drawPixmap( pos, contentsRect().y(), scrollTextPixmap );
90 if ( pixelLen > contentsRect().width() ) // Scrolling
91 p->drawPixmap( pos - pixelLen, contentsRect().y(), scrollTextPixmap );
92}
93
94void Ticker::mouseReleaseEvent( QMouseEvent * e) {
95 qDebug("<<<<<<<>>>>>>>>>");
96 emit mousePressed();
97}
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/ticker.h b/noncore/todayplugins/stockticker/stocktickerlib/ticker.h
deleted file mode 100644
index 3b68928..0000000
--- a/noncore/todayplugins/stockticker/stocktickerlib/ticker.h
+++ b/dev/null
@@ -1,32 +0,0 @@
1#ifndef TICKER_H
2#define TICKER_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 Ticker : public QFrame {
14 Q_OBJECT
15
16public:
17 Ticker( QWidget* parent=0 );
18 ~Ticker();
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