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 | |||
@@ -1,27 +1,27 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG -= moc | 2 | CONFIG -= moc |
3 | CONFIG += qt debug | 3 | CONFIG += qt debug |
4 | 4 | ||
5 | HEADERS = stocktickerplugin.h stocktickeruginimpl.h stocktickerpluginwidget.h ticker.h stocktickerconfig.h \ | 5 | HEADERS = 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 |
10 | SOURCES = stocktickerplugin.cpp stocktickerpluginimpl.cpp stocktickerpluginwidget.cpp ticker.cpp stocktickerconfig.cpp \ | 10 | SOURCES = 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 \ |
14 | ../libstocks/http.c \ | 14 | ../libstocks/http.c \ |
15 | ../libstocks/lists.c \ | 15 | ../libstocks/lists.c \ |
16 | ../libstocks/stocks.c | 16 | ../libstocks/stocks.c |
17 | 17 | ||
18 | INCLUDEPATH += $(OPIEDIR)/include \ | 18 | INCLUDEPATH += $(OPIEDIR)/include \ |
19 | ../ ../library | 19 | ../ ../library |
20 | DEPENDPATH += $(OPIEDIR)/include \ | 20 | DEPENDPATH += $(OPIEDIR)/include \ |
21 | ../ ../library | 21 | ../ ../library |
22 | 22 | ||
23 | LIBS+= -lqpe -lopie | 23 | LIBS+= -lqpe -lopie |
24 | TMAKE_CFLAGS += -D__UNIX__ | 24 | TMAKE_CFLAGS += -D__UNIX__ |
25 | 25 | ||
26 | DESTDIR = $(OPIEDIR)/plugins/today | 26 | DESTDIR = $(OPIEDIR)/plugins/today |
27 | TARGET = todaystocktickerplugin | 27 | TARGET = todaystocktickerplugin |
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 | |||
@@ -1,100 +1,94 @@ | |||
1 | /* | 1 | /* |
2 | * stocktickerpluginwidget.cpp | 2 | * stocktickerpluginwidget.cpp |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by L.J. Potter | 4 | * copyright : (c) 2002 by L.J. Potter |
5 | * email : llornkcor@handhelds.org | 5 | * email : llornkcor@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | #include <qvaluelist.h> | 17 | #include <qvaluelist.h> |
18 | #include <qtl.h> | 18 | #include <qtl.h> |
19 | #include <qstring.h> | 19 | #include <qstring.h> |
20 | #include <qstringlist.h> | 20 | #include <qstringlist.h> |
21 | #include <qobject.h> | 21 | #include <qobject.h> |
22 | #include <qlayout.h> | 22 | #include <qlayout.h> |
23 | #include <qlineedit.h> | 23 | #include <qlineedit.h> |
24 | #include <qregexp.h> | 24 | #include <qregexp.h> |
25 | #include <qtimer.h> | 25 | #include <qtimer.h> |
26 | 26 | ||
27 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
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 | ||
33 | extern "C" { | 34 | extern "C" { |
34 | #include "libstocks/stocks.h" | 35 | #include "libstocks/stocks.h" |
35 | } | 36 | } |
36 | 37 | ||
37 | #include "stocktickerpluginwidget.h" | 38 | #include "stocktickerpluginwidget.h" |
38 | 39 | ||
39 | StockTickerPluginWidget::StockTickerPluginWidget( QWidget *parent, const char* name) | 40 | StockTickerPluginWidget::StockTickerPluginWidget( QWidget *parent, const char* name) |
40 | : QWidget(parent, name ) { | 41 | : QWidget(parent, name ) { |
41 | init(); | 42 | init(); |
42 | startTimer(1000); | 43 | startTimer(1000); |
43 | } | 44 | } |
44 | 45 | ||
45 | StockTickerPluginWidget::~StockTickerPluginWidget() { | 46 | StockTickerPluginWidget::~StockTickerPluginWidget() { |
46 | } | 47 | } |
47 | 48 | ||
48 | void StockTickerPluginWidget::init() { | 49 | 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 | ||
66 | void StockTickerPluginWidget::doStocks() { | 61 | void 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", ""); |
72 | symbollist.replace(QRegExp(" "),"+");//seperated by + | 66 | symbollist.replace(QRegExp(" "),"+");//seperated by + |
73 | // qDebug(symbollist); | 67 | // qDebug(symbollist); |
74 | 68 | ||
75 | getStocks( symbollist.latin1()); | 69 | getStocks( symbollist.latin1()); |
76 | 70 | ||
77 | stocktickerTicker->setText( output ); | 71 | stocktickerTicker->setText( output ); |
78 | } | 72 | } |
79 | 73 | ||
80 | void StockTickerPluginWidget::getStocks( const char *blah) { | 74 | void StockTickerPluginWidget::getStocks( const char *blah) { |
81 | 75 | ||
82 | stock *stocks_quotes=NULL; | 76 | stock *stocks_quotes=NULL; |
83 | stock *stocks_tmp; | 77 | stock *stocks_tmp; |
84 | 78 | ||
85 | QString tempString; | 79 | QString tempString; |
86 | output = ""; | 80 | output = ""; |
87 | 81 | ||
88 | libstocks_return_code error; | 82 | libstocks_return_code error; |
89 | 83 | ||
90 | Config cfg( "stockticker"); | 84 | Config cfg( "stockticker"); |
91 | cfg.setGroup( "Fields" ); | 85 | cfg.setGroup( "Fields" ); |
92 | bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; | 86 | bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; |
93 | bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck; | 87 | bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck; |
94 | bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck; | 88 | bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck; |
95 | 89 | ||
96 | dotimeCheck=dodateCheck=dosymbolCheck=donameCheck= docurrentPriceCheck=dolastPriceCheck=doopenPriceCheck=dominPriceCheck=domaxPriceCheck=dovariationCheck=dovolumeCheck=false; | 90 | dotimeCheck=dodateCheck=dosymbolCheck=donameCheck= docurrentPriceCheck=dolastPriceCheck=doopenPriceCheck=dominPriceCheck=domaxPriceCheck=dovariationCheck=dovolumeCheck=false; |
97 | 91 | ||
98 | dotimeCheck=cfg.readBoolEntry("timeCheck",1); | 92 | dotimeCheck=cfg.readBoolEntry("timeCheck",1); |
99 | dodateCheck=cfg.readBoolEntry("dateCheck",1); | 93 | dodateCheck=cfg.readBoolEntry("dateCheck",1); |
100 | dosymbolCheck=cfg.readBoolEntry("symbolCheck",1); | 94 | dosymbolCheck=cfg.readBoolEntry("symbolCheck",1); |
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 | |||
@@ -1,64 +1,65 @@ | |||
1 | /* | 1 | /* |
2 | * stocktickerpluginwidget.h | 2 | * stocktickerpluginwidget.h |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by L.J. Potter | 4 | * copyright : (c) 2002 by L.J. Potter |
5 | * email : lornkcor@handhelds.org | 5 | * email : lornkcor@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | 17 | ||
18 | #ifndef STOCKTICKERL_PLUGIN_WIDGET_H | 18 | #ifndef STOCKTICKERL_PLUGIN_WIDGET_H |
19 | #define STOCKTICKERL_PLUGIN_WIDGET_H | 19 | #define STOCKTICKERL_PLUGIN_WIDGET_H |
20 | 20 | ||
21 | #include <qstring.h> | 21 | #include <qstring.h> |
22 | #include <qwidget.h> | 22 | #include <qwidget.h> |
23 | #include <qlineedit.h> | 23 | #include <qlineedit.h> |
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> |
30 | #include <unistd.h> | 31 | #include <unistd.h> |
31 | #include <stdio.h> | 32 | #include <stdio.h> |
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" */ |
39 | /* } */ | 40 | /* } */ |
40 | 41 | ||
41 | class QTimer; | 42 | class QTimer; |
42 | 43 | ||
43 | class StockTickerPluginWidget : public QWidget { | 44 | class StockTickerPluginWidget : public QWidget { |
44 | 45 | ||
45 | Q_OBJECT | 46 | Q_OBJECT |
46 | 47 | ||
47 | public: | 48 | public: |
48 | StockTickerPluginWidget( QWidget *parent, const char *name ); | 49 | StockTickerPluginWidget( QWidget *parent, const char *name ); |
49 | ~StockTickerPluginWidget(); | 50 | ~StockTickerPluginWidget(); |
50 | QString output; | 51 | QString output; |
51 | 52 | ||
52 | protected slots: | 53 | protected slots: |
53 | void doStocks(); | 54 | void doStocks(); |
54 | 55 | ||
55 | private: | 56 | private: |
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); |
60 | void DefProxy(void); | 61 | void DefProxy(void); |
61 | int timerDelay; | 62 | int timerDelay; |
62 | }; | 63 | }; |
63 | 64 | ||
64 | #endif | 65 | #endif |
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 | |||
50 | Ticker::Ticker( QWidget* parent=0 ) : QFrame( parent ) { | ||
51 | setFrameStyle( NoFrame/*WinPanel | Sunken */); | ||
52 | } | ||
53 | |||
54 | Ticker::~Ticker() { | ||
55 | } | ||
56 | |||
57 | void 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 | |||
82 | void Ticker::timerEvent( QTimerEvent * ) { | ||
83 | pos = ( pos <= 0 ) ? scrollTextPixmap.width() : pos - 1; | ||
84 | repaint( FALSE ); | ||
85 | } | ||
86 | |||
87 | void 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 | |||
94 | void 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 | |||
13 | class Ticker : public QFrame { | ||
14 | Q_OBJECT | ||
15 | |||
16 | public: | ||
17 | Ticker( QWidget* parent=0 ); | ||
18 | ~Ticker(); | ||
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 | ||