diff options
Diffstat (limited to 'kcontrol/tdefontinst/thumbnail')
-rw-r--r-- | kcontrol/tdefontinst/thumbnail/CMakeLists.txt | 35 | ||||
-rw-r--r-- | kcontrol/tdefontinst/thumbnail/FontThumbnail.cpp | 73 | ||||
-rw-r--r-- | kcontrol/tdefontinst/thumbnail/FontThumbnail.h | 55 | ||||
-rw-r--r-- | kcontrol/tdefontinst/thumbnail/Makefile.am | 14 | ||||
-rw-r--r-- | kcontrol/tdefontinst/thumbnail/fontthumbnail.desktop | 85 |
5 files changed, 262 insertions, 0 deletions
diff --git a/kcontrol/tdefontinst/thumbnail/CMakeLists.txt b/kcontrol/tdefontinst/thumbnail/CMakeLists.txt new file mode 100644 index 000000000..8d3c04b86 --- /dev/null +++ b/kcontrol/tdefontinst/thumbnail/CMakeLists.txt @@ -0,0 +1,35 @@ +################################################# +# +# (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_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/kcontrol/kfontinst/lib + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES fontthumbnail.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### fontthumbnail (module) #################### + +tde_add_kpart( fontthumbnail + SOURCES FontThumbnail.cpp + LINK kfontinst-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/kcontrol/tdefontinst/thumbnail/FontThumbnail.cpp b/kcontrol/tdefontinst/thumbnail/FontThumbnail.cpp new file mode 100644 index 000000000..aaf85e940 --- /dev/null +++ b/kcontrol/tdefontinst/thumbnail/FontThumbnail.cpp @@ -0,0 +1,73 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Class Name : KFI::CFontThumbnail +// Author : Craig Drummond +// Project : K Font Installer +// Creation Date : 02/08/2003 +// Version : $Revision$ $Date$ +// +//////////////////////////////////////////////////////////////////////////////// +// +// 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. +// +// 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; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//////////////////////////////////////////////////////////////////////////////// +// (C) Craig Drummond, 2003, 2004 +//////////////////////////////////////////////////////////////////////////////// + +#include "FontThumbnail.h" +#include "KfiConstants.h" +#include <tqimage.h> +#include <tqbitmap.h> +#include <tqpainter.h> +#include <kiconloader.h> +#include <kglobalsettings.h> +#include <klocale.h> +#include <kurl.h> + +extern "C" +{ + KDE_EXPORT ThumbCreator *new_creator() + { + return new KFI::CFontThumbnail; + } +} + +namespace KFI +{ + +CFontThumbnail::CFontThumbnail() +{ + TDEGlobal::locale()->insertCatalogue(KFI_CATALOGUE); +} + +bool CFontThumbnail::create(const TQString &path, int width, int height, TQImage &img) +{ + TQPixmap pix; + + if(itsEngine.draw(KURL(path), width, height, pix, 0, true)) + { + img=pix.convertToImage(); + return true; + } + + return false; +} + +ThumbCreator::Flags CFontThumbnail::flags() const +{ + return DrawFrame; +} + +} diff --git a/kcontrol/tdefontinst/thumbnail/FontThumbnail.h b/kcontrol/tdefontinst/thumbnail/FontThumbnail.h new file mode 100644 index 000000000..c902ce019 --- /dev/null +++ b/kcontrol/tdefontinst/thumbnail/FontThumbnail.h @@ -0,0 +1,55 @@ +#ifndef __FONT_THUMBNAIL__H__ +#define __FONT_THUMBNAIL__H__ + +//////////////////////////////////////////////////////////////////////////////// +// +// Class Name : KFI::CFontThumbnail +// Author : Craig Drummond +// Project : K Font Installer +// Creation Date : 02/08/2003 +// Version : $Revision$ $Date$ +// +//////////////////////////////////////////////////////////////////////////////// +// +// 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. +// +// 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; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//////////////////////////////////////////////////////////////////////////////// +// (C) Craig Drummond, 2003, 2004 +//////////////////////////////////////////////////////////////////////////////// + +#include <tdeio/thumbcreator.h> +#include "FcEngine.h" + +namespace KFI +{ + +class CFontThumbnail : public ThumbCreator +{ + public: + + CFontThumbnail(); + ~CFontThumbnail() {} + + bool create(const TQString &path, int width, int height, TQImage &img); + Flags flags() const; + + private: + + CFcEngine itsEngine; +}; + +} + +#endif diff --git a/kcontrol/tdefontinst/thumbnail/Makefile.am b/kcontrol/tdefontinst/thumbnail/Makefile.am new file mode 100644 index 000000000..49213a019 --- /dev/null +++ b/kcontrol/tdefontinst/thumbnail/Makefile.am @@ -0,0 +1,14 @@ +kde_module_LTLIBRARIES = fontthumbnail.la + +fontthumbnail_la_SOURCES = FontThumbnail.cpp +fontthumbnail_la_LIBADD = $(LIBFREETYPE_LIBS) $(LIB_TDECORE) $(LIB_KIO) ../lib/libkfontinst.la +fontthumbnail_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIBFREETYPE_RPATH) -module $(KDE_PLUGIN) +METASOURCES = AUTO + +noinst_HEADERS = FontThumbnail.h + +kdelnkdir = $(kde_servicesdir) + +kde_services_DATA = fontthumbnail.desktop + +AM_CPPFLAGS= -I$(srcdir)/../lib -I$(srcdir)/../../fonts $(all_includes) $(LIBFREETYPE_CFLAGS) diff --git a/kcontrol/tdefontinst/thumbnail/fontthumbnail.desktop b/kcontrol/tdefontinst/thumbnail/fontthumbnail.desktop new file mode 100644 index 000000000..7b82caf93 --- /dev/null +++ b/kcontrol/tdefontinst/thumbnail/fontthumbnail.desktop @@ -0,0 +1,85 @@ +[Desktop Entry] +Type=Service +Name=Font Files +Name[af]=Skrif tipe Lêers +Name[ar]=ملفات المحرف +Name[az]=Yazı Növü Faylları +Name[be]=Файлы шрыфтоў +Name[bg]=Файлове с шрифтове +Name[bn]=ফন্ট ফাইল +Name[br]=Restroù Nodrezhoù +Name[bs]=Datoteke sa fontovima +Name[ca]=Fitxers de lletres +Name[cs]=Soubory s písmy +Name[csb]=Lopczi fòntów +Name[cy]=Ffeiliau Ffont +Name[da]=Skrifttypefiler +Name[de]=Schriftdatei +Name[el]=Αρχεία γραμματοσειρών +Name[eo]=Tipardosierojn +Name[es]=Archivos de tipos de letra +Name[et]=Fondifailid +Name[eu]=Letra-tipo fitxategiak +Name[fa]=پروندۀ قلمها +Name[fi]=Kirjasintiedostot +Name[fr]=Fichiers de polices +Name[fy]=Lettertypetriemmen +Name[ga]=Comhaid Chlófhoirne +Name[gl]=Ficheiros de Tipografias +Name[he]=קבצי גופנים +Name[hi]=फ़ॉन्ट फ़ाइलें +Name[hr]=Datoteke fontova +Name[hu]=Betűtípusfájlok +Name[id]=Berkas Font +Name[is]=Leturskrár +Name[it]=File dei tipi di carattere +Name[ja]=フォントファイル +Name[ka]=ფონტების ფაილები +Name[kk]=Қаріп файлдары +Name[km]=ឯកសារពុម្ពអក្សរ +Name[ko]=글꼴 파일 +Name[lo]=ຄົ້ນຫາແຟ້ມ +Name[lt]=Šriftų bylos +Name[lv]=Fontu faili +Name[mk]=Датотеки со фонтови +Name[mn]=Бичгийн файл +Name[ms]=Fail Fon +Name[mt]=Fajls tal-fonts +Name[nb]=Skrifttypefiler +Name[nds]=Schriftoortdateien +Name[ne]=फन्ट फाइल +Name[nl]=Lettertypebestanden +Name[nn]=Skriftfiler +Name[nso]=Difaele tsa Fonto +Name[pa]=ਫੋਂਟ ਫਾਇਲਾਂ +Name[pl]=Pliki czcionek +Name[pt]=Ficheiros de Tipos de Letra +Name[pt_BR]=Arquivos de fonte +Name[ro]=Fișiere font +Name[ru]=Файлы шрифтов +Name[rw]=Amadosiye y'Imyandikire +Name[se]=Fontafiillat +Name[sk]=Súbory písiem +Name[sl]=Datoteke s pisavami +Name[sr]=Фајлови фонтова +Name[sr@Latn]=Fajlovi fontova +Name[sv]=Teckensnittsfiler +Name[ta]=எழுத்துரு கோப்புகள் +Name[tg]=Файлҳои ҳарф +Name[th]=แฟ้มแบบอักษร +Name[tr]=Yazıtipi Dosyaları +Name[tt]=Yazu Biremnäre +Name[uk]=Файли шрифтів +Name[uz]=Shrift-fayllari +Name[uz@cyrillic]=Шрифт-файллари +Name[ven]=Dzifaela dza Fontu +Name[vi]=Tập tin Phông chữ +Name[wa]=Fitchîs fontes +Name[xh]=Iifayile Zohlobo lwamagama +Name[zh_CN]=字体文件 +Name[zh_TW]=字型檔案 +Name[zu]=Amafayela ohlobo lwamagama +ServiceTypes=ThumbCreator +MimeTypes=application/x-font-ttf,application/x-font-type1,application/x-font-bdf,application/x-font-pcf,application/x-font-otf,application/x-font-ttc +X-TDE-Library=fontthumbnail +CacheThumbnail=false |