itom 2.0.0
D:/git-itom/sources/itom/Qitom/organizer/helpSystem.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 HELPSYSTEM_H
00024 #define HELPSYSTEM_H
00025 
00026 #include "../../common/sharedStructures.h"
00027 
00028 #include <qdir.h>
00029 #include <qstring.h>
00030 #include <qmap.h>
00031 #include <qpair.h>
00032 
00033 namespace ito
00034 {
00035 
00036 class HelpSystem
00037 {
00038 public:
00039     static HelpSystem* getInstance();
00040 
00041     QString getHelpCollectionAbsFileName() const;
00042     inline bool isUpToDate() const { return m_upToDate; };
00043     RetVal rebuildHelpIfNotUpToDate();
00044 
00045 protected:
00046 
00047 private:
00048     HelpSystem(void);
00049     HelpSystem(HelpSystem  &/*copyConstr*/) {}
00050     ~HelpSystem(void);
00051 
00052     RetVal scanDocumentationFiles(QStringList &qchFiles, quint16 &checksum);
00053     RetVal scanPluginQhpFiles(quint16 &checksum);
00054     RetVal getCheckSumOfBuild(QDir &helpDir, QString &projectFileName, quint16 &checksum);
00055     RetVal getCheckSumOfPluginBuild(quint16 &checksum);
00056 
00057     RetVal rebuildHelpCollection(QStringList &qchFiles, quint16 checksum, QDir &helpDir);
00058 
00059     RetVal buildPluginHelp(quint16 checksum);
00060     RetVal buildSinglePluginHelp(const QString &pluginFolder, QDir &buildDir, QDir &sourceDir, QString &tocs, QString &keywords, QString &files, QPair<QString,QString> &mainFileInfo);
00061     RetVal analyzeQhpFile(const QString &pluginFolder, QFile &qhpFile, QString &tocs, QString &keywords, QString &files, QStringList &filesToCopy, QPair<QString,QString> &mainFileInfo);
00062     QString modifyTocs(const QString &in, const QString &hrefPrefix, QString &mainFile);
00063     QString modifyKeywords(const QString &in, const QString &hrefPrefix);
00064     QString modifyFiles(const QString &in, const QString &hrefPrefix, const QStringList &excludeContent, QStringList &filesToCopy);
00065     RetVal modifyHrefInHtmlFile(const QString &htmlFile, const QString &prefix);
00066 
00067     static bool removeDir(const QDir &directory);
00068     static bool copyDir(const QDir &src, const QDir &dst);
00069     static bool copyFile(const QFileInfo &srcFileInfo, QDir &dstFolder);
00070 
00071 
00072     QDir m_helpDirectory;
00073     QMap<QString, quint16> m_registeredFilesQCH;
00074     QString m_helpCollectionName;
00075     QString m_helpCollectionProject;
00076     QString m_pluginHelpCollectionName;
00077     QString m_pluginHelpCollectionProject;
00078     bool m_upToDate;
00079 
00080 
00081 
00082 
00083     static HelpSystem *m_pHelpSystem;
00084 
00086     class HelpSystemSingleton
00087     {
00088         public:
00089             ~HelpSystemSingleton()
00090             {
00091                 #pragma omp critical
00092                 {
00093                     if( HelpSystem::m_pHelpSystem != NULL)
00094                     {
00095                         delete HelpSystem::m_pHelpSystem;
00096                         HelpSystem::m_pHelpSystem = NULL;
00097                     }
00098                 }
00099             }
00100     };
00101     friend class HelpSystemSingleton;
00102 
00103 };
00104 
00105 }; //namespace ito
00106 
00107 #endif
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends