summaryrefslogtreecommitdiffstats
path: root/languages/cpp/pcsimporter/qtimporter
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch)
treeacaf47eb0fa12142d3896416a69e74cbf5a72242 /languages/cpp/pcsimporter/qtimporter
downloadtdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz
tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip
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
Diffstat (limited to 'languages/cpp/pcsimporter/qtimporter')
-rw-r--r--languages/cpp/pcsimporter/qtimporter/Makefile.am11
-rw-r--r--languages/cpp/pcsimporter/qtimporter/kdevqtimporter.cpp73
-rw-r--r--languages/cpp/pcsimporter/qtimporter/kdevqtimporter.desktop37
-rw-r--r--languages/cpp/pcsimporter/qtimporter/kdevqtimporter.h37
-rw-r--r--languages/cpp/pcsimporter/qtimporter/settingsdialog.cpp122
-rw-r--r--languages/cpp/pcsimporter/qtimporter/settingsdialog.h46
-rw-r--r--languages/cpp/pcsimporter/qtimporter/settingsdialogbase.ui139
7 files changed, 465 insertions, 0 deletions
diff --git a/languages/cpp/pcsimporter/qtimporter/Makefile.am b/languages/cpp/pcsimporter/qtimporter/Makefile.am
new file mode 100644
index 00000000..878f9b4a
--- /dev/null
+++ b/languages/cpp/pcsimporter/qtimporter/Makefile.am
@@ -0,0 +1,11 @@
+INCLUDES = -I$(top_srcdir)/languages/lib/interfaces \
+ -I$(top_srcdir)/lib/interfaces $(all_includes)
+METASOURCES = AUTO
+kde_module_LTLIBRARIES = libkdevqtimporter.la
+
+noinst_HEADERS = kdevqtimporter.h settingsdialog.h
+libkdevqtimporter_la_SOURCES = kdevqtimporter.cpp settingsdialogbase.ui settingsdialog.cpp
+kde_services_DATA = kdevqtimporter.desktop
+libkdevqtimporter_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \
+ $(top_builddir)/languages/lib/interfaces/liblang_interfaces.la
+libkdevqtimporter_la_LDFLAGS = -module $(all_libraries) $(KDE_PLUGIN)
diff --git a/languages/cpp/pcsimporter/qtimporter/kdevqtimporter.cpp b/languages/cpp/pcsimporter/qtimporter/kdevqtimporter.cpp
new file mode 100644
index 00000000..add8574a
--- /dev/null
+++ b/languages/cpp/pcsimporter/qtimporter/kdevqtimporter.cpp
@@ -0,0 +1,73 @@
+/***************************************************************************
+* Copyright (C) 2003 by Roberto Raggi *
+* roberto@kdevelop.org *
+* *
+* 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 "kdevqtimporter.h"
+#include "kdevqtimporter.moc"
+#include "settingsdialog.h"
+
+#include <kgenericfactory.h>
+
+#include <qlabel.h>
+#include <qdir.h>
+
+K_EXPORT_COMPONENT_FACTORY( libkdevqtimporter, KGenericFactory<KDevQtImporter>( "kdevqtimporter" ) )
+
+KDevQtImporter::KDevQtImporter( QObject * parent, const char * name, const QStringList& )
+ : KDevPCSImporter( parent, name )
+{}
+
+KDevQtImporter::~KDevQtImporter()
+{}
+
+QStringList KDevQtImporter::fileList()
+{
+ if ( !m_settings )
+ return QStringList();
+
+ QDir dir( m_settings->qtDir() );
+ QStringList lst = dir.entryList( "*.h" );
+ QStringList fileList;
+ for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it )
+ {
+ if ( ( *it ).startsWith( "qconfig-" ) )
+ {
+ if ( ( *it ).endsWith( m_settings->configuration() + ".h" ) )
+ fileList.prepend( dir.absPath() + "/" + ( *it ) );
+ }
+ else
+ {
+ fileList.push_back( dir.absPath() + "/" + ( *it ) );
+ }
+ }
+ return fileList;
+}
+
+QStringList KDevQtImporter::includePaths()
+{
+ if ( !m_settings )
+ return QStringList();
+
+ QStringList includePaths;
+ includePaths.push_back( m_settings->qtDir() );
+ includePaths.push_back( m_settings->qtDir() + "/private" );
+ includePaths.push_back( m_settings->qtDir() + "/default" );
+
+ /// @todo add mkspec
+ return includePaths;
+}
+
+QWidget * KDevQtImporter::createSettingsPage( QWidget * parent, const char * name )
+{
+ m_settings = new SettingsDialog( parent, name );
+ return m_settings;
+}
+
+//kate: indent-mode csands; tab-width 4; space-indent off;
diff --git a/languages/cpp/pcsimporter/qtimporter/kdevqtimporter.desktop b/languages/cpp/pcsimporter/qtimporter/kdevqtimporter.desktop
new file mode 100644
index 00000000..965e581f
--- /dev/null
+++ b/languages/cpp/pcsimporter/qtimporter/kdevqtimporter.desktop
@@ -0,0 +1,37 @@
+[Desktop Entry]
+Type=Service
+Name=KDevQtImporter
+Name[da]=KDevelop Qt-importør
+Name[de]=Qt-PCS-Import (KDevelop)
+Name[hi]=के-डेव-क्यूटी-आयातक
+Name[nds]=Qt-PCS-Import (KDevelop)
+Name[pl]=KDevImportQt
+Name[sv]=KDevelop QT-import
+Name[ta]=கெடெவ் க்யு இறக்குமதியாளர்
+Name[zh_TW]=KDev Qt 匯入器
+Comment=KDevelop Qt3 PCS Importer
+Comment[ca]=Importador PCS de Qt3 per a KDevelop
+Comment[da]=KDevelop Qt3 PCS importør
+Comment[de]=Qt3-Import für persistenten Klassenspeicher
+Comment[el]=Εισαγωγέας PCS KDevelop Qt3
+Comment[es]=Importador PCS de Qt3 de KDevelop
+Comment[et]=KDevelopi Qt3 PCS importija
+Comment[fr]=Importation PCS de Qt3 pour KDevelop
+Comment[hu]=KDevelop Qt3 PCS-importáló
+Comment[it]=Importatore PCS di Qt3 di KDevelop
+Comment[ja]=KDevelop Qt3 PCS インポータ
+Comment[nds]=Qt3-Import för duerhaftig Klassenspieker
+Comment[pl]=KDevelop: importowanie PCS Qt3
+Comment[pt]=Importador de PCS para Qt3 do KDevelop
+Comment[pt_BR]=Importador de PCS para Qt3 do KDevelop
+Comment[ru]=Импорт Qt 3 PCS в KDevelop
+Comment[sk]=KDevelop Qt3 PCS import
+Comment[sr]=KDevelop-ов Qt3 PCS увозник
+Comment[sr@Latn]=KDevelop-ov Qt3 PCS uvoznik
+Comment[sv]=KDevelop QT3 PCS-import
+Comment[zh_TW]=KDevelop Qt3 PCS 匯入器
+Icon=gear
+ServiceTypes=KDevelop/PCSImporter
+X-KDE-Library=libkdevqtimporter
+X-KDevelop-PCSImporter=
+X-KDevelop-Version=5
diff --git a/languages/cpp/pcsimporter/qtimporter/kdevqtimporter.h b/languages/cpp/pcsimporter/qtimporter/kdevqtimporter.h
new file mode 100644
index 00000000..c53b0a8a
--- /dev/null
+++ b/languages/cpp/pcsimporter/qtimporter/kdevqtimporter.h
@@ -0,0 +1,37 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Roberto Raggi *
+ * roberto@kdevelop.org *
+ * *
+ * 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 KDEVQTIMPORTER_H
+#define KDEVQTIMPORTER_H
+
+#include <kdevpcsimporter.h>
+#include <qguardedptr.h>
+
+class SettingsDialog;
+
+class KDevQtImporter : public KDevPCSImporter
+{
+ Q_OBJECT
+public:
+ KDevQtImporter( QObject* parent=0, const char* name=0, const QStringList& args=QStringList() );
+ virtual ~KDevQtImporter();
+
+ virtual QString dbName() const { return QString::fromLatin1("Qt"); }
+ virtual QStringList fileList();
+ virtual QStringList includePaths();
+
+ virtual QWidget* createSettingsPage( QWidget* parent, const char* name=0 );
+
+private:
+ QGuardedPtr<SettingsDialog> m_settings;
+};
+
+#endif
diff --git a/languages/cpp/pcsimporter/qtimporter/settingsdialog.cpp b/languages/cpp/pcsimporter/qtimporter/settingsdialog.cpp
new file mode 100644
index 00000000..b0db10cc
--- /dev/null
+++ b/languages/cpp/pcsimporter/qtimporter/settingsdialog.cpp
@@ -0,0 +1,122 @@
+/***************************************************************************
+* Copyright (C) 2003 by Roberto Raggi *
+* roberto@kdevelop.org *
+* *
+* Copyright (C) 2006 by Jens Dagerbo *
+* jens.dagerbo@swipnet.se *
+* *
+* 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 <klistbox.h>
+#include <kcombobox.h>
+#include <kurlrequester.h>
+#include <kdebug.h>
+#include <klineedit.h>
+#include <kmessagebox.h>
+#include <klocale.h>
+
+#include <qfile.h>
+#include <qdir.h>
+#include <qregexp.h>
+#include <cstdlib>
+
+#include "settingsdialog.h"
+
+QListBoxItem* QListBox_selectedItem( QListBox* cpQListBox )
+{
+ if ( cpQListBox->selectionMode() != QListBox::Single )
+ return 0;
+ if ( cpQListBox->isSelected( cpQListBox->currentItem() ) )
+ return cpQListBox->item( cpQListBox->currentItem() );
+ return 0;
+}
+
+SettingsDialog::SettingsDialog( QWidget* parent, const char* name, WFlags fl )
+ : SettingsDialogBase( parent, name, fl )
+{
+ QStringList qtdirs;
+ qtdirs.push_back( ::getenv( "QTDIR" ) + QString("/include") );
+ qtdirs.push_back( "/usr/lib/qt3/include" );
+ qtdirs.push_back( "/usr/lib/qt/include" );
+ qtdirs.push_back( "/usr/share/qt3/include" );
+ qtdirs.push_back( "/usr/qt/3/include" ); // gentoo style
+
+ for ( QStringList::Iterator it = qtdirs.begin(); it != qtdirs.end(); ++it )
+ {
+ QString qtdir = *it;
+ if ( !qtdir.isEmpty() && isValidQtDir( qtdir ) )
+ if ( !qtListBox->findItem( qtdir, ExactMatch ) )
+ qtListBox->insertItem( qtdir );
+ }
+
+ qtUrl->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly );
+
+ connect( addUrlButton, SIGNAL(clicked()), this, SLOT(addUrlButton_clicked()) );
+}
+
+SettingsDialog::~SettingsDialog()
+{}
+
+void SettingsDialog::slotSelectionChanged( QListBoxItem* )
+{
+ if ( !qtListBox->selectedItem() )
+ {
+ emit enabled( false );
+ return ;
+ }
+
+ QDir dir( qtDir() );
+ QStringList qconfigFileList = dir.entryList( "qconfig-*.h" );
+ qtConfiguration->clear();
+ QRegExp rx( "qconfig-(\\w+)\\.h" );
+ for ( QStringList::Iterator it = qconfigFileList.begin(); it != qconfigFileList.end(); ++it )
+ {
+ ( void ) rx.exactMatch( *it );
+ qtConfiguration->insertItem( rx.cap( 1 ) );
+ }
+
+ emit enabled( true );
+}
+
+bool SettingsDialog::isValidQtDir( const QString & path ) const
+{
+ return QFile::exists( path + "/qt.h" );
+}
+
+QString SettingsDialog::qtDir( ) const
+{
+ return qtListBox->currentText();
+}
+
+QString SettingsDialog::configuration( ) const
+{
+ return qtConfiguration->currentText();
+}
+void SettingsDialog::addUrlButton_clicked( )
+{
+ kdDebug(9000) << k_funcinfo << endl;
+
+ if ( isValidQtDir( qtUrl->url() ) )
+ {
+ qtListBox->insertItem( qtUrl->url() );
+ if ( QListBoxItem * item = qtListBox->findItem( qtUrl->url(), ExactMatch ) )
+ {
+ qtListBox->setSelected( item, true );
+ }
+ qtUrl->lineEdit()->clear();
+ }
+ else
+ {
+ KMessageBox::error( this, i18n("This does not appear to be a valid Qt3 include directory.\nPlease select a different directory."), i18n("Invalid Directory") );
+ }
+
+}
+
+#include "settingsdialog.moc"
+//kate: indent-mode csands; tab-width 4; space-indent off;
+
diff --git a/languages/cpp/pcsimporter/qtimporter/settingsdialog.h b/languages/cpp/pcsimporter/qtimporter/settingsdialog.h
new file mode 100644
index 00000000..1ec5663e
--- /dev/null
+++ b/languages/cpp/pcsimporter/qtimporter/settingsdialog.h
@@ -0,0 +1,46 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Roberto Raggi *
+ * roberto@kdevelop.org *
+ * *
+ * 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 SETTINGSDIALOG_H
+#define SETTINGSDIALOG_H
+
+#include "settingsdialogbase.h"
+
+class SettingsDialog : public SettingsDialogBase
+{
+ Q_OBJECT
+
+public:
+ SettingsDialog(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~SettingsDialog();
+ /*$PUBLIC_FUNCTIONS$*/
+
+ bool isValidQtDir( const QString& path ) const;
+
+ QString qtDir() const;
+ QString configuration() const;
+
+public slots:
+ /*$PUBLIC_SLOTS$*/
+ virtual void slotSelectionChanged(QListBoxItem*);
+
+protected:
+ /*$PROTECTED_FUNCTIONS$*/
+
+protected slots:
+ /*$PROTECTED_SLOTS$*/
+ void addUrlButton_clicked();
+
+};
+
+#endif
+
+
diff --git a/languages/cpp/pcsimporter/qtimporter/settingsdialogbase.ui b/languages/cpp/pcsimporter/qtimporter/settingsdialogbase.ui
new file mode 100644
index 00000000..fa485d57
--- /dev/null
+++ b/languages/cpp/pcsimporter/qtimporter/settingsdialogbase.ui
@@ -0,0 +1,139 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>SettingsDialogBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>SettingsDialogBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>397</width>
+ <height>283</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer row="3" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>161</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget" row="3" column="0">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Scope:</string>
+ </property>
+ </widget>
+ <widget class="KComboBox">
+ <property name="name">
+ <cstring>qtConfiguration</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Select the Qt configuration for which to create a Code Completion database. If you do not know what this option does, accept the default.</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QPushButton" row="2" column="2">
+ <property name="name">
+ <cstring>addUrlButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Add</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>qtUrl</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Qt3 include directories:
+Only the selected entry will be used</string>
+ </property>
+ </widget>
+ <widget class="KListBox" row="1" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>qtListBox</cstring>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>qtListBox</sender>
+ <signal>selectionChanged(QListBoxItem*)</signal>
+ <receiver>SettingsDialogBase</receiver>
+ <slot>slotSelectionChanged(QListBoxItem*)</slot>
+ </connection>
+</connections>
+<signals>
+ <signal>enabled(int)</signal>
+</signals>
+<slots>
+ <slot>slotSelectionChanged(QListBoxItem*)</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kcombobox.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klistbox.h</includehint>
+</includehints>
+</UI>