summaryrefslogtreecommitdiffstats
path: root/kfile-plugins/png
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2013-01-27 01:03:37 -0600
committerTimothy Pearson <[email protected]>2013-01-27 01:03:37 -0600
commit2e25fa39cd67cca2472d3eabdb478feb517d72a5 (patch)
tree63725962f632d152cbf20709191d39f6fc865966 /kfile-plugins/png
parent190d88dfc662f3fc466c9d1f53acbbea65f33c49 (diff)
downloadtdegraphics-2e25fa39cd67cca2472d3eabdb478feb517d72a5.tar.gz
tdegraphics-2e25fa39cd67cca2472d3eabdb478feb517d72a5.zip
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'kfile-plugins/png')
-rw-r--r--kfile-plugins/png/CMakeLists.txt34
-rw-r--r--kfile-plugins/png/Makefile.am22
-rw-r--r--kfile-plugins/png/kfile_png.cpp315
-rw-r--r--kfile-plugins/png/kfile_png.desktop65
-rw-r--r--kfile-plugins/png/kfile_png.h40
5 files changed, 0 insertions, 476 deletions
diff --git a/kfile-plugins/png/CMakeLists.txt b/kfile-plugins/png/CMakeLists.txt
deleted file mode 100644
index 3281651a..00000000
--- a/kfile-plugins/png/CMakeLists.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-#################################################
-#
-# (C) 2010-2011 Calvin Morrison
-#
-# 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 kfile_png.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
-
-
-#### kfile_png (module) #########################
-tde_add_kpart( kfile_png AUTOMOC
- SOURCES kfile_png.cpp
- LINK kio-shared
- DESTINATION ${PLUGIN_INSTALL_DIR}
-)
diff --git a/kfile-plugins/png/Makefile.am b/kfile-plugins/png/Makefile.am
deleted file mode 100644
index 9aa820b6..00000000
--- a/kfile-plugins/png/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-## Makefile.am for png 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 = kfile_png.h
-
-kde_module_LTLIBRARIES = kfile_png.la
-
-kfile_png_la_SOURCES = kfile_png.cpp
-kfile_png_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
-kfile_png_la_LIBADD = $(LIB_KIO)
-
-# let automoc handle all of the meta source files (moc)
-METASOURCES = AUTO
-
-messages:
- $(XGETTEXT) *.cpp -o $(podir)/kfile_png.pot
-
-services_DATA = kfile_png.desktop
-servicesdir = $(kde_servicesdir)
diff --git a/kfile-plugins/png/kfile_png.cpp b/kfile-plugins/png/kfile_png.cpp
deleted file mode 100644
index 531fdfe3..00000000
--- a/kfile-plugins/png/kfile_png.cpp
+++ /dev/null
@@ -1,315 +0,0 @@
-/* This file is part of the KDE project
- * Copyright (C) 2001, 2002 Rolf Magnus <[email protected]>
- *
- * 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.
- *
- * $Id$
- */
-
-#include <stdlib.h>
-#include "kfile_png.h"
-
-#include <kurl.h>
-#include <kprocess.h>
-#include <klocale.h>
-#include <kgenericfactory.h>
-#include <kdebug.h>
-
-#include <tqcstring.h>
-#include <tqfile.h>
-#include <tqdatetime.h>
-#include <tqdict.h>
-#include <tqvalidator.h>
-#include <zlib.h>
-
-// some defines to make it easier
-// don't tell me anything about preprocessor usage :)
-#define CHUNK_SIZE(data, index) ((data[index ]<<24) + (data[index+1]<<16) + \
- (data[index+2]<< 8) + data[index+3])
-#define CHUNK_TYPE(data, index) &data[index+4]
-#define CHUNK_HEADER_SIZE 12
-#define CHUNK_DATA(data, index, offset) data[8+index+offset]
-
-// known translations for common png keys
-static const char* knownTranslations[]
-#ifdef __GNUC__
-__attribute__((unused))
-#endif
- = {
- I18N_NOOP("Title"),
- I18N_NOOP("Author"),
- I18N_NOOP("Description"),
- I18N_NOOP("Copyright"),
- I18N_NOOP("Creation Time"),
- I18N_NOOP("Software"),
- I18N_NOOP("Disclaimer"),
- I18N_NOOP("Warning"),
- I18N_NOOP("Source"),
- I18N_NOOP("Comment")
-};
-
-// and for the colors
-static const char* colors[] = {
- I18N_NOOP("Grayscale"),
- I18N_NOOP("Unknown"),
- I18N_NOOP("RGB"),
- I18N_NOOP("Palette"),
- I18N_NOOP("Grayscale/Alpha"),
- I18N_NOOP("Unknown"),
- I18N_NOOP("RGB/Alpha")
-};
-
- // and compressions
-static const char* compressions[] =
-{
- I18N_NOOP("Deflate")
-};
-
- // interlaced modes
-static const char* interlaceModes[] = {
- I18N_NOOP("None"),
- I18N_NOOP("Adam7")
-};
-
-typedef KGenericFactory<KPngPlugin> PngFactory;
-
-K_EXPORT_COMPONENT_FACTORY(kfile_png, PngFactory("kfile_png"))
-
-KPngPlugin::KPngPlugin(TQObject *parent, const char *name,
- const TQStringList &args)
- : KFilePlugin(parent, name, args)
-{
- kdDebug(7034) << "png plugin\n";
-
- // set up our mime type
- KFileMimeTypeInfo* info = addMimeTypeInfo( "image/png" );
-
- KFileMimeTypeInfo::GroupInfo* group = 0;
- KFileMimeTypeInfo::ItemInfo* item = 0;
-
- // comment group
- group = addGroupInfo(info, "Comment", i18n("Comment"));
- addVariableInfo(group, TQVariant::String, 0);
-
- // technical group
- group = addGroupInfo(info, "Technical", i18n("Technical Details"));
-
- 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);
-
- addItemInfo(group, "ColorMode", i18n("Color Mode"), TQVariant::String);
- addItemInfo(group, "Compression", i18n("Compression"), TQVariant::String);
- addItemInfo(group, "InterlaceMode", i18n("Interlace Mode"),TQVariant::String);
-}
-
-bool KPngPlugin::readInfo( KFileMetaInfo& info, uint what)
-{
- if ( info.path().isEmpty() ) // remote file
- return false;
- TQFile f(info.path());
- if ( !f.open(IO_ReadOnly) )
- return false;
-
- TQIODevice::Offset fileSize = f.size();
-
- if (fileSize < 29) return false;
- // the technical group will be read from the first 29 bytes. If the file
- // is smaller, we can't even read this.
-
- bool readComments = false;
- if (what & (KFileMetaInfo::Fastest |
- KFileMetaInfo::DontCare |
- KFileMetaInfo::ContentInfo)) readComments = true;
- else
- fileSize = 29; // No need to read more
-
- uchar *data = new uchar[fileSize+1];
- f.readBlock(reinterpret_cast<char*>(data), fileSize);
- data[fileSize]='\n';
-
- // find the start
- if (data[0] == 137 && data[1] == 80 && data[2] == 78 && data[3] == 71 &&
- data[4] == 13 && data[5] == 10 && data[6] == 26 && data[7] == 10 )
- {
- // ok
- // the IHDR chunk should be the first
- if (!strncmp((char*)&data[12], "IHDR", 4))
- {
- // we found it, get the dimensions
- ulong x,y;
- x = (data[16]<<24) + (data[17]<<16) + (data[18]<<8) + data[19];
- y = (data[20]<<24) + (data[21]<<16) + (data[22]<<8) + data[23];
-
- uint type = data[25];
- uint bpp = data[24];
- kdDebug(7034) << "dimensions " << x << "*" << y << endl;
-
- // the bpp are only per channel, so we need to multiply the with
- // the channel count
- switch (type)
- {
- case 0: break; // Grayscale
- case 2: bpp *= 3; break; // RGB
- case 3: break; // palette
- case 4: bpp *= 2; break; // grayscale w. alpha
- case 6: bpp *= 4; break; // RGBA
-
- default: // we don't get any sensible value here
- bpp = 0;
- }
-
- KFileMetaInfoGroup techgroup = appendGroup(info, "Technical");
-
- appendItem(techgroup, "Dimensions", TQSize(x, y));
- appendItem(techgroup, "BitDepth", bpp);
- appendItem(techgroup, "ColorMode",
- (type < sizeof(colors)/sizeof(colors[0]))
- ? i18n(colors[data[25]]) : i18n("Unknown"));
-
- appendItem(techgroup, "Compression",
- (data[26] < sizeof(compressions)/sizeof(compressions[0]))
- ? i18n(compressions[data[26]]) : i18n("Unknown"));
-
- appendItem(techgroup, "InterlaceMode",
- (data[28] < sizeof(interlaceModes)/sizeof(interlaceModes[0]))
- ? i18n(interlaceModes[data[28]]) : i18n("Unknown"));
- }
-
- // look for a tEXt chunk
- if (readComments)
- {
- uint index = 8;
- index += CHUNK_SIZE(data, index) + CHUNK_HEADER_SIZE;
- KFileMetaInfoGroup commentGroup = appendGroup(info, "Comment");
-
- while(index<fileSize-12)
- {
- while (index < fileSize - 12 &&
- strncmp((char*)CHUNK_TYPE(data,index), "tEXt", 4) &&
- strncmp((char*)CHUNK_TYPE(data,index), "zTXt", 4))
-
- {
- if (!strncmp((char*)CHUNK_TYPE(data,index), "IEND", 4))
- goto end;
-
- index += CHUNK_SIZE(data, index) + CHUNK_HEADER_SIZE;
- }
-
- if (index < fileSize - 12)
- {
- // we found a tEXt or zTXt field
-
- // get the key, it's a null terminated string at the
- // chunk start
-
- uchar* key = &CHUNK_DATA(data,index,0);
-
- int keysize=0;
- for (;key[keysize]!=0; keysize++)
- // look if we reached the end of the file
- // (it might be corrupted)
- if (8+index+keysize>=fileSize)
- goto end;
-
- TQByteArray arr;
- if(!strncmp((char*)CHUNK_TYPE(data,index), "zTXt", 4)) {
- kdDebug(7034) << "We found a zTXt field\n";
- // we get the compression method after the key
- uchar* compressionMethod = &CHUNK_DATA(data,index,keysize+1);
- if ( *compressionMethod != 0x00 ) {
- // then it isn't zlib compressed and we are sunk
- kdDebug(7034) << "Non-standard compression method." << endl;
- goto end;
- }
- // compressed string after the compression technique spec
- uchar* compressedText = &CHUNK_DATA(data, index, keysize+2);
- uint compressedTextSize = CHUNK_SIZE(data, index)-keysize-2;
-
- // security check, also considering overflow wraparound from the addition --
- // we may endup with a /smaller/ index if we wrap all the way around
- uint firstIndex = (uint)(compressedText - data);
- uint onePastLastIndex = firstIndex + compressedTextSize;
- if ( onePastLastIndex > fileSize || onePastLastIndex <= firstIndex)
- goto end;
-
- uLongf uncompressedLen = compressedTextSize * 2; // just a starting point
- int zlibResult;
- do {
- arr.resize(uncompressedLen);
- zlibResult = uncompress((Bytef*)arr.data(), &uncompressedLen,
- compressedText, compressedTextSize);
- if (Z_OK == zlibResult) {
- // then it is all OK
- arr.resize(uncompressedLen);
- } else if (Z_BUF_ERROR == zlibResult) {
- // the uncompressedArray needs to be larger
- // kdDebug(7034) << "doubling size for decompression" << endl;
- uncompressedLen *= 2;
-
- // DoS protection. can't be bigger than 64k
- if ( uncompressedLen > 131072 )
- break;
- } else {
- // something bad happened
- goto end;
- }
- } while (Z_BUF_ERROR == zlibResult);
-
- if (Z_OK != zlibResult)
- goto end;
- } else if (!strncmp((char*)CHUNK_TYPE(data,index), "tEXt", 4)) {
- kdDebug(7034) << "We found a tEXt field\n";
- // the text comes after the key, but isn't null terminated
- uchar* text = &CHUNK_DATA(data,index, keysize+1);
- uint textsize = CHUNK_SIZE(data, index)-keysize-1;
-
- // security check, also considering overflow wraparound from the addition --
- // we may endup with a /smaller/ index if we wrap all the way around
- uint firstIndex = (uint)(text - data);
- uint onePastLastIndex = firstIndex + textsize;
-
- if ( onePastLastIndex > fileSize || onePastLastIndex <= firstIndex)
- goto end;
-
- arr.resize(textsize);
- arr = TQByteArray(textsize).duplicate((const char*)text,
- textsize);
-
- } else {
- kdDebug(7034) << "We found a field, not expected though\n";
- goto end;
- }
- appendItem(commentGroup,
- TQString(reinterpret_cast<char*>(key)),
- TQString(arr));
-
- kdDebug(7034) << "adding " << key << " / "
- << TQString(arr) << endl;
-
- index += CHUNK_SIZE(data, index) + CHUNK_HEADER_SIZE;
- }
- }
- }
- }
-end:
- delete[] data;
- return true;
-}
-
-#include "kfile_png.moc"
diff --git a/kfile-plugins/png/kfile_png.desktop b/kfile-plugins/png/kfile_png.desktop
deleted file mode 100644
index c3df978e..00000000
--- a/kfile-plugins/png/kfile_png.desktop
+++ /dev/null
@@ -1,65 +0,0 @@
-[Desktop Entry]
-Type=Service
-Name=PNG Info
-Name[af]=Png Inligting
-Name[ar]=معلومات PNG
-Name[br]=Titouroù PNG
-Name[ca]=Informació de PNG
-Name[cs]=PNG info
-Name[cy]=Gybodaeth PNG
-Name[da]=PNG-info
-Name[de]=PNG-Info
-Name[el]=Πληροφορίες PNG
-Name[eo]=PNG-informo
-Name[es]=Info PNG
-Name[et]=PNG info
-Name[fa]=اطلاعات PNG
-Name[fi]=PNG-tiedot
-Name[fr]=Informations PNG
-Name[gl]=Inf. PNG
-Name[he]=מידע PNG
-Name[hi]=PNG जानकारी
-Name[hr]=PNG Informacije
-Name[hu]=PNG-jellemzők
-Name[is]=PNG upplýsingar
-Name[it]=Informazioni PNG
-Name[ja]=PNG 情報
-Name[kk]=PNG мәліметі
-Name[km]=ព័ត៌មាន PNG
-Name[lt]=PNG informacija
-Name[ms]=Maklumat PNG
-Name[nds]=PNG-Info
-Name[ne]=PNG सूचना
-Name[nl]=PNG-Info
-Name[nn]=PNG-info
-Name[nso]=Tshedimoso ya PNG
-Name[pa]=PNG ਜਾਣਕਾਰੀ
-Name[pl]=Informacja o pliku PNG
-Name[pt]=Informação do PNG
-Name[pt_BR]= Informação sobre PNG
-Name[ro]=Informaţii PNG
-Name[ru]=Информация о PNG
-Name[se]=PNG-dieđut
-Name[sl]=Podatki o PNG
-Name[sr]=PNG информације
-Name[sr@Latn]=PNG informacije
-Name[sv]=PNG-information
-Name[ta]=PNG தகவல்
-Name[tg]=Иттилоот оиди PNG
-Name[th]=ข้อมูลแฟ้ม PNG
-Name[tr]=PNG Bilgisi
-Name[uk]=Інформація про PNG
-Name[uz]=PNG haqida maʼlumot
-Name[uz@cyrillic]=PNG ҳақида маълумот
-Name[ven]=Mafhungo a PNG
-Name[wa]=Informåcion sol imådje PNG
-Name[xh]=PNG Ulwazi
-Name[zh_CN]=PNG 信息
-Name[zh_HK]=PNG 資訊
-Name[zh_TW]=PNG 資訊
-Name[zu]=Ulwazi lwe-PNG
-ServiceTypes=KFilePlugin
-X-TDE-Library=kfile_png
-MimeType=image/png
-PreferredGroups=Comment,Technical
-PreferredItems=Title,Author,Dimensions,BitDepth,ColorMode,Compression
diff --git a/kfile-plugins/png/kfile_png.h b/kfile-plugins/png/kfile_png.h
deleted file mode 100644
index 24322468..00000000
--- a/kfile-plugins/png/kfile_png.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* This file is part of the KDE project
- * Copyright (C) 2001, 2002 Rolf Magnus <[email protected]>
- *
- * 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.
- *
- * $Id$
- */
-
-#ifndef __KFILE_PNG_H__
-#define __KFILE_PNG_H__
-
-#include <kfilemetainfo.h>
-#include <kurl.h>
-
-class TQStringList;
-
-class KPngPlugin: public KFilePlugin
-{
- Q_OBJECT
-
-
-public:
- KPngPlugin( TQObject *parent, const char *name, const TQStringList& preferredItems );
-
- virtual bool readInfo( KFileMetaInfo& info, uint );
-};
-
-#endif