Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef __PROJECTMANAGER_HPP___
00043 #define __PROJECTMANAGER_HPP___
00044
00045
00046 #include <openfluid/dllexport.hpp>
00047 #include <string>
00048 #include <QString>
00049 #include <QVariant>
00050 #include <QSettings>
00051
00052 namespace openfluid { namespace base {
00053
00054
00055
00056
00057
00058 class DLLEXPORT ProjectManager
00059 {
00060 private:
00061
00062 static ProjectManager* mp_Singleton;
00063
00064 QSettings* mp_PrjFile;
00065
00066 std::string m_Path;
00067
00068 std::string m_Name;
00069 std::string m_Description;
00070 std::string m_Authors;
00071 std::string m_CreationDate;
00072 std::string m_LastModDate;
00073 bool m_IsIncOutputDir;
00074
00075 std::string m_OutputDir;
00076 std::string m_InputDir;
00077
00078 bool m_IsOpened;
00079
00080 static QString m_GroupName;
00081
00082
00083 ProjectManager();
00084
00085 static std::string getNow();
00086
00087 static std::string getFilePathFromProjectPath(std::string ProjectPath);
00088
00089 static std::string getInputDirFromProjectPath(std::string ProjectPath);
00090
00091 static std::string getOuputDirFromProjectPath(std::string ProjectPath);
00092
00093 static bool checkProject(const std::string& ProjectPath);
00094
00095
00096 public:
00097
00098 static ProjectManager* getInstance();
00099
00100 ~ProjectManager();
00101
00102 std::string getPath() const { return m_Path; };
00103
00104 std::string getName() const { return m_Name; };
00105
00106 void setName(const std::string& Name) { m_Name = Name; };
00107
00108 std::string getDescription() const { return m_Description; };
00109
00110 void setDescription(const std::string& Description) { m_Description = Description; };
00111
00112 std::string getAuthors() const { return m_Authors; };
00113
00114 void setAuthors(const std::string& Authors) { m_Authors = Authors; };
00115
00116 std::string getCreationDate() const { return m_CreationDate; };
00117
00118 void setCreationDate(const std::string& CreationDate) { m_CreationDate = CreationDate; };
00119
00120 void setCreationDateAsNow() { m_CreationDate = getNow(); };
00121
00122 std::string getLastModDate() const { return m_LastModDate; };
00123
00124 void setLastModDate(const std::string& LastModDate) { m_LastModDate = LastModDate; };
00125
00126 std::string getOutputDir() { return m_OutputDir; };
00127
00128 std::string getInputDir() const { return m_InputDir; };
00129
00130 bool isIncrementalOutputDir() const { return m_IsIncOutputDir; };
00131
00132 void setIncrementalOutputDir(const bool Inc) { m_IsIncOutputDir = Inc; };
00133
00134 bool open(const std::string& Path);
00135
00136 bool create(const std::string& Path, const std::string& Name,
00137 const std::string& Description, const std::string& Authors,
00138 const bool Inc);
00139
00140 bool isOpened() const { return m_IsOpened; };
00141
00142 bool save();
00143
00144 void close();
00145
00146 static bool isProject(const std::string& Path);
00147
00148 static bool getProjectInfos(const std::string& Path,
00149 std::string& Name, std::string& Description, std::string& Authors,
00150 std::string& CreationDate, std::string& LastModDate);
00151
00152 void updateOutputDir();
00153
00154 QVariant getConfigValue(const QString& Group, const QString& Key) const;
00155
00156 void setConfigValue(const QString& Group, const QString& Key, const QVariant& Value);
00157
00158 };
00159
00160
00161 } }
00162
00163
00164 #endif