Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

stocktickerconfig.cpp

Go to the documentation of this file.
00001 /*
00002  * stocktickeRconfig.cpp
00003  *
00004  * copyright   : (c) 2002 by ljp
00005  * email       : llornkcor@handhelds.org
00006  *
00007  */
00008 /***************************************************************************
00009  *                                                                         *
00010  *   This program is free software; you can redistribute it and/or modify  *
00011  *   it under the terms of the GNU General Public License as published by  *
00012  *   the Free Software Foundation; either version 2 of the License, or     *
00013  *   (at your option) any later version.                                   *
00014  *                                                                         *
00015  ***************************************************************************/
00016 
00017 #include "stocktickerconfig.h"
00018 
00019 #include <opie2/todayconfigwidget.h>
00020 
00021 #include <qpe/config.h>
00022 
00023 #include <qapplication.h>
00024 #include <qlayout.h>
00025 #include <qspinbox.h>
00026 #include <qcheckbox.h>
00027 #include <qlineedit.h>
00028 #include <qvariant.h>
00029 #include <qpushbutton.h>
00030 #include <qwhatsthis.h>
00031 #include <qlabel.h>
00032 #include <qstringlist.h>
00033 #include <qmainwindow.h>
00034 
00035 #include <stdlib.h>
00036 
00037 StocktickerPluginConfig::StocktickerPluginConfig( QWidget *parent,  const char* name)
00038     : TodayConfigWidget(parent,  name ) {
00039 
00040     QGridLayout *layout = new QGridLayout( this );
00041     layout->setSpacing(2);
00042     layout->setMargin( 2);
00043 
00044     LineEdit1 = new QLineEdit( this, "LineEdit1" );
00045     LineEdit1->setFocus();
00046 //     QWhatsThis::add( LineEdit1, tr("Enter the stock symbols you want to be shown here."));
00047 
00048     layout->addMultiCellWidget(  LineEdit1, 0, 0, 0, 4);
00049 
00050     Config cfg( "stockticker");
00051     cfg.setGroup( "Symbols" );
00052     QString symbollist;
00053     symbollist = cfg.readEntry("Symbols", "");
00054     LineEdit1->setText(symbollist);
00055 
00056     QLabel *label;
00057     label = new QLabel(this);
00058     label->setText( tr("Enter stock symbols seperated\nby a space."));
00059     label->setMaximumHeight(60);
00060     layout->addMultiCellWidget( label, 1, 1, 0, 4);
00061 
00062     cfg.setGroup( "Fields" );
00063 
00064     timeCheck= new QCheckBox ( "Time",this );
00065     timeCheck->setChecked( cfg.readBoolEntry("timeCheck",1));
00066     layout->addMultiCellWidget(timeCheck, 2, 2, 0, 0 );
00067     QWhatsThis::add( timeCheck, tr("Toggles Time of current price field"));
00068 
00069     dateCheck= new QCheckBox ( "Date", this );
00070     dateCheck->setChecked( cfg.readBoolEntry("dateCheck",1));
00071     layout->addMultiCellWidget( dateCheck, 2, 2, 1, 1 );
00072     QWhatsThis::add(dateCheck, tr("Toggles date field"));
00073 
00074     symbolCheck= new QCheckBox ( "Symbol", this );
00075     symbolCheck->setChecked( cfg.readBoolEntry("symbolCheck",1));
00076     layout->addMultiCellWidget( symbolCheck, 2, 2, 2, 2 );
00077     QWhatsThis::add(symbolCheck, tr("Toggles Symbol field"));
00078 
00079     nameCheck= new QCheckBox ( "Name", this );
00080     nameCheck->setChecked( cfg.readBoolEntry("nameCheck",1));
00081     layout->addMultiCellWidget( nameCheck, 3, 3, 0, 0 );
00082     QWhatsThis::add(nameCheck, tr("Toggles Name of symbols owner field"));
00083 
00084     currentPriceCheck= new QCheckBox ( "Price", this );
00085     currentPriceCheck->setChecked( cfg.readBoolEntry("currentPriceCheck",1));
00086     layout->addMultiCellWidget( currentPriceCheck, 3, 3, 1, 1 );
00087     QWhatsThis::add(currentPriceCheck, tr("Toggles current Price field"));
00088 
00089     lastPriceCheck= new QCheckBox ( "Last Price", this );
00090     lastPriceCheck->setChecked( cfg.readBoolEntry("lastPriceCheck",1));
00091     layout->addMultiCellWidget(lastPriceCheck, 3, 3, 2, 2);
00092     QWhatsThis::add(lastPriceCheck, tr("Toggles last price field"));
00093 
00094     openPriceCheck= new QCheckBox ( "Open Price", this);
00095     openPriceCheck->setChecked( cfg.readBoolEntry("openPriceCheck",1));
00096     layout->addMultiCellWidget( openPriceCheck, 4, 4, 0, 0 );
00097     QWhatsThis::add(openPriceCheck, tr("Toggles opening price field"));
00098 
00099     minPriceCheck= new QCheckBox ( "Min Price", this );
00100     minPriceCheck->setChecked( cfg.readBoolEntry("minPriceCheck",1));
00101     layout->addMultiCellWidget( minPriceCheck, 4, 4, 1, 1);
00102     QWhatsThis::add(minPriceCheck, tr("Toggles minimum daily price field"));
00103 
00104     maxPriceCheck= new QCheckBox ( "Max Price", this);
00105     maxPriceCheck->setChecked( cfg.readBoolEntry("maxPriceCheck",1));
00106     layout->addMultiCellWidget( maxPriceCheck, 4, 4, 2, 2 );
00107     QWhatsThis::add(maxPriceCheck, tr("Toggles maximum daily price field"));
00108 
00109     variationCheck= new QCheckBox ( "Variation", this );
00110     variationCheck->setChecked( cfg.readBoolEntry("variationCheck",1));
00111     layout->addMultiCellWidget( variationCheck, 5, 5, 0, 0 );
00112     QWhatsThis::add(variationCheck, tr("Toggles daily variation of price field"));
00113 
00114     volumeCheck= new QCheckBox ( "Volume", this );
00115     volumeCheck->setChecked( cfg.readBoolEntry("volumeCheck",1));
00116     layout->addMultiCellWidget( volumeCheck , 5, 5, 1, 1);
00117     QWhatsThis::add(volumeCheck, tr("Toggles volume of trading field"));
00118 
00119     timerDelaySpin =  new QSpinBox( this, "timer spin" );
00120     QWhatsThis::add( timerDelaySpin , tr( "How often stocks prices should be looked up. In minutes" ) );
00121     timerDelaySpin->setMaxValue( 60);
00122 
00123     cfg.setGroup("Timer");
00124     timerDelaySpin->setValue( cfg.readNumEntry("Delay",15));
00125     layout->addMultiCellWidget( timerDelaySpin , 6, 6, 0, 0);
00126 
00127     QLabel *label2;
00128     label2 = new QLabel(this);
00129     label2->setText( tr("Minutes between lookups."));
00130     label2->setMaximumHeight(60);
00131     layout->addMultiCellWidget( label2, 6, 6, 1, 2);
00132 
00133     scrollSpeed = new QSpinBox( this, "Scrollspin" );
00134     QWhatsThis::add( timerDelaySpin , tr( "Speed of scrolling action, in milliseconds" ) );
00135     scrollSpeed->setMaxValue( 1000);
00136     scrollSpeed->setSteps(50,50);
00137     cfg.setGroup("Timer");
00138     scrollSpeed->setValue( cfg.readNumEntry("ScrollSpeed",50));
00139     layout->addMultiCellWidget( scrollSpeed , 7, 7, 0, 0);
00140 
00141     QLabel *label3;
00142     label3 = new QLabel(this);
00143     label3->setText( tr("Scroll Speed, in milliseconds"));
00144     label3->setMaximumHeight(60);
00145     layout->addMultiCellWidget( label3, 7, 7, 1, 2);
00146 
00147     scrollLength = new QSpinBox( this, "ScrollLength" );
00148     QWhatsThis::add( timerDelaySpin , tr( "Length of scrolling" ) );
00149     scrollLength->setMaxValue( 10);
00150 //    scrollLength->setSteps(5,5);
00151     cfg.setGroup("Timer");
00152     scrollLength->setValue( cfg.readNumEntry("ScrollLength",1));
00153     layout->addMultiCellWidget( scrollLength , 8, 8, 0, 0);
00154 
00155     QLabel *label4;
00156     label4 = new QLabel(this);
00157     label4->setText( tr("Scroll Length"));
00158     label4->setMaximumHeight(60);
00159     layout->addMultiCellWidget( label4, 8, 8, 1, 2);
00160 
00161 //      lookupButton = new QPushButton(this, "LookupButton");
00162 //      lookupButton->setText(tr("Symbol Lookup"));
00163 //      connect(lookupButton,SIGNAL(clicked()),SLOT( doLookup()));
00164 //      layout->addMultiCellWidget( lookupButton , 9, 9, 0, 0);
00165 
00166     QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding );
00167     layout->addItem( spacer, 9, 0 );
00168 
00169 }
00170 
00171 
00172 void StocktickerPluginConfig::writeConfig() {
00173     Config cfg( "stockticker");
00174     cfg.setGroup( "Symbols" );
00175     QString outText = text().upper();
00176     outText.stripWhiteSpace();
00177     cfg.writeEntry("Symbols",  outText );
00178     cfg.setGroup( "Fields" );
00179     cfg.writeEntry("timeCheck",timeCheck->isChecked());
00180     cfg.writeEntry("dateCheck",dateCheck->isChecked());
00181     cfg.writeEntry("symbolCheck",symbolCheck->isChecked());
00182     cfg.writeEntry("nameCheck",nameCheck->isChecked());
00183     cfg.writeEntry("currentPriceCheck",currentPriceCheck->isChecked());
00184     cfg.writeEntry("lastPriceCheck",lastPriceCheck->isChecked());
00185     cfg.writeEntry("openPriceCheck",openPriceCheck->isChecked());
00186     cfg.writeEntry("minPriceCheck",minPriceCheck->isChecked());
00187     cfg.writeEntry("maxPriceCheck",maxPriceCheck->isChecked());
00188     cfg.writeEntry("variationCheck",variationCheck->isChecked());
00189     cfg.writeEntry("volumeCheck",volumeCheck->isChecked());
00190 
00191     cfg.setGroup("Timer");
00192     cfg.writeEntry("Delay",timerDelaySpin->value());
00193     cfg.writeEntry("ScrollLength",scrollLength->value());
00194     cfg.writeEntry("ScrollSpeed",scrollSpeed->value());
00195 
00196     cfg.write();
00197 }
00198 
00199 StocktickerPluginConfig::~StocktickerPluginConfig() {
00200 }
00201 
00202 QString StocktickerPluginConfig::text() const {
00203    return LineEdit1->text();
00204 }
00205 
00206 void StocktickerPluginConfig::doLookup() {
00207 
00208     system("stockticker");
00209 }

Generated on Sat Nov 5 16:18:00 2005 for OPIE by  doxygen 1.4.2