diff options
Diffstat (limited to 'buildtools/qmake')
36 files changed, 14273 insertions, 0 deletions
diff --git a/buildtools/qmake/Makefile.am b/buildtools/qmake/Makefile.am new file mode 100644 index 00000000..6b65901a --- /dev/null +++ b/buildtools/qmake/Makefile.am @@ -0,0 +1,34 @@ +# Here resides the troll project part for tmake or qmake + + +INCLUDES = -I$(top_srcdir)/buildtools/lib/base \ + -I$(top_srcdir)/buildtools/lib/widgets -I$(top_srcdir)/lib/interfaces \ + -I$(top_srcdir)/buildtools/lib/parsers/qmake \ + -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/interfaces/external -I$(top_srcdir)/lib/util \ + -I$(top_builddir)/buildtools/lib/widgets $(all_includes) + + +kde_module_LTLIBRARIES = libkdevtrollproject.la +libkdevtrollproject_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) +libkdevtrollproject_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \ + $(top_builddir)/lib/util/libkdevutil.la $(top_builddir)/buildtools/lib/widgets/libkdevbuildtoolswidgets.la \ + $(top_builddir)/buildtools/lib/base/libkdevbuildbase.la \ + $(top_builddir)/buildtools/lib/parsers/qmake/libkdevqmakeparser.la + +libkdevtrollproject_la_SOURCES = choosesubprojectdlg.cpp \ + choosesubprojectdlgbase.ui createscopedlg.cpp createscopedlgbase.ui disablesubprojectdlg.cpp \ + disablesubprojectdlgbase.ui newwidgetdlg.cpp newwidgetdlgbase.ui \ + projectconfigurationdlg.cpp projectconfigurationdlgbase.ui qmakedefaultopts.cpp \ + qmakeoptionswidget.cpp qmakeoptionswidgetbase.ui qmakescopeitem.cpp scope.cpp \ + trolllistview.cpp trollprojectpart.cpp trollprojectwidget.cpp + + +METASOURCES = AUTO + +servicedir = $(kde_servicesdir) +service_DATA = kdevtrollproject.desktop kdevtmakeproject.desktop + +rcdir = $(kde_datadir)/kdevtrollproject +rc_DATA = kdevtrollproject.rc +noinst_HEADERS = createscopedlg.h disablesubprojectdlg.h qmakedefaultopts.h \ + qmakeoptionswidget.h qmakescopeitem.h trolllistview.h diff --git a/buildtools/qmake/README b/buildtools/qmake/README new file mode 100644 index 00000000..0146b60f --- /dev/null +++ b/buildtools/qmake/README @@ -0,0 +1 @@ +Please read the README.dox file.
\ No newline at end of file diff --git a/buildtools/qmake/README.dox b/buildtools/qmake/README.dox new file mode 100644 index 00000000..6f0a4027 --- /dev/null +++ b/buildtools/qmake/README.dox @@ -0,0 +1,39 @@ +/** \class TrollProjectPart +A projectmanager for qmake based projects. + +Loads and maintains .pro files (qmake project files). The trollprojectpart +supports subprojects and qmake scopes. Qmake projects can be configured on +project, subproject and file level. +It will regenerate a projects .pro files dynamically as you add,remove or +reconfigure (sub)projects. Unsupported qmake features will be left unchanged +(hopefully) no major testing has been run yet. + +\authors <a href="mailto:bernd AT kdevelop.org">Bernd Gehrmann</a> +\authors <a href="mailto:thasart AT gmx.de">Thomas Hasart</a> + +\maintainer <a href="mailto:jsgaarde AT tdcspace.dk">Jakob Simon-Gaarde </a> + +\feature Loads and maintains .pro files (qmake project files). +\feature Supports subprojects and qmake scopes. +\feature Qmake projects can be configured on project, subproject and file level. +\feature Regenerates a projects .pro files dynamically as you add, +remove or reconfigure (sub)projects. +\feature Unsupported qmake features will be left unchanged (hopefully) + no major testing has been run yet. + +\bug bugs in <a href="http://bugs.kde.org/buglist.cgi?product=kdevelop&component=trollproject&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&order=Bug+Number">trollproject component at Bugzilla database</a> + +\requirement <a href="http://www.trolltech.com">QMake</a> >= 3.0.3 + +\todo <b>Relative directories (priority 1)</b> + By default a qmake projects created with kdevelop must be distributable, + therefore all directory-selections must be relative the subproject where + it is used (user can override this ofcourse). So when a select-directory + dialog is opened getRelativeDirectory() (#include pathutil.h) should be + called. +\todo <b>Ignore shell-expressions and qmake-functions (priority 2-3)</b> + FileBuffer should recognize and ignore shell-expressions and qmake-functions. + (Jakob Simon-Gaarde says: I'm on this one) + + +*/ diff --git a/buildtools/qmake/choosesubprojectdlg.cpp b/buildtools/qmake/choosesubprojectdlg.cpp new file mode 100644 index 00000000..20264144 --- /dev/null +++ b/buildtools/qmake/choosesubprojectdlg.cpp @@ -0,0 +1,114 @@ +/*************************************************************************** + * Copyright (C) 2003 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#include <kpushbutton.h> + +#include "trollprojectwidget.h" + +#include "choosesubprojectdlg.h" +#include "scope.h" + +ChooseSubprojectDlg::ChooseSubprojectDlg(TrollProjectWidget *widget, QWidget* parent, const char* name, bool modal, WFlags fl) + : ChooseSubprojectDlgBase(parent,name, modal,fl), m_widget(widget) +{ + connect(subprojects_view, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(itemSelected(QListViewItem *))); + if( m_widget->m_rootSubproject) + { + ChooseItem *it = new ChooseItem(m_widget->m_rootSubproject, subprojects_view, m_widget->m_rootSubproject->text(0)); + it->setPixmap(0, *(m_widget->m_rootSubproject->pixmap(0))); + it->setOpen(true); + fillSubprojectsView(it); + subprojects_view->setSelected(it, true); + } +} + +ChooseSubprojectDlg::~ChooseSubprojectDlg() +{ +} + +/*$SPECIALIZATION$*/ +void ChooseSubprojectDlg::accept() +{ + if (!subprojects_view->currentItem()) + return; + ChooseItem *item = dynamic_cast<ChooseItem*>(subprojects_view->currentItem()); + if (!item) + return; + if ( item->subproject()->scope->variableValues("TEMPLATE").findIndex("subdirs") != -1 ) + return; + + QDialog::accept(); +} + +ChooseItem::ChooseItem( QMakeScopeItem * spitem, QListViewItem * parent, QString text ) + :KListViewItem(parent, text), m_spitem(spitem) +{ +} + +ChooseItem::ChooseItem( QMakeScopeItem * spitem, QListView * parent, QString text ) + :KListViewItem(parent, text), m_spitem(spitem) +{ +} + +QMakeScopeItem * ChooseItem::subproject( ) +{ + return m_spitem; +} + +void ChooseSubprojectDlg::fillSubprojectsView( ChooseItem *item ) +{ + if (!item->subproject()) + return; + + QListViewItem * sub_spitem = item->subproject()->firstChild(); + while( sub_spitem ) { + QMakeScopeItem *spitem = dynamic_cast<QMakeScopeItem *>(sub_spitem); + if ( spitem && spitem->scope->scopeType() == Scope::ProjectScope ) + { + ChooseItem *child_item = new ChooseItem(spitem, item, spitem->text(0)); + child_item->setPixmap(0, *(spitem->pixmap(0))); + child_item->setOpen(true); + fillSubprojectsView(child_item); + } + + sub_spitem = sub_spitem->nextSibling(); + } +} + +void ChooseSubprojectDlg::itemSelected( QListViewItem * it ) +{ + if (!it) + return; + ChooseItem *item = dynamic_cast<ChooseItem*>(it); + if (!item) + return; + if ( item->subproject()->scope->variableValues("TEMPLATE").findIndex("subdirs") != -1 ) + buttonOk->setEnabled(false); + else + buttonOk->setEnabled(true); +} + +QMakeScopeItem * ChooseSubprojectDlg::selectedSubproject( ) +{ + if (subprojects_view->currentItem()) + { + ChooseItem *item = dynamic_cast<ChooseItem*>(subprojects_view->currentItem()); + if (item) + return item->subproject(); + } + + return 0; +} + + +#include "choosesubprojectdlg.moc" + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on + diff --git a/buildtools/qmake/choosesubprojectdlg.h b/buildtools/qmake/choosesubprojectdlg.h new file mode 100644 index 00000000..689fe8b3 --- /dev/null +++ b/buildtools/qmake/choosesubprojectdlg.h @@ -0,0 +1,64 @@ +/*************************************************************************** + * Copyright (C) 2003 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef CHOOSESUBPROJECTDLG_H +#define CHOOSESUBPROJECTDLG_H + +#include <klistview.h> + +#include "choosesubprojectdlgbase.h" + +class QMakeScopeItem; +class TrollProjectWidget; + +class ChooseItem: public KListViewItem +{ +public: + ChooseItem(QMakeScopeItem *spitem, QListViewItem *parent, QString text); + ChooseItem(QMakeScopeItem *spitem, QListView *parent, QString text); + + QMakeScopeItem *subproject(); + +private: + QMakeScopeItem *m_spitem; +}; + +class ChooseSubprojectDlg : public ChooseSubprojectDlgBase +{ + Q_OBJECT + +public: + ChooseSubprojectDlg(TrollProjectWidget *widget, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~ChooseSubprojectDlg(); + /*$PUBLIC_FUNCTIONS$*/ + + QMakeScopeItem *selectedSubproject(); + +public slots: + /*$PUBLIC_SLOTS$*/ + +protected: + /*$PROTECTED_FUNCTIONS$*/ + TrollProjectWidget *m_widget; + +protected slots: + /*$PROTECTED_SLOTS$*/ + virtual void accept(); + virtual void itemSelected(QListViewItem *it); + +private: + void fillSubprojectsView(ChooseItem *item); + +}; + +#endif + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/qmake/choosesubprojectdlgbase.ui b/buildtools/qmake/choosesubprojectdlgbase.ui new file mode 100644 index 00000000..12db29e2 --- /dev/null +++ b/buildtools/qmake/choosesubprojectdlgbase.ui @@ -0,0 +1,134 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>ChooseSubprojectDlgBase</class> +<widget class="QDialog"> + <property name="name"> + <cstring>ChooseSubprojectDlgBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>511</width> + <height>282</height> + </rect> + </property> + <property name="caption"> + <string>Select Subproject</string> + </property> + <property name="sizeGripEnabled"> + <bool>true</bool> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="1" column="0"> + <property name="name"> + <cstring>Layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <spacer> + <property name="name"> + <cstring>Horizontal Spacing2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KPushButton"> + <property name="name"> + <cstring>buttonOk</cstring> + </property> + <property name="text"> + <string>&OK</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>buttonCancel</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + <widget class="KListView" row="0" column="0"> + <column> + <property name="text"> + <string>Subprojects</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>subprojects_view</cstring> + </property> + <property name="resizeMode"> + <enum>LastColumn</enum> + </property> + </widget> + </grid> +</widget> +<connections> + <connection> + <sender>buttonOk</sender> + <signal>clicked()</signal> + <receiver>ChooseSubprojectDlgBase</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>buttonCancel</sender> + <signal>clicked()</signal> + <receiver>ChooseSubprojectDlgBase</receiver> + <slot>reject()</slot> + </connection> +</connections> +<tabstops> + <tabstop>subprojects_view</tabstop> + <tabstop>buttonOk</tabstop> + <tabstop>buttonCancel</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klistview.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/buildtools/qmake/createscopedlg.cpp b/buildtools/qmake/createscopedlg.cpp new file mode 100644 index 00000000..439ddd70 --- /dev/null +++ b/buildtools/qmake/createscopedlg.cpp @@ -0,0 +1,100 @@ +/*************************************************************************** +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#include "createscopedlg.h" + +#include <klineedit.h> +#include <kurlrequester.h> +#include <qcheckbox.h> +#include <kfile.h> +#include <kcombobox.h> +#include <kmessagebox.h> +#include <klocale.h> +#include <kfiledialog.h> +#include <kurlcompletion.h> + +#include "urlutil.h" +#include "qmakescopeitem.h" +#include "scope.h" +#include "trollprojectwidget.h" + +CreateScopeDlg::CreateScopeDlg( QMakeScopeItem* item, QWidget* parent, const char* name, bool modal, WFlags fl ) + : CreateScopeDlgBase( parent, name, modal, fl ), m_item( item ) +{ + incUrl->setMode( KFile::File | KFile::LocalOnly ); + incUrl->setCaption( i18n( "Choose existing .pri file or give a new filename for creation" ) ); + incUrl->setURL( QString("") ); + incUrl->completionObject() ->setDir( item->scope->projectDir() ); + incUrl->fileDialog()->setURL( KURL::fromPathOrURL( item->scope->projectDir() ) ); +} + +CreateScopeDlg::~CreateScopeDlg() +{} + +void CreateScopeDlg::accept() +{ + Scope * s = 0; + switch ( comboScopeType->currentItem() ) + { + case 0: + if ( !editScopeName->text().isEmpty() ) + s = m_item->scope->createSimpleScope( editScopeName->text() ); + break; + case 1: + if ( !editFunction->text().isEmpty() && !editArguments->text().isEmpty() ) + s = m_item->scope->createFunctionScope( editFunction->text(), editArguments->text() ); + break; + case 2: + if ( !incUrl->url().isEmpty() ) + { + QString file = incUrl->url(); + if ( !incUrl->url().endsWith( ".pri" ) ) + file += ".pri"; + if( file.find("/") == -1 ) + file = m_item->scope->projectDir()+"/"+file; + // We need to create the file, because getRelativePath checks for existent paths + if( !QFile::exists(file) ) + { + QFile temp(file); + if( temp.open(IO_WriteOnly) ) + temp.close(); + } + file = URLUtil::getRelativePath( m_item->scope->projectDir(), file ); + s = m_item->scope->createIncludeScope( file ); + } + break; + } + if ( s ) + { + if ( !m_item->firstChild() ) + new QMakeScopeItem( m_item, s->scopeName(), s ); + else + { + QListViewItem* item = m_item->firstChild(); + while( item->nextSibling() ) + item = item->nextSibling(); + QMakeScopeItem* newitem = new QMakeScopeItem( m_item, s->scopeName(), s ); + newitem->moveItem( item ); + } + QDialog::accept(); + } + else + { + if ( KMessageBox::warningYesNo( this, i18n( "You did not specify all needed information. " + "The scope will not be created.<br>Do you want to abort the scope creation?" ), + i18n( "Missing information" ) ) == KMessageBox:: Yes ) + QDialog::reject(); + } +} + +#include "createscopedlg.moc" + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/qmake/createscopedlg.h b/buildtools/qmake/createscopedlg.h new file mode 100644 index 00000000..c8ed86ef --- /dev/null +++ b/buildtools/qmake/createscopedlg.h @@ -0,0 +1,45 @@ +/*************************************************************************** +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef CREATESCOPEDLG_H +#define CREATESCOPEDLG_H + +#include "createscopedlgbase.h" + +class QMakeScopeItem; +class TrollProjectWigdet; + +class CreateScopeDlg : public CreateScopeDlgBase +{ + Q_OBJECT + +public: + CreateScopeDlg( QMakeScopeItem* item, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~CreateScopeDlg(); + /*$PUBLIC_FUNCTIONS$*/ + +public slots: + /*$PUBLIC_SLOTS$*/ + +protected: + /*$PROTECTED_FUNCTIONS$*/ + +protected slots: + /*$PROTECTED_SLOTS$*/ + virtual void accept(); +private: + QMakeScopeItem* m_item; +}; + +#endif + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on + diff --git a/buildtools/qmake/createscopedlgbase.ui b/buildtools/qmake/createscopedlgbase.ui new file mode 100644 index 00000000..244589cd --- /dev/null +++ b/buildtools/qmake/createscopedlgbase.ui @@ -0,0 +1,329 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>CreateScopeDlgBase</class> +<widget class="QDialog"> + <property name="name"> + <cstring>CreateScopeDlgBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>348</width> + <height>208</height> + </rect> + </property> + <property name="caption"> + <string>Create Scope</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout4</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>Scopetype:</string> + </property> + </widget> + <widget class="KComboBox"> + <item> + <property name="text"> + <string>Simple Scope</string> + </property> + </item> + <item> + <property name="text"> + <string>Function Scope</string> + </property> + </item> + <item> + <property name="text"> + <string>Include File</string> + </property> + </item> + <property name="name"> + <cstring>comboScopeType</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Choose between the different types of new scopes</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>95</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox1</cstring> + </property> + <property name="title"> + <string>Scope Settings</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QWidgetStack" row="0" column="0"> + <property name="name"> + <cstring>widgetStack1</cstring> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>simplePage</cstring> + </property> + <attribute name="id"> + <number>0</number> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KLineEdit" row="0" column="1"> + <property name="name"> + <cstring>editScopeName</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Specify the new scope name</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>Scopename:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>editScopeName</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>funcPage</cstring> + </property> + <attribute name="id"> + <number>1</number> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KLineEdit" row="0" column="1"> + <property name="name"> + <cstring>editFunction</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="text"> + <string>Function:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>editFunction</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Specify the function name</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel4</cstring> + </property> + <property name="text"> + <string>Arguments:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>editArguments</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Specify the list of function arguments, delimited by a comma</string> + </property> + </widget> + <widget class="KLineEdit" row="1" column="1"> + <property name="name"> + <cstring>editArguments</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>incPage</cstring> + </property> + <attribute name="id"> + <number>2</number> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KURLRequester" row="0" column="1"> + <property name="name"> + <cstring>incUrl</cstring> + </property> + <property name="focusPolicy"> + <enum>StrongFocus</enum> + </property> + <property name="filter"> + <string>*.pri</string> + </property> + <property name="mode"> + <number>25</number> + </property> + <property name="toolTip" stdset="0"> + <string>Choose the .pri file to include</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel5</cstring> + </property> + <property name="text"> + <string>Include File:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>incUrl</cstring> + </property> + </widget> + <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>checkNotInc</cstring> + </property> + <property name="text"> + <string>&use !include instead of include</string> + </property> + <property name="toolTip" stdset="0"> + <string>Use !include instead of include for the function scope</string> + </property> + </widget> + </grid> + </widget> + </widget> + </grid> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>150</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonOk</cstring> + </property> + <property name="text"> + <string>O&K</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonCancel</cstring> + </property> + <property name="text"> + <string>Ca&ncel</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<customwidgets> +</customwidgets> +<connections> + <connection> + <sender>comboScopeType</sender> + <signal>activated(int)</signal> + <receiver>widgetStack1</receiver> + <slot>raiseWidget(int)</slot> + </connection> + <connection> + <sender>buttonOk</sender> + <signal>clicked()</signal> + <receiver>CreateScopeDlgBase</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>buttonCancel</sender> + <signal>clicked()</signal> + <receiver>CreateScopeDlgBase</receiver> + <slot>reject()</slot> + </connection> +</connections> +<tabstops> + <tabstop>editFunction</tabstop> + <tabstop>editArguments</tabstop> + <tabstop>comboScopeType</tabstop> + <tabstop>buttonOk</tabstop> + <tabstop>buttonCancel</tabstop> + <tabstop>editScopeName</tabstop> + <tabstop>incUrl</tabstop> + <tabstop>checkNotInc</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kcombobox.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kurlrequester.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/buildtools/qmake/disablesubprojectdlg.cpp b/buildtools/qmake/disablesubprojectdlg.cpp new file mode 100644 index 00000000..335bf33f --- /dev/null +++ b/buildtools/qmake/disablesubprojectdlg.cpp @@ -0,0 +1,50 @@ +/*************************************************************************** +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#include "disablesubprojectdlg.h" +#include <klistview.h> +#include <qstringlist.h> +#include "scope.h" +#include "qmakescopeitem.h" + +DisableSubprojectDlg::DisableSubprojectDlg( const QStringList& projects, QWidget* parent, const char* name, WFlags fl ) + : DisableSubprojectDlgBase( parent, name, fl ) +{ + for( QStringList::const_iterator it = projects.begin(); it != projects.end(); ++it ) + { + new QCheckListItem(subprojects_view, *it, QCheckListItem::CheckBox); + } +} + +DisableSubprojectDlg::~DisableSubprojectDlg() +{ +} + +QStringList DisableSubprojectDlg::selectedProjects() +{ + QStringList result; + QListViewItem* item = subprojects_view->firstChild(); + while( item ) + { + QCheckListItem* ci = dynamic_cast<QCheckListItem*>(item); + if( ci && ci->isOn() ) + { + result << ci->text(0); + } + item = item->nextSibling(); + } + return result; +} + +#include "disablesubprojectdlg.moc" + + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/qmake/disablesubprojectdlg.h b/buildtools/qmake/disablesubprojectdlg.h new file mode 100644 index 00000000..13a27468 --- /dev/null +++ b/buildtools/qmake/disablesubprojectdlg.h @@ -0,0 +1,42 @@ +/*************************************************************************** +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef DISABLESUBPROJECTDLG_H +#define DISABLESUBPROJECTDLG_H + +#include "disablesubprojectdlgbase.h" + +class DisableSubprojectDlg : public DisableSubprojectDlgBase +{ + Q_OBJECT + +public: + DisableSubprojectDlg( const QStringList& projects, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DisableSubprojectDlg(); + /*$PUBLIC_FUNCTIONS$*/ + + QStringList selectedProjects(); + +public slots: + /*$PUBLIC_SLOTS$*/ + +protected: + /*$PROTECTED_FUNCTIONS$*/ + +protected slots: + /*$PROTECTED_SLOTS$*/ + +}; + +#endif + + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/qmake/disablesubprojectdlgbase.ui b/buildtools/qmake/disablesubprojectdlgbase.ui new file mode 100644 index 00000000..ffcc1d32 --- /dev/null +++ b/buildtools/qmake/disablesubprojectdlgbase.ui @@ -0,0 +1,126 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>DisableSubprojectDlgBase</class> +<widget class="QDialog"> + <property name="name"> + <cstring>DisableSubprojectDlgBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>512</width> + <height>282</height> + </rect> + </property> + <property name="caption"> + <string>Select Subprojects to disable</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KListView"> + <column> + <property name="text"> + <string>Subprojects</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>subprojects_view</cstring> + </property> + <property name="resizeMode"> + <enum>LastColumn</enum> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <spacer> + <property name="name"> + <cstring>Horizontal Spacing2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KPushButton"> + <property name="name"> + <cstring>buttonOk</cstring> + </property> + <property name="text"> + <string>O&K</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>buttonCancel</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<customwidgets> +</customwidgets> +<connections> + <connection> + <sender>buttonOk</sender> + <signal>clicked()</signal> + <receiver>DisableSubprojectDlgBase</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>buttonCancel</sender> + <signal>clicked()</signal> + <receiver>DisableSubprojectDlgBase</receiver> + <slot>accept()</slot> + </connection> +</connections> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klistview.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/buildtools/qmake/kdevtmakeproject.desktop b/buildtools/qmake/kdevtmakeproject.desktop new file mode 100644 index 00000000..f1921523 --- /dev/null +++ b/buildtools/qmake/kdevtmakeproject.desktop @@ -0,0 +1,91 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Comment=TMake Project +Comment[br]=Rektras TMake +Comment[ca]=Projecte TMake +Comment[da]=TMake-projekt +Comment[de]=TMake-Projekt für KDevelop +Comment[el]=Έργο TMake +Comment[es]=Proyecto TMake +Comment[et]=TMake projekt +Comment[eu]=TMake proiektua +Comment[fa]=پروژۀ TMake +Comment[fr]=Projet avec TMake +Comment[ga]=Comhad tionscadail TMake +Comment[gl]=Proxecto TMake +Comment[hi]=टी-मेक परियोजना +Comment[hu]=TMake-projekt +Comment[is]=TMake verkefni +Comment[it]=Progetto per TMake +Comment[ja]=TMake プロジェクト +Comment[ms]=Projek TMake +Comment[nds]=TMake-Projekt +Comment[ne]=TMake परियोजना +Comment[nl]=TMake-project +Comment[pl]=Projekt: TMake +Comment[pt]=Projecto TMake +Comment[pt_BR]=Projeto TMake +Comment[ru]=Проект TMake +Comment[sk]=TMake projekt +Comment[sl]=Projekt TMake +Comment[sr]=TMake пројекат +Comment[sr@Latn]=TMake projekat +Comment[sv]=Tmake-projekt +Comment[ta]=டிமேக் பிராஜக்ட் +Comment[tg]=Лоиҳаи TMake +Comment[tr]=TMake Projesi +Comment[zh_CN]=TMake 工程 +Comment[zh_TW]=TMake 專案 +Name=KDevTMakeProject +Name[da]=KDevelop TMake-projekt +Name[de]=TMake-Projekt (KDevelop) +Name[hi]=के-डेव-टी-मेक-परियोजना +Name[nds]=TMake-Projekt (KDevelop) +Name[ne]=KDevTMake परियोजना +Name[pl]=KDevProjektTMake +Name[sk]=KDevTMakeProjekt +Name[sv]=KDevelop Tmake-projekt +Name[ta]=கெடெவ் டிமேக் பிராஜக்ட் +Name[tg]=KDevTСохтани лоиҳа +Name[zh_TW]=KDevelop TMake 專案 +GenericName=TMake Project +GenericName[br]=Raktres TMake +GenericName[ca]=Projecte TMake +GenericName[da]=TMake-projekt +GenericName[de]=TMake-Projekt +GenericName[el]=Έργο TMake +GenericName[es]=Proyecto TMake +GenericName[et]=TMake projekt +GenericName[eu]=TMake proiektua +GenericName[fa]=پروژۀ TMake +GenericName[fr]=Projet avec TMake +GenericName[ga]=Tionscadal TMake +GenericName[gl]=Proxecto TMake +GenericName[hi]=टी-मेक परियोजना +GenericName[hu]=TMake-projekt +GenericName[it]=Progetto per TMake +GenericName[ja]=TMake プロジェクト +GenericName[ms]=Projek TMake +GenericName[nds]=TMake-Projekt +GenericName[ne]=TMake परियोजना +GenericName[nl]=TMake-project +GenericName[pl]=Projekt: TMake +GenericName[pt]=Projecto TMake +GenericName[pt_BR]=Projeto TMake +GenericName[ru]=Проект TMake +GenericName[sk]=TMake projekt +GenericName[sl]=Projekt TMake +GenericName[sr]=TMake пројекат +GenericName[sr@Latn]=TMake projekat +GenericName[sv]=Tmake-projekt +GenericName[ta]=டிமேக் பிராஜக்ட் +GenericName[tg]=Лоиҳаи TMake +GenericName[tr]=TMake Projesi +GenericName[zh_CN]=TMake 工程 +GenericName[zh_TW]=TMake 專案 +ServiceTypes=KDevelop/Project +X-KDE-Library=libkdevtrollproject +X-KDevelop-Version=5 +X-KDevelop-Args=TMake + diff --git a/buildtools/qmake/kdevtrollproject.desktop b/buildtools/qmake/kdevtrollproject.desktop new file mode 100644 index 00000000..5debaf34 --- /dev/null +++ b/buildtools/qmake/kdevtrollproject.desktop @@ -0,0 +1,95 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Comment=QMake Project +Comment[br]=Raktres QMake +Comment[ca]=Projecte QMake +Comment[da]=QMake-projekt +Comment[de]=QMake-Projekt für KDevelop +Comment[el]=Έργο QMake +Comment[es]=Proyecto QMake +Comment[et]=QMake projekt +Comment[eu]=QMake proiektua +Comment[fa]=پروژۀ QMake +Comment[fr]=Projet avec QMake +Comment[ga]=Tionscadal QMake +Comment[gl]=Proxecto QMake +Comment[hi]=क्यू-मेक परियोजना +Comment[hu]=QMake-projekt +Comment[is]=QMake verkefni +Comment[it]=Progetto per QMake +Comment[ja]=QMake プロジェクト +Comment[ms]=Projek QMake +Comment[nds]=QMake-Projekt +Comment[ne]=QMake परियोजना +Comment[nl]=QMake-project +Comment[pa]=QMake ਪ੍ਰੋਜੈਕਟ +Comment[pl]=Projekt: QMake +Comment[pt]=Projecto QMake +Comment[pt_BR]=Projeto QMake +Comment[ru]=Проект QMake +Comment[sk]=QMake projekt +Comment[sl]=Projekt QMake +Comment[sr]=QMake пројекат +Comment[sr@Latn]=QMake projekat +Comment[sv]=Qmake-projekt +Comment[ta]=க்யுமேக் பிராஜக்ட் +Comment[tg]=Лоиҳаи QMake +Comment[tr]=QMake Projesi +Comment[uz]=QMake loyihasi +Comment[uz@cyrillic]=QMake лойиҳаси +Comment[zh_CN]=QMake 工程 +Comment[zh_TW]=QMake 專案 +Name=KDevTrollProject +Name[da]=KDevelop Troll-projekt +Name[de]=QMake-Projekt (KDevelop) +Name[hi]=के-डेव-ट्रॉल-परियोजना +Name[nds]=QMake-Projekt (KDevelop) +Name[ne]=KDevTroll परियोजना +Name[pl]=KDevProjektTroll +Name[sk]=KDevTrollProjekt +Name[sv]=KDevelop Troll-projekt +Name[ta]=கெடெவ் டிரால் பிராஜக்ட் +Name[zh_TW]=KDevelop Troll 專案 +GenericName=QMake Project +GenericName[br]=Raktres QMake +GenericName[ca]=Projecte QMake +GenericName[da]=QMake-projekt +GenericName[de]=QMake-Projekt +GenericName[el]=Έργο QMake +GenericName[es]=Proyecto QMake +GenericName[et]=QMake projekt +GenericName[eu]=QMake proiektua +GenericName[fa]=پروژۀ QMake +GenericName[fr]=Projet avec QMake +GenericName[ga]=Tionscadal QMake +GenericName[gl]=Proxecto QMake +GenericName[hi]=क्यू-मेक परियोजना +GenericName[hu]=QMake-projekt +GenericName[it]=Progetto per QMake +GenericName[ja]=QMake プロジェクト +GenericName[ms]=Projek QMake +GenericName[nds]=QMake-Projekt +GenericName[ne]=QMake परियोजना +GenericName[nl]=QMake-project +GenericName[pa]=QMake ਪ੍ਰੋਜੈਕਟ +GenericName[pl]=Projekt: QMake +GenericName[pt]=Projecto QMake +GenericName[pt_BR]=Projeto QMake +GenericName[ru]=Проект QMake +GenericName[sk]=QMake projekt +GenericName[sl]=Projekt QMake +GenericName[sr]=QMake пројекат +GenericName[sr@Latn]=QMake projekat +GenericName[sv]=Qmake-projekt +GenericName[ta]=க்யுமேக் பிராஜக்ட் +GenericName[tg]=Лоиҳаи QMake +GenericName[tr]=QMake Projesi +GenericName[uz]=QMake loyihasi +GenericName[uz@cyrillic]=QMake лойиҳаси +GenericName[zh_CN]=QMake 工程 +GenericName[zh_TW]=QMake 專案 +ServiceTypes=KDevelop/Project +X-KDE-Library=libkdevtrollproject +X-KDevelop-Version=5 +X-KDevelop-Args= diff --git a/buildtools/qmake/kdevtrollproject.rc b/buildtools/qmake/kdevtrollproject.rc new file mode 100644 index 00000000..8f6e0048 --- /dev/null +++ b/buildtools/qmake/kdevtrollproject.rc @@ -0,0 +1,33 @@ +<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> +<kpartgui name="KDevTrollProject" version="3"> +<MenuBar> + <Menu name="build" > + <Action name="build_build_project" /> + <Action name="build_install_project" /> + <Action name="build_rebuild_project" /> + <Action name="build_execute_project" /> + <Action name="build_clean_project" /> + <Action name="build_distclean_project" /> + <Separator/> + <Action name="build_build_target" /> + <Action name="build_install_target" /> + <Action name="build_rebuild_target" /> + <Action name="build_execute_target" /> + <Action name="build_clean_target" /> + <Action name="build_distclean_target" /> + <Separator/> + <Action name="build_compilefile" /> + </Menu> +</MenuBar> +<ToolBar name="buildToolBar" noMerge="1"> + <Action name="build_build_project" group="build_operations" /> + <Action name="build_rebuild_project" group="build_operations" /> + <Action name="build_execute_project" group="build_operations" /> + <Separator group="build_operations"/> + <Action name="build_build_target" group="build_operations" /> + <Action name="build_rebuild_target" group="build_operations" /> + <Action name="build_execute_target" group="build_operations" /> + <Separator group="build_operations"/> + <Action name="build_compilefile" group="build_operations" /> +</ToolBar> +</kpartgui> diff --git a/buildtools/qmake/newwidgetdlg.cpp b/buildtools/qmake/newwidgetdlg.cpp new file mode 100644 index 00000000..7be62acd --- /dev/null +++ b/buildtools/qmake/newwidgetdlg.cpp @@ -0,0 +1,80 @@ +/*************************************************************************** + * Copyright (C) 2002 by Jakob Simon-Gaarde * + * jsgaarde@tdcspace.dk * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "newwidgetdlg.h" +#include <qradiobutton.h> +#include <qstringlist.h> +#include <qcheckbox.h> +#include <qmessagebox.h> +#include <kfiledialog.h> +#include <klineedit.h> +#include <kpushbutton.h> +#include <domutil.h> +#include <qdom.h> +#include <kstdguiitem.h> + +#define WIDGET_CAPTION_NAME "widget/property|name=caption/string" +#define WIDGET_CLASS_NAME "class" +#define WIDGET_SLOTS "slots" + +NewWidgetDlg::NewWidgetDlg(QStringList &newFileNames,QWidget* parent, const char* name, bool modal, WFlags fl) +: NewWidgetDlgBase(parent,name,modal,fl), +m_newFileNames(newFileNames) +//================================================= +{ +// Remove in kde 3.4 support + okayButton->setGuiItem(KStdGuiItem::ok()); + cancelButton->setGuiItem(KStdGuiItem::cancel()); +} + + +NewWidgetDlg::~NewWidgetDlg() +//============================================== +{ +} + + +void NewWidgetDlg::subclassingPressed() +//===================================== +{ + QMessageBox::information(0,"subclassing",""); +} + + +void NewWidgetDlg::templateSelChanged() +//===================================== +{ + QMessageBox::information(0,"template",""); +} + +void NewWidgetDlg::accept() +//========================= +{ + QDomDocument doc; + DomUtil::openDOMFile(doc,"/home/jsgaarde/programming/kdevelop/domapp/clean_dialog.ui"); + DomUtil::replaceText(doc,WIDGET_CLASS_NAME,"TestClass"); + DomUtil::replaceText(doc,WIDGET_CAPTION_NAME,"Test Dialog"); + QDomElement slotsElem = DomUtil::elementByPathExt(doc,WIDGET_SLOTS); + QDomNodeList slotnodes = slotsElem.childNodes(); + for (unsigned int i=0; i<slotnodes.count();i++) + { + QString msg; + QDomElement slotelem = slotnodes.item(i).toElement(); + msg.sprintf("Slotname: %s\nReturns: %s\nAccess: %s", + slotelem.text().ascii(), + slotelem.attributeNode("returnType").value().ascii(), + slotelem.attributeNode("access").value().ascii()); + QMessageBox::information(0,"Slots",msg); + } + DomUtil::saveDOMFile(doc,"/home/jsgaarde/programming/kdevelop/domapp/clean_dialog2.ui"); + NewWidgetDlgBase::accept(); +} + diff --git a/buildtools/qmake/newwidgetdlg.h b/buildtools/qmake/newwidgetdlg.h new file mode 100644 index 00000000..e8420df2 --- /dev/null +++ b/buildtools/qmake/newwidgetdlg.h @@ -0,0 +1,38 @@ +/*************************************************************************** + * Copyright (C) 2002 by Jakob Simon-Gaarde * + * jsgaarde@tdcspace.dk * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef NEWWIDGETDLG_H +#define NEWWIDGETDLG_H + +#include "newwidgetdlgbase.h" +#include "trollprojectwidget.h" + +class QStringList; +class QDomDocument; + +class NewWidgetDlg : public NewWidgetDlgBase +{ +public: + NewWidgetDlg(QStringList &newFileNames,QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~NewWidgetDlg(); + + +public slots: + virtual void subclassingPressed(); + virtual void templateSelChanged(); + virtual void accept(); + +protected: + QStringList &m_newFileNames; +}; + +#endif + diff --git a/buildtools/qmake/newwidgetdlgbase.ui b/buildtools/qmake/newwidgetdlgbase.ui new file mode 100644 index 00000000..7c3730ca --- /dev/null +++ b/buildtools/qmake/newwidgetdlgbase.ui @@ -0,0 +1,229 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>NewWidgetDlgBase</class> +<widget class="QDialog"> + <property name="name"> + <cstring>NewWidgetDlgBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>650</width> + <height>474</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="caption"> + <string>New Widget</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton" row="1" column="2"> + <property name="name"> + <cstring>cancelButton</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + </widget> + <widget class="QGroupBox" row="0" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>GroupBox2</cstring> + </property> + <property name="title"> + <string>Widget Properties</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="2" column="0"> + <property name="name"> + <cstring>subclassingCb</cstring> + </property> + <property name="text"> + <string>Subclassing</string> + </property> + </widget> + <widget class="QLayoutWidget" row="1" column="1" rowspan="2" colspan="1"> + <property name="name"> + <cstring>Layout5</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>captionLb</cstring> + </property> + <property name="text"> + <string>Caption:</string> + </property> + </widget> + <widget class="KLineEdit" row="2" column="1"> + <property name="name"> + <cstring>subclassnameEd</cstring> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>TextLabel4</cstring> + </property> + <property name="text"> + <string>Subclass name:</string> + </property> + </widget> + <widget class="KLineEdit" row="1" column="1"> + <property name="name"> + <cstring>captionEd</cstring> + </property> + </widget> + <widget class="KLineEdit" row="0" column="1"> + <property name="name"> + <cstring>ui_classnameEd</cstring> + </property> + <property name="minimumSize"> + <size> + <width>120</width> + <height>0</height> + </size> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>classnameLb</cstring> + </property> + <property name="text"> + <string>Class name:</string> + </property> + </widget> + </grid> + </widget> + <widget class="QLabel" row="0" column="1"> + <property name="name"> + <cstring>previewLb</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>2</hsizetype> + <vsizetype>2</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>160</height> + </size> + </property> + <property name="pixmap"> + <pixmap>image0</pixmap> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + </widget> + <widget class="QListBox" row="0" column="0" rowspan="2" colspan="1"> + <item> + <property name="text"> + <string>New Item</string> + </property> + </item> + <property name="name"> + <cstring>templateList</cstring> + </property> + </widget> + </grid> + </widget> + <spacer row="1" column="0"> + <property name="name"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>310</width> + <height>0</height> + </size> + </property> + </spacer> + <widget class="KPushButton" row="1" column="1"> + <property name="name"> + <cstring>okayButton</cstring> + </property> + <property name="text"> + <string>&OK</string> + </property> + </widget> + </grid> +</widget> +<images> + <image name="image0"> + <data format="XPM.GZ" length="27539">789cdd5c577362cb767e3fbf62eaf6db2d571ba148b9fc80028a244584cb0f9d480221b22497ffbb57afd06c103aa399a3721dfb72f7814f9bdddd2b876ee65ffff9a3512bfff8e7bffe31999a69d7fd701d33fef14f3f1b0cdefee33ffffdbffef8c7562ef7235e3b3bdb3ff2fff8973ffea1fc0ff743e5f07f88e7091f20ae09dec2fba69530dd778c77f8f959c274ff40303f7f9730ddb78c0fe879f39e30de770bc1fc7c89b1a3efbb7dc25bbc7ef7ca98d7632e111f24fa7209d3fc8f8279fce384e9fe94b1d0d74c98ee5705f3f36f09d3fd0963a64fd513a6fb05c1f4bced254cf49f09ced3f8278c997e7396307edf68c1349e3b4f18ef7b599fa3f15485b0f0cfdb84697d5b8c857ec398e9f13cdf16afc7aa88b792fcfc8031dff71709d37a5f05d37a7d8fb0ac271405337fde13a6e7f705333d0dc6bcde6004f3f3e78c451e0bc6c2cf36e13ccf6f4e190bfd63c4895e1308cbf77583317f5f3f30e6f9f43d637e3ee0f7f369fc304f98f897eeb37e2d18f378e13061d297316359df3de16dd1ffc098e7f3c78c793c37445c90efeb47c6f2fd66c2a41f79c662bf3dc6629ffcfd1d9127fa8bed2d19cf6e3116fedc3196f5ef254cf21e1296f1743361bc6feb8c793c8bf6b55d90e75d8fb03cefa709e3fdd0144cfc56fb8c65bdc58489fe9160febe622cf39f254ceb97fbc29f838469fd4f11ef6cc9f7435e30db8762cccfabd78489bea260d6774d7857f8759b307e5fe704f3fa5b8c77993faf82e97ea8332e307d57888d3c6f04f3f36e37615a9f15ccfee892318fa7b712267ed404f3fccf09d3fd05e1bd2d9e1fe5b79bdff5ccbf53c1ccbf47c1f902dedf26bcb7c5f33505f37c0f09d3fd57c1e46f429931f3c7dd33e6f92deaf36e5a5f7817bcbd85f79f19f3f3ea21615aff93609acf0e19337f5459303daf6f12a6f90f04f37a2d63e1cf96605eff7bc224afb9607ade05c2fbcc2f7f2698d77f9d30e9fbae607ade9f3016f923fd7bf9bdc236cac37518f3fcbe2d989f2f0ba6efab6dc269be5bc1fcfdd384697ccf98f96dca09d3f345c1fcfc3861d2971a63d6573f17ccfc7a13ccfc427ddb03fa49defe29615a4f9d31cfe74e13a6fb53c1ac2f8631cfa7af05f3f38384f179db15ccf3df244cfc6b3366f99bf384899e1dc1cc8f56c2f8bc1f09e6f12b840f581e6120989f47feed6fcbfabc134ccf872a6399af9330f1e34a30cf774758e6332f82e9799d4f98e84df7e979374a18ef9b29639647d009d3fc15c1f4bc318c999e702298e9a1f1ac3caf3463be6f1e1833bd6a2f6192df9b601eef967081e9f58782e9fbe646308f8ff67fb09dee3f0b667dba60ccf4eaba60e6cf56c2f4fc2363a6576f0be6f9761226f91e1136ec1f2c7fdfb0fd595cff8195f94c25617ade08dea1fb5dc6a2cfa58489ff82995fba9030c9ef52308d175a848df0e74930d37f9c303d9f632cfa712598e5f39830c90ff5adb023e3bb13c6c25f9d30cd5f154cebf3216183fad1616c985fdb09d3f81782e979f79c303e1f468c03eb575e30ebc37ec234dead601acf5608db3cc7f707c1cc8f90303d9f17ccf2d863bcc7cf1f254cfe662698e3a560c3f9ce5dc2a4ffbb82397ea1fc0a4ef8158e19337fc2a560a6679e307edf5e33667ea8ab84493e1dc1fc7c59f02ed6d3a14d38d1bb9330d94b4d30ebf375c224df73c6c28f8260e6877c7f8ffde34c30cf779a30f99b1bc1349fea33667e9a79c2c44f998ff9a95f13a67ce25230fb8b9260e6cf11e3c0f9dc4bc214af268279fc69c2e4bf9d60ce777612267dcd1176ac7fba97308d3f13ccf9c861c2c4cf3bc6ac7ff621618a571dc1fc3cf3d3317f1cd263923d98026191a71a264cfad4174cfae1cf198bfc1e0433ff6a82d97e0f13c6f15c5b308d675b8c595ebe9830c96b2c98f3839b84491f4f04b37e9e0966faea09937ebe09667af619b3bc552f61e29711ccfcdc4998d61704f3faaa09d37a8e05337f6682993f9384717d8671d28f61c2a41f5dc1ac7f8384e9fe5830eb773161f2670dc1ec2f4f13a678f52298d7779d30ae4f5718b3fee99030cdaf04f3fa5cc2747f2498ede32461b28f92608e47321edbbb6e254ce379c13c5f3f61aa2f647cd61f9f672cf23e4a98ec47e86779dbbd8449de587f1827faecbb8c59ffecbd60bedf17ccfa564f98eeef31667d315b8299fe8b84697c2798e4a30f1226fdc90966fb9a12167db1ed84899e8960d697fd84495fb605b37fde4d98d63b12ccf6964f98ec2d7d9fe3cb59c214dfee188b3fab264ceb3b16ccf2b50993fc851ed627bd4898d63716cceb3f4c98ecf34830f3f33c61f27f8f8279fd3b8c25fe0c12a6f518c1b4defa3461badf11ccf9727a9efd455930e7478d84291ebe0be6f55e244cfc147a257ebd254cf3cf05b33f3b4b98ee3f09667ebe274cf9475f30e717c584e93eebbf677fa58e05f37ca58449be0dc15c4fa13ddbe46ffc4430f1df29c62c4feb1326fb1809e6fca693308db710ccf6789030c5a71a6396573817ccfe232798f35f9730e99bac87e5a39e13267d9a09e6f9ab09d3fab6184b3e712198e5514d98e81d0866fdbe4a98f4e55630d70b9384c93e9f088b7cec4dc2a40fcf8239be9513267afb82591ebb09d3fc5dc15c0fdc274cf4ee30667bf55782391e61fcb3deeded917edf3066fe865ec2743f2798edb59230cd772d787f1bf16dc216d77fc458fcef2261a2e75e30fbdb43c1ac9f7b09d37aba82f768bf8ae4e9855fae9430f9dbbe60e6d776c2147f2f05337daf0993fef27c9efda1b18239ff6a0966fd7b4f98d6eb190b7fd17fb85d170e905fe188b08ca72e05f37a860993bedf326679d4a75a69a3d5efbe6bab1d5cebef3fbbe8d9ccf557d781b250dffe725fb8e2cbeb00d737cd4a71eb2ff32464aef477bc677f22d36f92497cff16b904dd42fe662ffafbf74bfc2772f90e9e2439988f57f63ecb6a69376dedbe63fe6fb417a757ed407d90d167df779967be412e7f992719dff4996cf8fa60577f3b7bd9eca33ef29be4d45ab3af6f92cab7d98b179f559fc2a70e6a4e37da027eb6681378c5bfc37b37ce4deff8c4dfc95e94eec1baba280b79efc01c4fbacf36d1d503b82ce027f8348814216dddbf99bd3cc30a15ad0e71570fd10e228543fd827fa35547bf35826ba0c748d184a8fa5bd98b42ad899ae6d1b2e96f434d31e625ca0aa530d05378454a46ac8933d2b7ef92cb5fcec786b0e239fade177c714e86abb7ac631d58fd026818eb57944b9449179f7bfb2e5ff62d7269c18a5ab8a2b8ea77586f115e87f03ad2c7fa4497e03ad567f03ad717fa12fe7ea5cb2897397ab46ff265df622f735dc1f53ce92aacf210565cd3757dad6ff4adbed3f7fa4137e07ad08fbaa9737a4be7f5b6ded1bbf0dd77a067ef7f35be50ec96f8ed327f979831048dd9072a0e74016e28fda88cb2cae1e594cf5cf16f16ee06d5526dd5d147aa8bd633c071b373b8b555ace3dfb21798a105974ffe9572a8aeea69a39e541f3e0dd4b31aaa1735526358ed04d7ecd494df676a0e97c76b4951bc16ea555fab37f5ae8aea500fd5913ad6bd7af40e237502144eb453a54c5da4b2b9c56fd80bc66a758a3c136ac06ed5997e51e7f07ea12ed5952a832c2ab07aafaab0f21a5c73f89cbd3cbed3ab0674d5912aa047dfab6b75a36e61ed33f0e271960efa3c075aabd49dfe4a4ef1557b11b91035f4a4c1d870a5ee754d3de83bd56019444a1ee16ac24aa749361ea98cef39a4845ed524a32d9557604340cf15f839a00238a550fa1d9827238fbf682f3e632f74b540ee4a81f5aa5db5a7f6515f68e5f58c1cdc868b6473c0b4cc819aa62ac0522245c6c4ffdf186b1c7aeb18a7ba20abea4fedf957eca59fb90c7ad117bd301e2ce4c104584513d65480ff3679b5510659b988bd084573a48234112ed382ff16a27c4c5bdf980e8c3c80b9233506e4d2f92cf7fecdf8229ae5c1fbb6c0daabfac874f52de846e428ad26aeb09ef15bcbd52fed67796f96b19d1a3e7f007f07eb313df3a4774d1f5608be0566ec26ddf8495efd257b8916cf323103786f0325cf60eb16f95e4f3cf688a34ce6c96eaa19fba8a17ce691dd20078fa8c074d5f01dbd81199a17333231631b9a81996caa797ed35ec47f88ddb4f5a199ea06f2b7ce16d084753493ad08bfe76bafa52dcdf8bdc0eb772b76e654de1833839cc7821e543ef412c287f57ddd5e3af8fd9656660ee31fe96bb3483e09a831af448179636da921752ef9ae498a9ae01dcc3b0cb9a46f66ded3f78803e4a9c7a6680ed5c01c61be36446d33baa7fa7fd15e623c8959e00bdac9543fe0cc05d40db2802893a8f7c7a0f5d5f4576b4e4c4955c0a21be61424b98008e4e465ced86666186b2cda5a93e509583f9a73b09b0ba026ad247a6af4d6bf6f2f1db0bfa8e451bb9e99921c4ac59b4bd2fb2893a585030d01d67265caa662aaa6069eb66eaee1d38dce9b5b88250b96d3ccdcb1dd57d97eaa38ce0ca9bd370f10bfc65cd57563bc9118b3eedbbe6c2f2fe622d685a6611ec1e21dc77689e59ef9db645dafc01a9ae6d9e44047ee81b35b90332fe055d665d3006ee4cdb6d931bb660f640663997d8c3873b623d2bc038aa1face1ca84ba0c6a5573753ef848f72f999bd809540fe67c6a600c1d7a24c222dde2ab08418556aaa091a833aa5e03fd65a67bddeb7c1b66cbb3e351758c9c42aba873ce9ab5bdb3155db85fc6d413edbf630428907885a3781d1ac7db27dc859c758c175b026edacf7a27fc95ebc99db813eb7cf104f7c8aed31168a078655989259d8a17db1233bb690dfd8b6eeda295a2de5d301fb2f2dc403e38cb7333bb70b8cb61ec79de1b8758eb41e680129db5733b2548f8e309f7ecaf8ae95fedb57ec45c50cefd9bee1ac53f24b682739b217fb1ee7b5457b08741c45dbb2c7f569bc8083167522d4a75c41f771051e32ae437b624bf6d474ec993d477a482ef5943fd4316b58d80b5db6037b895569ac0f36f4e13eb117b782806e73a42e4c07f2aee82b27c94a3cdbc80429b9b265a037d88aad9a23886f437b8cba1d3b16432db943acef6325ed319ebfe8be3a01ddedd81ada8e63bbab27df1865ee6cdd5eeb2b1b50cf62b5bdb63eb19bacbde085392970f5065710b32f63dbf6d6de61e6b8cc5222d7c06ea24c40f3b6ed3dc49d05ca213b16d51d31cf7e025feae0d3dc3ec46aa13ee5ee6bd736ccd83e4234016ae0a1038e4d8e3d74f435d63675940a4818a59d1ddf6fb017d23b8ef178778833e7e0d3425dd92dcce76b1cd5a6999aa4a2ae6d5e455f35415e0f3ff898168cd243b94ce0d55103bb6d77ec2ef0b96ff7e089992eda7d7b80d167b692b771be600b40b882da2f44fdd5215e5a313756ec654d2e0e31d002fc9beba133ea5e95a13e89d1718e71708a7491079e386beaaa68636745adea70b2b73398fd06fe0b3ecc393373def45cd067e09f5ec9c3aa43d7726d18a994ea50d1308cbcf6dc75c01681578e7b6ff529cba5bfc15e967ae770fc1e7e07b206e0770da3ca947936656e45adb6aee79eec295684d421f2cc896c8f1fb20f5582bf4f5ddfe4dc007b010b5384eaa7ab5fcd857d80e7c6fadc3ddbb3186739cecc967251ce0ddd0b649bedfa34c517d6a13f970b522b18aa093742e94f52fd4eb92fe8b11bebbaedb07605f6bea2bfcbdc760e79c80b54f0b76ee2a61851a21731a66867ceb959e401e459afaea5eb6e8c5c9bb3ddd01575a1a25e6ccc36bba05fd9fd9bfea7f642f4ced07b7a908983ec2e0f114d6ac6097b9b98cd3bd08832483ea0a70afa0dac62c8fd61b7d6cf1feaa9eaaa5d37c78a07b2140714b957f7a6cf80db90ed458b5210c3dc3b663712ff4536e0715cd11d02e547988f59b615b936ca85fd4bbf4e7de10e3c7d8cdebf4039125a7d0db2afc8ab7d77e24a9015185809d59b5d8864129703d43a1419a3b4ae6025a75126e6dd9d012de7902958fde006e0c3c6ea10b40c9eb6bbeec2f4909a6ab219cf9e6dec2e21beb6d0fa891aaa799de4672bf145ecc5215fa3d779b7a74ae3c833b5eca550d7a1628d812801f16480eb35dc4319f058ad5883f298637de6aec04e809254db78d6b45b88ff25eca70757d627aec2fd03a973a4d6713aaf9ed5ce8a0f53eb72f910473ba8fd91f6a23e5731ebaaa5de8a64e5608d9076555d6d59f7896fc15a7daedfa25c30aa94ad737594ee2ce5f9527581a69aa2bbb6bb205f18c1dda837f43413c964f81df233b56f3b9019058cc24eabac5c32f6e256628cc34c307e2eba5b1c59b2f959e2a9354dc82027c8a5a5cfa2712287ef7485ec07e27accf31729bf2e485586b137f2bbe1eedd036827f0cf9e981964012798c32efb3971e65803d420cfab6204eb7e2e17d171de59205db4aea1ebe841973279441979a8fb9eadb76d57dbb00719fbcb6ff08a9ea06c46ee1129b1189fb836e14c32c60f882aaee9727680dcacea63b765dae899e7ecc3880b1efcf8237832ca5497e706d6ed45e4d2c2cfb1c3463a79e8de507b853f73aeb840c34c4eef6b6b8f5132ab7b906f6829b11b78a58fcd0b7af45449732e2c7950acdcdacebb3ce8738c155db76deadc1759e6169eba346ec78cd1b2b2f6dd5f938b9c4f21deb6317f0bb1dfa26f60d4a9f229bb8f72c9c1a8bb6e0fbc31ed3d9a9578425e00bc30d46e79b7c3da2575499573e13952073c77fb3aaf4b9003d09eda8b5ec0c89a39982a3ea86f7ccccb20da19b67ee911adc797a55c025acb13e87afc74e40e567af52417c88bc102ee5dc192e7cec679b29b2ec8f6ca4dd4b6a75535590acb6a8b2cda99606ecdcc34ec896ec7c8015135f6fab6d7e432a728e09519a99db59d34af3fb117b81cd6d74394cbb1becb7458a72c97b939f1062aa4367ccbe28e6ad259b4b70e585c19f2ae9d4889b7cc893a6b19ad0ef32c13bc53bb503d2bee21473f02551a58e916e7c9443dd16255de7b1b2be6e8cb643ebfa17e71593f06fcf130fe09772a66ab7251151fa08e076b513de45236fe3a3d76db6ee25bd16b002533b68dd57e7ff44b25df062dbc01bbf290cf4d584307ae01d592e1e82fcf92958e4ddd62ee9ff1639bea4a976229f9ee21c8e5047b7a32a678e48969aba12e9a0bb63ec87780a78677ec604ac856a6c8598b598fc4a41c5b402d5a8a3df71ddf059b8b73cf40effb3cce047cd519cc40f34e1217d17bdb7b4b3eac8d6b0d1fea1791c720c9867cc408c63c5dd55bf29240e10dcc083516e4b8f1bb3daa3fd1c38cad4bf1a4c97ce52e385102763cf73dffe4fbd6c72e2b6618919a58c9f8a8a160416db6fda5adc24b3720c2ecc78a2cee3669c5be73935c9856cedae3b98953d0319f6a71910bd062eae01da98e8f7ade5367aa046b993807d94a9dfb11d2eb9fb34ca2a6e648f7fdc03ffb2154d52dacf97a2897aeba437e2efc4b461fa48e454f01fab0bf2e97157b913c4ce412efcfa2de03171ed2484bb9007fa0a629933470155023c49d39756b6a7e04d98a8508a839ffc8fa2ea9150be065cfcd2de49b55f0b10fee0e2ae7125bcd087c1ae918d9a97468638c825a0a79a878adad757b497d40b297c05d4e17f516339855eb8fef0b53055a869c27807d41a93e55b76ad78f31efaa638ccfc17f0b240b5e158d95c34eba530d73eba3249dcd410c883b54313fef40d6b38d3a3a632d937c3946e83acbc57e622fe27f5cb2178be7572093d2cd157ba1cfb13779631aa0539427f8b8df672c545a735a037ad079eafdcf33cf4b4f7f869da910a95183a8a52ce5ae1e012d076e1f75f380b9d8241efa29d2a230eb77595b59938b4bb4aad8b7859834864a2ec7d5572ee3cbea31ff8648dd055aa29697f42cfa2edb454f1af763a8435e55d2bb8fcf7b257bcbe4639be8e3c6beed67fa1d32cbd8f5807c01e63df473ec95d7388f957cc1aa57bf203f96d9b3db54bf2ce5d283911d8c39d597fe1533d65477630c7e0769cf416633ac5c14f8b227338378829516f7ed675c7bc8cab3fb6213b5dc9d9840ce3f056acae89762ded086d85ec6fe127d676975d6d6a0d619a7b82f76bea9aeb4c98f7571cf6504b9658533a31af590e30c71af543f9a0e64b65849838694637a01df3bf0a45d13f663a4a1d10b8b9cbc92be175dd3989199b27f37635fc4a8d6f11eabfe264b257579210bac9811d475d9b3b59beb7d95b117dec5370d7fc815fa9c77e864d7c5e80258cc007939f347fe1869a69dbc3ad252672df7ecd10a5c8165f7cea4ba5c78a85b629f052365b47c9faa64e9ca38b5e54bd82757985d66fa79abf165ad37d68fbd4b90cec274cc3dcc55e5fdf819f7c8c0e7fa53fb0879ba43af5cf4d18b5ab770e7e47ba09aaf2baa4fd063f91ef277861ca11a556a22f2070bc843176029e7766421073497ac9753e482f717e8c56a2eeabecde8d1267bc9d6d0333c21721673567bea2f15755f97fb8f3eee50983d53852c30d23ef390139b629420dcc18cd8bcb32c3cf2f3c997d5183fcf9092b5fd7fcc3f17a6acdeec0c62ce38555fcd94c94d807f2d88ad7472216b2b7f2e173af91575b7afaf7c85b3f60c35d1fa4dc9767d15e25a0fabb743fbe8c76e1f4fee5074e1fa04f2d09aaffb6b778a6733ea6acedae3d2fe3ff9280bdfbcf1b7306a0f635153e5403a3945f5ce1434e1cef5d50eee1e28aeb33ef6c7a4672972910aab027173e04ed28e025123bbd94e8ddcb32d61efdee9577f6f67a608b907f5b7a4660cfed43f580f1cbd872c6dbc127165af9fb516e4d3f08fbe99bc9dec20e25826b8139f3373bf855c0f18fb47ebf125d593cb33c60ebf1d6bdd01d4eb45b665ca3eb0978275dec22eec29ea63ec09bd9a0664fa1df4159eec4437dc95c9c7fa13f2ae7d3f416a265ca72e7725a29c9b98a7d18eed257cbe54d48bcbb10c27ae683bd8513219b98c3ef493b3bde4e5157c5e57dc91dfc61e9d679b218ecfd4818d7ad68ef991df8138d7d3cf1eaa2afb087562097d53ec16c5ac660faac581df77c6397fe0db2b75aaf4bf3c7a851a72c82305cb1c90bc4705c6b5be907691e39a1dca65a3bd6cdaa385cf45df076bb460d51287a38c649f64df5c9b317ab3987fcf6c09a939053a4e2137385303b641f2a06575032a20fb46b27b2e14496e3157d96c36f62d9c3d33dbfa8af2dfd87f3383a0b006b61ffa637ff61ad911d4df9518f34c4bc9ee1b65215e356c0d328078926dae8e22352e6ada996bfa337d6a77b587ac2066bf3d7c3d417c3f058f07194230187bce56f270c9da9aca67fe6e4d2958882cf184739f7bfbcb9ee807b9fcc97ea573ce1442e464016879645bacb24638a8fddb66dbb5f448f56186b9ee061f426885b67a072f17f78efba1837add03aade4d2374d53558955dd1b666e6dd73dca12bd60f3d7762fa7a6873d807b52b7af32bfbfb56ed849eebe06e528deb7df169b4021b9e5c5b9feb29f66e8399eb4ee81bdac7a65346b1fa2d01277b71efc296628726c656eee8adcb6599937b1e7f003986d395a0300288bffd8dfd7d48f316eec53ee1e892472d3d74ecdb6d8567f71c86601d5d9b8b7d0fdc05838ad3de70b61ac20b5013772fe229bab25fb837f47805ecb77d944d73498b5761e4ca3617c6d80b5dd62ebfb1bf6f0620994998a6ae9d64f39c5721b925b0ce1b90cd15eebf2bac46e26cb1e3d3b20f61861d6a1f6bae1819c0aa0edd34cc39be6f7a516fd341fd59c55c89f60dfccafece87fae567fbfb71d7322cfc83bee13d2d393122d56f3c6b143b9063a804aafac46dc7332c51abc182700737bc207506e51269ecba6a780d6fe11d7de2267bf1d83b77a1180e5ddb35a422c8d84bf8757bb1c7e6c81e83648ec2b1ca533ce6bd07c731146b4d3c256155de55dca18995da3e584bcc32bafa055780792078b436bc16fa085638f5cd0d5e4c2ca5c99fc7e1c4e4819a57aca0973dcb0fbf79fada79fefad419b5e35c28b95e92cc9ce79af0994ad2711b4fe4d82664e707e61032971148097f07a3069081348c371ee27f379cbab18f63e592947dfaafc85cec06e26438d347317fc02cd1a6b812b01a345fb7173d08e71a7b4ce1c2bcd8ad14e99aa2d3c98e6a8c2aba0114695336cfe152efc433fd1025afd49e3f0b6588bc8bf48cf8c58f92c99c35376dd0de9cba05afd1036f223d23957ee7f4e5f8a2db76e26a16f2533bb00e1ea29caac95926adbea9e8ac6e15abcae86d21c241846fd873a0ab611670058c2a48059fa799731ebcecb5f81599905c22c716fe1434f72ae58bcbdfff855f892f404bc0bd6890ae19c77cd70d71451395faf56ad9095cefb92cdfe97301655a4b75e33473afce1ab62a971966070b3f3723dc7fa475498cd9b8bfffd97bb4563c41751cadc6fa5009d598a1a909cc5150cb7d78b9aadcb958e2033eed963d554a19249ddb5ada4a7d835ca0c28b72d60fa16643e63c8c59cd1fbf622fbea0abdac63d1c1bfbfa166c7864e2b9f7e52f0f64cf57e423a73f2406656a5296256a156ada261ff6e1cc39686bcccaeae17a997fadc8e78bf1054f3a44c9c41dbdaaaea8beb90837e600328106dacd2347cfa95a9e4f4ebb79c0d333aa4fb07eab738f46f6da72fc3dde6d0ac58ced64fb01b182e8855bc84d2799fdea5f8e2f7ecbcce17501686826e12edcfb7d888697e63a3c70cd99958bec98644fc4bb957bcb6e77532dbb802ec6f8d0c05f9dacf93188fd25736f20fbd0639685cbd8cb86f3639fdacbeac57b9aaeaa77adb317b68eddc0cc09a9150f2bbb0e2233cab267a95e21ff57c7ce8e3255d78645d1ce4d3afd0bf50664cae1112829c61c2fb3ae95fdeb2f9ee75f3bb31d3bd8e011c67637f4f5692887a69273e475ae1357f6053299bd74a57cc68791fe0cc248175dd5e4cd2e7640cf3cd1037edc28f3a48ff0345c2fed0f7df8bdf3577f2fb67275b1af3982ace215f4f730e440e01d88a10d96411dfbbf55dbb33d3cb79cdd89aae2abee2fc06e2698f954ec59d882faa4e1cab1ea750d7fe0e65177e33da2d31d87219eefefc73317ebb5ef2fc497e52b5b2fe0af0ce31948b8dad1b3854b370879888713deadcdca65dd57f1efc6ccc215a1a2ded6875069c53dd29843bfaa779373733c2361ddbeb977c7fa08aba1e5997197f55f59b9fc3c1f5bf5e37cde78807a06f117a24e0fdeafcca1effb921b28981f4f867ffcf51bfdf22dfef62def2fcd7968d98ebdc53a7e0895d638e0ef4d6d50b790cd9debfb28135d473b19f3391b857d9895dfa4ff4a7cf9c003fa55ee047f6535897591adaa1ee44a4520cb9b43db3135f3e876c2b65790378f3187092083b19faa575bd3795f32b53051b73ea776207ab958c105e5f331b7c21ed54e3c7b126a104f6ea3ef021c6532e49330ebbf25fc157bc9fc1b23743682cf823fc51e22f5055dd75cd8b63ab72d88a9f177ad0b33365e1f796fef21eba9411d5030757de01776663bfad06d836ec62a349e4119d4a7bc52ac47f1f30034f8125e033c011fcf1078f63a935f389fbc49266b1756c05ddd8ffa1b730acbfbfc985f809784881aebad98f18ce115a096d9078ddfc773f121ee52c15ab903c17b5c74ce93cf7ae289e22e563df48bc13ef646e3aed984bbf7abbeecebf165eddf7ff9d4c7595a199f5791735eddcc6f2357ff7d98ecef2557ffeed6f462e5b9cfd6f90bf6b27e65e20ef256f1ea48a387994ba8fbf09e7af6ab7b29ab7d96e59ccbb37c1bedf8977e8fbc41362bbd10e19d4bab240da2dfec679fcbc66b3997b9cc29f8df27d9a013cbded81afe727c59fa8a55b9acc6dde5bdd57f2bc1613f7ef0e1391977d9835cf65696673eb3e76c5c668c0d31e68bf9585897cd8a5c3ef9379236c5e71519b613ffc3fa3cebb12d53e367f1cab85f944b6b03ffb3325bb7a3d51c61f5dcdf92c724afd1da5c9ffd8e72b34c7eadde8fef2dfd718f66c913f99d325db28718dfe9372fd95f00f3fd956bdd6fd17cab72cdcc9be402df0b3be157ed6595a7eb79c0f2f7ca2ef1dcf1af76567fcfbc49861ffd53d66e3eca7e2927f85e50ab72f96a8efc2b79dbbace7ff5fe67f36db4a1aceffb7a7cf93ff1faa67f7fec6ff1feff4a2efffd6f7ffc0f54dd11fd</data> + </image> +</images> +<connections> + <connection> + <sender>okayButton</sender> + <signal>pressed()</signal> + <receiver>NewWidgetDlgBase</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>cancelButton</sender> + <signal>pressed()</signal> + <receiver>NewWidgetDlgBase</receiver> + <slot>reject()</slot> + </connection> + <connection> + <sender>templateList</sender> + <signal>selectionChanged()</signal> + <receiver>NewWidgetDlgBase</receiver> + <slot>templateSelChanged()</slot> + </connection> + <connection> + <sender>subclassingCb</sender> + <signal>pressed()</signal> + <receiver>NewWidgetDlgBase</receiver> + <slot>subclassingPressed()</slot> + </connection> +</connections> +<tabstops> + <tabstop>templateList</tabstop> + <tabstop>subclassingCb</tabstop> + <tabstop>ui_classnameEd</tabstop> + <tabstop>captionEd</tabstop> + <tabstop>subclassnameEd</tabstop> + <tabstop>okayButton</tabstop> + <tabstop>cancelButton</tabstop> +</tabstops> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> + <include location="global" impldecl="in implementation">kpushbutton.h</include> +</includes> +<slots> + <slot>subclassingPressed()</slot> + <slot>templateSelChanged()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/buildtools/qmake/projectconfigurationdlg.cpp b/buildtools/qmake/projectconfigurationdlg.cpp new file mode 100644 index 00000000..b76fc3a5 --- /dev/null +++ b/buildtools/qmake/projectconfigurationdlg.cpp @@ -0,0 +1,2174 @@ +/*************************************************************************** +* Copyright (C) 2002 by Jakob Simon-Gaarde * +* jsgaarde@tdcspace.dk * +* Copyright (C) 2002-2003 by Alexander Dymo * +* cloudtemple@mksat.net * +* Copyright (C) 2003 by Thomas Hasart * +* thasart@gmx.de * +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#include "projectconfigurationdlg.h" +#include <qradiobutton.h> +#include <qbuttongroup.h> +#include <qcheckbox.h> +#include <qmessagebox.h> +#include <kfiledialog.h> +#include <knotifyclient.h> +#include <klineedit.h> +#include <kinputdialog.h> +#include <kurlrequesterdlg.h> +#include <kurlrequester.h> +#include <kurlcompletion.h> +#include <kdebug.h> +#include <kiconloader.h> +#include <ktextedit.h> + +#include <qdialog.h> +#include <qpushbutton.h> +#include <qbuttongroup.h> +#include <qlistview.h> +#include <qlabel.h> +#include <iostream> +#include <qregexp.h> +#include <qvalidator.h> +#include <qtabwidget.h> +#include <kpushbutton.h> +#include <kcombobox.h> +#include <klocale.h> +#include <kmessagebox.h> + +#include "trollprojectwidget.h" +#include "trollprojectpart.h" +#include "qmakescopeitem.h" +#include "scope.h" +#include "urlutil.h" + +InsideCheckListItem::InsideCheckListItem( QListView *parent, QMakeScopeItem *item, ProjectConfigurationDlg *config ) : + QCheckListItem( parent, item->relativePath().endsWith("/") ? item->relativePath().right( item->relativePath().length() - 1 ) : item->relativePath(), QCheckListItem::CheckBox ) +{ + prjItem = item; + m_config = config; +} + +InsideCheckListItem::InsideCheckListItem( QListView *parent, QListViewItem *after, QMakeScopeItem *item, ProjectConfigurationDlg *config ) : + QCheckListItem( parent, + after, + item->relativePath(), QCheckListItem::CheckBox ) +{ + prjItem = item; + m_config = config; +} + +//check or uncheck dependency to currently checked or unchecked library +void InsideCheckListItem::stateChange( bool state ) +{ + if ( listView() == m_config->insidelib_listview ) + { + QListViewItemIterator it( m_config->intDeps_view ); + while ( it.current() ) + { + InsideCheckListItem * chi = dynamic_cast<InsideCheckListItem*>( it.current() ); + if ( chi ) + if ( chi->prjItem == prjItem ) + chi->setOn( state ); + ++it; + } + } +} + +CustomVarListItem::CustomVarListItem(QListView* parent, unsigned int id, QMap<QString, QString> var) + : KListViewItem(parent), m_key(id) +{ + setText(0, var["var"]); + setText(1, var["op"]); + setText(2, var["values"]); +} + +QString CustomVarListItem::key(int column, bool ascending) const +{ + if( column == 0) + return QString::number(m_key); + return KListViewItem::key(column, ascending); +} + +ProjectConfigurationDlg::ProjectConfigurationDlg( QListView *_prjList, TrollProjectWidget* _prjWidget, QWidget* parent, const char* name, bool modal, WFlags fl ) + : ProjectConfigurationDlgBase( parent, name, modal, fl | Qt::WStyle_Tool ), myProjectItem(0) +{ + prjList = _prjList; + prjWidget = _prjWidget; + // m_projectConfiguration = conf; + m_targetLibraryVersion->setValidator( new QRegExpValidator( + QRegExp( "\\d+(\\.\\d+)?(\\.\\d+)" ), this ) ); + customVariables->setSortColumn(0); + customVariables->setSortOrder(Qt::Ascending); + mocdir_url->completionObject()->setMode(KURLCompletion::DirCompletion); + mocdir_url->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly ); + objdir_url->completionObject()->setMode(KURLCompletion::DirCompletion); + objdir_url->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly ); + rccdir_url->completionObject()->setMode(KURLCompletion::DirCompletion); + rccdir_url->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly ); + uidir_url->completionObject()->setMode(KURLCompletion::DirCompletion); + uidir_url->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly ); + m_CWDEdit->completionObject()->setMode(KURLCompletion::DirCompletion); + m_CWDEdit->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly ); + m_targetPath->completionObject()->setMode(KURLCompletion::DirCompletion); + m_targetPath->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly ); +} + +void ProjectConfigurationDlg::updateSubproject( QMakeScopeItem* _item ) +{ + if ( myProjectItem && myProjectItem->scope ) + { + switch ( prjWidget->dialogSaveBehaviour() ) + { + case TrollProjectWidget::AlwaysSave: + apply(); + break; + case TrollProjectWidget::NeverSave: + break; + case TrollProjectWidget::Ask: + if ( !buttonApply->isEnabled() ) + break; + if ( KMessageBox::questionYesNo( 0, i18n( "Save the current subproject's configuration?" ), + i18n( "Save Configuration?" ) ) == KMessageBox::Yes ) + apply(); + break; + } + } + myProjectItem = _item; + updateControls(); + buttonApply->setEnabled( false ); +} + +ProjectConfigurationDlg::~ProjectConfigurationDlg() +{} + +void ProjectConfigurationDlg::updateProjectConfiguration() +{ + // Template + if ( myProjectItem->scope->scopeType() == Scope::ProjectScope ) + { + if ( radioApplication->isChecked() ) + { + if( myProjectItem->scope->variableValues("TEMPLATE").findIndex("app") == -1 ) + { + addAppDeps(); + removeSharedLibDeps(); + removeStaticLibDeps(); + } + myProjectItem->scope->setEqualOp( "TEMPLATE", "app" ); + if( myProjectItem->scope->variableValues( "CONFIG" ).findIndex( "staticlib" ) != -1 ) + myProjectItem->scope->removeFromPlusOp( "CONFIG", "staticlib" ); + if( myProjectItem->scope->variableValues( "CONFIG" ).findIndex( "dll" ) != -1 ) + myProjectItem->scope->removeFromPlusOp( "CONFIG", "dll" ); + myProjectItem->setPixmap( 0, SmallIcon( "qmake_app" ) ); + QString targetname = prjWidget->getCurrentOutputFilename(); + if( targetname.findRev("/") != -1 ) + targetname = targetname.right( targetname.length() - targetname.findRev("/") - 1 ); + DomUtil::writeEntry( *prjWidget->m_part->projectDom(), + "/kdevtrollproject/run/runarguments/"+targetname, m_editRunArguments->text() ); + DomUtil::writeEntry( *prjWidget->m_part->projectDom(), + "/kdevtrollproject/run/cwd/"+targetname, m_CWDEdit->url() ); + DomUtil::writeEntry( *prjWidget->m_part->projectDom(), + "/kdevtrollproject/run/debugarguments/"+targetname, m_editDebugArguments->text() ); + + } + else if ( radioLibrary->isChecked() ) + { + myProjectItem->scope->setEqualOp( "TEMPLATE", "lib" ); + if ( staticRadio->isOn() ) + { + if( myProjectItem->scope->variableValues("CONFIG").findIndex("dll") != -1 ) + { + addStaticLibDeps(); + removeSharedLibDeps(); + } + myProjectItem->addValue( "CONFIG", "staticlib" ); + myProjectItem->removeValue( "CONFIG", "dll" ); + if ( !myProjectItem->scope->listIsEmpty( myProjectItem->scope->variableValues( "VERSION" ) ) ) + { + myProjectItem->scope->removeVariable( "VERSION", "=" ); + myProjectItem->scope->removeVariable( "VERSION", "+=" ); + myProjectItem->scope->removeVariable( "VERSION", "-=" ); + } + } + if ( sharedRadio->isOn() ) + { + kdDebug(9024) << "Activating debug lib:" << myProjectItem->scope->variableValues("CONFIG") << endl; + if( myProjectItem->scope->variableValues("CONFIG").findIndex("dll") == -1 ) + { + addSharedLibDeps(); + removeStaticLibDeps(); + } + myProjectItem->addValue( "CONFIG", "dll" ); + myProjectItem->scope->setEqualOp( "VERSION", m_targetLibraryVersion->text() ); + if ( myProjectItem->scope->variableValues( "CONFIG" ).findIndex( "staticlib" ) != -1 ) + myProjectItem->removeValue( "CONFIG", "staticlib" ); + } + if ( checkPlugin->isOn() ) + myProjectItem->addValue( "CONFIG", "plugin" ); + else + myProjectItem->removeValue( "CONFIG", "plugin" ); + if ( checkDesigner->isChecked() ) + myProjectItem->addValue( "CONFIG", "designer" ); + else + myProjectItem->removeValue( "CONFIG", "designer" ); + + myProjectItem->setPixmap( 0, SmallIcon( "qmake_lib" ) ); + removeAppDeps(); + } + else if ( radioSubdirs->isChecked() ) + { + if( myProjectItem->scope->variableValues("TEMPLATE").findIndex("subdirs") == -1 ) + { + removeSharedLibDeps(); + removeStaticLibDeps(); + removeAppDeps(); + } + if( myProjectItem->scope->variableValues( "CONFIG" ).findIndex( "dll" ) != -1 ) + myProjectItem->scope->removeFromPlusOp( "CONFIG", "dll" ); + if( myProjectItem->scope->variableValues( "CONFIG" ).findIndex( "staticlib" ) != -1 ) + myProjectItem->scope->removeFromPlusOp( "CONFIG", "staticlib" ); + myProjectItem->scope->setEqualOp( "TEMPLATE", "subdirs" ); + myProjectItem->setPixmap( 0, SmallIcon( "folder" ) ); + } + } + + // Buildmode + int releaseidx = myProjectItem->scope->variableValues( "CONFIG" ).findIndex( "release" ); + int debugidx = myProjectItem->scope->variableValues( "CONFIG" ).findIndex( "debug" ); + if ( radioReleaseMode->isChecked() ) + { + if( releaseidx != -1 && releaseidx < debugidx ) + myProjectItem->removeValue( "CONFIG", "debug" ); + else if( debugidx != -1 ) + myProjectItem->removeValue( "CONFIG", "debug" ); + myProjectItem->addValue( "CONFIG", "release" ); + }else if( !checkDebugReleaseMode->isChecked() ) + myProjectItem->removeValue( "CONFIG", "release" ); + + if ( radioDebugMode->isChecked() ) + { + if( debugidx != -1 && debugidx < releaseidx ) + myProjectItem->removeValue( "CONFIG", "release" ); + else if( releaseidx != -1 ) + myProjectItem->removeValue( "CONFIG", "release" ); + myProjectItem->addValue( "CONFIG", "debug" ); + }else if( !checkDebugReleaseMode->isChecked() ) + myProjectItem->removeValue( "CONFIG", "debug" ); + + // requirements + if ( exceptionCheck->isChecked() ) + myProjectItem->addValue( "CONFIG", "exceptions" ); + else + myProjectItem->removeValue( "CONFIG", "exceptions" ); + if ( stlCheck->isChecked() ) + myProjectItem->addValue( "CONFIG", "stl" ); + else + myProjectItem->removeValue( "CONFIG", "stl" ); + if ( rttiCheck->isChecked() ) + myProjectItem->addValue( "CONFIG", "rtti" ); + else + myProjectItem->removeValue( "CONFIG", "rtti" ); + if ( checkQt->isChecked() ) + myProjectItem->addValue( "CONFIG", "qt" ); + else + myProjectItem->removeValue( "CONFIG", "qt" ); + if ( checkOpenGL->isChecked() ) + myProjectItem->addValue( "CONFIG", "opengl" ); + else + myProjectItem->removeValue( "CONFIG", "opengl" ); + if ( checkThread->isChecked() ) + myProjectItem->addValue( "CONFIG", "thread" ); + else + myProjectItem->removeValue( "CONFIG", "thread" ); + if ( checkX11->isChecked() ) + myProjectItem->addValue( "CONFIG", "x11" ); + else + myProjectItem->removeValue( "CONFIG", "x11" ); + if ( checkOrdered->isChecked() ) + myProjectItem->addValue( "CONFIG", "ordered" ); + else + myProjectItem->removeValue( "CONFIG", "ordered" ); + if ( checkLibtool->isChecked() ) + myProjectItem->addValue( "CONFIG", "compile_libtool" ); + else + myProjectItem->removeValue( "CONFIG", "compile_libtool" ); + + if ( checkConsole->isChecked() ) + myProjectItem->addValue( "CONFIG", "console" ); + else + myProjectItem->removeValue( "CONFIG", "console" ); + if ( checkPCH->isChecked() ) + myProjectItem->addValue( "CONFIG", "precompile_header" ); + else + myProjectItem->removeValue( "CONFIG", "precompile_header" ); + // Warnings + if ( checkWarning->isChecked() ) + { + myProjectItem->addValue( "CONFIG", "warn_on" ); + myProjectItem->removeValue( "CONFIG", "warn_off" ); + } + else + { + myProjectItem->addValue( "CONFIG", "warn_off" ); + myProjectItem->removeValue( "CONFIG", "warn_on" ); + } + if ( checkWindows->isChecked() ) + myProjectItem->addValue( "CONFIG", "windows" ); + else + myProjectItem->removeValue( "CONFIG", "windows" ); + + //Qt4 libs + if ( prjWidget->m_part->isQt4Project() ) + { + if ( checkDebugReleaseMode->isChecked() ) + myProjectItem->addValue( "CONFIG", "debug_and_release" ); + else + myProjectItem->removeValue( "CONFIG", "debug_and_release" ); + + if ( checkTestlib->isChecked() ) + myProjectItem->addValue( "CONFIG", "qtestlib" ); + else + myProjectItem->removeValue( "CONFIG", "qtestlib" ); + if ( checkAssistant->isChecked() ) + myProjectItem->addValue( "CONFIG", "assistant" ); + else + myProjectItem->removeValue( "CONFIG", "assistant" ); + if ( checkUiTools->isChecked() ) + myProjectItem->addValue( "CONFIG", "uitools" ); + else + myProjectItem->removeValue( "CONFIG", "uitools" ); + if ( checkQDBus->isChecked() ) + myProjectItem->addValue( "CONFIG", "dbus" ); + else + myProjectItem->removeValue( "CONFIG", "dbus" ); + if ( checkBuildAll->isChecked() ) + myProjectItem->addValue( "CONFIG", "build_all" ); + else + myProjectItem->removeValue( "CONFIG", "build_all" ); + if ( checkQtHelp->isChecked() ) + myProjectItem->addValue( "CONFIG", "help" ); + else + myProjectItem->removeValue( "CONFIG", "help" ); + + if ( checkQt4Core->isChecked() ) + myProjectItem->addValue( "QT", "core" ); + else + myProjectItem->removeValue( "QT", "core" ); + if ( checkQt4Gui->isChecked() ) + myProjectItem->addValue( "QT", "gui" ); + else + myProjectItem->removeValue( "QT", "gui" ); + if ( checkQt4SQL->isChecked() ) + myProjectItem->addValue( "QT", "sql" ); + else + myProjectItem->removeValue( "QT", "sql" ); + if ( checkQt4SVG->isChecked() ) + myProjectItem->addValue( "QT", "svg" ); + else + myProjectItem->removeValue( "QT", "svg" ); + if ( checkQt4XML->isChecked() ) + myProjectItem->addValue( "QT", "xml" ); + else + myProjectItem->removeValue( "QT", "xml" ); + if ( checkQt4Network->isChecked() ) + myProjectItem->addValue( "QT", "network" ); + else + myProjectItem->removeValue( "QT", "network" ); + if ( checkQt3Support->isChecked() ) + myProjectItem->addValue( "QT", "qt3support" ); + else + myProjectItem->removeValue( "QT", "qt3support" ); + if ( checkQt4OpenGL->isChecked() ) + myProjectItem->addValue( "QT", "opengl" ); + else + myProjectItem->removeValue( "QT", "opengl" ); + if ( checkQtScript->isChecked() ) + myProjectItem->addValue( "QT", "script" ); + else + myProjectItem->removeValue( "QT", "script" ); + if ( checkQtWebKit->isChecked() ) + myProjectItem->addValue( "QT", "webkit" ); + else + myProjectItem->removeValue( "QT", "webkit" ); + if ( checkQtXmlPatterns->isChecked() ) + myProjectItem->addValue( "QT", "xmlpatterns" ); + else + myProjectItem->removeValue( "QT", "xmlpatterns" ); + if ( checkPhonon->isChecked() ) + myProjectItem->addValue( "QT", "phonon" ); + else + myProjectItem->removeValue( "QT", "phonon" ); + } + + QStringList confValues = myProjectItem->scope->variableValues( "CONFIG" ); + QStringList extraValues = QStringList::split( " ", editConfigExtra->text() ); + for ( QStringList::iterator it = confValues.begin() ; it != confValues.end() ; ++it ) + { + if ( Scope::KnownConfigValues.findIndex( *it ) == -1 && extraValues.findIndex( *it ) == -1 ) + { + myProjectItem->scope->removeFromPlusOp( "CONFIG", *it ); + } + } + + for ( QStringList::iterator it = extraValues.begin() ; it != extraValues.end() ; ++it ) + { + if ( confValues.findIndex( *it ) == -1 ) + myProjectItem->scope->addToPlusOp( "CONFIG", *it ); + } + + QString targetpath = m_targetPath->url(); +// if( !QFileInfo( targetpath ).isRelative() ) +// targetpath = URLUtil::getRelativePath( myProjectItem->scope->projectDir(), targetpath ); + if( myProjectItem->scope->scopeType() == Scope::FunctionScope || myProjectItem->scope->scopeType() == Scope::SimpleScope ) + { + if( myProjectItem->scope->variableValues("TARGET").findIndex( m_targetOutputFile->text() ) == -1 ) + myProjectItem->scope->setEqualOp( "TARGET", QStringList( m_targetOutputFile->text() ) ); + if( myProjectItem->scope->variableValues("DESTDIR").findIndex( targetpath ) == -1 ) + myProjectItem->scope->setEqualOp( "DESTDIR", QStringList( targetpath ) ); + }else + { + myProjectItem->scope->setEqualOp( "TARGET", QStringList( m_targetOutputFile->text() ) ); + myProjectItem->scope->setEqualOp( "DESTDIR", QStringList( targetpath ) ); + } + + myProjectItem->updateValues( "DEFINES", QStringList::split( " ", m_defines->text() ) ); + myProjectItem->updateValues( "QMAKE_CXXFLAGS_DEBUG", QStringList::split( " ", m_debugFlags->text() ) ); + myProjectItem->updateValues( "QMAKE_CXXFLAGS_RELEASE", QStringList::split( " ", m_releaseFlags->text() ) ); + + //add selected includes + QStringList values; + InsideCheckListItem *insideItem = ( InsideCheckListItem * ) insideinc_listview->firstChild(); + while ( insideItem ) + { + if ( insideItem->isOn() ) + { + QString tmpInc = insideItem->prjItem->getIncAddPath( myProjectItem->scope->projectDir() ); + tmpInc = QDir::cleanDirPath( tmpInc ); + values << tmpInc; + + } + insideItem = ( InsideCheckListItem* ) insideItem->itemBelow(); + } + + QCheckListItem *outsideItem = ( QCheckListItem * ) outsideinc_listview->firstChild(); + while ( outsideItem ) + { + values << outsideItem->text( 0 ); + outsideItem = ( QCheckListItem* ) outsideItem->itemBelow(); + } +// myProjectItem->removeValues( "INCLUDEPATH", values ); + myProjectItem->updateValues( "INCLUDEPATH", values ); + + //target.install + if ( checkInstallTarget->isChecked() == true ) + { + myProjectItem->addValue( "INSTALLS", "target" ); + myProjectItem->scope->setEqualOp( "target.path", QStringList( m_InstallTargetPath->text() ) ); + } + else + { + myProjectItem->removeValue( "INSTALLS", "target" ); + myProjectItem->scope->removeVariable( "target.path", "=" ); + } + + //makefile + myProjectItem->scope->setEqualOp( "MAKEFILE", QStringList( makefile_url->url() ) ); + + //add libs to link + + values.clear(); + QStringList libPaths; + + //inside libs to link + insideItem = ( InsideCheckListItem * ) insidelib_listview->firstChild(); + while ( insideItem ) + { + if ( insideItem->isOn() ) + { + + QString tmpLib = insideItem->prjItem->getLibAddObject( myProjectItem->scope->projectDir() ); + if ( insideItem->prjItem->scope->variableValues( "CONFIG" ).findIndex( "dll" ) != -1 ) + { + //add path if shared lib is linked + QString tmpPath = insideItem->prjItem->getLibAddPath( + myProjectItem->scope->projectDir() ); + if ( tmpPath != "" ) + { + values << ("-L"+tmpPath) ; + } + } + values << tmpLib ; + + } + insideItem = ( InsideCheckListItem* ) insideItem->itemBelow(); + } + + //extra lib paths + QListViewItem *lvItem = outsidelibdir_listview->firstChild(); + while ( lvItem ) + { + values << ( "-L"+lvItem->text( 0 ) ); + lvItem = lvItem->itemBelow(); + } + + + //outside libs to link + outsideItem = ( QCheckListItem * ) outsidelib_listview->firstChild(); + while ( outsideItem ) + { + values << outsideItem->text( 0 ); + outsideItem = ( QCheckListItem* ) outsideItem->itemBelow(); + } + + +// myProjectItem->removeValues( "LIBS", values ); + myProjectItem->updateValues( "LIBS", values ); + + values.clear(); + + //external project dependencies + QListViewItem *depItem = extDeps_view->firstChild(); + while ( depItem ) + { + values << depItem->text( 0 ); + depItem = depItem->itemBelow(); + } + + //internal project dependencies + insideItem = dynamic_cast<InsideCheckListItem *>( intDeps_view->firstChild() ); + while ( insideItem ) + { + if ( insideItem->isOn() ) + { + if ( insideItem->prjItem->scope->variableValues( "CONFIG" ).findIndex( "staticlib" ) != -1 + || ( insideItem->prjItem->scope->variableValues( "CONFIG" ).findIndex("dll") == -1 + && insideItem->prjItem->scope->variableValues( "TEMPLATE" ).findIndex("lib") != -1 ) ) + { + values << insideItem->prjItem->getLibAddObject( + myProjectItem->scope->projectDir() ); + } + else if ( insideItem->prjItem->scope->variableValues( "CONFIG" ).findIndex( "dll" ) != -1 ) + { + values << insideItem->prjItem->getSharedLibAddObject( + myProjectItem->scope->projectDir() ); + } + else + { + values << insideItem->prjItem->getApplicationObject( + myProjectItem->scope->projectDir() ); + } + } + insideItem = dynamic_cast<InsideCheckListItem *>( insideItem->itemBelow() ); + } +// myProjectItem->removeValues( "TARGETDEPS", values ); + myProjectItem->updateValues( "TARGETDEPS", values ); + + values.clear(); + //change build order + lvItem = buildorder_listview->firstChild(); + if ( lvItem && lvItem->itemBelow() && myProjectItem->scope->variableValues("TEMPLATE").findIndex("subdirs") != -1 ) + { + + while ( lvItem ) + { + values << lvItem->text( 0 ); + lvItem = lvItem->itemBelow(); + } + + if( values != myProjectItem->scope->variableValues("SUBDIRS") ) + { + if ( myProjectItem->scope->isVariableReset( "SUBDIRS" ) ) + { + myProjectItem->scope->removeVariable( "SUBDIRS", "=" ); + myProjectItem->scope->setEqualOp( "SUBDIRS", values ); + } + else + { + myProjectItem->scope->removeVariable( "SUBDIRS", "+=" ); + myProjectItem->scope->setPlusOp( "SUBDIRS", values ); + } + } + } + + // intermediate locations + myProjectItem->scope->setEqualOp( "OBJECTS_DIR", QStringList( objdir_url->url() ) ); + myProjectItem->scope->setEqualOp( "UI_DIR", QStringList( uidir_url->url() ) ); + myProjectItem->scope->setEqualOp( "MOC_DIR", QStringList( mocdir_url->url() ) ); + myProjectItem->scope->setEqualOp( "RCC_DIR", QStringList( rccdir_url->url() ) ); + + //CORBA + myProjectItem->scope->setEqualOp( "IDL_COMPILER", QStringList( idlCmdEdit->url() ) ); + myProjectItem->updateValues( "IDL_OPTIONS", QStringList::split( " ", idlCmdOptionsEdit->text() ) ); + + QListViewItemIterator iter(customVariables); + for( ; iter.current() ; iter++ ) + { + QListViewItem* item = iter.current(); + myProjectItem->scope->updateCustomVariable( item->key(0, true).toUInt(), item->text(0), item->text(1), item->text(2) ); + } +} + +void ProjectConfigurationDlg::accept() +{ + if( buttonApply->isEnabled() ) + apply(); + myProjectItem = 0; + QDialog::accept(); +} + +void ProjectConfigurationDlg::reject() +{ + myProjectItem = 0; + QDialog::reject(); +} + + + +void ProjectConfigurationDlg::updateControls() +{ + // Project template + groupLibraries->setEnabled( false ); + if( myProjectItem->scope->scopeType() != Scope::ProjectScope ) + groupTemplate->setEnabled( false ); + else + groupTemplate->setEnabled( true ); + + //cache the value of the some variables + QStringList configValues = myProjectItem->scope->variableValues( "CONFIG" ); + QStringList templateValues = myProjectItem->scope->variableValues( "TEMPLATE" ); + //if( !myProjectItem->isScope ) + //{ + if ( templateValues.findIndex( "lib" ) != -1 ) + { + groupLibraries->setEnabled( true ); + + radioLibrary->setChecked( true ); + staticRadio->setChecked( true ); //default + + if ( configValues.findIndex( "staticlib" ) != -1 ) + { + staticRadio->setChecked( true ); + checkPlugin->setEnabled( false ); + checkDesigner->setEnabled( false ); + } + else + staticRadio->setChecked( false ); + if ( configValues.findIndex( "dll" ) != -1 ) + { + sharedRadio->setChecked( true ); + checkPlugin->setEnabled( true ); + if( prjWidget->m_part->isQt4Project() ) + checkDesigner->setEnabled( true ); + m_targetLibraryVersion->setText( myProjectItem->scope->variableValues( "VERSION" ).front() ); + } + else + { + sharedRadio->setChecked( false ); + m_targetLibraryVersion->setText( "" ); + } + + if( !staticRadio->isChecked() && !sharedRadio->isChecked() ) + { + staticRadio->setChecked( true ); + checkPlugin->setEnabled( false ); + checkDesigner->setEnabled( false ); + } + + if ( configValues.findIndex( "plugin" ) != -1 ) + checkPlugin->setChecked( true ); + else + checkPlugin->setChecked( false ); + if ( configValues.findIndex( "designer" ) != -1 ) + checkDesigner->setChecked( true ); + else + checkDesigner->setChecked( false ); + if ( configValues.findIndex( "compile_libtool" ) != -1 ) + checkLibtool->setChecked( true ); + else + checkLibtool->setChecked( false ); + } + else if ( templateValues.findIndex( "subdirs" ) != -1 ) + { + radioSubdirs->setChecked( true ); + }else + { + //Default is app mode + radioApplication->setChecked( true ); + if ( configValues.findIndex( "console" ) != -1 ) + { + checkConsole->setChecked( true ); + } + QString targetname = prjWidget->getCurrentOutputFilename(); + if( targetname.findRev("/") != -1 ) + targetname = targetname.right( targetname.length() - targetname.findRev("/") - 1 ); + m_editRunArguments->setText( DomUtil::readEntry( *prjWidget->m_part->projectDom(), "/kdevtrollproject/run/runarguments/"+targetname, "" ) ); + + QString dir = DomUtil::readEntry( *prjWidget->m_part->projectDom(), "/kdevtrollproject/run/cwd/"+targetname, "" ); + if( QFileInfo(dir).isRelative() ) + { + m_CWDEdit->completionObject()->setDir( myProjectItem->scope->projectDir() ); + m_CWDEdit->fileDialog()->setURL( KURL( myProjectItem->scope->projectDir()+"/"+dir ) ); + }else + { + + m_CWDEdit->completionObject()->setDir( dir); + m_CWDEdit->fileDialog()->setURL( KURL( dir ) ); + } + m_CWDEdit->setURL( dir ); + + if( m_CWDEdit->url().isEmpty() ) + { + QString destdir = myProjectItem->m_widget->getCurrentDestDir(); + if( !destdir.startsWith( "/" ) ) + destdir = myProjectItem->m_widget->projectDirectory()+"/"+destdir; + m_CWDEdit->setURL( destdir.left( destdir.findRev("/") ) ); + m_CWDEdit->fileDialog()->setURL( KURL::fromPathOrURL( destdir.left( destdir.findRev("/") ) ) ); + } + m_editDebugArguments->setText( DomUtil::readEntry( *prjWidget->m_part->projectDom(), "/kdevtrollproject/run/debugarguments/"+targetname, "" ) ); + } + + // Buildmode + int debugidx = configValues.findIndex( "debug" ); + int releaseidx = configValues.findIndex( "release" ); + if ( debugidx != -1 && debugidx > releaseidx ) + { + radioDebugMode->setChecked( true ); + } + if ( releaseidx != -1 && releaseidx > debugidx ) + { + radioReleaseMode->setChecked( true ); + } + if ( configValues.findIndex( "debug_and_release" ) != -1 ) + { + checkDebugReleaseMode->setChecked( true ); + } + + // Requirements + if ( configValues.findIndex( "qt" ) != -1 ) + checkQt->setChecked( true ); + else + checkQt->setChecked( false ); + if ( configValues.findIndex( "opengl" ) != -1 ) + checkOpenGL->setChecked( true ); + else + checkOpenGL->setChecked( false ); + if ( configValues.findIndex( "thread" ) != -1 ) + checkThread->setChecked( true ); + else + checkThread->setChecked( false ); + if ( configValues.findIndex( "x11" ) != -1 ) + checkX11->setChecked( true ); + else + checkX11->setChecked( false ); + if ( configValues.findIndex( "ordered" ) != -1 ) + checkOrdered->setChecked( true ); + else + checkOrdered->setChecked( false ); + if ( configValues.findIndex( "exceptions" ) != -1 ) + exceptionCheck->setChecked( true ); + else + exceptionCheck->setChecked( false ); + if ( configValues.findIndex( "stl" ) != -1 ) + stlCheck->setChecked( true ); + else + stlCheck->setChecked( false ); + if ( configValues.findIndex( "rtti" ) != -1 ) + rttiCheck->setChecked( true ); + else + rttiCheck->setChecked( false ); + if ( configValues.findIndex( "precompile_header" ) != -1 ) + checkPCH->setChecked( true ); + else + checkPCH->setChecked( false ); + // Warnings + if ( configValues.findIndex( "warn_on" ) != -1 ) + { + checkWarning->setChecked( true ); + } + if ( configValues.findIndex( "warn_off" ) != -1 ) + { + checkWarning->setChecked( false ); + } + + if ( configValues.findIndex( "windows" ) != -1 ) + checkWindows->setChecked( true ); + else + checkWindows->setChecked( false ); + + //Qt4 libs + if ( prjWidget->m_part->isQt4Project() ) + { + + if ( configValues.findIndex( "assistant" ) != -1 ) + checkAssistant->setChecked( true ); + else + checkAssistant->setChecked( false ); + if ( configValues.findIndex( "qtestlib" ) != -1 ) + checkTestlib->setChecked( true ); + else + checkTestlib->setChecked( false ); + if ( configValues.findIndex( "uitools" ) != -1 ) + checkUiTools->setChecked( true ); + else + checkUiTools->setChecked( false ); + if ( configValues.findIndex( "dbus" ) != -1 ) + checkQDBus->setChecked( true ); + else + checkQDBus->setChecked( false ); + if ( configValues.findIndex( "build_all" ) != -1 ) + checkBuildAll->setChecked( true ); + else + checkBuildAll->setChecked( false ); + if ( configValues.findIndex( "help" ) != -1 ) + checkQtHelp->setChecked( true ); + else + checkQtHelp->setChecked( false ); + + QStringList qtLibs = myProjectItem->scope->variableValues( "QT" ); + if ( qtLibs.findIndex( "core" ) != -1 ) + checkQt4Core->setChecked( true ); + else + checkQt4Core->setChecked( false ); + if ( qtLibs.findIndex( "gui" ) != -1 ) + checkQt4Gui->setChecked( true ); + else + checkQt4Gui->setChecked( false ); + if ( qtLibs.findIndex( "sql" ) != -1 ) + checkQt4SQL->setChecked( true ); + else + checkQt4SQL->setChecked( false ); + if ( qtLibs.findIndex( "xml" ) != -1 ) + checkQt4XML->setChecked( true ); + else + checkQt4XML->setChecked( false ); + if ( qtLibs.findIndex( "network" ) != -1 ) + checkQt4Network->setChecked( true ); + else + checkQt4Network->setChecked( false ); + if ( qtLibs.findIndex( "svg" ) != -1 ) + checkQt4SVG->setChecked( true ); + else + checkQt4SVG->setChecked( false ); + if ( qtLibs.findIndex( "opengl" ) != -1 ) + checkQt4OpenGL->setChecked( true ); + else + checkQt4OpenGL->setChecked( false ); + if ( qtLibs.findIndex( "qt3support" ) != -1 ) + checkQt3Support->setChecked( true ); + else + checkQt3Support->setChecked( false ); + if ( qtLibs.findIndex( "script" ) != -1 ) + checkQtScript->setChecked( true ); + else + checkQtScript->setChecked( false ); + if ( qtLibs.findIndex( "phonon" ) != -1 ) + checkPhonon->setChecked( true ); + else + checkPhonon->setChecked( false ); + if ( qtLibs.findIndex( "webkit" ) != -1 ) + checkQtWebKit->setChecked( true ); + else + checkQtWebKit->setChecked( false ); + if ( qtLibs.findIndex( "xmlpatterns" ) != -1 ) + checkQtXmlPatterns->setChecked( true ); + else + checkQtXmlPatterns->setChecked( false ); + + checkDebugReleaseMode->setEnabled( true ); + checkBuildAll->setEnabled( true ); + groupQt4Libs->setEnabled( checkQt->isChecked() ); + rccdir_url->setEnabled( true ); + rccdir_label->setEnabled( true ); + } + + //fill the custom config edit + QStringList extraValues; + for ( QStringList::const_iterator it = configValues.begin() ; it != configValues.end() ; ++it ) + { + if ( Scope::KnownConfigValues.findIndex( *it ) == -1 ) + { + extraValues << *it; + } + } + editConfigExtra->setText( extraValues.join( " " ) ); + + QString dir = myProjectItem->scope->variableValues( "MAKEFILE" ).front(); + if( QFileInfo(dir).isRelative() ) + { + makefile_url->completionObject()->setDir( myProjectItem->scope->projectDir() ); + makefile_url->fileDialog()->setURL( KURL( myProjectItem->scope->projectDir()+"/"+dir ) ); + }else + { + makefile_url->completionObject()->setDir( dir ); + makefile_url->fileDialog()->setURL( KURL( dir ) ); + } + makefile_url->setURL( dir ); + + if ( myProjectItem->scope->variableValues( "INSTALLS" ).findIndex( "target" ) != -1 ) + { + checkInstallTarget->setChecked( true ); + m_InstallTargetPath->setEnabled( true ); + } + else + { + checkInstallTarget->setChecked( false ); + m_InstallTargetPath->setEnabled( false ); + } + m_InstallTargetPath->setText( myProjectItem->scope->variableValues( "target.path" ).front() ); + + m_targetOutputFile->setText( myProjectItem->scope->variableValues( "TARGET" ).front() ); + + dir = myProjectItem->scope->variableValues( "DESTDIR" ).front(); + if( QFileInfo(dir).isRelative() ) + { + m_targetPath->completionObject()->setDir( myProjectItem->scope->projectDir() ); + m_targetPath->fileDialog()->setURL( KURL( myProjectItem->scope->projectDir()+"/"+dir ) ); + }else + { + m_targetPath->completionObject()->setDir( dir ); + m_targetPath->fileDialog()->setURL( KURL( dir ) ); + } + m_targetPath->setURL( dir ); + + m_defines->setText( myProjectItem->scope->variableValues( "DEFINES" ).join( " " ) ); + m_debugFlags->setText( myProjectItem->scope->variableValues( "QMAKE_CXXFLAGS_DEBUG" ).join( " " ) ); + m_releaseFlags->setText( myProjectItem->scope->variableValues( "QMAKE_CXXFLAGS_RELEASE" ).join( " " ) ); + + updateIncludeControl(); + updateLibControls(); + updateBuildOrderControl(); + updateDependenciesControl(); + + dir = myProjectItem->scope->variableValues( "OBJECTS_DIR" ).front(); + if( QFileInfo(dir).isRelative() ) + { + objdir_url->completionObject()->setDir( myProjectItem->scope->projectDir() ); + objdir_url->fileDialog()->setURL( KURL( myProjectItem->scope->projectDir()+"/"+dir ) ); + }else + { + objdir_url->completionObject()->setDir( dir ); + objdir_url->fileDialog()->setURL( KURL( dir ) ); + } + objdir_url->setURL( dir ); + dir = myProjectItem->scope->variableValues( "UI_DIR" ).front(); + if( QFileInfo(dir).isRelative() ) + { + uidir_url->completionObject()->setDir( myProjectItem->scope->projectDir() ); + uidir_url->fileDialog()->setURL( KURL( myProjectItem->scope->projectDir()+"/"+dir ) ); + }else + { + uidir_url->completionObject()->setDir( dir ); + uidir_url->fileDialog()->setURL( KURL( dir ) ); + } + uidir_url->setURL( dir ); + dir = myProjectItem->scope->variableValues( "MOC_DIR" ).front(); + if( QFileInfo(dir).isRelative() ) + { + mocdir_url->completionObject()->setDir( myProjectItem->scope->projectDir() ); + mocdir_url->fileDialog()->setURL( KURL( myProjectItem->scope->projectDir()+"/"+dir ) ); + }else + { + mocdir_url->completionObject()->setDir( dir ); + mocdir_url->fileDialog()->setURL( KURL( dir ) ); + } + mocdir_url->setURL( dir ); + dir = myProjectItem->scope->variableValues( "RC_DIR" ).front(); + if( QFileInfo(dir).isRelative() ) + { + rccdir_url->completionObject()->setDir( myProjectItem->scope->projectDir() ); + rccdir_url->fileDialog()->setURL( KURL( myProjectItem->scope->projectDir()+"/"+dir ) ); + }else + { + rccdir_url->completionObject()->setDir( dir ); + rccdir_url->fileDialog()->setURL( KURL( dir ) ); + } + rccdir_url->setURL( dir ); + + + dir = myProjectItem->scope->variableValues( "IDL_COMPILER" ).front(); + if( QFileInfo(dir).isRelative() ) + { + idlCmdEdit->completionObject()->setDir( myProjectItem->scope->projectDir() ); + idlCmdEdit->fileDialog()->setURL( KURL( myProjectItem->scope->projectDir()+"/"+dir ) ); + }else + { + idlCmdEdit->completionObject()->setDir( dir ); + idlCmdEdit->fileDialog()->setURL( KURL( dir ) ); + } + idlCmdEdit->setURL( dir ); + idlCmdOptionsEdit->setText( myProjectItem->scope->variableValues( "IDL_OPTIONS" ).join( " " ) ); + + customVariables->clear(); + customVariableName->setText(""); + customVariableData->setText(""); + customVariableOp->setCurrentItem( 0 ); + QMap<unsigned int, QMap<QString, QString> > customvars = myProjectItem->scope->customVariables(); + QMap<unsigned int, QMap<QString, QString> >::iterator idx = customvars.begin(); + for ( ; idx != customvars.end(); ++idx ) + { + CustomVarListItem* item = new CustomVarListItem( customVariables, idx.key(), idx.data() ); + item->setMultiLinesEnabled(true); + } + + groupTemplateChanged(0); +} + +QPtrList<QMakeScopeItem> ProjectConfigurationDlg::getAllProjects() +{ + QPtrList <QMakeScopeItem> tmpPrjList; + QMakeScopeItem *item = static_cast<QMakeScopeItem*>( prjList->firstChild() ); + while ( item ) + { + if ( item->scope->scopeType() == Scope::ProjectScope ) + { + if( item != myProjectItem ) + tmpPrjList.append( item ); + getAllSubProjects( item, &tmpPrjList ); + } + item = static_cast<QMakeScopeItem*>( item->nextSibling() ); + } + return ( tmpPrjList ); +} + +void ProjectConfigurationDlg::getAllSubProjects( QMakeScopeItem *item, QPtrList <QMakeScopeItem> *itemList ) +{ + + QMakeScopeItem * subItem = static_cast<QMakeScopeItem*>( item->firstChild() ); + while ( subItem ) + { + if ( subItem->scope->scopeType() == Scope::ProjectScope ) + { + if ( subItem != myProjectItem ) + itemList->append( subItem ); + getAllSubProjects( subItem, itemList ); + } + subItem = static_cast<QMakeScopeItem*>( subItem->nextSibling() ); + } +} + +void ProjectConfigurationDlg::updateIncludeControl() +{ + insideinc_listview->setSorting( -1, false ); + outsideinc_listview->setSorting( -1, false ); + insideinc_listview->clear(); + outsideinc_listview->clear(); + + QStringList incList = myProjectItem->scope->variableValues( "INCLUDEPATH" ); + QStringList intIncList = incList; + QMap<QString, InsideCheckListItem*> items; + QPtrList <QMakeScopeItem> itemList = getAllProjects(); + QMakeScopeItem *item = itemList.first(); + while ( item ) + { + if ( item->scope->variableValues( "TEMPLATE" ).findIndex( "lib" ) != -1 || + item->scope->variableValues( "TEMPLATE" ).findIndex( "app" ) != -1 ) + { + QString tmpInc = item->getIncAddPath( myProjectItem->scope->projectDir() ); + tmpInc = QDir::cleanDirPath( tmpInc ); + InsideCheckListItem *newItem = new InsideCheckListItem( insideinc_listview, + insideinc_listview->lastItem(), item, this ); + + items[tmpInc] = newItem; + if ( incList.findIndex( tmpInc ) != -1 ) + { + incList.remove( tmpInc ); + newItem->setOn( true ); + } + } + // item=(ProjectItem*)item->itemBelow(); + item = itemList.next(); + } + + + //all other in incList are outside incs + outsideinc_listview->clear(); + QStringList::Iterator it1 = incList.begin(); + for ( ;it1 != incList.end();++it1 ) + { + intIncList.remove(*it1); + new QListViewItem( outsideinc_listview, outsideinc_listview->lastItem(), ( *it1 ) ); + } + for( QStringList::const_iterator it = intIncList.begin(); it != intIncList.end(); ++it ) + { + insideinc_listview->insertItem( items[*it] ); + items.remove(*it); + } + for( QMap<QString,InsideCheckListItem*>::ConstIterator it3 = items.begin(); it3 != items.end(); it3++ ) + { + insideinc_listview->insertItem( it3.data() ); + } +} + +void ProjectConfigurationDlg::updateLibControls() +{ + + QPtrList <QMakeScopeItem> itemList = getAllProjects(); + + insidelib_listview->setSorting( -1, false ); + outsidelib_listview->setSorting( -1, false ); + outsidelibdir_listview->setSorting( -1, false ); + insidelib_listview->clear(); + outsidelib_listview->clear(); + outsidelibdir_listview->clear(); + //update librarys + //temp strlist + QStringList libList = myProjectItem->scope->variableValues( "LIBS" ); + QStringList intLibList = libList; + QMap<QString, InsideCheckListItem*> items; + QMakeScopeItem* item = itemList.first(); + while ( item ) + { + if ( item->scope->variableValues( "TEMPLATE" ).findIndex( "lib" ) != -1 ) + { + if ( item != myProjectItem ) + { + // create lib string + QString tmpLib = item->getLibAddObject( myProjectItem->scope->projectDir() ); + + InsideCheckListItem * newItem = new InsideCheckListItem( insidelib_listview, + insidelib_listview->lastItem(), item, this ); + insidelib_listview->takeItem( newItem ); + items[tmpLib] = newItem; + QString tmpLibDir = item->getLibAddPath( myProjectItem->scope->projectDir() ); + kdDebug(9024) << "lib:" << tmpLib << " dir:" << tmpLibDir << "|" << libList << endl; + if ( libList.findIndex( "-L" + tmpLibDir ) != -1 ) + { + libList.remove( "-L" + tmpLibDir ); + } + if ( libList.findIndex( tmpLib ) != -1 ) + { + libList.remove( tmpLib ); + newItem->setOn( true ); + } + } + } + item = itemList.next(); + } + + //all other in libList are outside libs + QStringList::Iterator it1 = libList.begin(); + for ( ;it1 != libList.end();++it1 ) + { + intLibList.remove( *it1 ); + if ( ( *it1 ).startsWith( "-L" ) ) + new QListViewItem( outsidelibdir_listview, outsidelibdir_listview->lastItem(), ( *it1 ).mid( 2 ) ); + else + { + new QListViewItem( outsidelib_listview, outsidelib_listview->lastItem(), ( *it1 ) ); + } + } + + for( QStringList::const_iterator it = intLibList.begin(); it != intLibList.end(); ++it ) + { + QString lib = *it; + if( !lib.startsWith( "-L" ) ) + { + insidelib_listview->insertItem( items[lib] ); + items.remove(lib); + } + } + for( QMap<QString,InsideCheckListItem*>::ConstIterator it3 = items.begin(); it3 != items.end(); it3++ ) + { + insidelib_listview->insertItem( it3.data() ); + } +} + +void ProjectConfigurationDlg::updateDependenciesControl( ) +{ + QPtrList <QMakeScopeItem> itemList = getAllProjects(); + + intDeps_view->setSorting( -1, false ); + extDeps_view->setSorting( -1, false ); + intDeps_view->clear(); + extDeps_view->clear(); + + QStringList depsList = myProjectItem->scope->variableValues( "TARGETDEPS" ); + QStringList intDepList = depsList; + QMap<QString,InsideCheckListItem*> items; + QMakeScopeItem *item = itemList.first(); + while ( item ) + { + QStringList templateval = item->scope->variableValues( "TEMPLATE" ); + if ( templateval.findIndex( "lib" ) != -1 + || templateval.findIndex( "app" ) != -1 ) + { + QString tmpLib; + QStringList values = item->scope->variableValues( "CONFIG" ); + if ( templateval.findIndex( "lib" ) != -1 && values.findIndex( "dll" ) != -1 ) + tmpLib = item->getSharedLibAddObject( myProjectItem->scope->projectDir() ); + else if ( templateval.findIndex( "lib" ) != -1 ) + tmpLib = item->getLibAddObject( myProjectItem->scope->projectDir() ); + else + tmpLib = item->getApplicationObject( myProjectItem->scope->projectDir() ); + InsideCheckListItem * newItem = new InsideCheckListItem( intDeps_view, intDeps_view->lastItem(), item, this ); + items[tmpLib] = newItem; + if ( depsList.findIndex( tmpLib ) != -1 ) + { + depsList.remove( tmpLib ); + newItem->setOn( true ); + } + + } + item = itemList.next(); + } + + //add all other prj in itemList unchecked + + extDeps_view->clear(); + for ( QStringList::Iterator it1 = depsList.begin();it1 != depsList.end();++it1 ) + { + intDepList << *it1; + new QListViewItem( extDeps_view, extDeps_view->lastItem(), ( *it1 ) ); + } + + + for( QStringList::const_iterator it = intDepList.begin(); it != intDepList.end(); ++it ) + { + intDeps_view->insertItem( items[*it] ); + items.remove(*it); + } + + for( QMap<QString,InsideCheckListItem*>::ConstIterator it2 = items.begin(); it2 != items.end(); it2++ ) + { + intDeps_view->insertItem( it2.data() ); + } +} + + +void ProjectConfigurationDlg::updateBuildOrderControl() +{ + //sort build order only if subdirs + if ( myProjectItem->scope->variableValues( "TEMPLATE" ).findIndex( "subdirs" ) != -1 ) + { + + QPtrList <QMakeScopeItem> itemList; + + QMakeScopeItem *item = static_cast<QMakeScopeItem*>( myProjectItem->firstChild() ); + while ( item ) + { + itemList.append( item ); + item = static_cast<QMakeScopeItem*>( item->nextSibling() ); + } + + incaddTab->setEnabled( false ); + buildorder_listview->setSorting( -1, false ); + buildorder_listview->clear(); + QStringList buildList = myProjectItem->scope->variableValues( "SUBDIRS" ); + QStringList::Iterator it1 = buildList.begin(); + for ( ;it1 != buildList.end();++it1 ) + { + item = itemList.first(); + while ( item ) + { + if ( item->scope->scopeType() == Scope::ProjectScope ) + { + if ( item->text( 0 ) == ( *it1 ) ) + { + new QListViewItem( buildorder_listview, buildorder_listview->lastItem(), item->text( 0 ) ); + itemList.take(); + break; + } + } + item = itemList.next();; + } + } + }else + buildorder_listview->clear(); +} + +//build order buttons +void ProjectConfigurationDlg::buildorderMoveUpClicked() +{ + if ( buildorder_listview->currentItem() == buildorder_listview->firstChild() ) + { + KNotifyClient::beep(); + return ; + } + + QListViewItem *item = buildorder_listview->firstChild(); + while ( item->nextSibling() != buildorder_listview->currentItem() ) + item = item->nextSibling(); + item->moveItem( buildorder_listview->currentItem() ); + activateApply( 0 ); +} + + +void ProjectConfigurationDlg::buildorderMoveDownClicked() +{ + if ( buildorder_listview->currentItem() == 0 || buildorder_listview->currentItem() ->nextSibling() == 0 ) + { + KNotifyClient::beep(); + return ; + } + + buildorder_listview->currentItem() ->moveItem( buildorder_listview->currentItem() ->nextSibling() ); + activateApply( 0 ); +} + + +//Include dir buttons +void ProjectConfigurationDlg::insideIncMoveUpClicked() +{ + if ( insideinc_listview->currentItem() == insideinc_listview->firstChild() ) + { + KNotifyClient::beep(); + return ; + } + + QListViewItem *item = insideinc_listview->firstChild(); + while ( item->nextSibling() != insideinc_listview->currentItem() ) + item = item->nextSibling(); + item->moveItem( insideinc_listview->currentItem() ); + activateApply( 0 ); +} + + +void ProjectConfigurationDlg::insideIncMoveDownClicked() +{ + if ( insideinc_listview->currentItem() == 0 || insideinc_listview->currentItem() ->nextSibling() == 0 ) + { + KNotifyClient::beep(); + return ; + } + + insideinc_listview->currentItem() ->moveItem( insideinc_listview->currentItem() ->nextSibling() ); + activateApply( 0 ); +} + + +void ProjectConfigurationDlg::outsideIncMoveUpClicked() +{ + if ( outsideinc_listview->currentItem() == outsideinc_listview->firstChild() ) + { + KNotifyClient::beep(); + return ; + } + + QListViewItem *item = outsideinc_listview->firstChild(); + while ( item->nextSibling() != outsideinc_listview->currentItem() ) + item = item->nextSibling(); + item->moveItem( outsideinc_listview->currentItem() ); + activateApply( 0 ); +} + + +void ProjectConfigurationDlg::outsideIncMoveDownClicked() +{ + if ( outsideinc_listview->currentItem() == 0 || outsideinc_listview->currentItem() ->nextSibling() == 0 ) + { + KNotifyClient::beep(); + return ; + } + + outsideinc_listview->currentItem() ->moveItem( outsideinc_listview->currentItem() ->nextSibling() ); + activateApply( 0 ); +} + + +void ProjectConfigurationDlg::outsideIncAddClicked() +{ + KURLRequesterDlg dialog( "", i18n( "Add include directory:" ), 0, 0 ); + dialog.urlRequester() ->setMode( KFile::Directory | KFile::LocalOnly ); + dialog.urlRequester() ->setURL( QString::null ); + dialog.urlRequester() ->completionObject() ->setDir( myProjectItem->scope->projectDir() ); + dialog.urlRequester() ->fileDialog() ->setURL( KURL( myProjectItem->scope->projectDir() ) ); + if ( dialog.exec() != QDialog::Accepted ) + return ; + QString dir = dialog.urlRequester() ->url(); + if ( !dir.isEmpty() ) + { + new QListViewItem( outsideinc_listview, dir ); + activateApply( 0 ); + } +} + + +void ProjectConfigurationDlg::outsideIncRemoveClicked() +{ + delete outsideinc_listview->currentItem(); + activateApply( 0 ); +} + +//libadd buttons +void ProjectConfigurationDlg::insideLibMoveUpClicked() +{ + if ( insidelib_listview->currentItem() == insidelib_listview->firstChild() ) + { + KNotifyClient::beep(); + return ; + } + + QListViewItem *item = insidelib_listview->firstChild(); + while ( item->nextSibling() != insidelib_listview->currentItem() ) + item = item->nextSibling(); + item->moveItem( insidelib_listview->currentItem() ); + activateApply( 0 ); +} + + +void ProjectConfigurationDlg::insideLibMoveDownClicked() +{ + if ( insidelib_listview->currentItem() == 0 || insidelib_listview->currentItem() ->nextSibling() == 0 ) + { + KNotifyClient::beep(); + return ; + } + + insidelib_listview->currentItem() ->moveItem( insidelib_listview->currentItem() ->nextSibling() ); + activateApply( 0 ); +} + + +void ProjectConfigurationDlg::outsideLibMoveUpClicked() +{ + if ( outsidelib_listview->currentItem() == outsidelib_listview->firstChild() ) + { + KNotifyClient::beep(); + return ; + } + + QListViewItem *item = outsidelib_listview->firstChild(); + while ( item->nextSibling() != outsidelib_listview->currentItem() ) + item = item->nextSibling(); + item->moveItem( outsidelib_listview->currentItem() ); + activateApply( 0 ); +} + + +void ProjectConfigurationDlg::outsideLibMoveDownClicked() +{ + if ( outsidelib_listview->currentItem() == 0 || outsidelib_listview->currentItem() ->nextSibling() == 0 ) + { + KNotifyClient::beep(); + return ; + } + + outsidelib_listview->currentItem() ->moveItem( outsidelib_listview->currentItem() ->nextSibling() ); + activateApply( 0 ); +} + + +void ProjectConfigurationDlg::outsideLibAddClicked() +{ + KURLRequesterDlg dialog( "", i18n( "Add Library: Either choose the .a/.so file or give -l<libname>" ), 0, 0 ); + dialog.urlRequester() ->setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly ); + dialog.urlRequester() ->setFilter( "*.so|"+i18n("Shared Library (*.so)")+"\n*.a|"+i18n("Static Library (*.a)") ); + dialog.urlRequester() ->setURL( QString::null ); + dialog.urlRequester() ->completionObject() ->setDir( myProjectItem->scope->projectDir() ); + dialog.urlRequester() ->fileDialog() ->setURL( KURL( myProjectItem->scope->projectDir() ) ); + if ( dialog.exec() != QDialog::Accepted ) + return ; + QString file = dialog.urlRequester() ->url(); + if ( !file.isEmpty() ) + { + if( file.startsWith("-l") ) + { + new QListViewItem( outsidelib_listview, file ); + activateApply( 0 ); + } + else + { + QFileInfo fi(file); + if( !fi.exists() ) + { + new QListViewItem( outsidelib_listview, file );; + activateApply( 0 ); + } + if( fi.extension(false) == "a" ) + { + new QListViewItem( outsidelib_listview, file ); + activateApply( 0 ); + }else if ( fi.extension(false) == "so" ) + { + QString path = fi.dirPath( true ); + QString name = fi.fileName(); + if( name.startsWith( "lib" ) ) + name = name.mid(3); + name = "-l"+name.left( name.length() - 3 ); + new QListViewItem( outsidelib_listview, name ); + new QListViewItem( outsidelibdir_listview, path ); + activateApply( 0 ); + }else + return; + } + + } +} + + +void ProjectConfigurationDlg::outsideLibRemoveClicked() +{ + delete outsidelib_listview->currentItem(); + activateApply( 0 ); +} + +//lib paths buttons +void ProjectConfigurationDlg::outsideLibDirMoveUpClicked() +{ + if ( outsidelibdir_listview->currentItem() == outsidelibdir_listview->firstChild() ) + { + KNotifyClient::beep(); + return ; + } + + QListViewItem *item = outsidelibdir_listview->firstChild(); + while ( item->nextSibling() != outsidelibdir_listview->currentItem() ) + item = item->nextSibling(); + item->moveItem( outsidelibdir_listview->currentItem() ); + activateApply( 0 ); +} + + +void ProjectConfigurationDlg::outsideLibDirMoveDownClicked() +{ + if ( outsidelibdir_listview->currentItem() == 0 || outsidelibdir_listview->currentItem() ->nextSibling() == 0 ) + { + KNotifyClient::beep(); + return ; + } + + outsidelibdir_listview->currentItem() ->moveItem( outsidelibdir_listview->currentItem() ->nextSibling() ); + activateApply( 0 ); +} + + +void ProjectConfigurationDlg::outsideLibDirAddClicked() +{ + KURLRequesterDlg dialog( "", i18n( "Add library directory:" ), 0, 0 ); + dialog.urlRequester() ->setMode( KFile::Directory | KFile::LocalOnly ); + dialog.urlRequester() ->setURL( QString::null ); + dialog.urlRequester() ->completionObject() ->setDir( myProjectItem->scope->projectDir() ); + dialog.urlRequester() ->fileDialog() ->setURL( KURL( myProjectItem->scope->projectDir() ) ); + if ( dialog.exec() != QDialog::Accepted ) + return ; + QString dir = dialog.urlRequester() ->url(); + if ( !dir.isEmpty() ) + { + new QListViewItem( outsidelibdir_listview, dir ); + activateApply( 0 ); + } +} + + +void ProjectConfigurationDlg::outsideLibDirRemoveClicked() +{ + delete outsidelibdir_listview->currentItem(); + activateApply( 0 ); +} + +void ProjectConfigurationDlg::outsideIncEditClicked() +{ + QListViewItem * item = outsideinc_listview->currentItem(); + if ( item == NULL ) return ; + QString text = item->text( 0 ); + + KURLRequesterDlg dialog( text, i18n( "Change include directory:" ), 0, 0 ); + dialog.urlRequester() ->setMode( KFile::Directory | KFile::LocalOnly ); + if( QFileInfo(text).isRelative() ) + { + dialog.urlRequester() ->completionObject() ->setDir( myProjectItem->scope->projectDir() ); + dialog.urlRequester() ->fileDialog() ->setURL( KURL( myProjectItem->scope->projectDir()+"/"+text ) ); + } + else + { + dialog.urlRequester() ->completionObject() ->setDir( text ); + dialog.urlRequester() ->fileDialog() ->setURL( KURL( text ) ); + } + dialog.urlRequester() ->setURL( text ); + if ( dialog.exec() != QDialog::Accepted ) + return ; + QString dir = dialog.urlRequester() ->url(); + if ( !dir.isEmpty() ) + { + item->setText( 0, dir ); + activateApply( 0 ); + } +} + +void ProjectConfigurationDlg::outsideLibEditClicked() +{ + QListViewItem *item = outsidelib_listview->currentItem(); + if ( item == NULL ) return ; + QString text = item->text( 0 ); + + KURLRequesterDlg dialog( text, i18n( "Change Library:" ), 0, 0 ); + dialog.urlRequester() ->setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly ); + if( QFileInfo(text).isRelative() ) + { + dialog.urlRequester() ->completionObject() ->setDir( myProjectItem->scope->projectDir() ); + dialog.urlRequester() ->fileDialog() ->setURL( KURL( myProjectItem->scope->projectDir()+"/"+text ) ); + }else + { + dialog.urlRequester() ->completionObject() ->setDir( text ); + dialog.urlRequester() ->fileDialog() ->setURL( KURL( text ) ); + } + dialog.urlRequester() ->setURL( text ); + if ( dialog.exec() != QDialog::Accepted ) + return ; + QString file = dialog.urlRequester() ->url(); + if ( !file.isEmpty() ) + { + if( file.startsWith("-l") ) + { + item->setText( 0, file ); + activateApply( 0 ); + } + else + { + QFileInfo fi(file); + if( !fi.exists() ) + { + item->setText( 0, file ); + activateApply( 0 ); + } + if( fi.extension(false) == "a" ) + { + item->setText( 0, file ); + activateApply( 0 ); + }else if ( fi.extension(false) == "so" ) + { + QString path = fi.dirPath( true ); + QString name = fi.fileName(); + if( name.startsWith( "lib" ) ) + name = name.mid(3); + name = "-l"+name.left( name.length() - 3 ); + item->setText( 0, name ); + new QListViewItem( outsidelibdir_listview, path ); + activateApply( 0 ); + }else + return; + } + } +} + +void ProjectConfigurationDlg::outsideLibDirEditClicked() +{ + QListViewItem * item = outsidelibdir_listview->currentItem(); + if ( item == NULL ) return ; + QString text = item->text( 0 ); + + KURLRequesterDlg dialog( text, i18n( "Change library directory:" ), 0, 0 ); + dialog.urlRequester() ->setMode( KFile::Directory | KFile::LocalOnly ); + + if( QFileInfo(text).isRelative() ) + { + dialog.urlRequester() ->completionObject() ->setDir( myProjectItem->scope->projectDir() ); + dialog.urlRequester() ->fileDialog() ->setURL( KURL( myProjectItem->scope->projectDir()+"/"+text ) ); + } + else + { + dialog.urlRequester() ->completionObject() ->setDir( text ); + dialog.urlRequester() ->fileDialog() ->setURL( KURL( text ) ); + } + dialog.urlRequester() ->setURL( text ); + if ( dialog.exec() != QDialog::Accepted ) + return ; + QString dir = dialog.urlRequester() ->url(); + if ( !dir.isEmpty() ) + { + item->setText( 0, dir ); + activateApply( 0 ); + } +} + + +void ProjectConfigurationDlg::extAdd_button_clicked( ) +{ + KURLRequesterDlg dialog( "", i18n( "Add target:" ), 0, 0 ); + dialog.urlRequester() ->setMode( KFile::File | KFile::LocalOnly ); + dialog.urlRequester() ->setURL( QString::null ); + dialog.urlRequester() ->completionObject() ->setDir( myProjectItem->scope->projectDir() ); + dialog.urlRequester() ->fileDialog() ->setURL( KURL( myProjectItem->scope->projectDir() ) ); + if ( dialog.exec() != QDialog::Accepted ) + return ; + QString path = dialog.urlRequester() ->url(); + if ( !path.isEmpty() ) + { + new QListViewItem( extDeps_view, path ); + activateApply( 0 ); + } +} + +void ProjectConfigurationDlg::extEdit_button_clicked( ) +{ + QListViewItem * item = extDeps_view->currentItem(); + if ( item == NULL ) return ; + QString text = item->text( 0 ); + + KURLRequesterDlg dialog( text, i18n( "Change target:" ), 0, 0 ); + dialog.urlRequester() ->setMode( KFile::File | KFile::LocalOnly ); + if( QFileInfo(text).isRelative() ) + { + dialog.urlRequester() ->completionObject() ->setDir( myProjectItem->scope->projectDir() ); + dialog.urlRequester() ->fileDialog() ->setURL( KURL( myProjectItem->scope->projectDir()+"/"+text ) ); + } + else + { + dialog.urlRequester() ->completionObject() ->setDir( text ); + dialog.urlRequester() ->fileDialog() ->setURL( KURL( text ) ); + } + dialog.urlRequester() ->setURL( text ); + if ( dialog.exec() != QDialog::Accepted ) + return ; + QString path = dialog.urlRequester() ->url(); + if ( !path.isEmpty() ) + { + item->setText( 0, path ); + activateApply( 0 ); + } +} + +void ProjectConfigurationDlg::extMoveDown_button_clicked( ) +{ + if ( extDeps_view->currentItem() == 0 || extDeps_view->currentItem() ->nextSibling() == 0 ) + { + KNotifyClient::beep(); + return ; + } + + extDeps_view->currentItem() ->moveItem( extDeps_view->currentItem() ->nextSibling() ); + activateApply( 0 ); +} + +void ProjectConfigurationDlg::extMoveUp_button_clicked( ) +{ + if ( extDeps_view->currentItem() == extDeps_view->firstChild() ) + { + KNotifyClient::beep(); + return ; + } + + QListViewItem *item = extDeps_view->firstChild(); + while ( item->nextSibling() != extDeps_view->currentItem() ) + item = item->nextSibling(); + item->moveItem( extDeps_view->currentItem() ); + activateApply( 0 ); +} + +void ProjectConfigurationDlg::extRemove_button_clicked( ) +{ + delete extDeps_view->currentItem(); + activateApply( 0 ); +} + +void ProjectConfigurationDlg::intMoveDown_button_clicked( ) +{ + if ( intDeps_view->currentItem() == 0 || intDeps_view->currentItem() ->nextSibling() == 0 ) + { + KNotifyClient::beep(); + return ; + } + + intDeps_view->currentItem() ->moveItem( intDeps_view->currentItem() ->nextSibling() ); + activateApply( 0 ); +} + +void ProjectConfigurationDlg::intMoveUp_button_clicked( ) +{ + if ( intDeps_view->currentItem() == intDeps_view->firstChild() ) + { + KNotifyClient::beep(); + return ; + } + + QListViewItem *item = intDeps_view->firstChild(); + while ( item->nextSibling() != intDeps_view->currentItem() ) + item = item->nextSibling(); + item->moveItem( intDeps_view->currentItem() ); + activateApply( 0 ); +} + +void ProjectConfigurationDlg::addCustomValueClicked() +{ + QMap<QString, QString> customvar; + customvar["var"] = i18n("Name"); + customvar["op"] = "="; + customvar["values"] = i18n("Value"); + unsigned int key = myProjectItem->scope->addCustomVariable( customvar["var"], customvar["op"], customvar["values"] ); + CustomVarListItem* item = new CustomVarListItem( customVariables, key, customvar ); + item->setMultiLinesEnabled(true); + customVariables->setSelected( item, true ); + newCustomVariableActive(); + customVariables->sort(); + activateApply( 0 ); +} +void ProjectConfigurationDlg::removeCustomValueClicked() +{ + QListViewItem * item = customVariables->currentItem(); + if ( item ) + { + myProjectItem->scope->removeCustomVariable( item->key(0, true).toUInt() ); + delete item; + } + if( customVariables->firstChild() ) + { + customVariables->setSelected( customVariables->firstChild(), true ); + newCustomVariableActive(); + }else + { + customVariableName->setText( "" ); + customVariableData->setText( "" ); + customVariableOp->setCurrentItem( 0 ); + customVariableName->setFocus(); + } + customVariables->sort(); + + activateApply( 0 ); +} + +void ProjectConfigurationDlg::upCustomValueClicked() +{ + // custom vars + QListViewItem * item = customVariables->firstChild(); + if ( customVariables->currentItem() == item ) + { + KNotifyClient::beep(); + return ; + } + while ( item->nextSibling() != customVariables->currentItem() ) + item = item->nextSibling(); + item->moveItem( customVariables->currentItem() ); + activateApply( 0 ); +} + +void ProjectConfigurationDlg::downCustomValueClicked() +{ + if ( customVariables->currentItem() == 0 || customVariables->currentItem() ->nextSibling() == 0 ) + { + KNotifyClient::beep(); + return ; + } + customVariables->currentItem() ->moveItem( customVariables->currentItem() ->nextSibling() ); + activateApply( 0 ); +} + +void ProjectConfigurationDlg::newCustomVariableActive( ) +{ + customVariableOp->blockSignals(true); + customVariableName->blockSignals(true); + customVariableData->blockSignals(true); + QListViewItem * item = customVariables->currentItem(); + if ( item ) + { + customVariableName->setText( item->text( 0 ) ); + customVariableData->setText( item->text( 2 ) ); + customVariableOp->setCurrentText( item->text( 1 ) ); + customVariableName->setFocus(); + } + customVariableOp->blockSignals(false); + customVariableName->blockSignals(false); + customVariableData->blockSignals(false); +} + +void ProjectConfigurationDlg::groupLibrariesChanged( int ) +{ + if ( staticRadio->isChecked() ) + { + checkPlugin->setEnabled( false ); + checkDesigner->setEnabled( false ); + } + else if ( sharedRadio->isChecked() ) + { + checkPlugin->setEnabled( true ); + checkDesigner->setEnabled( checkPlugin->isChecked() ); + } + else if ( checkPlugin->isChecked() && prjWidget->m_part->isQt4Project() ) + { + checkDesigner->setEnabled( true ); + } + else + { + checkDesigner->setEnabled( false ); + } + activateApply( 0 ); +} + +void ProjectConfigurationDlg::groupTemplateChanged( int ) +{ + + if ( radioSubdirs->isChecked() ) + { + TabBuild->setTabEnabled( custVarsTab, true ); + TabBuild->setTabEnabled( libAddTab, false ); + TabBuild->setTabEnabled( incaddTab, false ); + TabBuild->setTabEnabled( buildOptsTab, false ); + TabBuild->setTabEnabled( configTab, false ); + TabBuild->setTabEnabled( depTab, true ); + intDeps_view->setEnabled( false ); + intMoveUp_button->setEnabled( false ); + intMoveDown_button->setEnabled( false ); + extAdd_button->setEnabled( false ); + extRemove_button->setEnabled( false ); + extEdit_button->setEnabled( false ); + extMoveUp_button->setEnabled( false ); + extMoveDown_button->setEnabled( false ); + extDeps_view->setEnabled( false ); + buildorder_listview->setEnabled( checkOrdered->isOn() ); + buildmoveup_button->setEnabled( checkOrdered->isOn() ); + buildmovedown_button->setEnabled( checkOrdered->isOn() ); + targetGroupbox->setEnabled( false ); + targetInstGroupbox->setEnabled( false ); + checkOrdered->setEnabled( true ); + } + else if ( radioLibrary->isChecked() ) + { + // staticRadio->setChecked(true); + TabBuild->setTabEnabled( custVarsTab, true ); + TabBuild->setTabEnabled( depTab, true ); + TabBuild->setTabEnabled( libAddTab, true ); + TabBuild->setTabEnabled( incaddTab, true ); + TabBuild->setTabEnabled( buildOptsTab, true ); + TabBuild->setTabEnabled( configTab, true ); + intDeps_view->setEnabled( true ); + intMoveUp_button->setEnabled( true ); + intMoveDown_button->setEnabled( true ); + extAdd_button->setEnabled( true ); + extRemove_button->setEnabled( true ); + extEdit_button->setEnabled( true ); + extMoveUp_button->setEnabled( true ); + extMoveDown_button->setEnabled( true ); + extDeps_view->setEnabled( true ); + buildorder_listview->setEnabled( false ); + buildmoveup_button->setEnabled( false ); + buildmovedown_button->setEnabled( false ); + groupLibraries->setEnabled( true ); + targetGroupbox->setEnabled( true ); + targetInstGroupbox->setEnabled( true ); + checkOrdered->setEnabled( false ); + } + else if ( radioApplication->isChecked() ) + { + TabBuild->setTabEnabled( custVarsTab, true ); + TabBuild->setTabEnabled( depTab, true ); + TabBuild->setTabEnabled( libAddTab, true ); + TabBuild->setTabEnabled( incaddTab, true ); + TabBuild->setTabEnabled( buildOptsTab, true ); + TabBuild->setTabEnabled( configTab, true ); + intDeps_view->setEnabled( true ); + intMoveUp_button->setEnabled( true ); + intMoveDown_button->setEnabled( true ); + extAdd_button->setEnabled( true ); + extRemove_button->setEnabled( true ); + extEdit_button->setEnabled( true ); + extMoveUp_button->setEnabled( true ); + extMoveDown_button->setEnabled( true ); + extDeps_view->setEnabled( true ); + buildorder_listview->setEnabled( false ); + buildmoveup_button->setEnabled( false ); + buildmovedown_button->setEnabled( false ); + groupLibraries->setEnabled( false ); + targetGroupbox->setEnabled( true ); + targetInstGroupbox->setEnabled( true ); + checkConsole->setEnabled( true ); + checkWindows->setEnabled( true ); + checkOrdered->setEnabled( false ); + } + activateApply( 0 ); +} + +void ProjectConfigurationDlg::groupRequirementsChanged( int ) +{ + if ( checkQt->isChecked() && prjWidget->m_part->isQt4Project() ) + { + groupQt4Libs->setEnabled( true ); + } + else + { + groupQt4Libs->setEnabled( false ); + } + activateApply( 0 ); +} + +void ProjectConfigurationDlg::targetInstallChanged( bool checked ) +{ + if ( checked ) + { + m_InstallTargetPath->setEnabled( true ); + } + else + { + m_InstallTargetPath->setEnabled( false ); + } + activateApply( 0 ); +} + +void ProjectConfigurationDlg::apply() +{ +// if( buttonApply->isEnabled() ) + if( !myProjectItem || !myProjectItem->scope ) + { + buttonApply->setEnabled( false ); + return; + } + updateProjectConfiguration(); + myProjectItem->scope->saveToFile(); + // prjWidget->updateProjectConfiguration( myProjectItem ); + prjWidget->setupContext(); + buttonApply->setEnabled( false ); +} + +void ProjectConfigurationDlg::activateApply( int ) +{ + buttonApply->setEnabled( true ); +} +void ProjectConfigurationDlg::activateApply( const QString& ) +{ + buttonApply->setEnabled( true ); +} + +void ProjectConfigurationDlg::activateApply( QListViewItem* ) +{ + buttonApply->setEnabled( true ); +} + +void ProjectConfigurationDlg::removeSharedLibDeps() +{ + QListViewItemIterator it(myProjectItem->listView()); + for( ; it.current() ; ++it ) + { + QMakeScopeItem* prjItem = static_cast<QMakeScopeItem*>( it.current() ); + if( prjItem == myProjectItem || !prjItem->isEnabled() ) + continue; + + QMap<QString, QString> infos = myProjectItem->getLibInfos(prjItem->scope->projectDir()); + + if( prjItem->scope->variableValues("LIBS").findIndex(infos["shared_lib"]) != -1 ) + prjItem->scope->removeFromPlusOp("LIBS", infos["shared_lib"]); + if( prjItem->scope->variableValues("LIBS").findIndex(infos["shared_libdir"]) != -1 ) + prjItem->scope->removeFromPlusOp("LIBS", infos["shared_libdir"]); + if( prjItem->scope->variableValues("TARGETDEPS").findIndex(infos["shared_depend"]) != -1 ) + { + prjItem->scope->removeFromPlusOp("TARGETDEPS", infos["shared_depend"]); + + prjItem->scope->saveToFile(); + } + } +} + +void ProjectConfigurationDlg::addStaticLibDeps() +{ + QListViewItemIterator it(myProjectItem->listView()); + for( ; it.current() ; ++it ) + { + QMakeScopeItem* prjItem = static_cast<QMakeScopeItem*>( it.current() ); + if( prjItem == myProjectItem || !prjItem->isEnabled() ) + continue; + + QMap<QString, QString> infos = myProjectItem->getLibInfos(prjItem->scope->projectDir()); + + if( prjItem->scope->variableValues("TARGETDEPS").findIndex(infos["app_depend"]) != -1 + || prjItem->scope->variableValues("TARGETDEPS").findIndex(infos["shared_depend"]) != -1 ) + { + prjItem->scope->addToPlusOp("LIBS", infos["static_lib"]); + prjItem->scope->addToPlusOp("TARGETDEPS", infos["static_depend"]); + prjItem->scope->saveToFile(); + } + } +} + +void ProjectConfigurationDlg::removeStaticLibDeps() +{ + QListViewItemIterator it(myProjectItem->listView()); + for( ; it.current() ; ++it ) + { + QMakeScopeItem* prjItem = static_cast<QMakeScopeItem*>( it.current() ); + if( prjItem == myProjectItem || !prjItem->isEnabled() ) + continue; + + + QMap<QString, QString> infos = myProjectItem->getLibInfos(prjItem->scope->projectDir()); + + if( prjItem->scope->variableValues("LIBS").findIndex(infos["static_lib"]) != -1 ) + prjItem->scope->removeFromPlusOp("LIBS", infos["static_lib"]); + if( prjItem->scope->variableValues("TARGETDEPS").findIndex(infos["static_depend"]) != -1 ) + { + prjItem->scope->removeFromPlusOp("TARGETDEPS", infos["static_depend"]); + prjItem->scope->saveToFile(); + } + } +} + +void ProjectConfigurationDlg::addSharedLibDeps() +{ + QListViewItemIterator it(myProjectItem->listView()); + for( ; it.current() ; ++it ) + { + QMakeScopeItem* prjItem = static_cast<QMakeScopeItem*>( it.current() ); + if( prjItem == myProjectItem || !prjItem->isEnabled() ) + continue; + + QMap<QString, QString> infos = myProjectItem->getLibInfos(prjItem->scope->projectDir()); + if( prjItem->scope->variableValues("TARGETDEPS").findIndex(infos["app_depend"]) != -1 + || prjItem->scope->variableValues("TARGETDEPS").findIndex(infos["static_depend"]) != -1 ) + { + prjItem->scope->addToPlusOp("LIBS", infos["shared_lib"]); + prjItem->scope->addToPlusOp("LIBS", infos["shared_libdir"]); + prjItem->scope->addToPlusOp("TARGETDEPS", infos["shared_depend"]); + prjItem->scope->saveToFile(); + } + } +} + +void ProjectConfigurationDlg::removeAppDeps() +{ + QListViewItemIterator it(myProjectItem->listView()); + for( ; it.current() ; ++it ) + { + QMakeScopeItem* prjItem = static_cast<QMakeScopeItem*>( it.current() ); + if( prjItem == myProjectItem || !prjItem->isEnabled() ) + continue; + + QMap<QString, QString> infos = myProjectItem->getLibInfos(prjItem->scope->projectDir()); + + if( prjItem->scope->variableValues("TARGETDEPS").findIndex(infos["app_depend"]) != -1 ) + { + prjItem->scope->removeFromPlusOp("TARGETDEPS", infos["app_depend"]); + prjItem->scope->saveToFile(); + } + } +} + +void ProjectConfigurationDlg::addAppDeps() +{ + QListViewItemIterator it(myProjectItem->listView()); + for( ; it.current() ; ++it ) + { + QMakeScopeItem* prjItem = static_cast<QMakeScopeItem*>( it.current() ); + if( prjItem == myProjectItem || !prjItem->isEnabled() ) + continue; + + QMap<QString, QString> infos = myProjectItem->getLibInfos(prjItem->scope->projectDir()); + + if( prjItem->scope->variableValues("TARGETDEPS").findIndex(infos["shared_depend"]) != -1 + || prjItem->scope->variableValues("TARGETDEPS").findIndex(infos["static_depend"]) != -1 ) + { + prjItem->scope->addToPlusOp("TARGETDEPS", infos["app_depend"]); + + prjItem->scope->saveToFile(); + } + } +} + +void ProjectConfigurationDlg::customVarChanged() +{ + QListViewItem * item = customVariables->currentItem(); + if ( item ) + { + item->setText( 0, customVariableName->text() ); + item->setText( 1, customVariableOp->currentText() ); + item->setText( 2, customVariableData->text() ); + } + activateApply( 0 ); +} + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/qmake/projectconfigurationdlg.h b/buildtools/qmake/projectconfigurationdlg.h new file mode 100644 index 00000000..246fb388 --- /dev/null +++ b/buildtools/qmake/projectconfigurationdlg.h @@ -0,0 +1,145 @@ +/*************************************************************************** +* Copyright (C) 2002 by Jakob Simon-Gaarde * +* jsgaarde@tdcspace.dk * +* Copyright (C) 2002-2003 by Alexander Dymo * +* cloudtemple@mksat.net * +* Copyright (C) 2003 by Thomas Hasart * +* thasart@gmx.de * +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef PROJECTCONFIGURATIONDLG_H +#define PROJECTCONFIGURATIONDLG_H + +#include "projectconfigurationdlgbase.h" +//#include "trollprojectwidget.h" +#include <kdeversion.h> +#include <qlistview.h> +#include <klistview.h> +#include <qmap.h> + +class QMakeScopeItem; +class KListViewItem; +class qProjectItem; +class ProjectConfigurationDlg; +class TrollProjectWidget; + +class InsideCheckListItem : public QCheckListItem +{ +public: + InsideCheckListItem( QListView *parent, QMakeScopeItem *item, ProjectConfigurationDlg *config ); + + InsideCheckListItem( QListView *parent, QListViewItem *after, QMakeScopeItem *item, ProjectConfigurationDlg *config ); + QMakeScopeItem *prjItem; + ProjectConfigurationDlg *m_config; + +protected: + virtual void stateChange ( bool state ); +}; + +class CustomVarListItem : public KListViewItem +{ + public: + CustomVarListItem( QListView*, unsigned int, QMap<QString, QString> ); + QString key(int column, bool ascending) const; + private: + unsigned int m_key; +}; + +class ProjectConfigurationDlg : public ProjectConfigurationDlgBase +{ +public: + ProjectConfigurationDlg( QListView *_prjList, TrollProjectWidget* _prjWidget, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~ProjectConfigurationDlg(); + void updateControls(); + void updateSubproject( QMakeScopeItem* _item ); + QMakeScopeItem* currentProjectItem() { return myProjectItem; } + +public slots: + // virtual void radioLibrarytoggled(bool); + virtual void updateProjectConfiguration(); + + virtual void buildorderMoveUpClicked(); + virtual void buildorderMoveDownClicked(); + + virtual void insideIncMoveUpClicked(); + virtual void insideIncMoveDownClicked(); + virtual void outsideIncMoveUpClicked(); + virtual void outsideIncMoveDownClicked(); + virtual void outsideIncAddClicked(); + virtual void outsideIncRemoveClicked(); + virtual void outsideIncEditClicked(); + + virtual void insideLibMoveUpClicked(); + virtual void insideLibMoveDownClicked(); + virtual void outsideLibMoveUpClicked(); + virtual void outsideLibMoveDownClicked(); + virtual void outsideLibAddClicked(); + virtual void outsideLibRemoveClicked(); + virtual void outsideLibEditClicked(); + + virtual void outsideLibDirMoveUpClicked(); + virtual void outsideLibDirMoveDownClicked(); + virtual void outsideLibDirAddClicked(); + virtual void outsideLibDirRemoveClicked(); + virtual void outsideLibDirEditClicked(); + + virtual void extAdd_button_clicked(); + virtual void extEdit_button_clicked(); + virtual void extMoveDown_button_clicked(); + virtual void extMoveUp_button_clicked(); + virtual void extRemove_button_clicked(); + virtual void intMoveDown_button_clicked(); + virtual void intMoveUp_button_clicked(); + + virtual void addCustomValueClicked(); + virtual void removeCustomValueClicked(); + virtual void upCustomValueClicked(); + virtual void downCustomValueClicked(); + + virtual void newCustomVariableActive(); + + virtual void groupLibrariesChanged( int ); + virtual void groupRequirementsChanged( int ); + virtual void groupTemplateChanged( int ); + virtual void targetInstallChanged( bool ); + virtual void accept(); + virtual void reject(); + virtual void apply(); + virtual void activateApply( int ); + virtual void activateApply( const QString& ); + + + void updateIncludeControl(); + void updateLibControls(); + void updateBuildOrderControl(); + void updateDependenciesControl(); + virtual void activateApply(QListViewItem*); + virtual void customVarChanged(); + +protected: + QListView *prjList; + QMakeScopeItem *myProjectItem; + QPtrList <QMakeScopeItem> getAllProjects(); + TrollProjectWidget* prjWidget; + void getAllSubProjects( QMakeScopeItem *item, QPtrList<QMakeScopeItem> *itemList ); + +private: + void removeSharedLibDeps(); + void removeStaticLibDeps(); + void addSharedLibDeps(); + void addStaticLibDeps(); + void removeAppDeps(); + void addAppDeps(); +}; + +#endif + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/qmake/projectconfigurationdlgbase.ui b/buildtools/qmake/projectconfigurationdlgbase.ui new file mode 100644 index 00000000..d447210d --- /dev/null +++ b/buildtools/qmake/projectconfigurationdlgbase.ui @@ -0,0 +1,2897 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>ProjectConfigurationDlgBase</class> +<author>Jakob Simon-Gaarde</author> +<widget class="QDialog"> + <property name="name"> + <cstring>ProjectConfigurationDlgBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>746</width> + <height>694</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="caption"> + <string>QMake Subproject Configuration</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton" row="1" column="3"> + <property name="name"> + <cstring>buttonCancel</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + </widget> + <widget class="KPushButton" row="1" column="1"> + <property name="name"> + <cstring>buttonOk</cstring> + </property> + <property name="text"> + <string>&OK</string> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <spacer row="1" column="0"> + <property name="name"> + <cstring>Spacer1_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>260</width> + <height>16</height> + </size> + </property> + </spacer> + <widget class="KPushButton" row="1" column="2"> + <property name="name"> + <cstring>buttonApply</cstring> + </property> + <property name="text"> + <string>&Apply</string> + </property> + </widget> + <widget class="QTabWidget" row="0" column="0" rowspan="1" colspan="4"> + <property name="name"> + <cstring>TabBuild</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>buildTab</cstring> + </property> + <attribute name="title"> + <string>Basics</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>groupTemplate</cstring> + </property> + <property name="title"> + <string>Template</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton" row="1" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>radioLibrary</cstring> + </property> + <property name="text"> + <string>Librar&y</string> + </property> + <property name="toolTip" stdset="0"> + <string>Create a library</string> + </property> + </widget> + <widget class="QRadioButton" row="2" column="0"> + <property name="name"> + <cstring>radioSubdirs</cstring> + </property> + <property name="text"> + <string>&Subdirectories</string> + </property> + <property name="toolTip" stdset="0"> + <string>This project holds subdirectories</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="1"> + <property name="name"> + <cstring>checkOrdered</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Ordered</string> + </property> + <property name="toolTip" stdset="0"> + <string>Build the subprojects in the order they are listed in the .pro file</string> + </property> + </widget> + <spacer row="2" column="2"> + <property name="name"> + <cstring>spacer15</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>101</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QRadioButton" row="0" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>radioApplication</cstring> + </property> + <property name="backgroundOrigin"> + <enum>WidgetOrigin</enum> + </property> + <property name="text"> + <string>A&pplication</string> + </property> + <property name="toolTip" stdset="0"> + <string>Create an application</string> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>targetGroupbox</cstring> + </property> + <property name="title"> + <string>Target</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel1_2</cstring> + </property> + <property name="text"> + <string>Path:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>m_targetPath</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>TextLabel2</cstring> + </property> + <property name="text"> + <string>Output file:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>m_targetOutputFile</cstring> + </property> + </widget> + <widget class="KLineEdit" row="1" column="1"> + <property name="name"> + <cstring>m_targetOutputFile</cstring> + </property> + </widget> + <widget class="KURLRequester" row="0" column="1"> + <property name="name"> + <cstring>m_targetPath</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>targetInstGroupbox</cstring> + </property> + <property name="title"> + <string>Target Installation</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KLineEdit" row="0" column="2"> + <property name="name"> + <cstring>m_InstallTargetPath</cstring> + </property> + </widget> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>checkInstallTarget</cstring> + </property> + <property name="text"> + <string>I&nstall</string> + </property> + </widget> + <widget class="QLabel" row="0" column="1"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string>Installation path:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>m_InstallTargetPath</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox6</cstring> + </property> + <property name="title"> + <string>Makefile</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KURLRequester" row="0" column="0"> + <property name="name"> + <cstring>makefile_url</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>argumentsGroupBox</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="title"> + <string>Arguments</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1_6</cstring> + </property> + <property name="text"> + <string>Run arguments:</string> + </property> + </widget> + <widget class="KLineEdit" row="0" column="1"> + <property name="name"> + <cstring>m_editRunArguments</cstring> + </property> + </widget> + <widget class="KLineEdit" row="1" column="1"> + <property name="name"> + <cstring>m_editDebugArguments</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel2_2</cstring> + </property> + <property name="text"> + <string>Debug Arguments:</string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel2_2_2</cstring> + </property> + <property name="text"> + <string>Working Directory:</string> + </property> + </widget> + <widget class="KURLRequester" row="2" column="1"> + <property name="name"> + <cstring>m_CWDEdit</cstring> + </property> + </widget> + </grid> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>120</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>configTab</cstring> + </property> + <attribute name="title"> + <string>Configuration</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>groupBuildMode</cstring> + </property> + <property name="title"> + <string>Build Mode</string> + </property> + <property name="selectedId" stdset="0"> + <number>-1</number> + </property> + <property name="toolTip" stdset="0"> + <string>Set project to be built in release mode</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout147</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>radioDebugMode</cstring> + </property> + <property name="text"> + <string>Debug</string> + </property> + <property name="toolTip" stdset="0"> + <string>Set project to be built in debug mode</string> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>radioReleaseMode</cstring> + </property> + <property name="text"> + <string>Release</string> + </property> + <property name="toolTip" stdset="0"> + <string>Set project to be built in release mode</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>checkDebugReleaseMode</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Debug && Release</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="toolTip" stdset="0"> + <string>Set project to be built in debug_and_release mode</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout30</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>checkWarning</cstring> + </property> + <property name="text"> + <string>Enable warnings</string> + </property> + <property name="toolTip" stdset="0"> + <string>Show compiler warnings</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>checkBuildAll</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Build All</string> + </property> + <property name="toolTip" stdset="0"> + <string>Builds Debug and Release version if Debug&Release is configured</string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>groupRequirements</cstring> + </property> + <property name="title"> + <string>Requirements</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="1" column="0"> + <property name="name"> + <cstring>checkOpenGL</cstring> + </property> + <property name="text"> + <string>OpenGL</string> + </property> + <property name="toolTip" stdset="0"> + <string>Requires the OpenGL (or Mesa) headers/libraries</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="0"> + <property name="name"> + <cstring>stlCheck</cstring> + </property> + <property name="text"> + <string>STL</string> + </property> + </widget> + <widget class="QCheckBox" row="0" column="1"> + <property name="name"> + <cstring>checkThread</cstring> + </property> + <property name="text"> + <string>Thread</string> + </property> + <property name="toolTip" stdset="0"> + <string>Requires support for multi-threaded application or library.</string> + </property> + </widget> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>checkQt</cstring> + </property> + <property name="text"> + <string>Qt</string> + </property> + <property name="toolTip" stdset="0"> + <string>Requires the Qt header files/library</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="1"> + <property name="name"> + <cstring>checkX11</cstring> + </property> + <property name="text"> + <string>X11</string> + </property> + <property name="toolTip" stdset="0"> + <string>Support required for X11 application or library</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="2"> + <property name="name"> + <cstring>checkPCH</cstring> + </property> + <property name="text"> + <string>Precompiled headers</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="1"> + <property name="name"> + <cstring>rttiCheck</cstring> + </property> + <property name="text"> + <string>RTTI</string> + </property> + </widget> + <widget class="QCheckBox" row="3" column="0"> + <property name="name"> + <cstring>checkWindows</cstring> + </property> + <property name="text"> + <string>Windows</string> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>textLabel1_4</cstring> + </property> + <property name="text"> + <string>Custom Configuration</string> + </property> + </widget> + <widget class="QCheckBox" row="0" column="2"> + <property name="name"> + <cstring>exceptionCheck</cstring> + </property> + <property name="text"> + <string>Exceptions </string> + </property> + </widget> + <widget class="KLineEdit" row="4" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>editConfigExtra</cstring> + </property> + </widget> + <widget class="QCheckBox" row="1" column="2"> + <property name="name"> + <cstring>checkConsole</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Console</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="toolTip" stdset="0"> + <string>Check to build a win32 console app</string> + </property> + </widget> + </grid> + </widget> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>groupQt4Libs</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="title"> + <string>Qt4 Libraries</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="1" column="0"> + <property name="name"> + <cstring>checkQt4Gui</cstring> + </property> + <property name="text"> + <string>Gui</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QCheckBox" row="2" column="0"> + <property name="name"> + <cstring>checkQt4XML</cstring> + </property> + <property name="text"> + <string>XML</string> + </property> + </widget> + <widget class="QCheckBox" row="3" column="0"> + <property name="name"> + <cstring>checkQt4Network</cstring> + </property> + <property name="text"> + <string>Network</string> + </property> + </widget> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>checkQt4Core</cstring> + </property> + <property name="text"> + <string>Core</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QCheckBox" row="0" column="1"> + <property name="name"> + <cstring>checkQt4OpenGL</cstring> + </property> + <property name="text"> + <string>OpenGL</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="1"> + <property name="name"> + <cstring>checkUiTools</cstring> + </property> + <property name="text"> + <string>QtUiTools</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="1"> + <property name="name"> + <cstring>checkQt4SQL</cstring> + </property> + <property name="text"> + <string>SQL</string> + </property> + </widget> + <widget class="QCheckBox" row="3" column="1"> + <property name="name"> + <cstring>checkQt4SVG</cstring> + </property> + <property name="text"> + <string>SVG</string> + </property> + </widget> + <widget class="QCheckBox" row="0" column="2"> + <property name="name"> + <cstring>checkTestlib</cstring> + </property> + <property name="text"> + <string>QtTest</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="2"> + <property name="name"> + <cstring>checkQt3Support</cstring> + </property> + <property name="text"> + <string>Qt3 Support</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="2"> + <property name="name"> + <cstring>checkQDBus</cstring> + </property> + <property name="text"> + <string>QDBus (Qt4.2)</string> + </property> + </widget> + <widget class="QCheckBox" row="3" column="2"> + <property name="name"> + <cstring>checkAssistant</cstring> + </property> + <property name="text"> + <string>QtAssistant</string> + </property> + </widget> + <widget class="QCheckBox" row="0" column="3"> + <property name="name"> + <cstring>checkQtScript</cstring> + </property> + <property name="text"> + <string>QtScript (Qt4.3)</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="3"> + <property name="name"> + <cstring>checkQtWebKit</cstring> + </property> + <property name="text"> + <string>QtWebKit (Qt4.4)</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="3"> + <property name="name"> + <cstring>checkQtXmlPatterns</cstring> + </property> + <property name="text"> + <string>QtXmlPatterns (Qt4.4)</string> + </property> + </widget> + <widget class="QCheckBox" row="3" column="3"> + <property name="name"> + <cstring>checkPhonon</cstring> + </property> + <property name="text"> + <string>Phonon (Qt4.4)</string> + </property> + </widget> + <widget class="QCheckBox" row="0" column="4"> + <property name="name"> + <cstring>checkQtHelp</cstring> + </property> + <property name="text"> + <string>QtHelp (Qt4.4)</string> + </property> + </widget> + </grid> + </widget> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>groupLibraries</cstring> + </property> + <property name="title"> + <string>Library Options</string> + </property> + <property name="exclusive"> + <bool>false</bool> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout69</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>staticRadio</cstring> + </property> + <property name="text"> + <string>Build as static library</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>checkPlugin</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Plugin</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>checkLibtool</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Make libtool archive</string> + </property> + <property name="toolTip" stdset="0"> + <string>Support required for X11 application or library</string> + </property> + </widget> + </vbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer34</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>41</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout68</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>sharedRadio</cstring> + </property> + <property name="text"> + <string>Build as shared library</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>checkDesigner</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Designer Plugin</string> + </property> + <property name="accel"> + <string></string> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout67</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>Library version:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>m_targetLibraryVersion</cstring> + </property> + </widget> + <widget class="KLineEdit"> + <property name="name"> + <cstring>m_targetLibraryVersion</cstring> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>16</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>incaddTab</cstring> + </property> + <attribute name="title"> + <string>Includes</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="1" column="1"> + <property name="name"> + <cstring>Layout9</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>insideIncMoveUpBtn</cstring> + </property> + <property name="text"> + <string>Move Up</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>insideIncMoveDownBtn</cstring> + </property> + <property name="text"> + <string>Move Down</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer3_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QListView" row="3" column="0"> + <column> + <property name="text"> + <string>Directories Outside Project</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>outsideinc_listview</cstring> + </property> + <property name="resizeMode"> + <enum>LastColumn</enum> + </property> + </widget> + <widget class="QListView" row="1" column="0"> + <column> + <property name="text"> + <string>Directories Inside Project</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>insideinc_listview</cstring> + </property> + <property name="resizeMode"> + <enum>LastColumn</enum> + </property> + </widget> + <widget class="QLayoutWidget" row="3" column="1"> + <property name="name"> + <cstring>layout8</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>outsideIncAddBtn</cstring> + </property> + <property name="text"> + <string>Add...</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>outsideIncRemoveBtn</cstring> + </property> + <property name="text"> + <string>Remove</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>outsideIncEditBtn</cstring> + </property> + <property name="text"> + <string>Edit</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>outsideIncMoveUpBtn</cstring> + </property> + <property name="text"> + <string>Move Up</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>outsideIncMoveDownBtn</cstring> + </property> + <property name="text"> + <string>Move Down</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer2_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>70</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>libAddTab</cstring> + </property> + <attribute name="title"> + <string>Libraries</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="1" column="0"> + <property name="name"> + <cstring>layout12</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QListView"> + <column> + <property name="text"> + <string>External Library Dirs</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>outsidelibdir_listview</cstring> + </property> + <property name="resizeMode"> + <enum>LastColumn</enum> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout10</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>outsideLibDirAddBtn</cstring> + </property> + <property name="text"> + <string>Add...</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>outsideLibDirRemoveBtn</cstring> + </property> + <property name="text"> + <string>Remove</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>outsideLibDirEditBtn</cstring> + </property> + <property name="text"> + <string>Edit</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>outsideLibDirMoveUpBtn</cstring> + </property> + <property name="text"> + <string>Move Up</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>outsideLibDirMoveDownBtn</cstring> + </property> + <property name="text"> + <string>Move Down</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer2_2_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>70</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="1" column="1"> + <property name="name"> + <cstring>layout11</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QListView"> + <column> + <property name="text"> + <string>External Libraries</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>outsidelib_listview</cstring> + </property> + <property name="resizeMode"> + <enum>LastColumn</enum> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout9</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>outsideLibAddBtn</cstring> + </property> + <property name="text"> + <string>Add...</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>outsideLibRemoveBtn</cstring> + </property> + <property name="text"> + <string>Remove</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>outsideLibEditBtn</cstring> + </property> + <property name="text"> + <string>Edit</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>outsideLibMoveUpBtn</cstring> + </property> + <property name="text"> + <string>Move Up</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>outsideLibMoveDownBtn</cstring> + </property> + <property name="text"> + <string>Move Down</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer8_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>64</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout10</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QListView"> + <column> + <property name="text"> + <string>Link Convenience Libraries Inside Project</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>insidelib_listview</cstring> + </property> + <property name="resizeMode"> + <enum>LastColumn</enum> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout9_3</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>insideLibMoveUpBtn</cstring> + </property> + <property name="text"> + <string>Move Up</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>insideLibMoveDownBtn</cstring> + </property> + <property name="text"> + <string>Move Down</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer6_2_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </hbox> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>depTab</cstring> + </property> + <attribute name="title"> + <string>Dependencies</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout26</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QListView"> + <column> + <property name="text"> + <string>Targets in Project</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>intDeps_view</cstring> + </property> + <property name="resizeMode"> + <enum>LastColumn</enum> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout9_3_2</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>intMoveUp_button</cstring> + </property> + <property name="text"> + <string>Move Up</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>intMoveDown_button</cstring> + </property> + <property name="text"> + <string>Move Down</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer6_2_2_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout27</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QListView"> + <column> + <property name="text"> + <string>Miscellaneous Targets</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>extDeps_view</cstring> + </property> + <property name="resizeMode"> + <enum>LastColumn</enum> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout9_2</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>extAdd_button</cstring> + </property> + <property name="text"> + <string>Add...</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>extRemove_button</cstring> + </property> + <property name="text"> + <string>Remove</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>extEdit_button</cstring> + </property> + <property name="text"> + <string>Edit</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>extMoveUp_button</cstring> + </property> + <property name="text"> + <string>Move Up</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>extMoveDown_button</cstring> + </property> + <property name="text"> + <string>Move Down</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer8_2_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>64</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout28_2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QListView"> + <column> + <property name="text"> + <string>Order in Which Sub Projects Are Built</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>buildorder_listview</cstring> + </property> + <property name="resizeMode"> + <enum>LastColumn</enum> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout9_2</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>buildmoveup_button</cstring> + </property> + <property name="text"> + <string>Move Up</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>buildmovedown_button</cstring> + </property> + <property name="text"> + <string>Move Down</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer3_2_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </hbox> + </widget> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>buildOptsTab</cstring> + </property> + <attribute name="title"> + <string>Build Options</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Compiler Options</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>layout26</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout23</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel2_2</cstring> + </property> + <property name="text"> + <string>Debug flags:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>m_debugFlags</cstring> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel2_2_2</cstring> + </property> + <property name="text"> + <string>Release flags:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>m_releaseFlags</cstring> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>Defines:</string> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout24</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KLineEdit"> + <property name="name"> + <cstring>m_debugFlags</cstring> + </property> + </widget> + <widget class="KLineEdit"> + <property name="name"> + <cstring>m_releaseFlags</cstring> + </property> + </widget> + <widget class="KLineEdit"> + <property name="name"> + <cstring>m_defines</cstring> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + </grid> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox8</cstring> + </property> + <property name="title"> + <string>Intermediate File Directories</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout84</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>mocdir_label</cstring> + </property> + <property name="text"> + <string>MOC files:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>mocdir_url</cstring> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>uidir_label</cstring> + </property> + <property name="text"> + <string>UI files:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>uidir_url</cstring> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>objdir_label</cstring> + </property> + <property name="text"> + <string>Object files:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>objdir_url</cstring> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>rccdir_label</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>RCC files:</string> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout85</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KURLRequester"> + <property name="name"> + <cstring>mocdir_url</cstring> + </property> + </widget> + <widget class="KURLRequester"> + <property name="name"> + <cstring>uidir_url</cstring> + </property> + </widget> + <widget class="KURLRequester"> + <property name="name"> + <cstring>objdir_url</cstring> + </property> + </widget> + <widget class="KURLRequester"> + <property name="name"> + <cstring>rccdir_url</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>idlGroup</cstring> + </property> + <property name="title"> + <string>Corba</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>TextLabel2_3</cstring> + </property> + <property name="text"> + <string>Compiler options:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>idlCmdOptionsEdit</cstring> + </property> + </widget> + <widget class="KLineEdit" row="1" column="1"> + <property name="name"> + <cstring>idlCmdOptionsEdit</cstring> + </property> + </widget> + <widget class="KURLRequester" row="0" column="1"> + <property name="name"> + <cstring>idlCmdEdit</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel1_2_2</cstring> + </property> + <property name="text"> + <string>IDL compiler:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>idlCmdEdit</cstring> + </property> + </widget> + </grid> + </widget> + <spacer> + <property name="name"> + <cstring>spacer29</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>21</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>custVarsTab</cstring> + </property> + <attribute name="title"> + <string>Custom Variables</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout24</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KListView"> + <column> + <property name="text"> + <string>Name</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Operator</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Value</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>customVariables</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>6</verstretch> + </sizepolicy> + </property> + <property name="allColumnsShowFocus"> + <bool>true</bool> + </property> + <property name="defaultRenameAction"> + <enum>Accept</enum> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout23</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout22</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>varAdd_button</cstring> + </property> + <property name="text"> + <string>New</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>varRemove_button</cstring> + </property> + <property name="text"> + <string>Remove</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>varMoveUp_button</cstring> + </property> + <property name="text"> + <string>Move Up</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>varMoveDown_button</cstring> + </property> + <property name="text"> + <string>Move Down</string> + </property> + </widget> + </vbox> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer8_2_2_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>106</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout33</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_3</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Name:</string> + </property> + </widget> + <widget class="KLineEdit"> + <property name="name"> + <cstring>customVariableName</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>3</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout32</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_5</cstring> + </property> + <property name="text"> + <string>Operator</string> + </property> + </widget> + <widget class="KComboBox"> + <item> + <property name="text"> + <string>+=</string> + </property> + </item> + <item> + <property name="text"> + <string>-=</string> + </property> + </item> + <item> + <property name="text"> + <string>=</string> + </property> + </item> + <item> + <property name="text"> + <string>*=</string> + </property> + </item> + <item> + <property name="text"> + <string>~=</string> + </property> + </item> + <property name="name"> + <cstring>customVariableOp</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="currentItem"> + <number>0</number> + </property> + <property name="duplicatesEnabled"> + <bool>false</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer17</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>250</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout34</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Value:</string> + </property> + <property name="alignment"> + <set>AlignTop</set> + </property> + </widget> + <widget class="KTextEdit"> + <property name="name"> + <cstring>customVariableData</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>2</verstretch> + </sizepolicy> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + </widget> + </grid> +</widget> +<connections> + <connection> + <sender>buttonOk</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>idlCmdEdit</sender> + <signal>textChanged(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>idlCmdEdit</sender> + <signal>urlSelected(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>idlCmdOptionsEdit</sender> + <signal>textChanged(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>makefile_url</sender> + <signal>textChanged(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>makefile_url</sender> + <signal>urlSelected(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>m_debugFlags</sender> + <signal>textChanged(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>m_defines</sender> + <signal>textChanged(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>m_InstallTargetPath</sender> + <signal>textChanged(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>mocdir_url</sender> + <signal>textChanged(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>mocdir_url</sender> + <signal>urlSelected(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>m_releaseFlags</sender> + <signal>textChanged(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>m_targetLibraryVersion</sender> + <signal>textChanged(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>m_targetOutputFile</sender> + <signal>textChanged(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>objdir_url</sender> + <signal>urlSelected(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>objdir_url</sender> + <signal>textChanged(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>rccdir_url</sender> + <signal>textChanged(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>rccdir_url</sender> + <signal>urlSelected(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>uidir_url</sender> + <signal>urlSelected(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>editConfigExtra</sender> + <signal>textChanged(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>m_editRunArguments</sender> + <signal>textChanged(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>m_editDebugArguments</sender> + <signal>textChanged(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>groupBuildMode</sender> + <signal>clicked(int)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(int)</slot> + </connection> + <connection> + <sender>groupQt4Libs</sender> + <signal>clicked(int)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(int)</slot> + </connection> + <connection> + <sender>insideinc_listview</sender> + <signal>clicked(QListViewItem*)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(QListViewItem*)</slot> + </connection> + <connection> + <sender>insideinc_listview</sender> + <signal>spacePressed(QListViewItem*)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(QListViewItem*)</slot> + </connection> + <connection> + <sender>insidelib_listview</sender> + <signal>clicked(QListViewItem*)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(QListViewItem*)</slot> + </connection> + <connection> + <sender>insidelib_listview</sender> + <signal>spacePressed(QListViewItem*)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(QListViewItem*)</slot> + </connection> + <connection> + <sender>intDeps_view</sender> + <signal>clicked(QListViewItem*)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(QListViewItem*)</slot> + </connection> + <connection> + <sender>intDeps_view</sender> + <signal>spacePressed(QListViewItem*)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(QListViewItem*)</slot> + </connection> + <connection> + <sender>varAdd_button</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>addCustomValueClicked()</slot> + </connection> + <connection> + <sender>buttonApply</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>apply()</slot> + </connection> + <connection> + <sender>buildmovedown_button</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>buildorderMoveDownClicked()</slot> + </connection> + <connection> + <sender>buildmoveup_button</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>buildorderMoveUpClicked()</slot> + </connection> + <connection> + <sender>customVariableName</sender> + <signal>textChanged(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>customVarChanged()</slot> + </connection> + <connection> + <sender>customVariableOp</sender> + <signal>activated(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>customVarChanged()</slot> + </connection> + <connection> + <sender>customVariableData</sender> + <signal>textChanged()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>customVarChanged()</slot> + </connection> + <connection> + <sender>varMoveUp_button</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>downCustomValueClicked()</slot> + </connection> + <connection> + <sender>extAdd_button</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>extAdd_button_clicked()</slot> + </connection> + <connection> + <sender>extEdit_button</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>extEdit_button_clicked()</slot> + </connection> + <connection> + <sender>extMoveDown_button</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>extMoveDown_button_clicked()</slot> + </connection> + <connection> + <sender>extMoveUp_button</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>extMoveUp_button_clicked()</slot> + </connection> + <connection> + <sender>extRemove_button</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>extRemove_button_clicked()</slot> + </connection> + <connection> + <sender>groupLibraries</sender> + <signal>clicked(int)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>groupLibrariesChanged(int)</slot> + </connection> + <connection> + <sender>groupRequirements</sender> + <signal>clicked(int)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>groupRequirementsChanged(int)</slot> + </connection> + <connection> + <sender>groupTemplate</sender> + <signal>clicked(int)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>groupTemplateChanged(int)</slot> + </connection> + <connection> + <sender>insideIncMoveDownBtn</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>insideIncMoveDownClicked()</slot> + </connection> + <connection> + <sender>insideIncMoveUpBtn</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>insideIncMoveUpClicked()</slot> + </connection> + <connection> + <sender>insideLibMoveDownBtn</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>insideLibMoveDownClicked()</slot> + </connection> + <connection> + <sender>insideLibMoveUpBtn</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>insideLibMoveUpClicked()</slot> + </connection> + <connection> + <sender>intMoveDown_button</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>intMoveDown_button_clicked()</slot> + </connection> + <connection> + <sender>intMoveUp_button</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>intMoveUp_button_clicked()</slot> + </connection> + <connection> + <sender>customVariables</sender> + <signal>selectionChanged()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>newCustomVariableActive()</slot> + </connection> + <connection> + <sender>outsideIncAddBtn</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>outsideIncAddClicked()</slot> + </connection> + <connection> + <sender>outsideIncEditBtn</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>outsideIncEditClicked()</slot> + </connection> + <connection> + <sender>outsideIncMoveDownBtn</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>outsideIncMoveDownClicked()</slot> + </connection> + <connection> + <sender>outsideIncMoveUpBtn</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>outsideIncMoveUpClicked()</slot> + </connection> + <connection> + <sender>outsideIncRemoveBtn</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>outsideIncRemoveClicked()</slot> + </connection> + <connection> + <sender>outsideLibAddBtn</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>outsideLibAddClicked()</slot> + </connection> + <connection> + <sender>outsideLibDirAddBtn</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>outsideLibDirAddClicked()</slot> + </connection> + <connection> + <sender>outsideLibDirEditBtn</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>outsideLibDirEditClicked()</slot> + </connection> + <connection> + <sender>outsideLibDirMoveDownBtn</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>outsideLibDirMoveDownClicked()</slot> + </connection> + <connection> + <sender>outsideLibDirMoveUpBtn</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>outsideLibDirMoveUpClicked()</slot> + </connection> + <connection> + <sender>outsideLibDirRemoveBtn</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>outsideLibDirRemoveClicked()</slot> + </connection> + <connection> + <sender>outsideLibEditBtn</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>outsideLibEditClicked()</slot> + </connection> + <connection> + <sender>outsideLibMoveDownBtn</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>outsideLibMoveDownClicked()</slot> + </connection> + <connection> + <sender>outsideLibMoveUpBtn</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>outsideLibMoveUpClicked()</slot> + </connection> + <connection> + <sender>outsideLibRemoveBtn</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>outsideLibRemoveClicked()</slot> + </connection> + <connection> + <sender>buttonCancel</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>reject()</slot> + </connection> + <connection> + <sender>varRemove_button</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>removeCustomValueClicked()</slot> + </connection> + <connection> + <sender>checkOrdered</sender> + <signal>toggled(bool)</signal> + <receiver>buildmovedown_button</receiver> + <slot>setDisabled(bool)</slot> + </connection> + <connection> + <sender>checkOrdered</sender> + <signal>toggled(bool)</signal> + <receiver>buildmoveup_button</receiver> + <slot>setDisabled(bool)</slot> + </connection> + <connection> + <sender>checkOrdered</sender> + <signal>toggled(bool)</signal> + <receiver>buildorder_listview</receiver> + <slot>setDisabled(bool)</slot> + </connection> + <connection> + <sender>radioApplication</sender> + <signal>toggled(bool)</signal> + <receiver>argumentsGroupBox</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>checkInstallTarget</sender> + <signal>toggled(bool)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>targetInstallChanged(bool)</slot> + </connection> + <connection> + <sender>varMoveDown_button</sender> + <signal>clicked()</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>upCustomValueClicked()</slot> + </connection> + <connection> + <sender>m_targetPath</sender> + <signal>textChanged(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>m_targetPath</sender> + <signal>returnPressed(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>m_targetPath</sender> + <signal>urlSelected(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>uidir_url</sender> + <signal>textChanged(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>m_CWDEdit</sender> + <signal>textChanged(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> + <connection> + <sender>m_CWDEdit</sender> + <signal>urlSelected(const QString&)</signal> + <receiver>ProjectConfigurationDlgBase</receiver> + <slot>activateApply(const QString&)</slot> + </connection> +</connections> +<tabstops> + <tabstop>TabBuild</tabstop> + <tabstop>radioApplication</tabstop> + <tabstop>radioLibrary</tabstop> + <tabstop>radioSubdirs</tabstop> + <tabstop>checkOrdered</tabstop> + <tabstop>m_targetOutputFile</tabstop> + <tabstop>checkInstallTarget</tabstop> + <tabstop>m_InstallTargetPath</tabstop> + <tabstop>makefile_url</tabstop> + <tabstop>radioDebugMode</tabstop> + <tabstop>radioReleaseMode</tabstop> + <tabstop>checkDebugReleaseMode</tabstop> + <tabstop>checkWarning</tabstop> + <tabstop>checkBuildAll</tabstop> + <tabstop>checkQt</tabstop> + <tabstop>checkOpenGL</tabstop> + <tabstop>stlCheck</tabstop> + <tabstop>checkWindows</tabstop> + <tabstop>checkThread</tabstop> + <tabstop>checkX11</tabstop> + <tabstop>rttiCheck</tabstop> + <tabstop>exceptionCheck</tabstop> + <tabstop>checkConsole</tabstop> + <tabstop>checkPCH</tabstop> + <tabstop>editConfigExtra</tabstop> + <tabstop>checkQt4Core</tabstop> + <tabstop>checkQt4Gui</tabstop> + <tabstop>checkQt4XML</tabstop> + <tabstop>checkQt4Network</tabstop> + <tabstop>checkQt4OpenGL</tabstop> + <tabstop>checkUiTools</tabstop> + <tabstop>checkQt4SQL</tabstop> + <tabstop>checkQt4SVG</tabstop> + <tabstop>checkTestlib</tabstop> + <tabstop>checkQt3Support</tabstop> + <tabstop>checkQDBus</tabstop> + <tabstop>checkAssistant</tabstop> + <tabstop>checkQtScript</tabstop> + <tabstop>checkQtWebKit</tabstop> + <tabstop>checkQtXmlPatterns</tabstop> + <tabstop>checkPhonon</tabstop> + <tabstop>checkQtHelp</tabstop> + <tabstop>staticRadio</tabstop> + <tabstop>checkPlugin</tabstop> + <tabstop>checkLibtool</tabstop> + <tabstop>sharedRadio</tabstop> + <tabstop>checkDesigner</tabstop> + <tabstop>m_targetLibraryVersion</tabstop> + <tabstop>insideinc_listview</tabstop> + <tabstop>insideIncMoveUpBtn</tabstop> + <tabstop>insideIncMoveDownBtn</tabstop> + <tabstop>outsideinc_listview</tabstop> + <tabstop>outsideIncAddBtn</tabstop> + <tabstop>outsideIncRemoveBtn</tabstop> + <tabstop>outsideIncEditBtn</tabstop> + <tabstop>outsideIncMoveUpBtn</tabstop> + <tabstop>outsideIncMoveDownBtn</tabstop> + <tabstop>insidelib_listview</tabstop> + <tabstop>insideLibMoveUpBtn</tabstop> + <tabstop>insideLibMoveDownBtn</tabstop> + <tabstop>outsidelibdir_listview</tabstop> + <tabstop>outsideLibDirAddBtn</tabstop> + <tabstop>outsideLibDirRemoveBtn</tabstop> + <tabstop>outsideLibDirEditBtn</tabstop> + <tabstop>outsideLibDirMoveUpBtn</tabstop> + <tabstop>outsideLibDirMoveDownBtn</tabstop> + <tabstop>outsidelib_listview</tabstop> + <tabstop>outsideLibAddBtn</tabstop> + <tabstop>outsideLibRemoveBtn</tabstop> + <tabstop>outsideLibEditBtn</tabstop> + <tabstop>outsideLibMoveUpBtn</tabstop> + <tabstop>outsideLibMoveDownBtn</tabstop> + <tabstop>intDeps_view</tabstop> + <tabstop>intMoveUp_button</tabstop> + <tabstop>intMoveDown_button</tabstop> + <tabstop>extDeps_view</tabstop> + <tabstop>extAdd_button</tabstop> + <tabstop>extRemove_button</tabstop> + <tabstop>extEdit_button</tabstop> + <tabstop>extMoveUp_button</tabstop> + <tabstop>extMoveDown_button</tabstop> + <tabstop>buildorder_listview</tabstop> + <tabstop>buildmoveup_button</tabstop> + <tabstop>buildmovedown_button</tabstop> + <tabstop>m_debugFlags</tabstop> + <tabstop>m_releaseFlags</tabstop> + <tabstop>m_defines</tabstop> + <tabstop>mocdir_url</tabstop> + <tabstop>uidir_url</tabstop> + <tabstop>objdir_url</tabstop> + <tabstop>rccdir_url</tabstop> + <tabstop>idlCmdEdit</tabstop> + <tabstop>idlCmdOptionsEdit</tabstop> + <tabstop>customVariables</tabstop> + <tabstop>varAdd_button</tabstop> + <tabstop>varRemove_button</tabstop> + <tabstop>varMoveUp_button</tabstop> + <tabstop>varMoveDown_button</tabstop> + <tabstop>customVariableName</tabstop> + <tabstop>customVariableOp</tabstop> + <tabstop>customVariableData</tabstop> + <tabstop>buttonOk</tabstop> + <tabstop>buttonApply</tabstop> + <tabstop>buttonCancel</tabstop> +</tabstops> +<includes> + <include location="global" impldecl="in implementation">klineedit.h</include> + <include location="global" impldecl="in implementation">kdialog.h</include> + <include location="global" impldecl="in implementation">kpushbutton.h</include> +</includes> +<slots> + <slot>updateProjectConfiguration()</slot> + <slot>buildorderMoveUpClicked()</slot> + <slot>buildorderMoveDownClicked()</slot> + <slot>outsideIncMoveUpClicked()</slot> + <slot>outsideIncMoveDownClicked()</slot> + <slot>insideIncMoveUpClicked()</slot> + <slot>insideIncMoveDownClicked()</slot> + <slot>outsideLibMoveUpClicked()</slot> + <slot>outsideLibMoveDownClicked()</slot> + <slot>insideLibMoveUpClicked()</slot> + <slot>insideLibMoveDownClicked()</slot> + <slot>outsideIncAddClicked()</slot> + <slot>outsideIncRemoveClicked()</slot> + <slot>outsideLibAddClicked()</slot> + <slot>outsideLibRemoveClicked()</slot> + <slot>outsideLibDirMoveDownClicked()</slot> + <slot>outsideLibDirMoveUpClicked()</slot> + <slot>outsideLibDirAddClicked()</slot> + <slot>outsideLibDirRemoveClicked()</slot> + <slot>outsideLibDirEditClicked()</slot> + <slot>outsideLibEditClicked()</slot> + <slot>outsideIncEditClicked()</slot> + <slot>intMoveUp_button_clicked()</slot> + <slot>intMoveDown_button_clicked()</slot> + <slot>extAdd_button_clicked()</slot> + <slot>extRemove_button_clicked()</slot> + <slot>extEdit_button_clicked()</slot> + <slot>extMoveUp_button_clicked()</slot> + <slot>extMoveDown_button_clicked()</slot> + <slot>removeCustomValueClicked()</slot> + <slot>upCustomValueClicked()</slot> + <slot>downCustomValueClicked()</slot> + <slot>newCustomVariableActive()</slot> + <slot>addCustomValueClicked()</slot> + <slot>groupRequirementsChanged( int )</slot> + <slot>groupLibrariesChanged( int )</slot> + <slot>groupTemplateChanged( int )</slot> + <slot>targetInstallChanged( bool )</slot> + <slot>apply()</slot> + <slot>activateApply( int )</slot> + <slot>activateApply( const QString & )</slot> + <slot>activateApply( QListViewItem * )</slot> + <slot>customVarChanged()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +<includehints> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kurlrequester.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kurlrequester.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kurlrequester.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kurlrequester.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kurlrequester.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kurlrequester.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kurlrequester.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kurlrequester.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>klistview.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kcombobox.h</includehint> + <includehint>ktextedit.h</includehint> +</includehints> +</UI> diff --git a/buildtools/qmake/qmakedefaultopts.cpp b/buildtools/qmake/qmakedefaultopts.cpp new file mode 100644 index 00000000..14ca7aa0 --- /dev/null +++ b/buildtools/qmake/qmakedefaultopts.cpp @@ -0,0 +1,91 @@ +/*************************************************************************** +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#include "qmakedefaultopts.h" + +#include <kdebug.h> +#include <ktempfile.h> +#include <qregexp.h> +#include <kprocess.h> + +#include <blockingkprocess.h> + +QMakeDefaultOpts::QMakeDefaultOpts() +{ + +} + +void QMakeDefaultOpts::readVariables( const QString& qmake, const QString& projdir ) +{ + KTempFile makefile (projdir+"/", ".mf"); + KTempFile qmakefile(projdir+"/", ".pro"); + if ( makefile.status() == 0 && qmakefile.status() == 0 ) + { + makefile.close(); + qmakefile.close(); + + BlockingKProcess proc; + kdDebug(9024) << "KProc Working dir:" << projdir << endl; + proc.setWorkingDirectory( projdir ); + proc << qmake; + proc << "-d"; + proc << "-o"; + proc << makefile.name(); + proc << qmakefile.name(); + kdDebug(9024) << "Executing:" << proc.args() << endl; + proc.start( KProcess::NotifyOnExit, KProcess::Stderr ); + if( !proc.isRunning() && !proc.normalExit() ) + { + kdDebug(9024) << "Couldn't execute qmake: " << proc.args() << endl; + makefile.unlink(); + qmakefile.unlink(); + m_variables.clear(); + m_keys.clear(); + }else + { + makefile.unlink(); + qmakefile.unlink(); + QStringList lines = QStringList::split( "\n", proc.stdErr() ); + kdDebug(9024) << "Got " << lines.count() << " lines" << endl; + for ( QStringList::const_iterator it = lines.begin(); it != lines.end(); ++it) + { + QString line = *it; + QRegExp re( "DEBUG 1: ([^ =:]+) === (.*)" ); + if ( re.exactMatch( line ) ) + { + QString var = re.cap( 1 ); + QStringList values = QStringList::split( " :: ", re.cap( 2 ) ); + m_variables[var] = values; + m_keys.append( var ); + } + } + } + } +} + +QMakeDefaultOpts::~QMakeDefaultOpts() +{ +} + +const QStringList QMakeDefaultOpts::variableValues( const QString& var ) const +{ +// QStringList result; + if ( m_variables.contains(var) ) + return m_variables[var]; + return QStringList(); +} + +const QStringList& QMakeDefaultOpts::variables() const +{ + return m_keys; +} + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/qmake/qmakedefaultopts.h b/buildtools/qmake/qmakedefaultopts.h new file mode 100644 index 00000000..63bab54b --- /dev/null +++ b/buildtools/qmake/qmakedefaultopts.h @@ -0,0 +1,49 @@ +/*************************************************************************** +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef QMAKEDEFAULTOPTS_H +#define QMAKEDEFAULTOPTS_H + +#include <qmap.h> +#include <qstringlist.h> +// #include <qobject.h> + +// class KTempFile; +// class BlockingKProcess; + +class QMakeDefaultOpts +{ +public: + QMakeDefaultOpts( ); + + ~QMakeDefaultOpts(); + + void readVariables( const QString& qtdir, const QString& projdir ); + + const QStringList variableValues( const QString& ) const; + const QStringList& variables() const; + +// signals: +// void variablesRead(); + +// private slots: +// void slotReadStderr( KProcess*, char*, int ); +// void slotFinished( KProcess* ); + +private: + QMap<QString, QStringList> m_variables; + QStringList m_keys; +}; + +#endif + + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/qmake/qmakeoptionswidget.cpp b/buildtools/qmake/qmakeoptionswidget.cpp new file mode 100644 index 00000000..89f63c1e --- /dev/null +++ b/buildtools/qmake/qmakeoptionswidget.cpp @@ -0,0 +1,63 @@ +/*************************************************************************** +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#include "qmakeoptionswidget.h" + +#include <qcheckbox.h> +#include <kcombobox.h> +#include <qbuttongroup.h> +#include <kurlrequester.h> + +#include <domutil.h> +#include <kdebug.h> + +QMakeOptionsWidget::QMakeOptionsWidget( const QString& projectdir, QDomDocument &dom, const QString &configGroup, + QWidget *parent, const char *name ) + : QMakeOptionsWidgetBase( parent, name ), + m_dom( dom ), m_configGroup( configGroup ), m_projectDir( projectdir ) +{ + groupBehaviour->setButton( DomUtil::readIntEntry( dom, configGroup+"/qmake/savebehaviour", 2) ); + checkReplacePaths->setChecked( DomUtil::readBoolEntry( dom, configGroup+"/qmake/replacePaths", false ) ); + checkDisableDefaultOpts->setChecked( DomUtil::readBoolEntry( dom, configGroup+"/qmake/disableDefaultOpts", true ) ); + checkFilenamesOnly->setChecked( DomUtil::readBoolEntry( dom, configGroup+"/qmake/enableFilenamesOnly", false ) ); + showVariablesInTree->setChecked( DomUtil::readBoolEntry( dom, configGroup+"/qmake/showVariablesInTree", true ) ); + checkShowParseErrors->setChecked( DomUtil::readBoolEntry( dom, + configGroup+"/qmake/showParseErrors", true ) ); + qmakeProjectFile->setURL( DomUtil::readEntry( dom, configGroup+"/qmake/projectfile", "" ) ); + qmakeProjectFile->setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly ); + qmakeProjectFile->setFilter( "*.pro *.pri" ); + if( qmakeProjectFile->url().isEmpty() ) + { + qmakeProjectFile->setURL( projectdir ); + } +} + + +QMakeOptionsWidget::~QMakeOptionsWidget() +{} + + +void QMakeOptionsWidget::accept() +{ + DomUtil::writeIntEntry( m_dom, m_configGroup + "/qmake/savebehaviour", groupBehaviour->selectedId() ); + DomUtil::writeBoolEntry( m_dom, m_configGroup + "/qmake/replacePaths", checkReplacePaths->isChecked() ); + DomUtil::writeBoolEntry( m_dom, m_configGroup + "/qmake/disableDefaultOpts", checkDisableDefaultOpts->isChecked() ); + DomUtil::writeBoolEntry( m_dom, m_configGroup + "/qmake/enableFilenamesOnly", checkFilenamesOnly->isChecked() ); + DomUtil::writeBoolEntry( m_dom, m_configGroup + "/qmake/showVariablesInTree", showVariablesInTree->isChecked() ); + DomUtil::writeBoolEntry( m_dom, m_configGroup + "/qmake/showParseErrors", checkShowParseErrors->isChecked() ); + QString projfile = qmakeProjectFile->url(); + if( projfile != m_projectDir && QFileInfo( projfile ).isFile() && ( projfile.endsWith( ".pro" ) || projfile.endsWith( ".pri" ) ) ) + DomUtil::writeEntry( m_dom, m_configGroup + "/qmake/projectfile", projfile ); +} + +#include "qmakeoptionswidget.moc" + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/qmake/qmakeoptionswidget.h b/buildtools/qmake/qmakeoptionswidget.h new file mode 100644 index 00000000..c50e4b44 --- /dev/null +++ b/buildtools/qmake/qmakeoptionswidget.h @@ -0,0 +1,39 @@ +/*************************************************************************** +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef QMAKEOPTIONSWIDGET_H +#define QMAKEOPTIONSWIDGET_H + +#include "qmakeoptionswidgetbase.h" + +#include <qdom.h> + +class QMakeOptionsWidget : public QMakeOptionsWidgetBase +{ + Q_OBJECT +public: + QMakeOptionsWidget( const QString& projectdir, QDomDocument &dom, const QString &configGroup, + QWidget *parent = 0, const char *name = 0 ); + ~QMakeOptionsWidget(); + +public slots: + void accept(); +private: + QDomDocument &m_dom; + QString m_configGroup; + QString m_projectDir; +}; + +#endif + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on + + diff --git a/buildtools/qmake/qmakeoptionswidgetbase.ui b/buildtools/qmake/qmakeoptionswidgetbase.ui new file mode 100644 index 00000000..0ad833d1 --- /dev/null +++ b/buildtools/qmake/qmakeoptionswidgetbase.ui @@ -0,0 +1,217 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>QMakeOptionsWidgetBase</class> +<widget class="QWidget"> + <property name="name"> + <cstring>QMakeOptionsWidgetBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>738</width> + <height>523</height> + </rect> + </property> + <property name="caption"> + <string>QMake Manager Options</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string>- Also look into C++/Qt to define the QMake, Qt and Designer paths. +- Environment variables that should be resolved during parsing can be set on the Make Options page. +- For changes on this page to take effect the project needs to be reloaded.</string> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_3</cstring> + </property> + <property name="text"> + <string>QMake Project File:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>qmakeProjectFile</cstring> + </property> + </widget> + <widget class="KURLRequester"> + <property name="name"> + <cstring>qmakeProjectFile</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>This is the top level qmake project file, from which the project manager will be populated. +Leave this empty to automatically search for a .pro file in the project directory.</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>groupBehaviour</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="title"> + <string>Behaviour on Subproject Change</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>The following settings determine what the project configuration dialog should do when another subproject is selected while the dialog is still open.</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter</set> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>radioAlwaysSave</cstring> + </property> + <property name="text"> + <string>&Always Save</string> + </property> + <property name="toolTip" stdset="0"> + <string>Always save the configuration when changing the project.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Always save the project configuration when selecting a another sub project.</string> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>radioNeverSave</cstring> + </property> + <property name="text"> + <string>&Never Save (Warning: This can lead to loss of setting changes)</string> + </property> + <property name="toolTip" stdset="0"> + <string>Never save the configuration when changing the project.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Never save the project configuration when selecting a another sub project.</string> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>radioAsk</cstring> + </property> + <property name="text"> + <string>As&k</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Ask whether the configuration should be saved when switching the project.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Always ask whether the configuration should be saved when selecting another subproject.</string> + </property> + </widget> + </vbox> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>checkReplacePaths</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Repla&ce File Paths with matching Variables when adding files</string> + </property> + <property name="checked"> + <bool>false</bool> + </property> + <property name="toolTip" stdset="0"> + <string>This replaces the relative paths of added files with existing custom variables if the value assigned to it is the same as the path.</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>showVariablesInTree</cstring> + </property> + <property name="text"> + <string>Show variables in filenames in the QMake projectmanager view.</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>checkFilenamesOnly</cstring> + </property> + <property name="text"> + <string>Display only filenames in the QMake Manager (Project reload is needed after changing this setting)</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>checkDisableDefaultOpts</cstring> + </property> + <property name="text"> + <string>Do not use the QMake Default Options +This disables the reading of any .qmake.cache files or mkspecs.</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>checkShowParseErrors</cstring> + </property> + <property name="text"> + <string>Show parse error in message box</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>50</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kurlrequester.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/buildtools/qmake/qmakescopeitem.cpp b/buildtools/qmake/qmakescopeitem.cpp new file mode 100644 index 00000000..66fa3c3f --- /dev/null +++ b/buildtools/qmake/qmakescopeitem.cpp @@ -0,0 +1,928 @@ +/*************************************************************************** +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* Part of this file is taken from Qt Designer. * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#include "qmakescopeitem.h" + +#include <qdir.h> +#include <qregexp.h> + +#include <kiconloader.h> +#include <klocale.h> +#include <kdebug.h> +#include <kdirwatch.h> + +#include "scope.h" +#include "urlutil.h" +#include "trollprojectwidget.h" +/* + * Class qProjectItem + */ + +qProjectItem::qProjectItem( Type type, QListView *parent, const QString &text ) + : QListViewItem( parent, text ), typ( type ) +{} + + +qProjectItem::qProjectItem( Type type, qProjectItem *parent, const QString &text ) + : QListViewItem( parent, text ), typ( type ) +{} + + + +/* + * Class GroupItem + */ + +GroupItem::GroupItem( QListView *lv, GroupType type, const QString &text, QMakeScopeItem* spitem ) + : qProjectItem( Group, lv, text ) +{ + this->owner = spitem; + groupType = type; +// files.setAutoDelete( true ); + setPixmap( 0, SmallIcon( "tar" ) ); +} + +GroupItem::GroupType GroupItem::groupTypeForExtension( const QString &ext ) +{ + if ( ext == "cpp" || ext == "cc" || ext == "c" || ext == "C" || ext == "c++" || ext == "cxx" || ext == "ocl" ) + return Sources; + else if ( ext == "hpp" || ext == "h" || ext == "hxx" || ext == "hh" || ext == "h++" || ext == "H" ) + return Headers; + else if ( ext == "ui" ) + return Forms; + else if ( ext == "jpg" || ext == "jpeg" || ext == "png" || ext == "xpm" || ext == "gif" || ext == "bmp" ) + return Images; + else if ( ext == "idl" ) + return IDLs; + else if ( ext == "l" || ext == "ll" || ext == "lxx" || ext == "l++" ) + return Lexsources; + else if ( ext == "y" || ext == "yy" || ext == "yxx" || ext == "y++" ) + return Yaccsources; + else if ( ext == "ts" ) + return Translations; + else if ( ext == "qrc" ) + return Resources; + else + return Distfiles; +} + +void GroupItem::groupTypeMeanings( GroupItem::GroupType type, QString& title, QString& ext ) +{ + switch ( type ) + { + case GroupItem::Sources: + title = i18n( "Sources" ); + ext = "*.cpp *.c"; + break; + case GroupItem::Headers: + title = i18n( "Headers" ); + ext = "*.h *.hpp"; + break; + case GroupItem::Forms: + title = i18n( "Forms" ); + ext = "*.ui"; + break; + case GroupItem::IDLs: + title = i18n( "Corba IDLs" ); + ext = "*.idl *.kidl"; + break; + case GroupItem::Lexsources: + title = i18n( "Lexsources" ); + ext = "*.l *.ll *.lxx *.l++"; + break; + case GroupItem::Yaccsources: + title = i18n( "Yaccsources" ); + ext = "*.y *.yy *.yxx *.y++"; + break; + case GroupItem::Images: + title = i18n( "Images" ); + ext = "*.jpg *.jpeg *.png *.xpm *.gif *.bmp"; + break; + case GroupItem::Resources: + title = i18n( "Resources" ); + ext = "*.qrc"; + break; + case GroupItem::Distfiles: + title = i18n( "Distfiles" ); + ext = "*"; + break; + case GroupItem::Translations: + title = i18n( "Translations" ); + ext = "*.ts"; + break; + case GroupItem::InstallRoot: + title = i18n( "Installs" ); + ext = "*"; + break; + case GroupItem::InstallObject: + title = i18n( "Install object" ); + ext = "*"; + break; + + default: // just give back source files, et all + title = i18n( "Source Files" ); + ext = "*.cpp *.cc *.ocl *.c *.hpp *.h *.ui"; + } +} + +void GroupItem::paintCell( QPainter* p, const QColorGroup& c, int column, int width, int align ) +{ + QColorGroup cg( c ); + if ( !firstChild() ) + { + cg.setColor( QColorGroup::Text, cg.mid() ); + } + + qProjectItem::paintCell( p, cg, column, width, align ); +} + +void GroupItem::addFileToScope( const QString& filename ) +{ + QString file = filename; + + QPtrListIterator<FileItem> it( files ); + while ( it.current() != 0 ) + { + if ( it.current() ->text( 0 ) == file ) //File already exists in this subproject + return ; + ++it; + } + + FileItem *fitem = owner->createFileItem( file ); + + fitem->uiFileLink = owner->m_widget->getUiFileLink( owner->relativePath() + QString( QChar( QDir::separator() ) ), owner->scope->resolveVariables( filename ) ); + files.append( fitem ); + switch ( groupType ) + { + case GroupItem::Sources: + owner->addValue( "SOURCES", file ); + break; + case GroupItem::Headers: + owner->addValue( "HEADERS", file ); + break; + case GroupItem::Forms: + if( owner->m_widget->isTMakeProject() ) + owner->addValue( "INTERFACES", file ); + else + owner->addValue( "FORMS", file ); + break; + case GroupItem::IDLs: + owner->addValue( "IDLS", file ); + break; + case GroupItem::Lexsources: + owner->addValue( "LEXSOURCES", file ); + break; + case GroupItem::Yaccsources: + owner->addValue( "YACCSOURCES", file ); + break; + case GroupItem::Images: + owner->addValue( "IMAGES", file ); + break; + case GroupItem::Resources: + owner->addValue( "RESOURCES", file ); + break; + case GroupItem::Distfiles: + owner->addValue( "DISTFILES", file ); + break; + case GroupItem::Translations: + owner->addValue( "TRANSLATIONS", file ); + break; + case GroupItem::InstallObject: + owner->addValue( text( 0 ) + ".files", file ); + break; + default: + break; + } + owner->scope->saveToFile(); +} + +void GroupItem::removeFileFromScope( const QString& filename ) +{ + QString filePath; + + QPtrListIterator<FileItem> it( files ); + while ( it.current() != 0 ) + { + if ( it.current() ->text( 0 ) == filename ) //File already exists in this subproject + { + FileItem * fitem = it.current(); + filePath = fitem->localFilePath; + files.remove( it ); + delete fitem; + break; + } + ++it; + } + + if ( groupType == GroupItem::Sources ) + { + owner->removeValue( "SOURCES", filePath ); + } + else if ( groupType == GroupItem::Headers ) + { + owner->removeValue( "HEADERS", filePath ); + } + else if ( groupType == GroupItem::Forms ) + { + owner->removeValue( "FORMS", filePath ); + } + else if ( groupType == GroupItem::Images ) + { + owner->removeValue( "IMAGES", filePath ); + } + else if ( groupType == GroupItem::Resources ) + { + owner->removeValue( "RESOURCES", filePath ); + } + else if ( groupType == GroupItem::Lexsources ) + { + owner->removeValue( "LEXSOURCES", filePath ); + } + else if ( groupType == GroupItem::Yaccsources ) + { + owner->removeValue( "YACCSOURCES", filePath ); + } + else if ( groupType == GroupItem::Translations ) + { + owner->removeValue( "TRANSLATIONS", filePath ); + } + else if ( groupType == GroupItem::IDLs ) + { + owner->removeValue( "IDL", filePath ); + } + else if ( groupType == GroupItem::Distfiles ) + { + owner->removeValue( "DISTFILES", filePath ); + } + else if ( groupType == GroupItem::InstallObject ) + { + owner->removeValue( text( 0 ) + ".files", filePath ); + } + owner->scope->saveToFile(); +} + +void GroupItem::addInstallObject( const QString& objectname ) +{ + GroupItem * objitem = owner->createGroupItem( GroupItem::InstallObject, objectname, owner ); + owner->addValue( "INSTALLS", objectname ); + owner->scope->saveToFile(); + installs.append( objitem ); +} + +void GroupItem::removeInstallObject( GroupItem* item ) +{ + owner->removeValue( "INSTALLS", item->text(0) ); + owner->scope->saveToFile(); + installs.remove( item ); + delete item; +} + +/* + * Class FileItem + */ + +FileItem::FileItem( QListView *lv, const QString &text ) + : qProjectItem( File, lv, text ), uiFileLink( "" ) +{ + // if excluded is set the file is excluded in the subproject/project. + // by default excluded is set to false, thus file is included + // excluded = exclude; + setPixmap( 0, SmallIcon( "document" ) ); +} + + +/* + * Class QMakeScopeItem + */ + +QMakeScopeItem::QMakeScopeItem( QListView *parent, const QString &text, Scope* s, TrollProjectWidget* widget ) + : qProjectItem( Subproject, parent, text ), scope( s ), m_widget( widget ) +{ + // configuration.m_template = QTMP_APPLICATION; + init(); +} + + +QMakeScopeItem::QMakeScopeItem( QMakeScopeItem *parent, const QString &text, Scope* s ) + : qProjectItem( Subproject, parent, text ), scope( s ), m_widget( parent->m_widget ) +{ + init(); +} + +QMakeScopeItem::~QMakeScopeItem() +{ + QMap<GroupItem::GroupType, GroupItem*>::iterator it; + for ( it = groups.begin() ; it != groups.end() ; ++it ) + { + GroupItem* s = it.data(); + delete s; + } + groups.clear(); + +} + +QString QMakeScopeItem::relativePath() +{ + if( !scope || !scope->parent() ) + return ""; + if( scope->scopeType() == Scope::ProjectScope ) + { + if( scope->parent() && scope->parent()->variableValues("SUBDIRS").contains( URLUtil::relativePathToFile( scope->parent()->projectDir(), scope->projectDir()+"/"+scope->fileName() ) ) ) + { + return URLUtil::relativePathToFile( scope->parent()->projectDir(), scope->projectDir()+"/"+scope->fileName() ); + }else + { + return URLUtil::getRelativePath( m_widget->projectDirectory(), scope->projectDir() ); + } + }else + return static_cast<QMakeScopeItem*>( parent() ) ->relativePath(); +// if( !scope->parent() ) +// return ""; +// else if ( !scope->parent()->parent() || scope->scopeType() != Scope::ProjectScope ) +// return scope->scopeName(); +// else if ( scope->scopeType() == Scope::ProjectScope ) +// return ( static_cast<QMakeScopeItem*>( parent() ) ->relativePath() +// + QString( QChar( QDir::separator() ) ) + scope->scopeName() ); +// else +// return ( static_cast<QMakeScopeItem*>( parent() ) ->relativePath() ); +} + +QString QMakeScopeItem::getSharedLibAddObject( QString basePath ) +{ + if ( scope->variableValues( "CONFIG" ).findIndex( "dll" ) != -1 ) + { + QString tmpPath = URLUtil::getRelativePath(basePath, scope->projectDir() ); + if ( !scope->variableValues( "DESTDIR" ).front().isEmpty() ) + { + if ( QDir::isRelativePath( scope->variableValues( "DESTDIR" ).front() ) ) + tmpPath += QString( QChar( QDir::separator() ) ) + scope->variableValues( "DESTDIR" ).front(); + else + tmpPath = scope->variableValues( "DESTDIR" ).front(); + } + else + { + tmpPath += QString( QChar( QDir::separator() ) ); + } + + tmpPath = QDir::cleanDirPath( tmpPath ); + + QString libString; + if ( !scope->variableValues( "TARGET" ).front().isEmpty() ) + { + libString = tmpPath + QString( QChar( QDir::separator() ) ) + "lib" + scope->variableValues( "TARGET" ).front() + ".so"; + + } + else + { + libString = tmpPath + QString( QChar( QDir::separator() ) ) + "lib" + scope->projectName() + ".so"; + + } + return ( libString ); + } + return ""; +} + +QString QMakeScopeItem::getApplicationObject( QString basePath ) +{ + QString tmpPath = URLUtil::getRelativePath(basePath, scope->projectDir() ); + QString destdir = scope->resolveVariables( scope->variableValues( "DESTDIR" ).front() ); + + if ( !destdir.isEmpty() ) + { + if ( QDir::isRelativePath( destdir ) ) + tmpPath += QString( QChar( QDir::separator() ) ) + destdir; + else + tmpPath = destdir; + } + else + { + tmpPath += QString( QChar( QDir::separator() ) ); + } + + tmpPath = QDir::cleanDirPath( tmpPath ); + + QString target = scope->resolveVariables( scope->variableValues( "TARGET" ).front() ); + + if ( target.isEmpty() ) + return tmpPath + QString( QChar( QDir::separator() ) ) + scope->projectName(); + else + return tmpPath + QString( QChar( QDir::separator() ) ) + target; +} + +QString QMakeScopeItem::getLibAddObject( QString basePath ) +{ + if ( scope->variableValues( "CONFIG" ).findIndex( "dll" ) != -1 ) + { + QString target = scope->resolveVariables( scope->variableValues( "TARGET" ).front() ); + if ( !target.isEmpty() ) + { + return ( "-l" + target ); + } + else + { + return ( "-l" + scope->projectName() ); + } + } + else if ( scope->variableValues( "CONFIG" ).findIndex( "staticlib" ) != -1 + || scope->variableValues("TEMPLATE").findIndex("lib") != -1 ) + { + QString tmpPath = URLUtil::getRelativePath(basePath, scope->projectDir() ); + QString destdir = scope->resolveVariables( scope->variableValues( "DESTDIR" ).front() ); + if ( !destdir.isEmpty() ) + { + if ( QDir::isRelativePath( destdir ) ) + tmpPath += QString( QChar( QDir::separator() ) ) + destdir; + else + tmpPath = destdir; + } + else + { + tmpPath += QString( QChar( QDir::separator() ) ); + } + + tmpPath = QDir::cleanDirPath( tmpPath ); + + QString libString; + QString target = scope->resolveVariables( scope->variableValues( "TARGET" ).front() ); + if ( !target.isEmpty() ) + { + libString = tmpPath + QString( QChar( QDir::separator() ) ) + "lib" + target + ".a"; + + } + else + { + libString = tmpPath + QString( QChar( QDir::separator() ) ) + "lib" + scope->projectName() + ".a"; + + } + return ( libString ); + } + + return ( "" ); +} +QString QMakeScopeItem::getLibAddPath( QString basePath ) +{ + + //PATH only add if shared lib + if ( scope->variableValues( "CONFIG" ).findIndex( "dll" ) == -1 ) return ( "" ); + + QString tmpPath = URLUtil::getRelativePath(basePath, scope->projectDir() ); + QString destdir = scope->resolveVariables( scope->variableValues( "DESTDIR" ).front() ); + if ( !destdir.isEmpty() ) + { + if ( QDir::isRelativePath( destdir ) ) + tmpPath += QString( QChar( QDir::separator() ) ) + destdir; + else + tmpPath = destdir; + } + else + { + tmpPath += QString( QChar( QDir::separator() ) ); + } + + tmpPath = QDir::cleanDirPath( tmpPath ); + + return ( tmpPath ); + +} + +QString QMakeScopeItem::getIncAddPath( QString basePath ) +{ + QString tmpPath = URLUtil::getRelativePath( basePath, scope->projectDir() ); + tmpPath = QDir::cleanDirPath( tmpPath ); + + return ( tmpPath ); +} + +void QMakeScopeItem::buildSubTree() +{ + QValueList<Scope*>::const_iterator it; + + sortChildItems( 0, false ); + + QValueList<Scope*> scopes = scope->scopesInOrder(); + + for ( it = scopes.begin(); it != scopes.end(); ++it ) + { + if( (*it)->scopeType() != Scope::InvalidScope ) + new QMakeScopeItem( this, ( *it )->scopeName(), ( *it ) ); + else + kdDebug( 9024 ) << "No QMakeScopeItem created" << endl; + } +} + + +void QMakeScopeItem::init() +{ + if ( scope->scopeType() == Scope::SimpleScope ) + { + setPixmap( 0, SmallIcon( "qmake_scope" ) ); + } + else if ( scope->scopeType() == Scope::FunctionScope ) + { + setPixmap( 0, SmallIcon( "qmake_func_scope" ) ); + } + else if ( scope->scopeType() == Scope::IncludeScope ) + { + setPixmap( 0, SmallIcon( "qmake_inc_scope" ) ); + } + else + { + QStringList tmp = scope->variableValues( "TEMPLATE" ); + if( scope->isEnabled() ) + { + if ( tmp.findIndex( "subdirs" ) != -1 ) + setPixmap( 0, SmallIcon( "folder" ) ); + else if ( tmp.findIndex( "lib" ) != -1 ) + setPixmap( 0, SmallIcon( "qmake_lib" ) ); + else + setPixmap( 0, SmallIcon( "qmake_app" ) ); + }else + { + if ( tmp.findIndex( "subdirs" ) != -1 ) + setPixmap( 0, SmallIcon( "folder_grey" ) ); + else if ( tmp.findIndex( "lib" ) != -1 ) + setPixmap( 0, SmallIcon( "qmake_lib_disabled" ) ); + else + setPixmap( 0, SmallIcon( "qmake_app_disabled" ) ); + } + } + + setEnabled( scope->isEnabled() ); + if( scope->isEnabled() ) + { + buildGroups(); + buildSubTree(); + } +} + +GroupItem* QMakeScopeItem::createGroupItem( GroupItem::GroupType type, const QString& label, QMakeScopeItem* scopeitem ) +{ + GroupItem * item = new GroupItem( scopeitem->listView(), type, label, scopeitem ); + scopeitem->listView() ->takeItem( item ); + return item; +} + +FileItem* QMakeScopeItem::createFileItem( const QString& name ) +{ + QString display = name; + if( m_widget->showFilenamesOnly() ) + { + int dirSepPos = name.findRev( QChar( QDir::separator() ) ); + if ( dirSepPos != - 1 ) + display = name.mid( dirSepPos + 1 ); + } + if( !m_widget->showVariablesInTree() ) + { + display = scope->resolveVariables( display ); + } + FileItem * fitem = new FileItem( listView(), display ); + listView() ->takeItem( fitem ); + + fitem->localFilePath = name; + + return fitem; +} + +void QMakeScopeItem::buildGroups() +{ + if( scope->variableValues("TEMPLATE").findIndex("subdirs") != -1 ) + return; + QStringList values; + + GroupItem* item; + QStringList::iterator it; + + values = scope->variableValues( "INSTALLS" ); + item = createGroupItem( GroupItem::InstallRoot, "INSTALLS", this ); + groups.insert( item->groupType, item ); + for ( it = values.begin(); it != values.end(); ++it ) + { + if ( ( *it ) == "target" ) + continue; + + QString path = scope->variableValues( *it + ".path" ).front(); + GroupItem* installitem = createGroupItem( GroupItem::InstallObject, *it, this ); + item->installs.append( installitem ); + QStringList files = scope -> variableValues( *it + ".files" ); + if ( !files.isEmpty() ) + { + QStringList::iterator filesit = files.begin(); + for ( ;filesit != files.end(); ++filesit ) + { + installitem->files.append( createFileItem( *filesit ) ); + } + } + } + + values = scope->variableValues( "LEXSOURCES" ); + item = createGroupItem( GroupItem::Lexsources, "LEXSOURCES", this ); + groups.insert( item->groupType, item ); + for ( it = values.begin(); it != values.end(); ++it ) + { + item->files.append( createFileItem( *it ) ); + } + + values = scope->variableValues( "YACCSOURCES" ); + item = createGroupItem( GroupItem::Yaccsources, "YACCSOURCES", this ); + groups.insert( item->groupType, item ); + for ( it = values.begin(); it != values.end(); ++it ) + { + item->files.append( createFileItem( *it ) ); + } + + values = scope->variableValues( "DISTFILES" ); + item = createGroupItem( GroupItem::Distfiles, "DISTFILES", this ); + groups.insert( item->groupType, item ); + for ( it = values.begin(); it != values.end(); ++it ) + { + item->files.append( createFileItem( *it ) ); + } + + if ( scope->isQt4Project() ) + { + values = scope->variableValues( "RESOURCES" ); + item = createGroupItem( GroupItem::Resources, "RESOURCES", this ); + groups.insert( item->groupType, item ); + for ( it = values.begin(); it != values.end(); ++it ) + { + item->files.append( createFileItem( *it ) ); + } + } + values = scope->variableValues( "IMAGES" ); + item = createGroupItem( GroupItem::Images, "IMAGES", this ); + groups.insert( item->groupType, item ); + for ( it = values.begin(); it != values.end(); ++it ) + { + item->files.append( createFileItem( *it ) ); + } + + values = scope->variableValues( "TRANSLATIONS" ); + item = createGroupItem( GroupItem::Translations, "TRANSLATIONS", this ); + groups.insert( item->groupType, item ); + for ( it = values.begin(); it != values.end(); ++it ) + { + item->files.append( createFileItem( *it ) ); + } + + values = scope->variableValues( "IDLS" ); + item = createGroupItem( GroupItem::IDLs, "Corba IDL", this ); + groups.insert( item->groupType, item ); + for ( it = values.begin(); it != values.end(); ++it ) + { + item->files.append( createFileItem( *it ) ); + } + + if ( m_widget->isTMakeProject() ) + { + values = scope->variableValues( "INTERFACES" ); + item = createGroupItem( GroupItem::Forms, "INTERFACES", this ); + } + else + { + values = scope->variableValues( "FORMS" ); + item = createGroupItem( GroupItem::Forms, "FORMS", this ); + } + groups.insert( item->groupType, item ); + for ( it = values.begin(); it != values.end(); ++it ) + { + item->files.append( createFileItem( *it ) ); + } + + values = scope->variableValues( "SOURCES" ); + item = createGroupItem( GroupItem::Sources, "SOURCES", this ); + groups.insert( item->groupType, item ); + for ( it = values.begin(); it != values.end(); ++it ) + { + FileItem* fitem = createFileItem( *it ); + fitem->uiFileLink = m_widget->getUiFileLink( relativePath() + QString( QChar( QDir::separator() ) ), scope->resolveVariables( *it ) ); + item->files.append( fitem ); + } + + values = scope->variableValues( "HEADERS" ); + item = createGroupItem( GroupItem::Headers, "HEADERS", this ); + groups.insert( item->groupType, item ); + for ( it = values.begin(); it != values.end(); ++it ) + { + FileItem* fitem = createFileItem( *it ); + fitem->uiFileLink = m_widget->getUiFileLink( relativePath() + QString( QChar( QDir::separator() ) ), scope->resolveVariables( *it ) ); + item->files.append( fitem ); + } + +} + +void QMakeScopeItem::removeValues( const QString& var, const QStringList& values ) +{ + for( QStringList::const_iterator it = values.begin() ; it != values.end(); ++it ) + { + removeValue( var, *it ); + } +} + +void QMakeScopeItem::addValues( const QString& var, const QStringList& values ) +{ + for( QStringList::const_iterator it = values.begin() ; it != values.end(); ++it ) + { + addValue( var, *it ); + } +} + +void QMakeScopeItem::removeValue( const QString& var, const QString& value ) +{ + if( scope->scopeType() != Scope::IncludeScope && scope->variableValues( var ).findIndex( value ) != -1 ) + { + if( scope->variableValuesForOp( var, "+=" ).findIndex(value) != -1 ) + { + scope->removeFromPlusOp( var, QStringList( value ) ); + if( scope->variableValues( var ).findIndex( value ) != -1 ) + { + scope->addToMinusOp( var, QStringList( value ) ); + } + }else + scope->addToMinusOp( var, QStringList( value ) ); + }else if( scope->scopeType() == Scope::IncludeScope ) + { + scope->addToMinusOp( var, QStringList( value ) ); + } +} + +void QMakeScopeItem::addValue( const QString& var, const QString& value ) +{ + if( scope->scopeType() != Scope::IncludeScope && scope->variableValues( var ).findIndex( value ) == -1 ) + { + if( scope->variableValuesForOp( var, "-=" ).findIndex(value) != -1 ) + scope->removeFromMinusOp( var, QStringList( value ) ); + else + scope->addToPlusOp( var, QStringList( value ) ); + }else if( scope->scopeType() == Scope::IncludeScope ) + { + scope->addToPlusOp( var, QStringList( value ) ); + } +} + +void QMakeScopeItem::updateValues( const QString& var, const QStringList& values ) +{ + QStringList curValues = scope->variableValues( var, (scope->scopeType() != Scope::IncludeScope) ); + QStringList scopeValues = scope->variableValuesForOp( var, "+=" ); + for( QStringList::const_iterator it = curValues.begin(); it != curValues.end(); ++it ) + { + if ( values.findIndex( *it ) == -1 ) + { + if( scopeValues.findIndex( *it ) != -1 ) + { + scope->removeFromPlusOp( var, QStringList( *it ) ); + scopeValues.remove( *it ); + }else + scope->addToMinusOp( var, QStringList( *it ) ); + } + } + for( QStringList::const_iterator it = values.begin(); it != values.end(); ++it ) + { + if ( scopeValues.findIndex( *it ) != -1 ) + { + scopeValues.remove(*it); + } + } +// kdDebug(9024) << "--------------" << var << "------------------" << endl; +// kdDebug(9024) << "values: " << values << "| scope:" << scopeValues << endl; + scopeValues += values; +// kdDebug(9024) << "values: " << values << "| scope:" << scopeValues << endl; + scope->setPlusOp( var, scopeValues ); +// QStringList tmp = scope->variableValuesForOp( var, "+=" ); +// kdDebug(9024) << "result:" << tmp << endl; +// kdDebug(9024) << "---------------------------------------" << endl; +} + +QMakeScopeItem* QMakeScopeItem::projectFileItem() +{ + if( scope->scopeType() != Scope::ProjectScope ) + { + QMakeScopeItem* parentitem = dynamic_cast<QMakeScopeItem*>(parent()); + if( parentitem ) + return parentitem->projectFileItem(); + } + return this; +} + +void QMakeScopeItem::reloadProject() +{ + kdDebug(9024) << "Reloading Project" << endl; + QListViewItem* item = firstChild(); + while( item ) + { + QListViewItem* olditem = item; + item = olditem->nextSibling(); + delete olditem; + } + QMap<GroupItem::GroupType, GroupItem*>::iterator it; + for ( it = groups.begin() ; it != groups.end() ; ++it ) + { + GroupItem* s = it.data(); + QListView* l = s->listView(); + if(l) + l->removeItem(s); + delete s; + } + groups.clear(); + scope->reloadProject(); + init(); +} + +void QMakeScopeItem::disableSubprojects( const QStringList& dirs ) +{ + QStringList::const_iterator it = dirs.begin(); + for( ; it != dirs.end() ; ++it) + { + if( scope->variableValues("SUBDIRS").findIndex(*it) != -1 ) + { + Scope* s = scope->disableSubproject(*it); + if( !s ) + return; + else + { + QMakeScopeItem* newitem = new QMakeScopeItem( this, s->scopeName(), s ); + QListViewItem* lastitem = firstChild(); + while( lastitem && lastitem->nextSibling() ) + lastitem = lastitem->nextSibling(); + if( lastitem ) + newitem->moveItem(lastitem); + } + } + } + +} + +int QMakeScopeItem::compare( QListViewItem* i, int , bool ) const +{ + QMakeScopeItem* other = dynamic_cast<QMakeScopeItem*>(i); + if( !i ) + return -1; + if( other->scope->getNum() < scope->getNum() ) + return 1; + else if ( other->scope->getNum() > scope->getNum() ) + return -1; + else + return 0; +} + +QMap<QString, QString> QMakeScopeItem::getLibInfos( QString basePath ) +{ + + QMap<QString, QString> result; + if ( scope->variableValues( "TARGET" ).front().isEmpty() ) + result["shared_lib"] = "-l"+scope->projectName(); + else + result["shared_lib"] = "-l"+scope->variableValues( "TARGET" ).front(); + + QString tmpPath = URLUtil::getRelativePath(basePath, scope->projectDir() ); + if ( !scope->variableValues( "DESTDIR" ).front().isEmpty() ) + { + if ( QDir::isRelativePath( scope->variableValues( "DESTDIR" ).front() ) ) + tmpPath += QString( QChar( QDir::separator() ) ) + scope->variableValues( "DESTDIR" ).front(); + else + tmpPath = scope->variableValues( "DESTDIR" ).front(); + } + else + { + tmpPath += QString( QChar( QDir::separator() ) ); + } + + tmpPath = QDir::cleanDirPath( tmpPath ); + + result["shared_libdir"] = "-L"+tmpPath; + + if ( scope->variableValues( "TARGET" ).front().isEmpty() ) + result["shared_depend"] = tmpPath+QString(QChar(QDir::separator()))+"lib"+scope->projectName()+".so"; + else + result["shared_depend"] = tmpPath+QString(QChar(QDir::separator()))+"lib"+scope->variableValues( "TARGET" ).front()+".so"; + + + if ( scope->variableValues( "TARGET" ).front().isEmpty() ) + result["static_lib"] = tmpPath+QString(QChar(QDir::separator()))+"lib"+scope->projectName()+".a"; + else + result["static_lib"] = tmpPath+QString(QChar(QDir::separator()))+"lib"+scope->variableValues( "TARGET" ).front()+".a"; + + result["static_depend"] = result["static_lib"]; + + if ( scope->variableValues( "TARGET" ).front().isEmpty() ) + result["app_depend"] = tmpPath + QString( QChar( QDir::separator() ) ) + scope->projectName(); + else + result["app_depend"] = tmpPath + QString( QChar( QDir::separator() ) ) + scope->variableValues( "TARGET" ).front(); + + QString map; + for( QMap<QString, QString>::const_iterator it = result.begin(); it != result.end(); ++it ) + map += "["+it.key() + "=>" +it.data() + "],"; + kdDebug(9024) << "Running getLibInfo for" << scope->projectName() << "|" << map << endl; + return result; +} + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/qmake/qmakescopeitem.h b/buildtools/qmake/qmakescopeitem.h new file mode 100644 index 00000000..b2c84345 --- /dev/null +++ b/buildtools/qmake/qmakescopeitem.h @@ -0,0 +1,128 @@ +/*************************************************************************** +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef _QMAKESCOPEITEM_H_ +#define _QMAKESCOPEITEM_H_ + +#include <qlistview.h> +#include <qstring.h> + +class Scope; +class QMakeScopeItem; +class FileItem; +class TrollProjectWidget; + +/** + * Base class for all items appearing in ProjectOverview and ProjectDetails. + */ +class qProjectItem : public QListViewItem +{ +public: + enum Type { Subproject, Group, File }; + + qProjectItem( Type type, QListView *parent, const QString &text ); + qProjectItem( Type type, qProjectItem *parent, const QString &text ); + + QString scopeString; + Type type() + { return typ; } + +private: + Type typ; + void init(); + +}; + + +class GroupItem : public qProjectItem +{ +public: + enum GroupType {NoType, Sources, Headers, Forms, Distfiles, Images, Resources, Lexsources, Yaccsources, Translations, IDLs, InstallRoot, InstallObject, MaxTypeEnum }; + + static GroupType groupTypeForExtension( const QString &ext ); + static void groupTypeMeanings( GroupItem::GroupType type, QString& title, QString& ext ); + + GroupItem( QListView *lv, GroupType type, const QString &text, QMakeScopeItem* spitem ); + + void removeFileFromScope( const QString& filename); + void addFileToScope( const QString& filename); + void addInstallObject( const QString& objectname); + void removeInstallObject( GroupItem* item ); + + // qmake INSTALLS support + QPtrList<GroupItem> installs; + QPtrList<FileItem> files; + +// QStringList str_files; +// QStringList str_files_exclude; + // end qmake INSTALLS support + GroupType groupType; + QMakeScopeItem* owner; + +protected: + void paintCell( QPainter* p, const QColorGroup& cg, int column, int width, int align ); +}; + + +// Not sure if this complexity is really necessary... +class FileItem : public qProjectItem +{ +public: + FileItem( QListView *lv, const QString &text ); + + QString uiFileLink; + QString localFilePath; +}; + +/** + * Stores one Scope + */ +class QMakeScopeItem : public qProjectItem +{ +public: + QMakeScopeItem( QListView *parent, const QString &text, Scope *s, TrollProjectWidget* widget ); + QMakeScopeItem( QMakeScopeItem *parent, const QString &text, Scope* ); + void updateValues( const QString& var, const QStringList& values ); + void addValue( const QString& var, const QString& value ); + void removeValue( const QString& var, const QString& value ); + void addValues( const QString& var, const QStringList& values ); + void removeValues( const QString& var, const QStringList& values ); + void disableSubprojects( const QStringList& ); + void reloadProject(); + int compare( QListViewItem* i, int col, bool ascending ) const; + ~QMakeScopeItem(); + + QMap<GroupItem::GroupType, GroupItem*> groups; + + Scope* scope; + QString relativePath(); + QString getLibAddPath( QString ); + QString getLibAddObject( QString ); + QString getSharedLibAddObject( QString ); + QString getApplicationObject( QString ); + QString getIncAddPath( QString downDirs ); + FileItem* createFileItem(const QString& file); + GroupItem* createGroupItem(GroupItem::GroupType type, const QString& name, QMakeScopeItem* scopeitem); + QMap<QString, QString> getLibInfos( QString ); + + QMakeScopeItem* projectFileItem(); + + TrollProjectWidget* m_widget; +private: + void init(); + void buildSubTree(); + void buildGroups(); +}; + + +#endif + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/qmake/scope.cpp b/buildtools/qmake/scope.cpp new file mode 100644 index 00000000..c090861b --- /dev/null +++ b/buildtools/qmake/scope.cpp @@ -0,0 +1,1710 @@ +/*************************************************************************** +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#include "scope.h" + +#include <kdebug.h> + +#include <qfile.h> +#include <qfileinfo.h> +#include <qdir.h> +#include <qpair.h> +#include <qmakedriver.h> +#include <qregexp.h> +#include <qtimer.h> + +#include <kdirwatch.h> + +#include <kmessagebox.h> +#include <klocale.h> +#include <stdlib.h> + +#include "urlutil.h" +#include "trollprojectpart.h" +#include "qmakedefaultopts.h" + +const QStringList Scope::KnownVariables = QStringList() << "QT" << "CONFIG" << "TEMPLATE" << "SUBDIRS" << "VERSION" << "LIBS" << "target.path" << "INSTALLS" << "MAKEFILE" << "TARGETDEPS" << "INCLUDEPATH" << "TARGET" << "DESTDIR" << "DEFINES" << "QMAKE_CXXFLAGS_DEBUG" << "QMAKE_CXXFLAGS_RELEASE" << "OBJECTS_DIR" << "UI_DIR" << "MOC_DIR" << "IDL_COMPILER" << "IDL_OPTIONS" << "RCC_DIR" << "IDLS" << "RESOURCES" << "IMAGES" << "LEXSOURCES" << "DISTFILES" << "YACCSOURCES" << "TRANSLATIONS" << "HEADERS" << "SOURCES" << "INTERFACES" << "FORMS" ; + +const QStringList Scope::KnownConfigValues = QStringList() << "debug" << "release" << "debug_and_release" << "warn_on" << "warn_off" << "staticlib" << "dll" << "plugin" << "designer" << "create_pkgconf" << "create_libtool" << "qt" << "console" << "windows" << "x11" << "thread" << "exceptions" << "stl" << "rtti" << "opengl" << "thread" << "ordered" << "precompile_header" << "qtestlib" << "uitools" << "dbus" << "assistant" << "build_all" << "help"; + +Scope::Scope( const QMap<QString, QString>& env, const QString &filename, TrollProjectPart* part ) + : m_root( 0 ), m_incast( 0 ), m_parent( 0 ), m_num(0), m_isEnabled( true ), m_part(part), m_defaultopts(0), m_environment( env ) +{ + if ( !loadFromFile( filename ) ) + { + if( !QFileInfo( filename ).exists() ) + { + m_root = new QMake::ProjectAST(); + m_root->setFileName( filename ); + }else + { + delete m_root; + m_root = 0; + } + } + loadDefaultOpts(); + if( m_root ) + { + m_part->dirWatch()->addFile(filename); + } + init(); +} + +Scope::~Scope() +{ + QMap<unsigned int, Scope*>::iterator it; + for ( it = m_scopes.begin() ; it != m_scopes.end() ; ++it ) + { + Scope* s = it.data(); + delete s; + } + m_scopes.clear(); + + m_customVariables.clear(); + if ( m_root && m_root->isProject() && !m_incast ) + { + delete m_root; + m_root = 0; + delete m_defaultopts; + m_defaultopts = 0; + } + +} + +// Simple/Function Scopes +Scope::Scope( const QMap<QString, QString>& env, unsigned int num, Scope* parent, QMake::ProjectAST* scope, + QMakeDefaultOpts* defaultopts, TrollProjectPart* part ) + : m_root( scope ), m_incast( 0 ), m_parent( parent ), m_num(num), m_isEnabled( true ), + m_part(part), m_defaultopts(defaultopts), m_environment( env ) +{ + init(); +} + +//Subdirs +Scope::Scope( const QMap<QString, QString>& env, unsigned int num, Scope* parent, const QString& filename, + TrollProjectPart* part, bool isEnabled ) + : m_root( 0 ), m_incast( 0 ), m_parent( parent ), m_num(num), m_isEnabled( isEnabled ), + m_part(part), m_defaultopts(0), m_environment( env ) +{ + if ( !loadFromFile( filename ) ) + { + if( !QFileInfo( filename ).exists() && QFileInfo( QFileInfo( filename ).dirPath( true ) ).exists() ) + { + m_root = new QMake::ProjectAST(); + m_root->setFileName( filename ); + }else + { + delete m_root; + m_root = 0; + m_isEnabled = false; + } + } + loadDefaultOpts(); + if( m_root ) + m_part->dirWatch()->addFile(filename); + init(); +} + +//Include Scope +Scope::Scope( const QMap<QString, QString>& env, unsigned int num, Scope* parent, QMake::IncludeAST* incast, const QString& path, + const QString& incfile, QMakeDefaultOpts* defaultopts, TrollProjectPart* part ) + : m_root( 0 ), m_incast( incast ), m_parent( parent ), m_num(num), m_isEnabled( true ), + m_part(part), m_defaultopts(defaultopts), m_environment( env ) +{ + QString absfilename; + QString tmp = incfile.stripWhiteSpace(); + if( tmp.contains(")" ) ) + tmp = tmp.mid(0, tmp.find(")") ); + + if( tmp.startsWith( "\"" ) ) + tmp = tmp.mid( 1, tmp.length()-2 ); + + if( QFileInfo(tmp).isRelative() ) + { + absfilename = QDir::cleanDirPath( path + QString( QChar( QDir::separator() ) ) + tmp ); + }else + absfilename = QDir::cleanDirPath( tmp ); + if ( !loadFromFile( absfilename ) ) + { + if( !QFileInfo( absfilename ).exists() && QFileInfo( QFileInfo( absfilename ).dirPath( true ) ).exists() ) + { + m_root = new QMake::ProjectAST(); + m_root->setFileName( absfilename ); + }else + { + delete m_root; + m_root = 0; + m_isEnabled = false; + } + } + if( m_root ) + m_part->dirWatch()->addFile( m_root->fileName() ); + init(); +} + +bool Scope::loadFromFile( const QString& filename ) +{ + if ( !QFileInfo(filename).exists() || QMake::Driver::parseFile( filename, &m_root, 0 ) != 0 ) + { + kdDebug( 9024 ) << "Couldn't parse project: " << filename << endl; + if( DomUtil::readBoolEntry( *m_part->projectDom(), + "/kdevtrollproject/qmake/showParseErrors", true ) ) + { + KMessageBox::error( 0, i18n( "Could not parse project file: %1" ).arg( filename ), + i18n( "Could not parse project file" ) ); + } + m_root = 0; + return false; + } +// init(); + return true; +} + +void Scope::saveToFile() const +{ + if ( !m_root ) + return ; + + if ( scopeType() != ProjectScope && scopeType() != IncludeScope ) + { + m_parent->saveToFile(); + return; + } + + QString filename; + if ( scopeType() == ProjectScope ) + filename = m_root->fileName() ; + else if ( scopeType() == IncludeScope ) + filename = m_parent->projectDir() + QString( QChar( QDir::separator() ) ) + m_incast->projectName; + if ( filename.isEmpty() ) + return ; + m_part->dirWatch()->stopScan(); + QFile file( filename ); + if ( file.open( IO_WriteOnly ) ) + { + + QTextStream out( &file ); + QString astbuffer; + m_root->writeBack( astbuffer ); + out << astbuffer; + file.close(); + }else + { + KMessageBox::error( 0, i18n( "Could not write project file: %1" ).arg( filename ), + i18n( "Could not write project file" ) ); + } +#ifdef DEBUG + Scope::PrintAST pa; + pa.processProject(m_root); +#endif + m_part->dirWatch()->startScan(); +} + +void Scope::addToPlusOp( const QString& variable, const QStringList& values ) +{ + if ( !m_root ) + return ; + + updateVariable( variable, "+=", values, false ); +} + +void Scope::removeFromPlusOp( const QString& variable, const QStringList& values ) +{ + if ( !m_root ) + return ; + + updateVariable( variable, "+=", values, true ); +} + + +void Scope::addToMinusOp( const QString& variable, const QStringList& values ) +{ + if ( !m_root ) + return ; + + updateVariable( variable, "-=", values, false ); +} + +void Scope::removeFromMinusOp( const QString& variable, const QStringList& values ) +{ + if ( !m_root ) + return ; + + updateVariable( variable, "-=", values, true ); +} + +void Scope::addToEqualOp( const QString& variable, const QStringList& values ) +{ + if ( !m_root ) + return ; + + updateVariable( variable, "=", values, false ); +} + +void Scope::removeFromEqualOp( const QString& variable, const QStringList& values ) +{ + if ( !m_root ) + return ; + + updateVariable( variable, "=", values, true ); +} + +void Scope::setPlusOp( const QString& variable, const QStringList& values ) +{ + if( !m_root || Scope::listsEqual(values, variableValuesForOp(variable, "+=") ) ) + return; + + updateVariable( variable, "+=", variableValuesForOp( variable, "+=" ), true ); + updateVariable( variable, "+=", values, false ); +} + +void Scope::setEqualOp( const QString& variable, const QStringList& values ) +{ + if( !m_root || Scope::listsEqual(values, variableValuesForOp(variable, "=") ) ) + return; + + updateVariable( variable, "=", variableValuesForOp( variable, "=" ), true ); + updateVariable( variable, "=", values, false ); +} + +void Scope::setMinusOp( const QString& variable, const QStringList& values ) +{ + if( !m_root || Scope::listsEqual(values, variableValuesForOp(variable, "-=") ) ) + return; + + updateVariable( variable, "-=", variableValuesForOp( variable, "-=" ), true ); + updateVariable( variable, "-=", values, false ); +} + +QStringList Scope::variableValuesForOp( const QString& variable , const QString& op ) const +{ + QStringList result; + + if( !m_root ) + return result; + + QValueList<QMake::AST*>::const_iterator it; + for ( it = m_root->m_children.begin(); it != m_root->m_children.end(); ++it ) + { + QMake::AST* ast = *it; + if ( ast->nodeType() == QMake::AST::AssignmentAST ) + { + QMake::AssignmentAST * assign = static_cast<QMake::AssignmentAST*>( ast ); + if ( assign->scopedID == variable && assign->op == op ) + { + result += assign->values; + } + } + } + result = cleanStringList(result); + return result; +} + +QStringList Scope::variableValues( const QString& variable, bool checkIncParent, bool fetchFromParent, bool evaluateSubScopes ) +{ + QStringList result; + + if ( !m_root ) + return result; + + if( m_varCache.contains( variable ) && fetchFromParent && ( checkIncParent || scopeType() != Scope::IncludeScope ) ) + { + return m_varCache[variable]; + } + + calcValuesFromStatements( variable, result, checkIncParent, 0, fetchFromParent, true, evaluateSubScopes ); + result = cleanStringList(result); + if( ( scopeType() != Scope::IncludeScope || checkIncParent ) && fetchFromParent ) + { + m_varCache[ variable ] = result; + } + return result; +} + +void Scope::calcValuesFromStatements( const QString& variable, QStringList& result, bool checkIncParent, QMake::AST* stopHere, bool fetchFromParent, bool setDefault, bool evaluateSubScopes ) const +{ + if( !m_root ) + return; + + /* For variables that we don't know and which are not QT/CONFIG find the default value */ + if( setDefault && m_defaultopts + && m_defaultopts->variables().findIndex(variable) != -1 + && ( variable == "TEMPLATE" || variable == "QT" || KnownVariables.findIndex(variable) == -1 || variable == "CONFIG" ) ) + { + result = m_defaultopts->variableValues(variable); + } + + if ( ( scopeType() == FunctionScope || scopeType() == SimpleScope ) && fetchFromParent ) + { + m_parent->calcValuesFromStatements( variable, result, checkIncParent, this->m_root, fetchFromParent, setDefault, evaluateSubScopes ); + } + else if ( scopeType() == IncludeScope && checkIncParent && fetchFromParent ) + { + m_parent->calcValuesFromStatements( variable, result, true, this->m_incast, fetchFromParent, setDefault, evaluateSubScopes ); + } + + QValueList<QMake::AST*>::const_iterator it; + for ( it = m_root->m_children.begin(); it != m_root->m_children.end(); ++it ) + { + if ( stopHere && *it == stopHere ) + return ; + QMake::AST* ast = *it; + if ( ast->nodeType() == QMake::AST::AssignmentAST ) + { + QMake::AssignmentAST * assign = static_cast<QMake::AssignmentAST*>( ast ); + if ( assign->scopedID == variable ) + { + if ( assign->op == "=" ) + { + result = assign->values; + } + else if ( assign->op == "+=" ) + { + for ( QStringList::const_iterator sit = assign->values.begin(); sit != assign->values.end() ; ++sit ) + { + if ( result.findIndex( *sit ) == -1 ) + result.append( *sit ); + } + } + else if ( assign->op == "-=" ) + { + for ( QStringList::const_iterator sit = assign->values.begin(); sit != assign->values.end() ; ++sit ) + { + if ( result.findIndex( *sit ) != -1 ) + result.remove( *sit ); + } + } + } + }else if( evaluateSubScopes ) + { + if( ast->nodeType() == QMake::AST::IncludeAST ) + { + QMake::IncludeAST* iast = static_cast<QMake::IncludeAST*>(ast); + QValueList<unsigned int> l = m_scopes.keys(); + for( unsigned int i = 0; i < l.count(); ++i ) + { + int num = l[ i ]; + if( m_scopes.contains( num ) ) + { + Scope* s = m_scopes[num]; + if( s && s->scopeType() == IncludeScope && s->m_incast == iast ) + { + s->calcValuesFromStatements( variable, result, false, 0, false, false, evaluateSubScopes ); + } + } + } + + } + else if( ast->nodeType() == QMake::AST::ProjectAST ) + { + QMake::ProjectAST* past = static_cast<QMake::ProjectAST*>(ast); + if( past->isFunctionScope() || past->isScope() ) + { + QValueList<unsigned int> l = m_scopes.keys(); + for( unsigned int i = 0; i < l.count(); ++i ) + { + int num = l[ i ]; + if( m_scopes.contains( num ) ) + { + Scope* s = m_scopes[num]; + if( s && s->m_root == past && s->m_root->scopedID == past->scopedID ) + { + s->calcValuesFromStatements( variable, result, false, 0, false, false, evaluateSubScopes ); + } + } + } + } + } + } + } + + result = cleanStringList( result ); + return ; +} + +Scope::ScopeType Scope::scopeType() const +{ + if ( !m_root ) + return InvalidScope; + else if ( m_incast ) + return IncludeScope; + else if ( m_root->isProject() ) + return ProjectScope; + else if ( m_root->isScope() ) + return SimpleScope; + else if ( m_root->isFunctionScope() ) + return FunctionScope; + return InvalidScope; +} + +QString Scope::scopeName() const +{ + if ( !m_root ) + return ""; + if ( m_incast ) + return "include<" + m_incast->projectName + ">"; + else if ( m_root->isFunctionScope() ) + return funcScopeKey( m_root ); + else if ( m_root->isScope() ) + return m_root->scopedID; + else if ( m_root->isProject() ) + { + if( m_parent && QDir::cleanDirPath( m_parent->projectDir() ) != QDir::cleanDirPath( projectDir() ) ) + { + return URLUtil::getRelativePath( m_parent->projectDir(), projectDir() ); + }else if ( m_parent && QDir::cleanDirPath( m_parent->projectDir() ) == QDir::cleanDirPath( projectDir() ) ) + { + return fileName(); + }else + return QFileInfo( projectDir() ).fileName() ; + } + return QString(); +} + +QString Scope::fileName() const +{ + if( !m_root ) + return ""; + if ( m_incast ) + return m_incast->projectName; + else if ( m_root->isProject() ) + return QFileInfo( m_root->fileName() ).fileName(); + else + return m_parent->fileName(); +} + +Scope* Scope::createFunctionScope( const QString& funcName, const QString& args ) +{ + if ( !m_root ) + return 0; + + QMake::ProjectAST* ast = new QMake::ProjectAST( QMake::ProjectAST::FunctionScope ); + ast->scopedID = funcName; + ast->args = args; + ast->setDepth( m_root->depth() ); + ast->addChildAST( new QMake::NewLineAST() ); + m_root->addChildAST( ast ); + m_root->addChildAST( new QMake::NewLineAST() ); + Scope* funcScope = new Scope( m_environment, getNextScopeNum(), this, ast, m_defaultopts, m_part ); + if( funcScope->scopeType() != Scope::InvalidScope ) + { + m_scopes.insert( getNextScopeNum(), funcScope ); + return funcScope; + }else + delete funcScope; + return 0; +} + +Scope* Scope::createSimpleScope( const QString& scopename ) +{ + if ( !m_root ) + return 0; + + QMake::ProjectAST* ast = new QMake::ProjectAST( QMake::ProjectAST::Scope ); + ast->scopedID = scopename; + ast->addChildAST( new QMake::NewLineAST() ); + ast->setDepth( m_root->depth() ); + m_root->addChildAST( ast ); + m_root->addChildAST( new QMake::NewLineAST() ); + /* We can't unconditionally add the scope name to CONFIG, scope might be win32 which may only be in CONFIG under windows. + if ( m_part->isQt4Project() ) + addToPlusOp( "CONFIG", QStringList( scopename ) ); + */ + Scope* simpleScope = new Scope( m_environment, getNextScopeNum(), this, ast, m_defaultopts, m_part ); + + if( simpleScope->scopeType() != Scope::InvalidScope ) + { + m_scopes.insert( getNextScopeNum(), simpleScope ); + return simpleScope; + }else + delete simpleScope; + return 0; + +} + +Scope* Scope::createIncludeScope( const QString& includeFile, bool negate ) +{ + if ( !m_root ) + return 0; + + Scope* funcScope; + if ( negate ) + { + funcScope = createFunctionScope( "!include", includeFile ); + } + else + { + funcScope = createFunctionScope( "include", includeFile ); + } + if( funcScope == 0 ) + return 0; + + QMake::IncludeAST* ast = new QMake::IncludeAST(); + ast->setDepth( m_root->depth() ); + ast->projectName = includeFile; + Scope* incScope = new Scope( m_environment, funcScope->getNextScopeNum(), funcScope, ast, projectDir(), resolveVariables( ast->projectName ), m_defaultopts, m_part ); + if ( incScope->scopeType() != InvalidScope ) + { + funcScope->m_root->addChildAST( ast ); + funcScope->m_scopes.insert( funcScope->getNextScopeNum(), incScope ); + return funcScope; + } + else + { + deleteFunctionScope( m_scopes.keys().last() ); + delete incScope; + } + return 0; + +} + +Scope* Scope::createSubProject( const QString& projname ) +{ + if( !m_root ) + return 0; + + if( variableValuesForOp( "SUBDIRS", "-=").findIndex( projname ) != -1 ) + removeFromMinusOp( "SUBDIRS", projname ); + + QString realprojname = resolveVariables(projname); + + if( variableValuesForOp( "SUBDIRS", "-=").findIndex( realprojname ) != -1 ) + removeFromMinusOp( "SUBDIRS", realprojname ); + + QDir curdir( projectDir() ); + + if ( variableValues("TEMPLATE").findIndex( "subdirs" ) != -1 ) + { + QString filename; + if( !realprojname.endsWith(".pro") ) + { + if ( !curdir.exists( realprojname ) ) + if ( !curdir.mkdir( realprojname ) ) + return 0; + curdir.cd( realprojname ); + QStringList entries = curdir.entryList("*.pro", QDir::Files); + + if ( !entries.isEmpty() && entries.findIndex( curdir.dirName()+".pro" ) == -1 ) + filename = curdir.absPath() + QString(QChar(QDir::separator()))+entries.first(); + else + filename = curdir.absPath() + QString(QChar(QDir::separator()))+curdir.dirName()+".pro"; + }else + filename = curdir.absPath() + QString(QChar(QDir::separator())) + realprojname; + + kdDebug( 9024 ) << "Creating subproject with filename:" << filename << endl; + + Scope* s = new Scope( m_environment, getNextScopeNum(), this, filename, m_part ); + s->loadDefaultOpts(); + if ( s->scopeType() != InvalidScope ) + { + if( s->variableValues("TEMPLATE").isEmpty() ) + s->setEqualOp("TEMPLATE", QStringList("app")); + s->saveToFile(); + addToPlusOp( "SUBDIRS", QStringList( realprojname ) ); + m_scopes.insert( getNextScopeNum(), s ); + return s; + } else + { + delete s; + } + } + + return 0; +} + +bool Scope::deleteFunctionScope( unsigned int num ) +{ + if ( !m_root || !m_scopes.contains( num ) ) + return false; + + Scope* funcScope = m_scopes[ num ]; + if ( funcScope ) + { + QMake::AST* ast = m_root->m_children[ m_root->m_children.findIndex( funcScope->m_root ) ]; + if( !ast ) + return false; + m_scopes.remove( num ); + m_root->removeChildAST( funcScope->m_root ); + delete funcScope; + delete ast; + return true; + } + return false; +} + +bool Scope::deleteSimpleScope( unsigned int num ) +{ + if ( !m_root || !m_scopes.contains( num ) ) + return false; + + Scope* simpleScope = m_scopes[ num ]; + if ( simpleScope ) + { + QMake::AST* ast = m_root->m_children[ m_root->m_children.findIndex( simpleScope->m_root ) ]; + if( !ast ) + return false; + m_scopes.remove( num ); + removeFromPlusOp( "CONFIG", simpleScope->m_root->scopedID ); + m_root->removeChildAST( simpleScope->m_root ); + delete simpleScope; + delete ast; + return true; + } + return false; +} + +bool Scope::deleteIncludeScope( unsigned int num ) +{ + if ( !m_root || !m_scopes.contains( num ) ) + return false; + + Scope * incScope = m_scopes[ num ]; + if( !incScope ) + return false; + QMake::AST* ast = incScope->m_incast; + if( !ast ) + return false; + m_scopes.remove( num ); + m_root->removeChildAST( incScope->m_incast); + delete incScope; + delete ast; + + return m_parent->deleteFunctionScope( getNum() ); +} + +bool Scope::deleteSubProject( unsigned int num, bool deleteSubdir ) +{ + if ( !m_root || !m_scopes.contains( num ) ) + return false; + + QValueList<QMake::AST*>::iterator it = findExistingVariable( "TEMPLATE" ); + if ( it != m_root->m_children.end() ) + { + QMake::AssignmentAST * tempast = static_cast<QMake::AssignmentAST*>( *it ); + if ( tempast->values.findIndex( "subdirs" ) != -1 || findExistingVariable( "TEMPLATE" ) != m_root->m_children.end() ) + { + Scope* project = m_scopes[ num ]; + if( !project ) + return false; + + QString projdir = project->scopeName(); + if ( deleteSubdir ) + { + QDir projdir = QDir( projectDir() ); + QString dir = project->scopeName(); + if( !dir.endsWith(".pro") ) + { + QDir subdir = QDir( projectDir() + QString( QChar( QDir::separator() ) ) + dir ); + if ( subdir.exists() ) + { + QStringList entries = subdir.entryList(); + for ( QStringList::iterator eit = entries.begin() ; eit != entries.end() ; ++eit ) + { + if( *eit == "." || *eit == ".." ) + continue; + if( !subdir.remove( *eit ) ) + kdDebug( 9024 ) << "Couldn't delete " << *eit << " from " << subdir.absPath() << endl; + } + if( !projdir.rmdir( dir ) ) + kdDebug( 9024 ) << "Couldn't delete " << dir << " from " << projdir.absPath() << endl; + } + }else + { + QDir d( project->projectDir() ); + kdDebug(9024) << "removed subproject?:" << d.remove( dir ) << endl; + } + } + QValueList<QMake::AST*>::iterator foundit = findExistingVariable( "SUBDIRS" ); + if ( foundit != m_root->m_children.end() ) + { + QMake::AssignmentAST * ast = static_cast<QMake::AssignmentAST*>( *foundit ); + updateValues( ast->values, QStringList( projdir ), true, ast->indent ); + if( m_varCache.contains( "SUBDIRS" ) ) + m_varCache.erase( "SUBDIRS" ); + }else + return false; + m_scopes.remove( num ); + delete project; + return true; + } + } + return false; +} + +void Scope::updateValues( QStringList& origValues, const QStringList& newValues, bool remove, QString indent ) +{ + if( !m_root ) + return; + + for ( QStringList::const_iterator it = newValues.begin(); it != newValues.end() ; ++it ) + { + if ( origValues.findIndex( *it ) == -1 && !remove ) + { + while ( !origValues.isEmpty() && origValues.last() == getLineEndingString() ) + origValues.pop_back(); + if ( origValues.count() > 0 && !containsContinue( origValues.last() ) && !isComment( origValues.last() ) ) + { + origValues.append( " " ); + origValues.append( "\\"+getLineEndingString() ); + if( indent != "" ) + origValues.append( indent ); + }else if ( !origValues.isEmpty() && containsContinue( origValues.last() ) && !isComment( origValues.last() ) ) + { + if( indent != "" ) + origValues.append( indent ); + }else if ( !origValues.isEmpty() && isComment( origValues.last() ) ) + { + origValues[origValues.count()-1] = "\\ "+origValues[origValues.count()-1]; + if( indent != "" ) + origValues.append( indent ); + }else if ( origValues.isEmpty() ) + origValues.append(" "); + QString newval = *it; + QRegExp re("([^$])\\$([^$\\(\\)\\{\\} /]*)( |\\)|/)"); + newval.replace(re, "\\1$(\\2)\\3"); + if( (newval).contains(" ") || (newval).contains("\t") || (newval).contains( getLineEndingString() ) || (newval).contains("#") ) + origValues.append( "\""+newval+"\"" ); + else + origValues.append( newval ); + origValues.append( getLineEndingString() ); + } else if ( origValues.findIndex( *it ) != -1 && remove ) + { + QStringList::iterator posit = origValues.find( *it ); + posit = origValues.remove( posit ); + while( posit != origValues.end() && ( (*posit).find( QRegExp("\\\\[\\s]*"+getLineEndingString() ) ) != -1 + || (*posit).stripWhiteSpace() == "" ) ) + { + posit = origValues.remove( posit ); + } + } + } + while( !origValues.isEmpty() && (origValues.last() == "\\"+getLineEndingString() + || origValues.last() == getLineEndingString() + || origValues.last().stripWhiteSpace() == "" ) && !origValues.isEmpty() ) + origValues.pop_back(); + if( !origValues.isEmpty() && origValues.last().find( QRegExp("\\\\[ \t]*#") ) != -1 ) + origValues[origValues.count()-1] = origValues[origValues.count()-1].mid(origValues[origValues.count()-1].find( "#") ); + if( !origValues.isEmpty() && origValues.last().find( getLineEndingString() ) == -1 ) + origValues.append(getLineEndingString()); +} + +void Scope::updateVariable( const QString& variable, const QString& op, const QStringList& values, bool removeFromOp ) +{ + if ( !m_root || listIsEmpty( values ) ) + return ; + + if( m_varCache.contains( variable ) ) + m_varCache.erase( variable ); + + for ( int i = m_root->m_children.count() - 1; i >= 0; --i ) + { + if ( m_root->m_children[ i ] ->nodeType() == QMake::AST::AssignmentAST ) + { + QMake::AssignmentAST * assignment = static_cast<QMake::AssignmentAST*>( m_root->m_children[ i ] ); + if ( assignment->scopedID == variable && Scope::isCompatible( assignment->op, op ) ) + { + updateValues( assignment->values, values, removeFromOp, assignment->indent ); + if ( removeFromOp && listIsEmpty( assignment->values ) ) + { + m_root->removeChildAST( assignment ); + delete assignment; + } + return ; + } + else if ( assignment->scopedID == variable && !Scope::isCompatible( assignment->op, op ) ) + { + for ( QStringList::const_iterator it = values.begin() ; it != values.end() ; ++it ) + { + if ( op == "+=" && !removeFromOp && assignment->values.findIndex( *it ) != -1 ) + { + if ( assignment->op == "=" ) + { + updateValues( assignment->values, values, false, assignment->indent ); + return ; + } + else if ( assignment->op == "-=" ) + { + updateValues( assignment->values, QStringList( *it ), true, assignment->indent ); + if ( listIsEmpty( assignment->values ) ) + { + m_root->removeChildAST( assignment ); + delete assignment; + break; + } + } + } + else if ( op == "-=" && !removeFromOp && assignment->values.findIndex( *it ) != -1 ) + { + updateValues( assignment->values, QStringList( *it ), true, assignment->indent ); + if ( listIsEmpty( assignment->values ) ) + { + m_root->removeChildAST( assignment ); + delete assignment; + break; + } + } + else if ( op == "=" ) + { + if ( !removeFromOp ) + { + m_root->removeChildAST( assignment ); + delete assignment; + } + else if ( assignment->op == "+=" && assignment->values.findIndex( *it ) != -1 ) + { + updateValues( assignment->values, QStringList( *it ), true, assignment->indent ); + if ( listIsEmpty( assignment->values ) ) + { + m_root->removeChildAST( assignment ); + delete assignment; + break; + } + } + } + } + } + } + } + + if ( !removeFromOp ) + { + QMake::AssignmentAST * ast = new QMake::AssignmentAST(); + ast->scopedID = variable; + ast->op = op; + updateValues( ast->values, values ); + if( scopeType() == ProjectScope ) + ast->setDepth( m_root->depth() ); + else + ast->setDepth( m_root->depth()+1 ); + m_root->addChildAST( ast ); + if ( values.findIndex( getLineEndingString() ) == -1 ) + { + ast->values.append( getLineEndingString() ); + } + } +} + +QValueList<QMake::AST*>::iterator Scope::findExistingVariable( const QString& variable ) +{ + QValueList<QMake::AST*>::iterator it; + QStringList ops; + ops << "=" << "+="; + + for ( it = m_root->m_children.begin(); it != m_root->m_children.end() ; ++it ) + { + if ( ( *it ) ->nodeType() == QMake::AST::AssignmentAST ) + { + QMake::AssignmentAST * assignment = static_cast<QMake::AssignmentAST*>( *it ); + if ( assignment->scopedID == variable && ops.findIndex( assignment->op ) != -1 ) + { + return it; + } + } + } + return m_root->m_children.end(); +} + +void Scope::init() +{ + if( !m_root ) + return; + + kdDebug(9024) << "Initializing Scope: " << scopeName() << this << endl; + m_maxCustomVarNum = 1; + + QValueList<QMake::AST*>::const_iterator it; + for ( it = m_root->m_children.begin(); it != m_root->m_children.end(); ++it ) + { + if ( ( *it ) ->nodeType() == QMake::AST::ProjectAST ) + { + QMake::ProjectAST * p = static_cast<QMake::ProjectAST*>( *it ); + m_scopes.insert( getNextScopeNum(), new Scope( m_environment, getNextScopeNum(), this, p, m_defaultopts, m_part ) ); + } + else if ( ( *it ) ->nodeType() == QMake::AST::IncludeAST ) + { + QMake::IncludeAST * i = static_cast<QMake::IncludeAST*>( *it ); + QString filename = i->projectName; + if( i->projectName.stripWhiteSpace().startsWith("$") ) + { + filename = resolveVariables(i->projectName, *it); + } + m_scopes.insert( getNextScopeNum(), new Scope( m_environment, getNextScopeNum(), this, i, projectDir(), filename, m_defaultopts, m_part ) ); + } + else if ( ( *it ) ->nodeType() == QMake::AST::AssignmentAST ) + { + QMake::AssignmentAST * m = static_cast<QMake::AssignmentAST*>( *it ); + // Check wether TEMPLATE==subdirs here too! + if ( m->scopedID == "SUBDIRS" && variableValues("TEMPLATE").findIndex("subdirs") != -1 ) + { + for ( QStringList::const_iterator sit = m->values.begin() ; sit != m->values.end(); ++sit ) + { + QString str = *sit; + if ( containsContinue( str ) || isComment( str ) || str == getLineEndingString() || str == "." || str == "./" || (str).stripWhiteSpace() == "" ) + continue; + QDir subproject; + QString projectfile; + kdDebug(9024) << "reading subproject: " << str << endl; + if( str.startsWith("$") ) + str = resolveVariables(str, *it); + if( str.endsWith(".pro") ) + { + subproject = QDir( projectDir(), "*.pro", QDir::Name | QDir::IgnoreCase, QDir::Files ); + projectfile = str; + }else + { + QString dir = str; + if( QFileInfo( dir ).isRelative() ) + dir = projectDir() + QString( QChar( QDir::separator() ) ) + dir; + subproject = QDir( dir, + "*.pro", QDir::Name | QDir::IgnoreCase, QDir::Files ); + if( !subproject.exists() ) + { + kdDebug(9024) << "Project Dir doesn't exist, trying to find name.subdir variable:" << str << endl; + if( !variableValues(str+".subdir").isEmpty() ) + { + kdDebug(9024) << "Found name.subdir variable for " << str << endl; + subproject = QDir( projectDir() + QString( QChar( QDir::separator() ) ) + + variableValues(str+".subdir").first(), + "*.pro", QDir::Name | QDir::IgnoreCase, QDir::Files ); + }else + continue; + } + if ( subproject.entryList().isEmpty() || subproject.entryList().findIndex( str + ".pro" ) != -1 ) + projectfile = (str) + ".pro"; + else + projectfile = subproject.entryList().first(); + + } + kdDebug( 9024 ) << "Parsing subproject: " << projectfile << endl; + m_scopes.insert( getNextScopeNum(), new Scope( m_environment, getNextScopeNum(), this, + subproject.absFilePath( projectfile ), + m_part, ( m->op != "-=" )) ); + } + } + else + { + if ( !( + KnownVariables.findIndex( m->scopedID ) != -1 + && ( m->op == "=" || m->op == "+=" || m->op == "-=") + ) + && !( + ( m->scopedID.contains( ".files" ) || m->scopedID.contains( ".path" ) ) + && variableValues("INSTALLS").findIndex(m->scopedID.left( m->scopedID.findRev(".") != -1 ) ) + ) + && !( + ( m->scopedID.contains( ".subdir" ) ) + && variableValues("SUBDIRS").findIndex(m->scopedID.left( m->scopedID.findRev(".") != -1 ) ) + ) + ) + { + m_customVariables[ m_maxCustomVarNum++ ] = m; + } + } + } + } +} + +QString Scope::projectName() const +{ + if( !m_root ) + return ""; + + return QFileInfo( projectDir() ).fileName(); +} + +QString Scope::projectDir() const +{ + if( !m_root ) + return ""; + if ( m_root->isProject() ) + { + return QFileInfo( m_root->fileName() ).dirPath( true ); + } + else + { + return m_parent->projectDir(); + } +} + +const QMap<unsigned int, QMap<QString, QString> > Scope::customVariables() const +{ + QMap<unsigned int, QMap<QString, QString> > result; + if( !m_root ) + return result; + + QMap<unsigned int, QMake::AssignmentAST*>::const_iterator it = m_customVariables.begin(); + for ( ; it != m_customVariables.end(); ++it ) + { + QMap<QString,QString> temp; + temp[ "var" ] = it.data()->scopedID; + temp[ "op" ] = it.data()->op; + temp[ "values" ] = it.data()->values.join("").stripWhiteSpace(); + result[ it.key() ] = temp; + } + return result; +} + +void Scope::updateCustomVariable( unsigned int id, const QString& name, const QString& newop, const QString& newvalues ) +{ + if( !m_root ) + return; + if ( id > 0 && m_customVariables.contains( id ) ) + { + m_customVariables[ id ] ->values.clear(); + updateValues( m_customVariables[ id ] ->values, newvalues.stripWhiteSpace() ); + if( m_varCache.contains( m_customVariables[ id ]->scopedID ) ) + m_varCache.erase( m_customVariables[ id ]->scopedID ); + m_customVariables[ id ] ->op = newop; + m_customVariables[ id ] ->scopedID = name; + } +} + +unsigned int Scope::addCustomVariable( const QString& var, const QString& op, const QString& values ) +{ + QMake::AssignmentAST* newast = new QMake::AssignmentAST(); + newast->scopedID = var; + newast->op = op; + newast->values.append(values.stripWhiteSpace()); + if( scopeType() == ProjectScope ) + newast->setDepth( m_root->depth() ); + else + newast->setDepth( m_root->depth()+1 ); + m_root->addChildAST( newast ); + m_customVariables[ m_maxCustomVarNum++ ] = newast; + return (m_maxCustomVarNum-1); +} + +void Scope::removeCustomVariable( unsigned int id ) +{ + if( m_customVariables.contains(id) ) + { + QMake::AssignmentAST* m = m_customVariables[id]; + m_customVariables.remove(id); + m_root->m_children.remove( m ); + } +} + +bool Scope::isVariableReset( const QString& var ) +{ + bool result = false; + if( !m_root ) + return result; + QValueList<QMake::AST*>::const_iterator it = m_root->m_children.begin(); + for ( ; it != m_root->m_children.end(); ++it ) + { + if ( ( *it ) ->nodeType() == QMake::AST::AssignmentAST ) + { + QMake::AssignmentAST * ast = static_cast<QMake::AssignmentAST*>( *it ); + if ( ast->scopedID == var && ast->op == "=" ) + { + result = true; + break; + } + } + } + return result; +} + +void Scope::removeVariable( const QString& var, const QString& op ) +{ + if ( !m_root ) + return ; + + QMake::AssignmentAST* ast = 0; + + QValueList<QMake::AST*>::iterator it = m_root->m_children.begin(); + for ( ; it != m_root->m_children.end(); ++it ) + { + if ( ( *it ) ->nodeType() == QMake::AST::AssignmentAST ) + { + ast = static_cast<QMake::AssignmentAST*>( *it ); + if ( ast->scopedID == var && ast->op == op ) + { + m_root->m_children.remove( ast ); + it = m_root->m_children.begin(); + } + } + } +} + +bool Scope::listIsEmpty( const QStringList& values ) +{ + if ( values.size() < 1 ) + return true; + for ( QStringList::const_iterator it = values.begin(); it != values.end(); ++it ) + { + if ( ( *it ).stripWhiteSpace() != "" && ( *it ).stripWhiteSpace() != "\\" ) + return false; + } + return true; +} + +bool Scope::isCompatible( const QString& op1, const QString& op2) +{ + if( op1 == "+=" ) + return ( op2 == "+=" || op2 == "=" ); + else if ( op1 == "-=" ) + return ( op2 == "-=" ); + else if ( op1 == "=" ) + return ( op2 == "=" || op2 == "+=" ); + return false; +} + +bool Scope::listsEqual(const QStringList& l1, const QStringList& l2) +{ + QStringList left = l1; + QStringList right = l2; +// left.sort(); +// right.sort(); + return (left == right); +} + +QStringList Scope::cleanStringList(const QStringList& list) const +{ + QStringList result; + for( QStringList::const_iterator it = list.begin(); it != list.end(); ++it ) + { + QString s = *it; + if( s.stripWhiteSpace() != "" + && !containsContinue(s) + && s.stripWhiteSpace() != getLineEndingString() + && !isComment(s) ) + result.append(s); + } + return result; +} + +bool Scope::isQt4Project() const +{ + return m_part->isQt4Project(); +} + +void Scope::reloadProject() +{ + if ( !m_root || !m_root->isProject() ) + return; + + QString filename = m_root->fileName(); + QMap<unsigned int, Scope*>::iterator it; + for ( it = m_scopes.begin() ; it != m_scopes.end() ; ++it ) + { + Scope* s = it.data(); + delete s; + } + m_scopes.clear(); + + m_customVariables.clear(); + + m_varCache.clear(); + + if ( m_root->isProject() ) + delete m_root; + if ( !loadFromFile( filename ) && !QFileInfo( filename ).exists() ) + { + m_root = new QMake::ProjectAST(); + m_root->setFileName( filename ); + } + init(); +} + +Scope* Scope::disableSubproject( const QString& dir) +{ + if( !m_root || ( m_root->isProject() && !m_incast ) ) + return 0; + + if( scopeType() != Scope::IncludeScope && variableValuesForOp( "SUBDIRS", "+=").findIndex( dir ) != -1 ) + removeFromPlusOp( "SUBDIRS", dir ); + else if( scopeType() != Scope::IncludeScope ) + removeFromPlusOp( "SUBDIRS", dir ); + + QDir curdir( projectDir() ); + + if ( variableValues("TEMPLATE").findIndex( "subdirs" ) != -1 ) + { + curdir.cd(dir); + QString filename; + QStringList entries = curdir.entryList("*.pro", QDir::Files); + + if ( !entries.isEmpty() && entries.findIndex( curdir.dirName()+".pro" ) != -1 ) + filename = curdir.absPath() + QString(QChar(QDir::separator()))+entries.first(); + else + filename = curdir.absPath() + QString(QChar(QDir::separator()))+curdir.dirName()+".pro"; + + kdDebug( 9024 ) << "Disabling subproject with filename:" << filename << endl; + + Scope* s = new Scope( m_environment, getNextScopeNum(), this, filename, m_part, false ); + addToMinusOp( "SUBDIRS", QStringList( dir ) ); + m_scopes.insert( getNextScopeNum(), s ); + return s; + } + + return 0; +} + +QString Scope::resolveVariables( const QString& value ) const +{ + return resolveVariables(QStringList(value), 0).front(); +} + + +QString Scope::resolveVariables( const QString& value, QMake::AST* stopHere ) const +{ + return resolveVariables(QStringList(value), stopHere).front(); +} + +QStringList Scope::variableValues( const QString& variable, QMake::AST* stopHere, bool fetchFromParent ) const +{ + QStringList result; + + if ( !m_root ) + return result; + + calcValuesFromStatements( variable, result, true, stopHere, fetchFromParent ); + result = cleanStringList(result); + return result; +} + +QStringList Scope::resolveVariables( const QStringList& values, QMake::AST* stopHere ) const +{ + QStringList result = values; + QMap<QString, QStringList> variables; + for( QStringList::iterator it = result.begin(); it != result.end(); ++it ) + { + QRegExp re("\\$\\$([^{}\\) /]*)( |\\)|/|$)"); + int pos = 0; + while( pos >= 0 ) + { + pos = re.search( (*it), pos ); + if( pos > -1 ) + { + if( !variables.contains( re.cap(1) ) ) + { + variables[re.cap(1)] = resolveVariables( variableValues( re.cap(1), stopHere ) ); + if( variables[re.cap(1)].isEmpty() && re.cap(1) == "TARGET" ) + { + variables[re.cap(1)] = QFileInfo( fileName() ).baseName(); + } + } + pos += re.matchedLength(); + } + } + re = QRegExp("\\$\\$\\{([^\\)\\}]*)\\}"); + pos = 0; + while( pos >= 0 ) + { + pos = re.search( (*it), pos ); + if( pos > -1 ) + { + if( !variables.contains( re.cap(1) ) ) + { + variables[re.cap(1)] = resolveVariables( variableValues( re.cap(1), stopHere ) ); + if( variables[re.cap(1)].isEmpty() && re.cap(1) == "TARGET" ) + { + variables[re.cap(1)] = QFileInfo( fileName() ).baseName(); + } + } + pos += re.matchedLength(); + } + } + re = QRegExp("\\$\\$\\(([^\\)\\}]*)\\)"); + pos = 0; + QMap<QString, QString> envvars; + while( pos >= 0 ) + { + pos = re.search( (*it), pos ); + if( pos > -1 ) + { + if( !envvars.contains( re.cap(1) ) ) + if( m_environment.contains( re.cap(1) ) != -1 ) + envvars[re.cap(1)] = m_environment[ re.cap(1) ]; + else if ( ::getenv( re.cap(1).local8Bit() ) != 0 ) + envvars[re.cap(1)] = QString::fromLocal8Bit( ::getenv( re.cap(1).local8Bit() ) ); + pos += re.matchedLength(); + } + } + for( QMap<QString, QString>::const_iterator it2 = envvars.begin(); it2 != envvars.end(); ++it2 ) + { + (*it).replace("$$("+it2.key()+")", it2.data() ); + } + for( QMap<QString, QStringList>::const_iterator it2 = variables.begin(); it2 != variables.end(); ++it2 ) + { + for( QStringList::const_iterator it3 = it2.data().begin(); it3 != it2.data().end(); ++it3 ) + { + (*it).replace("$$"+it2.key(), *it3 ); + (*it).replace("$${"+it2.key()+"}", *it3 ); + } + } + } + return result; +} + +void Scope::allFiles( const QString& projectDirectory, std::set<QString>& res ) +{ + + QString myRelPath = URLUtil::getRelativePath( projectDirectory, projectDir() ); + QString file; + QStringList values; + QString header = ""; + if( variableValues("TEMPLATE",false ).findIndex("subdirs") == -1 ) + { + values = variableValues( "INSTALLS" ,false, false ); + QStringList::const_iterator it; + for ( it = values.begin(); it != values.end(); ++it ) + { + if ( ( *it ) == "target" ) + continue; + + QStringList files = variableValues( *it + ".files" ,false, false ); + QStringList::iterator filesit = files.begin(); + for ( ;filesit != files.end(); ++filesit ) + { + file = myRelPath + QString(QChar(QDir::separator())) + *filesit; + file = resolveVariables( file ); + if( file.contains("*") ) + { + QFileInfo fi( projectDirectory + QString( QChar( QDir::separator() ) ) + file ); + QDir absDir = fi.dir( true ); + absDir.setNameFilter( fi.fileName() ); + absDir.setFilter( QDir::Files | QDir::Readable | QDir::NoSymLinks ); + QStringList list = absDir.entryList(); + for( QStringList::const_iterator it = list.begin(); it != list.end(); ++it ) + { + res.insert( QDir::cleanDirPath( URLUtil::getRelativePath( projectDirectory, absDir.path()+QString( QChar( QDir::separator() ) )+*it ) ) ); + } + } + else + { + res.insert( QDir::cleanDirPath( file ) ); + } + } + } + + values = variableValues( "LEXSOURCES" ,false, false ); + for ( it = values.begin(); it != values.end(); ++it ) + { + file = myRelPath + QString(QChar(QDir::separator())) + *it; + file = resolveVariables( file ); + res.insert( QDir::cleanDirPath( file ) ); + } + + values = variableValues( "YACCSOURCES" ,false, false ); + for ( it = values.begin(); it != values.end(); ++it ) + { + file = myRelPath + QString(QChar(QDir::separator())) + *it; + file = resolveVariables( file ); + res.insert( QDir::cleanDirPath( file ) ); + } + + values = variableValues( "DISTFILES" ,false, false ); + for ( it = values.begin(); it != values.end(); ++it ) + { + file = myRelPath + QString(QChar(QDir::separator())) + *it; + file = resolveVariables( file ); + if( file.contains("*") ) + { + QFileInfo fi( projectDirectory + QString( QChar( QDir::separator() ) ) + file ); + QDir absDir = fi.dir( true ); + absDir.setNameFilter( fi.fileName() ); + absDir.setFilter( QDir::Files | QDir::Readable | QDir::NoSymLinks ); + QStringList list = absDir.entryList(); + for( QStringList::const_iterator it = list.begin(); it != list.end(); ++it ) + { + res.insert( QDir::cleanDirPath( URLUtil::getRelativePath( projectDirectory, absDir.path()+QString( QChar( QDir::separator() ) )+*it ) ) ); + } + } + else + { + res.insert( QDir::cleanDirPath( file ) ); + } + } + + if ( isQt4Project() ) + { + values = variableValues( "RESOURCES" ,false, false ); + for ( it = values.begin(); it != values.end(); ++it ) + { + file = myRelPath + QString(QChar(QDir::separator())) + *it; + file = resolveVariables( file ); + res.insert( QDir::cleanDirPath( file ) ); + } + } + values = variableValues( "IMAGES" ,false, false ); + for ( it = values.begin(); it != values.end(); ++it ) + { + file = myRelPath + QString(QChar(QDir::separator())) + *it; + file = resolveVariables( file ); + res.insert( QDir::cleanDirPath( file ) ); + } + + values = variableValues( "TRANSLATIONS" ,false, false ); + for ( it = values.begin(); it != values.end(); ++it ) + { + file = myRelPath + QString(QChar(QDir::separator())) + *it; + file = resolveVariables( file ); + res.insert( QDir::cleanDirPath( file ) ); + } + + values = variableValues( "IDLS" ,false, false ); + for ( it = values.begin(); it != values.end(); ++it ) + { + file = myRelPath + QString(QChar(QDir::separator())) + *it; + file = resolveVariables( file ); + res.insert( QDir::cleanDirPath( file ) ); + } + + if ( m_part->isTMakeProject() ) + { + values = variableValues( "INTERFACES" ,false, false ); + for ( it = values.begin(); it != values.end(); ++it ) + { + file = myRelPath + QString(QChar(QDir::separator())) + *it; + file = resolveVariables( file ); + res.insert( QDir::cleanDirPath( file ) ); + if( QFileInfo(projectDir()+QString(QChar(QDir::separator())) + *it+".h").exists() ) + res.insert( QDir::cleanDirPath( file+".h" ) ); + } + } + else + { + values = variableValues( "FORMS" ,false, false ); + for ( it = values.begin(); it != values.end(); ++it ) + { + file = myRelPath + QString(QChar(QDir::separator())) + *it; + file = resolveVariables( file ); + res.insert( QDir::cleanDirPath( file ) ); + + if( !m_part->isQt4Project()) + { + header = projectDir()+QString(QChar(QDir::separator())) + *it+".h"; + if( QFileInfo(header).exists() ) + res.insert( QDir::cleanDirPath( header ) ); + header = projectDir()+QString(QChar(QDir::separator())) + *it+".cpp"; + if( QFileInfo(header).exists() ) + res.insert( QDir::cleanDirPath( header ) ); + } + else + { + header = projectDir()+QString(QChar(QDir::separator())) + "ui_" +*it; + header.replace(QRegExp("\\.ui$"),".h"); + if( QFileInfo(header).exists() ) + res.insert( QDir::cleanDirPath( header ) ); + } + } + } + + values = variableValues( "SOURCES" ,false, false ); + kdDebug(9024) << "scope:" << scopeType() << " found values: " << values << endl; + for ( it = values.begin(); it != values.end(); ++it ) + { + file = myRelPath + QString(QChar(QDir::separator())) + *it; + file = resolveVariables( file ); + res.insert( QDir::cleanDirPath( file ) ); + } + + values = variableValues( "HEADERS" ,false, false ); + for ( it = values.begin(); it != values.end(); ++it ) + { + file = myRelPath + QString(QChar(QDir::separator())) + *it; + file = resolveVariables( file ); + res.insert( QDir::cleanDirPath( file ) ); + } + } + QMap<unsigned int, Scope*>::const_iterator it = m_scopes.begin(); + for( ; it != m_scopes.end(); ++it ) + { + it.data()->allFiles( projectDirectory, res ); + } +} + +QStringList Scope::allFiles( const QString& projectDir ) +{ + QStringList result; + std::set<QString> files; + allFiles( projectDir, files ); + for( std::set<QString>::const_iterator it = files.begin(); it != files.end() ; ++it ) + result.append( *it ); + kdDebug(9024) << "all files: " << result << endl; + return result; +} + +QString Scope::findCustomVarForPath( const QString& path ) +{ + QString result; + if( !m_root ) + return result; + + QMap<unsigned int, QMake::AssignmentAST*>::const_iterator it = m_customVariables.begin(); + for( ; it != m_customVariables.end(); ++it ) + { + kdDebug(9024) << "Checking " << path << " against " << cleanStringList(it.data()->values) << endl; + if( !it.data()->values.isEmpty() && cleanStringList(it.data()->values).front() == path ) + { + return it.data()->scopedID; + } + } + if( scopeType() != ProjectScope ) + { + return parent()->findCustomVarForPath( path ); + } + return result; +} + +void Scope::loadDefaultOpts() +{ + if( !m_defaultopts && m_root ) + { + m_defaultopts = new QMakeDefaultOpts(); + if( DomUtil::readBoolEntry( *m_part->projectDom(), "/kdevtrollproject/qmake/disableDefaultOpts", true ) ) + { + m_defaultopts->readVariables( m_part->qmakePath(), QFileInfo( m_root->fileName() ).dirPath( true ) ); + } + } +} + +QString Scope::getLineEndingString() const +{ + + if( scopeType() == ProjectScope ) + { + switch( m_root->lineEnding() ) + { + case QMake::ProjectAST::Windows: + return QString("\r\n"); + break; + case QMake::ProjectAST::MacOS: + return QString("\r"); + break; + case QMake::ProjectAST::Unix: + return QString("\n"); + break; + } + }else if( m_parent ) + { + return m_parent->getLineEndingString(); + } + return "\n"; +} + +QString Scope::replaceWs(QString s) +{ + return s.replace( getLineEndingString(), "%nl").replace("\t", "%tab").replace(" ", "%spc"); +} + +bool Scope::containsContinue(const QString& s ) const +{ + return( s.find( QRegExp( "\\\\\\s*"+getLineEndingString() ) ) != -1 + || s.find( QRegExp( "\\\\\\s*#" ) ) != -1 ); +} + +bool Scope::isComment( const QString& s) const +{ + return s.startsWith("#"); +} + +#ifdef DEBUG +void Scope::printTree() +{ + PrintAST p; + p.processProject(m_root); +} + +Scope::PrintAST::PrintAST() : QMake::ASTVisitor() +{ + indent = 0; +} + +void Scope::PrintAST::processProject( QMake::ProjectAST* p ) +{ + QMake::ASTVisitor::processProject(p); +} + +void Scope::PrintAST::enterRealProject( QMake::ProjectAST* p ) +{ + kdDebug(9024) << getIndent() << "--------- Entering Project: " << replaceWs(p->fileName()) << " --------------" << endl; + indent += 4; + QMake::ASTVisitor::enterRealProject(p); +} + +void Scope::PrintAST::leaveRealProject( QMake::ProjectAST* p ) +{ + indent -= 4; + kdDebug(9024) << getIndent() << "--------- Leaving Project: " << replaceWs(p->fileName()) << " --------------" << endl; + QMake::ASTVisitor::leaveRealProject(p); +} + +void Scope::PrintAST::enterScope( QMake::ProjectAST* p ) +{ + kdDebug(9024) << getIndent() << "--------- Entering Scope: " << replaceWs(p->scopedID) << " --------------" << endl; + indent += 4; + QMake::ASTVisitor::enterScope(p); +} + +void Scope::PrintAST::leaveScope( QMake::ProjectAST* p ) +{ + indent -= 4; + kdDebug(9024) << getIndent() << "--------- Leaving Scope: " << replaceWs(p->scopedID) << " --------------" << endl; + QMake::ASTVisitor::leaveScope(p); +} + +void Scope::PrintAST::enterFunctionScope( QMake::ProjectAST* p ) +{ + kdDebug(9024) << getIndent() << "--------- Entering FunctionScope: " << replaceWs(p->scopedID) << "(" << replaceWs(p->args) << ")"<< " --------------" << endl; + indent += 4; + QMake::ASTVisitor::enterFunctionScope(p); +} + +void Scope::PrintAST::leaveFunctionScope( QMake::ProjectAST* p ) +{ + indent -= 4; + kdDebug(9024) << getIndent() << "--------- Leaving FunctionScope: " << replaceWs(p->scopedID) << "(" << replaceWs(p->args) << ")"<< " --------------" << endl; + QMake::ASTVisitor::leaveFunctionScope(p); +} + +QString Scope::PrintAST::replaceWs(QString s) +{ + return s.replace("\n", "%nl").replace("\t", "%tab").replace(" ", "%spc"); +} + +void Scope::PrintAST::processAssignment( QMake::AssignmentAST* a) +{ + kdDebug(9024) << getIndent() << "Assignment: " << replaceWs(a->scopedID) << " " << replaceWs(a->op) << " " + << replaceWs(a->values.join("|"))<< endl; + QMake::ASTVisitor::processAssignment(a); +} + +void Scope::PrintAST::processNewLine( QMake::NewLineAST* n) +{ + kdDebug(9024) << getIndent() << "Newline " << endl; + QMake::ASTVisitor::processNewLine(n); +} + +void Scope::PrintAST::processComment( QMake::CommentAST* a) +{ + kdDebug(9024) << getIndent() << "Comment: " << replaceWs(a->comment) << endl; + QMake::ASTVisitor::processComment(a); +} + +void Scope::PrintAST::processInclude( QMake::IncludeAST* a) +{ + kdDebug(9024) << getIndent() << "Include: " << replaceWs(a->projectName) << endl; + QMake::ASTVisitor::processInclude(a); +} + +QString Scope::PrintAST::getIndent() +{ + QString ind; + for( int i = 0 ; i < indent ; i++) + ind += " "; + return ind; +} +#endif + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on diff --git a/buildtools/qmake/scope.h b/buildtools/qmake/scope.h new file mode 100644 index 00000000..e8f40eb9 --- /dev/null +++ b/buildtools/qmake/scope.h @@ -0,0 +1,308 @@ +/*************************************************************************** +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef _SCOPE_H_ +#define _SCOPE_H_ + +#include <qstring.h> +#include <qstringlist.h> +#include <qmap.h> +#include <set> + +#include "qmakeast.h" +#include "qmakedefaultopts.h" + +#ifdef DEBUG +#include "qmakeastvisitor.h" +#endif + +class Scope; +class TrollProjectPart; + +class Scope +{ +public: + + enum ScopeType { + ProjectScope, + FunctionScope, + SimpleScope, + IncludeScope, + InvalidScope + }; + static const QStringList KnownVariables; + static const QStringList KnownConfigValues; + + Scope( const QMap<QString, QString>& env, const QString &filename, TrollProjectPart* part ); + ~Scope(); + + void saveToFile() const; + + // Changing variable values + void addToPlusOp( const QString& variable, const QStringList& values ); + void removeFromPlusOp( const QString& variable, const QStringList& values ); + void addToMinusOp( const QString& variable, const QStringList& values ); + void removeFromMinusOp( const QString& variable, const QStringList& values ); + void addToEqualOp( const QString& variable, const QStringList& values ); + void removeFromEqualOp( const QString& variable, const QStringList& values ); + void setPlusOp( const QString& variable, const QStringList& values ); + void setEqualOp( const QString& variable, const QStringList& values ); + void setMinusOp( const QString& variable, const QStringList& values ); + + // Checks wether a line like VAR = exists in this subscope + bool isVariableReset( const QString& var ); + + // Fetch the valuelist for the variable op combination inside this scope + QStringList variableValuesForOp( const QString& variable, const QString& op ) const; + + // Fetch the variable values by running over the statements and adding/removing/setting + // as the encountered op's say, begin with the parent projects variableValues list + QStringList variableValues( const QString& variable, bool checkIncParent = true, bool fetchFromParent = true, bool evaluateSubScopes = false ); + + // Remove a variable+Op combination from the scope, if existant + void removeVariable( const QString& var, const QString& op ); + + // Getting to know what type of scope this is + ScopeType scopeType() const; + + // This returns the function+args, the scopename or the pro/pri file + // depending on the type of scope + QString scopeName() const; + + // Returns the projectName for this scope, this is equal to the last part of the projectDir() + QString projectName() const; + + // Returns just the filename of this project's .pro file + QString fileName() const; + + // Returns the absolute path of the dir containing the .pro file + QString projectDir() const; + + // get the parent Scope + Scope* parent() const { return m_parent; } + + // Fetching sub-scopes + const QValueList<Scope*> scopesInOrder() const { return m_scopes.values(); } + // Working on SubScopes + /* + * creates a new function scope at the end of this (Sub-)AST and returns the Scope wrapping it + */ + Scope* createFunctionScope( const QString& funcName, const QString& args ); + /* + * creates a new simple scope at the end of this (Sub-)AST and returns the Scope wrapping it + */ + Scope* createSimpleScope( const QString& scopename ); + + /* + * creates a new function scope at the end of this (Sub-)AST + * and a new include scope inside the new function scope. + * It returns the Scope wrapping the include-AST, the function scope AST + * can be accessed easily using the parent() method. + */ + Scope* createIncludeScope( const QString& includeFile, bool negate = false ); + + /* + * creates a new subproject in dir (create's dir if necessary) + * If this scope is not a project scope the subproject will be added to this + * Scope only, i.e. it is not seen in the project-files list of subdirs + */ + Scope* createSubProject( const QString& dir ); + + /* delete the given function scope */ + bool deleteFunctionScope( unsigned int ); + /* delete the given simple scope */ + bool deleteSimpleScope( unsigned int ); + /* delete the given include scope */ + bool deleteIncludeScope( unsigned int ); + /* deletes the subproject (including the subdir if deleteSubdir is true) */ + bool deleteSubProject( unsigned int, bool deleteSubdir ); + + /* find out wether the project is Qt4 or Qt3 */ + bool isQt4Project() const ; + + /* Provide a Map of Custom variables */ + const QMap<unsigned int, QMap<QString, QString> > customVariables() const; + + unsigned int addCustomVariable( const QString& var, const QString& op, const QString& values ); + + /* Removes the variable with the given id if it exists */ + void removeCustomVariable( unsigned int ); + + /* Update the values of the variable/operation combo var+op to values */ + void updateCustomVariable( unsigned int, const QString&, const QString& , const QString& ); + + // Checks wether a QStringList contains any values that are not whitespace or \\n + static bool listIsEmpty( const QStringList& values ); + + /* returns wether this is an enabled subproject or a disabled one */ + bool isEnabled() { return m_isEnabled; } + + QStringList cleanStringList(const QStringList& list) const; + + /* Reload a project scope */ + void reloadProject(); + + /* creates a new disabled Scope child and add SUBDIRS -= dir to this scope */ + Scope* disableSubproject( const QString& ); + + /* return the "position" of this scope in the list of scopes */ + unsigned int getNum() { return m_num; } + + QStringList allFiles( const QString& ); + + QString resolveVariables( const QString& ) const; + + QString findCustomVarForPath( const QString& ); + +#ifdef DEBUG + void printTree(); +#endif + +private: + + // Builds the scope-lists and the customVariables list + void init(); + + /* + * Updates the given Variable+op with the values, if removeFromOp is true it removes the values, else it adds them + * this works it's way back through the current scope and changes the last occurence of op to + * include all new values. + * + * Depending on "op" it might end the search earlier (if op is += it also stops at =) + * + * This also removes the values from other assignments if the operation is not op, i.e. + * if op is += removes values from any occurence of -= + * if op is -= removes values from any occurence of = and += + * if op is = removes values frmo any occurence of -= + */ + void updateVariable( const QString& variable, const QString& op, const QStringList& values, bool removeFromOp ); + + /* + * Helper Function to change the origValues list with the values from newValues + * depending on the state of "remove" either adds or removes all entries from newValues + * to origValues if they didn't exist there yet + */ + void updateValues( QStringList& origValues, const QStringList& newValues, bool remove = false, QString indent = " " ); + + /* + * Finds an existing variable, returns the end() of the statemenst if it is not found + */ + QValueList<QMake::AST*>::iterator findExistingVariable( const QString& variable ); + + // Private constructors for easier subscope creation + /* + * just initializes the lists from the scope + */ + Scope( const QMap<QString, QString>& env, unsigned int num, Scope* parent, QMake::ProjectAST* root, QMakeDefaultOpts*, TrollProjectPart* part ); + /* + * reads the given filename and parses it. If it doesn't exist creates an empty + * ProjectAST with the given filename + */ + Scope( const QMap<QString, QString>& env, unsigned int num, Scope* parent, const QString& filename, TrollProjectPart* part, bool isEnabled = true ); + /* + * Creates a scope for an include statement, parses the file and initializes the Scope + * Create an empty ProjectAST if the file cannot be found or parsed. + */ + Scope( const QMap<QString, QString>& env, unsigned int num, Scope* parent, QMake::IncludeAST* incast, const QString& path, const QString& incfile, QMakeDefaultOpts*, TrollProjectPart* part ); + + + // runs through the statements until stopHere is found (or the end is reached, if stopHere is 0), + // using the given list as startvalue + // Changes the list using the +=, -=, = operations accordingly + void calcValuesFromStatements( const QString& variable, QStringList& result, bool, QMake::AST* stopHere = 0, bool fetchFromParent = true, bool setDefault = true, bool evaluateSubScopes = false ) const; + + // Check wether the two operators are compatible + static bool isCompatible( const QString& op1, const QString& op2); + + // Check wether the 2 lists are equal, regardless of element order. + static bool listsEqual(const QStringList& , const QStringList& ); + + // Load and Save project files, these only work on ProjectScope's + bool loadFromFile( const QString& filename ); + + QString funcScopeKey( QMake::ProjectAST* funcast ) const { return funcast->scopedID + "(" + funcast->args + ")"; } + + unsigned int getNextScopeNum() { if( m_scopes.isEmpty() ) return 0; else return (m_scopes.keys().last()+1); } + + QStringList lookupVariable( const QString& var ); + + QStringList resolveVariables( const QStringList&, QMake::AST* = 0 ) const; + QStringList variableValues( const QString& variable, QMake::AST*, bool fetchFromParent = true ) const; + QString resolveVariables( const QString& , QMake::AST* ) const; + + // This function determines the currently used String for fileending, it can be \n, \r or \r\n + QString getLineEndingString() const; + bool isComment( const QString& ) const; + bool containsContinue( const QString& ) const; + void allFiles( const QString&, std::set<QString>& ); + + void loadDefaultOpts(); + + QMake::ProjectAST* m_root; + QMake::IncludeAST* m_incast; + QMap<unsigned int, QMake::AssignmentAST*> m_customVariables; + QMap<unsigned int, Scope*> m_scopes; + Scope* m_parent; + unsigned int m_maxCustomVarNum; + + QString replaceWs(QString); + + + // The "position" inside the parent scope that this scope starts at + unsigned int m_num; + bool m_isEnabled; + TrollProjectPart* m_part; + QMakeDefaultOpts* m_defaultopts; + QMap<QString, QStringList> m_varCache; + QMap<QString,QString> m_environment; + +#ifdef DEBUG + class PrintAST : QMake::ASTVisitor + { + + public: + PrintAST(); + virtual void processProject( QMake::ProjectAST* p ); + virtual void enterRealProject( QMake::ProjectAST* p ); + + virtual void leaveRealProject( QMake::ProjectAST* p ); + + virtual void enterScope( QMake::ProjectAST* p ); + + virtual void leaveScope( QMake::ProjectAST* p ); + + virtual void enterFunctionScope( QMake::ProjectAST* p ); + + virtual void leaveFunctionScope( QMake::ProjectAST* p ); + + virtual void processAssignment( QMake::AssignmentAST* a); + + virtual void processNewLine( QMake::NewLineAST* n); + + virtual void processComment( QMake::CommentAST* a); + + virtual void processInclude( QMake::IncludeAST* a); + + QString replaceWs(QString); + + private: + QString getIndent(); + int indent; + + }; +#endif + +}; + +#endif + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on + diff --git a/buildtools/qmake/trolllistview.cpp b/buildtools/qmake/trolllistview.cpp new file mode 100644 index 00000000..531bb3e8 --- /dev/null +++ b/buildtools/qmake/trolllistview.cpp @@ -0,0 +1,38 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * adymo@mksat.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "trolllistview.h" + + +TrollListView::TrollListView(TrollProjectWidget *widget, QWidget *parent, + TrollProjectWidget::TrollProjectView view, const char *name) + :KListView(parent, name), m_widget(widget), m_view(view) +{ +} + +TrollListView::~TrollListView() +{ +} + +void TrollListView::focusOutEvent( QFocusEvent */* e*/ ) +{ + m_widget->setLastFocusedView(m_view); +} + +#include "trolllistview.moc" diff --git a/buildtools/qmake/trolllistview.h b/buildtools/qmake/trolllistview.h new file mode 100644 index 00000000..0ee86abb --- /dev/null +++ b/buildtools/qmake/trolllistview.h @@ -0,0 +1,41 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * adymo@mksat.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef TROLLLISTVIEW_H +#define TROLLLISTVIEW_H + +#include <klistview.h> + +#include "trollprojectwidget.h" + +class TrollListView : public KListView +{ +Q_OBJECT +public: + TrollListView(TrollProjectWidget *widget, QWidget *parent, TrollProjectWidget::TrollProjectView view, const char *name = 0); + ~TrollListView(); +protected: + virtual void focusOutEvent(QFocusEvent *e); + +private: + TrollProjectWidget *m_widget; + TrollProjectWidget::TrollProjectView m_view; +}; + +#endif diff --git a/buildtools/qmake/trollprojectpart.cpp b/buildtools/qmake/trollprojectpart.cpp new file mode 100644 index 00000000..6d2f5b3a --- /dev/null +++ b/buildtools/qmake/trollprojectpart.cpp @@ -0,0 +1,931 @@ +/*************************************************************************** + * Copyright (C) 2003 by Thomas Hasart * + * thasart@gmx.de * + * Copyright (C) 2001-2002 by Bernd Gehrmann * + * bernd@kdevelop.org * + * Copyright (C) 2002 by Jakob Simon-Gaarde * + * jakob@jsg.dk * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "trollprojectpart.h" + +#include <qdir.h> +#include <qfileinfo.h> +#include <qwhatsthis.h> +#include <kdeversion.h> +#include <kdebug.h> +#include <kdialogbase.h> +#include <kiconloader.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <kdirwatch.h> +#include <kstatusbar.h> +#include <qmessagebox.h> +#include <kdevgenericfactory.h> +#include <kaction.h> +#include <kparts/part.h> +#include <kprocess.h> +#include <kconfig.h> +#include <kapplication.h> +#include <kurlrequesterdlg.h> +#include <kurlrequester.h> +#include <kurlcompletion.h> +#include <kfile.h> +#include <makeoptionswidget.h> + + +#include "domutil.h" +#include "kdevcore.h" +#include "kdevmainwindow.h" +#include "kdevmakefrontend.h" +#include "kdevappfrontend.h" +#include "kdevpartcontroller.h" +#include "trollprojectwidget.h" +#include "runoptionswidget.h" +#include "config.h" +#include "envvartools.h" +#include "qmakeoptionswidget.h" +#include "scope.h" + +#include <kdevplugininfo.h> +#include <urlutil.h> + +typedef KDevGenericFactory<TrollProjectPart> TrollProjectFactory; +static const KDevPluginInfo data("kdevtrollproject"); +K_EXPORT_COMPONENT_FACTORY( libkdevtrollproject, TrollProjectFactory( data ) ) + +TrollProjectPart::TrollProjectPart(QObject *parent, const char *name, const QStringList& args ) + : KDevBuildTool(&data, parent, name ? name : "TrollProjectPart") +{ + setInstance(TrollProjectFactory::instance()); + + if ( args.count() == 1 && args[0] == "TMake" ) + m_tmakeProject = true; + else + m_tmakeProject = false; + + setXMLFile("kdevtrollproject.rc"); + + m_executeProjectAfterBuild = false; + m_executeTargetAfterBuild = false; + + m_dirWatch = new KDirWatch(this); + + m_widget = new TrollProjectWidget(this); + m_widget->setIcon(SmallIcon("qmakerun")); + m_widget->setCaption(i18n("QMake Manager")); + QWhatsThis::add(m_widget, i18n("<b>QMake manager</b><p>" + "The QMake manager project tree consists of two parts. The 'overview' " + "in the upper half shows the subprojects, each one having a " + ".pro file. The 'details' view in the lower half shows the " + "list of files for the active subproject selected in the overview.")); + + mainWindow()->embedSelectViewRight(m_widget, i18n("QMake Manager"), i18n("QMake manager")); + + KAction *action; + + const QIconSet icon(SmallIcon("compfile")); + action = new KAction( i18n("Compile &File"), "compfile", 0, + m_widget, SLOT(slotBuildOpenFile()), + actionCollection(),"build_compilefile" ); + action->setToolTip(i18n("Compile file")); + action->setWhatsThis(i18n("<b>Compile file</b><p>Runs <b>make filename.o</b> command from the directory where 'filename' is the name of currently opened file.<br>" + "Environment variables and make arguments can be specified " + "in the project settings dialog, <b>Make Options</b> tab.")); + + + action = new KAction( i18n("&Build Project"), "make_kdevelop", Key_F8, + m_widget, SLOT(slotBuildProject()), + actionCollection(), "build_build_project" ); + action->setToolTip(i18n("Build project")); + action->setWhatsThis(i18n("<b>Build project</b><p>Runs <b>make</b> from the project directory.<br>" + "Environment variables and make arguments can be specified " + "in the project settings dialog, <b>Make Options</b> tab.")); + + action = new KAction( i18n("&Rebuild Project"),"rebuild" , 0, + m_widget, SLOT(slotRebuildProject()), + actionCollection(),"build_rebuild_project" ); + action->setToolTip(i18n("Rebuild project")); + action->setWhatsThis(i18n("<b>Rebuild project</b><p>Runs <b>make clean</b> and then <b>make</b> from the project directory.<br>" + "Environment variables and make arguments can be specified " + "in the project settings dialog, <b>Make Options</b> tab.")); + + action = new KAction( i18n("&Install Project"),"install" , 0, + m_widget, SLOT(slotInstallProject()), + actionCollection(),"build_install_project" ); + action->setToolTip(i18n("Install project")); + action->setWhatsThis(i18n("<b>Install project</b><p>Runs <b>make install</b> from the project directory.<br>" + "Environment variables and make arguments can be specified " + "in the project settings dialog, <b>Make Options</b> tab.")); + + action = new KAction( i18n("&Clean Project"), 0, + m_widget, SLOT(slotCleanProject()), + actionCollection(), "build_clean_project" ); + action->setToolTip(i18n("Clean project")); + action->setWhatsThis(i18n("<b>Clean project</b><p>Runs <b>make clean</b> command from the project directory.<br>" + "Environment variables and make arguments can be specified " + "in the project settings dialog, <b>Make Options</b> tab.")); + + action = new KAction( i18n("&Dist-Clean Project"), 0, + m_widget, SLOT(slotDistCleanProject()), + actionCollection(), "build_distclean_project" ); + action->setToolTip(i18n("Dist-Clean project")); + action->setWhatsThis(i18n("<b>Dist-Clean project</b><p>Runs <b>make distclean</b> command from the " + "project directory.<br>Environment variables and make arguments can be specified " + "in the project settings dialog, <b>Make Options</b> tab.")); + + action = new KAction( i18n("Execute Main Program"), "exec", SHIFT+Key_F9, + this, SLOT(slotBuildAndExecuteProject()), + actionCollection(), "build_execute_project" ); + action->setToolTip(i18n("Execute main program")); + action->setWhatsThis(i18n("<b>Execute program</b><p>Executes the currently selected subproject if it is an application or the program specified in project settings, <b>Run Options</b> tab.")); + + action = new KAction( i18n("&Build Subproject"), "make_kdevelop", Key_F7, + m_widget, SLOT(slotBuildTarget()), + actionCollection(), "build_build_target" ); + action->setToolTip(i18n("Build subproject")); + action->setWhatsThis(i18n("<b>Build subproject</b><p>Runs <b>make</b> from the current subproject directory. " + "Current subproject is a subproject selected in <b>QMake manager</b> 'overview' window.<br>" + "Environment variables and make arguments can be specified " + "in the project settings dialog, <b>Make Options</b> tab.")); + + action = new KAction( i18n("&Rebuild Subproject"), "rebuild", 0, + m_widget, SLOT(slotRebuildTarget()), + actionCollection(),"build_rebuild_target" ); + action->setToolTip(i18n("Rebuild subproject")); + action->setWhatsThis(i18n("<b>Rebuild subproject</b><p>Runs <b>make clean</b> and then <b>make</b> from the current subproject directory. " + "Current subproject is a subproject selected in <b>QMake manager</b> 'overview' window.<br>" + "Environment variables and make arguments can be specified " + "in the project settings dialog, <b>Make Options</b> tab.")); + + action = new KAction( i18n("&Install Subproject"), "install", 0, + m_widget, SLOT(slotInstallTarget()), + actionCollection(),"build_install_target" ); + action->setToolTip(i18n("Install subproject")); + action->setWhatsThis(i18n("<b>Install subproject</b><p>Runs <b>make install</b> from the current subproject directory. " + "The current subproject is the subproject selected in the <b>QMake manager</b> 'overview' window.<br>" + "Environment variables and make arguments can be specified " + "in the project settings dialog, <b>Make Options</b> tab.")); + + action = new KAction( i18n("&Clean Subproject"), 0, + m_widget, SLOT(slotCleanTarget()), + actionCollection(), "build_clean_target" ); + action->setToolTip(i18n("Clean subproject")); + action->setWhatsThis(i18n("<b>Clean subproject</b><p>Runs <b>make clean</b> from the current subproject directory. " + "The current subproject is the subproject selected in the <b>QMake manager</b> 'overview' window.<br>" + "Environment variables and make arguments can be specified " + "in the project settings dialog, <b>Make Options</b> tab.")); + + action = new KAction( i18n("&Dist-Clean Subproject"), 0, + m_widget, SLOT(slotDistCleanTarget()), + actionCollection(), "build_distclean_target" ); + action->setToolTip(i18n("Dist-Clean subproject")); + action->setWhatsThis(i18n("<b>Dist-Clean subproject</b><p>Runs <b>make distclean</b> from the current" + " subproject directory. The current subproject is the subproject selected in the <b>QMake manager</b> 'overview' window.<br>" + "Environment variables and make arguments can be specified " + "in the project settings dialog, <b>Make Options</b> tab.")); + + action = new KAction( i18n("Execute Subproject"), "exec", 0, + this, SLOT(slotBuildAndExecuteTarget()), + actionCollection(), "build_execute_target" ); + action->setToolTip(i18n("Execute subproject")); + action->setWhatsThis(i18n("<b>Execute subproject</b><p>Executes the target program for the currently selected subproject. " + "This action is allowed only if a type of the subproject is 'application'. The type of the subproject can be " + "defined in <b>Subproject Settings</b> dialog (open it from the subproject context menu).")); + + connect( core(), SIGNAL(projectConfigWidget(KDialogBase*)), + this, SLOT(projectConfigWidget(KDialogBase*)) ); + + connect( makeFrontend(), SIGNAL(commandFinished(const QString&)), + this, SLOT(slotCommandFinished(const QString&)) ); + + QString m_defaultQtDir = DomUtil::readEntry(*projectDom(), "/kdevcppsupport/qt/root", ""); + QString m_qmakePath = DomUtil::readEntry(*projectDom(), "/kdevcppsupport/qt/qmake", ""); + QString qtversion = DomUtil::readEntry(*projectDom(), "/kdevcppsupport/qt/version", "3"); + + if( m_defaultQtDir.isEmpty() || !isValidQtDir( m_defaultQtDir ) ) + { + m_defaultQtDir = findQtDir(); + kdDebug(9024) << "Setting default dir to: " << m_defaultQtDir << endl; + DomUtil::writeEntry(*projectDom(), "/kdevcppsupport/qt/root", m_defaultQtDir ); + } + if( m_qmakePath.isEmpty() || !isExecutable( m_qmakePath ) ) + { + m_qmakePath = findExecutable( "qmake-qt"+qtversion ); + if( m_qmakePath.isEmpty() || !isExecutable( m_qmakePath ) ) + m_qmakePath = findExecutable( "qmake" ); + kdDebug(9024) << "Setting qmake binary to: " << m_qmakePath << endl; + DomUtil::writeEntry(*projectDom(), "/kdevcppsupport/qt/qmake", m_qmakePath ); + } +} + + +TrollProjectPart::~TrollProjectPart() +{ + if (m_widget) + mainWindow()->removeView(m_widget); + delete m_widget; +} + +QString TrollProjectPart::makeEnvironment() +{ + // Get the make environment variables pairs into the environstr string + // in the form of: "ENV_VARIABLE=ENV_VALUE" + // Note that we quote the variable value due to the possibility of + // embedded spaces + DomUtil::PairList envvars = + DomUtil::readPairListEntry(*projectDom(), "/kdevtrollproject/make/envvars", "envvar", "name", "value"); + + QString environstr; + DomUtil::PairList::ConstIterator it; + bool hasQtDir = false; + for (it = envvars.begin(); it != envvars.end(); ++it) { + if( (*it).first == "QTDIR" ) + hasQtDir = true; + + environstr += (*it).first; + environstr += "="; + environstr += EnvVarTools::quote((*it).second); + environstr += " "; + } + + if( !hasQtDir && !isQt4Project() && !DomUtil::readEntry(*projectDom(), "/kdevcppsupport/qt/root", "").isEmpty() ) + { + environstr += QString( "QTDIR=" ) + EnvVarTools::quote( DomUtil::readEntry(*projectDom(), "/kdevcppsupport/qt/root", "") ) + QString( " PATH=$QTDIR/bin:$PATH " ); + } + + KConfigGroup grp( kapp->config(), "MakeOutputView" ); + if( grp.readBoolEntry( "ForceCLocale", true ) ) + environstr += "LC_MESSAGES="+EnvVarTools::quote("C")+" "+" "+"LC_CTYPE="+EnvVarTools::quote("C")+" "; + + return environstr; +} + +void TrollProjectPart::projectConfigWidget(KDialogBase *dlg) +{ + QVBox *vbox; + vbox = dlg->addVBoxPage(i18n("Run Options"), i18n("Run Options"), BarIcon( "make", KIcon::SizeMedium )); + RunOptionsWidget *optdlg = new RunOptionsWidget(*projectDom(), "/kdevtrollproject", buildDirectory(), vbox); + + vbox = dlg->addVBoxPage(i18n("Make Options"), i18n("Make Options"), BarIcon( "make", KIcon::SizeMedium )); + MakeOptionsWidget *w4 = new MakeOptionsWidget(*projectDom(), "/kdevtrollproject", vbox); + + vbox = dlg->addVBoxPage(i18n("QMake Manager"), i18n("QMake Manager"), BarIcon( "make", KIcon::SizeMedium )); + QMakeOptionsWidget *qm = new QMakeOptionsWidget( projectDirectory(), *projectDom(), "/kdevtrollproject", vbox); + + + connect( dlg, SIGNAL(okClicked()), w4, SLOT(accept()) ); + connect( dlg, SIGNAL(okClicked()), qm, SLOT(accept()) ); + connect( dlg, SIGNAL(okClicked()), optdlg, SLOT(accept()) ); +} + + +void TrollProjectPart::openProject(const QString &dirName, const QString &projectName) +{ + mainWindow()->statusBar()->message( i18n("Loading Project...") ); + + QString defaultQtDir = DomUtil::readEntry(*projectDom(), "/kdevcppsupport/qt/root", ""); + if( !isQt4Project() && ( defaultQtDir.isEmpty() || !isValidQtDir( defaultQtDir ) ) ) + { + bool doask = true; + while( doask ) + { + KURLRequesterDlg dlg( i18n("Choose Qt3 directory"), + i18n("Choose the Qt3 directory to use. This directory needs to have an include directory containing qt.h.") + , m_widget, 0); + dlg.urlRequester() ->setMode( KFile::Directory | KFile::LocalOnly ); + dlg.urlRequester() ->setURL( QString::null ); + dlg.urlRequester() ->completionObject() ->setDir( "/" ); + + if ( dlg.exec() == QDialog::Accepted && !dlg.urlRequester() ->url().isEmpty() ) + { + QString qtdir = dlg.urlRequester()->url(); + if( !isValidQtDir( qtdir ) ) + { + if( KMessageBox::warningYesNo( m_widget, + i18n("The directory you gave is not a proper Qt directory, the " + "project might not work properly without one.\nPlease make " + "sure you give a directory that contains a bin with the " + "qmake binary in it and for Qt3 project also contains an " + "include directory with qt.h in it.\nDo you want to try " + "setting a Qt directory again?"), + i18n("Wrong Qt directory given")) + == KMessageBox::Yes + ) + doask = true; + else + doask = false; + }else + { + defaultQtDir = qtdir; + doask = false; + } + + }else + { + if( KMessageBox::warningYesNo( m_widget, + i18n("You did not specify a Qt directory, and the project might not " + "work properly without one.\nDo you want to try setting a Qt" + " directory again?"), + i18n("No Qt directory given")) + == KMessageBox::Yes + ) + doask = true; + else + doask = false; + } + } + } + QString qmakePath = DomUtil::readEntry(*projectDom(), "/kdevcppsupport/qt/qmake", ""); + if( qmakePath.isEmpty() || !isExecutable( qmakePath ) ) + { + bool doask = true; + while( doask ) + { + KURLRequesterDlg dlg( i18n("Choose QMake executable"), + i18n("Choose the QMake binary to use. QMake is used to generate Makefiles from the project files."), m_widget, 0); + dlg.urlRequester() ->setMode( KFile::Directory | KFile::LocalOnly ); + dlg.urlRequester() ->setURL( QString::null ); + dlg.urlRequester() ->completionObject() ->setDir( "/" ); + + if ( dlg.exec() == QDialog::Accepted && !dlg.urlRequester() ->url().isEmpty() ) + { + QString qmake = dlg.urlRequester()->url(); + if( !isExecutable( qmake ) ) + { + if( KMessageBox::warningYesNo( m_widget, + i18n("The binary you gave is not executable, the " + "project might not work properly.\nPlease make " + "sure you give a qmake binary that is executable.\nDo you want to try " + "setting the QMake binary again?"), + i18n("Wrong QMake binary given")) + == KMessageBox::Yes + ) + doask = true; + else + doask = false; + }else + { + qmakePath = qmake; + doask = false; + } + + }else + { + if( KMessageBox::warningYesNo( m_widget, + i18n("You did not specify a QMake binary, and the project might not " + "work properly without one.\nDo you want to try setting a QMake" + " binary again?"), + i18n("No QMake binary given")) + == KMessageBox::Yes + ) + doask = true; + else + doask = false; + } + } + } + DomUtil::writeEntry( *projectDom(), "/kdevcppsupport/qt/root", defaultQtDir ); + DomUtil::writeEntry( *projectDom(), "/kdevcppsupport/qt/qmake", qmakePath ); + + m_projectName = projectName; + + m_widget->openProject(dirName); + + + QDomDocument &dom = *projectDom(); + // Set the default directory radio to "executable" + if (DomUtil::readEntry(dom, "/kdevtrollproject/run/directoryradio") == "" ) { + DomUtil::writeEntry(dom, "/kdevtrollproject/run/directoryradio", "executable"); + } + + KDevProject::openProject( dirName, projectName ); +} + + +void TrollProjectPart::closeProject() +{ + m_widget->closeProject(); +} + + +QString TrollProjectPart::projectDirectory() const +{ + return m_widget->projectDirectory(); +} + + +QString TrollProjectPart::buildDirectory() const +{ + return m_widget->projectDirectory(); +} + +QString TrollProjectPart::projectName() const +{ + return m_projectName; +} + + +/** Retuns a PairList with the run environment variables */ +DomUtil::PairList TrollProjectPart::runEnvironmentVars() const +{ + return DomUtil::readPairListEntry(*projectDom(), "/kdevtrollproject/run/envvars", "envvar", "name", "value"); +} + +void TrollProjectPart::slotBuildAndExecuteProject() +{ + partController()->saveAllFiles(); + if (isDirty()) { + m_executeProjectAfterBuild = true; + m_widget->slotBuildProject(); + } else + m_widget->slotExecuteProject(); +} + +void TrollProjectPart::slotBuildAndExecuteTarget() +{ + partController()->saveAllFiles(); + if (isDirty()) { + m_executeTargetAfterBuild = true; + m_widget->slotBuildTarget(); + } else + m_widget->slotExecuteTarget(); +} + + +/** Retuns the currently selected run directory + * The returned string can be: + * if run/directoryradio == executable + * The directory where the executable is + * if run/directoryradio == build + * The directory where the executable is relative to build directory + * if run/directoryradio == custom + * The custom directory absolute path + */ +QString TrollProjectPart::runDirectory() const +{ + QDomDocument &dom = *projectDom(); + + QString cwd; + if( DomUtil::readBoolEntry(dom, "/kdevtrollproject/run/useglobalprogram", true) ) + { + cwd = defaultRunDirectory("kdevtrollproject"); + }else + { + QString name = m_widget->getCurrentOutputFilename(); + if( name.findRev("/") != -1 ) + name = name.right( name.length()-name.findRev("/")-1 ); + cwd = DomUtil::readEntry( dom, "/kdevtrollproject/run/cwd/" + name ); + } + if( cwd.isEmpty() ) + { + QString destpath = m_widget->getCurrentTarget(); + if( QDir::isRelativePath( destpath ) ) + { + destpath = m_widget->subprojectDirectory() + QString( QChar( QDir::separator() ) ) + destpath; + } + destpath = destpath.left( destpath.findRev("/") ); + cwd = destpath; + } + + return cwd; +} + + +/** Retuns the currently selected main program + * The returned string can be: + * if run/directoryradio == executable + * The executable name + * if run/directoryradio == build + * The path to executable relative to build directory + * if run/directoryradio == custom or relative == false + * The absolute path to executable + */ + + +QString TrollProjectPart::mainProgram() const +{ + + QDomDocument &dom = *projectDom(); + + if( DomUtil::readBoolEntry(dom, "/kdevtrollproject/run/useglobalprogram", false) ) + { + QString DomMainProgram = DomUtil::readEntry(dom, "/kdevtrollproject/run/mainprogram"); + + if ( DomMainProgram.isEmpty() ) return QString(); + + if ( DomMainProgram.startsWith("/") ) // assume absolute path + { + return DomMainProgram; + } + else // assume project relative path + { + return projectDirectory() + "/" + DomMainProgram; + } + }else + { + if( !m_widget->currentSubproject()) + { + KMessageBox::error( m_widget, "There's no selected subproject!\n" + "Unable to determine the main program", "No selected subproject found" ); + kdDebug ( 9020 ) << k_funcinfo << "Error! : There's no active target! -> Unable to determine the main program in TrollProjectPart::mainProgram()" << endl; + return QString::null; + } + + if ( m_widget->currentSubproject()->scope->variableValues("TEMPLATE").findIndex("app") == -1 ) + { + KMessageBox::error( m_widget, "Selected Subproject \""+m_widget->currentSubproject()->scope->projectName()+"\"isn't binary ( " + m_widget->currentSubproject()->scope->variableValues("TEMPLATE").join(" ") + " ) !\n" + "Unable to determine the main program. If you want this\n" + "to be the selected subproject, set a main program under\n" + "Project -> Project Options -> Run Options", "Selected subproject is not a library" ); + kdDebug ( 9020 ) << k_funcinfo << "Error! : Active target isn't binary (" << m_widget->currentSubproject()->scope->variableValues("TEMPLATE").join(" ") << ") ! -> Unable to determine the main program in TrollProjectPart::mainProgram()" << endl; + return QString::null; + } + + QString destpath = m_widget->getCurrentTarget(); + if( QDir::isRelativePath( destpath ) ) + { + destpath = m_widget->subprojectDirectory() + QString( QChar( QDir::separator() ) ) + destpath; + } + return destpath; + } +} + +QString TrollProjectPart::debugArguments() const +{ + if( DomUtil::readBoolEntry(*projectDom(), "/kdevtrollproject/run/useglobalprogram", true ) ) + { + return DomUtil::readEntry(*projectDom(), "/kdevtrollproject/run/globaldebugarguments"); + }else + { + return DomUtil::readEntry(*projectDom(), "/kdevtrollproject/run/debugarguments/"+m_widget->getCurrentOutputFilename() ); + } +} + +/** Retuns a QString with the run command line arguments */ +QString TrollProjectPart::runArguments() const +{ + if( DomUtil::readBoolEntry(*projectDom(), "/kdevtrollproject/run/useglobalprogram", true) ) + { + return DomUtil::readEntry(*projectDom(), "/kdevtrollproject/run/programargs"); + }else + { + return DomUtil::readEntry(*projectDom(), "/kdevtrollproject/run/runarguments/"+m_widget->getCurrentOutputFilename() ); + } +} + + +QString TrollProjectPart::activeDirectory() const +{ + QDomDocument &dom = *projectDom(); + + return DomUtil::readEntry(dom, "/kdevtrollproject/general/activedir"); +} + + +QStringList TrollProjectPart::allFiles() const +{ + return m_widget->allFiles(); +} + + +void TrollProjectPart::addFile(const QString &fileName) +{ + QStringList fileList; + fileList.append ( fileName ); + + this->addFiles ( QStringList( fileName ) ); +} + +void TrollProjectPart::addFiles ( const QStringList &fileList ) +{ + QStringList files = fileList; + for (QStringList::iterator it = files.begin(); it != files.end(); ++it) + { + if( !QFileInfo( *it ).isRelative() ) + { + *it = URLUtil::relativePathToFile( projectDirectory(), *it ); + } + } + m_widget->addFiles(files); + +} + +void TrollProjectPart::removeFile(const QString & /* fileName */) +{ + /// \FIXME +/* QStringList fileList; + fileList.append ( fileName ); + + this->removeFiles ( fileList );*/ +} + +void TrollProjectPart::removeFiles ( const QStringList& fileList ) +{ +/// \FIXME missing remove files functionality +// QStringList::ConstIterator it; +// +// it = fileList.begin(); +// +// for ( ; it != fileList.end(); ++it ) +// { +// FIXME +// } + + emit removedFilesFromProject ( fileList ); +} +/* +void TrollProjectPart::startMakeCommand(const QString &dir, const QString &target) +{ + partController()->saveAllFiles(); + + QFileInfo fi(dir + "/Makefile"); + if (!fi.exists()) { + int r = KMessageBox::questionYesNo(m_widget, i18n("There is no Makefile in this directory. Run qmake first?"), QString::null, i18n("Run qmake"), i18n("Do Not Run")); + if (r == KMessageBox::No) + return; + startQMakeCommand(dir); + } + QDomDocument &dom = *projectDom(); + + if (target=="clean") + { + QString cmdline = DomUtil::readEntry(dom, "/kdevtrollproject/make/makebin"); + if (cmdline.isEmpty()) + cmdline = MAKE_COMMAND; + cmdline += " clean"; + QString dircmd = "cd "; + dircmd += dir; + dircmd += " && "; + cmdline.prepend(makeEnvironment()); + makeFrontend()->queueCommand(dir, dircmd + cmdline); + } + + QString cmdline = DomUtil::readEntry(dom, "/kdevtrollproject/make/makebin"); + if (cmdline.isEmpty()) + cmdline = MAKE_COMMAND; + if (!DomUtil::readBoolEntry(dom, "/kdevtrollproject/make/abortonerror")) + cmdline += " -k"; + int jobs = DomUtil::readIntEntry(dom, "/kdevtrollproject/make/numberofjobs"); + if (jobs != 0) { + cmdline += " -j"; + cmdline += QString::number(jobs); + } + if (DomUtil::readBoolEntry(dom, "/kdevtrollproject/make/dontact")) + cmdline += " -n"; + + cmdline += " "; + cmdline += target; + + QString dircmd = "cd "; + dircmd += dir; + dircmd += " && "; + + cmdline.prepend(makeEnvironment()); + makeFrontend()->queueCommand(dir, dircmd + cmdline); +} +*/ + +void TrollProjectPart::startQMakeCommand(const QString &dir, bool recursive) +{ + QFileInfo fi(dir); + QString cmdline; + + if ( isTMakeProject() ) + { + cmdline = "tmake "; + }else + { + cmdline = DomUtil::readEntry(*projectDom(), "/kdevcppsupport/qt/qmake", "")+" "; + } + + if(isQt4Project() && recursive) + { + cmdline += " -recursive "; + } + + //QString cmdline = QString::fromLatin1( isTMakeProject() ? "tmake " : "qmake " ); +// cmdline += fi.baseName() + ".pro"; + QDir d(dir); + QStringList l = d.entryList("*.pro"); + + if( l.isEmpty() || ( l.count() && l.findIndex( projectName() + ".pro" ) != -1 ) ) + cmdline += projectName()+".pro"; + else if( l.isEmpty() || (l.count() && l.findIndex( fi.baseName() + ".pro" ) != -1 ) ) + cmdline += fi.baseName() + ".pro"; + else + cmdline += l[0]; + +// cmdline += QString::fromLatin1( " -o Makefile" ); + + QString dircmd = "cd "; + dircmd += KProcess::quote(dir); + dircmd += " && "; + + cmdline.prepend(makeEnvironment()); + makeFrontend()->queueCommand(dir, dircmd + cmdline); +} + +void TrollProjectPart::queueCmd(const QString &dir, const QString &cmd) +{ + makeFrontend()->queueCommand(dir, cmd); +} + +void TrollProjectPart::slotCommandFinished( const QString& command ) +{ + Q_UNUSED( command ); + +// if( m_buildCommand != command ) +// return; +// +// m_buildCommand = QString::null; + + m_timestamp.clear(); + QStringList fileList = allFiles(); + QStringList::Iterator it = fileList.begin(); + while( it != fileList.end() ){ + QString fileName = *it; + ++it; + + m_timestamp[ fileName ] = QFileInfo( projectDirectory(), fileName ).lastModified(); + } + + emit projectCompiled(); + + if( m_executeProjectAfterBuild ) + { + m_widget->slotExecuteProject(); + m_executeProjectAfterBuild = false; + }else if( m_executeTargetAfterBuild ) + { + m_widget->slotExecuteTarget(); + m_executeTargetAfterBuild = false; + } + +} + +bool TrollProjectPart::isDirty() +{ + QStringList fileList = allFiles(); + QStringList::Iterator it = fileList.begin(); + while( it != fileList.end() ){ + QString fileName = *it; + ++it; + + QMap<QString, QDateTime>::Iterator it = m_timestamp.find( fileName ); + QDateTime t = QFileInfo( projectDirectory(), fileName ).lastModified(); + if( it == m_timestamp.end() || *it != t ){ + return true; + } + } + + return false; +} + +KDevProject::Options TrollProjectPart::options( ) const +{ + return UsesQMakeBuildSystem; +} + +bool TrollProjectPart::isValidQtDir( const QString& path ) const +{ + QFileInfo inc( path + QString( QChar( QDir::separator() ) )+ + "include"+QString( QChar( QDir::separator() ) )+ + "qt.h" ); + return ( isQt4Project() || ( !isQt4Project() && inc.exists() ) ); +} + +void TrollProjectPart::buildBinDirs( QStringList & dirs ) const +{ + if( !isQt4Project() ) + { + QString m_defaultQtDir = DomUtil::readEntry(*projectDom(), "/kdevcppsupport/qt/root", ""); + if( !m_defaultQtDir.isEmpty() ) + dirs << (m_defaultQtDir + QString( QChar( QDir::separator() ) ) + "bin" ); + dirs << ( ::getenv("QTDIR") + QString( QChar( QDir::separator() ) ) + "bin" ); + } + QStringList paths = QStringList::split(":",::getenv("PATH")); + dirs += paths; + QString binpath = QDir::rootDirPath() + "bin"; + if( dirs.findIndex( binpath ) != -1 ) + dirs << binpath; + + binpath = QDir::rootDirPath() + "usr" + QString( QChar( QDir::separator() ) ) + "bin"; + if( dirs.findIndex( binpath ) != -1 ) + dirs << binpath; + binpath = QDir::rootDirPath() + "usr" + QString( QChar( QDir::separator() ) ) + "local" + QString( QChar( QDir::separator() ) ) + "bin"; + if( dirs.findIndex( binpath ) != -1 ) + dirs << binpath; +} + + +QString TrollProjectPart::findExecutable( const QString& execname ) const +{ + QStringList dirs; + buildBinDirs( dirs ); + + for( QStringList::Iterator it=dirs.begin(); it!=dirs.end(); ++it ) + { + QString designer = *it + QString( QChar( QDir::separator() ) ) + execname; + if( !designer.isEmpty() && isExecutable( designer ) ) + { + return designer; + } + } + return ""; +} + +bool TrollProjectPart::isExecutable( const QString& path ) const +{ + QFileInfo fi(path); + return( fi.exists() && fi.isExecutable() ); +} + +QString TrollProjectPart::findQtDir() +{ + QStringList qtdirs; + if( !isQt4Project() ) + qtdirs.push_back( ::getenv("QTDIR") ); + qtdirs.push_back( QDir::rootDirPath()+"usr"+QString( QChar( QDir::separator() ) )+"lib"+QString( QChar( QDir::separator() ) )+"qt"+QString("%1").arg( DomUtil::readEntry( *projectDom(), "/kdevcppsupport/qt/version", "3") ) ); + qtdirs.push_back( QDir::rootDirPath()+"usr"+QString( QChar( QDir::separator() ) )+"lib"+QString( QChar( QDir::separator() ) )+"qt"+QString( QChar( QDir::separator() ) )+QString("%1").arg( DomUtil::readEntry( *projectDom(), "/kdevcppsupport/qt/version", "3") ) ); + qtdirs.push_back( QDir::rootDirPath()+"usr"+QString( QChar( QDir::separator() ) )+"share"+QString( QChar( QDir::separator() ) )+"qt"+QString("%1").arg( DomUtil::readEntry( *projectDom(), "/kdevcppsupport/qt/version", "3") ) ); + qtdirs.push_back( QDir::rootDirPath()+"usr" ); + qtdirs.push_back( QDir::rootDirPath()+"usr"+QString( QChar( QDir::separator() ) )+"lib"+QString( QChar( QDir::separator() ) )+"qt" ); + + for( QStringList::Iterator it=qtdirs.begin(); it!=qtdirs.end(); ++it ) + { + QString qtdir = *it; + if( !qtdir.isEmpty() && isValidQtDir(qtdir) ) + { + return qtdir; + } + } + return ""; +} + + +QStringList recursiveProFind( const QString &currDir, const QString &baseDir ) +{ + QStringList fileList; + + if( !currDir.contains( QString( QChar ( QDir::separator() ) ) +".." ) + && !currDir.contains( QString( QChar( QDir::separator() ) )+".") ) + { + QDir dir(currDir); + QStringList dirList = dir.entryList(QDir::Dirs ); + QStringList::Iterator idx = dirList.begin(); + for( ; idx != dirList.end(); ++idx ) + { + fileList += recursiveProFind( currDir + QString( QChar( QDir::separator() ) ) + (*idx),baseDir ); + } + QStringList newFiles = dir.entryList("*.pro *.PRO"); + idx = newFiles.begin(); + for( ; idx != newFiles.end(); ++idx ) + { + QString file = currDir + QString( QChar( QDir::separator() ) ) + (*idx); + fileList.append( file.remove( baseDir ) ); + } + } + + + return fileList; +} + +/*! + \fn TrollProjectPart::distFiles() const + */ +QStringList TrollProjectPart::distFiles() const +{ + QStringList sourceList = allFiles(); + // Scan current source directory for any .pro files. + QString projectDir = projectDirectory(); + QStringList files = recursiveProFind( projectDir, projectDir + QString( QChar( QDir::separator() ) ) ); + return sourceList + files; +} + +bool TrollProjectPart::isQt4Project() const +{ + return ( DomUtil::readIntEntry( *projectDom(), "kdevcppsupport/qt/version", 3 ) == 4 ); +} + +KDirWatch* TrollProjectPart::dirWatch() +{ + return m_dirWatch; +} + +void TrollProjectPart::slotBuild() +{ + m_widget->slotBuildProject(); +} + +#include "trollprojectpart.moc" + +//kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on + + diff --git a/buildtools/qmake/trollprojectpart.h b/buildtools/qmake/trollprojectpart.h new file mode 100644 index 00000000..3e571e85 --- /dev/null +++ b/buildtools/qmake/trollprojectpart.h @@ -0,0 +1,105 @@ +/*************************************************************************** + * Copyright (C) 2003 by Thomas Hasart * + * thasart@gmx.de * + * Copyright (C) 2001-2002 by Bernd Gehrmann * + * bernd@kdevelop.org * + * Copyright (C) 2002 by Jakob Simon-Gaarde * + * jakob@jsg.dk * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef _TROLLPROJECTPART_H_ +#define _TROLLPROJECTPART_H_ + +#include <qdict.h> +#include <qguardedptr.h> +#include <qmap.h> +#include <qdatetime.h> + +#include "kdevbuildtool.h" + +class KDialogBase; +class TrollProjectWidget; +class KDirWatch; +class QMakeDefaultOpts; + +class TrollProjectPart : public KDevBuildTool +{ + Q_OBJECT + +public: + TrollProjectPart( QObject *parent, const char *name, const QStringList &args ); + ~TrollProjectPart(); + + bool isTMakeProject() const { return m_tmakeProject; } + bool isQt4Project() const; + bool isDirty(); + KDirWatch* dirWatch(); + virtual Options options() const; + QStringList distFiles() const; + inline QString qmakePath() const { return DomUtil::readEntry(*projectDom(), "/kdevcppsupport/qt/qmake", "");; } + +protected: + virtual void openProject(const QString &dirName, const QString &projectName); + virtual void closeProject(); + + virtual QString projectDirectory() const; + virtual QString projectName() const; + virtual QString mainProgram() const; + virtual QString activeDirectory() const; + virtual QStringList allFiles() const; + virtual void addFile(const QString &fileName); + virtual void addFiles ( const QStringList &fileList ); + virtual void removeFile(const QString &fileName); + virtual void removeFiles ( const QStringList &fileList ); + virtual QString buildDirectory() const; + virtual QString runDirectory() const; + virtual QString debugArguments() const; + virtual QString runArguments() const; + virtual DomUtil::PairList runEnvironmentVars() const; + +private slots: + void projectConfigWidget(KDialogBase *dlg); + void slotBuild(); +// void slotClean(); +// void slotExecute(); + void slotCommandFinished( const QString& command ); + void slotBuildAndExecuteProject(); + void slotBuildAndExecuteTarget(); + +private: +// void startMakeCommand(const QString &dir, const QString &target); + void startQMakeCommand(const QString &dir, bool recursive = false ); +// void execute(const QString &directory, const QString &command); + void queueCmd(const QString &dir, const QString &cmd); + QString makeEnvironment(); + + QString findQtDir(); + QString findExecutable( const QString& path ) const; + void buildBinDirs( QStringList& ) const; + bool isValidQtDir( const QString& path ) const; + bool isExecutable( const QString& path ) const; + + QGuardedPtr<TrollProjectWidget> m_widget; + QString m_projectName; + bool m_tmakeProject; + + QMap<QString, QDateTime> m_timestamp; + bool m_executeProjectAfterBuild; + bool m_executeTargetAfterBuild; + QString m_buildCommand; + + KDirWatch* m_dirWatch; + + friend class TrollProjectWidget; + friend class ProjectRunOptionsDlg; + friend class QMakeDefaultOpts; +}; + +#endif + diff --git a/buildtools/qmake/trollprojectwidget.cpp b/buildtools/qmake/trollprojectwidget.cpp new file mode 100644 index 00000000..7668dbd7 --- /dev/null +++ b/buildtools/qmake/trollprojectwidget.cpp @@ -0,0 +1,2547 @@ +/*************************************************************************** +* Copyright (C) 2001 by Bernd Gehrmann * +* bernd@kdevelop.org * +* Copyright (C) 2000-2001 by Trolltech AS. * +* info@trolltech.com * +* Copyright (C) 2002 by Jakob Simon-Gaarde * +* jakob@jsg.dk * +* Copyright (C) 2002-2003 by Alexander Dymo * +* cloudtemple@mksat.net * +* Copyright (C) 2003 by Thomas Hasart * +* thasart@gmx.de * +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* Part of this file is taken from Qt Designer. * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#include "trollprojectwidget.h" + +#include <config.h> + +#include <qfile.h> +#include <qfileinfo.h> +#include <qheader.h> +#include <qsplitter.h> +#include <qptrstack.h> +#include <qtextstream.h> +#include <qcombobox.h> +#include <kprocess.h> +#include <qtimer.h> +#include <qdir.h> +#include <qregexp.h> +#include <qinputdialog.h> +#include <qwhatsthis.h> +#include <qvaluestack.h> +#include <kfiledialog.h> +#include <qtooltip.h> +#include <kdebug.h> +#include <klistview.h> +#include <kmessagebox.h> +#include <kpopupmenu.h> +#include <kregexp.h> +#include <kurl.h> +#include <qmessagebox.h> +#include <iostream> +#include <kparts/part.h> +#include <kaction.h> +#include <kprocess.h> +#include <kinputdialog.h> +#include <kdeversion.h> +#include <kdirwatch.h> +#include <kurlrequesterdlg.h> +#include <kurlrequester.h> +#include <kio/netaccess.h> +#include <kurlcompletion.h> + +#include "kdevcore.h" +#include "kdevpartcontroller.h" +#include "kdevmainwindow.h" +#include "trollprojectpart.h" +#include "kdevappfrontend.h" +#include "kdevmakefrontend.h" +#include "kdevlanguagesupport.h" +#include "kdevcreatefile.h" +#include "subclassesdlg.h" +#include "addfilesdialog.h" +#include "urlutil.h" +#include "trolllistview.h" +#include "projectconfigurationdlg.h" +#include "qmakescopeitem.h" +#include "scope.h" +#include "createscopedlg.h" +#include "disablesubprojectdlg.h" +#include <kapplication.h> + +TrollProjectWidget::TrollProjectWidget( TrollProjectPart *part ) + : QVBox( 0, "troll project widget" ), m_shownSubproject( 0 ), m_rootSubproject( 0 ), + m_rootScope ( 0 ), m_part ( part ), m_configDlg( 0 ), m_filesCached(false) +{ + + QSplitter * splitter = new QSplitter( Vertical, this ); + + ////////////////// + // PROJECT VIEW // + ////////////////// + + overviewContainer = new QVBox( splitter, "Projects" ); + overviewContainer->setMargin ( 2 ); + overviewContainer->setSpacing ( 2 ); + // overviewContainer->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); + // splitter->setResizeMode(overviewContainer, QSplitter::FollowSizeHint); + + projectTools = new QHBox( overviewContainer, "Project buttons" ); + projectTools->setMargin ( 2 ); + projectTools->setSpacing ( 2 ); + // Add subdir + addSubdirButton = new QToolButton ( projectTools, "Add subproject button" ); + addSubdirButton->setPixmap ( SmallIcon ( "folder_new" ) ); + addSubdirButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, addSubdirButton->sizePolicy().hasHeightForWidth() ) ); + addSubdirButton->setEnabled ( true ); + QToolTip::add( addSubdirButton, i18n( "Add subproject" ) ); + QWhatsThis::add( addSubdirButton, i18n( "<b>Add subproject</b><p>Creates a <i>new</i> or adds an <i>existing</i> subproject to a currently selected subproject. " + "This action is allowed only if a type of the subproject is 'subdirectories'. The type of the subproject can be " + "defined in <b>Subproject Settings</b> dialog (open it from the subproject context menu)." ) ); + // Create scope + createScopeButton = new QToolButton ( projectTools, "Create scope button" ); + createScopeButton->setPixmap ( SmallIcon ( "qmake_scopenew" ) ); + createScopeButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, createScopeButton->sizePolicy().hasHeightForWidth() ) ); + createScopeButton->setEnabled ( true ); + QToolTip::add( createScopeButton, i18n( "Create scope" ) ); + QWhatsThis::add( createScopeButton, i18n( "<b>Create scope</b><p>Creates QMake scope in the project file in case the subproject is selected or creates nested scope in case the scope is selected." ) ); + + // build + buildProjectButton = new QToolButton ( projectTools, "Make button" ); + buildProjectButton->setPixmap ( SmallIcon ( "make_kdevelop" ) ); + buildProjectButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, buildProjectButton->sizePolicy().hasHeightForWidth() ) ); + buildProjectButton->setEnabled ( true ); + QToolTip::add( buildProjectButton, i18n( "Build project" ) ); + QWhatsThis::add( buildProjectButton, i18n( "<b>Build project</b><p>Runs <b>make</b> from the project directory.<br>" + "Environment variables and make arguments can be specified " + "in the project settings dialog, <b>Make Options</b> tab." ) ); + // rebuild + rebuildProjectButton = new QToolButton ( projectTools, "Rebuild button" ); + rebuildProjectButton->setPixmap ( SmallIcon ( "rebuild" ) ); + rebuildProjectButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, rebuildProjectButton->sizePolicy().hasHeightForWidth() ) ); + rebuildProjectButton->setEnabled ( true ); + QToolTip::add( rebuildProjectButton, i18n( "Rebuild project" ) ); + QWhatsThis::add( rebuildProjectButton, i18n( "<b>Rebuild project</b><p>Runs <b>make clean</b> and then <b>make</b> from the project directory.<br>" + "Environment variables and make arguments can be specified " + "in the project settings dialog, <b>Make Options</b> tab." ) ); + + // run + executeProjectButton = new QToolButton ( projectTools, "Run button" ); + executeProjectButton->setPixmap ( SmallIcon ( "exec" ) ); + executeProjectButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, executeProjectButton->sizePolicy().hasHeightForWidth() ) ); + executeProjectButton->setEnabled ( true ); + QToolTip::add( executeProjectButton, i18n( "Execute main program" ) ); + QWhatsThis::add( executeProjectButton, i18n( "<b>Execute main program</b><p>Executes the main program specified in project settings, <b>Run Options</b> tab." ) ); + // spacer + QWidget *spacer = new QWidget( projectTools ); + projectTools->setStretchFactor( spacer, 1 ); + // Project configuration + projectconfButton = new QToolButton ( projectTools, "Project configuration button" ); + projectconfButton->setPixmap ( SmallIcon ( "configure" ) ); + projectconfButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, projectconfButton->sizePolicy().hasHeightForWidth() ) ); + projectconfButton->setEnabled ( true ); + QToolTip::add( projectconfButton, i18n( "Subproject settings" ) ); + QWhatsThis::add( projectconfButton, i18n( "<b>Subproject settings</b><p>Opens <b>QMake Subproject Configuration</b> dialog for the currently selected subproject. " + "It provides settings for:<br>subproject type and configuration,<br>include and library paths,<br>lists of dependencies and " + "external libraries,<br>build order,<br>intermediate files locations,<br>compiler options." ) ); + + // Project button connections + connect ( addSubdirButton, SIGNAL ( clicked () ), this, SLOT ( slotAddSubproject () ) ); + connect ( createScopeButton, SIGNAL ( clicked () ), this, SLOT ( slotCreateScope () ) ); + + + connect ( buildProjectButton, SIGNAL ( clicked () ), this, SLOT ( slotBuildProject () ) ); + connect ( rebuildProjectButton, SIGNAL ( clicked () ), this, SLOT ( slotRebuildProject () ) ); + connect ( executeProjectButton, SIGNAL ( clicked () ), m_part, SLOT ( slotBuildAndExecuteProject () ) ); + + + connect ( projectconfButton, SIGNAL ( clicked () ), this, SLOT ( slotConfigureProject () ) ); + + // Project tree + overview = new TrollListView( this, overviewContainer, SubprojectView, "project overview widget" ); +// overview->setResizeMode( QListView::LastColumn ); + overview->setSorting( -1 ); + overview->header() ->hide(); + overview->addColumn( QString::null ); + + // Project tree connections + connect( overview, SIGNAL( selectionChanged( QListViewItem* ) ), + this, SLOT( slotOverviewSelectionChanged( QListViewItem* ) ) ); + connect( overview, SIGNAL( contextMenu( KListView*, QListViewItem*, const QPoint& ) ), + this, SLOT( slotOverviewContextMenu( KListView*, QListViewItem*, const QPoint& ) ) ); + + + ///////////////// + // DETAIL VIEW // + ///////////////// + + // Details tree + detailContainer = new QVBox( splitter, "Details" ); + detailContainer->setMargin ( 2 ); + detailContainer->setSpacing ( 2 ); + // detailContainer->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); + + // Details Toolbar + fileTools = new QHBox( detailContainer, "Detail buttons" ); + fileTools->setMargin ( 2 ); + fileTools->setSpacing ( 2 ); + + // Add new file button + newfileButton = new QToolButton ( fileTools, "Create new file" ); + newfileButton->setPixmap ( SmallIcon ( "filenew" ) ); + newfileButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, newfileButton->sizePolicy().hasHeightForWidth() ) ); + newfileButton->setEnabled ( true ); + QToolTip::add( newfileButton, i18n( "Create new file" ) ); + QWhatsThis::add( newfileButton, i18n( "<b>Create new file</b><p>Creates a new file and adds it to a currently selected group." ) ); + + // Add existing files button + addfilesButton = new QToolButton ( fileTools, "Add existing files" ); + addfilesButton->setPixmap ( SmallIcon ( "fileimport" ) ); + addfilesButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, addfilesButton->sizePolicy().hasHeightForWidth() ) ); + addfilesButton->setEnabled ( true ); + QToolTip::add( addfilesButton, i18n( "Add existing files" ) ); + QWhatsThis::add( addfilesButton, i18n( "<b>Add existing files</b><p>Adds existing files to a currently selected group. It is " + "possible to copy files to a current subproject directory, create symbolic links or " + "add them with the relative path." ) ); + + // remove file button + removefileButton = new QToolButton ( fileTools, "Remove file" ); + removefileButton->setPixmap ( SmallIcon ( "button_cancel" ) ); + removefileButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, removefileButton->sizePolicy().hasHeightForWidth() ) ); + removefileButton->setEnabled ( true ); + QToolTip::add( removefileButton, i18n( "Remove file" ) ); + QWhatsThis::add( removefileButton, i18n( "<b>Remove file</b><p>Removes file from a current group. Does not remove file from disk." ) ); + + // build selected file + buildFileButton = new QToolButton ( fileTools, "Make file button" ); + buildFileButton->setPixmap ( SmallIcon ( "compfile" ) ); + buildFileButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, buildFileButton->sizePolicy().hasHeightForWidth() ) ); + buildFileButton->setEnabled ( true ); + QToolTip::add( buildFileButton, i18n( "Compile file" ) ); + QWhatsThis::add( buildFileButton, i18n( "<b>Compile file</b><p>Runs <b>make filename.o</b> command from the directory where 'filename' is the name of currently opened file.<br>" + "Environment variables and make arguments can be specified " + "in the project settings dialog, <b>Make Options</b> tab." ) ); + + // build + buildTargetButton = new QToolButton ( fileTools, "Make sp button" ); + buildTargetButton->setPixmap ( SmallIcon ( "make_kdevelop" ) ); + buildTargetButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, buildTargetButton->sizePolicy().hasHeightForWidth() ) ); + buildTargetButton->setEnabled ( true ); + QToolTip::add( buildTargetButton, i18n( "Build subproject" ) ); + QWhatsThis::add( buildTargetButton, i18n( "<b>Build subproject</b><p>Runs <b>make</b> from the current subproject directory. " + "Current subproject is a subproject selected in <b>QMake manager</b> 'overview' window.<br>" + "Environment variables and make arguments can be specified " + "in the project settings dialog, <b>Make Options</b> tab." ) ); + // rebuild + rebuildTargetButton = new QToolButton ( fileTools, "Rebuild sp button" ); + rebuildTargetButton->setPixmap ( SmallIcon ( "rebuild" ) ); + rebuildTargetButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, rebuildTargetButton->sizePolicy().hasHeightForWidth() ) ); + rebuildTargetButton->setEnabled ( true ); + QToolTip::add( rebuildTargetButton, i18n( "Rebuild subproject" ) ); + QWhatsThis::add( rebuildTargetButton, i18n( "<b>Rebuild subproject</b><p>Runs <b>make clean</b> and then <b>make</b> from the current subproject directory. " + "Current subproject is a subproject selected in <b>QMake manager</b> 'overview' window.<br>" + "Environment variables and make arguments can be specified " + "in the project settings dialog, <b>Make Options</b> tab." ) ); + + // run + executeTargetButton = new QToolButton ( fileTools, "Run sp button" ); + executeTargetButton->setPixmap ( SmallIcon ( "exec" ) ); + executeTargetButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, executeTargetButton->sizePolicy().hasHeightForWidth() ) ); + executeTargetButton->setEnabled ( true ); + QToolTip::add( executeTargetButton, i18n( "Execute subproject" ) ); + QWhatsThis::add( executeTargetButton, i18n( "<b>Execute subproject</b><p>Executes the target program for the currently selected subproject. " + "This action is allowed only if a type of the subproject is 'application'. The type of the subproject can be " + "defined in <b>Subproject Settings</b> dialog (open it from the subproject context menu)." ) ); + + + // spacer + spacer = new QWidget( fileTools ); + projectTools->setStretchFactor( spacer, 1 ); + + // Configure file button + excludeFileFromScopeButton = new QToolButton ( fileTools, "Exclude file" ); + excludeFileFromScopeButton->setPixmap ( SmallIcon ( "configure_file" ) ); + excludeFileFromScopeButton->setSizePolicy ( QSizePolicy ( ( QSizePolicy::SizeType ) 0, ( QSizePolicy::SizeType ) 0, 0, 0, excludeFileFromScopeButton->sizePolicy().hasHeightForWidth() ) ); + excludeFileFromScopeButton->setEnabled ( true ); + QToolTip::add( excludeFileFromScopeButton , i18n( "Exclude file" ) ); + QWhatsThis::add( excludeFileFromScopeButton , i18n( "<b>Exclude file</b><p>Exclude the selected file from this scope." ) ); + + // detail tree + details = new TrollListView( this, detailContainer, DetailsView, "details widget" ); + details->setRootIsDecorated( true ); + details->setResizeMode( QListView::LastColumn ); + details->setSorting( -1 ); + details->header() ->hide(); + details->addColumn( QString::null ); + // Detail button connections + connect ( addfilesButton, SIGNAL ( clicked () ), this, SLOT ( slotAddFiles () ) ); + connect ( newfileButton, SIGNAL ( clicked () ), this, SLOT ( slotNewFile () ) ); + connect ( removefileButton, SIGNAL ( clicked () ), this, SLOT ( slotRemoveFile () ) ); + connect ( buildFileButton, SIGNAL ( clicked () ), this, SLOT ( slotBuildSelectedFile () ) ); + connect ( excludeFileFromScopeButton, SIGNAL ( clicked () ), this, SLOT ( slotExcludeFileFromScopeButton() ) ); + + // Detail tree connections + connect( details, SIGNAL( selectionChanged( QListViewItem* ) ), + this, SLOT( slotDetailsSelectionChanged( QListViewItem* ) ) ); + connect( details, SIGNAL( executed( QListViewItem* ) ), + this, SLOT( slotDetailsExecuted( QListViewItem* ) ) ); + connect( details, SIGNAL( contextMenu( KListView*, QListViewItem*, const QPoint& ) ), + this, SLOT( slotDetailsContextMenu( KListView*, QListViewItem*, const QPoint& ) ) ); + + connect ( buildTargetButton, SIGNAL ( clicked () ), this, SLOT ( slotBuildTarget () ) ); + connect ( rebuildTargetButton, SIGNAL ( clicked () ), this, SLOT ( slotRebuildTarget () ) ); + connect ( executeTargetButton, SIGNAL ( clicked () ), m_part, SLOT ( slotBuildAndExecuteTarget () ) ); + buildTargetButton->setEnabled( false ); + rebuildTargetButton->setEnabled( false ); + executeTargetButton->setEnabled( false ); + + m_configDlg = new ProjectConfigurationDlg( overview, this, this ); + + connect( m_part->dirWatch(), SIGNAL( dirty(const QString&) ), this, SLOT( slotProjectDirty(const QString&) ) ); +} + + +TrollProjectWidget::~TrollProjectWidget() +{ + delete m_configDlg; +} + + +void TrollProjectWidget::openProject( const QString &dirName ) +{ + QDomDocument & dom = *( m_part->projectDom() ); + m_subclasslist = DomUtil::readPairListEntry( dom, "/kdevtrollproject/subclassing" , + "subclass", "sourcefile", "uifile" ); + + QString projectfile = DomUtil::readEntry( dom, "/kdevtrollproject/qmake/projectfile", "" ); + + m_showFilenamesOnly = DomUtil::readBoolEntry( *m_part->projectDom(), "/kdevtrollproject/qmake/enableFilenamesOnly", false ); + m_showVariablesInTree = DomUtil::readBoolEntry( *m_part->projectDom(), "/kdevtrollproject/qmake/showVariablesInTree", true ); + + QString proname; + + if( projectfile.isEmpty() ) + { + QFileInfo fi( dirName ); + QDir dir( dirName ); + // QString proname = item->path + "/" + fi.baseName() + ".pro"; + + QStringList l = dir.entryList( "*.pro" ); + + QString profile; + if( l.count() && l.findIndex( m_part->projectName() + ".pro") != -1 ) + profile = m_part->projectName()+".pro"; + else if( l.isEmpty() || ( l.count() && l.findIndex( fi.baseName() + ".pro") != -1 ) ) + profile = fi.baseName()+".pro"; + else + profile = l[0]; + + proname = dirName + QString( QChar( QDir::separator() ) ) + profile; + } else + { + proname = projectfile; + } + + kdDebug( 9024 ) << "Parsing " << proname << endl; + + m_rootScope = new Scope( qmakeEnvironment(), proname, m_part ); + if( m_rootScope->scopeType() != Scope::InvalidScope ) + { + + m_rootSubproject = new QMakeScopeItem( overview, m_rootScope->scopeName(), m_rootScope, this ); + + + m_rootSubproject->setOpen( true ); + if ( m_rootSubproject->firstChild() && m_rootSubproject->scope->variableValues( "TEMPLATE" ).findIndex("subdirs") != -1 ) + { + overview->setSelected( m_rootSubproject->firstChild(), true ); + } + else + { + overview->setSelected( m_rootSubproject, true ); + } + }else + { + delete m_rootScope; + m_rootScope = 0; + } +// kdDebug(9024) << "Adding " << allFiles().count() << " Files" << endl; +// kdDebug(9024) << allFiles() << endl; + +} + +void TrollProjectWidget::createQMakeScopeItems() +{ + +} + +void TrollProjectWidget::closeProject() +{ + m_rootSubproject = 0; + overview->clear(); + details->clear(); + delete m_rootScope; +} + +QStringList TrollProjectWidget::allFiles() +{ + if( !m_rootScope ) + return QStringList(); + if( m_filesCached ) + return m_allFilesCache; + m_allFilesCache = m_rootScope->allFiles( m_rootScope->projectDir() ); + m_filesCached = true; + return m_allFilesCache; +} + +QString TrollProjectWidget::projectDirectory() +{ + if ( !m_rootScope ) + return QString::null; //confused + + return m_rootScope->projectDir(); +} + + +QString TrollProjectWidget::subprojectDirectory() +{ + if ( !m_shownSubproject ) + return QString::null; + + return m_shownSubproject->scope->projectDir(); +} + +void TrollProjectWidget::setupContext() +{ + if ( !m_shownSubproject ) + return ; + bool buildable = true; + bool runable = true; + bool fileconfigurable = true; + bool hasSourceFiles = true; + bool hasSubdirs = false; + + QStringList tmpl = m_shownSubproject->scope->variableValues( "TEMPLATE" ); + + if ( tmpl.findIndex( "lib" ) != -1 ) + { + runable = false; + } + else if ( tmpl.findIndex( "subdirs" ) != -1 ) + { + hasSubdirs = true; + runable = false; + hasSourceFiles = false; + fileconfigurable = false; + } + if ( m_shownSubproject->scope->scopeType() != Scope::ProjectScope ) + { + runable = false; + buildable = false; + } + + + // Setup toolbars according to context + addSubdirButton->setEnabled( hasSubdirs ); + buildTargetButton->setEnabled( buildable ); + m_part->actionCollection() ->action( "build_build_target" ) ->setEnabled( buildable ); + + rebuildTargetButton->setEnabled( buildable ); + m_part->actionCollection() ->action( "build_rebuild_target" ) ->setEnabled( buildable ); + + executeTargetButton->setEnabled( runable ); + m_part->actionCollection() ->action( "build_execute_target" ) ->setEnabled( runable ); + + excludeFileFromScopeButton->setEnabled( !hasSubdirs ); + newfileButton->setEnabled( !hasSubdirs ); + removefileButton->setEnabled( !hasSubdirs ); + addfilesButton->setEnabled( !hasSubdirs ); + buildFileButton->setEnabled( !hasSubdirs ); + + details->setEnabled( hasSourceFiles ); +} + +void TrollProjectWidget::slotOverviewSelectionChanged( QListViewItem *item ) +{ + QString olddir = m_part->activeDirectory(); + if ( !item ) + { + kdDebug(9024) << "Trying to select a non-existing item" << endl; + return ; + } + cleanDetailView( m_shownSubproject ); + m_shownSubproject = static_cast<QMakeScopeItem*>( item ); + setupContext(); + buildProjectDetailTree( m_shownSubproject, details ); + + QDomDocument &dom = *( m_part->projectDom() ); + DomUtil::writeEntry( dom, "/kdevtrollproject/general/activedir", m_shownSubproject->relativePath() ); + if ( m_configDlg && m_configDlg->isShown() ) + { + m_configDlg->updateSubproject( m_shownSubproject ); + } + emit m_part->activeDirectoryChanged( olddir, m_part->activeDirectory() ); +} + +QString TrollProjectWidget::getCurrentTarget() +{ + if ( !m_shownSubproject ) + return ""; + QString destdir = getCurrentDestDir(); + if ( destdir.isEmpty() ) + return getCurrentOutputFilename(); + else + return destdir + QString( QChar( QDir::separator() ) ) + getCurrentOutputFilename(); +} + +QString TrollProjectWidget::getCurrentDestDir() +{ + if ( !m_shownSubproject ) + return ""; + QStringList destdir = m_shownSubproject->scope->variableValues( "DESTDIR", true, true, true ); + return m_shownSubproject->scope->resolveVariables(m_shownSubproject->scope->variableValues( "DESTDIR", true, true, true ).front()); +} + +QString TrollProjectWidget::getCurrentOutputFilename() +{ + if ( !m_shownSubproject ) + return ""; + if ( m_shownSubproject->scope->variableValues( "TARGET", true, true, true ).isEmpty() ) + { + QString exe = m_shownSubproject->scope->resolveVariables(m_shownSubproject->scope->fileName()); + return exe.replace( QRegExp( "\\.pro$" ), "" ); + } + else + { + return m_shownSubproject->scope->resolveVariables(m_shownSubproject->scope->variableValues( "TARGET", true, true, true ).front()); + } +} + +void TrollProjectWidget::cleanDetailView( QMakeScopeItem *item ) +{ + // If no children in detailview + // it is a subdir template + if ( item && details->childCount() ) + { + QListViewItem* i = details->firstChild(); + while( i ) + { + QListViewItem* old = i; + i = i->nextSibling(); + details->takeItem(old); + } +// QMapIterator<GroupItem::GroupType, GroupItem*> it1 = item->groups.begin() ; +// for ( ; it1 != item->groups.end(); ++it1 ) +// { +// // After AddTargetDialog, it can happen that an +// // item is not yet in the list view, so better check... +// if ( it1.data() ->parent() ) +// while ( it1.data() ->firstChild() ) +// it1.data() ->takeItem( it1.data() ->firstChild() ); +// details->takeItem( it1.data() ); +// } + } +} + +void TrollProjectWidget::buildProjectDetailTree( QMakeScopeItem *item, KListView *listviewControl ) +{ + + // Insert all GroupItems and all of their children into the view + if ( !listviewControl || item->scope->variableValues( "TEMPLATE" ).findIndex("subdirs") != -1 ) + return ; + + QMapIterator<GroupItem::GroupType, GroupItem*> it2 = item->groups.begin(); + QListViewItem* lastItem = 0; + for ( ; it2 != item->groups.end(); ++it2 ) + { + listviewControl->insertItem( it2.data() ); + if(lastItem) + it2.data()->moveItem(lastItem); + lastItem = it2.data(); + if ( it2.key() == GroupItem::InstallRoot ) + { + QListViewItem* lastinstallitem = 0; + QPtrListIterator<GroupItem> it3( it2.data() ->installs ); + for ( ; it3.current(); ++it3 ) + { + it2.data() ->insertItem( *it3 ); + if ( lastinstallitem ) + it3.current()->moveItem(lastinstallitem); + lastinstallitem = it3.current(); + QPtrListIterator<FileItem> it4( ( *it3 ) ->files ); + QListViewItem* lastfileitem = 0; + for ( ; it4.current(); ++it4 ) + { + ( *it3 ) ->insertItem( *it4 ); + if ( lastfileitem ) + it4.current()->moveItem(lastfileitem); + lastfileitem = it4.current(); + } + ( *it3 ) ->setOpen( true ); + ( *it3 ) ->sortChildItems( 0, true ); + } + it2.data() ->setOpen( true ); + it2.data() ->sortChildItems( 0, true ); + } + else + { + QPtrListIterator<FileItem> it3( it2.data() ->files ); + QListViewItem* lastfileitem = 0; + for ( ; it3.current(); ++it3 ) + { + it2.data() ->insertItem( *it3 ); + if ( lastfileitem ) + it3.current()->moveItem(lastfileitem); + lastfileitem = it3.current(); + } + it2.data() ->setOpen( true ); + it2.data() ->sortChildItems( 0, true ); + } + } + listviewControl->setSelected( listviewControl->selectedItem(), false ); + listviewControl->setCurrentItem( 0 ); +} + +void TrollProjectWidget::slotDetailsExecuted( QListViewItem *item ) +{ + if ( !item ) + return ; + + // We assume here that ALL items in both list views + // are qProjectItem's + qProjectItem *pvitem = static_cast<qProjectItem*>( item ); + if ( pvitem->type() != qProjectItem::File ) + return ; + + FileItem *fitem = static_cast<FileItem*>( pvitem ); + + QString filePath; + if( m_shownSubproject->scope->scopeType() == Scope::IncludeScope ) + { + filePath = m_shownSubproject->scope->parent()->projectDir(); + }else + { + filePath = m_shownSubproject->scope->projectDir(); + } + filePath += QChar( QDir::separator() ) + m_shownSubproject->scope->resolveVariables( fitem->localFilePath ); + + bool isUiFile = QFileInfo( fitem->text( 0 ) ).extension() == "ui"; + kdDebug(9024) << "Opening file: " << filePath << endl; + if ( isTMakeProject() && isUiFile ) + { + // start designer in your PATH + KShellProcess proc; + proc << "designer" << filePath; + proc.start( KProcess::DontCare, KProcess::NoCommunication ); + } + else + m_part->partController() ->editDocument( KURL( filePath ) ); +} + + +void TrollProjectWidget::slotConfigureProject() +{ + m_configDlg->updateSubproject( m_shownSubproject ); + m_configDlg->show(); +} + +void TrollProjectWidget::slotExecuteTarget() +{ + //m_part->slotExecute(); + // no subproject selected + if ( !m_shownSubproject ) + return ; + + // can't build from scope + if ( m_shownSubproject->scope->scopeType() != Scope::ProjectScope ) + return ; + + + + // Only run application projects + if ( !m_shownSubproject->scope->variableValues( "TEMPLATE" ).isEmpty() && m_shownSubproject->scope->variableValues( "TEMPLATE" ).findIndex( "app" ) == -1 ) + return ; + + //only run once + if (m_part->appFrontend()->isRunning()) + { + if (KMessageBox::questionYesNo(this, i18n("Your application is currently running. Do you want to restart it?"), i18n("Application Already Running"), i18n("&Restart Application"), i18n("Do &Nothing")) == KMessageBox::No) + return; + m_part->appFrontend()->stopApplication(); + while(m_part->appFrontend()->isRunning()) + { + KApplication::kApplication()->processEvents(); + usleep(100); + } + } + + + QString program = KProcess::quote( "." + QString( QChar( QDir::separator() ) ) + getCurrentOutputFilename() ); + + // Build environment variables to prepend to the executable path + QString runEnvVars = QString::null; + DomUtil::PairList list = + DomUtil::readPairListEntry( *( m_part->projectDom() ), "/kdevtrollproject/run/envvars", "envvar", "name", "value" ); + + DomUtil::PairList::ConstIterator it; + for ( it = list.begin(); it != list.end(); ++it ) + { + const DomUtil::Pair &pair = ( *it ); + if ( ( !pair.first.isEmpty() ) && ( !pair.second.isEmpty() ) ) + runEnvVars += pair.first + "=" + pair.second + " "; + } + program.prepend( runEnvVars ); + + program.append( " " + m_part->runArguments() + " " ); + // std::cerr<<dircmd + "./"+program<<std::endl; + // m_part->execute(dircmd + "./"+program); + // m_part->appFrontend()->startAppCommand(dircmd +"./"+program,true); + + bool inTerminal = DomUtil::readBoolEntry( *m_part->projectDom(), "/kdevtrollproject/run/terminal" ); + + m_part->appFrontend() ->startAppCommand( subprojectDirectory() + QString( QChar( QDir::separator() ) ) + getCurrentDestDir(), program, inTerminal ); + +} + +void TrollProjectWidget::slotBuildProject() +{ + if ( m_part->partController() ->saveAllFiles() == false ) + return ; //user cancelled + + QString dir = projectDirectory(); + + if ( !m_rootSubproject ) + return ; + + createMakefileIfMissing( dir, m_rootSubproject ); + + m_part->mainWindow() ->raiseView( m_part->makeFrontend() ->widget() ); + QString dircmd = "cd " + KProcess::quote( dir ) + " && " ; + QString buildcmd = constructMakeCommandLine( m_rootSubproject->scope ); + m_part->queueCmd( dir, dircmd + buildcmd ); +} + +void TrollProjectWidget::slotInstallProject() +{ + if ( m_part->partController() ->saveAllFiles() == false ) + return ; //user cancelled + + QString dir = projectDirectory(); + + if ( !m_rootSubproject ) + return ; + + createMakefileIfMissing( dir, m_rootSubproject ); + + m_part->mainWindow() ->raiseView( m_part->makeFrontend() ->widget() ); + QString dircmd = "cd " + KProcess::quote( dir ) + " && " ; + QString buildcmd = constructMakeCommandLine( m_rootSubproject->scope ) + " install"; + m_part->queueCmd( dir, dircmd + buildcmd ); +} + +void TrollProjectWidget::slotBuildTarget() +{ + // no subproject selected + m_part->partController() ->saveAllFiles(); + if ( !m_shownSubproject ) + return ; + // can't build from scope + if ( m_shownSubproject->scope->scopeType() != Scope::ProjectScope ) + return ; + QString dir = subprojectDirectory(); + createMakefileIfMissing( dir, m_shownSubproject ); + + m_part->mainWindow() ->raiseView( m_part->makeFrontend() ->widget() ); + QString dircmd = "cd " + KProcess::quote( dir ) + " && " ; + QString buildcmd = constructMakeCommandLine( m_shownSubproject->scope ); + m_part->queueCmd( dir, dircmd + buildcmd ); +} + +void TrollProjectWidget::slotInstallTarget() +{ + // no subproject selected + m_part->partController() ->saveAllFiles(); + if ( !m_shownSubproject ) + return ; + // can't build from scope + if ( m_shownSubproject->scope->scopeType() != Scope::ProjectScope ) + return ; + QString dir = subprojectDirectory(); + createMakefileIfMissing( dir, m_shownSubproject ); + + m_part->mainWindow() ->raiseView( m_part->makeFrontend() ->widget() ); + QString dircmd = "cd " + KProcess::quote( dir ) + " && " ; + QString buildcmd = constructMakeCommandLine( m_shownSubproject->scope ) + " install"; + m_part->queueCmd( dir, dircmd + buildcmd ); +} + +void TrollProjectWidget::slotRebuildProject() +{ + m_part->partController() ->saveAllFiles(); + QString dir = this-> projectDirectory(); + + if ( !m_rootSubproject ) + return ; + + createMakefileIfMissing( dir, m_rootSubproject ); + + m_part->mainWindow() ->raiseView( m_part->makeFrontend() ->widget() ); + QString dircmd = "cd " + KProcess::quote( dir ) + " && " ; + QString rebuildcmd = constructMakeCommandLine( m_rootSubproject->scope ) + " clean && " + constructMakeCommandLine( m_rootSubproject->scope ); + m_part->queueCmd( dir, dircmd + rebuildcmd ); +} + +void TrollProjectWidget::slotRebuildTarget() +{ + // no subproject selected + m_part->partController() ->saveAllFiles(); + if ( !m_shownSubproject ) + return ; + // can't build from scope + if ( m_shownSubproject->scope->scopeType() != Scope::ProjectScope ) + return ; + + QString dir = subprojectDirectory(); + createMakefileIfMissing( dir, m_shownSubproject ); + + m_part->mainWindow() ->raiseView( m_part->makeFrontend() ->widget() ); + QString dircmd = "cd " + KProcess::quote( dir ) + " && " ; + QString rebuildcmd = constructMakeCommandLine( m_shownSubproject->scope ) + " clean && " + constructMakeCommandLine( m_shownSubproject->scope ); + m_part->queueCmd( dir, dircmd + rebuildcmd ); +} + +void TrollProjectWidget::slotCreateScope( QMakeScopeItem *spitem ) +{ + if ( spitem == 0 && m_shownSubproject == 0 ) + return ; + else + spitem = m_shownSubproject; + CreateScopeDlg dlg( spitem, this ); + if ( dlg.exec() == QDialog::Accepted ) + { + spitem->scope->saveToFile( ); + spitem->sortChildItems( 0, true ); + } + return ; +} + +void TrollProjectWidget::slotAddSubproject( QMakeScopeItem *spitem ) +{ + if ( spitem == 0 && m_shownSubproject == 0 ) + return ; + else + spitem = m_shownSubproject; + + m_filesCached = false; + m_allFilesCache.clear(); + + QString projectdir = spitem->scope->projectDir(); + + KURLRequesterDlg dialog( i18n( "Add Subproject" ), i18n( "Please enter a name for the subproject: " ), this, 0 ); + KURLRequester* req = dialog.urlRequester(); + req->setMode( KFile::Directory | KFile::File | KFile::LocalOnly ); + req->setFilter( "*.pro|QMake Project Files (*.pro)" ); + req->setURL( QString() ); + req->fileDialog()->setURL( KURL::fromPathOrURL( projectdir ) ); + req->completionObject() ->setDir( projectdir ); + + if ( dialog.exec() == QDialog::Accepted && !dialog.urlRequester() ->url().isEmpty() ) + { + QString subdirname; + if ( !QDir::isRelativePath( dialog.urlRequester() ->url() ) ) + subdirname = URLUtil::getRelativePath( projectdir, dialog.urlRequester()->url() ); + else + subdirname = dialog.urlRequester()->url(); + + while( subdirname.endsWith( QString(QChar(QDir::separator())) ) ) + subdirname = subdirname.left(subdirname.length()-1); + if( !subdirname.endsWith(".pro") ) + { + kdDebug(9024) << "Cleaned subdirname: " << subdirname << endl; + QDir dir( projectdir ); + QString realdir = spitem->scope->resolveVariables( subdirname ); + if ( !dir.exists( realdir ) ) + { + if ( !dir.mkdir( realdir ) ) + { + KMessageBox::error( this, i18n( "Failed to create subdirectory. " + "Do you have write permission " + "in the project folder?" ) ); + return ; + }else + { + QFile f( dir.absPath()+"/"+realdir+"/"+realdir+".pro" ); + f.open( IO_WriteOnly ); + f.close(); + } + } + }else + { + QString realdir = spitem->scope->resolveVariables( subdirname ); + QFile f( projectdir+"/"+realdir ); + f.open( IO_WriteOnly ); + f.close(); + } + + addSubprojectToItem( spitem, subdirname ); + + } +} + +void TrollProjectWidget::addSubprojectToItem( QMakeScopeItem* spitem, const QString& subdirname ) +{ + QListViewItem* item = spitem->firstChild(); + while( item ) + { + QMakeScopeItem* sitem = static_cast<QMakeScopeItem*>(item); + if( sitem->scope->scopeName() == subdirname ) + { + if( sitem->scope->isEnabled() ) + { + return; + }else + { + spitem->scope->removeFromMinusOp( "SUBDIRS", subdirname ); + delete item; + if( spitem->scope->variableValues( "SUBDIRS" ).findIndex( subdirname ) != -1 ) + return; + } + } + item = item->nextSibling(); + } + + Scope* subproject = spitem->scope->createSubProject( subdirname ); + if( subproject ) + { + new QMakeScopeItem( spitem, subproject->scopeName(), subproject ); +// QListViewItem* lastitem = spitem->firstChild(); +// while( lastitem->nextSibling() != 0 ) +// lastitem = lastitem->nextSibling(); +// newitem->moveItem( lastitem ); + }else + { + KMessageBox::error(this, i18n("Could not create subproject. This means that either the project you wanted" + " to add a subproject to is not parsed correctly, or it is not a" + " subdirs-project."), i18n("Subproject creation failed") ); + } + spitem->scope->saveToFile(); + spitem->sortChildItems( 0, true ); +} + +void TrollProjectWidget::slotRemoveSubproject( QMakeScopeItem *spitem ) +{ + if ( spitem == 0 && m_shownSubproject == 0 ) + return ; + else if ( ( spitem = dynamic_cast<QMakeScopeItem *>( m_shownSubproject->parent() ) ) != NULL ) + { + + m_filesCached = false; + m_allFilesCache.clear(); + + bool delsubdir = false; + if ( KMessageBox::warningYesNo( this, i18n( "Delete the file/directory of the subproject from disk?" ), i18n( "Delete subdir?" ) ) == KMessageBox::Yes ) + delsubdir = true; + if( !spitem->scope->deleteSubProject( m_shownSubproject->scope->getNum(), delsubdir ) ) + { + KMessageBox::error(this, i18n("Could not delete subproject.\nThis is an internal error, please write a" + " bug report to bugs.kde.org and include the output of kdevelop when run" + "from a shell."),i18n("Subproject Deletion failed")); + return; + } + delete m_shownSubproject; + m_shownSubproject = spitem; + spitem->scope->saveToFile( ); + overview->setCurrentItem( m_shownSubproject ); + overview->setSelected( m_shownSubproject, true ); + } +} + +void TrollProjectWidget::slotOverviewContextMenu( KListView *, QListViewItem *item, const QPoint &p ) +{ + if ( !item ) + return ; + + QMakeScopeItem *spitem = static_cast<QMakeScopeItem*>( item ); + + KPopupMenu popup( this ); + popup.insertTitle( i18n( "Subproject %1" ).arg( item->text( 0 ) ) ); + + int idBuild = -2; + int idRebuild = -2; + int idClean = -2; + int idInstall = -2; + int idDistClean = -2; + int idQmake = -2; + int idQmakeRecursive = -2; + int idProjectConfiguration = -2; + int idAddSubproject = -2; + int idRemoveSubproject = -2; + int idDisableSubproject = -2; + int idRemoveScope = -2; + int idAddScope = -2; + + + if ( spitem->scope->scopeType() == Scope::ProjectScope && ( !spitem->scope->parent() || spitem->scope->parent()->scopeType() == Scope::ProjectScope ) ) + { + idBuild = popup.insertItem( SmallIcon( "make_kdevelop" ), i18n( "Build" ) ); + popup.setWhatsThis( idBuild, i18n( "<b>Build</b><p>Runs <b>make</b> from the selected subproject directory.<br>" + "Environment variables and make arguments can be specified " + "in the project settings dialog, <b>Make Options</b> tab." ) ); + idInstall = popup.insertItem( i18n( "Install" ) ); + popup.setWhatsThis( idBuild, i18n( "<b>Install</b><p>Runs <b>make install</b> from the selected subproject directory.<br>" + "Environment variables and make arguments can be specified " + "in the project settings dialog, <b>Make Options</b> tab." ) ); + idClean = popup.insertItem( i18n( "Clean" ) ); + popup.setWhatsThis( idBuild, i18n( "<b>Clean project</b><p>Runs <b>make clean</b> command from the project " + "directory.<br> Environment variables and make arguments can be specified " + "in the project settings dialog, <b>Make Options</b> tab." ) ); + idDistClean = popup.insertItem( i18n( "Dist-Clean" ) ); + popup.setWhatsThis( idBuild, i18n( "<b>Dist-Clean project</b><p>Runs <b>make distclean</b> command from the project " + "directory.<br> Environment variables and make arguments can be specified " + "in the project settings dialog, <b>Make Options</b> tab." ) ); + + idRebuild = popup.insertItem( SmallIcon( "rebuild" ), i18n( "Rebuild" ) ); + popup.setWhatsThis( idRebuild, i18n( "<b>Rebuild project</b><p>Runs <b>make clean</b> and then <b>make</b> from " + "the project directory.<br>Environment variables and make arguments can be " + "specified in the project settings dialog, <b>Make Options</b> tab." ) ); + idQmake = popup.insertItem( SmallIcon( "qmakerun" ), i18n( "Run qmake" ) ); + popup.setWhatsThis( idQmake, i18n( "<b>Run qmake</b><p>Runs <b>qmake</b> from the selected subproject directory. This creates or regenerates Makefile." ) ); + idQmakeRecursive = popup.insertItem( SmallIcon( "qmakerun" ), i18n( "Run qmake recursively" ) ); + popup.setWhatsThis( idQmakeRecursive, i18n( "<b>Run qmake recursively</b><p>Runs <b>qmake</b> from the selected " + "subproject directory and recurses into all subproject directories. " + "This creates or regenerates Makefile." ) ); + + popup.insertSeparator(); + idAddSubproject = popup.insertItem( SmallIcon( "folder_new" ), i18n( "Add Subproject..." ) ); + popup.setWhatsThis( idAddSubproject, i18n( "<b>Add subproject</b><p>Creates a <i>new</i> or adds an <i>existing</i> subproject to a currently selected subproject. " + "This action is allowed only if a type of the subproject is 'subdirectories'. The type of the subproject can be " + "defined in <b>Subproject Settings</b> dialog (open it from the subproject context menu)." ) ); + if ( spitem->scope->variableValues( "TEMPLATE" ).findIndex( "subdirs" ) == -1 ) + popup.setItemEnabled( idAddSubproject, false ); + idRemoveSubproject = popup.insertItem( SmallIcon( "remove_subdir" ), i18n( "Remove Subproject..." ) ); + popup.setWhatsThis( idRemoveSubproject, i18n( "<b>Remove subproject</b><p>Removes currently selected subproject. Does not delete any file from disk. Deleted subproject can be later added by calling 'Add Subproject' action." ) ); + if ( spitem->parent() == NULL ) + popup.setItemEnabled( idRemoveSubproject, false ); + idAddScope = popup.insertItem( SmallIcon( "qmake_scopenew" ), i18n( "Create Scope..." ) ); + popup.setWhatsThis( idAddScope, i18n( "<b>Create scope</b><p>Creates QMake scope in the project file of the currently selected subproject." ) ); + popup.insertSeparator(); + idProjectConfiguration = popup.insertItem( SmallIcon( "configure" ), i18n( "Subproject Settings" ) ); + popup.setWhatsThis( idProjectConfiguration, i18n( "<b>Subproject settings</b><p>Opens <b>QMake Subproject Configuration</b> dialog. " + "It provides settings for:<br>subproject type and configuration,<br>include and library paths,<br>lists of dependencies and " + "external libraries,<br>build order,<br>intermediate files locations,<br>compiler options." ) ); + } + else + { + idAddScope = popup.insertItem( SmallIcon( "qmake_scopenew" ), i18n( "Create Scope..." ) ); + popup.setWhatsThis( idAddScope, i18n( "<b>Create Scope</b><p>Creates QMake scope in the currently selected scope." ) ); + idRemoveScope = popup.insertItem( SmallIcon( "editdelete" ), i18n( "Remove Scope" ) ); + popup.setWhatsThis( idRemoveScope, i18n( "<b>Remove Scope</b><p>Removes currently selected scope." ) ); + popup.insertSeparator(); + idAddSubproject = popup.insertItem( SmallIcon( "folder_new" ), i18n( "Add Subproject..." ) ); + popup.setWhatsThis( idAddSubproject, i18n( "<b>Add subproject</b><p>Creates a <i>new</i> or adds an <i>existing</i> subproject to the currently selected scope. " + "This action is allowed only if the type of the subproject is 'subdirectories'. The type of the subproject can be " + "defined in the <b>Subproject Settings</b> dialog (open it from the subproject context menu)." ) ); + if ( spitem->scope->variableValues( "TEMPLATE" ).findIndex( "subdirs" ) == -1 ) + popup.setItemEnabled( idAddSubproject, false ); + idDisableSubproject = popup.insertItem( SmallIcon( "remove_subdir" ), i18n( "Disable Subproject..." ) ); + popup.setWhatsThis( idRemoveSubproject, i18n( "<b>Disable subproject</b><p>Disables the currently selected subproject when this scope is active. Does not delete the directory from disk. The deleted subproject can be later added by using the 'Add Subproject' action." ) ); + if( spitem->scope->variableValues( "TEMPLATE" ).findIndex( "subdirs" ) == -1 && spitem->scope->parent()->variableValues( "TEMPLATE" ).findIndex( "subdirs" ) == -1 ) + popup.setItemEnabled( idDisableSubproject, false ); + popup.insertSeparator(); + idProjectConfiguration = popup.insertItem( SmallIcon( "configure" ), i18n( "Scope Settings" ) ); + popup.setWhatsThis( idProjectConfiguration, i18n( "<b>Scope settings</b><p>Opens <b>QMake Subproject Configuration</b> dialog. " + "It provides settings for:<br>subproject type and configuration,<br>include and library paths,<br>lists of dependencies and " + "external libraries,<br>build order,<br>intermediate files locations,<br>compiler options." ) ); + } + + int r = popup.exec( p ); + + QString relpath = spitem->relativePath(); + if ( r == idAddSubproject ) + { + slotAddSubproject( spitem ); + } + if ( r == idRemoveSubproject ) + { + slotRemoveSubproject( spitem ); + } + if ( r == idDisableSubproject ) + { + slotDisableSubproject( spitem ); + } + if ( r == idAddScope ) + { + slotCreateScope( spitem ); + } + else if ( r == idRemoveScope ) + { + slotRemoveScope( spitem ); + } + else if ( r == idBuild ) + { + slotBuildTarget(); + // m_part->startMakeCommand(projectDirectory() + relpath, QString::fromLatin1("")); + } + else if ( r == idInstall ) + { + slotInstallTarget(); + // m_part->startMakeCommand(projectDirectory() + relpath, QString::fromLatin1("")); + } + else if ( r == idRebuild ) + { + slotRebuildTarget(); + } + else if ( r == idClean ) + { + slotCleanTarget(); + } + else if ( r == idDistClean ) + { + slotDistCleanTarget(); + } + + else if ( r == idQmake ) + { + m_part->startQMakeCommand( projectDirectory() + QString(QChar(QDir::separator())) + relpath ); + } + else if ( r == idQmakeRecursive ) + { + runQMakeRecursive( spitem ); + } + + else if ( r == idProjectConfiguration ) + { + m_configDlg->updateSubproject( spitem ); + m_configDlg->show(); + } +} + +void TrollProjectWidget::addFileToCurrentSubProject( GroupItem *titem, const QString &filename ) +{ + + m_filesCached = false; + m_allFilesCache.clear(); + titem->addFileToScope( filename ); +} + +void TrollProjectWidget::addFileToCurrentSubProject( GroupItem::GroupType gtype, const QString &filename ) +{ + if ( !m_shownSubproject ) + return ; + + m_filesCached = false; + m_allFilesCache.clear(); + + GroupItem *gitem = 0; + + if ( m_shownSubproject->groups.contains( gtype ) ) + gitem = m_shownSubproject->groups[ gtype ]; + + if ( !gitem ) + return ; + + gitem->addFileToScope( filename ); +} + +/** +* Method adds a file to the current project by grouped +* by file extension +*/ +void TrollProjectWidget::addFiles( QStringList &files, bool relativeToProjectRoot ) +{ + if ( !m_shownSubproject ) + return ; + kdDebug(9024) << "Files to add:"<<files << " " << relativeToProjectRoot <<endl; + m_filesCached = false; + m_allFilesCache.clear(); + + for ( QStringList::Iterator it = files.begin(); it != files.end(); ++it ) + { + QString fileName = *it; + kdDebug(9024) << "Adding file:" << fileName << " " << relativeToProjectRoot << endl; + + if ( m_shownSubproject->scope->variableValues( "TEMPLATE" ).findIndex( "subdirs" ) != -1 && !fileName.endsWith(".pro") ) + { + ChooseSubprojectDlg dlg( this, false ); + if ( dlg.exec() == QDialog::Accepted ) + { + if ( dlg.selectedSubproject() && dlg.selectedSubproject()->scope->variableValues("TEMPLATE").findIndex( "subdirs" ) != -1 ) + { + fileName = URLUtil::getRelativePath( dlg.selectedSubproject()->scope->projectDir() , + QDir::cleanDirPath( + m_shownSubproject->scope->projectDir()+ + QString(QChar(QDir::separator()))+ + fileName ) ); + overview->setCurrentItem( dlg.selectedSubproject() ); + + } + } + else + { + KMessageBox::error( this, i18n("You did not select a subproject to add the file to, or select a subproject that has subdirs."), i18n( "File adding aborted" ) ); + } + } + + QFileInfo info( fileName ); + QString ext = info.extension( false ).simplifyWhiteSpace(); + + QString noPathFileName; + if( relativeToProjectRoot ) + noPathFileName = URLUtil::getRelativePath( m_shownSubproject->scope->projectDir(), QDir::cleanDirPath(projectDirectory()+QString(QChar(QDir::separator()))+fileName ) ); + else + noPathFileName = URLUtil::getRelativePath( m_shownSubproject->scope->projectDir(), QDir::cleanDirPath(m_shownSubproject->scope->projectDir()+QString(QChar(QDir::separator()))+fileName ) ); + + if( DomUtil::readBoolEntry( *m_part->projectDom(), "/kdevtrollproject/qmake/replacePaths", false ) ) + { + QString var = m_shownSubproject->scope->findCustomVarForPath( QFileInfo( noPathFileName ).dirPath() ); + if( !var.isEmpty() ) + { + noPathFileName = "$${"+var+"}"+QString( QChar( QDir::separator() ) )+QFileInfo( noPathFileName ).fileName(); + } + } + + kdDebug(9024) << "calc filename:" << noPathFileName << endl; +// GroupItem *gitem = 0; +// GroupItem::GroupType gtype = GroupItem::groupTypeForExtension( ext ); +// if ( m_shownSubproject->groups.contains( gtype ) ) +// gitem = m_shownSubproject->groups[ gtype ]; + + + if( ext == "pro" ) + { + addSubprojectToItem( findSubprojectForPath( QFileInfo( fileName ).dirPath() ), QFileInfo( fileName ).fileName() ); + }else + { + addFileToCurrentSubProject( GroupItem::groupTypeForExtension( ext ), noPathFileName ); + slotOverviewSelectionChanged( m_shownSubproject ); + kdDebug(9024) << "emitting" << relativeToProjectRoot << " " << fileName << endl; + if( relativeToProjectRoot ) + emitAddedFile ( projectDirectory()+QString( QChar( QDir::separator() ) ) + fileName ); + else + emitAddedFile ( m_shownSubproject->scope->projectDir()+QString( QChar( QDir::separator() ) ) + fileName ); + } + } + +} + + +void TrollProjectWidget::slotAddFiles() +{ + static KURL lastVisited; + QString cleanSubprojectDir = QDir::cleanDirPath( m_shownSubproject->scope->projectDir() ); + QString title, filter; + QString otherTitle, otherFilter; + + GroupItem* item = dynamic_cast<GroupItem*>( details->selectedItem() ); + GroupItem::GroupType type = item ? item->groupType : GroupItem::NoType; + GroupItem::groupTypeMeanings( type, title, filter ); + filter += "|" + title; + + m_filesCached = false; + m_allFilesCache.clear(); + + for ( int i = GroupItem::NoType + 1; i < GroupItem::MaxTypeEnum; ++i ) + { + if ( type != i ) + { + GroupItem::groupTypeMeanings( static_cast<GroupItem::GroupType>( i ), otherTitle, otherFilter ); + filter += "\n" + otherFilter + "|" + otherTitle; + } + } + + filter += "\n*|" + i18n( "All Files" ); + + AddFilesDialog *dialog = new AddFilesDialog( cleanSubprojectDir, + filter, + this, + "Insert existing files", + true, new QComboBox( false ) ); + + dialog->setMode( KFile::Files | KFile::ExistingOnly | KFile::LocalOnly ); + + if ( !lastVisited.isEmpty() ) + { + dialog->setURL( lastVisited ); + } + + dialog->exec(); + QStringList files = dialog->selectedFiles(); + lastVisited = dialog->baseURL(); + + for ( unsigned int i = 0; i < files.count(); i++ ) + { + switch ( dialog->mode() ) + { + case AddFilesDialog::Copy: + { + // Copy selected files to current subproject folder + // and add them to the filelist + QString filename = KURL( files[ i ] ).fileName(); + KIO::NetAccess::file_copy( files[ i ], cleanSubprojectDir + QString( QChar( QDir::separator() ) ) + filename, -1, false, false, this ); + QFile testExist( cleanSubprojectDir + QString( QChar( QDir::separator() ) ) + filename ); + + if ( testExist.exists() ) + { + QStringList files( filename ); + addFiles( files, false ); + } + } + break; + + case AddFilesDialog::Link: + { + // Link selected files to current subproject folder + KProcess *proc = new KProcess( this ); + *proc << "ln"; + *proc << "-s"; + *proc << files[ i ]; + *proc << cleanSubprojectDir; + proc->start(KProcess::Block); + QString filename = files[ i ].right( files[ i ].length() - files[ i ].findRev( '/' ) - 1 ); + // and add them to the filelist + QFile testExist( cleanSubprojectDir + QString( QChar( QDir::separator() ) ) + filename ); + if ( testExist.exists() ) + { + QStringList files( filename ); + addFiles( files, false ); + } + } + break; + + case AddFilesDialog::Relative: + { + // Form relative path to current subproject folder + QString theFile = files[ i ]; + QStringList files( URLUtil::relativePathToFile( cleanSubprojectDir , theFile ) + ); + addFiles( files, false ); + } + break; + } + } +} + +GroupItem* TrollProjectWidget::getInstallRoot( QMakeScopeItem* item ) +{ + if ( item->groups.contains( GroupItem::InstallRoot ) ) + return item->groups[ GroupItem::InstallRoot ]; + return 0; +} + +GroupItem* TrollProjectWidget::getInstallObject( QMakeScopeItem* item, const QString& objectname ) +{ + GroupItem * instroot = getInstallRoot( item ); + if ( !instroot ) + return 0; + QPtrListIterator<GroupItem> it( instroot->installs ); + for ( ;it.current();++it ) + { + if ( ( *it ) ->groupType == GroupItem::InstallObject && + ( *it ) ->text( 0 ) == objectname ) + return * it; + } + return 0; + +} + +void TrollProjectWidget::slotNewFile() +{ + GroupItem * gitem = dynamic_cast<GroupItem*>( details->currentItem() ); + + m_filesCached = false; + m_allFilesCache.clear(); + + if( !gitem ) + { + gitem = dynamic_cast<GroupItem*>( details->currentItem()->parent() ); + } + + if ( gitem ) + { + if ( gitem->groupType == GroupItem::InstallObject ) + { + // QString relpath = m_shownSubproject->path.mid(projectDirectory().length()); + bool ok = FALSE; + QString filepattern = KInputDialog::getText( + i18n( "Insert New Filepattern" ), + i18n( "Please enter a filepattern relative the current " + "subproject (example docs/*.html):" ), + QString::null, &ok, this ); + if ( ok && !filepattern.isEmpty() ) + { + addFileToCurrentSubProject( gitem, filepattern ); + slotOverviewSelectionChanged( m_shownSubproject ); + } + return ; + } + if ( gitem->groupType == GroupItem::InstallRoot ) + { + // QString relpath = m_shownSubproject->path.mid(projectDirectory().length()); + bool ok = FALSE; + QString install_obj = KInputDialog::getText( + i18n( "Insert New Install Object" ), + i18n( "Please enter a name for the new object:" ), + QString::null, &ok, this ); + if ( ok && !install_obj.isEmpty() ) + { + gitem->addInstallObject( install_obj ); + //GroupItem * institem = createGroupItem( GroupItem::InstallObject, install_obj , m_shownSubproject ); + //gitem->owner->scope->addToPlusOp("INSTALLS", install_obj); + gitem->owner->scope->saveToFile(); + slotOverviewSelectionChanged( m_shownSubproject ); + } + return ; + } + } + KDevCreateFile * createFileSupport = m_part->extension<KDevCreateFile>( "KDevelop/CreateFile" ); + QString fcext; + if( gitem ) + { + switch ( gitem->groupType ) + { + case GroupItem::Sources: + fcext = "cpp"; + break; + case GroupItem::Headers: + fcext = "h"; + break; + case GroupItem::Forms: + if ( !m_part->isQt4Project() ) + fcext = "ui-widget"; + else + fcext = "ui-widget-qt4"; + break; + case GroupItem::Translations: + fcext = "ts"; + break; + case GroupItem::Lexsources: + fcext = "l"; + break; + case GroupItem::Yaccsources: + fcext = "y"; + break; + case GroupItem::Resources: + fcext = "qrc"; + break; + default: + fcext = QString::null; + } + } + KDevCreateFile::CreatedFile crFile = + createFileSupport->createNewFile( fcext, projectDirectory() + QString(QChar(QDir::separator()))+ m_shownSubproject->relativePath() ); +} + +void TrollProjectWidget::slotRemoveFile() +{ + QListViewItem * selectedItem = details->currentItem(); + if ( !selectedItem ) + return ; + + m_filesCached = false; + m_allFilesCache.clear(); + + qProjectItem *pvitem = static_cast<qProjectItem*>( selectedItem ); + // Check that it is a file (just in case) + if ( pvitem->type() != qProjectItem::File ) + return ; + FileItem *fitem = static_cast<FileItem*>( pvitem ); + removeFile( m_shownSubproject, fitem ); +} + +void TrollProjectWidget::slotExcludeFileFromScopeButton() +{ + QListViewItem * selectedItem = details->currentItem(); + if ( !selectedItem ) + return ; + qProjectItem *pvitem = static_cast<qProjectItem*>( selectedItem ); + // Check that it is a file (just in case) + if ( pvitem->type() != qProjectItem::File ) + return ; + FileItem *fitem = static_cast<FileItem*>( pvitem ); + + GroupItem *gitem = static_cast<GroupItem*>( fitem->parent() ); + + gitem->removeFileFromScope( fitem->text( 0 ) ); +} + +void TrollProjectWidget::slotDetailsSelectionChanged( QListViewItem *item ) +{ + if ( !item ) + { + removefileButton->setEnabled( false ); + excludeFileFromScopeButton->setEnabled( false ); + return ; + } + removefileButton->setEnabled( false ); + excludeFileFromScopeButton->setEnabled( false ); + + qProjectItem *pvitem = static_cast<qProjectItem*>( item ); + if ( pvitem->type() == qProjectItem::Group ) + { + GroupItem * gitem = static_cast<GroupItem*>( item ); + if ( gitem->groupType == GroupItem::InstallObject ) + { + excludeFileFromScopeButton->setEnabled( true ); + newfileButton->setEnabled( true ); + } + else if ( gitem->groupType == GroupItem::InstallRoot ) + { + newfileButton->setEnabled( true ); + } + else + { + addfilesButton->setEnabled( true ); + newfileButton->setEnabled( true ); + } + + + } + else if ( pvitem->type() == qProjectItem::File ) + { + removefileButton->setEnabled( true ); + excludeFileFromScopeButton->setEnabled( true ); + /* buildTargetButton->setEnabled(true); + rebuildTargetButton->setEnabled(true); + executeTargetButton->setEnabled(true);*/ + } +} + +void TrollProjectWidget::slotDetailsContextMenu( KListView *, QListViewItem *item, const QPoint &p ) +{ + if ( !item ) + return ; + + qProjectItem *pvitem = static_cast<qProjectItem*>( item ); + if ( pvitem->type() == qProjectItem::Group ) + { + GroupItem * titem = static_cast<GroupItem*>( pvitem ); + QString title, ext; + GroupItem::groupTypeMeanings( titem->groupType, title, ext ); + + KPopupMenu popup( this ); + popup.insertTitle( title ); + + int idInsExistingFile = -2; + int idInsNewFile = -2; + int idInsInstallObject = -2; + int idInsNewFilepatternItem = -2; + int idSetInstObjPath = -2; + int idLUpdate = -2; + int idLRelease = -2; + int idRemoveFile = -2; + + // int idFileProperties = popup.insertItem(SmallIconSet("filenew"),i18n("Properties...")); + if ( titem->groupType == GroupItem::InstallRoot ) + { + idInsInstallObject = popup.insertItem( SmallIconSet( "fileopen" ), i18n( "Add Install Object..." ) ); + popup.setWhatsThis( idInsInstallObject, i18n( "<b>Add install object</b><p>Creates QMake install object. " + "It is possible to define a list of files to install and installation locations for each object. Warning! " + "Install objects without path specified will not be saved to a project file." ) ); + } + else if ( titem->groupType == GroupItem::InstallObject ) + { + idSetInstObjPath = popup.insertItem( SmallIconSet( "fileopen" ), i18n( "Install Path..." ) ); + popup.setWhatsThis( idSetInstObjPath, i18n( "<b>Install path</b><p>Allows to choose the installation path for the current install object." ) ); + idInsNewFilepatternItem = popup.insertItem( SmallIconSet( "fileopen" ), i18n( "Add Pattern of Files to Install..." ) ); + popup.setWhatsThis( idInsNewFilepatternItem, i18n( "<b>Add pattern of files to install</b><p>Defines the pattern to match files which will be installed. " + "It is possible to use wildcards and relative paths like <i>docs/*</i>." ) ); + idRemoveFile = popup.insertItem( SmallIconSet( "editdelete" ), i18n( "Remove Install Object" ) ); + popup.setWhatsThis( idRemoveFile, i18n( "<b>Remove install object</b><p>Removes the install object the current group." ) ); + } + else if ( titem->groupType == GroupItem::Translations ) + { + idInsNewFile = popup.insertItem( SmallIconSet( "filenew" ), i18n( "Create New File..." ) ); + popup.setWhatsThis( idInsNewFile, i18n( "<b>Create new file</b><p>Creates a new translation file and adds it to a currently selected TRANSLATIONS group." ) ); + idInsExistingFile = popup.insertItem( SmallIconSet( "fileopen" ), i18n( "Add Existing Files..." ) ); + popup.setWhatsThis( idInsExistingFile, i18n( "<b>Add existing files</b><p>Adds existing translation (*.ts) files to a currently selected TRANSLATIONS group. It is " + "possible to copy files to a current subproject directory, create symbolic links or " + "add them with the relative path." ) ); + idLUpdate = popup.insertItem( SmallIconSet( "konsole" ), i18n( "Update Translation Files" ) ); + popup.setWhatsThis( idLUpdate, i18n( "<b>Update Translation Files</b><p>Runs <b>lupdate</b> command from the current subproject directory. It collects translatable " + "messages and saves them into translation files." ) ); + idLRelease = popup.insertItem( SmallIconSet( "konsole" ), i18n( "Release Binary Translations" ) ); + popup.setWhatsThis( idLRelease, i18n( "<b>Release Binary Translations</b><p>Runs <b>lrelease</b> command from the current subproject directory. It creates binary " + "translation files that are ready to be loaded at program execution." ) ); + } + else // File group containing files + { + idInsNewFile = popup.insertItem( SmallIconSet( "filenew" ), i18n( "Create New File..." ) ); + popup.setWhatsThis( idInsNewFile, i18n( "<b>Create new file</b><p>Creates a new file and adds it to a currently selected group." ) ); + idInsExistingFile = popup.insertItem( SmallIconSet( "fileopen" ), i18n( "Add Existing Files..." ) ); + popup.setWhatsThis( idInsExistingFile, i18n( "<b>Add existing files</b><p>Adds existing files to a currently selected group. It is " + "possible to copy files to a current subproject directory, create symbolic links or " + "add them with the relative path." ) ); + } + int r = popup.exec( p ); + QString cleanSubprojectPath = QDir::cleanDirPath( m_shownSubproject->scope->projectDir() ); + + if ( r == idSetInstObjPath ) + { + KURLRequesterDlg dialog( i18n( "Choose Install Path" ), i18n( "Enter a path " + "(example /usr/local/share/... ):" ), this, 0 ); + dialog.urlRequester() ->setMode( KFile::Directory ); + dialog.urlRequester() ->setURL( titem->owner->scope->variableValues( titem->text( 0 ) + ".path" ).front() ); + if ( dialog.exec() == QDialog::Accepted ) + { + titem->owner->scope->setEqualOp( titem->text( 0 ) + ".path", dialog.urlRequester() ->url() ); + titem->owner->scope->saveToFile( ); + } + } + else if ( r == idInsNewFilepatternItem ) + { + bool ok = FALSE; + QString filepattern = KInputDialog::getText( + i18n( "Add Pattern of Files to Install" ), + i18n( "Enter a pattern relative to the current " + "subproject (example docs/*.html):" ), + QString::null, &ok, this ); + if ( ok && !filepattern.isEmpty() ) + { + addFileToCurrentSubProject( titem, filepattern ); + slotOverviewSelectionChanged( m_shownSubproject ); + } + } + else if ( r == idInsExistingFile ) + { + AddFilesDialog * dialog = new AddFilesDialog( cleanSubprojectPath, + ext + "|" + title + " (" + ext + ")", + this, + "Add existing files", + true, new QComboBox( false ) ); + dialog->setMode( KFile::Files | KFile::ExistingOnly | KFile::LocalOnly ); + if ( dialog->exec() == QDialog::Rejected ) + return ; + QStringList files = dialog->selectedFiles(); + for ( unsigned int i = 0;i < files.count();++i ) + { + switch ( dialog->mode() ) + { + case AddFilesDialog::Copy: + { + // Copy selected files to current subproject folder + // and add them to the filelist + QString filename = KURL( files[ i ] ).fileName(); + KIO::NetAccess::file_copy( files[ i ], cleanSubprojectPath + QString( QChar( QDir::separator() ) ) + filename, -1, false, false, this ); + QFile testExist( cleanSubprojectPath + QString( QChar( QDir::separator() ) ) + filename ); + + if ( testExist.exists() ) + { + QStringList files( filename ); + addFiles( files, false ); + } + } + break; + + case AddFilesDialog::Link: + { + // Link selected files to current subproject folder + KProcess *proc = new KProcess( this ); + *proc << "ln"; + *proc << "-s"; + *proc << files[ i ]; + *proc << cleanSubprojectPath; + proc->start(KProcess::Block); + QString filename = files[ i ].right( files[ i ].length() - files[ i ].findRev( '/' ) - 1 ); + // and add them to the filelist + QFile testExist( cleanSubprojectPath + QString( QChar( QDir::separator() ) ) + filename ); + if ( testExist.exists() ) + { + QStringList files( filename ); + addFiles( files, false ); + } + } + break; + + case AddFilesDialog::Relative: + { + // Form relative path to current subproject folder + QString theFile = files[ i ]; + QStringList files( URLUtil::relativePathToFile( cleanSubprojectPath, theFile ) + ); + addFiles( files, false ); + } + break; + } + } + // Update project file + if ( titem && titem->owner ) + { + titem->owner->scope->saveToFile( ); + } + // Update subprojectview + slotOverviewSelectionChanged( m_shownSubproject ); + } + else if ( r == idInsNewFile ) + { + KDevCreateFile * createFileSupport = m_part->extension<KDevCreateFile>( "KDevelop/CreateFile" ); + QString fcext; + switch ( titem->groupType ) + { + case GroupItem::Sources: + fcext = "cpp"; + break; + case GroupItem::Headers: + fcext = "h"; + break; + case GroupItem::Forms: + if ( !m_part->isQt4Project() ) + fcext = "ui-widget"; + else + fcext = "ui-widget-qt4"; + break; + case GroupItem::Translations: + fcext = "ts"; + break; + case GroupItem::Lexsources: + fcext = "l"; + break; + case GroupItem::Yaccsources: + fcext = "y"; + break; + case GroupItem::Resources: + fcext = "qrc"; + break; + default: + fcext = QString::null; + } + KDevCreateFile::CreatedFile crFile = + createFileSupport->createNewFile( fcext, cleanSubprojectPath ); + + } + else if ( r == idInsInstallObject ) + { + bool ok = FALSE; + QString install_obj = KInputDialog::getText( + i18n( "Add Install Object" ), + i18n( "Enter a name for the new object:" ), + QString::null, &ok, this ); + if ( ok && !install_obj.isEmpty() ) + { + titem->addInstallObject( install_obj ); + slotOverviewSelectionChanged( m_shownSubproject ); + } + } + else if ( r == idLUpdate ) + { + QString cmd = "lupdate "; + cmd += m_shownSubproject->scope->fileName(); + m_part->appFrontend() ->startAppCommand( m_shownSubproject->scope->projectDir(), cmd, false ); + } + else if ( r == idLRelease ) + { + QString cmd = "lrelease "; + cmd += m_shownSubproject->scope->fileName(); + m_part->appFrontend() ->startAppCommand( m_shownSubproject->scope->projectDir(), cmd, false ); + }else if( r == idRemoveFile ) + { + static_cast<GroupItem*>(titem->parent())->removeInstallObject( titem ); + slotOverviewSelectionChanged( m_shownSubproject ); + } + } + else if ( pvitem->type() == qProjectItem::File ) + { + + removefileButton->setEnabled( true ); + FileItem *fitem = static_cast<FileItem*>( pvitem ); + GroupItem* gitem = static_cast<GroupItem*>( item->parent() ); + + KPopupMenu popup( this ); + if ( !( gitem->groupType == GroupItem::InstallObject ) ) + popup.insertTitle( i18n( "File: %1" ).arg( fitem->text( 0 ) ) ); + else + popup.insertTitle( i18n( "Pattern: %1" ).arg( fitem->text( 0 ) ) ); + + int idRemoveFile = -2; + int idSubclassWidget = -2; + int idUpdateWidgetclass = -2; + int idBuildFile = -2; + int idUISubclasses = -2; + int idViewUIH = -2; + int idFileProperties = -2; + int idEditInstallPattern = -2; + + if ( !fitem->uiFileLink.isEmpty() ) + { + idUpdateWidgetclass = popup.insertItem( SmallIconSet( "qmake_subclass" ), i18n( "Edit ui-Subclass..." ) ); + popup.setWhatsThis( idUpdateWidgetclass, i18n( "<b>Edit ui-subclass</b><p>Launches <b>Subclassing</b> wizard " + "and prompts to implement missing in childclass slots and functions." ) ); + } + if ( fitem->text( 0 ).contains( ".ui" ) ) + { + idSubclassWidget = popup.insertItem( SmallIconSet( "qmake_subclass" ), i18n( "Subclassing Wizard..." ) ); + popup.setWhatsThis( idSubclassWidget, i18n( "<b>Subclass widget</b><p>Launches <b>Subclassing</b> wizard. " + "It allows to create a subclass from the class defined in .ui file. " + "There is also possibility to implement slots and functions defined in the base class." ) ); + if ( !m_part->isQt4Project() ) + { + idViewUIH = popup.insertItem( SmallIconSet( "qmake_ui_h" ), i18n( "Open ui.h File" ) ); + popup.setWhatsThis( idViewUIH, i18n( "<b>Open ui.h file</b><p>Opens .ui.h file associated with the selected .ui." ) ); + } + idUISubclasses = popup.insertItem( SmallIconSet( "qmake_subclass" ), i18n( "List of Subclasses..." ) ); + popup.setWhatsThis( idUISubclasses, i18n( "<b>List of subclasses</b><p>Shows subclasses list editor. " + "There is possibility to add or remove subclasses from the list." ) ); + } + if ( !( gitem->groupType == GroupItem::InstallObject ) ) + { + idRemoveFile = popup.insertItem( SmallIconSet( "editdelete" ), i18n( "Remove File" ) ); + popup.setWhatsThis( idRemoveFile, i18n( "<b>Remove file</b><p>Removes file from a current group. For sources, this also removes the subclassing information." ) ); + idFileProperties = popup.insertItem( SmallIconSet( "configure_file" ), i18n( "Exclude File" ) ); + popup.setWhatsThis( idFileProperties, i18n( "<b>Exclude File</b><p>Excludes the file from this Scope. Does not touch subclassing information" ) ); + } + else + { + idEditInstallPattern = popup.insertItem( SmallIconSet( "configure_file" ), i18n( "Edit Pattern" ) ); + popup.setWhatsThis( idEditInstallPattern, i18n( "<b>Edit pattern</b><p>Allows to edit install files pattern." ) ); + idRemoveFile = popup.insertItem( SmallIconSet( "editdelete" ), i18n( "Remove Pattern" ) ); + popup.setWhatsThis( idRemoveFile, i18n( "<b>Remove pattern</b><p>Removes install files pattern from the current install object." ) ); + } + if ( !( gitem->groupType == GroupItem::InstallObject ) ) + { + KURL::List urls; + urls.append( m_shownSubproject->scope->projectDir() + QChar( QDir::separator() ) + m_shownSubproject->scope->resolveVariables( fitem->localFilePath ) ); + FileContext context( urls ); + m_part->core() ->fillContextMenu( &popup, &context ); + } + if ( gitem->groupType == GroupItem::Sources ) + { + idBuildFile = popup.insertItem( SmallIconSet( "make_kdevelop" ), i18n( "Build File" ) ); + popup.setWhatsThis( idBuildFile, i18n( "<b>Build File</b><p>Builds the object file for this source file." ) ); + } + + int r = popup.exec( p ); + if ( r == idRemoveFile ) + removeFile( m_shownSubproject, fitem ); + else if ( r == idFileProperties ) + { + slotExcludeFileFromScopeButton(); + } + else if ( r == idViewUIH ) + { + kdDebug(9024) << "Opening:" << fitem->text(0) << ";" << fitem->text(0).replace(".ui","") << endl; + m_part->partController() ->editDocument( KURL( m_shownSubproject->scope->projectDir() + QChar( QDir::separator() ) + + fitem->localFilePath.replace(".ui","") + ".h" ) ); + + } + else if ( r == idSubclassWidget ) + { + QStringList newFileNames; + newFileNames = m_part->languageSupport() ->subclassWidget( m_shownSubproject->scope->projectDir() + QChar( QDir::separator() ) + fitem->localFilePath ); + kdDebug(9024) << "got new filenames: " << newFileNames << endl; + if ( !newFileNames.empty() ) + { + QDomDocument & dom = *( m_part->projectDom() ); + for ( uint i = 0; i < newFileNames.count(); ++i ) + { + QString srcfile_relpath = URLUtil::getRelativePath( m_shownSubproject->scope->projectDir(), newFileNames[ i ] ) ; + newFileNames[i] = URLUtil::getRelativePath( projectDirectory(), newFileNames[ i ] ) ; + QString uifile_relpath = m_shownSubproject->relativePath() + QChar( QDir::separator() ) + fitem->localFilePath; + DomUtil::PairList list = DomUtil::readPairListEntry( dom, "/kdevtrollproject/subclassing" , + "subclass", "sourcefile", "uifile" ); + + list << DomUtil::Pair( srcfile_relpath, uifile_relpath ); + DomUtil::writePairListEntry( dom, "/kdevtrollproject/subclassing", "subclass", "sourcefile", "uifile", list ); + // newFileNames[i] = newFileNames[i].replace(QRegExp(projectDirectory()+"/"),""); + qWarning( "new file: %s", newFileNames[ i ].latin1() ); + } + m_subclasslist = DomUtil::readPairListEntry( dom, "/kdevtrollproject/subclassing" , + "subclass", "sourcefile", "uifile" ); + + m_part->addFiles( newFileNames ); + } + } + else if ( r == idUpdateWidgetclass ) + { + QString noext = fitem->text( 0 ); + if ( noext.findRev( '.' ) > -1 ) + noext = noext.left( noext.findRev( '.' ) ); + QStringList dummy; + QString uifile = fitem->uiFileLink; + if ( uifile.findRev( QString( QChar( QDir::separator() ) ) ) > -1 ) + { + QStringList uisplit = QStringList::split( QString( QChar( QDir::separator() ) ), uifile ); + uifile = uisplit[ uisplit.count() - 1 ]; + } + m_part->languageSupport() ->updateWidget( m_shownSubproject->scope->projectDir() + QString( QChar( QDir::separator() ) ) + uifile, noext ); + } + else if ( r == idUISubclasses ) + { + QDomDocument & dom = *( m_part->projectDom() ); + DomUtil::PairList list = DomUtil::readPairListEntry( dom, "/kdevtrollproject/subclassing" , + "subclass", "sourcefile", "uifile" ); + SubclassesDlg *sbdlg = new SubclassesDlg( m_shownSubproject->relativePath() + QChar( QDir::separator() ) + fitem->localFilePath, + list, projectDirectory() ); + + if ( sbdlg->exec() ) + { + QDomElement el = DomUtil::elementByPath( dom, "/kdevtrollproject" ); + QDomElement el2 = DomUtil::elementByPath( dom, "/kdevtrollproject/subclassing" ); + if ( ( !el.isNull() ) && ( !el2.isNull() ) ) + { + el.removeChild( el2 ); + } + + DomUtil::writePairListEntry( dom, "/kdevtrollproject/subclassing", "subclass", "sourcefile", "uifile", list ); + + m_subclasslist = DomUtil::readPairListEntry( dom, "/kdevtrollproject/subclassing" , + "subclass", "sourcefile", "uifile" ); + } + } + else if ( r == idEditInstallPattern ) + { + GroupItem * titem = static_cast<GroupItem*>( item->parent() ); + + bool ok = FALSE; + QString filepattern = KInputDialog::getText( + i18n( "Edit Pattern" ), + i18n( "Enter a pattern relative to the current " + "subproject (example docs/*.html):" ), + fitem->text( 0 ) , &ok, this ); + if ( ok && !filepattern.isEmpty() ) + { + removeFile( m_shownSubproject, fitem ); + addFileToCurrentSubProject( titem, filepattern ); + slotOverviewSelectionChanged( m_shownSubproject ); + } + } + else if ( r == idBuildFile ) + { + buildFile( m_shownSubproject, fitem ); + } + } +} + + +void TrollProjectWidget::removeFile( QMakeScopeItem *spitem, FileItem *fitem ) +{ + GroupItem * gitem = static_cast<GroupItem*>( fitem->parent() ); + + m_filesCached = false; + m_allFilesCache.clear(); + + QString realfilename = spitem->scope->resolveVariables( fitem->localFilePath ); + if ( KMessageBox::warningYesNo( this, + "<qt>" + + i18n( "Do you want to delete the file <strong>%1</strong> from the project and your disk?" ) + .arg( fitem->text( 0 ) ) + + "</qt>", + i18n( "Remove File" ), + KStdGuiItem::remove(), + KStdGuiItem::no(), + "deleteFileFromQMakeProject" ) == KMessageBox::No ) + { + return; + }else + { + kdDebug(9024) << "Deleting file as the user wished: " << spitem->scope->projectDir() + QString( QChar( QDir::separator() ) ) + realfilename << endl; + KIO::NetAccess::del( KURL::fromPathOrURL( spitem->scope->projectDir() + QString( QChar( QDir::separator() ) ) + realfilename ), 0 ); + } + + if ( gitem->groupType != GroupItem::InstallObject ) + { + QString removedFileName = spitem->relativePath() + QString( QChar( QDir::separator() ) ) + realfilename; + if ( removedFileName.startsWith( QDir::rootDirPath() ) ) + removedFileName = removedFileName.mid( 1 ); + emitRemovedFile( removedFileName ); + } + + + //remove subclassing info + QDomDocument &dom = *( m_part->projectDom() ); + DomUtil::PairList list = DomUtil::readPairListEntry( dom, "/kdevtrollproject/subclassing" , + "subclass", "sourcefile", "uifile" ); + QPtrList<DomUtil::Pair> pairsToRemove; + DomUtil::PairList::iterator it; + for ( it = list.begin(); it != list.end(); ++it ) + { + if ( ( ( *it ).first == realfilename ) || ( ( *it ).second == realfilename ) ) + { + pairsToRemove.append( &( *it ) ); + } + } + DomUtil::Pair *pair; + for ( pair = pairsToRemove.first(); pair; pair = pairsToRemove.next() ) + { + list.remove( *pair ); + } + QDomElement el = DomUtil::elementByPath( dom, "/kdevtrollproject" ); + QDomElement el2 = DomUtil::elementByPath( dom, "/kdevtrollproject/subclassing" ); + if ( ( !el.isNull() ) && ( !el2.isNull() ) ) + { + el.removeChild( el2 ); + } + DomUtil::writePairListEntry( dom, "/kdevtrollproject/subclassing", "subclass", "sourcefile", "uifile", list ); + + gitem->removeFileFromScope( fitem->text( 0 ) ); +} + +void TrollProjectWidget::emitAddedFile( const QString &fileName ) +{ + emit m_part->addedFilesToProject( QStringList( fileName ) ); +} + + +void TrollProjectWidget::emitRemovedFile( const QString &fileName ) +{ + emit m_part->removedFilesFromProject( QStringList( fileName ) ); +} + + +QString TrollProjectWidget::getUiFileLink( const QString &relpath, const QString& filename ) +{ + DomUtil::PairList::iterator it; + for ( it = m_subclasslist.begin();it != m_subclasslist.end(); ++it ) + { + if ( ( *it ).first == relpath + filename ) + return ( *it ).second; + } + return ""; +} + +void TrollProjectWidget::slotBuildOpenFile() +{ + KParts::ReadWritePart * part = dynamic_cast<KParts::ReadWritePart*>( m_part->partController() ->activePart() ); + if ( !part || !part->url().isLocalFile() ) + return ; + + QString fileName = part->url().path(); + QFileInfo fi( fileName ); + QString sourceDir = fi.dirPath(); + QString baseName = fi.baseName( true ); + kdDebug( 9024 ) << "Compiling " << fileName + << "in dir " << sourceDir + << " with baseName " << baseName << endl; + + + QString buildDir = sourceDir; + QString target = baseName + ".o"; + + m_part->mainWindow() ->raiseView( m_part->makeFrontend() ->widget() ); + // m_part->startMakeCommand(buildDir, target); + + QPtrList<QMakeScopeItem> list = findSubprojectForFile( fi ); + + QMakeScopeItem *spitem; + for ( spitem = list.first(); spitem; spitem = list.next() ) + { + QString buildcmd = constructMakeCommandLine( spitem->scope ); + QString dircmd = "cd " + KProcess::quote( spitem->scope->projectDir() ) + " && " ; + kdDebug( 9024 ) << "builddir " << spitem->scope->projectDir() << ", cmd " << dircmd + buildcmd + " " + target << endl; + m_part->queueCmd( spitem->scope->projectDir(), dircmd + buildcmd + " " + target ); + } + + // startMakeCommand(buildDir, target); + +} + + +void TrollProjectWidget::slotExecuteProject() +{ + QString program = m_part->mainProgram(); + if ( program.isEmpty() ) + { + KMessageBox::sorry( this, i18n( "Please specify the executable name in the " + "project options dialog or select an application subproject in the QMake Manager." ), i18n( "No Executable Found" ) ); + return ; + } + + //only run once + if (m_part->appFrontend()->isRunning()) + { + if (KMessageBox::questionYesNo(this, i18n("Your application is currently running. Do you want to restart it?"), i18n("Application Already Running"), i18n("&Restart Application"), i18n("Do &Nothing")) == KMessageBox::No) + return; + m_part->appFrontend()->stopApplication(); + while(m_part->appFrontend()->isRunning()) + { + KApplication::kApplication()->processEvents(); + usleep(100); + } + } + + if ( !program.startsWith( QDir::rootDirPath() ) ) + program.prepend( "." + QString( QChar( QDir::separator() ) ) ); + + + // Build environment variables to prepend to the executable path + QString runEnvVars = QString::null; + DomUtil::PairList list = + DomUtil::readPairListEntry( *( m_part->projectDom() ), "/kdevtrollproject/run/envvars", "envvar", "name", "value" ); + + DomUtil::PairList::ConstIterator it; + for ( it = list.begin(); it != list.end(); ++it ) + { + const DomUtil::Pair &pair = ( *it ); + if ( ( !pair.first.isEmpty() ) && ( !pair.second.isEmpty() ) ) + runEnvVars += pair.first + "=" + pair.second + " "; + } + program.prepend( runEnvVars ); + program.append( " " + m_part->runArguments() + " " ); + + bool inTerminal = DomUtil::readBoolEntry( *( m_part->projectDom() ), "/kdevtrollproject/run/terminal" ); + m_part->appFrontend() ->startAppCommand( m_part->runDirectory(), program, inTerminal ); +} + + +void TrollProjectWidget::slotCleanProject() +{ + runClean(m_rootSubproject, "clean"); +} + +void TrollProjectWidget::slotCleanTarget() +{ + runClean(m_shownSubproject, "clean"); +} + +void TrollProjectWidget::slotDistCleanProject() +{ + runClean(m_rootSubproject, "distclean"); + +} + +void TrollProjectWidget::slotDistCleanTarget() +{ + runClean(m_shownSubproject, "distclean"); +} + +void TrollProjectWidget::runClean( QMakeScopeItem* item, const QString& cleantargetname ) +{ + // no subproject selected + m_part->partController() ->saveAllFiles(); + if ( !item ) + return ; + // can't build from scope + if ( item->scope->scopeType() != Scope::ProjectScope ) + return ; + + QString dir = item->scope->projectDir(); + createMakefileIfMissing( dir, item ); + + m_part->mainWindow() ->raiseView( m_part->makeFrontend() ->widget() ); + QString dircmd = "cd " + KProcess::quote( dir ) + " && " ; + QString rebuildcmd = constructMakeCommandLine( item->scope ) + " "+cleantargetname; + m_part->queueCmd( dir, dircmd + rebuildcmd ); +} + +QString TrollProjectWidget::constructMakeCommandLine( Scope* s ) +{ + QString makeFileName; + if ( s ) + makeFileName = s->resolveVariables( s->variableValues( "MAKEFILE", true, true, true ).front() ); + + QDomDocument & dom = *( m_part->projectDom() ); + + QString cmdline = DomUtil::readEntry( dom, "/kdevtrollproject/make/makebin" ); + if ( cmdline.isEmpty() ) + cmdline = MAKE_COMMAND; + if ( !makeFileName.isEmpty() ) + { + cmdline += " -f " + makeFileName; + } + if ( !DomUtil::readBoolEntry( dom, "/kdevtrollproject/make/abortonerror" ) ) + cmdline += " -k"; + bool runmultiple = DomUtil::readBoolEntry(dom, "/kdevtrollproject/make/runmultiplejobs"); + int jobs = DomUtil::readIntEntry( dom, "/kdevtrollproject/make/numberofjobs" ); + if ( jobs != 0 && runmultiple ) + { + cmdline += " -j"; + cmdline += QString::number( jobs ); + } + if ( DomUtil::readBoolEntry( dom, "/kdevtrollproject/make/dontact" ) ) + cmdline += " -n"; + + cmdline += " "; + cmdline.prepend( m_part->makeEnvironment() ); + + return cmdline; +} + + +void TrollProjectWidget::createMakefileIfMissing( const QString &dir, QMakeScopeItem *item ) +{ + QFileInfo fi; + QFileInfo fi2; + kdDebug(9024) << "Makefile:" << item->scope->variableValues( "MAKEFILE", true, true, true ) << endl; + if ( item->scope->variableValues( "MAKEFILE", true, true, true ).isEmpty() ) + { + fi.setFile( dir + QString( QChar( QDir::separator() ) ) + "Makefile" ); + fi2.setFile( dir + QString( QChar( QDir::separator() ) ) + "makefile" ); + } + else + { + QString realmf = item->scope->resolveVariables( item->scope->variableValues( "MAKEFILE", true, true, true ).front() ); + fi.setFile( realmf ); + fi2.setFile( dir + QString( QChar( QDir::separator() ) ) + realmf ); + } + if ( !fi.exists() && !fi2.exists() ) + { + int r = KMessageBox::questionYesNo( this, i18n( "There is no Makefile in this directory. Run qmake first?" ), QString::null, i18n( "Run qmake" ), i18n( "Do Not Run" ) ); + if ( r == KMessageBox::No ) + return ; + m_part->startQMakeCommand( dir ); + } +} + +QMakeScopeItem* TrollProjectWidget::findSubprojectForPath( const QString& relPath ) +{ + if( !m_rootSubproject ) + return 0; + QStringList dirs = QStringList::split("/", relPath); + QMakeScopeItem* pitem = static_cast<QMakeScopeItem*>(m_rootSubproject); + for( QStringList::iterator it = dirs.begin(); it != dirs.end(); ++it) + { + QListViewItem* item = pitem->firstChild(); + while( item ) + { + QMakeScopeItem* sitem = static_cast<QMakeScopeItem*>(item); + if( QFileInfo( sitem->scope->projectDir() ).fileName() == *it ) + { + pitem = sitem; + break; + } + } + } + return pitem; +} + +QPtrList<QMakeScopeItem> TrollProjectWidget::findSubprojectForFile( QFileInfo fi ) +{ + QPtrList<QMakeScopeItem> list; + findSubprojectForFile( list, m_rootSubproject, fi.absFilePath() ); + return list; +} + +void TrollProjectWidget::findSubprojectForFile( QPtrList<QMakeScopeItem> &list, QMakeScopeItem * item, QString absFilePath ) +{ + if( !item ) + return; + + QDir d( item->scope->projectDir() ); + + QStringList vars = item->scope->variableValues( "SOURCES" ); + for ( QStringList::Iterator it = vars.begin(); it != vars.end(); ++it ) + { + QFileInfo fi2( d, item->scope->resolveVariables( *it ) ); + if ( absFilePath == fi2.absFilePath() ) + list.append( item ); + } + + vars = item->scope->variableValues( "HEADERS" ); + for ( QStringList::Iterator it = vars.begin(); it != vars.end(); ++it ) + { + QFileInfo fi2( d, item->scope->resolveVariables( *it ) ); + if ( absFilePath == fi2.absFilePath() ) + list.append( item ); + } + + QListViewItem * child = item->firstChild(); + while ( child ) + { + QMakeScopeItem * spitem = dynamic_cast<QMakeScopeItem*>( child ); + + if ( spitem ) + { + findSubprojectForFile( list, spitem, absFilePath ); + } + + child = child->nextSibling(); + } +} + +void TrollProjectWidget::slotRemoveScope( QMakeScopeItem * spitem ) +{ + if ( spitem == 0 && m_shownSubproject == 0 ) + return ; + else + { + m_filesCached = false; + m_allFilesCache.clear(); + + QMakeScopeItem* pitem = dynamic_cast<QMakeScopeItem *>( spitem->parent() ); + if ( pitem != 0 ) + { + switch ( spitem->scope->scopeType() ) + { + case Scope::FunctionScope: + if( !pitem->scope->deleteFunctionScope( spitem->scope->getNum() ) ) + { + KMessageBox::error(this, i18n("Could not delete Function Scope.\nThis is an internal error, please write a bug report to bugs.kde.org and include the output of kdevelop when run from a shell."),i18n("Function Scope Deletion failed")); + return; + } + // pitem->scopes.remove( spitem ); + break; + case Scope::IncludeScope: + if( !pitem->scope->deleteIncludeScope( spitem->scope->getNum() ) ) + { + KMessageBox::error(this, i18n("Could not delete Include Scope.\nThis is an internal error, please write a bug report to bugs.kde.org and include the output of kdevelop when run from a shell."),i18n("Include Scope Deletion failed")); + return; + } + // pitem->scopes.remove( spitem ); + delete spitem; + spitem = pitem; + pitem = dynamic_cast<QMakeScopeItem *>( pitem->parent() ); + // pitem->scopes.remove(spitem); + break; + case Scope::SimpleScope: + if( !pitem->scope->deleteSimpleScope( spitem->scope->getNum() ) ) + { + KMessageBox::error(this, i18n("Could not delete Scope.\nThis is an internal error, please write a bug report to bugs.kde.org and include the output of kdevelop when run from a shell."),i18n("Scope Deletion failed")); + return; + } + // pitem->scopes.remove( spitem ); + break; + default: + break; + } + pitem->scope->saveToFile(); + delete spitem; + m_shownSubproject = pitem; + overview->setCurrentItem ( m_shownSubproject ); + overview->setSelected( m_shownSubproject, true ); + slotOverviewSelectionChanged( m_shownSubproject ); + } + } +} + +QMakeScopeItem * TrollProjectWidget::findSubprojectForScope( QMakeScopeItem * scope ) +{ + if ( ( scope == 0 ) || ( scope->parent() == 0 ) ) + return 0; + if ( scope->scope->scopeType() == Scope::ProjectScope ) + return scope; + return findSubprojectForScope( dynamic_cast<QMakeScopeItem *>( scope->parent() ) ); +} + +void TrollProjectWidget::focusInEvent( QFocusEvent * /*e*/ ) +{ + switch ( m_lastFocusedView ) + { + case DetailsView: + details->setFocus(); + break; + case SubprojectView: + default: + overview->setFocus(); + } +} + +void TrollProjectWidget::setLastFocusedView( TrollProjectView view ) +{ + m_lastFocusedView = view; +} + +void TrollProjectWidget::runQMakeRecursive( QMakeScopeItem* proj ) +{ + if( m_part->isQt4Project() ) + { + m_part->startQMakeCommand( proj->scope->projectDir(), true ); + }else + { + if ( proj->scope->scopeType() == Scope::ProjectScope ) + { + m_part->startQMakeCommand( proj->scope->projectDir() ); + } + QMakeScopeItem* item = static_cast<QMakeScopeItem*>( proj->firstChild() ); + while ( item ) + { + runQMakeRecursive( item ); + item = static_cast<QMakeScopeItem*>( item->nextSibling() ); + } + } +} + +void TrollProjectWidget::slotBuildSelectedFile() +{ + QListViewItem * selectedItem = details->currentItem(); + if ( !selectedItem ) + return ; + qProjectItem *pvitem = static_cast<qProjectItem*>( selectedItem ); + // Check that it is a file (just in case) + if ( pvitem->type() != qProjectItem::File ) + return ; + FileItem *fitem = static_cast<FileItem*>( pvitem ); + buildFile( m_shownSubproject, fitem ); +} + +void TrollProjectWidget::buildFile( QMakeScopeItem* spitem, FileItem* fitem ) +{ + QFileInfo fi( spitem->scope->projectDir() + QChar( QDir::separator() ) + spitem->scope->resolveVariables( fitem->localFilePath ) ); + QString sourceDir = fi.dirPath(); + QString baseName = fi.baseName( true ); + kdDebug( 9024 ) << "Compiling " << spitem->scope->resolveVariables( fitem->text( 0 ) ) + << "in dir " << sourceDir + << " with baseName " << baseName << endl; + + QString buildDir = sourceDir; + QString target = baseName + ".o"; + if( !spitem->scope->variableValues("OBJECTS_DIR").isEmpty() ) + target = spitem->scope->resolveVariables( spitem->scope->variableValues("OBJECTS_DIR").first() )+ QString( QChar( QDir::separator() ) )+target; + kdDebug( 9024 ) << "builddir " << buildDir << ", target " << target << endl; + + m_part->mainWindow() ->raiseView( m_part->makeFrontend() ->widget() ); + // m_part->startMakeCommand(buildDir, target); + + QString buildcmd = constructMakeCommandLine( spitem->scope ); + QString dircmd = "cd " + KProcess::quote( spitem->scope->projectDir() ) + " && " ; + kdDebug( 9024 ) << "builddir " << spitem->scope->projectDir() << ", cmd " << dircmd + buildcmd + " " + target << endl; + m_part->queueCmd( spitem->scope->projectDir(), dircmd + buildcmd + " " + target ); + + + // startMakeCommand(buildDir, target); + +} + +TrollProjectWidget::SaveType TrollProjectWidget::dialogSaveBehaviour() const +{ + switch ( DomUtil::readIntEntry( *m_part->projectDom(), "/kdevtrollproject/qmake/savebehaviour", 2 ) ) + { + case 0: + return AlwaysSave; + break; + case 1: + return NeverSave; + break; + case 2: + default: + return Ask; + break; + } +} + +bool TrollProjectWidget::isTMakeProject() +{ + return m_part->isTMakeProject(); +} + +void TrollProjectWidget::slotDisableSubproject( QMakeScopeItem* spitem ) +{ + m_filesCached = false; + m_allFilesCache.clear(); + + if( spitem->scope->variableValues("TEMPLATE").findIndex("subdirs") != -1 ) + { + QStringList subdirs = spitem->scope->variableValues( "SUBDIRS" ); + DisableSubprojectDlg dlg( subdirs ); + if( dlg.exec() ) + { + QStringList values = dlg.selectedProjects(); + QListViewItem* item = spitem->firstChild(); + while( item ) + { + if( values.findIndex( item->text(0) ) != -1 ) + delete item; + item = item->nextSibling(); + } + spitem->disableSubprojects( values ); + spitem->scope->saveToFile(); + m_shownSubproject = spitem; + slotOverviewSelectionChanged( m_shownSubproject ); + } + }else + { + QMakeScopeItem* parent = static_cast<QMakeScopeItem*>(spitem->parent()); + parent->disableSubprojects( QStringList( spitem->scope->scopeName() ) ); + delete spitem; + parent->scope->saveToFile(); + m_shownSubproject = parent; + slotOverviewSelectionChanged( m_shownSubproject ); + } +} + +void TrollProjectWidget::slotProjectDirty(const QString& path) +{ + kdDebug(9024) << "File is dirty:" << path << " using method " << endl; + if( KMessageBox::warningYesNo(this, i18n("The project file \"%1\" has changed on disk\n(Or you have \"%2\" opened in the editor, which also triggers a reload when you change something in the QMake Manager).\n\nDo you want to reload it?").arg(path).arg(path), i18n("Project File Changed"), i18n("Reload"), i18n("Do Not Reload"), "trollproject_reload_project_file" ) != KMessageBox::No ) + { + m_part->dirWatch()->stopScan(); + QListViewItemIterator it(m_rootSubproject); + QValueList<QMakeScopeItem*> itemstoreload; + while( it.current() ) + { + QMakeScopeItem* projectitem = static_cast<QMakeScopeItem*>( it.current() ); + if( projectitem->scope->scopeType() == Scope::ProjectScope + || projectitem->scope->scopeType() == Scope::IncludeScope ) + { + QString projectfile = projectitem->scope->projectDir() + QString(QChar(QDir::separator())) + projectitem->scope->fileName(); + if( projectfile == path ) + { + itemstoreload.append(projectitem); + } + } + it++; + } + + QValueList<QMakeScopeItem*>::const_iterator reloadit = itemstoreload.begin(); + for( ; reloadit != itemstoreload.end() ; ++reloadit ) + { + (*reloadit)->reloadProject(); + if( m_shownSubproject == (*reloadit) ) + { + cleanDetailView(*reloadit); + setupContext(); + buildProjectDetailTree( *reloadit, details ); + } + if( m_configDlg->isShown() && m_configDlg->currentProjectItem() == (*reloadit) ) + { + m_configDlg->reject(); + m_configDlg->updateSubproject(m_shownSubproject); + m_configDlg->show(); + } + } + m_part->dirWatch()->startScan(); + } +} + + +QMakeScopeItem* TrollProjectWidget::currentSubproject() +{ + return m_shownSubproject; +} + +bool TrollProjectWidget::showFilenamesOnly() const +{ + return m_showFilenamesOnly; +} + +bool TrollProjectWidget::showVariablesInTree() const +{ + return m_showVariablesInTree; +} + + +QMap<QString,QString> TrollProjectWidget::qmakeEnvironment() const +{ + QMap<QString,QString> map; + DomUtil::PairList envvars = + DomUtil::readPairListEntry(*m_part->projectDom(), "/kdevtrollproject/make/envvars", "envvar", "name", "value"); + + QString environstr; + DomUtil::PairList::ConstIterator it; + bool hasQtDir = false; + for (it = envvars.begin(); it != envvars.end(); ++it) { + if( (*it).first == "QTDIR" ) + hasQtDir = true; + + map[(*it).first] = (*it).second; + } + + if( !hasQtDir && !m_part->isQt4Project() && !DomUtil::readEntry(*m_part->projectDom(), "/kdevcppsupport/qt/root", "").isEmpty() ) + { + map["QTDIR="] = DomUtil::readEntry(*m_part->projectDom(), "/kdevcppsupport/qt/root", ""); + map["PATH"] = map["PATH"].prepend( DomUtil::readEntry(*m_part->projectDom(), "/kdevcppsupport/qt/root", "") +"/bin" ); + } + return map; +} + +#include "trollprojectwidget.moc" + +//kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on + diff --git a/buildtools/qmake/trollprojectwidget.h b/buildtools/qmake/trollprojectwidget.h new file mode 100644 index 00000000..19595f78 --- /dev/null +++ b/buildtools/qmake/trollprojectwidget.h @@ -0,0 +1,218 @@ +/*************************************************************************** +* Copyright (C) 2001 by Bernd Gehrmann * +* bernd@kdevelop.org * +* Copyright (C) 2002 by Jakob Simon-Gaarde * +* jakob@jsg.dk * +* Copyright (C) 2002-2003 by Alexander Dymo * +* cloudtemple@mksat.net * +* Copyright (C) 2003 by Thomas Hasart * +* thasart@gmx.de * +* Copyright (C) 2006 by Andreas Pakulat * +* apaku@gmx.de * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +***************************************************************************/ + +#ifndef _TROLLPROJECTWIDGET_H_ +#define _TROLLPROJECTWIDGET_H_ + +#include <qdict.h> +#include <qlistview.h> +#include <qmap.h> +#include <qstrlist.h> +#include <qvbox.h> +#include <qtoolbutton.h> +#include <kiconloader.h> +#include <klocale.h> +#include <kdeversion.h> +#include <qbutton.h> +#include <qfileinfo.h> +#include <qptrlist.h> +#include "choosesubprojectdlg.h" +#include "newwidgetdlg.h" +#include "domutil.h" +#include "qmakescopeitem.h" + +class TrollProjectPart; +class KListView; +class ProjectConfigurationDlg; + +class TrollProjectWidget : public QVBox +{ + Q_OBJECT + +public: + TrollProjectWidget( TrollProjectPart *part ); + ~TrollProjectWidget(); + + void openProject( const QString &dirName ); + void closeProject(); + + /** + * A list of the (relative) names of all subprojects (== subdirectories). + */ + //QStringList allSubprojects(); + /** + * A list of the (relative) names of all libraries. + */ + QStringList allLibraries(); + /** + * A list of all files that belong to the project. + **/ + QStringList allFiles(); + /** + * The top level directory of the project. + **/ + QString projectDirectory(); + /** + * The directory of the currently active subproject. + */ + QString subprojectDirectory(); + /** + * The directory of the currently active subproject. + */ + QString getCurrentTarget(); + + QString getCurrentDestDir(); + + QString getCurrentOutputFilename(); + + void addFileToCurrentSubProject( GroupItem *titem, const QString &filename ); + void addFileToCurrentSubProject( GroupItem::GroupType gtype, const QString &filename ); + void addFiles( QStringList &files, bool relativeToProjectRoot = true ); + void emitAddedFile( const QString &name ); + void emitRemovedFile( const QString &name ); + + QString getUiFileLink( const QString &path, const QString& filename ); + bool isTMakeProject(); + + enum TrollProjectView { SubprojectView, DetailsView }; + void setLastFocusedView( TrollProjectView view ); + enum SaveType { AlwaysSave, NeverSave, Ask }; + QMakeScopeItem* currentSubproject(); + + bool showFilenamesOnly() const; + bool showVariablesInTree() const; + +public slots: + void slotBuildTarget(); + void slotInstallTarget(); + void slotRebuildTarget(); + void slotCleanTarget(); + void slotDistCleanTarget(); + void slotExecuteTarget(); + + void slotBuildProject(); + void slotInstallProject(); + void slotRebuildProject(); + void slotCleanProject(); + void slotDistCleanProject(); + void slotExecuteProject(); + + void slotBuildOpenFile(); + void slotBuildSelectedFile(); + + void slotConfigureProject(); + void slotAddFiles(); + void slotNewFile(); + void slotRemoveFile(); + +protected: + virtual void focusInEvent( QFocusEvent *e ); + +private slots: + void slotOverviewSelectionChanged( QListViewItem *item ); + void slotOverviewContextMenu( KListView *, QListViewItem *item, const QPoint &p ); + void slotDetailsSelectionChanged( QListViewItem* ); + void slotDetailsExecuted( QListViewItem *item ); + void slotDetailsContextMenu( KListView *, QListViewItem *item, const QPoint &p ); + void slotExcludeFileFromScopeButton(); + void slotAddSubproject( QMakeScopeItem *spitem = 0 ); + void slotRemoveSubproject( QMakeScopeItem *spitem = 0 ); + void slotCreateScope( QMakeScopeItem *spitem = 0 ); + void slotRemoveScope( QMakeScopeItem *spitem = 0 ); + void slotDisableSubproject( QMakeScopeItem* spitem = 0 ); + void slotProjectDirty( const QString& ); + + void createQMakeScopeItems(); + +private: + void cleanDetailView( QMakeScopeItem *item ); + void runClean( QMakeScopeItem*, const QString& ); + void buildProjectDetailTree( QMakeScopeItem *item, KListView *listviewControl ); + void removeFile( QMakeScopeItem *spitem, FileItem *fitem ); + void addSubprojectToItem( QMakeScopeItem*, const QString& ); + void setupContext(); + // void parseScope(QMakeScopeItem *item,QString scopeString, Scope *scope); + GroupItem* getInstallRoot( QMakeScopeItem *item ); + GroupItem* getInstallObject( QMakeScopeItem *item, const QString& objectname ); + QString constructMakeCommandLine( Scope* s = 0 ); + + void createMakefileIfMissing( const QString &dir, QMakeScopeItem *item ); + + void runQMakeRecursive( QMakeScopeItem* proj); + void buildFile( QMakeScopeItem* spitem, FileItem* fitem); + + /*fileName: full base file name like QFileInfo::baseName ( true )*/ + QPtrList<QMakeScopeItem> findSubprojectForFile( QFileInfo fi ); + void findSubprojectForFile( QPtrList<QMakeScopeItem> &list, QMakeScopeItem * item, QString absFilePath ); + QMakeScopeItem* findSubprojectForPath( const QString& ); + // QString makeEnvironment(); + + TrollProjectWidget::SaveType dialogSaveBehaviour() const; + + QMakeScopeItem *findSubprojectForScope( QMakeScopeItem *scope ); + + void reloadProjectFromFile( QMakeScopeItem* item ); + QMap<QString,QString> qmakeEnvironment() const; + + QVBox *overviewContainer; + KListView *overview; + QHBox *projectTools; + QToolButton *addSubdirButton; + QToolButton *createScopeButton; + + QToolButton *buildProjectButton; + QToolButton *rebuildProjectButton; + QToolButton *executeProjectButton; + + QToolButton *buildTargetButton; + QToolButton *rebuildTargetButton; + QToolButton *executeTargetButton; + + QToolButton *buildFileButton; + QToolButton *projectconfButton; + + QVBox *detailContainer; + KListView *details; + QHBox *fileTools; + QToolButton *addfilesButton; + QToolButton *newfileButton; + QToolButton *removefileButton; + QToolButton *excludeFileFromScopeButton; + + DomUtil::PairList m_subclasslist; + QMakeScopeItem *m_shownSubproject; + QMakeScopeItem *m_rootSubproject; + Scope* m_rootScope; + TrollProjectPart *m_part; + ProjectConfigurationDlg* m_configDlg; + + TrollProjectView m_lastFocusedView; + + bool m_filesCached; + bool m_showFilenamesOnly; + bool m_showVariablesInTree; + QStringList m_allFilesCache; + + friend class ChooseSubprojectDlg; + friend class ProjectConfigurationDlg; +}; + +#endif + +// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on |