4 files changed, 40 insertions, 6 deletions
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp index 11b615b..fdabd5c 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp | |||
@@ -129,19 +129,47 @@ StocktickerPluginConfig::StocktickerPluginConfig( QWidget *parent, const char* | |||
129 | QLabel *label2; | 129 | QLabel *label2; |
130 | label2 = new QLabel(this); | 130 | label2 = new QLabel(this); |
131 | label2->setText( tr("Minutes between lookups.")); | 131 | label2->setText( tr("Minutes between lookups.")); |
132 | label2->setMaximumHeight(60); | 132 | label2->setMaximumHeight(60); |
133 | layout->addMultiCellWidget( label2, 6, 6, 1, 2); | 133 | layout->addMultiCellWidget( label2, 6, 6, 1, 2); |
134 | 134 | ||
135 | scrollSpeed = new QSpinBox( this, "Scrollspin" ); | ||
136 | QWhatsThis::add( timerDelaySpin , tr( "Speed of scrolling action, in milliseconds" ) ); | ||
137 | scrollSpeed->setMaxValue( 1000); | ||
138 | scrollSpeed->setSteps(50,50); | ||
139 | cfg.setGroup("Timer"); | ||
140 | scrollSpeed->setValue( cfg.readNumEntry("ScrollSpeed",50)); | ||
141 | layout->addMultiCellWidget( scrollSpeed , 7, 7, 0, 0); | ||
142 | |||
143 | QLabel *label3; | ||
144 | label3 = new QLabel(this); | ||
145 | label3->setText( tr("Scroll Speed, in milliseconds")); | ||
146 | label3->setMaximumHeight(60); | ||
147 | layout->addMultiCellWidget( label3, 7, 7, 1, 2); | ||
148 | |||
149 | scrollLength = new QSpinBox( this, "ScrollLength" ); | ||
150 | QWhatsThis::add( timerDelaySpin , tr( "Length of scrolling" ) ); | ||
151 | scrollLength->setMaxValue( 10); | ||
152 | // scrollLength->setSteps(5,5); | ||
153 | cfg.setGroup("Timer"); | ||
154 | scrollLength->setValue( cfg.readNumEntry("ScrollLength",1)); | ||
155 | layout->addMultiCellWidget( scrollLength , 8, 8, 0, 0); | ||
156 | |||
157 | QLabel *label4; | ||
158 | label4 = new QLabel(this); | ||
159 | label4->setText( tr("Scroll Length")); | ||
160 | label4->setMaximumHeight(60); | ||
161 | layout->addMultiCellWidget( label4, 8, 8, 1, 2); | ||
162 | |||
135 | // lookupButton = new QPushButton(this, "LookupButton"); | 163 | // lookupButton = new QPushButton(this, "LookupButton"); |
136 | // lookupButton->setText(tr("Symbol Lookup")); | 164 | // lookupButton->setText(tr("Symbol Lookup")); |
137 | // connect(lookupButton,SIGNAL(clicked()),SLOT( doLookup())); | 165 | // connect(lookupButton,SIGNAL(clicked()),SLOT( doLookup())); |
138 | // layout->addMultiCellWidget( lookupButton , 9, 9, 0, 0); | 166 | // layout->addMultiCellWidget( lookupButton , 9, 9, 0, 0); |
139 | 167 | ||
140 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); | 168 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); |
141 | layout->addItem( spacer, 8, 0 ); | 169 | layout->addItem( spacer, 9, 0 ); |
142 | 170 | ||
143 | } | 171 | } |
144 | 172 | ||
145 | 173 | ||
146 | void StocktickerPluginConfig::writeConfig() { | 174 | void StocktickerPluginConfig::writeConfig() { |
147 | Config cfg( "stockticker"); | 175 | Config cfg( "stockticker"); |
@@ -161,12 +189,14 @@ void StocktickerPluginConfig::writeConfig() { | |||
161 | cfg.writeEntry("maxPriceCheck",maxPriceCheck->isChecked()); | 189 | cfg.writeEntry("maxPriceCheck",maxPriceCheck->isChecked()); |
162 | cfg.writeEntry("variationCheck",variationCheck->isChecked()); | 190 | cfg.writeEntry("variationCheck",variationCheck->isChecked()); |
163 | cfg.writeEntry("volumeCheck",volumeCheck->isChecked()); | 191 | cfg.writeEntry("volumeCheck",volumeCheck->isChecked()); |
164 | 192 | ||
165 | cfg.setGroup("Timer"); | 193 | cfg.setGroup("Timer"); |
166 | cfg.writeEntry("Delay",timerDelaySpin->value()); | 194 | cfg.writeEntry("Delay",timerDelaySpin->value()); |
195 | cfg.writeEntry("ScrollLength",scrollLength->value()); | ||
196 | cfg.writeEntry("ScrollSpeed",scrollSpeed->value()); | ||
167 | 197 | ||
168 | cfg.write(); | 198 | cfg.write(); |
169 | } | 199 | } |
170 | 200 | ||
171 | StocktickerPluginConfig::~StocktickerPluginConfig() { | 201 | StocktickerPluginConfig::~StocktickerPluginConfig() { |
172 | } | 202 | } |
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.h b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.h index 33aed86..2b67a8b 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.h +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.h | |||
@@ -35,12 +35,12 @@ public: | |||
35 | QString text() const; | 35 | QString text() const; |
36 | void writeConfig(); | 36 | void writeConfig(); |
37 | private: | 37 | private: |
38 | QLineEdit* LineEdit1; | 38 | QLineEdit* LineEdit1; |
39 | QCheckBox *timeCheck, *dateCheck, *symbolCheck, *nameCheck, *currentPriceCheck, *lastPriceCheck, *openPriceCheck, *minPriceCheck, *maxPriceCheck, *variationCheck, *volumeCheck; | 39 | QCheckBox *timeCheck, *dateCheck, *symbolCheck, *nameCheck, *currentPriceCheck, *lastPriceCheck, *openPriceCheck, *minPriceCheck, *maxPriceCheck, *variationCheck, *volumeCheck; |
40 | QPushButton *lookupButton; | 40 | QPushButton *lookupButton; |
41 | QSpinBox *timerDelaySpin; | 41 | QSpinBox *timerDelaySpin, *scrollSpeed, *scrollLength; |
42 | private slots: | 42 | private slots: |
43 | void doLookup(); | 43 | void doLookup(); |
44 | 44 | ||
45 | }; | 45 | }; |
46 | #endif | 46 | #endif |
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 | |||
@@ -209,20 +209,22 @@ void getStocks( const QString *blah) { | |||
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 | ||
@@ -240,19 +242,20 @@ 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 | } |
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h index 8776bff..1189bf5 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h | |||
@@ -47,12 +47,13 @@ public: | |||
47 | protected slots: | 47 | protected slots: |
48 | void doStocks(); | 48 | void doStocks(); |
49 | void isConnected(); | 49 | void isConnected(); |
50 | void socketError(int); | 50 | void socketError(int); |
51 | void checkConnection(); | 51 | void checkConnection(); |
52 | private: | 52 | private: |
53 | int updateSpeed; | ||
53 | QString symbollist; | 54 | QString symbollist; |
54 | bool wasError; | 55 | bool wasError; |
55 | QSocket *Sock; | 56 | QSocket *Sock; |
56 | void timerEvent( QTimerEvent * ); | 57 | void timerEvent( QTimerEvent * ); |
57 | void init(); | 58 | void init(); |
58 | // void DefProxy(void); | 59 | // void DefProxy(void); |