summaryrefslogtreecommitdiffstats
path: root/buildtools/ada
diff options
context:
space:
mode:
Diffstat (limited to 'buildtools/ada')
-rw-r--r--buildtools/ada/Makefile.am18
-rw-r--r--buildtools/ada/README.dox17
-rw-r--r--buildtools/ada/adaglobaloptionsdlg.cpp129
-rw-r--r--buildtools/ada/adaglobaloptionsdlg.h50
-rw-r--r--buildtools/ada/adaproject_optionsdlgbase.ui472
-rw-r--r--buildtools/ada/adaproject_part.cpp465
-rw-r--r--buildtools/ada/adaproject_part.h93
-rw-r--r--buildtools/ada/adaproject_widget.cpp24
-rw-r--r--buildtools/ada/adaproject_widget.h21
-rw-r--r--buildtools/ada/adaprojectoptionsdlg.cpp208
-rw-r--r--buildtools/ada/adaprojectoptionsdlg.h57
-rw-r--r--buildtools/ada/kdevadaproject.desktop100
-rw-r--r--buildtools/ada/kdevadaproject.rc14
-rw-r--r--buildtools/ada/service.cpp75
-rw-r--r--buildtools/ada/service.h27
15 files changed, 1770 insertions, 0 deletions
diff --git a/buildtools/ada/Makefile.am b/buildtools/ada/Makefile.am
new file mode 100644
index 00000000..2de845ca
--- /dev/null
+++ b/buildtools/ada/Makefile.am
@@ -0,0 +1,18 @@
+INCLUDES = -I$(top_srcdir)/buildtools/lib/base -I$(top_srcdir)/lib/interfaces \
+ -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/interfaces/external \
+ -I$(top_srcdir)/lib/interfaces/extras -I$(top_srcdir)/lib/util $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevadaproject.la
+libkdevadaproject_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevadaproject_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \
+ $(top_builddir)/buildtools/lib/base/libkdevbuildbase.la $(top_builddir)/lib/interfaces/extras/libkdevextras.la
+
+libkdevadaproject_la_SOURCES = adaproject_part.cpp adaproject_widget.cpp adaproject_optionsdlgbase.ui adaprojectoptionsdlg.cpp adaglobaloptionsdlg.cpp service.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevadaproject.desktop
+
+rcdir = $(kde_datadir)/kdevadaproject
+rc_DATA = kdevadaproject.rc
diff --git a/buildtools/ada/README.dox b/buildtools/ada/README.dox
new file mode 100644
index 00000000..24e0bd7e
--- /dev/null
+++ b/buildtools/ada/README.dox
@@ -0,0 +1,17 @@
+/** \class AdaProjectPart
+Ada Project: the common project part for all available ada
+compilers (currently only gnat).
+It holds the project file list and tries to abstract from their specifics.
+
+\authors <a href="mailto:okellogg AT users.sourceforge.net">Oliver Kellogg</a>
+
+\unmaintained This part is currently un-maintained
+
+\deprecated This class is deprecated, use GenericProjectPart (buildtools/generic) instead.
+
+\feature supports gnat compiler
+\feature Holds the project file list and tries to abstract from their specifics
+
+\requirement Ada gnat compiler
+
+*/
diff --git a/buildtools/ada/adaglobaloptionsdlg.cpp b/buildtools/ada/adaglobaloptionsdlg.cpp
new file mode 100644
index 00000000..a8171c81
--- /dev/null
+++ b/buildtools/ada/adaglobaloptionsdlg.cpp
@@ -0,0 +1,129 @@
+/* Copyright (C) 2003 Oliver Kellogg
+ * okellogg@users.sourceforge.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 <qlayout.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qcombobox.h>
+
+#include <kurlrequester.h>
+#include <kdebug.h>
+#include <kconfig.h>
+
+#include "kdevcompileroptions.h"
+
+#include "service.h"
+#include "adaproject_part.h"
+#include "adaglobaloptionsdlg.h"
+
+AdaGlobalOptionsDlg::AdaGlobalOptionsDlg(AdaProjectPart *part, QWidget* parent, const char* name, WFlags fl)
+ :AdaProjectOptionsDlgBase(parent,name,fl), m_part(part)
+{
+ delete config_label;
+ delete config_combo;
+ delete addconfig_button;
+ delete removeconfig_button;
+ delete compiler_label;
+ delete configuration_layout;
+ delete configuration_line;
+ delete exec_label;
+ delete exec_edit;
+ delete mainSourceLabel;
+ delete mainSourceUrl;
+ delete defaultopts_button;
+
+ offers = KTrader::self()->query("KDevelop/CompilerOptions", "[X-KDevelop-Language] == 'Ada'");
+
+ ServiceComboBox::insertStringList(compiler_box, offers, &service_names, &service_execs);
+
+ if (offers.isEmpty())
+ options_button->setEnabled(false);
+
+ currentCompiler = QString::null;
+
+ /*kdDebug() << ServiceComboBox::defaultCompiler() << endl;
+ kdDebug() << ServiceComboBox::itemForText(ServiceComboBox::defaultCompiler(), service_names) << endl;
+ kdDebug() << compiler_box->text(ServiceComboBox::itemForText(ServiceComboBox::defaultCompiler(), service_names)) << endl;
+*/
+ ServiceComboBox::setCurrentText(compiler_box, ServiceComboBox::defaultCompiler(), service_names);
+ compiler_box_activated(compiler_box->currentText());
+}
+
+AdaGlobalOptionsDlg::~AdaGlobalOptionsDlg()
+{
+}
+
+void AdaGlobalOptionsDlg::optionsButtonClicked()
+{
+ QString name = ServiceComboBox::currentText(compiler_box, service_names);
+ KDevCompilerOptions *plugin = m_part->createCompilerOptions(name);
+
+ if (plugin) {
+ QString flags = plugin->exec(this, options_edit->text());
+ options_edit->setText(flags);
+ delete plugin;
+ }
+}
+
+void AdaGlobalOptionsDlg::compiler_box_activated(const QString& text)
+{
+ kdDebug() << "text changed from " << currentCompiler << " to " << text << endl;
+ if (currentCompiler == text)
+ return;
+ if (!currentCompiler.isEmpty())
+ saveCompilerOpts(currentCompiler);
+ currentCompiler = text;
+ readCompilerOpts(currentCompiler);
+}
+
+void AdaGlobalOptionsDlg::accept()
+{
+ saveCompilerOpts(currentCompiler);
+
+ saveConfigCache();
+}
+
+void AdaGlobalOptionsDlg::saveCompilerOpts( QString compiler )
+{
+ configCache[compiler] = options_edit->text();
+}
+
+void AdaGlobalOptionsDlg::readCompilerOpts( QString compiler )
+{
+ QString settings = configCache[compiler];
+ if (settings.isEmpty())
+ {
+ KConfig *config = KGlobal::config();
+ config->setGroup("Ada Compiler");
+ settings = config->readPathEntry(compiler);
+ }
+
+ options_edit->setText(settings);
+}
+
+void AdaGlobalOptionsDlg::readConfigCache( )
+{
+/* KConfig *config = KGlobal::config();
+ config->setGroup("Ada Compiler");
+
+ QMap<QString, QString> settings = config->entryMap("Ada Compiler");
+*/
+}
+
+void AdaGlobalOptionsDlg::saveConfigCache( )
+{
+ KConfig *config = KGlobal::config();
+ config->setGroup("Ada Compiler");
+
+ for (QMap<QString, QString>::iterator it = configCache.begin(); it != configCache.end(); ++it)
+ {
+ config->writeEntry(it.key(), it.data());
+ }
+}
+
+#include "adaglobaloptionsdlg.moc"
diff --git a/buildtools/ada/adaglobaloptionsdlg.h b/buildtools/ada/adaglobaloptionsdlg.h
new file mode 100644
index 00000000..92001a1b
--- /dev/null
+++ b/buildtools/ada/adaglobaloptionsdlg.h
@@ -0,0 +1,50 @@
+/* Copyright (C) 2003 Oliver Kellogg
+ * okellogg@users.sourceforge.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 ADAGLOBALOPTIONSDLG_H
+#define ADAGLOBALOPTIONSDLG_H
+
+#include <qmap.h>
+
+#include <ktrader.h>
+
+#include "adaproject_optionsdlgbase.h"
+
+class AdaProjectPart;
+
+class AdaGlobalOptionsDlg : public AdaProjectOptionsDlgBase
+{
+ Q_OBJECT
+
+public:
+ AdaGlobalOptionsDlg(AdaProjectPart *part, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~AdaGlobalOptionsDlg();
+
+public slots:
+ virtual void accept();
+
+protected slots:
+ virtual void optionsButtonClicked();
+ virtual void compiler_box_activated(const QString& text);
+
+private:
+ AdaProjectPart *m_part;
+ KTrader::OfferList offers;
+ QString currentCompiler;
+ QStringList service_names;
+ QStringList service_execs;
+ QMap<QString, QString> configCache;
+
+ void saveCompilerOpts(QString compiler);
+ void readCompilerOpts(QString compiler);
+
+ void readConfigCache();
+ void saveConfigCache();
+};
+
+#endif
diff --git a/buildtools/ada/adaproject_optionsdlgbase.ui b/buildtools/ada/adaproject_optionsdlgbase.ui
new file mode 100644
index 00000000..72e99f74
--- /dev/null
+++ b/buildtools/ada/adaproject_optionsdlgbase.ui
@@ -0,0 +1,472 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>AdaProjectOptionsDlgBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>AdaProjectOptionsDlgBase</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Ada Compiler</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer row="10" column="1">
+ <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>160</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget" row="0" column="0" rowspan="1" colspan="5">
+ <property name="name">
+ <cstring>configuration_layout</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>config_label</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Configuration:</string>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <property name="name">
+ <cstring>config_combo</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer17_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>8</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>addconfig_button</cstring>
+ </property>
+ <property name="text">
+ <string>Add</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>removeconfig_button</cstring>
+ </property>
+ <property name="text">
+ <string>Remove</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer18_2</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>
+ </hbox>
+ </widget>
+ <widget class="QPushButton" row="6" column="4">
+ <property name="name">
+ <cstring>options_button</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="6" column="0">
+ <property name="name">
+ <cstring>options_label</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Compiler &amp;options:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>compiler_box</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>compiler_label</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Ada &amp;compiler:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>compiler_box</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="4" column="1" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>exec_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="6" column="1" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>options_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="2" column="1" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>compiler_box</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>exec_label</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Compiler co&amp;mmand:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>compiler_box</cstring>
+ </property>
+ </widget>
+ <widget class="Line" row="1" column="0" rowspan="1" colspan="5">
+ <property name="name">
+ <cstring>configuration_line</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <spacer row="3" column="1">
+ <property name="name">
+ <cstring>spacer11</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="5" column="3">
+ <property name="name">
+ <cstring>spacer12</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KURLRequester" row="9" column="1" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>mainSourceUrl</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>26</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>WheelFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="9" column="0">
+ <property name="name">
+ <cstring>mainSourceLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Main &amp;source file:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>compiler_box</cstring>
+ </property>
+ </widget>
+ <spacer row="8" column="2">
+ <property name="name">
+ <cstring>spacer13</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>30</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="7" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>400</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton" row="7" column="3" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>defaultopts_button</cstring>
+ </property>
+ <property name="text">
+ <string>Load Default Compiler Options</string>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>compiler_box</sender>
+ <signal>activated(const QString&amp;)</signal>
+ <receiver>AdaProjectOptionsDlgBase</receiver>
+ <slot>compiler_box_activated(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>removeconfig_button</sender>
+ <signal>clicked()</signal>
+ <receiver>AdaProjectOptionsDlgBase</receiver>
+ <slot>configRemoved()</slot>
+ </connection>
+ <connection>
+ <sender>config_combo</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>AdaProjectOptionsDlgBase</receiver>
+ <slot>configComboTextChanged(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>config_combo</sender>
+ <signal>activated(const QString&amp;)</signal>
+ <receiver>AdaProjectOptionsDlgBase</receiver>
+ <slot>configChanged(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>addconfig_button</sender>
+ <signal>clicked()</signal>
+ <receiver>AdaProjectOptionsDlgBase</receiver>
+ <slot>configAdded()</slot>
+ </connection>
+ <connection>
+ <sender>options_button</sender>
+ <signal>clicked()</signal>
+ <receiver>AdaProjectOptionsDlgBase</receiver>
+ <slot>optionsButtonClicked()</slot>
+ </connection>
+ <connection>
+ <sender>exec_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>AdaProjectOptionsDlgBase</receiver>
+ <slot>setDirty()</slot>
+ </connection>
+ <connection>
+ <sender>options_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>AdaProjectOptionsDlgBase</receiver>
+ <slot>setDirty()</slot>
+ </connection>
+ <connection>
+ <sender>mainSourceUrl</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>AdaProjectOptionsDlgBase</receiver>
+ <slot>setDirty()</slot>
+ </connection>
+ <connection>
+ <sender>mainSourceUrl</sender>
+ <signal>urlSelected(const QString&amp;)</signal>
+ <receiver>AdaProjectOptionsDlgBase</receiver>
+ <slot>setDirty()</slot>
+ </connection>
+ <connection>
+ <sender>compiler_box</sender>
+ <signal>activated(const QString&amp;)</signal>
+ <receiver>AdaProjectOptionsDlgBase</receiver>
+ <slot>setDirty()</slot>
+ </connection>
+ <connection>
+ <sender>compiler_box</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>AdaProjectOptionsDlgBase</receiver>
+ <slot>setDirty()</slot>
+ </connection>
+ <connection>
+ <sender>defaultopts_button</sender>
+ <signal>clicked()</signal>
+ <receiver>AdaProjectOptionsDlgBase</receiver>
+ <slot>setDefaultOptions()</slot>
+ </connection>
+ <connection>
+ <sender>defaultopts_button</sender>
+ <signal>clicked()</signal>
+ <receiver>AdaProjectOptionsDlgBase</receiver>
+ <slot>setDirty()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>compiler_box</tabstop>
+ <tabstop>exec_edit</tabstop>
+ <tabstop>options_edit</tabstop>
+ <tabstop>options_button</tabstop>
+ <tabstop>mainSourceUrl</tabstop>
+ <tabstop>config_combo</tabstop>
+ <tabstop>addconfig_button</tabstop>
+ <tabstop>removeconfig_button</tabstop>
+</tabstops>
+<slots>
+ <slot access="protected">compiler_box_activated(const QString&amp;)</slot>
+ <slot access="protected">addconfig_button_clicked()</slot>
+ <slot access="protected">configRemoved()</slot>
+ <slot access="protected">configComboTextChanged(const QString&amp;)</slot>
+ <slot access="protected">configChanged(const QString&amp;)</slot>
+ <slot access="protected">optionsButtonClicked()</slot>
+ <slot access="protected">configAdded()</slot>
+ <slot access="protected">setDirty()</slot>
+ <slot access="protected">setDefaultOptions()</slot>
+</slots>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>qwidget.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/buildtools/ada/adaproject_part.cpp b/buildtools/ada/adaproject_part.cpp
new file mode 100644
index 00000000..33ba166b
--- /dev/null
+++ b/buildtools/ada/adaproject_part.cpp
@@ -0,0 +1,465 @@
+/* Copyright (C) 2003 Oliver Kellogg
+ * okellogg@users.sourceforge.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 "adaproject_part.h"
+
+#include <qdom.h>
+#include <qfileinfo.h>
+#include <qdir.h>
+#include <qvaluestack.h>
+#include <qregexp.h>
+#include <qvbox.h>
+
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kaction.h>
+#include <kgenericfactory.h>
+#include <kdebug.h>
+#include <kdialogbase.h>
+#include <kmessagebox.h>
+#include <klibloader.h>
+#include <kprocess.h>
+#include <kservice.h>
+#include <kconfig.h>
+
+#include "domutil.h"
+#include "kdevcore.h"
+#include "kdevmainwindow.h"
+#include "kdevmakefrontend.h"
+#include "kdevappfrontend.h"
+#include "kdevpartcontroller.h"
+#include "kdevlanguagesupport.h"
+#include "kdevcompileroptions.h"
+#include "kdevgenericfactory.h"
+#include <kdevplugininfo.h>
+
+#include "adaproject_widget.h"
+#include "adaprojectoptionsdlg.h"
+#include "adaglobaloptionsdlg.h"
+
+typedef KDevGenericFactory<AdaProjectPart> AdaProjectFactory;
+static const KDevPluginInfo data("kdevadaproject");
+K_EXPORT_COMPONENT_FACTORY( libkdevadaproject, AdaProjectFactory( data ) )
+
+AdaProjectPart::AdaProjectPart(QObject *parent, const char *name, const QStringList& )
+ :KDevBuildTool(&data, parent, name ? name : "AdaProjectPart" )
+{
+ setInstance(AdaProjectFactory::instance());
+ setXMLFile("kdevadaproject.rc");
+
+ KAction *action;
+ action = new KAction( i18n("&Build Project"), "make_kdevelop", Key_F8,
+ this, SLOT(slotBuild()),
+ actionCollection(), "build_build" );
+ action = new KAction( i18n("Execute Program"), "exec", 0,
+ this, SLOT(slotExecute()),
+ actionCollection(), "build_execute" );
+
+ connect( core(), SIGNAL(projectConfigWidget(KDialogBase*)),
+ this, SLOT(projectConfigWidget(KDialogBase*)) );
+
+ connect( core(), SIGNAL(configWidget(KDialogBase*)),
+ this, SLOT(configWidget(KDialogBase*)) );
+
+// m_widget = new AdaProjectWidget(this);
+
+// QWhatsThis::add(m_widget, i18n("WHAT DOES THIS PART DO?"));
+
+ // now you decide what should happen to the widget. Take a look at kdevcore.h
+ // or at other plugins how to embed it.
+
+ // if you want to embed your widget as an outputview, simply uncomment
+ // the following line.
+
+ // mainWindow()->embedOutputView( m_widget, "name that should appear", "enter a tooltip" );
+
+}
+
+AdaProjectPart::~AdaProjectPart()
+{
+// delete m_widget;
+}
+
+/**
+ * This should really be merged with FileTreeWidget::matchesHidePattern()
+ * and put in its own class. Currently this is repeated in scriptprojectpart.cpp, pascalproject_part.cpp, adaproject_part.cpp
+ */
+static bool matchesPattern(const QString &fileName, const QStringList &patternList)
+{
+ QStringList::ConstIterator it;
+ for (it = patternList.begin(); it != patternList.end(); ++it) {
+ QRegExp re(*it, true, true);
+ if (re.search(fileName) == 0 && re.matchedLength() == (int)fileName.length())
+ return true;
+ }
+
+ return false;
+}
+
+void AdaProjectPart::openProject(const QString &dirName, const QString &projectName)
+{
+ m_buildDir = dirName;
+ m_projectDir = dirName;
+ m_projectName = projectName;
+
+ QDomDocument &dom = *projectDom();
+ // Set the default directory radio to "executable"
+ if (DomUtil::readEntry(dom, "/kdevadaproject/run/directoryradio") == "" ) {
+ DomUtil::writeEntry(dom, "/kdevadaproject/run/directoryradio", "executable");
+ }
+
+ loadProjectConfig();
+
+ // Put all files from all subdirectories into file list
+ QValueStack<QString> s;
+ int prefixlen = m_projectDir.length()+1;
+ s.push(m_projectDir);
+
+ QStringList includepatternList;
+
+ if ( languageSupport() )
+ {
+ KMimeType::List list = languageSupport()->mimeTypes();
+ KMimeType::List::Iterator it = list.begin();
+ while( it != list.end() ){
+ includepatternList += (*it)->patterns();
+ ++it;
+ }
+ }
+
+ QString excludepatterns = "*~";
+ QStringList excludepatternList = QStringList::split(",", excludepatterns);
+
+ QDir dir;
+ do {
+ dir.setPath(s.pop());
+ kdDebug() << "AdaProjectPart::openProject examining: " << dir.path() << endl;
+ const QFileInfoList *dirEntries = dir.entryInfoList();
+ if( !dirEntries )
+ break;
+
+ QPtrListIterator<QFileInfo> it(*dirEntries);
+ for (; it.current(); ++it) {
+ QString fileName = it.current()->fileName();
+ if (fileName == "." || fileName == "..")
+ continue;
+ QString path = it.current()->absFilePath();
+ if (it.current()->isDir()) {
+ kdDebug() << "AdaProjectPart::openProject pushing: " << path << endl;
+ s.push(path);
+ }
+ else {
+ if (matchesPattern(path, includepatternList)
+ && !matchesPattern(path, excludepatternList)) {
+ kdDebug() << "AdaProjectPart::openProject adding: " << path << endl;
+ m_sourceFiles.append(path.mid(prefixlen));
+ } else {
+ kdDebug() << "AdaProjectPart::openProject ignoring: " << path << endl;
+ }
+ }
+ }
+ } while (!s.isEmpty());
+
+ KDevProject::openProject( dirName, projectName );
+}
+
+void AdaProjectPart::closeProject()
+{
+}
+
+/** Retuns a PairList with the run environment variables */
+DomUtil::PairList AdaProjectPart::runEnvironmentVars() const
+{
+ return DomUtil::readPairListEntry(*projectDom(), "/kdevadaproject/run/envvars", "envvar", "name", "value");
+}
+
+
+/** 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 AdaProjectPart::runDirectory() const
+{
+ QString cwd = defaultRunDirectory("kdevadaproject");
+ if (cwd.isEmpty())
+ cwd = buildDirectory();
+ 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 AdaProjectPart::mainProgram() const
+{
+ QDomDocument * dom = projectDom();
+
+ if ( !dom ) return QString();
+
+ QString DomMainProgram = DomUtil::readEntry( *dom, "/kdevadaproject/run/mainprogram");
+
+ if ( DomMainProgram.isEmpty() ) return QString();
+
+ if ( DomMainProgram.startsWith("/") ) // assume absolute path
+ {
+ return DomMainProgram;
+ }
+ else // assume project relative path
+ {
+ return projectDirectory() + "/" + DomMainProgram;
+ }
+
+ return QString();
+}
+
+/** Retuns a QString with the run command line arguments */
+QString AdaProjectPart::debugArguments() const
+{
+ return DomUtil::readEntry(*projectDom(), "/kdevadaproject/run/globaldebugarguments");
+}
+
+
+/** Retuns a QString with the run command line arguments */
+QString AdaProjectPart::runArguments() const
+{
+ return DomUtil::readEntry(*projectDom(), "/kdevadaproject/run/programargs");
+}
+
+QString AdaProjectPart::mainSource() const
+{
+ return projectDirectory() + "/" + m_mainSource;
+}
+
+void AdaProjectPart::setMainSource(QString fullPath)
+{
+ QString olddir = activeDirectory();
+ m_mainSource = fullPath.replace(QRegExp(QString(projectDirectory() + QString("/"))),"");
+ emit activeDirectoryChanged( olddir, activeDirectory() );
+}
+
+QString AdaProjectPart::projectDirectory() const
+{
+ return m_projectDir;
+}
+
+QString AdaProjectPart::projectName() const
+{
+ return m_projectName;
+}
+
+QString AdaProjectPart::activeDirectory() const
+{
+ QFileInfo fi(mainSource());
+ return fi.dirPath(true).replace(QRegExp(projectDirectory()),"");
+}
+
+QString AdaProjectPart::buildDirectory() const
+{
+ QFileInfo fi(mainSource());
+ return fi.dirPath(true);
+}
+
+void AdaProjectPart::listOfFiles(QStringList &result, QString path) const
+{
+ QDir d(path);
+ if (!d.exists())
+ return;
+
+ const QFileInfoList *entries = d.entryInfoList(QDir::Dirs | QDir::Files | QDir::Hidden);
+ if( !entries )
+ return;
+
+ QFileInfoListIterator it( *entries );
+ while( const QFileInfo* fileInfo = it.current() )
+ {
+ ++it;
+
+ if (fileInfo->isDir() && fileInfo->filePath() != path)
+ {
+ kdDebug() << "entering dir " << fileInfo->dirPath() << endl;
+ listOfFiles(result, fileInfo->dirPath());
+ }
+ else
+ {
+ kdDebug() << "adding to result: " << fileInfo->filePath() << endl;
+ result << fileInfo->filePath();
+ }
+ }
+}
+
+QStringList AdaProjectPart::allFiles() const
+{
+// QStringList files;
+
+// listOfFiles(files, projectDirectory());
+
+// return files;
+ return m_sourceFiles;
+}
+
+void AdaProjectPart::addFile(const QString& /*fileName*/)
+{
+}
+
+void AdaProjectPart::addFiles(const QStringList& /*fileList*/)
+{
+}
+
+void AdaProjectPart::removeFile(const QString& /*fileName*/)
+{
+}
+
+void AdaProjectPart::removeFiles(const QStringList& /*fileList*/)
+{
+}
+
+void AdaProjectPart::slotBuild()
+{
+ if (partController()->saveAllFiles()==false)
+ return; //user cancelled
+
+ QString cmdline = m_compilerExec + " " + m_compilerOpts + " ";
+
+ if (cmdline.isEmpty())
+ {
+ KMessageBox::sorry(0, i18n("Could not find ada compiler.\nCheck if your compiler settings are correct."));
+ return;
+ }
+
+ QFileInfo fi(mainSource());
+ cmdline += fi.fileName();
+
+ QString dircmd = "cd ";
+ dircmd += KProcess::quote(buildDirectory());
+ dircmd += " && ";
+
+ makeFrontend()->queueCommand(buildDirectory(), dircmd + cmdline);
+}
+
+void AdaProjectPart::slotExecute()
+{
+ partController()->saveAllFiles();
+ QString program = "./";
+ appFrontend()->startAppCommand(buildDirectory(), mainProgram(), true);
+}
+
+void AdaProjectPart::changedFiles( const QStringList & fileList )
+{
+ KDevProject::changedFiles(fileList);
+}
+
+void AdaProjectPart::changedFile( const QString & fileName )
+{
+ KDevProject::changedFile(fileName);
+}
+
+void AdaProjectPart::projectConfigWidget( KDialogBase * dlg )
+{
+ QVBox *vbox;
+ vbox = dlg->addVBoxPage(i18n("Ada Compiler"));
+ AdaProjectOptionsDlg *w = new AdaProjectOptionsDlg(this, vbox);
+ connect( dlg, SIGNAL(okClicked()), w, SLOT(accept()) );
+ connect( dlg, SIGNAL(okClicked()), this, SLOT(loadProjectConfig()) );
+}
+
+void AdaProjectPart::loadProjectConfig( )
+{
+ QDomDocument &dom = *(projectDom());
+
+ QString config = DomUtil::readEntry(dom, "/kdevadaproject/general/useconfiguration", "default");
+ m_mainSource = DomUtil::readEntry(dom, QString("/kdevadaproject/configurations/") + config + QString("/mainsource") );
+ m_compilerOpts = DomUtil::readEntry(dom, QString("/kdevadaproject/configurations/") + config + QString("/compileroptions"));
+ m_compilerExec = DomUtil::readEntry(dom, QString("/kdevadaproject/configurations/") + config + QString("/compilerexec"));
+
+ if (m_compilerExec.isEmpty())
+ {
+ KTrader::OfferList offers = KTrader::self()->query("KDevelop/CompilerOptions", "[X-KDevelop-Language] == 'Ada'");
+ QValueList<KService::Ptr>::ConstIterator it;
+ for (it = offers.begin(); it != offers.end(); ++it) {
+ if ((*it)->property("X-KDevelop-Default").toBool()) {
+ m_compilerExec = (*it)->exec();
+ break;
+ }
+ }
+ }
+}
+
+void AdaProjectPart::configWidget( KDialogBase * dlg )
+{
+ QVBox *vbox;
+ vbox = dlg->addVBoxPage(i18n("Ada Compiler"));
+ AdaGlobalOptionsDlg *w = new AdaGlobalOptionsDlg(this, vbox);
+ connect( dlg, SIGNAL(okClicked()), w, SLOT(accept()) );
+}
+
+KDevCompilerOptions *AdaProjectPart::createCompilerOptions(const QString &name)
+{
+ KService::Ptr service = KService::serviceByDesktopName(name);
+ if (!service) {
+ kdDebug() << "AdaProjectPart::createCompilerOptions can't find service " << name;
+ return 0;
+ }
+
+ KLibFactory *factory = KLibLoader::self()->factory(QFile::encodeName(service->library()));
+ if (!factory) {
+ QString errorMessage = KLibLoader::self()->lastErrorMessage();
+ KMessageBox::error(0, i18n("There was an error loading the module %1.\n"
+ "The diagnostics are:\n%2").arg(service->name()).arg(errorMessage));
+ exit(1);
+ }
+
+ QStringList args;
+ QVariant prop = service->property("X-KDevelop-Args");
+ if (prop.isValid())
+ args = QStringList::split(" ", prop.toString());
+
+ QObject *obj = factory->create(this, service->name().latin1(),
+ "KDevCompilerOptions", args);
+
+ if (!obj->inherits("KDevCompilerOptions")) {
+ kdDebug() << "AdaProjectPart::createCompilerOptions: component does not inherit KDevCompilerOptions" << endl;
+ return 0;
+ }
+ KDevCompilerOptions *dlg = (KDevCompilerOptions*) obj;
+
+ return dlg;
+}
+
+QString AdaProjectPart::defaultOptions( const QString compiler )
+{
+ KConfig *config = KGlobal::config();
+ config->setGroup("Ada Compiler");
+ return config->readPathEntry(compiler);
+}
+
+#include "adaproject_part.moc"
+
+
+/*!
+ \fn AdaProjectPart::distFiles() const
+ */
+QStringList AdaProjectPart::distFiles() const
+{
+ QStringList sourceList = allFiles();
+ // Scan current source directory for any .pro files.
+ QString projectDir = projectDirectory();
+ QDir dir(projectDir);
+ QStringList files = dir.entryList( "Makefile");
+ return sourceList + files;
+}
diff --git a/buildtools/ada/adaproject_part.h b/buildtools/ada/adaproject_part.h
new file mode 100644
index 00000000..88966ae2
--- /dev/null
+++ b/buildtools/ada/adaproject_part.h
@@ -0,0 +1,93 @@
+/* Copyright (C) 2003 Oliver Kellogg
+ * okellogg@users.sourceforge.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 __KDEVPART_ADAPROJECT_H__
+#define __KDEVPART_ADAPROJECT_H__
+
+#include <qguardedptr.h>
+
+#include "kdevbuildtool.h"
+
+class AdaProjectWidget;
+class KDialogBase;
+class KDevCompilerOptions;
+
+class AdaProjectPart : public KDevBuildTool
+{
+ Q_OBJECT
+public:
+ AdaProjectPart(QObject *parent, const char *name, const QStringList &);
+ ~AdaProjectPart();
+
+ virtual void openProject(const QString &dirName, const QString &projectName);
+ virtual void closeProject();
+
+ /**Returns the name of the main source file without extension.
+ We assume that all Ada compilers call the binary that way. */
+ virtual QString mainProgram() const;
+ /**Main source file (like src/main.adb)*/
+ virtual QString mainSource() const;
+ virtual void setMainSource(QString fullPath);
+
+ virtual QString projectDirectory() const;
+ virtual QString projectName() const;
+ virtual QString activeDirectory() const;
+ /**The location of the main source file*/
+ virtual QString buildDirectory() const;
+ virtual QString runDirectory() const;
+ virtual QString debugArguments() const;
+ virtual QString runArguments() const;
+ virtual DomUtil::PairList runEnvironmentVars() const;
+
+ /**Returns everything in the project directory*/
+ virtual QStringList allFiles() const;
+ /**This does absolutelly nothing*/
+ virtual void addFile(const QString &fileName);
+ /**This does absolutelly nothing*/
+ virtual void addFiles(const QStringList &fileList);
+ /**This does absolutelly nothing*/
+ virtual void removeFile(const QString &fileName);
+ /**This does absolutelly nothing*/
+ virtual void removeFiles(const QStringList &fileList);
+
+ virtual void changedFiles( const QStringList & fileList );
+ virtual void changedFile( const QString & fileName );
+
+ KDevCompilerOptions *createCompilerOptions(const QString &name);
+
+ virtual QString defaultOptions(const QString compiler);
+ QStringList distFiles() const;
+
+public slots:
+ /**loads config from project file*/
+ void loadProjectConfig();
+
+private slots:
+ void slotBuild();
+ void slotExecute();
+ void projectConfigWidget(KDialogBase *dlg);
+ void configWidget(KDialogBase *dlg);
+
+private:
+ QGuardedPtr<AdaProjectWidget> m_widget;
+
+ void listOfFiles(QStringList &result, QString path) const;
+
+ QString m_buildDir;
+ QString m_projectDir;
+ QString m_projectName;
+
+ QString m_mainProg;
+ QString m_mainSource;
+ QString m_compilerExec;
+ QString m_compilerOpts;
+
+ QStringList m_sourceFiles;
+};
+
+#endif
diff --git a/buildtools/ada/adaproject_widget.cpp b/buildtools/ada/adaproject_widget.cpp
new file mode 100644
index 00000000..d4bdf37b
--- /dev/null
+++ b/buildtools/ada/adaproject_widget.cpp
@@ -0,0 +1,24 @@
+#include <kparts/part.h>
+#include <klibloader.h>
+#include <kurl.h>
+#include <kdebug.h>
+
+#include <kdevcore.h>
+
+#include "adaproject_part.h"
+#include "adaproject_widget.h"
+
+
+AdaProjectWidget::AdaProjectWidget(AdaProjectPart *part)
+ : QWidget(0, "AdaProject widget")
+{
+ Q_UNUSED( part );
+}
+
+
+AdaProjectWidget::~AdaProjectWidget()
+{
+}
+
+
+#include "adaproject_widget.moc"
diff --git a/buildtools/ada/adaproject_widget.h b/buildtools/ada/adaproject_widget.h
new file mode 100644
index 00000000..dc6b4ec4
--- /dev/null
+++ b/buildtools/ada/adaproject_widget.h
@@ -0,0 +1,21 @@
+#ifndef __ADAPROJECT_WIDGET_H__
+#define __ADAPROJECT_WIDGET_H__
+
+#include <qwidget.h>
+#include <qstring.h>
+
+class KDevProject;
+class AdaProjectPart;
+
+class AdaProjectWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+
+ AdaProjectWidget(AdaProjectPart *part);
+ ~AdaProjectWidget();
+
+};
+
+#endif
diff --git a/buildtools/ada/adaprojectoptionsdlg.cpp b/buildtools/ada/adaprojectoptionsdlg.cpp
new file mode 100644
index 00000000..3eafb082
--- /dev/null
+++ b/buildtools/ada/adaprojectoptionsdlg.cpp
@@ -0,0 +1,208 @@
+/* Copyright (C) 2003 Oliver Kellogg
+ * okellogg@users.sourceforge.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 <kurlrequester.h>
+#include <kservice.h>
+#include <kdebug.h>
+#include <kmessagebox.h>
+#include <klocale.h>
+
+#include <qlineedit.h>
+#include <qcombobox.h>
+#include <qregexp.h>
+#include <qvalidator.h>
+
+#include "domutil.h"
+#include "kdevcompileroptions.h"
+
+#include "service.h"
+#include "adaproject_part.h"
+#include "adaprojectoptionsdlg.h"
+
+AdaProjectOptionsDlg::AdaProjectOptionsDlg(AdaProjectPart *part, QWidget* parent, const char* name, WFlags fl)
+ : AdaProjectOptionsDlgBase(parent,name, fl), m_part(part)
+{
+ config_combo->setValidator(new QRegExpValidator(QRegExp("^\\D.*"), this));
+
+ offers = KTrader::self()->query("KDevelop/CompilerOptions", "[X-KDevelop-Language] == 'Ada'");
+
+ ServiceComboBox::insertStringList(compiler_box, offers, &service_names, &service_execs);
+
+ if (offers.isEmpty())
+ options_button->setEnabled(false);
+
+ allConfigs = allBuildConfigs();
+ config_combo->insertStringList(allConfigs);
+
+ dirty = false;
+
+ QDomDocument &dom = *(m_part->projectDom());
+ currentConfig = QString::null;
+ configChanged(DomUtil::readEntry(dom, "/kdevadaproject/general/useconfiguration", "default"));
+}
+
+AdaProjectOptionsDlg::~AdaProjectOptionsDlg()
+{
+}
+
+QStringList AdaProjectOptionsDlg::allBuildConfigs()
+{
+ QDomDocument &dom = *(m_part->projectDom());
+
+ QStringList allConfigs;
+ allConfigs.append("default");
+
+ QDomNode node = dom.documentElement().namedItem("kdevadaproject").namedItem("configurations");
+ QDomElement childEl = node.firstChild().toElement();
+ while (!childEl.isNull()) {
+ QString config = childEl.tagName();
+ kdDebug() << "Found config " << config << endl;
+ if (config != "default")
+ allConfigs.append(config);
+ childEl = childEl.nextSibling().toElement();
+ }
+
+ return allConfigs;
+}
+
+void AdaProjectOptionsDlg::accept()
+{
+ DomUtil::writeEntry(*m_part->projectDom(), "/kdevadaproject/general/useconfiguration", currentConfig);
+ if (dirty)
+ {
+ saveConfig(currentConfig);
+ }
+}
+
+void AdaProjectOptionsDlg::compiler_box_activated( const QString& /*s*/ )
+{
+ QString exec = ServiceComboBox::currentText(compiler_box, service_execs);
+ exec_edit->setText(exec);
+}
+
+void AdaProjectOptionsDlg::saveConfig( QString config )
+{
+ QDomDocument dom = *m_part->projectDom();
+ QString prefix = "/kdevadaproject/configurations/" + config + "/";
+
+ DomUtil::writeEntry(dom, prefix + "compiler",
+ ServiceComboBox::currentText(compiler_box, service_names));
+ DomUtil::writeEntry(dom, prefix + "compileroptions", options_edit->text());
+ DomUtil::writeEntry(dom, prefix + "compilerexec", exec_edit->text());
+ DomUtil::writeEntry(dom, prefix + "mainsource", mainSourceUrl->url().replace(QRegExp(m_part->projectDirectory() + QString("/")),""));
+}
+
+void AdaProjectOptionsDlg::readConfig( QString config )
+{
+ QDomDocument dom = *m_part->projectDom();
+ QString prefix = "/kdevadaproject/configurations/" + config + "/";
+
+ QString compiler = DomUtil::readEntry(dom, prefix + "compiler", "");
+
+ if (compiler.isEmpty())
+ {
+ offers = KTrader::self()->query("KDevelop/CompilerOptions", "[X-KDevelop-Language] == 'Ada'");
+ QValueList<KService::Ptr>::ConstIterator it;
+ for (it = offers.begin(); it != offers.end(); ++it) {
+ if ((*it)->property("X-KDevelop-Default").toBool()) {
+ compiler = (*it)->name();
+ kdDebug() << "compiler is " << compiler << endl;
+ break;
+ }
+ }
+ }
+ ServiceComboBox::setCurrentText(compiler_box, compiler, service_names);
+
+ QString exec = DomUtil::readEntry(dom, prefix + "compilerexec", "");
+ if (exec.isEmpty())
+ exec = ServiceComboBox::currentText(compiler_box, service_execs);
+ exec_edit->setText(exec);
+ options_edit->setText(DomUtil::readEntry(dom, prefix + "compileroptions"));
+ mainSourceUrl->setURL(m_part->projectDirectory() + "/" + DomUtil::readEntry(dom, prefix + "mainsource"));
+}
+
+void AdaProjectOptionsDlg::configComboTextChanged(const QString &config)
+{
+ bool canAdd = !allConfigs.contains(config) && !config.contains("/") && !config.isEmpty();
+ bool canRemove = allConfigs.contains(config) && config != "default";
+ addconfig_button->setEnabled(canAdd);
+ removeconfig_button->setEnabled(canRemove);
+}
+
+
+void AdaProjectOptionsDlg::configChanged(const QString &config)
+{
+ if (config == currentConfig || !allConfigs.contains(config))
+ return;
+
+ if (!currentConfig.isNull() && dirty)
+ saveConfig(currentConfig);
+
+ currentConfig = config;
+ readConfig(config);
+ dirty = false;
+
+ config_combo->blockSignals(true);
+ config_combo->setEditText(config);
+ config_combo->blockSignals(false);
+}
+
+
+void AdaProjectOptionsDlg::configAdded()
+{
+ QString config = config_combo->currentText();
+
+ allConfigs.append(config);
+
+ config_combo->clear();
+ config_combo->insertStringList(allConfigs);
+ configChanged(config);
+ setDirty(); // force saving
+}
+
+
+void AdaProjectOptionsDlg::configRemoved()
+{
+ QString config = config_combo->currentText();
+
+ QDomDocument dom = *m_part->projectDom();
+ QDomNode node = dom.documentElement().namedItem("kdevadaproject").namedItem("configurations");
+ node.removeChild(node.namedItem(config));
+ allConfigs.remove(config);
+
+ config_combo->clear();
+ config_combo->insertStringList(allConfigs);
+
+ currentConfig = QString::null;
+ configChanged("default");
+}
+
+void AdaProjectOptionsDlg::optionsButtonClicked( )
+{
+ QString name = ServiceComboBox::currentText(compiler_box, service_names);
+ KDevCompilerOptions *plugin = m_part->createCompilerOptions(name);
+
+ if (plugin) {
+ QString flags = plugin->exec(this, options_edit->text());
+ options_edit->setText(flags);
+ delete plugin;
+ }
+}
+
+void AdaProjectOptionsDlg::setDirty( )
+{
+ dirty = true;
+}
+
+void AdaProjectOptionsDlg::setDefaultOptions( )
+{
+ if (!compiler_box->currentText().isEmpty())
+ options_edit->setText(m_part->defaultOptions(compiler_box->currentText()));
+}
+
+#include "adaprojectoptionsdlg.moc"
diff --git a/buildtools/ada/adaprojectoptionsdlg.h b/buildtools/ada/adaprojectoptionsdlg.h
new file mode 100644
index 00000000..d91c5266
--- /dev/null
+++ b/buildtools/ada/adaprojectoptionsdlg.h
@@ -0,0 +1,57 @@
+/* Copyright (C) 2003 Oliver Kellogg
+ * okellogg@users.sourceforge.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 ADAPROJECTOPTIONSDLG_H
+#define ADAPROJECTOPTIONSDLG_H
+
+#include <ktrader.h>
+
+#include "adaproject_optionsdlgbase.h"
+
+class AdaProjectPart;
+class KDevCompilerOptions;
+
+class AdaProjectOptionsDlg : public AdaProjectOptionsDlgBase
+{
+ Q_OBJECT
+
+public:
+ AdaProjectOptionsDlg(AdaProjectPart *part, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~AdaProjectOptionsDlg();
+
+public slots:
+ virtual void accept();
+
+protected slots:
+ virtual void compiler_box_activated(const QString &s);
+ void configComboTextChanged(const QString &config);
+ void configChanged(const QString &config);
+ void configAdded();
+ void configRemoved();
+ void optionsButtonClicked();
+ void setDirty();
+ void setDefaultOptions();
+
+private:
+ QStringList allConfigs;
+ QString currentConfig;
+ bool dirty;
+
+ KTrader::OfferList offers;
+ QStringList service_names;
+ QStringList service_execs;
+
+ AdaProjectPart *m_part;
+
+ void saveConfig(QString config);
+ void readConfig(QString config);
+ QStringList allBuildConfigs();
+};
+
+#endif
+
diff --git a/buildtools/ada/kdevadaproject.desktop b/buildtools/ada/kdevadaproject.desktop
new file mode 100644
index 00000000..0e306f4b
--- /dev/null
+++ b/buildtools/ada/kdevadaproject.desktop
@@ -0,0 +1,100 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=Ada Project
+Comment[br]=Raktres Ada
+Comment[ca]=Projecte Ada
+Comment[cs]=Ada projekt
+Comment[da]=Ada-projekt
+Comment[de]=Ada-Projekt für KDevelop
+Comment[el]=Έργο Ada
+Comment[es]=Proyecto Ada
+Comment[et]=Ada projekt
+Comment[eu]=Ada proiektua
+Comment[fa]=پروژۀ آدا
+Comment[fr]=Projet en Ada
+Comment[ga]=Tionscadal Ada
+Comment[gl]=Proxecto Ada
+Comment[hi]=एडीए परियोजना
+Comment[hu]=Ada-projekt
+Comment[is]=Ada verkefni
+Comment[it]=Progetto Ada
+Comment[ja]=Ada プロジェクト
+Comment[ms]=Projek Ada
+Comment[nds]=Ada-Projekt
+Comment[ne]=एडा परियोजना
+Comment[nl]=Ada-project
+Comment[pa]=Ada ਪ੍ਰੋਜੈਕਟ
+Comment[pl]=Projekt: Ada
+Comment[pt]=Projecto Ada
+Comment[pt_BR]=Projeto Ada
+Comment[ro]=Proiect Ada
+Comment[ru]=Проект Ada
+Comment[sk]=Ada projekt
+Comment[sl]=Projekt Ada
+Comment[sr]=Ada пројекат
+Comment[sr@Latn]=Ada projekat
+Comment[sv]=Ada-projekt
+Comment[ta]=அடா பிராஜக்ட்
+Comment[tg]=Лоиҳаи Ada
+Comment[tr]=Ada Projesi
+Comment[uz]=Ada loyihasi
+Comment[uz@cyrillic]=Ada лойиҳаси
+Comment[zh_CN]=Ada 工程
+Comment[zh_TW]=Ada 專案
+Name=KDevAdaProject
+Name[da]=KDevelop Ada-projekt
+Name[de]=Ada-Projekt (KDevelop)
+Name[fr]=Projet Ada pour KDevelop
+Name[hi]=के-डेव-एडीए-परियोजना
+Name[nds]=Ada-Projekt (KDevelop)
+Name[ne]=केडीई विकास एडा परियोजना
+Name[pl]=KDevProjektAda
+Name[sk]=KDevAdaProjekt
+Name[sv]=KDevelop Ada-projekt
+Name[ta]=கெடெவ் அடா பிராஜக்ட்
+Name[tg]=Лоиҳаи KDevAda
+Name[zh_TW]=KDevelop Ada 專案
+GenericName=Ada Project
+GenericName[br]=Raktres Ada
+GenericName[ca]=Projecte Ada
+GenericName[da]=Ada-projekt
+GenericName[de]=Ada-Projekt
+GenericName[el]=Έργο Ada
+GenericName[es]=Proyecto Ada
+GenericName[et]=Ada projekt
+GenericName[eu]=Ada proiektua
+GenericName[fa]=پروژۀ آدا
+GenericName[fr]=Projet en Ada
+GenericName[ga]=Tionscadal Ada
+GenericName[gl]=Proxecto Ada
+GenericName[hi]=एडीए परियोजना
+GenericName[hu]=Ada-projekt
+GenericName[is]=Ada verkefni
+GenericName[it]=Project con Ada
+GenericName[ja]=Ada プロジェクト
+GenericName[ms]=Projek Ada
+GenericName[nds]=Ada-Projekt
+GenericName[ne]=एडा परियोजना
+GenericName[nl]=Ada-project
+GenericName[pa]=Ada ਪ੍ਰੋਜੈਕਟ
+GenericName[pl]=Projekt: Ada
+GenericName[pt]=Projecto Ada
+GenericName[pt_BR]=Projeto Ada
+GenericName[ru]=Проект Ada
+GenericName[sk]=Ada projekt
+GenericName[sl]=Projekt Ada
+GenericName[sr]=Ada пројекат
+GenericName[sr@Latn]=Ada projekat
+GenericName[sv]=Ada-projekt
+GenericName[ta]=அடா பிராஜக்ட்
+GenericName[tg]=Лоиҳаи Ada
+GenericName[tr]=Ada Projesi
+GenericName[uz]=Ada loyihasi
+GenericName[uz@cyrillic]=Ada лойиҳаси
+GenericName[zh_CN]=Ada 工程
+GenericName[zh_TW]=Ada 專案
+ServiceTypes=KDevelop/Project
+X-KDE-Library=libkdevadaproject
+X-KDevelop-Version=5
+X-KDevelop-Language=Ada
diff --git a/buildtools/ada/kdevadaproject.rc b/buildtools/ada/kdevadaproject.rc
new file mode 100644
index 00000000..d7f260e1
--- /dev/null
+++ b/buildtools/ada/kdevadaproject.rc
@@ -0,0 +1,14 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="KDevAdaProject" version="1">
+<MenuBar>
+ <Menu name="build" >
+ <Action name="build_build" />
+ <Separator/>
+ <Action name="build_execute" />
+ </Menu>
+</MenuBar>
+<ToolBar name="mainToolBar" noMerge="1">
+ <Action name="build_build" group="build_operations" />
+ <Action name="build_execute" group="build_operations" />
+</ToolBar>
+</kpartplugin>
diff --git a/buildtools/ada/service.cpp b/buildtools/ada/service.cpp
new file mode 100644
index 00000000..02081a58
--- /dev/null
+++ b/buildtools/ada/service.cpp
@@ -0,0 +1,75 @@
+/* Copyright (C) 2001-2002 by Bernd Gehrmann
+ * bernd@kdevelop.org
+ * Copyright (C) 2003 Oliver Kellogg
+ * okellogg@users.sourceforge.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 <qcombobox.h>
+#include <qvaluelist.h>
+
+#include <kservice.h>
+#include <kdebug.h>
+
+#include "service.h"
+
+
+void ServiceComboBox::insertStringList(QComboBox *combo, const QValueList<KService::Ptr> &list,
+ QStringList *names, QStringList *execs)
+{
+ QValueList<KService::Ptr>::ConstIterator it;
+ for (it = list.begin(); it != list.end(); ++it) {
+ combo->insertItem((*it)->comment());
+ (*names) << (*it)->desktopEntryName();
+ (*execs) << (*it)->exec();
+ kdDebug() << "insertStringList item " << (*it)->name() << "," << (*it)->exec() << endl;
+ }
+}
+
+QString ServiceComboBox::currentText(QComboBox *combo, const QStringList &names)
+{
+ if (combo->currentItem() == -1)
+ return QString::null;
+ return names[combo->currentItem()];
+}
+
+void ServiceComboBox::setCurrentText(QComboBox *combo, const QString &str, const QStringList &names)
+{
+ QStringList::ConstIterator it;
+ int i = 0;
+ for (it = names.begin(); it != names.end(); ++it) {
+ if (*it == str) {
+ combo->setCurrentItem(i);
+ break;
+ }
+ ++i;
+ }
+}
+
+int ServiceComboBox::itemForText(const QString &str, const QStringList &names)
+{
+ QStringList::ConstIterator it;
+ int i = 0;
+ for (it = names.begin(); it != names.end(); ++it) {
+ if (*it == str) {
+ return i;
+ }
+ ++i;
+ }
+ return 0;
+}
+
+QString ServiceComboBox::defaultCompiler()
+{
+ KTrader::OfferList offers = KTrader::self()->query("KDevelop/CompilerOptions", "[X-KDevelop-Language] == 'Ada'");
+ QValueList<KService::Ptr>::ConstIterator it;
+ for (it = offers.begin(); it != offers.end(); ++it) {
+ if ((*it)->property("X-KDevelop-Default").toBool()) {
+ return (*it)->name();;
+ }
+ }
+ return "";
+}
diff --git a/buildtools/ada/service.h b/buildtools/ada/service.h
new file mode 100644
index 00000000..f9671d0a
--- /dev/null
+++ b/buildtools/ada/service.h
@@ -0,0 +1,27 @@
+/* Copyright (C) 2001-2002 by Bernd Gehrmann
+ * bernd@kdevelop.org
+ * Copyright (C) 2003 Oliver Kellogg
+ * okellogg@users.sourceforge.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 SERVICE_H
+#define SERVICE_H
+
+#include <ktrader.h>
+
+class ServiceComboBox
+{
+public:
+ static void insertStringList(QComboBox *combo, const QValueList<KService::Ptr> &list,
+ QStringList *names, QStringList *execs);
+ static QString currentText(QComboBox *combo, const QStringList &names);
+ static void setCurrentText(QComboBox *combo, const QString &str, const QStringList &names);
+ static int itemForText(const QString &str, const QStringList &names);
+ static QString defaultCompiler();
+};
+
+#endif