00001 /*************************************************************************** 00002 * SpikeStream Application * 00003 * Copyright (C) 2007 by David Gamez * 00004 * david@davidgamez.eu * 00005 * Version 0.1 * 00006 * * 00007 * This program is free software; you can redistribute it and/or modify * 00008 * it under the terms of the GNU General Public License as published by * 00009 * the Free Software Foundation; either version 2 of the License, or * 00010 * (at your option) any later version. * 00011 * * 00012 * This program is distributed in the hope that it will be useful, * 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00015 * GNU General Public License for more details. * 00016 * * 00017 * You should have received a copy of the GNU General Public License * 00018 * along with this program; if not, write to the * 00019 * Free Software Foundation, Inc., * 00020 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00021 ***************************************************************************/ 00022 00023 #ifndef CONNECTIONPARAMETERVIEWER_H 00024 #define CONNECTIONPARAMETERVIEWER_H 00025 00026 //SpikeStream includes 00027 #include "DBInterface.h" 00028 00029 //Qt includes 00030 #include <qxml.h> 00031 #include <qdialog.h> 00032 #include <qwidget.h> 00033 #include <qlayout.h> 00034 00035 //----------------------- Connection Parameter Viewer ----------------------- 00036 /*! Displays the parameters of connection group. */ 00037 /* FIXME IN THE FUTURE THIS SHOULD ENABLE THE USER TO CREATE A NEW CONNECTION 00038 GROUP BASED ON THESE PARAMETERS. 00039 FIXME THIS SHOULD DELETE ITSELF WHEN THE WINDOW IS CLOSED. */ 00040 //-------------------------------------------------------------------------- 00041 00042 class ConnectionParameterViewer : public QDialog, public QXmlDefaultHandler { 00043 Q_OBJECT 00044 00045 public: 00046 ConnectionParameterViewer(QWidget* parent, DBInterface* netDBInter, unsigned int cGrpID); 00047 ~ConnectionParameterViewer(); 00048 bool loadError(); 00049 00050 00051 protected: 00052 //Parsing methods inherited from QXmlDefaultHandler 00053 bool characters ( const QString & ch ); 00054 bool endElement( const QString&, const QString&, const QString& ); 00055 bool startDocument(); 00056 bool startElement( const QString&, const QString&, const QString& , const QXmlAttributes& ); 00057 00058 //Error handling methods inherited from QXmlDefaultHandler 00059 bool error ( const QXmlParseException & exception ); 00060 QString errorString(); 00061 bool fatalError ( const QXmlParseException & exception ); 00062 bool warning ( const QXmlParseException & exception ); 00063 00064 00065 private slots: 00066 void okButtonPressed(); 00067 void cancelButtonPressed(); 00068 00069 00070 private: 00071 //=========================== VARIABLES ============================= 00072 /*! Database connection.*/ 00073 DBInterface* networkDBInterface; 00074 00075 /*! The connection group whose parameters are being displayed.*/ 00076 unsigned int connGrpID; 00077 00078 /*! Stores the current element. */ 00079 QString currentElement; 00080 00081 /*! Records whether there has been an error during parsing. */ 00082 bool parseError; 00083 00084 /*! Error messages generated during parsing. */ 00085 QString parseErrorString; 00086 00087 /*! The current horizontal box.*/ 00088 QHBoxLayout* currentHBox; 00089 00090 /*! The main vertical box for the widget.*/ 00091 QVBoxLayout* mainVerticalBox; 00092 00093 /*! Records if there has been an error during startup.*/ 00094 bool errorState; 00095 00096 00097 //=========================== METHODS =============================== 00098 /*! Declare copy constructor private so it cannot be used inadvertently.*/ 00099 ConnectionParameterViewer (const ConnectionParameterViewer&); 00100 00101 /*! Declare assignment private so it cannot be used inadvertently.*/ 00102 ConnectionParameterViewer operator = (const ConnectionParameterViewer&); 00103 00104 }; 00105 00106 #endif//CONNECTIONPARAMETERVIEWER_H 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118
1.4.4