diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch) | |
tree | acaf47eb0fa12142d3896416a69e74cbf5a72242 /languages/cpp/pcsimporter | |
download | tdevelop-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')
29 files changed, 1825 insertions, 0 deletions
diff --git a/languages/cpp/pcsimporter/Makefile.am b/languages/cpp/pcsimporter/Makefile.am new file mode 100644 index 00000000..5a2945ac --- /dev/null +++ b/languages/cpp/pcsimporter/Makefile.am @@ -0,0 +1,3 @@ +INCLUDES = +METASOURCES = AUTO +SUBDIRS = qtimporter kdelibsimporter customimporter qt4importer diff --git a/languages/cpp/pcsimporter/customimporter/Makefile.am b/languages/cpp/pcsimporter/customimporter/Makefile.am new file mode 100644 index 00000000..5a630be9 --- /dev/null +++ b/languages/cpp/pcsimporter/customimporter/Makefile.am @@ -0,0 +1,12 @@ +INCLUDES = -I$(top_srcdir)/languages/lib/interfaces \ + -I$(top_srcdir)/lib/interfaces $(all_includes) +METASOURCES = AUTO +kde_module_LTLIBRARIES = libkdevcustompcsimporter.la + + +noinst_HEADERS = kdevcustomimporter.h +libkdevcustompcsimporter_la_SOURCES = kdevcustomimporter.cpp settingsdialog.cpp settingsdialogbase.ui +libkdevcustompcsimporter_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \ + $(top_builddir)/languages/lib/interfaces/liblang_interfaces.la +libkdevcustompcsimporter_la_LDFLAGS = -module $(all_libraries) $(KDE_PLUGIN) +kde_services_DATA = kdevpcscustomimporter.desktop diff --git a/languages/cpp/pcsimporter/customimporter/kdevcustomimporter.cpp b/languages/cpp/pcsimporter/customimporter/kdevcustomimporter.cpp new file mode 100644 index 00000000..c3e5cb43 --- /dev/null +++ b/languages/cpp/pcsimporter/customimporter/kdevcustomimporter.cpp @@ -0,0 +1,118 @@ +/*************************************************************************** +* Copyright (C) 2003 by Alexander Dymo * +* cloudtemple@mksat.net * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +***************************************************************************/ +#include "kdevcustomimporter.h" + +#include "settingsdialog.h" + +#include <qvaluestack.h> +#include <qdir.h> + +#include <kdebug.h> +#include <kgenericfactory.h> + +K_EXPORT_COMPONENT_FACTORY( libkdevcustompcsimporter, KGenericFactory<KDevCustomImporter>( "kdevcustompcsimporter" ) ) + +KDevCustomImporter::KDevCustomImporter( QObject* parent, const char* name, const QStringList & // args + ) + : KDevPCSImporter( parent, name ) +{} + + +KDevCustomImporter::~KDevCustomImporter() +{} + + +QString KDevCustomImporter::dbName() const +{ + return m_settings->dbName(); +} + +QStringList KDevCustomImporter::fileList( const QString& path ) +{ + QDir dir( path ); + if ( !dir.exists() ) + return QStringList(); +// QStringList lst = dir.entryList( "*.h;*.H;*.hh;*.hxx;*.hpp;*.tlh" ); + QStringList lst = dir.entryList( m_settings->filePattern() ); + QStringList fileList; + for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) + { + fileList.push_back( dir.absPath() + "/" + ( *it ) ); + } + return fileList; +} + +QStringList KDevCustomImporter::fileList() +{ + if ( !m_settings ) + return QStringList(); + + QStringList lst = m_settings->dirs(); + QStringList files; + for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) + { + if ( !m_settings->recursive() ) + files += fileList( *it ); + else + processDir( *it, files ); + } + + return files; +} + +QStringList KDevCustomImporter::includePaths() +{ + if ( !m_settings ) + return QStringList(); + + return m_settings->dirs(); +} + +QWidget* KDevCustomImporter::createSettingsPage( QWidget* parent, const char* name ) +{ + m_settings = new SettingsDialog( parent, name ); + return m_settings; +} + +void KDevCustomImporter::processDir( const QString path, QStringList & files ) +{ + QValueStack<QString> s; + s.push( path ); + files += fileList( path ); + + QDir dir; + do + { + dir.setPath( s.pop() ); + if (!dir.exists()) + continue; + kdDebug( 9015 ) << "Examining: " << dir.path() << endl; + const QFileInfoList *dirEntries = dir.entryInfoList(); + if ( !dirEntries ) continue; + QPtrListIterator<QFileInfo> it( *dirEntries ); + for ( ; dirEntries && it.current(); ++it ) + { + QString fileName = it.current() ->fileName(); + if ( fileName == "." || fileName == ".." ) + continue; + if ( it.current() ->isDir() ) + { + QString tmpPath = it.current() ->absFilePath(); + kdDebug( 9015 ) << "Pushing: " << tmpPath << endl; + s.push( tmpPath ); + files += fileList( tmpPath ); + } + } + } + while ( !s.isEmpty() ); +} + +#include "kdevcustomimporter.moc" +//kate: indent-mode csands; tab-width 4; space-indent off; diff --git a/languages/cpp/pcsimporter/customimporter/kdevcustomimporter.h b/languages/cpp/pcsimporter/customimporter/kdevcustomimporter.h new file mode 100644 index 00000000..5a522785 --- /dev/null +++ b/languages/cpp/pcsimporter/customimporter/kdevcustomimporter.h @@ -0,0 +1,40 @@ +/*************************************************************************** +* Copyright (C) 2003 by Alexander Dymo * +* cloudtemple@mksat.net * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +***************************************************************************/ +#ifndef KDEVCUSTOMIMPORTER_H +#define KDEVCUSTOMIMPORTER_H + +#include "kdevpcsimporter.h" + +#include <qguardedptr.h> + +class SettingsDialog; + +class KDevCustomImporter : public KDevPCSImporter +{ +Q_OBJECT +public: + KDevCustomImporter(QObject* parent = 0, const char* name = 0, const QStringList &args = QStringList()); + + ~KDevCustomImporter(); + + virtual QString dbName() const; + virtual QStringList fileList(); + virtual QStringList includePaths(); + virtual QWidget* createSettingsPage(QWidget* parent, const char* name); + +protected: + QStringList fileList( const QString& path ); + void processDir(const QString path, QStringList &files ); + +private: + QGuardedPtr<SettingsDialog> m_settings; +}; + +#endif diff --git a/languages/cpp/pcsimporter/customimporter/kdevpcscustomimporter.desktop b/languages/cpp/pcsimporter/customimporter/kdevpcscustomimporter.desktop new file mode 100644 index 00000000..2e331977 --- /dev/null +++ b/languages/cpp/pcsimporter/customimporter/kdevpcscustomimporter.desktop @@ -0,0 +1,44 @@ +[Desktop Entry] +Type=Service +Name=KDevPCSCustomImporter +Name[da]=KDevelop brugerdefineret PCS-importør +Name[nds]=EgenPCS-Import för KDevelop +Name[pl]=KDevWłasnyImportPCS +Name[sk]=KDev PCS vlastný import +Name[sv]=KDevelop egen import av PCS +Name[zh_TW]=KDevelop PCS 自訂匯入器 +Comment=KDevelop Custom Directory PCS Importer +Comment[ca]=Importador PCS de directori personalitzat per a KDevelop +Comment[da]=KDevelop brugerdefineret mappe-PCS-importør +Comment[de]=Import für persistenten Klassenspeicher aus benutzerdefinierten Ordnern +Comment[el]=Εισαγωγέας PCS προσαρμοσμένου καταλόγου του KDevelop +Comment[es]=Importador PCS de carpeta personalizada de KDevelop +Comment[et]=KDevelopi kohandatud kataloogi PCS importija +Comment[eu]=KDevelop-en direktorio pertsonalizatuko PCS inportatzailea +Comment[fa]=واردکنندۀ PCS فهرست سفارشی KDevelop +Comment[fr]=Importation PCS de dossiers personnalisés pour KDevelop +Comment[gl]=Importador PCS de directorios personalizados para KDevelop +Comment[hi]=के-डेवलप मनपसंद डिरेक्ट्री पीसीएस आयातक +Comment[hu]=KDevelop egyéni könyvtár PCS-importáló +Comment[it]=Cartella per l'importatore personalizzato PCS di KDevelop +Comment[ja]=KDevelop カスタムディレクトリ PCS インポータ +Comment[nds]=Import för duerhaftig Klassenspieker ut Bruker-Ornern +Comment[ne]=केडीई विकास अनुकूल डाइरेक्टरी PCS आयातकर्ता +Comment[nl]=KDevelop PCS Importer voor eigen mappen +Comment[pl]=Własny program do importowania PCS dla KDevelopa +Comment[pt]=Importador de PCS com Directoria Personalizada do KDevelop +Comment[pt_BR]=Importador de Diretório PCS Personalizado para o KDevelop +Comment[ru]=Загрузка символов из любого каталога в хранилище классов +Comment[sk]=KDevelop vlastný PCS import priečinkov +Comment[sr]=KDevelop-ов PCS увозник прилагођеног директоријума +Comment[sr@Latn]=KDevelop-ov PCS uvoznik prilagođenog direktorijuma +Comment[sv]=KDevelop PCS-import för egen katalog +Comment[ta]=கெடெவலப் கஸ்டம் டைரக்ட்ரி இறக்குமதியாளர் +Comment[tg]=Пурборкунии нишонаҳо аз анбори синфҳои каталог +Comment[tr]=KDevelop Özel Dizin PCS Aktarıcısı +Comment[zh_CN]=KDevelop 自定义目录的 PCS 导入器 +Comment[zh_TW]=KDevelop 自訂目錄 PCS 匯入器 +Icon=gear +ServiceTypes=KDevelop/PCSImporter +X-KDE-Library=libkdevcustompcsimporter +X-KDevelop-PCSImporter= diff --git a/languages/cpp/pcsimporter/customimporter/settingsdialog.cpp b/languages/cpp/pcsimporter/customimporter/settingsdialog.cpp new file mode 100644 index 00000000..f6df0902 --- /dev/null +++ b/languages/cpp/pcsimporter/customimporter/settingsdialog.cpp @@ -0,0 +1,107 @@ +/*************************************************************************** +* 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 <qdir.h> + +#include <klistbox.h> +#include <kcombobox.h> +#include <kurlrequester.h> +#include <kdeversion.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <klineedit.h> + +#include <keditlistbox.h> + +// should be included after possible KEditListBox redefinition +#include "settingsdialog.h" + +#include <qfile.h> +#include <qregexp.h> +#include <qlayout.h> +#include <qcheckbox.h> + +#include <cstdlib> + +SettingsDialog::SettingsDialog( QWidget* parent, const char* name, WFlags fl ) + : SettingsDialogBase( parent, name, fl ) +{ + KURLRequester * req = new KURLRequester( this ); + req->setMode( KFile::Directory ); + KEditListBox::CustomEditor pCustomEditor; + pCustomEditor = req->customEditor(); + elb = new KEditListBox( i18n( "Directories to Parse" ), pCustomEditor, this ); + + grid->addMultiCellWidget( elb, 3, 3, 0, grid->numCols() ); + + // connect( dbName_edit, SIGNAL( textChanged( const QString& ) ), this, SLOT( validate() ) ); + connect( elb->addButton(), SIGNAL( clicked() ), this, SLOT( validate() ) ); + connect( elb->removeButton(), SIGNAL( clicked() ), this, SLOT( validate() ) ); + connect( elb, SIGNAL( added( const QString& ) ), this, SLOT( validateDirectory( const QString& ) ) ); +} + +SettingsDialog::~SettingsDialog() +{} + +QString SettingsDialog::dbName( ) const +{ + return QString(); +// return dbName_edit->text(); +} + +QStringList SettingsDialog::dirs( ) const +{ + return elb->items(); +} + +QString SettingsDialog::filePattern( ) const +{ + return pattern_edit->text(); +} + +bool SettingsDialog::recursive( ) const +{ + return recursive_box->isChecked(); +} + +void SettingsDialog::validate() +{ +// emit enabled( !dbName_edit->text().isEmpty() && elb->listBox() ->count() > 0 ); + emit enabled( elb->listBox()->count() > 0 ); +} + +void SettingsDialog::validateDirectory( const QString & dir ) +{ + QDir d( dir, QString::null, QDir::DefaultSort, QDir::Dirs ); + if ( !d.exists() ) + { + elb->lineEdit() ->setText( dir ); + + if ( QListBoxItem * item = elb->listBox() ->findItem( dir, Qt::ExactMatch ) ) + { + elb->listBox() ->removeItem( elb->listBox() ->index( item ) ); + } + + QString errormsg = QString( "<qt><b>%1</b> is not a directory</qt>" ).arg( dir ); + KMessageBox::error( 0, errormsg, "Couldn't find directory" ); + } + emit enabled( elb->listBox()->count() > 0 ); +} + +#include "settingsdialog.moc" +//kate: indent-mode csands; tab-width 4; space-indent off; + + + + diff --git a/languages/cpp/pcsimporter/customimporter/settingsdialog.h b/languages/cpp/pcsimporter/customimporter/settingsdialog.h new file mode 100644 index 00000000..309df8ab --- /dev/null +++ b/languages/cpp/pcsimporter/customimporter/settingsdialog.h @@ -0,0 +1,48 @@ +/*************************************************************************** + * 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 KEditListBox; + +class SettingsDialog : public SettingsDialogBase +{ + Q_OBJECT + +public: + SettingsDialog(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~SettingsDialog(); + + bool isValidQtDir( const QString& path ) const; + + QString qtDir() const; + QString configuration() const; + + QString dbName() const; + QStringList dirs() const; + bool recursive() const; + QString filePattern() const; + +private slots: + void validate(); + void validateDirectory( const QString & dir ); + +private: + KEditListBox *elb; + +}; + +#endif + + diff --git a/languages/cpp/pcsimporter/customimporter/settingsdialogbase.ui b/languages/cpp/pcsimporter/customimporter/settingsdialogbase.ui new file mode 100644 index 00000000..b9faadb1 --- /dev/null +++ b/languages/cpp/pcsimporter/customimporter/settingsdialogbase.ui @@ -0,0 +1,62 @@ +<!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>510</width> + <height>501</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>grid</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KLineEdit" row="1" column="0"> + <property name="name"> + <cstring>pattern_edit</cstring> + </property> + <property name="text"> + <string>*.h;*.H;*.hh;*.hxx;*.hpp;*.tlh</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string>Filename pattern:</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="0"> + <property name="name"> + <cstring>recursive_box</cstring> + </property> + <property name="text"> + <string>&Recursive</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </grid> + </widget> + </vbox> +</widget> +<signals> + <signal>enabled(int)</signal> +</signals> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/languages/cpp/pcsimporter/kdelibsimporter/Makefile.am b/languages/cpp/pcsimporter/kdelibsimporter/Makefile.am new file mode 100644 index 00000000..96c3474f --- /dev/null +++ b/languages/cpp/pcsimporter/kdelibsimporter/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 = libkdevkdelibsimporter.la + +noinst_HEADERS = kdevkdelibsimporter.h settingsdialog.h +libkdevkdelibsimporter_la_SOURCES = kdevkdelibsimporter.cpp settingsdialogbase.ui settingsdialog.cpp +kde_services_DATA = kdevkdelibsimporter.desktop +libkdevkdelibsimporter_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \ + $(top_builddir)/languages/lib/interfaces/liblang_interfaces.la +libkdevkdelibsimporter_la_LDFLAGS = -module $(all_libraries) $(KDE_PLUGIN) diff --git a/languages/cpp/pcsimporter/kdelibsimporter/kdevkdelibsimporter.cpp b/languages/cpp/pcsimporter/kdelibsimporter/kdevkdelibsimporter.cpp new file mode 100644 index 00000000..341256b7 --- /dev/null +++ b/languages/cpp/pcsimporter/kdelibsimporter/kdevkdelibsimporter.cpp @@ -0,0 +1,119 @@ +/*************************************************************************** +* 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 "kdevkdelibsimporter.h" +#include "kdevkdelibsimporter.moc" +#include "settingsdialog.h" + +#include <kdebug.h> +#include <kgenericfactory.h> + +#include <qvaluestack.h> +#include <qlabel.h> +#include <qdir.h> +#include <qcombobox.h> + +K_EXPORT_COMPONENT_FACTORY( libkdevkdelibsimporter, KGenericFactory<KDevKDELibsImporter>( "kdevkdelibsimporter" ) ) + +KDevKDELibsImporter::KDevKDELibsImporter( QObject * parent, const char * name, const QStringList& ) + : KDevPCSImporter( parent, name ) +{} + +KDevKDELibsImporter::~KDevKDELibsImporter() +{} + +QStringList KDevKDELibsImporter::fileList( const QString& path ) +{ + QDir dir( path ); + QStringList lst = dir.entryList( "*.h" ); + QStringList fileList; + for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) + { + fileList.push_back( dir.absPath() + "/" + ( *it ) ); + } + return fileList; +} + + +QStringList KDevKDELibsImporter::fileList() +{ + if ( !m_settings ) + return QStringList(); + + QStringList files; + int scope = m_settings->cbParsingScope->currentItem(); + if ( scope == 0 ) + { + files += fileList( m_settings->kdeDir() ); + files += fileList( m_settings->kdeDir() + "/arts" ); + files += fileList( m_settings->kdeDir() + "/artsc" ); + files += fileList( m_settings->kdeDir() + "/dcopc" ); + files += fileList( m_settings->kdeDir() + "/dom" ); + files += fileList( m_settings->kdeDir() + "/kabc" ); + files += fileList( m_settings->kdeDir() + "/kdeprint" ); + files += fileList( m_settings->kdeDir() + "/kdesu" ); + files += fileList( m_settings->kdeDir() + "/kio" ); + files += fileList( m_settings->kdeDir() + "/kjs" ); + files += fileList( m_settings->kdeDir() + "/kparts" ); + files += fileList( m_settings->kdeDir() + "/ktexteditor" ); + } + else if ( scope == 1 ) + { + QValueStack<QString> s; + s.push( m_settings->kdeDir() ); + files += fileList( m_settings->kdeDir() ); + + QDir dir; + do + { + dir.setPath( s.pop() ); + kdDebug( 9015 ) << "Examining: " << dir.path() << endl; + const QFileInfoList *dirEntries = dir.entryInfoList(); + if ( !dirEntries ) continue; + 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( 9015 ) << "Pushing: " << path << endl; + s.push( path ); + files += fileList( path ); + } + } + } + while ( !s.isEmpty() ); + } + + return files; +} + +QStringList KDevKDELibsImporter::includePaths() +{ + if ( !m_settings ) + return QStringList(); + + QStringList includePaths; + includePaths.push_back( m_settings->kdeDir() ); + return includePaths; +} + +QWidget * KDevKDELibsImporter::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/kdelibsimporter/kdevkdelibsimporter.desktop b/languages/cpp/pcsimporter/kdelibsimporter/kdevkdelibsimporter.desktop new file mode 100644 index 00000000..51163d14 --- /dev/null +++ b/languages/cpp/pcsimporter/kdelibsimporter/kdevkdelibsimporter.desktop @@ -0,0 +1,49 @@ +[Desktop Entry] +Type=Service +Name=KDevKDELibsImporter +Name[da]=KDevelop KDELibs-importør +Name[de]=KDELibs-PCS-Import (KDevelop) +Name[hi]=के-डेव-केडीई-लिब्स-इम्पोर्टर +Name[ja]=KDev KDE +Name[nds]=KDELibs-PCS-Import (KDevelop) +Name[pl]=KDevKDEImportBib +Name[sk]=KDev KDE import knižníc +Name[sv]=KDevelop KDE-biblioteksimport +Name[ta]=கெடெவ் கெடெலிப்ஸ் இறக்குமதியாளர் +Name[zh_TW]=KDevelop KDE 函式庫匯入器 +Comment=KDevelop KDELibs PCS Importer +Comment[ca]=Importador PCS de KDELibs per a KDevelop +Comment[da]=KDevelop KDELibs PCS importør +Comment[de]=KDELibs-Import für persistenten Klassenspeicher +Comment[el]=Εισαγωγέας PCS KDevelop KDELibs +Comment[es]=Importador PCS de KDELibs de KDevelop +Comment[et]=KDevelopi kdelibs PCS importija +Comment[eu]=KDevelop-en KDELibs PCS inportatzailea +Comment[fa]=واردکنندۀ KDevelop KDELibs PCS +Comment[fr]=Importation PCS de KDELibs pour KDevelop +Comment[gl]=Importador PCS de KDELibs para KDevelop +Comment[hi]=के-डेवलप केडीई-लिब्स पीसीएस आयातक +Comment[hu]=KDevelop KDELibs PCS-importáló +Comment[it]=Importatore per KDELibs PCS di KDevelop +Comment[ja]=KDevelop KDELibs PCS インポータ +Comment[nds]=KDELibs-Import för duerhaftig Klassenspieker +Comment[ne]=KDevelop KDELibs PCS आयातकर्ता +Comment[nl]=KDevelop PCS Importer voor KDELibs +Comment[pl]=KDevelop: importowanie PCS (KDELibs) +Comment[pt]=Importador de PCS das KDELibs do KDevelop +Comment[pt_BR]=Importador PCS do KDELibs para o KDevelop +Comment[ru]=Загрузка символов из библиотеки KDELibs в хранилище классов +Comment[sk]=KDevelop PCS import KDE knižníc +Comment[sr]=KDevelop-ов KDELibs PCS увозник +Comment[sr@Latn]=KDevelop-ov KDELibs PCS uvoznik +Comment[sv]=KDevelop KDE-bibliotek PCS-import +Comment[ta]=கெடெவலப் கெடெலிப்ஸ் பிசிஸ் இறக்குமதியாளர் +Comment[tg]=Пурборкунии нишонаҳо аз китобхонаи KDELibs дар синфҳои анборӣ +Comment[tr]=KDevelop KDELibs PCS Aktarıcısı +Comment[zh_CN]=KDevelop KDELibs PCS 导入器 +Comment[zh_TW]=KDevelop KDE 函式庫匯入器 +Icon=gear +ServiceTypes=KDevelop/PCSImporter +X-KDE-Library=libkdevkdelibsimporter +X-KDevelop-PCSImporter= +X-KDevelop-Version=5 diff --git a/languages/cpp/pcsimporter/kdelibsimporter/kdevkdelibsimporter.h b/languages/cpp/pcsimporter/kdelibsimporter/kdevkdelibsimporter.h new file mode 100644 index 00000000..9514f287 --- /dev/null +++ b/languages/cpp/pcsimporter/kdelibsimporter/kdevkdelibsimporter.h @@ -0,0 +1,40 @@ +/*************************************************************************** + * 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 KDevKDELibsImporter : public KDevPCSImporter +{ + Q_OBJECT +public: + KDevKDELibsImporter( QObject* parent=0, const char* name=0, const QStringList& args=QStringList() ); + virtual ~KDevKDELibsImporter(); + + virtual QString dbName() const { return QString::fromLatin1("KDElibs"); } + virtual QStringList fileList(); + virtual QStringList includePaths(); + + virtual QWidget* createSettingsPage( QWidget* parent, const char* name=0 ); + +private: + QStringList fileList( const QString& path ); + +private: + QGuardedPtr<SettingsDialog> m_settings; +}; + +#endif diff --git a/languages/cpp/pcsimporter/kdelibsimporter/settingsdialog.cpp b/languages/cpp/pcsimporter/kdelibsimporter/settingsdialog.cpp new file mode 100644 index 00000000..29ef96e9 --- /dev/null +++ b/languages/cpp/pcsimporter/kdelibsimporter/settingsdialog.cpp @@ -0,0 +1,101 @@ +/*************************************************************************** +* 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 <kapplication.h> +#include <kstandarddirs.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 ) +{ + KApplication::kApplication()->dirs()->addResourceType("include","include"); + QStringList kdedirs=KApplication::kApplication()->dirs()->findDirs("include",""); + for( QStringList::Iterator it=kdedirs.begin(); it!=kdedirs.end(); ++it ) + { + QString kdedir = *it; + if ( !kdedir.isEmpty() && isValidKDELibsDir( kdedir ) ) + if ( !kdeListBox->findItem( kdedir, ExactMatch ) ) + kdeListBox->insertItem( kdedir ); + } + + kdeUrl->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly ); + + connect( addUrlButton, SIGNAL(clicked()), this, SLOT(addUrlButton_clicked()) ); +} + +SettingsDialog::~SettingsDialog() +{} + +void SettingsDialog::slotSelectionChanged( QListBoxItem* ) +{ + emit enabled( kdeListBox->selectedItem() != 0 ); +} + +bool SettingsDialog::isValidKDELibsDir( const QString & path ) const +{ + return QFile::exists( path + "/kapplication.h" ); +} + +QString SettingsDialog::kdeDir( ) const +{ + return kdeListBox->currentText(); +} + +void SettingsDialog::addUrlButton_clicked() +{ + kdDebug(9000) << k_funcinfo << endl; + + if ( isValidKDELibsDir( kdeUrl->url() ) ) + { + kdeListBox->insertItem( kdeUrl->url() ); + if ( QListBoxItem * item = kdeListBox->findItem( kdeUrl->url(), ExactMatch ) ) + { + kdeListBox->setSelected( item, true ); + } + kdeUrl->lineEdit()->clear(); + } + else + { + KMessageBox::error( this, i18n("This does not appear to be a valid KDE 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/kdelibsimporter/settingsdialog.h b/languages/cpp/pcsimporter/kdelibsimporter/settingsdialog.h new file mode 100644 index 00000000..ba15019b --- /dev/null +++ b/languages/cpp/pcsimporter/kdelibsimporter/settingsdialog.h @@ -0,0 +1,44 @@ +/*************************************************************************** + * 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 isValidKDELibsDir( const QString& path ) const; + + QString kdeDir() 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/kdelibsimporter/settingsdialogbase.ui b/languages/cpp/pcsimporter/kdelibsimporter/settingsdialogbase.ui new file mode 100644 index 00000000..00b8c3ac --- /dev/null +++ b/languages/cpp/pcsimporter/kdelibsimporter/settingsdialogbase.ui @@ -0,0 +1,131 @@ +<!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>403</width> + <height>266</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0" rowspan="1" colspan="4"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string>KDE include directories: +Only the selected entry will be used</string> + </property> + </widget> + <widget class="QComboBox" row="3" column="1"> + <item> + <property name="text"> + <string>KDE Libs Headers</string> + </property> + </item> + <item> + <property name="text"> + <string>All KDE Headers</string> + </property> + </item> + <property name="name"> + <cstring>cbParsingScope</cstring> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + <property name="whatsThis" stdset="0"> + <string>Decide if you want to restrict the Code Completion database to only the base kdelibs API or the entire KDE include structure</string> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>Scope:</string> + </property> + </widget> + <widget class="KURLRequester" row="2" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>kdeUrl</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <string>If none of the directories KDevelop found is what you want,you can enter a directory of your choice here</string> + </property> + </widget> + <widget class="QPushButton" row="2" column="3"> + <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>&Add</string> + </property> + </widget> + <widget class="KListBox" row="1" column="0" rowspan="1" colspan="4"> + <property name="name"> + <cstring>kdeListBox</cstring> + </property> + </widget> + <spacer row="3" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>220</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> +</widget> +<customwidgets> +</customwidgets> +<connections> + <connection> + <sender>kdeListBox</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>kurlrequester.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>klistbox.h</includehint> +</includehints> +</UI> diff --git a/languages/cpp/pcsimporter/qt4importer/Makefile.am b/languages/cpp/pcsimporter/qt4importer/Makefile.am new file mode 100644 index 00000000..b0b4a622 --- /dev/null +++ b/languages/cpp/pcsimporter/qt4importer/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 = libkdevqt4importer.la + +noinst_HEADERS = kdevqt4importer.h settingsdialog.h +libkdevqt4importer_la_SOURCES = kdevqt4importer.cpp settingsdialogbase.ui settingsdialog.cpp +kde_services_DATA = kdevqt4importer.desktop +libkdevqt4importer_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \ + $(top_builddir)/languages/lib/interfaces/liblang_interfaces.la +libkdevqt4importer_la_LDFLAGS = -module $(all_libraries) $(KDE_PLUGIN) diff --git a/languages/cpp/pcsimporter/qt4importer/kdevqt4importer.cpp b/languages/cpp/pcsimporter/qt4importer/kdevqt4importer.cpp new file mode 100644 index 00000000..f4fedea0 --- /dev/null +++ b/languages/cpp/pcsimporter/qt4importer/kdevqt4importer.cpp @@ -0,0 +1,107 @@ +/*************************************************************************** + * 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 "kdevqt4importer.h" +#include "kdevqt4importer.moc" +#include "settingsdialog.h" + +#include <kgenericfactory.h> +#include <ktempfile.h> +#include <kprocess.h> +#include <kdebug.h> + +#include <qtextstream.h> +#include <qlabel.h> +#include <qdir.h> + +K_EXPORT_COMPONENT_FACTORY( libkdevqt4importer, KGenericFactory<KDevQt4Importer>( "kdevqt4importer" ) ) + +KDevQt4Importer::KDevQt4Importer( QObject * parent, const char * name, const QStringList& ) + : KDevPCSImporter( parent, name ) +{ + m_qtfile = 0; +} + +KDevQt4Importer::~KDevQt4Importer() +{ + if (m_qtfile) + delete m_qtfile; + + m_qtfile = 0; +} + +QStringList KDevQt4Importer::fileList() +{ + if( !m_settings ) + return QStringList(); + + if (m_qtfile) + delete m_qtfile; + + KTempFile ifile; + QTextStream &is = *ifile.textStream(); + + is << "#include <QtCore/qobjectdefs.h>\n" + << "#undef Q_SLOTS\n#undef Q_SIGNALS\n#undef slots\n#undef signals" + << "#define Q_SLOTS slots\n" + << "#define Q_SIGNALS signals\n" + << "#include <QtCore/QtCore>\n" + << "#include <QtGui/QtGui>\n" + << "#include <QtNetwork/QtNetwork>\n" + << "#include <QtXml/QtXml>\n" + << "#include <Qt3Support/Qt3Support>\n" + << "#include <QtSql/QtSql>\n" + << "#include <QtTest/QtTest>\n" + << "#include <QtOpenGL/QtOpenGL>\n"; + + + + KProcess proc; + proc << "cpp" << "-nostdinc" << "-xc++"; + + m_qtfile = new KTempFile(); + + // include paths + QStringList paths = includePaths(); + for (QStringList::Iterator it = paths.begin(); it != paths.end(); ++it) + proc << "-I" << *it; + + ifile.close(); + + QString o; + o += "-o"; + o += m_qtfile->name(); + + proc << ifile.name() << o; + proc.start(KProcess::Block); + + return m_qtfile->name(); +} + +QStringList KDevQt4Importer::includePaths() +{ + if( !m_settings || !m_qtfile) + return QStringList(); + + QStringList includePaths; + includePaths.push_back( m_settings->qtDir() ); + includePaths.push_back( m_settings->qtDir() + "/Qt" ); + + /// @todo add mkspec + return includePaths; +} + +QWidget * KDevQt4Importer::createSettingsPage( QWidget * parent, const char * name ) +{ + m_settings = new SettingsDialog( parent, name ); + return m_settings; +} + diff --git a/languages/cpp/pcsimporter/qt4importer/kdevqt4importer.desktop b/languages/cpp/pcsimporter/qt4importer/kdevqt4importer.desktop new file mode 100644 index 00000000..d1003610 --- /dev/null +++ b/languages/cpp/pcsimporter/qt4importer/kdevqt4importer.desktop @@ -0,0 +1,34 @@ +[Desktop Entry] +Type=Service +Name=KDevQt4Importer +Name[de]=Qt4-PCS-Import (KDevelop) +Name[fr]=KDevQtImporter +Name[nds]=Qt4-PCS-Import (KDevelop) +Name[ru]=KDevQt 4Importer +Name[sv]=KDevelop QT4-import +Comment=KDevelop Qt4 PCS Importer +Comment[ca]=Importador PCS de Qt4 per a KDevelop +Comment[da]=KDevelop Qt4 PCS importør +Comment[de]=Qt4-Import für persistenten Klassenspeicher +Comment[el]=Εισαγωγέας PCS KDevelop Qt4 +Comment[es]=Importador PCS de Qt4 de KDevelop +Comment[et]=KDevelopi Qt4 PCS importija +Comment[fr]=Importation PCS de Qt4 pour KDevelop +Comment[hu]=KDevelop Qt4 PCS-importáló +Comment[it]=Importatore PCS di Qt4 di KDevelop +Comment[ja]=KDevelop Qt4 PCS インポータ +Comment[nds]=Qt4-Import för duerhaftig Klassenspieker +Comment[pl]=KDevelop: importowanie PCS Qt4 +Comment[pt]=Importador de PCS para Qt4 do KDevelop +Comment[pt_BR]=Importador de PCS para Qt4 do KDevelop +Comment[ru]=Импорт Qt 4 PCS в KDevelop +Comment[sk]=KDevelop Qt4 PCS import +Comment[sr]=KDevelop-ов Qt4 PCS увозник +Comment[sr@Latn]=KDevelop-ov Qt4 PCS uvoznik +Comment[sv]=KDevelop QT4 PCS-import +Comment[zh_TW]=KDevelop Qt4 PCS 匯入器 +Icon=gear +ServiceTypes=KDevelop/PCSImporter +X-KDE-Library=libkdevqt4importer +X-KDevelop-PCSImporter= +X-KDevelop-Version=5 diff --git a/languages/cpp/pcsimporter/qt4importer/kdevqt4importer.h b/languages/cpp/pcsimporter/qt4importer/kdevqt4importer.h new file mode 100644 index 00000000..821e6fef --- /dev/null +++ b/languages/cpp/pcsimporter/qt4importer/kdevqt4importer.h @@ -0,0 +1,39 @@ +/*************************************************************************** + * 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 KTempFile; + +class KDevQt4Importer : public KDevPCSImporter +{ + Q_OBJECT +public: + KDevQt4Importer( QObject* parent=0, const char* name=0, const QStringList& args=QStringList() ); + virtual ~KDevQt4Importer(); + + virtual QString dbName() const { return QString::fromLatin1("Qt4"); } + virtual QStringList fileList(); + virtual QStringList includePaths(); + + virtual QWidget* createSettingsPage( QWidget* parent, const char* name=0 ); + +private: + QGuardedPtr<SettingsDialog> m_settings; + KTempFile *m_qtfile; +}; + +#endif diff --git a/languages/cpp/pcsimporter/qt4importer/settingsdialog.cpp b/languages/cpp/pcsimporter/qt4importer/settingsdialog.cpp new file mode 100644 index 00000000..cc59c6e9 --- /dev/null +++ b/languages/cpp/pcsimporter/qt4importer/settingsdialog.cpp @@ -0,0 +1,115 @@ +/*************************************************************************** + * 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( QString::fromLocal8Bit(::getenv("HOME")) + "/dev/qt/include" ); + qtdirs.push_back( QString::fromLocal8Bit(::getenv("HOME")) + "/dev/qt-main/include" ); + qtdirs.push_back( "/usr/qt/4/include" ); + + 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* item) +{ + if( !qtListBox->selectedItem() ) + { + emit enabled( false ); + return; + } + + + emit enabled( true ); +} + +bool SettingsDialog::isValidQtDir( const QString & path ) const +{ + return QFile::exists( path + "/QtCore/QtCore" ); +} + +QString SettingsDialog::qtDir( ) const +{ + return qtListBox->currentText(); +} + +QString SettingsDialog::configuration( ) const +{ + return ""; +} + +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 Qt4 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/qt4importer/settingsdialog.h b/languages/cpp/pcsimporter/qt4importer/settingsdialog.h new file mode 100644 index 00000000..1ec5663e --- /dev/null +++ b/languages/cpp/pcsimporter/qt4importer/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/qt4importer/settingsdialogbase.ui b/languages/cpp/pcsimporter/qt4importer/settingsdialogbase.ui new file mode 100644 index 00000000..f655e4f9 --- /dev/null +++ b/languages/cpp/pcsimporter/qt4importer/settingsdialogbase.ui @@ -0,0 +1,79 @@ +<!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>346</width> + <height>275</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string>Qt4 include directories: +Only the selected entry will be used</string> + </property> + </widget> + <widget class="QPushButton" row="2" column="1"> + <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>&Add</string> + </property> + </widget> + <widget class="KURLRequester" row="2" column="0"> + <property name="name"> + <cstring>qtUrl</cstring> + </property> + </widget> + <widget class="KListBox" row="1" column="0" rowspan="1" colspan="2"> + <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>kurlrequester.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>klistbox.h</includehint> +</includehints> +</UI> 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>&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> |