-rw-r--r-- | noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp index e3d378b..d740b6f 100644 --- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp +++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp | |||
@@ -1,207 +1,209 @@ | |||
1 | /* | 1 | /* |
2 | * stocktickeRconfig.cpp | 2 | * stocktickeRconfig.cpp |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by ljp | 4 | * copyright : (c) 2002 by ljp |
5 | * email : llornkcor@handhelds.org | 5 | * email : llornkcor@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | #include "stocktickerconfig.h" | 17 | #include "stocktickerconfig.h" |
18 | #include <opie/todayconfigwidget.h> | 18 | #include <opie/todayconfigwidget.h> |
19 | 19 | ||
20 | #include <qpe/config.h> | ||
20 | 21 | ||
21 | #include <qapplication.h> | 22 | #include <qapplication.h> |
22 | 23 | ||
24 | #include <qlayout.h> | ||
23 | #include <qspinbox.h> | 25 | #include <qspinbox.h> |
24 | #include <qcheckbox.h> | 26 | #include <qcheckbox.h> |
25 | #include <qlineedit.h> | 27 | #include <qlineedit.h> |
26 | #include <qvariant.h> | 28 | #include <qvariant.h> |
27 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
28 | #include <qwhatsthis.h> | 30 | #include <qwhatsthis.h> |
29 | #include <qlabel.h> | 31 | #include <qlabel.h> |
30 | #include <qstringlist.h> | 32 | #include <qstringlist.h> |
31 | #include <qmainwindow.h> | 33 | #include <qmainwindow.h> |
32 | 34 | ||
33 | #include <stdlib.h> | 35 | #include <stdlib.h> |
34 | 36 | ||
35 | StocktickerPluginConfig::StocktickerPluginConfig( QWidget *parent, const char* name) | 37 | StocktickerPluginConfig::StocktickerPluginConfig( QWidget *parent, const char* name) |
36 | : TodayConfigWidget(parent, name ) { | 38 | : TodayConfigWidget(parent, name ) { |
37 | 39 | ||
38 | QGridLayout *layout = new QGridLayout( this ); | 40 | QGridLayout *layout = new QGridLayout( this ); |
39 | layout->setSpacing(2); | 41 | layout->setSpacing(2); |
40 | layout->setMargin( 2); | 42 | layout->setMargin( 2); |
41 | 43 | ||
42 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); | 44 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); |
43 | LineEdit1->setFocus(); | 45 | LineEdit1->setFocus(); |
44 | // QWhatsThis::add( LineEdit1, tr("Enter the stock symbols you want to be shown here.")); | 46 | // QWhatsThis::add( LineEdit1, tr("Enter the stock symbols you want to be shown here.")); |
45 | 47 | ||
46 | layout->addMultiCellWidget( LineEdit1, 0, 0, 0, 4); | 48 | layout->addMultiCellWidget( LineEdit1, 0, 0, 0, 4); |
47 | 49 | ||
48 | Config cfg( "stockticker"); | 50 | Config cfg( "stockticker"); |
49 | cfg.setGroup( "Symbols" ); | 51 | cfg.setGroup( "Symbols" ); |
50 | QString symbollist; | 52 | QString symbollist; |
51 | symbollist = cfg.readEntry("Symbols", ""); | 53 | symbollist = cfg.readEntry("Symbols", ""); |
52 | LineEdit1->setText(symbollist); | 54 | LineEdit1->setText(symbollist); |
53 | 55 | ||
54 | QLabel *label; | 56 | QLabel *label; |
55 | label = new QLabel(this); | 57 | label = new QLabel(this); |
56 | label->setText( tr("Enter stock symbols seperated\nby a space.")); | 58 | label->setText( tr("Enter stock symbols seperated\nby a space.")); |
57 | label->setMaximumHeight(60); | 59 | label->setMaximumHeight(60); |
58 | layout->addMultiCellWidget( label, 1, 1, 0, 4); | 60 | layout->addMultiCellWidget( label, 1, 1, 0, 4); |
59 | 61 | ||
60 | cfg.setGroup( "Fields" ); | 62 | cfg.setGroup( "Fields" ); |
61 | 63 | ||
62 | timeCheck= new QCheckBox ( "Time",this ); | 64 | timeCheck= new QCheckBox ( "Time",this ); |
63 | timeCheck->setChecked( cfg.readBoolEntry("timeCheck",1)); | 65 | timeCheck->setChecked( cfg.readBoolEntry("timeCheck",1)); |
64 | layout->addMultiCellWidget(timeCheck, 2, 2, 0, 0 ); | 66 | layout->addMultiCellWidget(timeCheck, 2, 2, 0, 0 ); |
65 | QWhatsThis::add( timeCheck, tr("Toggles Time of current price field")); | 67 | QWhatsThis::add( timeCheck, tr("Toggles Time of current price field")); |
66 | 68 | ||
67 | dateCheck= new QCheckBox ( "Date", this ); | 69 | dateCheck= new QCheckBox ( "Date", this ); |
68 | dateCheck->setChecked( cfg.readBoolEntry("dateCheck",1)); | 70 | dateCheck->setChecked( cfg.readBoolEntry("dateCheck",1)); |
69 | layout->addMultiCellWidget( dateCheck, 2, 2, 1, 1 ); | 71 | layout->addMultiCellWidget( dateCheck, 2, 2, 1, 1 ); |
70 | QWhatsThis::add(dateCheck, tr("Toggles date field")); | 72 | QWhatsThis::add(dateCheck, tr("Toggles date field")); |
71 | 73 | ||
72 | symbolCheck= new QCheckBox ( "Symbol", this ); | 74 | symbolCheck= new QCheckBox ( "Symbol", this ); |
73 | symbolCheck->setChecked( cfg.readBoolEntry("symbolCheck",1)); | 75 | symbolCheck->setChecked( cfg.readBoolEntry("symbolCheck",1)); |
74 | layout->addMultiCellWidget( symbolCheck, 2, 2, 2, 2 ); | 76 | layout->addMultiCellWidget( symbolCheck, 2, 2, 2, 2 ); |
75 | QWhatsThis::add(symbolCheck, tr("Toggles Symbol field")); | 77 | QWhatsThis::add(symbolCheck, tr("Toggles Symbol field")); |
76 | 78 | ||
77 | nameCheck= new QCheckBox ( "Name", this ); | 79 | nameCheck= new QCheckBox ( "Name", this ); |
78 | nameCheck->setChecked( cfg.readBoolEntry("nameCheck",1)); | 80 | nameCheck->setChecked( cfg.readBoolEntry("nameCheck",1)); |
79 | layout->addMultiCellWidget( nameCheck, 3, 3, 0, 0 ); | 81 | layout->addMultiCellWidget( nameCheck, 3, 3, 0, 0 ); |
80 | QWhatsThis::add(nameCheck, tr("Toggles Name of symbols owner field")); | 82 | QWhatsThis::add(nameCheck, tr("Toggles Name of symbols owner field")); |
81 | 83 | ||
82 | currentPriceCheck= new QCheckBox ( "Price", this ); | 84 | currentPriceCheck= new QCheckBox ( "Price", this ); |
83 | currentPriceCheck->setChecked( cfg.readBoolEntry("currentPriceCheck",1)); | 85 | currentPriceCheck->setChecked( cfg.readBoolEntry("currentPriceCheck",1)); |
84 | layout->addMultiCellWidget( currentPriceCheck, 3, 3, 1, 1 ); | 86 | layout->addMultiCellWidget( currentPriceCheck, 3, 3, 1, 1 ); |
85 | QWhatsThis::add(currentPriceCheck, tr("Toggles current Price field")); | 87 | QWhatsThis::add(currentPriceCheck, tr("Toggles current Price field")); |
86 | 88 | ||
87 | lastPriceCheck= new QCheckBox ( "Last Price", this ); | 89 | lastPriceCheck= new QCheckBox ( "Last Price", this ); |
88 | lastPriceCheck->setChecked( cfg.readBoolEntry("lastPriceCheck",1)); | 90 | lastPriceCheck->setChecked( cfg.readBoolEntry("lastPriceCheck",1)); |
89 | layout->addMultiCellWidget(lastPriceCheck, 3, 3, 2, 2); | 91 | layout->addMultiCellWidget(lastPriceCheck, 3, 3, 2, 2); |
90 | QWhatsThis::add(lastPriceCheck, tr("Toggles last price field")); | 92 | QWhatsThis::add(lastPriceCheck, tr("Toggles last price field")); |
91 | 93 | ||
92 | openPriceCheck= new QCheckBox ( "Open Price", this); | 94 | openPriceCheck= new QCheckBox ( "Open Price", this); |
93 | openPriceCheck->setChecked( cfg.readBoolEntry("openPriceCheck",1)); | 95 | openPriceCheck->setChecked( cfg.readBoolEntry("openPriceCheck",1)); |
94 | layout->addMultiCellWidget( openPriceCheck, 4, 4, 0, 0 ); | 96 | layout->addMultiCellWidget( openPriceCheck, 4, 4, 0, 0 ); |
95 | QWhatsThis::add(openPriceCheck, tr("Toggles opening price field")); | 97 | QWhatsThis::add(openPriceCheck, tr("Toggles opening price field")); |
96 | 98 | ||
97 | minPriceCheck= new QCheckBox ( "Min Price", this ); | 99 | minPriceCheck= new QCheckBox ( "Min Price", this ); |
98 | minPriceCheck->setChecked( cfg.readBoolEntry("minPriceCheck",1)); | 100 | minPriceCheck->setChecked( cfg.readBoolEntry("minPriceCheck",1)); |
99 | layout->addMultiCellWidget( minPriceCheck, 4, 4, 1, 1); | 101 | layout->addMultiCellWidget( minPriceCheck, 4, 4, 1, 1); |
100 | QWhatsThis::add(minPriceCheck, tr("Toggles minimum daily price field")); | 102 | QWhatsThis::add(minPriceCheck, tr("Toggles minimum daily price field")); |
101 | 103 | ||
102 | maxPriceCheck= new QCheckBox ( "Max Price", this); | 104 | maxPriceCheck= new QCheckBox ( "Max Price", this); |
103 | maxPriceCheck->setChecked( cfg.readBoolEntry("maxPriceCheck",1)); | 105 | maxPriceCheck->setChecked( cfg.readBoolEntry("maxPriceCheck",1)); |
104 | layout->addMultiCellWidget( maxPriceCheck, 4, 4, 2, 2 ); | 106 | layout->addMultiCellWidget( maxPriceCheck, 4, 4, 2, 2 ); |
105 | QWhatsThis::add(maxPriceCheck, tr("Toggles maximum daily price field")); | 107 | QWhatsThis::add(maxPriceCheck, tr("Toggles maximum daily price field")); |
106 | 108 | ||
107 | variationCheck= new QCheckBox ( "Variation", this ); | 109 | variationCheck= new QCheckBox ( "Variation", this ); |
108 | variationCheck->setChecked( cfg.readBoolEntry("variationCheck",1)); | 110 | variationCheck->setChecked( cfg.readBoolEntry("variationCheck",1)); |
109 | layout->addMultiCellWidget( variationCheck, 5, 5, 0, 0 ); | 111 | layout->addMultiCellWidget( variationCheck, 5, 5, 0, 0 ); |
110 | QWhatsThis::add(variationCheck, tr("Toggles daily variation of price field")); | 112 | QWhatsThis::add(variationCheck, tr("Toggles daily variation of price field")); |
111 | 113 | ||
112 | volumeCheck= new QCheckBox ( "Volume", this ); | 114 | volumeCheck= new QCheckBox ( "Volume", this ); |
113 | volumeCheck->setChecked( cfg.readBoolEntry("volumeCheck",1)); | 115 | volumeCheck->setChecked( cfg.readBoolEntry("volumeCheck",1)); |
114 | layout->addMultiCellWidget( volumeCheck , 5, 5, 1, 1); | 116 | layout->addMultiCellWidget( volumeCheck , 5, 5, 1, 1); |
115 | QWhatsThis::add(volumeCheck, tr("Toggles volume of trading field")); | 117 | QWhatsThis::add(volumeCheck, tr("Toggles volume of trading field")); |
116 | 118 | ||
117 | timerDelaySpin = new QSpinBox( this, "timer spin" ); | 119 | timerDelaySpin = new QSpinBox( this, "timer spin" ); |
118 | QWhatsThis::add( timerDelaySpin , tr( "How often stocks prices should be looked up. In minutes" ) ); | 120 | QWhatsThis::add( timerDelaySpin , tr( "How often stocks prices should be looked up. In minutes" ) ); |
119 | timerDelaySpin->setMaxValue( 60); | 121 | timerDelaySpin->setMaxValue( 60); |
120 | 122 | ||
121 | cfg.setGroup("Timer"); | 123 | cfg.setGroup("Timer"); |
122 | timerDelaySpin->setValue( cfg.readNumEntry("Delay",0)); | 124 | timerDelaySpin->setValue( cfg.readNumEntry("Delay",0)); |
123 | layout->addMultiCellWidget( timerDelaySpin , 6, 6, 0, 0); | 125 | layout->addMultiCellWidget( timerDelaySpin , 6, 6, 0, 0); |
124 | 126 | ||
125 | QLabel *label2; | 127 | QLabel *label2; |
126 | label2 = new QLabel(this); | 128 | label2 = new QLabel(this); |
127 | label2->setText( tr("Minutes between lookups.")); | 129 | label2->setText( tr("Minutes between lookups.")); |
128 | label2->setMaximumHeight(60); | 130 | label2->setMaximumHeight(60); |
129 | layout->addMultiCellWidget( label2, 6, 6, 1, 2); | 131 | layout->addMultiCellWidget( label2, 6, 6, 1, 2); |
130 | 132 | ||
131 | scrollSpeed = new QSpinBox( this, "Scrollspin" ); | 133 | scrollSpeed = new QSpinBox( this, "Scrollspin" ); |
132 | QWhatsThis::add( timerDelaySpin , tr( "Speed of scrolling action, in milliseconds" ) ); | 134 | QWhatsThis::add( timerDelaySpin , tr( "Speed of scrolling action, in milliseconds" ) ); |
133 | scrollSpeed->setMaxValue( 1000); | 135 | scrollSpeed->setMaxValue( 1000); |
134 | scrollSpeed->setSteps(50,50); | 136 | scrollSpeed->setSteps(50,50); |
135 | cfg.setGroup("Timer"); | 137 | cfg.setGroup("Timer"); |
136 | scrollSpeed->setValue( cfg.readNumEntry("ScrollSpeed",50)); | 138 | scrollSpeed->setValue( cfg.readNumEntry("ScrollSpeed",50)); |
137 | layout->addMultiCellWidget( scrollSpeed , 7, 7, 0, 0); | 139 | layout->addMultiCellWidget( scrollSpeed , 7, 7, 0, 0); |
138 | 140 | ||
139 | QLabel *label3; | 141 | QLabel *label3; |
140 | label3 = new QLabel(this); | 142 | label3 = new QLabel(this); |
141 | label3->setText( tr("Scroll Speed, in milliseconds")); | 143 | label3->setText( tr("Scroll Speed, in milliseconds")); |
142 | label3->setMaximumHeight(60); | 144 | label3->setMaximumHeight(60); |
143 | layout->addMultiCellWidget( label3, 7, 7, 1, 2); | 145 | layout->addMultiCellWidget( label3, 7, 7, 1, 2); |
144 | 146 | ||
145 | scrollLength = new QSpinBox( this, "ScrollLength" ); | 147 | scrollLength = new QSpinBox( this, "ScrollLength" ); |
146 | QWhatsThis::add( timerDelaySpin , tr( "Length of scrolling" ) ); | 148 | QWhatsThis::add( timerDelaySpin , tr( "Length of scrolling" ) ); |
147 | scrollLength->setMaxValue( 10); | 149 | scrollLength->setMaxValue( 10); |
148 | // scrollLength->setSteps(5,5); | 150 | // scrollLength->setSteps(5,5); |
149 | cfg.setGroup("Timer"); | 151 | cfg.setGroup("Timer"); |
150 | scrollLength->setValue( cfg.readNumEntry("ScrollLength",1)); | 152 | scrollLength->setValue( cfg.readNumEntry("ScrollLength",1)); |
151 | layout->addMultiCellWidget( scrollLength , 8, 8, 0, 0); | 153 | layout->addMultiCellWidget( scrollLength , 8, 8, 0, 0); |
152 | 154 | ||
153 | QLabel *label4; | 155 | QLabel *label4; |
154 | label4 = new QLabel(this); | 156 | label4 = new QLabel(this); |
155 | label4->setText( tr("Scroll Length")); | 157 | label4->setText( tr("Scroll Length")); |
156 | label4->setMaximumHeight(60); | 158 | label4->setMaximumHeight(60); |
157 | layout->addMultiCellWidget( label4, 8, 8, 1, 2); | 159 | layout->addMultiCellWidget( label4, 8, 8, 1, 2); |
158 | 160 | ||
159 | // lookupButton = new QPushButton(this, "LookupButton"); | 161 | // lookupButton = new QPushButton(this, "LookupButton"); |
160 | // lookupButton->setText(tr("Symbol Lookup")); | 162 | // lookupButton->setText(tr("Symbol Lookup")); |
161 | // connect(lookupButton,SIGNAL(clicked()),SLOT( doLookup())); | 163 | // connect(lookupButton,SIGNAL(clicked()),SLOT( doLookup())); |
162 | // layout->addMultiCellWidget( lookupButton , 9, 9, 0, 0); | 164 | // layout->addMultiCellWidget( lookupButton , 9, 9, 0, 0); |
163 | 165 | ||
164 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); | 166 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding ); |
165 | layout->addItem( spacer, 9, 0 ); | 167 | layout->addItem( spacer, 9, 0 ); |
166 | 168 | ||
167 | } | 169 | } |
168 | 170 | ||
169 | 171 | ||
170 | void StocktickerPluginConfig::writeConfig() { | 172 | void StocktickerPluginConfig::writeConfig() { |
171 | Config cfg( "stockticker"); | 173 | Config cfg( "stockticker"); |
172 | cfg.setGroup( "Symbols" ); | 174 | cfg.setGroup( "Symbols" ); |
173 | QString outText = text().upper(); | 175 | QString outText = text().upper(); |
174 | outText.stripWhiteSpace(); | 176 | outText.stripWhiteSpace(); |
175 | cfg.writeEntry("Symbols", outText ); | 177 | cfg.writeEntry("Symbols", outText ); |
176 | cfg.setGroup( "Fields" ); | 178 | cfg.setGroup( "Fields" ); |
177 | cfg.writeEntry("timeCheck",timeCheck->isChecked()); | 179 | cfg.writeEntry("timeCheck",timeCheck->isChecked()); |
178 | cfg.writeEntry("dateCheck",dateCheck->isChecked()); | 180 | cfg.writeEntry("dateCheck",dateCheck->isChecked()); |
179 | cfg.writeEntry("symbolCheck",symbolCheck->isChecked()); | 181 | cfg.writeEntry("symbolCheck",symbolCheck->isChecked()); |
180 | cfg.writeEntry("nameCheck",nameCheck->isChecked()); | 182 | cfg.writeEntry("nameCheck",nameCheck->isChecked()); |
181 | cfg.writeEntry("currentPriceCheck",currentPriceCheck->isChecked()); | 183 | cfg.writeEntry("currentPriceCheck",currentPriceCheck->isChecked()); |
182 | cfg.writeEntry("lastPriceCheck",lastPriceCheck->isChecked()); | 184 | cfg.writeEntry("lastPriceCheck",lastPriceCheck->isChecked()); |
183 | cfg.writeEntry("openPriceCheck",openPriceCheck->isChecked()); | 185 | cfg.writeEntry("openPriceCheck",openPriceCheck->isChecked()); |
184 | cfg.writeEntry("minPriceCheck",minPriceCheck->isChecked()); | 186 | cfg.writeEntry("minPriceCheck",minPriceCheck->isChecked()); |
185 | cfg.writeEntry("maxPriceCheck",maxPriceCheck->isChecked()); | 187 | cfg.writeEntry("maxPriceCheck",maxPriceCheck->isChecked()); |
186 | cfg.writeEntry("variationCheck",variationCheck->isChecked()); | 188 | cfg.writeEntry("variationCheck",variationCheck->isChecked()); |
187 | cfg.writeEntry("volumeCheck",volumeCheck->isChecked()); | 189 | cfg.writeEntry("volumeCheck",volumeCheck->isChecked()); |
188 | 190 | ||
189 | cfg.setGroup("Timer"); | 191 | cfg.setGroup("Timer"); |
190 | cfg.writeEntry("Delay",timerDelaySpin->value()); | 192 | cfg.writeEntry("Delay",timerDelaySpin->value()); |
191 | cfg.writeEntry("ScrollLength",scrollLength->value()); | 193 | cfg.writeEntry("ScrollLength",scrollLength->value()); |
192 | cfg.writeEntry("ScrollSpeed",scrollSpeed->value()); | 194 | cfg.writeEntry("ScrollSpeed",scrollSpeed->value()); |
193 | 195 | ||
194 | cfg.write(); | 196 | cfg.write(); |
195 | } | 197 | } |
196 | 198 | ||
197 | StocktickerPluginConfig::~StocktickerPluginConfig() { | 199 | StocktickerPluginConfig::~StocktickerPluginConfig() { |
198 | } | 200 | } |
199 | 201 | ||
200 | QString StocktickerPluginConfig::text() const { | 202 | QString StocktickerPluginConfig::text() const { |
201 | return LineEdit1->text(); | 203 | return LineEdit1->text(); |
202 | } | 204 | } |
203 | 205 | ||
204 | void StocktickerPluginConfig::doLookup() { | 206 | void StocktickerPluginConfig::doLookup() { |
205 | 207 | ||
206 | system("stockticker"); | 208 | system("stockticker"); |
207 | } | 209 | } |