summaryrefslogtreecommitdiff
path: root/noncore
authorllornkcor <llornkcor>2002-11-20 16:53:04 (UTC)
committer llornkcor <llornkcor>2002-11-20 16:53:04 (UTC)
commit95f1c2be3c6de39935f0b0b8ac19046c5ef29fb5 (patch) (unidiff)
tree4cc9020584b4c377f7bdf6210f40b6a18c451628 /noncore
parentf028217d1bae612e6e88b34f640e4fe4dd020a5a (diff)
downloadopie-95f1c2be3c6de39935f0b0b8ac19046c5ef29fb5.zip
opie-95f1c2be3c6de39935f0b0b8ac19046c5ef29fb5.tar.gz
opie-95f1c2be3c6de39935f0b0b8ac19046c5ef29fb5.tar.bz2
simpler char * to thread
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp
index 0d90d0f..5ddf03c 100644
--- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp
+++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp
@@ -35,30 +35,32 @@
35 35
36extern "C" { 36extern "C" {
37#include "libstocks/stocks.h" 37#include "libstocks/stocks.h"
38} 38}
39 39
40#include <pthread.h> 40#include <pthread.h>
41 41
42#include "stocktickerpluginwidget.h" 42#include "stocktickerpluginwidget.h"
43 43
44QString output; 44QString output;
45OTicker *stocktickerTicker; 45OTicker *stocktickerTicker;
46 46
47void getStocks( const QString *blah) { 47void getStocks( const char *blah) {
48 48
49// stocktickerTicker->setText( "Downloading stock data."); 49// stocktickerTicker->setText( "Downloading stock data.");
50 stock *stocks_quotes=NULL; 50 stock *stocks_quotes=NULL;
51 stock *stocks_tmp; 51 stock *stocks_tmp;
52 qDebug("%s", blah->latin1()); 52 char *stock_liste = blah;
53 // char *stock_liste = (char *)blah->latin1();
54 qDebug("%s", stock_liste );
53 QString tempString; 55 QString tempString;
54 output = ""; 56 output = "";
55 57
56 libstocks_return_code error; 58 libstocks_return_code error;
57 59
58 Config cfg( "stockticker"); 60 Config cfg( "stockticker");
59 cfg.setGroup( "Fields" ); 61 cfg.setGroup( "Fields" );
60 bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; 62 bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck;
61 bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck; 63 bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck;
62 bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck; 64 bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck;
63 65
64 dotimeCheck=dodateCheck=dosymbolCheck=donameCheck= docurrentPriceCheck=dolastPriceCheck=doopenPriceCheck=dominPriceCheck=domaxPriceCheck=dovariationCheck=dovolumeCheck=false; 66 dotimeCheck=dodateCheck=dosymbolCheck=donameCheck= docurrentPriceCheck=dolastPriceCheck=doopenPriceCheck=dominPriceCheck=domaxPriceCheck=dovariationCheck=dovolumeCheck=false;
@@ -87,25 +89,24 @@ void getStocks( const QString *blah) {
87 /* printf("proxy set\n"); */ 89 /* printf("proxy set\n"); */
88 error = set_proxy(proxy); 90 error = set_proxy(proxy);
89 if (error) { 91 if (error) {
90 printf("Proxy error (%d)\n", error); 92 printf("Proxy error (%d)\n", error);
91 QString tempString; 93 QString tempString;
92 tempString.sprintf("Proxy error (%d)\n", error); 94 tempString.sprintf("Proxy error (%d)\n", error);
93 output = tempString; 95 output = tempString;
94 return; 96 return;
95// exit(1); 97// exit(1);
96 } 98 }
97 } 99 }
98 } 100 }
99 char *stock_liste = (char *)blah->latin1();
100// char *stock_liste = (char *)blah; 101// char *stock_liste = (char *)blah;
101 /* Get the stocks and process errors */ 102 /* Get the stocks and process errors */
102 error = get_stocks( stock_liste, &stocks_quotes); 103 error = get_stocks( stock_liste, &stocks_quotes);
103 104
104 if (error) { 105 if (error) {
105 printf("Error in getting stocks (%d)\n", error); 106 printf("Error in getting stocks (%d)\n", error);
106 tempString.sprintf("Error in getting stocks (%d)\n", error); 107 tempString.sprintf("Error in getting stocks (%d)\n", error);
107 output =tempString; 108 output =tempString;
108 return; 109 return;
109// exit(1); 110// exit(1);
110 } 111 }
111 112
@@ -242,25 +243,26 @@ void StockTickerPluginWidget::doStocks() {
242 Config cfg( "stockticker"); 243 Config cfg( "stockticker");
243 cfg.setGroup( "Symbols" ); 244 cfg.setGroup( "Symbols" );
244 symbollist=""; 245 symbollist="";
245 symbollist = cfg.readEntry("Symbols", ""); 246 symbollist = cfg.readEntry("Symbols", "");
246 symbollist.replace(QRegExp(" "),"+");//seperated by + 247 symbollist.replace(QRegExp(" "),"+");//seperated by +
247 248
248 cfg.setGroup("Timer"); 249 cfg.setGroup("Timer");
249 stocktickerTicker->setUpdateTime( cfg.readNumEntry("ScrollSpeed",50)); 250 stocktickerTicker->setUpdateTime( cfg.readNumEntry("ScrollSpeed",50));
250 stocktickerTicker->setScrollLength( cfg.readNumEntry("ScrollLength",10)); 251 stocktickerTicker->setScrollLength( cfg.readNumEntry("ScrollLength",10));
251 252
252 if (!symbollist.isEmpty()) { 253 if (!symbollist.isEmpty()) {
253 pthread_t thread1; 254 pthread_t thread1;
254 pthread_create(&thread1,NULL, (void * (*)(void *))getStocks, &symbollist); 255 char *blah = symbollist.latin1();
256 pthread_create(&thread1,NULL, (void * (*)(void *))getStocks, blah);
255 } 257 }
256} 258}
257 259
258void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) { 260void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) {
259 killTimer(e->timerId()); 261 killTimer(e->timerId());
260 checkConnection(); 262 checkConnection();
261} 263}
262 264
263void StockTickerPluginWidget::checkConnection() { 265void StockTickerPluginWidget::checkConnection() {
264// qDebug("checking connection"); 266// qDebug("checking connection");
265// Sock = new QSocket( this ); 267// Sock = new QSocket( this );
266 268