From 2e25fa39cd67cca2472d3eabdb478feb517d72a5 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 27 Jan 2013 01:03:37 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- tdefile-plugins/pcx/CMakeLists.txt | 35 +++++++++ tdefile-plugins/pcx/Makefile.am | 21 ++++++ tdefile-plugins/pcx/tdefile_pcx.cpp | 122 ++++++++++++++++++++++++++++++++ tdefile-plugins/pcx/tdefile_pcx.desktop | 62 ++++++++++++++++ tdefile-plugins/pcx/tdefile_pcx.h | 89 +++++++++++++++++++++++ 5 files changed, 329 insertions(+) create mode 100644 tdefile-plugins/pcx/CMakeLists.txt create mode 100644 tdefile-plugins/pcx/Makefile.am create mode 100644 tdefile-plugins/pcx/tdefile_pcx.cpp create mode 100644 tdefile-plugins/pcx/tdefile_pcx.desktop create mode 100644 tdefile-plugins/pcx/tdefile_pcx.h (limited to 'tdefile-plugins/pcx') diff --git a/tdefile-plugins/pcx/CMakeLists.txt b/tdefile-plugins/pcx/CMakeLists.txt new file mode 100644 index 00000000..7eea5125 --- /dev/null +++ b/tdefile-plugins/pcx/CMakeLists.txt @@ -0,0 +1,35 @@ +################################################# +# +# (C) 2010-2011 Calvin Morrison +# mutantturkey@gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +#### other data ################################# + +install( FILES tdefile_pcx.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +#### tdefile_pcx (module) ######################### + +tde_add_kpart( tdefile_pcx AUTOMOC + SOURCES tdefile_pcx.cpp + LINK tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/pcx/Makefile.am b/tdefile-plugins/pcx/Makefile.am new file mode 100644 index 00000000..18249bc6 --- /dev/null +++ b/tdefile-plugins/pcx/Makefile.am @@ -0,0 +1,21 @@ +## Makefile.am for PCX file meta info plugin + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +noinst_HEADERS = tdefile_pcx.h + +kde_module_LTLIBRARIES = tdefile_pcx.la + +tdefile_pcx_la_SOURCES = tdefile_pcx.cpp +tdefile_pcx_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdefile_pcx_la_LIBADD = $(LIB_KIO) $(LIBTIFF) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: + $(XGETTEXT) *.cpp -o $(podir)/tdefile_pcx.pot + +services_DATA = tdefile_pcx.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/pcx/tdefile_pcx.cpp b/tdefile-plugins/pcx/tdefile_pcx.cpp new file mode 100644 index 00000000..2c4047a6 --- /dev/null +++ b/tdefile-plugins/pcx/tdefile_pcx.cpp @@ -0,0 +1,122 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Nadeem Hasan + * + * 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_pcx.h" + +#include +#include + +#include +#include + +typedef KGenericFactory PcxFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_pcx, PcxFactory("tdefile_pcx")) + +TQDataStream &operator>>( TQDataStream &s, PALETTE &pal ) +{ + for ( int i=0; i<16; ++i ) + s >> pal.p[ i ].r >> pal.p[ i ].g >> pal.p[ i ].b; + + return s; +} + +TQDataStream &operator>>( TQDataStream &s, PCXHEADER &ph ) +{ + s >> ph.Manufacturer; + s >> ph.Version; + s >> ph.Encoding; + s >> ph.Bpp; + s >> ph.XMin >> ph.YMin >> ph.XMax >> ph.YMax; + s >> ph.HDpi >> ph.YDpi; + s >> ph.Palette; + s >> ph.Reserved; + s >> ph.NPlanes; + s >> ph.BytesPerLine; + s >> ph.PaletteInfo; + s >> ph.HScreenSize; + s >> ph.VScreenSize; + + return s; +} + +KPcxPlugin::KPcxPlugin( TQObject *parent, const char *name, + const TQStringList &args ) : KFilePlugin( parent, name, args ) +{ + kdDebug(7034) << "PCX file meta info plugin" << endl; + KFileMimeTypeInfo* info = addMimeTypeInfo( "image/x-pcx" ); + + KFileMimeTypeInfo::GroupInfo* group = + addGroupInfo( info, "General", i18n( "General" ) ); + + KFileMimeTypeInfo::ItemInfo* item; + item = addItemInfo( group, "Dimensions", i18n( "Dimensions" ), + TQVariant::Size ); + setHint( item, KFileMimeTypeInfo::Size ); + setUnit( item, KFileMimeTypeInfo::Pixels ); + item = addItemInfo( group, "BitDepth", i18n( "Bit Depth" ), + TQVariant::Int ); + setUnit( item, KFileMimeTypeInfo::BitsPerPixel ); + item = addItemInfo( group, "Resolution", i18n( "Resolution" ), + TQVariant::Size ); + setUnit( item, KFileMimeTypeInfo::DotsPerInch ); + item = addItemInfo( group, "Compression", i18n( "Compression" ), + TQVariant::String ); +} + +bool KPcxPlugin::readInfo( KFileMetaInfo& info, uint ) +{ + if ( info.path().isEmpty() ) + return false; + + struct PCXHEADER header; + + TQFile f( info.path() ); + if ( !f.open( IO_ReadOnly ) ) + return false; + + TQDataStream s( &f ); + s.setByteOrder( TQDataStream::LittleEndian ); + + s >> header; + + int w = ( header.XMax-header.XMin ) + 1; + int h = ( header.YMax-header.YMin ) + 1; + int bpp = header.Bpp*header.NPlanes; + + KFileMetaInfoGroup group = appendGroup( info, "General" ); + + appendItem( group, "Dimensions", TQSize( w, h ) ); + appendItem( group, "BitDepth", bpp ); + appendItem( group, "Resolution", TQSize( header.HDpi, header.YDpi ) ); + if ( header.Encoding == 1 ) + appendItem( group, "Compression", i18n( "Yes (RLE)" ) ); + else + appendItem( group, "Compression", i18n( "None" ) ); + + f.close(); + + return true; +} + +#include "tdefile_pcx.moc" + +/* vim: et sw=2 ts=2 +*/ + diff --git a/tdefile-plugins/pcx/tdefile_pcx.desktop b/tdefile-plugins/pcx/tdefile_pcx.desktop new file mode 100644 index 00000000..bcf54b6a --- /dev/null +++ b/tdefile-plugins/pcx/tdefile_pcx.desktop @@ -0,0 +1,62 @@ +[Desktop Entry] +Type=Service +Name=PCX File Meta Info +Name[ar]=معلومات ملف PCX +Name[br]=Meta-titouroù ar restr PCX +Name[bs]=PCX meta-podaci +Name[ca]=Metainformació de fitxer PCX +Name[cs]=Metainformace obrázku typu PCX +Name[cy]=Meta-wybodaeth Ffeil PCX +Name[da]=PCX Fil-meta-info +Name[de]=PCX Metainformation +Name[el]=Μετα-πληροφορίες αρχείου PCX +Name[eo]=PCX-dosiera metainformo +Name[es]=Info meta de archivos PCX +Name[et]=PCX faili metainfo +Name[eu]=PCX fitxategi meta info +Name[fa]=فرااطلاعات پروندۀ PCX +Name[fi]=PCX-tiedoston metatiedot +Name[fr]=Méta Informations sur les fichiers PCX +Name[gl]=Inf. metaficheiro PCX +Name[he]=מידע PCX +Name[hi]=PCX फ़ाइल मेटा जानकारी +Name[hu]=PCX-jellemzők +Name[is]=PCX File Meta upplýsingar +Name[it]=Informazioni PCX +Name[ja]=PCX ファイルメタ情報 +Name[kk]=PCX файлдың мета деректері +Name[km]=ព័ត៌មាន​មេតា​របស់​ឯកសារ PCX +Name[lt]=PCX bylos meta informacija +Name[ms]=Maklumat Meta Fail PCX +Name[nb]=PCX-filmetainfo +Name[nds]=PCX-Metainfo +Name[ne]=PCX फाइल मेटा सूचना +Name[nl]=PCX meta-info +Name[nn]=PCX-filmetainfo +Name[pl]=Informacja o pliku PCX +Name[pt]=Meta-Informação do Ficheiro PCX +Name[pt_BR]=Informação sobre Meta Arquivo PCX +Name[ro]=Metainformaţii PCX +Name[ru]=Информация о метафайле PCX +Name[se]=PCX-filla metadieđut +Name[sk]=Meta-info o súbore PCX +Name[sl]=Meta podatki o PCX +Name[sr]=Мета информације PCX фајла +Name[sr@Latn]=Meta informacije PCX fajla +Name[sv]=Metainformation om PCX-fil +Name[ta]=PCX File Meta தகவல் +Name[tg]=Иттилоот оиди метафайли PCX +Name[th]=ข้อมูลเมตาแฟ้ม PCX +Name[tr]=PCX Dosya Bilgisi +Name[uk]=Метаінформація про файл PCX +Name[uz]=PCX-faylining meta-maʼlumoti +Name[uz@cyrillic]=PCX-файлининг мета-маълумоти +Name[wa]=Informåcion sol imådje PCX +Name[zh_CN]=PCX 文件元信息 +Name[zh_HK]=PCX 檔案 Meta 資訊 +Name[zh_TW]=PCX 檔案 Meta 資訊 +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_pcx +MimeType=image/x-pcx +PreferredGroups=General +PreferredItems=Dimensions,Resolution,BitDepth,Compression diff --git a/tdefile-plugins/pcx/tdefile_pcx.h b/tdefile-plugins/pcx/tdefile_pcx.h new file mode 100644 index 00000000..c7b62e2e --- /dev/null +++ b/tdefile-plugins/pcx/tdefile_pcx.h @@ -0,0 +1,89 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Nadeem Hasan + * + * 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_PCX_H_ +#define __KFILE_PCX_H_ + +#include + +struct PALETTE +{ + struct + { + TQ_UINT8 r; + TQ_UINT8 g; + TQ_UINT8 b; + } p[ 16 ]; +}; + +struct PCXHEADER +{ + TQ_UINT8 Manufacturer; // Constant Flag, 10 = ZSoft .pcx + TQ_UINT8 Version; // Version information + // 0 = Version 2.5 of PC Paintbrush + // 2 = Version 2.8 w/palette information + // 3 = Version 2.8 w/o palette information + // 4 = PC Paintbrush for Windows(Plus for + // Windows uses Ver 5) + // 5 = Version 3.0 and > of PC Paintbrush + // and PC Paintbrush +, includes + // Publisher's Paintbrush . Includes + // 24-bit .PCX files + TQ_UINT8 Encoding; // 1 = .PCX run length encoding + TQ_UINT8 Bpp; // Number of bits to represent a pixel + // (per Plane) - 1, 2, 4, or 8 + TQ_UINT16 XMin; + TQ_UINT16 YMin; + TQ_UINT16 XMax; + TQ_UINT16 YMax; + TQ_UINT16 HDpi; + TQ_UINT16 YDpi; + struct PALETTE Palette; + TQ_UINT8 Reserved; // Should be set to 0. + TQ_UINT8 NPlanes; // Number of color planes + TQ_UINT16 BytesPerLine; // Number of bytes to allocate for a scanline + // plane. MUST be an EVEN number. Do NOT + // calculate from Xmax-Xmin. + TQ_UINT16 PaletteInfo; // How to interpret palette- 1 = Color/BW, + // 2 = Grayscale ( ignored in PB IV/ IV + ) + TQ_UINT16 HScreenSize; //Qt::Horizontal screen size in pixels. New field + // found only in PB IV/IV Plus + TQ_UINT16 VScreenSize; //Qt::Vertical screen size in pixels. New field + // found only in PB IV/IV Plus + TQ_UINT8 Filler[ 54 ]; // Blank to fill out 128 byte header. Set all + // bytes to 0 +}; + +class KPcxPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KPcxPlugin(TQObject *parent, const char *name, const TQStringList& args); + virtual bool readInfo(KFileMetaInfo& info, uint what); + +private: +}; + +#endif + +/* vim: et sw=2 ts=2 +*/ + -- cgit v1.2.1