lib/QuotePlugin.h

Go to the documentation of this file.
00001 /*
00002  *  Qtstalker stock charter
00003  *
00004  *  Copyright (C) 2001-2007 Stefan S. Stratigakos
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
00019  *  USA.
00020  */
00021 
00022 #ifndef QUOTEPLUGIN_HPP
00023 #define QUOTEPLUGIN_HPP
00024 
00025 #include <qstring.h>
00026 #include <qnetworkprotocol.h>
00027 #include <qurloperator.h>
00028 #include <qtimer.h>
00029 #include <qtabdialog.h>
00030 #include <qtextedit.h>
00031 #include <qlayout.h>
00032 #include <qspinbox.h>
00033 #include <qprogressbar.h>
00034 #include "Toolbar.h"
00035 #include "DBIndex.h"
00036 
00037 /**
00038 * \todo
00039 * Needs to be re-written to not use the QUrlOperator.
00040 * See http://doc.trolltech.com/4.3/porting4-overview.html#url-operations-qurloperator
00041 */
00042 class QuotePlugin : public QTabDialog
00043 {
00044   Q_OBJECT
00045 
00046   signals:
00047     void signalGetFileDone (bool);
00048     void signalCopyFileDone (QString);
00049     void signalTimeout ();
00050     void signalProgMessage (int, int);
00051     void chartUpdated ();
00052     void signalWakeup ();
00053 
00054   public:
00055     QuotePlugin ();
00056     virtual ~QuotePlugin ();
00057     bool setTFloat (QString &, bool);
00058     void stripJunk (QString &, QString &);
00059     void createDirectory (QString &, QString &);
00060     void getPluginName (QString &);
00061     void getHelpFile (QString &);
00062     void buildGui ();
00063     void enableGUI ();
00064     void disableGUI ();
00065     virtual void update ();
00066     void setChartIndex (DBIndex *);
00067     QProgressBar *progressBar;
00068     
00069   public slots:
00070     void getFile (QString &);
00071     void copyFile (QString &, QString &);
00072     void getFileDone (QNetworkOperation *);
00073     void copyFileDone (QNetworkOperation *);
00074     void dataReady (const QByteArray &, QNetworkOperation *);
00075     void slotTimeout ();
00076     void getQuotes ();
00077     void downloadComplete ();
00078     void cancelDownload ();
00079     void printStatusLogMessage (QString &);
00080     void help ();
00081     void slotWakeup ();
00082     
00083   protected:
00084     QString file;
00085     float tfloat;
00086     bool saveFlag;
00087     QString pluginName;
00088     QString helpFile;
00089     QUrlOperator *op;
00090     QString data;
00091     QTimer *timer;
00092     int errorLoop;
00093     QString stringDone;
00094     QString stringCanceled;
00095     QTextEdit *statusLog;
00096     Toolbar *toolbar;
00097     QVBoxLayout *vbox;
00098     QWidget *baseWidget;
00099     QGridLayout *grid;
00100     QSpinBox *retrySpin;
00101     QSpinBox *timeoutSpin;
00102     DBIndex *chartIndex;
00103 };
00104 
00105 #endif