author | llornkcor <llornkcor> | 2002-11-20 16:53:04 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-11-20 16:53:04 (UTC) |
commit | 95f1c2be3c6de39935f0b0b8ac19046c5ef29fb5 (patch) (side-by-side diff) | |
tree | 4cc9020584b4c377f7bdf6210f40b6a18c451628 | |
parent | f028217d1bae612e6e88b34f640e4fe4dd020a5a (diff) | |
download | opie-95f1c2be3c6de39935f0b0b8ac19046c5ef29fb5.zip opie-95f1c2be3c6de39935f0b0b8ac19046c5ef29fb5.tar.gz opie-95f1c2be3c6de39935f0b0b8ac19046c5ef29fb5.tar.bz2 |
simpler char * to thread
-rw-r--r-- | noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp | 10 |
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 @@ -23,101 +23,102 @@ #include <qlayout.h> #include <qlineedit.h> #include <qregexp.h> #include <qtimer.h> #include <qmessagebox.h> #include <qpe/config.h> #include <qpe/timestring.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/network.h> #include <opie/oticker.h> extern "C" { #include "libstocks/stocks.h" } #include <pthread.h> #include "stocktickerpluginwidget.h" QString output; OTicker *stocktickerTicker; -void getStocks( const QString *blah) { +void getStocks( const char *blah) { // stocktickerTicker->setText( "Downloading stock data."); stock *stocks_quotes=NULL; stock *stocks_tmp; - qDebug("%s", blah->latin1()); + char *stock_liste = blah; + // char *stock_liste = (char *)blah->latin1(); + qDebug("%s", stock_liste ); QString tempString; output = ""; libstocks_return_code error; Config cfg( "stockticker"); cfg.setGroup( "Fields" ); bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck; bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck; bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck; dotimeCheck=dodateCheck=dosymbolCheck=donameCheck= docurrentPriceCheck=dolastPriceCheck=doopenPriceCheck=dominPriceCheck=domaxPriceCheck=dovariationCheck=dovolumeCheck=false; dotimeCheck=cfg.readBoolEntry("timeCheck",1); dodateCheck=cfg.readBoolEntry("dateCheck",1); dosymbolCheck=cfg.readBoolEntry("symbolCheck",1); donameCheck=cfg.readBoolEntry("nameCheck",1); docurrentPriceCheck=cfg.readBoolEntry("currentPriceCheck",1); dolastPriceCheck=cfg.readBoolEntry("lastPriceCheck",1); doopenPriceCheck=cfg.readBoolEntry("openPriceCheck",1); dominPriceCheck=cfg.readBoolEntry("minPriceCheck",1); domaxPriceCheck=cfg.readBoolEntry("maxPriceCheck",1); dovariationCheck=cfg.readBoolEntry("variationCheck",1); dovolumeCheck=cfg.readBoolEntry("volumeCheck",1); // DefProxy(); { char *proxy; libstocks_return_code error; /* Proxy support */ /* Checks for "http_proxy" environment variable */ proxy = getenv("http_proxy"); if(proxy) { /* printf("proxy set\n"); */ error = set_proxy(proxy); if (error) { printf("Proxy error (%d)\n", error); QString tempString; tempString.sprintf("Proxy error (%d)\n", error); output = tempString; return; // exit(1); } } } - char *stock_liste = (char *)blah->latin1(); // char *stock_liste = (char *)blah; /* Get the stocks and process errors */ error = get_stocks( stock_liste, &stocks_quotes); if (error) { printf("Error in getting stocks (%d)\n", error); tempString.sprintf("Error in getting stocks (%d)\n", error); output =tempString; return; // exit(1); } stocks_tmp = stocks_quotes; /* Displays the stocks */ while(stocks_tmp!=0){ if (stocks_tmp->Time) { // printf("%s ", stocks_tmp->Time); tempString.sprintf("| %s ", stocks_tmp->Time); tempString.replace(QRegExp("\""),""); if( dotimeCheck) output +=tempString; } @@ -230,49 +231,50 @@ StockTickerPluginWidget::~StockTickerPluginWidget() { void StockTickerPluginWidget::init() { QHBoxLayout* layout = new QHBoxLayout( this ); stocktickerTicker = new OTicker(this); // stocktickerTicker->setMinimumHeight(15); connect( stocktickerTicker, SIGNAL( mousePressed()), this, SLOT( checkConnection() )); layout->addWidget( stocktickerTicker); wasError = true; } void StockTickerPluginWidget::doStocks() { Config cfg( "stockticker"); cfg.setGroup( "Symbols" ); symbollist=""; symbollist = cfg.readEntry("Symbols", ""); symbollist.replace(QRegExp(" "),"+");//seperated by + cfg.setGroup("Timer"); stocktickerTicker->setUpdateTime( cfg.readNumEntry("ScrollSpeed",50)); stocktickerTicker->setScrollLength( cfg.readNumEntry("ScrollLength",10)); if (!symbollist.isEmpty()) { pthread_t thread1; - pthread_create(&thread1,NULL, (void * (*)(void *))getStocks, &symbollist); + char *blah = symbollist.latin1(); + pthread_create(&thread1,NULL, (void * (*)(void *))getStocks, blah); } } void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) { killTimer(e->timerId()); checkConnection(); } void StockTickerPluginWidget::checkConnection() { // qDebug("checking connection"); // Sock = new QSocket( this ); // if( wasError) // stocktickerTicker->setText("Checking connection"); // if(Sock->state() == QSocket::Idle) { // Sock->connectToHost("finance.yahoo.com", 80); // connect( Sock, SIGNAL( error(int) ), SLOT(socketError(int)) ); // connect( Sock, SIGNAL( hostFound() ), SLOT(isConnected()) ); // } else { // qDebug("State is not Idle"); isConnected(); // } } |