KDevelop API Documentation

projectconfigurationdlg.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2002 by Jakob Simon-Gaarde                              *
00003  *   jsgaarde@tdcspace.dk                                                  *
00004  *   Copyright (C) 2002-2003 by Alexander Dymo                             *
00005  *   cloudtemple@mksat.net                                                 *
00006  *   Copyright (C) 2003 by Thomas Hasart                                   *
00007  *   thasart@gmx.de                                                        *
00008  *                                                                         *
00009  *   This program is free software; you can redistribute it and/or modify  *
00010  *   it under the terms of the GNU General Public License as published by  *
00011  *   the Free Software Foundation; either version 2 of the License, or     *
00012  *   (at your option) any later version.                                   *
00013  *                                                                         *
00014  ***************************************************************************/
00015 
00016 #include "projectconfigurationdlg.h"
00017 #include <qradiobutton.h>
00018 #include <qbuttongroup.h>
00019 #include <qcheckbox.h>
00020 #include <qmessagebox.h>
00021 #include <kfiledialog.h>
00022 #include <knotifyclient.h>
00023 #include <klineedit.h>
00024 #include <kinputdialog.h>
00025 #include <kurlrequesterdlg.h>
00026 #include <kurlrequester.h>
00027 #include <kdebug.h>
00028 #include <kiconloader.h>
00029 
00030 #include <qdialog.h>
00031 #include <qpushbutton.h>
00032 #include <qbuttongroup.h>
00033 #include <qlistview.h>
00034 #include <iostream>
00035 #include <qregexp.h>
00036 #include <qvalidator.h>
00037 #include <qtabwidget.h>
00038 #include <pathutil.h>
00039 
00040 ProjectConfigurationDlg::ProjectConfigurationDlg(SubqmakeprojectItem *_item,QListView *_prjList,QWidget* parent, const char* name, bool modal, WFlags fl)
00041 : ProjectConfigurationDlgBase(parent,name,modal,fl)
00042 //=================================================
00043 {
00044   myProjectItem=_item;
00045   prjList=_prjList;
00046 //  m_projectConfiguration = conf;
00047   m_targetLibraryVersion->setValidator(new QRegExpValidator(
00048     QRegExp("\\d+(\\.\\d+)?(\\.\\d+)"), this));
00049   UpdateControls();
00050 }
00051 
00052 
00053 ProjectConfigurationDlg::~ProjectConfigurationDlg()
00054 //==============================================
00055 {
00056 }
00057 
00058 //void ProjectConfigurationDlg::radioLibrarytoggled(bool on)
00060 //{
00061 //  if(!on) checkStatic->setChecked(false);
00062 //  checkStatic->setEnabled(on);
00063 //  m_targetLibraryVersion->setEnabled(on);
00064 //}
00065 
00066 /*
00067 void ProjectConfigurationDlg::radioLibrarytoggled(bool on)
00068 //=============================================
00069 {
00070     groupLibrary->setEnabled(on);
00071     //radioShared->setChecked(true);
00072     m_targetLibraryVersion->setEnabled(on);
00073 }
00074 */
00075 void ProjectConfigurationDlg::browseTargetPath()
00076 //==============================================
00077 {
00078   m_targetPath->setText(getRelativePath(myProjectItem->path,KFileDialog::getExistingDirectory()));
00079 }
00080 
00081 
00082 void ProjectConfigurationDlg::updateProjectConfiguration()
00083 //=======================================================
00084 {
00085   // Template
00086   myProjectItem->configuration.m_requirements = 0;
00087 
00088   if (radioApplication->isChecked())
00089   {
00090     myProjectItem->configuration.m_template = QTMP_APPLICATION;
00091     myProjectItem->setPixmap(0,SmallIcon("qmake_app"));
00092   }
00093   else if (radioLibrary->isChecked())
00094   {
00095     myProjectItem->configuration.m_template = QTMP_LIBRARY;
00096     if (staticRadio->isOn())
00097       myProjectItem->configuration.m_requirements += QD_STATIC;
00098     if (sharedRadio->isOn()){
00099       myProjectItem->configuration.m_requirements += QD_SHARED;
00100       myProjectItem->configuration.m_libraryversion = m_targetLibraryVersion->text();
00101     }
00102     if (pluginRadio->isOn())
00103       myProjectItem->configuration.m_requirements += QD_PLUGIN;
00104     myProjectItem->setPixmap(0,SmallIcon("qmake_lib"));
00105   }
00106   else if (radioSubdirs->isChecked())
00107   {
00108     myProjectItem->configuration.m_template = QTMP_SUBDIRS;
00109     myProjectItem->setPixmap(0,SmallIcon("qmake_sub"));
00110   }
00111 
00112   // Buildmode
00113   if (radioDebugMode->isChecked())
00114     myProjectItem->configuration.m_buildMode = QBM_DEBUG;
00115   if (radioReleaseMode->isChecked())
00116     myProjectItem->configuration.m_buildMode = QBM_RELEASE;
00117 
00118   // requirements
00119   if (exceptionCheck->isChecked())
00120     myProjectItem->configuration.m_requirements += QD_EXCEPTIONS;
00121   if (stlCheck->isChecked())
00122     myProjectItem->configuration.m_requirements += QD_STL;
00123   if (rttiCheck->isChecked())
00124     myProjectItem->configuration.m_requirements += QD_RTTI;
00125   if (checkQt->isChecked())
00126     myProjectItem->configuration.m_requirements += QD_QT;
00127   if (checkOpenGL->isChecked())
00128     myProjectItem->configuration.m_requirements += QD_OPENGL;
00129   if (checkThread->isChecked())
00130     myProjectItem->configuration.m_requirements += QD_THREAD;
00131   if (checkX11->isChecked())
00132     myProjectItem->configuration.m_requirements += QD_X11;
00133   if (checkOrdered->isChecked())
00134     myProjectItem->configuration.m_requirements += QD_ORDERED;
00135 
00136   // Warnings
00137   myProjectItem->configuration.m_warnings = QWARN_OFF;
00138   if (checkWarning->isChecked())
00139     myProjectItem->configuration.m_warnings = QWARN_ON;
00140 
00141   myProjectItem->configuration.m_target = "";
00142 /*  if ((m_targetPath->text().simplifyWhiteSpace()!="" ||
00143       m_targetOutputFile->text().simplifyWhiteSpace()!="") &&
00144       !radioSubdirs->isChecked())
00145   {
00146     QString outputFile = m_targetOutputFile->text();
00147     if (outputFile.simplifyWhiteSpace() == "")
00148       outputFile = myProjectItem->configuration.m_subdirName;
00149     myProjectItem->configuration.m_target = m_targetPath->text() + "/" + outputFile;
00150   }*/
00151   myProjectItem->configuration.m_target = m_targetOutputFile->text();
00152   myProjectItem->configuration.m_destdir = m_targetPath->text();
00153 //  myProjectItem->configuration.m_includepath = m_includePath->text();
00154   myProjectItem->configuration.m_defines = QStringList::split(" ",m_defines->text());
00155   myProjectItem->configuration.m_cxxflags_debug = QStringList::split(" ",m_debugFlags->text());
00156   myProjectItem->configuration.m_cxxflags_release = QStringList::split(" ",m_releaseFlags->text());
00157 //  myProjectItem->configuration.m_lflags_debug = QStringList::split(" ",m_debugFlagsLink->text());
00158 // myProjectItem->configuration.m_lflags_release = QStringList::split(" ",m_releaseFlagsLink->text());
00159 //  myProjectItem->configuration.m_librarypath = QStringList::split(" ",m_libraryPath->text());
00160   if (checkDontInheritConfig->isChecked())
00161     myProjectItem->configuration.m_inheritconfig = false;
00162   else
00163     myProjectItem->configuration.m_inheritconfig = true;
00164 
00165   //add selected includes
00166   myProjectItem->configuration.m_incadd.clear();
00167 
00168   InsideCheckListItem *insideItem=(InsideCheckListItem *)insideinc_listview->firstChild();
00169   while(insideItem)
00170   {
00171     if(insideItem->isOn()){
00172       QString tmpInc=insideItem->prjItem->getIncAddPath(myProjectItem->getDownDirs());
00173       tmpInc=QDir::cleanDirPath(tmpInc);
00174       myProjectItem->configuration.m_incadd.append(tmpInc);
00175 
00176     }
00177     insideItem=(InsideCheckListItem*)insideItem->itemBelow();
00178   }
00179 
00180   QCheckListItem *outsideItem=(QCheckListItem *)outsideinc_listview->firstChild();
00181   while(outsideItem)
00182   {
00183     myProjectItem->configuration.m_incadd.append(outsideItem->text(0));
00184     outsideItem=(QCheckListItem*)outsideItem->itemBelow();
00185   }
00186 
00187   //target.install
00188   if (checkInstallTarget->isChecked() == true)
00189   {
00190     myProjectItem->configuration.m_target_install = true;
00191     myProjectItem->configuration.m_target_install_path = m_InstallTargetPath->text();
00192   }
00193   else
00194   {
00195     myProjectItem->configuration.m_target_install = false;
00196   }
00197 
00198   //makefile
00199   myProjectItem->configuration.m_makefile = makefile_url->url();
00200 
00201   //add libs to link
00202   myProjectItem->configuration.m_libadd.clear();
00203   myProjectItem->configuration.m_librarypath.clear();
00204 
00205   //inside libs to link
00206 //  myProjectItem->configuration.m_prjdeps.clear();
00207   insideItem=(InsideCheckListItem *)insidelib_listview->firstChild();
00208   while(insideItem)
00209   {
00210     if(insideItem->isOn()){
00211 
00212       QString tmpLib=insideItem->prjItem->getLibAddObject(myProjectItem->getDownDirs());
00213       if(insideItem->prjItem->configuration.m_requirements & QD_SHARED)
00214       {
00215         tmpLib=/*"-l"+*/tmpLib;
00216 
00217         //add path if shared lib is linked
00218         QString tmpPath=insideItem->prjItem->getLibAddPath(myProjectItem->getDownDirs());
00219         if(tmpPath!=""){
00220           myProjectItem->configuration.m_librarypath.append(/*"-L"+*/tmpPath);
00221         }
00222       }
00223       myProjectItem->configuration.m_libadd.append(tmpLib);
00224 
00225     }
00226     insideItem=(InsideCheckListItem*)insideItem->itemBelow();
00227   }
00228 
00229   //outside libs to link
00230   outsideItem=(QCheckListItem *)outsidelib_listview->firstChild();
00231   while(outsideItem)
00232   {
00233     myProjectItem->configuration.m_libadd.append(outsideItem->text(0));
00234     outsideItem=(QCheckListItem*)outsideItem->itemBelow();
00235   }
00236 
00237   //external project dependencies
00238   myProjectItem->configuration.m_prjdeps.clear();
00239   QListViewItem *depItem=extDeps_view->firstChild();
00240   while(depItem)
00241   {
00242     myProjectItem->configuration.m_prjdeps.append(depItem->text(0));
00243     depItem=depItem->itemBelow();
00244   }
00245   //internal project dependencies
00246   insideItem=dynamic_cast<InsideCheckListItem *>(intDeps_view->firstChild());
00247   while(insideItem)
00248   {
00249       if (insideItem->isOn())
00250       {
00251         if(insideItem->prjItem->configuration.m_requirements & QD_STATIC)
00252         {
00253             QString tmpLib=insideItem->prjItem->getLibAddObject(myProjectItem->getDownDirs());
00254             myProjectItem->configuration.m_prjdeps.append(tmpLib);
00255         }
00256         else if(insideItem->prjItem->configuration.m_requirements & QD_SHARED)
00257         {
00258             QString tmpLib=insideItem->prjItem->getSharedLibAddObject(myProjectItem->getDownDirs());
00259             myProjectItem->configuration.m_prjdeps.append(tmpLib);
00260         }
00261         else
00262         {
00263             QString tmpApp=insideItem->prjItem->getApplicationObject(myProjectItem->getDownDirs());
00264             myProjectItem->configuration.m_prjdeps.append(tmpApp);
00265         }
00266       }
00267       insideItem=dynamic_cast<InsideCheckListItem *>(insideItem->itemBelow());
00268   }
00269 
00270   //extra lib paths
00271   QListViewItem *lvItem=outsidelibdir_listview->firstChild();
00272   while(lvItem)
00273   {
00274     myProjectItem->configuration.m_librarypath.append(lvItem->text(0));
00275     lvItem=lvItem->itemBelow();
00276   }
00277 
00278   //change build order
00279   lvItem=buildorder_listview->firstChild();
00280   myProjectItem->subdirs.clear();
00281   while(lvItem)
00282   {
00283     myProjectItem->subdirs.append(lvItem->text(0));
00284     lvItem=lvItem->itemBelow();
00285   }
00286 
00287   // intermediate locations
00288   myProjectItem->configuration.m_objectpath = objdir_url->url();
00289   myProjectItem->configuration.m_uipath = uidir_url->url();
00290   myProjectItem->configuration.m_mocpath = mocdir_url->url();
00291 
00292   //CORBA
00293   myProjectItem->configuration.idl_compiler=idlCmdEdit->url();
00294   myProjectItem->configuration.idl_options=idlCmdOptionsEdit->text();
00295 
00296   QDialog::accept();
00297 
00298 }
00299 
00300 
00301 void ProjectConfigurationDlg::UpdateControls()
00302 //============================================
00303 {
00304   QRadioButton *activateRadiobutton=NULL;
00305   // Project template
00306   libGroup->setEnabled(false);
00307   switch (myProjectItem->configuration.m_template)
00308   {
00309     case QTMP_APPLICATION:
00310       activateRadiobutton = radioApplication;
00311       break;
00312     case QTMP_LIBRARY:
00313       libGroup->setEnabled(true);
00314 
00315       activateRadiobutton = radioLibrary;
00316       staticRadio->setChecked(true); //default
00317       if (myProjectItem->configuration.m_requirements & QD_STATIC){
00318         staticRadio->setChecked(true);
00319 /*        libAddTab->setEnabled(false);
00320         libPathTab->setEnabled(false);*/
00321         libAddTab->setEnabled(true);
00322         libPathTab->setEnabled(true);
00323       }else{
00324         libAddTab->setEnabled(true);
00325         libPathTab->setEnabled(true);
00326       }
00327       if (myProjectItem->configuration.m_requirements & QD_SHARED){
00328         sharedRadio->setChecked(true);
00329         m_targetLibraryVersion->setText(myProjectItem->configuration.m_libraryversion);
00330       }
00331 
00332       if (myProjectItem->configuration.m_requirements & QD_PLUGIN)
00333         pluginRadio->setChecked(true);
00334       break;
00335     case QTMP_SUBDIRS:
00336       activateRadiobutton = radioSubdirs;
00337       break;
00338   }
00339   // Buildmode
00340   if (activateRadiobutton)
00341     activateRadiobutton->setChecked(true);
00342   switch (myProjectItem->configuration.m_buildMode)
00343   {
00344     case QBM_DEBUG:
00345       activateRadiobutton = radioDebugMode;
00346       break;
00347     case QBM_RELEASE:
00348       activateRadiobutton = radioReleaseMode;
00349       break;
00350   }
00351   if (activateRadiobutton)
00352     activateRadiobutton->setChecked(true);
00353 
00354   // Requirements
00355   if (myProjectItem->configuration.m_requirements & QD_QT)
00356     checkQt->setChecked(true);
00357   if (myProjectItem->configuration.m_requirements & QD_OPENGL)
00358     checkOpenGL->setChecked(true);
00359   if (myProjectItem->configuration.m_requirements & QD_THREAD)
00360     checkThread->setChecked(true);
00361   if (myProjectItem->configuration.m_requirements & QD_X11)
00362     checkX11->setChecked(true);
00363   if (myProjectItem->configuration.m_requirements & QD_ORDERED)
00364     checkOrdered->setChecked(true);
00365   if (myProjectItem->configuration.m_requirements & QD_EXCEPTIONS)
00366     exceptionCheck->setChecked(true);
00367   if (myProjectItem->configuration.m_requirements & QD_STL)
00368     stlCheck->setChecked(true);
00369   if (myProjectItem->configuration.m_requirements & QD_RTTI)
00370     rttiCheck->setChecked(true);
00371 
00372   // Warnings
00373   if (myProjectItem->configuration.m_warnings == QWARN_ON)
00374   {
00375     checkWarning->setChecked(true);
00376   }
00377 
00378   //makefile
00379   makefile_url->setURL(myProjectItem->configuration.m_makefile);
00380 
00381   // Target
00382 /*  QString targetString = myProjectItem->configuration.m_target;
00383   int slashPos = targetString.findRev('/');
00384 
00385   if (slashPos>=0)
00386   {
00387     m_targetPath->setText(targetString.left(slashPos));
00388     m_targetOutputFile->setText(targetString.right(targetString.length()-slashPos-1));
00389   }
00390   else
00391     m_targetOutputFile->setText(targetString);
00392 */
00393   //target.path = path
00394   //INSTALLS += target
00395   if (myProjectItem->configuration.m_target_install == true) 
00396   {
00397     checkInstallTarget->setChecked(true);
00398     m_InstallTargetPath->setEnabled(true);
00399   } 
00400   else
00401   {
00402     checkInstallTarget->setChecked(false);
00403     m_InstallTargetPath->setEnabled(false);
00404   }
00405   m_InstallTargetPath->setText(myProjectItem->configuration.m_target_install_path);
00406 
00407   
00408   
00409   m_targetOutputFile->setText(myProjectItem->configuration.m_target);
00410   m_targetPath->setText(myProjectItem->configuration.m_destdir);
00411   clickSubdirsTemplate();
00412 
00413   m_defines->setText(myProjectItem->configuration.m_defines.join(" "));
00414   m_debugFlags->setText(myProjectItem->configuration.m_cxxflags_debug.join(" "));
00415   m_releaseFlags->setText(myProjectItem->configuration.m_cxxflags_release.join(" "));
00416 
00417   if (myProjectItem->configuration.m_inheritconfig == false)
00418     checkDontInheritConfig->setChecked(true);
00419   else
00420     checkDontInheritConfig->setChecked(false);    
00421      
00422   updateIncludeControl();
00423   updateLibaddControl();
00424   updateLibDirAddControl();
00425   updateBuildOrderControl();  
00426   updateDependenciesControl();
00427 
00428   objdir_url->setURL(myProjectItem->configuration.m_objectpath);
00429   uidir_url->setURL(myProjectItem->configuration.m_uipath);
00430   mocdir_url->setURL(myProjectItem->configuration.m_mocpath);
00431 }
00432 
00433 QPtrList <qProjectItem> ProjectConfigurationDlg::getAllProjects()
00434 {
00435   QPtrList <qProjectItem> tmpPrjList;
00436   qProjectItem *item=(qProjectItem *)prjList->firstChild();
00437   while(item)
00438   {
00439     tmpPrjList.append(item);
00440     getAllSubProjects(item,&tmpPrjList);
00441     item=(qProjectItem *)item->nextSibling();
00442   }
00443   return(tmpPrjList);
00444 }
00445 
00446 void ProjectConfigurationDlg::getAllSubProjects(qProjectItem *item, QPtrList <qProjectItem> *itemList)
00447 {
00448 
00449   qProjectItem *subItem=(qProjectItem *)item->firstChild();
00450   while(subItem)
00451   {
00452     itemList->append(subItem);
00453     getAllSubProjects(subItem,itemList);
00454     subItem=(qProjectItem *)subItem->nextSibling();
00455   }
00456 }
00457 
00458 
00459 
00460 void ProjectConfigurationDlg::updateIncludeControl()
00461 {
00462   insideinc_listview->setSorting(-1,false);
00463   outsideinc_listview->setSorting(-1,false);
00464 
00465 
00466   QStringList incList=myProjectItem->configuration.m_incadd;
00467   QPtrList <qProjectItem> itemList=getAllProjects();
00468   qProjectItem *item=itemList.first();
00469 
00470   
00471   while(item){
00472     if(item->type() == qProjectItem::Subproject)
00473     {
00474 
00475       //includes
00476       //temp strlist
00477       if( ((SubqmakeprojectItem*)item)->configuration.m_template==QTMP_LIBRARY ||
00478           ((SubqmakeprojectItem*)item)->configuration.m_template==QTMP_APPLICATION){
00479           SubqmakeprojectItem *sItem=(SubqmakeprojectItem*)item;
00480          //if(sItem!=myProjectItem) //needed own path for other libs
00481          if (!sItem->isScope)
00482          {
00483               QString tmpInc=sItem->getIncAddPath(myProjectItem->getDownDirs());
00484               tmpInc=QDir::cleanDirPath(tmpInc);
00485               InsideCheckListItem *newItem=new InsideCheckListItem(insideinc_listview,insideinc_listview->lastItem(),sItem, this);
00486               QStringList::Iterator it=incList.begin();
00487 
00488           for(;it!=incList.end();++it)
00489           {
00490             if((*it).find(tmpInc)>=0){
00491               incList.remove(it);
00492               newItem->setOn(true);
00493               it=incList.begin();
00494             }
00495           }
00496         }
00497       }
00498     }
00499 //    item=(ProjectItem*)item->itemBelow();
00500     item=itemList.next();
00501   }
00502 
00503   //all other in incList are outside incs
00504   QStringList::Iterator it1=incList.begin();
00505   for(;it1!=incList.end();++it1)
00506   {
00507       new QListViewItem(outsideinc_listview,outsideinc_listview->lastItem(),(*it1));
00508   }
00509 
00510 }
00511 void ProjectConfigurationDlg::updateLibaddControl()
00512 {
00513 
00514   QPtrList <qProjectItem> itemList=getAllProjects();
00515 
00516   insidelib_listview->setSorting(-1,false);
00517   outsidelib_listview->setSorting(-1,false);
00518 
00519   //update librarys
00520   //temp strlist
00521   QStringList libList=myProjectItem->configuration.m_libadd;
00522 
00523 
00524   QStringList::Iterator it=libList.begin();
00525   for(;it!=libList.end();++it){
00526         qProjectItem *item=itemList.first();
00527         while(item){
00528           if(item->type()==qProjectItem::Subproject)
00529           {
00530 
00531             //librarys
00532             if( ((SubqmakeprojectItem*)item)->configuration.m_template==QTMP_LIBRARY ){
00533               SubqmakeprojectItem *sItem=(SubqmakeprojectItem*)item;
00534 
00535 
00536               if(sItem!=myProjectItem)
00537               {
00538                 // create lib string
00539                   QString tmpLib=sItem->getLibAddObject(myProjectItem->getDownDirs());
00540                   if(sItem->configuration.m_requirements & QD_SHARED) tmpLib=/*"-l"+*/tmpLib;
00541                   if(tmpLib==(*it)){
00542                     InsideCheckListItem *newItem=new InsideCheckListItem(insidelib_listview,insidelib_listview->lastItem(),sItem, this);
00543                     libList.remove(it);
00544                     it=libList.begin();
00545                     newItem->setOn(true);
00546                     itemList.remove(item);
00547                     item=itemList.first();
00548                   }
00549 
00550               }
00551             }
00552           }
00553           item=itemList.next();
00554         }
00555     }
00556 
00557   kdDebug()<< "itemlist count =" << itemList.count()<<endl;
00558 
00559   //add all other prj in itemList unchecked
00560   qProjectItem *item=itemList.first();
00561   while(item)
00562   {
00563     if(item->type()==qProjectItem::Subproject)
00564     {
00565       //librarys
00566       if( ((SubqmakeprojectItem*)item)->configuration.m_template==QTMP_LIBRARY ){
00567         SubqmakeprojectItem *sItem=(SubqmakeprojectItem*)item;
00568         if(sItem!=myProjectItem)
00569         {
00570           // create lib string
00571           QString tmpLib=sItem->getLibAddObject(myProjectItem->getDownDirs());
00572           if(sItem->configuration.m_requirements & QD_SHARED) tmpLib=/*"-l"+*/tmpLib;
00573           InsideCheckListItem *newItem=new InsideCheckListItem(insidelib_listview,insidelib_listview->lastItem(),sItem,this);
00574           newItem->setOn(false);
00575         }
00576       }
00577     }
00578     item=itemList.next();
00579   }
00580 
00581   //all other in libList are outside libs
00582   QStringList::Iterator it1=libList.begin();
00583   for(;it1!=libList.end();++it1)
00584   {
00585       new QListViewItem(outsidelib_listview,outsidelib_listview->lastItem(),(*it1));
00586   }
00587 }
00588 
00589 void ProjectConfigurationDlg::updateDependenciesControl( )
00590 {
00591   QPtrList <qProjectItem> itemList=getAllProjects();
00592 
00593   intDeps_view->setSorting(-1,false);
00594   extDeps_view->setSorting(-1,false);
00595 
00596   QStringList depsList=myProjectItem->configuration.m_prjdeps;
00597 
00598   QStringList::Iterator it=depsList.begin();
00599   for(;it!=depsList.end();++it){
00600         qProjectItem *item=itemList.first();
00601         while(item){
00602           if(item->type()==qProjectItem::Subproject)
00603           {
00604             if( (((SubqmakeprojectItem*)item)->configuration.m_template==QTMP_LIBRARY )
00605                 || (((SubqmakeprojectItem*)item)->configuration.m_template==QTMP_APPLICATION ) ){
00606               SubqmakeprojectItem *sItem=(SubqmakeprojectItem*)item;
00607               if ((!sItem->isScope) && (sItem!=myProjectItem))
00608               {
00609                   QString tmpLib;
00610                   if(sItem->configuration.m_requirements & QD_SHARED)
00611                     tmpLib = sItem->getSharedLibAddObject(myProjectItem->getDownDirs());
00612                   else if(sItem->configuration.m_requirements & QD_STATIC)
00613                     tmpLib=sItem->getLibAddObject(myProjectItem->getDownDirs());
00614                   else
00615                     tmpLib=sItem->getApplicationObject(myProjectItem->getDownDirs());
00616                   if(tmpLib==(*it)){
00617                     InsideCheckListItem *newItem=new InsideCheckListItem(intDeps_view,intDeps_view->lastItem(),sItem,this);
00618                     depsList.remove(it);
00619                     it=depsList.begin();
00620                     newItem->setOn(true);
00621                     itemList.remove(item);
00622                     item=itemList.first();
00623                   }
00624 
00625               }
00626             }
00627           }
00628           item=itemList.next();
00629         }
00630     }
00631 
00632   kdDebug()<< "itemlist count =" << itemList.count()<<endl;
00633 
00634   //add all other prj in itemList unchecked
00635   qProjectItem *item=itemList.first();
00636   while(item)
00637   {
00638     if(item->type()==qProjectItem::Subproject)
00639     {
00640       if( (((SubqmakeprojectItem*)item)->configuration.m_template==QTMP_LIBRARY )
00641         || (((SubqmakeprojectItem*)item)->configuration.m_template==QTMP_APPLICATION ) ){
00642         SubqmakeprojectItem *sItem=(SubqmakeprojectItem*)item;
00643         if ((!sItem->isScope) && (sItem!=myProjectItem))
00644         {
00645           QString tmpLib;
00646           if(sItem->configuration.m_requirements & QD_SHARED)
00647             tmpLib = sItem->getSharedLibAddObject(myProjectItem->getDownDirs());
00648           else if(sItem->configuration.m_requirements & QD_STATIC)
00649             tmpLib=sItem->getLibAddObject(myProjectItem->getDownDirs());
00650           else
00651             tmpLib=sItem->getApplicationObject(myProjectItem->getDownDirs());
00652           InsideCheckListItem *newItem=new InsideCheckListItem(intDeps_view,intDeps_view->lastItem(),sItem,this);
00653           newItem->setOn(false);
00654         }
00655       }
00656     }
00657     item=itemList.next();
00658   }
00659 
00660   QStringList::Iterator it1=depsList.begin();
00661   for(;it1!=depsList.end();++it1)
00662   {
00663       new QListViewItem(extDeps_view,extDeps_view->lastItem(),(*it1));
00664   }
00665 }
00666 
00667 
00668 void ProjectConfigurationDlg::updateBuildOrderControl()
00669 {
00670   //sort build order only if subdirs
00671   if(myProjectItem->configuration.m_template==QTMP_SUBDIRS)
00672   {
00673 
00674       QPtrList <qProjectItem> itemList;
00675 
00676       qProjectItem *item=(qProjectItem *)myProjectItem->firstChild();
00677       while(item){
00678         itemList.append(item);
00679         item=(qProjectItem*)item->nextSibling();
00680       }
00681 
00682 
00683 
00684     incaddTab->setEnabled(false);
00685     buildorder_listview->setSorting(-1,false);
00686     QStringList buildList=myProjectItem->subdirs;
00687     QStringList::Iterator it1=buildList.begin();
00688     for(;it1!=buildList.end();++it1){
00689       item=itemList.first();
00690       while(item){
00691         if(item->type()==qProjectItem::Subproject)
00692         {
00693           if(item->text(0)==(*it1)){
00694             new QListViewItem(buildorder_listview,buildorder_listview->lastItem(),item->text(0));
00695             itemList.take();
00696             item=itemList.first();
00697           }
00698         }
00699         item=itemList.next();;
00700       }
00701     }
00702     //add the rest
00703       item=itemList.first();
00704       while(item){
00705         if(item->type()==qProjectItem::Subproject)
00706         {
00707             new QListViewItem(buildorder_listview,buildorder_listview->lastItem(),item->text(0));
00708         }
00709         item=itemList.next();;
00710       }
00711 
00712   }else buildOrderTab->setEnabled(false);
00713 
00714 }
00715 
00716 void ProjectConfigurationDlg::updateLibDirAddControl()
00717 {
00718   //update librarys
00719   //temp strlist
00720   QStringList libDirList=myProjectItem->configuration.m_librarypath;
00721 
00722   QPtrList <qProjectItem> itemList=getAllProjects();
00723   outsidelibdir_listview->setSorting(-1,false);
00724 
00725   qProjectItem *item=itemList.first();
00726   
00727   while(item){
00728     if(item->type()==qProjectItem::Subproject)
00729     {
00730 
00731       //librarys
00732       if( ((SubqmakeprojectItem*)item)->configuration.m_template==QTMP_LIBRARY ){
00733         SubqmakeprojectItem *sItem=(SubqmakeprojectItem*)item;
00734 
00735         if(sItem!=myProjectItem)
00736         {
00737           // create lib string
00738           QString tmpLibDir=sItem->getLibAddPath(myProjectItem->getDownDirs());
00739           
00740           QStringList::Iterator it=libDirList.begin();
00741           for(;it!=libDirList.end();++it)
00742           {
00743 
00744             if((*it).find(tmpLibDir)>=0 && tmpLibDir!="" && !tmpLibDir.isEmpty()){
00745               kdDebug()<<"remove from LIBDIR   "<<(*it).ascii()<<"   tmpLib="<<tmpLibDir.ascii()<<""<<endl;
00746               libDirList.remove(it);
00747               it=libDirList.begin();
00748             }
00749           }
00750         }
00751       }
00752     }
00753     item=itemList.next();
00754   }
00755 
00756   //all other in libList are outside libs
00757   QStringList::Iterator it1=libDirList.begin();
00758   for(;it1!=libDirList.end();++it1)
00759   {
00760       kdDebug()<<"create LIBDIR item  "<<(*it1).ascii()<<endl;
00761       new QListViewItem(outsidelibdir_listview,outsidelibdir_listview->lastItem(),(*it1));
00762   }
00763   
00764 }
00765 
00766 
00767 void ProjectConfigurationDlg::slotStaticLibClicked(int)
00768 {
00769 /*  dymo: static libs can be linked with other libs too
00770     so please don't uncomment following*/
00771 /*if (staticRadio->isChecked())
00772   {
00773     libAddTab->setEnabled(false);
00774     libPathTab->setEnabled(false);
00775   } else {
00776     libAddTab->setEnabled(true);
00777     libPathTab->setEnabled(true);
00778   }*/
00779 }
00780 
00781 
00782 void ProjectConfigurationDlg::templateLibraryClicked(int)
00783 {
00784   if (radioLibrary->isChecked())
00785   {
00786     libGroup->setEnabled(true);
00787 //    staticRadio->setChecked(true);
00788   } else {
00789     libGroup->setEnabled(false);
00790   }
00791 }
00792 void ProjectConfigurationDlg::clickSubdirsTemplate()
00793 {
00794   if (radioSubdirs->isChecked())
00795   {
00796     m_targetPath->setEnabled(false);
00797     m_targetOutputFile->setEnabled(false);
00798     Browse->setEnabled(false);
00799     libGroup->setEnabled(false);
00800     buildOrderTab->setEnabled(true);
00801     corbaTab->setEnabled(false);
00802   }
00803   else
00804   {
00805     m_targetPath->setEnabled(true);
00806     m_targetOutputFile->setEnabled(true);
00807     Browse->setEnabled(true);
00808     buildOrderTab->setEnabled(false);
00809     if (radioLibrary->isChecked()) libGroup->setEnabled(true);
00810     else libGroup->setEnabled(false);
00811     corbaTab->setEnabled(true);
00812   }
00813 }
00814 
00815 
00816 
00817 //build order buttons
00818 void ProjectConfigurationDlg::buildorderMoveUpClicked()
00819 {
00820     if (buildorder_listview->currentItem() == buildorder_listview->firstChild()) {
00821         KNotifyClient::beep();
00822         return;
00823     }
00824 
00825     QListViewItem *item = buildorder_listview->firstChild();
00826     while (item->nextSibling() != buildorder_listview->currentItem())
00827         item = item->nextSibling();
00828     item->moveItem(buildorder_listview->currentItem());
00829 }
00830 
00831 
00832 void ProjectConfigurationDlg::buildorderMoveDownClicked()
00833 {
00834    if (buildorder_listview->currentItem() == 0 || buildorder_listview->currentItem()->nextSibling() == 0) {
00835         KNotifyClient::beep();
00836         return;
00837    }
00838 
00839    buildorder_listview->currentItem()->moveItem(buildorder_listview->currentItem()->nextSibling());
00840 }
00841 
00842 
00843 
00844 
00845 
00846 
00847 
00848 //Include dir buttons
00849 void ProjectConfigurationDlg::insideIncMoveUpClicked()
00850 {
00851     if (insideinc_listview->currentItem() == insideinc_listview->firstChild()) {
00852         KNotifyClient::beep();
00853         return;
00854     }
00855 
00856     QListViewItem *item = insideinc_listview->firstChild();
00857     while (item->nextSibling() != insideinc_listview->currentItem())
00858         item = item->nextSibling();
00859     item->moveItem(insideinc_listview->currentItem());
00860 }
00861 
00862 
00863 void ProjectConfigurationDlg::insideIncMoveDownClicked()
00864 {
00865    if (insideinc_listview->currentItem() == 0 || insideinc_listview->currentItem()->nextSibling() == 0) {
00866         KNotifyClient::beep();
00867         return;
00868    }
00869 
00870    insideinc_listview->currentItem()->moveItem(insideinc_listview->currentItem()->nextSibling());
00871 }
00872 
00873 
00874 void ProjectConfigurationDlg::outsideIncMoveUpClicked()
00875 {
00876     if (outsideinc_listview->currentItem() == outsideinc_listview->firstChild()) {
00877         KNotifyClient::beep();
00878         return;
00879     }
00880 
00881     QListViewItem *item = outsideinc_listview->firstChild();
00882     while (item->nextSibling() != outsideinc_listview->currentItem())
00883         item = item->nextSibling();
00884     item->moveItem(outsideinc_listview->currentItem());
00885 }
00886 
00887 
00888 void ProjectConfigurationDlg::outsideIncMoveDownClicked()
00889 {
00890    if (outsideinc_listview->currentItem() == 0 || outsideinc_listview->currentItem()->nextSibling() == 0) {
00891         KNotifyClient::beep();
00892         return;
00893    }
00894 
00895    outsideinc_listview->currentItem()->moveItem(outsideinc_listview->currentItem()->nextSibling());
00896 }
00897 
00898 
00899 void ProjectConfigurationDlg::outsideIncAddClicked()
00900 {
00901     KURLRequesterDlg dialog("", i18n("Add include directory:"), 0, 0);
00902     dialog.urlRequester()->setMode(KFile::Directory);
00903     if (dialog.exec() != QDialog::Accepted)
00904         return;
00905     QString dir = dialog.urlRequester()->url();
00906     if (!dir.isEmpty())
00907         new QListViewItem(outsideinc_listview, dir);
00908 }
00909 
00910 
00911 void ProjectConfigurationDlg::outsideIncRemoveClicked()
00912 {
00913     delete outsideinc_listview->currentItem();
00914 }
00915 
00916 
00917 
00918 
00919 
00920 
00921 
00922 
00923 
00924 
00925 //libadd buttons
00926 void ProjectConfigurationDlg::insideLibMoveUpClicked()
00927 {
00928     if (insidelib_listview->currentItem() == insidelib_listview->firstChild()) {
00929         KNotifyClient::beep();
00930         return;
00931     }
00932 
00933     QListViewItem *item = insidelib_listview->firstChild();
00934     while (item->nextSibling() != insidelib_listview->currentItem())
00935         item = item->nextSibling();
00936     item->moveItem(insidelib_listview->currentItem());
00937 }
00938 
00939 
00940 void ProjectConfigurationDlg::insideLibMoveDownClicked()
00941 {
00942    if (insidelib_listview->currentItem() == 0 || insidelib_listview->currentItem()->nextSibling() == 0) {
00943         KNotifyClient::beep();
00944         return;
00945    }
00946 
00947    insidelib_listview->currentItem()->moveItem(insidelib_listview->currentItem()->nextSibling());
00948 }
00949 
00950 
00951 void ProjectConfigurationDlg::outsideLibMoveUpClicked()
00952 {
00953     if (outsidelib_listview->currentItem() == outsidelib_listview->firstChild()) {
00954         KNotifyClient::beep();
00955         return;
00956     }
00957 
00958     QListViewItem *item = outsidelib_listview->firstChild();
00959     while (item->nextSibling() != outsidelib_listview->currentItem())
00960         item = item->nextSibling();
00961     item->moveItem(outsidelib_listview->currentItem());
00962 }
00963 
00964 
00965 void ProjectConfigurationDlg::outsideLibMoveDownClicked()
00966 {
00967    if (outsidelib_listview->currentItem() == 0 || outsidelib_listview->currentItem()->nextSibling() == 0) {
00968         KNotifyClient::beep();
00969         return;
00970    }
00971 
00972    outsidelib_listview->currentItem()->moveItem(outsidelib_listview->currentItem()->nextSibling());
00973 }
00974 
00975 
00976 void ProjectConfigurationDlg::outsideLibAddClicked()
00977 {
00978     bool ok;
00979     QString dir = KInputDialog::getText(i18n("Add Library"), i18n("Add library to link:"), "-l", &ok, 0);
00980     if (ok && !dir.isEmpty() && dir != "-I")
00981         new QListViewItem(outsidelib_listview, dir);
00982 }
00983 
00984 
00985 void ProjectConfigurationDlg::outsideLibRemoveClicked()
00986 {
00987     delete outsidelib_listview->currentItem();
00988 }
00989 
00990 
00991 
00992 //lib paths buttons
00993 
00994 
00995 void ProjectConfigurationDlg::outsideLibDirMoveUpClicked()
00996 {
00997     if (outsidelibdir_listview->currentItem() == outsidelibdir_listview->firstChild()) {
00998         KNotifyClient::beep();
00999         return;
01000     }
01001 
01002     QListViewItem *item = outsidelibdir_listview->firstChild();
01003     while (item->nextSibling() != outsidelibdir_listview->currentItem())
01004         item = item->nextSibling();
01005     item->moveItem(outsidelibdir_listview->currentItem());
01006 }
01007 
01008 
01009 void ProjectConfigurationDlg::outsideLibDirMoveDownClicked()
01010 {
01011    if (outsidelibdir_listview->currentItem() == 0 || outsidelibdir_listview->currentItem()->nextSibling() == 0) {
01012         KNotifyClient::beep();
01013         return;
01014    }
01015 
01016    outsidelibdir_listview->currentItem()->moveItem(outsidelibdir_listview->currentItem()->nextSibling());
01017 }
01018 
01019 
01020 void ProjectConfigurationDlg::outsideLibDirAddClicked()
01021 {
01022     KURLRequesterDlg dialog("", i18n("Add library directory:"), 0, 0);
01023     dialog.urlRequester()->setMode(KFile::Directory);
01024     if (dialog.exec() != QDialog::Accepted)
01025         return;
01026     QString dir = dialog.urlRequester()->url();
01027     if (!dir.isEmpty())
01028         new QListViewItem(outsidelibdir_listview, dir);
01029 }
01030 
01031 
01032 void ProjectConfigurationDlg::outsideLibDirRemoveClicked()
01033 {
01034     delete outsidelibdir_listview->currentItem();
01035 }
01036 
01037 void ProjectConfigurationDlg::outsideIncEditClicked()
01038 {
01039     QListViewItem *item=outsideinc_listview->currentItem();
01040     if(item==NULL)return;
01041     QString text=item->text(0);
01042 
01043     KURLRequesterDlg dialog(text, i18n("Change include directory:"), 0, 0);
01044     dialog.urlRequester()->setMode(KFile::Directory);
01045     if (dialog.exec() != QDialog::Accepted)
01046         return;
01047     QString dir = dialog.urlRequester()->url();
01048     if (!dir.isEmpty())
01049         item->setText(0,dir);
01050 }
01051 
01052 void ProjectConfigurationDlg::outsideLibEditClicked()
01053 {
01054     bool ok;
01055     QListViewItem *item=outsidelib_listview->currentItem();
01056     if(item==NULL)return;
01057     QString text=item->text(0);
01058 
01059     QString dir = KInputDialog::getText(i18n("Change Library"), i18n("Change library to link:"), text, &ok, 0);
01060     if (ok && !dir.isEmpty() && dir != "-l")
01061         item->setText(0,dir);
01062 
01063 }
01064 
01065 void ProjectConfigurationDlg::outsideLibDirEditClicked()
01066 {
01067     QListViewItem *item=outsidelibdir_listview->currentItem();
01068     if(item==NULL)return;
01069     QString text=item->text(0);
01070 
01071     KURLRequesterDlg dialog(text, i18n("Change library directory:"), 0, 0);
01072     dialog.urlRequester()->setMode(KFile::Directory);
01073     if (dialog.exec() != QDialog::Accepted)
01074         return;
01075     QString dir = dialog.urlRequester()->url();
01076     if (!dir.isEmpty())
01077         item->setText(0,dir);
01078 }
01079 
01080 void ProjectConfigurationDlg::slotInstallTargetClicked()
01081 {
01082   if (checkInstallTarget->isChecked() == true)
01083     m_InstallTargetPath->setEnabled(true);
01084   else
01085     m_InstallTargetPath->setEnabled(false);
01086 }
01087 
01088 
01089 void ProjectConfigurationDlg::extAdd_button_clicked( )
01090 {
01091     KURLRequesterDlg dialog("", i18n("Add target:"), 0, 0);
01092     dialog.urlRequester()->setMode(KFile::File);
01093     if (dialog.exec() != QDialog::Accepted)
01094         return;
01095     QString path = dialog.urlRequester()->url();
01096     if (!path.isEmpty())
01097         new QListViewItem(extDeps_view, path);
01098 }
01099 
01100 void ProjectConfigurationDlg::extEdit_button_clicked( )
01101 {
01102     QListViewItem *item=extDeps_view->currentItem();
01103     if(item==NULL)return;
01104     QString text=item->text(0);
01105 
01106     KURLRequesterDlg dialog(text, i18n("Change target:"), 0, 0);
01107     dialog.urlRequester()->setMode(KFile::File);
01108     if (dialog.exec() != QDialog::Accepted)
01109         return;
01110     QString path = dialog.urlRequester()->url();
01111     if (!path.isEmpty())
01112         item->setText(0, path);
01113 }
01114 
01115 void ProjectConfigurationDlg::extMoveDown_button_clicked( )
01116 {
01117    if (extDeps_view->currentItem() == 0 || extDeps_view->currentItem()->nextSibling() == 0) {
01118         KNotifyClient::beep();
01119         return;
01120    }
01121 
01122    extDeps_view->currentItem()->moveItem(extDeps_view->currentItem()->nextSibling());
01123 }
01124 
01125 void ProjectConfigurationDlg::extMoveUp_button_clicked( )
01126 {
01127     if (extDeps_view->currentItem() == extDeps_view->firstChild()) {
01128         KNotifyClient::beep();
01129         return;
01130     }
01131 
01132     QListViewItem *item = extDeps_view->firstChild();
01133     while (item->nextSibling() != extDeps_view->currentItem())
01134         item = item->nextSibling();
01135     item->moveItem(extDeps_view->currentItem());
01136 }
01137 
01138 void ProjectConfigurationDlg::extRemove_button_clicked( )
01139 {
01140     delete extDeps_view->currentItem();
01141 }
01142 
01143 void ProjectConfigurationDlg::intMoveDown_button_clicked( )
01144 {
01145    if (intDeps_view->currentItem() == 0 || intDeps_view->currentItem()->nextSibling() == 0) {
01146         KNotifyClient::beep();
01147         return;
01148    }
01149 
01150    intDeps_view->currentItem()->moveItem(intDeps_view->currentItem()->nextSibling());
01151 }
01152 
01153 void ProjectConfigurationDlg::intMoveUp_button_clicked( )
01154 {
01155     if (intDeps_view->currentItem() == intDeps_view->firstChild()) {
01156         KNotifyClient::beep();
01157         return;
01158     }
01159 
01160     QListViewItem *item = intDeps_view->firstChild();
01161     while (item->nextSibling() != intDeps_view->currentItem())
01162         item = item->nextSibling();
01163     item->moveItem(intDeps_view->currentItem());
01164 }
01165 
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Feb 22 09:22:23 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003