diff options
Diffstat (limited to 'kcontrol/kfontinst/thumbnail')
-rw-r--r-- | kcontrol/kfontinst/thumbnail/FontThumbnail.cpp | 73 | ||||
-rw-r--r-- | kcontrol/kfontinst/thumbnail/FontThumbnail.h | 55 | ||||
-rw-r--r-- | kcontrol/kfontinst/thumbnail/Makefile.am | 14 | ||||
-rw-r--r-- | kcontrol/kfontinst/thumbnail/fontthumbnail.desktop | 85 |
4 files changed, 227 insertions, 0 deletions
diff --git a/kcontrol/kfontinst/thumbnail/FontThumbnail.cpp b/kcontrol/kfontinst/thumbnail/FontThumbnail.cpp new file mode 100644 index 000000000..86794377b --- /dev/null +++ b/kcontrol/kfontinst/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 <qimage.h> +#include <qbitmap.h> +#include <qpainter.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() +{ + KGlobal::locale()->insertCatalogue(KFI_CATALOGUE); +} + +bool CFontThumbnail::create(const QString &path, int width, int height, QImage &img) +{ + QPixmap 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/kfontinst/thumbnail/FontThumbnail.h b/kcontrol/kfontinst/thumbnail/FontThumbnail.h new file mode 100644 index 000000000..c2d1294e4 --- /dev/null +++ b/kcontrol/kfontinst/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 <kio/thumbcreator.h> +#include "FcEngine.h" + +namespace KFI +{ + +class CFontThumbnail : public ThumbCreator +{ + public: + + CFontThumbnail(); + ~CFontThumbnail() {} + + bool create(const QString &path, int width, int height, QImage &img); + Flags flags() const; + + private: + + CFcEngine itsEngine; +}; + +} + +#endif diff --git a/kcontrol/kfontinst/thumbnail/Makefile.am b/kcontrol/kfontinst/thumbnail/Makefile.am new file mode 100644 index 000000000..c7608e843 --- /dev/null +++ b/kcontrol/kfontinst/thumbnail/Makefile.am @@ -0,0 +1,14 @@ +kde_module_LTLIBRARIES = fontthumbnail.la + +fontthumbnail_la_SOURCES = FontThumbnail.cpp +fontthumbnail_la_LIBADD = $(LIBFREETYPE_LIBS) $(LIB_KDECORE) $(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/kfontinst/thumbnail/fontthumbnail.desktop b/kcontrol/kfontinst/thumbnail/fontthumbnail.desktop new file mode 100644 index 000000000..cdda5c4d1 --- /dev/null +++ b/kcontrol/kfontinst/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-KDE-Library=fontthumbnail +CacheThumbnail=false |