Diffstat (limited to 'noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp index 18c9e51..0d90d0f 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp | |||
@@ -203,62 +203,65 @@ void getStocks( const QString *blah) { | |||
203 | output +=tempString; | 203 | output +=tempString; |
204 | 204 | ||
205 | // printf("----------------------------------------\n\n"); | 205 | // printf("----------------------------------------\n\n"); |
206 | tempString.sprintf("||==++==|"); | 206 | tempString.sprintf("||==++==|"); |
207 | output +=tempString; | 207 | output +=tempString; |
208 | 208 | ||
209 | /* Simple function which help to browse in the stocks list */ | 209 | /* Simple function which help to browse in the stocks list */ |
210 | stocks_tmp = next_stock(stocks_tmp); | 210 | stocks_tmp = next_stock(stocks_tmp); |
211 | } | 211 | } |
212 | 212 | ||
213 | /* frees stocks */ | 213 | /* frees stocks */ |
214 | free_stocks(stocks_quotes); | 214 | free_stocks(stocks_quotes); |
215 | stocktickerTicker->setText( output ); | 215 | stocktickerTicker->setText( output.latin1() ); |
216 | 216 | ||
217 | } | 217 | } |
218 | 218 | ||
219 | StockTickerPluginWidget::StockTickerPluginWidget( QWidget *parent, const char* name) | 219 | StockTickerPluginWidget::StockTickerPluginWidget( QWidget *parent, const char* name) |
220 | : QWidget(parent, name ) { | 220 | : QWidget(parent, name ) { |
221 | init(); | 221 | init(); |
222 | startTimer(1000); | 222 | startTimer(1000); |
223 | |||
224 | stocktickerTicker->setTextFormat(Qt::RichText); | ||
223 | // checkConnection(); | 225 | // checkConnection(); |
224 | } | 226 | } |
225 | 227 | ||
226 | StockTickerPluginWidget::~StockTickerPluginWidget() { | 228 | StockTickerPluginWidget::~StockTickerPluginWidget() { |
227 | } | 229 | } |
228 | 230 | ||
229 | void StockTickerPluginWidget::init() { | 231 | void StockTickerPluginWidget::init() { |
230 | 232 | ||
231 | QHBoxLayout* layout = new QHBoxLayout( this ); | 233 | QHBoxLayout* layout = new QHBoxLayout( this ); |
232 | stocktickerTicker = new OTicker(this); | 234 | stocktickerTicker = new OTicker(this); |
233 | // stocktickerTicker->setMinimumHeight(15); | 235 | // stocktickerTicker->setMinimumHeight(15); |
234 | connect( stocktickerTicker, SIGNAL( mousePressed()), this, SLOT( checkConnection() )); | 236 | connect( stocktickerTicker, SIGNAL( mousePressed()), this, SLOT( checkConnection() )); |
235 | layout->addWidget( stocktickerTicker); | 237 | layout->addWidget( stocktickerTicker); |
236 | wasError = true; | 238 | wasError = true; |
237 | } | 239 | } |
238 | 240 | ||
239 | void StockTickerPluginWidget::doStocks() { | 241 | void StockTickerPluginWidget::doStocks() { |
240 | Config cfg( "stockticker"); | 242 | Config cfg( "stockticker"); |
241 | cfg.setGroup( "Symbols" ); | 243 | cfg.setGroup( "Symbols" ); |
242 | symbollist=""; | 244 | symbollist=""; |
243 | symbollist = cfg.readEntry("Symbols", ""); | 245 | symbollist = cfg.readEntry("Symbols", ""); |
244 | symbollist.replace(QRegExp(" "),"+");//seperated by + | 246 | symbollist.replace(QRegExp(" "),"+");//seperated by + |
245 | 247 | ||
246 | // qDebug(symbollist); | 248 | cfg.setGroup("Timer"); |
249 | stocktickerTicker->setUpdateTime( cfg.readNumEntry("ScrollSpeed",50)); | ||
250 | stocktickerTicker->setScrollLength( cfg.readNumEntry("ScrollLength",10)); | ||
251 | |||
247 | if (!symbollist.isEmpty()) { | 252 | if (!symbollist.isEmpty()) { |
248 | pthread_t thread1; | 253 | pthread_t thread1; |
249 | pthread_create(&thread1,NULL, (void * (*)(void *))getStocks, &symbollist); | 254 | pthread_create(&thread1,NULL, (void * (*)(void *))getStocks, &symbollist); |
250 | } | 255 | } |
251 | // pthread_join(thread1,NULL); | ||
252 | // getStocks( symbollist.latin1() ); | ||
253 | } | 256 | } |
254 | 257 | ||
255 | void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) { | 258 | void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) { |
256 | killTimer(e->timerId()); | 259 | killTimer(e->timerId()); |
257 | checkConnection(); | 260 | checkConnection(); |
258 | } | 261 | } |
259 | 262 | ||
260 | void StockTickerPluginWidget::checkConnection() { | 263 | void StockTickerPluginWidget::checkConnection() { |
261 | // qDebug("checking connection"); | 264 | // qDebug("checking connection"); |
262 | // Sock = new QSocket( this ); | 265 | // Sock = new QSocket( this ); |
263 | 266 | ||
264 | // if( wasError) | 267 | // if( wasError) |