Project.h

Go to the documentation of this file.
00001 #ifndef PROJECT_H
00002 #define PROJECT_H
00003 
00004 #include "ItemTreeNode.h"
00005 #include "QDebug"
00006 
00007 class SgNode;
00008 class SgProject;
00009 class SgSourceFile;
00010 class SgBinaryFile;
00011 
00012 
00013 class ProjectNode;
00014 class ProjectManagerRootNode;
00015 
00016 class MetricsConfig;
00017 
00018 class TaskList;
00019 class QWidget;
00020 
00036 class ProjectManager : public ItemTreeNode
00037 {
00038     public:
00039         virtual ~ProjectManager();
00040 
00041         static ProjectManager * instance();
00042 
00045         int addProject(const QString & projectName);
00046 
00048         ProjectNode * getProject(int id);
00049         int getProjectCount() const;
00050         SgProject * getSgProject(int id);
00051         
00055         MetricsConfig * getMetricsConfig(int id);
00056         
00057         MetricsConfig *getMetricsConfig( SgNode *node );
00058 
00060         void setTaskListWidget     (TaskList * l)   { taskListWdg = l; }
00061         void setTaskMsgOutputWidget(QWidget * wdg)  { taskOutputWdg = wdg; }
00062 
00063         TaskList * taskListWidget()   { Q_ASSERT(taskListWdg);   return taskListWdg; }
00064         QWidget  * taskOutputWidget() { Q_ASSERT(taskOutputWdg); return taskOutputWdg; }
00065 
00066         ProjectManagerRootNode * getModelRootNode();
00067 
00068         int getIdFromSgProject(SgProject * proj);
00069 
00070         void storeProjectState();
00071         void loadProjectState( int argc, char **argv );
00072 
00073     private:
00074         //singleton
00075         static ProjectManager * single;
00076         ProjectManager();
00077 
00078         ProjectManagerRootNode * rootNode;
00079 
00080         TaskList * taskListWdg;
00081         QWidget * taskOutputWdg;
00082 };
00083 
00087 class ProjectManagerRootNode : public ItemTreeNode
00088 {
00089     public:
00090         ProjectManagerRootNode()
00091             : ItemTreeNode()
00092         {}
00093 
00094         virtual QStringList sectionHeader() const
00095         {
00096             static QStringList l = QStringList() << "Element";
00097             return l;
00098         }
00099 };
00100 
00101 class SgFile;
00102 class SourceFileNode;
00103 class BinaryFileNode;
00104 class SourceFileHeaderNode;
00105 class BinaryFileHeaderNode;
00106 class SgIncidenceDirectedGraph;
00107 
00108 
00115 class ProjectNode : public ItemTreeNode
00116 {
00117     public:
00119         ProjectNode(const QString & name);
00120         virtual ~ProjectNode();
00121 
00124         //ProjectNode(const QString & name, SgProject * initProj);
00125 
00128         bool addFile(const QString & path);
00129 
00131         void addBinaryFile(const QList<SourceFileNode *> & sourceFileNode);
00132 
00133 
00137         QStringList getCommandLine() const;
00138         void addToCommandLine(const QString & string);
00139         void setCommandLine(const QStringList & l);
00140         
00142         void showCmdLineDialog();
00143 
00144 
00145         SgProject * getSgProject()         { return sgProject; }
00146         MetricsConfig * getMetricsConfig() { return metricsConfig; }
00147 
00148 
00149         int getSourceFileCount() const;
00150         SourceFileNode * getSourceFile(int id) const;
00151 
00152         int getBinaryFileCount() const;
00153         BinaryFileNode * getBinaryFile(int id) const;
00154 
00155         
00158         SgIncidenceDirectedGraph * getCallGraph();
00159         
00160         //  ----  Implementation of ItemTreeNode Interface  ---------
00161         virtual QVariant data(int role, int column=0) const;
00162 
00163 
00164         const QString & getName() const { return name;}
00165 
00166 
00167 
00168     protected:
00169         QString name;
00170         SgProject * sgProject;
00171         MetricsConfig *metricsConfig;
00172 
00173         SgIncidenceDirectedGraph * callGraph;
00174 
00178         inline void createSrcFileHeaderNode();
00179         inline void createBinFileHeaderNode();
00180 
00181         SourceFileHeaderNode * srcFileHeaderNode;
00182         BinaryFileHeaderNode * binFileHeaderNode;
00183 };
00184 
00188 class SourceFileHeaderNode : public ItemTreeNode
00189 {
00190     public:
00191         virtual QVariant data(int role, int column=0) const;
00192 };
00193 
00194 
00195 class ProjectNode;
00196 class RoseFrontendTask;
00197 
00202 class SourceFileNode : public QObject, public ItemTreeNode
00203 {
00204     Q_OBJECT
00205     friend class ProjectNode;
00206 
00207     public:
00208         virtual ~SourceFileNode();
00209 
00210 
00211         const QString & getPath() const          { return path;}
00212         const QString & getFileName() const      { return filename; }
00213         SgSourceFile * getSgSourceFile() const   { return sgSourceFile; }
00214 
00215         virtual QVariant data(int role, int column=0) const;
00216 
00217         virtual void rebuild();
00218 
00219 
00220     protected slots:
00221         void buildTaskFinished();
00222 
00223     protected:
00224 
00225         // only the projectNode can create new SourceFileNodes
00226         SourceFileNode(const QString & path);
00227 
00228 
00229         QString path;
00230         QString filename;
00231         SgSourceFile * sgSourceFile;
00232 
00233         RoseFrontendTask * task;
00234 
00236         QList<BinaryFileNode*> binaries;
00237 };
00238 
00239 
00240 
00244 class BinaryFileHeaderNode :   public ItemTreeNode
00245 {
00246     public:
00247         virtual QVariant data(int role, int column=0) const;
00248 
00249 };
00250 
00251 class ProjectNode;
00252 class GccCompileTask;
00253 
00257 class BinaryFileNode : public QObject, public ItemTreeNode
00258 {
00259     Q_OBJECT
00260 
00261     friend class ProjectNode;
00262     public:
00263         virtual ~BinaryFileNode();
00264 
00265         virtual QVariant data(int role, int column=0) const;
00266 
00267         SgBinaryFile *getSgBinaryFile() const { return sgBinaryFile; }
00268 
00269         virtual void rebuild();
00270 
00271     protected slots:
00272         void frontendTaskFinished();
00273         void buildTaskFinished();
00274 
00275     protected:
00276         void submitCompileTask();
00277         void submitFrontendTask();
00278 
00279         // only the projectNode can create new SourceFileNodes
00280         // add an existing binary file
00281         BinaryFileNode(const QString & path);
00282 
00283         BinaryFileNode(const QList<SourceFileNode*> & sources, const QString & outputPath);
00284 
00285         QString path;
00286         QString filename;
00287 
00288         QList<SourceFileNode*> sourceFiles;
00289 
00290         GccCompileTask *   compileTask;
00291         RoseFrontendTask * frontendTask;
00292 
00294         SgBinaryFile * sgBinaryFile;
00295 };
00296 
00297 
00298 #endif

Generated on Tue Sep 15 14:48:47 2009 for RoseQtWidgets by  doxygen 1.4.7