itom
1.0.13
|
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 QSCIAPIMANAGER_H 00024 #define QSCIAPIMANAGER_H 00025 00026 // Under Windows, define QSCINTILLA_MAKE_DLL to create a Scintilla DLL, or 00027 // define QSCINTILLA_DLL to link against a Scintilla DLL, or define neither 00028 // to either build or link against a static Scintilla library. 00030 #define QSCINTILLA_DLL //http://www.riverbankcomputing.com/pipermail/qscintilla/2007-March/000034.html 00031 00032 #include <Qsci/qsciscintilla.h> 00033 #include <Qsci/qscilexerpython.h> 00034 #include "Qsci/qsciapis.h" 00035 00036 #include <qstringlist.h> 00037 #include <qdatetime.h> 00038 00039 namespace ito 00040 { 00041 00042 class QsciApiManager : public QObject 00043 { 00044 Q_OBJECT 00045 00046 public: 00047 static QsciApiManager * getInstance(void); 00048 00049 inline QsciAPIs *getQsciAPIs() const { qDebug("return m_pApi"); return m_pApi; } 00050 inline bool isPreparing() const { return m_isPreparing; } 00051 00052 int updateAPI(QStringList files, bool forcePreparation = false); 00053 00054 struct APIFileInfo 00055 { 00056 public: 00057 QString absoluteFilename; 00058 quint16 checksum; 00059 bool exists; 00060 QDateTime lastModified; 00061 00062 //sorting depends on filename only 00063 bool operator < (const APIFileInfo rhs) const 00064 { 00065 return absoluteFilename < rhs.absoluteFilename; 00066 } 00067 }; 00068 00069 protected: 00070 00071 private: 00072 QsciApiManager(void); 00073 inline QsciApiManager(QsciApiManager &/*copyConstr*/) : QObject(), m_isPreparing(0) {} 00074 ~QsciApiManager(void); 00075 00076 QsciAPIs* m_pApi; 00077 QsciLexerPython* m_qSciLex; 00078 00079 bool m_isPreparing; 00080 QList<APIFileInfo> m_preparingAPIFiles; 00081 QString m_preparingFileInfo; 00082 00083 bool m_loaded; 00084 00085 static QsciApiManager *m_pQsciApiManager; 00086 00088 class QsciApiSingleton 00089 { 00090 public: 00091 ~QsciApiSingleton() 00092 { 00093 #pragma omp critical 00094 { 00095 if( QsciApiManager::m_pQsciApiManager != NULL) 00096 { 00097 delete QsciApiManager::m_pQsciApiManager; 00098 QsciApiManager::m_pQsciApiManager = NULL; 00099 } 00100 } 00101 } 00102 }; 00103 friend class QsciApiSingleton; 00104 00105 signals: 00106 00107 public slots: 00108 00109 private slots: 00110 void apiPreparationFinished(); 00111 void apiPreparationCancelled(); 00112 void apiPreparationStarted(); 00113 }; 00114 } //namespace ito 00115 00116 #endif