diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-16 16:06:07 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-16 16:06:07 -0600 |
commit | 5fbf99bcc4d03f3001f42905d1217758c4aeac13 (patch) | |
tree | b61aa3fd6d7b0e8302a8b11a18ef2cab5f404951 /languages/cpp/pcsimporter/tdelibsimporter | |
parent | 06c48bfff719dedfe6f271fe5a363453e4af6d31 (diff) | |
download | tdevelop-5fbf99bcc4d03f3001f42905d1217758c4aeac13.tar.gz tdevelop-5fbf99bcc4d03f3001f42905d1217758c4aeac13.zip |
Finish rename from prior commit
Diffstat (limited to 'languages/cpp/pcsimporter/tdelibsimporter')
8 files changed, 535 insertions, 0 deletions
diff --git a/languages/cpp/pcsimporter/tdelibsimporter/CMakeLists.txt b/languages/cpp/pcsimporter/tdelibsimporter/CMakeLists.txt new file mode 100644 index 00000000..d48bad5a --- /dev/null +++ b/languages/cpp/pcsimporter/tdelibsimporter/CMakeLists.txt @@ -0,0 +1,38 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/languages/lib/interfaces + ${CMAKE_SOURCE_DIR}/lib/interfaces + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES kdevtdelibsimporter.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### libkdevtdelibsimporter (module) ########### + +tde_add_kpart( libkdevtdelibsimporter AUTOMOC + SOURCES + kdevtdelibsimporter.cpp settingsdialogbase.ui + settingsdialog.cpp + LINK lang_interfaces-shared tdevelop-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/languages/cpp/pcsimporter/tdelibsimporter/Makefile.am b/languages/cpp/pcsimporter/tdelibsimporter/Makefile.am new file mode 100644 index 00000000..14efcabc --- /dev/null +++ b/languages/cpp/pcsimporter/tdelibsimporter/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 = libkdevtdelibsimporter.la + +noinst_HEADERS = kdevtdelibsimporter.h settingsdialog.h +libkdevtdelibsimporter_la_SOURCES = kdevtdelibsimporter.cpp settingsdialogbase.ui settingsdialog.cpp +kde_services_DATA = kdevtdelibsimporter.desktop +libkdevtdelibsimporter_la_LIBADD = $(top_builddir)/lib/libtdevelop.la \ + $(top_builddir)/languages/lib/interfaces/liblang_interfaces.la +libkdevtdelibsimporter_la_LDFLAGS = -module $(all_libraries) $(KDE_PLUGIN) diff --git a/languages/cpp/pcsimporter/tdelibsimporter/kdevtdelibsimporter.cpp b/languages/cpp/pcsimporter/tdelibsimporter/kdevtdelibsimporter.cpp new file mode 100644 index 00000000..c3e7ca0c --- /dev/null +++ b/languages/cpp/pcsimporter/tdelibsimporter/kdevtdelibsimporter.cpp @@ -0,0 +1,119 @@ +/*************************************************************************** +* Copyright (C) 2003 by Roberto Raggi * +* roberto@tdevelop.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 "kdevtdelibsimporter.h" +#include "kdevtdelibsimporter.moc" +#include "settingsdialog.h" + +#include <kdebug.h> +#include <kgenericfactory.h> + +#include <tqvaluestack.h> +#include <tqlabel.h> +#include <tqdir.h> +#include <tqcombobox.h> + +K_EXPORT_COMPONENT_FACTORY( libkdevtdelibsimporter, KGenericFactory<KDevKDELibsImporter>( "kdevtdelibsimporter" ) ) + +KDevKDELibsImporter::KDevKDELibsImporter( TQObject * parent, const char * name, const TQStringList& ) + : KDevPCSImporter( parent, name ) +{} + +KDevKDELibsImporter::~KDevKDELibsImporter() +{} + +TQStringList KDevKDELibsImporter::fileList( const TQString& path ) +{ + TQDir dir( path ); + TQStringList lst = dir.entryList( "*.h" ); + TQStringList fileList; + for ( TQStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) + { + fileList.push_back( dir.absPath() + "/" + ( *it ) ); + } + return fileList; +} + + +TQStringList KDevKDELibsImporter::fileList() +{ + if ( !m_settings ) + return TQStringList(); + + TQStringList 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() + "/tdeprint" ); + files += fileList( m_settings->kdeDir() + "/tdesu" ); + 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 ) + { + TQValueStack<TQString> s; + s.push( m_settings->kdeDir() ); + files += fileList( m_settings->kdeDir() ); + + TQDir dir; + do + { + dir.setPath( s.pop() ); + kdDebug( 9015 ) << "Examining: " << dir.path() << endl; + const TQFileInfoList *dirEntries = dir.entryInfoList(); + if ( !dirEntries ) continue; + TQPtrListIterator<TQFileInfo> it( *dirEntries ); + for ( ; it.current(); ++it ) + { + TQString fileName = it.current() ->fileName(); + if ( fileName == "." || fileName == ".." ) + continue; + TQString path = it.current() ->absFilePath(); + if ( it.current() ->isDir() ) + { + kdDebug( 9015 ) << "Pushing: " << path << endl; + s.push( path ); + files += fileList( path ); + } + } + } + while ( !s.isEmpty() ); + } + + return files; +} + +TQStringList KDevKDELibsImporter::includePaths() +{ + if ( !m_settings ) + return TQStringList(); + + TQStringList includePaths; + includePaths.push_back( m_settings->kdeDir() ); + return includePaths; +} + +TQWidget * KDevKDELibsImporter::createSettingsPage( TQWidget * 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/tdelibsimporter/kdevtdelibsimporter.desktop b/languages/cpp/pcsimporter/tdelibsimporter/kdevtdelibsimporter.desktop new file mode 100644 index 00000000..7836c861 --- /dev/null +++ b/languages/cpp/pcsimporter/tdelibsimporter/kdevtdelibsimporter.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 tdelibs 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=libkdevtdelibsimporter +X-KDevelop-PCSImporter= +X-KDevelop-Version=5 diff --git a/languages/cpp/pcsimporter/tdelibsimporter/kdevtdelibsimporter.h b/languages/cpp/pcsimporter/tdelibsimporter/kdevtdelibsimporter.h new file mode 100644 index 00000000..06782a37 --- /dev/null +++ b/languages/cpp/pcsimporter/tdelibsimporter/kdevtdelibsimporter.h @@ -0,0 +1,41 @@ +/*************************************************************************** + * Copyright (C) 2003 by Roberto Raggi * + * roberto@tdevelop.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 KDEVTQTIMPORTER_H +#define KDEVTQTIMPORTER_H + +#include <kdevpcsimporter.h> +#include <tqguardedptr.h> + +class SettingsDialog; + +class KDevKDELibsImporter : public KDevPCSImporter +{ + Q_OBJECT + TQ_OBJECT +public: + KDevKDELibsImporter( TQObject* parent=0, const char* name=0, const TQStringList& args=TQStringList() ); + virtual ~KDevKDELibsImporter(); + + virtual TQString dbName() const { return TQString::tqfromLatin1("KDElibs"); } + virtual TQStringList fileList(); + virtual TQStringList includePaths(); + + virtual TQWidget* createSettingsPage( TQWidget* parent, const char* name=0 ); + +private: + TQStringList fileList( const TQString& path ); + +private: + TQGuardedPtr<SettingsDialog> m_settings; +}; + +#endif diff --git a/languages/cpp/pcsimporter/tdelibsimporter/settingsdialog.cpp b/languages/cpp/pcsimporter/tdelibsimporter/settingsdialog.cpp new file mode 100644 index 00000000..a6d95acf --- /dev/null +++ b/languages/cpp/pcsimporter/tdelibsimporter/settingsdialog.cpp @@ -0,0 +1,101 @@ +/*************************************************************************** +* Copyright (C) 2003 by Roberto Raggi * +* roberto@tdevelop.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 <tqfile.h> +#include <tqdir.h> +#include <tqregexp.h> +#include <cstdlib> + +#include "settingsdialog.h" + +TQListBoxItem* TQListBox_selectedItem( TQListBox* cpTQListBox ) +{ + if ( cpTQListBox->selectionMode() != TQListBox::Single ) + return 0; + if ( cpTQListBox->isSelected( cpTQListBox->currentItem() ) ) + return cpTQListBox->item( cpTQListBox->currentItem() ); + return 0; +} + +SettingsDialog::SettingsDialog( TQWidget* parent, const char* name, WFlags fl ) +: SettingsDialogBase( parent, name, fl ) +{ + KApplication::kApplication()->dirs()->addResourceType("include","include"); + TQStringList kdedirs=KApplication::kApplication()->dirs()->findDirs("include",""); + for( TQStringList::Iterator it=kdedirs.begin(); it!=kdedirs.end(); ++it ) + { + TQString 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, TQT_SIGNAL(clicked()), this, TQT_SLOT(addUrlButton_clicked()) ); +} + +SettingsDialog::~SettingsDialog() +{} + +void SettingsDialog::slotSelectionChanged( TQListBoxItem* ) +{ + emit enabled( kdeListBox->selectedItem() != 0 ); +} + +bool SettingsDialog::isValidKDELibsDir( const TQString & path ) const +{ + return TQFile::exists( path + "/kapplication.h" ); +} + +TQString SettingsDialog::kdeDir( ) const +{ + return kdeListBox->currentText(); +} + +void SettingsDialog::addUrlButton_clicked() +{ + kdDebug(9000) << k_funcinfo << endl; + + if ( isValidKDELibsDir( kdeUrl->url() ) ) + { + kdeListBox->insertItem( kdeUrl->url() ); + if ( TQListBoxItem * 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/tdelibsimporter/settingsdialog.h b/languages/cpp/pcsimporter/tdelibsimporter/settingsdialog.h new file mode 100644 index 00000000..26668187 --- /dev/null +++ b/languages/cpp/pcsimporter/tdelibsimporter/settingsdialog.h @@ -0,0 +1,45 @@ +/*************************************************************************** + * Copyright (C) 2003 by Roberto Raggi * + * roberto@tdevelop.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 + TQ_OBJECT + +public: + SettingsDialog(TQWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~SettingsDialog(); + /*$PUBLIC_FUNCTIONS$*/ + + bool isValidKDELibsDir( const TQString& path ) const; + + TQString kdeDir() const; + +public slots: + /*$PUBLIC_SLOTS$*/ + virtual void slotSelectionChanged(TQListBoxItem*); + +protected: + /*$PROTECTED_FUNCTIONS$*/ + +protected slots: + /*$PROTECTED_SLOTS$*/ + void addUrlButton_clicked(); +}; + +#endif + + diff --git a/languages/cpp/pcsimporter/tdelibsimporter/settingsdialogbase.ui b/languages/cpp/pcsimporter/tdelibsimporter/settingsdialogbase.ui new file mode 100644 index 00000000..a7ba1365 --- /dev/null +++ b/languages/cpp/pcsimporter/tdelibsimporter/settingsdialogbase.ui @@ -0,0 +1,131 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>SettingsDialogBase</class> +<widget class="TQWidget"> + <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="TQLabel" 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="TQComboBox" 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 tdelibs API or the entire KDE include structure</string> + </property> + </widget> + <widget class="TQLabel" 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="TQPushButton" 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="tqsizeHint"> + <size> + <width>220</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> +</widget> +<customwidgets> +</customwidgets> +<connections> + <connection> + <sender>kdeListBox</sender> + <signal>selectionChanged(TQListBoxItem*)</signal> + <receiver>SettingsDialogBase</receiver> + <slot>slotSelectionChanged(TQListBoxItem*)</slot> + </connection> +</connections> +<Q_SIGNALS> + <signal>enabled(int)</signal> +</Q_SIGNALS> +<Q_SLOTS> + <slot>slotSelectionChanged(TQListBoxItem*)</slot> +</Q_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> |