itom 1.3.0
D:/git-itom/sources/itom/Qitom/ui/widgetPropHelpDock.h
00001 /* ********************************************************************
00002     itom software
00003     URL: http://www.uni-stuttgart.de/ito
00004     Copyright (C) 2013, Institut für Technische Optik (ITO),
00005     Universität Stuttgart, Germany
00006 
00007     This file is part of itom.
00008 
00009     itom is free software; you can redistribute it and/or modify it
00010     under the terms of the GNU Library General Public Licence as published by
00011     the Free Software Foundation; either version 2 of the Licence, or (at
00012     your option) any later version.
00013 
00014     itom is distributed in the hope that it will be useful, but
00015     WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
00017     General Public Licence for more details.
00018 
00019     You should have received a copy of the GNU Library General Public License
00020     along with itom. If not, see <http://www.gnu.org/licenses/>.
00021 *********************************************************************** */
00022 
00023 #ifndef WIDGETPROPHELPDOCK_H
00024 #define WIDGETPROPHELPDOCK_H
00025 
00026 #include "abstractPropertyPageWidget.h"
00027 
00028 #include <qwidget.h>
00029 #include <qstring.h>
00030 
00031 #include "ui_widgetPropHelpDock.h"
00032 #include "helper/fileDownloader.h"
00033 #include <qlist.h>
00034 #include <qdir.h>
00035 #include <qxmlstream.h>
00036 
00037 namespace ito
00038 {
00039 
00040 class WidgetPropHelpDock: public AbstractPropertyPageWidget
00041 {
00042     Q_OBJECT
00043 
00044 public:
00045     WidgetPropHelpDock(QWidget *parent = NULL);
00046     ~WidgetPropHelpDock();
00047 
00048 protected:
00049     bool event (QEvent * event);
00050 
00051 private:
00052     Ui::WidgetPropHelpDock ui;
00053 
00054     enum UpdateState
00055     {
00056         stateUnknown = 0,
00057         stateUpToDate,
00058         stateUpdateAvailable,
00059         stateDownloadAvailable,
00060         stateWrongScheme,
00061     };
00062 
00063     struct DatabaseInfo
00064     {
00065         bool        isChecked;
00066         UpdateState updateState;
00067         int         version;
00068         int         schemeID;
00069         QString     name;
00070         QString     date;
00071         QFileInfo   path;
00072         QUrl        url;
00073     };
00074 
00075     // Functions
00076     void readSettings();
00077     void writeSettings();
00078     void getHelpList();
00079     void refreshExistingDBs();
00080     void initMenus();
00081     void compareDatabaseVersions();
00082     void updateCheckedIdList();
00083     void setExistingDBsChecks();
00084     QPair<int, DatabaseInfo> parseFile(QXmlStreamReader& xml);
00085     void updateTreeWidget();
00086     void refreshUpdatableDBs();
00087     void setUpdateColumnText(QTreeWidgetItem *widget);
00088     void showInGraphicalShell(const QString & filePath);
00089     void showErrorMessage(const QString &error);
00090 
00091 
00092 
00093     // Variables
00094     QString m_pdbPath;
00095     bool m_listChanged;
00096     bool m_treeIsUpdating;
00097     bool m_downloadTimeoutReached;
00098     int  m_downloadTimeout;                         
00099     QUrl m_serverAdress;                            
00101     // Lists and Co
00102     QMap< int, DatabaseInfo > existingDBs;          
00103     QMap< int, DatabaseInfo > updatableDBs;         
00104     QList< int > checkedIdList;                     
00106     // Menu
00107     QMenu* m_pContextMenu;                          
00108     std::map<QString,QAction*> contextMenuActions;  
00110     // Consts
00111     static const int m_urID = Qt::UserRole + 1;     
00112     static const int m_urUD = Qt::UserRole + 2;     
00113     static const int m_urFD = Qt::UserRole + 3;     
00114     static const int SCHEME_ID = 1;                 
00115     QString m_xmlFileName;
00116 
00117 signals:
00118 
00119 public slots:
00120 
00121 
00122 private slots:
00123     void on_treeWidgetDB_itemChanged(QTreeWidgetItem * item, int column);
00124     void on_checkModules_stateChanged (int state);
00125     void on_checkFilters_stateChanged (int state);
00126     void on_checkWidgets_stateChanged (int state);
00127     void on_checkDataIO_stateChanged (int state);
00128     void on_spinTimeout_valueChanged(int i);
00129     void refreshButtonClicked();
00130     void mnuDownloadUpdate();
00131     void mnuLocateOnDisk();
00132     void mnuRemoveDatabase();
00133     void treeWidgetContextMenuRequested(const QPoint &pos);
00134     void downloadTimeoutReached();
00135 };
00136 
00137 } //end namespace ito
00138 
00139 #endif
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends