KDevelop API Documentation

trollprojectwidget.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2001 by Bernd Gehrmann                                  *
00003  *   bernd@kdevelop.org                                                    *
00004  *   Copyright (C) 2002 by Jakob Simon-Gaarde                              *
00005  *   jakob@jsg.dk                                                          *
00006  *   Copyright (C) 2002-2003 by Alexander Dymo                             *
00007  *   cloudtemple@mksat.net                                                 *
00008  *   Copyright (C) 2003 by Thomas Hasart                                   *
00009  *   thasart@gmx.de                                                        *
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef _TROLLPROJECTWIDGET_H_
00019 #define _TROLLPROJECTWIDGET_H_
00020 
00021 #include <qdict.h>
00022 #include <qlistview.h>
00023 #include <qmap.h>
00024 #include <qstrlist.h>
00025 #include <qvbox.h>
00026 #include <qtoolbutton.h>
00027 #include <kiconloader.h>
00028 #include <klocale.h>
00029 #include <kdeversion.h>
00030 #include <qbutton.h>
00031 #include <qfileinfo.h>
00032 #include <qptrlist.h>
00033 #include "filebuffer.h"
00034 #include "projectconfigurationdlg.h"
00035 #include "choosesubprojectdlg.h"
00036 #include "filepropertydlg.h"
00037 #include "newwidgetdlg.h"
00038 #include "domutil.h"
00039 
00040 class TrollProjectPart;
00041 class KListView;
00042 class SubqmakeprojectItem;
00043 class GroupItem;
00044 class FileItem;
00045 class FileBuffer;
00046 
00047 
00051 struct ProjectConfiguration
00052 {
00053   QMakeTemplate   m_template;
00054   QMakeBuildMode  m_buildMode;
00055   QMakeWarnings   m_warnings;
00056   int             m_requirements;
00057   QString         m_destdir;
00058   QString         m_target;
00059   QString         m_subdirName;
00060   QStringList     m_includepath;
00061   QString         m_libraryversion;
00062   QStringList     m_librarypath;
00063   QString         m_objectpath;
00064   QString         m_uipath;
00065   QString         m_mocpath;
00066   QString         m_makefile;
00067   QStringList     m_defines;
00068   QStringList     m_cxxflags_debug;
00069   QStringList     m_cxxflags_release;
00070   QStringList     m_lflags_debug;
00071   QStringList     m_lflags_release;
00072   QStringList     m_libadd;
00073   QStringList     m_incadd;
00074 
00075   QString         idl_compiler;
00076   QString         idl_options;
00077   QStringList     m_prjdeps;
00078   QStringList     m_incdeps;
00079   bool            m_inheritconfig;
00080   bool            m_target_install;
00081   QString         m_target_install_path;
00082 };
00083 
00084 
00088 class qProjectItem : public QListViewItem
00089 {
00090 public:
00091     enum Type { Subproject, Group, File };
00092 
00093     qProjectItem(Type type, QListView *parent, const QString &text);
00094     qProjectItem(Type type, qProjectItem *parent, const QString &text);
00095 
00096     QString scopeString;
00097     Type type()
00098         { return typ; }
00099 
00100 private:
00101     Type typ;
00102     void init();
00103 
00104 };
00105 
00106 
00110 class SubqmakeprojectItem : public qProjectItem
00111 {
00112 public:
00113     SubqmakeprojectItem(QListView *parent, const QString &text,const QString &scopeString);
00114     SubqmakeprojectItem(SubqmakeprojectItem *parent, const QString &text, const QString &scopeString);
00115     ~SubqmakeprojectItem();
00116 
00117     QString subdir;
00118     QString relpath;
00119     QString path;
00120     QString pro_file;
00121     QPtrList<GroupItem> groups;
00122     QPtrList<SubqmakeprojectItem> scopes;
00123 
00124     // Containers of included an excluded files
00125     QStringList subdirs;
00126     QStringList subdirs_exclude;
00127     QStringList sources;
00128     QStringList sources_exclude;
00129     QStringList headers;
00130     QStringList headers_exclude;
00131     QStringList forms;
00132     QStringList forms_exclude;
00133 
00134     QStringList distfiles;
00135     QStringList distfiles_exclude;
00136     QStringList images;
00137     QStringList images_exclude;
00138     QStringList lexsources;
00139     QStringList lexsources_exclude;
00140     QStringList yaccsources;
00141     QStringList yaccsources_exclude;
00142     QStringList translations;
00143     QStringList translations_exclude;
00144     QStringList idls;
00145     QStringList idls_exclude;
00146 
00147 
00148 
00149     ProjectConfiguration configuration;
00150 
00151     FileBuffer m_FileBuffer;
00152     FileBuffer *m_RootBuffer;
00153     bool isScope;
00154     QString getRelativPath();
00155     QString getDownDirs();
00156     QString getLibAddPath(QString downDirs);
00157     QString getLibAddObject(QString downDirs);
00158     QString getSharedLibAddObject(QString downDirs);
00159     QString getApplicationObject(QString downDirs);
00160     QString getIncAddPath(QString downDirs);
00161 
00162 private:
00163     void init();
00164 };
00165 
00166 class ProjectConfigurationDlg;
00167 
00168 class InsideCheckListItem:public QCheckListItem
00169 {
00170 public:
00171   InsideCheckListItem(QListView *parent,SubqmakeprojectItem *item, ProjectConfigurationDlg *config):
00172     QCheckListItem(parent, item->relpath.right(item->relpath.length()-1), QCheckListItem::CheckBox)
00173   {
00174     prjItem=item;
00175     m_config = config;
00176   }
00177   InsideCheckListItem(QListView *parent,QListViewItem *after,SubqmakeprojectItem *item, ProjectConfigurationDlg *config):
00178       QCheckListItem(parent,
00179 #if KDE_VERSION > 305
00180              after,
00181 #endif
00182              item->relpath.right(item->relpath.length()-1),QCheckListItem::CheckBox)
00183   {
00184     prjItem=item;
00185     m_config = config;
00186   }
00187   SubqmakeprojectItem *prjItem;
00188   ProjectConfigurationDlg *m_config;
00189 
00190 protected:
00191     virtual void stateChange ( bool state );
00192 };
00193 
00194 
00195 
00196 class GroupItem : public qProjectItem
00197 {
00198 public:
00199     enum GroupType {NoType, Sources, Headers, Forms,Distfiles,Images,Lexsources,Yaccsources,Translations,IDLs, InstallRoot, InstallObject};
00200 
00201     static GroupType groupTypeForExtension(const QString &ext);
00202 
00203     GroupItem(QListView *lv, GroupType type, const QString &text,const QString &scopeString);
00204 
00205     // qmake INSTALLS support
00206     QString             install_objectname;
00207     QString             install_path;
00208     QPtrList<GroupItem> installs;
00209     QPtrList<FileItem>  files;
00210 
00211     QStringList         str_files;
00212     QStringList         str_files_exclude;
00213     // end qmake INSTALLS support
00214     GroupType           groupType;
00215     SubqmakeprojectItem*     owner;
00216 };
00217 
00218 
00219 // Not sure if this complexity is really necessary...
00220 class FileItem : public qProjectItem
00221 {
00222 public:
00223     FileItem(QListView *lv, const QString &text,bool exclude=false);
00224 
00225     QString uiFileLink;
00226     QString name;
00227     bool excluded;
00228 };
00229 
00230 
00231 class TrollProjectWidget : public QVBox
00232 {
00233     Q_OBJECT
00234 
00235 public:
00236     TrollProjectWidget(TrollProjectPart *part);
00237     ~TrollProjectWidget();
00238 
00239     void openProject(const QString &dirName);
00240     void closeProject();
00241 
00245     QStringList allSubprojects();
00249     QStringList allLibraries();
00253     QStringList allFiles();
00257     QString projectDirectory();
00261     QString subprojectDirectory();
00265     QString getCurrentTarget();
00266 
00267     QString getCurrentDestDir();
00268 
00269     QString getCurrentOutputFilename();
00270 
00271     GroupItem *createGroupItem(GroupItem::GroupType groupType, const QString &name, const QString &scopeName);
00272     FileItem *createFileItem(const QString &name);
00273 
00274     SubqmakeprojectItem* getScope(SubqmakeprojectItem *baseItem,const QString &scopeString); // baseItem must be ansister
00275     void updateProjectFile(QListViewItem *item);
00276     void updateProjectConfiguration(SubqmakeprojectItem *item);
00277     void updateInstallObjects(SubqmakeprojectItem* item, FileBuffer *subBuffer);
00278     void addFileToCurrentSubProject(GroupItem *titem,const QString &filename);
00279     void addFileToCurrentSubProject(GroupItem::GroupType gtype,const QString &filename);
00280     void addFiles( QStringList &files, bool noPathTruncate = false);
00281     void emitAddedFile(const QString &name);
00282     void emitRemovedFile(const QString &name);
00283 
00284     enum TrollProjectView { SubprojectView, DetailsView };
00285     void setLastFocusedView(TrollProjectView view);
00286     
00287 public slots:
00288     void slotBuildTarget();
00289     void slotRebuildTarget();
00290     void slotCleanTarget();
00291     void slotExecuteTarget();
00292 
00293     void slotBuildProject();
00294     void slotRebuildProject();
00295     void slotCleanProject();
00296     void slotExecuteProject();
00297 
00298     void slotBuildFile();
00299 
00300     void slotConfigureProject();
00301     void slotAddFiles();
00302     void slotNewFile();
00303     void slotRemoveFile();
00304 
00305 protected:
00306     virtual void focusInEvent(QFocusEvent *e);
00307     
00308 private slots:
00309     void slotOverviewSelectionChanged(QListViewItem *item);
00310     void slotOverviewContextMenu(KListView *, QListViewItem *item, const QPoint &p);
00311     void slotDetailsSelectionChanged(QListViewItem*);
00312     void slotDetailsExecuted(QListViewItem *item);
00313     void slotDetailsContextMenu(KListView *, QListViewItem *item, const QPoint &p);
00314     void slotConfigureFile();
00315     void slotAddSubdir(SubqmakeprojectItem *spitem=0);
00316     void slotRemoveSubproject(SubqmakeprojectItem *spitem=0);
00317     void slotCreateScope(SubqmakeprojectItem *spitem=0);
00318     void slotRemoveScope(SubqmakeprojectItem *spitem=0);
00319 
00320 private:
00321     void cleanDetailView(SubqmakeprojectItem *item);
00322     void buildProjectDetailTree(SubqmakeprojectItem *item, KListView *listviewControl);
00323     void removeFile(SubqmakeprojectItem *spitem, FileItem *fitem);
00324     void setupContext();
00325     void parseScope(SubqmakeprojectItem *item,QString scopeString, FileBuffer *buffer);
00326     void parse(SubqmakeprojectItem *item);
00327     GroupItem* getInstallRoot(SubqmakeprojectItem *item);
00328     GroupItem* getInstallObject(SubqmakeprojectItem *item,const QString& objectname);
00329     QString getUiFileLink(const QString &path, const QString& filename);
00330     QString getHeader();
00331     QString constructMakeCommandLine(const QString makeFileName = QString::null);
00332     void startMakeCommand(const QString &dir, const QString &target);
00333     void createMakefileIfMissing(const QString &dir, SubqmakeprojectItem *item);
00334 
00335     /*fileName: full base file name like QFileInfo::baseName ( true )*/
00336     QPtrList<SubqmakeprojectItem> findSubprojectForFile( QFileInfo fi );
00337     void findSubprojectForFile( QPtrList<SubqmakeprojectItem> &list, SubqmakeprojectItem * item, QString absFilePath );
00338 //    QString makeEnvironment();
00339 
00340     SubqmakeprojectItem *findSubprojectForScope(SubqmakeprojectItem *scope);
00341 
00342     QVBox     *overviewContainer;
00343     KListView *overview;
00344     QHBox     *projectTools;
00345     QToolButton *addSubdirButton;
00346     QToolButton *createScopeButton;
00347 
00348     QToolButton *buildProjectButton;
00349     QToolButton *rebuildProjectButton;
00350     QToolButton *executeProjectButton;
00351 
00352     QToolButton *buildTargetButton;
00353     QToolButton *rebuildTargetButton;
00354     QToolButton *executeTargetButton;
00355 
00356     QToolButton *buildFileButton;
00357     QToolButton *projectconfButton;
00358 
00359     QVBox     *detailContainer;
00360     KListView *details;
00361     QHBox     *fileTools;
00362     QToolButton *addfilesButton;
00363     QToolButton *newfileButton;
00364     QToolButton *removefileButton;
00365     QToolButton *configurefileButton;
00366 
00367     DomUtil::PairList m_subclasslist;
00368     SubqmakeprojectItem *m_shownSubproject;
00369     SubqmakeprojectItem *m_rootSubproject;
00370     TrollProjectPart *m_part;
00371 
00372     TrollProjectView m_lastFocusedView;
00373     
00374     friend class ChooseSubprojectDlg;
00375 };
00376 
00377 #endif
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 23 00:03:41 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003