diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-27 01:05:39 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-27 01:05:39 -0600 |
commit | ff94d46e423398804d2ae63faeb114c2cf604fc4 (patch) | |
tree | 4481ffd491d15ac15081cea46d7cc298ef6351a4 /tdefile-plugins/c++ | |
parent | b9553cef2a3cd9f5b89c8aca6f4b7781a079dbb7 (diff) | |
download | tdesdk-ff94d46e423398804d2ae63faeb114c2cf604fc4.tar.gz tdesdk-ff94d46e423398804d2ae63faeb114c2cf604fc4.zip |
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'tdefile-plugins/c++')
-rw-r--r-- | tdefile-plugins/c++/CMakeLists.txt | 35 | ||||
-rw-r--r-- | tdefile-plugins/c++/Makefile.am | 22 | ||||
-rw-r--r-- | tdefile-plugins/c++/tdefile_cpp.cpp | 130 | ||||
-rw-r--r-- | tdefile-plugins/c++/tdefile_cpp.desktop | 60 | ||||
-rw-r--r-- | tdefile-plugins/c++/tdefile_cpp.h | 41 | ||||
-rw-r--r-- | tdefile-plugins/c++/tdefile_h.desktop | 58 |
6 files changed, 346 insertions, 0 deletions
diff --git a/tdefile-plugins/c++/CMakeLists.txt b/tdefile-plugins/c++/CMakeLists.txt new file mode 100644 index 00000000..60ce0c29 --- /dev/null +++ b/tdefile-plugins/c++/CMakeLists.txt @@ -0,0 +1,35 @@ +################################################# +# +# (C) 2012 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} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES tdefile_cpp.desktop tdefile_h.desktop + DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### tdefile_cpp (module) ######################## + +tde_add_kpart( tdefile_cpp AUTOMOC + SOURCES tdefile_cpp.cpp + LINK tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/c++/Makefile.am b/tdefile-plugins/c++/Makefile.am new file mode 100644 index 00000000..f74cf59e --- /dev/null +++ b/tdefile-plugins/c++/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for c++ file meta info plugin + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# these are the headers for your project +noinst_HEADERS = tdefile_cpp.h + +kde_module_LTLIBRARIES = tdefile_cpp.la + +tdefile_cpp_la_SOURCES = tdefile_cpp.cpp +tdefile_cpp_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdefile_cpp_la_LIBADD = $(LIB_KIO) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: + $(XGETTEXT) *.cpp -o $(podir)/tdefile_cpp.pot + +services_DATA = tdefile_cpp.desktop tdefile_h.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/c++/tdefile_cpp.cpp b/tdefile-plugins/c++/tdefile_cpp.cpp new file mode 100644 index 00000000..31f777df --- /dev/null +++ b/tdefile-plugins/c++/tdefile_cpp.cpp @@ -0,0 +1,130 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Rolf Magnus <ramagnus@kde.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 version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "tdefile_cpp.h" + +#include <kurl.h> +#include <klocale.h> +#include <kgenericfactory.h> +#include <kdebug.h> + +#include <tqfile.h> +#include <tqregexp.h> + +typedef KGenericFactory<KCppPlugin> CppFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_cpp, CppFactory("tdefile_cpp")) + +KCppPlugin::KCppPlugin(TQObject *parent, const char *name, + const TQStringList &args) + : KFilePlugin(parent, name, args) +{ + kdDebug(7034) << "c++ plugin\n"; + makeMimeTypeInfo("text/x-c++src"); + makeMimeTypeInfo("text/x-chdr"); +} + +void KCppPlugin::makeMimeTypeInfo(const TQString& mimetype) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( mimetype ); + + KFileMimeTypeInfo::GroupInfo* group = + addGroupInfo(info, "General", i18n("General")); + + KFileMimeTypeInfo::ItemInfo* item; + item = addItemInfo(group, "Lines", i18n("Lines"), TQVariant::Int); + setAttributes(item, KFileMimeTypeInfo::Averaged); + item = addItemInfo(group, "Code", i18n("Code"), TQVariant::Int); + setAttributes(item, KFileMimeTypeInfo::Averaged); + item = addItemInfo(group, "Comment", i18n("Comment"), TQVariant::Int); + setAttributes(item, KFileMimeTypeInfo::Averaged); + item = addItemInfo(group, "Blank", i18n("Blank"), TQVariant::Int); + setAttributes(item, KFileMimeTypeInfo::Averaged); + item = addItemInfo(group, "Strings", i18n("Strings"), TQVariant::Int); + setAttributes(item, KFileMimeTypeInfo::Averaged); + item = addItemInfo(group, "i18n Strings", i18n("i18n Strings"), TQVariant::Int); + setAttributes(item, KFileMimeTypeInfo::Averaged); + item = addItemInfo(group, "Included Files", i18n("Included Files"), TQVariant::Int); + setAttributes(item, KFileMimeTypeInfo::Averaged); +} + +bool KCppPlugin::readInfo( KFileMetaInfo& info, uint ) +{ + TQFile f(info.path()); + if (!f.open(IO_ReadOnly)) + return false; + + int codeLines = 0; + int commentLines = 0; + int totalLines = 0; + int emptyLines = 0; + int Strings = 0; + int Stringsi18n = 0; + int Includes = 0; + + bool inComment = false; + + TQString line; + + TQTextStream stream( &f ); + while (!stream.eof()) + { + line = stream.readLine(); + totalLines++; + + if (line.stripWhiteSpace().isEmpty()) + { + emptyLines++; + continue; + } + + if (line.contains("/*")) inComment = true; + + if (!inComment) + { + codeLines++; + if (line.contains(TQRegExp("^\\s*#\\s*include"))) Includes++; + + int pos = line.find("//"); + if (pos>=0) commentLines++; + // truncate the comment - we don't want to count strings in it + line.truncate(pos); + + Strings+=line.contains(TQRegExp("\".*\"")); + Stringsi18n+=line.contains(TQRegExp("(?:i18n|I18N_NOOP)\\s*\\(")); + } + else + commentLines++; + + if (line.contains("*/")) inComment = false; + } + + KFileMetaInfoGroup group = appendGroup(info, "General"); + + appendItem(group, "Lines", int(totalLines)); + appendItem(group, "Code", int(codeLines)); + appendItem(group, "Comment", int(commentLines)); + appendItem(group, "Blank", int(emptyLines)); + appendItem(group, "Strings", int(Strings)); + appendItem(group, "i18n Strings", int(Stringsi18n)); + appendItem(group, "Included Files", int(Includes)); + return true; +} + +#include "tdefile_cpp.moc" diff --git a/tdefile-plugins/c++/tdefile_cpp.desktop b/tdefile-plugins/c++/tdefile_cpp.desktop new file mode 100644 index 00000000..7bbed693 --- /dev/null +++ b/tdefile-plugins/c++/tdefile_cpp.desktop @@ -0,0 +1,60 @@ +[Desktop Entry] +Type=Service +Name=C++ Info +Name[af]=C++ Inligting +Name[bg]=Изходен код на C++ +Name[br]=Titouroù C++ +Name[ca]=Informació C++ +Name[cs]=C++ info +Name[cy]=Gwybodaeth C++ +Name[da]=C++-info +Name[de]=C++-Info +Name[el]=Πληροφορίες C++ +Name[eo]=C++-informo +Name[es]=Info de C++ +Name[et]=C++ info +Name[eu]=C++ informazioa +Name[fa]=اطلاعات C++ +Name[fi]=C++-tiedot +Name[fo]=C++-upplýsingar +Name[fr]=Informations C++ +Name[ga]=Eolas C++ +Name[gl]=Información de C++ +Name[he]=מידע ++C +Name[hi]=C++ जानकारी +Name[hr]=C++ informacije +Name[hu]=C++-jellemzők +Name[is]=C++ upplýsingar +Name[it]=Informazioni C++ +Name[ja]=C++ 情報 +Name[ka]=C++ ინფორმაცია +Name[kk]=C++ мәліметі +Name[lt]=C++ Informacija +Name[ms]=Info C++ +Name[nds]=C++-Datei-Info +Name[nl]=C++-info +Name[nn]=C++-info +Name[pa]=C++ ਜਾਣਕਾਰੀ +Name[pl]=Informacja z C++ +Name[pt]=Informação de C++ +Name[pt_BR]=Informações C++ +Name[ro]=Informaţii C++ +Name[ru]=Информация C++ +Name[sk]=Informácie o C++ +Name[sl]=Informacije o C++ +Name[sr]=C++ информације +Name[sr@Latn]=C++ informacije +Name[sv]=C++-information +Name[ta]= =C/C++ தகவல் +Name[tg]=Ахбороти C++ +Name[th]=ข้อมูล C++ +Name[tr]=C++ Bilgisi +Name[uk]=Інформація про C++ +Name[xh]=C++ Ulwazi +Name[zh_CN]=C++ 信息 +Name[zh_TW]=C++ 資訊 +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_cpp +MimeType=text/x-c++src;text/x-chdr +PreferredGroups=General +PreferredItems=Lines,Code,Comment,Blank,Strings,i18n Strings,Included Files diff --git a/tdefile-plugins/c++/tdefile_cpp.h b/tdefile-plugins/c++/tdefile_cpp.h new file mode 100644 index 00000000..f289b09b --- /dev/null +++ b/tdefile-plugins/c++/tdefile_cpp.h @@ -0,0 +1,41 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Rolf Magnus <ramagnus@kde.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 version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef __KFILE_CPP_H__ +#define __KFILE_CPP_H__ + +#include <tdefilemetainfo.h> +#include <kurl.h> + +class TQStringList; + +class KCppPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KCppPlugin(TQObject *parent, const char *name, const TQStringList& args); + virtual bool readInfo(KFileMetaInfo& info, uint what); + +private: + void makeMimeTypeInfo(const TQString& mimetype); +}; + +#endif diff --git a/tdefile-plugins/c++/tdefile_h.desktop b/tdefile-plugins/c++/tdefile_h.desktop new file mode 100644 index 00000000..539ff599 --- /dev/null +++ b/tdefile-plugins/c++/tdefile_h.desktop @@ -0,0 +1,58 @@ +[Desktop Entry] +Type=Service +Name=C/C++ Header Info +Name[af]=C/C++ Opskrif Inligting +Name[bg]=Информация за заглавната част на C/C++ +Name[br]=Titouriñ diwar-benn ar reollin C/C++ +Name[ca]=Informació de capçaleres C/C++ +Name[cs]=Informace o C/C++ hlavičce +Name[cy]=Gwybodaeth Pennawd C/C++ +Name[da]=C/C++-headerinfo +Name[de]=C++-Header-Info +Name[el]=Πληροφορίες κεφαλίδων C/C++ +Name[es]=Info de cabecera C/C++ +Name[et]=C/C++ päise info +Name[eu]=C/C++ goiburuen informazioa +Name[fa]=اطلاعات سرآیند C/C++ +Name[fi]=C/C++-otsikkotiedot +Name[fr]=Informations d'en-tête C/C++ +Name[gl]=Información da cabeceira de C/C++ +Name[he]=מידע כותרות ++C/C +Name[hi]=C/C++ हेडर जानकारी +Name[hr]=Informacije o C++ zaglavljima +Name[hu]=C/C++ header fájl jellemzői +Name[is]=C/C++ haus upplýsingar +Name[it]=Informazioni intestazioni C/C++ +Name[ja]=C/C++ ヘッダ情報 +Name[ka]=C/C++ ზედა კოლონტიტულის ინფორმაცია +Name[kk]=C/C++ айдар мәліметі +Name[lt]=C/C++ antraščių informacija +Name[ms]=Info Pengepala C/C++ +Name[nb]=C++-deklarasjonsfilinfo +Name[nds]=C/C++-Koppdatei-Info +Name[ne]=C/C++ Header info +Name[nl]=C/C++ Header-info +Name[nn]=C/C++-deklarasjonsinfo +Name[pa]=C/C++ Header ਜਾਣਕਾਰੀ +Name[pl]=Informacja z nagłówka C/C++ +Name[pt]=Informações do Cabeçalho de C/C++ +Name[pt_BR]=Informações sobre Cabeçalhos C/C++ +Name[ro]=Informaţii antet C/C++ +Name[ru]=Информация о файлах заголовков C/C++ +Name[sk]=Informácie o hlavičkách C/C++ +Name[sl]=Informacije o glavi C/C++ +Name[sr]=Информације о C/C++ заглављу +Name[sr@Latn]=Informacije o C/C++ zaglavlju +Name[sv]=Information om C/C++-deklarationsfiler +Name[ta]= =C/C++ தலைப்பு தகவல் +Name[tg]=Ахборот дар бораи сарлавҳаи файлҳои C/C++ +Name[th]=ข้อมูลแฟ้มส่วนหัว C/C++ +Name[tr]=C/C++ Başlık Bilgisi +Name[uk]=Інформація по заголовкам C++ +Name[xh]=C/C++ Ulwazi lokubhaliweyo okuphezulu +Name[zh_CN]=C/C++ 头文件信息 +Name[zh_TW]=C/C++ 檔頭資訊 +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_cpp +MimeType=text/x-chdr +PreferredItems=Lines,Code,Comment,Blank,Strings,i18n Strings,Included Files |