From 114a878c64ce6f8223cfd22d76a20eb16d177e5e Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- buildtools/lib/widgets/Mainpage.dox | 10 + buildtools/lib/widgets/Makefile.am | 30 +++ buildtools/lib/widgets/addenvvardlg.cpp | 84 +++++++ buildtools/lib/widgets/addenvvardlg.h | 54 +++++ buildtools/lib/widgets/addfilesdialog.cpp | 78 +++++++ buildtools/lib/widgets/addfilesdialog.h | 57 +++++ .../lib/widgets/environmentdisplaydialog.cpp | 54 +++++ buildtools/lib/widgets/environmentdisplaydialog.h | 35 +++ .../lib/widgets/environmentdisplaydialogbase.ui | 111 +++++++++ .../lib/widgets/environmentvariableswidget.cpp | 126 ++++++++++ .../lib/widgets/environmentvariableswidget.h | 59 +++++ .../lib/widgets/environmentvariableswidgetbase.ui | 200 ++++++++++++++++ buildtools/lib/widgets/envvartools.cpp | 31 +++ buildtools/lib/widgets/envvartools.h | 28 +++ buildtools/lib/widgets/makeoptionswidget.cpp | 64 +++++ buildtools/lib/widgets/makeoptionswidget.h | 50 ++++ buildtools/lib/widgets/makeoptionswidgetbase.ui | 194 ++++++++++++++++ buildtools/lib/widgets/removesubprojectdialog.cpp | 52 +++++ buildtools/lib/widgets/removesubprojectdialog.h | 52 +++++ buildtools/lib/widgets/removesubprojectdlgbase.ui | 154 ++++++++++++ buildtools/lib/widgets/runoptionswidget.cpp | 138 +++++++++++ buildtools/lib/widgets/runoptionswidget.h | 57 +++++ buildtools/lib/widgets/runoptionswidgetbase.ui | 257 +++++++++++++++++++++ buildtools/lib/widgets/subclassesdlg.cpp | 122 ++++++++++ buildtools/lib/widgets/subclassesdlg.h | 58 +++++ buildtools/lib/widgets/subclassesdlgbase.ui | 224 ++++++++++++++++++ 26 files changed, 2379 insertions(+) create mode 100644 buildtools/lib/widgets/Mainpage.dox create mode 100644 buildtools/lib/widgets/Makefile.am create mode 100644 buildtools/lib/widgets/addenvvardlg.cpp create mode 100644 buildtools/lib/widgets/addenvvardlg.h create mode 100644 buildtools/lib/widgets/addfilesdialog.cpp create mode 100644 buildtools/lib/widgets/addfilesdialog.h create mode 100644 buildtools/lib/widgets/environmentdisplaydialog.cpp create mode 100644 buildtools/lib/widgets/environmentdisplaydialog.h create mode 100644 buildtools/lib/widgets/environmentdisplaydialogbase.ui create mode 100644 buildtools/lib/widgets/environmentvariableswidget.cpp create mode 100644 buildtools/lib/widgets/environmentvariableswidget.h create mode 100644 buildtools/lib/widgets/environmentvariableswidgetbase.ui create mode 100644 buildtools/lib/widgets/envvartools.cpp create mode 100644 buildtools/lib/widgets/envvartools.h create mode 100644 buildtools/lib/widgets/makeoptionswidget.cpp create mode 100644 buildtools/lib/widgets/makeoptionswidget.h create mode 100644 buildtools/lib/widgets/makeoptionswidgetbase.ui create mode 100644 buildtools/lib/widgets/removesubprojectdialog.cpp create mode 100644 buildtools/lib/widgets/removesubprojectdialog.h create mode 100644 buildtools/lib/widgets/removesubprojectdlgbase.ui create mode 100644 buildtools/lib/widgets/runoptionswidget.cpp create mode 100644 buildtools/lib/widgets/runoptionswidget.h create mode 100644 buildtools/lib/widgets/runoptionswidgetbase.ui create mode 100644 buildtools/lib/widgets/subclassesdlg.cpp create mode 100644 buildtools/lib/widgets/subclassesdlg.h create mode 100644 buildtools/lib/widgets/subclassesdlgbase.ui (limited to 'buildtools/lib/widgets') diff --git a/buildtools/lib/widgets/Mainpage.dox b/buildtools/lib/widgets/Mainpage.dox new file mode 100644 index 00000000..56884c97 --- /dev/null +++ b/buildtools/lib/widgets/Mainpage.dox @@ -0,0 +1,10 @@ +/** +@mainpage The KDevelop Buildtool Widgets Library + +This library contains widgets commonly used in buildtool support plugins. + +Link with: -lkdevbuildtoolswidgets + +Include path: -I\$(kde_includes)/kdevelop/buildtools/widgets +*/ + diff --git a/buildtools/lib/widgets/Makefile.am b/buildtools/lib/widgets/Makefile.am new file mode 100644 index 00000000..2277d9d0 --- /dev/null +++ b/buildtools/lib/widgets/Makefile.am @@ -0,0 +1,30 @@ +# This directory collects some classes related to +# project management for the sole purpose that they +# can be shared between parts. + +INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util \ + -I$(top_srcdir)/lib/widgets/propeditor $(all_includes) + +lib_LTLIBRARIES = libkdevbuildtoolswidgets.la +libkdevbuildtoolswidgets_la_LDFLAGS = $(all_libraries) +libkdevbuildtoolswidgets_la_LIBADD = $(top_builddir)/lib/interfaces/libkdevinterfaces.la \ + $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI) $(LIB_KIO) -lktexteditor +libkdevbuildtoolswidgets_la_SOURCES = addenvvardlg.cpp addfilesdialog.cpp \ + environmentdisplaydialog.cpp environmentdisplaydialogbase.ui environmentvariableswidget.cpp \ + environmentvariableswidgetbase.ui envvartools.cpp makeoptionswidget.cpp makeoptionswidgetbase.ui \ + removesubprojectdialog.cpp removesubprojectdlgbase.ui runoptionswidget.cpp runoptionswidgetbase.ui \ + subclassesdlg.cpp subclassesdlgbase.ui + +METASOURCES = AUTO + +kdevelopbuildtoolsincludedir = $(includedir)/kdevelop/buildtools/widgets +kdevelopbuildtoolsinclude_HEADERS = addenvvardlg.h addfilesdialog.h \ + environmentvariableswidget.h environmentvariableswidgetbase.h envvartools.h makeoptionswidget.h \ + makeoptionswidgetbase.h removesubprojectdialog.h removesubprojectdlgbase.h runoptionswidget.h \ + runoptionswidgetbase.h subclassesdlg.h subclassesdlgbase.h + +DOXYGEN_REFERENCES = dcop interfaces kdecore kdefx kdeui khtml kmdi kio kjs kparts kutils kdevutil kdevinterfaces kdevutil +DOXYGEN_PROJECTNAME = KDevelop Buildtool Widgets Library +DOXYGEN_DOCDIRPREFIX = kdevbt +include ../../../Doxyfile.am +noinst_HEADERS = environmentdisplaydialog.h diff --git a/buildtools/lib/widgets/addenvvardlg.cpp b/buildtools/lib/widgets/addenvvardlg.cpp new file mode 100644 index 00000000..aaf82774 --- /dev/null +++ b/buildtools/lib/widgets/addenvvardlg.cpp @@ -0,0 +1,84 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Bernd Gehrmann + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include +#include +#include +#include + +#include "addenvvardlg.h" + + +AddEnvvarDialog::AddEnvvarDialog(QWidget *parent, const char *name) + : QDialog(parent, name, true) +{ + setCaption(i18n("Add Environment Variable")); + + QLabel *varname_label = new QLabel(i18n("&Name:"), this); + varname_edit = new KLineEdit(this); + varname_edit->setFocus(); + varname_label->setBuddy(varname_edit); + + connect( varname_edit, SIGNAL( textChanged ( const QString & ) ), this, SLOT( slotTextChanged() ) ); + QLabel *value_label = new QLabel(i18n("&Value:"), this); + value_edit = new KLineEdit(this); + value_label->setBuddy(value_edit); + QFontMetrics fm(value_edit->fontMetrics()); + value_edit->setMinimumWidth(fm.width('X')*35); + connect( value_edit, SIGNAL( textChanged ( const QString & ) ), this, SLOT( slotTextChanged() ) ); + + + QVBoxLayout *layout = new QVBoxLayout(this, 10); + + QGridLayout *grid = new QGridLayout(2, 2); + layout->addLayout(grid); + grid->addWidget(varname_label, 0, 0); + grid->addWidget(varname_edit, 0, 1); + grid->addWidget(value_label, 1, 0); + grid->addWidget(value_edit, 1, 1); + + QFrame *frame = new QFrame(this); + frame->setFrameStyle(QFrame::HLine | QFrame::Sunken); + layout->addWidget(frame, 0); + + KButtonBox *buttonbox = new KButtonBox(this); + buttonbox->addStretch(); + m_pOk = buttonbox->addButton( KStdGuiItem::ok()); + QPushButton *cancel = buttonbox->addButton(KStdGuiItem::cancel()); + m_pOk->setDefault(true); + connect( m_pOk, SIGNAL(clicked()), this, SLOT(accept()) ); + connect( cancel, SIGNAL(clicked()), this, SLOT(reject()) ); + buttonbox->layout(); + layout->addWidget(buttonbox, 0); + slotTextChanged(); +} + + +AddEnvvarDialog::~AddEnvvarDialog() +{} + +void AddEnvvarDialog::slotTextChanged() +{ + m_pOk->setEnabled( !varname_edit->text().isEmpty() && !value_edit->text().isEmpty() ); +} + +#include "addenvvardlg.moc" diff --git a/buildtools/lib/widgets/addenvvardlg.h b/buildtools/lib/widgets/addenvvardlg.h new file mode 100644 index 00000000..0ffdbde1 --- /dev/null +++ b/buildtools/lib/widgets/addenvvardlg.h @@ -0,0 +1,54 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Bernd Gehrmann + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef _ADDENVVARDLG_H_ +#define _ADDENVVARDLG_H_ + +#include +#include +class QPushButton; + +/** +Dialog to add environment variables. +*/ +class AddEnvvarDialog : public QDialog +{ + Q_OBJECT + +public: + AddEnvvarDialog( QWidget *parent=0, const char *name=0 ); + ~AddEnvvarDialog(); + + QString varname() const + { return varname_edit->text(); } + QString value() const + { return value_edit->text(); } + void setvarname(const QString name) const + { varname_edit->setText(name); } + void setvalue(const QString value) const + { value_edit->setText(value); } + private slots: + void slotTextChanged(); +private: + KLineEdit *varname_edit; + KLineEdit *value_edit; + QPushButton *m_pOk; +}; + +#endif diff --git a/buildtools/lib/widgets/addfilesdialog.cpp b/buildtools/lib/widgets/addfilesdialog.cpp new file mode 100644 index 00000000..8ba14539 --- /dev/null +++ b/buildtools/lib/widgets/addfilesdialog.cpp @@ -0,0 +1,78 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +#include +#include + +#include + +#include "addfilesdialog.h" +#include "addfilesdialog.moc" + +AddFilesDialog::AddFilesDialog(const QString& startDir, const QString& filter, + QWidget *parent, const char *name, bool modal): + KFileDialog(startDir, filter, parent, name, modal) +{ + KConfig *config = kapp->config(); + config->setGroup("Add Files Dialog"); + + m_extraWidget = new QComboBox(false, this); + m_extraWidget->insertItem(i18n("Copy File(s)"), 0); + m_extraWidget->insertItem(i18n("Create Symbolic Link(s)"), 1); + m_extraWidget->insertItem(i18n("Add Relative Path(s)"), 2); + m_extraWidget->setCurrentItem(config->readNumEntry("Mode")); + connect(m_extraWidget, SIGNAL(activated(int)), this, SLOT(storePreferred(int))); + + setPreviewWidget(m_extraWidget); + + setOperationMode(Opening); +} + + +AddFilesDialog::AddFilesDialog(const QString& startDir, const QString& filter, + QWidget *parent, const char *name, bool modal, QComboBox *extraWidget): + KFileDialog(startDir, filter, parent, name, modal, extraWidget), m_extraWidget(extraWidget) +{ + KConfig *config = kapp->config(); + config->setGroup("Add Files Dialog"); + + m_extraWidget->insertItem(i18n("Copy File(s)"), 0); + m_extraWidget->insertItem(i18n("Create Symbolic Link(s)"), 1); + m_extraWidget->insertItem(i18n("Add Relative Path(s)"), 2); + m_extraWidget->setCurrentItem(config->readNumEntry("Mode")); + connect(m_extraWidget, SIGNAL(activated(int)), this, SLOT(storePreferred(int))); + + setOperationMode(Opening); +} + + +AddFilesDialog::~AddFilesDialog() +{ +} + +AddFilesDialog::Mode AddFilesDialog::mode( ) +{ + return (AddFilesDialog::Mode)m_extraWidget->currentItem(); +} + +void AddFilesDialog::storePreferred( int index ) +{ + KConfig *config = kapp->config(); + config->setGroup("Add Files Dialog"); + config->writeEntry("Mode", index); +} diff --git a/buildtools/lib/widgets/addfilesdialog.h b/buildtools/lib/widgets/addfilesdialog.h new file mode 100644 index 00000000..00b238a7 --- /dev/null +++ b/buildtools/lib/widgets/addfilesdialog.h @@ -0,0 +1,57 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +#ifndef ADDFILESDIALOG_H +#define ADDFILESDIALOG_H + +#include +#include + +class QComboBox; + +/** +This class allows you to choose additional modes when adding +files to the project. +Currently available modes are Copy, Link and Relative. +Relative means that file should be not copied but added +with the relative path (e.g. ../../dir/filename) +*/ +class AddFilesDialog : public KFileDialog +{ + Q_OBJECT +public: + enum Mode { Copy, Link, Relative }; + + AddFilesDialog(const QString& startDir, const QString& filter, + QWidget *parent, const char *name, bool modal); + + AddFilesDialog(const QString& startDir, const QString& filter, + QWidget *parent, const char *name, bool modal, QComboBox *extraWidget); + + virtual ~AddFilesDialog(); + + virtual AddFilesDialog::Mode mode(); + +private: + QComboBox * m_extraWidget; + +private slots: + void storePreferred(int index); +}; + +#endif diff --git a/buildtools/lib/widgets/environmentdisplaydialog.cpp b/buildtools/lib/widgets/environmentdisplaydialog.cpp new file mode 100644 index 00000000..7d01b031 --- /dev/null +++ b/buildtools/lib/widgets/environmentdisplaydialog.cpp @@ -0,0 +1,54 @@ +/* This file is part of the KDE project + Copyright (C) 2007 Jens Dagerbo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include + +#include "environmentdisplaydialog.h" + +extern char **environ; + +EnvironmentDisplayDialog::EnvironmentDisplayDialog(QWidget* parent, const char* name, bool modal, WFlags fl) +: EnvironmentDisplayDialogBase(parent,name, modal,fl) +{ + QStringList environment; + char ** e = ::environ; + + while ( *e ) + { + environment << *e; + e++; + } + + QStringList::ConstIterator it = environment.begin(); + while( it !=environment.end() ) + { + QStringList pair = QStringList::split( QChar('='), *it ); + if ( pair.count() == 2 ) + { + new QListViewItem( environmentListView, pair.first(), pair.last() ); + } + ++it; + } +} + + +#include "environmentdisplaydialog.moc" + diff --git a/buildtools/lib/widgets/environmentdisplaydialog.h b/buildtools/lib/widgets/environmentdisplaydialog.h new file mode 100644 index 00000000..af284a3b --- /dev/null +++ b/buildtools/lib/widgets/environmentdisplaydialog.h @@ -0,0 +1,35 @@ +/* This file is part of the KDE project + Copyright (C) 2007 Jens Dagerbo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef ENVIRONMENTDISPLAYDIALOG_H +#define ENVIRONMENTDISPLAYDIALOG_H + + +#include "environmentdisplaydialogbase.h" + +class EnvironmentDisplayDialog : public EnvironmentDisplayDialogBase +{ +Q_OBJECT + +public: + EnvironmentDisplayDialog(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); +}; + +#endif + diff --git a/buildtools/lib/widgets/environmentdisplaydialogbase.ui b/buildtools/lib/widgets/environmentdisplaydialogbase.ui new file mode 100644 index 00000000..8b41862f --- /dev/null +++ b/buildtools/lib/widgets/environmentdisplaydialogbase.ui @@ -0,0 +1,111 @@ + +EnvironmentDisplayDialogBase + + + EnvironmentDisplayDialogBase + + + + 0 + 0 + 583 + 523 + + + + Environment + + + + unnamed + + + + groupBox1 + + + Current Environment + + + + unnamed + + + + + Variable + + + true + + + true + + + + + Value + + + true + + + true + + + + environmentListView + + + + + + + layout1 + + + + unnamed + + + + spacer1 + + + Horizontal + + + Expanding + + + + 321 + 21 + + + + + + closeButton + + + &Close + + + + + + + + + closeButton + clicked() + EnvironmentDisplayDialogBase + accept() + + + + + klistview.h + + diff --git a/buildtools/lib/widgets/environmentvariableswidget.cpp b/buildtools/lib/widgets/environmentvariableswidget.cpp new file mode 100644 index 00000000..7ba08427 --- /dev/null +++ b/buildtools/lib/widgets/environmentvariableswidget.cpp @@ -0,0 +1,126 @@ +/* This file is part of the KDE project + Copyright (C) 2001-2002 Bernd Gehrmann + Copyright (C) 2003 John Firebaugh + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include "environmentvariableswidget.h" +#include "environmentdisplaydialog.h" + +#include +#include +#include +#include +#include "domutil.h" +#include "addenvvardlg.h" + + +void EnvironmentVariablesWidget::addVarClicked() +{ + AddEnvvarDialog dlg( this, "add env dialog" ) ; + if (QListViewItem *Item = listview->selectedItem()) + { + dlg.setvarname(Item->text(0)); + dlg.setvalue(Item->text(1)); + } + if (!dlg.exec()) + return; + + (void) new QListViewItem(listview, dlg.varname(), dlg.value()); +} + + +void EnvironmentVariablesWidget::editVarClicked() +{ + AddEnvvarDialog dlg( this, "edit env dialog" ); + QListViewItem *item = listview->selectedItem(); + if ( !item ) + return; + dlg.setvarname(item->text(0)); + dlg.setvalue(item->text(1)); + if (!dlg.exec()) + return; + + item->setText(0,dlg.varname()); + item->setText(1,dlg.value()); +} + + +void EnvironmentVariablesWidget::removeVarClicked() +{ + delete listview->selectedItem(); +} + + +EnvironmentVariablesWidget::EnvironmentVariablesWidget(QDomDocument &dom, const QString &configGroup, + QWidget *parent, const char *name) + : EnvironmentVariablesWidgetBase(parent, name), + m_dom(dom), m_configGroup(configGroup) +{ + readEnvironment(dom, configGroup); + connect( listview, SIGNAL( doubleClicked ( QListViewItem *, const QPoint &, int ) ), this, SLOT( editVarClicked() ) ); +} + + +EnvironmentVariablesWidget::~EnvironmentVariablesWidget() +{} + +void EnvironmentVariablesWidget::readEnvironment(QDomDocument &dom, const QString &configGroup) +{ + m_dom = dom; + m_configGroup = configGroup; + + listview->clear(); + + DomUtil::PairList list = + DomUtil::readPairListEntry(dom, m_configGroup, "envvar", "name", "value"); + + QListViewItem *lastItem = 0; + + DomUtil::PairList::ConstIterator it; + for (it = list.begin(); it != list.end(); ++it) { + QListViewItem *newItem = new QListViewItem(listview, (*it).first, (*it).second); + if (lastItem) + newItem->moveItem(lastItem); + lastItem = newItem; + } +} + +void EnvironmentVariablesWidget::changeConfigGroup( const QString &configGroup) +{ + m_configGroup = configGroup; +} + +void EnvironmentVariablesWidget::accept() +{ + DomUtil::PairList list; + QListViewItem *item = listview->firstChild(); + while (item) { + list << DomUtil::Pair(item->text(0), item->text(1)); + item = item->nextSibling(); + } + + DomUtil::writePairListEntry(m_dom, m_configGroup, "envvar", "name", "value", list); +} + +void EnvironmentVariablesWidget::environmentClicked() +{ + EnvironmentDisplayDialog dlg; + dlg.exec(); +} + +#include "environmentvariableswidget.moc" diff --git a/buildtools/lib/widgets/environmentvariableswidget.h b/buildtools/lib/widgets/environmentvariableswidget.h new file mode 100644 index 00000000..9f2d472e --- /dev/null +++ b/buildtools/lib/widgets/environmentvariableswidget.h @@ -0,0 +1,59 @@ +/* This file is part of the KDE project + Copyright (C) 2001-2002 Bernd Gehrmann + Copyright (C) 2003 John Firebaugh + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef _ENVIRONMENTVARIABLESWIDGET_H_ +#define _ENVIRONMENTVARIABLESWIDGET_H_ + +#include "environmentvariableswidgetbase.h" + +#include + +/** +Environment variables widget. +*/ +class EnvironmentVariablesWidget : public EnvironmentVariablesWidgetBase +{ + Q_OBJECT + +public: + EnvironmentVariablesWidget( QDomDocument &dom, const QString &configGroup, + QWidget *parent=0, const char *name=0 ); + ~EnvironmentVariablesWidget(); + + /// read in a set of environment variables from the DOM document + void readEnvironment(QDomDocument &dom, const QString &configGroup); + + /// changes the path in the DOM structure where the environment variables are stored + void changeConfigGroup( const QString &configGroup); + +public slots: + void accept(); + +private: + virtual void addVarClicked(); + virtual void removeVarClicked(); + virtual void editVarClicked(); + virtual void environmentClicked(); + + QDomDocument &m_dom; + QString m_configGroup; +}; + +#endif diff --git a/buildtools/lib/widgets/environmentvariableswidgetbase.ui b/buildtools/lib/widgets/environmentvariableswidgetbase.ui new file mode 100644 index 00000000..d16cc613 --- /dev/null +++ b/buildtools/lib/widgets/environmentvariableswidgetbase.ui @@ -0,0 +1,200 @@ + +EnvironmentVariablesWidgetBase + + + EnvironmentVariablesWidgetBase + + + + 0 + 0 + 566 + 451 + + + + Environment Variables + + + + unnamed + + + 0 + + + + + Name + + + true + + + true + + + + + Value + + + true + + + true + + + + listview + + + + 7 + 7 + 0 + 0 + + + + true + + + AllColumns + + + + + removevar_button + + + + 5 + 0 + 0 + 0 + + + + &Remove + + + + + editvar_button + + + + 1 + 0 + 0 + 0 + + + + &Edit + + + + + addvar_button + + + + 1 + 0 + 0 + 0 + + + + A&dd / Copy + + + + + Spacer12 + + + Vertical + + + Expanding + + + + 20 + 60 + + + + + + environmentButton + + + E&nvironment + + + + + spacer2 + + + Vertical + + + Expanding + + + + 20 + 171 + + + + + + + + addvar_button + clicked() + EnvironmentVariablesWidgetBase + addVarClicked() + + + removevar_button + clicked() + EnvironmentVariablesWidgetBase + removeVarClicked() + + + editvar_button + clicked() + EnvironmentVariablesWidgetBase + editVarClicked() + + + environmentButton + clicked() + EnvironmentVariablesWidgetBase + environmentClicked() + + + + listview + addvar_button + removevar_button + + + kdialog.h + + + addVarClicked() + removeVarClicked() + editVarClicked() + environmentClicked() + + + + diff --git a/buildtools/lib/widgets/envvartools.cpp b/buildtools/lib/widgets/envvartools.cpp new file mode 100644 index 00000000..bc8eaf51 --- /dev/null +++ b/buildtools/lib/widgets/envvartools.cpp @@ -0,0 +1,31 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +#include "envvartools.h" + +#include + +QString EnvVarTools::quote( const QString & arg ) +{ + QString res = arg; + res.replace(QRegExp(QString::fromLatin1("'")), QString::fromLatin1("'\\''")); + res.prepend("\""); + res.append("\""); + return res; +} + diff --git a/buildtools/lib/widgets/envvartools.h b/buildtools/lib/widgets/envvartools.h new file mode 100644 index 00000000..65db1b8d --- /dev/null +++ b/buildtools/lib/widgets/envvartools.h @@ -0,0 +1,28 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +#include + +/**Environment support functions.*/ +namespace EnvVarTools{ + + /**Quotes the argument using double quotes ("). Created as a replacement + for KShellProcess::quote.*/ + QString quote(const QString &arg); + +} diff --git a/buildtools/lib/widgets/makeoptionswidget.cpp b/buildtools/lib/widgets/makeoptionswidget.cpp new file mode 100644 index 00000000..c720de8b --- /dev/null +++ b/buildtools/lib/widgets/makeoptionswidget.cpp @@ -0,0 +1,64 @@ +/* This file is part of the KDE project + Copyright (C) 2001-2002 Bernd Gehrmann + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include "makeoptionswidget.h" + +#include +#include +#include +#include +#include + +#include "domutil.h" +#include "environmentvariableswidget.h" + +MakeOptionsWidget::MakeOptionsWidget(QDomDocument &dom, const QString &configGroup, + QWidget *parent, const char *name) + : MakeOptionsWidgetBase(parent, name), + m_dom(dom), m_configGroup(configGroup) +{ + env_var_group->setColumnLayout( 1, Qt::Vertical ); + m_environmentVariablesWidget = new EnvironmentVariablesWidget( dom, configGroup + "/make/envvars", env_var_group ); + + abort_box->setChecked(DomUtil::readBoolEntry(dom, configGroup + "/make/abortonerror", true )); + jobs_box->setValue(DomUtil::readIntEntry(dom, configGroup + "/make/numberofjobs")); + runMultiJobs->setChecked(DomUtil::readBoolEntry(dom, configGroup + "/make/runmultiplejobs")); + dontact_box->setChecked(DomUtil::readBoolEntry(dom, configGroup + "/make/dontact")); + makebin_edit->setText(DomUtil::readEntry(dom, configGroup + "/make/makebin")); + prio_box->setValue(DomUtil::readIntEntry(dom, configGroup + "/make/prio")); +} + + +MakeOptionsWidget::~MakeOptionsWidget() +{} + + +void MakeOptionsWidget::accept() +{ + DomUtil::writeBoolEntry(m_dom, m_configGroup + "/make/abortonerror", abort_box->isChecked()); + DomUtil::writeBoolEntry(m_dom, m_configGroup + "/make/runmultiplejobs", runMultiJobs->isChecked()); + DomUtil::writeIntEntry(m_dom, m_configGroup + "/make/numberofjobs", jobs_box->value()); + DomUtil::writeBoolEntry(m_dom, m_configGroup + "/make/dontact", dontact_box->isChecked()); + DomUtil::writeEntry(m_dom, m_configGroup + "/make/makebin", makebin_edit->text()); + DomUtil::writeIntEntry(m_dom, m_configGroup + "/make/prio", prio_box->value()); + + m_environmentVariablesWidget->accept(); +} + +#include "makeoptionswidget.moc" diff --git a/buildtools/lib/widgets/makeoptionswidget.h b/buildtools/lib/widgets/makeoptionswidget.h new file mode 100644 index 00000000..b6deeb05 --- /dev/null +++ b/buildtools/lib/widgets/makeoptionswidget.h @@ -0,0 +1,50 @@ +/* This file is part of the KDE project + Copyright (C) 2001-2002 Bernd Gehrmann + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef _MAKEOPTIONSWIDGET_H_ +#define _MAKEOPTIONSWIDGET_H_ + +#include "makeoptionswidgetbase.h" + +#include + +class EnvironmentVariablesWidget; + +/** +Make options widget. +*/ +class MakeOptionsWidget : public MakeOptionsWidgetBase +{ + Q_OBJECT + +public: + MakeOptionsWidget( QDomDocument &dom, const QString &configGroup, + QWidget *parent=0, const char *name=0 ); + ~MakeOptionsWidget(); + +public slots: + void accept(); + +private: + QDomDocument &m_dom; + QString m_configGroup; + EnvironmentVariablesWidget* m_environmentVariablesWidget; +}; + +#endif diff --git a/buildtools/lib/widgets/makeoptionswidgetbase.ui b/buildtools/lib/widgets/makeoptionswidgetbase.ui new file mode 100644 index 00000000..4bddebd1 --- /dev/null +++ b/buildtools/lib/widgets/makeoptionswidgetbase.ui @@ -0,0 +1,194 @@ + +MakeOptionsWidgetBase + + + make_options_widget + + + + 0 + 0 + 507 + 366 + + + + Make Options + + + + unnamed + + + + abort_box + + + &Abort on first error + + + + + dontact_box + + + Onl&y display commands without actually executing them + + + + + env_var_group + + + Environment &Variables + + + + + makebin_label + + + &Name of make executable: + + + makebin_edit + + + + + makebin_edit + + + + + jobs_box + + + false + + + + 0 + 0 + 0 + 0 + + + + 30 + + + 1 + + + + + textLabel1 + + + false + + + Num&ber of jobs to run simultaneously: + + + jobs_box + + + + + spacer33 + + + Horizontal + + + Expanding + + + + 121 + 20 + + + + + + spacer2 + + + Horizontal + + + Fixed + + + + 20 + 20 + + + + + + runMultiJobs + + + Run more than one &job at a time + + + + + prio_label + + + Make priority: + + + + + prio_box + + + + 0 + 0 + 0 + 0 + + + + 19 + + + -20 + + + + + + + runMultiJobs + toggled(bool) + textLabel1 + setEnabled(bool) + + + runMultiJobs + toggled(bool) + jobs_box + setEnabled(bool) + + + + abort_box + dontact_box + makebin_edit + jobs_box + + + kdialog.h + + + + diff --git a/buildtools/lib/widgets/removesubprojectdialog.cpp b/buildtools/lib/widgets/removesubprojectdialog.cpp new file mode 100644 index 00000000..37f9aaf8 --- /dev/null +++ b/buildtools/lib/widgets/removesubprojectdialog.cpp @@ -0,0 +1,52 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +#include +#include +#include "removesubprojectdialog.h" + +RemoveSubprojectDialog::RemoveSubprojectDialog(QString caption, QString question, QWidget* parent, const char* name, bool modal, WFlags fl) + : RemoveSubprojectDlgBase(parent,name, modal,fl) +{ + setCaption(caption); + removeLabel->setText(question); +} + +RemoveSubprojectDialog::~RemoveSubprojectDialog() +{ +} + +/*$SPECIALIZATION$*/ +void RemoveSubprojectDialog::reject() +{ + QDialog::reject(); +} + +void RemoveSubprojectDialog::accept() +{ + QDialog::accept(); +} + +bool RemoveSubprojectDialog::removeFromDisk( ) +{ + return removeCheckBox->isChecked(); +} + + +#include "removesubprojectdialog.moc" + diff --git a/buildtools/lib/widgets/removesubprojectdialog.h b/buildtools/lib/widgets/removesubprojectdialog.h new file mode 100644 index 00000000..89487511 --- /dev/null +++ b/buildtools/lib/widgets/removesubprojectdialog.h @@ -0,0 +1,52 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef REMOVESUBPROJECTDIALOG_H +#define REMOVESUBPROJECTDIALOG_H + +#include "removesubprojectdlgbase.h" + +/** +Subproject removal dialog. +*/ +class RemoveSubprojectDialog : public RemoveSubprojectDlgBase +{ + Q_OBJECT + +public: + RemoveSubprojectDialog(QString caption, QString question, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~RemoveSubprojectDialog(); + /*$PUBLIC_FUNCTIONS$*/ + bool removeFromDisk(); + +public slots: + /*$PUBLIC_SLOTS$*/ + +protected: + /*$PROTECTED_FUNCTIONS$*/ + +protected slots: + /*$PROTECTED_SLOTS$*/ + virtual void reject(); + virtual void accept(); + +}; + +#endif + diff --git a/buildtools/lib/widgets/removesubprojectdlgbase.ui b/buildtools/lib/widgets/removesubprojectdlgbase.ui new file mode 100644 index 00000000..cd36b6ff --- /dev/null +++ b/buildtools/lib/widgets/removesubprojectdlgbase.ui @@ -0,0 +1,154 @@ + +RemoveSubprojectDlgBase + + + RemoveSubprojectDlgBase + + + + 0 + 0 + 378 + 147 + + + + [REMOVE SUBPROJECT] + + + + unnamed + + + + fileGroupBox + + + + 0 + 0 + + + + + 32767 + 140 + + + + Sunken + + + &Information + + + + unnamed + + + + removeLabel + + + [REMOVE QUESTION] + + + + + removeCheckBox + + + Also &remove it from disk + + + + + noticeLabel + + + + 200 + 0 + + + + <b>Note:</b> You will not be able to undo this operation. + + + + + + + buttonLayout + + + + unnamed + + + 0 + + + + buttonSpacer + + + Horizontal + + + Expanding + + + + 30 + 20 + + + + + + removeButton + + + &OK + + + true + + + + + cancelButton + + + &Cancel + + + + + + + + + removeButton + clicked() + RemoveSubprojectDlgBase + accept() + + + cancelButton + clicked() + RemoveSubprojectDlgBase + reject() + + + + kdialog.h + + + accept() + reject() + + + + diff --git a/buildtools/lib/widgets/runoptionswidget.cpp b/buildtools/lib/widgets/runoptionswidget.cpp new file mode 100644 index 00000000..95fe4529 --- /dev/null +++ b/buildtools/lib/widgets/runoptionswidget.cpp @@ -0,0 +1,138 @@ +/* This file is part of the KDE project + Copyright (C) 2001-2002 Bernd Gehrmann + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include "runoptionswidget.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "domutil.h" +#include "environmentvariableswidget.h" + + +RunOptionsWidget::RunOptionsWidget(QDomDocument &dom, const QString &configGroup, + const QString &buildDirectory, QWidget *parent, const char *name) + : RunOptionsWidgetBase(parent, name), + m_dom(dom), m_configGroup(configGroup) +{ + // Create the "Environment Variables" GUI + env_var_group->setColumnLayout( 1, Qt::Vertical ); + m_environmentVariablesWidget = new EnvironmentVariablesWidget( dom, configGroup + "/run/envvars", env_var_group ); + + mainprogram_edit->completionObject()->setMode(KURLCompletion::FileCompletion); + mainprogram_edit->setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly ); + if( DomUtil::readEntry(dom, configGroup + "/run/mainprogram").isEmpty() && QFileInfo( buildDirectory ).exists() ) + { + mainprogram_edit->setURL( buildDirectory ); + mainprogram_edit->fileDialog()->setURL( KURL::fromPathOrURL(buildDirectory) ); + }else if ( QFileInfo( DomUtil::readEntry(dom, configGroup + "/run/mainprogram") ).exists() ) + { + QString program = DomUtil::readEntry(dom, configGroup + "/run/mainprogram"); + if( QDir::isRelativePath(program) ) + program = buildDirectory + "/" + program; + mainprogram_edit->setURL(program); + mainprogram_edit->fileDialog()->setURL( program ); + }else + { + mainprogram_edit->setURL(QString()); + mainprogram_edit->fileDialog()->setURL(QString()); + } + + cwd_edit->completionObject()->setMode(KURLCompletion::DirCompletion); + cwd_edit->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly ); + if( DomUtil::readEntry(dom, configGroup + "/run/globalcwd").isEmpty() && QFileInfo( buildDirectory ).exists() ) + { + cwd_edit->setURL( buildDirectory ); + cwd_edit->fileDialog()->setURL( KURL::fromPathOrURL(buildDirectory) ); + }else if( QFileInfo( DomUtil::readEntry(dom, configGroup + "/run/globalcwd") ).exists() ) + { + cwd_edit->setURL(DomUtil::readEntry(dom, configGroup + "/run/globalcwd")); + cwd_edit->fileDialog()->setURL( KURL::fromPathOrURL( DomUtil::readEntry(dom, configGroup + "/run/globalcwd") ) ); + }else + { + cwd_edit->setURL(QString()); + cwd_edit->fileDialog()->setURL(QString()); + } + + if( configGroup == "/kdevautoproject" || configGroup == "/kdevtrollproject" ) + { + mainProgramGroupBox->setCheckable(true); + mainProgramGroupBox->setChecked( DomUtil::readBoolEntry(dom, configGroup+"/run/useglobalprogram", false ) ); + }else + { + delete notelabel; + } + + // Read the main program command line arguments and store them in the edit box + + runargs_edit->setText(DomUtil::readEntry(dom, configGroup + "/run/programargs")); + debugargs_edit->setText(DomUtil::readEntry(dom, configGroup + "/run/globaldebugarguments")); + + startinterminal_box->setChecked(DomUtil::readBoolEntry(dom, configGroup + "/run/terminal")); + autocompile_box->setChecked(DomUtil::readBoolEntry(dom, configGroup + "/run/autocompile", false)); + autoinstall_box->setChecked(DomUtil::readBoolEntry(dom, configGroup + "/run/autoinstall", false)); + autokdesu_box->setChecked(DomUtil::readBoolEntry(dom, configGroup + "/run/autokdesu", false)); +} + + +RunOptionsWidget::~RunOptionsWidget() +{} + + +void RunOptionsWidget::accept() +{ + DomUtil::writeEntry(m_dom, m_configGroup + "/run/mainprogram", mainprogram_edit->url()); + DomUtil::writeEntry(m_dom, m_configGroup + "/run/programargs", runargs_edit->text()); + DomUtil::writeEntry(m_dom, m_configGroup + "/run/globaldebugarguments", debugargs_edit->text()); + DomUtil::writeEntry(m_dom, m_configGroup + "/run/globalcwd", cwd_edit->url()); + DomUtil::writeBoolEntry(m_dom, m_configGroup + "/run/useglobalprogram", mainProgramGroupBox->isChecked()); + DomUtil::writeBoolEntry(m_dom, m_configGroup + "/run/terminal", startinterminal_box->isChecked()); + DomUtil::writeBoolEntry(m_dom, m_configGroup + "/run/autocompile", autocompile_box->isChecked()); + DomUtil::writeBoolEntry(m_dom, m_configGroup + "/run/autoinstall", autoinstall_box->isChecked()); + DomUtil::writeBoolEntry(m_dom, m_configGroup + "/run/autokdesu", autokdesu_box->isChecked()); + + m_environmentVariablesWidget->accept(); +} + +void RunOptionsWidget::mainProgramChanged( ) +{ + + if( mainProgramGroupBox->isChecked() && mainprogram_edit->url().isEmpty() ) + { + mainprogram_label->setPaletteForegroundColor(QColor("#ff0000")); + } + else + { + mainprogram_label->unsetPalette(); + } +} + +#include "runoptionswidget.moc" diff --git a/buildtools/lib/widgets/runoptionswidget.h b/buildtools/lib/widgets/runoptionswidget.h new file mode 100644 index 00000000..758ef4b1 --- /dev/null +++ b/buildtools/lib/widgets/runoptionswidget.h @@ -0,0 +1,57 @@ +/* This file is part of the KDE project + Copyright (C) 2001-2002 Bernd Gehrmann + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef _RUNOPTIONSWIDGET_H_ +#define _RUNOPTIONSWIDGET_H_ + +#include "runoptionswidgetbase.h" + +#include +#include + +class EnvironmentVariablesWidget; + +/** +Run options widget. +*/ +class RunOptionsWidget : public RunOptionsWidgetBase +{ + Q_OBJECT + +public: + RunOptionsWidget( QDomDocument &dom, //!< document DOM + const QString &configGroup, //!< configuration group + const QString &buildDirectory, //!< project build directory + QWidget *parent=0, //!< parent widget + const char *name=0 //!< widget's name + ); + ~RunOptionsWidget(); + +public slots: + void accept(); + +private: + virtual void mainProgramChanged( ); + + QDomDocument &m_dom; + QString m_configGroup; + EnvironmentVariablesWidget* m_environmentVariablesWidget; +}; + +#endif diff --git a/buildtools/lib/widgets/runoptionswidgetbase.ui b/buildtools/lib/widgets/runoptionswidgetbase.ui new file mode 100644 index 00000000..1163484c --- /dev/null +++ b/buildtools/lib/widgets/runoptionswidgetbase.ui @@ -0,0 +1,257 @@ + +RunOptionsWidgetBase + + + run_options_widget + + + + 0 + 0 + 500 + 506 + + + + Run Options + + + + unnamed + + + + mainProgramGroupBox + + + + 5 + 0 + 0 + 0 + + + + Main Program + + + false + + + false + + + + unnamed + + + + notelabel + + + Note: These options override target specific settings. + + + AlignVCenter + + + For Automake and QMake type projects, the proper way to set these options are per target in the <b>Automake Manager</b> and <b>QMake Manager</b>, respectively. + + + + + runargs_edit + + + The command line arguments passed to the main program when run + + + + + mainprogram_label_2 + + + Run Arg&uments: + + + mainprogram_edit + + + + + mainprogram_label + + + Executa&ble: + + + mainprogram_edit + + + + + mainprogram_edit + + + Full path to the executable + + + + + mainprogram_label_3 + + + Debug Ar&guments: + + + mainprogram_edit + + + + + debugargs_edit + + + The command line arguments passed to the main program when debugged + + + + + mainprogram_label_3_2 + + + Working &Directory: + + + mainprogram_edit + + + + + cwd_edit + + + Sets the current working directory for the launched process + + + + + + + groupBox2 + + + + 5 + 0 + 0 + 0 + + + + Options + + + + unnamed + + + + autocompile_box + + + Automaticall&y compile before execution + + + If the program is not up-to-date with the source code, compile it before starting its execution + + + + + autoinstall_box + + + &Automatically install before execution + + + + + + + + autokdesu_box + + + Use &kdesu when installing + + + + + + + + startinterminal_box + + + Start in e&xternal terminal + + + Start the main program in an external terminal + + + + + + + env_var_group + + + Environment &Variables + + + + + + + mainprogram_edit + textChanged(const QString&) + run_options_widget + mainProgramChanged() + + + mainprogram_edit + urlSelected(const QString&) + run_options_widget + mainProgramChanged() + + + mainProgramGroupBox + toggled(bool) + run_options_widget + mainProgramChanged() + + + + startinterminal_box + autocompile_box + + + kdialog.h + ksqueezedtextlabel.h + + + mainProgramChanged() + + + + + klineedit.h + kurlrequester.h + klineedit.h + kpushbutton.h + klineedit.h + kurlrequester.h + klineedit.h + kpushbutton.h + + diff --git a/buildtools/lib/widgets/subclassesdlg.cpp b/buildtools/lib/widgets/subclassesdlg.cpp new file mode 100644 index 00000000..5c3a0fef --- /dev/null +++ b/buildtools/lib/widgets/subclassesdlg.cpp @@ -0,0 +1,122 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +#include +#include + +#include "subclassesdlg.h" +#include "subclassesdlg.moc" +SubclassesDlg::SubclassesDlg(QString form, DomUtil::PairList &config, QString projectDir, QWidget* parent, const char* name, bool modal, WFlags fl) +: SubclassesDlgBase(parent,name, modal,fl), m_form(form), m_config(config), m_projectDir(projectDir) +{ + subclass_url->setEnabled(false); + + DomUtil::PairList::iterator it; + for ( it = config.begin(); it != config.end(); ++it ) + { + if ((*it).second == form) + subclasses_box->insertItem(projectDir + (*it).first); + } +} + +SubclassesDlg::~SubclassesDlg() +{ +} + +/*$SPECIALIZATION$*/ +void SubclassesDlg::accept() +{ + QPtrList pairsToRemove; + + DomUtil::PairList::iterator it; + for ( it = m_config.begin(); it != m_config.end(); ++it ) + { + if ((*it).second == m_form) + { + pairsToRemove.append(&(*it)); + } + } + + DomUtil::Pair *pair; + for ( pair = pairsToRemove.first(); pair; pair = pairsToRemove.next() ) + { + m_config.remove(*pair); + } + + for (int i = 0; i < (int)subclasses_box->count(); ++i) + { + m_config << DomUtil::Pair(subclasses_box->text(i).remove(0,m_projectDir.length()), m_form); + } + + SubclassesDlgBase::accept(); +} + + +void SubclassesDlg::newRelation() +{ + subclasses_box->setFocus(); + subclasses_box->insertItem(""); + subclasses_box->setCurrentItem(subclasses_box->count()-1); + subclass_url->setEnabled(true); + subclass_url->setURL(""); + subclass_url->setFocus(); +} + +void SubclassesDlg::removeRelation() +{ + if (subclasses_box->currentItem() > -1) + { + QListBoxItem *item = subclasses_box->item(subclasses_box->currentItem()); + int itemIdx = subclasses_box->currentItem(); + + if (item->prev()) + { + subclasses_box->setCurrentItem(item->prev()); + subclass_url->setURL(item->prev()->text()); + } + else if (item->next()) + { + subclasses_box->setCurrentItem(item->next()); + subclass_url->setURL(item->next()->text()); + } + else + { + subclass_url->setEnabled(false); + subclass_url->setURL(""); + } + subclasses_box->removeItem(itemIdx); + } +} + +void SubclassesDlg::changeCurrentURL(const QString &str) +{ + if ( subclasses_box->currentItem() > -1 ) + { + subclasses_box->changeItem(str, subclasses_box->currentItem()); + } +} + +void SubclassesDlg::currentRelationChanged( QListBoxItem * item ) +{ + if (item) + { + subclass_url->setEnabled(true); + subclass_url->setURL(item->text()); + } +} + diff --git a/buildtools/lib/widgets/subclassesdlg.h b/buildtools/lib/widgets/subclassesdlg.h new file mode 100644 index 00000000..46b07b31 --- /dev/null +++ b/buildtools/lib/widgets/subclassesdlg.h @@ -0,0 +1,58 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef SUBCLASSESDLG_H +#define SUBCLASSESDLG_H +#include "domutil.h" +#include "subclassesdlgbase.h" + +/** +Subclass creation dialog. +*/ +class SubclassesDlg : public SubclassesDlgBase +{ + Q_OBJECT + +public: + SubclassesDlg(QString form, DomUtil::PairList &config, QString projectDir, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~SubclassesDlg(); + /*$PUBLIC_FUNCTIONS$*/ + +public slots: + /*$PUBLIC_SLOTS$*/ + virtual void accept(); + +protected: + /*$PROTECTED_FUNCTIONS$*/ + +protected slots: + /*$PROTECTED_SLOTS$*/ + virtual void newRelation(); + virtual void removeRelation(); + virtual void changeCurrentURL(const QString &str); + virtual void currentRelationChanged(QListBoxItem *item); + +private: + QString m_form; + DomUtil::PairList &m_config; + QString m_projectDir; +}; + +#endif + diff --git a/buildtools/lib/widgets/subclassesdlgbase.ui b/buildtools/lib/widgets/subclassesdlgbase.ui new file mode 100644 index 00000000..026ab2ca --- /dev/null +++ b/buildtools/lib/widgets/subclassesdlgbase.ui @@ -0,0 +1,224 @@ + +SubclassesDlgBase + + + SubclassesDlgBase + + + + 0 + 0 + 514 + 278 + + + + Related Subclasses + + + true + + + + unnamed + + + + add_button + + + &Add Relation + + + false + + + + + remove_button + + + &Remove Relation + + + false + + + + + subclasses_box + + + + + subclass_url + + + + 0 + 24 + + + + WheelFocus + + + + + spacer2 + + + Vertical + + + Expanding + + + + 20 + 90 + + + + + + textLabel2 + + + + 5 + 5 + 0 + 0 + + + + Related subclass &location: + + + WordBreak|AlignVCenter + + + subclass_url + + + + + layout3 + + + + unnamed + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 310 + 20 + + + + + + buttonOk + + + &OK + + + true + + + true + + + + + buttonCancel + + + &Cancel + + + true + + + false + + + + + + + + + buttonOk + clicked() + SubclassesDlgBase + accept() + + + subclass_url + textChanged(const QString&) + SubclassesDlgBase + changeCurrentURL(const QString&) + + + remove_button + clicked() + SubclassesDlgBase + removeRelation() + + + buttonCancel + clicked() + SubclassesDlgBase + reject() + + + add_button + clicked() + SubclassesDlgBase + newRelation() + + + subclasses_box + clicked(QListBoxItem*) + SubclassesDlgBase + currentRelationChanged(QListBoxItem*) + + + + subclasses_box + add_button + subclass_url + remove_button + buttonOk + buttonCancel + + + kdialog.h + + + changeCurrentURL(const QString &str) + removeRelation() + newRelation() + currentRelationChanged(QListBoxItem *item) + + + + + kurlrequester.h + klineedit.h + kpushbutton.h + + -- cgit v1.2.3