summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp32
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.h2
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp11
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.h1
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
@@ -127,23 +127,51 @@ StocktickerPluginConfig::StocktickerPluginConfig( QWidget *parent, const char*
127 layout->addMultiCellWidget( timerDelaySpin , 6, 6, 0, 0); 127 layout->addMultiCellWidget( timerDelaySpin , 6, 6, 0, 0);
128 128
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
146void StocktickerPluginConfig::writeConfig() { 174void StocktickerPluginConfig::writeConfig() {
147 Config cfg( "stockticker"); 175 Config cfg( "stockticker");
148 cfg.setGroup( "Symbols" ); 176 cfg.setGroup( "Symbols" );
149 QString outText = text().upper(); 177 QString outText = text().upper();
@@ -159,16 +187,18 @@ void StocktickerPluginConfig::writeConfig() {
159 cfg.writeEntry("openPriceCheck",openPriceCheck->isChecked()); 187 cfg.writeEntry("openPriceCheck",openPriceCheck->isChecked());
160 cfg.writeEntry("minPriceCheck",minPriceCheck->isChecked()); 188 cfg.writeEntry("minPriceCheck",minPriceCheck->isChecked());
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
171StocktickerPluginConfig::~StocktickerPluginConfig() { 201StocktickerPluginConfig::~StocktickerPluginConfig() {
172} 202}
173 203
174QString StocktickerPluginConfig::text() const { 204QString StocktickerPluginConfig::text() const {
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
@@ -33,14 +33,14 @@ public:
33 StocktickerPluginConfig( QWidget *parent, const char *name ); 33 StocktickerPluginConfig( QWidget *parent, const char *name );
34 ~StocktickerPluginConfig(); 34 ~StocktickerPluginConfig();
35 QString text() const; 35 QString text() const;
36 void writeConfig(); 36 void writeConfig();
37private: 37private:
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;
42private slots: 42private 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
@@ -207,24 +207,26 @@ void getStocks( const QString *blah) {
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
219StockTickerPluginWidget::StockTickerPluginWidget( QWidget *parent, const char* name) 219StockTickerPluginWidget::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
226StockTickerPluginWidget::~StockTickerPluginWidget() { 228StockTickerPluginWidget::~StockTickerPluginWidget() {
227} 229}
228 230
229void StockTickerPluginWidget::init() { 231void StockTickerPluginWidget::init() {
230 232
@@ -238,23 +240,24 @@ void StockTickerPluginWidget::init() {
238 240
239void StockTickerPluginWidget::doStocks() { 241void 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
255void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) { 258void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) {
256 killTimer(e->timerId()); 259 killTimer(e->timerId());
257 checkConnection(); 260 checkConnection();
258} 261}
259 262
260void StockTickerPluginWidget::checkConnection() { 263void StockTickerPluginWidget::checkConnection() {
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
@@ -45,16 +45,17 @@ public:
45 ~StockTickerPluginWidget(); 45 ~StockTickerPluginWidget();
46 46
47protected slots: 47protected 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();
52private: 52private:
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);
59 int timerDelay; 60 int timerDelay;
60}; 61};