KDevelop API Documentation

buildtools/qmake/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 public slots: 00285 void slotBuildTarget(); 00286 void slotRebuildTarget(); 00287 void slotCleanTarget(); 00288 void slotExecuteTarget(); 00289 00290 void slotBuildProject(); 00291 void slotRebuildProject(); 00292 void slotCleanProject(); 00293 void slotExecuteProject(); 00294 00295 void slotBuildFile(); 00296 00297 void slotConfigureProject(); 00298 void slotAddFiles(); 00299 void slotNewFile(); 00300 void slotRemoveFile(); 00301 00302 private slots: 00303 void slotOverviewSelectionChanged(QListViewItem *item); 00304 void slotOverviewContextMenu(KListView *, QListViewItem *item, const QPoint &p); 00305 void slotDetailsSelectionChanged(QListViewItem*); 00306 void slotDetailsExecuted(QListViewItem *item); 00307 void slotDetailsContextMenu(KListView *, QListViewItem *item, const QPoint &p); 00308 void slotConfigureFile(); 00309 void slotAddSubdir(SubqmakeprojectItem *spitem=0); 00310 void slotRemoveSubproject(SubqmakeprojectItem *spitem=0); 00311 void slotCreateScope(SubqmakeprojectItem *spitem=0); 00312 void slotRemoveScope(SubqmakeprojectItem *spitem=0); 00313 00314 private: 00315 void cleanDetailView(SubqmakeprojectItem *item); 00316 void buildProjectDetailTree(SubqmakeprojectItem *item, KListView *listviewControl); 00317 void removeFile(SubqmakeprojectItem *spitem, FileItem *fitem); 00318 void setupContext(); 00319 void parseScope(SubqmakeprojectItem *item,QString scopeString, FileBuffer *buffer); 00320 void parse(SubqmakeprojectItem *item); 00321 GroupItem* getInstallRoot(SubqmakeprojectItem *item); 00322 GroupItem* getInstallObject(SubqmakeprojectItem *item,const QString& objectname); 00323 QString getUiFileLink(const QString &path, const QString& filename); 00324 QString getHeader(); 00325 QString constructMakeCommandLine(const QString makeFileName = QString::null); 00326 void startMakeCommand(const QString &dir, const QString &target); 00327 void createMakefileIfMissing(const QString &dir, SubqmakeprojectItem *item); 00328 00329 /*fileName: full base file name like QFileInfo::baseName ( true )*/ 00330 QPtrList<SubqmakeprojectItem> findSubprojectForFile( QFileInfo fi ); 00331 void findSubprojectForFile( QPtrList<SubqmakeprojectItem> &list, SubqmakeprojectItem * item, QString absFilePath ); 00332 // QString makeEnvironment(); 00333 00334 SubqmakeprojectItem *findSubprojectForScope(SubqmakeprojectItem *scope); 00335 00336 QVBox *overviewContainer; 00337 KListView *overview; 00338 QHBox *projectTools; 00339 QToolButton *addSubdirButton; 00340 QToolButton *createScopeButton; 00341 00342 QToolButton *buildProjectButton; 00343 QToolButton *rebuildProjectButton; 00344 QToolButton *executeProjectButton; 00345 00346 QToolButton *buildTargetButton; 00347 QToolButton *rebuildTargetButton; 00348 QToolButton *executeTargetButton; 00349 00350 QToolButton *buildFileButton; 00351 QToolButton *projectconfButton; 00352 00353 QVBox *detailContainer; 00354 KListView *details; 00355 QHBox *fileTools; 00356 QToolButton *addfilesButton; 00357 QToolButton *newfileButton; 00358 QToolButton *removefileButton; 00359 QToolButton *configurefileButton; 00360 00361 DomUtil::PairList m_subclasslist; 00362 SubqmakeprojectItem *m_shownSubproject; 00363 SubqmakeprojectItem *m_rootSubproject; 00364 TrollProjectPart *m_part; 00365 00366 friend class ChooseSubprojectDlg; 00367 }; 00368 00369 #endif
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Oct 6 17:38:55 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003