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 --- CMakeLists.txt | 18 +- Makefile.am.in | 2 +- README | 2 +- kamera/CMakeLists.txt | 2 +- kamera/Makefile.am | 2 +- kamera/kcontrol/CMakeLists.txt | 2 +- kamera/kcontrol/kamera.desktop | 2 +- kamera/kcontrol/kameradevice.cpp | 2 +- kamera/kioslave/CMakeLists.txt | 37 - kamera/kioslave/Makefile.am | 17 - kamera/kioslave/camera.protocol | 16 - kamera/kioslave/kamera.cpp | 1074 ------------------- kamera/kioslave/kamera.h | 82 -- kamera/tdeioslave/CMakeLists.txt | 37 + kamera/tdeioslave/Makefile.am | 17 + kamera/tdeioslave/camera.protocol | 16 + kamera/tdeioslave/kamera.cpp | 1074 +++++++++++++++++++ kamera/tdeioslave/kamera.h | 82 ++ kcoloredit/CMakeLists.txt | 2 +- kcoloredit/kcoloredit.cpp | 4 +- kcoloredit/loadpalettedlg.cpp | 2 +- kdvi/dviRenderer.cpp | 6 +- kdvi/dviRenderer_export.cpp | 6 +- kdvi/infodialog.cpp | 2 +- kdvi/kdvi_multipage.cpp | 4 +- kdvi/kdvi_multipage_texthandling.cpp | 2 +- kdvi/prefs.kcfgc | 2 +- kfax/kfax.cpp | 10 +- kfaxview/CMakeLists.txt | 2 +- kfaxview/faxmultipage.cpp | 2 +- kfile-plugins/CMakeLists.txt | 31 - kfile-plugins/Makefile.am | 14 - kfile-plugins/RETURNED_ITEMS | 245 ----- kfile-plugins/bmp/CMakeLists.txt | 34 - kfile-plugins/bmp/Makefile.am | 22 - kfile-plugins/bmp/kfile_bmp.cpp | 174 ---- kfile-plugins/bmp/kfile_bmp.desktop | 66 -- kfile-plugins/bmp/kfile_bmp.h | 38 - kfile-plugins/configure.in.bot | 32 - kfile-plugins/dds/CMakeLists.txt | 35 - kfile-plugins/dds/Makefile.am | 22 - kfile-plugins/dds/kfile_dds.cpp | 317 ------ kfile-plugins/dds/kfile_dds.desktop | 53 - kfile-plugins/dds/kfile_dds.h | 38 - kfile-plugins/dependencies/CMakeLists.txt | 14 - kfile-plugins/dependencies/Makefile.am | 1 - .../dependencies/poppler-tqt/CMakeLists.txt | 54 - .../dependencies/poppler-tqt/ConfigureChecks.cmake | 21 - kfile-plugins/dependencies/poppler-tqt/Makefile.am | 40 - .../dependencies/poppler-tqt/poppler-document.cc | 341 ------ .../dependencies/poppler-tqt/poppler-fontinfo.cc | 83 -- .../dependencies/poppler-tqt/poppler-link-qt3.h | 188 ---- .../dependencies/poppler-tqt/poppler-link.cc | 267 ----- .../poppler-tqt/poppler-page-transition-private.h | 33 - .../poppler-tqt/poppler-page-transition.cc | 95 -- .../poppler-tqt/poppler-page-transition.h | 146 --- .../dependencies/poppler-tqt/poppler-page.cc | 370 ------- .../dependencies/poppler-tqt/poppler-private.cc | 147 --- .../dependencies/poppler-tqt/poppler-private.h | 97 -- .../dependencies/poppler-tqt/poppler-qt.h | 310 ------ .../dependencies/poppler-tqt/poppler-tqt.pc.cmake | 12 - .../dependencies/poppler-tqt/test-poppler-qt.cpp | 122 --- kfile-plugins/dvi/CMakeLists.txt | 35 - kfile-plugins/dvi/Makefile.am | 22 - kfile-plugins/dvi/kfile_dvi.cpp | 150 --- kfile-plugins/dvi/kfile_dvi.desktop | 60 -- kfile-plugins/dvi/kfile_dvi.h | 38 - kfile-plugins/exr/CMakeLists.txt | 38 - kfile-plugins/exr/ConfigureChecks.cmake | 16 - kfile-plugins/exr/Makefile.am | 25 - kfile-plugins/exr/configure.in.in | 14 - kfile-plugins/exr/kfile_exr.cpp | 393 ------- kfile-plugins/exr/kfile_exr.desktop | 57 -- kfile-plugins/exr/kfile_exr.h | 40 - kfile-plugins/gif/CMakeLists.txt | 34 - kfile-plugins/gif/Makefile.am | 24 - kfile-plugins/gif/README | 10 - kfile-plugins/gif/gif-info.1 | 25 - kfile-plugins/gif/gif-info.c | 561 ---------- kfile-plugins/gif/kfile_gif.cpp | 122 --- kfile-plugins/gif/kfile_gif.desktop | 65 -- kfile-plugins/gif/kfile_gif.h | 38 - kfile-plugins/ico/CMakeLists.txt | 35 - kfile-plugins/ico/Makefile.am | 22 - kfile-plugins/ico/kfile_ico.cpp | 148 --- kfile-plugins/ico/kfile_ico.desktop | 65 -- kfile-plugins/ico/kfile_ico.h | 38 - kfile-plugins/jpeg/CMakeLists.txt | 35 - kfile-plugins/jpeg/Makefile.am | 24 - kfile-plugins/jpeg/README | 35 - kfile-plugins/jpeg/exif.cpp | 961 ----------------- kfile-plugins/jpeg/exif.h | 127 --- kfile-plugins/jpeg/kfile_jpeg.cpp | 531 ---------- kfile-plugins/jpeg/kfile_jpeg.desktop | 64 -- kfile-plugins/jpeg/kfile_jpeg.h | 44 - kfile-plugins/jpeg/kfile_setcomment.cpp | 536 ---------- kfile-plugins/pcx/CMakeLists.txt | 35 - kfile-plugins/pcx/Makefile.am | 21 - kfile-plugins/pcx/kfile_pcx.cpp | 122 --- kfile-plugins/pcx/kfile_pcx.desktop | 62 -- kfile-plugins/pcx/kfile_pcx.h | 89 -- kfile-plugins/pdf/CMakeLists.txt | 36 - kfile-plugins/pdf/Makefile.am | 22 - kfile-plugins/pdf/configure.in.in | 16 - kfile-plugins/pdf/kfile_pdf.cpp | 104 -- kfile-plugins/pdf/kfile_pdf.desktop | 64 -- kfile-plugins/pdf/kfile_pdf.h | 39 - kfile-plugins/png/CMakeLists.txt | 34 - kfile-plugins/png/Makefile.am | 22 - kfile-plugins/png/kfile_png.cpp | 315 ------ kfile-plugins/png/kfile_png.desktop | 65 -- kfile-plugins/png/kfile_png.h | 40 - kfile-plugins/pnm/CMakeLists.txt | 35 - kfile-plugins/pnm/Makefile.am | 22 - kfile-plugins/pnm/kfile_pnm.cpp | 137 --- kfile-plugins/pnm/kfile_pnm.desktop | 60 -- kfile-plugins/pnm/kfile_pnm.h | 40 - kfile-plugins/ps/CMakeLists.txt | 46 - kfile-plugins/ps/Makefile.am | 26 - kfile-plugins/ps/gscreator.cpp | 619 ----------- kfile-plugins/ps/gscreator.h | 42 - kfile-plugins/ps/gsthumbnail.desktop | 60 -- kfile-plugins/ps/kfile_ps.cpp | 124 --- kfile-plugins/ps/kfile_ps.desktop | 66 -- kfile-plugins/ps/kfile_ps.h | 51 - kfile-plugins/raw/CMakeLists.txt | 35 - kfile-plugins/raw/Makefile.am | 19 - kfile-plugins/raw/kcamerarawplugin.cpp | 141 --- kfile-plugins/raw/kcamerarawplugin.h | 39 - kfile-plugins/raw/kfile_raw.desktop | 53 - kfile-plugins/raw/parse.c | 1080 -------------------- kfile-plugins/rgb/CMakeLists.txt | 35 - kfile-plugins/rgb/Makefile.am | 22 - kfile-plugins/rgb/kfile_rgb.cpp | 208 ---- kfile-plugins/rgb/kfile_rgb.desktop | 61 -- kfile-plugins/rgb/kfile_rgb.h | 42 - kfile-plugins/tga/CMakeLists.txt | 35 - kfile-plugins/tga/Makefile.am | 22 - kfile-plugins/tga/kfile_tga.cpp | 165 --- kfile-plugins/tga/kfile_tga.desktop | 64 -- kfile-plugins/tga/kfile_tga.h | 38 - kfile-plugins/tiff/CMakeLists.txt | 37 - kfile-plugins/tiff/ConfigureChecks.cmake | 21 - kfile-plugins/tiff/Makefile.am | 21 - kfile-plugins/tiff/configure.in.in | 3 - kfile-plugins/tiff/kfile_tiff.cpp | 299 ------ kfile-plugins/tiff/kfile_tiff.desktop | 67 -- kfile-plugins/tiff/kfile_tiff.h | 43 - kfile-plugins/xbm/CMakeLists.txt | 35 - kfile-plugins/xbm/Makefile.am | 22 - kfile-plugins/xbm/kfile_xbm.cpp | 128 --- kfile-plugins/xbm/kfile_xbm.desktop | 65 -- kfile-plugins/xbm/kfile_xbm.h | 43 - kfile-plugins/xpm/CMakeLists.txt | 35 - kfile-plugins/xpm/Makefile.am | 21 - kfile-plugins/xpm/kfile_xpm.cpp | 71 -- kfile-plugins/xpm/kfile_xpm.desktop | 53 - kfile-plugins/xpm/kfile_xpm.h | 46 - kgamma/kcmkgamma/kgamma.cpp | 2 +- kgamma/kcmkgamma/kgamma.desktop | 2 +- kghostview/Makefile.am | 2 +- kghostview/displayoptions.cpp | 2 +- kghostview/kgv_miniwidget.cpp | 2 +- kghostview/kgv_view.cpp | 4 +- kghostview/kgv_view.h | 2 +- kghostview/kgvconfigdialog.cpp | 6 +- kghostview/kgvdocument.cpp | 6 +- kghostview/kgvshell.cpp | 2 +- kiconedit/CMakeLists.txt | 2 +- kiconedit/kicon.cpp | 4 +- kiconedit/kiconconfig.cpp | 2 +- kiconedit/kiconedit.cpp | 2 +- kiconedit/knew.cpp | 2 +- kiconedit/main.cpp | 2 +- kiconedit/properties.cpp | 2 +- kmrml/README | 2 +- kmrml/kmrml/CMakeLists.txt | 2 +- kmrml/kmrml/kcontrol/CMakeLists.txt | 2 +- kmrml/kmrml/kcontrol/indextest.cpp | 2 +- kmrml/kmrml/kcontrol/kcmkmrml.desktop | 2 +- kmrml/kmrml/kcontrol/mainpage.cpp | 4 +- kmrml/kmrml/lib/kmrml_config.cpp | 2 +- kmrml/kmrml/loader.cpp | 2 +- kmrml/kmrml/loader.h | 2 +- kmrml/kmrml/mrml.cpp | 2 +- kmrml/kmrml/mrml.h | 2 +- kmrml/kmrml/mrml.protocol | 2 +- kmrml/kmrml/mrml_part.cpp | 8 +- kmrml/kmrml/mrmlsearch.cpp | 4 +- kmrml/kmrml/server/CMakeLists.txt | 2 +- kolourpaint/kpcommandhistory.cpp | 2 +- kolourpaint/kpdocument.cpp | 2 +- kolourpaint/kpdocumentsaveoptions.cpp | 2 +- kolourpaint/kpdocumentsaveoptionswidget.cpp | 2 +- kolourpaint/kpmainwindow.cpp | 2 +- kolourpaint/kpmainwindow_file.cpp | 6 +- kolourpaint/kpmainwindow_help.cpp | 4 +- kolourpaint/kpmainwindow_image.cpp | 2 +- kolourpaint/kpmainwindow_settings.cpp | 2 +- kolourpaint/kpmainwindow_text.cpp | 2 +- kolourpaint/kpmainwindow_tools.cpp | 2 +- kolourpaint/kpmainwindow_view.cpp | 2 +- kolourpaint/pixmapfx/kpeffectflatten.cpp | 2 +- kolourpaint/pixmapfx/kpeffectsdialog.cpp | 2 +- kolourpaint/pixmapfx/kppixmapfx.cpp | 2 +- kolourpaint/tools/kptoolresizescale.cpp | 2 +- kolourpaint/widgets/kpcolortoolbar.cpp | 2 +- kolourpaint/widgets/kptooltoolbar.cpp | 2 +- kolourpaint/widgets/kptoolwidgetbase.cpp | 2 +- kooka/CHANGES | 2 +- kooka/imageselectline.cpp | 2 +- kooka/img_saver.cpp | 10 +- kooka/imgnamecombo.cpp | 2 +- kooka/kocrbase.cpp | 8 +- kooka/kocrbase.h | 2 +- kooka/kocrgocr.cpp | 2 +- kooka/kocrkadmos.cpp | 2 +- kooka/kocrocrad.cpp | 2 +- kooka/kooka.cpp | 6 +- kooka/kookaimage.cpp | 2 +- kooka/kookaimage.h | 2 +- kooka/kookapref.cpp | 2 +- kooka/kookaview.cpp | 2 +- kooka/ksaneocr.cpp | 2 +- kooka/ocrresedit.cpp | 2 +- kooka/scanpackager.cpp | 24 +- kooka/scanpackager.h | 8 +- kooka/thumbview.cpp | 8 +- kooka/thumbview.h | 6 +- kooka/thumbviewitem.cpp | 4 +- kooka/thumbviewitem.h | 6 +- kpdf/conf/preferencesdialog.h | 2 +- kpdf/part.cpp | 6 +- kpdf/shell/shell.cpp | 4 +- kpdf/ui/pageview.cpp | 2 +- kpovmodeler/kdoc.rules | 2 +- kpovmodeler/pmblendmapmodifiersedit.cpp | 2 +- kpovmodeler/pmbumpmapedit.cpp | 2 +- kpovmodeler/pmcontrolpoint.cpp | 2 +- kpovmodeler/pmdialogeditbase.cpp | 2 +- kpovmodeler/pmdockwidget.cpp | 2 +- kpovmodeler/pmdocumentationmap.cpp | 2 +- kpovmodeler/pmerrordialog.cpp | 2 +- kpovmodeler/pmfiledialog.cpp | 2 +- kpovmodeler/pmfiledialog.h | 2 +- kpovmodeler/pmglview.cpp | 2 +- kpovmodeler/pmheightfieldedit.cpp | 2 +- kpovmodeler/pmimagemapedit.cpp | 2 +- kpovmodeler/pmlibrarybrowser.cpp | 4 +- kpovmodeler/pmlibraryentrypreview.cpp | 2 +- kpovmodeler/pmlibraryhandleedit.cpp | 4 +- kpovmodeler/pmlibraryiconview.cpp | 2 +- kpovmodeler/pmlibrarymanager.cpp | 2 +- kpovmodeler/pmmaterialmapedit.cpp | 2 +- kpovmodeler/pmobjectlibrarysettings.cpp | 2 +- kpovmodeler/pmpalettevalueedit.cpp | 2 +- kpovmodeler/pmpart.cpp | 6 +- kpovmodeler/pmpatternedit.cpp | 2 +- kpovmodeler/pmpluginmanager.cpp | 2 +- kpovmodeler/pmpovrayoutputwidget.cpp | 2 +- kpovmodeler/pmpovrayrenderwidget.cpp | 2 +- kpovmodeler/pmpovraysettings.cpp | 2 +- kpovmodeler/pmpovraywidget.cpp | 4 +- kpovmodeler/pmrendermanager.cpp | 2 +- kpovmodeler/pmrendermodesdialog.cpp | 4 +- kpovmodeler/pmsettingsdialog.cpp | 2 +- kpovmodeler/pmshell.cpp | 2 +- kpovmodeler/pmtextedit.cpp | 2 +- kpovmodeler/pmview.cpp | 2 +- kpovmodeler/pmviewlayoutmanager.cpp | 2 +- kruler/klineal.cpp | 2 +- ksnapshot/ksnapshot.cpp | 4 +- ksvg/core/KSVGLoader.cpp | 4 +- ksvg/impl/SVGColorProfileElementImpl.cc | 2 +- ksvg/impl/SVGScriptElementImpl.cc | 2 +- ksvg/impl/SVGScriptElementImpl.h | 2 +- ksvg/plugin/ksvg_plugin.cpp | 2 +- ksvg/plugin/svgcreator.h | 2 +- kuickshow/ChangeLog | 26 +- kuickshow/src/filefinder.cpp | 2 +- kuickshow/src/filewidget.cpp | 2 +- kuickshow/src/imagewindow.cpp | 6 +- kuickshow/src/imdata.cpp | 2 +- kuickshow/src/imlibwidget.cpp | 2 +- kuickshow/src/kuickconfigdlg.cpp | 2 +- kuickshow/src/kuickdata.cpp | 2 +- kuickshow/src/kuickfile.cpp | 4 +- kuickshow/src/kuickshow.cpp | 8 +- kuickshow/src/kuickshow.h | 2 +- kview/config/CMakeLists.txt | 2 +- kview/config/Makefile.am | 2 +- kview/config/kviewconfmodules.cpp | 2 +- kview/config/plugins/CMakeLists.txt | 2 +- kview/config/plugins/Makefile.am | 2 +- kview/kview.cpp | 2 +- kview/kviewcanvas/config/CMakeLists.txt | 2 +- kview/kviewcanvas/config/Makefile.am | 2 +- kview/kviewcanvas/kimagecanvas.cpp | 2 +- kview/kviewviewer/config/CMakeLists.txt | 2 +- kview/kviewviewer/config/Makefile.am | 2 +- kview/kviewviewer/kviewviewer.cpp | 4 +- kview/modules/browser/kmyfileitemlist.cpp | 2 +- kview/modules/browser/kviewbrowser.h | 2 +- kview/modules/presenter/CMakeLists.txt | 2 +- kview/modules/presenter/config/CMakeLists.txt | 2 +- kview/modules/presenter/config/Makefile.am | 2 +- .../presenter/config/kviewpresenterconfig.cpp | 2 +- kview/modules/presenter/imagelistdialog.ui | 4 +- kview/modules/presenter/kviewpresenter.cpp | 4 +- .../modules/presenter/kviewpresenterconfmodule.cpp | 2 +- kview/photobook/photobook.h | 2 +- kviewshell/kviewpart.cpp | 8 +- kviewshell/kviewshell.cpp | 2 +- kviewshell/kvsprefs.kcfgc | 2 +- kviewshell/plugins/djvu/djvumultipage.cpp | 2 +- kviewshell/plugins/djvu/prefs.kcfgc | 2 +- kviewshell/tdemultipage.cpp | 4 +- libkscan/CMakeLists.txt | 2 +- libkscan/devselector.cpp | 2 +- libkscan/kscandevice.cpp | 2 +- libkscan/kscanoptset.cpp | 2 +- libkscan/previewer.cpp | 2 +- libkscan/scandialog.cpp | 2 +- libkscan/scanparams.cpp | 2 +- tdefile-plugins/CMakeLists.txt | 31 + tdefile-plugins/Makefile.am | 14 + tdefile-plugins/RETURNED_ITEMS | 245 +++++ tdefile-plugins/bmp/CMakeLists.txt | 34 + tdefile-plugins/bmp/Makefile.am | 22 + tdefile-plugins/bmp/tdefile_bmp.cpp | 174 ++++ tdefile-plugins/bmp/tdefile_bmp.desktop | 66 ++ tdefile-plugins/bmp/tdefile_bmp.h | 38 + tdefile-plugins/configure.in.bot | 32 + tdefile-plugins/dds/CMakeLists.txt | 35 + tdefile-plugins/dds/Makefile.am | 22 + tdefile-plugins/dds/tdefile_dds.cpp | 317 ++++++ tdefile-plugins/dds/tdefile_dds.desktop | 53 + tdefile-plugins/dds/tdefile_dds.h | 38 + tdefile-plugins/dependencies/CMakeLists.txt | 14 + tdefile-plugins/dependencies/Makefile.am | 1 + .../dependencies/poppler-tqt/CMakeLists.txt | 54 + .../dependencies/poppler-tqt/ConfigureChecks.cmake | 21 + .../dependencies/poppler-tqt/Makefile.am | 40 + .../dependencies/poppler-tqt/poppler-document.cc | 341 ++++++ .../dependencies/poppler-tqt/poppler-fontinfo.cc | 83 ++ .../dependencies/poppler-tqt/poppler-link-qt3.h | 188 ++++ .../dependencies/poppler-tqt/poppler-link.cc | 267 +++++ .../poppler-tqt/poppler-page-transition-private.h | 33 + .../poppler-tqt/poppler-page-transition.cc | 95 ++ .../poppler-tqt/poppler-page-transition.h | 146 +++ .../dependencies/poppler-tqt/poppler-page.cc | 370 +++++++ .../dependencies/poppler-tqt/poppler-private.cc | 147 +++ .../dependencies/poppler-tqt/poppler-private.h | 97 ++ .../dependencies/poppler-tqt/poppler-qt.h | 310 ++++++ .../dependencies/poppler-tqt/poppler-tqt.pc.cmake | 12 + .../dependencies/poppler-tqt/test-poppler-qt.cpp | 122 +++ tdefile-plugins/dvi/CMakeLists.txt | 35 + tdefile-plugins/dvi/Makefile.am | 22 + tdefile-plugins/dvi/tdefile_dvi.cpp | 150 +++ tdefile-plugins/dvi/tdefile_dvi.desktop | 60 ++ tdefile-plugins/dvi/tdefile_dvi.h | 38 + tdefile-plugins/exr/CMakeLists.txt | 38 + tdefile-plugins/exr/ConfigureChecks.cmake | 16 + tdefile-plugins/exr/Makefile.am | 25 + tdefile-plugins/exr/configure.in.in | 14 + tdefile-plugins/exr/tdefile_exr.cpp | 393 +++++++ tdefile-plugins/exr/tdefile_exr.desktop | 57 ++ tdefile-plugins/exr/tdefile_exr.h | 40 + tdefile-plugins/gif/CMakeLists.txt | 34 + tdefile-plugins/gif/Makefile.am | 24 + tdefile-plugins/gif/README | 10 + tdefile-plugins/gif/gif-info.1 | 25 + tdefile-plugins/gif/gif-info.c | 561 ++++++++++ tdefile-plugins/gif/tdefile_gif.cpp | 122 +++ tdefile-plugins/gif/tdefile_gif.desktop | 65 ++ tdefile-plugins/gif/tdefile_gif.h | 38 + tdefile-plugins/ico/CMakeLists.txt | 35 + tdefile-plugins/ico/Makefile.am | 22 + tdefile-plugins/ico/tdefile_ico.cpp | 148 +++ tdefile-plugins/ico/tdefile_ico.desktop | 65 ++ tdefile-plugins/ico/tdefile_ico.h | 38 + tdefile-plugins/jpeg/CMakeLists.txt | 35 + tdefile-plugins/jpeg/Makefile.am | 24 + tdefile-plugins/jpeg/README | 35 + tdefile-plugins/jpeg/exif.cpp | 961 +++++++++++++++++ tdefile-plugins/jpeg/exif.h | 127 +++ tdefile-plugins/jpeg/tdefile_jpeg.cpp | 531 ++++++++++ tdefile-plugins/jpeg/tdefile_jpeg.desktop | 64 ++ tdefile-plugins/jpeg/tdefile_jpeg.h | 44 + tdefile-plugins/jpeg/tdefile_setcomment.cpp | 536 ++++++++++ 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 ++ tdefile-plugins/pdf/CMakeLists.txt | 36 + tdefile-plugins/pdf/Makefile.am | 22 + tdefile-plugins/pdf/configure.in.in | 16 + tdefile-plugins/pdf/tdefile_pdf.cpp | 104 ++ tdefile-plugins/pdf/tdefile_pdf.desktop | 64 ++ tdefile-plugins/pdf/tdefile_pdf.h | 39 + tdefile-plugins/png/CMakeLists.txt | 34 + tdefile-plugins/png/Makefile.am | 22 + tdefile-plugins/png/tdefile_png.cpp | 315 ++++++ tdefile-plugins/png/tdefile_png.desktop | 65 ++ tdefile-plugins/png/tdefile_png.h | 40 + tdefile-plugins/pnm/CMakeLists.txt | 35 + tdefile-plugins/pnm/Makefile.am | 22 + tdefile-plugins/pnm/tdefile_pnm.cpp | 137 +++ tdefile-plugins/pnm/tdefile_pnm.desktop | 60 ++ tdefile-plugins/pnm/tdefile_pnm.h | 40 + tdefile-plugins/ps/CMakeLists.txt | 46 + tdefile-plugins/ps/Makefile.am | 26 + tdefile-plugins/ps/gscreator.cpp | 619 +++++++++++ tdefile-plugins/ps/gscreator.h | 42 + tdefile-plugins/ps/gsthumbnail.desktop | 60 ++ tdefile-plugins/ps/tdefile_ps.cpp | 124 +++ tdefile-plugins/ps/tdefile_ps.desktop | 66 ++ tdefile-plugins/ps/tdefile_ps.h | 51 + tdefile-plugins/raw/CMakeLists.txt | 35 + tdefile-plugins/raw/Makefile.am | 19 + tdefile-plugins/raw/kcamerarawplugin.cpp | 141 +++ tdefile-plugins/raw/kcamerarawplugin.h | 39 + tdefile-plugins/raw/parse.c | 1080 ++++++++++++++++++++ tdefile-plugins/raw/tdefile_raw.desktop | 53 + tdefile-plugins/rgb/CMakeLists.txt | 35 + tdefile-plugins/rgb/Makefile.am | 22 + tdefile-plugins/rgb/tdefile_rgb.cpp | 208 ++++ tdefile-plugins/rgb/tdefile_rgb.desktop | 61 ++ tdefile-plugins/rgb/tdefile_rgb.h | 42 + tdefile-plugins/tga/CMakeLists.txt | 35 + tdefile-plugins/tga/Makefile.am | 22 + tdefile-plugins/tga/tdefile_tga.cpp | 165 +++ tdefile-plugins/tga/tdefile_tga.desktop | 64 ++ tdefile-plugins/tga/tdefile_tga.h | 38 + tdefile-plugins/tiff/CMakeLists.txt | 37 + tdefile-plugins/tiff/ConfigureChecks.cmake | 21 + tdefile-plugins/tiff/Makefile.am | 21 + tdefile-plugins/tiff/configure.in.in | 3 + tdefile-plugins/tiff/tdefile_tiff.cpp | 299 ++++++ tdefile-plugins/tiff/tdefile_tiff.desktop | 67 ++ tdefile-plugins/tiff/tdefile_tiff.h | 43 + tdefile-plugins/xbm/CMakeLists.txt | 35 + tdefile-plugins/xbm/Makefile.am | 22 + tdefile-plugins/xbm/tdefile_xbm.cpp | 128 +++ tdefile-plugins/xbm/tdefile_xbm.desktop | 65 ++ tdefile-plugins/xbm/tdefile_xbm.h | 43 + tdefile-plugins/xpm/CMakeLists.txt | 35 + tdefile-plugins/xpm/Makefile.am | 21 + tdefile-plugins/xpm/tdefile_xpm.cpp | 71 ++ tdefile-plugins/xpm/tdefile_xpm.desktop | 53 + tdefile-plugins/xpm/tdefile_xpm.h | 46 + 452 files changed, 14888 insertions(+), 14888 deletions(-) delete mode 100644 kamera/kioslave/CMakeLists.txt delete mode 100644 kamera/kioslave/Makefile.am delete mode 100644 kamera/kioslave/camera.protocol delete mode 100644 kamera/kioslave/kamera.cpp delete mode 100644 kamera/kioslave/kamera.h create mode 100644 kamera/tdeioslave/CMakeLists.txt create mode 100644 kamera/tdeioslave/Makefile.am create mode 100644 kamera/tdeioslave/camera.protocol create mode 100644 kamera/tdeioslave/kamera.cpp create mode 100644 kamera/tdeioslave/kamera.h delete mode 100644 kfile-plugins/CMakeLists.txt delete mode 100644 kfile-plugins/Makefile.am delete mode 100644 kfile-plugins/RETURNED_ITEMS delete mode 100644 kfile-plugins/bmp/CMakeLists.txt delete mode 100644 kfile-plugins/bmp/Makefile.am delete mode 100644 kfile-plugins/bmp/kfile_bmp.cpp delete mode 100644 kfile-plugins/bmp/kfile_bmp.desktop delete mode 100644 kfile-plugins/bmp/kfile_bmp.h delete mode 100644 kfile-plugins/configure.in.bot delete mode 100644 kfile-plugins/dds/CMakeLists.txt delete mode 100644 kfile-plugins/dds/Makefile.am delete mode 100644 kfile-plugins/dds/kfile_dds.cpp delete mode 100644 kfile-plugins/dds/kfile_dds.desktop delete mode 100644 kfile-plugins/dds/kfile_dds.h delete mode 100644 kfile-plugins/dependencies/CMakeLists.txt delete mode 100644 kfile-plugins/dependencies/Makefile.am delete mode 100644 kfile-plugins/dependencies/poppler-tqt/CMakeLists.txt delete mode 100644 kfile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake delete mode 100644 kfile-plugins/dependencies/poppler-tqt/Makefile.am delete mode 100644 kfile-plugins/dependencies/poppler-tqt/poppler-document.cc delete mode 100644 kfile-plugins/dependencies/poppler-tqt/poppler-fontinfo.cc delete mode 100644 kfile-plugins/dependencies/poppler-tqt/poppler-link-qt3.h delete mode 100644 kfile-plugins/dependencies/poppler-tqt/poppler-link.cc delete mode 100644 kfile-plugins/dependencies/poppler-tqt/poppler-page-transition-private.h delete mode 100644 kfile-plugins/dependencies/poppler-tqt/poppler-page-transition.cc delete mode 100644 kfile-plugins/dependencies/poppler-tqt/poppler-page-transition.h delete mode 100644 kfile-plugins/dependencies/poppler-tqt/poppler-page.cc delete mode 100644 kfile-plugins/dependencies/poppler-tqt/poppler-private.cc delete mode 100644 kfile-plugins/dependencies/poppler-tqt/poppler-private.h delete mode 100644 kfile-plugins/dependencies/poppler-tqt/poppler-qt.h delete mode 100644 kfile-plugins/dependencies/poppler-tqt/poppler-tqt.pc.cmake delete mode 100644 kfile-plugins/dependencies/poppler-tqt/test-poppler-qt.cpp delete mode 100644 kfile-plugins/dvi/CMakeLists.txt delete mode 100644 kfile-plugins/dvi/Makefile.am delete mode 100644 kfile-plugins/dvi/kfile_dvi.cpp delete mode 100644 kfile-plugins/dvi/kfile_dvi.desktop delete mode 100644 kfile-plugins/dvi/kfile_dvi.h delete mode 100644 kfile-plugins/exr/CMakeLists.txt delete mode 100644 kfile-plugins/exr/ConfigureChecks.cmake delete mode 100644 kfile-plugins/exr/Makefile.am delete mode 100644 kfile-plugins/exr/configure.in.in delete mode 100644 kfile-plugins/exr/kfile_exr.cpp delete mode 100644 kfile-plugins/exr/kfile_exr.desktop delete mode 100644 kfile-plugins/exr/kfile_exr.h delete mode 100644 kfile-plugins/gif/CMakeLists.txt delete mode 100644 kfile-plugins/gif/Makefile.am delete mode 100644 kfile-plugins/gif/README delete mode 100644 kfile-plugins/gif/gif-info.1 delete mode 100644 kfile-plugins/gif/gif-info.c delete mode 100644 kfile-plugins/gif/kfile_gif.cpp delete mode 100644 kfile-plugins/gif/kfile_gif.desktop delete mode 100644 kfile-plugins/gif/kfile_gif.h delete mode 100644 kfile-plugins/ico/CMakeLists.txt delete mode 100644 kfile-plugins/ico/Makefile.am delete mode 100644 kfile-plugins/ico/kfile_ico.cpp delete mode 100644 kfile-plugins/ico/kfile_ico.desktop delete mode 100644 kfile-plugins/ico/kfile_ico.h delete mode 100644 kfile-plugins/jpeg/CMakeLists.txt delete mode 100644 kfile-plugins/jpeg/Makefile.am delete mode 100644 kfile-plugins/jpeg/README delete mode 100644 kfile-plugins/jpeg/exif.cpp delete mode 100644 kfile-plugins/jpeg/exif.h delete mode 100644 kfile-plugins/jpeg/kfile_jpeg.cpp delete mode 100644 kfile-plugins/jpeg/kfile_jpeg.desktop delete mode 100644 kfile-plugins/jpeg/kfile_jpeg.h delete mode 100644 kfile-plugins/jpeg/kfile_setcomment.cpp delete mode 100644 kfile-plugins/pcx/CMakeLists.txt delete mode 100644 kfile-plugins/pcx/Makefile.am delete mode 100644 kfile-plugins/pcx/kfile_pcx.cpp delete mode 100644 kfile-plugins/pcx/kfile_pcx.desktop delete mode 100644 kfile-plugins/pcx/kfile_pcx.h delete mode 100644 kfile-plugins/pdf/CMakeLists.txt delete mode 100644 kfile-plugins/pdf/Makefile.am delete mode 100644 kfile-plugins/pdf/configure.in.in delete mode 100644 kfile-plugins/pdf/kfile_pdf.cpp delete mode 100644 kfile-plugins/pdf/kfile_pdf.desktop delete mode 100644 kfile-plugins/pdf/kfile_pdf.h delete mode 100644 kfile-plugins/png/CMakeLists.txt delete mode 100644 kfile-plugins/png/Makefile.am delete mode 100644 kfile-plugins/png/kfile_png.cpp delete mode 100644 kfile-plugins/png/kfile_png.desktop delete mode 100644 kfile-plugins/png/kfile_png.h delete mode 100644 kfile-plugins/pnm/CMakeLists.txt delete mode 100644 kfile-plugins/pnm/Makefile.am delete mode 100644 kfile-plugins/pnm/kfile_pnm.cpp delete mode 100644 kfile-plugins/pnm/kfile_pnm.desktop delete mode 100644 kfile-plugins/pnm/kfile_pnm.h delete mode 100644 kfile-plugins/ps/CMakeLists.txt delete mode 100644 kfile-plugins/ps/Makefile.am delete mode 100644 kfile-plugins/ps/gscreator.cpp delete mode 100644 kfile-plugins/ps/gscreator.h delete mode 100644 kfile-plugins/ps/gsthumbnail.desktop delete mode 100644 kfile-plugins/ps/kfile_ps.cpp delete mode 100644 kfile-plugins/ps/kfile_ps.desktop delete mode 100644 kfile-plugins/ps/kfile_ps.h delete mode 100644 kfile-plugins/raw/CMakeLists.txt delete mode 100644 kfile-plugins/raw/Makefile.am delete mode 100644 kfile-plugins/raw/kcamerarawplugin.cpp delete mode 100644 kfile-plugins/raw/kcamerarawplugin.h delete mode 100644 kfile-plugins/raw/kfile_raw.desktop delete mode 100644 kfile-plugins/raw/parse.c delete mode 100644 kfile-plugins/rgb/CMakeLists.txt delete mode 100644 kfile-plugins/rgb/Makefile.am delete mode 100644 kfile-plugins/rgb/kfile_rgb.cpp delete mode 100644 kfile-plugins/rgb/kfile_rgb.desktop delete mode 100644 kfile-plugins/rgb/kfile_rgb.h delete mode 100644 kfile-plugins/tga/CMakeLists.txt delete mode 100644 kfile-plugins/tga/Makefile.am delete mode 100644 kfile-plugins/tga/kfile_tga.cpp delete mode 100644 kfile-plugins/tga/kfile_tga.desktop delete mode 100644 kfile-plugins/tga/kfile_tga.h delete mode 100644 kfile-plugins/tiff/CMakeLists.txt delete mode 100644 kfile-plugins/tiff/ConfigureChecks.cmake delete mode 100644 kfile-plugins/tiff/Makefile.am delete mode 100644 kfile-plugins/tiff/configure.in.in delete mode 100644 kfile-plugins/tiff/kfile_tiff.cpp delete mode 100644 kfile-plugins/tiff/kfile_tiff.desktop delete mode 100644 kfile-plugins/tiff/kfile_tiff.h delete mode 100644 kfile-plugins/xbm/CMakeLists.txt delete mode 100644 kfile-plugins/xbm/Makefile.am delete mode 100644 kfile-plugins/xbm/kfile_xbm.cpp delete mode 100644 kfile-plugins/xbm/kfile_xbm.desktop delete mode 100644 kfile-plugins/xbm/kfile_xbm.h delete mode 100644 kfile-plugins/xpm/CMakeLists.txt delete mode 100644 kfile-plugins/xpm/Makefile.am delete mode 100644 kfile-plugins/xpm/kfile_xpm.cpp delete mode 100644 kfile-plugins/xpm/kfile_xpm.desktop delete mode 100644 kfile-plugins/xpm/kfile_xpm.h create mode 100644 tdefile-plugins/CMakeLists.txt create mode 100644 tdefile-plugins/Makefile.am create mode 100644 tdefile-plugins/RETURNED_ITEMS create mode 100644 tdefile-plugins/bmp/CMakeLists.txt create mode 100644 tdefile-plugins/bmp/Makefile.am create mode 100644 tdefile-plugins/bmp/tdefile_bmp.cpp create mode 100644 tdefile-plugins/bmp/tdefile_bmp.desktop create mode 100644 tdefile-plugins/bmp/tdefile_bmp.h create mode 100644 tdefile-plugins/configure.in.bot create mode 100644 tdefile-plugins/dds/CMakeLists.txt create mode 100644 tdefile-plugins/dds/Makefile.am create mode 100644 tdefile-plugins/dds/tdefile_dds.cpp create mode 100644 tdefile-plugins/dds/tdefile_dds.desktop create mode 100644 tdefile-plugins/dds/tdefile_dds.h create mode 100644 tdefile-plugins/dependencies/CMakeLists.txt create mode 100644 tdefile-plugins/dependencies/Makefile.am create mode 100644 tdefile-plugins/dependencies/poppler-tqt/CMakeLists.txt create mode 100644 tdefile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake create mode 100644 tdefile-plugins/dependencies/poppler-tqt/Makefile.am create mode 100644 tdefile-plugins/dependencies/poppler-tqt/poppler-document.cc create mode 100644 tdefile-plugins/dependencies/poppler-tqt/poppler-fontinfo.cc create mode 100644 tdefile-plugins/dependencies/poppler-tqt/poppler-link-qt3.h create mode 100644 tdefile-plugins/dependencies/poppler-tqt/poppler-link.cc create mode 100644 tdefile-plugins/dependencies/poppler-tqt/poppler-page-transition-private.h create mode 100644 tdefile-plugins/dependencies/poppler-tqt/poppler-page-transition.cc create mode 100644 tdefile-plugins/dependencies/poppler-tqt/poppler-page-transition.h create mode 100644 tdefile-plugins/dependencies/poppler-tqt/poppler-page.cc create mode 100644 tdefile-plugins/dependencies/poppler-tqt/poppler-private.cc create mode 100644 tdefile-plugins/dependencies/poppler-tqt/poppler-private.h create mode 100644 tdefile-plugins/dependencies/poppler-tqt/poppler-qt.h create mode 100644 tdefile-plugins/dependencies/poppler-tqt/poppler-tqt.pc.cmake create mode 100644 tdefile-plugins/dependencies/poppler-tqt/test-poppler-qt.cpp create mode 100644 tdefile-plugins/dvi/CMakeLists.txt create mode 100644 tdefile-plugins/dvi/Makefile.am create mode 100644 tdefile-plugins/dvi/tdefile_dvi.cpp create mode 100644 tdefile-plugins/dvi/tdefile_dvi.desktop create mode 100644 tdefile-plugins/dvi/tdefile_dvi.h create mode 100644 tdefile-plugins/exr/CMakeLists.txt create mode 100644 tdefile-plugins/exr/ConfigureChecks.cmake create mode 100644 tdefile-plugins/exr/Makefile.am create mode 100644 tdefile-plugins/exr/configure.in.in create mode 100644 tdefile-plugins/exr/tdefile_exr.cpp create mode 100644 tdefile-plugins/exr/tdefile_exr.desktop create mode 100644 tdefile-plugins/exr/tdefile_exr.h create mode 100644 tdefile-plugins/gif/CMakeLists.txt create mode 100644 tdefile-plugins/gif/Makefile.am create mode 100644 tdefile-plugins/gif/README create mode 100644 tdefile-plugins/gif/gif-info.1 create mode 100644 tdefile-plugins/gif/gif-info.c create mode 100644 tdefile-plugins/gif/tdefile_gif.cpp create mode 100644 tdefile-plugins/gif/tdefile_gif.desktop create mode 100644 tdefile-plugins/gif/tdefile_gif.h create mode 100644 tdefile-plugins/ico/CMakeLists.txt create mode 100644 tdefile-plugins/ico/Makefile.am create mode 100644 tdefile-plugins/ico/tdefile_ico.cpp create mode 100644 tdefile-plugins/ico/tdefile_ico.desktop create mode 100644 tdefile-plugins/ico/tdefile_ico.h create mode 100644 tdefile-plugins/jpeg/CMakeLists.txt create mode 100644 tdefile-plugins/jpeg/Makefile.am create mode 100644 tdefile-plugins/jpeg/README create mode 100644 tdefile-plugins/jpeg/exif.cpp create mode 100644 tdefile-plugins/jpeg/exif.h create mode 100644 tdefile-plugins/jpeg/tdefile_jpeg.cpp create mode 100644 tdefile-plugins/jpeg/tdefile_jpeg.desktop create mode 100644 tdefile-plugins/jpeg/tdefile_jpeg.h create mode 100644 tdefile-plugins/jpeg/tdefile_setcomment.cpp 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 create mode 100644 tdefile-plugins/pdf/CMakeLists.txt create mode 100644 tdefile-plugins/pdf/Makefile.am create mode 100644 tdefile-plugins/pdf/configure.in.in create mode 100644 tdefile-plugins/pdf/tdefile_pdf.cpp create mode 100644 tdefile-plugins/pdf/tdefile_pdf.desktop create mode 100644 tdefile-plugins/pdf/tdefile_pdf.h create mode 100644 tdefile-plugins/png/CMakeLists.txt create mode 100644 tdefile-plugins/png/Makefile.am create mode 100644 tdefile-plugins/png/tdefile_png.cpp create mode 100644 tdefile-plugins/png/tdefile_png.desktop create mode 100644 tdefile-plugins/png/tdefile_png.h create mode 100644 tdefile-plugins/pnm/CMakeLists.txt create mode 100644 tdefile-plugins/pnm/Makefile.am create mode 100644 tdefile-plugins/pnm/tdefile_pnm.cpp create mode 100644 tdefile-plugins/pnm/tdefile_pnm.desktop create mode 100644 tdefile-plugins/pnm/tdefile_pnm.h create mode 100644 tdefile-plugins/ps/CMakeLists.txt create mode 100644 tdefile-plugins/ps/Makefile.am create mode 100644 tdefile-plugins/ps/gscreator.cpp create mode 100644 tdefile-plugins/ps/gscreator.h create mode 100644 tdefile-plugins/ps/gsthumbnail.desktop create mode 100644 tdefile-plugins/ps/tdefile_ps.cpp create mode 100644 tdefile-plugins/ps/tdefile_ps.desktop create mode 100644 tdefile-plugins/ps/tdefile_ps.h create mode 100644 tdefile-plugins/raw/CMakeLists.txt create mode 100644 tdefile-plugins/raw/Makefile.am create mode 100644 tdefile-plugins/raw/kcamerarawplugin.cpp create mode 100644 tdefile-plugins/raw/kcamerarawplugin.h create mode 100644 tdefile-plugins/raw/parse.c create mode 100644 tdefile-plugins/raw/tdefile_raw.desktop create mode 100644 tdefile-plugins/rgb/CMakeLists.txt create mode 100644 tdefile-plugins/rgb/Makefile.am create mode 100644 tdefile-plugins/rgb/tdefile_rgb.cpp create mode 100644 tdefile-plugins/rgb/tdefile_rgb.desktop create mode 100644 tdefile-plugins/rgb/tdefile_rgb.h create mode 100644 tdefile-plugins/tga/CMakeLists.txt create mode 100644 tdefile-plugins/tga/Makefile.am create mode 100644 tdefile-plugins/tga/tdefile_tga.cpp create mode 100644 tdefile-plugins/tga/tdefile_tga.desktop create mode 100644 tdefile-plugins/tga/tdefile_tga.h create mode 100644 tdefile-plugins/tiff/CMakeLists.txt create mode 100644 tdefile-plugins/tiff/ConfigureChecks.cmake create mode 100644 tdefile-plugins/tiff/Makefile.am create mode 100644 tdefile-plugins/tiff/configure.in.in create mode 100644 tdefile-plugins/tiff/tdefile_tiff.cpp create mode 100644 tdefile-plugins/tiff/tdefile_tiff.desktop create mode 100644 tdefile-plugins/tiff/tdefile_tiff.h create mode 100644 tdefile-plugins/xbm/CMakeLists.txt create mode 100644 tdefile-plugins/xbm/Makefile.am create mode 100644 tdefile-plugins/xbm/tdefile_xbm.cpp create mode 100644 tdefile-plugins/xbm/tdefile_xbm.desktop create mode 100644 tdefile-plugins/xbm/tdefile_xbm.h create mode 100644 tdefile-plugins/xpm/CMakeLists.txt create mode 100644 tdefile-plugins/xpm/Makefile.am create mode 100644 tdefile-plugins/xpm/tdefile_xpm.cpp create mode 100644 tdefile-plugins/xpm/tdefile_xpm.desktop create mode 100644 tdefile-plugins/xpm/tdefile_xpm.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 42794966..f1439b55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,9 +44,9 @@ tde_setup_paths( ) option( WITH_T1LIB "Enable t1lib support" OFF ) option( WITH_PAPER "Enable libpaper support" OFF ) -OPTION( WITH_TIFF "Enable tiff support (kfile-plugins)" OFF ) -OPTION( WITH_OPENEXR "Enable openexr support (kfile-plugins)" OFF ) -OPTION( WITH_PDF "Enable pdf support (kfile-plugins)" OFF ) +OPTION( WITH_TIFF "Enable tiff support (tdefile-plugins)" OFF ) +OPTION( WITH_OPENEXR "Enable openexr support (tdefile-plugins)" OFF ) +OPTION( WITH_PDF "Enable pdf support (tdefile-plugins)" OFF ) ##### options comments ########################## @@ -60,9 +60,9 @@ OPTION( WITH_PDF "Enable pdf support (kfile-plugins)" OFF ) # WITH_PAPER affects kpdf # WITH_PAPER description this library is only used to set some default # parameters of paper according to system settings. -# WITH_TIFF affects kfile-plugins(tiff) -# WITH_OPENEXR affects kfile-plugins(exr) -# WITH_PDF affects kfile-plugins(pdf dependencies/poppler-tqt) +# WITH_TIFF affects tdefile-plugins(tiff) +# WITH_OPENEXR affects tdefile-plugins(exr) +# WITH_PDF affects tdefile-plugins(pdf dependencies/poppler-tqt) # NOTE: It seems that libtiff was planned to be used in # kviewshell(plugins/djvu) but isn't yet implemented @@ -77,7 +77,7 @@ option( BUILD_KCOLOREDIT "Build kcoloredit" ${BUILD_ALL} ) option( BUILD_KDVI "Build kdvi" ${BUILD_ALL} ) option( BUILD_KFAX "Build kfax" ${BUILD_ALL} ) option( BUILD_KFAXVIEW "Build kfaxview" ${BUILD_ALL} ) -option( BUILD_KFILE_PLUGINS "Build kfile-plugins" ${BUILD_ALL} ) +option( BUILD_KFILE_PLUGINS "Build tdefile-plugins" ${BUILD_ALL} ) option( BUILD_KGAMMA "Build kgamma" ${BUILD_ALL} ) option( BUILD_KGHOSTVIEW "Build kghostview" ${BUILD_ALL} ) option( BUILD_KICONEDIT "Build kiconedit" ${BUILD_ALL} ) @@ -113,7 +113,7 @@ set( CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined" ) ##### tdegraphics directories ################### -# kfile-plugins/ps requires dscparse-static library +# tdefile-plugins/ps requires dscparse-static library if( BUILD_KFILE_PLUGINS AND NOT BUILD_KGHOSTVIEW ) add_subdirectory( kghostview/dscparse ) endif( ) @@ -124,7 +124,7 @@ tde_conditional_add_subdirectory( BUILD_KCOLOREDIT kcoloredit ) tde_conditional_add_subdirectory( BUILD_KDVI kdvi ) tde_conditional_add_subdirectory( BUILD_KFAX kfax ) tde_conditional_add_subdirectory( BUILD_KFAXVIEW kfaxview ) -tde_conditional_add_subdirectory( BUILD_KFILE_PLUGINS kfile-plugins ) +tde_conditional_add_subdirectory( BUILD_KFILE_PLUGINS tdefile-plugins ) tde_conditional_add_subdirectory( BUILD_KGAMMA kgamma ) tde_conditional_add_subdirectory( BUILD_KGHOSTVIEW kghostview ) tde_conditional_add_subdirectory( BUILD_KICONEDIT kiconedit ) diff --git a/Makefile.am.in b/Makefile.am.in index dddf1aea..8500f20f 100644 --- a/Makefile.am.in +++ b/Makefile.am.in @@ -5,7 +5,7 @@ AUTOMAKE_OPTIONS = foreign 1.6.1 COMPILE_BEFORE_kooka = libkscan COMPILE_BEFORE_kfaxview = kfax -COMPILE_BEFORE_kfile-plugins = kghostview +COMPILE_BEFORE_tdefile-plugins = kghostview COMPILE_AFTER_kviewshell = kdvi kfaxview DISTCLEANFILES = inst-apps diff --git a/README b/README index 721bcdbc..d27e6b1d 100644 --- a/README +++ b/README @@ -32,7 +32,7 @@ tdegraphics is a collection of graphic oriented applications: * kfaxview An embeddable KPart to display tiffed fax images. -* kfile-plugins +* tdefile-plugins Provide meta information for graphic files. * kghostview diff --git a/kamera/CMakeLists.txt b/kamera/CMakeLists.txt index 700fe6a9..56e7c70d 100644 --- a/kamera/CMakeLists.txt +++ b/kamera/CMakeLists.txt @@ -11,6 +11,6 @@ include( ConfigureChecks.cmake ) -add_subdirectory( kioslave ) +add_subdirectory( tdeioslave ) add_subdirectory( kcontrol ) add_subdirectory( pics ) diff --git a/kamera/Makefile.am b/kamera/Makefile.am index f012f4a1..e7776502 100644 --- a/kamera/Makefile.am +++ b/kamera/Makefile.am @@ -1 +1 @@ -SUBDIRS = kcontrol kioslave pics +SUBDIRS = kcontrol tdeioslave pics diff --git a/kamera/kcontrol/CMakeLists.txt b/kamera/kcontrol/CMakeLists.txt index c4a395ab..c901d4b4 100644 --- a/kamera/kcontrol/CMakeLists.txt +++ b/kamera/kcontrol/CMakeLists.txt @@ -31,6 +31,6 @@ install( FILES kamera.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) tde_add_kpart( kcm_kamera SHARED AUTOMOC SOURCES kamera.cpp kameradevice.cpp kameraconfigdialog.cpp - LINK kio-shared ${GPHOTO2_LIBRARIES} + LINK tdeio-shared ${GPHOTO2_LIBRARIES} DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kamera/kcontrol/kamera.desktop b/kamera/kcontrol/kamera.desktop index ac9f737e..d06c4be9 100644 --- a/kamera/kcontrol/kamera.desktop +++ b/kamera/kcontrol/kamera.desktop @@ -188,6 +188,6 @@ Type=Application X-TDE-Library=kamera X-TDE-ModuleType=Library Icon=camera -Exec=kcmshell kamera +Exec=tdecmshell kamera DocPath=kamera/index.html Categories=Qt;TDE;Settings;X-TDE-settings-hardware; diff --git a/kamera/kcontrol/kameradevice.cpp b/kamera/kcontrol/kameradevice.cpp index 20d090fa..e6f26449 100644 --- a/kamera/kcontrol/kameradevice.cpp +++ b/kamera/kcontrol/kameradevice.cpp @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include #include diff --git a/kamera/kioslave/CMakeLists.txt b/kamera/kioslave/CMakeLists.txt deleted file mode 100644 index d480f90e..00000000 --- a/kamera/kioslave/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -################################################# -# -# (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} - ${GPHOTO2_INCLUDE_DIRS} -) - - -link_directories( - ${TQT_LIBRARY_DIRS} -) - - -##### other data ################################ - -install( FILES camera.protocol DESTINATION ${SERVICES_INSTALL_DIR} ) - - -#### kamera (module) ############################ - -tde_add_kpart( kio_kamera AUTOMOC - SOURCES kamera.cpp - LINK kio-shared ${GPHOTO2_LIBRARIES} - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kamera/kioslave/Makefile.am b/kamera/kioslave/Makefile.am deleted file mode 100644 index bfb0d198..00000000 --- a/kamera/kioslave/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -# $Id$ -# Makefile for tdebase/kioslave/kamera - -INCLUDES= -I$(srcdir)/../.. -I$(srcdir)/.. $(all_includes) $(GPHOTO2_INCS) - -####### Files - -kde_module_LTLIBRARIES = kio_kamera.la - -kio_kamera_la_SOURCES = kamera.cpp -kio_kamera_la_LIBADD = $(LIB_KIO) -lgphoto2 -kio_kamera_la_LDFLAGS = $(all_libraries) $(GPHOTO2_LIBS) -module $(KDE_PLUGIN) - -noinst_HEADERS = kamera.h - -kde_services_DATA = camera.protocol - diff --git a/kamera/kioslave/camera.protocol b/kamera/kioslave/camera.protocol deleted file mode 100644 index 947d02b9..00000000 --- a/kamera/kioslave/camera.protocol +++ /dev/null @@ -1,16 +0,0 @@ -[Protocol] -exec=kio_kamera -protocol=camera -input=none -output=filesystem -listing=Name,Type -reading=true -writing=false -deleting=true -source=true -makedir=false -linking=false -moving=false -Icon=camera -maxInstances=1 -Class=:local diff --git a/kamera/kioslave/kamera.cpp b/kamera/kioslave/kamera.cpp deleted file mode 100644 index 9806a132..00000000 --- a/kamera/kioslave/kamera.cpp +++ /dev/null @@ -1,1074 +0,0 @@ -/* - - Copyright (C) 2001 The Kompany - 2001-2003 Ilya Konstantinov - 2001-2007 Marcus Meissner - - 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. - -*/ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "kamera.h" - -#define MAXIDLETIME 30 /* seconds */ - -#define tocstr(x) ((x).local8Bit()) - -using namespace TDEIO; - -extern "C" -{ - KDE_EXPORT int kdemain(int argc, char **argv); - - static void frontendCameraStatus(GPContext *context, const char *format, va_list args, void *data); - static unsigned int frontendProgressStart( - GPContext *context, float totalsize, const char *format, - va_list args, void *data - ); - static void frontendProgressUpdate( - GPContext *context, unsigned int id, float current, void *data - ); -} - -int kdemain(int argc, char **argv) -{ - TDEInstance instance("kio_kamera"); - - if(argc != 4) { - kdDebug(7123) << "Usage: kio_kamera protocol " - "domain-socket1 domain-socket2" << endl; - exit(-1); - } - KameraProtocol slave(argv[2], argv[3]); - slave.dispatchLoop(); - return 0; -} - -KameraProtocol::KameraProtocol(const TQCString &pool, const TQCString &app) -: SlaveBase("camera", pool, app), -m_camera(NULL) -{ - // attempt to initialize libgphoto2 and chosen camera (requires locking) - // (will init m_camera, since the m_camera's configuration is empty) - m_camera = 0; - m_file = NULL; - m_config = new KSimpleConfig(KProtocolInfo::config("camera")); - m_context = gp_context_new(); - actiondone = true; - cameraopen = false; - m_modelSpecified = true; - m_lockfile = locateLocal("tmp", "kamera"); - idletime = 0; -} - -// This handler is getting called every second. We use it to do the -// delayed close of the camera. -// Logic is: -// - No more requests in the queue (signaled by actiondone) AND -// - We are MAXIDLETIME seconds idle OR -// - Another slave wants to have access to the camera. -// -// The existance of a lockfile is used to signify "please give up camera". -// -void KameraProtocol::special(const TQByteArray&) { - kdDebug(7123) << "KameraProtocol::special() at " << getpid() << endl; - - if (!actiondone && cameraopen) { - struct stat stbuf; - if ((-1!=::stat(m_lockfile.utf8(),&stbuf)) || (idletime++ >= MAXIDLETIME)) { - kdDebug(7123) << "KameraProtocol::special() closing camera." << endl; - closeCamera(); - setTimeoutSpecialCommand(-1); - } else { - // continue to wait - setTimeoutSpecialCommand(1); - } - } else { - // We let it run until the slave gets no actions anymore. - setTimeoutSpecialCommand(1); - } - actiondone = false; -} - -KameraProtocol::~KameraProtocol() -{ - kdDebug(7123) << "KameraProtocol::~KameraProtocol()" << endl; - delete m_config; - if(m_camera) { - closeCamera(); - gp_camera_free(m_camera); - m_camera = NULL; - } -} - -// initializes the camera for usage - should be done before operations over the wire -bool KameraProtocol::openCamera(TQString &str) { - idletime = 0; - actiondone = true; - if (!m_camera) { - reparseConfiguration(); - } else { - if (!cameraopen) { - int ret, tries = 15; - kdDebug(7123) << "KameraProtocol::openCamera at " << getpid() << endl; - while (tries--) { - ret = gp_camera_init(m_camera, m_context); - if ( (ret == GP_ERROR_IO_USB_CLAIM) || - (ret == GP_ERROR_IO_LOCK)) { - // just create / touch if not there - int fd = ::open(m_lockfile.utf8(),O_CREAT|O_WRONLY,0600); - if (fd != -1) ::close(fd); - ::sleep(1); - kdDebug(7123) << "openCamera at " << getpid() << "- busy, ret " << ret << ", trying again." << endl; - continue; - } - if (ret == GP_OK) break; - str = gp_result_as_string(ret); - return false; - } - ::unlink(m_lockfile.utf8()); - setTimeoutSpecialCommand(1); - kdDebug(7123) << "openCamera succeeded at " << getpid() << endl; - if (!m_modelSpecified) { - gp_camera_get_abilities(m_camera, &m_abilities); - m_modelSpecified = true; - } - cameraopen = true; - } - } - return true; -} - -// should be done after operations over the wire -void KameraProtocol::closeCamera(void) -{ - int gpr; - - if (!m_camera) - return; - - kdDebug(7123) << "KameraProtocol::closeCamera at " << getpid() << endl; - if ((gpr=gp_camera_exit(m_camera,m_context))!=GP_OK) { - kdDebug(7123) << "closeCamera failed with " << gp_result_as_string(gpr) << endl; - } - // HACK: gp_camera_exit() in gp 2.0 does not close the port if there - // is no camera_exit function. - gp_port_close(m_camera->port); - cameraopen = false; - return; -} - -static TQString fix_foldername(TQString ofolder) { - TQString folder = ofolder; - if (folder.length() > 1) { - while ((folder.length()>1) && (folder.right(1) == "/")) - folder = folder.left(folder.length()-1); - } - if (folder.length() == 0) - folder = "/"; - return folder; -} - -// The KIO slave "get" function (starts a download from the camera) -// The actual returning of the data is done in the frontend callback functions. -void KameraProtocol::get(const KURL &url) -{ - kdDebug(7123) << "KameraProtocol::get(" << url.path() << ")" << endl; - - CameraFileType fileType; - int gpr; - if (url.host().isEmpty()) { - error(TDEIO::ERR_DOES_NOT_EXIST, url.path()); - return; - } - - if(!openCamera()) { - error(TDEIO::ERR_DOES_NOT_EXIST, url.path()); - return; - } - - // fprintf(stderr,"get(%s)\n",url.path().latin1()); - -#define GPHOTO_TEXT_FILE(xx) \ - if (!url.path().compare("/" #xx ".txt")) { \ - CameraText xx; \ - gpr = gp_camera_get_##xx(m_camera, &xx, m_context); \ - if (gpr != GP_OK) { \ - error(TDEIO::ERR_DOES_NOT_EXIST, url.path()); \ - return; \ - } \ - TQByteArray chunkDataBuffer; \ - chunkDataBuffer.setRawData(xx.text, strlen(xx.text)); \ - data(chunkDataBuffer); \ - processedSize(strlen(xx.text)); \ - chunkDataBuffer.resetRawData(xx.text, strlen(xx.text)); \ - finished(); \ - return; \ - } - - GPHOTO_TEXT_FILE(about); - GPHOTO_TEXT_FILE(manual); - GPHOTO_TEXT_FILE(summary); - -#undef GPHOTO_TEXT_FILE - // emit info message - infoMessage( i18n("Retrieving data from camera %1").arg(url.user()) ); - - // Note: There's no need to re-read directory for each get() anymore - gp_file_new(&m_file); - - // emit the total size (we must do it before sending data to allow preview) - CameraFileInfo info; - - gpr = gp_camera_file_get_info(m_camera, tocstr(fix_foldername(url.directory(false))), tocstr(url.fileName()), &info, m_context); - if (gpr != GP_OK) { - // fprintf(stderr,"Folder %s / File %s not found, gpr is %d\n",folder.latin1(), url.fileName().latin1(), gpr); - gp_file_unref(m_file); - if ((gpr == GP_ERROR_FILE_NOT_FOUND) || (gpr == GP_ERROR_DIRECTORY_NOT_FOUND)) - error(TDEIO::ERR_DOES_NOT_EXIST, url.path()); - else - error(TDEIO::ERR_UNKNOWN, gp_result_as_string(gpr)); - return; - } - - // at last, a proper API to determine whether a thumbnail was requested. - if(cameraSupportsPreview() && metaData("thumbnail") == "1") { - kdDebug(7123) << "get() retrieving the thumbnail" << endl; - fileType = GP_FILE_TYPE_PREVIEW; - if (info.preview.fields & GP_FILE_INFO_SIZE) - totalSize(info.preview.size); - if (info.preview.fields & GP_FILE_INFO_TYPE) - mimeType(info.preview.type); - } else { - kdDebug(7123) << "get() retrieving the full-scale photo" << endl; - fileType = GP_FILE_TYPE_NORMAL; - if (info.file.fields & GP_FILE_INFO_SIZE) - totalSize(info.file.size); - if (info.preview.fields & GP_FILE_INFO_TYPE) - mimeType(info.file.type); - } - - // fetch the data - m_fileSize = 0; - gpr = gp_camera_file_get(m_camera, tocstr(fix_foldername(url.directory(false))), tocstr(url.fileName()), fileType, m_file, m_context); - if ( (gpr == GP_ERROR_NOT_SUPPORTED) && - (fileType == GP_FILE_TYPE_PREVIEW) - ) { - // If we get here, the file info command information - // will either not be used, or still valid. - fileType = GP_FILE_TYPE_NORMAL; - gpr = gp_camera_file_get(m_camera, tocstr(fix_foldername(url.directory(false))), tocstr(url.fileName()), fileType, m_file, m_context); - } - switch(gpr) { - case GP_OK: - break; - case GP_ERROR_FILE_NOT_FOUND: - case GP_ERROR_DIRECTORY_NOT_FOUND: - gp_file_unref(m_file); - m_file = NULL; - error(TDEIO::ERR_DOES_NOT_EXIST, url.fileName()); - return ; - default: - gp_file_unref(m_file); - m_file = NULL; - error(TDEIO::ERR_UNKNOWN, gp_result_as_string(gpr)); - return; - } - // emit the mimetype - // NOTE: we must first get the file, so that CameraFile->name would be set - const char *fileMimeType; - gp_file_get_mime_type(m_file, &fileMimeType); - mimeType(fileMimeType); - - // We need to pass left over data here. Some camera drivers do not - // implement progress callbacks! - const char *fileData; - long unsigned int fileSize; - // This merely returns us a pointer to gphoto's internal data - // buffer -- there's no expensive memcpy - gpr = gp_file_get_data_and_size(m_file, &fileData, &fileSize); - if (gpr != GP_OK) { - kdDebug(7123) << "get():: get_data_and_size failed." << endl; - gp_file_free(m_file); - m_file = NULL; - error(TDEIO::ERR_UNKNOWN, gp_result_as_string(gpr)); - return; - } - // make sure we're not sending zero-sized chunks (=EOF) - // also make sure we send only if the progress did not send the data - // already. - if ((fileSize > 0) && (fileSize - m_fileSize)>0) { - unsigned long written = 0; - TQByteArray chunkDataBuffer; - - // We need to split it up here. Someone considered it funny - // to discard any data() larger than 16MB. - // - // So nearly any Movie will just fail.... - while (written < fileSize-m_fileSize) { - unsigned long towrite = 1024*1024; // 1MB - - if (towrite > fileSize-m_fileSize-written) - towrite = fileSize-m_fileSize-written; - chunkDataBuffer.setRawData(fileData + m_fileSize + written, towrite); - processedSize(m_fileSize + written + towrite); - data(chunkDataBuffer); - chunkDataBuffer.resetRawData(fileData + m_fileSize + written, towrite); - written += towrite; - } - m_fileSize = fileSize; - setFileSize(fileSize); - } - - finished(); - gp_file_unref(m_file); /* just unref, might be stored in fs */ - m_file = NULL; -} - -// The KIO slave "stat" function. -void KameraProtocol::stat(const KURL &url) -{ - kdDebug(7123) << "stat(\"" << url.path() << "\")" << endl; - - if (url.path() == "") { - KURL rooturl(url); - - kdDebug(7123) << "redirecting to /" << endl; - rooturl.setPath("/"); - rooturl.setHost(url.host()); - rooturl.setUser(url.user()); - redirection(rooturl); - finished(); - return; - } - - if(url.path() == "/") - statRoot(); - else - statRegular(url); -} - -// Implements stat("/") -- which always returns the same value. -void KameraProtocol::statRoot(void) -{ - UDSEntry entry; - UDSAtom atom; - - atom.m_uds = UDS_NAME; - atom.m_str = "/"; - entry.append(atom); - - atom.m_uds = UDS_FILE_TYPE; - atom.m_long = S_IFDIR; - entry.append(atom); - - atom.m_uds = UDS_ACCESS; - atom.m_long = S_IRUSR | S_IRGRP | S_IROTH | - S_IWUSR | S_IWGRP | S_IWOTH; - entry.append(atom); - - statEntry(entry); - - finished(); - - // This call happens on autodetect by kdemm. So close the camera, but - // only if no more requests are pending. - idletime = MAXIDLETIME; -} - -// Implements a regular stat() of a file / directory, returning all we know about it -void KameraProtocol::statRegular(const KURL &url) -{ - UDSEntry entry; - int gpr; - - kdDebug(7123) << "statRegular(\"" << url.path() << "\")" << endl; - if (openCamera() == false) { - error(TDEIO::ERR_DOES_NOT_EXIST, url.path()); - return; - } - - // fprintf(stderr,"statRegular(%s)\n",url.path().latin1()); - - // Is "url" a directory? - CameraList *dirList; - gp_list_new(&dirList); - kdDebug(7123) << "statRegular() Requesting directories list for " << url.directory() << endl; - - gpr = gp_camera_folder_list_folders(m_camera, tocstr(fix_foldername(url.directory(false))), dirList, m_context); - if (gpr != GP_OK) { - if ((gpr == GP_ERROR_FILE_NOT_FOUND) || (gpr == GP_ERROR_DIRECTORY_NOT_FOUND)) - error(TDEIO::ERR_DOES_NOT_EXIST, url.path()); - else - error(TDEIO::ERR_UNKNOWN, gp_result_as_string(gpr)); - gp_list_free(dirList); - return; - } - -#define GPHOTO_TEXT_FILE(xx) \ - if (!url.path().compare("/"#xx".txt")) { \ - CameraText xx; \ - gpr = gp_camera_get_about(m_camera, &xx, m_context); \ - if (gpr != GP_OK) { \ - error(TDEIO::ERR_DOES_NOT_EXIST, url.fileName()); \ - return; \ - } \ - translateTextToUDS(entry,#xx".txt",xx.text); \ - statEntry(entry); \ - finished(); \ - return; \ - } - GPHOTO_TEXT_FILE(about); - GPHOTO_TEXT_FILE(manual); - GPHOTO_TEXT_FILE(summary); -#undef GPHOTO_TEXT_FILE - - const char *name; - for(int i = 0; i < gp_list_count(dirList); i++) { - gp_list_get_name(dirList, i, &name); - if (url.fileName().compare(name) == 0) { - gp_list_free(dirList); - UDSEntry entry; - translateDirectoryToUDS(entry, url.fileName()); - statEntry(entry); - finished(); - return; - } - } - gp_list_free(dirList); - - // Is "url" a file? - CameraFileInfo info; - gpr = gp_camera_file_get_info(m_camera, tocstr(fix_foldername(url.directory(false))), tocstr(url.fileName()), &info, m_context); - if (gpr != GP_OK) { - if ((gpr == GP_ERROR_FILE_NOT_FOUND) || (gpr == GP_ERROR_DIRECTORY_NOT_FOUND)) - error(TDEIO::ERR_DOES_NOT_EXIST, url.path()); - else - error(TDEIO::ERR_UNKNOWN, gp_result_as_string(gpr)); - return; - } - translateFileToUDS(entry, info, url.fileName()); - statEntry(entry); - finished(); -} - -// The KIO slave "del" function. -void KameraProtocol::del(const KURL &url, bool isFile) -{ - kdDebug(7123) << "KameraProtocol::del(" << url.path() << ")" << endl; - - if(!openCamera()) { - error(TDEIO::ERR_CANNOT_DELETE, url.fileName()); - return; - } - if (!cameraSupportsDel()) { - error(TDEIO::ERR_CANNOT_DELETE, url.fileName()); - return; - } - if(isFile){ - CameraList *list; - gp_list_new(&list); - int ret; - - ret = gp_camera_file_delete(m_camera, tocstr(fix_foldername(url.directory(false))), tocstr(url.fileName()), m_context); - - if(ret != GP_OK) { - error(TDEIO::ERR_CANNOT_DELETE, url.fileName()); - } else { - finished(); - } - } -} - -// The KIO slave "listDir" function. -void KameraProtocol::listDir(const KURL &url) -{ - kdDebug(7123) << "KameraProtocol::listDir(" << url.path() << ")" << endl; - - if (url.host().isEmpty()) { - KURL xurl; - // List the available cameras - TQStringList groupList = m_config->groupList(); - kdDebug(7123) << "Found cameras: " << groupList.join(", ") << endl; - TQStringList::Iterator it; - UDSEntry entry; - UDSAtom atom; - - - /* - * What we do: - * - Autodetect cameras and remember them with their ports. - * - List all saved and possible offline cameras. - * - List all autodetected and not yet printed cameras. - */ - TQMap ports, names; - TQMap modelcnt; - - /* Autodetect USB cameras ... */ - GPContext *glob_context = NULL; - int i, count; - CameraList *list; - CameraAbilitiesList *al; - GPPortInfoList *il; - - gp_list_new (&list); - gp_abilities_list_new (&al); - gp_abilities_list_load (al, glob_context); - gp_port_info_list_new (&il); - gp_port_info_list_load (il); - gp_abilities_list_detect (al, il, list, glob_context); - gp_abilities_list_free (al); - gp_port_info_list_free (il); - - count = gp_list_count (list); - - for (i = 0 ; isetGroup(model); - m_config->writeEntry("Model",model); - m_config->writeEntry("Path",value); - modelcnt[model]++; - } - gp_list_free (list); - - /* Avoid duplicated entry for usb: and usb:001,042 entries. */ - if (ports.contains("usb:") && names[ports["usb:"]]!="usb:") - ports.remove("usb:"); - - for (it = groupList.begin(); it != groupList.end(); it++) { - TQString m_cfgPath; - if (*it == "") - continue; - - m_config->setGroup(*it); - m_cfgPath = m_config->readEntry("Path"); - - /* If autodetect by USB autodetect ... skip it here. - * We leave unattached USB cameras in here, because the user - * might plug them in later and does not want to press reload. - * We add them with port "usb:". - */ - if (modelcnt[*it] > 0) - continue; - - entry.clear(); - atom.m_uds = UDS_FILE_TYPE;atom.m_long = S_IFDIR;entry.append(atom); - atom.m_uds = UDS_NAME;atom.m_str = *it;entry.append(atom); - atom.m_uds = UDS_ACCESS; - atom.m_long = S_IRUSR | S_IRGRP | S_IROTH | - S_IWUSR | S_IWGRP | S_IWOTH; - entry.append(atom); - - atom.m_uds = UDS_URL; - - xurl.setProtocol("camera"); - xurl.setUser(*it); - /* Avoid setting usb:xxx,yyy. */ - if (m_cfgPath.contains("usb:")>0) { - names[*it] = "usb:"; - xurl.setHost("usb:"); - } else { - xurl.setHost(m_cfgPath); - } - xurl.setPath("/"); - atom.m_str = xurl.url(); - entry.append(atom); - - listEntry(entry, false); - } - - TQMap::iterator portsit; - - for (portsit = ports.begin(); portsit != ports.end(); portsit++) { - entry.clear(); - atom.m_uds = UDS_FILE_TYPE;atom.m_long = S_IFDIR; entry.append(atom); - atom.m_uds = UDS_NAME;atom.m_str = portsit.data();entry.append(atom); - - atom.m_uds = UDS_ACCESS; - atom.m_long = S_IRUSR | S_IRGRP | S_IROTH | - S_IWUSR | S_IWGRP | S_IWOTH; - entry.append(atom); - - atom.m_uds = UDS_URL; - xurl.setProtocol("camera"); - xurl.setHost(portsit.key()); - xurl.setUser(portsit.data()); - xurl.setPath("/"); - atom.m_str = xurl.url(); - entry.append(atom); - - listEntry(entry, false); - } - listEntry(entry, true); - - finished(); - return; - } - - if (url.path() == "") { - KURL rooturl(url); - - kdDebug(7123) << "redirecting to /" << endl; - rooturl.setPath("/"); - rooturl.setHost(url.host()); - rooturl.setUser(url.user()); - redirection(rooturl); - finished(); - return; - } - - if (!openCamera()) { - error(TDEIO::ERR_COULD_NOT_READ,url.path()); - return; - } - - CameraList *dirList; - CameraList *fileList; - CameraList *specialList; - gp_list_new(&dirList); - gp_list_new(&fileList); - gp_list_new(&specialList); - int gpr; - - if (!url.path().compare("/")) { - CameraText text; - if (GP_OK == gp_camera_get_manual(m_camera, &text, m_context)) - gp_list_append(specialList,"manual.txt",NULL); - if (GP_OK == gp_camera_get_about(m_camera, &text, m_context)) - gp_list_append(specialList,"about.txt",NULL); - if (GP_OK == gp_camera_get_summary(m_camera, &text, m_context)) - gp_list_append(specialList,"summary.txt",NULL); - } - - gpr = readCameraFolder(url.path(), dirList, fileList); - if(gpr != GP_OK) { - kdDebug(7123) << "read Camera Folder failed:" << gp_result_as_string(gpr) <getFile()) - return; - gp_file_get_data_and_size(object->getFile(), &fileData, &fileSize); - // make sure we're not sending zero-sized chunks (=EOF) - if (fileSize > 0) { - // XXX using assign() here causes segfault, prolly because - // gp_file_free is called before chunkData goes out of scope - TQByteArray chunkDataBuffer; - chunkDataBuffer.setRawData(fileData + object->getFileSize(), fileSize - object->getFileSize()); - // Note: this will fail with sizes > 16MB ... - object->data(chunkDataBuffer); - object->processedSize(fileSize); - chunkDataBuffer.resetRawData(fileData + object->getFileSize(), fileSize - object->getFileSize()); - object->setFileSize(fileSize); - } -} - -unsigned int frontendProgressStart( - GPContext * /*context*/, float totalsize, const char *format, va_list args, - void *data -) { - KameraProtocol *object = (KameraProtocol*)data; - char *status; - - /* We must copy the va_list to walk it twice, or all hell - * breaks loose on non-i386 platforms. - */ -#if defined(HAVE_VA_COPY) || defined(HAVE___VA_COPY) - va_list xvalist; -# ifdef HAVE_VA_COPY - va_copy(xvalist, args); -# elif HAVE___VA_COPY - __va_copy(xvalist, args); -# endif - int size=vsnprintf(NULL, 0, format, xvalist); - if(size<=0) - return GP_OK; // vsnprintf is broken, better don't do anything. - - status=new char[size+1]; -# ifdef HAVE_VA_COPY - va_copy(xvalist, args); -# elif HAVE___VA_COPY - __va_copy(xvalist, args); -# endif - vsnprintf(status, size+1, format, xvalist); -#else - /* We cannot copy the va_list, so make sure we - * walk it just _once_. - */ - status=new char[300]; - vsnprintf(status, 300, format, args); -#endif - - object->infoMessage(TQString::fromLocal8Bit(status)); - delete [] status; - object->totalSize((int)totalsize); // hack: call slot directly - return GP_OK; -} - -// this callback function is activated on every status message from gphoto2 -static void frontendCameraStatus(GPContext * /*context*/, const char *format, va_list args, void *data) -{ - KameraProtocol *object = (KameraProtocol*)data; - char *status; - - /* We must copy the va_list to walk it twice, or all hell - * breaks loose on non-i386 platforms. - */ -#if defined(HAVE_VA_COPY) || defined(HAVE___VA_COPY) - va_list xvalist; -# ifdef HAVE_VA_COPY - va_copy(xvalist, args); -# elif HAVE___VA_COPY - __va_copy(xvalist, args); -# endif - int size=vsnprintf(NULL, 0, format, xvalist); - if(size<=0) - return; // vsnprintf is broken, better don't do anything. - - status=new char[size+1]; -# ifdef HAVE_VA_COPY - va_copy(xvalist, args); -# elif HAVE___VA_COPY - __va_copy(xvalist, args); -# endif - vsnprintf(status, size+1, format, xvalist); -#else - /* We cannot copy the va_list, so make sure we - * walk it just _once_. - */ - status=new char[300]; - vsnprintf(status, 300, format, args); -#endif - object->infoMessage(TQString::fromLocal8Bit(status)); - delete [] status; -} diff --git a/kamera/kioslave/kamera.h b/kamera/kioslave/kamera.h deleted file mode 100644 index f569f4ac..00000000 --- a/kamera/kioslave/kamera.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - - Copyright (C) 2001 The Kompany - 2001-2003 Ilya Konstantinov - 2001-2007 Marcus Meissner - - 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. - -*/ - -#ifndef __kamera_h__ -#define __kamera_h__ - -#include -#include -#include - -class KSimpleConfig; - -class KameraProtocol : public TDEIO::SlaveBase -{ -public: - KameraProtocol(const TQCString &pool, const TQCString &app); - virtual ~KameraProtocol(); - - virtual void get(const KURL &url); - virtual void stat(const KURL &url); - virtual void del(const KURL &url, bool isFile); - virtual void setHost(const TQString& host, int port, const TQString& user, const TQString& pass ); - virtual void listDir(const KURL &url); - virtual void special(const TQByteArray &data); - - CameraFile *getFile() { return m_file; } - int getFileSize() { return m_fileSize; } - void setFileSize(int newfs) { m_fileSize = newfs; } - -private: - Camera *m_camera; - CameraAbilities m_abilities; - KSimpleConfig *m_config; - - GPContext *m_context; - - void reparseConfiguration(void); - bool openCamera(TQString& str); - bool openCamera(void ) { - TQString errstr; - return openCamera(errstr); - } - void closeCamera(void); - - void statRoot(void); - void statRegular(const KURL &url); - void translateTextToUDS(TDEIO::UDSEntry &udsEntry, const TQString &info, const char *txt); - void translateFileToUDS(TDEIO::UDSEntry &udsEntry, const CameraFileInfo &info, TQString name); - void translateDirectoryToUDS(TDEIO::UDSEntry &udsEntry, const TQString &dirname); - bool cameraSupportsPreview(void); - bool cameraSupportsDel(void); - bool cameraSupportsPut(void); - int readCameraFolder(const TQString &folder, CameraList *dirList, CameraList *fileList); - - TQString m_lockfile; - int idletime; - - int m_fileSize; - CameraFile *m_file; - bool actiondone, cameraopen; - bool m_modelSpecified; -}; -#endif diff --git a/kamera/tdeioslave/CMakeLists.txt b/kamera/tdeioslave/CMakeLists.txt new file mode 100644 index 00000000..33ca815e --- /dev/null +++ b/kamera/tdeioslave/CMakeLists.txt @@ -0,0 +1,37 @@ +################################################# +# +# (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} + ${GPHOTO2_INCLUDE_DIRS} +) + + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES camera.protocol DESTINATION ${SERVICES_INSTALL_DIR} ) + + +#### kamera (module) ############################ + +tde_add_kpart( kio_kamera AUTOMOC + SOURCES kamera.cpp + LINK tdeio-shared ${GPHOTO2_LIBRARIES} + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/kamera/tdeioslave/Makefile.am b/kamera/tdeioslave/Makefile.am new file mode 100644 index 00000000..80877fa7 --- /dev/null +++ b/kamera/tdeioslave/Makefile.am @@ -0,0 +1,17 @@ +# $Id$ +# Makefile for tdebase/tdeioslave/kamera + +INCLUDES= -I$(srcdir)/../.. -I$(srcdir)/.. $(all_includes) $(GPHOTO2_INCS) + +####### Files + +kde_module_LTLIBRARIES = kio_kamera.la + +kio_kamera_la_SOURCES = kamera.cpp +kio_kamera_la_LIBADD = $(LIB_KIO) -lgphoto2 +kio_kamera_la_LDFLAGS = $(all_libraries) $(GPHOTO2_LIBS) -module $(KDE_PLUGIN) + +noinst_HEADERS = kamera.h + +kde_services_DATA = camera.protocol + diff --git a/kamera/tdeioslave/camera.protocol b/kamera/tdeioslave/camera.protocol new file mode 100644 index 00000000..947d02b9 --- /dev/null +++ b/kamera/tdeioslave/camera.protocol @@ -0,0 +1,16 @@ +[Protocol] +exec=kio_kamera +protocol=camera +input=none +output=filesystem +listing=Name,Type +reading=true +writing=false +deleting=true +source=true +makedir=false +linking=false +moving=false +Icon=camera +maxInstances=1 +Class=:local diff --git a/kamera/tdeioslave/kamera.cpp b/kamera/tdeioslave/kamera.cpp new file mode 100644 index 00000000..45d11970 --- /dev/null +++ b/kamera/tdeioslave/kamera.cpp @@ -0,0 +1,1074 @@ +/* + + Copyright (C) 2001 The Kompany + 2001-2003 Ilya Konstantinov + 2001-2007 Marcus Meissner + + 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. + +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "kamera.h" + +#define MAXIDLETIME 30 /* seconds */ + +#define tocstr(x) ((x).local8Bit()) + +using namespace TDEIO; + +extern "C" +{ + KDE_EXPORT int kdemain(int argc, char **argv); + + static void frontendCameraStatus(GPContext *context, const char *format, va_list args, void *data); + static unsigned int frontendProgressStart( + GPContext *context, float totalsize, const char *format, + va_list args, void *data + ); + static void frontendProgressUpdate( + GPContext *context, unsigned int id, float current, void *data + ); +} + +int kdemain(int argc, char **argv) +{ + TDEInstance instance("kio_kamera"); + + if(argc != 4) { + kdDebug(7123) << "Usage: kio_kamera protocol " + "domain-socket1 domain-socket2" << endl; + exit(-1); + } + KameraProtocol slave(argv[2], argv[3]); + slave.dispatchLoop(); + return 0; +} + +KameraProtocol::KameraProtocol(const TQCString &pool, const TQCString &app) +: SlaveBase("camera", pool, app), +m_camera(NULL) +{ + // attempt to initialize libgphoto2 and chosen camera (requires locking) + // (will init m_camera, since the m_camera's configuration is empty) + m_camera = 0; + m_file = NULL; + m_config = new KSimpleConfig(KProtocolInfo::config("camera")); + m_context = gp_context_new(); + actiondone = true; + cameraopen = false; + m_modelSpecified = true; + m_lockfile = locateLocal("tmp", "kamera"); + idletime = 0; +} + +// This handler is getting called every second. We use it to do the +// delayed close of the camera. +// Logic is: +// - No more requests in the queue (signaled by actiondone) AND +// - We are MAXIDLETIME seconds idle OR +// - Another slave wants to have access to the camera. +// +// The existance of a lockfile is used to signify "please give up camera". +// +void KameraProtocol::special(const TQByteArray&) { + kdDebug(7123) << "KameraProtocol::special() at " << getpid() << endl; + + if (!actiondone && cameraopen) { + struct stat stbuf; + if ((-1!=::stat(m_lockfile.utf8(),&stbuf)) || (idletime++ >= MAXIDLETIME)) { + kdDebug(7123) << "KameraProtocol::special() closing camera." << endl; + closeCamera(); + setTimeoutSpecialCommand(-1); + } else { + // continue to wait + setTimeoutSpecialCommand(1); + } + } else { + // We let it run until the slave gets no actions anymore. + setTimeoutSpecialCommand(1); + } + actiondone = false; +} + +KameraProtocol::~KameraProtocol() +{ + kdDebug(7123) << "KameraProtocol::~KameraProtocol()" << endl; + delete m_config; + if(m_camera) { + closeCamera(); + gp_camera_free(m_camera); + m_camera = NULL; + } +} + +// initializes the camera for usage - should be done before operations over the wire +bool KameraProtocol::openCamera(TQString &str) { + idletime = 0; + actiondone = true; + if (!m_camera) { + reparseConfiguration(); + } else { + if (!cameraopen) { + int ret, tries = 15; + kdDebug(7123) << "KameraProtocol::openCamera at " << getpid() << endl; + while (tries--) { + ret = gp_camera_init(m_camera, m_context); + if ( (ret == GP_ERROR_IO_USB_CLAIM) || + (ret == GP_ERROR_IO_LOCK)) { + // just create / touch if not there + int fd = ::open(m_lockfile.utf8(),O_CREAT|O_WRONLY,0600); + if (fd != -1) ::close(fd); + ::sleep(1); + kdDebug(7123) << "openCamera at " << getpid() << "- busy, ret " << ret << ", trying again." << endl; + continue; + } + if (ret == GP_OK) break; + str = gp_result_as_string(ret); + return false; + } + ::unlink(m_lockfile.utf8()); + setTimeoutSpecialCommand(1); + kdDebug(7123) << "openCamera succeeded at " << getpid() << endl; + if (!m_modelSpecified) { + gp_camera_get_abilities(m_camera, &m_abilities); + m_modelSpecified = true; + } + cameraopen = true; + } + } + return true; +} + +// should be done after operations over the wire +void KameraProtocol::closeCamera(void) +{ + int gpr; + + if (!m_camera) + return; + + kdDebug(7123) << "KameraProtocol::closeCamera at " << getpid() << endl; + if ((gpr=gp_camera_exit(m_camera,m_context))!=GP_OK) { + kdDebug(7123) << "closeCamera failed with " << gp_result_as_string(gpr) << endl; + } + // HACK: gp_camera_exit() in gp 2.0 does not close the port if there + // is no camera_exit function. + gp_port_close(m_camera->port); + cameraopen = false; + return; +} + +static TQString fix_foldername(TQString ofolder) { + TQString folder = ofolder; + if (folder.length() > 1) { + while ((folder.length()>1) && (folder.right(1) == "/")) + folder = folder.left(folder.length()-1); + } + if (folder.length() == 0) + folder = "/"; + return folder; +} + +// The KIO slave "get" function (starts a download from the camera) +// The actual returning of the data is done in the frontend callback functions. +void KameraProtocol::get(const KURL &url) +{ + kdDebug(7123) << "KameraProtocol::get(" << url.path() << ")" << endl; + + CameraFileType fileType; + int gpr; + if (url.host().isEmpty()) { + error(TDEIO::ERR_DOES_NOT_EXIST, url.path()); + return; + } + + if(!openCamera()) { + error(TDEIO::ERR_DOES_NOT_EXIST, url.path()); + return; + } + + // fprintf(stderr,"get(%s)\n",url.path().latin1()); + +#define GPHOTO_TEXT_FILE(xx) \ + if (!url.path().compare("/" #xx ".txt")) { \ + CameraText xx; \ + gpr = gp_camera_get_##xx(m_camera, &xx, m_context); \ + if (gpr != GP_OK) { \ + error(TDEIO::ERR_DOES_NOT_EXIST, url.path()); \ + return; \ + } \ + TQByteArray chunkDataBuffer; \ + chunkDataBuffer.setRawData(xx.text, strlen(xx.text)); \ + data(chunkDataBuffer); \ + processedSize(strlen(xx.text)); \ + chunkDataBuffer.resetRawData(xx.text, strlen(xx.text)); \ + finished(); \ + return; \ + } + + GPHOTO_TEXT_FILE(about); + GPHOTO_TEXT_FILE(manual); + GPHOTO_TEXT_FILE(summary); + +#undef GPHOTO_TEXT_FILE + // emit info message + infoMessage( i18n("Retrieving data from camera %1").arg(url.user()) ); + + // Note: There's no need to re-read directory for each get() anymore + gp_file_new(&m_file); + + // emit the total size (we must do it before sending data to allow preview) + CameraFileInfo info; + + gpr = gp_camera_file_get_info(m_camera, tocstr(fix_foldername(url.directory(false))), tocstr(url.fileName()), &info, m_context); + if (gpr != GP_OK) { + // fprintf(stderr,"Folder %s / File %s not found, gpr is %d\n",folder.latin1(), url.fileName().latin1(), gpr); + gp_file_unref(m_file); + if ((gpr == GP_ERROR_FILE_NOT_FOUND) || (gpr == GP_ERROR_DIRECTORY_NOT_FOUND)) + error(TDEIO::ERR_DOES_NOT_EXIST, url.path()); + else + error(TDEIO::ERR_UNKNOWN, gp_result_as_string(gpr)); + return; + } + + // at last, a proper API to determine whether a thumbnail was requested. + if(cameraSupportsPreview() && metaData("thumbnail") == "1") { + kdDebug(7123) << "get() retrieving the thumbnail" << endl; + fileType = GP_FILE_TYPE_PREVIEW; + if (info.preview.fields & GP_FILE_INFO_SIZE) + totalSize(info.preview.size); + if (info.preview.fields & GP_FILE_INFO_TYPE) + mimeType(info.preview.type); + } else { + kdDebug(7123) << "get() retrieving the full-scale photo" << endl; + fileType = GP_FILE_TYPE_NORMAL; + if (info.file.fields & GP_FILE_INFO_SIZE) + totalSize(info.file.size); + if (info.preview.fields & GP_FILE_INFO_TYPE) + mimeType(info.file.type); + } + + // fetch the data + m_fileSize = 0; + gpr = gp_camera_file_get(m_camera, tocstr(fix_foldername(url.directory(false))), tocstr(url.fileName()), fileType, m_file, m_context); + if ( (gpr == GP_ERROR_NOT_SUPPORTED) && + (fileType == GP_FILE_TYPE_PREVIEW) + ) { + // If we get here, the file info command information + // will either not be used, or still valid. + fileType = GP_FILE_TYPE_NORMAL; + gpr = gp_camera_file_get(m_camera, tocstr(fix_foldername(url.directory(false))), tocstr(url.fileName()), fileType, m_file, m_context); + } + switch(gpr) { + case GP_OK: + break; + case GP_ERROR_FILE_NOT_FOUND: + case GP_ERROR_DIRECTORY_NOT_FOUND: + gp_file_unref(m_file); + m_file = NULL; + error(TDEIO::ERR_DOES_NOT_EXIST, url.fileName()); + return ; + default: + gp_file_unref(m_file); + m_file = NULL; + error(TDEIO::ERR_UNKNOWN, gp_result_as_string(gpr)); + return; + } + // emit the mimetype + // NOTE: we must first get the file, so that CameraFile->name would be set + const char *fileMimeType; + gp_file_get_mime_type(m_file, &fileMimeType); + mimeType(fileMimeType); + + // We need to pass left over data here. Some camera drivers do not + // implement progress callbacks! + const char *fileData; + long unsigned int fileSize; + // This merely returns us a pointer to gphoto's internal data + // buffer -- there's no expensive memcpy + gpr = gp_file_get_data_and_size(m_file, &fileData, &fileSize); + if (gpr != GP_OK) { + kdDebug(7123) << "get():: get_data_and_size failed." << endl; + gp_file_free(m_file); + m_file = NULL; + error(TDEIO::ERR_UNKNOWN, gp_result_as_string(gpr)); + return; + } + // make sure we're not sending zero-sized chunks (=EOF) + // also make sure we send only if the progress did not send the data + // already. + if ((fileSize > 0) && (fileSize - m_fileSize)>0) { + unsigned long written = 0; + TQByteArray chunkDataBuffer; + + // We need to split it up here. Someone considered it funny + // to discard any data() larger than 16MB. + // + // So nearly any Movie will just fail.... + while (written < fileSize-m_fileSize) { + unsigned long towrite = 1024*1024; // 1MB + + if (towrite > fileSize-m_fileSize-written) + towrite = fileSize-m_fileSize-written; + chunkDataBuffer.setRawData(fileData + m_fileSize + written, towrite); + processedSize(m_fileSize + written + towrite); + data(chunkDataBuffer); + chunkDataBuffer.resetRawData(fileData + m_fileSize + written, towrite); + written += towrite; + } + m_fileSize = fileSize; + setFileSize(fileSize); + } + + finished(); + gp_file_unref(m_file); /* just unref, might be stored in fs */ + m_file = NULL; +} + +// The KIO slave "stat" function. +void KameraProtocol::stat(const KURL &url) +{ + kdDebug(7123) << "stat(\"" << url.path() << "\")" << endl; + + if (url.path() == "") { + KURL rooturl(url); + + kdDebug(7123) << "redirecting to /" << endl; + rooturl.setPath("/"); + rooturl.setHost(url.host()); + rooturl.setUser(url.user()); + redirection(rooturl); + finished(); + return; + } + + if(url.path() == "/") + statRoot(); + else + statRegular(url); +} + +// Implements stat("/") -- which always returns the same value. +void KameraProtocol::statRoot(void) +{ + UDSEntry entry; + UDSAtom atom; + + atom.m_uds = UDS_NAME; + atom.m_str = "/"; + entry.append(atom); + + atom.m_uds = UDS_FILE_TYPE; + atom.m_long = S_IFDIR; + entry.append(atom); + + atom.m_uds = UDS_ACCESS; + atom.m_long = S_IRUSR | S_IRGRP | S_IROTH | + S_IWUSR | S_IWGRP | S_IWOTH; + entry.append(atom); + + statEntry(entry); + + finished(); + + // This call happens on autodetect by kdemm. So close the camera, but + // only if no more requests are pending. + idletime = MAXIDLETIME; +} + +// Implements a regular stat() of a file / directory, returning all we know about it +void KameraProtocol::statRegular(const KURL &url) +{ + UDSEntry entry; + int gpr; + + kdDebug(7123) << "statRegular(\"" << url.path() << "\")" << endl; + if (openCamera() == false) { + error(TDEIO::ERR_DOES_NOT_EXIST, url.path()); + return; + } + + // fprintf(stderr,"statRegular(%s)\n",url.path().latin1()); + + // Is "url" a directory? + CameraList *dirList; + gp_list_new(&dirList); + kdDebug(7123) << "statRegular() Requesting directories list for " << url.directory() << endl; + + gpr = gp_camera_folder_list_folders(m_camera, tocstr(fix_foldername(url.directory(false))), dirList, m_context); + if (gpr != GP_OK) { + if ((gpr == GP_ERROR_FILE_NOT_FOUND) || (gpr == GP_ERROR_DIRECTORY_NOT_FOUND)) + error(TDEIO::ERR_DOES_NOT_EXIST, url.path()); + else + error(TDEIO::ERR_UNKNOWN, gp_result_as_string(gpr)); + gp_list_free(dirList); + return; + } + +#define GPHOTO_TEXT_FILE(xx) \ + if (!url.path().compare("/"#xx".txt")) { \ + CameraText xx; \ + gpr = gp_camera_get_about(m_camera, &xx, m_context); \ + if (gpr != GP_OK) { \ + error(TDEIO::ERR_DOES_NOT_EXIST, url.fileName()); \ + return; \ + } \ + translateTextToUDS(entry,#xx".txt",xx.text); \ + statEntry(entry); \ + finished(); \ + return; \ + } + GPHOTO_TEXT_FILE(about); + GPHOTO_TEXT_FILE(manual); + GPHOTO_TEXT_FILE(summary); +#undef GPHOTO_TEXT_FILE + + const char *name; + for(int i = 0; i < gp_list_count(dirList); i++) { + gp_list_get_name(dirList, i, &name); + if (url.fileName().compare(name) == 0) { + gp_list_free(dirList); + UDSEntry entry; + translateDirectoryToUDS(entry, url.fileName()); + statEntry(entry); + finished(); + return; + } + } + gp_list_free(dirList); + + // Is "url" a file? + CameraFileInfo info; + gpr = gp_camera_file_get_info(m_camera, tocstr(fix_foldername(url.directory(false))), tocstr(url.fileName()), &info, m_context); + if (gpr != GP_OK) { + if ((gpr == GP_ERROR_FILE_NOT_FOUND) || (gpr == GP_ERROR_DIRECTORY_NOT_FOUND)) + error(TDEIO::ERR_DOES_NOT_EXIST, url.path()); + else + error(TDEIO::ERR_UNKNOWN, gp_result_as_string(gpr)); + return; + } + translateFileToUDS(entry, info, url.fileName()); + statEntry(entry); + finished(); +} + +// The KIO slave "del" function. +void KameraProtocol::del(const KURL &url, bool isFile) +{ + kdDebug(7123) << "KameraProtocol::del(" << url.path() << ")" << endl; + + if(!openCamera()) { + error(TDEIO::ERR_CANNOT_DELETE, url.fileName()); + return; + } + if (!cameraSupportsDel()) { + error(TDEIO::ERR_CANNOT_DELETE, url.fileName()); + return; + } + if(isFile){ + CameraList *list; + gp_list_new(&list); + int ret; + + ret = gp_camera_file_delete(m_camera, tocstr(fix_foldername(url.directory(false))), tocstr(url.fileName()), m_context); + + if(ret != GP_OK) { + error(TDEIO::ERR_CANNOT_DELETE, url.fileName()); + } else { + finished(); + } + } +} + +// The KIO slave "listDir" function. +void KameraProtocol::listDir(const KURL &url) +{ + kdDebug(7123) << "KameraProtocol::listDir(" << url.path() << ")" << endl; + + if (url.host().isEmpty()) { + KURL xurl; + // List the available cameras + TQStringList groupList = m_config->groupList(); + kdDebug(7123) << "Found cameras: " << groupList.join(", ") << endl; + TQStringList::Iterator it; + UDSEntry entry; + UDSAtom atom; + + + /* + * What we do: + * - Autodetect cameras and remember them with their ports. + * - List all saved and possible offline cameras. + * - List all autodetected and not yet printed cameras. + */ + TQMap ports, names; + TQMap modelcnt; + + /* Autodetect USB cameras ... */ + GPContext *glob_context = NULL; + int i, count; + CameraList *list; + CameraAbilitiesList *al; + GPPortInfoList *il; + + gp_list_new (&list); + gp_abilities_list_new (&al); + gp_abilities_list_load (al, glob_context); + gp_port_info_list_new (&il); + gp_port_info_list_load (il); + gp_abilities_list_detect (al, il, list, glob_context); + gp_abilities_list_free (al); + gp_port_info_list_free (il); + + count = gp_list_count (list); + + for (i = 0 ; isetGroup(model); + m_config->writeEntry("Model",model); + m_config->writeEntry("Path",value); + modelcnt[model]++; + } + gp_list_free (list); + + /* Avoid duplicated entry for usb: and usb:001,042 entries. */ + if (ports.contains("usb:") && names[ports["usb:"]]!="usb:") + ports.remove("usb:"); + + for (it = groupList.begin(); it != groupList.end(); it++) { + TQString m_cfgPath; + if (*it == "") + continue; + + m_config->setGroup(*it); + m_cfgPath = m_config->readEntry("Path"); + + /* If autodetect by USB autodetect ... skip it here. + * We leave unattached USB cameras in here, because the user + * might plug them in later and does not want to press reload. + * We add them with port "usb:". + */ + if (modelcnt[*it] > 0) + continue; + + entry.clear(); + atom.m_uds = UDS_FILE_TYPE;atom.m_long = S_IFDIR;entry.append(atom); + atom.m_uds = UDS_NAME;atom.m_str = *it;entry.append(atom); + atom.m_uds = UDS_ACCESS; + atom.m_long = S_IRUSR | S_IRGRP | S_IROTH | + S_IWUSR | S_IWGRP | S_IWOTH; + entry.append(atom); + + atom.m_uds = UDS_URL; + + xurl.setProtocol("camera"); + xurl.setUser(*it); + /* Avoid setting usb:xxx,yyy. */ + if (m_cfgPath.contains("usb:")>0) { + names[*it] = "usb:"; + xurl.setHost("usb:"); + } else { + xurl.setHost(m_cfgPath); + } + xurl.setPath("/"); + atom.m_str = xurl.url(); + entry.append(atom); + + listEntry(entry, false); + } + + TQMap::iterator portsit; + + for (portsit = ports.begin(); portsit != ports.end(); portsit++) { + entry.clear(); + atom.m_uds = UDS_FILE_TYPE;atom.m_long = S_IFDIR; entry.append(atom); + atom.m_uds = UDS_NAME;atom.m_str = portsit.data();entry.append(atom); + + atom.m_uds = UDS_ACCESS; + atom.m_long = S_IRUSR | S_IRGRP | S_IROTH | + S_IWUSR | S_IWGRP | S_IWOTH; + entry.append(atom); + + atom.m_uds = UDS_URL; + xurl.setProtocol("camera"); + xurl.setHost(portsit.key()); + xurl.setUser(portsit.data()); + xurl.setPath("/"); + atom.m_str = xurl.url(); + entry.append(atom); + + listEntry(entry, false); + } + listEntry(entry, true); + + finished(); + return; + } + + if (url.path() == "") { + KURL rooturl(url); + + kdDebug(7123) << "redirecting to /" << endl; + rooturl.setPath("/"); + rooturl.setHost(url.host()); + rooturl.setUser(url.user()); + redirection(rooturl); + finished(); + return; + } + + if (!openCamera()) { + error(TDEIO::ERR_COULD_NOT_READ,url.path()); + return; + } + + CameraList *dirList; + CameraList *fileList; + CameraList *specialList; + gp_list_new(&dirList); + gp_list_new(&fileList); + gp_list_new(&specialList); + int gpr; + + if (!url.path().compare("/")) { + CameraText text; + if (GP_OK == gp_camera_get_manual(m_camera, &text, m_context)) + gp_list_append(specialList,"manual.txt",NULL); + if (GP_OK == gp_camera_get_about(m_camera, &text, m_context)) + gp_list_append(specialList,"about.txt",NULL); + if (GP_OK == gp_camera_get_summary(m_camera, &text, m_context)) + gp_list_append(specialList,"summary.txt",NULL); + } + + gpr = readCameraFolder(url.path(), dirList, fileList); + if(gpr != GP_OK) { + kdDebug(7123) << "read Camera Folder failed:" << gp_result_as_string(gpr) <getFile()) + return; + gp_file_get_data_and_size(object->getFile(), &fileData, &fileSize); + // make sure we're not sending zero-sized chunks (=EOF) + if (fileSize > 0) { + // XXX using assign() here causes segfault, prolly because + // gp_file_free is called before chunkData goes out of scope + TQByteArray chunkDataBuffer; + chunkDataBuffer.setRawData(fileData + object->getFileSize(), fileSize - object->getFileSize()); + // Note: this will fail with sizes > 16MB ... + object->data(chunkDataBuffer); + object->processedSize(fileSize); + chunkDataBuffer.resetRawData(fileData + object->getFileSize(), fileSize - object->getFileSize()); + object->setFileSize(fileSize); + } +} + +unsigned int frontendProgressStart( + GPContext * /*context*/, float totalsize, const char *format, va_list args, + void *data +) { + KameraProtocol *object = (KameraProtocol*)data; + char *status; + + /* We must copy the va_list to walk it twice, or all hell + * breaks loose on non-i386 platforms. + */ +#if defined(HAVE_VA_COPY) || defined(HAVE___VA_COPY) + va_list xvalist; +# ifdef HAVE_VA_COPY + va_copy(xvalist, args); +# elif HAVE___VA_COPY + __va_copy(xvalist, args); +# endif + int size=vsnprintf(NULL, 0, format, xvalist); + if(size<=0) + return GP_OK; // vsnprintf is broken, better don't do anything. + + status=new char[size+1]; +# ifdef HAVE_VA_COPY + va_copy(xvalist, args); +# elif HAVE___VA_COPY + __va_copy(xvalist, args); +# endif + vsnprintf(status, size+1, format, xvalist); +#else + /* We cannot copy the va_list, so make sure we + * walk it just _once_. + */ + status=new char[300]; + vsnprintf(status, 300, format, args); +#endif + + object->infoMessage(TQString::fromLocal8Bit(status)); + delete [] status; + object->totalSize((int)totalsize); // hack: call slot directly + return GP_OK; +} + +// this callback function is activated on every status message from gphoto2 +static void frontendCameraStatus(GPContext * /*context*/, const char *format, va_list args, void *data) +{ + KameraProtocol *object = (KameraProtocol*)data; + char *status; + + /* We must copy the va_list to walk it twice, or all hell + * breaks loose on non-i386 platforms. + */ +#if defined(HAVE_VA_COPY) || defined(HAVE___VA_COPY) + va_list xvalist; +# ifdef HAVE_VA_COPY + va_copy(xvalist, args); +# elif HAVE___VA_COPY + __va_copy(xvalist, args); +# endif + int size=vsnprintf(NULL, 0, format, xvalist); + if(size<=0) + return; // vsnprintf is broken, better don't do anything. + + status=new char[size+1]; +# ifdef HAVE_VA_COPY + va_copy(xvalist, args); +# elif HAVE___VA_COPY + __va_copy(xvalist, args); +# endif + vsnprintf(status, size+1, format, xvalist); +#else + /* We cannot copy the va_list, so make sure we + * walk it just _once_. + */ + status=new char[300]; + vsnprintf(status, 300, format, args); +#endif + object->infoMessage(TQString::fromLocal8Bit(status)); + delete [] status; +} diff --git a/kamera/tdeioslave/kamera.h b/kamera/tdeioslave/kamera.h new file mode 100644 index 00000000..1e015d0f --- /dev/null +++ b/kamera/tdeioslave/kamera.h @@ -0,0 +1,82 @@ +/* + + Copyright (C) 2001 The Kompany + 2001-2003 Ilya Konstantinov + 2001-2007 Marcus Meissner + + 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. + +*/ + +#ifndef __kamera_h__ +#define __kamera_h__ + +#include +#include +#include + +class KSimpleConfig; + +class KameraProtocol : public TDEIO::SlaveBase +{ +public: + KameraProtocol(const TQCString &pool, const TQCString &app); + virtual ~KameraProtocol(); + + virtual void get(const KURL &url); + virtual void stat(const KURL &url); + virtual void del(const KURL &url, bool isFile); + virtual void setHost(const TQString& host, int port, const TQString& user, const TQString& pass ); + virtual void listDir(const KURL &url); + virtual void special(const TQByteArray &data); + + CameraFile *getFile() { return m_file; } + int getFileSize() { return m_fileSize; } + void setFileSize(int newfs) { m_fileSize = newfs; } + +private: + Camera *m_camera; + CameraAbilities m_abilities; + KSimpleConfig *m_config; + + GPContext *m_context; + + void reparseConfiguration(void); + bool openCamera(TQString& str); + bool openCamera(void ) { + TQString errstr; + return openCamera(errstr); + } + void closeCamera(void); + + void statRoot(void); + void statRegular(const KURL &url); + void translateTextToUDS(TDEIO::UDSEntry &udsEntry, const TQString &info, const char *txt); + void translateFileToUDS(TDEIO::UDSEntry &udsEntry, const CameraFileInfo &info, TQString name); + void translateDirectoryToUDS(TDEIO::UDSEntry &udsEntry, const TQString &dirname); + bool cameraSupportsPreview(void); + bool cameraSupportsDel(void); + bool cameraSupportsPut(void); + int readCameraFolder(const TQString &folder, CameraList *dirList, CameraList *fileList); + + TQString m_lockfile; + int idletime; + + int m_fileSize; + CameraFile *m_file; + bool actiondone, cameraopen; + bool m_modelSpecified; +}; +#endif diff --git a/kcoloredit/CMakeLists.txt b/kcoloredit/CMakeLists.txt index caf8e202..ad3d5552 100644 --- a/kcoloredit/CMakeLists.txt +++ b/kcoloredit/CMakeLists.txt @@ -43,7 +43,7 @@ tde_add_executable( kcoloredit AUTOMOC kxycolorselector.cpp paletteview.cpp paletteviewscrolledarea.cpp editablestreamhistory.cpp color.cpp palette.cpp loadpalettedlg.cpp kcoloreditview.cpp kcoloreditdoc.cpp kcoloredit.cpp main.cpp - LINK kio-shared + LINK tdeio-shared DESTINATION ${BIN_INSTALL_DIR} ) diff --git a/kcoloredit/kcoloredit.cpp b/kcoloredit/kcoloredit.cpp index 5b0dffb9..8e62a2d6 100644 --- a/kcoloredit/kcoloredit.cpp +++ b/kcoloredit/kcoloredit.cpp @@ -23,11 +23,11 @@ // include files for KDE #include #include -#include +#include #include #include #include -#include +#include #include // application specific includes diff --git a/kcoloredit/loadpalettedlg.cpp b/kcoloredit/loadpalettedlg.cpp index 23def4d5..ead23eff 100644 --- a/kcoloredit/loadpalettedlg.cpp +++ b/kcoloredit/loadpalettedlg.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include "main.h" #include "palette.h" diff --git a/kdvi/dviRenderer.cpp b/kdvi/dviRenderer.cpp index 36c6bd0e..cfdbcfe5 100644 --- a/kdvi/dviRenderer.cpp +++ b/kdvi/dviRenderer.cpp @@ -34,9 +34,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/kdvi/dviRenderer_export.cpp b/kdvi/dviRenderer_export.cpp index 9fd0809e..a3574162 100644 --- a/kdvi/dviRenderer_export.cpp +++ b/kdvi/dviRenderer_export.cpp @@ -30,9 +30,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/kdvi/infodialog.cpp b/kdvi/infodialog.cpp index 652f89fa..0ec8f36a 100644 --- a/kdvi/infodialog.cpp +++ b/kdvi/infodialog.cpp @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include #include diff --git a/kdvi/kdvi_multipage.cpp b/kdvi/kdvi_multipage.cpp index 53a5d6df..0396c09e 100644 --- a/kdvi/kdvi_multipage.cpp +++ b/kdvi/kdvi_multipage.cpp @@ -4,9 +4,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include #include diff --git a/kdvi/kdvi_multipage_texthandling.cpp b/kdvi/kdvi_multipage_texthandling.cpp index dc237da5..bcadd45a 100644 --- a/kdvi/kdvi_multipage_texthandling.cpp +++ b/kdvi/kdvi_multipage_texthandling.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kdvi/prefs.kcfgc b/kdvi/prefs.kcfgc index 7b77dce6..34148d6f 100644 --- a/kdvi/prefs.kcfgc +++ b/kdvi/prefs.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=kdvi.kcfg ClassName=Prefs Singleton=true diff --git a/kfax/kfax.cpp b/kfax/kfax.cpp index f77c281f..9e3479c1 100644 --- a/kfax/kfax.cpp +++ b/kfax/kfax.cpp @@ -43,14 +43,14 @@ #include #include #include -#include -#include +#include +#include #include -#include +#include #include #include #include -#include +#include #include #include #include @@ -60,7 +60,7 @@ #include #include #include -#include +#include #include #include "faxexpand.h" diff --git a/kfaxview/CMakeLists.txt b/kfaxview/CMakeLists.txt index b01047b8..dcb8b751 100644 --- a/kfaxview/CMakeLists.txt +++ b/kfaxview/CMakeLists.txt @@ -48,6 +48,6 @@ tde_add_kpart( kfaxviewpart AUTOMOC tde_add_executable( kfaxview AUTOMOC SOURCES main.cpp - LINK kviewshell-static kio-shared tdeparts-shared + LINK kviewshell-static tdeio-shared tdeparts-shared DESTINATION ${BIN_INSTALL_DIR} ) diff --git a/kfaxview/faxmultipage.cpp b/kfaxview/faxmultipage.cpp index b01d4577..5c27a23d 100644 --- a/kfaxview/faxmultipage.cpp +++ b/kfaxview/faxmultipage.cpp @@ -20,7 +20,7 @@ #include -#include +#include #include #include "faxmultipage.h" diff --git a/kfile-plugins/CMakeLists.txt b/kfile-plugins/CMakeLists.txt deleted file mode 100644 index 238bc4b2..00000000 --- a/kfile-plugins/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -add_subdirectory( dependencies ) -add_subdirectory( dvi ) -add_subdirectory( png ) -add_subdirectory( ps ) -add_subdirectory( jpeg ) -add_subdirectory( xbm ) -add_subdirectory( xpm ) -add_subdirectory( bmp ) -add_subdirectory( tga ) -add_subdirectory( rgb ) -add_subdirectory( ico ) -add_subdirectory( pcx ) -add_subdirectory( pnm ) -add_subdirectory( dds ) -add_subdirectory( gif ) -add_subdirectory( raw ) - -tde_conditional_add_subdirectory( WITH_TIFF tiff ) -tde_conditional_add_subdirectory( WITH_OPENEXR exr ) -tde_conditional_add_subdirectory( WITH_PDF pdf ) diff --git a/kfile-plugins/Makefile.am b/kfile-plugins/Makefile.am deleted file mode 100644 index bc15008f..00000000 --- a/kfile-plugins/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -if include_EXR_MODULES -KFILE_EXR_SUBDIR=exr -endif - -if include_TIFF -KFILE_TIFF_SUBDIR=tiff -endif - -if include_PDF -KFILE_PDF_SUBDIR=pdf -endif - -SUBDIRS=dependencies dvi png ps jpeg xbm xpm bmp tga rgb ico pcx $(KFILE_TIFF_SUBDIR) pnm \ - $(KFILE_EXR_SUBDIR) $(KFILE_PDF_SUBDIR) dds gif raw diff --git a/kfile-plugins/RETURNED_ITEMS b/kfile-plugins/RETURNED_ITEMS deleted file mode 100644 index 70a3b519..00000000 --- a/kfile-plugins/RETURNED_ITEMS +++ /dev/null @@ -1,245 +0,0 @@ -If you make a new plugin, please add the list of returned items to this list. - - -pdf plugin: -=========== - -Date Created -Date Modiified -Int Pages -Bool Encrypted -and everything else pdfinfo returns as string - - -png plugin: -=========== - -type key W/A details ------------------------------------------------------------------------- -Size Dimensions -/- -Int BitDepth -/- -String ColorMode -/- -String Compression -/- Compression type. Right now always "deflate" - -Other keys corresponding to the png comment keys are returned as non-editable -String. - -Common keys that are recommended in the png spec: -Title, Author, Description, Copyright, Creation Time, Software, Disclaimer, -Warning, Source, Comment - - -PostScript plugin: -================== - -String Title -String Creator -String CreationDate -String For -Int Pages - - - -Jpeg plugin: -============ -Note: number.number means precision of converted number - -type key Comment ------------------------------------------------------------------------------ -String Camera make -String Camera model -String Date/time -Size Dimensions Width x Height in pixels -int Qt::Orientation 1 - "The 0th row is at the visual top of the image, - and the 0th column is the visual left-hand side." - 2 - "The 0th row is at the visual top of the image, - and the 0th column is the visual right-hand side." - 3 - "The 0th row is at the visual bottom of the image, - and the 0th column is the visual right-hand side." - 4 - "The 0th row is at the visual bottom of the image, - and the 0th column is the visual left-hand side." - 5 - "The 0th row is the visual left-hand side of of the image, - and the 0th column is the visual top." - 6 - "The 0th row is the visual right-hand side of of the image, - and the 0th column is the visual top." - 7 - "The 0th row is the visual right-hand side of of the image, - and the 0th column is the visual bottom." - 8 - "The 0th row is the visual left-hand side of of the image, - and the 0th column is the visual bottom." -String ColorMode "Grayscale" "Color" -String Flash used "Yes" "No" -String Focal length 4.1 mm, 35mm equivalent -String Exposure time 6.3 (if < 0.5 also in 1/xx) sec -String Aperture "f/3.1" -String Focus dist. "Infinite" or 5.2 m -String CCD width 4.2 Postfix mm -String Exposure bias 4.2 -String Whitebalance 0 = unknown - 1 = Daylight - 2 = Fluorescent - 3 = Tungsten - 17 = Standard light A - 18 = Standard light B - 19 = Standard light C - 20 = D55 - 21 = D65 - 22 = D75 - 23 to 254 = reserved - 255 = other -String Metering mode 0 = unknown - 1 = Average - 2 = CenterWeightedAverage - 3 = Spot - 4 = MultiSpot - 5 = Pattern - 6 = Partial - 7 to 254 = reserved - 255 = other -String Exposure 0 = Not defined - 1 = Manual - 2 = Normal program - 3 = Aperture priority - 4 = Shutter priority - 5 = Creative program (biased toward depth of field) - 6 = Action program - (biased toward fast shutter speed) - 7 = Portrait mode - (for closeup photos with the background out of focus) - 8 = Landscape mode - (for landscape photos with the background in focus) - 9 to 255 = reserved -String ISO equiv. 2digits ??? -String JPG quality 1 - "basic" - 2 - "normal" - 4 - "fine" - default: unknown -String User comment -String Comment -QImage Thumbnail - - -gif plugin: -=========== - -type key Comment ------------------------------------------------------------------------------ -Size Dimensions Width x Height in pixels. -String Comment gif comment blocks, which we permit to be utf-8 encoded - in clear violation/extension of the specification which - calls for 7 bit ASCII. See: - http://www.geocities.co.jp/SiliconValley/3453/gif_info/index_en.html - - -TIFF plugin: -=========== - -:: Group: General :: - -type key Comment ------- -------------- ----------------------------------------------------- -String ColorMode Color Mode (Monochrome, RGB, RGBA etc) -Size Dimensions Width & height as a QSize object -Size Resolution x & y resolution in dpi as a QSize object -Int BitDepth No. of bits per pixel (e.g. 24 for 8-bit RGB) -String Compression Compression used (None, Deflate, LZW, JPEG etc.) -Int FaxPages No. of pages if this is fax -String Software Software used to produce this image -String Description Image description -String Copyright Copyright information -String DateTime Date and time of image creation -String Artist Name of the person who created this image - -:: Group: Scanner :: - -type key Comment ------- -------------- ----------------------------------------------------- -String Make Make of the scanner used -String Model Model of the scanner used - - - - - -xbm plugin: -=========== - -type key W/A details ------------------------------------------------------------------------- -QSize Dimensions -/- Dimensions in pixels - -xpm plugin: -=========== - -type key W/A details ------------------------------------------------------------------------- -QSize Dimensions -/- Dimensions in pixels -Int BitDepth -/- Bits per pixel - - -bmp plugin: -=========== - -type key W/A details ------------------------------------------------------------------------- -String Type -/- Bitmap type (Windows / OS/2) -QSize Dimensions -/- Dimensions in pixels -Int BitDepth -/- Bits per pixel -String Compression -/- Compression type - - -tga plugin: -=========== - -type key W/A details ------------------------------------------------------------------------- -QSize Dimensions -/- Dimensions in pixels -Int BitDepth -/- Bits per pixel -String ColorMode -/- Color mode (e.g. RGB) -String Compression -/- Compression type, if any - - -ico plugin: -=========== - -type key W/A details ------------------------------------------------------------------------- -Int Number -/- Number of icons in file -QSize Dimensions -/- Dimensions -QSize DimensionsM -/- Dimensions [of 1st icon] -Int Colors -/- Number of colors [in 1st icon] - -pcx plugin: -=========== - -type key W/A details ------------------------------------------------------------------------- -QSize Dimensions -/- Dimensions in pixels -Int BitDepth -/- Bits per pixel -QSize Resolution -/- Resolution in DPI -String Compression -/- Compression type, if any - - -rgb plugin: -=========== - -type key details ------------------------------------------------------------------------- -String ImageName Image name (or comment) -QSize Dimensions Dimensions in pixels -Int BitDepth Bits per pixel -String ColorMode Color Mode (Monochrome, RGB, RGBA etc) -String Compression Compression type -String SharedRows Percentage of shared rows - (amount of "aggression" -> see GIMP) -dds plugin: -=========== - -type key details ------------------------------------------------------------------------- -QSize Dimensions Dimensions in pixels -Int Depth Depth in pixels -Int BitDepth Bits per pixel -String ColorMode Color Mode (RGB, RGBA) -String Type 2D, volume or cube map -String Compression Compression type - diff --git a/kfile-plugins/bmp/CMakeLists.txt b/kfile-plugins/bmp/CMakeLists.txt deleted file mode 100644 index c1c46db6..00000000 --- a/kfile-plugins/bmp/CMakeLists.txt +++ /dev/null @@ -1,34 +0,0 @@ -################################################# -# -# (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 kfile_bmp.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - - -#### kfile_bmp (module) ######################### - -tde_add_kpart( kfile_bmp AUTOMOC - SOURCES kfile_bmp.cpp - LINK kio-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kfile-plugins/bmp/Makefile.am b/kfile-plugins/bmp/Makefile.am deleted file mode 100644 index dbaa8ff2..00000000 --- a/kfile-plugins/bmp/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for bmp 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_bmp.h - -kde_module_LTLIBRARIES = kfile_bmp.la - -kfile_bmp_la_SOURCES = kfile_bmp.cpp -kfile_bmp_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -kfile_bmp_la_LIBADD = $(LIB_KSYCOCA) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) kfile_bmp.cpp -o $(podir)/kfile_bmp.pot - -services_DATA = kfile_bmp.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/bmp/kfile_bmp.cpp b/kfile-plugins/bmp/kfile_bmp.cpp deleted file mode 100644 index cfda7a16..00000000 --- a/kfile-plugins/bmp/kfile_bmp.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Shane Wright - * - * 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 -#include "kfile_bmp.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#if !defined(__osf__) -#include -#else -typedef unsigned long uint32_t; -typedef unsigned short uint16_t; -#endif - -typedef KGenericFactory BmpFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_bmp, BmpFactory( "kfile_bmp" )) - -KBmpPlugin::KBmpPlugin(TQObject *parent, const char *name, - const TQStringList &args) - - : KFilePlugin(parent, name, args) -{ - KFileMimeTypeInfo* info = addMimeTypeInfo( "image/x-bmp" ); - - KFileMimeTypeInfo::GroupInfo* group = 0L; - - group = addGroupInfo(info, "Technical", i18n("Technical Details")); - - KFileMimeTypeInfo::ItemInfo* item; - - item = addItemInfo(group, "Type", i18n("Type"), TQVariant::String); - - 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, "Compression", i18n("Compression"), TQVariant::String); - -} - - -bool KBmpPlugin::readInfo( KFileMetaInfo& info, uint what) -{ - const char * bmptype_bm = "BM"; - const char * bmptype_ba = "BA"; - const char * bmptype_ci = "CI"; - const char * bmptype_cp = "CP"; - const char * bmptype_ic = "IC"; - const char * bmptype_pt = "PT"; - - TQFile file(info.path()); - - if (!file.open(IO_ReadOnly)) - { - kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()).data() << endl; - return false; - } - - TQDataStream dstream(&file); - - // BMP files are little-endian - dstream.setByteOrder(TQDataStream::LittleEndian); - - // create this now because we output image type early on - KFileMetaInfoGroup group = appendGroup(info, "Technical"); - - - // read the beginning of the file and make sure it looks ok - unsigned char * bmp_id = (unsigned char *) malloc(2); - file.readBlock((char *) bmp_id, 2); - - if (memcmp(bmp_id, bmptype_bm, 2) == 0) { - appendItem(group, "Type", i18n("Windows Bitmap")); - } else if (memcmp(bmp_id, bmptype_ba, 2) == 0) { - appendItem(group, "Type", i18n("OS/2 Bitmap Array")); - } else if (memcmp(bmp_id, bmptype_ci, 2) == 0) { - appendItem(group, "Type", i18n("OS/2 Color Icon")); - } else if (memcmp(bmp_id, bmptype_cp, 2) == 0) { - appendItem(group, "Type", i18n("OS/2 Color Pointer")); - } else if (memcmp(bmp_id, bmptype_ic, 2) == 0) { - appendItem(group, "Type", i18n("OS/2 Icon")); - } else if (memcmp(bmp_id, bmptype_pt, 2) == 0) { - appendItem(group, "Type", i18n("OS/2 Pointer")); - } else { - return false; - } - - free(bmp_id); - - - // read the next bits, we ignore them, but anyways... - uint32_t bmp_size; - uint16_t bmp_reserved1; - uint16_t bmp_reserved2; - uint32_t bmp_offbits; - - dstream >> bmp_size; - dstream >> bmp_reserved1; - dstream >> bmp_reserved2; - dstream >> bmp_offbits; - - - // we should now be at the file info structure - uint32_t bmpi_size; - uint32_t bmpi_width; - uint32_t bmpi_height; - uint16_t bmpi_planes; - uint16_t bmpi_bitcount; - uint32_t bmpi_compression; - - dstream >> bmpi_size; - dstream >> bmpi_width; - dstream >> bmpi_height; - dstream >> bmpi_planes; - dstream >> bmpi_bitcount; - dstream >> bmpi_compression; - - - // output the useful bits - appendItem(group, "Dimensions", TQSize(bmpi_width, bmpi_height)); - appendItem(group, "BitDepth", bmpi_bitcount); - - switch (bmpi_compression) { - case 0 : - appendItem(group, "Compression", i18n("None")); - break; - case 1 : - appendItem(group, "Compression", i18n("RLE 8bit/pixel")); - break; - case 2 : - appendItem(group, "Compression", i18n("RLE 4bit/pixel")); - break; - case 3 : - appendItem(group, "Compression", i18n("Bitfields")); - break; - default : - appendItem(group, "Compression", i18n("Unknown")); - } - - return true; -} - -#include "kfile_bmp.moc" diff --git a/kfile-plugins/bmp/kfile_bmp.desktop b/kfile-plugins/bmp/kfile_bmp.desktop deleted file mode 100644 index eb66bc53..00000000 --- a/kfile-plugins/bmp/kfile_bmp.desktop +++ /dev/null @@ -1,66 +0,0 @@ -[Desktop Entry] -Type=Service -Name=BMP Info -Name[af]=Bmp Inligting -Name[ar]=معلومات BMP -Name[br]=Titouroù BMP -Name[ca]=Informació de BMP -Name[cs]=BMP info -Name[cy]=Gwybodaeth BMP -Name[da]=BMP-info -Name[de]=BMP-Info -Name[el]=Πληροφορίες BMP -Name[eo]=BMP-informo -Name[es]=Info BMP -Name[et]=BMP info -Name[fa]=اطلاعات BMP -Name[fi]=BMP-tiedot -Name[fr]=Informations BMP -Name[ga]=Eolas faoi BMP -Name[gl]=Inf. BMP -Name[he]=מידע BMP -Name[hi]=BMP जानकारी -Name[hr]=BMP informacije -Name[hu]=BMP-jellemzők -Name[is]=BMP upplýsingar -Name[it]=Informazioni BMP -Name[ja]=BMP 情報 -Name[kk]=BMP мәліметі -Name[km]=ព័ត៌មាន BMP -Name[lt]=BMP informacija -Name[ms]=Maklumat BMP -Name[nds]=BMP-Info -Name[ne]=BMP सूचना -Name[nl]=BMP-info -Name[nn]=BMP-info -Name[nso]=Tshedimoso ya BMP -Name[pa]=BMP ਜਾਣਕਾਰੀ -Name[pl]=Informacja o pliku BMP -Name[pt]=Informação do BMP -Name[pt_BR]=Informação sobre BMP -Name[ro]=Informaţii BMP -Name[ru]=Информация о BMP -Name[se]=BMP-dieđut -Name[sl]=Podatki o BMP -Name[sr]=BMP информације -Name[sr@Latn]=BMP informacije -Name[sv]=BMP-information -Name[ta]=BMP தகவல் -Name[tg]=Иттилоот оиди BMP -Name[th]=ข้อมูลแฟ้ม BMP -Name[tr]=BMP Bilgisi -Name[uk]=Інформація по BMP -Name[uz]=BMP haqida maʼlumot -Name[uz@cyrillic]=BMP ҳақида маълумот -Name[ven]=Mafhungo BMP -Name[wa]=Informåcion sol imådje BMP -Name[xh]=Ulwazi lwe BMP -Name[zh_CN]=BMP 信息 -Name[zh_HK]=BMP 資訊 -Name[zh_TW]=BMP 資訊 -Name[zu]=Ulwazi lwe-BMP -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_bmp -MimeType=image/x-bmp -PreferredGroups=Technical -PreferredItems=Type,Resolution,Bitdepth,Compression diff --git a/kfile-plugins/bmp/kfile_bmp.h b/kfile-plugins/bmp/kfile_bmp.h deleted file mode 100644 index b57e725f..00000000 --- a/kfile-plugins/bmp/kfile_bmp.h +++ /dev/null @@ -1,38 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Shane Wright - * - * 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_BMP_H__ -#define __KFILE_BMP_H__ - -#include - -class TQStringList; - -class KBmpPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KBmpPlugin( TQObject *parent, const char *name, const TQStringList& args ); - - virtual bool readInfo( KFileMetaInfo& info, uint what); -}; - -#endif diff --git a/kfile-plugins/configure.in.bot b/kfile-plugins/configure.in.bot deleted file mode 100644 index f03bc711..00000000 --- a/kfile-plugins/configure.in.bot +++ /dev/null @@ -1,32 +0,0 @@ -if test -z "$LIBTIFF"; then - echo "" - echo "You're missing libtiff. The additional info plugin for TIFF images" - echo "files won't be compiled without libtiff." - echo "You can download it from http://www.libtiff.org" - echo "" - all_tests=bad -fi - -#if test -z "$POPPLER_LIBS"; then -# echo "" -# echo "You're missing poppler. The additional info plugin for PDF files" -# echo "files won't be compiled without poppler >= 0.3.1." -# echo "You can download poppler from http://poppler.freedesktop.org/" -# echo "" -#fi - -if test "$EXRSTATUS" = "no"; then - echo "" - echo "No OpenEXR Libraries were found" - echo "Install the OpenEXR package (from http://www.openexr.org)" - echo "if you want EXR image format support" - echo "" -fi - -if test "$EXRSTATUS" = "old"; then - echo "" - echo "OpenEXR libraries were found, but at least version 1.1.0 is required" - echo "Install a newer OpenEXR package (from http://www.openexr.org)" - echo "if you want EXR image format support" - echo "" -fi diff --git a/kfile-plugins/dds/CMakeLists.txt b/kfile-plugins/dds/CMakeLists.txt deleted file mode 100644 index 77716a5d..00000000 --- a/kfile-plugins/dds/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -################################################# -# -# (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 kfile_dds.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - - -#### kfile_dds (module) ########################## - -tde_add_kpart( kfile_dds AUTOMOC - SOURCES kfile_dds.cpp - LINK kio-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kfile-plugins/dds/Makefile.am b/kfile-plugins/dds/Makefile.am deleted file mode 100644 index c3e0382a..00000000 --- a/kfile-plugins/dds/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for dds 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_dds.h - -kde_module_LTLIBRARIES = kfile_dds.la - -kfile_dds_la_SOURCES = kfile_dds.cpp -kfile_dds_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -kfile_dds_la_LIBADD = $(LIB_KSYCOCA) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) kfile_dds.cpp -o $(podir)/kfile_dds.pot - -services_DATA = kfile_dds.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/dds/kfile_dds.cpp b/kfile-plugins/dds/kfile_dds.cpp deleted file mode 100644 index c392685f..00000000 --- a/kfile-plugins/dds/kfile_dds.cpp +++ /dev/null @@ -1,317 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Ignacio Casta�o - * - * 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 -#include "kfile_dds.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - - -typedef KGenericFactory DdsFactory; - -typedef TQ_UINT32 uint; -typedef TQ_UINT16 ushort; -typedef TQ_UINT8 uchar; - -namespace { // Private. - -#if !defined(MAKEFOURCC) -# define MAKEFOURCC(ch0, ch1, ch2, ch3) \ - (uint(uchar(ch0)) | (uint(uchar(ch1)) << 8) | \ - (uint(uchar(ch2)) << 16) | (uint(uchar(ch3)) << 24 )) -#endif - - static const uint FOURCC_DDS = MAKEFOURCC('D', 'D', 'S', ' '); - static const uint FOURCC_DXT1 = MAKEFOURCC('D', 'X', 'T', '1'); - static const uint FOURCC_DXT2 = MAKEFOURCC('D', 'X', 'T', '2'); - static const uint FOURCC_DXT3 = MAKEFOURCC('D', 'X', 'T', '3'); - static const uint FOURCC_DXT4 = MAKEFOURCC('D', 'X', 'T', '4'); - static const uint FOURCC_DXT5 = MAKEFOURCC('D', 'X', 'T', '5'); - static const uint FOURCC_RXGB = MAKEFOURCC('R', 'X', 'G', 'B'); - - static const uint DDSD_CAPS = 0x00000001l; - static const uint DDSD_PIXELFORMAT = 0x00001000l; - static const uint DDSD_WIDTH = 0x00000004l; - static const uint DDSD_HEIGHT = 0x00000002l; - static const uint DDSD_PITCH = 0x00000008l; - - static const uint DDSCAPS_TEXTURE = 0x00001000l; - static const uint DDSCAPS2_VOLUME = 0x00200000l; - static const uint DDSCAPS2_CUBEMAP = 0x00000200l; - - static const uint DDPF_RGB = 0x00000040l; - static const uint DDPF_FOURCC = 0x00000004l; - static const uint DDPF_ALPHAPIXELS = 0x00000001l; - - enum DDSType { - DDS_A8R8G8B8 = 0, - DDS_A1R5G5B5 = 1, - DDS_A4R4G4B4 = 2, - DDS_R8G8B8 = 3, - DDS_R5G6B5 = 4, - DDS_DXT1 = 5, - DDS_DXT2 = 6, - DDS_DXT3 = 7, - DDS_DXT4 = 8, - DDS_DXT5 = 9, - DDS_RXGB = 10, - DDS_UNKNOWN - }; - - - struct DDSPixelFormat { - uint size; - uint flags; - uint fourcc; - uint bitcount; - uint rmask; - uint gmask; - uint bmask; - uint amask; - }; - - TQDataStream & operator>> ( TQDataStream & s, DDSPixelFormat & pf ) - { - s >> pf.size; - s >> pf.flags; - s >> pf.fourcc; - s >> pf.bitcount; - s >> pf.rmask; - s >> pf.gmask; - s >> pf.bmask; - s >> pf.amask; - return s; - } - - struct DDSCaps { - uint caps1; - uint caps2; - uint caps3; - uint caps4; - }; - - TQDataStream & operator>> ( TQDataStream & s, DDSCaps & caps ) - { - s >> caps.caps1; - s >> caps.caps2; - s >> caps.caps3; - s >> caps.caps4; - return s; - } - - struct DDSHeader { - uint size; - uint flags; - uint height; - uint width; - uint pitch; - uint depth; - uint mipmapcount; - uint reserved[11]; - DDSPixelFormat pf; - DDSCaps caps; - uint notused; - }; - - TQDataStream & operator>> ( TQDataStream & s, DDSHeader & header ) - { - s >> header.size; - s >> header.flags; - s >> header.height; - s >> header.width; - s >> header.pitch; - s >> header.depth; - s >> header.mipmapcount; - for( int i = 0; i < 11; i++ ) { - s >> header.reserved[i]; - } - s >> header.pf; - s >> header.caps; - s >> header.notused; - return s; - } - - static bool IsValid( const DDSHeader & header ) - { - if( header.size != 124 ) { - return false; - } - const uint required = (DDSD_WIDTH|DDSD_HEIGHT|DDSD_CAPS|DDSD_PIXELFORMAT); - if( (header.flags & required) != required ) { - return false; - } - if( header.pf.size != 32 ) { - return false; - } - if( !(header.caps.caps1 & DDSCAPS_TEXTURE) ) { - return false; - } - return true; - } - -} // namespace - - - -K_EXPORT_COMPONENT_FACTORY(kfile_dds, DdsFactory( "kfile_dds" )) - -// Constructor, init mime type info. -KDdsPlugin::KDdsPlugin(TQObject *parent, const char *name, const TQStringList &args) : - KFilePlugin(parent, name, args) -{ - KFileMimeTypeInfo * info = addMimeTypeInfo( "image/x-dds" ); - - KFileMimeTypeInfo::GroupInfo * group = 0L; - - group = addGroupInfo(info, "Technical", i18n("Technical Details")); - - KFileMimeTypeInfo::ItemInfo * item; - - item = addItemInfo(group, "Dimensions", i18n("Dimensions"), TQVariant::Size); - setHint(item, KFileMimeTypeInfo::Size); - setUnit(item, KFileMimeTypeInfo::Pixels); - - item = addItemInfo(group, "Depth", i18n("Depth"), TQVariant::Int); - setUnit(item, KFileMimeTypeInfo::Pixels); - - item = addItemInfo(group, "BitDepth", i18n("Bit Depth"), TQVariant::Int); - setUnit(item, KFileMimeTypeInfo::BitsPerPixel); - - addItemInfo(group, "MipmapCount", i18n("Mipmap Count"), TQVariant::Int); - - addItemInfo(group, "Type", i18n("Type"), TQVariant::String); - addItemInfo(group, "ColorMode", i18n("Color Mode"), TQVariant::String); - addItemInfo(group, "Compression", i18n("Compression"), TQVariant::String); -} - -// Read mime type info. -bool KDdsPlugin::readInfo( KFileMetaInfo& info, uint /*what*/) -{ - TQFile file(info.path()); - - if (!file.open(IO_ReadOnly)) { - kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()).data() << endl; - return false; - } - - TQDataStream s(&file); - s.setByteOrder(TQDataStream::LittleEndian); - - // Validate header. - uint fourcc; - s >> fourcc; - if( fourcc != FOURCC_DDS ) { - kdDebug(7034) << TQFile::encodeName(info.path()).data() << " is not a DDS file." << endl; - return false; - } - - // Read image header. - DDSHeader header; - s >> header; - - // Check image file format. - if( s.atEnd() || !IsValid( header ) ) { - kdDebug(7034) << TQFile::encodeName(info.path()).data() << " is not a valid DDS file." << endl; - return false; - } - - // Set file info. - KFileMetaInfoGroup group = appendGroup(info, "Technical"); - appendItem(group, "Dimensions", TQSize(header.width, header.height)); - appendItem(group, "MipmapCount", header.mipmapcount); - - // Set file type. - if( header.caps.caps2 & DDSCAPS2_CUBEMAP ) { - appendItem(group, "Type", i18n("Cube Map Texture")); - } - else if( header.caps.caps2 & DDSCAPS2_VOLUME ) { - appendItem(group, "Type", i18n("Volume Texture")); - appendItem(group, "Depth", header.depth); - } - else { - appendItem(group, "Type", i18n("2D Texture")); - } - - // Set file color depth and compression. - if( header.pf.flags & DDPF_RGB ) { - appendItem(group, "BitDepth", header.pf.bitcount); - appendItem(group, "Compression", i18n("Uncompressed")); - if( header.pf.flags & DDPF_ALPHAPIXELS ) { - appendItem(group, "ColorMode", "RGB/Alpha"); - } - else { - appendItem(group, "ColorMode", "RGB"); - } - } - else if( header.pf.flags & DDPF_FOURCC ) { - switch( header.pf.fourcc ) { - case FOURCC_DXT1: - appendItem(group, "BitDepth", 4); - appendItem(group, "Compression", "DXT1"); - appendItem(group, "ColorMode", "RGB"); - break; - case FOURCC_DXT2: - appendItem(group, "BitDepth", 16); - appendItem(group, "Compression", "DXT2"); - appendItem(group, "ColorMode", "RGB/Alpha"); - break; - case FOURCC_DXT3: - appendItem(group, "BitDepth", 16); - appendItem(group, "Compression", "DXT3"); - appendItem(group, "ColorMode", "RGB/Alpha"); - break; - case FOURCC_DXT4: - appendItem(group, "BitDepth", 16); - appendItem(group, "Compression", "DXT4"); - appendItem(group, "ColorMode", "RGB/Alpha"); - break; - case FOURCC_DXT5: - appendItem(group, "BitDepth", 16); - appendItem(group, "Compression", "DXT5"); - appendItem(group, "ColorMode", "RGB/Alpha"); - break; - case FOURCC_RXGB: - appendItem(group, "BitDepth", 16); - appendItem(group, "Compression", "RXGB"); - appendItem(group, "ColorMode", "RGB"); - break; - default: - appendItem(group, "Compression", "Unknown"); - break; - } - } - else { - appendItem(group, "Compression", "Unknown"); - } - - return true; -} - -#include "kfile_dds.moc" - diff --git a/kfile-plugins/dds/kfile_dds.desktop b/kfile-plugins/dds/kfile_dds.desktop deleted file mode 100644 index c88bfce2..00000000 --- a/kfile-plugins/dds/kfile_dds.desktop +++ /dev/null @@ -1,53 +0,0 @@ -[Desktop Entry] -Type=Service -Name=DirectDraw Surface Info -Name[ca]=Informació de superfície DirectDraw -Name[cs]=DirectDraw Surface info -Name[da]=DirectDraw overflade-info -Name[de]=DirectDraw Oberflächeninfo -Name[el]=Πληροφορίες επιφάνειας DirectDraw -Name[eo]=DirectDraw surfac-informo -Name[es]=Información de la primera vista de DirectDraw -Name[et]=DirectDraw Surface'i info -Name[eu]=DirectDraw Surface informazioa -Name[fa]=اطلاعات سطح DirectDraw -Name[fi]=DirectDraw pintatieto -Name[fr]=Informations de surface DirectDraw -Name[ga]=Eolas faoi DirectDraw Surface -Name[gl]=Información de Superficie de DirectDraw -Name[he]=מיגע אודות משטח DirectDraw -Name[hu]=DirectDraw felületinformáció -Name[is]=DirectDraw yfirborðs upplýsingar -Name[it]=Informazioni superficie DirectDraw -Name[ja]=DDS (DirectDraw Surface) 情報 -Name[kk]=DirectDraw бедерінің мәлметі -Name[km]=ព័ត៌មាន​ផ្ទៃ​ខាង​ក្រៅ​អំពី DirectDraw -Name[lt]=DirectDraw Surface informacija -Name[ms]=Maklumat Permukaan LukisTerus -Name[nb]=DirectDraw Overflate info -Name[nds]="DirectDraw"-Böversietinfo -Name[ne]=प्रत्यक्ष रेखाचित्र सतह सूचना -Name[nl]=DirectDraw Surface-info -Name[nn]=DirectDraw-overflateinfo -Name[pl]=Informacja o powierzchni DirectDraw -Name[pt]=Informação de Superfície DirectDraw -Name[pt_BR]=Informações Sobre Superfícies Direct Draw -Name[ro]=Informaţii Suprafaţă DirectDraw -Name[ru]=Сведения о поверхности DirectDraw -Name[sk]=DirectDraw informácie o povrchu -Name[sl]=Podatki o površini DirectDraw -Name[sr]=Информације о DirectDraw површини -Name[sr@Latn]=Informacije o DirectDraw površini -Name[sv]=Directdraw ytinformation -Name[ta]=நேரடி மேற்பரப்பு தகவல் -Name[th]=ข้อมูลแฟ้มพื้นผิว DirectDraw -Name[tr]=DirectDraw Yüzey Bilgisi -Name[uk]=Інформація про поверхню DirectDraw -Name[zh_CN]=DirectDraw 表面信息 -Name[zh_HK]=DirectDraw 表面資訊 -Name[zh_TW]=DirectDraw Surface 資訊 -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_dds -MimeType=image/x-dds -PreferredGroups=Technical -PreferredItems=Dimensions,Depth,BitDepth,Type,ColorMode,Compression diff --git a/kfile-plugins/dds/kfile_dds.h b/kfile-plugins/dds/kfile_dds.h deleted file mode 100644 index 4a0eefbb..00000000 --- a/kfile-plugins/dds/kfile_dds.h +++ /dev/null @@ -1,38 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Ignacio Castao - * - * 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_DDS_H__ -#define __KFILE_DDS_H__ - -#include - -class TQStringList; - -class KDdsPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KDdsPlugin( TQObject *parent, const char *name, const TQStringList& args ); - - virtual bool readInfo( KFileMetaInfo& info, uint what); -}; - -#endif diff --git a/kfile-plugins/dependencies/CMakeLists.txt b/kfile-plugins/dependencies/CMakeLists.txt deleted file mode 100644 index a4b1da2c..00000000 --- a/kfile-plugins/dependencies/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -if( WITH_PDF ) - add_subdirectory( poppler-tqt ) -endif ( ) diff --git a/kfile-plugins/dependencies/Makefile.am b/kfile-plugins/dependencies/Makefile.am deleted file mode 100644 index 1c8d5d88..00000000 --- a/kfile-plugins/dependencies/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS=poppler-tqt diff --git a/kfile-plugins/dependencies/poppler-tqt/CMakeLists.txt b/kfile-plugins/dependencies/poppler-tqt/CMakeLists.txt deleted file mode 100644 index 42d50a80..00000000 --- a/kfile-plugins/dependencies/poppler-tqt/CMakeLists.txt +++ /dev/null @@ -1,54 +0,0 @@ -################################################# -# -# (C) 2010-2011 Calvin Morrison -# mutantturkey@gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -project( libpoppler-tqt ) - -##### configure checks ########################## - -include( ConfigureChecks.cmake ) - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_BINARY_DIR} - ${TDE_INCLUDE_DIR} - ${TQT_INCLUDE_DIRS} - ${CMAKE_SOURCE_DIR}/kfile-plugins/dependencies/poppler-tqt - ${POPPLER_INCLUDE_DIRS} -) - -link_directories( - ${TQT_LIBRARY_DIRS} -) - -##### pc files ################################## - -configure_file( poppler-tqt.pc.cmake poppler-tqt.pc @ONLY ) - -install( FILES ${CMAKE_CURRENT_BINARY_DIR}/poppler-tqt.pc DESTINATION ${PKGCONFIG_INSTALL_DIR} ) - -##### headers ################################### - -install( FILES - poppler-qt.h poppler-page-transition.h poppler-link-qt3.h - DESTINATION ${INCLUDE_INSTALL_DIR} ) - -##### poppler-tqt (shared) ############################ - -tde_add_library( poppler-tqt SHARED AUTOMOC - SOURCES - poppler-document.cc poppler-fontinfo.cc - poppler-link.cc poppler-page.cc - poppler-page-transition.cc poppler-page-transition-private.h - poppler-private.cc poppler-private.h - VERSION 0.0.0 - LINK poppler ${TQT_LIBRARIES} - DESTINATION ${LIB_INSTALL_DIR} -) diff --git a/kfile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake b/kfile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake deleted file mode 100644 index b15057c9..00000000 --- a/kfile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake +++ /dev/null @@ -1,21 +0,0 @@ -# Poppler -pkg_search_module( POPPLER poppler ) -if( POPPLER_FOUND ) - set( HAVE_POPPLER 1 ) -else( ) - tde_message_fatal( "poppler is required, but was not found on your system" ) -endif( ) - -tde_save( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES ) -set( CMAKE_REQUIRED_INCLUDES ${DBUS_TQT_INCLUDE_DIRS} ${TQT_INCLUDE_DIRS} ${QT_INCLUDE_DIRS} ${POPPLER_INCLUDE_DIRS}) -set( CMAKE_REQUIRED_LIBRARIES ${DBUS_TQT_LDFLAGS} ${TQT_LDFLAGS} ${QT_LDFLAGS} ${POPPLER_LDFLAGS} ) -check_cxx_source_compiles(" - #include - int main(int, char**) { int a; int b; PSOutputDev *psOut = new PSOutputDev(\"test\", (PDFDoc*)0, (XRef*)0, (Catalog*)0, NULL, 0, 0, psModePS, a, b); } " - HAVE_POPPLER_016 ) -check_cxx_source_compiles(" - #include - int main(int, char**) { int a; int b; PSOutputDev *psOut = new PSOutputDev(\"test\", (PDFDoc*)0, NULL, 0, 0, psModePS, a, b); } " - HAVE_POPPLER_020 ) -tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES ) - diff --git a/kfile-plugins/dependencies/poppler-tqt/Makefile.am b/kfile-plugins/dependencies/poppler-tqt/Makefile.am deleted file mode 100644 index 949dc2a4..00000000 --- a/kfile-plugins/dependencies/poppler-tqt/Makefile.am +++ /dev/null @@ -1,40 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - -I/usr/include/poppler \ - $(cairo_includes) \ - $(QT_INCLUDES) \ - $(FREETYPE_CFLAGS) \ - $(FONTCONFIG_CFLAGS) - - -poppler_includedir = $(includedir)/ -poppler_include_HEADERS = \ - poppler-qt.h \ - poppler-page-transition.h \ - poppler-link-qt3.h - -lib_LTLIBRARIES = libpoppler-tqt.la -libpoppler_tqt_la_SOURCES = \ - poppler-document.cc \ - poppler-fontinfo.cc \ - poppler-link.cc \ - poppler-page.cc \ - poppler-page-transition.cc \ - poppler-page-transition-private.h \ - poppler-private.cc \ - poppler-private.h - -libpoppler_tqt_la_LIBADD = \ - -lpoppler \ - $(QT_LIBS) \ - $(FREETYPE_LIBS) \ - $(FONTCONFIG_LIBS) - -test_poppler_tqt_SOURCES = \ - test-poppler-qt.cpp - -test_poppler_tqt_LDADD = \ - $(top_builddir)/poppler/libpoppler.la \ - libpoppler-tqt.la \ - $(QT_LIBS) \ - $(FREETYPE_LIBS) diff --git a/kfile-plugins/dependencies/poppler-tqt/poppler-document.cc b/kfile-plugins/dependencies/poppler-tqt/poppler-document.cc deleted file mode 100644 index 2e7cc516..00000000 --- a/kfile-plugins/dependencies/poppler-tqt/poppler-document.cc +++ /dev/null @@ -1,341 +0,0 @@ -/* poppler-document.cc: qt interface to poppler - * Copyright (C) 2005, Net Integration Technologies, Inc. - * Copyright (C) 2005-2009, Albert Astals Cid - * Copyright (C) 2006, Stefan Kebekus - * Copyright (C) 2006, Wilfried Huss - * - * 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, 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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "poppler-private.h" - -#undef bool - -namespace Poppler { - -Document *Document::load(const TQString &filePath) -{ - if (!globalParams) { - globalParams = new GlobalParams(); - } - - DocumentData *doc = new DocumentData(new GooString(TQFile::encodeName(filePath)), NULL); - Document *pdoc; - if (doc->doc.isOk() || doc->doc.getErrorCode() == errEncrypted) { - pdoc = new Document(doc); - if (doc->doc.getErrorCode() == errEncrypted) - pdoc->data->locked = true; - else - pdoc->data->locked = false; - pdoc->data->m_fontInfoScanner = new FontInfoScanner(&(doc->doc)); - return pdoc; - } - else - return NULL; -} - -Document::Document(DocumentData *dataA) -{ - data = dataA; -} - -Document::~Document() -{ - delete data; -} - -bool Document::isLocked() const -{ - return data->locked; -} - -bool Document::unlock(const TQCString &password) -{ - if (data->locked) { - /* racier then it needs to be */ - GooString *filename = new GooString(data->doc.getFileName()); - GooString *pwd = new GooString(password.data()); - DocumentData *doc2 = new DocumentData(filename, pwd); - delete pwd; - if (!doc2->doc.isOk()) { - delete doc2; - } else { - delete data; - data = doc2; - data->locked = false; - data->m_fontInfoScanner = new FontInfoScanner(&(data->doc)); - } - } - return data->locked; -} - -Document::PageMode Document::getPageMode(void) const -{ - switch (data->doc.getCatalog()->getPageMode()) { - case Catalog::pageModeNone: - return UseNone; - case Catalog::pageModeOutlines: - return UseOutlines; - case Catalog::pageModeThumbs: - return UseThumbs; - case Catalog::pageModeFullScreen: - return FullScreen; - case Catalog::pageModeOC: - return UseOC; - default: - return UseNone; - } -} - -int Document::getNumPages() const -{ - return data->doc.getNumPages(); -} - -TQValueList Document::fonts() const -{ - TQValueList ourList; - scanForFonts(getNumPages(), &ourList); - return ourList; -} - -bool Document::scanForFonts( int numPages, TQValueList *fontList ) const -{ - GooList *items = data->m_fontInfoScanner->scan( numPages ); - - if ( NULL == items ) - return false; - - for ( int i = 0; i < items->getLength(); ++i ) { - TQString fontName; - if (((::FontInfo*)items->get(i))->getName()) - fontName = ((::FontInfo*)items->get(i))->getName()->getCString(); - - FontInfo font(fontName, - ((::FontInfo*)items->get(i))->getEmbedded(), - ((::FontInfo*)items->get(i))->getSubset(), - (Poppler::FontInfo::Type)((::FontInfo*)items->get(i))->getType()); - fontList->append(font); - } - deleteGooList(items, ::FontInfo); - return true; -} - -/* borrowed from kpdf */ -TQString Document::getInfo( const TQString & type ) const -{ - // [Albert] Code adapted from pdfinfo.cc on xpdf - Object info; - if ( data->locked ) - return NULL; - - data->doc.getDocInfo( &info ); - if ( !info.isDict() ) - return NULL; - - TQString result; - Object obj; - GooString *s1; - GBool isUnicode; - Unicode u; - int i; - Dict *infoDict = info.getDict(); - - if ( infoDict->lookup( (char*)type.latin1(), &obj )->isString() ) - { - s1 = obj.getString(); - if ( ( s1->getChar(0) & 0xff ) == 0xfe && ( s1->getChar(1) & 0xff ) == 0xff ) - { - isUnicode = gTrue; - i = 2; - } - else - { - isUnicode = gFalse; - i = 0; - } - while ( i < obj.getString()->getLength() ) - { - if ( isUnicode ) - { - u = ( ( s1->getChar(i) & 0xff ) << 8 ) | ( s1->getChar(i+1) & 0xff ); - i += 2; - } - else - { - u = s1->getChar(i) & 0xff; - ++i; - } - result += unicodeToTQString( &u, 1 ); - } - obj.free(); - info.free(); - return result; - } - obj.free(); - info.free(); - return NULL; -} - -/* borrowed from kpdf */ -TQDateTime Document::getDate( const TQString & type ) const -{ - // [Albert] Code adapted from pdfinfo.cc on xpdf - if ( data->locked ) - return TQDateTime(); - - Object info; - data->doc.getDocInfo( &info ); - if ( !info.isDict() ) { - info.free(); - return TQDateTime(); - } - - Object obj; - int year, mon, day, hour, min, sec, tz_hour, tz_minute; - char tz; - Dict *infoDict = info.getDict(); - TQString result; - - if ( infoDict->lookup( (char*)type.latin1(), &obj )->isString() ) - { - TQString s = UnicodeParsedString(obj.getString()); - // TODO do something with the timezone information - if ( parseDateString( s.latin1(), &year, &mon, &day, &hour, &min, &sec, &tz, &tz_hour, &tz_minute ) ) - { - TQDate d( year, mon, day ); //CHECK: it was mon-1, Jan->0 (??) - TQTime t( hour, min, sec ); - if ( d.isValid() && t.isValid() ) { - obj.free(); - info.free(); - return TQDateTime( d, t ); - } - } - } - obj.free(); - info.free(); - return TQDateTime(); -} - -bool Document::isEncrypted() const -{ - return data->doc.isEncrypted(); -} - -bool Document::isLinearized() const -{ - return data->doc.isLinearized(); -} - -bool Document::okToPrint() const -{ - return data->doc.okToPrint(); -} - -bool Document::okToChange() const -{ - return data->doc.okToChange(); -} - -bool Document::okToCopy() const -{ - return data->doc.okToCopy(); -} - -bool Document::okToAddNotes() const -{ - return data->doc.okToAddNotes(); -} - -double Document::getPDFVersion() const -{ - return data->doc.getPDFMajorVersion () + data->doc.getPDFMinorVersion() / 10.0; -} - -void Document::getPdfVersion(int *major, int *minor) const -{ - if (major) - *major = data->doc.getPDFMajorVersion(); - if (minor) - *minor = data->doc.getPDFMinorVersion(); -} - -TQDomDocument *Document::toc() const -{ - Outline * outline = data->doc.getOutline(); - if ( !outline ) - return NULL; - - GooList * items = outline->getItems(); - if ( !items || items->getLength() < 1 ) - return NULL; - - TQDomDocument *toc = new TQDomDocument(); - if ( items->getLength() > 0 ) - data->addTocChildren( toc, toc, items ); - - return toc; -} - -LinkDestination *Document::linkDestination( const TQString &name ) -{ - GooString * namedDest = TQStringToGooString( name ); - LinkDestinationData ldd(NULL, namedDest, data); - LinkDestination *ld = new LinkDestination(ldd); - delete namedDest; - return ld; -} - -bool Document::print(const TQString &fileName, TQValueList pageList, double hDPI, double vDPI, int rotate) -{ - return print(fileName, pageList, hDPI, vDPI, rotate, -1, -1); -} - -bool Document::print(const TQString &file, TQValueList pageList, double hDPI, double vDPI, int rotate, int paperWidth, int paperHeight) -{ -#if defined(HAVE_POPPLER_020) - PSOutputDev *psOut = new PSOutputDev(file.latin1(), &(data->doc), NULL, 1, data->doc.getNumPages(), psModePS, paperWidth, paperHeight); -#elif defined(HAVE_POPPLER_016) - PSOutputDev *psOut = new PSOutputDev(file.latin1(), &(data->doc), data->doc.getXRef(), data->doc.getCatalog(), NULL, 1, data->doc.getNumPages(), psModePS, paperWidth, paperHeight); -#else - PSOutputDev *psOut = new PSOutputDev(file.latin1(), data->doc.getXRef(), data->doc.getCatalog(), NULL, 1, data->doc.getNumPages(), psModePS, paperWidth, paperHeight); -#endif - - if (psOut->isOk()) { - TQValueList::iterator it; - for (it = pageList.begin(); it != pageList.end(); ++it ) - data->doc.displayPage(psOut, *it, hDPI, vDPI, rotate, gFalse, gTrue, gTrue); - - delete psOut; - return true; - } else { - delete psOut; - return false; - } -} - -} diff --git a/kfile-plugins/dependencies/poppler-tqt/poppler-fontinfo.cc b/kfile-plugins/dependencies/poppler-tqt/poppler-fontinfo.cc deleted file mode 100644 index c0e777a7..00000000 --- a/kfile-plugins/dependencies/poppler-tqt/poppler-fontinfo.cc +++ /dev/null @@ -1,83 +0,0 @@ -/* poppler-qt.h: qt interface to poppler - * Copyright (C) 2005, Albert Astals Cid - * - * 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, 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. - */ - -#include "poppler-qt.h" - -namespace Poppler { - -class FontInfoData -{ - public: - TQString fontName; - bool isEmbedded; - bool isSubset; - FontInfo::Type type; -}; - -FontInfo::FontInfo( const TQString &fontName, const bool isEmbedded, const bool isSubset, Type type ) -{ - data = new FontInfoData(); - data->fontName = fontName; - data->isEmbedded = isEmbedded; - data->isSubset = isSubset; - data->type = type; -} - -FontInfo::FontInfo( const FontInfo &fi ) -{ - data = new FontInfoData(); - data->fontName = fi.data->fontName; - data->isEmbedded = fi.data->isEmbedded; - data->isSubset = fi.data->isSubset; - data->type = fi.data->type; -} - -FontInfo::FontInfo() -{ - data = new FontInfoData(); - data->isEmbedded = false; - data->isSubset = false; - data->type = unknown; -} - -FontInfo::~FontInfo() -{ - delete data; -} - -const TQString &FontInfo::name() const -{ - return data->fontName; -} - -bool FontInfo::isEmbedded() const -{ - return data->isEmbedded; -} - -bool FontInfo::isSubset() const -{ - return data->isSubset; -} - -FontInfo::Type FontInfo::type() const -{ - return data->type; -} - -} diff --git a/kfile-plugins/dependencies/poppler-tqt/poppler-link-qt3.h b/kfile-plugins/dependencies/poppler-tqt/poppler-link-qt3.h deleted file mode 100644 index fc22d8ed..00000000 --- a/kfile-plugins/dependencies/poppler-tqt/poppler-link-qt3.h +++ /dev/null @@ -1,188 +0,0 @@ -/* poppler-link.h: qt interface to poppler - * Copyright (C) 2006, Albert Astals Cid - * Adapting code from - * Copyright (C) 2004 by Enrico Ros - * - * 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, 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. - */ - -#ifndef _POPPLER_LINK_H_ -#define _POPPLER_LINK_H_ - -#include -#include - -namespace Poppler { - -class LinkDestinationData; - -class LinkDestination -{ - public: - enum Kind - { - destXYZ = 1, - destFit = 2, - destFitH = 3, - destFitV = 4, - destFitR = 5, - destFitB = 6, - destFitBH = 7, - destFitBV = 8 - }; - - LinkDestination(const LinkDestinationData &data); - LinkDestination(const TQString &description); - - // Accessors. - Kind kind() const; - int pageNumber() const; - double left() const; - double bottom() const; - double right() const; - double top() const; - double zoom() const; - bool isChangeLeft() const; - bool isChangeTop() const; - bool isChangeZoom() const; - - TQString toString() const; - - private: - Kind m_kind; // destination type - int m_pageNum; // page number - double m_left, m_bottom; // position - double m_right, m_top; - double m_zoom; // zoom factor - bool m_changeLeft, m_changeTop; // for destXYZ links, which position - bool m_changeZoom; // components to change -}; - -/** - * @short Encapsulates data that describes a link. - * - * This is the base class for links. It makes mandatory for inherited - * widgets to reimplement the 'linkType' method and return the type of - * the link described by the reimplemented class. - */ -class Link -{ - public: - Link( const TQRect &linkArea ); - - // get link type (inherited classes mustreturn an unique identifier) - enum LinkType { None, Goto, Execute, Browse, Action, Movie }; - virtual LinkType linkType() const; - - // virtual destructor - virtual ~Link(); - - TQRect linkArea() const; - - private: - TQRect m_linkArea; -}; - - -/** Goto: a viewport and maybe a reference to an external filename **/ -class LinkGoto : public Link -{ - public: - LinkGoto( const TQRect &linkArea, TQString extFileName, const LinkDestination & destination ); - - // query for goto parameters - bool isExternal() const; - const TQString & fileName() const; - const LinkDestination & destination() const; - LinkType linkType() const; - - private: - TQString m_extFileName; - LinkDestination m_destination; -}; - -/** Execute: filename and parameters to execute **/ -class LinkExecute : public Link -{ - public: - // query for filename / parameters - const TQString & fileName() const; - const TQString & parameters() const; - - // create a Link_Execute - LinkExecute( const TQRect &linkArea, const TQString & file, const TQString & params ); - LinkType linkType() const; - - private: - TQString m_fileName; - TQString m_parameters; -}; - -/** Browse: an URL to open, ranging from 'http://' to 'mailto:' etc.. **/ -class LinkBrowse : public Link -{ - public: - // query for URL - const TQString & url() const; - - // create a Link_Browse - LinkBrowse( const TQRect &linkArea, const TQString &url ); - LinkType linkType() const; - - private: - TQString m_url; -}; - -/** Action: contains an action to perform on document / viewer **/ -class LinkAction : public Link -{ - public: - // define types of actions - enum ActionType { PageFirst = 1, - PagePrev = 2, - PageNext = 3, - PageLast = 4, - HistoryBack = 5, - HistoryForward = 6, - Quit = 7, - Presentation = 8, - EndPresentation = 9, - Find = 10, - GoToPage = 11, - Close = 12 }; - - // query for action type - ActionType actionType() const; - - // create a Link_Action - LinkAction( const TQRect &linkArea, ActionType actionType ); - LinkType linkType() const; - - private: - ActionType m_type; -}; - -/** Movie: Not yet defined -> think renaming to 'Media' link **/ -class LinkMovie : public Link -// TODO this (Movie link) -{ - public: - LinkMovie( const TQRect &linkArea ); - LinkType linkType() const; -}; - -} - -#endif diff --git a/kfile-plugins/dependencies/poppler-tqt/poppler-link.cc b/kfile-plugins/dependencies/poppler-tqt/poppler-link.cc deleted file mode 100644 index 72db1fff..00000000 --- a/kfile-plugins/dependencies/poppler-tqt/poppler-link.cc +++ /dev/null @@ -1,267 +0,0 @@ -/* poppler-link.cc: qt interface to poppler - * Copyright (C) 2006, 2008 Albert Astals Cid - * Adapting code from - * Copyright (C) 2004 by Enrico Ros - * - * 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, 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. - */ - -#include -#include - -#include - -#include - -namespace Poppler { - - LinkDestination::LinkDestination(const LinkDestinationData &data) - { - bool deleteDest = false; - LinkDest *ld = data.ld; - - if ( data.namedDest && !ld ) - { - deleteDest = true; - ld = data.doc->doc.findDest( data.namedDest ); - } - - if (!ld) return; - - if (ld->getKind() == ::destXYZ) m_kind = destXYZ; - else if (ld->getKind() == ::destFit) m_kind = destFit; - else if (ld->getKind() == ::destFitH) m_kind = destFitH; - else if (ld->getKind() == ::destFitV) m_kind = destFitV; - else if (ld->getKind() == ::destFitR) m_kind = destFitR; - else if (ld->getKind() == ::destFitB) m_kind = destFitB; - else if (ld->getKind() == ::destFitBH) m_kind = destFitBH; - else if (ld->getKind() == ::destFitBV) m_kind = destFitBV; - - if ( !ld->isPageRef() ) m_pageNum = ld->getPageNum(); - else - { - Ref ref = ld->getPageRef(); - m_pageNum = data.doc->doc.findPage( ref.num, ref.gen ); - } - double left = ld->getLeft(); - double bottom = ld->getBottom(); - double right = ld->getRight(); - double top = ld->getTop(); - m_zoom = ld->getZoom(); - m_changeLeft = ld->getChangeLeft(); - m_changeTop = ld->getChangeTop(); - m_changeZoom = ld->getChangeZoom(); - - int leftAux = 0, topAux = 0, rightAux = 0, bottomAux = 0; - -#if defined(HAVE_SPLASH) - SplashOutputDev *sod = data.doc->getOutputDev(); - sod->cvtUserToDev( left, top, &leftAux, &topAux ); - sod->cvtUserToDev( right, bottom, &rightAux, &bottomAux ); -#endif - - m_left = leftAux; - m_top = topAux; - m_right = rightAux; - m_bottom = bottomAux; - - if (deleteDest) delete ld; - } - - LinkDestination::LinkDestination(const TQString &description) - { - TQStringList tokens = TQStringList::split(';', description); - m_kind = static_cast(tokens[0].toInt()); - m_pageNum = tokens[1].toInt(); - m_left = tokens[2].toDouble(); - m_bottom = tokens[3].toDouble(); - m_right = tokens[4].toDouble(); - m_top = tokens[5].toDouble(); - m_zoom = tokens[6].toDouble(); - m_changeLeft = static_cast(tokens[7].toInt()); - m_changeTop = static_cast(tokens[8].toInt()); - m_changeZoom = static_cast(tokens[9].toInt()); - } - - LinkDestination::Kind LinkDestination::kind() const - { - return m_kind; - } - - int LinkDestination::pageNumber() const - { - return m_pageNum; - } - - double LinkDestination::left() const - { - return m_left; - } - - double LinkDestination::bottom() const - { - return m_bottom; - } - - double LinkDestination::right() const - { - return m_right; - } - - double LinkDestination::top() const - { - return m_top; - } - - double LinkDestination::zoom() const - { - return m_zoom; - } - - bool LinkDestination::isChangeLeft() const - { - return m_changeLeft; - } - - bool LinkDestination::isChangeTop() const - { - return m_changeTop; - } - - bool LinkDestination::isChangeZoom() const - { - return m_changeZoom; - } - - TQString LinkDestination::toString() const - { - TQString s = TQString::number( (TQ_INT8)m_kind ); - s += ";" + TQString::number( m_pageNum ); - s += ";" + TQString::number( m_left ); - s += ";" + TQString::number( m_bottom ); - s += ";" + TQString::number( m_right ); - s += ";" + TQString::number( m_top ); - s += ";" + TQString::number( m_zoom ); - s += ";" + TQString::number( (TQ_INT8)m_changeLeft ); - s += ";" + TQString::number( (TQ_INT8)m_changeTop ); - s += ";" + TQString::number( (TQ_INT8)m_changeZoom ); - return s; - } - - - // Link - Link::~Link() - { - } - - Link::Link(const TQRect &linkArea) : m_linkArea(linkArea) - { - } - - Link::LinkType Link::linkType() const - { - return None; - } - - TQRect Link::linkArea() const - { - return m_linkArea; - } - - // LinkGoto - LinkGoto::LinkGoto( const TQRect &linkArea, TQString extFileName, const LinkDestination & destination ) : Link(linkArea), m_extFileName(extFileName), m_destination(destination) - { - } - - bool LinkGoto::isExternal() const - { - return !m_extFileName.isEmpty(); - } - - const TQString &LinkGoto::fileName() const - { - return m_extFileName; - } - - const LinkDestination &LinkGoto::destination() const - { - return m_destination; - } - - Link::LinkType LinkGoto::linkType() const - { - return Goto; - } - - // LinkExecute - LinkExecute::LinkExecute( const TQRect &linkArea, const TQString & file, const TQString & params ) : Link(linkArea), m_fileName(file), m_parameters(params) - { - } - - const TQString & LinkExecute::fileName() const - { - return m_fileName; - } - const TQString & LinkExecute::parameters() const - { - return m_parameters; - } - - Link::LinkType LinkExecute::linkType() const - { - return Execute; - } - - // LinkBrowse - LinkBrowse::LinkBrowse( const TQRect &linkArea, const TQString &url ) : Link(linkArea), m_url(url) - { - } - - const TQString & LinkBrowse::url() const - { - return m_url; - } - - Link::LinkType LinkBrowse::linkType() const - { - return Browse; - } - - // LinkAction - LinkAction::LinkAction( const TQRect &linkArea, ActionType actionType ) : Link(linkArea), m_type(actionType) - { - } - - LinkAction::ActionType LinkAction::actionType() const - { - return m_type; - } - - Link::LinkType LinkAction::linkType() const - { - return Action; - } - - // LinkMovie - LinkMovie::LinkMovie( const TQRect &linkArea ) : Link(linkArea) - { - } - - Link::LinkType LinkMovie::linkType() const - { - return Movie; - } - -} diff --git a/kfile-plugins/dependencies/poppler-tqt/poppler-page-transition-private.h b/kfile-plugins/dependencies/poppler-tqt/poppler-page-transition-private.h deleted file mode 100644 index 8bc70825..00000000 --- a/kfile-plugins/dependencies/poppler-tqt/poppler-page-transition-private.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2005, Albert Astals Cid - * - * 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, 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. - */ - -#ifndef POPPLER_PAGE_TRANSITION_PRIVATE_H -#define POPPLER_PAGE_TRANSITION_PRIVATE_H - -class Object; - -namespace Poppler { - -class PageTransitionParams { - public: - Object *dictObj; -}; - -} - -#endif // POPPLER_PAGE_TRANSITION_PRIVATE_H diff --git a/kfile-plugins/dependencies/poppler-tqt/poppler-page-transition.cc b/kfile-plugins/dependencies/poppler-tqt/poppler-page-transition.cc deleted file mode 100644 index cde8818d..00000000 --- a/kfile-plugins/dependencies/poppler-tqt/poppler-page-transition.cc +++ /dev/null @@ -1,95 +0,0 @@ -/* PageTransition.cc - * Copyright (C) 2005, Net Integration Technologies, Inc. - * - * 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, 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. - */ - -#include "PageTransition.h" -#include "poppler-page-transition.h" -#include "poppler-page-transition-private.h" - -namespace Poppler { - -class PageTransitionData -{ - public: - PageTransitionData(Object *trans) - { - pt = new ::PageTransition(trans); - } - - PageTransitionData(const PageTransitionData &ptd) - { - pt = new ::PageTransition(*ptd.pt); - } - - ~PageTransitionData() - { - delete pt; - } - - ::PageTransition *pt; -}; - -PageTransition::PageTransition(const PageTransitionParams ¶ms) -{ - data = new PageTransitionData(params.dictObj); -} - -PageTransition::PageTransition(const PageTransition &pt) -{ - data = new PageTransitionData(*pt.data); -} - -PageTransition::~PageTransition() -{ - delete data; -} - -PageTransition::Type PageTransition::type() const -{ - return (Poppler::PageTransition::Type)data->pt->getType(); -} - -int PageTransition::duration() const -{ - return data->pt->getDuration(); -} - -PageTransition::Alignment PageTransition::alignment() const -{ - return (Poppler::PageTransition::Alignment)data->pt->getAlignment(); -} - -PageTransition::Direction PageTransition::direction() const -{ - return (Poppler::PageTransition::Direction)data->pt->getDirection(); -} - -int PageTransition::angle() const -{ - return data->pt->getAngle(); -} - -double PageTransition::scale() const -{ - return data->pt->getScale(); -} -bool PageTransition::isRectangular() const -{ - return data->pt->isRectangular(); -} - -} diff --git a/kfile-plugins/dependencies/poppler-tqt/poppler-page-transition.h b/kfile-plugins/dependencies/poppler-tqt/poppler-page-transition.h deleted file mode 100644 index 53002ff9..00000000 --- a/kfile-plugins/dependencies/poppler-tqt/poppler-page-transition.h +++ /dev/null @@ -1,146 +0,0 @@ -/* PageTransition.h - * Copyright (C) 2005, Net Integration Technologies, Inc. - * Copyright (C) 2005, Brad Hards - * - * 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, 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. - */ - -#ifndef __PAGETRANSITION_X_H__ -#define __PAGETRANSITION_X_H__ - -namespace Poppler { - -class PageTransitionParams; -class PageTransitionData; - -/** - \brief Describes how a PDF file viewer shall perform the transition - from one page to another - - In PDF files there is a way to specify if the viewer shall use - certain effects to perform the transition from one page to - another. This feature can be used, e.g., in a PDF-based beamer - presentation. - - This utility class represents the transition effect, and can be - used to extract the information from a PDF object. -*/ - - -class PageTransition { - public: - - /** \brief transition effect that shall be used - */ - // if changed remember to keep in sync with PageTransition.h enum - enum Type { - Replace = 0, - Split, - Blinds, - Box, - Wipe, - Dissolve, - Glitter, - Fly, - Push, - Cover, - Uncover, - Fade - }; - - /** \brief alignment of the transition effect that shall be used - */ - // if changed remember to keep in sync with PageTransition.h enum - enum Alignment { - Horizontal = 0, - Vertical - }; - - /** \brief direction of the transition effect that shall be used - */ - // if changed remember to keep in sync with PageTransition.h enum - enum Direction { - Inward = 0, - Outward - }; - - /** \brief Construct a new PageTransition object from a page dictionary. - - Users of the library will rarely need to construct a - PageTransition object themselves. Instead, the method - Poppler::Page::transition() can be used to find out if a certain - transition effect is specified. - - @warning In case or error, this method will print an error message to stderr, - and construct a default object. - - @param params an object whose dictionary will be read and - parsed. This must be a valid object, whose dictionaries are - accessed by the constructor. The object is only accessed by this - constructor, and may be deleted after the constructor returns. - */ - PageTransition(const PageTransitionParams ¶ms); - - /** \brief copy constructor */ - PageTransition(const PageTransition &pt); - - /** - Destructor - */ - ~PageTransition(); - - /** - \brief Get type of the transition. - */ - Type type() const; - - /** - \brief Get duration of the transition in seconds. - */ - int duration() const; - - /** - \brief Get dimension in which the transition effect occurs. - */ - Alignment alignment() const; - - /** - \brief Get direction of motion of the transition effect. - */ - Direction direction() const; - - /** - \brief Get direction in which the transition effect moves. - */ - int angle() const; - - /** - \brief Get starting or ending scale. - */ - double scale() const; - - /** - \brief Returns true if the area to be flown is rectangular and - opaque. - */ - bool isRectangular() const; - - private: - PageTransitionData *data; -}; - -} - -#endif diff --git a/kfile-plugins/dependencies/poppler-tqt/poppler-page.cc b/kfile-plugins/dependencies/poppler-tqt/poppler-page.cc deleted file mode 100644 index 3d1e6569..00000000 --- a/kfile-plugins/dependencies/poppler-tqt/poppler-page.cc +++ /dev/null @@ -1,370 +0,0 @@ -/* poppler-page.cc: qt interface to poppler - * Copyright (C) 2005, Net Integration Technologies, Inc. - * Copyright (C) 2005-2006, Albert Astals Cid - * Copyright (C) 2005, Tobias Koening - * Copyright (C) 2005, Stefan Kebekus - * Copyright (C) 2006, Wilfried Huss - * Copyright (C) 2006, Jerry Epplin - * Copyright (C) 2007, 2010, Pino Toscano - * - * 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, 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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if defined(HAVE_SPLASH) -#include -#include -#endif - -#include "poppler-private.h" -#include "poppler-page-transition-private.h" - -namespace Poppler { - -class PageData { - public: - const Document *doc; - int index; - PageTransition *transition; -}; - -Page::Page(const Document *doc, int index) { - data = new PageData(); - data->index = index; - data->doc = doc; - data->transition = 0; -} - -Page::~Page() -{ - delete data->transition; - delete data; -} - -void Page::renderToPixmap(TQPixmap **q, int x, int y, int w, int h, bool doLinks) const -{ - renderToPixmap(q, x, y, w, h, 72.0, 72.0, doLinks); -} - -void Page::renderToPixmap(TQPixmap **q, int x, int y, int w, int h, double xres, double yres, bool doLinks) const -{ - TQImage img = renderToImage(xres, yres, doLinks); - *q = new TQPixmap( img ); -} - -TQImage Page::renderToImage(double xres, double yres, bool doLinks) const -{ -#if defined(HAVE_SPLASH) - SplashOutputDev *output_dev; - SplashBitmap *bitmap; - SplashColorPtr color_ptr; - output_dev = data->doc->data->getOutputDev(); - - data->doc->data->doc.displayPageSlice(output_dev, data->index + 1, xres, yres, - 0, false, true, false, -1, -1, -1, -1); - bitmap = output_dev->getBitmap (); - color_ptr = bitmap->getDataPtr (); - int bw = output_dev->getBitmap()->getWidth(); - int bh = output_dev->getBitmap()->getHeight(); - SplashColorPtr dataPtr = output_dev->getBitmap()->getDataPtr(); - - if (TQImage::BigEndian == TQImage::systemByteOrder()) - { - uchar c; - int count = bw * bh * 4; - for (int k = 0; k < count; k += 4) - { - c = dataPtr[k]; - dataPtr[k] = dataPtr[k+3]; - dataPtr[k+3] = c; - - c = dataPtr[k+1]; - dataPtr[k+1] = dataPtr[k+2]; - dataPtr[k+2] = c; - } - } - - // construct a qimage SHARING the raw bitmap data in memory - TQImage img( dataPtr, bw, bh, 32, 0, 0, TQImage::IgnoreEndian ); - img = img.copy(); - // unload underlying xpdf bitmap - output_dev->startPage( 0, NULL ); - - return img; -#else - (void)xres; - (void)xres; - (void)doLinks; - - return TQImage(); -#endif -} - -TQString Page::getText(const Rectangle &r) const -{ - TextOutputDev *output_dev; - GooString *s; - PDFRectangle *rect; - TQString result; - ::Page *p; - -#if defined(HAVE_POPPLER_020) - output_dev = new TextOutputDev(0, gFalse, 0, gFalse, gFalse); -#else - output_dev = new TextOutputDev(0, gFalse, gFalse, gFalse); -#endif - data->doc->data->doc.displayPageSlice(output_dev, data->index + 1, 72, 72, - 0, false, false, false, -1, -1, -1, -1); - p = data->doc->data->doc.getCatalog()->getPage(data->index + 1); - if (r.isNull()) - { - rect = p->getCropBox(); - s = output_dev->getText(rect->x1, rect->y1, rect->x2, rect->y2); - } - else - { - double height, y1, y2; - height = p->getCropHeight(); - y1 = height - r.m_y2; - y2 = height - r.m_y1; - s = output_dev->getText(r.m_x1, y1, r.m_x2, y2); - } - - result = TQString::fromUtf8(s->getCString()); - - delete output_dev; - delete s; - return result; -} - -TQValueList Page::textList() const -{ - TextOutputDev *output_dev; - - TQValueList output_list; - -#if defined(HAVE_POPPLER_020) - output_dev = new TextOutputDev(0, gFalse, 0, gFalse, gFalse); -#else - output_dev = new TextOutputDev(0, gFalse, gFalse, gFalse); -#endif - - data->doc->data->doc.displayPageSlice(output_dev, data->index + 1, 72, 72, - 0, false, false, false, -1, -1, -1, -1); - - TextWordList *word_list = output_dev->makeWordList(); - - if (!word_list) { - delete output_dev; - return output_list; - } - - for (int i = 0; i < word_list->getLength(); i++) { - TextWord *word = word_list->get(i); - GooString *word_str = word->getText(); - TQString string = TQString::fromUtf8(word_str->getCString()); - delete word_str; - double xMin, yMin, xMax, yMax; - word->getBBox(&xMin, &yMin, &xMax, &yMax); - - TextBox* text_box = new TextBox(string, Rectangle(xMin, yMin, xMax, yMax)); - - output_list.append(text_box); - } - - delete word_list; - delete output_dev; - - return output_list; -} - -PageTransition *Page::getTransition() const -{ - if (!data->transition) - { - Object o; - PageTransitionParams params; - params.dictObj = data->doc->data->doc.getCatalog()->getPage(data->index + 1)->getTrans(&o); - data->transition = new PageTransition(params); - o.free(); - } - return data->transition; -} - -TQSize Page::pageSize() const -{ - ::Page *p; - - p = data->doc->data->doc.getCatalog()->getPage(data->index + 1); - if ( ( Page::Landscape == orientation() ) || (Page::Seascape == orientation() ) ) { - return TQSize( (int)p->getCropHeight(), (int)p->getCropWidth() ); - } else { - return TQSize( (int)p->getCropWidth(), (int)p->getCropHeight() ); - } -} - -Page::Orientation Page::orientation() const -{ - ::Page *p = data->doc->data->doc.getCatalog()->getPage(data->index + 1); - - int rotation = p->getRotate(); - switch (rotation) { - case 90: - return Page::Landscape; - break; - case 180: - return Page::UpsideDown; - break; - case 270: - return Page::Seascape; - break; - default: - return Page::Portrait; - } -} - -TQValueList Page::links() const -{ - TQValueList popplerLinks; - -#if defined(HAVE_SPLASH) - Links *xpdfLinks = data->doc->data->doc.getLinks(data->index + 1); - for (int i = 0; i < xpdfLinks->getNumLinks(); ++i) - { - ::Link *xpdfLink = xpdfLinks->getLink(i); - - double left, top, right, bottom; - int leftAux, topAux, rightAux, bottomAux; - xpdfLink->getRect( &left, &top, &right, &bottom ); - TQRect linkArea; - - data->doc->data->m_outputDev->cvtUserToDev( left, top, &leftAux, &topAux ); - data->doc->data->m_outputDev->cvtUserToDev( right, bottom, &rightAux, &bottomAux ); - linkArea.setLeft(leftAux); - linkArea.setTop(topAux); - linkArea.setRight(rightAux); - linkArea.setBottom(bottomAux); - - if (!xpdfLink->isOk()) continue; - - Link *popplerLink = NULL; - ::LinkAction *a = xpdfLink->getAction(); - if ( a ) - { - switch ( a->getKind() ) - { - case actionGoTo: - { - LinkGoTo * g = (LinkGoTo *) a; - // create link: no ext file, namedDest, object pointer - popplerLink = new LinkGoto( linkArea, TQString(), LinkDestination( LinkDestinationData(g->getDest(), g->getNamedDest(), data->doc->data ) ) ); - } - break; - - case actionGoToR: - { - LinkGoToR * g = (LinkGoToR *) a; - // copy link file - const TQString fileName = UnicodeParsedString( g->getFileName() ); - // ceate link: fileName, namedDest, object pointer - popplerLink = new LinkGoto( linkArea, fileName, LinkDestination( LinkDestinationData(g->getDest(), g->getNamedDest(), data->doc->data ) ) ); - } - break; - - case actionLaunch: - { - LinkLaunch * e = (LinkLaunch *)a; - GooString * p = e->getParams(); - popplerLink = new LinkExecute( linkArea, e->getFileName()->getCString(), p ? p->getCString() : 0 ); - } - break; - - case actionNamed: - { - const char * name = ((LinkNamed *)a)->getName()->getCString(); - if ( !strcmp( name, "NextPage" ) ) - popplerLink = new LinkAction( linkArea, LinkAction::PageNext ); - else if ( !strcmp( name, "PrevPage" ) ) - popplerLink = new LinkAction( linkArea, LinkAction::PagePrev ); - else if ( !strcmp( name, "FirstPage" ) ) - popplerLink = new LinkAction( linkArea, LinkAction::PageFirst ); - else if ( !strcmp( name, "LastPage" ) ) - popplerLink = new LinkAction( linkArea, LinkAction::PageLast ); - else if ( !strcmp( name, "GoBack" ) ) - popplerLink = new LinkAction( linkArea, LinkAction::HistoryBack ); - else if ( !strcmp( name, "GoForward" ) ) - popplerLink = new LinkAction( linkArea, LinkAction::HistoryForward ); - else if ( !strcmp( name, "Quit" ) ) - popplerLink = new LinkAction( linkArea, LinkAction::Quit ); - else if ( !strcmp( name, "GoToPage" ) ) - popplerLink = new LinkAction( linkArea, LinkAction::GoToPage ); - else if ( !strcmp( name, "Find" ) ) - popplerLink = new LinkAction( linkArea, LinkAction::Find ); - else if ( !strcmp( name, "FullScreen" ) ) - popplerLink = new LinkAction( linkArea, LinkAction::Presentation ); - else if ( !strcmp( name, "Close" ) ) - { - // acroread closes the document always, doesnt care whether - // its presentation mode or not - // popplerLink = new LinkAction( linkArea, LinkAction::EndPresentation ); - popplerLink = new LinkAction( linkArea, LinkAction::Close ); - } - else - { - // TODO - } - } - break; - - case actionURI: - { - popplerLink = new LinkBrowse( linkArea, ((LinkURI *)a)->getURI()->getCString() ); - } - break; - - case actionMovie: - case actionSound: - case actionRendition: - case actionJavaScript: - case actionOCGState: - break; - - case actionUnknown: - break; - } - } - - if (popplerLink) - { - popplerLinks.append(popplerLink); - } - } - - delete xpdfLinks; -#endif - - return popplerLinks; -} - -} diff --git a/kfile-plugins/dependencies/poppler-tqt/poppler-private.cc b/kfile-plugins/dependencies/poppler-tqt/poppler-private.cc deleted file mode 100644 index 7e366014..00000000 --- a/kfile-plugins/dependencies/poppler-tqt/poppler-private.cc +++ /dev/null @@ -1,147 +0,0 @@ -/* poppler-private.h: qt interface to poppler - * Copyright (C) 2005, Net Integration Technologies, Inc. - * Copyright (C) 2005-2008, Albert Astals Cid - * Copyright (C) 2006, Kristian Høgsberg - * Copyright (C) 2006, Wilfried Huss - * Copyright (C) 2007, Pino Toscano - * - * 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, 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. - */ - -#include "poppler-private.h" -#include "poppler-link-qt3.h" - -#include - -#include -#include - -namespace Poppler { - -/* borrowed from kpdf */ -TQString unicodeToTQString(Unicode* u, int len) -{ - TQString ret; - ret.setLength(len); - TQChar* qch = (TQChar*) ret.unicode(); - for (;len;--len) - *qch++ = (TQChar) *u++; - return ret; -} - -TQString UnicodeParsedString(GooString *s1) -{ - GBool isUnicode; - int i; - Unicode u; - TQString result; - if ( ( s1->getChar(0) & 0xff ) == 0xfe && ( s1->getChar(1) & 0xff ) == 0xff ) - { - isUnicode = gTrue; - i = 2; - } - else - { - isUnicode = gFalse; - i = 0; - } - while ( i < s1->getLength() ) - { - if ( isUnicode ) - { - u = ( ( s1->getChar(i) & 0xff ) << 8 ) | ( s1->getChar(i+1) & 0xff ); - i += 2; - } - else - { - u = s1->getChar(i) & 0xff; - ++i; - } - result += unicodeToTQString( &u, 1 ); - } - return result; -} - -GooString *TQStringToGooString(const TQString &s) -{ - int len = s.length(); - char *cstring = (char *)gmallocn(s.length(), sizeof(char)); - for (int i = 0; i < len; ++i) - cstring[i] = s.at(i).unicode(); - GooString *ret = new GooString(cstring, len); - gfree(cstring); - return ret; -} - - -void DocumentData::addTocChildren( TQDomDocument * docSyn, TQDomNode * parent, GooList * items ) -{ - int numItems = items->getLength(); - for ( int i = 0; i < numItems; ++i ) - { - // iterate over every object in 'items' - OutlineItem * outlineItem = (OutlineItem *)items->get( i ); - - // 1. create element using outlineItem's title as tagName - TQString name; - Unicode * uniChar = outlineItem->getTitle(); - int titleLength = outlineItem->getTitleLength(); - name = unicodeToTQString(uniChar, titleLength); - if ( name.isEmpty() ) - continue; - - TQDomElement item = docSyn->createElement( name ); - parent->appendChild( item ); - - // 2. find the page the link refers to - ::LinkAction * a = outlineItem->getAction(); - if ( a && ( a->getKind() == actionGoTo || a->getKind() == actionGoToR ) ) - { - // page number is contained/referenced in a LinkGoTo - LinkGoTo * g = static_cast< LinkGoTo * >( a ); - LinkDest * destination = g->getDest(); - if ( !destination && g->getNamedDest() ) - { - // no 'destination' but an internal 'named reference'. we could - // get the destination for the page now, but it's VERY time consuming, - // so better storing the reference and provide the viewport on demand - GooString *s = g->getNamedDest(); - TQChar *charArray = new TQChar[s->getLength()]; - for (int i = 0; i < s->getLength(); ++i) charArray[i] = TQChar(s->getCString()[i]); - TQString aux(charArray, s->getLength()); - item.setAttribute( "DestinationName", aux ); - delete[] charArray; - } - else if ( destination && destination->isOk() ) - { - LinkDestinationData ldd(destination, NULL, this); - item.setAttribute( "Destination", LinkDestination(ldd).toString() ); - } - if ( a->getKind() == actionGoToR ) - { - LinkGoToR * g2 = static_cast< LinkGoToR * >( a ); - item.setAttribute( "ExternalFileName", g2->getFileName()->getCString() ); - } - } - - // 3. recursively descend over children - outlineItem->open(); - GooList * children = outlineItem->getKids(); - if ( children ) - addTocChildren( docSyn, &item, children ); - } -} - -} diff --git a/kfile-plugins/dependencies/poppler-tqt/poppler-private.h b/kfile-plugins/dependencies/poppler-tqt/poppler-private.h deleted file mode 100644 index 9e9e3292..00000000 --- a/kfile-plugins/dependencies/poppler-tqt/poppler-private.h +++ /dev/null @@ -1,97 +0,0 @@ -/* poppler-private.h: qt interface to poppler - * Copyright (C) 2005, Net Integration Technologies, Inc. - * Copyright (C) 2005-2008, Albert Astals Cid - * Copyright (C) 2006, Kristian Høgsberg - * Copyright (C) 2006, Wilfried Huss - * Copyright (C) 2007, Pino Toscano - * - * 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, 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. - */ - -#ifndef POPPLER_PRIVATE_H -#define POPPLER_PRIVATE_H - -#include - -#include -#include -#include -#include -#if defined(HAVE_SPLASH) -#include -#else -class SplashOutputDev; -#endif - -namespace Poppler { - -class DocumentData; - -TQString unicodeToTQString(Unicode* u, int len); - -TQString UnicodeParsedString(GooString *s1); - -GooString *TQStringToGooString(const TQString &s); - -class LinkDestinationData { - public: - LinkDestinationData( LinkDest *l, GooString *nd, Poppler::DocumentData *pdfdoc ) : ld(l), namedDest(nd), doc(pdfdoc) - { - } - - LinkDest *ld; - GooString *namedDest; - Poppler::DocumentData *doc; -}; - -class DocumentData { - public: - DocumentData(GooString *filePath, GooString *password) : doc(filePath,password), m_fontInfoScanner(0), m_outputDev(0) {} - - ~DocumentData() - { -#if defined(HAVE_SPLASH) - delete m_outputDev; -#endif - delete m_fontInfoScanner; - } - - SplashOutputDev *getOutputDev() - { -#if defined(HAVE_SPLASH) - if (!m_outputDev) - { - SplashColor white; - white[0] = 255; - white[1] = 255; - white[2] = 255; - m_outputDev = new SplashOutputDev(splashModeXBGR8, 4, gFalse, white); - m_outputDev->startDoc(doc.getXRef()); - } -#endif - return m_outputDev; - } - - void addTocChildren( TQDomDocument * docSyn, TQDomNode * parent, GooList * items ); - - class PDFDoc doc; - bool locked; - FontInfoScanner *m_fontInfoScanner; - SplashOutputDev *m_outputDev; -}; - -} - -#endif // POPPLER_PRIVATE_H diff --git a/kfile-plugins/dependencies/poppler-tqt/poppler-qt.h b/kfile-plugins/dependencies/poppler-tqt/poppler-qt.h deleted file mode 100644 index 9150ee3b..00000000 --- a/kfile-plugins/dependencies/poppler-tqt/poppler-qt.h +++ /dev/null @@ -1,310 +0,0 @@ -/* poppler-qt.h: qt interface to poppler - * Copyright (C) 2005, Net Integration Technologies, Inc. - * Copyright (C) 2005, Tobias Koening - * Copyright (C) 2005-2007, Albert Astals Cid - * Copyright (C) 2005-2006, Stefan Kebekus - * Copyright (C) 2006, Wilfried Huss - * - * 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, 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. - */ - -#ifndef __POPPLER_TQT_H__ -#define __POPPLER_TQT_H__ - -#include "poppler-link-qt3.h" -#include "poppler-page-transition.h" - -#include -#include -#include -#include - -namespace Poppler { - -class Document; -class Page; - -/* A rectangle on a page, with coordinates in PDF points. */ -class Rectangle -{ - public: - Rectangle(double x1 = 0, double y1 = 0, double x2 = 0, double y2 = 0) : - m_x1(x1), m_y1(y1), m_x2(x2), m_y2(y2) {} - bool isNull() const { return m_x1 == 0 && m_y1 == 0 && m_x2 == 0 && m_y2 == 0; } - - double m_x1; - double m_y1; - double m_x2; - double m_y2; -}; - -class TextBox -{ - public: - TextBox(const TQString& text, const Rectangle &bBox) : - m_text(text), m_bBox(bBox) {}; - - TQString getText() const { return m_text; }; - Rectangle getBoundingBox() const { return m_bBox; }; - - private: - TQString m_text; - Rectangle m_bBox; -}; - - -/** - Container class for information about a font within a PDF document -*/ -class FontInfoData; -class FontInfo { -public: - enum Type { - unknown, - Type1, - Type1C, - Type1COT, - Type3, - TrueType, - TrueTypeOT, - CIDType0, - CIDType0C, - CIDType0COT, - CIDTrueType, - CIDTrueTypeOT - }; - - /** - Create a new font information container - */ - FontInfo( const TQString &fontName, const bool isEmbedded, - const bool isSubset, Type type ); - - FontInfo(); - - FontInfo( const FontInfo &fi ); - - ~FontInfo(); - - /** - The name of the font. Can be TQString() if the font has no name - */ - const TQString &name() const; - - /** - Whether the font is embedded in the file, or not - - \return true if the font is embedded - */ - bool isEmbedded() const; - - /** - Whether the font provided is only a subset of the full - font or not. This only has meaning if the font is embedded. - - \return true if the font is only a subset - */ - bool isSubset() const; - - /** - The type of font encoding - */ - Type type() const; - - const TQString &typeName() const; - -private: - FontInfoData *data; -}; - -class PageData; -class Page { - friend class Document; - public: - ~Page(); - void renderToPixmap(TQPixmap **q, int x, int y, int w, int h, double xres, double yres, bool doLinks = false) const; - - /** - This is a convenience function that is equivalent to - renderToPixmap() with xres and yres set to 72.0. We keep it - only for binary compatibility - - \sa renderToImage() - */ - void renderToPixmap(TQPixmap **q, int x, int y, int w, int h, bool doLinks = false) const; - - /** - \brief Render the page to a TQImage using the Splash renderer - - This method can be used to render the page to a TQImage. It - uses the "Splash" rendering engine. - - \param xres horizontal resolution of the graphics device, - in dots per inch (defaults to 72 dpi) - - \param yres vertical resolution of the graphics device, in - dots per inch (defaults to 72 dpi) - - \returns a TQImage of the page. - - \sa renderToPixmap() - */ - TQImage renderToImage(double xres = 72.0, double yres = 72.0, bool doLinks = false) const; - - /** - * Returns the size of the page in points - **/ - TQSize pageSize() const; - - /** - * Returns the text that is inside the Rectangle r - * If r is a null Rectangle all text of the page is given - **/ - TQString getText(const Rectangle &r) const; - - TQValueList textList() const; - - /** - * Returns the transition of this page - **/ - PageTransition *getTransition() const; - - enum Orientation { - Landscape, - Portrait, - Seascape, - UpsideDown - }; - - /** - * The orientation of the page - **/ - Orientation orientation() const; - - /** - Gets the links of the page once it has been rendered if doLinks was true - */ - TQValueList links() const; - - private: - Page(const Document *doc, int index); - PageData *data; -}; - -class DocumentData; - -class Document { - friend class Page; - -public: - enum PageMode { - UseNone, - UseOutlines, - UseThumbs, - FullScreen, - UseOC - }; - - static Document *load(const TQString & filePath); - - Page *getPage(int index) const{ return new Page(this, index); } - - int getNumPages() const; - - PageMode getPageMode() const; - - bool unlock(const TQCString &password); - - bool isLocked() const; - - TQDateTime getDate( const TQString & data ) const; - TQString getInfo( const TQString & data ) const; - bool isEncrypted() const; - bool isLinearized() const; - bool okToPrint() const; - bool okToChange() const; - bool okToCopy() const; - bool okToAddNotes() const; - double getPDFVersion() const; - /** - The version of the PDF specification that the document - conforms to - - \param major an optional pointer to a variable where store the - "major" number of the version - \param minor an optional pointer to a variable where store the - "minor" number of the version - - \since 0.12 - */ - void getPdfVersion(int *major, int *minor) const; - - bool print(const TQString &fileName, TQValueList pageList, double hDPI, double vDPI, int rotate); - - // If you are using TQPrinter you can get paper size doing - // TQPrinter dummy(TQPrinter::PrinterResolution); - // dummy.setFullPage(true); - // dummy.setPageSize(thePageSizeYouWant); - // TQPaintDeviceMetrics metrics(&dummy); - // int width = metrics.width(); - // int height = metrics.height(); - bool print(const TQString &fileName, TQValueList pageList, double hDPI, double vDPI, int rotate, int paperWidth, int paperHeight); - - /** - The fonts within the PDF document. - - \note this can take a very long time to run with a large - document. You may wish to use the call below if you have more - than say 20 pages - */ - TQValueList fonts() const; - - /** - \overload - - \param numPages the number of pages to scan - \param fontList pointer to the list where the font information - should be placed - - \return false if the end of the document has been reached - */ - bool scanForFonts( int numPages, TQValueList *fontList ) const; - - /** - Gets the TOC of the Document, it is application responsabiliy to delete - it when no longer needed - - * In the tree the tag name is the 'screen' name of the entry. A tag can have - * attributes. Here follows the list of tag attributes with meaning: - * - Destination: A string description of the referred destination - * - DestinationName: A 'named reference' to the viewport that must be converted - * using linkDestination( *destination_name* ) - * - ExternalFileName: A link to a external filename - - \returns NULL if the Document does not have TOC - */ - TQDomDocument *toc() const; - - LinkDestination *linkDestination( const TQString &name ); - - ~Document(); - -private: - DocumentData *data; - Document(DocumentData *dataA); -}; - -} -#endif diff --git a/kfile-plugins/dependencies/poppler-tqt/poppler-tqt.pc.cmake b/kfile-plugins/dependencies/poppler-tqt/poppler-tqt.pc.cmake deleted file mode 100644 index 86a0a0d5..00000000 --- a/kfile-plugins/dependencies/poppler-tqt/poppler-tqt.pc.cmake +++ /dev/null @@ -1,12 +0,0 @@ -prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=${prefix} -libdir=@LIB_INSTALL_DIR@ -includedir=@INCLUDE_INSTALL_DIR@ - -Name: poppler-tqt -Description: TQt bindings for poppler -Version: @POPPLER_VERSION@ -Requires: poppler = @POPPLER_VERSION@ - -Libs: -L${libdir} -lpoppler-tqt -Cflags: -I${includedir} diff --git a/kfile-plugins/dependencies/poppler-tqt/test-poppler-qt.cpp b/kfile-plugins/dependencies/poppler-tqt/test-poppler-qt.cpp deleted file mode 100644 index d616290d..00000000 --- a/kfile-plugins/dependencies/poppler-tqt/test-poppler-qt.cpp +++ /dev/null @@ -1,122 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class PDFDisplay : public TQWidget // picture display widget -{ -public: - PDFDisplay( Poppler::Document *d ); - ~PDFDisplay(); -protected: - void paintEvent( TQPaintEvent * ); - void keyPressEvent( TQKeyEvent * ); -private: - void display(); - - int currentPage; - TQPixmap *pixmap; - Poppler::Document *doc; -}; - -PDFDisplay::PDFDisplay( Poppler::Document *d ) -{ - doc = d; - pixmap = 0; - currentPage = 0; - display(); -} - -PDFDisplay::~PDFDisplay() -{ - delete doc; - delete pixmap; -} - -void PDFDisplay::paintEvent( TQPaintEvent *e ) -{ - TQPainter paint( this ); // paint widget - if (pixmap) - paint.drawPixmap(0, 0, *pixmap); -} - -void PDFDisplay::keyPressEvent( TQKeyEvent *e ) -{ - if (e->key() == TQt::Key_Down) - { - if (currentPage + 1 < doc->getNumPages()) - { - currentPage++; - display(); - } - } - else if (e->key() == TQt::Key_Up) - { - if (currentPage > 0) - { - currentPage--; - display(); - } - } -} - -void PDFDisplay::display() -{ - if (doc) { - Poppler::Page *page = doc->getPage(currentPage); - if (page) { - delete pixmap; - page->renderToPixmap(&pixmap, -1, -1, -1, -1); - delete page; - update(); - } - } else { - printf("doc not loaded\n"); - } -} - -int main( int argc, char **argv ) -{ - TQApplication a( argc, argv ); // TQApplication required! - - if ( argc < 2 || (argc == 3 && strcmp(argv[2], "-extract") != 0) || argc > 3) - { - // use argument as file name - printf("usage: test-poppler-qt filename [-extract]\n"); - exit(1); - } - - Poppler::Document *doc = Poppler::Document::load(argv[1]); - if (!doc) - { - printf("doc not loaded\n"); - exit(1); - } - - if (argc == 2) - { - PDFDisplay test( doc ); // create picture display - a.setMainWidget( &test); // set main widget - test.setCaption("Poppler-TQt Test"); - test.show(); // show it - - return a.exec(); // start event loop - } - else - { - Poppler::Page *page = doc->getPage(0); - - TQLabel *l = new TQLabel(page->getText(Poppler::Rectangle()), 0); - l->show(); - a.setMainWidget(l); // set main widget - delete page; - delete doc; - return a.exec(); - } -} diff --git a/kfile-plugins/dvi/CMakeLists.txt b/kfile-plugins/dvi/CMakeLists.txt deleted file mode 100644 index 116d6032..00000000 --- a/kfile-plugins/dvi/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -################################################# -# -# (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 kfile_dvi.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - - -#### kfile_dvi (module) ######################### - -tde_add_kpart( kfile_dvi AUTOMOC - SOURCES kfile_dvi.cpp - LINK kio-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kfile-plugins/dvi/Makefile.am b/kfile-plugins/dvi/Makefile.am deleted file mode 100644 index 61791bdc..00000000 --- a/kfile-plugins/dvi/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for the dvi 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_dvi.h - -kde_module_LTLIBRARIES = kfile_dvi.la - -kfile_dvi_la_SOURCES = kfile_dvi.cpp -kfile_dvi_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -kfile_dvi_la_LIBADD = $(LIB_KIO) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: - $(XGETTEXT) *.cpp -o $(podir)/kfile_dvi.pot - -services_DATA = kfile_dvi.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/dvi/kfile_dvi.cpp b/kfile-plugins/dvi/kfile_dvi.cpp deleted file mode 100644 index b449ad1e..00000000 --- a/kfile-plugins/dvi/kfile_dvi.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Matthias Witzgall - * - * 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. - * - */ - - -/* further informations about the dvi file format could be downloaded from: http://www.rpi.edu/~sofkam/DVI/archive/standards/dvistd0.dvi */ - -#include "kfile_dvi.h" - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - - -// preprocessormacro K_EXPORT_COMPONENT_FACTORY loads shared library 'kfile_dvi.so' dynamic if necessary -typedef KGenericFactory DviFactory; -K_EXPORT_COMPONENT_FACTORY(kfile_dvi, DviFactory("kfile_dvi")) - -KDviPlugin::KDviPlugin (TQObject * parent, const char * name, const TQStringList & preferredItems) - : KFilePlugin(parent, name, preferredItems) -{ - kdDebug(7034) << "dvi plugin" << endl; - - // set up our mime type - KFileMimeTypeInfo * info = this->addMimeTypeInfo("application/x-dvi"); - - - KFileMimeTypeInfo::GroupInfo * group = this->addGroupInfo(info, "General", "General"); - - this->addItemInfo(group, "3_Created", i18n("Created"), TQVariant::String); - this->addItemInfo(group, "6_Comment", i18n("Comment"), TQVariant::String); - this->addItemInfo(group, "7_Pages", i18n("Pages"), TQVariant::UInt); -} - -bool KDviPlugin::readInfo (KFileMetaInfo & info, uint /* what (unused in this plugin) */) -{ - if ( info.path().isEmpty() ) - return false; - KFileMetaInfoGroup GeneralGroup = appendGroup(info, "General"); - TQFile f(info.path()); - TQFileInfo f_info; - TQ_UINT16 bytes_to_read; - TQ_UINT8 comment_length; - TQString comment; - TQ_UINT16 pages; - TQ_UINT8 buffer[270]; // buffer for reading data; no data is read with more than 270 bytes - TQ_UINT32 ptr; - int i; // running index - - // open file and try to get the comment - f.open(IO_ReadOnly); - - if ( f.isOpen() == false ){ - kdDebug(7034) << "cannot open file" << endl; - return false; - } - - f_info.setFile(f); // create fileinfoobject - bytes_to_read = TQMIN(f_info.size(), 270); // check, if the file size is smaller than 270 bytes - // (if the comment is as large as possible, we don't have to - // read more than 270 bytes) - - if ( f.readBlock((char *)buffer, bytes_to_read) != bytes_to_read ){ // cast to (char *) is necessary - kdDebug(7034) << "read error (1)" << endl; - return false; - } - - if ( (buffer[0] != 247) || (buffer[1] != 2) ){ - // magic numbers are not right - kdDebug(7034) << "wrong file format" << endl;; - return false; - } - - comment_length = buffer[14]; // set up length of comment - comment.setLength(comment_length); // used to avoid permanent reallocation when extracting the comment from buffer - - for ( i = 15; i <= 14+comment_length; ++i ) // extract comment from buffer - comment[i-15] = (char)buffer[i]; - - appendItem(GeneralGroup, "6_Comment", comment.simplifyWhiteSpace() ); - - // comment is ok, now get total number of pages - f.at( f.size() - 13); - if ( f.readBlock((char *)buffer, 13) != 13 ){ - kdDebug(7034) << "read error (2)" << endl; - return false; - } - - i = 12; // reset running index i - while ( buffer[i] == 223 ){ --i; } // skip all trailing bytes - - if ( (buffer[i] != 2) || (i > 8) || (i < 5) ){ - kdDebug(7034) << "wrong file formatx" << endl; - return false; - } - - // now we know the position of the pointer to the beginning of the postamble and we can read it - ptr = buffer[i-4]; - ptr = (ptr << 8) | buffer[i-3]; - ptr = (ptr << 8) | buffer[i-2]; - ptr = (ptr << 8) | buffer[i-1]; - - // bytes for total number of pages have a offset of 27 to the beginning of the postamble - f.at(ptr + 27); - - // now read total number of pages from file - if ( f.readBlock((char *)buffer, 2) != 2 ){ - kdDebug(7034) << "read error (3)" << endl; - return false; - } - pages = buffer[0]; - pages = (pages << 8) | buffer[1]; - - appendItem(GeneralGroup, "7_Pages", TQVariant(pages) ); - - f.close(); - - // now get and set up some basic informations about the file (same informations would be displayed, if there is no dvi-plugin) - appendItem(GeneralGroup, "1_Type", TQVariant( i18n("TeX Device Independent file") ) ); // set up type of file - - appendItem(GeneralGroup, "4_Modified", TQVariant(f_info.lastModified().toString("yyyy-MM-dd hh:mm")) ); - // ISO 8601 date format (without seconds) - - return true; -} - -#include "kfile_dvi.moc" diff --git a/kfile-plugins/dvi/kfile_dvi.desktop b/kfile-plugins/dvi/kfile_dvi.desktop deleted file mode 100644 index e272eab6..00000000 --- a/kfile-plugins/dvi/kfile_dvi.desktop +++ /dev/null @@ -1,60 +0,0 @@ -[Desktop Entry] -Icon= -MimeType=application/x-dvi -Name=DVI Info -Name[ar]=معلومات DVI -Name[br]=Titouroù DVI -Name[ca]=Informació de DVI -Name[cs]=DVI info -Name[cy]=Gwybodaeth DVI -Name[da]=DVI-info -Name[de]=DVI-Info -Name[el]=Πληροφορίες DVI -Name[eo]=DVI-informo -Name[es]=Info DVI -Name[et]=DVI info -Name[fa]=اطلاعات DVI -Name[fi]=DVI-tiedot -Name[fr]=Informations DVI -Name[ga]=Eolas faoi DVI -Name[gl]=Inf. DVI -Name[he]=מידע DVI -Name[hi]=DVI जानकारी -Name[hu]=DVI-jellemzők -Name[is]=DVI upplýsingar -Name[it]=Informazioni DVI -Name[ja]=DVI 情報 -Name[kk]=DVI мәліметі -Name[km]=ព័ត៌មាន DVI -Name[lt]=DVI informacija -Name[ms]=Maklumat DVI -Name[nds]=DVI-Info -Name[ne]=DVI सूचना -Name[nl]=DVI-info -Name[nn]=DVI-info -Name[pa]=DVI ਜਾਣਕਾਰੀ -Name[pl]=Informacja o pliku DVI -Name[pt]=Informação do DVI -Name[pt_BR]=Informação sobre DVI -Name[ro]=Informaţii DVI -Name[ru]=Информация о DVI -Name[se]=DVI-dieđut -Name[sl]=Podatki o DVI -Name[sr]=DVI информације -Name[sr@Latn]=DVI informacije -Name[sv]=DVI-information -Name[ta]=DVI தகவல் -Name[tg]=Иттилоот оиди DVI -Name[th]=ข้อมูลแฟ้ม DVI -Name[tr]=DVI Bilgisi -Name[uk]=Інформація по DVI -Name[uz]=DVI haqida maʼlumot -Name[uz@cyrillic]=DVI ҳақида маълумот -Name[wa]=Informåcion sol documint DVI -Name[zh_CN]=DVI 信息 -Name[zh_HK]=DVI 資訊 -Name[zh_TW]=DVI 資訊 -ServiceTypes=KFilePlugin -Type=Service -X-TDE-Library=kfile_dvi -PreferredItems=Title,Author,Subject,Creator,Producer,CreationDate,ModDate,Keywords diff --git a/kfile-plugins/dvi/kfile_dvi.h b/kfile-plugins/dvi/kfile_dvi.h deleted file mode 100644 index 48aadc9a..00000000 --- a/kfile-plugins/dvi/kfile_dvi.h +++ /dev/null @@ -1,38 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Matthias Witzgall - * - * 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_DVI_H__ -#define __KFILE_DVI_H__ - -#include - -class TQStringList; - -class KDviPlugin : public KFilePlugin -{ - Q_OBJECT - -public: - KDviPlugin ( TQObject * parent, const char * name, const TQStringList & preferredItems ); - - virtual bool readInfo (KFileMetaInfo & info, uint what); -}; - -#endif diff --git a/kfile-plugins/exr/CMakeLists.txt b/kfile-plugins/exr/CMakeLists.txt deleted file mode 100644 index 84f526c5..00000000 --- a/kfile-plugins/exr/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -################################################# -# -# (C) 2010-2011 Calvin Morrison -# mutantturkey@gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -include( ConfigureChecks.cmake ) - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_BINARY_DIR} - ${TDE_INCLUDE_DIR} - ${TQT_INCLUDE_DIRS} - ${OPENEXR_INCLUDE_DIRS} -) - -link_directories( - ${TQT_LIBRARY_DIRS} -) - - -#### other data ################################# - -install( FILES kfile_exr.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - - -#### kfile_exr (module) ######################### - -tde_add_kpart( kfile_exr AUTOMOC - SOURCES kfile_exr.cpp - LINK kio-shared ${OPENEXR_LIBRARIES} - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kfile-plugins/exr/ConfigureChecks.cmake b/kfile-plugins/exr/ConfigureChecks.cmake deleted file mode 100644 index 193173c2..00000000 --- a/kfile-plugins/exr/ConfigureChecks.cmake +++ /dev/null @@ -1,16 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -# OpenEXR -pkg_search_module( OPENEXR OpenEXR ) -if( NOT OPENEXR_FOUND ) - tde_message_fatal( "OpenEXR is required, but was not found on your system" ) -endif( ) diff --git a/kfile-plugins/exr/Makefile.am b/kfile-plugins/exr/Makefile.am deleted file mode 100644 index f337359c..00000000 --- a/kfile-plugins/exr/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -## Makefile.am for EXR file meta info plugin - -KDE_CXXFLAGS = $(USE_EXCEPTIONS) - -# set the include path for X, qt and KDE -INCLUDES = -Drestrict= $(all_includes) $(EXR_FLAGS) -# INCLUDES = $(all_includes) $(EXR_FLAGS) - -# these are the headers for your project -noinst_HEADERS = kfile_exr.h - -kde_module_LTLIBRARIES = kfile_exr.la - -kfile_exr_la_SOURCES = kfile_exr.cpp -kfile_exr_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -kfile_exr_la_LIBADD = $(LIB_KIO) $(LIB_EXR) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: - $(XGETTEXT) *.cpp -o $(podir)/kfile_exr.pot - -services_DATA = kfile_exr.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/exr/configure.in.in b/kfile-plugins/exr/configure.in.in deleted file mode 100644 index 2a9ff5e5..00000000 --- a/kfile-plugins/exr/configure.in.in +++ /dev/null @@ -1,14 +0,0 @@ -AC_ARG_WITH([openexr], - [AC_HELP_STRING([--with-openexr], - [Enable support for OpenEXR @<:@default=check@:>@])], - [], with_openexr=check) - -if test "x$with_openexr" != xno; then - KDE_FIND_LIBEXR - - if test "x$with_openexr" != xcheck && test -z "$LIB_EXR"; then - AC_MSG_ERROR([--with-openexr was given, but test for OpenEXR failed]) - fi -fi - -AM_CONDITIONAL(include_EXR_MODULES, test -n "$LIB_EXR") diff --git a/kfile-plugins/exr/kfile_exr.cpp b/kfile-plugins/exr/kfile_exr.cpp deleted file mode 100644 index 639ac0df..00000000 --- a/kfile-plugins/exr/kfile_exr.cpp +++ /dev/null @@ -1,393 +0,0 @@ -// -*- C++;indent-tabs-mode: t; tab-width: 4; c-basic-offset: 4; -*- -/* This file is part of the KDE project - * Copyright (C) 2003 - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - - -#include "kfile_exr.h" -using namespace Imf; - -typedef KGenericFactory ExrFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_exr, ExrFactory("kfile_exr")) - -KExrPlugin::KExrPlugin(TQObject *parent, const char *name, - const TQStringList &args) - : KFilePlugin(parent, name, args) -{ - // set up our mime type - KFileMimeTypeInfo* info = addMimeTypeInfo( "image/x-exr" ); - - KFileMimeTypeInfo::GroupInfo* group = 0; - KFileMimeTypeInfo::ItemInfo* item; - - // info group - group = addGroupInfo( info, "Info", i18n("Information") ); - addItemInfo( group, "Version", i18n("Format Version"), TQVariant::Int ); - addItemInfo( group, "Tiled image", i18n("Tiled Image"), TQVariant::String ); - item = addItemInfo( group, "Dimensions", i18n("Dimensions"), TQVariant::Size ); - setHint( item, KFileMimeTypeInfo::Size ); - setUnit( item, KFileMimeTypeInfo::Pixels ); - item = addItemInfo( group, "ThumbnailDimensions", - i18n("Thumbnail Dimensions"), TQVariant::Size ); - setHint( item, KFileMimeTypeInfo::Size ); - setUnit( item, KFileMimeTypeInfo::Pixels ); - addItemInfo( group, "Comment", i18n("Comment"), TQVariant::String ); - item = addItemInfo( group, "Thumbnail", i18n("Thumbnail"), TQVariant::Image ); - setHint( item, KFileMimeTypeInfo::Thumbnail ); - - // standard attributes group - group = addGroupInfo( info, "Standard", i18n("Standard Attributes") ); - addItemInfo( group, "Owner", i18n("Owner"), TQVariant::String ); - addItemInfo( group, "Comments", i18n("Comments"), TQVariant::String ); - addItemInfo( group, "Capture Date", i18n("Capture Date"), TQVariant::String ); - item = addItemInfo( group, "UTC Offset", i18n("UTC Offset"), TQVariant::String ); - item = addItemInfo( group, "Exposure time", i18n("Exposure Time"), TQVariant::Double); - setUnit( item, KFileMimeTypeInfo::Seconds ); - item = addItemInfo( group, "Focus", i18n("Focus"), TQVariant::Double); - setSuffix( item, i18n("Metres", "m") ); - item = addItemInfo( group, "X Density", i18n("X Density"), TQVariant::Double); - setSuffix( item, i18n("Pixels Per Inch", " ppi") ); - item = addItemInfo( group, "White luminance", i18n("White Luminance"), TQVariant::Double); - setSuffix( item, i18n("Candelas per square metre", " Nits") ); - addItemInfo( group, "Longitude", i18n("Longitude"), TQVariant::String ); - addItemInfo( group, "Latitude", i18n("Latitude"), TQVariant::String ); - item = addItemInfo( group, "Altitude", i18n("Altitude"), TQVariant::String ); - setSuffix( item, i18n("Metres", "m") ); - addItemInfo( group, "ISO speed", i18n("ISO Speed"), TQVariant::Double ); - addItemInfo( group, "Aperture", i18n("Aperture"), TQVariant::Double ); - - // channel group - group = addGroupInfo( info, "Channel", i18n("Channels") ); - addItemInfo( group, "A", i18n("A"), TQVariant::String ); - addItemInfo( group, "R", i18n("R"), TQVariant::String ); - addItemInfo( group, "G", i18n("G"), TQVariant::String ); - addItemInfo( group, "B", i18n("B"), TQVariant::String ); - addItemInfo( group, "Z", i18n("Z"), TQVariant::String ); - addItemInfo( group, "NX", i18n("NX"), TQVariant::String ); - addItemInfo( group, "NY", i18n("NY"), TQVariant::String ); - addItemInfo( group, "NZ", i18n("NZ"), TQVariant::String ); - addItemInfo( group, "R", i18n("R"), TQVariant::String ); - addItemInfo( group, "U", i18n("U"), TQVariant::String ); - addItemInfo( group, "V", i18n("V"), TQVariant::String ); - addItemInfo( group, "materialID", i18n("materialID"), TQVariant::String ); - addItemInfo( group, "objectID", i18n("objectID"), TQVariant::String ); - addItemInfo( group, "renderID", i18n("renderID"), TQVariant::String ); - addItemInfo( group, "pixelCover", i18n("pixelCover"), TQVariant::String ); - addItemInfo( group, "velX", i18n("velX"), TQVariant::String ); - addItemInfo( group, "velY", i18n("velY"), TQVariant::String ); - addItemInfo( group, "packedRGBA", i18n("packedRGBA"), TQVariant::String ); - - - // technical group - group = addGroupInfo( info, "Technical", i18n("Technical Details") ); - addItemInfo( group, "Compression", i18n("Compression"), TQVariant::String ); - addItemInfo( group, "Line Order", i18n("Line Order"), TQVariant::String ); - - // 3dsMax group - // This supports a special plugin for 3D Studio Max - group = addGroupInfo( info, "3dsMax", i18n("3dsMax Details") ); - addItemInfo( group, "Local time", i18n("Local Time"), TQVariant::String ); - addItemInfo( group, "System time", i18n("System Time"), TQVariant::String ); - addItemInfo( group, "Plugin version", i18n("Plugin Version"), TQVariant::String ); - addItemInfo( group, "EXR version", i18n("EXR Version"), TQVariant::String ); - addItemInfo( group, "Computer name", i18n("Computer Name"), TQVariant::String ); -} - -TQCString doType( PixelType pt ) -{ - switch (pt) - { - case UINT: - return TQCString("32-bit unsigned integer"); - break; - case HALF: - return TQCString("16-bit floating-point"); - break; - case FLOAT: - return TQCString("32-bit floating-point"); - break; - default: - return TQCString(); - break; - } -} - -bool KExrPlugin::readInfo( KFileMetaInfo& info, uint what) -{ - try - { - InputFile in ( info.path().ascii() ); - const Header &h = in.header(); - - KFileMetaInfoGroup infogroup = appendGroup(info, "Info"); - KFileMetaInfoGroup stdgroup = appendGroup(info, "Standard"); - KFileMetaInfoGroup channelgroup = appendGroup(info, "Channel"); - KFileMetaInfoGroup techgroup = appendGroup(info, "Technical"); - KFileMetaInfoGroup threedsmaxgroup = appendGroup(info, "3dsMax"); - - appendItem( infogroup, "Version", getVersion(in.version()) ); - if (isTiled(in.version())) { - appendItem( infogroup, "Tiled image", "yes" ); - } else { - appendItem( infogroup, "Tiled image", "no" ); - } - - Imath::Box2i dw = h.dataWindow(); - appendItem( infogroup, "Dimensions", TQSize( (dw.max.x - dw.min.x + 1 ), - (dw.max.y - dw.min.y + 1 ) ) ); - - if ( h.hasPreviewImage() ) { - const PreviewImage &preview = in.header().previewImage(); - appendItem( infogroup, "ThumbnailDimensions", TQSize(preview.width(), preview.height()) ); - TQImage qpreview(preview.width(), preview.height(), 32, 0, TQImage::BigEndian); - for ( unsigned int y=0; y < preview.height(); y++ ) { - for ( unsigned int x=0; x < preview.width(); x++ ) { - const PreviewRgba &q = preview.pixels()[x+(y*preview.width())]; - qpreview.setPixel( x, y, tqRgba(q.r, q.g, q.b, q.a) ); - } - } - appendItem( infogroup, "Thumbnail", qpreview); - } - - const StringAttribute *commentSA = h.findTypedAttribute ("comment"); - if (commentSA) { - std::string commentString = commentSA->value(); - TQString qcommentString(commentString.data()); - qcommentString.setLength(commentString.size()); - appendItem( infogroup, "Comment", qcommentString ); - } - - // Standard Attributes we are interested in and can - // meaningfully represent. - if ( hasComments(h) ) { - std::string commentsString = comments(h); - TQString qcommentsString(commentsString.data()); - qcommentsString.setLength(commentsString.size()); - appendItem( stdgroup, "Comments", qcommentsString ); - } - if ( hasOwner(h) ) { - std::string ownerString = owner(h); - TQString qownerString(ownerString.data()); - qownerString.setLength(ownerString.size()); - appendItem( stdgroup, "Owner", qownerString ); - } - if ( hasCapDate(h) ) { - std::string capDateString = capDate(h); - TQString qcapDateString(capDateString.data()); - qcapDateString.setLength(capDateString.size()); - appendItem( stdgroup, "Capture Date", qcapDateString ); - } - // This define was introduced in EXR 1.6.0 -#ifndef IMF_B44_COMPRESSION - // This is the 1.4 and earlier version - if ( hasutcOffset(h) ) { -#else - // This is the 1.6.0 and later version - if ( hasUtcOffset(h) ) { -#endif - TQString UTCOffset; - if (utcOffset(h)>0.0) { - UTCOffset.append(TQString("%1").arg(utcOffset(h)/3600, 0, 'f', 1)); - UTCOffset.append(" hours behind UTC"); - } else { - UTCOffset.append(TQString("%1").arg(-1.0*utcOffset(h)/3600, 0, 'f', 1)); - UTCOffset.append(" hours ahead of UTC"); - } - appendItem( stdgroup, "UTC Offset", UTCOffset); - } - if ( hasExpTime(h) ) { - double exposureTime = expTime(h); - appendItem( stdgroup, "Exposure time", exposureTime ); - } - if ( hasFocus(h) ) { - double focusDistance = focus(h); - appendItem( stdgroup, "Focus", focusDistance ); - } - if ( hasXDensity(h) ) { - double XDensity = xDensity(h); - appendItem( stdgroup, "X Density", XDensity ); - } - if ( hasWhiteLuminance(h) ) { - double WhiteLuminance = whiteLuminance(h); - appendItem( stdgroup, "White luminance", WhiteLuminance ); - } - if ( hasLongitude(h) ) { - TQString Longitude; - if (longitude(h)<0.0) { - Longitude.append(TQString("%1").arg(-1.0*longitude(h),0,'f',3)); - Longitude.append(" deg West"); - } else { - Longitude.append(TQString("%1").arg(longitude(h),0,'f',3)); - Longitude.append(" deg East"); - } - appendItem( stdgroup, "Longitude", Longitude); - } - if ( hasLatitude(h) ) { - TQString Latitude; - if (latitude(h)<0.0) { - Latitude.append(TQString("%1").arg(-1.0*latitude(h),0,'f',3)); - Latitude.append(" deg South"); - } else { - Latitude.append(TQString("%1").arg(latitude(h),0,'f',3)); - Latitude.append(" deg North"); - } - appendItem( stdgroup, "Latitude", Latitude ); - } - if ( hasAltitude(h) ) { - double Altitude = altitude(h); - appendItem( stdgroup, "Altitude", TQString("%1").arg(Altitude,0,'f',1) ); - } - if ( hasIsoSpeed(h) ) { - double IsoSpeed = isoSpeed(h); - appendItem( stdgroup, "ISO speed", IsoSpeed ); - } - if ( hasAperture(h) ) { - double Aperture = aperture(h); - appendItem( stdgroup, "Aperture", Aperture ); - } - - for (Header::ConstIterator i = h.begin(); i != h.end(); ++i) { - const Attribute *a = &i.attribute(); - - if (const CompressionAttribute *ta = dynamic_cast (a)) { - switch ( ta->value() ) - { - case NO_COMPRESSION: - appendItem( techgroup, "Compression", i18n("No compression")); - break; - case RLE_COMPRESSION: - appendItem( techgroup, "Compression", i18n("Run Length Encoding")); - break; - case ZIPS_COMPRESSION: - appendItem( techgroup, "Compression", i18n("zip, individual scanlines")); - break; - case ZIP_COMPRESSION: - appendItem( techgroup, "Compression", i18n("zip, multi-scanline blocks")); - break; - case PIZ_COMPRESSION: - appendItem( techgroup, "Compression", i18n("piz compression")); - break; - default: - break; - } - } else if (const LineOrderAttribute *ta = dynamic_cast (a)) { - switch (ta->value()) - { - case INCREASING_Y: - appendItem( techgroup, "Line Order", i18n("increasing Y")); - break; - case DECREASING_Y: - appendItem( techgroup, "Line Order", i18n("decreasing Y")); - break; - default: - break; - }; - } else if (const ChannelListAttribute *ta = dynamic_cast (a)) { - - for (ChannelList::ConstIterator i = ta->value().begin(); i != ta->value().end(); ++i) - { - appendItem( channelgroup, i.name(), doType(i.channel().type) ); - } - } - } - - // This section deals with some special case stuff for a 3D Studio Max - // plugin from Splutterfish. The weird construction is an - // attempt to to deal with class conversion. C++ string handling - // without TQt is a pain... - const StringAttribute *ver3DSM = h.findTypedAttribute ("version3dsMax"); - if (ver3DSM) { - std::string ver3DSMstring = ver3DSM->value(); - TQString qver3DSMstring(ver3DSMstring.data()); - qver3DSMstring.setLength(ver3DSMstring.size()); - appendItem( threedsmaxgroup, "Plugin version", qver3DSMstring ); - } - const StringAttribute *verEXR = h.findTypedAttribute ("versionEXR"); - if (verEXR) { - std::string verEXRstring = verEXR->value(); - TQString qverEXRstring(verEXRstring.data()); - qverEXRstring.setLength(verEXRstring.size()); - appendItem( threedsmaxgroup, "EXR version", TQString( verEXRstring.data() ) ); - } - const StringAttribute *localTime = h.findTypedAttribute ("localTime"); - if (localTime) { - std::string localTimeString = localTime->value(); - TQString qlocalTimeString(localTimeString.data()); - qlocalTimeString.setLength(localTimeString.size()); - appendItem( threedsmaxgroup, "Local time", qlocalTimeString ); - } - const StringAttribute *systemTime = h.findTypedAttribute ("systemTime"); - if (systemTime) { - std::string systemTimeString = systemTime->value(); - TQString qsystemTimeString(systemTimeString.data()); - qsystemTimeString.setLength(systemTimeString.size()); - appendItem( threedsmaxgroup, "System time", qsystemTimeString ); - } - const StringAttribute *computerName = h.findTypedAttribute ("computerName"); - if (computerName) { - std::string computerNameString = computerName->value(); - TQString qcomputerNameString(computerNameString.data()); - qcomputerNameString.setLength(computerNameString.size()); - appendItem( threedsmaxgroup, "Computer name", qcomputerNameString ); - } - - return true; - } - catch (const std::exception &e) - { - kdDebug(0) << e.what() << endl; - return false; - } -} - -#include "kfile_exr.moc" diff --git a/kfile-plugins/exr/kfile_exr.desktop b/kfile-plugins/exr/kfile_exr.desktop deleted file mode 100644 index 4ced6088..00000000 --- a/kfile-plugins/exr/kfile_exr.desktop +++ /dev/null @@ -1,57 +0,0 @@ -[Desktop Entry] -Type=Service -Name=EXR Info -Name[br]=Titouroù EXR -Name[ca]=Informació EXR -Name[cs]=EXR info -Name[cy]=Gwybodaeth EXR -Name[da]=EXR-Info -Name[de]=EXR-Info -Name[el]=Πληροφορίες EXR -Name[eo]=EXR-informo -Name[es]=Info EXR -Name[et]=EXR info -Name[fa]=اطلاعات EXR -Name[fi]=EXR-tiedot -Name[fr]=Informations EXR -Name[ga]=Eolas faoi EXR -Name[gl]=Inf. EXR -Name[he]=מידע EXR -Name[hu]=EXR-jellemzők -Name[is]=EXR upplýsingar -Name[it]=Informazioni EXR -Name[ja]=EXR 情報 -Name[kk]=EXR мәліметі -Name[km]=ព័ត៌មាន EXR -Name[lt]=EXR informacija -Name[ms]=Maklumat EXR -Name[nds]=EXR-Info -Name[ne]=EXR सूचना -Name[nl]=EXR-info -Name[nn]=EXR-info -Name[pa]=EXR ਜਾਣਕਾਰੀ -Name[pl]=Informacja EXR -Name[pt]=Informação do EXR -Name[pt_BR]=Informação sobre EXR -Name[ro]=Informaţii EXR -Name[ru]=Информация о EXR -Name[se]=EXR-dieđut -Name[sl]=Podatki o EXR -Name[sr]=EXR информације -Name[sr@Latn]=EXR informacije -Name[sv]=EXR-information -Name[ta]=EXR தகவல் -Name[tg]=Иттилоот оиди EXR -Name[th]=ข้อมูลแฟ้ม EXR -Name[tr]=EXR Bilgisi -Name[uk]=Інформація по EXR -Name[uz]=EXR haqida maʼlumot -Name[uz@cyrillic]=EXR ҳақида маълумот -Name[zh_CN]=EXR 信息 -Name[zh_HK]=EXR 資訊 -Name[zh_TW]=EXR 資訊 -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_exr -MimeType=image/x-exr -PreferredGroups=Info,Standard,Channels,Technical,3dsMax -PreferredItems=Dimensions,Thumbnail,ThumbnailDimensions,Version,Comments,Owner,Latitude,Longitude,Altitude,Capture Date,UTC Offset diff --git a/kfile-plugins/exr/kfile_exr.h b/kfile-plugins/exr/kfile_exr.h deleted file mode 100644 index 80e7fea7..00000000 --- a/kfile-plugins/exr/kfile_exr.h +++ /dev/null @@ -1,40 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2003 - * - * 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_EXR_H__ -#define __KFILE_EXR_H__ - -#include -#include - -class TQStringList; - -class KExrPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KExrPlugin( TQObject *parent, const char *name, const TQStringList& preferredItems ); - - virtual bool readInfo( KFileMetaInfo& info, uint ); -}; - -#endif diff --git a/kfile-plugins/gif/CMakeLists.txt b/kfile-plugins/gif/CMakeLists.txt deleted file mode 100644 index f2fc4320..00000000 --- a/kfile-plugins/gif/CMakeLists.txt +++ /dev/null @@ -1,34 +0,0 @@ -################################################# -# -# (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 kfile_gif.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - - -#### kfile_gif (module) ######################### -tde_add_kpart( kfile_gif AUTOMOC - SOURCES kfile_gif.cpp - LINK kio-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kfile-plugins/gif/Makefile.am b/kfile-plugins/gif/Makefile.am deleted file mode 100644 index b847d002..00000000 --- a/kfile-plugins/gif/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -## Makefile.am for gif file meta info plugin - -KDE_CXXFLAGS = $(USE_EXCEPTIONS) - -# set the include path for X, qt and KDE -INCLUDES = $(all_includes) - -# these are the headers for your project -noinst_HEADERS = kfile_gif.h - -kde_module_LTLIBRARIES = kfile_gif.la - -kfile_gif_la_SOURCES = kfile_gif.cpp -kfile_gif_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -kfile_gif_la_LIBADD = $(LIB_KIO) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: - $(XGETTEXT) *.cpp -o $(podir)/kfile_gif.pot - -services_DATA = kfile_gif.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/gif/README b/kfile-plugins/gif/README deleted file mode 100644 index e81cc913..00000000 --- a/kfile-plugins/gif/README +++ /dev/null @@ -1,10 +0,0 @@ -The original README for this file read: - -Note: Development of this module has been suspended. -Please feel free to contact me, and pick it up. All I ask -is that you preserve both command line and kfile abilities. Thanks. -bryce@obviously.com - - -I contacted Bryce, but received no response. The command line code -is unchanged - I just fixed the kfile code to work, read only. diff --git a/kfile-plugins/gif/gif-info.1 b/kfile-plugins/gif/gif-info.1 deleted file mode 100644 index 6c36b1c4..00000000 --- a/kfile-plugins/gif/gif-info.1 +++ /dev/null @@ -1,25 +0,0 @@ -.TH gif-info 1 "April 2002" - -.SH NAME -gif-info \- reads gif image info or sets comment. - -.SH SYNOPSIS -.B gif-info -.RB -['Comment'] - -.SH DESCRIPTION -.LP -.B gif-info -displays information about the given gif (Graphic Interchange Format) image. If a comment is specified, the comment is set instead. -.PP -Write a empty comment ('') to delete the comment block. -.PP -The GIF standard allows any number of 256 byte comment blocks in an image file, but most implementations (including this one) restrict you to just one block. The GIF standard restricts comment blocks to "7 Bit ASCII", but this is widely ignored. You are welcome to store text in your own native language, and are especially encouraged to use comments in utf-8 unicode format. - -.SH "SEE ALSO" -.BR wrjpgcom (1) -.BR rdjpgcom (1) - -.SH AUTHOR -Bryce Nesbitt diff --git a/kfile-plugins/gif/gif-info.c b/kfile-plugins/gif/gif-info.c deleted file mode 100644 index 2f64a2f2..00000000 --- a/kfile-plugins/gif/gif-info.c +++ /dev/null @@ -1,561 +0,0 @@ -/* -** $Id$ -** -** Minimal GIF parser, for use in extracting and setting metadata. -** Modified for standalone & KDE calling by Bryce Nesbitt -** -** TODO: -** Support gif comments that span more than one comment block. -** Verify that Unicode utf-8 is fully unmolested by this code. -** Implement gif structure verifier. -** -** Based on: GIFtrans v1.12.2 -** Copyright (C) 24.2.94 by Andreas Ley -** -******************************************************************************* -** -** Original distribution site is -** ftp://ftp.rz.uni-karlsruhe.de/pub/net/www/tools/giftrans/giftrans.c -** A man-page by knordlun@fltxa.helsinki.fi (Kai Nordlund) is at -** ftp://ftp.rz.uni-karlsruhe.de/pub/net/www/tools/giftrans/giftrans.1 -** An online version by taylor@intuitive.com (Dave Taylor) is at -** http://www.intuitive.com/coolweb/Addons/giftrans-doc.html -** To compile for MS-DOS or OS/2, you need getopt: -** ftp://ftp.rz.uni-karlsruhe.de/pub/net/www/tools/giftrans/getopt.c -** MS-DOS executable can be found at -** ftp://ftp.rz.uni-karlsruhe.de/pub/net/www/tools/giftrans/giftrans.exe -** OS/2 executable can be found at -** ftp://ftp.rz.uni-karlsruhe.de/pub/net/www/tools/giftrans/giftrans.os2.exe -** A template rgb.txt for use with the MS-DOS version can be found at -** ftp://ftp.rz.uni-karlsruhe.de/pub/net/www/tools/giftrans/rgb.txt -** Additional info can be found on -** http://melmac.corp.harris.com/transparent_images.html -** -** The GIF file format is documented in -** ftp://ftp.uu.net/doc/literary/obi/Standards/Graphics/Formats/gif89a.doc.Z -** A good quick reference is at: -** http://www.goice.co.jp/member/mo/formats/gif.html -** -******************************************************************************* -** -** 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. -** -*/ - -#include -#include -#include -#include -#include -#include -#include - -#define STANDALONE_COMPILE - -extern int set_gif_comment( const char * original_filename, char * comment ); -extern void * get_gif_info( const char * original_filename ); -extern int validate_gif_structure( const char * original_filename ); -int giftrans( FILE * src, FILE * dest); - -#define WARNING_GARBAGE 1 /* Original file had some unspecified content */ -#define ERROR_NOT_A_JPEG 5 /* Original file not a proper jpeg (must be 1st) */ -#define ERROR_TEMP_FILE 6 /* Problem writing temporay file */ -#define ERROR_SCREWUP 7 /* Original file is now damaged. Ooops. */ -#define ERROR_PREMATURE_EOF 8 /* Unexpected end of file */ -#define ERROR_BAD_MARKER 9 /* Marker with illegal length */ -#define ERROR_MARKER_ORDER 10 /* File seems to be mixed up */ - -/*****************************************************************************/ -#ifndef FALSE -#define FALSE (0) /* This is the naked Truth */ -#define TRUE (1) /* and this is the Light */ -#endif - -#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ -#define READ_BINARY "r" -#define WRITE_BINARY "w" -#else -#ifdef VMS /* VMS is very nonstandard */ -#define READ_BINARY "rb", "ctx=stm" -#define WRITE_BINARY "wb", "ctx=stm" -#else /* standard ANSI-compliant case */ -#define READ_BINARY "rb" -#define WRITE_BINARY "wb" -#endif -#endif - -#define SUCCESS (0) -#define FAILURE (1) - -static char skipcomment,list,verbose,output,debug; -char *global_comment; -static long int pos; - -static char true[] = "True"; -static char false[] = "False"; -static char id[] = "$Id$"; - -/*****************************************************************************/ - -#define readword(buffer) ((buffer)[0]+256*(buffer)[1]) -#define readflag(buffer) ((buffer)?true:false) -#define hex(c) ('a'<=(c)&&(c)<='z'?(c)-'a'+10:'A'<=(c)&&(c)<='Z'?(c)-'A'+10:(c)-'0') - -void dump(adr,data,len) -long int adr; -unsigned char *data; -size_t len; -{ - int i; - - while (len>0) { - (void)fprintf(stderr,"%08lx:%*s",adr,(int)((adr%16)*3+(adr%16>8?1:0)),""); - for (i=adr%16;i<16&&len>0;i++,adr++,data++,len--) - (void)fprintf(stderr,"%s%02x",i==8?" ":" ",*data); - (void)fprintf(stderr,"\n"); - } -} - -void writedata(dest,data,len) -FILE *dest; -unsigned char *data; -size_t len; -{ - unsigned char size; - - while (len) { - size=len<256?len:255; - (void)fwrite((void *)&size,1,1,dest); - (void)fwrite((void *)data,(size_t)size,1,dest); - data+=size; - len-=size; - } - size=0; - (void)fwrite((void *)&size,1,1,dest); -} - -void skipdata(src) -FILE *src; -{ - unsigned char size,buffer[256]; - - do { - pos=ftell(src); - (void)fread((void *)&size,1,1,src); - if (debug) - dump(pos,&size,1); - if (debug) { - pos=ftell(src); - (void)fread((void *)buffer,(size_t)size,1,src); - dump(pos,buffer,(size_t)size); - } - else - (void)fseek(src,(long int)size,SEEK_CUR); - } while (!feof(src)&&size>0); -} - -void transblock(src,dest) -FILE *src; -FILE *dest; -{ - unsigned char size,buffer[256]; - - pos=ftell(src); - (void)fread((void *)&size,1,1,src); - if (debug) - dump(pos,&size,1); - if (output) - (void)fwrite((void *)&size,1,1,dest); - pos=ftell(src); - (void)fread((void *)buffer,(size_t)size,1,src); - if (debug) - dump(pos,buffer,(size_t)size); - if (output) - (void)fwrite((void *)buffer,(size_t)size,1,dest); -} - -void dumpcomment(src) -FILE *src; -{ - unsigned char size,buffer[256]; - size_t i; - - pos=ftell(src); - (void)fread((void *)&size,1,1,src); - if (debug) - dump(pos,&size,1); - (void)fread((void *)buffer,(size_t)size,1,src); - if (debug) - dump(pos+1,buffer,(size_t)size); - for (i=0; i<(size_t)size; i++) - { - if ( buffer[i] >= 0x20 || buffer[i] == '\t' || - buffer[i] =='\r' || buffer[i] == '\n') - (void)putc(buffer[i],stderr); - else - (void)fprintf(stderr,"\\%03o",buffer[i]); - } - (void)fseek(src,(long int)pos,SEEK_SET); -} - -void transdata(src,dest) -FILE *src; -FILE *dest; -{ - unsigned char size,buffer[256]; - - do { - pos=ftell(src); - (void)fread((void *)&size,1,1,src); - if (debug) - dump(pos,&size,1); - if (output) - (void)fwrite((void *)&size,1,1,dest); - pos=ftell(src); - (void)fread((void *)buffer,(size_t)size,1,src); - if (debug) - dump(pos,buffer,(size_t)size); - if (output) - (void)fwrite((void *)buffer,(size_t)size,1,dest); - } while (!feof(src)&&size>0); -} - - -/*****************************************************************************/ - -int giftrans(src,dest) -FILE *src; -FILE *dest; -{ - unsigned char buffer[3*256],lsd[7],gct[3*256]; - unsigned int cnt,cols,size,gct_size; - - /* Header */ - pos=ftell(src); - (void)fread((void *)buffer,6,1,src); - if (strncmp((char *)buffer,"GIF",3)) { - (void)fprintf(stderr,"Not GIF file!\n"); - return(1); - } - if (verbose && debug) { - buffer[6]='\0'; - (void)fprintf(stderr,"Header: \"%s\"\n",buffer); - } - if (debug) - dump(pos,buffer,6); - if (output) { - (void)fwrite((void *)buffer,6,1,dest); - } - - /* Logical Screen Descriptor */ - pos=ftell(src); - (void)fread((void *)lsd,7,1,src); - if (verbose) { - //(void)fprintf(stderr,"Logical Screen Descriptor:\n"); - (void)fprintf(stderr,"Size : %dx%d pixels\n",readword(lsd), readword(lsd+2)); - //(void)fprintf(stderr,"Global Color Table Flag: %s\n",readflag(lsd[4]&0x80)); - (void)fprintf(stderr,"Depth : %d bits\n",(lsd[4]&0x70>>4)+1); - //if (lsd[4]&0x80) { - // (void)fprintf(stderr,"\tSort Flag: %s\n",readflag(lsd[4]&0x8)); - // (void)fprintf(stderr,"\tSize of Global Color Table: %d colors\n",2<<(lsd[4]&0x7)); - // (void)fprintf(stderr,"\tBackground Color Index: %d\n",lsd[5]); - //} - if (lsd[6]) - (void)fprintf(stderr,"Pixel Aspect Ratio: %d (Aspect Ratio %f)\n",lsd[6],((double)lsd[6]+15)/64); - } - if (debug) - dump(pos,lsd,7); - if (output) - (void)fwrite((void *)lsd,7,1,dest); - - /* Global Color Table */ - if (lsd[4]&0x80) { - gct_size=2<<(lsd[4]&0x7); - pos=ftell(src); - (void)fread((void *)gct,gct_size,3,src); - if (output) - (void)fwrite((void *)gct,gct_size,3,dest); - } - - do { - pos=ftell(src); - (void)fread((void *)buffer,1,1,src); - switch (buffer[0]) { - case 0x2c: /* Image Descriptor */ - if (verbose && debug) - (void)fprintf(stderr,"Image Descriptor:\n"); - (void)fread((void *)(buffer+1),9,1,src); - if (debug) - dump(pos,buffer,10); - if (output) - (void)fwrite((void *)buffer,10,1,dest); - /* Local Color Table */ - if (buffer[8]&0x80) { - size=2<<(buffer[8]&0x7); - pos=ftell(src); - (void)fread((void *)buffer,size,3,src); - if (verbose && debug) { - (void)fprintf(stderr,"Local Color Table:\n"); - for(cnt=0;cnt 3) { - fprintf(stderr, "Usage: %s [\"\"]\nReads gif image info or sets comment.\n", progname); - return(5); - } - filename = argv[1]; - comment = argv[2]; - - - /* Check if file is readable... */ - if ((fp = fopen(filename, READ_BINARY)) == NULL) { - fprintf(stderr, "Error: Can't open file '%s'\n", filename); - return(5); - } - fclose(fp); - - /* Check if we really have a commentable image file here... */ - if( validate_gif_structure( filename ) ) { - fprintf(stderr, "Error: error parsing file '%s' as a gif image\n", filename); - return(5); - } - - if( argc == 2 ) { - get_gif_info( filename ); - } - else { - set_gif_comment( filename, comment ); - } - - return( 0 ); -} -#endif - diff --git a/kfile-plugins/gif/kfile_gif.cpp b/kfile-plugins/gif/kfile_gif.cpp deleted file mode 100644 index 009f8cc5..00000000 --- a/kfile-plugins/gif/kfile_gif.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* - * This file is part of the KDE project, added by Bryce Nesbitt - * - * This is a plugin for Konqeror/KFile which processes 'extra' information - * contained in a .gif image file (In particular the comment, and resolution). - * - ************************************** - * - * 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 -#include "kfile_gif.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -typedef KGenericFactory GifFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_gif, GifFactory("kfile_gif")) - -KGifPlugin::KGifPlugin(TQObject *parent, const char *name, - const TQStringList &args) - : KFilePlugin(parent, name, args) -{ - kdDebug(7034) << "gif KFileMetaInfo plugin\n"; - - KFileMimeTypeInfo* info = addMimeTypeInfo( "image/gif" ); - - KFileMimeTypeInfo::GroupInfo* group = 0L; - - group = addGroupInfo(info, "General", i18n("General")); - - KFileMimeTypeInfo::ItemInfo* item; - - item = addItemInfo(group, "Version", i18n("Version"), TQVariant::String); - - 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); - -} - -bool KGifPlugin::readInfo( KFileMetaInfo& info, uint what ) -{ - Q_UNUSED( what ); - - kdDebug(7034) << "gif KFileMetaInfo readInfo\n"; - - TQFile file(info.path()); - - if (!file.open(IO_ReadOnly)) { - kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()).data() << endl; - return false; - } - - TQDataStream fstream(&file); - - bool isGIF87a = false; - char magic[7]; - TQ_UINT16 width = 0; - TQ_UINT16 height = 0; - TQ_UINT8 miscInfo = 0; - - fstream.readRawBytes( magic, 6 ); - magic[6] = 0x00; // null terminate - - // I have special requirements... - fstream.setByteOrder( TQDataStream::LittleEndian ); - fstream >> width; - fstream >> height; - fstream >> miscInfo; - - KFileMetaInfoGroup group = appendGroup(info, "General"); - - if ( 0 == strncmp( magic, "GIF89a", 6 ) ) { - appendItem( group, "Version", i18n("GIF Version 89a") ); - } else if ( 0 == strncmp( magic, "GIF87a", 6 ) ) { - appendItem( group, "Version", i18n("GIF Version 87a") ); - isGIF87a = true; - } else { - appendItem( group, "Version", i18n("Unknown") ); - } - - appendItem( group, "Dimensions", TQSize(width, height) ); - - if ( isGIF87a ) { - appendItem( group, "BitDepth", ( (miscInfo & 0x07) + 1) ); - } - - file.close(); - - return true; -} - -#include "kfile_gif.moc" diff --git a/kfile-plugins/gif/kfile_gif.desktop b/kfile-plugins/gif/kfile_gif.desktop deleted file mode 100644 index 246f7565..00000000 --- a/kfile-plugins/gif/kfile_gif.desktop +++ /dev/null @@ -1,65 +0,0 @@ -[Desktop Entry] -Type=Service -Name=GIF Info -Name[af]=Gif Inligting -Name[ar]=معلومات GIF -Name[br]=Titouroù GIF -Name[ca]=Informació de GIF -Name[cs]=GIF info -Name[cy]=Gwybodaeth GIF -Name[da]=GIF-info -Name[de]=GIF-Info -Name[el]=Πληροφορίες GIF -Name[eo]=GIF-informo -Name[es]=Info GIF -Name[et]=GIF info -Name[fa]=اطلاعات GIF -Name[fi]=GIF-tiedot -Name[fr]=Informations GIF -Name[ga]=Eolas faoi GIF -Name[gl]=Inf. Gif -Name[he]=מידע GIF -Name[hi]=GIF जानकारी -Name[hr]=GIF Informacije -Name[hu]=GIF-jellemzők -Name[is]=GIF upplýsingar -Name[it]=Informazioni GIF -Name[ja]=GIF 情報 -Name[kk]=GIF мәліметі -Name[km]=ព័ត៌មាន GIF -Name[lt]=GIF informacija -Name[ms]=Maklumat GIF -Name[nds]=GIF-Info -Name[ne]=GIF सूचना -Name[nl]=GIF-info -Name[nn]=GIF-info -Name[nso]=Tshedimoso ya GIF -Name[pa]=GIF ਜਾਣਕਾਰੀ -Name[pl]=Informacja o pliku GIF -Name[pt]=Informação do GIF -Name[pt_BR]=Informação sobre GIF -Name[ro]=Informaţii GIF -Name[ru]=Информация о GIF -Name[se]=GIF-dieđut -Name[sl]=Podatki o GIF -Name[sr]=GIF информације -Name[sr@Latn]=GIF informacije -Name[sv]=Gif-information -Name[ta]=GIF தகவல் -Name[tg]=Иттилоот оиди GIF -Name[th]=ข้อมูลแฟ้ม GIF -Name[tr]=GIF Bilgisi -Name[uk]=Інформація по GIF -Name[uz]=GIF haqida maʼlumot -Name[uz@cyrillic]=GIF ҳақида маълумот -Name[ven]=Mafhungo a GIF -Name[wa]=Informåcion sol imådje GIF -Name[xh]=Ulwazi lwe GIF -Name[zh_CN]=GIF 信息 -Name[zh_HK]=GIF 資訊 -Name[zh_TW]=GIF 資訊 -Name[zu]=Ulwazi lwe-GIF -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_gif -MimeType=image/gif -PreferredItems=Comment,Resolution diff --git a/kfile-plugins/gif/kfile_gif.h b/kfile-plugins/gif/kfile_gif.h deleted file mode 100644 index 1285dd45..00000000 --- a/kfile-plugins/gif/kfile_gif.h +++ /dev/null @@ -1,38 +0,0 @@ -/* This file is part of the KDE project - * - * 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_GIF_H__ -#define __KFILE_GIF_H__ - -#include -#include - -class TQStringList; - -class KGifPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KGifPlugin( TQObject *parent, const char *name, const TQStringList& args ); - - virtual bool readInfo ( KFileMetaInfo& info, uint what ); -}; - -#endif diff --git a/kfile-plugins/ico/CMakeLists.txt b/kfile-plugins/ico/CMakeLists.txt deleted file mode 100644 index 1fdbed2b..00000000 --- a/kfile-plugins/ico/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -################################################# -# -# (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 kfile_ico.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - - -#### kfile_ico (module) ######################## - -tde_add_kpart( kfile_ico AUTOMOC - SOURCES kfile_ico.cpp - LINK kio-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kfile-plugins/ico/Makefile.am b/kfile-plugins/ico/Makefile.am deleted file mode 100644 index df3d65ca..00000000 --- a/kfile-plugins/ico/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for ico 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_ico.h - -kde_module_LTLIBRARIES = kfile_ico.la - -kfile_ico_la_SOURCES = kfile_ico.cpp -kfile_ico_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -kfile_ico_la_LIBADD = $(LIB_KSYCOCA) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) kfile_ico.cpp -o $(podir)/kfile_ico.pot - -services_DATA = kfile_ico.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/ico/kfile_ico.cpp b/kfile-plugins/ico/kfile_ico.cpp deleted file mode 100644 index 44fa28d6..00000000 --- a/kfile-plugins/ico/kfile_ico.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Shane Wright - * - * 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 -#include "kfile_ico.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#if !defined(__osf__) -#include -#else -typedef unsigned long uint32_t; -typedef unsigned short uint16_t; -typedef unsigned char uint8_t; -#endif - -typedef KGenericFactory IcoFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_ico, IcoFactory( "kfile_ico" )) - -KIcoPlugin::KIcoPlugin(TQObject *parent, const char *name, - const TQStringList &args) - - : KFilePlugin(parent, name, args) -{ - KFileMimeTypeInfo* info = addMimeTypeInfo( "image/x-ico" ); - - KFileMimeTypeInfo::GroupInfo* group = 0L; - - group = addGroupInfo(info, "Technical", i18n("Technical Details")); - - KFileMimeTypeInfo::ItemInfo* item; - - item = addItemInfo(group, "Number", i18n("Number of Icons"), TQVariant::Int); - - item = addItemInfo(group, "Dimensions", i18n("Dimensions"), TQVariant::Size); - item = addItemInfo(group, "Colors", i18n("Colors"), TQVariant::Int); - - item = addItemInfo(group, "DimensionsM", i18n("Dimensions (1st icon)"), TQVariant::Size); - item = addItemInfo(group, "ColorsM", i18n("Colors (1st icon)"), TQVariant::Int); -} - - -bool KIcoPlugin::readInfo( KFileMetaInfo& info, uint what) -{ - - - TQFile file(info.path()); - - if (!file.open(IO_ReadOnly)) - { - kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()).data() << endl; - return false; - } - - TQDataStream dstream(&file); - - // ICO files are little-endian - dstream.setByteOrder(TQDataStream::LittleEndian); - - - // read the beginning of the file and make sure it looks ok - uint16_t ico_reserved; - uint16_t ico_type; - uint16_t ico_count; - - dstream >> ico_reserved; - dstream >> ico_type; - dstream >> ico_count; - - if ((ico_reserved != 0) || (ico_type != 1) || (ico_count < 1)) - return false; - - - // now loop through each of the icon entries - uint8_t icoe_width; - uint8_t icoe_height; - uint8_t icoe_colorcount; - uint8_t icoe_reserved; - uint16_t icoe_planes; - uint16_t icoe_bitcount; - uint32_t icoe_bytesinres; - uint32_t icoe_imageoffset; - - // read the data on the 1st icon - dstream >> icoe_width; - dstream >> icoe_height; - dstream >> icoe_colorcount; - dstream >> icoe_reserved; - dstream >> icoe_planes; - dstream >> icoe_bitcount; - dstream >> icoe_bytesinres; - dstream >> icoe_imageoffset; - - - // output the useful bits - KFileMetaInfoGroup group = appendGroup(info, "Technical"); - appendItem(group, "Number", ico_count); - - if (ico_count == 1) { - appendItem(group, "Dimensions", TQSize(icoe_width, icoe_height)); - - if (icoe_colorcount > 0) - appendItem(group, "Colors", icoe_colorcount); - else if (icoe_bitcount > 0) - appendItem(group, "Colors", 2 ^ icoe_bitcount); - - } else { - - appendItem(group, "DimensionsM", TQSize(icoe_width, icoe_height)); - - if (icoe_colorcount > 0) - appendItem(group, "ColorsM", icoe_colorcount); - else if (icoe_bitcount > 0) - appendItem(group, "ColorsM", 2 ^ icoe_bitcount); - - } - - return true; -} - -#include "kfile_ico.moc" diff --git a/kfile-plugins/ico/kfile_ico.desktop b/kfile-plugins/ico/kfile_ico.desktop deleted file mode 100644 index 1c63f92c..00000000 --- a/kfile-plugins/ico/kfile_ico.desktop +++ /dev/null @@ -1,65 +0,0 @@ -[Desktop Entry] -Type=Service -Name=ICO Info -Name[af]=Ico Inligting -Name[ar]=معلومات ICO -Name[br]=Titouroù ICO -Name[ca]=Informació d'ICO -Name[cs]=ICO info -Name[cy]=Gwybodaeth ICO -Name[da]=ICO-info -Name[de]=ICO-Info -Name[el]=Πληροφορίες ICO -Name[eo]=ICO-informo -Name[es]=Info ICO -Name[et]=ICO info -Name[fa]=اطلاعات ICO -Name[fi]=ICO-tiedot -Name[fr]=Informations ICO -Name[gl]=Inf. ICO -Name[he]=מידע ICO -Name[hi]=ICO जानकारी -Name[hr]=ICO informacije -Name[hu]=ICO-jellemzők -Name[is]=ICO upplýsingar -Name[it]=Informazioni ICO -Name[ja]=ICO 情報 -Name[kk]=ICO мәліметі -Name[km]=ព័ត៌មាន ICO -Name[lt]=ICO informacija -Name[ms]= Maklumat ICO -Name[nds]=ICO-Info -Name[ne]=ICO सूचना -Name[nl]=ICO-info -Name[nn]=ICO-info -Name[nso]=Tshedimoso ya ICO -Name[pa]=ICO ਜਾਣਕਾਰੀ -Name[pl]=Informacja o pliku ICO -Name[pt]=Informação do ICO -Name[pt_BR]=Informação sobre ICO -Name[ro]=Informaţii ICO -Name[ru]=Информация об ICO -Name[se]=ICO-dieđut -Name[sl]=Podatki o ICO -Name[sr]=ICO информације -Name[sr@Latn]=ICO informacije -Name[sv]=Ico-information -Name[ta]=ICO தகவல் -Name[tg]=Иттилоот оиди ICO -Name[th]=ข้อมูลแฟ้ม ICO -Name[tr]=ICO Bilgisi -Name[uk]=Інформація по ICO -Name[uz]=ICO haqida maʼlumot -Name[uz@cyrillic]=ICO ҳақида маълумот -Name[ven]=Mafhungo a ICO -Name[wa]=Informåcion sol imådjete ICO -Name[xh]=Ulwazi lwe ICO -Name[zh_CN]=ICO 信息 -Name[zh_HK]=ICO 資訊 -Name[zh_TW]=ICO 資訊 -Name[zu]=Ulwazi lwe-ICO -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_ico -MimeType=image/x-ico -PreferredGroups=Technical -PreferredItems=Number,Resolution,Colors,ResolutionM,ColorsM diff --git a/kfile-plugins/ico/kfile_ico.h b/kfile-plugins/ico/kfile_ico.h deleted file mode 100644 index ed447e50..00000000 --- a/kfile-plugins/ico/kfile_ico.h +++ /dev/null @@ -1,38 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Shane Wright - * - * 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_ICO_H__ -#define __KFILE_ICO_H__ - -#include - -class TQStringList; - -class KIcoPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KIcoPlugin( TQObject *parent, const char *name, const TQStringList& args ); - - virtual bool readInfo( KFileMetaInfo& info, uint what); -}; - -#endif diff --git a/kfile-plugins/jpeg/CMakeLists.txt b/kfile-plugins/jpeg/CMakeLists.txt deleted file mode 100644 index a35543d7..00000000 --- a/kfile-plugins/jpeg/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -################################################# -# -# (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 kfile_jpeg.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - - -#### kfile_jpeg (module) ######################## - -tde_add_kpart( kfile_jpeg AUTOMOC - SOURCES kfile_jpeg.cpp exif.cpp kfile_setcomment.cpp - LINK kio-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kfile-plugins/jpeg/Makefile.am b/kfile-plugins/jpeg/Makefile.am deleted file mode 100644 index fac3b392..00000000 --- a/kfile-plugins/jpeg/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -## Makefile.am for jpeg file meta info plugin - -KDE_CXXFLAGS = $(USE_EXCEPTIONS) - -# set the include path for X, qt and KDE -INCLUDES = $(all_includes) - -# these are the headers for your project -noinst_HEADERS = kfile_jpeg.h exif.h - -kde_module_LTLIBRARIES = kfile_jpeg.la - -kfile_jpeg_la_SOURCES = kfile_jpeg.cpp exif.cpp kfile_setcomment.cpp -kfile_jpeg_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -kfile_jpeg_la_LIBADD = $(LIB_KIO) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: - $(XGETTEXT) *.cpp -o $(podir)/kfile_jpeg.pot - -services_DATA = kfile_jpeg.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/jpeg/README b/kfile-plugins/jpeg/README deleted file mode 100644 index 6b714426..00000000 --- a/kfile-plugins/jpeg/README +++ /dev/null @@ -1,35 +0,0 @@ -------------------------------------------------------------------------------- -Thanks to: -Matthias Wandel -jhead (http://www.sentex.net/~mwandel/jhead/) - -Groult Richard -showimg (http://ric.jalix.org/) - -Bryce Nesbitt for setcomment -based on wrjpgcom.c, Copyright (C) 1994-1997, Thomas G. Lane. - -Frank Pieczynski - -EXIF spec: -http://www.pima.net/standards/it10/PIMA15740/exif.htm -http://www.ba.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html - -------------------------------------------------------------------------------- -Bugs: - 0) Just showing the meta info can cause the file to be rewritten!!! - 1) utf-8 paths must be tested and supported. - 2) Display of EXIF comments need to be tested. - Both Unicode & ASCII need testing. - -New features needed: - 1) Should switch to a multi-line editor for comments. Support "\n". - 2) Should autodetect if the jpeg COM is in utf-8 format. - 3) Allow editing the EXIF "Orientation" flag (without rewriting the exif header). - 4) Extract and return the EXIF thumbnail, oriented properly, as an alternative - to the much slower process of generating a new thumbnail. - -Future features: - 1) Allow the user to erase or move comment in either the EXIF or jpeg COM. - 2) Play or return audio files associated with the exif. - diff --git a/kfile-plugins/jpeg/exif.cpp b/kfile-plugins/jpeg/exif.cpp deleted file mode 100644 index 60c689bd..00000000 --- a/kfile-plugins/jpeg/exif.cpp +++ /dev/null @@ -1,961 +0,0 @@ -//-------------------------------------------------------------------------- -// Program to pull the information out of various types of EFIF digital -// camera files and show it in a reasonably consistent way -// -// This module parses the very complicated exif structures. -// -// Matthias Wandel, Dec 1999 - August 2000 -//-------------------------------------------------------------------------- - - -#include "exif.h" -#include -#include - - -static unsigned char * LastExifRefd; -static int ExifSettingsLength; -static double FocalplaneXRes; -static double FocalplaneUnits; -static int MotorolaOrder = 0; -static int SectionsRead; -//static int HaveAll; - -//-------------------------------------------------------------------------- -// Table of Jpeg encoding process names - -#define M_SOF0 0xC0 // Start Of Frame N -#define M_SOF1 0xC1 // N indicates which compression process -#define M_SOF2 0xC2 // Only SOF0-SOF2 are now in common use -#define M_SOF3 0xC3 -#define M_SOF5 0xC5 // NB: codes C4 and CC are NOT SOF markers -#define M_SOF6 0xC6 -#define M_SOF7 0xC7 -#define M_SOF9 0xC9 -#define M_SOF10 0xCA -#define M_SOF11 0xCB -#define M_SOF13 0xCD -#define M_SOF14 0xCE -#define M_SOF15 0xCF -#define M_SOI 0xD8 // Start Of Image (beginning of datastream) -#define M_EOI 0xD9 // End Of Image (end of datastream) -#define M_SOS 0xDA // Start Of Scan (begins compressed data) -#define M_JFIF 0xE0 // Jfif marker -#define M_EXIF 0xE1 // Exif marker -#define M_COM 0xFE // COMment - - -TagTable_t ProcessTable[] = { - { M_SOF0, "Baseline"}, - { M_SOF1, "Extended sequential"}, - { M_SOF2, "Progressive"}, - { M_SOF3, "Lossless"}, - { M_SOF5, "Differential sequential"}, - { M_SOF6, "Differential progressive"}, - { M_SOF7, "Differential lossless"}, - { M_SOF9, "Extended sequential, arithmetic coding"}, - { M_SOF10, "Progressive, arithmetic coding"}, - { M_SOF11, "Lossless, arithmetic coding"}, - { M_SOF13, "Differential sequential, arithmetic coding"}, - { M_SOF14, "Differential progressive, arithmetic coding"}, - { M_SOF15, "Differential lossless, arithmetic coding"}, - { 0, "Unknown"} -}; - - - -//-------------------------------------------------------------------------- -// Describes format descriptor -static int BytesPerFormat[] = {0,1,1,2,4,8,1,1,2,4,8,4,8}; -#define NUM_FORMATS 12 - -#define FMT_BYTE 1 -#define FMT_STRING 2 -#define FMT_USHORT 3 -#define FMT_ULONG 4 -#define FMT_URATIONAL 5 -#define FMT_SBYTE 6 -#define FMT_UNDEFINED 7 -#define FMT_SSHORT 8 -#define FMT_SLONG 9 -#define FMT_SRATIONAL 10 -#define FMT_SINGLE 11 -#define FMT_DOUBLE 12 - -//-------------------------------------------------------------------------- -// Describes tag values - -#define TAG_EXIF_OFFSET 0x8769 -#define TAG_INTEROP_OFFSET 0xa005 - -#define TAG_MAKE 0x010F -#define TAG_MODEL 0x0110 -#define TAG_ORIENTATION 0x0112 - -#define TAG_EXPOSURETIME 0x829A -#define TAG_FNUMBER 0x829D - -#define TAG_SHUTTERSPEED 0x9201 -#define TAG_APERTURE 0x9202 -#define TAG_MAXAPERTURE 0x9205 -#define TAG_FOCALLENGTH 0x920A - -#define TAG_DATETIME_ORIGINAL 0x9003 -#define TAG_USERCOMMENT 0x9286 - -#define TAG_SUBJECT_DISTANCE 0x9206 -#define TAG_FLASH 0x9209 - -#define TAG_FOCALPLANEXRES 0xa20E -#define TAG_FOCALPLANEUNITS 0xa210 -#define TAG_EXIF_IMAGEWIDTH 0xA002 -#define TAG_EXIF_IMAGELENGTH 0xA003 - -// the following is added 05-jan-2001 vcs -#define TAG_EXPOSURE_BIAS 0x9204 -#define TAG_WHITEBALANCE 0x9208 -#define TAG_METERING_MODE 0x9207 -#define TAG_EXPOSURE_PROGRAM 0x8822 -#define TAG_ISO_EQUIVALENT 0x8827 -#define TAG_COMPRESSION_LEVEL 0x9102 - -#define TAG_THUMBNAIL_OFFSET 0x0201 -#define TAG_THUMBNAIL_LENGTH 0x0202 - - -/*static TagTable_t TagTable[] = { - { 0x100, "ImageWidth"}, - { 0x101, "ImageLength"}, - { 0x102, "BitsPerSample"}, - { 0x103, "Compression"}, - { 0x106, "PhotometricInterpretation"}, - { 0x10A, "FillOrder"}, - { 0x10D, "DocumentName"}, - { 0x10E, "ImageDescription"}, - { 0x10F, "Make"}, - { 0x110, "Model"}, - { 0x111, "StripOffsets"}, - { 0x112, "Orientation"}, - { 0x115, "SamplesPerPixel"}, - { 0x116, "RowsPerStrip"}, - { 0x117, "StripByteCounts"}, - { 0x11A, "XResolution"}, - { 0x11B, "YResolution"}, - { 0x11C, "PlanarConfiguration"}, - { 0x128, "ResolutionUnit"}, - { 0x12D, "TransferFunction"}, - { 0x131, "Software"}, - { 0x132, "DateTime"}, - { 0x13B, "Artist"}, - { 0x13E, "WhitePoint"}, - { 0x13F, "PrimaryChromaticities"}, - { 0x156, "TransferRange"}, - { 0x200, "JPEGProc"}, - { 0x201, "ThumbnailOffset"}, - { 0x202, "ThumbnailLength"}, - { 0x211, "YCbCrCoefficients"}, - { 0x212, "YCbCrSubSampling"}, - { 0x213, "YCbCrPositioning"}, - { 0x214, "ReferenceBlackWhite"}, - { 0x828D, "CFARepeatPatternDim"}, - { 0x828E, "CFAPattern"}, - { 0x828F, "BatteryLevel"}, - { 0x8298, "Copyright"}, - { 0x829A, "ExposureTime"}, - { 0x829D, "FNumber"}, - { 0x83BB, "IPTC/NAA"}, - { 0x8769, "ExifOffset"}, - { 0x8773, "InterColorProfile"}, - { 0x8822, "ExposureProgram"}, - { 0x8824, "SpectralSensitivity"}, - { 0x8825, "GPSInfo"}, - { 0x8827, "ISOSpeedRatings"}, - { 0x8828, "OECF"}, - { 0x9000, "ExifVersion"}, - { 0x9003, "DateTimeOriginal"}, - { 0x9004, "DateTimeDigitized"}, - { 0x9101, "ComponentsConfiguration"}, - { 0x9102, "CompressedBitsPerPixel"}, - { 0x9201, "ShutterSpeedValue"}, - { 0x9202, "ApertureValue"}, - { 0x9203, "BrightnessValue"}, - { 0x9204, "ExposureBiasValue"}, - { 0x9205, "MaxApertureValue"}, - { 0x9206, "SubjectDistance"}, - { 0x9207, "MeteringMode"}, - { 0x9208, "LightSource"}, - { 0x9209, "Flash"}, - { 0x920A, "FocalLength"}, - { 0x927C, "MakerNote"}, - { 0x9286, "UserComment"}, - { 0x9290, "SubSecTime"}, - { 0x9291, "SubSecTimeOriginal"}, - { 0x9292, "SubSecTimeDigitized"}, - { 0xA000, "FlashPixVersion"}, - { 0xA001, "ColorSpace"}, - { 0xA002, "ExifImageWidth"}, - { 0xA003, "ExifImageLength"}, - { 0xA005, "InteroperabilityOffset"}, - { 0xA20B, "FlashEnergy"}, // 0x920B in TIFF/EP - { 0xA20C, "SpatialFrequencyResponse"}, // 0x920C - - - { 0xA20E, "FocalPlaneXResolution"}, // 0x920E - - - { 0xA20F, "FocalPlaneYResolution"}, // 0x920F - - - { 0xA210, "FocalPlaneResolutionUnit"}, // 0x9210 - - - { 0xA214, "SubjectLocation"}, // 0x9214 - - - { 0xA215, "ExposureIndex"}, // 0x9215 - - - { 0xA217, "SensingMethod"}, // 0x9217 - - - { 0xA300, "FileSource"}, - { 0xA301, "SceneType"}, - { 0, NULL} -} ; -*/ - - -//-------------------------------------------------------------------------- -// Parse the marker stream until SOS or EOI is seen; -//-------------------------------------------------------------------------- -int ExifData::ReadJpegSections (TQFile & infile, ReadMode_t ReadMode) -{ - int a; - - a = infile.getch(); - - if (a != 0xff || infile.getch() != M_SOI) { - SectionsRead = 0; - return false; - } - for(SectionsRead = 0; SectionsRead < MAX_SECTIONS-1; ){ - int marker = 0; - int got; - unsigned int ll,lh; - unsigned int itemlen; - uchar * Data; - - for (a=0;a<7;a++){ - marker = infile.getch(); - if (marker != 0xff) break; - - if (a >= 6){ - - kdDebug(7034) << "too many padding bytes\n"; - return false; - - } - } - - if (marker == 0xff){ - // 0xff is legal padding, but if we get that many, something's wrong. - throw FatalError("too many padding bytes!"); - } - - Sections[SectionsRead].Type = marker; - - // Read the length of the section. - lh = (uchar) infile.getch(); - ll = (uchar) infile.getch(); - - itemlen = (lh << 8) | ll; - - if (itemlen < 2) { - throw FatalError("invalid marker"); - } - - Sections[SectionsRead].Size = itemlen; - - Data = (uchar *)malloc(itemlen+1); // Add 1 to allow sticking a 0 at the end. - Sections[SectionsRead].Data = Data; - - // Store first two pre-read bytes. - Data[0] = (uchar)lh; - Data[1] = (uchar)ll; - - got = infile.readBlock((char*)Data+2, itemlen-2); // Read the whole section. - if (( unsigned ) got != itemlen-2){ - throw FatalError("reading from file"); - } - SectionsRead++; - - switch(marker){ - - case M_SOS: // stop before hitting compressed data - // If reading entire image is requested, read the rest of the data. - if (ReadMode & READ_IMAGE){ - unsigned long size; - - size = kMax( 0ul, (unsigned long)(infile.size()-infile.at()) ); - Data = (uchar *)malloc(size); - if (Data == NULL){ - throw FatalError("could not allocate data for entire image"); - } - - got = infile.readBlock((char*)Data, size); - if (( unsigned ) got != size){ - throw FatalError("could not read the rest of the image"); - } - - Sections[SectionsRead].Data = Data; - Sections[SectionsRead].Size = size; - Sections[SectionsRead].Type = PSEUDO_IMAGE_MARKER; - SectionsRead ++; - //HaveAll = 1; - } - return true; - - case M_EOI: // in case it's a tables-only JPEG stream - kdDebug(7034) << "No image in jpeg!\n"; - return false; - - case M_COM: // Comment section - // pieczy 2002-02-12 - // now the User comment goes to UserComment - // so we can store a Comment section also in READ_EXIF mode - process_COM(Data, itemlen); - break; - - case M_JFIF: - // Regular jpegs always have this tag, exif images have the exif - // marker instead, althogh ACDsee will write images with both markers. - // this program will re-create this marker on absence of exif marker. - // hence no need to keep the copy from the file. - free(Sections[--SectionsRead].Data); - break; - - case M_EXIF: - // Seen files from some 'U-lead' software with Vivitar scanner - // that uses marker 31 for non exif stuff. Thus make sure - // it says 'Exif' in the section before treating it as exif. - if ((ReadMode & READ_EXIF) && memcmp(Data+2, "Exif", 4) == 0){ - process_EXIF((uchar *)Data, itemlen); // FIXME: This call - // requires Data to be array of at least 8 bytes. Code - // above only checks for itemlen < 2. - }else{ - // Discard this section. - free(Sections[--SectionsRead].Data); - } - break; - - case M_SOF0: - case M_SOF1: - case M_SOF2: - case M_SOF3: - case M_SOF5: - case M_SOF6: - case M_SOF7: - case M_SOF9: - case M_SOF10: - case M_SOF11: - case M_SOF13: - case M_SOF14: - case M_SOF15: - process_SOFn(Data, marker); //FIXME: This call requires Data to - // be array of at least 8 bytes. Code above only checks for - // itemlen < 2. - break; - default: - break; - } - } - return true; -} - - -//-------------------------------------------------------------------------- -// Discard read data. -//-------------------------------------------------------------------------- -void ExifData::DiscardData(void) -{ - for (int a=0; a < SectionsRead; a++) - free(Sections[a].Data); - SectionsRead = 0; -} - -//-------------------------------------------------------------------------- -// Convert a 16 bit unsigned value from file's native byte order -//-------------------------------------------------------------------------- -int ExifData::Get16u(void * Short) -{ - if (MotorolaOrder){ - return (((uchar *)Short)[0] << 8) | ((uchar *)Short)[1]; - }else{ - return (((uchar *)Short)[1] << 8) | ((uchar *)Short)[0]; - } -} - -//-------------------------------------------------------------------------- -// Convert a 32 bit signed value from file's native byte order -//-------------------------------------------------------------------------- -int ExifData::Get32s(void * Long) -{ - if (MotorolaOrder){ - return ((( char *)Long)[0] << 24) | (((uchar *)Long)[1] << 16) - | (((uchar *)Long)[2] << 8 ) | (((uchar *)Long)[3] << 0 ); - }else{ - return ((( char *)Long)[3] << 24) | (((uchar *)Long)[2] << 16) - | (((uchar *)Long)[1] << 8 ) | (((uchar *)Long)[0] << 0 ); - } -} - -//-------------------------------------------------------------------------- -// Convert a 32 bit unsigned value from file's native byte order -//-------------------------------------------------------------------------- -unsigned ExifData::Get32u(void * Long) -{ - return (unsigned)Get32s(Long) & 0xffffffff; -} - -//-------------------------------------------------------------------------- -// Evaluate number, be it int, rational, or float from directory. -//-------------------------------------------------------------------------- -double ExifData::ConvertAnyFormat(void * ValuePtr, int Format) -{ - double Value; - Value = 0; - - switch(Format){ - case FMT_SBYTE: Value = *(signed char *)ValuePtr; break; - case FMT_BYTE: Value = *(uchar *)ValuePtr; break; - - case FMT_USHORT: Value = Get16u(ValuePtr); break; - - case FMT_ULONG: Value = Get32u(ValuePtr); break; - - case FMT_URATIONAL: - case FMT_SRATIONAL: - { - int Num,Den; - Num = Get32s(ValuePtr); - Den = Get32s(4+(char *)ValuePtr); - if (Den == 0){ - Value = 0; - }else{ - Value = (double)Num/Den; - } - break; - } - - case FMT_SSHORT: Value = (signed short)Get16u(ValuePtr); break; - case FMT_SLONG: Value = Get32s(ValuePtr); break; - - // Not sure if this is correct (never seen float used in Exif format) - case FMT_SINGLE: Value = (double)*(float *)ValuePtr; break; - case FMT_DOUBLE: Value = *(double *)ValuePtr; break; - } - return Value; -} - -//-------------------------------------------------------------------------- -// Process one of the nested EXIF directories. -//-------------------------------------------------------------------------- -void ExifData::ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBase, unsigned ExifLength, unsigned NestingLevel) -{ - int de; - int a; - int NumDirEntries; - unsigned ThumbnailOffset = 0; - unsigned ThumbnailSize = 0; - - if ( NestingLevel > 4) - throw FatalError("Maximum directory nesting exceeded (corrupt exif header)"); - - NumDirEntries = Get16u(DirStart); - #define DIR_ENTRY_ADDR(Start, Entry) (Start+2+12*(Entry)) - - { - unsigned char * DirEnd; - DirEnd = DIR_ENTRY_ADDR(DirStart, NumDirEntries); - if (DirEnd+4 > (OffsetBase+ExifLength)){ - if (DirEnd+2 == OffsetBase+ExifLength || DirEnd == OffsetBase+ExifLength){ - // Version 1.3 of jhead would truncate a bit too much. - // This also caught later on as well. - }else{ - // Note: Files that had thumbnails trimmed with jhead 1.3 or earlier - // might trigger this. - throw FatalError("Illegally sized directory"); - } - } - if (DirEnd < LastExifRefd) LastExifRefd = DirEnd; - } - - for (de=0;de= NUM_FORMATS) { - // (-1) catches illegal zero case as unsigned underflows to positive large. - throw FatalError("Illegal format code in EXIF dir"); - } - - if ((unsigned)Components > 0x10000) { - throw FatalError("Illegal number of components for tag"); - continue; - } - - ByteCount = Components * BytesPerFormat[Format]; - - if (ByteCount > 4){ - unsigned OffsetVal; - OffsetVal = Get32u(DirEntry+8); - // If its bigger than 4 bytes, the dir entry contains an offset. - if (OffsetVal+ByteCount > ExifLength){ - // Bogus pointer offset and / or bytecount value - //printf("Offset %d bytes %d ExifLen %d\n",OffsetVal, ByteCount, ExifLength); - - throw FatalError("Illegal pointer offset value in EXIF"); - } - ValuePtr = OffsetBase+OffsetVal; - }else{ - // 4 bytes or less and value is in the dir entry itself - ValuePtr = (unsigned char *)DirEntry+8; - } - - if (LastExifRefd < ValuePtr+ByteCount){ - // Keep track of last byte in the exif header that was actually referenced. - // That way, we know where the discardable thumbnail data begins. - LastExifRefd = ValuePtr+ByteCount; - } - - // Extract useful components of tag - switch(Tag){ - - case TAG_MAKE: - ExifData::CameraMake = TQString::fromLatin1((const char*)ValuePtr, 31); - break; - - case TAG_MODEL: - ExifData::CameraModel = TQString::fromLatin1((const char*)ValuePtr, 39); - break; - - case TAG_ORIENTATION: - Orientation = (int)ConvertAnyFormat(ValuePtr, Format); - break; - - case TAG_DATETIME_ORIGINAL: - DateTime = TQString::fromLatin1((const char*)ValuePtr, 19); - break; - - case TAG_USERCOMMENT: - // Olympus has this padded with trailing spaces. Remove these first. - for (a=ByteCount;;){ - a--; - if ((ValuePtr)[a] == ' '){ - (ValuePtr)[a] = '\0'; - }else{ - break; - } - if (a == 0) break; - } - - // Copy the comment - if (memcmp(ValuePtr, "ASCII",5) == 0){ - for (a=5;a<10;a++){ - int c; - c = (ValuePtr)[a]; - if (c != '\0' && c != ' '){ - UserComment = TQString::fromLatin1((const char*)(a+ValuePtr), 199); - break; - } - } - }else{ - UserComment = TQString::fromLatin1((const char*)ValuePtr, 199); - } - break; - - case TAG_FNUMBER: - // Simplest way of expressing aperture, so I trust it the most. - // (overwrite previously computd value if there is one) - ExifData::ApertureFNumber = (float)ConvertAnyFormat(ValuePtr, Format); - break; - - case TAG_APERTURE: - case TAG_MAXAPERTURE: - // More relevant info always comes earlier, so only use this field if we don't - // have appropriate aperture information yet. - if (ExifData::ApertureFNumber == 0){ - ExifData::ApertureFNumber - = (float)exp(ConvertAnyFormat(ValuePtr, Format)*log(2.0)*0.5); - } - break; - - case TAG_FOCALLENGTH: - // Nice digital cameras actually save the focal length as a function - // of how far they are zoomed in. - ExifData::FocalLength = (float)ConvertAnyFormat(ValuePtr, Format); - break; - - case TAG_SUBJECT_DISTANCE: - // Inidcates the distacne the autofocus camera is focused to. - // Tends to be less accurate as distance increases. - ExifData::Distance = (float)ConvertAnyFormat(ValuePtr, Format); - break; - - case TAG_EXPOSURETIME: - // Simplest way of expressing exposure time, so I trust it most. - // (overwrite previously computd value if there is one) - ExifData::ExposureTime = (float)ConvertAnyFormat(ValuePtr, Format); - break; - - case TAG_SHUTTERSPEED: - // More complicated way of expressing exposure time, so only use - // this value if we don't already have it from somewhere else. - if (ExifData::ExposureTime == 0){ - ExifData::ExposureTime - = (float)(1/exp(ConvertAnyFormat(ValuePtr, Format)*log(2.0))); - } - break; - - case TAG_FLASH: - ExifData::FlashUsed = (int)ConvertAnyFormat(ValuePtr, Format); - break; - - case TAG_EXIF_IMAGELENGTH: - ExifImageLength = (int)ConvertAnyFormat(ValuePtr, Format); - break; - - case TAG_EXIF_IMAGEWIDTH: - ExifImageWidth = (int)ConvertAnyFormat(ValuePtr, Format); - break; - - case TAG_FOCALPLANEXRES: - FocalplaneXRes = ConvertAnyFormat(ValuePtr, Format); - break; - - case TAG_FOCALPLANEUNITS: - switch((int)ConvertAnyFormat(ValuePtr, Format)){ - case 1: FocalplaneUnits = 25.4; break; // inch - case 2: - // According to the information I was using, 2 means meters. - // But looking at the Cannon powershot's files, inches is the only - // sensible value. - FocalplaneUnits = 25.4; - break; - - case 3: FocalplaneUnits = 10; break; // centimeter - case 4: FocalplaneUnits = 1; break; // milimeter - case 5: FocalplaneUnits = .001; break; // micrometer - } - break; - - // Remaining cases contributed by: Volker C. Schoech (schoech@gmx.de) - - case TAG_EXPOSURE_BIAS: - ExifData::ExposureBias = (float)ConvertAnyFormat(ValuePtr, Format); - break; - - case TAG_WHITEBALANCE: - ExifData::Whitebalance = (int)ConvertAnyFormat(ValuePtr, Format); - break; - - case TAG_METERING_MODE: - ExifData::MeteringMode = (int)ConvertAnyFormat(ValuePtr, Format); - break; - - case TAG_EXPOSURE_PROGRAM: - ExifData::ExposureProgram = (int)ConvertAnyFormat(ValuePtr, Format); - break; - - case TAG_ISO_EQUIVALENT: - ExifData::ISOequivalent = (int)ConvertAnyFormat(ValuePtr, Format); - if ( ExifData::ISOequivalent < 50 ) ExifData::ISOequivalent *= 200; - break; - - case TAG_COMPRESSION_LEVEL: - ExifData::CompressionLevel = (int)ConvertAnyFormat(ValuePtr, Format); - break; - - case TAG_THUMBNAIL_OFFSET: - ThumbnailOffset = (unsigned)ConvertAnyFormat(ValuePtr, Format); - break; - - case TAG_THUMBNAIL_LENGTH: - ThumbnailSize = (unsigned)ConvertAnyFormat(ValuePtr, Format); - break; - - } - - if (Tag == TAG_EXIF_OFFSET || Tag == TAG_INTEROP_OFFSET){ - unsigned char * SubdirStart; - SubdirStart = OffsetBase + Get32u(ValuePtr); - if (SubdirStart <= OffsetBase || SubdirStart >= OffsetBase+ExifLength){ - throw FatalError("Illegal subdirectory link"); - } - ProcessExifDir(SubdirStart, OffsetBase, ExifLength, NestingLevel+1); - continue; - } - } - - { - // In addition to linking to subdirectories via exif tags, - // there's also a potential link to another directory at the end of each - // directory. this has got to be the result of a comitee! - unsigned char * SubdirStart; - unsigned Offset; - - if (DIR_ENTRY_ADDR(DirStart, NumDirEntries) + 4 <= OffsetBase+ExifLength){ - Offset = Get32u(DIR_ENTRY_ADDR(DirStart, NumDirEntries)); - // There is at least one jpeg from an HP camera having an Offset of almost MAXUINT. - // Adding OffsetBase to it produces an overflow, so compare with ExifLength here. - // See http://bugs.kde.org/show_bug.cgi?id=54542 - if (Offset && Offset < ExifLength){ - SubdirStart = OffsetBase + Offset; - if (SubdirStart > OffsetBase+ExifLength){ - if (SubdirStart < OffsetBase+ExifLength+20){ - // Jhead 1.3 or earlier would crop the whole directory! - // As Jhead produces this form of format incorrectness, - // I'll just let it pass silently - kdDebug(7034) << "Thumbnail removed with Jhead 1.3 or earlier\n"; - }else{ - throw FatalError("Illegal subdirectory link 2"); - } - }else{ - if (SubdirStart <= OffsetBase+ExifLength){ - ProcessExifDir(SubdirStart, OffsetBase, ExifLength, NestingLevel+1); - } - } - } - }else{ - // The exif header ends before the last next directory pointer. - } - } - - if (ThumbnailSize && ThumbnailOffset){ - if (ThumbnailSize + ThumbnailOffset < ExifLength){ - // The thumbnail pointer appears to be valid. Store it. - Thumbnail.loadFromData(OffsetBase + ThumbnailOffset, ThumbnailSize, "JPEG"); - } - } -} - -//-------------------------------------------------------------------------- -// Process a COM marker. We want to leave the bytes unchanged. The -// progam that displays this text may decide to remove blanks, convert -// newlines, or otherwise modify the text. In particular we want to be -// safe for passing utf-8 text. -//-------------------------------------------------------------------------- -void ExifData::process_COM (const uchar * Data, int length) -{ - Comment = TQString::fromUtf8((char *)Data+2, (length-2)); -} - - -//-------------------------------------------------------------------------- -// Process a SOFn marker. This is useful for the image dimensions -//-------------------------------------------------------------------------- -void ExifData::process_SOFn (const uchar * Data, int marker) -{ - int data_precision, num_components; - - data_precision = Data[2]; - ExifData::Height = Get16m(Data+3); - ExifData::Width = Get16m(Data+5); - num_components = Data[7]; - - if (num_components == 3){ - ExifData::IsColor = 1; - }else{ - ExifData::IsColor = 0; - } - - ExifData::Process = marker; - -} - -//-------------------------------------------------------------------------- -// Get 16 bits motorola order (always) for jpeg header stuff. -//-------------------------------------------------------------------------- -int ExifData::Get16m(const void * Short) -{ - return (((uchar *)Short)[0] << 8) | ((uchar *)Short)[1]; -} - - -//-------------------------------------------------------------------------- -// Process a EXIF marker -// Describes all the drivel that most digital cameras include... -//-------------------------------------------------------------------------- -void ExifData::process_EXIF(unsigned char * CharBuf, unsigned int length) -{ - ExifData::FlashUsed = 0; // If it s from a digicam, and it used flash, it says so. - - FocalplaneXRes = 0; - FocalplaneUnits = 0; - ExifImageWidth = 0; - ExifImageLength = 0; - - { // Check the EXIF header component - static const uchar ExifHeader[] = "Exif\0\0"; - if (memcmp(CharBuf+2, ExifHeader,6)){ - throw FatalError("Incorrect Exif header"); - } - } - - if (memcmp(CharBuf+8,"II",2) == 0){ - // printf("Exif section in Intel order\n"); - MotorolaOrder = 0; - }else{ - if (memcmp(CharBuf+8,"MM",2) == 0){ - // printf("Exif section in Motorola order\n"); - MotorolaOrder = 1; - }else{ - throw FatalError("Invalid Exif alignment marker."); - } - } - - // Check the next two values for correctness. - if (Get16u(CharBuf+10) != 0x2a){ - throw FatalError("Invalid Exif start (1)"); - } - - long IFDoffset = Get32u(CharBuf+12); - - LastExifRefd = CharBuf; - - // First directory starts 16 bytes in. Offsets start at 8 bytes in. - ProcessExifDir(&CharBuf[8+IFDoffset], CharBuf+8, length-6, 0); - - // This is how far the interesting (non thumbnail) part of the exif went. - ExifSettingsLength = LastExifRefd - CharBuf; - - // Compute the CCD width, in milimeters. - if (FocalplaneXRes != 0){ - kdDebug(7034) << "ExifImageWidth " << ExifImageWidth << " FocalplaneUnits " << FocalplaneUnits << " FocalplaneXRes " << FocalplaneXRes << endl; - ExifData::CCDWidth = (float)(ExifImageWidth * FocalplaneUnits / FocalplaneXRes); - } -} - -//-------------------------------------------------------------------------- -// Convert exif time to Unix time structure -//-------------------------------------------------------------------------- -int ExifData::Exif2tm(struct tm * timeptr, char * ExifTime) -{ - int a; - - timeptr->tm_wday = -1; - - // Check for format: YYYY:MM:DD HH:MM:SS format. - a = sscanf(ExifTime, "%d:%d:%d %d:%d:%d", - &timeptr->tm_year, &timeptr->tm_mon, &timeptr->tm_mday, - &timeptr->tm_hour, &timeptr->tm_min, &timeptr->tm_sec); - - if (a == 6){ - timeptr->tm_isdst = -1; - timeptr->tm_mon -= 1; // Adjust for unix zero-based months - timeptr->tm_year -= 1900; // Adjust for year starting at 1900 - return true; // worked. - } - - return false; // Wasn't in Exif date format. -} - -//-------------------------------------------------------------------------- -// Contructor for initialising -//-------------------------------------------------------------------------- -ExifData::ExifData() -{ - ExifData::Whitebalance = -1; - ExifData::MeteringMode = -1; - ExifData::FlashUsed = 0; - Orientation = 0; - Height = 0; - Width = 0; - IsColor = 0; - Process = 0; - FocalLength = 0; - ExposureTime = 0; - ApertureFNumber = 0; - Distance = 0; - CCDWidth = 0; - ExposureBias = 0; - ExposureProgram = 0; - ISOequivalent = 0; - CompressionLevel = 0; -} - -//-------------------------------------------------------------------------- -// process a EXIF jpeg file -//-------------------------------------------------------------------------- -bool ExifData::scan(const TQString & path) -{ - int ret; - - TQFile f(path); - if ( !f.open(IO_ReadOnly) ) - return false; - - try { - // Scan the JPEG headers. - ret = ReadJpegSections(f, READ_EXIF); - } - catch (FatalError& e) { - e.debug_print(); - f.close(); - return false; - } - - if (ret == false){ - kdDebug(7034) << "Not JPEG file!\n"; - DiscardData(); - f.close(); - return false; - } - f.close(); - DiscardData(); - - //now make the strings clean, - // for exmaple my Casio is a "QV-4000 " - CameraMake = CameraMake.stripWhiteSpace(); - CameraModel = CameraModel.stripWhiteSpace(); - UserComment = UserComment.stripWhiteSpace(); - Comment = Comment.stripWhiteSpace(); - return true; -} - -//-------------------------------------------------------------------------- -// Does the embedded thumbnail match the jpeg image? -//-------------------------------------------------------------------------- -#ifndef JPEG_TOL -#define JPEG_TOL 0.02 -#endif -bool ExifData::isThumbnailSane() { - if (Thumbnail.isNull()) return false; - - // check whether thumbnail dimensions match the image - // not foolproof, but catches some altered images (jpegtran -rotate) - if (ExifImageLength != 0 && ExifImageLength != Height) return false; - if (ExifImageWidth != 0 && ExifImageWidth != Width) return false; - if (Thumbnail.width() == 0 || Thumbnail.height() == 0) return false; - if (Height == 0 || Width == 0) return false; - double d = (double)Height/Width*Thumbnail.width()/Thumbnail.height(); - return (1-JPEG_TOL < d) && (d < 1+JPEG_TOL); -} - - -//-------------------------------------------------------------------------- -// return a thumbnail that respects the orientation flag -// only if it seems sane -//-------------------------------------------------------------------------- -TQImage ExifData::getThumbnail() { - if (!isThumbnailSane()) return NULL; - if (!Orientation || Orientation == 1) return Thumbnail; - - // now fix orientation - TQWMatrix M; - TQWMatrix flip= TQWMatrix(-1,0,0,1,0,0); - switch (Orientation) { // notice intentional fallthroughs - case 2: M = flip; break; - case 4: M = flip; - case 3: M.rotate(180); break; - case 5: M = flip; - case 6: M.rotate(90); break; - case 7: M = flip; - case 8: M.rotate(270); break; - default: break; // should never happen - } - return Thumbnail.xForm(M); -} diff --git a/kfile-plugins/jpeg/exif.h b/kfile-plugins/jpeg/exif.h deleted file mode 100644 index f8eb13ef..00000000 --- a/kfile-plugins/jpeg/exif.h +++ /dev/null @@ -1,127 +0,0 @@ -#ifndef __EXIF_H__ -#define __EXIF_H__ - -/** - exif.h -*/ - -#include -#include -#include -#include - -#include "tqstring.h" -#include "tqfile.h" -#include "tqimage.h" -#include - -typedef enum { - READ_EXIF = 1, - READ_IMAGE = 2, - READ_ALL = 3 -}ReadMode_t; - -//-------------------------------------------------------------------------- -// This structure is used to store jpeg file sections in memory. -typedef struct { - uchar * Data; - int Type; - unsigned Size; -}Section_t; - -typedef unsigned char uchar; - -typedef struct { - unsigned short Tag; - const char*const Desc; -}TagTable_t; - -#define MAX_SECTIONS 20 -#define PSEUDO_IMAGE_MARKER 0x123; // Extra value. - -class ExifData { - Section_t Sections[MAX_SECTIONS]; - - TQString CameraMake; - TQString CameraModel; - TQString DateTime; - int Orientation; - int Height, Width; - int ExifImageLength, ExifImageWidth; - int IsColor; - int Process; - int FlashUsed; - float FocalLength; - float ExposureTime; - float ApertureFNumber; - float Distance; - int Whitebalance; - int MeteringMode; - float CCDWidth; - float ExposureBias; - int ExposureProgram; - int ISOequivalent; - int CompressionLevel; - TQString UserComment; - TQString Comment; - TQImage Thumbnail; - - int ReadJpegSections (TQFile & infile, ReadMode_t ReadMode); - void DiscardData(void); - int Get16u(void * Short); - int Get32s(void * Long); - unsigned Get32u(void * Long); - double ConvertAnyFormat(void * ValuePtr, int Format); - void ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBase, unsigned ExifLength, - unsigned NestingLevel); - void process_COM (const uchar * Data, int length); - void process_SOFn (const uchar * Data, int marker); - int Get16m(const void * Short); - void process_EXIF(unsigned char * CharBuf, unsigned int length); - int Exif2tm(struct tm * timeptr, char * ExifTime); - -public: - ExifData(); - bool scan(const TQString &); - TQString getCameraMake() { return CameraMake; } - TQString getCameraModel() { return CameraModel; } - TQString getDateTime() { return DateTime; } - int getOrientation() { return Orientation; } - int getHeight() { return Height; } - int getWidth() { return Width; } - int getIsColor() { return IsColor; } - int getProcess() { return Process; } - int getFlashUsed() { return FlashUsed; } - float getFocalLength() { return FocalLength; } - float getExposureTime() { return ExposureTime; } - float getApertureFNumber() { return ApertureFNumber; } - float getDistance() { return Distance; } - int getWhitebalance() { return Whitebalance; } - int getMeteringMode() { return MeteringMode; } - float getCCDWidth() { return CCDWidth; } - float getExposureBias() { return ExposureBias; } - int getExposureProgram() { return ExposureProgram; } - int getISOequivalent() { return ISOequivalent; } - int getCompressionLevel() { return CompressionLevel; } - TQString getUserComment() { return UserComment; } - TQString getComment() { return Comment; } - TQImage getThumbnail(); - bool isThumbnailSane(); - bool isNullThumbnail() { return !isThumbnailSane(); } -}; - -class FatalError { - const char* ex; -public: - FatalError(const char* s) { ex = s; } - void debug_print() const { kdDebug(7034) << "exception: " << ex << endl; } -}; - -extern TagTable_t ProcessTable[]; - -//-------------------------------------------------------------------------- -// Define comment writing code, impelemented in setcomment.c -extern int safe_copy_and_modify( const char * original_filename, const char * comment ); - -#endif - diff --git a/kfile-plugins/jpeg/kfile_jpeg.cpp b/kfile-plugins/jpeg/kfile_jpeg.cpp deleted file mode 100644 index 6f187c8e..00000000 --- a/kfile-plugins/jpeg/kfile_jpeg.cpp +++ /dev/null @@ -1,531 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Frank Pieczynski , - * 2002 Carsten Pfeiffer - * based on the jhead tool of Matthias Wandel (see below) - * - * 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 -#include "kfile_jpeg.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "exif.h" - -#define EXIFGROUP "Jpeg EXIF Data" - -typedef KGenericFactory JpegFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_jpeg, JpegFactory("kfile_jpeg")) - -KJpegPlugin::KJpegPlugin(TQObject *parent, const char *name, - const TQStringList &args ) - : KFilePlugin(parent, name, args) -{ - kdDebug(7034) << "jpeg plugin\n"; - - // - // define all possible meta info items - // - KFileMimeTypeInfo *info = addMimeTypeInfo("image/jpeg"); - KFileMimeTypeInfo::GroupInfo *exifGroup = addGroupInfo( info, EXIFGROUP, - i18n("JPEG Exif") ); - KFileMimeTypeInfo::ItemInfo* item; - - item = addItemInfo( exifGroup, "Comment", i18n("Comment"), TQVariant::String); - setAttributes( item, - KFileMimeTypeInfo::Modifiable | - KFileMimeTypeInfo::Addable | - KFileMimeTypeInfo::MultiLine ); - - item = addItemInfo( exifGroup, "Manufacturer", i18n("Camera Manufacturer"), - TQVariant::String ); - - item = addItemInfo( exifGroup, "Model", i18n("Camera Model"), - TQVariant::String ); - - item = addItemInfo( exifGroup, "Date/time", i18n("Date/Time"), - TQVariant::DateTime ); - - item = addItemInfo( exifGroup, "CreationDate", i18n("Creation Date"), - TQVariant::Date ); - - item = addItemInfo( exifGroup, "CreationTime", i18n("Creation Time"), - TQVariant::Time ); - - item = addItemInfo( exifGroup, "Dimensions", i18n("Dimensions"), - TQVariant::Size ); - setHint( item, KFileMimeTypeInfo::Size ); - setUnit( item, KFileMimeTypeInfo::Pixels ); - - item = addItemInfo( exifGroup, "Orientation", i18n("Orientation"), - TQVariant::Int ); - - item = addItemInfo( exifGroup, "ColorMode", i18n("Color Mode"), - TQVariant::String ); - - item = addItemInfo( exifGroup, "Flash used", i18n("Flash Used"), - TQVariant::String ); - item = addItemInfo( exifGroup, "Focal length", i18n("Focal Length"), - TQVariant::String ); - setUnit( item, KFileMimeTypeInfo::Millimeters ); - - item = addItemInfo( exifGroup, "35mm equivalent", i18n("35mm Equivalent"), - TQVariant::Int ); - setUnit( item, KFileMimeTypeInfo::Millimeters ); - - item = addItemInfo( exifGroup, "CCD width", i18n("CCD Width"), - TQVariant::String ); - setUnit( item, KFileMimeTypeInfo::Millimeters ); - - item = addItemInfo( exifGroup, "Exposure time", i18n("Exposure Time"), - TQVariant::String ); - setHint( item, KFileMimeTypeInfo::Seconds ); - - item = addItemInfo( exifGroup, "Aperture", i18n("Aperture"), - TQVariant::String ); - - item = addItemInfo( exifGroup, "Focus dist.", i18n("Focus Dist."), - TQVariant::String ); - - item = addItemInfo( exifGroup, "Exposure bias", i18n("Exposure Bias"), - TQVariant::String ); - - item = addItemInfo( exifGroup, "Whitebalance", i18n("Whitebalance"), - TQVariant::String ); - - item = addItemInfo( exifGroup, "Metering mode", i18n("Metering Mode"), - TQVariant::String ); - - item = addItemInfo( exifGroup, "Exposure", i18n("Exposure"), - TQVariant::String ); - - item = addItemInfo( exifGroup, "ISO equiv.", i18n("ISO Equiv."), - TQVariant::String ); - - item = addItemInfo( exifGroup, "JPEG quality", i18n("JPEG Quality"), - TQVariant::String ); - - item = addItemInfo( exifGroup, "User comment", i18n("User Comment"), - TQVariant::String ); - setHint(item, KFileMimeTypeInfo::Description); - - item = addItemInfo( exifGroup, "JPEG process", i18n("JPEG Process"), - TQVariant::String ); - - item = addItemInfo( exifGroup, "Thumbnail", i18n("Thumbnail"), - TQVariant::Image ); - setHint( item, KFileMimeTypeInfo::Thumbnail ); - -// ### -// exifGroup.setSupportsVariableKeys(true); -} - -TQValidator* KJpegPlugin::createValidator(const KFileMetaInfoItem& /*item*/, - TQObject */*parent*/, - const char */*name*/ ) const -{ - // no need to return a validator that validates everything as OK :) -// if (item.isEditable()) -// return new TQRegExpValidator(TQRegExp(".*"), parent, name); -// else - return 0L; -} - -bool KJpegPlugin::writeInfo( const KFileMetaInfo& info ) const -{ - TQString comment = info[EXIFGROUP].value("Comment").toString(); - TQString path = info.path(); - - kdDebug(7034) << "exif writeInfo: " << info.path() << " \"" << comment << "\"\n"; - - /* - Do a strictly safe insertion of the comment: - - Scan original to verify it's a proper jpeg - Open a unique temporary file in this directory - Write temporary, replacing all COM blocks with this one. - Scan temporary, to verify it's a proper jpeg - Rename original to another unique name - Rename temporary to original - Unlink original - */ - /* - The jpeg standard does not regulate the contents of the COM block. - I'm assuming the best thing to do here is write as unicode utf-8, - which is fully backwards compatible with readers expecting ascii. - Readers expecting a national character set are out of luck... - */ - if( safe_copy_and_modify( TQFile::encodeName( path ), comment.utf8() ) ) { - return false; - } - return true; -} - -bool KJpegPlugin::readInfo( KFileMetaInfo& info, uint what ) -{ - const TQString path( info.path() ); - if ( path.isEmpty() ) // remote file - return false; - - TQString tag; - ExifData ImageInfo; - - // parse the jpeg file now - try { - if ( !ImageInfo.scan(info.path()) ) { - kdDebug(7034) << "Not a JPEG file!\n"; - return false; - } - } - catch (FatalError& e) { // malformed exif data? - kdDebug(7034) << "Exception caught while parsing Exif data of: " << info.path() << endl; - e.debug_print(); - return false; - } - - KFileMetaInfoGroup exifGroup = appendGroup( info, EXIFGROUP ); - - tag = ImageInfo.getComment(); - if ( tag.length() ) { - kdDebug(7034) << "exif inserting Comment: " << tag << "\n"; - appendItem( exifGroup, "Comment", tag ); - } else { - appendItem( exifGroup, "Comment", tag ); // So user can add new comment - } - - tag = ImageInfo.getCameraMake(); - if (tag.length()) - appendItem( exifGroup, "Manufacturer", tag ); - - tag = ImageInfo.getCameraModel(); - if (tag.length()) - appendItem( exifGroup, "Model", tag ); - - tag = ImageInfo.getDateTime(); - if (tag.length()){ - TQDateTime dt = parseDateTime( tag.stripWhiteSpace() ); - if ( dt.isValid() ) { - appendItem( exifGroup, "Date/time", dt ); - appendItem( exifGroup, "CreationDate", dt.date() ); - appendItem( exifGroup, "CreationTime", dt.time() ); - } - } - - appendItem( exifGroup,"Dimensions", TQSize( ImageInfo.getWidth(), - ImageInfo.getHeight() ) ); - - if ( ImageInfo.getOrientation() ) - appendItem( exifGroup, "Orientation", ImageInfo.getOrientation() ); - - appendItem( exifGroup, "ColorMode", ImageInfo.getIsColor() ? - i18n("Color") : i18n("Black and white") ); - - int flashUsed = ImageInfo.getFlashUsed(); // -1, - if ( flashUsed >= 0 ) { - TQString flash = i18n("Flash", "(unknown)"); - switch ( flashUsed ) { - case 0: flash = i18n("Flash", "No"); - break; - case 1: - case 5: - case 7: - flash = i18n("Flash", "Fired"); - break; - case 9: - case 13: - case 15: - flash = i18n( "Flash", "Fill Fired" ); - break; - case 16: - flash = i18n( "Flash", "Off" ); - break; - case 24: - flash = i18n( "Flash", "Auto Off" ); - break; - case 25: - case 29: - case 31: - flash = i18n( "Flash", "Auto Fired" ); - break; - case 32: - flash = i18n( "Flash", "Not Available" ); - break; - default: - break; - } - appendItem( exifGroup, "Flash used", - flash ); - } - - if (ImageInfo.getFocalLength()){ - appendItem( exifGroup, "Focal length", - TQString(TQString().sprintf("%4.1f", ImageInfo.getFocalLength()) )); - - if (ImageInfo.getCCDWidth()){ - appendItem( exifGroup, "35mm equivalent", - (int)(ImageInfo.getFocalLength()/ImageInfo.getCCDWidth()*35 + 0.5) ); - } - } - - if (ImageInfo.getCCDWidth()){ - appendItem( exifGroup, "CCD width", - TQString(TQString().sprintf("%4.2f", ImageInfo.getCCDWidth()) )); - } - - if (ImageInfo.getExposureTime()){ - tag=TQString().sprintf("%6.3f", ImageInfo.getExposureTime()); - float exposureTime = ImageInfo.getExposureTime(); - if (exposureTime > 0 && exposureTime <= 0.5){ - tag+=TQString().sprintf(" (1/%d)", (int)(0.5 + 1/exposureTime) ); - } - appendItem( exifGroup, "Exposure time", tag ); - } - - if (ImageInfo.getApertureFNumber()){ - appendItem( exifGroup, "Aperture", - TQString(TQString().sprintf("f/%3.1f", - (double)ImageInfo.getApertureFNumber()))); - } - - if (ImageInfo.getDistance()){ - if (ImageInfo.getDistance() < 0){ - tag=i18n("Infinite"); - }else{ - tag=TQString().sprintf("%5.2fm",(double)ImageInfo.getDistance()); - } - appendItem( exifGroup, "Focus dist.", tag ); - } - - if (ImageInfo.getExposureBias()){ - appendItem( exifGroup, "Exposure bias", - TQString(TQString().sprintf("%4.2f", - (double)ImageInfo.getExposureBias()) )); - } - - if (ImageInfo.getWhitebalance() != -1){ - switch(ImageInfo.getWhitebalance()) { - case 0: - tag=i18n("Unknown"); - break; - case 1: - tag=i18n("Daylight"); - break; - case 2: - tag=i18n("Fluorescent"); - break; - case 3: - //tag=i18n("incandescent"); - tag=i18n("Tungsten"); - break; - case 17: - tag=i18n("Standard light A"); - break; - case 18: - tag=i18n("Standard light B"); - break; - case 19: - tag=i18n("Standard light C"); - break; - case 20: - tag=i18n("D55"); - break; - case 21: - tag=i18n("D65"); - break; - case 22: - tag=i18n("D75"); - break; - case 255: - tag=i18n("Other"); - break; - default: - //23 to 254 = reserved - tag=i18n("Unknown"); - } - appendItem( exifGroup, "Whitebalance", tag ); - } - - if (ImageInfo.getMeteringMode() != -1){ - switch(ImageInfo.getMeteringMode()) { - case 0: - tag=i18n("Unknown"); - break; - case 1: - tag=i18n("Average"); - break; - case 2: - tag=i18n("Center weighted average"); - break; - case 3: - tag=i18n("Spot"); - break; - case 4: - tag=i18n("MultiSpot"); - break; - case 5: - tag=i18n("Pattern"); - break; - case 6: - tag=i18n("Partial"); - break; - case 255: - tag=i18n("Other"); - break; - default: - // 7 to 254 = reserved - tag=i18n("Unknown"); - } - appendItem( exifGroup, "Metering mode", tag ); - } - - if (ImageInfo.getExposureProgram()){ - switch(ImageInfo.getExposureProgram()) { - case 0: - tag=i18n("Not defined"); - break; - case 1: - tag=i18n("Manual"); - break; - case 2: - tag=i18n("Normal program"); - break; - case 3: - tag=i18n("Aperture priority"); - break; - case 4: - tag=i18n("Shutter priority"); - break; - case 5: - tag=i18n("Creative program\n(biased toward fast shutter speed)"); - break; - case 6: - tag=i18n("Action program\n(biased toward fast shutter speed)"); - break; - case 7: - tag=i18n("Portrait mode\n(for closeup photos with the background out of focus)"); - break; - case 8: - tag=i18n("Landscape mode\n(for landscape photos with the background in focus)"); - break; - default: - // 9 to 255 = reserved - tag=i18n("Unknown"); - } - appendItem( exifGroup, "Exposure", tag ); - } - - if (ImageInfo.getISOequivalent()){ - appendItem( exifGroup, "ISO equiv.", - TQString(TQString().sprintf("%2d", - (int)ImageInfo.getISOequivalent()) )); - } - - if (ImageInfo.getCompressionLevel()){ - switch(ImageInfo.getCompressionLevel()) { - case 1: - tag=i18n("Basic"); - break; - case 2: - tag=i18n("Normal"); - break; - case 4: - tag=i18n("Fine"); - break; - default: - tag=i18n("Unknown"); - } - appendItem( exifGroup, "JPEG quality", tag ); - } - - tag = ImageInfo.getUserComment(); - if (tag.length()){ - appendItem( exifGroup, "EXIF comment", tag ); - } - - int a; - for (a=0;;a++){ - if (ProcessTable[a].Tag == ImageInfo.getProcess() || ProcessTable[a].Tag == 0){ - appendItem( exifGroup, "JPEG process", - TQString::fromUtf8( ProcessTable[a].Desc) ); - break; - } - } - - if ( what & KFileMetaInfo::Thumbnail && !ImageInfo.isNullThumbnail() ){ - appendItem( exifGroup, "Thumbnail", ImageInfo.getThumbnail() ); - } - - return true; -} - -// format of the string is: -// YYYY:MM:DD HH:MM:SS -TQDateTime KJpegPlugin::parseDateTime( const TQString& string ) -{ - TQDateTime dt; - if ( string.length() != 19 ) - return dt; - - TQString year = string.left( 4 ); - TQString month = string.mid( 5, 2 ); - TQString day = string.mid( 8, 2 ); - TQString hour = string.mid( 11, 2 ); - TQString minute = string.mid( 14, 2 ); - TQString seconds = string.mid( 17, 2 ); - - bool ok; - bool allOk = true; - int y = year.toInt( &ok ); - allOk &= ok; - - int mo = month.toInt( &ok ); - allOk &= ok; - - int d = day.toInt( &ok ); - allOk &= ok; - - int h = hour.toInt( &ok ); - allOk &= ok; - - int mi = minute.toInt( &ok ); - allOk &= ok; - - int s = seconds.toInt( &ok ); - allOk &= ok; - - if ( allOk ) { - dt.setDate( TQDate( y, mo, d ) ); - dt.setTime( TQTime( h, mi, s ) ); - } - - return dt; -} - -#include "kfile_jpeg.moc" diff --git a/kfile-plugins/jpeg/kfile_jpeg.desktop b/kfile-plugins/jpeg/kfile_jpeg.desktop deleted file mode 100644 index fccaaeff..00000000 --- a/kfile-plugins/jpeg/kfile_jpeg.desktop +++ /dev/null @@ -1,64 +0,0 @@ -[Desktop Entry] -Type=Service -Name=JPEG EXIF Info -Name[ar]=معلومات JPEG EXIF -Name[br]=Titouroù EXIF JPEG -Name[ca]=Informació de JPEG EXIF -Name[cs]=JPEG EXIF info -Name[cy]=Gwybodaeth JPEG EXIF -Name[da]=JPEG EXIF-info -Name[de]=JPEG EXIF-Info -Name[el]=Πληροφορίες JPEG EXIF -Name[eo]=JPEG-EXIF-informo -Name[es]=Info JPEG EXIF -Name[et]=JPEG EXIF info -Name[fa]=اطلاعات JPEG EXIF -Name[fi]=JPEG EXIF -tiedot -Name[fr]=Informations JPEG EXIF -Name[gl]=Inf. JPEG EXIF -Name[he]=מידע JPEG EXIF -Name[hi]=JPEG EXIF जानकारी -Name[hr]=JPEG EXIF Informacije -Name[hu]=JPEG EXIF-jellemzők -Name[is]=JPEG EXIF upplýsingar -Name[it]=Informazioni JPEG EXIF -Name[ja]=JPEG EXIF 情報 -Name[kk]=JPEG EXIF мәліметі -Name[km]=ព័ត៌មាន JPEG EXIF -Name[lt]=JPEG EXIF informacija -Name[ms]=Maklumat JPEG EXIF -Name[nds]=JPEG-EXIF-Info -Name[ne]=JPEG EXIF सूचना -Name[nl]=JPEG EXIF-info -Name[nn]=JPEG EXIF-info -Name[nso]=TshedimoJPEG EXIF Info -Name[pa]=JPEG EXIF ਜਾਣਕਾਰੀ -Name[pl]=Informacja o pliku JPEG EXIF -Name[pt]=Informação do JPEG EXIF -Name[pt_BR]=Informação sobre JPEG EXIF -Name[ro]=Informaţii EXIF JPEG -Name[ru]=Информация о JPEG EXIF -Name[se]=JPEG EXIF-dieđut -Name[sl]=Podatki o JPEG EXIF -Name[sr]=JPEG EXIF информације -Name[sr@Latn]=JPEG EXIF informacije -Name[sv]=JPEG EXIF-information -Name[ta]=JPEG EXIF தகவல் -Name[tg]=Иттилоот оиди JPEG EXIF -Name[th]=ข้อมูลแฟ้ม JPEG EXIF -Name[tr]=JPEG EXIF Bilgisi -Name[uk]=Інформація про JPEG EXIF -Name[uz]=JPEG EXIF haqida maʼlumot -Name[uz@cyrillic]=JPEG EXIF ҳақида маълумот -Name[ven]=Mafhungo a JPEG EXIF -Name[wa]=Informåcion sol imådje JPEG EXIF -Name[xh]=Ulwazi lwe JPEG EXIF -Name[zh_CN]=JPEG EXIF 信息 -Name[zh_HK]=JPEG EXIF 資訊 -Name[zh_TW]=JPEG EXIF 資訊 -Name[zu]=Ulwazi lwe-JPEG EXIF -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_jpeg -MimeType=image/jpeg -PreferredItems=User comment,CreationDate,CreationTime,Dimensions,Exposure time,JPEG quality,Comment -SupportsThumbnail=true diff --git a/kfile-plugins/jpeg/kfile_jpeg.h b/kfile-plugins/jpeg/kfile_jpeg.h deleted file mode 100644 index e7c821a6..00000000 --- a/kfile-plugins/jpeg/kfile_jpeg.h +++ /dev/null @@ -1,44 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Frank Pieczynski - * - * 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_JPEG_H__ -#define __KFILE_JPEG_H__ - -#include -#include - -class KJpegPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KJpegPlugin( TQObject *parent, const char *name, - const TQStringList& args ); - - virtual bool readInfo ( KFileMetaInfo& info, uint what ); - virtual bool writeInfo( const KFileMetaInfo& info ) const; - virtual TQValidator* createValidator( const KFileMetaInfoItem& item, - TQObject* parent, const char* name) const; - -private: - TQDateTime parseDateTime( const TQString& string ); -}; - -#endif diff --git a/kfile-plugins/jpeg/kfile_setcomment.cpp b/kfile-plugins/jpeg/kfile_setcomment.cpp deleted file mode 100644 index 07dca273..00000000 --- a/kfile-plugins/jpeg/kfile_setcomment.cpp +++ /dev/null @@ -1,536 +0,0 @@ -/* - * setcomment.cpp - * - * Copyright 2002 Bryce Nesbitt - * - * Based on wrjpgcom.c, Copyright (C) 1994-1997, Thomas G. Lane. - * Part of the Independent JPEG Group's software release 6b of 27-Mar-1998 - * - * This file contains a very simple stand-alone application that inserts - * user-supplied text as a COM (comment) marker in a JPEG/JFIF file. - * This may be useful as an example of the minimum logic needed to parse - * JPEG markers. - * - * There can be an arbitrary number of COM blocks in each jpeg file, with - * up to 64K of data each. We, however, write just one COM and blow away - * the rest. - * - ***************** - * - * 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. - * - */ - -#undef STANDALONE_COMPILE - -#include -#include -#include -#include -#include -#include -#include "config.h" - -extern int safe_copy_and_modify( const char * original_filename, const char * comment ); - -#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ -#define READ_BINARY "r" -#define WRITE_BINARY "w" -#else -#ifdef VMS /* VMS is very nonstandard */ -#define READ_BINARY "rb", "ctx=stm" -#define WRITE_BINARY "wb", "ctx=stm" -#else /* standard ANSI-compliant case */ -#define READ_BINARY "rb" -#define WRITE_BINARY "wb" -#endif -#endif - -#define WARNING_GARBAGE 1 /* Original file had some unspecified content */ -#define ERROR_NOT_A_JPEG 5 /* Original file not a proper jpeg (must be 1st) */ -#define ERROR_TEMP_FILE 6 /* Problem writing temporay file */ -#define ERROR_SCREWUP 7 /* Original file is now damaged. Ooops. */ -#define ERROR_PREMATURE_EOF 8 /* Unexpected end of file */ -#define ERROR_BAD_MARKER 9 /* Marker with illegal length */ -#define ERROR_MARKER_ORDER 10 /* File seems to be mixed up */ - -static int global_error; /* global error flag. Once set, we're dead. */ - -/****************************************************************************/ -/* - * These macros are used to read the input file and write the output file. - * To reuse this code in another application, you might need to change these. - */ -static FILE * infile; /* input JPEG file */ - -/* Return next input byte, or EOF if no more */ -#define NEXTBYTE() getc(infile) - -static FILE * outfile; /* output JPEG file */ - -/* Emit an output byte */ -#define PUTBYTE(x) putc((x), outfile) - - -/****************************************************************************/ -/* Read one byte, testing for EOF */ -static int -read_1_byte (void) -{ - int c; - - c = NEXTBYTE(); - if (c == EOF) { - global_error = ERROR_PREMATURE_EOF; - } - return c; -} - -/* Read 2 bytes, convert to unsigned int */ -/* All 2-byte quantities in JPEG markers are MSB first */ -static unsigned int -read_2_bytes (void) -{ - int c1, c2; - - c1 = NEXTBYTE(); - if (c1 == EOF) - global_error = ERROR_PREMATURE_EOF; - c2 = NEXTBYTE(); - if (c2 == EOF) - global_error = ERROR_PREMATURE_EOF; - return (((unsigned int) c1) << 8) + ((unsigned int) c2); -} - - -/****************************************************************************/ -/* Routines to write data to output file */ -static void -write_1_byte (int c) -{ - PUTBYTE(c); -} - -static void -write_2_bytes (unsigned int val) -{ - PUTBYTE((val >> 8) & 0xFF); - PUTBYTE(val & 0xFF); -} - -static void -write_marker (int marker) -{ - PUTBYTE(0xFF); - PUTBYTE(marker); -} - -static void -copy_rest_of_file (void) -{ - int c; - - while ((c = NEXTBYTE()) != EOF) - PUTBYTE(c); -} - - -/****************************************************************************/ -/* - * JPEG markers consist of one or more 0xFF bytes, followed by a marker - * code byte (which is not an FF). Here are the marker codes of interest - * in this program. (See jdmarker.c for a more complete list.) - */ - -#define M_SOF0 0xC0 /* Start Of Frame N */ -#define M_SOF1 0xC1 /* N indicates which compression process */ -#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */ -#define M_SOF3 0xC3 -#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */ -#define M_SOF6 0xC6 -#define M_SOF7 0xC7 -#define M_SOF9 0xC9 -#define M_SOF10 0xCA -#define M_SOF11 0xCB -#define M_SOF13 0xCD -#define M_SOF14 0xCE -#define M_SOF15 0xCF -#define M_SOI 0xD8 /* Start Of Image (beginning of datastream) */ -#define M_EOI 0xD9 /* End Of Image (end of datastream) */ -#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */ -#define M_COM 0xFE /* COMment */ - - -/* - * Find the next JPEG marker and return its marker code. - * We expect at least one FF byte, possibly more if the compressor used FFs - * to pad the file. (Padding FFs will NOT be replicated in the output file.) - * There could also be non-FF garbage between markers. The treatment of such - * garbage is unspecified; we choose to skip over it but emit a warning msg. - * NB: this routine must not be used after seeing SOS marker, since it will - * not deal correctly with FF/00 sequences in the compressed image data... - */ -static int -next_marker (void) -{ - int c; - int discarded_bytes = 0; - - /* Find 0xFF byte; count and skip any non-FFs. */ - c = read_1_byte(); - while (c != 0xFF) { - discarded_bytes++; - c = read_1_byte(); - } - /* Get marker code byte, swallowing any duplicate FF bytes. Extra FFs - * are legal as pad bytes, so don't count them in discarded_bytes. - */ - do { - c = read_1_byte(); - } while (c == 0xFF); - - if (discarded_bytes != 0) { - global_error = WARNING_GARBAGE; - } - - return c; -} - - -/* - * Most types of marker are followed by a variable-length parameter segment. - * This routine skips over the parameters for any marker we don't otherwise - * want to process. - * Note that we MUST skip the parameter segment explicitly in order not to - * be fooled by 0xFF bytes that might appear within the parameter segment; - * such bytes do NOT introduce new markers. - */ -static void -copy_variable (void) -/* Copy an unknown or uninteresting variable-length marker */ -{ - unsigned int length; - - /* Get the marker parameter length count */ - length = read_2_bytes(); - write_2_bytes(length); - /* Length includes itself, so must be at least 2 */ - if (length < 2) { - global_error = ERROR_BAD_MARKER; - length = 2; - } - length -= 2; - /* Skip over the remaining bytes */ - while (length > 0) { - write_1_byte(read_1_byte()); - length--; - } -} - -static void -skip_variable (void) -/* Skip over an unknown or uninteresting variable-length marker */ -{ - unsigned int length; - - /* Get the marker parameter length count */ - length = read_2_bytes(); - /* Length includes itself, so must be at least 2 */ - if (length < 2) { - global_error = ERROR_BAD_MARKER; - length = 2; - } - length -= 2; - /* Skip over the remaining bytes */ - while (length > 0) { - (void) read_1_byte(); - length--; - } -} - - -static int -scan_JPEG_header (int keep_COM) -/* - * Parse & copy the marker stream until SOFn or EOI is seen; - * copy data to output, but discard COM markers unless keep_COM is true. - */ -{ - int c1, c2; - int marker; - - /* - * Read the initial marker, which should be SOI. - * For a JFIF file, the first two bytes of the file should be literally - * 0xFF M_SOI. To be more general, we could use next_marker, but if the - * input file weren't actually JPEG at all, next_marker might read the whole - * file and then return a misleading error message... - */ - c1 = NEXTBYTE(); - c2 = NEXTBYTE(); - if (c1 != 0xFF || c2 != M_SOI) { - global_error = ERROR_NOT_A_JPEG; - return EOF; - } - - write_marker(M_SOI); - - /* Scan miscellaneous markers until we reach SOFn. */ - for (;;) { - marker = next_marker(); - switch (marker) { - /* Note that marker codes 0xC4, 0xC8, 0xCC are not, and must not be, - * treated as SOFn. C4 in particular is actually DHT. - */ - case M_SOF0: /* Baseline */ - case M_SOF1: /* Extended sequential, Huffman */ - case M_SOF2: /* Progressive, Huffman */ - case M_SOF3: /* Lossless, Huffman */ - case M_SOF5: /* Differential sequential, Huffman */ - case M_SOF6: /* Differential progressive, Huffman */ - case M_SOF7: /* Differential lossless, Huffman */ - case M_SOF9: /* Extended sequential, arithmetic */ - case M_SOF10: /* Progressive, arithmetic */ - case M_SOF11: /* Lossless, arithmetic */ - case M_SOF13: /* Differential sequential, arithmetic */ - case M_SOF14: /* Differential progressive, arithmetic */ - case M_SOF15: /* Differential lossless, arithmetic */ - return marker; - - case M_SOS: /* should not see compressed data before SOF */ - global_error = ERROR_MARKER_ORDER; - break; - - case M_EOI: /* in case it's a tables-only JPEG stream */ - return marker; - - case M_COM: /* Existing COM: conditionally discard */ - if (keep_COM) { - write_marker(marker); - copy_variable(); - } else { - skip_variable(); - } - break; - - default: /* Anything else just gets copied */ - write_marker(marker); - copy_variable(); /* we assume it has a parameter count... */ - break; - } - } /* end loop */ -} - - -/****************************************************************************/ -/* - Verify we know how to set the comment on this type of file. - - TODO: The actual check! This should verify - the image size promised in the headers matches the file, - and that all markers are properly formatted. -*/ -static int validate_image_file( const char * filename ) -{ -int status = 1; -int c1, c2; - - if ( (infile = fopen(filename, READ_BINARY)) ) { - c1 = NEXTBYTE(); - c2 = NEXTBYTE(); - if (c1 != 0xFF || c2 != M_SOI) - status = ERROR_NOT_A_JPEG; - else - status = 0; - fclose( infile ); - } - return( status ); -} - - -/****************************************************************************/ -/* - Modify the file in place, but be paranoid and safe about it. - It's worth a few extra CPU cycles to make sure we never - destory an original image: - 1) Validate the input file. - 2) Open a temporary file. - 3) Copy the data, writing a new comment block. - 4) Validate the temporary file. - 5) Move the temporary file over the original. - - To be even more paranoid & safe we could: - 5) Rename the original to a different temporary name. - 6) Rename the temporary to the original. - 7) Delete the original. -*/ -extern int safe_copy_and_modify( const char * original_filename, const char * comment ) -{ -char * temp_filename; -int temp_filename_length; -int comment_length = 0; -int marker; -int i; -struct stat statbuf; - - global_error = 0; - - /* - * Make sure we're dealing with a proper input file. Safety first! - */ - if( validate_image_file( original_filename ) ) { - fprintf(stderr, "error validating original file %s\n", original_filename); - return(ERROR_NOT_A_JPEG); - } - - /* Get a unique temporary file in the same directory. Hopefully - * if things go wrong, this file will still be left for recovery purposes. - * - * NB: I hate these stupid string functions in C... the buffer length is too - * hard to manage... - */ - outfile = NULL; - temp_filename_length = strlen( original_filename) + 4; - temp_filename = (char *)calloc( temp_filename_length, 1 ); - for( i=0; i<10; i++ ) { - snprintf( temp_filename, temp_filename_length, "%s%d", original_filename, i ); - if( stat( temp_filename, &statbuf ) ) { - outfile = fopen(temp_filename, WRITE_BINARY); - break; - } - } - if( !outfile ) { - fprintf(stderr, "failed opening temporary file %s\n", temp_filename); - free(temp_filename); - return(ERROR_TEMP_FILE); - } - - - /* - * Let's rock and roll! - */ - if ((infile = fopen(original_filename, READ_BINARY)) == NULL) { - fprintf(stderr, "can't open input file %s\n", original_filename); - free(temp_filename); - return(ERROR_NOT_A_JPEG); - } - /* Copy JPEG headers until SOFn marker; - * we will insert the new comment marker just before SOFn. - * This (a) causes the new comment to appear after, rather than before, - * existing comments; and (b) ensures that comments come after any JFIF - * or JFXX markers, as required by the JFIF specification. - */ - marker = scan_JPEG_header(0); - /* Insert the new COM marker, but only if nonempty text has been supplied */ - if (comment) { - comment_length = strlen( comment ); - } - if (comment_length > 0) { - write_marker(M_COM); - write_2_bytes(comment_length + 2); - while (comment_length > 0) { - write_1_byte(*comment++); - comment_length--; - } - } - /* Duplicate the remainder of the source file. - * Note that any COM markers occurring after SOF will not be touched. - * - * :TODO: Discard COM markers occurring after SOF - */ - write_marker(marker); - copy_rest_of_file(); - fclose( infile ); - fsync( fileno( outfile) ); /* Make sure its really on disk first. !!!VERY IMPORTANT!!! */ - if ( fclose( outfile ) ) { - fprintf(stderr, "error in temporary file %s\n", temp_filename); - free(temp_filename); - return(ERROR_TEMP_FILE); - } - - - /* - * Make sure we did it right. We've already fsync()'ed the file. Safety first! - */ - if( validate_image_file( temp_filename ) ) { - fprintf(stderr, "error in temporary file %s\n", temp_filename); - free(temp_filename); - return(ERROR_TEMP_FILE); - } - - if( global_error >= ERROR_NOT_A_JPEG ) { - fprintf(stderr, "error %d processing %s\n", global_error, original_filename); - free(temp_filename); - return(ERROR_NOT_A_JPEG); - } - - if( rename( temp_filename, original_filename ) ) { - fprintf(stderr, "error renaming %s to %s\n", temp_filename, original_filename); - free(temp_filename); - return(ERROR_TEMP_FILE); - } - free(temp_filename); - - return(0); -} - - -#ifdef STANDALONE_COMPILE -int -main (int argc, char **argv) -{ - char * progname; /* program name for error messages */ - char * filename; - char * comment; - FILE * fp; - int error; - - /* Process command line arguments... */ - progname = argv[0]; - if (progname == NULL || progname[0] == 0) - progname = "writejpgcomment"; /* in case C library doesn't provide it */ - if( argc != 3) { - fprintf(stderr, "Usage: %s \"\"\nOverwrites the comment in a image file with the given comment.\n", progname); - return(5); - } - filename = argv[1]; - comment = argv[2]; - - - /* Check if file is readable... */ - if ((fp = fopen(filename, READ_BINARY)) == NULL) { - fprintf(stderr, "Error: Can't open file %s\n", filename); - fclose(fp); - return(5); - } - fclose(fp); - - /* Check if we really have a commentable image file here... */ - if( validate_image_file( filename ) ) { - fprintf(stderr, "Error: file %s is not of a supported type\n", filename); - return(5); - } - - /* Lets do it... modify the comment in place */ - if ((error = safe_copy_and_modify( filename, comment ) )) { - fprintf(stderr, "Error: %d setting jpg comment\n", error); - return(10); - } - - - /* TODO: Read comment back out of jpg and display it */ - return( 0 ); -} -#endif diff --git a/kfile-plugins/pcx/CMakeLists.txt b/kfile-plugins/pcx/CMakeLists.txt deleted file mode 100644 index efabc58e..00000000 --- a/kfile-plugins/pcx/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -################################################# -# -# (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 kfile_pcx.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - - -#### kfile_pcx (module) ######################### - -tde_add_kpart( kfile_pcx AUTOMOC - SOURCES kfile_pcx.cpp - LINK kio-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kfile-plugins/pcx/Makefile.am b/kfile-plugins/pcx/Makefile.am deleted file mode 100644 index 111b4c28..00000000 --- a/kfile-plugins/pcx/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -## Makefile.am for PCX file meta info plugin - -# set the include path for X, qt and KDE -INCLUDES = $(all_includes) - -noinst_HEADERS = kfile_pcx.h - -kde_module_LTLIBRARIES = kfile_pcx.la - -kfile_pcx_la_SOURCES = kfile_pcx.cpp -kfile_pcx_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -kfile_pcx_la_LIBADD = $(LIB_KIO) $(LIBTIFF) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: - $(XGETTEXT) *.cpp -o $(podir)/kfile_pcx.pot - -services_DATA = kfile_pcx.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/pcx/kfile_pcx.cpp b/kfile-plugins/pcx/kfile_pcx.cpp deleted file mode 100644 index 5dceec9d..00000000 --- a/kfile-plugins/pcx/kfile_pcx.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* 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 "kfile_pcx.h" - -#include -#include - -#include -#include - -typedef KGenericFactory PcxFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_pcx, PcxFactory("kfile_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 "kfile_pcx.moc" - -/* vim: et sw=2 ts=2 -*/ - diff --git a/kfile-plugins/pcx/kfile_pcx.desktop b/kfile-plugins/pcx/kfile_pcx.desktop deleted file mode 100644 index b998b479..00000000 --- a/kfile-plugins/pcx/kfile_pcx.desktop +++ /dev/null @@ -1,62 +0,0 @@ -[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=kfile_pcx -MimeType=image/x-pcx -PreferredGroups=General -PreferredItems=Dimensions,Resolution,BitDepth,Compression diff --git a/kfile-plugins/pcx/kfile_pcx.h b/kfile-plugins/pcx/kfile_pcx.h deleted file mode 100644 index 47e74ab6..00000000 --- a/kfile-plugins/pcx/kfile_pcx.h +++ /dev/null @@ -1,89 +0,0 @@ -/* 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 -*/ - diff --git a/kfile-plugins/pdf/CMakeLists.txt b/kfile-plugins/pdf/CMakeLists.txt deleted file mode 100644 index c75dcf3f..00000000 --- a/kfile-plugins/pdf/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -################################################# -# -# (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} - ${CMAKE_SOURCE_DIR}/kfile-plugins/dependencies/poppler-tqt -) - -link_directories( - ${TQT_LIBRARY_DIRS} -) - - -#### other data ################################# - -install( FILES kfile_pdf.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - - -#### kfile_pdf (module) ######################### - -tde_add_kpart( kfile_pdf AUTOMOC - SOURCES kfile_pdf.cpp - LINK kio-shared -L${CMAKE_BINARY_DIR}/kfile-plugins/dependencies/poppler-tqt -lpoppler-tqt - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kfile-plugins/pdf/Makefile.am b/kfile-plugins/pdf/Makefile.am deleted file mode 100644 index 0b5bf202..00000000 --- a/kfile-plugins/pdf/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for the pdf file meta info plugin - -# set the include path for X, qt and KDE -INCLUDES = $(all_includes) -I$(top_srcdir)/kfile-plugins/dependencies/poppler-tqt - -# these are the headers for your project -noinst_HEADERS = kfile_pdf.h - -kde_module_LTLIBRARIES = kfile_pdf.la - -kfile_pdf_la_SOURCES = kfile_pdf.cpp -kfile_pdf_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -kfile_pdf_la_LIBADD = $(LIB_KIO) -L$(top_builddir)/kfile-plugins/dependencies/poppler-tqt/ -lpoppler-tqt - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: - $(XGETTEXT) *.cpp -o $(podir)/kfile_pdf.pot - -services_DATA = kfile_pdf.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/pdf/configure.in.in b/kfile-plugins/pdf/configure.in.in deleted file mode 100644 index ec2fff51..00000000 --- a/kfile-plugins/pdf/configure.in.in +++ /dev/null @@ -1,16 +0,0 @@ -AC_ARG_WITH([poppler], - [AC_HELP_STRING([--with-poppler], - [Enable PDF support through poppler @<:@default=check@:>@])], - [], with_poppler=check) - -## Compile the pdf meta info plugin only if Poppler is available -#if test "x$with_poppler" != xno; then -# PKG_CHECK_MODULES(POPPLER, poppler-qt >= 0.3.1, have_poppler=yes, have_poppler=no) -# -# if test "x$with_poppler" != xcheck && test "x$have_poppler" != xyes; then -# AC_MSG_ERROR([--with-poppler was given, but test for poppler failed]) -# fi -#fi - -have_poppler=yes -AM_CONDITIONAL(include_PDF, test "x$have_poppler" = xyes) diff --git a/kfile-plugins/pdf/kfile_pdf.cpp b/kfile-plugins/pdf/kfile_pdf.cpp deleted file mode 100644 index a3dcbde7..00000000 --- a/kfile-plugins/pdf/kfile_pdf.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2001, 2002 Rolf Magnus - * - * 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 "kfile_pdf.h" - -#include -#include - -typedef KGenericFactory PdfFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_pdf, PdfFactory("kfile_pdf")) - -KPdfPlugin::KPdfPlugin(TQObject *parent, const char *name, const TQStringList &preferredItems) - : KFilePlugin(parent, name, preferredItems) -{ - kdDebug(7034) << "pdf plugin\n"; - - // set up our mime type - KFileMimeTypeInfo* info = addMimeTypeInfo( "application/pdf" ); - - // general group - KFileMimeTypeInfo::GroupInfo* group = addGroupInfo(info, "General", i18n("General")); - - KFileMimeTypeInfo::ItemInfo* item; - - item = addItemInfo(group, "Title", i18n("Title"), TQVariant::String); - setHint(item, KFileMimeTypeInfo::Name); - item = addItemInfo(group, "Subject", i18n("Subject"), TQVariant::String); - setHint(item, KFileMimeTypeInfo::Description); - item = addItemInfo(group, "Author", i18n("Author"), TQVariant::String); - setHint(item, KFileMimeTypeInfo::Author); - addItemInfo(group, "Keywords", i18n("Key Words"), TQVariant::String); - addItemInfo(group, "Creator", i18n("Creator"), TQVariant::String); - addItemInfo(group, "Producer", i18n("Producer"), TQVariant::String); - addItemInfo(group, "CreationDate", i18n("Creation Date"), TQVariant::DateTime); - addItemInfo(group, "ModificationDate", i18n("Modified"), TQVariant::DateTime); - addItemInfo(group, "Pages", i18n("Pages"), TQVariant::Int); - addItemInfo(group, "Protected", i18n("Protected"), TQVariant::String); - addItemInfo(group, "Linearized", i18n("Linearized"), TQVariant::String); - addItemInfo(group, "Version", i18n("Version"), TQVariant::String); -} - -bool KPdfPlugin::readInfo( KFileMetaInfo& info, uint /* what */) -{ - Poppler::Document *doc = Poppler::Document::load(info.path()); - if (!doc || doc->isLocked()) - { - delete doc; - return false; - } - - KFileMetaInfoGroup generalGroup = appendGroup(info, "General"); - - appendItem(generalGroup, "Title", doc->getInfo("Title") ); - appendItem(generalGroup, "Subject", doc->getInfo("Subject") ); - appendItem(generalGroup, "Author", doc->getInfo("Author") ); - appendItem(generalGroup, "Keywords", doc->getInfo("Keywords") ); - appendItem(generalGroup, "Creator", doc->getInfo("Creator") ); - appendItem(generalGroup, "Producer", doc->getInfo("Producer") ); - - appendItem(generalGroup, "CreationDate", doc->getDate("CreationDate") ); - appendItem(generalGroup, "ModificationDate", doc->getDate("ModDate") ); - appendItem(generalGroup, "Pages", doc->getNumPages() ); - - TQString enc; - if (doc->isEncrypted()) - { - enc = i18n("Yes (Can Print:%1 Can Copy:%2 Can Change:%3 Can Add notes:%4)") - .arg(doc->okToPrint() ? i18n("Yes") : i18n("No")) - .arg(doc->okToCopy() ? i18n("Yes") : i18n("No")) - .arg(doc->okToChange() ? i18n("Yes") : i18n("No")) - .arg(doc->okToAddNotes() ? i18n("Yes") : i18n("No")); - } - else enc = i18n("No"); - - appendItem(generalGroup, "Protected", enc ); - appendItem(generalGroup, "Linearized", doc->isLinearized() ? i18n("Yes") : i18n("No") ); - TQString versionString = TQString("%1").arg( doc->getPDFVersion(), 0, 'f', 1 ); - appendItem(generalGroup, "Version", versionString ); - - delete doc; - - return true; -} - -#include "kfile_pdf.moc" - diff --git a/kfile-plugins/pdf/kfile_pdf.desktop b/kfile-plugins/pdf/kfile_pdf.desktop deleted file mode 100644 index 0af41176..00000000 --- a/kfile-plugins/pdf/kfile_pdf.desktop +++ /dev/null @@ -1,64 +0,0 @@ -[Desktop Entry] -Type=Service -Name=PDF Info -Name[af]=Pdf Inligting -Name[ar]=معلومات PDF -Name[br]=Titouroù PDF -Name[ca]=Informació de PDF -Name[cs]=PDF info -Name[cy]=Gybodaeth PDF -Name[da]=PDF-info -Name[de]=PDF-Info -Name[el]=Πληροφορίες PDF -Name[eo]=PDF-informo -Name[es]=Info PDF -Name[et]=PDF info -Name[fa]=اطلاعات PDF -Name[fi]=PDF-tiedot -Name[fr]=Informations PDF -Name[gl]=Inf. PDF -Name[he]=מידע PDF -Name[hi]=PDF जानकारी -Name[hr]=PDF Informacije -Name[hu]=PDF-jellemzők -Name[is]=PDF upplýsingar -Name[it]=Informazioni PDF -Name[ja]=PDF 情報 -Name[kk]=PDF мәліметі -Name[km]=ព័ត៌មាន PDF -Name[lt]=PDF informacija -Name[ms]=Maklumat PDF -Name[nds]=PDF-Info -Name[ne]=PDF सूचना -Name[nl]=PDF-info -Name[nn]=PDF-info -Name[nso]=Tshedimoso ya PDF -Name[pa]=PDF ਜਾਣਕਾਰੀ -Name[pl]=Informacja o pliku PDF -Name[pt]=Informação do PDF -Name[pt_BR]=Informação sobre PDF -Name[ro]=Informaţii PDF -Name[ru]=Информация о PDF -Name[se]=PDF-dieđut -Name[sl]=Podatki o PDF -Name[sr]=PDF информације -Name[sr@Latn]=PDF informacije -Name[sv]=PDF-information -Name[ta]=PDF தகவல் -Name[tg]=Иттилоот оиди PDF -Name[th]=ข้อมูลแฟ้ม PDF -Name[tr]=PDF Bilgisi -Name[uk]=Інформація про PDF -Name[uz]=PDF haqida maʼlumot -Name[uz@cyrillic]=PDF ҳақида маълумот -Name[ven]=Mafhungo a PDF -Name[wa]=Informåcion sol documint PDF -Name[xh]=PDF Ulwazi -Name[zh_CN]=PDF 信息 -Name[zh_HK]=PDF 資訊 -Name[zh_TW]=PDF 資訊 -Name[zu]=Ulwazi lwe-PDF -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_pdf -MimeType=application/pdf -PreferredItems=Title,Subject,Author,Keywords,Creator,Producer,CreationDate,ModificationDate,Pages,Protected,Linearized,Version diff --git a/kfile-plugins/pdf/kfile_pdf.h b/kfile-plugins/pdf/kfile_pdf.h deleted file mode 100644 index e732e2be..00000000 --- a/kfile-plugins/pdf/kfile_pdf.h +++ /dev/null @@ -1,39 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2001, 2002 Rolf Magnus - * - * 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_PDF_H__ -#define __KFILE_PDF_H__ - -#include -#include - -class TQStringList; - -class KPdfPlugin: public KFilePlugin -{ -Q_OBJECT - -public: - KPdfPlugin( TQObject *parent, const char *name, const TQStringList& preferredItems ); - - virtual bool readInfo(KFileMetaInfo& info, uint what); -}; - -#endif 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 -# 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 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 - * - * 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 -#include "kfile_png.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -// 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 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(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) - 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(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 - * - * 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 -#include - -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 diff --git a/kfile-plugins/pnm/CMakeLists.txt b/kfile-plugins/pnm/CMakeLists.txt deleted file mode 100644 index 34e78ddf..00000000 --- a/kfile-plugins/pnm/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -################################################# -# -# (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 kfile_pnm.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - - -#### kfile_pnm (module) ######################### - -tde_add_kpart( kfile_pnm AUTOMOC - SOURCES kfile_pnm.cpp - LINK kio-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kfile-plugins/pnm/Makefile.am b/kfile-plugins/pnm/Makefile.am deleted file mode 100644 index 7148232a..00000000 --- a/kfile-plugins/pnm/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for pnm 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_pnm.h - -kde_module_LTLIBRARIES = kfile_pnm.la - -kfile_pnm_la_SOURCES = kfile_pnm.cpp -kfile_pnm_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -kfile_pnm_la_LIBADD = $(LIB_KIO) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: - $(XGETTEXT) *.cpp -o $(podir)/kfile_pnm.pot - -services_DATA = kfile_pnm.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/pnm/kfile_pnm.cpp b/kfile-plugins/pnm/kfile_pnm.cpp deleted file mode 100644 index 6c965e65..00000000 --- a/kfile-plugins/pnm/kfile_pnm.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2003 Volker Krause - * - * 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 "kfile_pnm.h" - -#include -#include -#include -#include - -static const char* formats[] = { - I18N_NOOP("plain"), - I18N_NOOP("raw") -}; - -typedef KGenericFactory PnmFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_pnm, PnmFactory("kfile_pnm")) - -KPnmPlugin::KPnmPlugin(TQObject *parent, const char *name, const TQStringList &args) : KFilePlugin(parent, name, args) -{ - makeMimeTypeInfo( "image/x-portable-bitmap" ); - makeMimeTypeInfo( "image/x-portable-greymap" ); - makeMimeTypeInfo( "image/x-portable-pixmap" ); -} - -void KPnmPlugin::makeMimeTypeInfo(const TQString& mimetype) -{ - KFileMimeTypeInfo* info = addMimeTypeInfo( mimetype ); - - KFileMimeTypeInfo::GroupInfo* group = 0; - KFileMimeTypeInfo::ItemInfo* item = 0; - - group = addGroupInfo(info, "General", i18n("General")); - - addItemInfo(group, "Format", i18n("Format"), TQVariant::String); - - item = addItemInfo(group, "Dimensions", i18n("Dimensions"), TQVariant::Size); - setUnit(item, KFileMimeTypeInfo::Pixels); - - item = addItemInfo(group, "BitDepth", i18n("Bit Depth"), TQVariant::Int); - setUnit(item, KFileMimeTypeInfo::BitsPerPixel); - - addItemInfo(group, "Comment", i18n("Comment"), TQVariant::String); -} - - -bool KPnmPlugin::readInfo( KFileMetaInfo& info, uint /*what*/) -{ - TQFile f(info.path()); - if(!f.open(IO_ReadOnly)) - return false; - if(f.size() <= 2) - return false; - TQTextStream stream(&f); - - char c; - stream >> c; - if(c != 'P') - return false; - - // image format and type - int n; - stream >> n; - int format = (n - 1) / 3; - if(format != 0 && format != 1) - return false; - int type = (n - 1) % 3; - - TQString comments, buffer; - while(!stream.atEnd()) { - stream >> c; - // comment - if( c == '#') { - buffer = stream.readLine(); - comments += buffer.stripWhiteSpace(); - comments += '\n'; - } - // image size - // unfortunately TQt doesn't have some kind of push-back method for - // TQTextStream, so we need to manually decode the first part of the - // image size. - if( c >= '0' && c <= '9' ) { - buffer = ""; - TQChar tmp(c); - while(!stream.atEnd() && tmp.isDigit()) { - buffer += tmp; - stream >> tmp; - } - break; - } - } - - // image size - int x, y, max; - x = buffer.toInt(); - stream >> y; - stream >> max; - - // bit depth - // PNM doesn't provide a conventional bit depth value, only the highest value - // per pixel. To have comparable values with other formats, we convert it to - // a normal bit depth value. - int bpp = 1; - if(type != 0) - bpp = (int)ceil(log((double)max) / log(2.0)); - if(type == 2) - bpp *= 3; - - KFileMetaInfoGroup group = appendGroup(info, "General"); - appendItem(group, "Format", formats[format]); - appendItem(group, "Dimensions", TQSize(x, y)); - if(!comments.isEmpty()) - appendItem(group, "Comment", comments.stripWhiteSpace()); - appendItem(group, "BitDepth", bpp); - - f.close(); - return true; -} - -#include "kfile_pnm.moc" diff --git a/kfile-plugins/pnm/kfile_pnm.desktop b/kfile-plugins/pnm/kfile_pnm.desktop deleted file mode 100644 index 4de8e7c1..00000000 --- a/kfile-plugins/pnm/kfile_pnm.desktop +++ /dev/null @@ -1,60 +0,0 @@ -[Desktop Entry] -Type=Service -Name=PNM Info -Name[ar]=معلومات PNM -Name[br]=Titouroù PNM -Name[ca]=Informació de PNM -Name[cs]=PNM info -Name[cy]=Gybodaeth PNM -Name[da]=PNG-info -Name[de]=PNM-Info -Name[el]=Πληροφορίες PNM -Name[eo]=PNM-informo -Name[es]=Info PNM -Name[et]=PNM info -Name[fa]=اطلاعات PNM -Name[fi]=PNM-tiedot -Name[fr]=Informations PNM -Name[gl]=Inf. PNM -Name[he]=מידע PNM -Name[hi]=PNM जानकारी -Name[hu]=PNM-jellemzők -Name[is]=PNM upplýsingar -Name[it]=Informazioni PNM -Name[ja]=PNM 情報 -Name[kk]=PNM мәліметі -Name[km]=ព័ត៌មាន PNM -Name[lt]=PNM informacija -Name[ms]=Maklumat PNM -Name[nb]=PNM-info -Name[nds]=PNM-Info -Name[ne]=PNM सूचना -Name[nl]=PNG-info -Name[nn]=PNM-info -Name[pa]=PNM ਜਾਣਕਾਰੀ -Name[pl]=Informacja o pliku PNM -Name[pt]=Informação do PNM -Name[pt_BR]=Informação sobre PNG -Name[ro]=Informaţii PNM -Name[ru]=Информация о PNM -Name[se]=PNM-dieđut -Name[sl]=Podatki o PNM -Name[sr]=PNM информације -Name[sr@Latn]=PNM informacije -Name[sv]=PNM-information -Name[ta]=PNM தகவல் -Name[tg]=Иттилоот оиди PNM -Name[th]=ข้อมูลแฟ้ม PNM -Name[tr]=PNM Bilgisi -Name[uk]=Інформація про PNM -Name[uz]=PNM haqida maʼlumot -Name[uz@cyrillic]=PNM ҳақида маълумот -Name[wa]=Informåcion sol imådje PNM -Name[zh_CN]=PNM 信息 -Name[zh_HK]=PNM 資訊 -Name[zh_TW]=PNM 資訊 -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_pnm -MimeType=image/x-portable-bitmap;image/x-portable-greymap;image/x-portable-pixmap -PreferredGroups=General -PreferredItems=Format,Dimensions,BitDepth,Comment diff --git a/kfile-plugins/pnm/kfile_pnm.h b/kfile-plugins/pnm/kfile_pnm.h deleted file mode 100644 index b033d022..00000000 --- a/kfile-plugins/pnm/kfile_pnm.h +++ /dev/null @@ -1,40 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2003 Volker Krause - * - * 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_PNM_H__ -#define __KFILE_PNM_H__ - -#include - -class TQStringList; - -class KPnmPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KPnmPlugin( TQObject *parent, const char *name, const TQStringList& preferredItems ); - virtual bool readInfo( KFileMetaInfo& info, uint ); - -private: - void makeMimeTypeInfo( const TQString&); -}; - -#endif diff --git a/kfile-plugins/ps/CMakeLists.txt b/kfile-plugins/ps/CMakeLists.txt deleted file mode 100644 index 2d5cf3df..00000000 --- a/kfile-plugins/ps/CMakeLists.txt +++ /dev/null @@ -1,46 +0,0 @@ -################################################# -# -# (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} - ${CMAKE_SOURCE_DIR}/kghostview - ${CMAKE_SOURCE_DIR}/kghostview/dscparse - ${TDE_INCLUDE_DIR} - ${TQT_INCLUDE_DIRS} -) - -link_directories( - ${TQT_LIBRARY_DIRS} -) - - -#### other data ################################# - -install( FILES kfile_ps.desktop gsthumbnail.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - - -#### kfile_ps (module) ######################## - -tde_add_kpart( kfile_ps AUTOMOC - SOURCES kfile_ps.cpp - LINK dscparse-static kio-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) - - -##### gsthumbnail (module) ###################### - -tde_add_kpart( gsthumbnail AUTOMOC - SOURCES gscreator.cpp - LINK dscparse-static ${TQT_LIBRARIES} - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kfile-plugins/ps/Makefile.am b/kfile-plugins/ps/Makefile.am deleted file mode 100644 index 6d76e075..00000000 --- a/kfile-plugins/ps/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -## Makefile.am for the ps file meta info plugin - -# set the include path for X, qt and KDE -INCLUDES = -I$(top_srcdir)/kghostview/dscparse $(all_includes) - -# these are the headers for your project -noinst_HEADERS = kfile_ps.h gscreator.h - -kde_module_LTLIBRARIES = kfile_ps.la gsthumbnail.la - -kfile_ps_la_SOURCES = kfile_ps.cpp -kfile_ps_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -kfile_ps_la_LIBADD = $(LIB_KIO) ../../kghostview/libdscparse.la - -gsthumbnail_la_SOURCES = gscreator.cpp -gsthumbnail_la_LIBADD = $(LIB_TDECORE) ../../kghostview/libdscparse.la -gsthumbnail_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: - $(XGETTEXT) *.cpp -o $(podir)/kfile_ps.pot - -services_DATA = kfile_ps.desktop gsthumbnail.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/ps/gscreator.cpp b/kfile-plugins/ps/gscreator.cpp deleted file mode 100644 index c664947b..00000000 --- a/kfile-plugins/ps/gscreator.cpp +++ /dev/null @@ -1,619 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2001 Malte Starostik - - Handling of EPS previews Copyright (C) 2003 Philipp Hullmann - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -/* This function gets a path of a DVI, EPS, PS or PDF file and - produces a PNG-Thumbnail which is stored as a TQImage - - The program works as follows - - 1. Test if file is a DVI file - - 2. Create a child process (1), in which the - file is to be changed into a PNG - - 3. Child-process (1) : - - 4. If file is DVI continue with 6 - - 5. If file is no DVI continue with 9 - - 6. Create another child process (2), in which the DVI is - turned into PS using dvips - - 7. Parent process (2) : - Turn the recently created PS file into a PNG file using gs - - 8. continue with 10 - - 9. Turn the PS,PDF or EPS file into a PNG file using gs - - 10. Parent process (1) - store data in a TQImage -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif - - -#include -#include -#include -#include -#include -#include -#ifdef HAVE_SYS_SELECT_H -#include -#endif -#include -#include -#include -#include -#include - -#include -#include -#include -#include - - -#include "gscreator.h" -#include "dscparse_adapter.h" -#include "dscparse.h" - -extern "C" -{ - KDE_EXPORT ThumbCreator *new_creator() - { - return new GSCreator; - } -} - -// This PS snippet will be prepended to the actual file so that only -// the first page is output. -static const char *psprolog = - "%!PS-Adobe-3.0\n" - "/.showpage.orig /showpage load def\n" - "/.showpage.firstonly {\n" - " .showpage.orig\n" - " quit\n" - "} def\n" - "/showpage { .showpage.firstonly } def\n"; - -// This is the code recommended by Adobe tech note 5002 for including -// EPS files. -static const char *epsprolog = - "%!PS-Adobe-3.0\n" - "userdict begin /pagelevel save def /showpage { } def\n" - "0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin 10 setmiterlimit\n" - "[ ] 0 setdash newpath false setoverprint false setstrokeadjust\n"; - -static const char * gsargs_ps[] = { - "gs", - "-sDEVICE=png16m", - "-sOutputFile=-", - "-dSAFER", - "-dPARANOIDSAFER", - "-dNOPAUSE", - "-dFirstPage=1", - "-dLastPage=1", - "-q", - "-", - 0, // file name - "-c", - "showpage", - "-c", - "quit", - 0 -}; - -static const char * gsargs_eps[] = { - "gs", - "-sDEVICE=png16m", - "-sOutputFile=-", - "-dSAFER", - "-dPARANOIDSAFER", - "-dNOPAUSE", - 0, // page size - 0, // resolution - "-q", - "-", - 0, // file name - "-c", - "pagelevel", - "-c", - "restore", - "-c", - "end", - "-c", - "showpage", - "-c", - "quit", - 0 -}; - -static const char *dvipsargs[] = { - "dvips", - "-n", - "1", - "-q", - "-o", - "-", - 0, // file name - 0 -}; - -static bool correctDVI(const TQString& filename); - - -namespace { - bool got_sig_term = false; - void handle_sigterm( int ) { - got_sig_term = true; - } -} - - -bool GSCreator::create(const TQString &path, int width, int height, TQImage &img) -{ -// The code in the loop (when testing whether got_sig_term got set) -// should read some variation of: -// parentJob()->wasKilled() -// -// Unfortunatelly, that's currently impossible without breaking BIC. -// So we need to catch the signal ourselves. -// Otherwise, on certain funny PS files (for example -// http://www.tjhsst.edu/~Eedanaher/pslife/life.ps ) -// gs would run forever after we were dead. -// #### Reconsider for KDE 4 ### -// (24/12/03 - luis_pedro) -// - typedef void ( *sighandler_t )( int ); - // according to linux's "man signal" the above typedef is a gnu extension - sighandler_t oldhandler = signal( SIGTERM, handle_sigterm ); - - int input[2]; - int output[2]; - int dvipipe[2]; - - TQByteArray data(1024); - - bool ok = false; - - // Test if file is DVI - bool no_dvi =!correctDVI(path); - - if (pipe(input) == -1) { - return false; - } - if (pipe(output) == -1) { - close(input[0]); - close(input[1]); - return false; - } - - KDSC dsc; - endComments = false; - dsc.setCommentHandler(this); - - if (no_dvi) - { - FILE* fp = fopen(TQFile::encodeName(path), "r"); - if (fp == 0) return false; - - char buf[4096]; - int count; - while ((count = fread(buf, sizeof(char), 4096, fp)) != 0 - && !endComments) { - dsc.scanData(buf, count); - } - fclose(fp); - - if (dsc.pjl() || dsc.ctrld()) { - // this file is a mess. - return false; - } - } - - const bool is_encapsulated = no_dvi && - (path.find(TQRegExp("\\.epsi?$", false, false)) > 0) && - (dsc.bbox()->width() > 0) && (dsc.bbox()->height() > 0) && - (dsc.page_count() <= 1); - - char translation[64] = ""; - char pagesize[32] = ""; - char resopt[32] = ""; - std::auto_ptr bbox = dsc.bbox(); - if (is_encapsulated) { - // GhostScript's rendering at the extremely low resolutions - // required for thumbnails leaves something to be desired. To - // get nicer images, we render to four times the required - // resolution and let TQImage scale the result. - const int hres = (width * 72) / bbox->width(); - const int vres = (height * 72) / bbox->height(); - const int resolution = (hres > vres ? vres : hres) * 4; - const int gswidth = ((bbox->urx() - bbox->llx()) * resolution) / 72; - const int gsheight = ((bbox->ury() - bbox->lly()) * resolution) / 72; - - snprintf(pagesize, 31, "-g%ix%i", gswidth, gsheight); - snprintf(resopt, 31, "-r%i", resolution); - snprintf(translation, 63, - " 0 %i sub 0 %i sub translate\n", bbox->llx(), - bbox->lly()); - } - - const CDSC_PREVIEW_TYPE previewType = - static_cast(dsc.preview()); - - switch (previewType) { - case CDSC_TIFF: - case CDSC_WMF: - case CDSC_PICT: - // FIXME: these should take precedence, since they can hold - // color previews, which EPSI can't (or can it?). - break; - case CDSC_EPSI: - { - const int xscale = bbox->width() / width; - const int yscale = bbox->height() / height; - const int scale = xscale < yscale ? xscale : yscale; - if (getEPSIPreview(path, - dsc.beginpreview(), - dsc.endpreview(), - img, - bbox->width() / scale, - bbox->height() / scale)) - return true; - // If the preview extraction routine fails, gs is used to - // create a thumbnail. - } - break; - case CDSC_NOPREVIEW: - default: - // need to run ghostscript in these cases - break; - } - - pid_t pid = fork(); - if (pid == 0) { - // Child process (1) - - // close(STDERR_FILENO); - - // find first zero entry in gsargs and put the filename - // or - (stdin) there, if DVI - const char **gsargs = gsargs_ps; - const char **arg = gsargs; - - if (no_dvi && is_encapsulated) { - gsargs = gsargs_eps; - arg = gsargs; - - // find first zero entry and put page size there - while (*arg) ++arg; - *arg = pagesize; - - // find second zero entry and put resolution there - while (*arg) ++arg; - *arg = resopt; - } - - // find next zero entry and put the filename there - TQCString fname = TQFile::encodeName( path ); - while (*arg) - ++arg; - if( no_dvi ) - *arg = fname.data(); - else - *arg = "-"; - - // find first zero entry in dvipsargs and put the filename there - arg = dvipsargs; - while (*arg) - ++arg; - *arg = fname.data(); - - if( !no_dvi ){ - pipe(dvipipe); - pid_t pid_two = fork(); - if( pid_two == 0 ){ - // Child process (2), reopen stdout on the pipe "dvipipe" and exec dvips - - close(input[0]); - close(input[1]); - close(output[0]); - close(output[1]); - close(dvipipe[0]); - - dup2( dvipipe[1], STDOUT_FILENO); - - execvp(dvipsargs[0], const_cast(dvipsargs)); - exit(1); - } - else if(pid_two != -1){ - close(input[1]); - close(output[0]); - close(dvipipe[1]); - - dup2( dvipipe[0], STDIN_FILENO); - dup2( output[1], STDOUT_FILENO); - - execvp(gsargs[0], const_cast(gsargs)); - exit(1); - } - else{ - // fork() (2) failed, close these - close(dvipipe[0]); - close(dvipipe[1]); - } - - } - else if( no_dvi ){ - // Reopen stdin/stdout on the pipes and exec gs - close(input[1]); - close(output[0]); - - dup2(input[0], STDIN_FILENO); - dup2(output[1], STDOUT_FILENO); - - execvp(gsargs[0], const_cast(gsargs)); - exit(1); - } - } - else if (pid != -1) { - // Parent process, write first-page-only-hack (the hack is not - // used if DVI) and read the png output - close(input[0]); - close(output[1]); - const char *prolog; - if (is_encapsulated) - prolog = epsprolog; - else - prolog = psprolog; - int count = write(input[1], prolog, strlen(prolog)); - if (is_encapsulated) - write(input[1], translation, strlen(translation)); - - close(input[1]); - if (count == static_cast(strlen(prolog))) { - int offset = 0; - while (!ok) { - fd_set fds; - FD_ZERO(&fds); - FD_SET(output[0], &fds); - struct timeval tv; - tv.tv_sec = 20; - tv.tv_usec = 0; - - got_sig_term = false; - if (select(output[0] + 1, &fds, 0, 0, &tv) <= 0) { - if ( ( errno == EINTR || errno == EAGAIN ) && !got_sig_term ) continue; - break; // error, timeout or master wants us to quit (SIGTERM) - } - if (FD_ISSET(output[0], &fds)) { - count = read(output[0], data.data() + offset, 1024); - if (count == -1) - break; - else - if (count) // prepare for next block - { - offset += count; - data.resize(offset + 1024); - } - else // got all data - { - data.resize(offset); - ok = true; - } - } - } - } - if (!ok) // error or timeout, gs probably didn't exit yet - { - kill(pid, SIGTERM); - } - - int status = 0; - if (waitpid(pid, &status, 0) != pid || (status != 0 && status != 256) ) - ok = false; - } - else { - // fork() (1) failed, close these - close(input[0]); - close(input[1]); - close(output[1]); - } - close(output[0]); - - int l = img.loadFromData( data ); - - if ( got_sig_term && - oldhandler != SIG_ERR && - oldhandler != SIG_DFL && - oldhandler != SIG_IGN ) { - oldhandler( SIGTERM ); // propagate the signal. Other things might rely on it - } - if ( oldhandler != SIG_ERR ) signal( SIGTERM, oldhandler ); - - return ok && l; -} - -ThumbCreator::Flags GSCreator::flags() const -{ - return static_cast(DrawFrame); -} - -void GSCreator::comment(Name name) -{ - switch (name) { - case EndPreview: - case BeginProlog: - case Page: - endComments = true; - break; - - default: - break; - } -} - -// Quick function to check if the filename corresponds to a valid DVI -// file. Returns true if is a DVI file, false otherwise. - -static bool correctDVI(const TQString& filename) -{ - TQFile f(filename); - if (!f.open(IO_ReadOnly)) - return FALSE; - - unsigned char test[4]; - if ( f.readBlock( (char *)test,2)<2 || test[0] != 247 || test[1] != 2 ) - return FALSE; - - int n = f.size(); - if ( n < 134 ) // Too short for a dvi file - return FALSE; - f.at( n-4 ); - - unsigned char trailer[4] = { 0xdf,0xdf,0xdf,0xdf }; - - if ( f.readBlock( (char *)test, 4 )<4 || strncmp( (char *)test, (char*) trailer, 4 ) ) - return FALSE; - // We suppose now that the dvi file is complete and OK - return TRUE; -} - -bool GSCreator::getEPSIPreview(const TQString &path, long start, long - end, TQImage &outimg, int imgwidth, int imgheight) -{ - FILE *fp; - fp = fopen(TQFile::encodeName(path), "r"); - if (fp == 0) return false; - - const long previewsize = end - start + 1; - - char *buf = (char *) malloc(previewsize); - fseek(fp, start, SEEK_SET); - int count = fread(buf, sizeof(char), previewsize - 1, fp); - fclose(fp); - buf[previewsize - 1] = 0; - if (count != previewsize - 1) - { - free(buf); - return false; - } - - TQString previewstr = TQString::fromLatin1(buf); - free(buf); - - int offset = 0; - while ((offset < previewsize) && !(previewstr[offset].isDigit())) offset++; - int digits = 0; - while ((offset + digits < previewsize) && previewstr[offset + digits].isDigit()) digits++; - int width = previewstr.mid(offset, digits).toInt(); - offset += digits + 1; - while ((offset < previewsize) && !(previewstr[offset].isDigit())) offset++; - digits = 0; - while ((offset + digits < previewsize) && previewstr[offset + digits].isDigit()) digits++; - int height = previewstr.mid(offset, digits).toInt(); - offset += digits + 1; - while ((offset < previewsize) && !(previewstr[offset].isDigit())) offset++; - digits = 0; - while ((offset + digits < previewsize) && previewstr[offset + digits].isDigit()) digits++; - int depth = previewstr.mid(offset, digits).toInt(); - - // skip over the rest of the BeginPreview comment - while ((offset < previewsize) && - previewstr[offset] != '\n' && - previewstr[offset] != '\r') offset++; - while ((offset < previewsize) && previewstr[offset] != '%') offset++; - - unsigned int imagedepth; - switch (depth) { - case 1: - case 2: - case 4: - case 8: - imagedepth = 8; - break; - case 12: // valid, but not (yet) supported - default: // illegal value - return false; - } - - unsigned int colors = (1U << depth); - TQImage img(width, height, imagedepth, colors); - img.setAlphaBuffer(false); - - if (imagedepth <= 8) { - for (unsigned int gray = 0; gray < colors; gray++) { - unsigned int grayvalue = (255U * (colors - 1 - gray)) / - (colors - 1); - img.setColor(gray, tqRgb(grayvalue, grayvalue, grayvalue)); - } - } - - const unsigned int bits_per_scan_line = width * depth; - unsigned int bytes_per_scan_line = bits_per_scan_line / 8; - if (bits_per_scan_line % 8) bytes_per_scan_line++; - const unsigned int bindatabytes = height * bytes_per_scan_line; - TQMemArray bindata(bindatabytes); - - for (unsigned int i = 0; i < bindatabytes; i++) { - if (offset >= previewsize) - return false; - - while (!isxdigit(previewstr[offset].latin1()) && - offset < previewsize) - offset++; - - bool ok = false; - bindata[i] = static_cast(previewstr.mid(offset, 2).toUInt(&ok, 16)); - if (!ok) - return false; - - offset += 2; - } - - for (int scanline = 0; scanline < height; scanline++) { - unsigned char *scanlineptr = img.scanLine(scanline); - - for (int pixelindex = 0; pixelindex < width; pixelindex++) { - unsigned char pixelvalue = 0; - const unsigned int bitoffset = - scanline * bytes_per_scan_line * 8U + pixelindex * depth; - for (int depthindex = 0; depthindex < depth; - depthindex++) { - const unsigned int byteindex = (bitoffset + depthindex) / 8U; - const unsigned int bitindex = - 7 - ((bitoffset + depthindex) % 8U); - const unsigned char bitvalue = - (bindata[byteindex] & static_cast(1U << bitindex)) >> bitindex; - pixelvalue |= (bitvalue << depthindex); - } - scanlineptr[pixelindex] = pixelvalue; - } - } - - outimg = img.convertDepth(32).smoothScale(imgwidth, imgheight); - - return true; -} diff --git a/kfile-plugins/ps/gscreator.h b/kfile-plugins/ps/gscreator.h deleted file mode 100644 index 7139b233..00000000 --- a/kfile-plugins/ps/gscreator.h +++ /dev/null @@ -1,42 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2000 Malte Starostik - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef _GSCREATOR_H_ -#define _GSCREATOR_H_ - -#include -#include "dscparse_adapter.h" - -class GSCreator : public ThumbCreator, public KDSCCommentHandler -{ -public: - GSCreator() {}; - virtual bool create(const TQString &path, int, int, TQImage &img); - virtual Flags flags() const; - void comment(Name name); - -private: - static bool getEPSIPreview(const TQString &path, - long start, long end, - TQImage &outimg, - int imgwidth, int imgheight); - bool endComments; -}; - -#endif diff --git a/kfile-plugins/ps/gsthumbnail.desktop b/kfile-plugins/ps/gsthumbnail.desktop deleted file mode 100644 index 903f3447..00000000 --- a/kfile-plugins/ps/gsthumbnail.desktop +++ /dev/null @@ -1,60 +0,0 @@ -[Desktop Entry] -Type=Service -Name=PostScript, PDF and DVI Files -Name[ar]=ملفات الــ PostScript ، PDF و DVI -Name[br]=Restroù PostScript, PDF ha DVI -Name[bs]=Postscript, PDF i DVI datoteke -Name[ca]=Fitxers PostScript, PDF i DVI -Name[cs]=Postscriptové, PDF a DVI soubory -Name[cy]=Ffeiliau PostScript, PDF a DVI -Name[da]=PostScript, PDF- og DVI-filer -Name[de]=PostScript-, PDF- und DVI-Dateien -Name[el]=Αρχεία PostScript, PDF και DVI -Name[eo]=Postskriptaj, PDF- kaj DVI-dosieroj -Name[es]=Archivos PostScript, PDF y DVI -Name[et]=PostScript-, PDF- ja DVI-failid -Name[eu]=PostScript, PDF eta DVI fitxategiak -Name[fa]=پرونده‌های PostScript، PDF و DVI -Name[fi]=PostScript-, PDF- ja DVI-tiedostot -Name[fr]=Fichiers PostScript, PDF et DVI -Name[ga]=Comhaid PostScript, PDF agus DVI -Name[gl]=Ficheiros PostScript, PDF e DVI -Name[he]=קבצי PostScript, PDF ו־DVI -Name[hu]=PostScript-, PDF- és DVI-fájlok -Name[is]=PostScript PDF og DVI skrár -Name[it]=File PostScript, PDF e DVI -Name[ja]=Postscript,PDF,DVIファイル -Name[kk]=PostScript, PDF және DVI файлдары -Name[km]=ឯកសារ PostScript, PDF និង DVI -Name[lt]=Postscript, PDF ir DVI bylos -Name[ms]=PostScript, PDF dan Fail DVI -Name[nb]=PostScript, PDF og DVI filer -Name[nds]=PostScript-, PDF- un DVI-Dateien -Name[ne]=पोष्टस्क्रिप्ट, PDF र DVI फाइल -Name[nl]=PostScript-, DVI- en PDF-bestanden -Name[nn]=PostScript-, PDF- og DVI-filer -Name[pl]=Pliki PostScript, PDF i DVI -Name[pt]=Ficheiros PostScript, PDF e DVI -Name[pt_BR]=Arquivos PostScript, PDF e DVI -Name[ro]=Fişiere PostScript, PDF şi DVI -Name[ru]=Файлы PostScript, PDF и DVI -Name[se]=PostScript-, PDF- ja DVI-fiillat -Name[sk]=PostScript, PDF a DVI súbory -Name[sl]=Datoteke PostScript, PDF in DVI -Name[sr]=PostScript, PDF и DVI фајлови -Name[sr@Latn]=PostScript, PDF i DVI fajlovi -Name[sv]=Postscript, PDF och DVI-filer -Name[ta]= போஸ்ட்கிரிப்ட், பிடிஃப் மற்றும் டிவிஐ கோப்புகள் -Name[tg]=Файлҳои PostScript, PDF ва DVI -Name[th]=แฟ้ม PDF, DVI และ โพสต์สคริปต์ -Name[tr]=PostScript, PDF ve DVI Dosyaları -Name[uk]=Файли PostScript, PDF та DVI -Name[uz]=PostScript, PDF va DVI fayllari -Name[uz@cyrillic]=PostScript, PDF ва DVI файллари -Name[zh_CN]=PostScript、PDF 和 DVI 文件 -Name[zh_HK]=PostScript 、PDF 及 DVI 檔案 -Name[zh_TW]=PostScript,PDF 與 DVI 檔 -ServiceTypes=ThumbCreator -MimeTypes=application/x-dvi,application/postscript,application/pdf,image/x-eps -X-TDE-Library=gsthumbnail -CacheThumbnail=true diff --git a/kfile-plugins/ps/kfile_ps.cpp b/kfile-plugins/ps/kfile_ps.cpp deleted file mode 100644 index 01136d88..00000000 --- a/kfile-plugins/ps/kfile_ps.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Wilco Greven - * - * 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 "kfile_ps.h" - -#include - -#include -#include -#include - -typedef KGenericFactory PSFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_ps, PSFactory("kfile_ps")) - -KPSPlugin::KPSPlugin(TQObject *parent, const char *name, - const TQStringList &preferredItems) : - KFilePlugin( parent, name, preferredItems ) -{ - kdDebug(7034) << "ps plugin\n"; - - // set up our mimetypes - makeMimeTypeInfo( "application/postscript" ); - makeMimeTypeInfo( "image/x-eps" ); -} - -void KPSPlugin::makeMimeTypeInfo( const char* mimeType ) -{ - KFileMimeTypeInfo* info = addMimeTypeInfo( mimeType ); - - // general group - KFileMimeTypeInfo::GroupInfo* group = addGroupInfo(info, "General", i18n("General")); - addItemInfo(group, "Title", i18n("Title"), TQVariant::String); - addItemInfo(group, "Creator", i18n("Creator"), TQVariant::String); - addItemInfo(group, "CreationDate", i18n("Creation Date"), TQVariant::String); - addItemInfo(group, "For", i18n("For"), TQVariant::String); - addItemInfo(group, "Pages", i18n("Pages"), TQVariant::UInt); -} - -bool KPSPlugin::readInfo( KFileMetaInfo& info, uint /* what */) -{ - _info = info; - _group = appendGroup(info, "General"); - _endComments = false; - _setData = 0; - - _dsc = new KDSC; - _dsc->setCommentHandler( this ); - FILE* fp = fopen( TQFile::encodeName( info.path() ), "r" ); - if( fp == 0 ) - return false; - - char buf[4096]; - int count; - while( ( count = fread( buf, sizeof(char), sizeof( buf ), fp ) ) ) { - if ( !_dsc->scanData( buf, count ) ) break; - if ( _endComments || _setData == 5 ) break; // Change if new item scanned - } - fclose( fp ); - delete _dsc; - _dsc = 0; - - return _setData > 0; -} - -void KPSPlugin::comment( Name name ) -{ - switch( name ) - { - case Title: - appendItem(_group, "Title", _dsc->dsc_title()); - ++_setData; - break; - case Creator: - appendItem(_group, "Creator", _dsc->dsc_creator()); - ++_setData; - break; - case CreationDate: - appendItem(_group, "CreationDate", _dsc->dsc_date()); - ++_setData; - break; - case For: - appendItem(_group, "For", _dsc->dsc_for()); - ++_setData; - break; - case Pages: { - int pages = _dsc->page_pages(); - if (pages) - { - appendItem(_group, "Pages", pages); - ++_setData; - } - } - break; - - // Right now we watch for 5 elements: - // Title, Creator, CreationDate, For, Pages - // - // If you add another one(s), please update the 5 in "_setData == 5" above - // - case EndComments: _endComments = true; - default: ; // Ignore - } -} - -#include "kfile_ps.moc" - diff --git a/kfile-plugins/ps/kfile_ps.desktop b/kfile-plugins/ps/kfile_ps.desktop deleted file mode 100644 index 9c23026d..00000000 --- a/kfile-plugins/ps/kfile_ps.desktop +++ /dev/null @@ -1,66 +0,0 @@ -[Desktop Entry] -Type=Service -Name=PostScript Info -Name[af]=Postscript Inligting -Name[ar]=معلومات PostScript -Name[br]=Procinfo PostScript -Name[ca]=Informació de PostScript -Name[cs]=PostScript info -Name[cy]=Gwybodaeth PostScript -Name[da]=PostScript-info -Name[de]=PostScript-Info -Name[el]=Πληροφορίες PostScript -Name[eo]=Postskriptinformo -Name[es]=Info PostScript -Name[et]=PostScript info -Name[fa]=اطلاعات PostScript -Name[fi]=PostScript-tiedot -Name[fr]=Informations PostScript -Name[gl]=Inf. PostScript -Name[he]=מידע PostScript -Name[hi]=पोस्टस्क्रिप्ट जानकारी -Name[hr]=Postscript informacije -Name[hu]=PostScript-jellemzők -Name[is]=PostScript upplýsingar -Name[it]=Informazioni PostScript -Name[ja]=PostScript 情報 -Name[kk]=PostScript мәліметі -Name[km]=ព័ត៌មាន PostScript -Name[lt]=PostScript informacija -Name[lv]=Postscript Info -Name[ms]=Maklumat PostScript -Name[nb]=PostScript-info -Name[nds]=PostScript-Info -Name[ne]=पोष्टस्क्रिप्ट सूचना -Name[nl]=PostScript-info -Name[nn]=PostScript-info -Name[nso]=Tshedimoso ya PostScript -Name[pa]=PostScript ਜਾਣਕਾਰੀ -Name[pl]=Informacja o pliku PostScriptu -Name[pt]=Informação do PostScript -Name[pt_BR]=Informação sobre PostScript -Name[ro]=Informaţii PostScript -Name[ru]=Информация о PostScript -Name[se]=PostScript-dieđut -Name[sl]=Podatki o PostScriptu -Name[sr]=PostScript информације -Name[sr@Latn]=PostScript informacije -Name[sv]=Postscript-information -Name[ta]=முன் எழுத்தாக்க தகவல் -Name[tg]=Иттилоот оиди PostScript -Name[th]=ข้อมูลโพสต์สคริปต์ -Name[tr]=PostScript Bilgisi -Name[uk]=Інформація про PostScript -Name[uz]=PostScript haqida maʼlumot -Name[uz@cyrillic]=PostScript ҳақида маълумот -Name[ven]=Mafhungo a mabammbiri a poso -Name[wa]=Informåcion sol documint PostScript -Name[xh]=Ulwazi Lwe PostScript -Name[zh_CN]=PostScript 信息 -Name[zh_HK]=PostScript 資訊 -Name[zh_TW]=PostScript 資訊 -Name[zu]=Ulwazi Lwesi-PostScript -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_ps -MimeType=application/postscript;image/x-eps -PreferredItems=Title,Creator,CreationDate,For,Pages diff --git a/kfile-plugins/ps/kfile_ps.h b/kfile-plugins/ps/kfile_ps.h deleted file mode 100644 index a1d3ebee..00000000 --- a/kfile-plugins/ps/kfile_ps.h +++ /dev/null @@ -1,51 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Wilco Greven - * - * 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_PS_H__ -#define __KFILE_PS_H__ - -#include - -#include "dscparse_adapter.h" - -class TQStringList; - -class KPSPlugin: public KFilePlugin, public KDSCCommentHandler -{ - Q_OBJECT - -public: - KPSPlugin( TQObject *parent, const char *name, - const TQStringList& preferredItems ); - - virtual bool readInfo( KFileMetaInfo& info, uint what); - - void comment( Name ); - void makeMimeTypeInfo( const char* mimeType ); - -private: - KFileMetaInfo _info; - KFileMetaInfoGroup _group; - KDSC* _dsc; - bool _endComments; - int _setData; -}; - -#endif diff --git a/kfile-plugins/raw/CMakeLists.txt b/kfile-plugins/raw/CMakeLists.txt deleted file mode 100644 index 9f7aa544..00000000 --- a/kfile-plugins/raw/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -################################################# -# -# (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 kfile_raw.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - - -#### kfile_raw (module) ######################### - -tde_add_kpart( kfile_raw AUTOMOC - SOURCES kcamerarawplugin.cpp parse.c - LINK kio-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kfile-plugins/raw/Makefile.am b/kfile-plugins/raw/Makefile.am deleted file mode 100644 index c68309bc..00000000 --- a/kfile-plugins/raw/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -## Makefile.am for the raw thumbnail extration plugin - -# set the include path for X, qt and KDE -INCLUDES = $(all_includes) - -# these are the headers for your project -noinst_HEADERS = kcamerarawplugin.h - -kde_module_LTLIBRARIES = kfile_raw.la - -kfile_raw_la_SOURCES = kcamerarawplugin.cpp parse.c -kfile_raw_la_LIBADD = $(LIB_KIO) -kfile_raw_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -services_DATA = kfile_raw.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/raw/kcamerarawplugin.cpp b/kfile-plugins/raw/kcamerarawplugin.cpp deleted file mode 100644 index 8a0b0ce8..00000000 --- a/kfile-plugins/raw/kcamerarawplugin.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) Steffen Hansen - * - * 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 "kcamerarawplugin.h" - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -typedef KGenericFactory RawFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_raw, RawFactory("kfile_raw")) - -#ifndef KDE_EXPORT -# define KDE_EXPORT -#endif - -/* Main entry point into raw parser */ -extern "C" { - int extract_thumbnail( FILE*, FILE*, int* ); - extern char make[]; - extern char model[]; -} - -bool KCameraRawPlugin::createPreview(const TQString &path, TQImage &img) -{ - /* Open file and extract thumbnail */ - FILE* input = fopen( TQFile::encodeName(path), "rb" ); - if( !input ) return false; - KTempFile output; - output.setAutoDelete(true); - int orientation = 0; - if( extract_thumbnail( input, output.fstream(), &orientation ) ) { - fclose(input); - return false; - } - fclose(input); - output.close(); - if( !img.load( output.name() ) ) return false; - - if(orientation) { - TQWMatrix M; - TQWMatrix flip= TQWMatrix(-1,0,0,1,0,0); - switch(orientation+1) { // notice intentional fallthroughs - case 2: M = flip; break; - case 4: M = flip; - case 3: M.rotate(180); break; - case 5: M = flip; - case 6: M.rotate(90); break; - case 7: M = flip; - case 8: M.rotate(270); break; - default: break; // should never happen - } - img = img.xForm(M); - } - return true; -} - -KCameraRawPlugin::KCameraRawPlugin(TQObject *parent, const char *name, - const TQStringList &args ) - : KFilePlugin(parent, name, args) -{ - kdDebug(7034) << "KCameraRawPlugin c'tor" << endl; - - // - // define all possible meta info items - // - KFileMimeTypeInfo *info = addMimeTypeInfo("image/x-raw"); - KFileMimeTypeInfo::GroupInfo *group = addGroupInfo( info, "Info", - i18n("Image Info") ); - KFileMimeTypeInfo::ItemInfo* item; - - item = addItemInfo( group, "Manufacturer", i18n("Camera Manufacturer"), - TQVariant::String ); - item = addItemInfo( group, "Model", i18n("Camera Model"), - TQVariant::String ); - item = addItemInfo( group, "Thumbnail", i18n("Thumbnail"), - TQVariant::Image ); - setHint( item, KFileMimeTypeInfo::Thumbnail ); -} - -bool KCameraRawPlugin::readInfo( KFileMetaInfo& info, uint what ) -{ - kdDebug(7034) << "KCameraRawPlugin::readInfo()" << endl; - - const TQString path( info.path() ); - if ( path.isEmpty() ) // remote file - return false; - - KFileMetaInfoGroup group = appendGroup( info, "Info" ); - if ( what & KFileMetaInfo::Thumbnail ){ - TQImage img; - if( createPreview( path,img ) ) { - appendItem( group, "Thumbnail", img ); - kdDebug(7034) << "thumbnail " << path << " created" << endl; - } - } else { - // HACK: We have to extract thumbnail to get any info... - TQImage img; - createPreview( path,img ); - } - kdDebug(7034) << "make=" << make << endl; - kdDebug(7034) << "model=" << model << endl; - if( make[0] ) { - appendItem( group, "Manufacturer", &make[0] ); - } - if( model[0] ) { - appendItem( group, "Model", &model[0] ); - } - - return true; -} - -#include "kcamerarawplugin.moc" diff --git a/kfile-plugins/raw/kcamerarawplugin.h b/kfile-plugins/raw/kcamerarawplugin.h deleted file mode 100644 index c1a172ae..00000000 --- a/kfile-plugins/raw/kcamerarawplugin.h +++ /dev/null @@ -1,39 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2005 Steffen Hansen - * - * 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 KCAMERARAWPLUGIN_H -#define KCAMERARAWPLUGIN_H - -#include - -class TQImage; - -class KCameraRawPlugin: public KFilePlugin { - Q_OBJECT - - -public: - KCameraRawPlugin(TQObject *parent, const char *name, const TQStringList& args); - virtual bool readInfo(KFileMetaInfo& info, uint what); - -private: - bool createPreview(const TQString &path, TQImage &img); -}; - -#endif /* KCAMERARAWPLUGIN_H */ diff --git a/kfile-plugins/raw/kfile_raw.desktop b/kfile-plugins/raw/kfile_raw.desktop deleted file mode 100644 index e56cc4f0..00000000 --- a/kfile-plugins/raw/kfile_raw.desktop +++ /dev/null @@ -1,53 +0,0 @@ -[Desktop Entry] -Type=Service -Name=RAW Camera Files -Name[br]=Restroù kamera kriz -Name[bs]=RAW kamera datoteke -Name[ca]=Fitxers RAW de càmera -Name[cs]=RAW soubory -Name[da]=RAW kamera-filer -Name[de]=RAW Kamera-Dateien -Name[el]=RAW αρχείο κάμερας -Name[es]=Archivos RAW de cámara -Name[et]=Toored kaamerafailid -Name[eu]=RAW kamera-fitxategiak -Name[fa]=پرونده‌های خام دوربین -Name[fi]=RAW-kuvatiedostot -Name[fr]=Fichiers RAW d'appareil photo numérique -Name[ga]=Comhaid Cheamara RAW -Name[gl]=Ficheiros RAW de Cámara -Name[he]=קבצי מצלמה דיגיטלית גולמיים -Name[hu]=RAW-fájlok -Name[is]=RAW myndavélaskrár -Name[it]=File grezzi fotocamera digitale -Name[ja]=RAW カメラファイル -Name[kk]=Камераның RAW пішімдегі файлдары -Name[km]=ឯកសារ​ចេញ​ពី​ម៉ាស៊ីន​ថត​រូប -Name[lt]=RAW fotoaparato bylos -Name[nb]=RAW-kamerafiler -Name[nds]=RAW-Kameradateien -Name[ne]=RAW क्यामेरा फाइल -Name[nl]=Rauwe camerabestanden -Name[nn]=RAW-kamerafiler -Name[pa]=RAW ਕੈਮਰਾ ਫਾਇਲਾਂ -Name[pl]=Pliki RAW z aparatów cyfrowych -Name[pt]=Ficheiros de Máquina Fotográfica Digital RAW -Name[pt_BR]=Arquivos de Câmeras -Name[ro]=Fişiere foto brute -Name[ru]=Необработанные Файлы с цифровой камеры (RAW) -Name[sk]=RAW súbory digitálneho fotoaparátu -Name[sl]=Surove datoteke s fotoaparata -Name[sr]=RAW фајлови слика -Name[sr@Latn]=RAW fajlovi slika -Name[sv]=Obehandlade kamerafiler -Name[th]=แฟ้มภาพ RAW จากกล้อง -Name[tr]=RAW Kamera Dosyaları -Name[uk]=Файли цифрової камери RAW -Name[zh_CN]=RAW 相机文件 -Name[zh_HK]=RAW 相機檔案 -Name[zh_TW]=原始相機檔 -ServiceTypes=KFilePlugin -MimeType=image/x-raw -X-TDE-Library=kfile_raw -CacheThumbnail=false -SupportsThumbnail=true diff --git a/kfile-plugins/raw/parse.c b/kfile-plugins/raw/parse.c deleted file mode 100644 index a256f04e..00000000 --- a/kfile-plugins/raw/parse.c +++ /dev/null @@ -1,1080 +0,0 @@ -/* - Raw Photo Parser - Copyright 2004 by Dave Coffin, dcoffin a cybercom o net - - This program extracts thumbnail images (preferably JPEGs) - from any raw digital camera formats that have them, and - shows table contents. - - $Revision: 1.36 $ - $Date: 2005/05/10 21:43:10 $ - */ - -/* Hacked for thumbnail extraction in KDE by - Steffen Hansen - - Based on parse.c and parts of dcraw.c by Dave Coffin -*/ - -#include -#include -#include -#include -#include -#include - -#ifdef WIN32 -#include -typedef __int64 INT64; -#else -#include -typedef long long INT64; -#endif - -/* - TIFF and CIFF data blocks can be quite large. - Display only the first DLEN bytes. - */ -#ifndef DLEN -#define DLEN 768 -#endif - -typedef unsigned char uchar; -/*typedef unsigned short ushort;*/ - -FILE *ifp; -short order; -char *fname; -char make[128], model[128], model2[128], thumb_head[128]; -int width, height, offset, length, bps, is_dng; -int thumb_offset, thumb_length, thumb_layers; -float cam_mul[4], pre_mul[4], coeff[3][4]; -#define camera_red cam_mul[0] -#define camera_blue cam_mul[2] -/*float flash_used, canon_5814;*/ -time_t timestamp; -/*int data_offset, meta_offset*/ -int raw_height, raw_width, top_margin, left_margin; -static int flip = 0; - -struct decode { - struct decode *branch[2]; - int leaf; -} first_decode[640], *free_decode; - -#define CLASS - -#define FORC3 for (c=0; c < 3; c++) -#define FORC4 for (c=0; c < 4; c++) -#define FORCC for (c=0; c < colors; c++) - -/* - Get a 2-byte integer, making no assumptions about CPU byte order. - Nor should we assume that the compiler evaluates left-to-right. - */ -ushort get2() -{ - uchar a, b; - - a = fgetc(ifp); b = fgetc(ifp); - - if (order == 0x4949) /* "II" means little-endian */ - return a | b << 8; - else /* "MM" means big-endian */ - return a << 8 | b; -} - -/* - Same for a 4-byte integer. - */ -int get4() -{ - uchar a, b, c, d; - - a = fgetc(ifp); b = fgetc(ifp); - c = fgetc(ifp); d = fgetc(ifp); - - if (order == 0x4949) - return a | b << 8 | c << 16 | d << 24; - else - return a << 24 | b << 16 | c << 8 | d; -} - -void tiff_dump(int base, int tag, int type, int count, int level) -{ - int save, j, num, den; - uchar c; - int size[] = { 1,1,1,2,4,8,1,1,2,4,8,4,8 }; - - if (count * size[type < 13 ? type:0] > 4) - fseek (ifp, get4()+base, SEEK_SET); - save = ftell(ifp); - fseek (ifp, save, SEEK_SET); -} - -void nikon_decrypt (uchar ci, uchar cj, int tag, int i, int size, uchar *buf) -{ -} - -int parse_tiff_ifd (int base, int level); - -void nef_parse_makernote (base) -{ - int offset=0, entries, tag, type, count, val, save; - unsigned serial=0, key=0; - uchar buf91[630], buf97[608], buf98[31]; - short sorder; - char buf[10]; - -/* - The MakerNote might have its own TIFF header (possibly with - its own byte-order!), or it might just be a table. - */ - sorder = order; - fread (buf, 1, 10, ifp); - if (!strcmp (buf,"Nikon")) { /* starts with "Nikon\0\2\0\0\0" ? */ - base = ftell(ifp); - order = get2(); /* might differ from file-wide byteorder */ - val = get2(); /* should be 42 decimal */ - offset = get4(); - fseek (ifp, offset-8, SEEK_CUR); - } else if (!strncmp (buf,"FUJIFILM",8) || - !strcmp (buf,"Panasonic")) { - order = 0x4949; - fseek (ifp, 2, SEEK_CUR); - } else if (!strcmp (buf,"OLYMP") || - !strcmp (buf,"LEICA") || - !strcmp (buf,"EPSON")) - fseek (ifp, -2, SEEK_CUR); - else if (!strcmp (buf,"AOC")) - fseek (ifp, -4, SEEK_CUR); - else - fseek (ifp, -10, SEEK_CUR); - - entries = get2(); - if (entries > 100) return; - while (entries--) { - save = ftell(ifp); - tag = get2(); - type = get2(); - count= get4(); - tiff_dump (base, tag, type, count, 2); - if (tag == 0x1d) - fscanf (ifp, "%d", &serial); - if (tag == 0x91) - fread (buf91, sizeof buf91, 1, ifp); - if (tag == 0x97) - fread (buf97, sizeof buf97, 1, ifp); - if (tag == 0x98) - fread (buf98, sizeof buf98, 1, ifp); - if (tag == 0xa7) - key = fgetc(ifp)^fgetc(ifp)^fgetc(ifp)^fgetc(ifp); - - if (tag == 0x100 && type == 7 && !strncmp(make,"OLYMPUS",7)) { - thumb_offset = ftell(ifp); - thumb_length = count; - } - if (tag == 0x280 && type == 1) { /* EPSON */ - strncpy (thumb_head, "\xff", sizeof(thumb_head) ); - thumb_offset = ftell(ifp)+1; - thumb_length = count-1; - } - if (strstr(make,"Minolta") || strstr(make,"MINOLTA")) { - switch (tag) { - case 0x81: - thumb_offset = ftell(ifp); - thumb_length = count; - break; - case 0x88: - thumb_offset = get4() + base; - break; - case 0x89: - thumb_length = get4(); - } - } - if (!strcmp (buf,"OLYMP") && tag >> 8 == 0x20) - parse_tiff_ifd (base, 3); - fseek (ifp, save+12, SEEK_SET); - } - nikon_decrypt (serial, key, 0x91, 4, sizeof buf91, buf91); - nikon_decrypt (serial, key, 0x97, 284, sizeof buf97, buf97); - nikon_decrypt (serial, key, 0x98, 4, sizeof buf98, buf98); - order = sorder; -} - -void nef_parse_exif(int base) -{ - int entries, tag, type, count, save; - - entries = get2(); - while (entries--) { - save = ftell(ifp); - tag = get2(); - type = get2(); - count= get4(); - tiff_dump (base, tag, type, count, 1); - if (tag == 0x927c) - nef_parse_makernote (base); - fseek (ifp, save+12, SEEK_SET); - } -} - -int parse_tiff_ifd (int base, int level) -{ - int entries, tag, type, count, slen, save, save2, val, i; - int comp=0; - static const int flip_map[] = { 0,1,3,2,4,6,7,5 }; - - entries = get2(); - if (entries > 255) return 1; - while (entries--) { - save = ftell(ifp); - tag = get2(); - type = get2(); - count= get4(); - slen = count; - if (slen > 128) slen = 128; - - tiff_dump (base, tag, type, count, level); - - save2 = ftell(ifp); - if (type == 3) /* short int */ - val = get2(); - else - val = get4(); - fseek (ifp, save2, SEEK_SET); - - if (tag > 50700 && tag < 50800) - is_dng = 1; - - if (level == 3) { /* Olympus E-1 and E-300 */ - if (type == 4) { - if (tag == 0x101) - thumb_offset = val; - else if (tag == 0x102) - thumb_length = val; - } - goto cont; - } - switch (tag) { - case 0x100: /* ImageWidth */ - if (!width) width = val; - break; - case 0x101: /* ImageHeight */ - if (!height) height = val; - break; - case 0x102: /* Bits per sample */ - if (bps) break; - bps = val; - if (count == 1) - thumb_layers = 1; - break; - case 0x103: /* Compression */ - comp = val; - break; - case 0x10f: /* Make tag */ - fgets (make, slen, ifp); - break; - case 0x110: /* Model tag */ - fgets (model, slen, ifp); - break; - case 33405: /* Model2 tag */ - fgets (model2, slen, ifp); - break; - case 0x111: /* StripOffset */ - if (!offset || is_dng) offset = val; - break; - case 0x112: /* Qt::Orientation */ - flip = flip_map[(val-1) & 7]; - break; - case 0x117: /* StripByteCounts */ - if (!length || is_dng) length = val; - if (offset > val && !strncmp(make,"KODAK",5) && !is_dng) - offset -= val; - break; - case 0x14a: /* SubIFD tag */ - save2 = ftell(ifp); - for (i=0; i < count; i++) { - fseek (ifp, save2 + i*4, SEEK_SET); - fseek (ifp, get4()+base, SEEK_SET); - parse_tiff_ifd (base, level+1); - } - break; - case 0x201: - if (strncmp(make,"OLYMPUS",7) || !thumb_offset) - thumb_offset = val; - break; - case 0x202: - if (strncmp(make,"OLYMPUS",7) || !thumb_length) - thumb_length = val; - break; - case 34665: - fseek (ifp, get4()+base, SEEK_SET); - nef_parse_exif (base); - break; - case 50706: - is_dng = 1; - } -cont: - fseek (ifp, save+12, SEEK_SET); - } - if ((comp == 6 && !strcmp(make,"Canon")) || - (comp == 7 && is_dng)) { - thumb_offset = offset; - thumb_length = length; - } - return 0; -} - -/* - Parse a TIFF file looking for camera model and decompress offsets. - */ -void parse_tiff (int base) -{ - int doff, spp=3, ifd=0; - - width = height = offset = length = bps = is_dng = 0; - fseek (ifp, base, SEEK_SET); - order = get2(); - if (order != 0x4949 && order != 0x4d4d) return; - get2(); - while ((doff = get4())) { - fseek (ifp, doff+base, SEEK_SET); - printf ("IFD #%d:\n", ifd++); - if (parse_tiff_ifd (base, 0)) break; - } - if (is_dng) return; - - if (strncmp(make,"KODAK",5)) - thumb_layers = 0; - if (!strncmp(make,"Kodak",5)) { - fseek (ifp, 12+base, SEEK_SET); - puts ("\nSpecial Kodak image directory:"); - parse_tiff_ifd (base, 0); - } - if (!strncmp(model,"DCS460A",7)) { - spp = 1; - thumb_layers = 0; - } - if (!thumb_length && offset) { - thumb_offset = offset; - sprintf (thumb_head, "P%d %d %d %d\n", - spp > 1 ? 6:5, width, height, (1 << bps) - 1); - thumb_length = width * height * spp * ((bps+7)/8); - } -} - -void parse_minolta() -{ - int data_offset, save, tag, len; - - fseek (ifp, 4, SEEK_SET); - data_offset = get4() + 8; - while ((save=ftell(ifp)) < data_offset) { - tag = get4(); - len = get4(); - printf ("Tag %c%c%c offset %06x length %06x\n", - tag>>16, tag>>8, tag, save, len); - switch (tag) { - case 0x545457: /* TTW */ - parse_tiff (ftell(ifp)); - } - fseek (ifp, save+len+8, SEEK_SET); - } - strncpy (thumb_head, "\xff", sizeof(thumb_head) ); - thumb_offset++; - thumb_length--; -} - -/* - Parse a CIFF file, better known as Canon CRW format. - */ -void parse_ciff (int offset, int length, int level /*unused*/) -{ - int tboff, nrecs, i, c, type, len, roff, aoff, save, wbi=-1; - static const int remap[] = { 1,2,3,4,5,1 }; - static const int remap_10d[] = { 0,1,3,4,5,6,0,0,2,8 }; - static const int remap_s70[] = { 0,1,2,9,4,3,6,7,8,9,10,0,0,0,7,0,0,8 }; - ushort key[] = { 0x410, 0x45f3 }; - - if (strcmp(model,"Canon PowerShot G6") && - strcmp(model,"Canon PowerShot S60") && - strcmp(model,"Canon PowerShot S70") && - strcmp(model,"Canon PowerShot Pro1")) - key[0] = key[1] = 0; - fseek (ifp, offset+length-4, SEEK_SET); - tboff = get4() + offset; - fseek (ifp, tboff, SEEK_SET); - nrecs = get2(); - if (nrecs > 100) return; - for (i = 0; i < nrecs; i++) { - type = get2(); - len = get4(); - roff = get4(); - aoff = offset + roff; - save = ftell(ifp); - if (type == 0x080a) { /* Get the camera make and model */ - fseek (ifp, aoff, SEEK_SET); - fread (make, 64, 1, ifp); - fseek (ifp, aoff+strlen(make)+1, SEEK_SET); - fread (model, 64, 1, ifp); - } - if (type == 0x102a) { /* Find the White Balance index */ - fseek (ifp, aoff+14, SEEK_SET); /* 0=auto, 1=daylight, 2=cloudy ... */ - wbi = get2(); - if (((!strcmp(model,"Canon EOS DIGITAL REBEL") || - !strcmp(model,"Canon EOS 300D DIGITAL"))) && wbi == 6) - wbi++; - } - if (type == 0x102c) { /* Get white balance (G2) */ - if (!strcmp(model,"Canon PowerShot G1") || - !strcmp(model,"Canon PowerShot Pro90 IS")) { - fseek (ifp, aoff+120, SEEK_SET); - FORC4 cam_mul[c ^ 2] = get2(); - } else { - fseek (ifp, aoff+100, SEEK_SET); - goto common; - } - } - if (type == 0x0032) { /* Get white balance (D30 & G3) */ - if (!strcmp(model,"Canon EOS D30")) { - fseek (ifp, aoff+72, SEEK_SET); -common: - camera_red = get2() ^ key[0]; - camera_red =(get2() ^ key[1]) / camera_red; - camera_blue = get2() ^ key[0]; - camera_blue /= get2() ^ key[1]; - } else if (!strcmp(model,"Canon PowerShot G6") || - !strcmp(model,"Canon PowerShot S60") || - !strcmp(model,"Canon PowerShot S70")) { - fseek (ifp, aoff+96 + remap_s70[wbi]*8, SEEK_SET); - goto common; - } else if (!strcmp(model,"Canon PowerShot Pro1")) { - fseek (ifp, aoff+96 + wbi*8, SEEK_SET); - goto common; - } else { - fseek (ifp, aoff+80 + (wbi < 6 ? remap[wbi]*8 : 0), SEEK_SET); - if (!camera_red) - goto common; - } - } - if (type == 0x10a9) { /* Get white balance (D60) */ - if (!strcmp(model,"Canon EOS 10D")) - wbi = remap_10d[wbi]; - fseek (ifp, aoff+2 + wbi*8, SEEK_SET); - camera_red = get2(); - camera_red /= get2(); - camera_blue = get2(); - camera_blue = get2() / camera_blue; - } - /* Skip this for now /steffen */ -#if 0 - if (type == 0x1030 && (wbi == 6 || wbi == 15)) { - fseek (ifp, aoff, SEEK_SET); /* Get white sample */ - ciff_block_1030(); - } -#endif - if (type == 0x1031) { /* Get the raw width and height */ - fseek (ifp, aoff+2, SEEK_SET); - raw_width = get2(); - raw_height = get2(); - } - if (type == 0x180e) { /* Get the timestamp */ - fseek (ifp, aoff, SEEK_SET); - timestamp = get4(); - } - if (type == 0x580e) - timestamp = len; -#if 0 - if (type == 0x5813) - flash_used = *((float *) &len); - if (type == 0x5814) - canon_5814 = *((float *) &len); -#endif - if (type == 0x1810) { /* Get the rotation */ - fseek (ifp, aoff+12, SEEK_SET); - flip = get4(); - } - /* Skip this for now /steffen */ -#if 0 - if (type == 0x1835) { /* Get the decoder table */ - fseek (ifp, aoff, SEEK_SET); - crw_init_tables (get4()); - } -#endif - if (type == 0x2007) { /* Found the JPEG thumbnail */ - thumb_offset = aoff; - thumb_length = len; - } - if (type >> 8 == 0x28 || type >> 8 == 0x30) /* Get sub-tables */ - parse_ciff(aoff, len, level+1); - fseek (ifp, save, SEEK_SET); - } - if (wbi == 0 && !strcmp(model,"Canon EOS D30")) - camera_red = -1; /* Use my auto WB for this photo */ -} - - -void parse_mos(int level) -{ - uchar data[256]; - int i, j, skip, save; - char *cp; - - save = ftell(ifp); - while (1) { - fread (data, 1, 8, ifp); - if (strcmp(data,"PKTS")) break; - strcpy (model, "Valeo"); - fread (data, 1, 40, ifp); - skip = get4(); - if (!strcmp(data,"icc_camera_to_tone_matrix")) { - for (i=0; i < skip/4; i++) { - j = get4(); - } - continue; - } - if (!strcmp(data,"JPEG_preview_data")) { - thumb_head[0] = 0; - thumb_offset = ftell(ifp); - thumb_length = skip; - } - fread (data, 1, sizeof data, ifp); - fseek (ifp, -sizeof data, SEEK_CUR); - data[sizeof data - 1] = 0; - while ((cp=index(data,'\n'))) - *cp = ' '; - parse_mos(level+2); - fseek (ifp, skip, SEEK_CUR); - } - fseek (ifp, save, SEEK_SET); -} - -void parse_rollei() -{ - char line[128], *val; - - fseek (ifp, 0, SEEK_SET); - do { - fgets (line, 128, ifp); - fputs (line, stdout); - if ((val = strchr(line,'='))) - *val++ = 0; - else - val = line + strlen(line); - if (!strcmp(line,"HDR")) - thumb_offset = atoi(val); - if (!strcmp(line,"TX ")) - width = atoi(val); - if (!strcmp(line,"TY ")) - height = atoi(val); - } while (strncmp(line,"EOHD",4)); - strcpy (make, "Rollei"); - strcpy (model, "d530flex"); - thumb_length = width*height*2; -} - -void rollei_decode (FILE *tfp) -{ - ushort data; - int row, col; - - fseek (ifp, thumb_offset, SEEK_SET); - fprintf (tfp, "P6\n%d %d\n255\n", width, height); - for (row=0; row < height; row++) - for (col=0; col < width; col++) { - fread (&data, 2, 1, ifp); - data = ntohs(data); - putc (data << 3, tfp); - putc (data >> 5 << 2, tfp); - putc (data >> 11 << 3, tfp); - } -} - -void get_utf8 (int offset, char *buf, int len) -{ - ushort c; - char *cp; - - fseek (ifp, offset, SEEK_SET); - for (cp=buf; (c = get2()) && cp+3 < buf+len; ) { - if (c < 0x80) - *cp++ = c; - else if (c < 0x800) { - *cp++ = 0xc0 + (c >> 6); - *cp++ = 0x80 + (c & 0x3f); - } else { - *cp++ = 0xe0 + (c >> 12); - *cp++ = 0x80 + (c >> 6 & 0x3f); - *cp++ = 0x80 + (c & 0x3f); - } - } - *cp = 0; -} - -ushort sget2 (uchar *s) -{ - return s[0] + (s[1]<<8); -} - -int sget4 (uchar *s) -{ - return s[0] + (s[1]<<8) + (s[2]<<16) + (s[3]<<24); -} - -void parse_foveon() -{ - int entries, img=0, off, len, tag, save, i, j, k, pent, poff[256][2]; - char name[128], value[128], camf[0x20000], *pos, *cp, *dp; - unsigned val, key, type, num, ndim, dim[3]; - - order = 0x4949; /* Little-endian */ - fseek (ifp, -4, SEEK_END); - fseek (ifp, get4(), SEEK_SET); - if (get4() != 0x64434553) { /* SECd */ - printf ("Bad Section identifier at %6x\n", (int)ftell(ifp)-4); - return; - } - get4(); - entries = get4(); - while (entries--) { - off = get4(); - len = get4(); - tag = get4(); - save = ftell(ifp); - fseek (ifp, off, SEEK_SET); - if (get4() != (0x20434553 | (tag << 24))) { - printf ("Bad Section identifier at %6x\n", off); - goto next; - } - val = get4(); - switch (tag) { - case 0x32414d49: /* IMA2 */ - case 0x47414d49: /* IMAG */ - if (++img == 2) { /* second image */ - thumb_offset = off; - thumb_length = 1; - } - printf ("type %d, " , get4()); - printf ("format %2d, " , get4()); - printf ("columns %4d, " , get4()); - printf ("rows %4d, " , get4()); - printf ("rowsize %d\n" , get4()); - break; - case 0x464d4143: /* CAMF */ - printf ("type %d, ", get4()); - get4(); - for (i=0; i < 4; i++) - putchar(fgetc(ifp)); - val = get4(); - printf (" version %d.%d:\n",val >> 16, val & 0xffff); - key = get4(); - if ((len -= 28) > 0x20000) - len = 0x20000; - fread (camf, 1, len, ifp); - for (i=0; i < len; i++) { - key = (key * 1597 + 51749) % 244944; - val = key * (INT64) 301593171 >> 24; - camf[i] ^= ((((key << 8) - val) >> 1) + val) >> 17; - } - for (pos=camf; (unsigned) (pos-camf) < len; pos += sget4(pos+8)) { - if (strncmp (pos, "CMb", 3)) { - printf("Bad CAMF tag \"%.4s\"\n", pos); - break; - } - val = sget4(pos+4); - printf (" %4.4s version %d.%d: ", pos, val >> 16, val & 0xffff); - switch (pos[3]) { - case 'M': - cp = pos + sget4(pos+16); - type = sget4(cp); - ndim = sget4(cp+4); - dim[0] = dim[1] = dim[2] = 1; - printf ("%d-dimensonal array %s of type %d:\n Key: (", - ndim, pos+sget4(pos+12), sget4(cp)); - dp = pos + sget4(cp+8); - for (i=ndim; i--; ) { - cp += 12; - dim[i] = sget4(cp); - printf ("%s %d%s", pos+sget4(cp+4), dim[i], i ? ", ":")\n"); - } - for (i=0; i < dim[2]; i++) { - for (j=0; j < dim[1]; j++) { - printf (" "); - for (k=0; k < dim[0]; k++) - switch (type) { - case 0: - case 6: - printf ("%7d", sget2(dp)); - dp += 2; - break; - case 1: - case 2: - printf (" %d", sget4(dp)); - dp += 4; - break; - case 3: { - union { int ival; float fval; } __t; - __t.ival = sget4(dp); - printf (" %9f", __t.fval); - dp += 4; - } - } - printf ("\n"); - } - printf ("\n"); - } - break; - case 'P': - val = sget4(pos+16); - num = sget4(pos+val); - printf ("%s, %d parameters:\n", pos+sget4(pos+12), num); - cp = pos+val+8 + num*8; - for (i=0; i < num; i++) { - val += 8; - printf (" %s = %s\n", cp+sget4(pos+val), cp+sget4(pos+val+4)); - } - break; - case 'T': - cp = pos + sget4(pos+16); - printf ("%s = %.*s\n", pos+sget4(pos+12), sget4(cp), cp+4); - break; - default: - printf ("\n"); - } - } - break; - case 0x504f5250: /* PROP */ - printf ("entries %d, ", pent=get4()); - printf ("charset %d, ", get4()); - get4(); - printf ("nchars %d\n", get4()); - off += pent*8 + 24; - if (pent > 256) pent=256; - for (i=0; i < pent*2; i++) - poff[0][i] = off + get4()*2; - for (i=0; i < pent; i++) { - get_utf8 (poff[i][0], name, 128); - get_utf8 (poff[i][1], value, 128); - printf (" %s = %s\n", name, value); - if (!strcmp (name,"CAMMANUF")) - strncpy (make, value, sizeof(make)); - if (!strcmp (name,"CAMMODEL")) - strncpy (model, value, sizeof(value)); - } - } -next: - fseek (ifp, save, SEEK_SET); - } -} - -void foveon_tree (unsigned huff[1024], unsigned code) -{ - struct decode *cur; - int i, len; - - cur = free_decode++; - if (code) { - for (i=0; i < 1024; i++) - if (huff[i] == code) { - cur->leaf = i; - return; - } - } - if ((len = code >> 27) > 26) return; - code = (len+1) << 27 | (code & 0x3ffffff) << 1; - - cur->branch[0] = free_decode; - foveon_tree (huff, code); - cur->branch[1] = free_decode; - foveon_tree (huff, code+1); -} - -void foveon_decode (FILE *tfp) -{ - int bwide, row, col, bit=-1, c, i; - char *buf; - struct decode *dindex; - short pred[3]; - unsigned huff[1024], bitbuf=0; - - fseek (ifp, thumb_offset+16, SEEK_SET); - width = get4(); - height = get4(); - bwide = get4(); - fprintf (tfp, "P6\n%d %d\n255\n", width, height); - if (bwide > 0) { - buf = malloc(bwide); - for (row=0; row < height; row++) { - fread (buf, 1, bwide, ifp); - fwrite (buf, 3, width, tfp); - } - free (buf); - return; - } - for (i=0; i < 256; i++) - huff[i] = get4(); - memset (first_decode, 0, sizeof first_decode); - free_decode = first_decode; - foveon_tree (huff, 0); - - for (row=0; row < height; row++) { - memset (pred, 0, sizeof pred); - if (!bit) get4(); - for (col=bit=0; col < width; col++) { - for (c=0; c < 3; c++) { - for (dindex=first_decode; dindex->branch[0]; ) { - if ((bit = (bit-1) & 31) == 31) - for (i=0; i < 4; i++) - bitbuf = (bitbuf << 8) + fgetc(ifp); - dindex = dindex->branch[bitbuf >> bit & 1]; - } - pred[c] += dindex->leaf; - fputc (pred[c], tfp); - } - } - } -} - -void kodak_yuv_decode (FILE *tfp) -{ - uchar c, blen[384]; - unsigned row, col, len, bits=0; - INT64 bitbuf=0; - int i, li=0, si, diff, six[6], y[4], cb=0, cr=0, rgb[3]; - ushort *out, *op; - - fseek (ifp, thumb_offset, SEEK_SET); - width = (width+1) & -2; - height = (height+1) & -2; - fprintf (tfp, "P6\n%d %d\n65535\n", width, height); - out = malloc (width * 12); - if (!out) { - fprintf (stderr, "kodak_yuv_decode() malloc failed!\n"); - exit(1); - } - - for (row=0; row < height; row+=2) { - for (col=0; col < width; col+=2) { - if ((col & 127) == 0) { - len = (width - col + 1) * 3 & -4; - if (len > 384) len = 384; - for (i=0; i < len; ) { - c = fgetc(ifp); - blen[i++] = c & 15; - blen[i++] = c >> 4; - } - li = bitbuf = bits = y[1] = y[3] = cb = cr = 0; - if (len % 8 == 4) { - bitbuf = fgetc(ifp) << 8; - bitbuf += fgetc(ifp); - bits = 16; - } - } - for (si=0; si < 6; si++) { - len = blen[li++]; - if (bits < len) { - for (i=0; i < 32; i+=8) - bitbuf += (INT64) fgetc(ifp) << (bits+(i^8)); - bits += 32; - } - diff = bitbuf & (0xffff >> (16-len)); - bitbuf >>= len; - bits -= len; - if ((diff & (1 << (len-1))) == 0) - diff -= (1 << len) - 1; - six[si] = diff; - } - y[0] = six[0] + y[1]; - y[1] = six[1] + y[0]; - y[2] = six[2] + y[3]; - y[3] = six[3] + y[2]; - cb += six[4]; - cr += six[5]; - for (i=0; i < 4; i++) { - op = out + ((i >> 1)*width + col+(i & 1)) * 3; - rgb[0] = y[i] + 1.40200/2 * cr; - rgb[1] = y[i] - 0.34414/2 * cb - 0.71414/2 * cr; - rgb[2] = y[i] + 1.77200/2 * cb; - for (c=0; c < 3; c++) - if (rgb[c] > 0) op[c] = htons(rgb[c]); - } - } - fwrite (out, sizeof *out, width*6, tfp); - } - free(out); -} - -void parse_phase_one (int base) -{ - unsigned entries, tag, type, len, data, save; - char str[256]; - - fseek (ifp, base + 8, SEEK_SET); - fseek (ifp, base + get4(), SEEK_SET); - entries = get4(); - get4(); - while (entries--) { - tag = get4(); - type = get4(); - len = get4(); - data = get4(); - save = ftell(ifp); - printf ("Phase One tag=0x%x, type=%d, len=%2d, data = 0x%x\n", - tag, type, len, data); - if (type == 1 && len < 256) { - fseek (ifp, base + data, SEEK_SET); - fread (str, 256, 1, ifp); - puts (str); - } - if (tag == 0x110) { - thumb_offset = data + base; - thumb_length = len; - } - fseek (ifp, save, SEEK_SET); - } - strcpy (make, "Phase One"); - strcpy (model, "unknown"); -} - -void parse_jpeg (int offset) -{ - int len, save, hlen; - - fseek (ifp, offset, SEEK_SET); - if (fgetc(ifp) != 0xff || fgetc(ifp) != 0xd8) return; - - while (fgetc(ifp) == 0xff && fgetc(ifp) >> 4 != 0xd) { - order = 0x4d4d; - len = get2() - 2; - save = ftell(ifp); - order = get2(); - hlen = get4(); - if (get4() == 0x48454150) /* "HEAP" */ - parse_ciff (save+hlen, len-hlen, 0); - parse_tiff (save+6); - fseek (ifp, save+len, SEEK_SET); - } -} - -char *raw_memmem (char *haystack, size_t haystacklen, - char *needle, size_t needlelen) -{ - char *c; - for (c = haystack; c <= haystack + haystacklen - needlelen; c++) - if (!memcmp (c, needle, needlelen)) - return c; - return NULL; -} - -/* - Identify which camera created this file, and set global variables - accordingly. - Return nonzero if the file cannot be decoded or no thumbnail is found - */ -int identify(FILE* tfp) -{ - char head[32], *thumb, *rgb, *cp; - unsigned hlen, fsize, toff, tlen, lsize, i; - - make[0] = model[0] = model2[0] = is_dng = 0; - thumb_head[0] = thumb_offset = thumb_length = thumb_layers = 0; - order = get2(); - hlen = get4(); - fseek (ifp, 0, SEEK_SET); - fread (head, 1, 32, ifp); - fseek (ifp, 0, SEEK_END); - fsize = ftell(ifp); - if ((cp = raw_memmem (head, 32, "MMMMRawT", 8)) || - (cp = raw_memmem (head, 32, "IIIITwaR", 8))) - parse_phase_one (cp - head); - else if (order == 0x4949 || order == 0x4d4d) { - if (!memcmp(head+6,"HEAPCCDR",8)) { - parse_ciff (hlen, fsize - hlen, 0); - fseek (ifp, hlen, SEEK_SET); - } else - parse_tiff (0); - } else if (!memcmp (head, "\0MRM", 4)) - parse_minolta(); - else if (!memcmp (head, "\xff\xd8\xff\xe1", 4) && - !memcmp (head+6, "Exif", 4)) { - parse_tiff (12); - thumb_length = 0; - } else if (!memcmp (head, "FUJIFILM", 8)) { - fseek (ifp, 84, SEEK_SET); - toff = get4(); - tlen = get4(); - thumb_offset = toff; - thumb_length = tlen; - } else if (!memcmp (head, "DSC-Image", 9)) - parse_rollei(); - else if (!memcmp (head, "FOVb", 4)) - parse_foveon(); - fseek (ifp, 8, SEEK_SET); - parse_mos(0); - fseek (ifp, 3472, SEEK_SET); - parse_mos(0); - parse_jpeg(0); - - if (!thumb_length) { - fprintf (stderr, "Thumbnail image not found\n"); - return -1; - } - - if (is_dng) goto dng_skip; - if (!strncmp(model,"DCS Pro",7)) { - kodak_yuv_decode (tfp); - goto done; - } - if (!strcmp(make,"Rollei")) { - rollei_decode (tfp); - goto done; - } - if (!strcmp(make,"SIGMA")) { - foveon_decode (tfp); - goto done; - } -dng_skip: - thumb = (char *) malloc(thumb_length); - if (!thumb) { - fprintf (stderr, "Cannot allocate %d bytes!!\n", thumb_length); - exit(1); - } - fseek (ifp, thumb_offset, SEEK_SET); - fread (thumb, 1, thumb_length, ifp); - if (thumb_layers && !is_dng) { - rgb = (char *) malloc(thumb_length); - if (!rgb) { - fprintf (stderr, "Cannot allocate %d bytes!!\n", thumb_length); - return -1; - } - lsize = thumb_length/3; - for (i=0; i < thumb_length; i++) - rgb[(i%lsize)*3 + i/lsize] = thumb[i]; - free(thumb); - thumb = rgb; - } - fputs (thumb_head, tfp); - fwrite(thumb, 1, thumb_length, tfp); - free (thumb); -done: - fprintf (stderr, "Thumbnail image written, make=%s, model=%s\n",&(make[0]),&(model[0])); - return 0; -} - -int extract_thumbnail( FILE* input, FILE* output, int* orientation ) -{ - /* Coffin's code has different meaning for orientation - values than TIFF, so we map them to TIFF values */ - static const int flip_map[] = { 0,1,3,2,4,7,5,6 }; - int rc; - ifp = input; - rc = identify(output); - switch ((flip+3600) % 360) { - case 270: flip = 5; break; - case 180: flip = 3; break; - case 90: flip = 6; - } - if( orientation ) *orientation = flip_map[flip%7]; - return rc; -} diff --git a/kfile-plugins/rgb/CMakeLists.txt b/kfile-plugins/rgb/CMakeLists.txt deleted file mode 100644 index be9870d1..00000000 --- a/kfile-plugins/rgb/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -################################################# -# -# (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 kfile_rgb.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - - -#### kfile_rgb (module) ######################### - -tde_add_kpart( kfile_rgb AUTOMOC - SOURCES kfile_rgb.cpp - LINK kio-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kfile-plugins/rgb/Makefile.am b/kfile-plugins/rgb/Makefile.am deleted file mode 100644 index 8fc22e17..00000000 --- a/kfile-plugins/rgb/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for rgb 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_rgb.h - -kde_module_LTLIBRARIES = kfile_rgb.la - -kfile_rgb_la_SOURCES = kfile_rgb.cpp -kfile_rgb_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -kfile_rgb_la_LIBADD = $(LIB_KSYCOCA) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) kfile_rgb.cpp -o $(podir)/kfile_rgb.pot - -services_DATA = kfile_rgb.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/rgb/kfile_rgb.cpp b/kfile-plugins/rgb/kfile_rgb.cpp deleted file mode 100644 index ffcad0b5..00000000 --- a/kfile-plugins/rgb/kfile_rgb.cpp +++ /dev/null @@ -1,208 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2004 Melchior FRANZ - * - * 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 -#include "kfile_rgb.h" - -#include -#include - -#include -#include - - -typedef KGenericFactory RgbFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_rgb, RgbFactory("kfile_rgb")) - - -KRgbPlugin::KRgbPlugin(TQObject *parent, const char *name, const TQStringList &args) : - KFilePlugin(parent, name, args) -{ - KFileMimeTypeInfo* info = addMimeTypeInfo("image/x-rgb"); - - KFileMimeTypeInfo::GroupInfo* group = 0; - KFileMimeTypeInfo::ItemInfo* item; - - - group = addGroupInfo(info, "Comment", i18n("Comment")); - - item = addItemInfo(group, "ImageName", i18n("Name"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - setHint(item, KFileMimeTypeInfo::Description); - - - 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); - - item = addItemInfo(group, "ColorMode", i18n("Color Mode"), TQVariant::String); - item = addItemInfo(group, "Compression", i18n("Compression"), TQVariant::String); - item = addItemInfo(group, "SharedRows", - i18n("percentage of avoided vertical redundancy (the higher the better)", - "Shared Rows"), TQVariant::String); - -} - - -bool KRgbPlugin::readInfo(KFileMetaInfo& info, uint /*what*/) -{ - TQFile file(info.path()); - - if (!file.open(IO_ReadOnly)) { - kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()).data() << endl; - return false; - } - - TQDataStream dstream(&file); - - TQ_UINT16 magic; - TQ_UINT8 storage; - TQ_UINT8 bpc; - TQ_UINT16 dimension; - TQ_UINT16 xsize; - TQ_UINT16 ysize; - TQ_UINT16 zsize; - TQ_UINT32 pixmin; - TQ_UINT32 pixmax; - TQ_UINT32 dummy; - char imagename[80]; - TQ_UINT32 colormap; - - dstream >> magic; - dstream >> storage; - dstream >> bpc; - dstream >> dimension; - dstream >> xsize; - dstream >> ysize; - dstream >> zsize; - dstream >> pixmin; - dstream >> pixmax; - dstream >> dummy; - dstream.readRawBytes(imagename, 80); - imagename[79] = '\0'; - dstream >> colormap; - TQ_UINT8 u8; - for (uint i = 0; i < 404; i++) - dstream >> u8; - - if (magic != 474) - return false; - - KFileMetaInfoGroup group; - - group = appendGroup(info, "Technical"); - - if (dimension == 1) - ysize = 1; - appendItem(group, "Dimensions", TQSize(xsize, ysize)); - appendItem(group, "BitDepth", zsize * 8 * bpc); - - if (zsize == 1) - appendItem(group, "ColorMode", i18n("Grayscale")); - else if (zsize == 2) - appendItem(group, "ColorMode", i18n("Grayscale/Alpha")); - else if (zsize == 3) - appendItem(group, "ColorMode", i18n("RGB")); - else if (zsize == 4) - appendItem(group, "ColorMode", i18n("RGB/Alpha")); - - if (!storage) - appendItem(group, "Compression", i18n("Uncompressed")); - else if (storage == 1) { - long compressed = file.size() - 512; - long verbatim = xsize * ysize * zsize; - appendItem(group, "Compression", i18n("Runlength Encoded") - + TQString(", %1%").arg(compressed * 100.0 / verbatim, 0, 'f', 1)); - - long k; - TQ_UINT32 offs; - TQMap map; - TQMap::Iterator it; - TQMap::Iterator end = map.end(); - for (k = 0; k < (ysize * zsize); k++) { - dstream >> offs; - if ((it = map.find(offs)) != end) - map.replace(offs, it.data() + 1); - else - map[offs] = 0; - } - for (k = 0, it = map.begin(); it != end; ++it) - k += it.data(); - - if (k) - appendItem(group, "SharedRows", TQString("%1%").arg(k * 100.0 - / (ysize * zsize), 0, 'f', 1)); - else - appendItem(group, "SharedRows", i18n("None")); - } else - appendItem(group, "Compression", i18n("Unknown")); - - - group = appendGroup(info, "Comment"); - appendItem(group, "ImageName", imagename); - - file.close(); - return true; -} - - -bool KRgbPlugin::writeInfo(const KFileMetaInfo& info) const -{ - TQFile file(info.path()); - - if (!file.open(IO_WriteOnly|IO_Raw)) { - kdDebug(7034) << "couldn't open " << TQFile::encodeName(info.path()).data() << endl; - return false; - } - - if (!file.at(24)) { - kdDebug(7034) << "couldn't set offset" << endl; - return false; - } - - TQDataStream dstream(&file); - TQString s = info["Comment"]["ImageName"].value().toString(); - s.truncate(79); - - unsigned i; - for (i = 0; i < s.length(); i++) - dstream << TQ_UINT8(s.latin1()[i]); - for (; i < 80; i++) - dstream << TQ_UINT8(0); - - file.close(); - return true; -} - - -// restrict to 79 ASCII characters -TQValidator* KRgbPlugin::createValidator(const TQString&, const TQString &, - const TQString &, TQObject* parent, const char* name) const -{ - return new TQRegExpValidator(TQRegExp("[\x0020-\x007E]{79}"), parent, name); -} - - -#include "kfile_rgb.moc" diff --git a/kfile-plugins/rgb/kfile_rgb.desktop b/kfile-plugins/rgb/kfile_rgb.desktop deleted file mode 100644 index 524de909..00000000 --- a/kfile-plugins/rgb/kfile_rgb.desktop +++ /dev/null @@ -1,61 +0,0 @@ -[Desktop Entry] -Type=Service -Name=SGI Image (RGB) -Name[br]=Skeudenn SGI (RGB) -Name[bs]=SGI slika (RGB) -Name[ca]=Imatge SGI (RGB) -Name[cs]=SGI obrázek (RGB) -Name[cy]=Delwedd SGI (RGB) -Name[da]=SGI-billede (RGB) -Name[de]=SGI-Bild (RGB) -Name[el]=Εικόνα SGI (RGB) -Name[es]=Imagen SGI (RGB) -Name[et]=SGI pildifail (RGB) -Name[eu]=SGI irudia RGB) -Name[fa]=تصویر SGI (RGB) -Name[fi]=SGI-kuva (RGB) -Name[fr]=Image SGI (RVB) -Name[ga]=Íomhá SGI (RGB) -Name[gl]=Imaxe SGI (RGB) -Name[he]=תמונת SGI (RGB) -Name[hr]=SGI slika (RGB) -Name[hu]=SGI-kép (RGB) -Name[is]=SGI mynd (TGB) -Name[it]=Immagine SGI (RGB) -Name[ja]=SGI 画像 (RGB) -Name[kk]=SGI кескіні (RGB) -Name[km]=រូបភាព SGI (RGB) -Name[lt]=SGI paveiksliukas (RGB) -Name[ms]=Imej SGI (RGB) -Name[nb]=Bildeindeks -Name[nds]=SGI-Bild (RGB) -Name[ne]=SGI छवि (RGB) -Name[nl]=SGI-afbeelding (RGB) -Name[nn]=SGI-bilete (RGB) -Name[pl]=Obrazek SGI (RGB) -Name[pt]=Imagem SGI (RGB) -Name[pt_BR]=Imagem SGI (RGB) -Name[ro]=Imagine SGI (RGB) -Name[ru]=Изображение SGI (RGB) -Name[rw]=SGI Ishusho (RGB) -Name[se]=SGI-govva (RGB) -Name[sk]=SGI obrázok (RGB) -Name[sl]=Slika SGI (RGB) -Name[sr]=SGI слика (RGB) -Name[sr@Latn]=SGI slika (RGB) -Name[sv]=SGI-bild (RGB) -Name[ta]=எஸ்ஜிஐ படிமம் (RGB) -Name[tg]=Тасвироти SGI (RGB) -Name[th]=ภาพ SGI (RGB) -Name[tr]=SGI Resmi(KYM) -Name[uk]=Зображення SGI (RGB) -Name[uz]=SGI-rasm (RGB) -Name[uz@cyrillic]=SGI-расм (RGB) -Name[zh_CN]=SGI 图像(RGB) -Name[zh_HK]=SGI 圖像 (RGB) -Name[zh_TW]=SGI 影像(RGB) -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_rgb -MimeType=image/x-rgb -PreferredGroups=Comment,Technical -PreferredItems=Dimensions,BitDepth,ColorMode,Compression,SharedRows,ImageName diff --git a/kfile-plugins/rgb/kfile_rgb.h b/kfile-plugins/rgb/kfile_rgb.h deleted file mode 100644 index 9d07f10b..00000000 --- a/kfile-plugins/rgb/kfile_rgb.h +++ /dev/null @@ -1,42 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2004 Melcrhio FRANZ - * - * 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_RGB_H__ -#define __KFILE_RGB_H__ - -#include - -class TQStringList; - -class KRgbPlugin : public KFilePlugin -{ - Q_OBJECT - - -public: - KRgbPlugin(TQObject *parent, const char *name, const TQStringList& args); - virtual bool readInfo(KFileMetaInfo& info, uint what); - virtual bool writeInfo(const KFileMetaInfo& info) const; - virtual TQValidator* createValidator(const TQString& mimetype, - const TQString &group, const TQString &key, - TQObject* parent, const char* name) const; - -}; - -#endif diff --git a/kfile-plugins/tga/CMakeLists.txt b/kfile-plugins/tga/CMakeLists.txt deleted file mode 100644 index eddb0d44..00000000 --- a/kfile-plugins/tga/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -################################################# -# -# (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 kfile_tga.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - - -#### kfile_tga (module) ######################### - -tde_add_kpart( kfile_tga AUTOMOC - SOURCES kfile_tga.cpp - LINK kio-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kfile-plugins/tga/Makefile.am b/kfile-plugins/tga/Makefile.am deleted file mode 100644 index 3856c26f..00000000 --- a/kfile-plugins/tga/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for tga 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_tga.h - -kde_module_LTLIBRARIES = kfile_tga.la - -kfile_tga_la_SOURCES = kfile_tga.cpp -kfile_tga_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -kfile_tga_la_LIBADD = $(LIB_KSYCOCA) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) kfile_tga.cpp -o $(podir)/kfile_tga.pot - -services_DATA = kfile_tga.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/tga/kfile_tga.cpp b/kfile-plugins/tga/kfile_tga.cpp deleted file mode 100644 index b102deb6..00000000 --- a/kfile-plugins/tga/kfile_tga.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Shane Wright - * - * 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 -#include "kfile_tga.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#if !defined(__osf__) -#include -#else -typedef unsigned long uint32_t; -typedef unsigned short uint16_t; -typedef unsigned char uint8_t; -#endif - -typedef KGenericFactory TgaFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_tga, TgaFactory( "kfile_tga" )) - -KTgaPlugin::KTgaPlugin(TQObject *parent, const char *name, - const TQStringList &args) - - : KFilePlugin(parent, name, args) -{ - KFileMimeTypeInfo* info = addMimeTypeInfo( "image/x-targa" ); - - KFileMimeTypeInfo::GroupInfo* group = 0L; - - group = addGroupInfo(info, "Technical", i18n("Technical Details")); - - 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, "ColorMode", i18n("Color Mode"), TQVariant::String); - item = addItemInfo(group, "Compression", i18n("Compression"), TQVariant::String); - -} - -bool KTgaPlugin::readInfo( KFileMetaInfo& info, uint what) -{ - - - TQFile file(info.path()); - - if (!file.open(IO_ReadOnly)) - { - kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()).data() << endl; - return false; - } - - TQDataStream dstream(&file); - - // TGA files are little-endian - dstream.setByteOrder(TQDataStream::LittleEndian); - - // the vars for the image data - uint8_t tga_idlength; - uint8_t tga_colormaptype; - uint8_t tga_imagetype; - uint16_t tga_colormap_fei; - uint16_t tga_colormap_length; - uint8_t tga_colormap_entrysize; - uint16_t tga_imagespec_origin_x; - uint16_t tga_imagespec_origin_y; - uint16_t tga_imagespec_width; - uint16_t tga_imagespec_height; - uint8_t tga_imagespec_depth; - uint8_t tga_imagespec_descriptor; - - // read the image data - dstream >> tga_idlength; - dstream >> tga_colormaptype; - dstream >> tga_imagetype; - dstream >> tga_colormap_fei; - dstream >> tga_colormap_length; - dstream >> tga_colormap_entrysize; - dstream >> tga_imagespec_origin_x; - dstream >> tga_imagespec_origin_y; - dstream >> tga_imagespec_width; - dstream >> tga_imagespec_height; - dstream >> tga_imagespec_depth; - dstream >> tga_imagespec_descriptor; - - // output the useful bits - KFileMetaInfoGroup group = appendGroup(info, "Technical"); - appendItem(group, "Dimensions", TQSize(tga_imagespec_width, tga_imagespec_height)); - appendItem(group, "BitDepth", tga_imagespec_depth); - - switch (tga_imagetype) { - case 1 : - case 9 : - case 32 : - appendItem(group, "ColorMode", i18n("Color-Mapped")); - break; - case 2 : - case 10 : - case 33 : - appendItem(group, "ColorMode", i18n("RGB")); - break; - case 3 : - case 11 : - appendItem(group, "ColorMode", i18n("Black and White")); - break; - default : - appendItem(group, "ColorMode", i18n("Unknown")); - } - - switch (tga_imagetype) { - case 1 : - case 2 : - case 3 : - appendItem(group, "Compression", i18n("Uncompressed")); - break; - case 9 : - case 10 : - case 11 : - appendItem(group, "Compression", i18n("Runlength Encoded")); - break; - case 32 : - appendItem(group, "Compression", i18n("Huffman, Delta & RLE")); - break; - case 33 : - appendItem(group, "Compression", i18n("Huffman, Delta, RLE (4-pass quadtree)")); - break; - default : - appendItem(group, "Compression", i18n("Unknown")); - }; - - return true; -} - -#include "kfile_tga.moc" diff --git a/kfile-plugins/tga/kfile_tga.desktop b/kfile-plugins/tga/kfile_tga.desktop deleted file mode 100644 index c581e5ff..00000000 --- a/kfile-plugins/tga/kfile_tga.desktop +++ /dev/null @@ -1,64 +0,0 @@ -[Desktop Entry] -Type=Service -Name=Truevision Targa Info -Name[ar]=معلومات Truevision Targa -Name[br]=Gorretaol Truevision Targa -Name[ca]=Informació de Targa Truevision -Name[cs]=Truevision Targa info -Name[cy]=Gwybodaeth Truevision Targa -Name[da]=Truevision Targa-info -Name[de]=Truevision Targa-Info -Name[el]=Πληροφορίες Truevision Targa -Name[eo]=TARGA-informo -Name[es]=Info de Targa visión verdadera -Name[et]=Truevision Targa info -Name[fa]=اطلاعات Truevision Targa -Name[fi]=Truevision Targa -tiedot -Name[fr]=Informations Truevision -Name[gl]=Inf. Truevision Targa -Name[he]=מידע Truevision Targa -Name[hi]=ट्रू-विज़न टाग्रा जानकारी -Name[hr]=Truevision Targa Infomacije -Name[hu]=Truevision/Targa-jellemzők -Name[is]=Truevision Targa upplýsingar -Name[it]=Informazioni Truevision Targa -Name[ja]=TGA (Truevision Targa) 情報 -Name[kk]=Truevision Targa мәліметі -Name[km]=ព័ត៌មាន Truevision Targa -Name[lt]=Truevision Targa informacija -Name[ms]=Maklumat Targa Truevision -Name[nb]=Truevision Targa-info -Name[nds]="Truevision Targa"-Info -Name[ne]=ट्रुभिजन टार्गा सूचना -Name[nl]=Truevision Targa-info -Name[nn]=Truevision Targa-info -Name[nso]=Tshedimoso ya Targa ya pono ya Nnete -Name[pl]=Informacja o pliku Truevision Targa -Name[pt]=Informação do Targa da Truevision -Name[pt_BR]=Informação sobre Truevision Targa -Name[ro]=Informaţii Targa Truevision -Name[ru]=Информация о Truevision Targa -Name[se]=Truevision Targa-dieđut -Name[sl]=Podatki o Truevision Targa -Name[sr]=Truevision Targa информације -Name[sr@Latn]=Truevision Targa informacije -Name[sv]=Information om Truevision Targa -Name[ta]=சரியான பார்வை தார்கா தகவல் -Name[tg]=Иттилоот оиди Truevision Targa -Name[th]=ข้อมูลแฟ้ม Truevision Targa -Name[tr]=Truevision Targa Bilgisi -Name[uk]=Інформація по Truevision Targa -Name[uz]=TGA haqida maʼlumot -Name[uz@cyrillic]=TGA ҳақида маълумот -Name[ven]=Mafhungo a Targa ya mbonalelo ya vhukuma -Name[wa]=Informåcion sol imådje Truevision Targa -Name[xh]=Ulwazi lwe Truevision Targa -Name[zh_CN]=Truevision Targa 信息 -Name[zh_HK]=Truevision Targa 資訊 -Name[zh_TW]=Truevision Targa 資訊 -Name[zu]=Ulwazi lwe-Truevision Targa -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_tga -MimeType=image/x-targa -PreferredGroups=Technical -PreferredItems=Dimensions,BitDepth,ColorMode,Compression diff --git a/kfile-plugins/tga/kfile_tga.h b/kfile-plugins/tga/kfile_tga.h deleted file mode 100644 index f98229df..00000000 --- a/kfile-plugins/tga/kfile_tga.h +++ /dev/null @@ -1,38 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Shane Wright - * - * 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_TGA_H__ -#define __KFILE_TGA_H__ - -#include - -class TQStringList; - -class KTgaPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KTgaPlugin( TQObject *parent, const char *name, const TQStringList& args ); - - virtual bool readInfo( KFileMetaInfo& info, uint what); -}; - -#endif diff --git a/kfile-plugins/tiff/CMakeLists.txt b/kfile-plugins/tiff/CMakeLists.txt deleted file mode 100644 index 9cc70ef0..00000000 --- a/kfile-plugins/tiff/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -################################################# -# -# (C) 2010-2011 Calvin Morrison -# mutantturkey@gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -include( ConfigureChecks.cmake ) - -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_tiff.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - - -#### kfile_tiff (module) ######################## - -tde_add_kpart( kfile_tiff AUTOMOC - SOURCES kfile_tiff.cpp - LINK kio-shared ${TIFF_LIBRARY} - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kfile-plugins/tiff/ConfigureChecks.cmake b/kfile-plugins/tiff/ConfigureChecks.cmake deleted file mode 100644 index c7efb9b7..00000000 --- a/kfile-plugins/tiff/ConfigureChecks.cmake +++ /dev/null @@ -1,21 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -# libtiff -check_include_file( tiff.h HAVE_TIFF_H ) -if( HAVE_TIFF_H ) - check_library_exists( tiff TIFFOpen "" HAVE_TIFF ) -endif( ) -if( HAVE_TIFF_H AND HAVE_TIFF ) - set( TIFF_LIBRARY tiff ) -else( ) - tde_message_fatal( "libtiff is required, but was not found on your system" ) -endif( ) diff --git a/kfile-plugins/tiff/Makefile.am b/kfile-plugins/tiff/Makefile.am deleted file mode 100644 index e1e74cde..00000000 --- a/kfile-plugins/tiff/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -## Makefile.am for Tiff file meta info plugin - -# set the include path for X, qt and KDE -INCLUDES = $(all_includes) - -noinst_HEADERS = kfile_tiff.h - -kde_module_LTLIBRARIES = kfile_tiff.la - -kfile_tiff_la_SOURCES = kfile_tiff.cpp -kfile_tiff_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -kfile_tiff_la_LIBADD = $(LIB_KIO) $(LIBTIFF) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: - $(XGETTEXT) *.cpp -o $(podir)/kfile_tiff.pot - -services_DATA = kfile_tiff.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/tiff/configure.in.in b/kfile-plugins/tiff/configure.in.in deleted file mode 100644 index e1a9730a..00000000 --- a/kfile-plugins/tiff/configure.in.in +++ /dev/null @@ -1,3 +0,0 @@ -# Compile the tiff meta info plugin only if libtiff was detected -AC_FIND_TIFF -AM_CONDITIONAL(include_TIFF, test -n "$LIBTIFF") diff --git a/kfile-plugins/tiff/kfile_tiff.cpp b/kfile-plugins/tiff/kfile_tiff.cpp deleted file mode 100644 index ce55e5b3..00000000 --- a/kfile-plugins/tiff/kfile_tiff.cpp +++ /dev/null @@ -1,299 +0,0 @@ -/* 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 "kfile_tiff.h" - -#include -#include - -#include -#include -#include -#include - -#include -#include - -typedef KGenericFactory TiffFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_tiff, TiffFactory("kfile_tiff")) - -KTiffPlugin::KTiffPlugin(TQObject *parent, const char *name, - const TQStringList &args) : KFilePlugin(parent, name, args) -{ - kdDebug(7034) << "TIFF file meta info plugin" << endl; - KFileMimeTypeInfo* info = addMimeTypeInfo( "image/tiff" ); - - KFileMimeTypeInfo::GroupInfo* group = - addGroupInfo(info, "General", i18n("General")); - - KFileMimeTypeInfo::ItemInfo* item; - item = addItemInfo(group, "Description", i18n("Description"), - TQVariant::String); - setHint(item, KFileMimeTypeInfo::Description); - item = addItemInfo(group, "Copyright", i18n("Copyright"), - TQVariant::String); - item = addItemInfo(group, "ColorMode", i18n("Color Mode"), - TQVariant::String); - item = addItemInfo(group, "Dimensions", i18n("Dimensions"), - TQVariant::Size); - setHint(item, KFileMimeTypeInfo::Size); - setUnit(item, KFileMimeTypeInfo::Pixels); - item = addItemInfo(group, "Resolution", i18n("Resolution"), - TQVariant::Size); - setUnit(item, KFileMimeTypeInfo::DotsPerInch); - item = addItemInfo(group, "BitDepth", i18n("Bit Depth"), - TQVariant::Int); - setUnit(item, KFileMimeTypeInfo::BitsPerPixel); - item = addItemInfo(group, "Compression", i18n("Compression"), - TQVariant::String); - item = addItemInfo(group, "Software", i18n("Software"), - TQVariant::String); - item = addItemInfo(group, "DateTime", i18n("Date/Time"), - TQVariant::DateTime); - item = addItemInfo(group, "Artist", i18n("Artist"), - TQVariant::String); - setHint(item, KFileMimeTypeInfo::Author); - item = addItemInfo(group, "FaxPages", i18n("Fax Pages"), - TQVariant::Int); - - group = addGroupInfo(info, "Scanner", i18n("Scanner")); - - item = addItemInfo(group, "Make", i18n("Make"), TQVariant::String); - item = addItemInfo(group, "Model", i18n("Model"), TQVariant::String); - - m_colorMode.setAutoDelete(true); - m_imageCompression.setAutoDelete(true); - - m_colorMode.insert(PHOTOMETRIC_MINISWHITE, - new TQString(I18N_NOOP("Monochrome"))); - m_colorMode.insert(PHOTOMETRIC_MINISBLACK, - new TQString(I18N_NOOP("Monochrome"))); - m_colorMode.insert(PHOTOMETRIC_RGB, - new TQString(I18N_NOOP("RGB"))); - m_colorMode.insert(PHOTOMETRIC_PALETTE, - new TQString(I18N_NOOP("Palette color"))); - m_colorMode.insert(PHOTOMETRIC_MASK, - new TQString(I18N_NOOP("Transparency mask"))); - m_colorMode.insert(PHOTOMETRIC_SEPARATED, - new TQString(I18N_NOOP("Color separations"))); - m_colorMode.insert(PHOTOMETRIC_YCBCR, - new TQString(I18N_NOOP("YCbCr"))); - m_colorMode.insert(PHOTOMETRIC_CIELAB, - new TQString(I18N_NOOP("CIE Lab"))); -#ifdef PHOTOMETRIC_ITULAB - m_colorMode.insert(PHOTOMETRIC_ITULAB, - new TQString(I18N_NOOP("ITU Lab"))); -#endif - m_colorMode.insert(PHOTOMETRIC_LOGL, - new TQString(I18N_NOOP("LOGL"))); - m_colorMode.insert(PHOTOMETRIC_LOGLUV, - new TQString(I18N_NOOP("LOGLUV"))); - - m_imageCompression.insert(COMPRESSION_NONE, - new TQString(I18N_NOOP("None"))); - m_imageCompression.insert(COMPRESSION_CCITTRLE, - new TQString(I18N_NOOP("RLE"))); - m_imageCompression.insert(COMPRESSION_CCITTFAX3, - new TQString(I18N_NOOP("G3 Fax"))); - m_imageCompression.insert(COMPRESSION_CCITTFAX4, - new TQString(I18N_NOOP("G4 Fax"))); - m_imageCompression.insert(COMPRESSION_LZW, - new TQString(I18N_NOOP("LZW"))); - m_imageCompression.insert(COMPRESSION_OJPEG, - new TQString(I18N_NOOP("JPEG"))); - m_imageCompression.insert(COMPRESSION_JPEG, - new TQString(I18N_NOOP("JPEG DCT"))); -#ifdef COMPRESSION_ADOBE_DEFLATE - m_imageCompression.insert(COMPRESSION_ADOBE_DEFLATE, - new TQString(I18N_NOOP("Adobe Deflate"))); -#endif - m_imageCompression.insert(COMPRESSION_NEXT, - new TQString(I18N_NOOP("NeXT 2-bit RLE"))); - m_imageCompression.insert(COMPRESSION_CCITTRLEW, - new TQString(I18N_NOOP("RLE Word"))); - m_imageCompression.insert(COMPRESSION_PACKBITS, - new TQString(I18N_NOOP("Packbits"))); - m_imageCompression.insert(COMPRESSION_THUNDERSCAN, - new TQString(I18N_NOOP("Thunderscan RLE"))); - m_imageCompression.insert(COMPRESSION_IT8CTPAD, - new TQString(I18N_NOOP("IT8 CT w/padding"))); - m_imageCompression.insert(COMPRESSION_IT8LW, - new TQString(I18N_NOOP("IT8 linework RLE"))); - m_imageCompression.insert(COMPRESSION_IT8MP, - new TQString(I18N_NOOP("IT8 monochrome"))); - m_imageCompression.insert(COMPRESSION_IT8BL, - new TQString(I18N_NOOP("IT8 binary lineart"))); - m_imageCompression.insert(COMPRESSION_PIXARFILM, - new TQString(I18N_NOOP("Pixar 10-bit LZW"))); - m_imageCompression.insert(COMPRESSION_PIXARLOG, - new TQString(I18N_NOOP("Pixar 11-bit ZIP"))); - m_imageCompression.insert(COMPRESSION_DEFLATE, - new TQString(I18N_NOOP("Pixar deflate"))); - m_imageCompression.insert(COMPRESSION_DCS, - new TQString(I18N_NOOP("Kodak DCS"))); - m_imageCompression.insert(COMPRESSION_JBIG, - new TQString(I18N_NOOP("ISO JBIG"))); - m_imageCompression.insert(COMPRESSION_SGILOG, - new TQString(I18N_NOOP("SGI log luminance RLE"))); - m_imageCompression.insert(COMPRESSION_SGILOG24, - new TQString(I18N_NOOP("SGI log 24-bit packed"))); -} - -TQDateTime KTiffPlugin::tiffDate(const TQString& s) const -{ - TQDateTime dt; - TQRegExp rxDate("^([0-9]{4}):([0-9]{2}):([0-9]{2})\\s" - "([0-9]{2}):([0-9]{2}):([0-9]{2})$"); - - if (rxDate.search(s) != -1) - { - int year = rxDate.cap(1).toInt(); - int month = rxDate.cap(2).toInt(); - int day = rxDate.cap(3).toInt(); - int hour = rxDate.cap(4).toInt(); - int min = rxDate.cap(5).toInt(); - int sec = rxDate.cap(6).toInt(); - - TQDate d = TQDate(year, month, day); - TQTime t = TQTime(hour, min, sec); - - if (d.isValid() && t.isValid()) - { - dt.setDate(d); - dt.setTime(t); - } - } - - return dt; -} - -bool KTiffPlugin::readInfo(KFileMetaInfo& info, uint) -{ - TIFF *tiff = TIFFOpen(TQFile::encodeName(info.path()), "r"); - if (!tiff) - return false; - - uint32 imageLength=0, imageWidth=0; - uint16 bitsPerSample=0, imageCompression=0, colorMode=0, samplesPerPixel=0, - imageAlpha=0, imageResUnit=0, dummy=0, faxPages=0; - float imageXResolution=0, imageYResolution=0; - char *description=0, *copyright=0, *software=0, *datetime=0, *artist=0, - *scannerMake=0, *scannerModel=0; - - TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &imageLength); - TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &imageWidth); - TIFFGetFieldDefaulted(tiff, TIFFTAG_BITSPERSAMPLE, &bitsPerSample); - TIFFGetFieldDefaulted(tiff, TIFFTAG_SAMPLESPERPIXEL, &samplesPerPixel); - TIFFGetField(tiff, TIFFTAG_PHOTOMETRIC, &colorMode); - TIFFGetFieldDefaulted(tiff, TIFFTAG_COMPRESSION, &imageCompression); - TIFFGetField(tiff, TIFFTAG_MATTEING, &imageAlpha); - TIFFGetField(tiff, TIFFTAG_XRESOLUTION, &imageXResolution); - TIFFGetField(tiff, TIFFTAG_YRESOLUTION, &imageYResolution); - TIFFGetFieldDefaulted(tiff, TIFFTAG_RESOLUTIONUNIT, &imageResUnit); - TIFFGetField(tiff, TIFFTAG_IMAGEDESCRIPTION, &description); - TIFFGetField(tiff, TIFFTAG_SOFTWARE, &software); - TIFFGetField(tiff, TIFFTAG_COPYRIGHT, ©right); - TIFFGetField(tiff, TIFFTAG_DATETIME, &datetime); - TIFFGetField(tiff, TIFFTAG_ARTIST, &artist); - TIFFGetField(tiff, TIFFTAG_PAGENUMBER, &dummy, &faxPages); - TIFFGetField(tiff, TIFFTAG_MAKE, &scannerMake); - TIFFGetField(tiff, TIFFTAG_MODEL, &scannerModel); - - kdDebug(7034) << "Description: " << description << endl; - kdDebug(7034) << "Width: " << imageWidth << endl; - kdDebug(7034) << "Height: " << imageLength << endl; - kdDebug(7034) << "BitDepth: " << bitsPerSample << endl; - kdDebug(7034) << "ColorMode: " << colorMode << endl; - kdDebug(7034) << "Compression: " << imageCompression << endl; - kdDebug(7034) << "SamplesPerPixel: " << samplesPerPixel << endl; - kdDebug(7034) << "ImageAlpha: " << imageAlpha << endl; - kdDebug(7034) << "XResolution: " << imageXResolution << endl; - kdDebug(7034) << "YResolution: " << imageYResolution << endl; - kdDebug(7034) << "ResolutionUnit: " << imageResUnit << endl; - kdDebug(7034) << "FaxPages: " << faxPages << endl; - kdDebug(7034) << "DateTime: " << datetime << endl; - kdDebug(7034) << "Copyright: " << copyright << endl; - kdDebug(7034) << "Software: " << software << endl; - kdDebug(7034) << "Artist: " << artist << endl; - kdDebug(7034) << "Make: " << scannerMake << endl; - kdDebug(7034) << "Model: " << scannerModel << endl; - - if (imageResUnit == RESUNIT_CENTIMETER) - { - imageXResolution *= 2.54; - imageYResolution *= 2.54; - } - else if (imageResUnit == RESUNIT_NONE) - { - imageXResolution = 0; - imageYResolution = 0; - } - - int imageBpp = bitsPerSample*samplesPerPixel; - if (imageAlpha && colorMode==PHOTOMETRIC_RGB) - m_colorMode.replace(PHOTOMETRIC_RGB, new TQString(I18N_NOOP("RGBA"))); - - KFileMetaInfoGroup group = appendGroup(info, "General"); - if (description) - appendItem(group, "Description", TQString(description)); - appendItem(group, "Dimensions", TQSize(imageWidth, imageLength)); - appendItem(group, "BitDepth", imageBpp); - if (imageXResolution>0 && imageYResolution>0) - appendItem(group, "Resolution", TQSize( - static_cast(imageXResolution), - static_cast(imageYResolution))); - if (m_colorMode[colorMode]) - appendItem(group, "ColorMode", *m_colorMode[colorMode]); - if (m_imageCompression[imageCompression]) - appendItem(group, "Compression", *m_imageCompression[imageCompression]); - if (datetime) - { - TQDateTime dt = tiffDate(TQString(datetime)); - if (dt.isValid()) - appendItem(group, "DateTime", dt); - } - if (copyright) - appendItem(group, "Copyright", TQString(copyright)); - if (software) - appendItem(group, "Software", TQString(software)); - if (artist) - appendItem(group, "Artist", TQString(artist)); - - if (faxPages>0 && (imageCompression==COMPRESSION_CCITTFAX3 || - imageCompression==COMPRESSION_CCITTFAX4)) - { - appendItem(group, "FaxPages", faxPages); - } - - if (scannerMake || scannerModel) - { - group = appendGroup(info, "Scanner"); - if (scannerMake) - appendItem(group, "Make", TQString(scannerMake)); - if (scannerModel) - appendItem(group, "Model", TQString(scannerModel)); - } - - TIFFClose(tiff); - - return true; -} - -#include "kfile_tiff.moc" diff --git a/kfile-plugins/tiff/kfile_tiff.desktop b/kfile-plugins/tiff/kfile_tiff.desktop deleted file mode 100644 index 52efbfb6..00000000 --- a/kfile-plugins/tiff/kfile_tiff.desktop +++ /dev/null @@ -1,67 +0,0 @@ -[Desktop Entry] -Type=Service -Name=TIFF File Meta Info -Name[af]=Tiff Lêer Meta Inligting -Name[ar]=معلومات ملف TIFF -Name[br]=Meta-titouroù ar restr TIFF -Name[ca]=Metainformació de fitxer TIFF -Name[cs]=Metainformace obrázku typu TIFF -Name[cy]=Meta-wybodaeth Ffeil TIFF -Name[da]=TIFF Fil-meta-info -Name[de]=TIFF-Metainformation -Name[el]=Μετα-πληροφορίες αρχείου TIFF -Name[eo]=TIFF-informo -Name[es]=Info meta de archivos TIFF -Name[et]=TIFF faili metainfo -Name[eu]=TIFF fitxategi meta info -Name[fa]=فرااطلاعات پروندۀ TIFF -Name[fi]=TIFF-metatiedot -Name[fr]=Méta Informations sur les fichiers TIFF -Name[gl]=Inf. metaficheiro TIFF -Name[he]=מידע TIFF -Name[hi]=TIFF फ़ाइल मेटा जानकारी -Name[hr]=TIFF meta informacije -Name[hu]=TIFF-metajellemzők -Name[is]=TIFF File Meta upplýsingar -Name[it]=Informazioni TIFF -Name[ja]=TIFF ファイルメタ情報 -Name[kk]=TIFF файлдың мета деректері -Name[km]=ព័ត៌មាន​មេតា​របស់​ឯកសារ TIFF -Name[lt]=TIFF bylos meta informacija -Name[ms]=TIFF Maklumat Meta Fail TIFF -Name[nb]=TIFF-filmetainfo -Name[nds]=TIFF-Metainfo -Name[ne]=TIFF फाइल मेटा सूचना -Name[nl]=TIFF File Meta-info -Name[nn]=TIFF-filmetainfo -Name[nso]=Tshedimoso ya Meta wa Faele ya TIFF -Name[pl]=Informacja o pliku TIFF -Name[pt]=Meta-Informação do Ficheiro TIFF -Name[pt_BR]=Informação sobre Meta Arquivo TIFF -Name[ro]=Metainformaţii TIFF -Name[ru]=Информация о метафайле TIFF -Name[se]=TIFF-filla metadieđut -Name[sk]=Meta-info o súbore TIFF -Name[sl]=Meta podatki o TIFF -Name[sr]=Мета информације TIFF фајла -Name[sr@Latn]=Meta informacije TIFF fajla -Name[sv]=Metainformation om TIFF-fil -Name[ta]=TIFF மீக்கோப்பு தகவல் -Name[tg]=Иттилоот оиди метафайли TIFF -Name[th]=ข้อมูลเมตาแฟ้ม TIFF -Name[tr]=TIFF Dosya Bilgisi -Name[uk]=Метаінформація про файл TIFF -Name[uz]=TIFF-faylining meta-maʼlumoti -Name[uz@cyrillic]=TIFF-файлининг мета-маълумоти -Name[ven]=Mafhungo a Meta faela ya TIFF -Name[wa]=Informåcion sol imådje TIFF -Name[xh]=Ulwazi lwe TIFF Ifayile Esembindini -Name[zh_CN]=TIFF 文件元信息 -Name[zh_HK]=TIFF 檔案 Meta 資訊 -Name[zh_TW]=TIFF 檔案 Meta 資訊 -Name[zu]=Ulwazi Lwefayela yemeta ye-TIFF -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_tiff -MimeType=image/tiff -PreferredGroups=General,Scanner -PreferredItems=Description,Copyright,Type,Dimensions,Resolution,BitDepth,Compression,Software,DateTime,Artist,FaxPages,Make,Model diff --git a/kfile-plugins/tiff/kfile_tiff.h b/kfile-plugins/tiff/kfile_tiff.h deleted file mode 100644 index 6bd87756..00000000 --- a/kfile-plugins/tiff/kfile_tiff.h +++ /dev/null @@ -1,43 +0,0 @@ -/* 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_TIFF_H_ -#define __KFILE_TIFF_H_ - -#include - -#include - -class KTiffPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KTiffPlugin(TQObject *parent, const char *name, const TQStringList& args); - virtual bool readInfo(KFileMetaInfo& info, uint what); - -private: - TQDateTime tiffDate(const TQString&) const; - - TQIntDict m_colorMode; - TQIntDict m_imageCompression; -}; - -#endif diff --git a/kfile-plugins/xbm/CMakeLists.txt b/kfile-plugins/xbm/CMakeLists.txt deleted file mode 100644 index 37a9aa6b..00000000 --- a/kfile-plugins/xbm/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -################################################# -# -# (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 kfile_xbm.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - - -#### kfile_xbm (module) ######################## - -tde_add_kpart( kfile_xbm AUTOMOC - SOURCES kfile_xbm.cpp - LINK kio-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kfile-plugins/xbm/Makefile.am b/kfile-plugins/xbm/Makefile.am deleted file mode 100644 index 1b9d7ff9..00000000 --- a/kfile-plugins/xbm/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for xbm 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_xbm.h - -kde_module_LTLIBRARIES = kfile_xbm.la - -kfile_xbm_la_SOURCES = kfile_xbm.cpp -kfile_xbm_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -kfile_xbm_la_LIBADD = $(LIB_KSYCOCA) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) kfile_xbm.cpp -o $(podir)/kfile_xbm.pot - -services_DATA = kfile_xbm.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/xbm/kfile_xbm.cpp b/kfile-plugins/xbm/kfile_xbm.cpp deleted file mode 100644 index 2d246c97..00000000 --- a/kfile-plugins/xbm/kfile_xbm.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Shane Wright - * - * 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 -#include "kfile_xbm.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#if !defined(__osf__) -#include -#else -typedef unsigned short uint32_t; -#endif - -typedef KGenericFactory XbmFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_xbm, XbmFactory( "kfile_xbm" )) - -KXbmPlugin::KXbmPlugin(TQObject *parent, const char *name, - const TQStringList &args) - - : KFilePlugin(parent, name, args) -{ - KFileMimeTypeInfo* info = addMimeTypeInfo( "image/x-xbm" ); - - KFileMimeTypeInfo::GroupInfo* group = 0L; - - group = addGroupInfo(info, "Technical", i18n("Technical Details")); - - KFileMimeTypeInfo::ItemInfo* item; - - item = addItemInfo(group, "Dimensions", i18n("Dimensions"), TQVariant::Size); - setHint( item, KFileMimeTypeInfo::Size ); - setUnit(item, KFileMimeTypeInfo::Pixels); -} - - -unsigned long KXbmPlugin::xbm_processLine(char * linebuf) -{ - const char * fsig = "#define "; - - // check it starts with #define - if (memcmp(linebuf, fsig, 8)) - return 0; - - // scan for the 2nd space and set up a pointer - uint32_t slen = strlen(linebuf); - bool done = false; - uint32_t spos = 0; - unsigned char spacecount = 0; - do { - - if (linebuf[spos] == 0x00) - return 0; - - if (linebuf[spos] == ' ') - ++spacecount; - - if (spacecount == 2) - done = true; - else - ++spos; - - } while (!done); - - return atoi(linebuf + spos); -} - - -bool KXbmPlugin::readInfo( KFileMetaInfo& info, uint what) -{ - - TQFile file(info.path()); - - if (!file.open(IO_ReadOnly)) - { - kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()).data() << endl; - return false; - } - - // we need a buffer for lines - char linebuf[1000]; - - // read the first line - file.readLine(linebuf, sizeof( linebuf )); - uint32_t width = xbm_processLine(linebuf); - - // read the 2nd line - file.readLine(linebuf, sizeof( linebuf )); - uint32_t height = xbm_processLine(linebuf); - - if ((width > 0) && (height > 0)) { - // we have valid looking data - KFileMetaInfoGroup group = appendGroup(info, "Technical"); - appendItem(group, "Dimensions", TQSize(width, height)); - return true; - } - - return false; -} - -#include "kfile_xbm.moc" diff --git a/kfile-plugins/xbm/kfile_xbm.desktop b/kfile-plugins/xbm/kfile_xbm.desktop deleted file mode 100644 index 127a5c9d..00000000 --- a/kfile-plugins/xbm/kfile_xbm.desktop +++ /dev/null @@ -1,65 +0,0 @@ -[Desktop Entry] -Type=Service -Name=XBM Info -Name[af]=Xbm Inligting -Name[ar]=معلومات XBM -Name[br]=Titouroù XBM -Name[ca]=Informació d'XBM -Name[cs]=XBM info -Name[cy]=Gwybodaeth XBM -Name[da]=XBM-info -Name[de]=XBM-Info -Name[el]=Πληροφορίες XBM -Name[eo]=XBM-informo -Name[es]=Info XBM -Name[et]=XBM info -Name[fa]=اطلاعات XBM -Name[fi]=XBM-tiedot -Name[fr]=Informations sur XBM -Name[gl]=Inf. XBM -Name[he]=מידע XBM -Name[hi]=XBM जानकारी -Name[hr]=XBM Infoformacije -Name[hu]=XBM-jellemzők -Name[is]=XBM upplýsingar -Name[it]=Informazioni XBM -Name[ja]=XBM 情報 -Name[kk]=XBM мәліметі -Name[km]=ព័ត៌មាន XBM -Name[lt]=XBM informacija -Name[ms]=Maklumat XBM -Name[nds]=XBM-Info -Name[ne]=XBM सूचना -Name[nl]=XBM-info -Name[nn]=XBM-info -Name[nso]=Tshedimoso ya XBM -Name[pa]=XBM ਜਾਣਕਾਰੀ -Name[pl]=Informacja o pliku XBM -Name[pt]=Informação do XBM -Name[pt_BR]=Informação sobre XBM -Name[ro]=Informaţii XBM -Name[ru]=Информация о XBM -Name[se]=XBM-dieđut -Name[sl]=Podatki o XBM -Name[sr]=XBM информације -Name[sr@Latn]=XBM informacije -Name[sv]=XBM-information -Name[ta]=XBM தகவல் -Name[tg]=Иттилоот оиди XBM -Name[th]=ข้อมูลแฟ้ม XBM -Name[tr]=XBM Bilgisi -Name[uk]=Інформація по XBM -Name[uz]=XBM haqida maʼlumot -Name[uz@cyrillic]=XBM ҳақида маълумот -Name[ven]=Mafhungo a XBM -Name[wa]=Informåcion sol imådje XBM -Name[xh]=Ulwazi lwe XBM -Name[zh_CN]=XBM 信息 -Name[zh_HK]=XBM 資訊 -Name[zh_TW]=XBM 資訊 -Name[zu]=Ulwazi lwe-XBM -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_xbm -MimeType=image/x-xbm -PreferredGroups=Technical -PreferredItems=Resolution diff --git a/kfile-plugins/xbm/kfile_xbm.h b/kfile-plugins/xbm/kfile_xbm.h deleted file mode 100644 index cf4450ef..00000000 --- a/kfile-plugins/xbm/kfile_xbm.h +++ /dev/null @@ -1,43 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Shane Wright - * - * 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_XBM_H__ -#define __KFILE_XBM_H__ - -#include - -class TQStringList; - -class KXbmPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KXbmPlugin( TQObject *parent, const char *name, const TQStringList& args ); - - virtual bool readInfo( KFileMetaInfo& info, uint what); - -private: - - unsigned long xbm_processLine(char * linebuf); - -}; - -#endif diff --git a/kfile-plugins/xpm/CMakeLists.txt b/kfile-plugins/xpm/CMakeLists.txt deleted file mode 100644 index 0e401288..00000000 --- a/kfile-plugins/xpm/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -################################################# -# -# (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 kfile_xpm.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - - -#### kfile_xpm (module) ######################### - -tde_add_kpart( kfile_xpm AUTOMOC - SOURCES kfile_xpm.cpp - LINK kio-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kfile-plugins/xpm/Makefile.am b/kfile-plugins/xpm/Makefile.am deleted file mode 100644 index 5a1254b1..00000000 --- a/kfile-plugins/xpm/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -## Makefile.am for xpm file meta info plugin - -INCLUDES = $(all_includes) - -# these are the headers for your project -noinst_HEADERS = kfile_xpm.h - -kde_module_LTLIBRARIES = kfile_xpm.la - -kfile_xpm_la_SOURCES = kfile_xpm.cpp -kfile_xpm_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -kfile_xpm_la_LIBADD = $(LIB_KIO) -kfile_xpm_la_METASOURCES = kfile_xpm.moc - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -kde_services_DATA = kfile_xpm.desktop - -messages: - $(XGETTEXT) *.cpp -o $(podir)/kfile_xpm.pot diff --git a/kfile-plugins/xpm/kfile_xpm.cpp b/kfile-plugins/xpm/kfile_xpm.cpp deleted file mode 100644 index a121a359..00000000 --- a/kfile-plugins/xpm/kfile_xpm.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004 by Martin Koller * - * m.koller@surfeu.at * - * * - * 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. * - ***************************************************************************/ - -#include -#include -#include "kfile_xpm.h" - -#include - -//-------------------------------------------------------------------------------- - -typedef KGenericFactory xpmFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_xpm, xpmFactory( "kfile_xpm" )) - -//-------------------------------------------------------------------------------- - -xpmPlugin::xpmPlugin(TQObject *parent, const char *name, const TQStringList &args) - : KFilePlugin(parent, name, args) -{ - KFileMimeTypeInfo* info = addMimeTypeInfo( "image/x-xpm" ); - - // our new group - KFileMimeTypeInfo::GroupInfo* group = 0; - group = addGroupInfo(info, "xpmInfo", i18n("X PixMap File Information")); - - KFileMimeTypeInfo::ItemInfo* item; - - // our new items in the group - item = addItemInfo(group, "Dimension", i18n("Dimension"), TQVariant::Size); - setHint(item, KFileMimeTypeInfo::Size); - setUnit(item, KFileMimeTypeInfo::Pixels); - - item = addItemInfo(group, "BitDepth", i18n("Bit Depth"), TQVariant::Int); - setUnit(item, KFileMimeTypeInfo::BitsPerPixel); -} - -//-------------------------------------------------------------------------------- - -bool xpmPlugin::readInfo(KFileMetaInfo& info, uint /*what*/) -{ - TQImage pix; - - if ( ! pix.load(info.path(), "XPM") ) return false; - - KFileMetaInfoGroup group = appendGroup(info, "xpmInfo"); - - appendItem(group, "Dimension", TQSize(pix.size())); - appendItem(group, "BitDepth", pix.depth()); - - return true; -} - -#include "kfile_xpm.moc" diff --git a/kfile-plugins/xpm/kfile_xpm.desktop b/kfile-plugins/xpm/kfile_xpm.desktop deleted file mode 100644 index d5ce55db..00000000 --- a/kfile-plugins/xpm/kfile_xpm.desktop +++ /dev/null @@ -1,53 +0,0 @@ -[Desktop Entry] -Type=Service -Name=XPM Info -Name[br]=Titouroù XPM -Name[ca]=Informació de XPM -Name[cs]=XPM info -Name[de]=XPM-Info -Name[el]=Πληροφορίες XPM -Name[eo]=XPM-informo -Name[es]=Información XPM -Name[et]=XPM info -Name[fa]=اطلاعات XPM -Name[fi]=XPM-tiedot -Name[fr]=Informations XPM -Name[gl]=Información XPM -Name[he]=מידע XPM -Name[hu]=XPM-jellemzők -Name[is]=XPM upplýsingar -Name[it]=Informazioni XPM -Name[ja]=XPM 情報 -Name[kk]=XPM мәліметі -Name[km]=ព័ត៌មាន XPM -Name[lt]=XPM informacija -Name[ms]=Maklumat XPM -Name[nb]=XPM-info -Name[nds]=XPM-Info -Name[ne]=XPM सूचना -Name[nl]=XPM-info -Name[nn]=XPM-info -Name[pa]=XPM ਜਾਣਕਾਰੀ -Name[pl]=Informacja o pliku XPM -Name[pt]=Informação do XPM -Name[pt_BR]=Informações Sobre XPM -Name[ro]=Informaţii XPM -Name[ru]=Информация о XPM -Name[sl]=Podatki o XPM -Name[sr]=XPM информације -Name[sr@Latn]=XPM informacije -Name[sv]=XPM-information -Name[ta]=XPM தகவல் -Name[th]=ข้อมูลแฟ้ม XPM -Name[tr]=XPM Bilgisi -Name[uk]=Інформація про XPM -Name[uz]=XPM haqida maʼlumot -Name[uz@cyrillic]=XPM ҳақида маълумот -Name[zh_CN]=XPM 信息 -Name[zh_HK]=XPM 資訊 -Name[zh_TW]=XPM 資訊 -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_xpm -MimeType=image/x-xpm -PreferredGroups=xpmInfo -PreferredItems=Dimension diff --git a/kfile-plugins/xpm/kfile_xpm.h b/kfile-plugins/xpm/kfile_xpm.h deleted file mode 100644 index ef05e9b5..00000000 --- a/kfile-plugins/xpm/kfile_xpm.h +++ /dev/null @@ -1,46 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004 by Martin Koller * - * m.koller@surfeu.at * - * * - * This plugin provides information about the content of a * - * XPM image file. * - * * - * 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. * - ***************************************************************************/ - -#ifndef KFILE_XPM_H -#define KFILE_XPM_H - -/** - * Note: For further information look into <$TDEDIR/include/kfilemetainfo.h> - */ -#include - -class TQStringList; - -class xpmPlugin: public KFilePlugin -{ - Q_OBJECT - - - public: - xpmPlugin(TQObject *parent, const char *name, const TQStringList& args); - - virtual bool readInfo(KFileMetaInfo& info, uint what); -}; - -#endif - diff --git a/kgamma/kcmkgamma/kgamma.cpp b/kgamma/kcmkgamma/kgamma.cpp index 8a9a33fd..729f249e 100644 --- a/kgamma/kcmkgamma/kgamma.cpp +++ b/kgamma/kcmkgamma/kgamma.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include #include diff --git a/kgamma/kcmkgamma/kgamma.desktop b/kgamma/kcmkgamma/kgamma.desktop index 5da57b89..d348afef 100644 --- a/kgamma/kcmkgamma/kgamma.desktop +++ b/kgamma/kcmkgamma/kgamma.desktop @@ -84,7 +84,7 @@ Name[xh]=Unobumba wesithathu konoobumba besiGrike Name[zh_HK]=伽馬(Gamma) DocPath=kgamma -Exec=kcmshell kgamma +Exec=tdecmshell kgamma Icon=kgamma Keywords=KGamma, kgamma, Gamma, gamma Keywords[bg]=калибриране, гама, яркост, цвят, монитор, екран, KGamma, kgamma, Gamma, gamma diff --git a/kghostview/Makefile.am b/kghostview/Makefile.am index 3d7faa44..072c6037 100644 --- a/kghostview/Makefile.am +++ b/kghostview/Makefile.am @@ -59,7 +59,7 @@ messages: rc.cpp $(XGETTEXT) *.cpp *.h -o $(podir)/kghostview.pot -updatedir = $(kde_datadir)/kconf_update +updatedir = $(kde_datadir)/tdeconf_update update_DATA = kghostview.upd update_SCRIPTS = update-to-xt-names.pl diff --git a/kghostview/displayoptions.cpp b/kghostview/displayoptions.cpp index 6e4dddc7..20931fca 100644 --- a/kghostview/displayoptions.cpp +++ b/kghostview/displayoptions.cpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include namespace { const double allowedMagnifications[] = { diff --git a/kghostview/kgv_miniwidget.cpp b/kghostview/kgv_miniwidget.cpp index 3e108866..b226bb78 100644 --- a/kghostview/kgv_miniwidget.cpp +++ b/kghostview/kgv_miniwidget.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include #include diff --git a/kghostview/kgv_view.cpp b/kghostview/kgv_view.cpp index e651c55d..57b1e7db 100644 --- a/kghostview/kgv_view.cpp +++ b/kghostview/kgv_view.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include #include @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include diff --git a/kghostview/kgv_view.h b/kghostview/kgv_view.h index 158ef0ec..e9feb249 100644 --- a/kghostview/kgv_view.h +++ b/kghostview/kgv_view.h @@ -22,7 +22,7 @@ #include // TQByteArray #include -#include +#include #include #include diff --git a/kghostview/kgvconfigdialog.cpp b/kghostview/kgvconfigdialog.cpp index 27f2664c..0982cc65 100644 --- a/kghostview/kgvconfigdialog.cpp +++ b/kghostview/kgvconfigdialog.cpp @@ -21,7 +21,7 @@ #include -#include +#include #include #include #include @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include "configuration.h" #include "kgv_view.h" @@ -75,7 +75,7 @@ namespace { /* On a related note: * We don't detect upgrades (or downgrades, for that matter) of gs. * I am seeing if I can get the version out of gs as a side effect to displaying a file. - * This way, using kconfig:/Ghostscript/GS Version we will see whether the version has changed + * This way, using tdeconfig:/Ghostscript/GS Version we will see whether the version has changed * and trigger a redetection without the trouble of running "gs --version" on each launch. * * LPC (9 April 2003) diff --git a/kghostview/kgvdocument.cpp b/kghostview/kgvdocument.cpp index 673220a0..6303591e 100644 --- a/kghostview/kgvdocument.cpp +++ b/kghostview/kgvdocument.cpp @@ -21,8 +21,8 @@ #include -#include -#include +#include +#include #include #include #include @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include diff --git a/kghostview/kgvshell.cpp b/kghostview/kgvshell.cpp index 95aac5f9..75f27dad 100644 --- a/kghostview/kgvshell.cpp +++ b/kghostview/kgvshell.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include #include diff --git a/kiconedit/CMakeLists.txt b/kiconedit/CMakeLists.txt index fbd10516..285760ce 100644 --- a/kiconedit/CMakeLists.txt +++ b/kiconedit/CMakeLists.txt @@ -37,6 +37,6 @@ tde_add_executable( kiconedit AUTOMOC kiconcolors.cpp kcolorgrid.cpp palettetoolbar.cpp kicon.cpp kresize.cpp knew.cpp properties.cpp kiconeditslots.cpp kiconconfig.cpp - LINK kio-shared tdeprint-shared + LINK tdeio-shared tdeprint-shared DESTINATION ${BIN_INSTALL_DIR} ) diff --git a/kiconedit/kicon.cpp b/kiconedit/kicon.cpp index b16a78b5..d5ee400a 100644 --- a/kiconedit/kicon.cpp +++ b/kiconedit/kicon.cpp @@ -23,8 +23,8 @@ #include #include -#include -#include +#include +#include #include #include #include diff --git a/kiconedit/kiconconfig.cpp b/kiconedit/kiconconfig.cpp index 1a2d7bf2..3dbd10e7 100644 --- a/kiconedit/kiconconfig.cpp +++ b/kiconedit/kiconconfig.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kiconedit/kiconedit.cpp b/kiconedit/kiconedit.cpp index 8f93dc37..0afd63c4 100644 --- a/kiconedit/kiconedit.cpp +++ b/kiconedit/kiconedit.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include #include diff --git a/kiconedit/knew.cpp b/kiconedit/knew.cpp index 1c25fe2f..11f27ba8 100644 --- a/kiconedit/knew.cpp +++ b/kiconedit/knew.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include #include diff --git a/kiconedit/main.cpp b/kiconedit/main.cpp index 1d6ca16d..a64cbf9e 100644 --- a/kiconedit/main.cpp +++ b/kiconedit/main.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include diff --git a/kiconedit/properties.cpp b/kiconedit/properties.cpp index f9ad44b4..8d42c039 100644 --- a/kiconedit/properties.cpp +++ b/kiconedit/properties.cpp @@ -18,7 +18,7 @@ Boston, MA 02110-1301, USA. */ -#include +#include #include #include diff --git a/kmrml/README b/kmrml/README index 59f2dd9b..f65ff1ff 100644 --- a/kmrml/README +++ b/kmrml/README @@ -2,7 +2,7 @@ kio_mrml and mrml_part Carsten Pfeiffer 2001/05/03 ---------------------------------------------------------------------- -These are the sources for an mrml kioslave and an accompanying KPart. +These are the sources for an mrml tdeioslave and an accompanying KPart. How does it work in Konqueror? diff --git a/kmrml/kmrml/CMakeLists.txt b/kmrml/kmrml/CMakeLists.txt index b570b684..4d445b2d 100644 --- a/kmrml/kmrml/CMakeLists.txt +++ b/kmrml/kmrml/CMakeLists.txt @@ -37,7 +37,7 @@ install( FILES mrml-servicemenu.desktop DESTINATION ${DATA_INSTALL_DIR}/konquero tde_add_kpart( kio_mrml AUTOMOC SOURCES mrml.cpp - LINK kmrmlstuff-static kio-shared + LINK kmrmlstuff-static tdeio-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kmrml/kmrml/kcontrol/CMakeLists.txt b/kmrml/kmrml/kcontrol/CMakeLists.txt index 15f85e95..6ff6fbb6 100644 --- a/kmrml/kmrml/kcontrol/CMakeLists.txt +++ b/kmrml/kmrml/kcontrol/CMakeLists.txt @@ -33,6 +33,6 @@ tde_add_kpart( kcm_kmrml AUTOMOC kcmkmrml.cpp mainpage.cpp indexer.cpp serverconfigwidget.ui indexcleaner.cpp LINK - kmrmlstuff-static tdeparts-shared kio-shared + kmrmlstuff-static tdeparts-shared tdeio-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kmrml/kmrml/kcontrol/indextest.cpp b/kmrml/kmrml/kcontrol/indextest.cpp index 9571a88f..6fe6587f 100644 --- a/kmrml/kmrml/kcontrol/indextest.cpp +++ b/kmrml/kmrml/kcontrol/indextest.cpp @@ -3,7 +3,7 @@ #include "indextest.moc" #include -#include +#include #include using namespace KMrmlConfig; diff --git a/kmrml/kmrml/kcontrol/kcmkmrml.desktop b/kmrml/kmrml/kcontrol/kcmkmrml.desktop index 1de03e4a..b8f9e4ba 100644 --- a/kmrml/kmrml/kcontrol/kcmkmrml.desktop +++ b/kmrml/kmrml/kcontrol/kcmkmrml.desktop @@ -1,5 +1,5 @@ [Desktop Entry] -Exec=kcmshell kcmkmrml +Exec=tdecmshell kcmkmrml Icon=folder_image Type=Application diff --git a/kmrml/kmrml/kcontrol/mainpage.cpp b/kmrml/kmrml/kcontrol/mainpage.cpp index a8a0ab84..ee8fd88f 100644 --- a/kmrml/kmrml/kcontrol/mainpage.cpp +++ b/kmrml/kmrml/kcontrol/mainpage.cpp @@ -36,8 +36,8 @@ #include #include -#include -#include // MAX_PORT_VALUE +#include +#include // MAX_PORT_VALUE #include "serverconfigwidget.h" #include "mainpage.h" diff --git a/kmrml/kmrml/lib/kmrml_config.cpp b/kmrml/kmrml/lib/kmrml_config.cpp index be408bc2..9aa92d54 100644 --- a/kmrml/kmrml/lib/kmrml_config.cpp +++ b/kmrml/kmrml/lib/kmrml_config.cpp @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include #include diff --git a/kmrml/kmrml/loader.cpp b/kmrml/kmrml/loader.cpp index ec1d7cdd..576513ed 100644 --- a/kmrml/kmrml/loader.cpp +++ b/kmrml/kmrml/loader.cpp @@ -17,7 +17,7 @@ */ #include -#include +#include #include "loader.h" diff --git a/kmrml/kmrml/loader.h b/kmrml/kmrml/loader.h index aa63823e..4c8b8b21 100644 --- a/kmrml/kmrml/loader.h +++ b/kmrml/kmrml/loader.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include class Download diff --git a/kmrml/kmrml/mrml.cpp b/kmrml/kmrml/mrml.cpp index d6273c2c..adbbbe95 100644 --- a/kmrml/kmrml/mrml.cpp +++ b/kmrml/kmrml/mrml.cpp @@ -25,7 +25,7 @@ #include #endif -#include +#include #include #include #include diff --git a/kmrml/kmrml/mrml.h b/kmrml/kmrml/mrml.h index 13d3cde7..2a39466f 100644 --- a/kmrml/kmrml/mrml.h +++ b/kmrml/kmrml/mrml.h @@ -20,7 +20,7 @@ #define MRML_H -#include +#include #include #include diff --git a/kmrml/kmrml/mrml.protocol b/kmrml/kmrml/mrml.protocol index c3a732eb..4efceaee 100644 --- a/kmrml/kmrml/mrml.protocol +++ b/kmrml/kmrml/mrml.protocol @@ -7,4 +7,4 @@ reading=true defaultMimetype=text/mrml determineMimetypeFromExtension=false Icon=image -DocPath=kioslave/mrml.html +DocPath=tdeioslave/mrml.html diff --git a/kmrml/kmrml/mrml_part.cpp b/kmrml/kmrml/mrml_part.cpp index 29e633a7..a808da9e 100644 --- a/kmrml/kmrml/mrml_part.cpp +++ b/kmrml/kmrml/mrml_part.cpp @@ -30,15 +30,15 @@ #include #include #include -#include +#include #include #include #include #include #include #include -#include -#include +#include +#include #include #include #include @@ -284,7 +284,7 @@ bool MrmlPart::openURL( const KURL& url ) "kmrml_ask_configure_gift" ) == KMessageBox::Yes ) { - TDEApplication::tdeinitExec( "kcmshell", + TDEApplication::tdeinitExec( "tdecmshell", TQString::fromLatin1("kcmkmrml")); setStatus( NeedCollection ); return false; diff --git a/kmrml/kmrml/mrmlsearch.cpp b/kmrml/kmrml/mrmlsearch.cpp index fbd1468d..9a06f309 100644 --- a/kmrml/kmrml/mrmlsearch.cpp +++ b/kmrml/kmrml/mrmlsearch.cpp @@ -21,7 +21,7 @@ // from Konqueror and creates a query of the form // mrml://host.com/?relevant=url1;url2;url3;url4.... // By default, the mrml URL is mrml://localhost", but you can override that -// by editing ~/.trinity/share/config/kio_mrmlrc and adding +// by editing ~/.trinity/share/config/tdeio_mrmlrc and adding // [MRML Settings] // Default URL=mrml://url.to.your.giftserver.com // @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include #include diff --git a/kmrml/kmrml/server/CMakeLists.txt b/kmrml/kmrml/server/CMakeLists.txt index 337bede6..652d5c07 100644 --- a/kmrml/kmrml/server/CMakeLists.txt +++ b/kmrml/kmrml/server/CMakeLists.txt @@ -30,6 +30,6 @@ INSTALL( FILES daemonwatcher.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded ) tde_add_kpart( kded_daemonwatcher AUTOMOC SOURCES watcher.cpp watcher.skel - LINK kmrmlstuff-static tdeparts-shared kio-shared tdeinit_kded-shared + LINK kmrmlstuff-static tdeparts-shared tdeio-shared tdeinit_kded-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kolourpaint/kpcommandhistory.cpp b/kolourpaint/kpcommandhistory.cpp index db865a70..babbd4d9 100644 --- a/kolourpaint/kpcommandhistory.cpp +++ b/kolourpaint/kpcommandhistory.cpp @@ -37,7 +37,7 @@ #include #include -#include +#include #include #include #include diff --git a/kolourpaint/kpdocument.cpp b/kolourpaint/kpdocument.cpp index 100bd5ce..060f19eb 100644 --- a/kolourpaint/kpdocument.cpp +++ b/kolourpaint/kpdocument.cpp @@ -48,7 +48,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kolourpaint/kpdocumentsaveoptions.cpp b/kolourpaint/kpdocumentsaveoptions.cpp index 3a95171c..b617c469 100644 --- a/kolourpaint/kpdocumentsaveoptions.cpp +++ b/kolourpaint/kpdocumentsaveoptions.cpp @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include diff --git a/kolourpaint/kpdocumentsaveoptionswidget.cpp b/kolourpaint/kpdocumentsaveoptionswidget.cpp index ebc68382..d3a6d422 100644 --- a/kolourpaint/kpdocumentsaveoptionswidget.cpp +++ b/kolourpaint/kpdocumentsaveoptionswidget.cpp @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include #include diff --git a/kolourpaint/kpmainwindow.cpp b/kolourpaint/kpmainwindow.cpp index b073e01e..ee506883 100644 --- a/kolourpaint/kpmainwindow.cpp +++ b/kolourpaint/kpmainwindow.cpp @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include #include diff --git a/kolourpaint/kpmainwindow_file.cpp b/kolourpaint/kpmainwindow_file.cpp index c962d3eb..455732c9 100644 --- a/kolourpaint/kpmainwindow_file.cpp +++ b/kolourpaint/kpmainwindow_file.cpp @@ -37,13 +37,13 @@ #include #include #include -#include +#include #include -#include +#include #include #include #include -#include +#include #include #include #include diff --git a/kolourpaint/kpmainwindow_help.cpp b/kolourpaint/kpmainwindow_help.cpp index ef87fda6..9e351aac 100644 --- a/kolourpaint/kpmainwindow_help.cpp +++ b/kolourpaint/kpmainwindow_help.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include @@ -205,7 +205,7 @@ void kpMainWindow::slotHelpTakingScreenshotsFollowLink (const TQString &link) if (link == "configure kde shortcuts") { - KRun::runCommand ("kcmshell keys"); + KRun::runCommand ("tdecmshell keys"); } else if (link == "run ksnapshot") { diff --git a/kolourpaint/kpmainwindow_image.cpp b/kolourpaint/kpmainwindow_image.cpp index 6e54a7ad..6a2ef02e 100644 --- a/kolourpaint/kpmainwindow_image.cpp +++ b/kolourpaint/kpmainwindow_image.cpp @@ -34,7 +34,7 @@ #include #include -#include +#include #include #include #include diff --git a/kolourpaint/kpmainwindow_settings.cpp b/kolourpaint/kpmainwindow_settings.cpp index d3ca18f4..79746294 100644 --- a/kolourpaint/kpmainwindow_settings.cpp +++ b/kolourpaint/kpmainwindow_settings.cpp @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include #include diff --git a/kolourpaint/kpmainwindow_text.cpp b/kolourpaint/kpmainwindow_text.cpp index b0e406b5..e8d3b951 100644 --- a/kolourpaint/kpmainwindow_text.cpp +++ b/kolourpaint/kpmainwindow_text.cpp @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include diff --git a/kolourpaint/kpmainwindow_tools.cpp b/kolourpaint/kpmainwindow_tools.cpp index 14a541df..93132936 100644 --- a/kolourpaint/kpmainwindow_tools.cpp +++ b/kolourpaint/kpmainwindow_tools.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include diff --git a/kolourpaint/kpmainwindow_view.cpp b/kolourpaint/kpmainwindow_view.cpp index 4a95255a..49e5e229 100644 --- a/kolourpaint/kpmainwindow_view.cpp +++ b/kolourpaint/kpmainwindow_view.cpp @@ -36,7 +36,7 @@ #include #include -#include +#include #include #include #include diff --git a/kolourpaint/pixmapfx/kpeffectflatten.cpp b/kolourpaint/pixmapfx/kpeffectflatten.cpp index 001fb7e6..c870b5da 100644 --- a/kolourpaint/pixmapfx/kpeffectflatten.cpp +++ b/kolourpaint/pixmapfx/kpeffectflatten.cpp @@ -37,7 +37,7 @@ #include #include -#include +#include #include #include #include diff --git a/kolourpaint/pixmapfx/kpeffectsdialog.cpp b/kolourpaint/pixmapfx/kpeffectsdialog.cpp index 206fcc91..61df72e5 100644 --- a/kolourpaint/pixmapfx/kpeffectsdialog.cpp +++ b/kolourpaint/pixmapfx/kpeffectsdialog.cpp @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include diff --git a/kolourpaint/pixmapfx/kppixmapfx.cpp b/kolourpaint/pixmapfx/kppixmapfx.cpp index a861995f..d037758f 100644 --- a/kolourpaint/pixmapfx/kppixmapfx.cpp +++ b/kolourpaint/pixmapfx/kppixmapfx.cpp @@ -43,7 +43,7 @@ #include #include -#include +#include #include #include #include diff --git a/kolourpaint/tools/kptoolresizescale.cpp b/kolourpaint/tools/kptoolresizescale.cpp index 58c17abd..d3ae370d 100644 --- a/kolourpaint/tools/kptoolresizescale.cpp +++ b/kolourpaint/tools/kptoolresizescale.cpp @@ -52,7 +52,7 @@ #include #include -#include +#include #include #include #include diff --git a/kolourpaint/widgets/kpcolortoolbar.cpp b/kolourpaint/widgets/kpcolortoolbar.cpp index c66cedb4..5c6a2aca 100644 --- a/kolourpaint/widgets/kpcolortoolbar.cpp +++ b/kolourpaint/widgets/kpcolortoolbar.cpp @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kolourpaint/widgets/kptooltoolbar.cpp b/kolourpaint/widgets/kptooltoolbar.cpp index e33986c6..abe63d87 100644 --- a/kolourpaint/widgets/kptooltoolbar.cpp +++ b/kolourpaint/widgets/kptooltoolbar.cpp @@ -39,7 +39,7 @@ #include #include -#include +#include #include #include #include diff --git a/kolourpaint/widgets/kptoolwidgetbase.cpp b/kolourpaint/widgets/kptoolwidgetbase.cpp index ae70a906..fa123d29 100644 --- a/kolourpaint/widgets/kptoolwidgetbase.cpp +++ b/kolourpaint/widgets/kptoolwidgetbase.cpp @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include diff --git a/kooka/CHANGES b/kooka/CHANGES index 45997a77..3d87017b 100644 --- a/kooka/CHANGES +++ b/kooka/CHANGES @@ -82,7 +82,7 @@ the preview page. Nov 2001: Replaced the old ScanPackager object by a new one based on the new KFileTreeView -Widget in tdelibs/kfile. Hopefully soon full KURL support and more than one image +Widget in tdelibs/tdefile. Hopefully soon full KURL support and more than one image repository. Nov 2001: diff --git a/kooka/imageselectline.cpp b/kooka/imageselectline.cpp index a21b56c0..c037a958 100644 --- a/kooka/imageselectline.cpp +++ b/kooka/imageselectline.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include "imageselectline.h" diff --git a/kooka/img_saver.cpp b/kooka/img_saver.cpp index 5c61cd31..162cf3a2 100644 --- a/kooka/img_saver.cpp +++ b/kooka/img_saver.cpp @@ -31,17 +31,17 @@ #include -#include +#include #include #include #include #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include diff --git a/kooka/imgnamecombo.cpp b/kooka/imgnamecombo.cpp index 9364bef3..3b954f79 100644 --- a/kooka/imgnamecombo.cpp +++ b/kooka/imgnamecombo.cpp @@ -33,7 +33,7 @@ #include #include -#include +#include #include "imgnamecombo.h" #include "img_saver.h" diff --git a/kooka/kocrbase.cpp b/kooka/kocrbase.cpp index 168e9e63..ae1800b2 100644 --- a/kooka/kocrbase.cpp +++ b/kooka/kocrbase.cpp @@ -28,11 +28,11 @@ #include #include #include -#include -#include +#include +#include #include -#include +#include #include #include #include @@ -50,7 +50,7 @@ #include #include -#include +#include #include #include #include diff --git a/kooka/kocrbase.h b/kooka/kocrbase.h index f56d08c7..615ef05f 100644 --- a/kooka/kocrbase.h +++ b/kooka/kocrbase.h @@ -28,7 +28,7 @@ #define KOCRBASE_H #include -#include +#include #include #include diff --git a/kooka/kocrgocr.cpp b/kooka/kocrgocr.cpp index c4c34d4a..d5e9cad0 100644 --- a/kooka/kocrgocr.cpp +++ b/kooka/kocrgocr.cpp @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include #include diff --git a/kooka/kocrkadmos.cpp b/kooka/kocrkadmos.cpp index 013b5e1a..de0e520e 100644 --- a/kooka/kocrkadmos.cpp +++ b/kooka/kocrkadmos.cpp @@ -36,7 +36,7 @@ #include #include -#include +#include #include #include #include diff --git a/kooka/kocrocrad.cpp b/kooka/kocrocrad.cpp index f037e4b2..394548bc 100644 --- a/kooka/kocrocrad.cpp +++ b/kooka/kocrocrad.cpp @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include #include diff --git a/kooka/kooka.cpp b/kooka/kooka.cpp index 30186479..70ff9b21 100644 --- a/kooka/kooka.cpp +++ b/kooka/kooka.cpp @@ -42,9 +42,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/kooka/kookaimage.cpp b/kooka/kookaimage.cpp index ab491429..14e6ef83 100644 --- a/kooka/kookaimage.cpp +++ b/kooka/kookaimage.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include "kookaimage.h" #include "config.h" diff --git a/kooka/kookaimage.h b/kooka/kookaimage.h index b56c086b..14be4f86 100644 --- a/kooka/kookaimage.h +++ b/kooka/kookaimage.h @@ -34,7 +34,7 @@ #include #include -#include +#include class KFileItem; diff --git a/kooka/kookapref.cpp b/kooka/kookapref.cpp index e0996966..13db5c95 100644 --- a/kooka/kookapref.cpp +++ b/kooka/kookapref.cpp @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include #include diff --git a/kooka/kookaview.cpp b/kooka/kookaview.cpp index cc1c3af1..bdc2a075 100644 --- a/kooka/kookaview.cpp +++ b/kooka/kookaview.cpp @@ -59,7 +59,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kooka/ksaneocr.cpp b/kooka/ksaneocr.cpp index f35d1057..5ae8f1ba 100644 --- a/kooka/ksaneocr.cpp +++ b/kooka/ksaneocr.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include #include diff --git a/kooka/ocrresedit.cpp b/kooka/ocrresedit.cpp index f8e8f2c2..3ea563cc 100644 --- a/kooka/ocrresedit.cpp +++ b/kooka/ocrresedit.cpp @@ -28,7 +28,7 @@ #include "ocrresedit.h" #include "ocrword.h" #include -#include +#include #include #include diff --git a/kooka/scanpackager.cpp b/kooka/scanpackager.cpp index 24b815cb..ec9ad987 100644 --- a/kooka/scanpackager.cpp +++ b/kooka/scanpackager.cpp @@ -45,26 +45,26 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include #include #include #include -#include +#include #include #include #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #define STARTUP_FIRST_START "firstStart" @@ -630,7 +630,7 @@ void ScanPackager::loadImageForItem( KFileTreeViewItem *item ) } } -/* Hit this slot with a file for a kfiletreeviewitem. */ +/* Hit this slot with a file for a tdefiletreeviewitem. */ void ScanPackager::slImageArrived( KFileTreeViewItem *item, KookaImage* image ) { if( item && image ) @@ -892,7 +892,7 @@ KFileTreeViewItem *ScanPackager::spFindItem( SearchType type, const TQString nam { /* Prepare a list of branches to go through. If the parameter branch is set, search * only in the parameter branch. If it is zero, search all branches returned by - * kfiletreeview.branches() + * tdefiletreeview.branches() */ KFileTreeBranchList branchList; diff --git a/kooka/scanpackager.h b/kooka/scanpackager.h index 0f57b7fc..4e1cee38 100644 --- a/kooka/scanpackager.h +++ b/kooka/scanpackager.h @@ -34,10 +34,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include /** diff --git a/kooka/thumbview.cpp b/kooka/thumbview.cpp index d1b48045..e69f7b52 100644 --- a/kooka/thumbview.cpp +++ b/kooka/thumbview.cpp @@ -30,11 +30,11 @@ #include #include -#include +#include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/kooka/thumbview.h b/kooka/thumbview.h index c4c58323..4dff2559 100644 --- a/kooka/thumbview.h +++ b/kooka/thumbview.h @@ -37,9 +37,9 @@ #include #include -#include -#include -#include +#include +#include +#include /* TDEConfig group definitions */ #define MARGIN_COLOR1 "MarginColor1" diff --git a/kooka/thumbviewitem.cpp b/kooka/thumbviewitem.cpp index e682c34b..7479f535 100644 --- a/kooka/thumbviewitem.cpp +++ b/kooka/thumbviewitem.cpp @@ -26,8 +26,8 @@ * * ***************************************************************************/ -#include -#include +#include +#include #include "thumbview.h" #include "thumbviewitem.h" diff --git a/kooka/thumbviewitem.h b/kooka/thumbviewitem.h index 4478df34..fd1c8b48 100644 --- a/kooka/thumbviewitem.h +++ b/kooka/thumbviewitem.h @@ -31,9 +31,9 @@ #include #include -#include -#include -#include +#include +#include +#include class KFileTreeViewItem; diff --git a/kpdf/conf/preferencesdialog.h b/kpdf/conf/preferencesdialog.h index 488eb763..bc7b0cbf 100644 --- a/kpdf/conf/preferencesdialog.h +++ b/kpdf/conf/preferencesdialog.h @@ -10,7 +10,7 @@ #ifndef _PREFERENCESDIALOG_H #define _PREFERENCESDIALOG_H -#include +#include #include "conf/settings.h" class TQWidget; diff --git a/kpdf/part.cpp b/kpdf/part.cpp index f36d6ce5..0b3b9ca9 100644 --- a/kpdf/part.cpp +++ b/kpdf/part.cpp @@ -44,13 +44,13 @@ #include #include #include -#include +#include #include #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/kpdf/shell/shell.cpp b/kpdf/shell/shell.cpp index 5491321e..8b101fa9 100644 --- a/kpdf/shell/shell.cpp +++ b/kpdf/shell/shell.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include // local includes diff --git a/kpdf/ui/pageview.cpp b/kpdf/ui/pageview.cpp index 7b4d0e75..a76d03ea 100644 --- a/kpdf/ui/pageview.cpp +++ b/kpdf/ui/pageview.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kpovmodeler/kdoc.rules b/kpovmodeler/kdoc.rules index ca8abb0d..87e9cc96 100644 --- a/kpovmodeler/kdoc.rules +++ b/kpovmodeler/kdoc.rules @@ -6,5 +6,5 @@ kde_MODULES = kpovmodeler kpovmodeler_FILES = *.h -kpovmodeler_LIBS = -ltdeui -ltdeparts -ltdecore -ldcop -lkfile -lkio -lqt -p +kpovmodeler_LIBS = -ltdeui -ltdeparts -ltdecore -ldcop -ltdefile -lkio -lqt -p kpovmodeler_PATH = . \ No newline at end of file diff --git a/kpovmodeler/pmblendmapmodifiersedit.cpp b/kpovmodeler/pmblendmapmodifiersedit.cpp index fd443623..ab3634c8 100644 --- a/kpovmodeler/pmblendmapmodifiersedit.cpp +++ b/kpovmodeler/pmblendmapmodifiersedit.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include PMBlendMapModifiersEdit::PMBlendMapModifiersEdit( TQWidget* parent, const char* name ) : Base( parent, name ) diff --git a/kpovmodeler/pmbumpmapedit.cpp b/kpovmodeler/pmbumpmapedit.cpp index 5a4bf298..cdf14a44 100644 --- a/kpovmodeler/pmbumpmapedit.cpp +++ b/kpovmodeler/pmbumpmapedit.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include PMBumpMapEdit::PMBumpMapEdit( TQWidget* parent, const char* name ) diff --git a/kpovmodeler/pmcontrolpoint.cpp b/kpovmodeler/pmcontrolpoint.cpp index 70cab9d4..a6b5a497 100644 --- a/kpovmodeler/pmcontrolpoint.cpp +++ b/kpovmodeler/pmcontrolpoint.cpp @@ -19,7 +19,7 @@ #include "pmdefaults.h" #include "pmdebug.h" -#include +#include double PMControlPoint::s_moveGrid = c_defaultMoveGrid; double PMControlPoint::s_scaleGrid = c_defaultScaleGrid; diff --git a/kpovmodeler/pmdialogeditbase.cpp b/kpovmodeler/pmdialogeditbase.cpp index d56d1b2b..73bec441 100644 --- a/kpovmodeler/pmdialogeditbase.cpp +++ b/kpovmodeler/pmdialogeditbase.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include diff --git a/kpovmodeler/pmdockwidget.cpp b/kpovmodeler/pmdockwidget.cpp index e3e3c7b4..d92ab0bc 100644 --- a/kpovmodeler/pmdockwidget.cpp +++ b/kpovmodeler/pmdockwidget.cpp @@ -30,7 +30,7 @@ #include #ifndef NO_KDE2 -#include +#include #include #include #include diff --git a/kpovmodeler/pmdocumentationmap.cpp b/kpovmodeler/pmdocumentationmap.cpp index 2ee43a02..40e23d24 100644 --- a/kpovmodeler/pmdocumentationmap.cpp +++ b/kpovmodeler/pmdocumentationmap.cpp @@ -17,7 +17,7 @@ #include "pmdocumentationmap.h" -#include +#include #include #include diff --git a/kpovmodeler/pmerrordialog.cpp b/kpovmodeler/pmerrordialog.cpp index a8e84afc..f2b4ee62 100644 --- a/kpovmodeler/pmerrordialog.cpp +++ b/kpovmodeler/pmerrordialog.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include TQSize PMErrorDialog::s_size = TQSize( 150, 200 ); diff --git a/kpovmodeler/pmfiledialog.cpp b/kpovmodeler/pmfiledialog.cpp index 96085f19..8cee6b3a 100644 --- a/kpovmodeler/pmfiledialog.cpp +++ b/kpovmodeler/pmfiledialog.cpp @@ -19,7 +19,7 @@ #include "pmfiledialog.h" #include "pmpart.h" -#include +#include PMFileDialog::PMFileDialog( const TQString& startDir, const TQString& filter, TQWidget* parent, const char* name, bool modal ) diff --git a/kpovmodeler/pmfiledialog.h b/kpovmodeler/pmfiledialog.h index b45ce050..454cf1f8 100644 --- a/kpovmodeler/pmfiledialog.h +++ b/kpovmodeler/pmfiledialog.h @@ -24,7 +24,7 @@ #endif #include "pmiomanager.h" -#include +#include class PMPart; diff --git a/kpovmodeler/pmglview.cpp b/kpovmodeler/pmglview.cpp index 7bd9c0be..71e7eafa 100644 --- a/kpovmodeler/pmglview.cpp +++ b/kpovmodeler/pmglview.cpp @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include #include diff --git a/kpovmodeler/pmheightfieldedit.cpp b/kpovmodeler/pmheightfieldedit.cpp index cc413acf..851d6200 100644 --- a/kpovmodeler/pmheightfieldedit.cpp +++ b/kpovmodeler/pmheightfieldedit.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include PMHeightFieldEdit::PMHeightFieldEdit( TQWidget* parent, const char* name ) : Base( parent, name ) diff --git a/kpovmodeler/pmimagemapedit.cpp b/kpovmodeler/pmimagemapedit.cpp index 206d39a7..c2d7ff88 100644 --- a/kpovmodeler/pmimagemapedit.cpp +++ b/kpovmodeler/pmimagemapedit.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include PMImageMapEdit::PMImageMapEdit( TQWidget* parent, const char* name ) diff --git a/kpovmodeler/pmlibrarybrowser.cpp b/kpovmodeler/pmlibrarybrowser.cpp index f53d4301..71d5b89d 100644 --- a/kpovmodeler/pmlibrarybrowser.cpp +++ b/kpovmodeler/pmlibrarybrowser.cpp @@ -25,10 +25,10 @@ #include #include -#include +#include #include #include -#include +#include #include #include #include diff --git a/kpovmodeler/pmlibraryentrypreview.cpp b/kpovmodeler/pmlibraryentrypreview.cpp index 0ccfd5b4..86ea01e4 100644 --- a/kpovmodeler/pmlibraryentrypreview.cpp +++ b/kpovmodeler/pmlibraryentrypreview.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include PMLibraryEntryPreview::PMLibraryEntryPreview( TQWidget* parent ) : TQWidget( parent ) diff --git a/kpovmodeler/pmlibraryhandleedit.cpp b/kpovmodeler/pmlibraryhandleedit.cpp index 4629a388..17620df2 100644 --- a/kpovmodeler/pmlibraryhandleedit.cpp +++ b/kpovmodeler/pmlibraryhandleedit.cpp @@ -26,9 +26,9 @@ #include #include -#include +#include #include -#include +#include #include "pmlineedits.h" #include "pmdialogeditbase.h" diff --git a/kpovmodeler/pmlibraryiconview.cpp b/kpovmodeler/pmlibraryiconview.cpp index 757162ec..a0661059 100644 --- a/kpovmodeler/pmlibraryiconview.cpp +++ b/kpovmodeler/pmlibraryiconview.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include diff --git a/kpovmodeler/pmlibrarymanager.cpp b/kpovmodeler/pmlibrarymanager.cpp index cf9c6f96..4429a88b 100644 --- a/kpovmodeler/pmlibrarymanager.cpp +++ b/kpovmodeler/pmlibrarymanager.cpp @@ -17,7 +17,7 @@ #include "pmlibrarymanager.h" -#include +#include #include #include diff --git a/kpovmodeler/pmmaterialmapedit.cpp b/kpovmodeler/pmmaterialmapedit.cpp index 491f9d76..8ec346dd 100644 --- a/kpovmodeler/pmmaterialmapedit.cpp +++ b/kpovmodeler/pmmaterialmapedit.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include PMMaterialMapEdit::PMMaterialMapEdit( TQWidget* parent, const char* name ) diff --git a/kpovmodeler/pmobjectlibrarysettings.cpp b/kpovmodeler/pmobjectlibrarysettings.cpp index 47a38435..6dd1488c 100644 --- a/kpovmodeler/pmobjectlibrarysettings.cpp +++ b/kpovmodeler/pmobjectlibrarysettings.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include diff --git a/kpovmodeler/pmpalettevalueedit.cpp b/kpovmodeler/pmpalettevalueedit.cpp index ca029887..84a98e83 100644 --- a/kpovmodeler/pmpalettevalueedit.cpp +++ b/kpovmodeler/pmpalettevalueedit.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include PMPaletteValueEdit::PMPaletteValueEdit( TQWidget* parent, const char* name ) : TQWidget( parent, name ) diff --git a/kpovmodeler/pmpart.cpp b/kpovmodeler/pmpart.cpp index f58b87a3..7ca0a555 100644 --- a/kpovmodeler/pmpart.cpp +++ b/kpovmodeler/pmpart.cpp @@ -32,15 +32,15 @@ // include files for KDE #include -#include +#include #include #include #include #include -#include +#include #include #include -#include +#include // application specific includes #include "pmpart.h" diff --git a/kpovmodeler/pmpatternedit.cpp b/kpovmodeler/pmpatternedit.cpp index eb65727f..13c39c21 100644 --- a/kpovmodeler/pmpatternedit.cpp +++ b/kpovmodeler/pmpatternedit.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include PMPatternEdit::PMPatternEdit( TQWidget* parent, const char* name ) diff --git a/kpovmodeler/pmpluginmanager.cpp b/kpovmodeler/pmpluginmanager.cpp index f7313675..a9c86a1b 100644 --- a/kpovmodeler/pmpluginmanager.cpp +++ b/kpovmodeler/pmpluginmanager.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include PMPluginManager* PMPluginManager::s_pInstance = 0; KStaticDeleter PMPluginManager::s_staticDeleter; diff --git a/kpovmodeler/pmpovrayoutputwidget.cpp b/kpovmodeler/pmpovrayoutputwidget.cpp index 39c125d6..7ac52131 100644 --- a/kpovmodeler/pmpovrayoutputwidget.cpp +++ b/kpovmodeler/pmpovrayoutputwidget.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include diff --git a/kpovmodeler/pmpovrayrenderwidget.cpp b/kpovmodeler/pmpovrayrenderwidget.cpp index a47d66b0..8235e161 100644 --- a/kpovmodeler/pmpovrayrenderwidget.cpp +++ b/kpovmodeler/pmpovrayrenderwidget.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kpovmodeler/pmpovraysettings.cpp b/kpovmodeler/pmpovraysettings.cpp index 3ceaa83b..40153ce8 100644 --- a/kpovmodeler/pmpovraysettings.cpp +++ b/kpovmodeler/pmpovraysettings.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include PMPovraySettings::PMPovraySettings( TQWidget* parent, const char* name ) : PMSettingsDialogPage( parent, name ) diff --git a/kpovmodeler/pmpovraywidget.cpp b/kpovmodeler/pmpovraywidget.cpp index e077de69..c28b48b9 100644 --- a/kpovmodeler/pmpovraywidget.cpp +++ b/kpovmodeler/pmpovraywidget.cpp @@ -23,9 +23,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include #include diff --git a/kpovmodeler/pmrendermanager.cpp b/kpovmodeler/pmrendermanager.cpp index 2e56662a..746f64b9 100644 --- a/kpovmodeler/pmrendermanager.cpp +++ b/kpovmodeler/pmrendermanager.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include diff --git a/kpovmodeler/pmrendermodesdialog.cpp b/kpovmodeler/pmrendermodesdialog.cpp index e787616c..346f2219 100644 --- a/kpovmodeler/pmrendermodesdialog.cpp +++ b/kpovmodeler/pmrendermodesdialog.cpp @@ -29,9 +29,9 @@ #include #include -#include +#include #include -#include +#include #include "pmlineedits.h" diff --git a/kpovmodeler/pmsettingsdialog.cpp b/kpovmodeler/pmsettingsdialog.cpp index ade88b40..4bb6c568 100644 --- a/kpovmodeler/pmsettingsdialog.cpp +++ b/kpovmodeler/pmsettingsdialog.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include //#define KPM_WITH_OBJECT_LIBRARY diff --git a/kpovmodeler/pmshell.cpp b/kpovmodeler/pmshell.cpp index 13148682..35cd78cf 100644 --- a/kpovmodeler/pmshell.cpp +++ b/kpovmodeler/pmshell.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kpovmodeler/pmtextedit.cpp b/kpovmodeler/pmtextedit.cpp index e1e4e038..2ea76346 100644 --- a/kpovmodeler/pmtextedit.cpp +++ b/kpovmodeler/pmtextedit.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include PMTextEdit::PMTextEdit( TQWidget* parent, const char* name ) : Base( parent, name ) diff --git a/kpovmodeler/pmview.cpp b/kpovmodeler/pmview.cpp index a774aa28..c791375b 100644 --- a/kpovmodeler/pmview.cpp +++ b/kpovmodeler/pmview.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include diff --git a/kpovmodeler/pmviewlayoutmanager.cpp b/kpovmodeler/pmviewlayoutmanager.cpp index fe3a031d..b6d72b3c 100644 --- a/kpovmodeler/pmviewlayoutmanager.cpp +++ b/kpovmodeler/pmviewlayoutmanager.cpp @@ -20,7 +20,7 @@ #include "pmviewlayoutmanager.h" #include "pmdockwidget_private.h" -#include +#include #include #include #include diff --git a/kruler/klineal.cpp b/kruler/klineal.cpp index 7123fe04..686af2e5 100644 --- a/kruler/klineal.cpp +++ b/kruler/klineal.cpp @@ -17,7 +17,7 @@ #include -#include +#include #include #include #include diff --git a/ksnapshot/ksnapshot.cpp b/ksnapshot/ksnapshot.cpp index 6a6007ca..9fd455f5 100644 --- a/ksnapshot/ksnapshot.cpp +++ b/ksnapshot/ksnapshot.cpp @@ -13,13 +13,13 @@ #include #include -#include +#include #include #include #include #include #include -#include +#include #include #include diff --git a/ksvg/core/KSVGLoader.cpp b/ksvg/core/KSVGLoader.cpp index 3ae1d7ff..01601999 100644 --- a/ksvg/core/KSVGLoader.cpp +++ b/ksvg/core/KSVGLoader.cpp @@ -25,9 +25,9 @@ #include #include -#include +#include #include -#include +#include #include "SVGDocumentImpl.h" #include "SVGSVGElementImpl.h" diff --git a/ksvg/impl/SVGColorProfileElementImpl.cc b/ksvg/impl/SVGColorProfileElementImpl.cc index 85e3c035..0aa91e52 100644 --- a/ksvg/impl/SVGColorProfileElementImpl.cc +++ b/ksvg/impl/SVGColorProfileElementImpl.cc @@ -20,7 +20,7 @@ #include #include -#include +#include #include diff --git a/ksvg/impl/SVGScriptElementImpl.cc b/ksvg/impl/SVGScriptElementImpl.cc index b7ddf420..541c098d 100644 --- a/ksvg/impl/SVGScriptElementImpl.cc +++ b/ksvg/impl/SVGScriptElementImpl.cc @@ -20,7 +20,7 @@ #include -#include +#include #include #include diff --git a/ksvg/impl/SVGScriptElementImpl.h b/ksvg/impl/SVGScriptElementImpl.h index 72c75506..df7d88c0 100644 --- a/ksvg/impl/SVGScriptElementImpl.h +++ b/ksvg/impl/SVGScriptElementImpl.h @@ -23,7 +23,7 @@ #include -#include +#include #include diff --git a/ksvg/plugin/ksvg_plugin.cpp b/ksvg/plugin/ksvg_plugin.cpp index 49a95760..46e301fd 100644 --- a/ksvg/plugin/ksvg_plugin.cpp +++ b/ksvg/plugin/ksvg_plugin.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/ksvg/plugin/svgcreator.h b/ksvg/plugin/svgcreator.h index 53e8e2be..696251ce 100644 --- a/ksvg/plugin/svgcreator.h +++ b/ksvg/plugin/svgcreator.h @@ -22,7 +22,7 @@ #ifndef __svgcreator_h__ #define __svgcreator_h__ -#include +#include class SVGCreator : public TQObject, public ThumbCreator { diff --git a/kuickshow/ChangeLog b/kuickshow/ChangeLog index 4f455d15..eda22bb8 100644 --- a/kuickshow/ChangeLog +++ b/kuickshow/ChangeLog @@ -148,7 +148,7 @@ Tue May 29 15:20:34 2001 Carsten Pfeiffer changed accels: shift-accel is now for removing brightness/contrast/gamma - removed delete action, now provided by kfile + removed delete action, now provided by tdefile Thu Apr 19 23:16:12 2001 Carsten Pfeiffer @@ -413,9 +413,9 @@ Fri Nov 3 01:49:57 2000 Carsten Pfeiffer Thu Aug 31 01:48:55 2000 Carsten Pfeiffer * src/*: started reworking/rewriting the whole stuff to make it KDE2 - ready. Now I have to pay for rewriting so much of tdelibs/kfile... + ready. Now I have to pay for rewriting so much of tdelibs/tdefile... The good thing is: it's mostly about removing stuff from KuickShow - because the functionality is already in libkfile, now :) + because the functionality is already in libtdefile, now :) Tue Sep 28 10:35:39 1999 Carsten Pfeiffer @@ -473,7 +473,7 @@ Thu Jul 22 21:26:11 1999 Carsten Pfeiffer Fri Jul 16 13:09:07 1999 Carsten Pfeiffer - * src/kfileview.cpp (refresh): + * src/tdefileview.cpp (refresh): Oh well, thanks to Robert Hamberger , I fixed another (hopefully last, for the next time) segfault. SIGSEGV happened, when opening the about-dialog, NOT giving the focus back @@ -533,7 +533,7 @@ Fri Jul 2 14:27:08 1999 Carsten Pfeiffer in the filebrowser??? In certain cases, I got an almost completely black Messagebox... - * src/kfileview.cpp (removeItem): + * src/tdefileview.cpp (removeItem): oups... segfault fixed: removing the very first item in the filebrowser caused crash @@ -586,15 +586,15 @@ Fri May 28 11:48:46 1999 Carsten Pfeiffer Tue May 18 21:19:32 1999 Carsten Pfeiffer - * src/kfileview.cpp (refresh): + * src/tdefileview.cpp (refresh): sorting does somehow work. Some code seems to be duplicated in KFileInfoContents and KDir - both offer sorting. However, both don't work 100% :-/ Anyway, if you have KDE 1.1.1, sorting should work, it is disabled for earlier releases, as there was a segfault - problem in kfile (nobody ever seemed to use KFileInfoContent's sorting, + problem in tdefile (nobody ever seemed to use KFileInfoContent's sorting, so that was never realized). - * src/kfileview.cpp, src/fileview.cpp: + * src/tdefileview.cpp, src/fileview.cpp: some minor fixlets: always try to highlight the last active file, whenever the directory contents are updated @@ -630,7 +630,7 @@ Sat Apr 17 18:43:03 1999 Carsten Pfeiffer * src/kuickdata.cpp: updated file filters (Photoshop psd and bmp) - * src/kfileview.cpp: + * src/tdefileview.cpp: changed the kdir behavior, so that the browser displays files altogether at once, not incrementally. This also let me (finally, yippeee :-P) highlight the last direcory, where you came from. @@ -670,7 +670,7 @@ Wed Feb 3 22:43:32 1999 Carsten Pfeiffer Tue Dec 29 16:55:11 1998 Carsten Pfeiffer - * src/kuickshow.cpp, imlibwidget.cpp, kfileview.*: + * src/kuickshow.cpp, imlibwidget.cpp, tdefileview.*: fixed updating of directory in statusbar and filename in caption of imlibwidget @@ -773,8 +773,8 @@ Mon Sep 21 16:29:56 1998 Carsten Pfeiffer Sun Sep 20 19:04:23 1998 Carsten Pfeiffer - * src/kfileview.cpp (prev): - whoops, fixed a segfault, when trying to get a kfileinfo of index -1. + * src/tdefileview.cpp (prev): + whoops, fixed a segfault, when trying to get a tdefileinfo of index -1. I shouldn't check, whether an unsigned int is smaller than 0, which it actually was. Now uses int. @@ -853,7 +853,7 @@ Tue Sep 15 14:06:27 1998 Carsten Pfeiffer Mon Sep 14 16:20:30 1998 Carsten Pfeiffer * src/fileview.cpp/.h - * src/kfileview.cpp/.h + * src/tdefileview.cpp/.h * src/kuickshow.cpp added "change directory" possibility. A dialog asks for a directory and the fileview is being updated. Either accessible via the diff --git a/kuickshow/src/filefinder.cpp b/kuickshow/src/filefinder.cpp index 4f0d054a..9a2777b0 100644 --- a/kuickshow/src/filefinder.cpp +++ b/kuickshow/src/filefinder.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include #include diff --git a/kuickshow/src/filewidget.cpp b/kuickshow/src/filewidget.cpp index 9f158c1a..bc931794 100644 --- a/kuickshow/src/filewidget.cpp +++ b/kuickshow/src/filewidget.cpp @@ -93,7 +93,7 @@ void FileWidget::initActions() if ( coll->action("kuick_delete") ) menu->insert( coll->action("kuick_delete"), 9 ); - // properties dialog is now in kfile, but not at the right position, + // properties dialog is now in tdefile, but not at the right position, // so we move it to the real bottom menu->remove( coll->action( "properties" ) ); diff --git a/kuickshow/src/imagewindow.cpp b/kuickshow/src/imagewindow.cpp index 558e4c71..97aae529 100644 --- a/kuickshow/src/imagewindow.cpp +++ b/kuickshow/src/imagewindow.cpp @@ -37,14 +37,14 @@ #include #include -#include +#include #include #include #include #ifdef KDE_USE_FINAL #undef Unsorted #endif -#include +#include #include #include #include @@ -59,7 +59,7 @@ #include #include #include -#include +#include #include "filecache.h" #include "imagewindow.h" diff --git a/kuickshow/src/imdata.cpp b/kuickshow/src/imdata.cpp index e084e898..c580f7e3 100644 --- a/kuickshow/src/imdata.cpp +++ b/kuickshow/src/imdata.cpp @@ -18,7 +18,7 @@ #include -#include +#include #include "imdata.h" diff --git a/kuickshow/src/imlibwidget.cpp b/kuickshow/src/imlibwidget.cpp index 36420918..530875e8 100644 --- a/kuickshow/src/imlibwidget.cpp +++ b/kuickshow/src/imlibwidget.cpp @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include "filecache.h" diff --git a/kuickshow/src/kuickconfigdlg.cpp b/kuickshow/src/kuickconfigdlg.cpp index 263e98e7..e72062a8 100644 --- a/kuickshow/src/kuickconfigdlg.cpp +++ b/kuickshow/src/kuickconfigdlg.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include diff --git a/kuickshow/src/kuickdata.cpp b/kuickshow/src/kuickdata.cpp index c7b5f203..84c4ff38 100644 --- a/kuickshow/src/kuickdata.cpp +++ b/kuickshow/src/kuickdata.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include "kuickdata.h" diff --git a/kuickshow/src/kuickfile.cpp b/kuickshow/src/kuickfile.cpp index d0cff155..764210f0 100644 --- a/kuickshow/src/kuickfile.cpp +++ b/kuickshow/src/kuickfile.cpp @@ -5,8 +5,8 @@ #include #include #include -#include -#include +#include +#include #include #include "filecache.h" diff --git a/kuickshow/src/kuickshow.cpp b/kuickshow/src/kuickshow.cpp index 1e6352fa..da1651a4 100644 --- a/kuickshow/src/kuickshow.cpp +++ b/kuickshow/src/kuickshow.cpp @@ -33,15 +33,15 @@ #include #include #include -#include +#include #include #include -#include -#include +#include +#include #include #include #include -#include +#include #include #include #include diff --git a/kuickshow/src/kuickshow.h b/kuickshow/src/kuickshow.h index 31874153..baba06a3 100644 --- a/kuickshow/src/kuickshow.h +++ b/kuickshow/src/kuickshow.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include diff --git a/kview/config/CMakeLists.txt b/kview/config/CMakeLists.txt index 53b97f03..d2649a1c 100644 --- a/kview/config/CMakeLists.txt +++ b/kview/config/CMakeLists.txt @@ -24,7 +24,7 @@ link_directories( ##### other data ################################ -install( FILES kviewgeneralconfig.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kconfiguredialog ) +install( FILES kviewgeneralconfig.desktop DESTINATION ${SERVICES_INSTALL_DIR}/tdeconfiguredialog ) install( FILES kview.setdlg DESTINATION ${DATA_INSTALL_DIR}/kview ) diff --git a/kview/config/Makefile.am b/kview/config/Makefile.am index 5d09eee8..0c97cb33 100644 --- a/kview/config/Makefile.am +++ b/kview/config/Makefile.am @@ -12,7 +12,7 @@ kcm_kviewgeneralconfig_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) kcm_kviewgeneralconfig_la_LIBADD = $(LIB_TDEUI) kcm_kviewgeneralconfig_DATA = kviewgeneralconfig.desktop -kcm_kviewgeneralconfigdir = $(kde_servicesdir)/kconfiguredialog +kcm_kviewgeneralconfigdir = $(kde_servicesdir)/tdeconfiguredialog kviewappdatadir = $(kde_datadir)/kview kviewappdata_DATA = kview.setdlg diff --git a/kview/config/kviewconfmodules.cpp b/kview/config/kviewconfmodules.cpp index f36da30c..2316c920 100644 --- a/kview/config/kviewconfmodules.cpp +++ b/kview/config/kviewconfmodules.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include diff --git a/kview/config/plugins/CMakeLists.txt b/kview/config/plugins/CMakeLists.txt index f7c4672a..1b1fbec4 100644 --- a/kview/config/plugins/CMakeLists.txt +++ b/kview/config/plugins/CMakeLists.txt @@ -22,7 +22,7 @@ link_directories( ##### other data ################################ -install( FILES kviewpluginsconfig.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kconfiguredialog ) +install( FILES kviewpluginsconfig.desktop DESTINATION ${SERVICES_INSTALL_DIR}/tdeconfiguredialog ) ##### kcm_kviewpluginsconfig (module) ########### diff --git a/kview/config/plugins/Makefile.am b/kview/config/plugins/Makefile.am index d2169a9d..239504dd 100644 --- a/kview/config/plugins/Makefile.am +++ b/kview/config/plugins/Makefile.am @@ -11,7 +11,7 @@ kcm_kviewpluginsconfig_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) kcm_kviewpluginsconfig_la_LIBADD = $(LIB_KUTILS) kcm_kviewpluginsconfig_DATA = kviewpluginsconfig.desktop -kcm_kviewpluginsconfigdir = $(kde_servicesdir)/kconfiguredialog +kcm_kviewpluginsconfigdir = $(kde_servicesdir)/tdeconfiguredialog messages: rc.cpp $(XGETTEXT) *.cpp *.h -o $(podir)/kcm_kviewpluginsconfig.pot diff --git a/kview/kview.cpp b/kview/kview.cpp index 9aa38524..21b851c3 100644 --- a/kview/kview.cpp +++ b/kview/kview.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kview/kviewcanvas/config/CMakeLists.txt b/kview/kviewcanvas/config/CMakeLists.txt index 99fbb78f..fc094083 100644 --- a/kview/kviewcanvas/config/CMakeLists.txt +++ b/kview/kviewcanvas/config/CMakeLists.txt @@ -24,7 +24,7 @@ link_directories( install( FILES kviewcanvasconfig.desktop - DESTINATION ${SERVICES_INSTALL_DIR}/kconfiguredialog ) + DESTINATION ${SERVICES_INSTALL_DIR}/tdeconfiguredialog ) ##### kcm_kviewcanvasconfig (module) ############ diff --git a/kview/kviewcanvas/config/Makefile.am b/kview/kviewcanvas/config/Makefile.am index 25d77983..1439251e 100644 --- a/kview/kviewcanvas/config/Makefile.am +++ b/kview/kviewcanvas/config/Makefile.am @@ -8,7 +8,7 @@ kcm_kviewcanvasconfig_la_LDFLAGS = $(KDE_RPATH) $(all_libraries) -module -avoid- kcm_kviewcanvasconfig_la_LIBADD = $(LIB_TDEUI) kcm_kviewcanvasconfig_DATA = kviewcanvasconfig.desktop -kcm_kviewcanvasconfigdir = $(kde_servicesdir)/kconfiguredialog +kcm_kviewcanvasconfigdir = $(kde_servicesdir)/tdeconfiguredialog METASOURCES = AUTO diff --git a/kview/kviewcanvas/kimagecanvas.cpp b/kview/kviewcanvas/kimagecanvas.cpp index 4411d752..32260a45 100644 --- a/kview/kviewcanvas/kimagecanvas.cpp +++ b/kview/kviewcanvas/kimagecanvas.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #define KIMAGECANVAS_WIPESIZE 5 diff --git a/kview/kviewviewer/config/CMakeLists.txt b/kview/kviewviewer/config/CMakeLists.txt index d3640df6..10b5b05f 100644 --- a/kview/kviewviewer/config/CMakeLists.txt +++ b/kview/kviewviewer/config/CMakeLists.txt @@ -24,7 +24,7 @@ link_directories( install( FILES kviewviewerpluginsconfig.desktop - DESTINATION ${SERVICES_INSTALL_DIR}/kconfiguredialog ) + DESTINATION ${SERVICES_INSTALL_DIR}/tdeconfiguredialog ) ##### kcm_kviewviewerpluginsconfig (module) ##### diff --git a/kview/kviewviewer/config/Makefile.am b/kview/kviewviewer/config/Makefile.am index fe65e613..dfa55d4c 100644 --- a/kview/kviewviewer/config/Makefile.am +++ b/kview/kviewviewer/config/Makefile.am @@ -11,7 +11,7 @@ kcm_kviewviewerpluginsconfig_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) kcm_kviewviewerpluginsconfig_la_LIBADD = $(LIB_KUTILS) kcm_kviewviewerpluginsconfig_DATA = kviewviewerpluginsconfig.desktop -kcm_kviewviewerpluginsconfigdir = $(kde_servicesdir)/kconfiguredialog +kcm_kviewviewerpluginsconfigdir = $(kde_servicesdir)/tdeconfiguredialog messages: rc.cpp $(XGETTEXT) *.cpp *.h -o $(podir)/kcm_kviewviewerpluginsconfig.pot diff --git a/kview/kviewviewer/kviewviewer.cpp b/kview/kviewviewer/kviewviewer.cpp index 3e3c7085..4e318342 100644 --- a/kview/kviewviewer/kviewviewer.cpp +++ b/kview/kviewviewer/kviewviewer.cpp @@ -37,9 +37,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include #include diff --git a/kview/modules/browser/kmyfileitemlist.cpp b/kview/modules/browser/kmyfileitemlist.cpp index 28c3cb08..24d70527 100644 --- a/kview/modules/browser/kmyfileitemlist.cpp +++ b/kview/modules/browser/kmyfileitemlist.cpp @@ -18,7 +18,7 @@ // $Id$ #include "kmyfileitemlist.h" -#include +#include KMyFileItemList::KMyFileItemList() {} KMyFileItemList::KMyFileItemList( const TQPtrList & l ) : TQPtrList( l ) {} diff --git a/kview/modules/browser/kviewbrowser.h b/kview/modules/browser/kviewbrowser.h index 985ec564..a26b90c1 100644 --- a/kview/modules/browser/kviewbrowser.h +++ b/kview/modules/browser/kviewbrowser.h @@ -21,7 +21,7 @@ #define __kviewbrowser_h #include -#include +#include namespace KImageViewer { class Viewer; } diff --git a/kview/modules/presenter/CMakeLists.txt b/kview/modules/presenter/CMakeLists.txt index a34cc893..aa21d851 100644 --- a/kview/modules/presenter/CMakeLists.txt +++ b/kview/modules/presenter/CMakeLists.txt @@ -36,6 +36,6 @@ install( FILES tde_add_kpart( kview_presenterplugin AUTOMOC SOURCES imagelistitem.cpp imagelistdialog.ui kviewpresenter.cpp - LINK kio-shared tdeparts-shared + LINK tdeio-shared tdeparts-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kview/modules/presenter/config/CMakeLists.txt b/kview/modules/presenter/config/CMakeLists.txt index b8dfc56a..e359bee9 100644 --- a/kview/modules/presenter/config/CMakeLists.txt +++ b/kview/modules/presenter/config/CMakeLists.txt @@ -24,7 +24,7 @@ link_directories( install( FILES kviewpresenterconfig.desktop - DESTINATION ${SERVICES_INSTALL_DIR}/kconfiguredialog ) + DESTINATION ${SERVICES_INSTALL_DIR}/tdeconfiguredialog ) ##### kcm_kviewpresenterconfig (module) ######### diff --git a/kview/modules/presenter/config/Makefile.am b/kview/modules/presenter/config/Makefile.am index 8c212e7f..88d3d479 100644 --- a/kview/modules/presenter/config/Makefile.am +++ b/kview/modules/presenter/config/Makefile.am @@ -9,7 +9,7 @@ kcm_kviewpresenterconfig_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) kcm_kviewpresenterconfig_la_LIBADD = $(LIB_KUTILS) kcm_kviewpresenterconfig_DATA = kviewpresenterconfig.desktop -kcm_kviewpresenterconfigdir = $(kde_servicesdir)/kconfiguredialog +kcm_kviewpresenterconfigdir = $(kde_servicesdir)/tdeconfiguredialog METASOURCES = AUTO diff --git a/kview/modules/presenter/config/kviewpresenterconfig.cpp b/kview/modules/presenter/config/kviewpresenterconfig.cpp index 7ed447c2..c3682d5f 100644 --- a/kview/modules/presenter/config/kviewpresenterconfig.cpp +++ b/kview/modules/presenter/config/kviewpresenterconfig.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include typedef KGenericFactory KViewPresenterConfigFactory; diff --git a/kview/modules/presenter/imagelistdialog.ui b/kview/modules/presenter/imagelistdialog.ui index 05d3b90f..8878eab6 100644 --- a/kview/modules/presenter/imagelistdialog.ui +++ b/kview/modules/presenter/imagelistdialog.ui @@ -256,9 +256,9 @@ kdialog.h kdebug.h kimageviewer/viewer.h - kio/netaccess.h + tdeio/netaccess.h kurl.h - kfiledialog.h + tdefiledialog.h tqstring.h kmessagebox.h imagelistitem.h diff --git a/kview/modules/presenter/kviewpresenter.cpp b/kview/modules/presenter/kviewpresenter.cpp index 534b305c..b7aef984 100644 --- a/kview/modules/presenter/kviewpresenter.cpp +++ b/kview/modules/presenter/kviewpresenter.cpp @@ -39,11 +39,11 @@ #include #include #include -#include +#include #include #include #include -#include +#include #include #include #include diff --git a/kview/modules/presenter/kviewpresenterconfmodule.cpp b/kview/modules/presenter/kviewpresenterconfmodule.cpp index 1c79ee15..df9622b8 100644 --- a/kview/modules/presenter/kviewpresenterconfmodule.cpp +++ b/kview/modules/presenter/kviewpresenterconfmodule.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include KViewPresenterConfModule::KViewPresenterConfModule( TQObject * parent ) : KPreferencesModule( "kviewpresenter", parent, "KView Presenter Config Module" ) diff --git a/kview/photobook/photobook.h b/kview/photobook/photobook.h index 7faaaa32..e19abe36 100644 --- a/kview/photobook/photobook.h +++ b/kview/photobook/photobook.h @@ -40,7 +40,7 @@ Copyright (c) 2004 Charles Samuels #define PHOTOBOOK_H #include -#include +#include #include #include diff --git a/kviewshell/kviewpart.cpp b/kviewshell/kviewpart.cpp index f76c5dd2..017d3e17 100644 --- a/kviewshell/kviewpart.cpp +++ b/kviewshell/kviewpart.cpp @@ -12,16 +12,16 @@ #include #include #include -#include -#include +#include +#include #include #include -#include +#include #include #include #include #include -#include +#include #include #include #include diff --git a/kviewshell/kviewshell.cpp b/kviewshell/kviewshell.cpp index b155e73e..a45563c3 100644 --- a/kviewshell/kviewshell.cpp +++ b/kviewshell/kviewshell.cpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kviewshell/kvsprefs.kcfgc b/kviewshell/kvsprefs.kcfgc index c507ba3d..f72f4bd0 100644 --- a/kviewshell/kvsprefs.kcfgc +++ b/kviewshell/kvsprefs.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=kviewshell.kcfg ClassName=KVSPrefs Singleton=true diff --git a/kviewshell/plugins/djvu/djvumultipage.cpp b/kviewshell/plugins/djvu/djvumultipage.cpp index dd6d08b1..c60c7c9c 100644 --- a/kviewshell/plugins/djvu/djvumultipage.cpp +++ b/kviewshell/plugins/djvu/djvumultipage.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include #include diff --git a/kviewshell/plugins/djvu/prefs.kcfgc b/kviewshell/plugins/djvu/prefs.kcfgc index 93a7650b..80838068 100644 --- a/kviewshell/plugins/djvu/prefs.kcfgc +++ b/kviewshell/plugins/djvu/prefs.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=djvumultipage.kcfg ClassName=Prefs Singleton=true diff --git a/kviewshell/tdemultipage.cpp b/kviewshell/tdemultipage.cpp index b6b98855..d08dead7 100644 --- a/kviewshell/tdemultipage.cpp +++ b/kviewshell/tdemultipage.cpp @@ -3,9 +3,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include #include diff --git a/libkscan/CMakeLists.txt b/libkscan/CMakeLists.txt index 12ecff9f..b108f9e9 100644 --- a/libkscan/CMakeLists.txt +++ b/libkscan/CMakeLists.txt @@ -43,7 +43,7 @@ tde_add_library( kscan SHARED AUTOMOC img_canvas.cpp previewer.cpp imgscaledialog.cpp sizeindicator.cpp imgscaninfo.cpp VERSION 1.0.0 - LINK kio-shared ${SANE_LIBRARIES} + LINK tdeio-shared ${SANE_LIBRARIES} DESTINATION ${LIB_INSTALL_DIR} ) diff --git a/libkscan/devselector.cpp b/libkscan/devselector.cpp index 2945dfdd..2caa054a 100644 --- a/libkscan/devselector.cpp +++ b/libkscan/devselector.cpp @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include #include diff --git a/libkscan/kscandevice.cpp b/libkscan/kscandevice.cpp index d42ddb9f..41e05570 100644 --- a/libkscan/kscandevice.cpp +++ b/libkscan/kscandevice.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include diff --git a/libkscan/kscanoptset.cpp b/libkscan/kscanoptset.cpp index 0c9b76e6..84e034c8 100644 --- a/libkscan/kscanoptset.cpp +++ b/libkscan/kscanoptset.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include "kscandevice.h" #include "kscanoption.h" diff --git a/libkscan/previewer.cpp b/libkscan/previewer.cpp index 183c7ba6..c13e45e3 100644 --- a/libkscan/previewer.cpp +++ b/libkscan/previewer.cpp @@ -43,7 +43,7 @@ #include "kscandevice.h" #include #include -#include +#include #include #include #include diff --git a/libkscan/scandialog.cpp b/libkscan/scandialog.cpp index c4b8691b..9a0d2bf0 100644 --- a/libkscan/scandialog.cpp +++ b/libkscan/scandialog.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/libkscan/scanparams.cpp b/libkscan/scanparams.cpp index 896bf92e..64bcde21 100644 --- a/libkscan/scanparams.cpp +++ b/libkscan/scanparams.cpp @@ -36,7 +36,7 @@ #include -#include +#include #include #include #include diff --git a/tdefile-plugins/CMakeLists.txt b/tdefile-plugins/CMakeLists.txt new file mode 100644 index 00000000..238bc4b2 --- /dev/null +++ b/tdefile-plugins/CMakeLists.txt @@ -0,0 +1,31 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( dependencies ) +add_subdirectory( dvi ) +add_subdirectory( png ) +add_subdirectory( ps ) +add_subdirectory( jpeg ) +add_subdirectory( xbm ) +add_subdirectory( xpm ) +add_subdirectory( bmp ) +add_subdirectory( tga ) +add_subdirectory( rgb ) +add_subdirectory( ico ) +add_subdirectory( pcx ) +add_subdirectory( pnm ) +add_subdirectory( dds ) +add_subdirectory( gif ) +add_subdirectory( raw ) + +tde_conditional_add_subdirectory( WITH_TIFF tiff ) +tde_conditional_add_subdirectory( WITH_OPENEXR exr ) +tde_conditional_add_subdirectory( WITH_PDF pdf ) diff --git a/tdefile-plugins/Makefile.am b/tdefile-plugins/Makefile.am new file mode 100644 index 00000000..bc15008f --- /dev/null +++ b/tdefile-plugins/Makefile.am @@ -0,0 +1,14 @@ +if include_EXR_MODULES +KFILE_EXR_SUBDIR=exr +endif + +if include_TIFF +KFILE_TIFF_SUBDIR=tiff +endif + +if include_PDF +KFILE_PDF_SUBDIR=pdf +endif + +SUBDIRS=dependencies dvi png ps jpeg xbm xpm bmp tga rgb ico pcx $(KFILE_TIFF_SUBDIR) pnm \ + $(KFILE_EXR_SUBDIR) $(KFILE_PDF_SUBDIR) dds gif raw diff --git a/tdefile-plugins/RETURNED_ITEMS b/tdefile-plugins/RETURNED_ITEMS new file mode 100644 index 00000000..70a3b519 --- /dev/null +++ b/tdefile-plugins/RETURNED_ITEMS @@ -0,0 +1,245 @@ +If you make a new plugin, please add the list of returned items to this list. + + +pdf plugin: +=========== + +Date Created +Date Modiified +Int Pages +Bool Encrypted +and everything else pdfinfo returns as string + + +png plugin: +=========== + +type key W/A details +------------------------------------------------------------------------ +Size Dimensions -/- +Int BitDepth -/- +String ColorMode -/- +String Compression -/- Compression type. Right now always "deflate" + +Other keys corresponding to the png comment keys are returned as non-editable +String. + +Common keys that are recommended in the png spec: +Title, Author, Description, Copyright, Creation Time, Software, Disclaimer, +Warning, Source, Comment + + +PostScript plugin: +================== + +String Title +String Creator +String CreationDate +String For +Int Pages + + + +Jpeg plugin: +============ +Note: number.number means precision of converted number + +type key Comment +----------------------------------------------------------------------------- +String Camera make +String Camera model +String Date/time +Size Dimensions Width x Height in pixels +int Qt::Orientation 1 - "The 0th row is at the visual top of the image, + and the 0th column is the visual left-hand side." + 2 - "The 0th row is at the visual top of the image, + and the 0th column is the visual right-hand side." + 3 - "The 0th row is at the visual bottom of the image, + and the 0th column is the visual right-hand side." + 4 - "The 0th row is at the visual bottom of the image, + and the 0th column is the visual left-hand side." + 5 - "The 0th row is the visual left-hand side of of the image, + and the 0th column is the visual top." + 6 - "The 0th row is the visual right-hand side of of the image, + and the 0th column is the visual top." + 7 - "The 0th row is the visual right-hand side of of the image, + and the 0th column is the visual bottom." + 8 - "The 0th row is the visual left-hand side of of the image, + and the 0th column is the visual bottom." +String ColorMode "Grayscale" "Color" +String Flash used "Yes" "No" +String Focal length 4.1 mm, 35mm equivalent +String Exposure time 6.3 (if < 0.5 also in 1/xx) sec +String Aperture "f/3.1" +String Focus dist. "Infinite" or 5.2 m +String CCD width 4.2 Postfix mm +String Exposure bias 4.2 +String Whitebalance 0 = unknown + 1 = Daylight + 2 = Fluorescent + 3 = Tungsten + 17 = Standard light A + 18 = Standard light B + 19 = Standard light C + 20 = D55 + 21 = D65 + 22 = D75 + 23 to 254 = reserved + 255 = other +String Metering mode 0 = unknown + 1 = Average + 2 = CenterWeightedAverage + 3 = Spot + 4 = MultiSpot + 5 = Pattern + 6 = Partial + 7 to 254 = reserved + 255 = other +String Exposure 0 = Not defined + 1 = Manual + 2 = Normal program + 3 = Aperture priority + 4 = Shutter priority + 5 = Creative program (biased toward depth of field) + 6 = Action program + (biased toward fast shutter speed) + 7 = Portrait mode + (for closeup photos with the background out of focus) + 8 = Landscape mode + (for landscape photos with the background in focus) + 9 to 255 = reserved +String ISO equiv. 2digits ??? +String JPG quality 1 - "basic" + 2 - "normal" + 4 - "fine" + default: unknown +String User comment +String Comment +QImage Thumbnail + + +gif plugin: +=========== + +type key Comment +----------------------------------------------------------------------------- +Size Dimensions Width x Height in pixels. +String Comment gif comment blocks, which we permit to be utf-8 encoded + in clear violation/extension of the specification which + calls for 7 bit ASCII. See: + http://www.geocities.co.jp/SiliconValley/3453/gif_info/index_en.html + + +TIFF plugin: +=========== + +:: Group: General :: + +type key Comment +------ -------------- ----------------------------------------------------- +String ColorMode Color Mode (Monochrome, RGB, RGBA etc) +Size Dimensions Width & height as a QSize object +Size Resolution x & y resolution in dpi as a QSize object +Int BitDepth No. of bits per pixel (e.g. 24 for 8-bit RGB) +String Compression Compression used (None, Deflate, LZW, JPEG etc.) +Int FaxPages No. of pages if this is fax +String Software Software used to produce this image +String Description Image description +String Copyright Copyright information +String DateTime Date and time of image creation +String Artist Name of the person who created this image + +:: Group: Scanner :: + +type key Comment +------ -------------- ----------------------------------------------------- +String Make Make of the scanner used +String Model Model of the scanner used + + + + + +xbm plugin: +=========== + +type key W/A details +------------------------------------------------------------------------ +QSize Dimensions -/- Dimensions in pixels + +xpm plugin: +=========== + +type key W/A details +------------------------------------------------------------------------ +QSize Dimensions -/- Dimensions in pixels +Int BitDepth -/- Bits per pixel + + +bmp plugin: +=========== + +type key W/A details +------------------------------------------------------------------------ +String Type -/- Bitmap type (Windows / OS/2) +QSize Dimensions -/- Dimensions in pixels +Int BitDepth -/- Bits per pixel +String Compression -/- Compression type + + +tga plugin: +=========== + +type key W/A details +------------------------------------------------------------------------ +QSize Dimensions -/- Dimensions in pixels +Int BitDepth -/- Bits per pixel +String ColorMode -/- Color mode (e.g. RGB) +String Compression -/- Compression type, if any + + +ico plugin: +=========== + +type key W/A details +------------------------------------------------------------------------ +Int Number -/- Number of icons in file +QSize Dimensions -/- Dimensions +QSize DimensionsM -/- Dimensions [of 1st icon] +Int Colors -/- Number of colors [in 1st icon] + +pcx plugin: +=========== + +type key W/A details +------------------------------------------------------------------------ +QSize Dimensions -/- Dimensions in pixels +Int BitDepth -/- Bits per pixel +QSize Resolution -/- Resolution in DPI +String Compression -/- Compression type, if any + + +rgb plugin: +=========== + +type key details +------------------------------------------------------------------------ +String ImageName Image name (or comment) +QSize Dimensions Dimensions in pixels +Int BitDepth Bits per pixel +String ColorMode Color Mode (Monochrome, RGB, RGBA etc) +String Compression Compression type +String SharedRows Percentage of shared rows + (amount of "aggression" -> see GIMP) +dds plugin: +=========== + +type key details +------------------------------------------------------------------------ +QSize Dimensions Dimensions in pixels +Int Depth Depth in pixels +Int BitDepth Bits per pixel +String ColorMode Color Mode (RGB, RGBA) +String Type 2D, volume or cube map +String Compression Compression type + diff --git a/tdefile-plugins/bmp/CMakeLists.txt b/tdefile-plugins/bmp/CMakeLists.txt new file mode 100644 index 00000000..1bc54e24 --- /dev/null +++ b/tdefile-plugins/bmp/CMakeLists.txt @@ -0,0 +1,34 @@ +################################################# +# +# (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_bmp.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +#### tdefile_bmp (module) ######################### + +tde_add_kpart( tdefile_bmp AUTOMOC + SOURCES tdefile_bmp.cpp + LINK tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/bmp/Makefile.am b/tdefile-plugins/bmp/Makefile.am new file mode 100644 index 00000000..f8f70112 --- /dev/null +++ b/tdefile-plugins/bmp/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for bmp 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_bmp.h + +kde_module_LTLIBRARIES = tdefile_bmp.la + +tdefile_bmp_la_SOURCES = tdefile_bmp.cpp +tdefile_bmp_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdefile_bmp_la_LIBADD = $(LIB_KSYCOCA) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) tdefile_bmp.cpp -o $(podir)/tdefile_bmp.pot + +services_DATA = tdefile_bmp.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/bmp/tdefile_bmp.cpp b/tdefile-plugins/bmp/tdefile_bmp.cpp new file mode 100644 index 00000000..354ea54e --- /dev/null +++ b/tdefile-plugins/bmp/tdefile_bmp.cpp @@ -0,0 +1,174 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Shane Wright + * + * 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 +#include "tdefile_bmp.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#if !defined(__osf__) +#include +#else +typedef unsigned long uint32_t; +typedef unsigned short uint16_t; +#endif + +typedef KGenericFactory BmpFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_bmp, BmpFactory( "tdefile_bmp" )) + +KBmpPlugin::KBmpPlugin(TQObject *parent, const char *name, + const TQStringList &args) + + : KFilePlugin(parent, name, args) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( "image/x-bmp" ); + + KFileMimeTypeInfo::GroupInfo* group = 0L; + + group = addGroupInfo(info, "Technical", i18n("Technical Details")); + + KFileMimeTypeInfo::ItemInfo* item; + + item = addItemInfo(group, "Type", i18n("Type"), TQVariant::String); + + 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, "Compression", i18n("Compression"), TQVariant::String); + +} + + +bool KBmpPlugin::readInfo( KFileMetaInfo& info, uint what) +{ + const char * bmptype_bm = "BM"; + const char * bmptype_ba = "BA"; + const char * bmptype_ci = "CI"; + const char * bmptype_cp = "CP"; + const char * bmptype_ic = "IC"; + const char * bmptype_pt = "PT"; + + TQFile file(info.path()); + + if (!file.open(IO_ReadOnly)) + { + kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()).data() << endl; + return false; + } + + TQDataStream dstream(&file); + + // BMP files are little-endian + dstream.setByteOrder(TQDataStream::LittleEndian); + + // create this now because we output image type early on + KFileMetaInfoGroup group = appendGroup(info, "Technical"); + + + // read the beginning of the file and make sure it looks ok + unsigned char * bmp_id = (unsigned char *) malloc(2); + file.readBlock((char *) bmp_id, 2); + + if (memcmp(bmp_id, bmptype_bm, 2) == 0) { + appendItem(group, "Type", i18n("Windows Bitmap")); + } else if (memcmp(bmp_id, bmptype_ba, 2) == 0) { + appendItem(group, "Type", i18n("OS/2 Bitmap Array")); + } else if (memcmp(bmp_id, bmptype_ci, 2) == 0) { + appendItem(group, "Type", i18n("OS/2 Color Icon")); + } else if (memcmp(bmp_id, bmptype_cp, 2) == 0) { + appendItem(group, "Type", i18n("OS/2 Color Pointer")); + } else if (memcmp(bmp_id, bmptype_ic, 2) == 0) { + appendItem(group, "Type", i18n("OS/2 Icon")); + } else if (memcmp(bmp_id, bmptype_pt, 2) == 0) { + appendItem(group, "Type", i18n("OS/2 Pointer")); + } else { + return false; + } + + free(bmp_id); + + + // read the next bits, we ignore them, but anyways... + uint32_t bmp_size; + uint16_t bmp_reserved1; + uint16_t bmp_reserved2; + uint32_t bmp_offbits; + + dstream >> bmp_size; + dstream >> bmp_reserved1; + dstream >> bmp_reserved2; + dstream >> bmp_offbits; + + + // we should now be at the file info structure + uint32_t bmpi_size; + uint32_t bmpi_width; + uint32_t bmpi_height; + uint16_t bmpi_planes; + uint16_t bmpi_bitcount; + uint32_t bmpi_compression; + + dstream >> bmpi_size; + dstream >> bmpi_width; + dstream >> bmpi_height; + dstream >> bmpi_planes; + dstream >> bmpi_bitcount; + dstream >> bmpi_compression; + + + // output the useful bits + appendItem(group, "Dimensions", TQSize(bmpi_width, bmpi_height)); + appendItem(group, "BitDepth", bmpi_bitcount); + + switch (bmpi_compression) { + case 0 : + appendItem(group, "Compression", i18n("None")); + break; + case 1 : + appendItem(group, "Compression", i18n("RLE 8bit/pixel")); + break; + case 2 : + appendItem(group, "Compression", i18n("RLE 4bit/pixel")); + break; + case 3 : + appendItem(group, "Compression", i18n("Bitfields")); + break; + default : + appendItem(group, "Compression", i18n("Unknown")); + } + + return true; +} + +#include "tdefile_bmp.moc" diff --git a/tdefile-plugins/bmp/tdefile_bmp.desktop b/tdefile-plugins/bmp/tdefile_bmp.desktop new file mode 100644 index 00000000..6331c397 --- /dev/null +++ b/tdefile-plugins/bmp/tdefile_bmp.desktop @@ -0,0 +1,66 @@ +[Desktop Entry] +Type=Service +Name=BMP Info +Name[af]=Bmp Inligting +Name[ar]=معلومات BMP +Name[br]=Titouroù BMP +Name[ca]=Informació de BMP +Name[cs]=BMP info +Name[cy]=Gwybodaeth BMP +Name[da]=BMP-info +Name[de]=BMP-Info +Name[el]=Πληροφορίες BMP +Name[eo]=BMP-informo +Name[es]=Info BMP +Name[et]=BMP info +Name[fa]=اطلاعات BMP +Name[fi]=BMP-tiedot +Name[fr]=Informations BMP +Name[ga]=Eolas faoi BMP +Name[gl]=Inf. BMP +Name[he]=מידע BMP +Name[hi]=BMP जानकारी +Name[hr]=BMP informacije +Name[hu]=BMP-jellemzők +Name[is]=BMP upplýsingar +Name[it]=Informazioni BMP +Name[ja]=BMP 情報 +Name[kk]=BMP мәліметі +Name[km]=ព័ត៌មាន BMP +Name[lt]=BMP informacija +Name[ms]=Maklumat BMP +Name[nds]=BMP-Info +Name[ne]=BMP सूचना +Name[nl]=BMP-info +Name[nn]=BMP-info +Name[nso]=Tshedimoso ya BMP +Name[pa]=BMP ਜਾਣਕਾਰੀ +Name[pl]=Informacja o pliku BMP +Name[pt]=Informação do BMP +Name[pt_BR]=Informação sobre BMP +Name[ro]=Informaţii BMP +Name[ru]=Информация о BMP +Name[se]=BMP-dieđut +Name[sl]=Podatki o BMP +Name[sr]=BMP информације +Name[sr@Latn]=BMP informacije +Name[sv]=BMP-information +Name[ta]=BMP தகவல் +Name[tg]=Иттилоот оиди BMP +Name[th]=ข้อมูลแฟ้ม BMP +Name[tr]=BMP Bilgisi +Name[uk]=Інформація по BMP +Name[uz]=BMP haqida maʼlumot +Name[uz@cyrillic]=BMP ҳақида маълумот +Name[ven]=Mafhungo BMP +Name[wa]=Informåcion sol imådje BMP +Name[xh]=Ulwazi lwe BMP +Name[zh_CN]=BMP 信息 +Name[zh_HK]=BMP 資訊 +Name[zh_TW]=BMP 資訊 +Name[zu]=Ulwazi lwe-BMP +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_bmp +MimeType=image/x-bmp +PreferredGroups=Technical +PreferredItems=Type,Resolution,Bitdepth,Compression diff --git a/tdefile-plugins/bmp/tdefile_bmp.h b/tdefile-plugins/bmp/tdefile_bmp.h new file mode 100644 index 00000000..27bc31a6 --- /dev/null +++ b/tdefile-plugins/bmp/tdefile_bmp.h @@ -0,0 +1,38 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Shane Wright + * + * 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_BMP_H__ +#define __KFILE_BMP_H__ + +#include + +class TQStringList; + +class KBmpPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KBmpPlugin( TQObject *parent, const char *name, const TQStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint what); +}; + +#endif diff --git a/tdefile-plugins/configure.in.bot b/tdefile-plugins/configure.in.bot new file mode 100644 index 00000000..f03bc711 --- /dev/null +++ b/tdefile-plugins/configure.in.bot @@ -0,0 +1,32 @@ +if test -z "$LIBTIFF"; then + echo "" + echo "You're missing libtiff. The additional info plugin for TIFF images" + echo "files won't be compiled without libtiff." + echo "You can download it from http://www.libtiff.org" + echo "" + all_tests=bad +fi + +#if test -z "$POPPLER_LIBS"; then +# echo "" +# echo "You're missing poppler. The additional info plugin for PDF files" +# echo "files won't be compiled without poppler >= 0.3.1." +# echo "You can download poppler from http://poppler.freedesktop.org/" +# echo "" +#fi + +if test "$EXRSTATUS" = "no"; then + echo "" + echo "No OpenEXR Libraries were found" + echo "Install the OpenEXR package (from http://www.openexr.org)" + echo "if you want EXR image format support" + echo "" +fi + +if test "$EXRSTATUS" = "old"; then + echo "" + echo "OpenEXR libraries were found, but at least version 1.1.0 is required" + echo "Install a newer OpenEXR package (from http://www.openexr.org)" + echo "if you want EXR image format support" + echo "" +fi diff --git a/tdefile-plugins/dds/CMakeLists.txt b/tdefile-plugins/dds/CMakeLists.txt new file mode 100644 index 00000000..eb367982 --- /dev/null +++ b/tdefile-plugins/dds/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_dds.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +#### tdefile_dds (module) ########################## + +tde_add_kpart( tdefile_dds AUTOMOC + SOURCES tdefile_dds.cpp + LINK tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/dds/Makefile.am b/tdefile-plugins/dds/Makefile.am new file mode 100644 index 00000000..ce77c9c3 --- /dev/null +++ b/tdefile-plugins/dds/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for dds 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_dds.h + +kde_module_LTLIBRARIES = tdefile_dds.la + +tdefile_dds_la_SOURCES = tdefile_dds.cpp +tdefile_dds_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdefile_dds_la_LIBADD = $(LIB_KSYCOCA) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) tdefile_dds.cpp -o $(podir)/tdefile_dds.pot + +services_DATA = tdefile_dds.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/dds/tdefile_dds.cpp b/tdefile-plugins/dds/tdefile_dds.cpp new file mode 100644 index 00000000..e49bf498 --- /dev/null +++ b/tdefile-plugins/dds/tdefile_dds.cpp @@ -0,0 +1,317 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Ignacio Casta�o + * + * 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 +#include "tdefile_dds.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + + +typedef KGenericFactory DdsFactory; + +typedef TQ_UINT32 uint; +typedef TQ_UINT16 ushort; +typedef TQ_UINT8 uchar; + +namespace { // Private. + +#if !defined(MAKEFOURCC) +# define MAKEFOURCC(ch0, ch1, ch2, ch3) \ + (uint(uchar(ch0)) | (uint(uchar(ch1)) << 8) | \ + (uint(uchar(ch2)) << 16) | (uint(uchar(ch3)) << 24 )) +#endif + + static const uint FOURCC_DDS = MAKEFOURCC('D', 'D', 'S', ' '); + static const uint FOURCC_DXT1 = MAKEFOURCC('D', 'X', 'T', '1'); + static const uint FOURCC_DXT2 = MAKEFOURCC('D', 'X', 'T', '2'); + static const uint FOURCC_DXT3 = MAKEFOURCC('D', 'X', 'T', '3'); + static const uint FOURCC_DXT4 = MAKEFOURCC('D', 'X', 'T', '4'); + static const uint FOURCC_DXT5 = MAKEFOURCC('D', 'X', 'T', '5'); + static const uint FOURCC_RXGB = MAKEFOURCC('R', 'X', 'G', 'B'); + + static const uint DDSD_CAPS = 0x00000001l; + static const uint DDSD_PIXELFORMAT = 0x00001000l; + static const uint DDSD_WIDTH = 0x00000004l; + static const uint DDSD_HEIGHT = 0x00000002l; + static const uint DDSD_PITCH = 0x00000008l; + + static const uint DDSCAPS_TEXTURE = 0x00001000l; + static const uint DDSCAPS2_VOLUME = 0x00200000l; + static const uint DDSCAPS2_CUBEMAP = 0x00000200l; + + static const uint DDPF_RGB = 0x00000040l; + static const uint DDPF_FOURCC = 0x00000004l; + static const uint DDPF_ALPHAPIXELS = 0x00000001l; + + enum DDSType { + DDS_A8R8G8B8 = 0, + DDS_A1R5G5B5 = 1, + DDS_A4R4G4B4 = 2, + DDS_R8G8B8 = 3, + DDS_R5G6B5 = 4, + DDS_DXT1 = 5, + DDS_DXT2 = 6, + DDS_DXT3 = 7, + DDS_DXT4 = 8, + DDS_DXT5 = 9, + DDS_RXGB = 10, + DDS_UNKNOWN + }; + + + struct DDSPixelFormat { + uint size; + uint flags; + uint fourcc; + uint bitcount; + uint rmask; + uint gmask; + uint bmask; + uint amask; + }; + + TQDataStream & operator>> ( TQDataStream & s, DDSPixelFormat & pf ) + { + s >> pf.size; + s >> pf.flags; + s >> pf.fourcc; + s >> pf.bitcount; + s >> pf.rmask; + s >> pf.gmask; + s >> pf.bmask; + s >> pf.amask; + return s; + } + + struct DDSCaps { + uint caps1; + uint caps2; + uint caps3; + uint caps4; + }; + + TQDataStream & operator>> ( TQDataStream & s, DDSCaps & caps ) + { + s >> caps.caps1; + s >> caps.caps2; + s >> caps.caps3; + s >> caps.caps4; + return s; + } + + struct DDSHeader { + uint size; + uint flags; + uint height; + uint width; + uint pitch; + uint depth; + uint mipmapcount; + uint reserved[11]; + DDSPixelFormat pf; + DDSCaps caps; + uint notused; + }; + + TQDataStream & operator>> ( TQDataStream & s, DDSHeader & header ) + { + s >> header.size; + s >> header.flags; + s >> header.height; + s >> header.width; + s >> header.pitch; + s >> header.depth; + s >> header.mipmapcount; + for( int i = 0; i < 11; i++ ) { + s >> header.reserved[i]; + } + s >> header.pf; + s >> header.caps; + s >> header.notused; + return s; + } + + static bool IsValid( const DDSHeader & header ) + { + if( header.size != 124 ) { + return false; + } + const uint required = (DDSD_WIDTH|DDSD_HEIGHT|DDSD_CAPS|DDSD_PIXELFORMAT); + if( (header.flags & required) != required ) { + return false; + } + if( header.pf.size != 32 ) { + return false; + } + if( !(header.caps.caps1 & DDSCAPS_TEXTURE) ) { + return false; + } + return true; + } + +} // namespace + + + +K_EXPORT_COMPONENT_FACTORY(tdefile_dds, DdsFactory( "tdefile_dds" )) + +// Constructor, init mime type info. +KDdsPlugin::KDdsPlugin(TQObject *parent, const char *name, const TQStringList &args) : + KFilePlugin(parent, name, args) +{ + KFileMimeTypeInfo * info = addMimeTypeInfo( "image/x-dds" ); + + KFileMimeTypeInfo::GroupInfo * group = 0L; + + group = addGroupInfo(info, "Technical", i18n("Technical Details")); + + KFileMimeTypeInfo::ItemInfo * item; + + item = addItemInfo(group, "Dimensions", i18n("Dimensions"), TQVariant::Size); + setHint(item, KFileMimeTypeInfo::Size); + setUnit(item, KFileMimeTypeInfo::Pixels); + + item = addItemInfo(group, "Depth", i18n("Depth"), TQVariant::Int); + setUnit(item, KFileMimeTypeInfo::Pixels); + + item = addItemInfo(group, "BitDepth", i18n("Bit Depth"), TQVariant::Int); + setUnit(item, KFileMimeTypeInfo::BitsPerPixel); + + addItemInfo(group, "MipmapCount", i18n("Mipmap Count"), TQVariant::Int); + + addItemInfo(group, "Type", i18n("Type"), TQVariant::String); + addItemInfo(group, "ColorMode", i18n("Color Mode"), TQVariant::String); + addItemInfo(group, "Compression", i18n("Compression"), TQVariant::String); +} + +// Read mime type info. +bool KDdsPlugin::readInfo( KFileMetaInfo& info, uint /*what*/) +{ + TQFile file(info.path()); + + if (!file.open(IO_ReadOnly)) { + kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()).data() << endl; + return false; + } + + TQDataStream s(&file); + s.setByteOrder(TQDataStream::LittleEndian); + + // Validate header. + uint fourcc; + s >> fourcc; + if( fourcc != FOURCC_DDS ) { + kdDebug(7034) << TQFile::encodeName(info.path()).data() << " is not a DDS file." << endl; + return false; + } + + // Read image header. + DDSHeader header; + s >> header; + + // Check image file format. + if( s.atEnd() || !IsValid( header ) ) { + kdDebug(7034) << TQFile::encodeName(info.path()).data() << " is not a valid DDS file." << endl; + return false; + } + + // Set file info. + KFileMetaInfoGroup group = appendGroup(info, "Technical"); + appendItem(group, "Dimensions", TQSize(header.width, header.height)); + appendItem(group, "MipmapCount", header.mipmapcount); + + // Set file type. + if( header.caps.caps2 & DDSCAPS2_CUBEMAP ) { + appendItem(group, "Type", i18n("Cube Map Texture")); + } + else if( header.caps.caps2 & DDSCAPS2_VOLUME ) { + appendItem(group, "Type", i18n("Volume Texture")); + appendItem(group, "Depth", header.depth); + } + else { + appendItem(group, "Type", i18n("2D Texture")); + } + + // Set file color depth and compression. + if( header.pf.flags & DDPF_RGB ) { + appendItem(group, "BitDepth", header.pf.bitcount); + appendItem(group, "Compression", i18n("Uncompressed")); + if( header.pf.flags & DDPF_ALPHAPIXELS ) { + appendItem(group, "ColorMode", "RGB/Alpha"); + } + else { + appendItem(group, "ColorMode", "RGB"); + } + } + else if( header.pf.flags & DDPF_FOURCC ) { + switch( header.pf.fourcc ) { + case FOURCC_DXT1: + appendItem(group, "BitDepth", 4); + appendItem(group, "Compression", "DXT1"); + appendItem(group, "ColorMode", "RGB"); + break; + case FOURCC_DXT2: + appendItem(group, "BitDepth", 16); + appendItem(group, "Compression", "DXT2"); + appendItem(group, "ColorMode", "RGB/Alpha"); + break; + case FOURCC_DXT3: + appendItem(group, "BitDepth", 16); + appendItem(group, "Compression", "DXT3"); + appendItem(group, "ColorMode", "RGB/Alpha"); + break; + case FOURCC_DXT4: + appendItem(group, "BitDepth", 16); + appendItem(group, "Compression", "DXT4"); + appendItem(group, "ColorMode", "RGB/Alpha"); + break; + case FOURCC_DXT5: + appendItem(group, "BitDepth", 16); + appendItem(group, "Compression", "DXT5"); + appendItem(group, "ColorMode", "RGB/Alpha"); + break; + case FOURCC_RXGB: + appendItem(group, "BitDepth", 16); + appendItem(group, "Compression", "RXGB"); + appendItem(group, "ColorMode", "RGB"); + break; + default: + appendItem(group, "Compression", "Unknown"); + break; + } + } + else { + appendItem(group, "Compression", "Unknown"); + } + + return true; +} + +#include "tdefile_dds.moc" + diff --git a/tdefile-plugins/dds/tdefile_dds.desktop b/tdefile-plugins/dds/tdefile_dds.desktop new file mode 100644 index 00000000..c98f0181 --- /dev/null +++ b/tdefile-plugins/dds/tdefile_dds.desktop @@ -0,0 +1,53 @@ +[Desktop Entry] +Type=Service +Name=DirectDraw Surface Info +Name[ca]=Informació de superfície DirectDraw +Name[cs]=DirectDraw Surface info +Name[da]=DirectDraw overflade-info +Name[de]=DirectDraw Oberflächeninfo +Name[el]=Πληροφορίες επιφάνειας DirectDraw +Name[eo]=DirectDraw surfac-informo +Name[es]=Información de la primera vista de DirectDraw +Name[et]=DirectDraw Surface'i info +Name[eu]=DirectDraw Surface informazioa +Name[fa]=اطلاعات سطح DirectDraw +Name[fi]=DirectDraw pintatieto +Name[fr]=Informations de surface DirectDraw +Name[ga]=Eolas faoi DirectDraw Surface +Name[gl]=Información de Superficie de DirectDraw +Name[he]=מיגע אודות משטח DirectDraw +Name[hu]=DirectDraw felületinformáció +Name[is]=DirectDraw yfirborðs upplýsingar +Name[it]=Informazioni superficie DirectDraw +Name[ja]=DDS (DirectDraw Surface) 情報 +Name[kk]=DirectDraw бедерінің мәлметі +Name[km]=ព័ត៌មាន​ផ្ទៃ​ខាង​ក្រៅ​អំពី DirectDraw +Name[lt]=DirectDraw Surface informacija +Name[ms]=Maklumat Permukaan LukisTerus +Name[nb]=DirectDraw Overflate info +Name[nds]="DirectDraw"-Böversietinfo +Name[ne]=प्रत्यक्ष रेखाचित्र सतह सूचना +Name[nl]=DirectDraw Surface-info +Name[nn]=DirectDraw-overflateinfo +Name[pl]=Informacja o powierzchni DirectDraw +Name[pt]=Informação de Superfície DirectDraw +Name[pt_BR]=Informações Sobre Superfícies Direct Draw +Name[ro]=Informaţii Suprafaţă DirectDraw +Name[ru]=Сведения о поверхности DirectDraw +Name[sk]=DirectDraw informácie o povrchu +Name[sl]=Podatki o površini DirectDraw +Name[sr]=Информације о DirectDraw површини +Name[sr@Latn]=Informacije o DirectDraw površini +Name[sv]=Directdraw ytinformation +Name[ta]=நேரடி மேற்பரப்பு தகவல் +Name[th]=ข้อมูลแฟ้มพื้นผิว DirectDraw +Name[tr]=DirectDraw Yüzey Bilgisi +Name[uk]=Інформація про поверхню DirectDraw +Name[zh_CN]=DirectDraw 表面信息 +Name[zh_HK]=DirectDraw 表面資訊 +Name[zh_TW]=DirectDraw Surface 資訊 +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_dds +MimeType=image/x-dds +PreferredGroups=Technical +PreferredItems=Dimensions,Depth,BitDepth,Type,ColorMode,Compression diff --git a/tdefile-plugins/dds/tdefile_dds.h b/tdefile-plugins/dds/tdefile_dds.h new file mode 100644 index 00000000..464ed6fd --- /dev/null +++ b/tdefile-plugins/dds/tdefile_dds.h @@ -0,0 +1,38 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Ignacio Castao + * + * 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_DDS_H__ +#define __KFILE_DDS_H__ + +#include + +class TQStringList; + +class KDdsPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KDdsPlugin( TQObject *parent, const char *name, const TQStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint what); +}; + +#endif diff --git a/tdefile-plugins/dependencies/CMakeLists.txt b/tdefile-plugins/dependencies/CMakeLists.txt new file mode 100644 index 00000000..a4b1da2c --- /dev/null +++ b/tdefile-plugins/dependencies/CMakeLists.txt @@ -0,0 +1,14 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +if( WITH_PDF ) + add_subdirectory( poppler-tqt ) +endif ( ) diff --git a/tdefile-plugins/dependencies/Makefile.am b/tdefile-plugins/dependencies/Makefile.am new file mode 100644 index 00000000..1c8d5d88 --- /dev/null +++ b/tdefile-plugins/dependencies/Makefile.am @@ -0,0 +1 @@ +SUBDIRS=poppler-tqt diff --git a/tdefile-plugins/dependencies/poppler-tqt/CMakeLists.txt b/tdefile-plugins/dependencies/poppler-tqt/CMakeLists.txt new file mode 100644 index 00000000..26e87e1c --- /dev/null +++ b/tdefile-plugins/dependencies/poppler-tqt/CMakeLists.txt @@ -0,0 +1,54 @@ +################################################# +# +# (C) 2010-2011 Calvin Morrison +# mutantturkey@gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +project( libpoppler-tqt ) + +##### configure checks ########################## + +include( ConfigureChecks.cmake ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} + ${CMAKE_SOURCE_DIR}/tdefile-plugins/dependencies/poppler-tqt + ${POPPLER_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + +##### pc files ################################## + +configure_file( poppler-tqt.pc.cmake poppler-tqt.pc @ONLY ) + +install( FILES ${CMAKE_CURRENT_BINARY_DIR}/poppler-tqt.pc DESTINATION ${PKGCONFIG_INSTALL_DIR} ) + +##### headers ################################### + +install( FILES + poppler-qt.h poppler-page-transition.h poppler-link-qt3.h + DESTINATION ${INCLUDE_INSTALL_DIR} ) + +##### poppler-tqt (shared) ############################ + +tde_add_library( poppler-tqt SHARED AUTOMOC + SOURCES + poppler-document.cc poppler-fontinfo.cc + poppler-link.cc poppler-page.cc + poppler-page-transition.cc poppler-page-transition-private.h + poppler-private.cc poppler-private.h + VERSION 0.0.0 + LINK poppler ${TQT_LIBRARIES} + DESTINATION ${LIB_INSTALL_DIR} +) diff --git a/tdefile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake b/tdefile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake new file mode 100644 index 00000000..b15057c9 --- /dev/null +++ b/tdefile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake @@ -0,0 +1,21 @@ +# Poppler +pkg_search_module( POPPLER poppler ) +if( POPPLER_FOUND ) + set( HAVE_POPPLER 1 ) +else( ) + tde_message_fatal( "poppler is required, but was not found on your system" ) +endif( ) + +tde_save( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES ) +set( CMAKE_REQUIRED_INCLUDES ${DBUS_TQT_INCLUDE_DIRS} ${TQT_INCLUDE_DIRS} ${QT_INCLUDE_DIRS} ${POPPLER_INCLUDE_DIRS}) +set( CMAKE_REQUIRED_LIBRARIES ${DBUS_TQT_LDFLAGS} ${TQT_LDFLAGS} ${QT_LDFLAGS} ${POPPLER_LDFLAGS} ) +check_cxx_source_compiles(" + #include + int main(int, char**) { int a; int b; PSOutputDev *psOut = new PSOutputDev(\"test\", (PDFDoc*)0, (XRef*)0, (Catalog*)0, NULL, 0, 0, psModePS, a, b); } " + HAVE_POPPLER_016 ) +check_cxx_source_compiles(" + #include + int main(int, char**) { int a; int b; PSOutputDev *psOut = new PSOutputDev(\"test\", (PDFDoc*)0, NULL, 0, 0, psModePS, a, b); } " + HAVE_POPPLER_020 ) +tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES ) + diff --git a/tdefile-plugins/dependencies/poppler-tqt/Makefile.am b/tdefile-plugins/dependencies/poppler-tqt/Makefile.am new file mode 100644 index 00000000..949dc2a4 --- /dev/null +++ b/tdefile-plugins/dependencies/poppler-tqt/Makefile.am @@ -0,0 +1,40 @@ +INCLUDES = \ + -I$(top_srcdir) \ + -I/usr/include/poppler \ + $(cairo_includes) \ + $(QT_INCLUDES) \ + $(FREETYPE_CFLAGS) \ + $(FONTCONFIG_CFLAGS) + + +poppler_includedir = $(includedir)/ +poppler_include_HEADERS = \ + poppler-qt.h \ + poppler-page-transition.h \ + poppler-link-qt3.h + +lib_LTLIBRARIES = libpoppler-tqt.la +libpoppler_tqt_la_SOURCES = \ + poppler-document.cc \ + poppler-fontinfo.cc \ + poppler-link.cc \ + poppler-page.cc \ + poppler-page-transition.cc \ + poppler-page-transition-private.h \ + poppler-private.cc \ + poppler-private.h + +libpoppler_tqt_la_LIBADD = \ + -lpoppler \ + $(QT_LIBS) \ + $(FREETYPE_LIBS) \ + $(FONTCONFIG_LIBS) + +test_poppler_tqt_SOURCES = \ + test-poppler-qt.cpp + +test_poppler_tqt_LDADD = \ + $(top_builddir)/poppler/libpoppler.la \ + libpoppler-tqt.la \ + $(QT_LIBS) \ + $(FREETYPE_LIBS) diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-document.cc b/tdefile-plugins/dependencies/poppler-tqt/poppler-document.cc new file mode 100644 index 00000000..2e7cc516 --- /dev/null +++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-document.cc @@ -0,0 +1,341 @@ +/* poppler-document.cc: qt interface to poppler + * Copyright (C) 2005, Net Integration Technologies, Inc. + * Copyright (C) 2005-2009, Albert Astals Cid + * Copyright (C) 2006, Stefan Kebekus + * Copyright (C) 2006, Wilfried Huss + * + * 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, 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "poppler-private.h" + +#undef bool + +namespace Poppler { + +Document *Document::load(const TQString &filePath) +{ + if (!globalParams) { + globalParams = new GlobalParams(); + } + + DocumentData *doc = new DocumentData(new GooString(TQFile::encodeName(filePath)), NULL); + Document *pdoc; + if (doc->doc.isOk() || doc->doc.getErrorCode() == errEncrypted) { + pdoc = new Document(doc); + if (doc->doc.getErrorCode() == errEncrypted) + pdoc->data->locked = true; + else + pdoc->data->locked = false; + pdoc->data->m_fontInfoScanner = new FontInfoScanner(&(doc->doc)); + return pdoc; + } + else + return NULL; +} + +Document::Document(DocumentData *dataA) +{ + data = dataA; +} + +Document::~Document() +{ + delete data; +} + +bool Document::isLocked() const +{ + return data->locked; +} + +bool Document::unlock(const TQCString &password) +{ + if (data->locked) { + /* racier then it needs to be */ + GooString *filename = new GooString(data->doc.getFileName()); + GooString *pwd = new GooString(password.data()); + DocumentData *doc2 = new DocumentData(filename, pwd); + delete pwd; + if (!doc2->doc.isOk()) { + delete doc2; + } else { + delete data; + data = doc2; + data->locked = false; + data->m_fontInfoScanner = new FontInfoScanner(&(data->doc)); + } + } + return data->locked; +} + +Document::PageMode Document::getPageMode(void) const +{ + switch (data->doc.getCatalog()->getPageMode()) { + case Catalog::pageModeNone: + return UseNone; + case Catalog::pageModeOutlines: + return UseOutlines; + case Catalog::pageModeThumbs: + return UseThumbs; + case Catalog::pageModeFullScreen: + return FullScreen; + case Catalog::pageModeOC: + return UseOC; + default: + return UseNone; + } +} + +int Document::getNumPages() const +{ + return data->doc.getNumPages(); +} + +TQValueList Document::fonts() const +{ + TQValueList ourList; + scanForFonts(getNumPages(), &ourList); + return ourList; +} + +bool Document::scanForFonts( int numPages, TQValueList *fontList ) const +{ + GooList *items = data->m_fontInfoScanner->scan( numPages ); + + if ( NULL == items ) + return false; + + for ( int i = 0; i < items->getLength(); ++i ) { + TQString fontName; + if (((::FontInfo*)items->get(i))->getName()) + fontName = ((::FontInfo*)items->get(i))->getName()->getCString(); + + FontInfo font(fontName, + ((::FontInfo*)items->get(i))->getEmbedded(), + ((::FontInfo*)items->get(i))->getSubset(), + (Poppler::FontInfo::Type)((::FontInfo*)items->get(i))->getType()); + fontList->append(font); + } + deleteGooList(items, ::FontInfo); + return true; +} + +/* borrowed from kpdf */ +TQString Document::getInfo( const TQString & type ) const +{ + // [Albert] Code adapted from pdfinfo.cc on xpdf + Object info; + if ( data->locked ) + return NULL; + + data->doc.getDocInfo( &info ); + if ( !info.isDict() ) + return NULL; + + TQString result; + Object obj; + GooString *s1; + GBool isUnicode; + Unicode u; + int i; + Dict *infoDict = info.getDict(); + + if ( infoDict->lookup( (char*)type.latin1(), &obj )->isString() ) + { + s1 = obj.getString(); + if ( ( s1->getChar(0) & 0xff ) == 0xfe && ( s1->getChar(1) & 0xff ) == 0xff ) + { + isUnicode = gTrue; + i = 2; + } + else + { + isUnicode = gFalse; + i = 0; + } + while ( i < obj.getString()->getLength() ) + { + if ( isUnicode ) + { + u = ( ( s1->getChar(i) & 0xff ) << 8 ) | ( s1->getChar(i+1) & 0xff ); + i += 2; + } + else + { + u = s1->getChar(i) & 0xff; + ++i; + } + result += unicodeToTQString( &u, 1 ); + } + obj.free(); + info.free(); + return result; + } + obj.free(); + info.free(); + return NULL; +} + +/* borrowed from kpdf */ +TQDateTime Document::getDate( const TQString & type ) const +{ + // [Albert] Code adapted from pdfinfo.cc on xpdf + if ( data->locked ) + return TQDateTime(); + + Object info; + data->doc.getDocInfo( &info ); + if ( !info.isDict() ) { + info.free(); + return TQDateTime(); + } + + Object obj; + int year, mon, day, hour, min, sec, tz_hour, tz_minute; + char tz; + Dict *infoDict = info.getDict(); + TQString result; + + if ( infoDict->lookup( (char*)type.latin1(), &obj )->isString() ) + { + TQString s = UnicodeParsedString(obj.getString()); + // TODO do something with the timezone information + if ( parseDateString( s.latin1(), &year, &mon, &day, &hour, &min, &sec, &tz, &tz_hour, &tz_minute ) ) + { + TQDate d( year, mon, day ); //CHECK: it was mon-1, Jan->0 (??) + TQTime t( hour, min, sec ); + if ( d.isValid() && t.isValid() ) { + obj.free(); + info.free(); + return TQDateTime( d, t ); + } + } + } + obj.free(); + info.free(); + return TQDateTime(); +} + +bool Document::isEncrypted() const +{ + return data->doc.isEncrypted(); +} + +bool Document::isLinearized() const +{ + return data->doc.isLinearized(); +} + +bool Document::okToPrint() const +{ + return data->doc.okToPrint(); +} + +bool Document::okToChange() const +{ + return data->doc.okToChange(); +} + +bool Document::okToCopy() const +{ + return data->doc.okToCopy(); +} + +bool Document::okToAddNotes() const +{ + return data->doc.okToAddNotes(); +} + +double Document::getPDFVersion() const +{ + return data->doc.getPDFMajorVersion () + data->doc.getPDFMinorVersion() / 10.0; +} + +void Document::getPdfVersion(int *major, int *minor) const +{ + if (major) + *major = data->doc.getPDFMajorVersion(); + if (minor) + *minor = data->doc.getPDFMinorVersion(); +} + +TQDomDocument *Document::toc() const +{ + Outline * outline = data->doc.getOutline(); + if ( !outline ) + return NULL; + + GooList * items = outline->getItems(); + if ( !items || items->getLength() < 1 ) + return NULL; + + TQDomDocument *toc = new TQDomDocument(); + if ( items->getLength() > 0 ) + data->addTocChildren( toc, toc, items ); + + return toc; +} + +LinkDestination *Document::linkDestination( const TQString &name ) +{ + GooString * namedDest = TQStringToGooString( name ); + LinkDestinationData ldd(NULL, namedDest, data); + LinkDestination *ld = new LinkDestination(ldd); + delete namedDest; + return ld; +} + +bool Document::print(const TQString &fileName, TQValueList pageList, double hDPI, double vDPI, int rotate) +{ + return print(fileName, pageList, hDPI, vDPI, rotate, -1, -1); +} + +bool Document::print(const TQString &file, TQValueList pageList, double hDPI, double vDPI, int rotate, int paperWidth, int paperHeight) +{ +#if defined(HAVE_POPPLER_020) + PSOutputDev *psOut = new PSOutputDev(file.latin1(), &(data->doc), NULL, 1, data->doc.getNumPages(), psModePS, paperWidth, paperHeight); +#elif defined(HAVE_POPPLER_016) + PSOutputDev *psOut = new PSOutputDev(file.latin1(), &(data->doc), data->doc.getXRef(), data->doc.getCatalog(), NULL, 1, data->doc.getNumPages(), psModePS, paperWidth, paperHeight); +#else + PSOutputDev *psOut = new PSOutputDev(file.latin1(), data->doc.getXRef(), data->doc.getCatalog(), NULL, 1, data->doc.getNumPages(), psModePS, paperWidth, paperHeight); +#endif + + if (psOut->isOk()) { + TQValueList::iterator it; + for (it = pageList.begin(); it != pageList.end(); ++it ) + data->doc.displayPage(psOut, *it, hDPI, vDPI, rotate, gFalse, gTrue, gTrue); + + delete psOut; + return true; + } else { + delete psOut; + return false; + } +} + +} diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-fontinfo.cc b/tdefile-plugins/dependencies/poppler-tqt/poppler-fontinfo.cc new file mode 100644 index 00000000..c0e777a7 --- /dev/null +++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-fontinfo.cc @@ -0,0 +1,83 @@ +/* poppler-qt.h: qt interface to poppler + * Copyright (C) 2005, Albert Astals Cid + * + * 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, 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. + */ + +#include "poppler-qt.h" + +namespace Poppler { + +class FontInfoData +{ + public: + TQString fontName; + bool isEmbedded; + bool isSubset; + FontInfo::Type type; +}; + +FontInfo::FontInfo( const TQString &fontName, const bool isEmbedded, const bool isSubset, Type type ) +{ + data = new FontInfoData(); + data->fontName = fontName; + data->isEmbedded = isEmbedded; + data->isSubset = isSubset; + data->type = type; +} + +FontInfo::FontInfo( const FontInfo &fi ) +{ + data = new FontInfoData(); + data->fontName = fi.data->fontName; + data->isEmbedded = fi.data->isEmbedded; + data->isSubset = fi.data->isSubset; + data->type = fi.data->type; +} + +FontInfo::FontInfo() +{ + data = new FontInfoData(); + data->isEmbedded = false; + data->isSubset = false; + data->type = unknown; +} + +FontInfo::~FontInfo() +{ + delete data; +} + +const TQString &FontInfo::name() const +{ + return data->fontName; +} + +bool FontInfo::isEmbedded() const +{ + return data->isEmbedded; +} + +bool FontInfo::isSubset() const +{ + return data->isSubset; +} + +FontInfo::Type FontInfo::type() const +{ + return data->type; +} + +} diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-link-qt3.h b/tdefile-plugins/dependencies/poppler-tqt/poppler-link-qt3.h new file mode 100644 index 00000000..fc22d8ed --- /dev/null +++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-link-qt3.h @@ -0,0 +1,188 @@ +/* poppler-link.h: qt interface to poppler + * Copyright (C) 2006, Albert Astals Cid + * Adapting code from + * Copyright (C) 2004 by Enrico Ros + * + * 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, 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. + */ + +#ifndef _POPPLER_LINK_H_ +#define _POPPLER_LINK_H_ + +#include +#include + +namespace Poppler { + +class LinkDestinationData; + +class LinkDestination +{ + public: + enum Kind + { + destXYZ = 1, + destFit = 2, + destFitH = 3, + destFitV = 4, + destFitR = 5, + destFitB = 6, + destFitBH = 7, + destFitBV = 8 + }; + + LinkDestination(const LinkDestinationData &data); + LinkDestination(const TQString &description); + + // Accessors. + Kind kind() const; + int pageNumber() const; + double left() const; + double bottom() const; + double right() const; + double top() const; + double zoom() const; + bool isChangeLeft() const; + bool isChangeTop() const; + bool isChangeZoom() const; + + TQString toString() const; + + private: + Kind m_kind; // destination type + int m_pageNum; // page number + double m_left, m_bottom; // position + double m_right, m_top; + double m_zoom; // zoom factor + bool m_changeLeft, m_changeTop; // for destXYZ links, which position + bool m_changeZoom; // components to change +}; + +/** + * @short Encapsulates data that describes a link. + * + * This is the base class for links. It makes mandatory for inherited + * widgets to reimplement the 'linkType' method and return the type of + * the link described by the reimplemented class. + */ +class Link +{ + public: + Link( const TQRect &linkArea ); + + // get link type (inherited classes mustreturn an unique identifier) + enum LinkType { None, Goto, Execute, Browse, Action, Movie }; + virtual LinkType linkType() const; + + // virtual destructor + virtual ~Link(); + + TQRect linkArea() const; + + private: + TQRect m_linkArea; +}; + + +/** Goto: a viewport and maybe a reference to an external filename **/ +class LinkGoto : public Link +{ + public: + LinkGoto( const TQRect &linkArea, TQString extFileName, const LinkDestination & destination ); + + // query for goto parameters + bool isExternal() const; + const TQString & fileName() const; + const LinkDestination & destination() const; + LinkType linkType() const; + + private: + TQString m_extFileName; + LinkDestination m_destination; +}; + +/** Execute: filename and parameters to execute **/ +class LinkExecute : public Link +{ + public: + // query for filename / parameters + const TQString & fileName() const; + const TQString & parameters() const; + + // create a Link_Execute + LinkExecute( const TQRect &linkArea, const TQString & file, const TQString & params ); + LinkType linkType() const; + + private: + TQString m_fileName; + TQString m_parameters; +}; + +/** Browse: an URL to open, ranging from 'http://' to 'mailto:' etc.. **/ +class LinkBrowse : public Link +{ + public: + // query for URL + const TQString & url() const; + + // create a Link_Browse + LinkBrowse( const TQRect &linkArea, const TQString &url ); + LinkType linkType() const; + + private: + TQString m_url; +}; + +/** Action: contains an action to perform on document / viewer **/ +class LinkAction : public Link +{ + public: + // define types of actions + enum ActionType { PageFirst = 1, + PagePrev = 2, + PageNext = 3, + PageLast = 4, + HistoryBack = 5, + HistoryForward = 6, + Quit = 7, + Presentation = 8, + EndPresentation = 9, + Find = 10, + GoToPage = 11, + Close = 12 }; + + // query for action type + ActionType actionType() const; + + // create a Link_Action + LinkAction( const TQRect &linkArea, ActionType actionType ); + LinkType linkType() const; + + private: + ActionType m_type; +}; + +/** Movie: Not yet defined -> think renaming to 'Media' link **/ +class LinkMovie : public Link +// TODO this (Movie link) +{ + public: + LinkMovie( const TQRect &linkArea ); + LinkType linkType() const; +}; + +} + +#endif diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-link.cc b/tdefile-plugins/dependencies/poppler-tqt/poppler-link.cc new file mode 100644 index 00000000..72db1fff --- /dev/null +++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-link.cc @@ -0,0 +1,267 @@ +/* poppler-link.cc: qt interface to poppler + * Copyright (C) 2006, 2008 Albert Astals Cid + * Adapting code from + * Copyright (C) 2004 by Enrico Ros + * + * 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, 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. + */ + +#include +#include + +#include + +#include + +namespace Poppler { + + LinkDestination::LinkDestination(const LinkDestinationData &data) + { + bool deleteDest = false; + LinkDest *ld = data.ld; + + if ( data.namedDest && !ld ) + { + deleteDest = true; + ld = data.doc->doc.findDest( data.namedDest ); + } + + if (!ld) return; + + if (ld->getKind() == ::destXYZ) m_kind = destXYZ; + else if (ld->getKind() == ::destFit) m_kind = destFit; + else if (ld->getKind() == ::destFitH) m_kind = destFitH; + else if (ld->getKind() == ::destFitV) m_kind = destFitV; + else if (ld->getKind() == ::destFitR) m_kind = destFitR; + else if (ld->getKind() == ::destFitB) m_kind = destFitB; + else if (ld->getKind() == ::destFitBH) m_kind = destFitBH; + else if (ld->getKind() == ::destFitBV) m_kind = destFitBV; + + if ( !ld->isPageRef() ) m_pageNum = ld->getPageNum(); + else + { + Ref ref = ld->getPageRef(); + m_pageNum = data.doc->doc.findPage( ref.num, ref.gen ); + } + double left = ld->getLeft(); + double bottom = ld->getBottom(); + double right = ld->getRight(); + double top = ld->getTop(); + m_zoom = ld->getZoom(); + m_changeLeft = ld->getChangeLeft(); + m_changeTop = ld->getChangeTop(); + m_changeZoom = ld->getChangeZoom(); + + int leftAux = 0, topAux = 0, rightAux = 0, bottomAux = 0; + +#if defined(HAVE_SPLASH) + SplashOutputDev *sod = data.doc->getOutputDev(); + sod->cvtUserToDev( left, top, &leftAux, &topAux ); + sod->cvtUserToDev( right, bottom, &rightAux, &bottomAux ); +#endif + + m_left = leftAux; + m_top = topAux; + m_right = rightAux; + m_bottom = bottomAux; + + if (deleteDest) delete ld; + } + + LinkDestination::LinkDestination(const TQString &description) + { + TQStringList tokens = TQStringList::split(';', description); + m_kind = static_cast(tokens[0].toInt()); + m_pageNum = tokens[1].toInt(); + m_left = tokens[2].toDouble(); + m_bottom = tokens[3].toDouble(); + m_right = tokens[4].toDouble(); + m_top = tokens[5].toDouble(); + m_zoom = tokens[6].toDouble(); + m_changeLeft = static_cast(tokens[7].toInt()); + m_changeTop = static_cast(tokens[8].toInt()); + m_changeZoom = static_cast(tokens[9].toInt()); + } + + LinkDestination::Kind LinkDestination::kind() const + { + return m_kind; + } + + int LinkDestination::pageNumber() const + { + return m_pageNum; + } + + double LinkDestination::left() const + { + return m_left; + } + + double LinkDestination::bottom() const + { + return m_bottom; + } + + double LinkDestination::right() const + { + return m_right; + } + + double LinkDestination::top() const + { + return m_top; + } + + double LinkDestination::zoom() const + { + return m_zoom; + } + + bool LinkDestination::isChangeLeft() const + { + return m_changeLeft; + } + + bool LinkDestination::isChangeTop() const + { + return m_changeTop; + } + + bool LinkDestination::isChangeZoom() const + { + return m_changeZoom; + } + + TQString LinkDestination::toString() const + { + TQString s = TQString::number( (TQ_INT8)m_kind ); + s += ";" + TQString::number( m_pageNum ); + s += ";" + TQString::number( m_left ); + s += ";" + TQString::number( m_bottom ); + s += ";" + TQString::number( m_right ); + s += ";" + TQString::number( m_top ); + s += ";" + TQString::number( m_zoom ); + s += ";" + TQString::number( (TQ_INT8)m_changeLeft ); + s += ";" + TQString::number( (TQ_INT8)m_changeTop ); + s += ";" + TQString::number( (TQ_INT8)m_changeZoom ); + return s; + } + + + // Link + Link::~Link() + { + } + + Link::Link(const TQRect &linkArea) : m_linkArea(linkArea) + { + } + + Link::LinkType Link::linkType() const + { + return None; + } + + TQRect Link::linkArea() const + { + return m_linkArea; + } + + // LinkGoto + LinkGoto::LinkGoto( const TQRect &linkArea, TQString extFileName, const LinkDestination & destination ) : Link(linkArea), m_extFileName(extFileName), m_destination(destination) + { + } + + bool LinkGoto::isExternal() const + { + return !m_extFileName.isEmpty(); + } + + const TQString &LinkGoto::fileName() const + { + return m_extFileName; + } + + const LinkDestination &LinkGoto::destination() const + { + return m_destination; + } + + Link::LinkType LinkGoto::linkType() const + { + return Goto; + } + + // LinkExecute + LinkExecute::LinkExecute( const TQRect &linkArea, const TQString & file, const TQString & params ) : Link(linkArea), m_fileName(file), m_parameters(params) + { + } + + const TQString & LinkExecute::fileName() const + { + return m_fileName; + } + const TQString & LinkExecute::parameters() const + { + return m_parameters; + } + + Link::LinkType LinkExecute::linkType() const + { + return Execute; + } + + // LinkBrowse + LinkBrowse::LinkBrowse( const TQRect &linkArea, const TQString &url ) : Link(linkArea), m_url(url) + { + } + + const TQString & LinkBrowse::url() const + { + return m_url; + } + + Link::LinkType LinkBrowse::linkType() const + { + return Browse; + } + + // LinkAction + LinkAction::LinkAction( const TQRect &linkArea, ActionType actionType ) : Link(linkArea), m_type(actionType) + { + } + + LinkAction::ActionType LinkAction::actionType() const + { + return m_type; + } + + Link::LinkType LinkAction::linkType() const + { + return Action; + } + + // LinkMovie + LinkMovie::LinkMovie( const TQRect &linkArea ) : Link(linkArea) + { + } + + Link::LinkType LinkMovie::linkType() const + { + return Movie; + } + +} diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-page-transition-private.h b/tdefile-plugins/dependencies/poppler-tqt/poppler-page-transition-private.h new file mode 100644 index 00000000..8bc70825 --- /dev/null +++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-page-transition-private.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2005, Albert Astals Cid + * + * 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, 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. + */ + +#ifndef POPPLER_PAGE_TRANSITION_PRIVATE_H +#define POPPLER_PAGE_TRANSITION_PRIVATE_H + +class Object; + +namespace Poppler { + +class PageTransitionParams { + public: + Object *dictObj; +}; + +} + +#endif // POPPLER_PAGE_TRANSITION_PRIVATE_H diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-page-transition.cc b/tdefile-plugins/dependencies/poppler-tqt/poppler-page-transition.cc new file mode 100644 index 00000000..cde8818d --- /dev/null +++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-page-transition.cc @@ -0,0 +1,95 @@ +/* PageTransition.cc + * Copyright (C) 2005, Net Integration Technologies, Inc. + * + * 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, 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. + */ + +#include "PageTransition.h" +#include "poppler-page-transition.h" +#include "poppler-page-transition-private.h" + +namespace Poppler { + +class PageTransitionData +{ + public: + PageTransitionData(Object *trans) + { + pt = new ::PageTransition(trans); + } + + PageTransitionData(const PageTransitionData &ptd) + { + pt = new ::PageTransition(*ptd.pt); + } + + ~PageTransitionData() + { + delete pt; + } + + ::PageTransition *pt; +}; + +PageTransition::PageTransition(const PageTransitionParams ¶ms) +{ + data = new PageTransitionData(params.dictObj); +} + +PageTransition::PageTransition(const PageTransition &pt) +{ + data = new PageTransitionData(*pt.data); +} + +PageTransition::~PageTransition() +{ + delete data; +} + +PageTransition::Type PageTransition::type() const +{ + return (Poppler::PageTransition::Type)data->pt->getType(); +} + +int PageTransition::duration() const +{ + return data->pt->getDuration(); +} + +PageTransition::Alignment PageTransition::alignment() const +{ + return (Poppler::PageTransition::Alignment)data->pt->getAlignment(); +} + +PageTransition::Direction PageTransition::direction() const +{ + return (Poppler::PageTransition::Direction)data->pt->getDirection(); +} + +int PageTransition::angle() const +{ + return data->pt->getAngle(); +} + +double PageTransition::scale() const +{ + return data->pt->getScale(); +} +bool PageTransition::isRectangular() const +{ + return data->pt->isRectangular(); +} + +} diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-page-transition.h b/tdefile-plugins/dependencies/poppler-tqt/poppler-page-transition.h new file mode 100644 index 00000000..53002ff9 --- /dev/null +++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-page-transition.h @@ -0,0 +1,146 @@ +/* PageTransition.h + * Copyright (C) 2005, Net Integration Technologies, Inc. + * Copyright (C) 2005, Brad Hards + * + * 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, 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. + */ + +#ifndef __PAGETRANSITION_X_H__ +#define __PAGETRANSITION_X_H__ + +namespace Poppler { + +class PageTransitionParams; +class PageTransitionData; + +/** + \brief Describes how a PDF file viewer shall perform the transition + from one page to another + + In PDF files there is a way to specify if the viewer shall use + certain effects to perform the transition from one page to + another. This feature can be used, e.g., in a PDF-based beamer + presentation. + + This utility class represents the transition effect, and can be + used to extract the information from a PDF object. +*/ + + +class PageTransition { + public: + + /** \brief transition effect that shall be used + */ + // if changed remember to keep in sync with PageTransition.h enum + enum Type { + Replace = 0, + Split, + Blinds, + Box, + Wipe, + Dissolve, + Glitter, + Fly, + Push, + Cover, + Uncover, + Fade + }; + + /** \brief alignment of the transition effect that shall be used + */ + // if changed remember to keep in sync with PageTransition.h enum + enum Alignment { + Horizontal = 0, + Vertical + }; + + /** \brief direction of the transition effect that shall be used + */ + // if changed remember to keep in sync with PageTransition.h enum + enum Direction { + Inward = 0, + Outward + }; + + /** \brief Construct a new PageTransition object from a page dictionary. + + Users of the library will rarely need to construct a + PageTransition object themselves. Instead, the method + Poppler::Page::transition() can be used to find out if a certain + transition effect is specified. + + @warning In case or error, this method will print an error message to stderr, + and construct a default object. + + @param params an object whose dictionary will be read and + parsed. This must be a valid object, whose dictionaries are + accessed by the constructor. The object is only accessed by this + constructor, and may be deleted after the constructor returns. + */ + PageTransition(const PageTransitionParams ¶ms); + + /** \brief copy constructor */ + PageTransition(const PageTransition &pt); + + /** + Destructor + */ + ~PageTransition(); + + /** + \brief Get type of the transition. + */ + Type type() const; + + /** + \brief Get duration of the transition in seconds. + */ + int duration() const; + + /** + \brief Get dimension in which the transition effect occurs. + */ + Alignment alignment() const; + + /** + \brief Get direction of motion of the transition effect. + */ + Direction direction() const; + + /** + \brief Get direction in which the transition effect moves. + */ + int angle() const; + + /** + \brief Get starting or ending scale. + */ + double scale() const; + + /** + \brief Returns true if the area to be flown is rectangular and + opaque. + */ + bool isRectangular() const; + + private: + PageTransitionData *data; +}; + +} + +#endif diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-page.cc b/tdefile-plugins/dependencies/poppler-tqt/poppler-page.cc new file mode 100644 index 00000000..3d1e6569 --- /dev/null +++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-page.cc @@ -0,0 +1,370 @@ +/* poppler-page.cc: qt interface to poppler + * Copyright (C) 2005, Net Integration Technologies, Inc. + * Copyright (C) 2005-2006, Albert Astals Cid + * Copyright (C) 2005, Tobias Koening + * Copyright (C) 2005, Stefan Kebekus + * Copyright (C) 2006, Wilfried Huss + * Copyright (C) 2006, Jerry Epplin + * Copyright (C) 2007, 2010, Pino Toscano + * + * 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, 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if defined(HAVE_SPLASH) +#include +#include +#endif + +#include "poppler-private.h" +#include "poppler-page-transition-private.h" + +namespace Poppler { + +class PageData { + public: + const Document *doc; + int index; + PageTransition *transition; +}; + +Page::Page(const Document *doc, int index) { + data = new PageData(); + data->index = index; + data->doc = doc; + data->transition = 0; +} + +Page::~Page() +{ + delete data->transition; + delete data; +} + +void Page::renderToPixmap(TQPixmap **q, int x, int y, int w, int h, bool doLinks) const +{ + renderToPixmap(q, x, y, w, h, 72.0, 72.0, doLinks); +} + +void Page::renderToPixmap(TQPixmap **q, int x, int y, int w, int h, double xres, double yres, bool doLinks) const +{ + TQImage img = renderToImage(xres, yres, doLinks); + *q = new TQPixmap( img ); +} + +TQImage Page::renderToImage(double xres, double yres, bool doLinks) const +{ +#if defined(HAVE_SPLASH) + SplashOutputDev *output_dev; + SplashBitmap *bitmap; + SplashColorPtr color_ptr; + output_dev = data->doc->data->getOutputDev(); + + data->doc->data->doc.displayPageSlice(output_dev, data->index + 1, xres, yres, + 0, false, true, false, -1, -1, -1, -1); + bitmap = output_dev->getBitmap (); + color_ptr = bitmap->getDataPtr (); + int bw = output_dev->getBitmap()->getWidth(); + int bh = output_dev->getBitmap()->getHeight(); + SplashColorPtr dataPtr = output_dev->getBitmap()->getDataPtr(); + + if (TQImage::BigEndian == TQImage::systemByteOrder()) + { + uchar c; + int count = bw * bh * 4; + for (int k = 0; k < count; k += 4) + { + c = dataPtr[k]; + dataPtr[k] = dataPtr[k+3]; + dataPtr[k+3] = c; + + c = dataPtr[k+1]; + dataPtr[k+1] = dataPtr[k+2]; + dataPtr[k+2] = c; + } + } + + // construct a qimage SHARING the raw bitmap data in memory + TQImage img( dataPtr, bw, bh, 32, 0, 0, TQImage::IgnoreEndian ); + img = img.copy(); + // unload underlying xpdf bitmap + output_dev->startPage( 0, NULL ); + + return img; +#else + (void)xres; + (void)xres; + (void)doLinks; + + return TQImage(); +#endif +} + +TQString Page::getText(const Rectangle &r) const +{ + TextOutputDev *output_dev; + GooString *s; + PDFRectangle *rect; + TQString result; + ::Page *p; + +#if defined(HAVE_POPPLER_020) + output_dev = new TextOutputDev(0, gFalse, 0, gFalse, gFalse); +#else + output_dev = new TextOutputDev(0, gFalse, gFalse, gFalse); +#endif + data->doc->data->doc.displayPageSlice(output_dev, data->index + 1, 72, 72, + 0, false, false, false, -1, -1, -1, -1); + p = data->doc->data->doc.getCatalog()->getPage(data->index + 1); + if (r.isNull()) + { + rect = p->getCropBox(); + s = output_dev->getText(rect->x1, rect->y1, rect->x2, rect->y2); + } + else + { + double height, y1, y2; + height = p->getCropHeight(); + y1 = height - r.m_y2; + y2 = height - r.m_y1; + s = output_dev->getText(r.m_x1, y1, r.m_x2, y2); + } + + result = TQString::fromUtf8(s->getCString()); + + delete output_dev; + delete s; + return result; +} + +TQValueList Page::textList() const +{ + TextOutputDev *output_dev; + + TQValueList output_list; + +#if defined(HAVE_POPPLER_020) + output_dev = new TextOutputDev(0, gFalse, 0, gFalse, gFalse); +#else + output_dev = new TextOutputDev(0, gFalse, gFalse, gFalse); +#endif + + data->doc->data->doc.displayPageSlice(output_dev, data->index + 1, 72, 72, + 0, false, false, false, -1, -1, -1, -1); + + TextWordList *word_list = output_dev->makeWordList(); + + if (!word_list) { + delete output_dev; + return output_list; + } + + for (int i = 0; i < word_list->getLength(); i++) { + TextWord *word = word_list->get(i); + GooString *word_str = word->getText(); + TQString string = TQString::fromUtf8(word_str->getCString()); + delete word_str; + double xMin, yMin, xMax, yMax; + word->getBBox(&xMin, &yMin, &xMax, &yMax); + + TextBox* text_box = new TextBox(string, Rectangle(xMin, yMin, xMax, yMax)); + + output_list.append(text_box); + } + + delete word_list; + delete output_dev; + + return output_list; +} + +PageTransition *Page::getTransition() const +{ + if (!data->transition) + { + Object o; + PageTransitionParams params; + params.dictObj = data->doc->data->doc.getCatalog()->getPage(data->index + 1)->getTrans(&o); + data->transition = new PageTransition(params); + o.free(); + } + return data->transition; +} + +TQSize Page::pageSize() const +{ + ::Page *p; + + p = data->doc->data->doc.getCatalog()->getPage(data->index + 1); + if ( ( Page::Landscape == orientation() ) || (Page::Seascape == orientation() ) ) { + return TQSize( (int)p->getCropHeight(), (int)p->getCropWidth() ); + } else { + return TQSize( (int)p->getCropWidth(), (int)p->getCropHeight() ); + } +} + +Page::Orientation Page::orientation() const +{ + ::Page *p = data->doc->data->doc.getCatalog()->getPage(data->index + 1); + + int rotation = p->getRotate(); + switch (rotation) { + case 90: + return Page::Landscape; + break; + case 180: + return Page::UpsideDown; + break; + case 270: + return Page::Seascape; + break; + default: + return Page::Portrait; + } +} + +TQValueList Page::links() const +{ + TQValueList popplerLinks; + +#if defined(HAVE_SPLASH) + Links *xpdfLinks = data->doc->data->doc.getLinks(data->index + 1); + for (int i = 0; i < xpdfLinks->getNumLinks(); ++i) + { + ::Link *xpdfLink = xpdfLinks->getLink(i); + + double left, top, right, bottom; + int leftAux, topAux, rightAux, bottomAux; + xpdfLink->getRect( &left, &top, &right, &bottom ); + TQRect linkArea; + + data->doc->data->m_outputDev->cvtUserToDev( left, top, &leftAux, &topAux ); + data->doc->data->m_outputDev->cvtUserToDev( right, bottom, &rightAux, &bottomAux ); + linkArea.setLeft(leftAux); + linkArea.setTop(topAux); + linkArea.setRight(rightAux); + linkArea.setBottom(bottomAux); + + if (!xpdfLink->isOk()) continue; + + Link *popplerLink = NULL; + ::LinkAction *a = xpdfLink->getAction(); + if ( a ) + { + switch ( a->getKind() ) + { + case actionGoTo: + { + LinkGoTo * g = (LinkGoTo *) a; + // create link: no ext file, namedDest, object pointer + popplerLink = new LinkGoto( linkArea, TQString(), LinkDestination( LinkDestinationData(g->getDest(), g->getNamedDest(), data->doc->data ) ) ); + } + break; + + case actionGoToR: + { + LinkGoToR * g = (LinkGoToR *) a; + // copy link file + const TQString fileName = UnicodeParsedString( g->getFileName() ); + // ceate link: fileName, namedDest, object pointer + popplerLink = new LinkGoto( linkArea, fileName, LinkDestination( LinkDestinationData(g->getDest(), g->getNamedDest(), data->doc->data ) ) ); + } + break; + + case actionLaunch: + { + LinkLaunch * e = (LinkLaunch *)a; + GooString * p = e->getParams(); + popplerLink = new LinkExecute( linkArea, e->getFileName()->getCString(), p ? p->getCString() : 0 ); + } + break; + + case actionNamed: + { + const char * name = ((LinkNamed *)a)->getName()->getCString(); + if ( !strcmp( name, "NextPage" ) ) + popplerLink = new LinkAction( linkArea, LinkAction::PageNext ); + else if ( !strcmp( name, "PrevPage" ) ) + popplerLink = new LinkAction( linkArea, LinkAction::PagePrev ); + else if ( !strcmp( name, "FirstPage" ) ) + popplerLink = new LinkAction( linkArea, LinkAction::PageFirst ); + else if ( !strcmp( name, "LastPage" ) ) + popplerLink = new LinkAction( linkArea, LinkAction::PageLast ); + else if ( !strcmp( name, "GoBack" ) ) + popplerLink = new LinkAction( linkArea, LinkAction::HistoryBack ); + else if ( !strcmp( name, "GoForward" ) ) + popplerLink = new LinkAction( linkArea, LinkAction::HistoryForward ); + else if ( !strcmp( name, "Quit" ) ) + popplerLink = new LinkAction( linkArea, LinkAction::Quit ); + else if ( !strcmp( name, "GoToPage" ) ) + popplerLink = new LinkAction( linkArea, LinkAction::GoToPage ); + else if ( !strcmp( name, "Find" ) ) + popplerLink = new LinkAction( linkArea, LinkAction::Find ); + else if ( !strcmp( name, "FullScreen" ) ) + popplerLink = new LinkAction( linkArea, LinkAction::Presentation ); + else if ( !strcmp( name, "Close" ) ) + { + // acroread closes the document always, doesnt care whether + // its presentation mode or not + // popplerLink = new LinkAction( linkArea, LinkAction::EndPresentation ); + popplerLink = new LinkAction( linkArea, LinkAction::Close ); + } + else + { + // TODO + } + } + break; + + case actionURI: + { + popplerLink = new LinkBrowse( linkArea, ((LinkURI *)a)->getURI()->getCString() ); + } + break; + + case actionMovie: + case actionSound: + case actionRendition: + case actionJavaScript: + case actionOCGState: + break; + + case actionUnknown: + break; + } + } + + if (popplerLink) + { + popplerLinks.append(popplerLink); + } + } + + delete xpdfLinks; +#endif + + return popplerLinks; +} + +} diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-private.cc b/tdefile-plugins/dependencies/poppler-tqt/poppler-private.cc new file mode 100644 index 00000000..7e366014 --- /dev/null +++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-private.cc @@ -0,0 +1,147 @@ +/* poppler-private.h: qt interface to poppler + * Copyright (C) 2005, Net Integration Technologies, Inc. + * Copyright (C) 2005-2008, Albert Astals Cid + * Copyright (C) 2006, Kristian Høgsberg + * Copyright (C) 2006, Wilfried Huss + * Copyright (C) 2007, Pino Toscano + * + * 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, 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. + */ + +#include "poppler-private.h" +#include "poppler-link-qt3.h" + +#include + +#include +#include + +namespace Poppler { + +/* borrowed from kpdf */ +TQString unicodeToTQString(Unicode* u, int len) +{ + TQString ret; + ret.setLength(len); + TQChar* qch = (TQChar*) ret.unicode(); + for (;len;--len) + *qch++ = (TQChar) *u++; + return ret; +} + +TQString UnicodeParsedString(GooString *s1) +{ + GBool isUnicode; + int i; + Unicode u; + TQString result; + if ( ( s1->getChar(0) & 0xff ) == 0xfe && ( s1->getChar(1) & 0xff ) == 0xff ) + { + isUnicode = gTrue; + i = 2; + } + else + { + isUnicode = gFalse; + i = 0; + } + while ( i < s1->getLength() ) + { + if ( isUnicode ) + { + u = ( ( s1->getChar(i) & 0xff ) << 8 ) | ( s1->getChar(i+1) & 0xff ); + i += 2; + } + else + { + u = s1->getChar(i) & 0xff; + ++i; + } + result += unicodeToTQString( &u, 1 ); + } + return result; +} + +GooString *TQStringToGooString(const TQString &s) +{ + int len = s.length(); + char *cstring = (char *)gmallocn(s.length(), sizeof(char)); + for (int i = 0; i < len; ++i) + cstring[i] = s.at(i).unicode(); + GooString *ret = new GooString(cstring, len); + gfree(cstring); + return ret; +} + + +void DocumentData::addTocChildren( TQDomDocument * docSyn, TQDomNode * parent, GooList * items ) +{ + int numItems = items->getLength(); + for ( int i = 0; i < numItems; ++i ) + { + // iterate over every object in 'items' + OutlineItem * outlineItem = (OutlineItem *)items->get( i ); + + // 1. create element using outlineItem's title as tagName + TQString name; + Unicode * uniChar = outlineItem->getTitle(); + int titleLength = outlineItem->getTitleLength(); + name = unicodeToTQString(uniChar, titleLength); + if ( name.isEmpty() ) + continue; + + TQDomElement item = docSyn->createElement( name ); + parent->appendChild( item ); + + // 2. find the page the link refers to + ::LinkAction * a = outlineItem->getAction(); + if ( a && ( a->getKind() == actionGoTo || a->getKind() == actionGoToR ) ) + { + // page number is contained/referenced in a LinkGoTo + LinkGoTo * g = static_cast< LinkGoTo * >( a ); + LinkDest * destination = g->getDest(); + if ( !destination && g->getNamedDest() ) + { + // no 'destination' but an internal 'named reference'. we could + // get the destination for the page now, but it's VERY time consuming, + // so better storing the reference and provide the viewport on demand + GooString *s = g->getNamedDest(); + TQChar *charArray = new TQChar[s->getLength()]; + for (int i = 0; i < s->getLength(); ++i) charArray[i] = TQChar(s->getCString()[i]); + TQString aux(charArray, s->getLength()); + item.setAttribute( "DestinationName", aux ); + delete[] charArray; + } + else if ( destination && destination->isOk() ) + { + LinkDestinationData ldd(destination, NULL, this); + item.setAttribute( "Destination", LinkDestination(ldd).toString() ); + } + if ( a->getKind() == actionGoToR ) + { + LinkGoToR * g2 = static_cast< LinkGoToR * >( a ); + item.setAttribute( "ExternalFileName", g2->getFileName()->getCString() ); + } + } + + // 3. recursively descend over children + outlineItem->open(); + GooList * children = outlineItem->getKids(); + if ( children ) + addTocChildren( docSyn, &item, children ); + } +} + +} diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-private.h b/tdefile-plugins/dependencies/poppler-tqt/poppler-private.h new file mode 100644 index 00000000..9e9e3292 --- /dev/null +++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-private.h @@ -0,0 +1,97 @@ +/* poppler-private.h: qt interface to poppler + * Copyright (C) 2005, Net Integration Technologies, Inc. + * Copyright (C) 2005-2008, Albert Astals Cid + * Copyright (C) 2006, Kristian Høgsberg + * Copyright (C) 2006, Wilfried Huss + * Copyright (C) 2007, Pino Toscano + * + * 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, 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. + */ + +#ifndef POPPLER_PRIVATE_H +#define POPPLER_PRIVATE_H + +#include + +#include +#include +#include +#include +#if defined(HAVE_SPLASH) +#include +#else +class SplashOutputDev; +#endif + +namespace Poppler { + +class DocumentData; + +TQString unicodeToTQString(Unicode* u, int len); + +TQString UnicodeParsedString(GooString *s1); + +GooString *TQStringToGooString(const TQString &s); + +class LinkDestinationData { + public: + LinkDestinationData( LinkDest *l, GooString *nd, Poppler::DocumentData *pdfdoc ) : ld(l), namedDest(nd), doc(pdfdoc) + { + } + + LinkDest *ld; + GooString *namedDest; + Poppler::DocumentData *doc; +}; + +class DocumentData { + public: + DocumentData(GooString *filePath, GooString *password) : doc(filePath,password), m_fontInfoScanner(0), m_outputDev(0) {} + + ~DocumentData() + { +#if defined(HAVE_SPLASH) + delete m_outputDev; +#endif + delete m_fontInfoScanner; + } + + SplashOutputDev *getOutputDev() + { +#if defined(HAVE_SPLASH) + if (!m_outputDev) + { + SplashColor white; + white[0] = 255; + white[1] = 255; + white[2] = 255; + m_outputDev = new SplashOutputDev(splashModeXBGR8, 4, gFalse, white); + m_outputDev->startDoc(doc.getXRef()); + } +#endif + return m_outputDev; + } + + void addTocChildren( TQDomDocument * docSyn, TQDomNode * parent, GooList * items ); + + class PDFDoc doc; + bool locked; + FontInfoScanner *m_fontInfoScanner; + SplashOutputDev *m_outputDev; +}; + +} + +#endif // POPPLER_PRIVATE_H diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-qt.h b/tdefile-plugins/dependencies/poppler-tqt/poppler-qt.h new file mode 100644 index 00000000..9150ee3b --- /dev/null +++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-qt.h @@ -0,0 +1,310 @@ +/* poppler-qt.h: qt interface to poppler + * Copyright (C) 2005, Net Integration Technologies, Inc. + * Copyright (C) 2005, Tobias Koening + * Copyright (C) 2005-2007, Albert Astals Cid + * Copyright (C) 2005-2006, Stefan Kebekus + * Copyright (C) 2006, Wilfried Huss + * + * 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, 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. + */ + +#ifndef __POPPLER_TQT_H__ +#define __POPPLER_TQT_H__ + +#include "poppler-link-qt3.h" +#include "poppler-page-transition.h" + +#include +#include +#include +#include + +namespace Poppler { + +class Document; +class Page; + +/* A rectangle on a page, with coordinates in PDF points. */ +class Rectangle +{ + public: + Rectangle(double x1 = 0, double y1 = 0, double x2 = 0, double y2 = 0) : + m_x1(x1), m_y1(y1), m_x2(x2), m_y2(y2) {} + bool isNull() const { return m_x1 == 0 && m_y1 == 0 && m_x2 == 0 && m_y2 == 0; } + + double m_x1; + double m_y1; + double m_x2; + double m_y2; +}; + +class TextBox +{ + public: + TextBox(const TQString& text, const Rectangle &bBox) : + m_text(text), m_bBox(bBox) {}; + + TQString getText() const { return m_text; }; + Rectangle getBoundingBox() const { return m_bBox; }; + + private: + TQString m_text; + Rectangle m_bBox; +}; + + +/** + Container class for information about a font within a PDF document +*/ +class FontInfoData; +class FontInfo { +public: + enum Type { + unknown, + Type1, + Type1C, + Type1COT, + Type3, + TrueType, + TrueTypeOT, + CIDType0, + CIDType0C, + CIDType0COT, + CIDTrueType, + CIDTrueTypeOT + }; + + /** + Create a new font information container + */ + FontInfo( const TQString &fontName, const bool isEmbedded, + const bool isSubset, Type type ); + + FontInfo(); + + FontInfo( const FontInfo &fi ); + + ~FontInfo(); + + /** + The name of the font. Can be TQString() if the font has no name + */ + const TQString &name() const; + + /** + Whether the font is embedded in the file, or not + + \return true if the font is embedded + */ + bool isEmbedded() const; + + /** + Whether the font provided is only a subset of the full + font or not. This only has meaning if the font is embedded. + + \return true if the font is only a subset + */ + bool isSubset() const; + + /** + The type of font encoding + */ + Type type() const; + + const TQString &typeName() const; + +private: + FontInfoData *data; +}; + +class PageData; +class Page { + friend class Document; + public: + ~Page(); + void renderToPixmap(TQPixmap **q, int x, int y, int w, int h, double xres, double yres, bool doLinks = false) const; + + /** + This is a convenience function that is equivalent to + renderToPixmap() with xres and yres set to 72.0. We keep it + only for binary compatibility + + \sa renderToImage() + */ + void renderToPixmap(TQPixmap **q, int x, int y, int w, int h, bool doLinks = false) const; + + /** + \brief Render the page to a TQImage using the Splash renderer + + This method can be used to render the page to a TQImage. It + uses the "Splash" rendering engine. + + \param xres horizontal resolution of the graphics device, + in dots per inch (defaults to 72 dpi) + + \param yres vertical resolution of the graphics device, in + dots per inch (defaults to 72 dpi) + + \returns a TQImage of the page. + + \sa renderToPixmap() + */ + TQImage renderToImage(double xres = 72.0, double yres = 72.0, bool doLinks = false) const; + + /** + * Returns the size of the page in points + **/ + TQSize pageSize() const; + + /** + * Returns the text that is inside the Rectangle r + * If r is a null Rectangle all text of the page is given + **/ + TQString getText(const Rectangle &r) const; + + TQValueList textList() const; + + /** + * Returns the transition of this page + **/ + PageTransition *getTransition() const; + + enum Orientation { + Landscape, + Portrait, + Seascape, + UpsideDown + }; + + /** + * The orientation of the page + **/ + Orientation orientation() const; + + /** + Gets the links of the page once it has been rendered if doLinks was true + */ + TQValueList links() const; + + private: + Page(const Document *doc, int index); + PageData *data; +}; + +class DocumentData; + +class Document { + friend class Page; + +public: + enum PageMode { + UseNone, + UseOutlines, + UseThumbs, + FullScreen, + UseOC + }; + + static Document *load(const TQString & filePath); + + Page *getPage(int index) const{ return new Page(this, index); } + + int getNumPages() const; + + PageMode getPageMode() const; + + bool unlock(const TQCString &password); + + bool isLocked() const; + + TQDateTime getDate( const TQString & data ) const; + TQString getInfo( const TQString & data ) const; + bool isEncrypted() const; + bool isLinearized() const; + bool okToPrint() const; + bool okToChange() const; + bool okToCopy() const; + bool okToAddNotes() const; + double getPDFVersion() const; + /** + The version of the PDF specification that the document + conforms to + + \param major an optional pointer to a variable where store the + "major" number of the version + \param minor an optional pointer to a variable where store the + "minor" number of the version + + \since 0.12 + */ + void getPdfVersion(int *major, int *minor) const; + + bool print(const TQString &fileName, TQValueList pageList, double hDPI, double vDPI, int rotate); + + // If you are using TQPrinter you can get paper size doing + // TQPrinter dummy(TQPrinter::PrinterResolution); + // dummy.setFullPage(true); + // dummy.setPageSize(thePageSizeYouWant); + // TQPaintDeviceMetrics metrics(&dummy); + // int width = metrics.width(); + // int height = metrics.height(); + bool print(const TQString &fileName, TQValueList pageList, double hDPI, double vDPI, int rotate, int paperWidth, int paperHeight); + + /** + The fonts within the PDF document. + + \note this can take a very long time to run with a large + document. You may wish to use the call below if you have more + than say 20 pages + */ + TQValueList fonts() const; + + /** + \overload + + \param numPages the number of pages to scan + \param fontList pointer to the list where the font information + should be placed + + \return false if the end of the document has been reached + */ + bool scanForFonts( int numPages, TQValueList *fontList ) const; + + /** + Gets the TOC of the Document, it is application responsabiliy to delete + it when no longer needed + + * In the tree the tag name is the 'screen' name of the entry. A tag can have + * attributes. Here follows the list of tag attributes with meaning: + * - Destination: A string description of the referred destination + * - DestinationName: A 'named reference' to the viewport that must be converted + * using linkDestination( *destination_name* ) + * - ExternalFileName: A link to a external filename + + \returns NULL if the Document does not have TOC + */ + TQDomDocument *toc() const; + + LinkDestination *linkDestination( const TQString &name ); + + ~Document(); + +private: + DocumentData *data; + Document(DocumentData *dataA); +}; + +} +#endif diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-tqt.pc.cmake b/tdefile-plugins/dependencies/poppler-tqt/poppler-tqt.pc.cmake new file mode 100644 index 00000000..86a0a0d5 --- /dev/null +++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-tqt.pc.cmake @@ -0,0 +1,12 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=@LIB_INSTALL_DIR@ +includedir=@INCLUDE_INSTALL_DIR@ + +Name: poppler-tqt +Description: TQt bindings for poppler +Version: @POPPLER_VERSION@ +Requires: poppler = @POPPLER_VERSION@ + +Libs: -L${libdir} -lpoppler-tqt +Cflags: -I${includedir} diff --git a/tdefile-plugins/dependencies/poppler-tqt/test-poppler-qt.cpp b/tdefile-plugins/dependencies/poppler-tqt/test-poppler-qt.cpp new file mode 100644 index 00000000..d616290d --- /dev/null +++ b/tdefile-plugins/dependencies/poppler-tqt/test-poppler-qt.cpp @@ -0,0 +1,122 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class PDFDisplay : public TQWidget // picture display widget +{ +public: + PDFDisplay( Poppler::Document *d ); + ~PDFDisplay(); +protected: + void paintEvent( TQPaintEvent * ); + void keyPressEvent( TQKeyEvent * ); +private: + void display(); + + int currentPage; + TQPixmap *pixmap; + Poppler::Document *doc; +}; + +PDFDisplay::PDFDisplay( Poppler::Document *d ) +{ + doc = d; + pixmap = 0; + currentPage = 0; + display(); +} + +PDFDisplay::~PDFDisplay() +{ + delete doc; + delete pixmap; +} + +void PDFDisplay::paintEvent( TQPaintEvent *e ) +{ + TQPainter paint( this ); // paint widget + if (pixmap) + paint.drawPixmap(0, 0, *pixmap); +} + +void PDFDisplay::keyPressEvent( TQKeyEvent *e ) +{ + if (e->key() == TQt::Key_Down) + { + if (currentPage + 1 < doc->getNumPages()) + { + currentPage++; + display(); + } + } + else if (e->key() == TQt::Key_Up) + { + if (currentPage > 0) + { + currentPage--; + display(); + } + } +} + +void PDFDisplay::display() +{ + if (doc) { + Poppler::Page *page = doc->getPage(currentPage); + if (page) { + delete pixmap; + page->renderToPixmap(&pixmap, -1, -1, -1, -1); + delete page; + update(); + } + } else { + printf("doc not loaded\n"); + } +} + +int main( int argc, char **argv ) +{ + TQApplication a( argc, argv ); // TQApplication required! + + if ( argc < 2 || (argc == 3 && strcmp(argv[2], "-extract") != 0) || argc > 3) + { + // use argument as file name + printf("usage: test-poppler-qt filename [-extract]\n"); + exit(1); + } + + Poppler::Document *doc = Poppler::Document::load(argv[1]); + if (!doc) + { + printf("doc not loaded\n"); + exit(1); + } + + if (argc == 2) + { + PDFDisplay test( doc ); // create picture display + a.setMainWidget( &test); // set main widget + test.setCaption("Poppler-TQt Test"); + test.show(); // show it + + return a.exec(); // start event loop + } + else + { + Poppler::Page *page = doc->getPage(0); + + TQLabel *l = new TQLabel(page->getText(Poppler::Rectangle()), 0); + l->show(); + a.setMainWidget(l); // set main widget + delete page; + delete doc; + return a.exec(); + } +} diff --git a/tdefile-plugins/dvi/CMakeLists.txt b/tdefile-plugins/dvi/CMakeLists.txt new file mode 100644 index 00000000..beb5d8e2 --- /dev/null +++ b/tdefile-plugins/dvi/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_dvi.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +#### tdefile_dvi (module) ######################### + +tde_add_kpart( tdefile_dvi AUTOMOC + SOURCES tdefile_dvi.cpp + LINK tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/dvi/Makefile.am b/tdefile-plugins/dvi/Makefile.am new file mode 100644 index 00000000..116d7a0d --- /dev/null +++ b/tdefile-plugins/dvi/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for the dvi 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_dvi.h + +kde_module_LTLIBRARIES = tdefile_dvi.la + +tdefile_dvi_la_SOURCES = tdefile_dvi.cpp +tdefile_dvi_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdefile_dvi_la_LIBADD = $(LIB_KIO) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: + $(XGETTEXT) *.cpp -o $(podir)/tdefile_dvi.pot + +services_DATA = tdefile_dvi.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/dvi/tdefile_dvi.cpp b/tdefile-plugins/dvi/tdefile_dvi.cpp new file mode 100644 index 00000000..374e5e54 --- /dev/null +++ b/tdefile-plugins/dvi/tdefile_dvi.cpp @@ -0,0 +1,150 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Matthias Witzgall + * + * 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. + * + */ + + +/* further informations about the dvi file format could be downloaded from: http://www.rpi.edu/~sofkam/DVI/archive/standards/dvistd0.dvi */ + +#include "tdefile_dvi.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + + +// preprocessormacro K_EXPORT_COMPONENT_FACTORY loads shared library 'tdefile_dvi.so' dynamic if necessary +typedef KGenericFactory DviFactory; +K_EXPORT_COMPONENT_FACTORY(tdefile_dvi, DviFactory("tdefile_dvi")) + +KDviPlugin::KDviPlugin (TQObject * parent, const char * name, const TQStringList & preferredItems) + : KFilePlugin(parent, name, preferredItems) +{ + kdDebug(7034) << "dvi plugin" << endl; + + // set up our mime type + KFileMimeTypeInfo * info = this->addMimeTypeInfo("application/x-dvi"); + + + KFileMimeTypeInfo::GroupInfo * group = this->addGroupInfo(info, "General", "General"); + + this->addItemInfo(group, "3_Created", i18n("Created"), TQVariant::String); + this->addItemInfo(group, "6_Comment", i18n("Comment"), TQVariant::String); + this->addItemInfo(group, "7_Pages", i18n("Pages"), TQVariant::UInt); +} + +bool KDviPlugin::readInfo (KFileMetaInfo & info, uint /* what (unused in this plugin) */) +{ + if ( info.path().isEmpty() ) + return false; + KFileMetaInfoGroup GeneralGroup = appendGroup(info, "General"); + TQFile f(info.path()); + TQFileInfo f_info; + TQ_UINT16 bytes_to_read; + TQ_UINT8 comment_length; + TQString comment; + TQ_UINT16 pages; + TQ_UINT8 buffer[270]; // buffer for reading data; no data is read with more than 270 bytes + TQ_UINT32 ptr; + int i; // running index + + // open file and try to get the comment + f.open(IO_ReadOnly); + + if ( f.isOpen() == false ){ + kdDebug(7034) << "cannot open file" << endl; + return false; + } + + f_info.setFile(f); // create fileinfoobject + bytes_to_read = TQMIN(f_info.size(), 270); // check, if the file size is smaller than 270 bytes + // (if the comment is as large as possible, we don't have to + // read more than 270 bytes) + + if ( f.readBlock((char *)buffer, bytes_to_read) != bytes_to_read ){ // cast to (char *) is necessary + kdDebug(7034) << "read error (1)" << endl; + return false; + } + + if ( (buffer[0] != 247) || (buffer[1] != 2) ){ + // magic numbers are not right + kdDebug(7034) << "wrong file format" << endl;; + return false; + } + + comment_length = buffer[14]; // set up length of comment + comment.setLength(comment_length); // used to avoid permanent reallocation when extracting the comment from buffer + + for ( i = 15; i <= 14+comment_length; ++i ) // extract comment from buffer + comment[i-15] = (char)buffer[i]; + + appendItem(GeneralGroup, "6_Comment", comment.simplifyWhiteSpace() ); + + // comment is ok, now get total number of pages + f.at( f.size() - 13); + if ( f.readBlock((char *)buffer, 13) != 13 ){ + kdDebug(7034) << "read error (2)" << endl; + return false; + } + + i = 12; // reset running index i + while ( buffer[i] == 223 ){ --i; } // skip all trailing bytes + + if ( (buffer[i] != 2) || (i > 8) || (i < 5) ){ + kdDebug(7034) << "wrong file formatx" << endl; + return false; + } + + // now we know the position of the pointer to the beginning of the postamble and we can read it + ptr = buffer[i-4]; + ptr = (ptr << 8) | buffer[i-3]; + ptr = (ptr << 8) | buffer[i-2]; + ptr = (ptr << 8) | buffer[i-1]; + + // bytes for total number of pages have a offset of 27 to the beginning of the postamble + f.at(ptr + 27); + + // now read total number of pages from file + if ( f.readBlock((char *)buffer, 2) != 2 ){ + kdDebug(7034) << "read error (3)" << endl; + return false; + } + pages = buffer[0]; + pages = (pages << 8) | buffer[1]; + + appendItem(GeneralGroup, "7_Pages", TQVariant(pages) ); + + f.close(); + + // now get and set up some basic informations about the file (same informations would be displayed, if there is no dvi-plugin) + appendItem(GeneralGroup, "1_Type", TQVariant( i18n("TeX Device Independent file") ) ); // set up type of file + + appendItem(GeneralGroup, "4_Modified", TQVariant(f_info.lastModified().toString("yyyy-MM-dd hh:mm")) ); + // ISO 8601 date format (without seconds) + + return true; +} + +#include "tdefile_dvi.moc" diff --git a/tdefile-plugins/dvi/tdefile_dvi.desktop b/tdefile-plugins/dvi/tdefile_dvi.desktop new file mode 100644 index 00000000..e3bade83 --- /dev/null +++ b/tdefile-plugins/dvi/tdefile_dvi.desktop @@ -0,0 +1,60 @@ +[Desktop Entry] +Icon= +MimeType=application/x-dvi +Name=DVI Info +Name[ar]=معلومات DVI +Name[br]=Titouroù DVI +Name[ca]=Informació de DVI +Name[cs]=DVI info +Name[cy]=Gwybodaeth DVI +Name[da]=DVI-info +Name[de]=DVI-Info +Name[el]=Πληροφορίες DVI +Name[eo]=DVI-informo +Name[es]=Info DVI +Name[et]=DVI info +Name[fa]=اطلاعات DVI +Name[fi]=DVI-tiedot +Name[fr]=Informations DVI +Name[ga]=Eolas faoi DVI +Name[gl]=Inf. DVI +Name[he]=מידע DVI +Name[hi]=DVI जानकारी +Name[hu]=DVI-jellemzők +Name[is]=DVI upplýsingar +Name[it]=Informazioni DVI +Name[ja]=DVI 情報 +Name[kk]=DVI мәліметі +Name[km]=ព័ត៌មាន DVI +Name[lt]=DVI informacija +Name[ms]=Maklumat DVI +Name[nds]=DVI-Info +Name[ne]=DVI सूचना +Name[nl]=DVI-info +Name[nn]=DVI-info +Name[pa]=DVI ਜਾਣਕਾਰੀ +Name[pl]=Informacja o pliku DVI +Name[pt]=Informação do DVI +Name[pt_BR]=Informação sobre DVI +Name[ro]=Informaţii DVI +Name[ru]=Информация о DVI +Name[se]=DVI-dieđut +Name[sl]=Podatki o DVI +Name[sr]=DVI информације +Name[sr@Latn]=DVI informacije +Name[sv]=DVI-information +Name[ta]=DVI தகவல் +Name[tg]=Иттилоот оиди DVI +Name[th]=ข้อมูลแฟ้ม DVI +Name[tr]=DVI Bilgisi +Name[uk]=Інформація по DVI +Name[uz]=DVI haqida maʼlumot +Name[uz@cyrillic]=DVI ҳақида маълумот +Name[wa]=Informåcion sol documint DVI +Name[zh_CN]=DVI 信息 +Name[zh_HK]=DVI 資訊 +Name[zh_TW]=DVI 資訊 +ServiceTypes=KFilePlugin +Type=Service +X-TDE-Library=tdefile_dvi +PreferredItems=Title,Author,Subject,Creator,Producer,CreationDate,ModDate,Keywords diff --git a/tdefile-plugins/dvi/tdefile_dvi.h b/tdefile-plugins/dvi/tdefile_dvi.h new file mode 100644 index 00000000..da4bc6fe --- /dev/null +++ b/tdefile-plugins/dvi/tdefile_dvi.h @@ -0,0 +1,38 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Matthias Witzgall + * + * 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_DVI_H__ +#define __KFILE_DVI_H__ + +#include + +class TQStringList; + +class KDviPlugin : public KFilePlugin +{ + Q_OBJECT + +public: + KDviPlugin ( TQObject * parent, const char * name, const TQStringList & preferredItems ); + + virtual bool readInfo (KFileMetaInfo & info, uint what); +}; + +#endif diff --git a/tdefile-plugins/exr/CMakeLists.txt b/tdefile-plugins/exr/CMakeLists.txt new file mode 100644 index 00000000..284c973a --- /dev/null +++ b/tdefile-plugins/exr/CMakeLists.txt @@ -0,0 +1,38 @@ +################################################# +# +# (C) 2010-2011 Calvin Morrison +# mutantturkey@gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include( ConfigureChecks.cmake ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} + ${OPENEXR_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +#### other data ################################# + +install( FILES tdefile_exr.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +#### tdefile_exr (module) ######################### + +tde_add_kpart( tdefile_exr AUTOMOC + SOURCES tdefile_exr.cpp + LINK tdeio-shared ${OPENEXR_LIBRARIES} + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/exr/ConfigureChecks.cmake b/tdefile-plugins/exr/ConfigureChecks.cmake new file mode 100644 index 00000000..193173c2 --- /dev/null +++ b/tdefile-plugins/exr/ConfigureChecks.cmake @@ -0,0 +1,16 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +# OpenEXR +pkg_search_module( OPENEXR OpenEXR ) +if( NOT OPENEXR_FOUND ) + tde_message_fatal( "OpenEXR is required, but was not found on your system" ) +endif( ) diff --git a/tdefile-plugins/exr/Makefile.am b/tdefile-plugins/exr/Makefile.am new file mode 100644 index 00000000..8df4ed64 --- /dev/null +++ b/tdefile-plugins/exr/Makefile.am @@ -0,0 +1,25 @@ +## Makefile.am for EXR file meta info plugin + +KDE_CXXFLAGS = $(USE_EXCEPTIONS) + +# set the include path for X, qt and KDE +INCLUDES = -Drestrict= $(all_includes) $(EXR_FLAGS) +# INCLUDES = $(all_includes) $(EXR_FLAGS) + +# these are the headers for your project +noinst_HEADERS = tdefile_exr.h + +kde_module_LTLIBRARIES = tdefile_exr.la + +tdefile_exr_la_SOURCES = tdefile_exr.cpp +tdefile_exr_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdefile_exr_la_LIBADD = $(LIB_KIO) $(LIB_EXR) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: + $(XGETTEXT) *.cpp -o $(podir)/tdefile_exr.pot + +services_DATA = tdefile_exr.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/exr/configure.in.in b/tdefile-plugins/exr/configure.in.in new file mode 100644 index 00000000..2a9ff5e5 --- /dev/null +++ b/tdefile-plugins/exr/configure.in.in @@ -0,0 +1,14 @@ +AC_ARG_WITH([openexr], + [AC_HELP_STRING([--with-openexr], + [Enable support for OpenEXR @<:@default=check@:>@])], + [], with_openexr=check) + +if test "x$with_openexr" != xno; then + KDE_FIND_LIBEXR + + if test "x$with_openexr" != xcheck && test -z "$LIB_EXR"; then + AC_MSG_ERROR([--with-openexr was given, but test for OpenEXR failed]) + fi +fi + +AM_CONDITIONAL(include_EXR_MODULES, test -n "$LIB_EXR") diff --git a/tdefile-plugins/exr/tdefile_exr.cpp b/tdefile-plugins/exr/tdefile_exr.cpp new file mode 100644 index 00000000..d8007e3d --- /dev/null +++ b/tdefile-plugins/exr/tdefile_exr.cpp @@ -0,0 +1,393 @@ +// -*- C++;indent-tabs-mode: t; tab-width: 4; c-basic-offset: 4; -*- +/* This file is part of the KDE project + * Copyright (C) 2003 + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + + +#include "tdefile_exr.h" +using namespace Imf; + +typedef KGenericFactory ExrFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_exr, ExrFactory("tdefile_exr")) + +KExrPlugin::KExrPlugin(TQObject *parent, const char *name, + const TQStringList &args) + : KFilePlugin(parent, name, args) +{ + // set up our mime type + KFileMimeTypeInfo* info = addMimeTypeInfo( "image/x-exr" ); + + KFileMimeTypeInfo::GroupInfo* group = 0; + KFileMimeTypeInfo::ItemInfo* item; + + // info group + group = addGroupInfo( info, "Info", i18n("Information") ); + addItemInfo( group, "Version", i18n("Format Version"), TQVariant::Int ); + addItemInfo( group, "Tiled image", i18n("Tiled Image"), TQVariant::String ); + item = addItemInfo( group, "Dimensions", i18n("Dimensions"), TQVariant::Size ); + setHint( item, KFileMimeTypeInfo::Size ); + setUnit( item, KFileMimeTypeInfo::Pixels ); + item = addItemInfo( group, "ThumbnailDimensions", + i18n("Thumbnail Dimensions"), TQVariant::Size ); + setHint( item, KFileMimeTypeInfo::Size ); + setUnit( item, KFileMimeTypeInfo::Pixels ); + addItemInfo( group, "Comment", i18n("Comment"), TQVariant::String ); + item = addItemInfo( group, "Thumbnail", i18n("Thumbnail"), TQVariant::Image ); + setHint( item, KFileMimeTypeInfo::Thumbnail ); + + // standard attributes group + group = addGroupInfo( info, "Standard", i18n("Standard Attributes") ); + addItemInfo( group, "Owner", i18n("Owner"), TQVariant::String ); + addItemInfo( group, "Comments", i18n("Comments"), TQVariant::String ); + addItemInfo( group, "Capture Date", i18n("Capture Date"), TQVariant::String ); + item = addItemInfo( group, "UTC Offset", i18n("UTC Offset"), TQVariant::String ); + item = addItemInfo( group, "Exposure time", i18n("Exposure Time"), TQVariant::Double); + setUnit( item, KFileMimeTypeInfo::Seconds ); + item = addItemInfo( group, "Focus", i18n("Focus"), TQVariant::Double); + setSuffix( item, i18n("Metres", "m") ); + item = addItemInfo( group, "X Density", i18n("X Density"), TQVariant::Double); + setSuffix( item, i18n("Pixels Per Inch", " ppi") ); + item = addItemInfo( group, "White luminance", i18n("White Luminance"), TQVariant::Double); + setSuffix( item, i18n("Candelas per square metre", " Nits") ); + addItemInfo( group, "Longitude", i18n("Longitude"), TQVariant::String ); + addItemInfo( group, "Latitude", i18n("Latitude"), TQVariant::String ); + item = addItemInfo( group, "Altitude", i18n("Altitude"), TQVariant::String ); + setSuffix( item, i18n("Metres", "m") ); + addItemInfo( group, "ISO speed", i18n("ISO Speed"), TQVariant::Double ); + addItemInfo( group, "Aperture", i18n("Aperture"), TQVariant::Double ); + + // channel group + group = addGroupInfo( info, "Channel", i18n("Channels") ); + addItemInfo( group, "A", i18n("A"), TQVariant::String ); + addItemInfo( group, "R", i18n("R"), TQVariant::String ); + addItemInfo( group, "G", i18n("G"), TQVariant::String ); + addItemInfo( group, "B", i18n("B"), TQVariant::String ); + addItemInfo( group, "Z", i18n("Z"), TQVariant::String ); + addItemInfo( group, "NX", i18n("NX"), TQVariant::String ); + addItemInfo( group, "NY", i18n("NY"), TQVariant::String ); + addItemInfo( group, "NZ", i18n("NZ"), TQVariant::String ); + addItemInfo( group, "R", i18n("R"), TQVariant::String ); + addItemInfo( group, "U", i18n("U"), TQVariant::String ); + addItemInfo( group, "V", i18n("V"), TQVariant::String ); + addItemInfo( group, "materialID", i18n("materialID"), TQVariant::String ); + addItemInfo( group, "objectID", i18n("objectID"), TQVariant::String ); + addItemInfo( group, "renderID", i18n("renderID"), TQVariant::String ); + addItemInfo( group, "pixelCover", i18n("pixelCover"), TQVariant::String ); + addItemInfo( group, "velX", i18n("velX"), TQVariant::String ); + addItemInfo( group, "velY", i18n("velY"), TQVariant::String ); + addItemInfo( group, "packedRGBA", i18n("packedRGBA"), TQVariant::String ); + + + // technical group + group = addGroupInfo( info, "Technical", i18n("Technical Details") ); + addItemInfo( group, "Compression", i18n("Compression"), TQVariant::String ); + addItemInfo( group, "Line Order", i18n("Line Order"), TQVariant::String ); + + // 3dsMax group + // This supports a special plugin for 3D Studio Max + group = addGroupInfo( info, "3dsMax", i18n("3dsMax Details") ); + addItemInfo( group, "Local time", i18n("Local Time"), TQVariant::String ); + addItemInfo( group, "System time", i18n("System Time"), TQVariant::String ); + addItemInfo( group, "Plugin version", i18n("Plugin Version"), TQVariant::String ); + addItemInfo( group, "EXR version", i18n("EXR Version"), TQVariant::String ); + addItemInfo( group, "Computer name", i18n("Computer Name"), TQVariant::String ); +} + +TQCString doType( PixelType pt ) +{ + switch (pt) + { + case UINT: + return TQCString("32-bit unsigned integer"); + break; + case HALF: + return TQCString("16-bit floating-point"); + break; + case FLOAT: + return TQCString("32-bit floating-point"); + break; + default: + return TQCString(); + break; + } +} + +bool KExrPlugin::readInfo( KFileMetaInfo& info, uint what) +{ + try + { + InputFile in ( info.path().ascii() ); + const Header &h = in.header(); + + KFileMetaInfoGroup infogroup = appendGroup(info, "Info"); + KFileMetaInfoGroup stdgroup = appendGroup(info, "Standard"); + KFileMetaInfoGroup channelgroup = appendGroup(info, "Channel"); + KFileMetaInfoGroup techgroup = appendGroup(info, "Technical"); + KFileMetaInfoGroup threedsmaxgroup = appendGroup(info, "3dsMax"); + + appendItem( infogroup, "Version", getVersion(in.version()) ); + if (isTiled(in.version())) { + appendItem( infogroup, "Tiled image", "yes" ); + } else { + appendItem( infogroup, "Tiled image", "no" ); + } + + Imath::Box2i dw = h.dataWindow(); + appendItem( infogroup, "Dimensions", TQSize( (dw.max.x - dw.min.x + 1 ), + (dw.max.y - dw.min.y + 1 ) ) ); + + if ( h.hasPreviewImage() ) { + const PreviewImage &preview = in.header().previewImage(); + appendItem( infogroup, "ThumbnailDimensions", TQSize(preview.width(), preview.height()) ); + TQImage qpreview(preview.width(), preview.height(), 32, 0, TQImage::BigEndian); + for ( unsigned int y=0; y < preview.height(); y++ ) { + for ( unsigned int x=0; x < preview.width(); x++ ) { + const PreviewRgba &q = preview.pixels()[x+(y*preview.width())]; + qpreview.setPixel( x, y, tqRgba(q.r, q.g, q.b, q.a) ); + } + } + appendItem( infogroup, "Thumbnail", qpreview); + } + + const StringAttribute *commentSA = h.findTypedAttribute ("comment"); + if (commentSA) { + std::string commentString = commentSA->value(); + TQString qcommentString(commentString.data()); + qcommentString.setLength(commentString.size()); + appendItem( infogroup, "Comment", qcommentString ); + } + + // Standard Attributes we are interested in and can + // meaningfully represent. + if ( hasComments(h) ) { + std::string commentsString = comments(h); + TQString qcommentsString(commentsString.data()); + qcommentsString.setLength(commentsString.size()); + appendItem( stdgroup, "Comments", qcommentsString ); + } + if ( hasOwner(h) ) { + std::string ownerString = owner(h); + TQString qownerString(ownerString.data()); + qownerString.setLength(ownerString.size()); + appendItem( stdgroup, "Owner", qownerString ); + } + if ( hasCapDate(h) ) { + std::string capDateString = capDate(h); + TQString qcapDateString(capDateString.data()); + qcapDateString.setLength(capDateString.size()); + appendItem( stdgroup, "Capture Date", qcapDateString ); + } + // This define was introduced in EXR 1.6.0 +#ifndef IMF_B44_COMPRESSION + // This is the 1.4 and earlier version + if ( hasutcOffset(h) ) { +#else + // This is the 1.6.0 and later version + if ( hasUtcOffset(h) ) { +#endif + TQString UTCOffset; + if (utcOffset(h)>0.0) { + UTCOffset.append(TQString("%1").arg(utcOffset(h)/3600, 0, 'f', 1)); + UTCOffset.append(" hours behind UTC"); + } else { + UTCOffset.append(TQString("%1").arg(-1.0*utcOffset(h)/3600, 0, 'f', 1)); + UTCOffset.append(" hours ahead of UTC"); + } + appendItem( stdgroup, "UTC Offset", UTCOffset); + } + if ( hasExpTime(h) ) { + double exposureTime = expTime(h); + appendItem( stdgroup, "Exposure time", exposureTime ); + } + if ( hasFocus(h) ) { + double focusDistance = focus(h); + appendItem( stdgroup, "Focus", focusDistance ); + } + if ( hasXDensity(h) ) { + double XDensity = xDensity(h); + appendItem( stdgroup, "X Density", XDensity ); + } + if ( hasWhiteLuminance(h) ) { + double WhiteLuminance = whiteLuminance(h); + appendItem( stdgroup, "White luminance", WhiteLuminance ); + } + if ( hasLongitude(h) ) { + TQString Longitude; + if (longitude(h)<0.0) { + Longitude.append(TQString("%1").arg(-1.0*longitude(h),0,'f',3)); + Longitude.append(" deg West"); + } else { + Longitude.append(TQString("%1").arg(longitude(h),0,'f',3)); + Longitude.append(" deg East"); + } + appendItem( stdgroup, "Longitude", Longitude); + } + if ( hasLatitude(h) ) { + TQString Latitude; + if (latitude(h)<0.0) { + Latitude.append(TQString("%1").arg(-1.0*latitude(h),0,'f',3)); + Latitude.append(" deg South"); + } else { + Latitude.append(TQString("%1").arg(latitude(h),0,'f',3)); + Latitude.append(" deg North"); + } + appendItem( stdgroup, "Latitude", Latitude ); + } + if ( hasAltitude(h) ) { + double Altitude = altitude(h); + appendItem( stdgroup, "Altitude", TQString("%1").arg(Altitude,0,'f',1) ); + } + if ( hasIsoSpeed(h) ) { + double IsoSpeed = isoSpeed(h); + appendItem( stdgroup, "ISO speed", IsoSpeed ); + } + if ( hasAperture(h) ) { + double Aperture = aperture(h); + appendItem( stdgroup, "Aperture", Aperture ); + } + + for (Header::ConstIterator i = h.begin(); i != h.end(); ++i) { + const Attribute *a = &i.attribute(); + + if (const CompressionAttribute *ta = dynamic_cast (a)) { + switch ( ta->value() ) + { + case NO_COMPRESSION: + appendItem( techgroup, "Compression", i18n("No compression")); + break; + case RLE_COMPRESSION: + appendItem( techgroup, "Compression", i18n("Run Length Encoding")); + break; + case ZIPS_COMPRESSION: + appendItem( techgroup, "Compression", i18n("zip, individual scanlines")); + break; + case ZIP_COMPRESSION: + appendItem( techgroup, "Compression", i18n("zip, multi-scanline blocks")); + break; + case PIZ_COMPRESSION: + appendItem( techgroup, "Compression", i18n("piz compression")); + break; + default: + break; + } + } else if (const LineOrderAttribute *ta = dynamic_cast (a)) { + switch (ta->value()) + { + case INCREASING_Y: + appendItem( techgroup, "Line Order", i18n("increasing Y")); + break; + case DECREASING_Y: + appendItem( techgroup, "Line Order", i18n("decreasing Y")); + break; + default: + break; + }; + } else if (const ChannelListAttribute *ta = dynamic_cast (a)) { + + for (ChannelList::ConstIterator i = ta->value().begin(); i != ta->value().end(); ++i) + { + appendItem( channelgroup, i.name(), doType(i.channel().type) ); + } + } + } + + // This section deals with some special case stuff for a 3D Studio Max + // plugin from Splutterfish. The weird construction is an + // attempt to to deal with class conversion. C++ string handling + // without TQt is a pain... + const StringAttribute *ver3DSM = h.findTypedAttribute ("version3dsMax"); + if (ver3DSM) { + std::string ver3DSMstring = ver3DSM->value(); + TQString qver3DSMstring(ver3DSMstring.data()); + qver3DSMstring.setLength(ver3DSMstring.size()); + appendItem( threedsmaxgroup, "Plugin version", qver3DSMstring ); + } + const StringAttribute *verEXR = h.findTypedAttribute ("versionEXR"); + if (verEXR) { + std::string verEXRstring = verEXR->value(); + TQString qverEXRstring(verEXRstring.data()); + qverEXRstring.setLength(verEXRstring.size()); + appendItem( threedsmaxgroup, "EXR version", TQString( verEXRstring.data() ) ); + } + const StringAttribute *localTime = h.findTypedAttribute ("localTime"); + if (localTime) { + std::string localTimeString = localTime->value(); + TQString qlocalTimeString(localTimeString.data()); + qlocalTimeString.setLength(localTimeString.size()); + appendItem( threedsmaxgroup, "Local time", qlocalTimeString ); + } + const StringAttribute *systemTime = h.findTypedAttribute ("systemTime"); + if (systemTime) { + std::string systemTimeString = systemTime->value(); + TQString qsystemTimeString(systemTimeString.data()); + qsystemTimeString.setLength(systemTimeString.size()); + appendItem( threedsmaxgroup, "System time", qsystemTimeString ); + } + const StringAttribute *computerName = h.findTypedAttribute ("computerName"); + if (computerName) { + std::string computerNameString = computerName->value(); + TQString qcomputerNameString(computerNameString.data()); + qcomputerNameString.setLength(computerNameString.size()); + appendItem( threedsmaxgroup, "Computer name", qcomputerNameString ); + } + + return true; + } + catch (const std::exception &e) + { + kdDebug(0) << e.what() << endl; + return false; + } +} + +#include "tdefile_exr.moc" diff --git a/tdefile-plugins/exr/tdefile_exr.desktop b/tdefile-plugins/exr/tdefile_exr.desktop new file mode 100644 index 00000000..e9736d67 --- /dev/null +++ b/tdefile-plugins/exr/tdefile_exr.desktop @@ -0,0 +1,57 @@ +[Desktop Entry] +Type=Service +Name=EXR Info +Name[br]=Titouroù EXR +Name[ca]=Informació EXR +Name[cs]=EXR info +Name[cy]=Gwybodaeth EXR +Name[da]=EXR-Info +Name[de]=EXR-Info +Name[el]=Πληροφορίες EXR +Name[eo]=EXR-informo +Name[es]=Info EXR +Name[et]=EXR info +Name[fa]=اطلاعات EXR +Name[fi]=EXR-tiedot +Name[fr]=Informations EXR +Name[ga]=Eolas faoi EXR +Name[gl]=Inf. EXR +Name[he]=מידע EXR +Name[hu]=EXR-jellemzők +Name[is]=EXR upplýsingar +Name[it]=Informazioni EXR +Name[ja]=EXR 情報 +Name[kk]=EXR мәліметі +Name[km]=ព័ត៌មាន EXR +Name[lt]=EXR informacija +Name[ms]=Maklumat EXR +Name[nds]=EXR-Info +Name[ne]=EXR सूचना +Name[nl]=EXR-info +Name[nn]=EXR-info +Name[pa]=EXR ਜਾਣਕਾਰੀ +Name[pl]=Informacja EXR +Name[pt]=Informação do EXR +Name[pt_BR]=Informação sobre EXR +Name[ro]=Informaţii EXR +Name[ru]=Информация о EXR +Name[se]=EXR-dieđut +Name[sl]=Podatki o EXR +Name[sr]=EXR информације +Name[sr@Latn]=EXR informacije +Name[sv]=EXR-information +Name[ta]=EXR தகவல் +Name[tg]=Иттилоот оиди EXR +Name[th]=ข้อมูลแฟ้ม EXR +Name[tr]=EXR Bilgisi +Name[uk]=Інформація по EXR +Name[uz]=EXR haqida maʼlumot +Name[uz@cyrillic]=EXR ҳақида маълумот +Name[zh_CN]=EXR 信息 +Name[zh_HK]=EXR 資訊 +Name[zh_TW]=EXR 資訊 +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_exr +MimeType=image/x-exr +PreferredGroups=Info,Standard,Channels,Technical,3dsMax +PreferredItems=Dimensions,Thumbnail,ThumbnailDimensions,Version,Comments,Owner,Latitude,Longitude,Altitude,Capture Date,UTC Offset diff --git a/tdefile-plugins/exr/tdefile_exr.h b/tdefile-plugins/exr/tdefile_exr.h new file mode 100644 index 00000000..2fd23434 --- /dev/null +++ b/tdefile-plugins/exr/tdefile_exr.h @@ -0,0 +1,40 @@ +/* This file is part of the KDE project + * Copyright (C) 2003 + * + * 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_EXR_H__ +#define __KFILE_EXR_H__ + +#include +#include + +class TQStringList; + +class KExrPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KExrPlugin( TQObject *parent, const char *name, const TQStringList& preferredItems ); + + virtual bool readInfo( KFileMetaInfo& info, uint ); +}; + +#endif diff --git a/tdefile-plugins/gif/CMakeLists.txt b/tdefile-plugins/gif/CMakeLists.txt new file mode 100644 index 00000000..8e71efbf --- /dev/null +++ b/tdefile-plugins/gif/CMakeLists.txt @@ -0,0 +1,34 @@ +################################################# +# +# (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_gif.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +#### tdefile_gif (module) ######################### +tde_add_kpart( tdefile_gif AUTOMOC + SOURCES tdefile_gif.cpp + LINK tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/gif/Makefile.am b/tdefile-plugins/gif/Makefile.am new file mode 100644 index 00000000..d6f8d82c --- /dev/null +++ b/tdefile-plugins/gif/Makefile.am @@ -0,0 +1,24 @@ +## Makefile.am for gif file meta info plugin + +KDE_CXXFLAGS = $(USE_EXCEPTIONS) + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# these are the headers for your project +noinst_HEADERS = tdefile_gif.h + +kde_module_LTLIBRARIES = tdefile_gif.la + +tdefile_gif_la_SOURCES = tdefile_gif.cpp +tdefile_gif_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdefile_gif_la_LIBADD = $(LIB_KIO) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: + $(XGETTEXT) *.cpp -o $(podir)/tdefile_gif.pot + +services_DATA = tdefile_gif.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/gif/README b/tdefile-plugins/gif/README new file mode 100644 index 00000000..811cbb28 --- /dev/null +++ b/tdefile-plugins/gif/README @@ -0,0 +1,10 @@ +The original README for this file read: + +Note: Development of this module has been suspended. +Please feel free to contact me, and pick it up. All I ask +is that you preserve both command line and tdefile abilities. Thanks. +bryce@obviously.com + + +I contacted Bryce, but received no response. The command line code +is unchanged - I just fixed the tdefile code to work, read only. diff --git a/tdefile-plugins/gif/gif-info.1 b/tdefile-plugins/gif/gif-info.1 new file mode 100644 index 00000000..6c36b1c4 --- /dev/null +++ b/tdefile-plugins/gif/gif-info.1 @@ -0,0 +1,25 @@ +.TH gif-info 1 "April 2002" + +.SH NAME +gif-info \- reads gif image info or sets comment. + +.SH SYNOPSIS +.B gif-info +.RB +['Comment'] + +.SH DESCRIPTION +.LP +.B gif-info +displays information about the given gif (Graphic Interchange Format) image. If a comment is specified, the comment is set instead. +.PP +Write a empty comment ('') to delete the comment block. +.PP +The GIF standard allows any number of 256 byte comment blocks in an image file, but most implementations (including this one) restrict you to just one block. The GIF standard restricts comment blocks to "7 Bit ASCII", but this is widely ignored. You are welcome to store text in your own native language, and are especially encouraged to use comments in utf-8 unicode format. + +.SH "SEE ALSO" +.BR wrjpgcom (1) +.BR rdjpgcom (1) + +.SH AUTHOR +Bryce Nesbitt diff --git a/tdefile-plugins/gif/gif-info.c b/tdefile-plugins/gif/gif-info.c new file mode 100644 index 00000000..2f64a2f2 --- /dev/null +++ b/tdefile-plugins/gif/gif-info.c @@ -0,0 +1,561 @@ +/* +** $Id$ +** +** Minimal GIF parser, for use in extracting and setting metadata. +** Modified for standalone & KDE calling by Bryce Nesbitt +** +** TODO: +** Support gif comments that span more than one comment block. +** Verify that Unicode utf-8 is fully unmolested by this code. +** Implement gif structure verifier. +** +** Based on: GIFtrans v1.12.2 +** Copyright (C) 24.2.94 by Andreas Ley +** +******************************************************************************* +** +** Original distribution site is +** ftp://ftp.rz.uni-karlsruhe.de/pub/net/www/tools/giftrans/giftrans.c +** A man-page by knordlun@fltxa.helsinki.fi (Kai Nordlund) is at +** ftp://ftp.rz.uni-karlsruhe.de/pub/net/www/tools/giftrans/giftrans.1 +** An online version by taylor@intuitive.com (Dave Taylor) is at +** http://www.intuitive.com/coolweb/Addons/giftrans-doc.html +** To compile for MS-DOS or OS/2, you need getopt: +** ftp://ftp.rz.uni-karlsruhe.de/pub/net/www/tools/giftrans/getopt.c +** MS-DOS executable can be found at +** ftp://ftp.rz.uni-karlsruhe.de/pub/net/www/tools/giftrans/giftrans.exe +** OS/2 executable can be found at +** ftp://ftp.rz.uni-karlsruhe.de/pub/net/www/tools/giftrans/giftrans.os2.exe +** A template rgb.txt for use with the MS-DOS version can be found at +** ftp://ftp.rz.uni-karlsruhe.de/pub/net/www/tools/giftrans/rgb.txt +** Additional info can be found on +** http://melmac.corp.harris.com/transparent_images.html +** +** The GIF file format is documented in +** ftp://ftp.uu.net/doc/literary/obi/Standards/Graphics/Formats/gif89a.doc.Z +** A good quick reference is at: +** http://www.goice.co.jp/member/mo/formats/gif.html +** +******************************************************************************* +** +** 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. +** +*/ + +#include +#include +#include +#include +#include +#include +#include + +#define STANDALONE_COMPILE + +extern int set_gif_comment( const char * original_filename, char * comment ); +extern void * get_gif_info( const char * original_filename ); +extern int validate_gif_structure( const char * original_filename ); +int giftrans( FILE * src, FILE * dest); + +#define WARNING_GARBAGE 1 /* Original file had some unspecified content */ +#define ERROR_NOT_A_JPEG 5 /* Original file not a proper jpeg (must be 1st) */ +#define ERROR_TEMP_FILE 6 /* Problem writing temporay file */ +#define ERROR_SCREWUP 7 /* Original file is now damaged. Ooops. */ +#define ERROR_PREMATURE_EOF 8 /* Unexpected end of file */ +#define ERROR_BAD_MARKER 9 /* Marker with illegal length */ +#define ERROR_MARKER_ORDER 10 /* File seems to be mixed up */ + +/*****************************************************************************/ +#ifndef FALSE +#define FALSE (0) /* This is the naked Truth */ +#define TRUE (1) /* and this is the Light */ +#endif + +#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ +#define READ_BINARY "r" +#define WRITE_BINARY "w" +#else +#ifdef VMS /* VMS is very nonstandard */ +#define READ_BINARY "rb", "ctx=stm" +#define WRITE_BINARY "wb", "ctx=stm" +#else /* standard ANSI-compliant case */ +#define READ_BINARY "rb" +#define WRITE_BINARY "wb" +#endif +#endif + +#define SUCCESS (0) +#define FAILURE (1) + +static char skipcomment,list,verbose,output,debug; +char *global_comment; +static long int pos; + +static char true[] = "True"; +static char false[] = "False"; +static char id[] = "$Id$"; + +/*****************************************************************************/ + +#define readword(buffer) ((buffer)[0]+256*(buffer)[1]) +#define readflag(buffer) ((buffer)?true:false) +#define hex(c) ('a'<=(c)&&(c)<='z'?(c)-'a'+10:'A'<=(c)&&(c)<='Z'?(c)-'A'+10:(c)-'0') + +void dump(adr,data,len) +long int adr; +unsigned char *data; +size_t len; +{ + int i; + + while (len>0) { + (void)fprintf(stderr,"%08lx:%*s",adr,(int)((adr%16)*3+(adr%16>8?1:0)),""); + for (i=adr%16;i<16&&len>0;i++,adr++,data++,len--) + (void)fprintf(stderr,"%s%02x",i==8?" ":" ",*data); + (void)fprintf(stderr,"\n"); + } +} + +void writedata(dest,data,len) +FILE *dest; +unsigned char *data; +size_t len; +{ + unsigned char size; + + while (len) { + size=len<256?len:255; + (void)fwrite((void *)&size,1,1,dest); + (void)fwrite((void *)data,(size_t)size,1,dest); + data+=size; + len-=size; + } + size=0; + (void)fwrite((void *)&size,1,1,dest); +} + +void skipdata(src) +FILE *src; +{ + unsigned char size,buffer[256]; + + do { + pos=ftell(src); + (void)fread((void *)&size,1,1,src); + if (debug) + dump(pos,&size,1); + if (debug) { + pos=ftell(src); + (void)fread((void *)buffer,(size_t)size,1,src); + dump(pos,buffer,(size_t)size); + } + else + (void)fseek(src,(long int)size,SEEK_CUR); + } while (!feof(src)&&size>0); +} + +void transblock(src,dest) +FILE *src; +FILE *dest; +{ + unsigned char size,buffer[256]; + + pos=ftell(src); + (void)fread((void *)&size,1,1,src); + if (debug) + dump(pos,&size,1); + if (output) + (void)fwrite((void *)&size,1,1,dest); + pos=ftell(src); + (void)fread((void *)buffer,(size_t)size,1,src); + if (debug) + dump(pos,buffer,(size_t)size); + if (output) + (void)fwrite((void *)buffer,(size_t)size,1,dest); +} + +void dumpcomment(src) +FILE *src; +{ + unsigned char size,buffer[256]; + size_t i; + + pos=ftell(src); + (void)fread((void *)&size,1,1,src); + if (debug) + dump(pos,&size,1); + (void)fread((void *)buffer,(size_t)size,1,src); + if (debug) + dump(pos+1,buffer,(size_t)size); + for (i=0; i<(size_t)size; i++) + { + if ( buffer[i] >= 0x20 || buffer[i] == '\t' || + buffer[i] =='\r' || buffer[i] == '\n') + (void)putc(buffer[i],stderr); + else + (void)fprintf(stderr,"\\%03o",buffer[i]); + } + (void)fseek(src,(long int)pos,SEEK_SET); +} + +void transdata(src,dest) +FILE *src; +FILE *dest; +{ + unsigned char size,buffer[256]; + + do { + pos=ftell(src); + (void)fread((void *)&size,1,1,src); + if (debug) + dump(pos,&size,1); + if (output) + (void)fwrite((void *)&size,1,1,dest); + pos=ftell(src); + (void)fread((void *)buffer,(size_t)size,1,src); + if (debug) + dump(pos,buffer,(size_t)size); + if (output) + (void)fwrite((void *)buffer,(size_t)size,1,dest); + } while (!feof(src)&&size>0); +} + + +/*****************************************************************************/ + +int giftrans(src,dest) +FILE *src; +FILE *dest; +{ + unsigned char buffer[3*256],lsd[7],gct[3*256]; + unsigned int cnt,cols,size,gct_size; + + /* Header */ + pos=ftell(src); + (void)fread((void *)buffer,6,1,src); + if (strncmp((char *)buffer,"GIF",3)) { + (void)fprintf(stderr,"Not GIF file!\n"); + return(1); + } + if (verbose && debug) { + buffer[6]='\0'; + (void)fprintf(stderr,"Header: \"%s\"\n",buffer); + } + if (debug) + dump(pos,buffer,6); + if (output) { + (void)fwrite((void *)buffer,6,1,dest); + } + + /* Logical Screen Descriptor */ + pos=ftell(src); + (void)fread((void *)lsd,7,1,src); + if (verbose) { + //(void)fprintf(stderr,"Logical Screen Descriptor:\n"); + (void)fprintf(stderr,"Size : %dx%d pixels\n",readword(lsd), readword(lsd+2)); + //(void)fprintf(stderr,"Global Color Table Flag: %s\n",readflag(lsd[4]&0x80)); + (void)fprintf(stderr,"Depth : %d bits\n",(lsd[4]&0x70>>4)+1); + //if (lsd[4]&0x80) { + // (void)fprintf(stderr,"\tSort Flag: %s\n",readflag(lsd[4]&0x8)); + // (void)fprintf(stderr,"\tSize of Global Color Table: %d colors\n",2<<(lsd[4]&0x7)); + // (void)fprintf(stderr,"\tBackground Color Index: %d\n",lsd[5]); + //} + if (lsd[6]) + (void)fprintf(stderr,"Pixel Aspect Ratio: %d (Aspect Ratio %f)\n",lsd[6],((double)lsd[6]+15)/64); + } + if (debug) + dump(pos,lsd,7); + if (output) + (void)fwrite((void *)lsd,7,1,dest); + + /* Global Color Table */ + if (lsd[4]&0x80) { + gct_size=2<<(lsd[4]&0x7); + pos=ftell(src); + (void)fread((void *)gct,gct_size,3,src); + if (output) + (void)fwrite((void *)gct,gct_size,3,dest); + } + + do { + pos=ftell(src); + (void)fread((void *)buffer,1,1,src); + switch (buffer[0]) { + case 0x2c: /* Image Descriptor */ + if (verbose && debug) + (void)fprintf(stderr,"Image Descriptor:\n"); + (void)fread((void *)(buffer+1),9,1,src); + if (debug) + dump(pos,buffer,10); + if (output) + (void)fwrite((void *)buffer,10,1,dest); + /* Local Color Table */ + if (buffer[8]&0x80) { + size=2<<(buffer[8]&0x7); + pos=ftell(src); + (void)fread((void *)buffer,size,3,src); + if (verbose && debug) { + (void)fprintf(stderr,"Local Color Table:\n"); + for(cnt=0;cnt 3) { + fprintf(stderr, "Usage: %s [\"\"]\nReads gif image info or sets comment.\n", progname); + return(5); + } + filename = argv[1]; + comment = argv[2]; + + + /* Check if file is readable... */ + if ((fp = fopen(filename, READ_BINARY)) == NULL) { + fprintf(stderr, "Error: Can't open file '%s'\n", filename); + return(5); + } + fclose(fp); + + /* Check if we really have a commentable image file here... */ + if( validate_gif_structure( filename ) ) { + fprintf(stderr, "Error: error parsing file '%s' as a gif image\n", filename); + return(5); + } + + if( argc == 2 ) { + get_gif_info( filename ); + } + else { + set_gif_comment( filename, comment ); + } + + return( 0 ); +} +#endif + diff --git a/tdefile-plugins/gif/tdefile_gif.cpp b/tdefile-plugins/gif/tdefile_gif.cpp new file mode 100644 index 00000000..9cc522dc --- /dev/null +++ b/tdefile-plugins/gif/tdefile_gif.cpp @@ -0,0 +1,122 @@ +/* + * This file is part of the KDE project, added by Bryce Nesbitt + * + * This is a plugin for Konqeror/KFile which processes 'extra' information + * contained in a .gif image file (In particular the comment, and resolution). + * + ************************************** + * + * 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 +#include "tdefile_gif.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +typedef KGenericFactory GifFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_gif, GifFactory("tdefile_gif")) + +KGifPlugin::KGifPlugin(TQObject *parent, const char *name, + const TQStringList &args) + : KFilePlugin(parent, name, args) +{ + kdDebug(7034) << "gif KFileMetaInfo plugin\n"; + + KFileMimeTypeInfo* info = addMimeTypeInfo( "image/gif" ); + + KFileMimeTypeInfo::GroupInfo* group = 0L; + + group = addGroupInfo(info, "General", i18n("General")); + + KFileMimeTypeInfo::ItemInfo* item; + + item = addItemInfo(group, "Version", i18n("Version"), TQVariant::String); + + 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); + +} + +bool KGifPlugin::readInfo( KFileMetaInfo& info, uint what ) +{ + Q_UNUSED( what ); + + kdDebug(7034) << "gif KFileMetaInfo readInfo\n"; + + TQFile file(info.path()); + + if (!file.open(IO_ReadOnly)) { + kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()).data() << endl; + return false; + } + + TQDataStream fstream(&file); + + bool isGIF87a = false; + char magic[7]; + TQ_UINT16 width = 0; + TQ_UINT16 height = 0; + TQ_UINT8 miscInfo = 0; + + fstream.readRawBytes( magic, 6 ); + magic[6] = 0x00; // null terminate + + // I have special requirements... + fstream.setByteOrder( TQDataStream::LittleEndian ); + fstream >> width; + fstream >> height; + fstream >> miscInfo; + + KFileMetaInfoGroup group = appendGroup(info, "General"); + + if ( 0 == strncmp( magic, "GIF89a", 6 ) ) { + appendItem( group, "Version", i18n("GIF Version 89a") ); + } else if ( 0 == strncmp( magic, "GIF87a", 6 ) ) { + appendItem( group, "Version", i18n("GIF Version 87a") ); + isGIF87a = true; + } else { + appendItem( group, "Version", i18n("Unknown") ); + } + + appendItem( group, "Dimensions", TQSize(width, height) ); + + if ( isGIF87a ) { + appendItem( group, "BitDepth", ( (miscInfo & 0x07) + 1) ); + } + + file.close(); + + return true; +} + +#include "tdefile_gif.moc" diff --git a/tdefile-plugins/gif/tdefile_gif.desktop b/tdefile-plugins/gif/tdefile_gif.desktop new file mode 100644 index 00000000..d6e3bfb3 --- /dev/null +++ b/tdefile-plugins/gif/tdefile_gif.desktop @@ -0,0 +1,65 @@ +[Desktop Entry] +Type=Service +Name=GIF Info +Name[af]=Gif Inligting +Name[ar]=معلومات GIF +Name[br]=Titouroù GIF +Name[ca]=Informació de GIF +Name[cs]=GIF info +Name[cy]=Gwybodaeth GIF +Name[da]=GIF-info +Name[de]=GIF-Info +Name[el]=Πληροφορίες GIF +Name[eo]=GIF-informo +Name[es]=Info GIF +Name[et]=GIF info +Name[fa]=اطلاعات GIF +Name[fi]=GIF-tiedot +Name[fr]=Informations GIF +Name[ga]=Eolas faoi GIF +Name[gl]=Inf. Gif +Name[he]=מידע GIF +Name[hi]=GIF जानकारी +Name[hr]=GIF Informacije +Name[hu]=GIF-jellemzők +Name[is]=GIF upplýsingar +Name[it]=Informazioni GIF +Name[ja]=GIF 情報 +Name[kk]=GIF мәліметі +Name[km]=ព័ត៌មាន GIF +Name[lt]=GIF informacija +Name[ms]=Maklumat GIF +Name[nds]=GIF-Info +Name[ne]=GIF सूचना +Name[nl]=GIF-info +Name[nn]=GIF-info +Name[nso]=Tshedimoso ya GIF +Name[pa]=GIF ਜਾਣਕਾਰੀ +Name[pl]=Informacja o pliku GIF +Name[pt]=Informação do GIF +Name[pt_BR]=Informação sobre GIF +Name[ro]=Informaţii GIF +Name[ru]=Информация о GIF +Name[se]=GIF-dieđut +Name[sl]=Podatki o GIF +Name[sr]=GIF информације +Name[sr@Latn]=GIF informacije +Name[sv]=Gif-information +Name[ta]=GIF தகவல் +Name[tg]=Иттилоот оиди GIF +Name[th]=ข้อมูลแฟ้ม GIF +Name[tr]=GIF Bilgisi +Name[uk]=Інформація по GIF +Name[uz]=GIF haqida maʼlumot +Name[uz@cyrillic]=GIF ҳақида маълумот +Name[ven]=Mafhungo a GIF +Name[wa]=Informåcion sol imådje GIF +Name[xh]=Ulwazi lwe GIF +Name[zh_CN]=GIF 信息 +Name[zh_HK]=GIF 資訊 +Name[zh_TW]=GIF 資訊 +Name[zu]=Ulwazi lwe-GIF +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_gif +MimeType=image/gif +PreferredItems=Comment,Resolution diff --git a/tdefile-plugins/gif/tdefile_gif.h b/tdefile-plugins/gif/tdefile_gif.h new file mode 100644 index 00000000..37588e7a --- /dev/null +++ b/tdefile-plugins/gif/tdefile_gif.h @@ -0,0 +1,38 @@ +/* This file is part of the KDE project + * + * 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_GIF_H__ +#define __KFILE_GIF_H__ + +#include +#include + +class TQStringList; + +class KGifPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KGifPlugin( TQObject *parent, const char *name, const TQStringList& args ); + + virtual bool readInfo ( KFileMetaInfo& info, uint what ); +}; + +#endif diff --git a/tdefile-plugins/ico/CMakeLists.txt b/tdefile-plugins/ico/CMakeLists.txt new file mode 100644 index 00000000..54d87add --- /dev/null +++ b/tdefile-plugins/ico/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_ico.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +#### tdefile_ico (module) ######################## + +tde_add_kpart( tdefile_ico AUTOMOC + SOURCES tdefile_ico.cpp + LINK tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/ico/Makefile.am b/tdefile-plugins/ico/Makefile.am new file mode 100644 index 00000000..e95cf924 --- /dev/null +++ b/tdefile-plugins/ico/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for ico 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_ico.h + +kde_module_LTLIBRARIES = tdefile_ico.la + +tdefile_ico_la_SOURCES = tdefile_ico.cpp +tdefile_ico_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdefile_ico_la_LIBADD = $(LIB_KSYCOCA) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) tdefile_ico.cpp -o $(podir)/tdefile_ico.pot + +services_DATA = tdefile_ico.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/ico/tdefile_ico.cpp b/tdefile-plugins/ico/tdefile_ico.cpp new file mode 100644 index 00000000..273a5e18 --- /dev/null +++ b/tdefile-plugins/ico/tdefile_ico.cpp @@ -0,0 +1,148 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Shane Wright + * + * 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 +#include "tdefile_ico.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#if !defined(__osf__) +#include +#else +typedef unsigned long uint32_t; +typedef unsigned short uint16_t; +typedef unsigned char uint8_t; +#endif + +typedef KGenericFactory IcoFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_ico, IcoFactory( "tdefile_ico" )) + +KIcoPlugin::KIcoPlugin(TQObject *parent, const char *name, + const TQStringList &args) + + : KFilePlugin(parent, name, args) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( "image/x-ico" ); + + KFileMimeTypeInfo::GroupInfo* group = 0L; + + group = addGroupInfo(info, "Technical", i18n("Technical Details")); + + KFileMimeTypeInfo::ItemInfo* item; + + item = addItemInfo(group, "Number", i18n("Number of Icons"), TQVariant::Int); + + item = addItemInfo(group, "Dimensions", i18n("Dimensions"), TQVariant::Size); + item = addItemInfo(group, "Colors", i18n("Colors"), TQVariant::Int); + + item = addItemInfo(group, "DimensionsM", i18n("Dimensions (1st icon)"), TQVariant::Size); + item = addItemInfo(group, "ColorsM", i18n("Colors (1st icon)"), TQVariant::Int); +} + + +bool KIcoPlugin::readInfo( KFileMetaInfo& info, uint what) +{ + + + TQFile file(info.path()); + + if (!file.open(IO_ReadOnly)) + { + kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()).data() << endl; + return false; + } + + TQDataStream dstream(&file); + + // ICO files are little-endian + dstream.setByteOrder(TQDataStream::LittleEndian); + + + // read the beginning of the file and make sure it looks ok + uint16_t ico_reserved; + uint16_t ico_type; + uint16_t ico_count; + + dstream >> ico_reserved; + dstream >> ico_type; + dstream >> ico_count; + + if ((ico_reserved != 0) || (ico_type != 1) || (ico_count < 1)) + return false; + + + // now loop through each of the icon entries + uint8_t icoe_width; + uint8_t icoe_height; + uint8_t icoe_colorcount; + uint8_t icoe_reserved; + uint16_t icoe_planes; + uint16_t icoe_bitcount; + uint32_t icoe_bytesinres; + uint32_t icoe_imageoffset; + + // read the data on the 1st icon + dstream >> icoe_width; + dstream >> icoe_height; + dstream >> icoe_colorcount; + dstream >> icoe_reserved; + dstream >> icoe_planes; + dstream >> icoe_bitcount; + dstream >> icoe_bytesinres; + dstream >> icoe_imageoffset; + + + // output the useful bits + KFileMetaInfoGroup group = appendGroup(info, "Technical"); + appendItem(group, "Number", ico_count); + + if (ico_count == 1) { + appendItem(group, "Dimensions", TQSize(icoe_width, icoe_height)); + + if (icoe_colorcount > 0) + appendItem(group, "Colors", icoe_colorcount); + else if (icoe_bitcount > 0) + appendItem(group, "Colors", 2 ^ icoe_bitcount); + + } else { + + appendItem(group, "DimensionsM", TQSize(icoe_width, icoe_height)); + + if (icoe_colorcount > 0) + appendItem(group, "ColorsM", icoe_colorcount); + else if (icoe_bitcount > 0) + appendItem(group, "ColorsM", 2 ^ icoe_bitcount); + + } + + return true; +} + +#include "tdefile_ico.moc" diff --git a/tdefile-plugins/ico/tdefile_ico.desktop b/tdefile-plugins/ico/tdefile_ico.desktop new file mode 100644 index 00000000..66cadb95 --- /dev/null +++ b/tdefile-plugins/ico/tdefile_ico.desktop @@ -0,0 +1,65 @@ +[Desktop Entry] +Type=Service +Name=ICO Info +Name[af]=Ico Inligting +Name[ar]=معلومات ICO +Name[br]=Titouroù ICO +Name[ca]=Informació d'ICO +Name[cs]=ICO info +Name[cy]=Gwybodaeth ICO +Name[da]=ICO-info +Name[de]=ICO-Info +Name[el]=Πληροφορίες ICO +Name[eo]=ICO-informo +Name[es]=Info ICO +Name[et]=ICO info +Name[fa]=اطلاعات ICO +Name[fi]=ICO-tiedot +Name[fr]=Informations ICO +Name[gl]=Inf. ICO +Name[he]=מידע ICO +Name[hi]=ICO जानकारी +Name[hr]=ICO informacije +Name[hu]=ICO-jellemzők +Name[is]=ICO upplýsingar +Name[it]=Informazioni ICO +Name[ja]=ICO 情報 +Name[kk]=ICO мәліметі +Name[km]=ព័ត៌មាន ICO +Name[lt]=ICO informacija +Name[ms]= Maklumat ICO +Name[nds]=ICO-Info +Name[ne]=ICO सूचना +Name[nl]=ICO-info +Name[nn]=ICO-info +Name[nso]=Tshedimoso ya ICO +Name[pa]=ICO ਜਾਣਕਾਰੀ +Name[pl]=Informacja o pliku ICO +Name[pt]=Informação do ICO +Name[pt_BR]=Informação sobre ICO +Name[ro]=Informaţii ICO +Name[ru]=Информация об ICO +Name[se]=ICO-dieđut +Name[sl]=Podatki o ICO +Name[sr]=ICO информације +Name[sr@Latn]=ICO informacije +Name[sv]=Ico-information +Name[ta]=ICO தகவல் +Name[tg]=Иттилоот оиди ICO +Name[th]=ข้อมูลแฟ้ม ICO +Name[tr]=ICO Bilgisi +Name[uk]=Інформація по ICO +Name[uz]=ICO haqida maʼlumot +Name[uz@cyrillic]=ICO ҳақида маълумот +Name[ven]=Mafhungo a ICO +Name[wa]=Informåcion sol imådjete ICO +Name[xh]=Ulwazi lwe ICO +Name[zh_CN]=ICO 信息 +Name[zh_HK]=ICO 資訊 +Name[zh_TW]=ICO 資訊 +Name[zu]=Ulwazi lwe-ICO +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_ico +MimeType=image/x-ico +PreferredGroups=Technical +PreferredItems=Number,Resolution,Colors,ResolutionM,ColorsM diff --git a/tdefile-plugins/ico/tdefile_ico.h b/tdefile-plugins/ico/tdefile_ico.h new file mode 100644 index 00000000..faa9481e --- /dev/null +++ b/tdefile-plugins/ico/tdefile_ico.h @@ -0,0 +1,38 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Shane Wright + * + * 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_ICO_H__ +#define __KFILE_ICO_H__ + +#include + +class TQStringList; + +class KIcoPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KIcoPlugin( TQObject *parent, const char *name, const TQStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint what); +}; + +#endif diff --git a/tdefile-plugins/jpeg/CMakeLists.txt b/tdefile-plugins/jpeg/CMakeLists.txt new file mode 100644 index 00000000..3e99eba7 --- /dev/null +++ b/tdefile-plugins/jpeg/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_jpeg.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +#### tdefile_jpeg (module) ######################## + +tde_add_kpart( tdefile_jpeg AUTOMOC + SOURCES tdefile_jpeg.cpp exif.cpp tdefile_setcomment.cpp + LINK tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/jpeg/Makefile.am b/tdefile-plugins/jpeg/Makefile.am new file mode 100644 index 00000000..76e9e32d --- /dev/null +++ b/tdefile-plugins/jpeg/Makefile.am @@ -0,0 +1,24 @@ +## Makefile.am for jpeg file meta info plugin + +KDE_CXXFLAGS = $(USE_EXCEPTIONS) + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# these are the headers for your project +noinst_HEADERS = tdefile_jpeg.h exif.h + +kde_module_LTLIBRARIES = tdefile_jpeg.la + +tdefile_jpeg_la_SOURCES = tdefile_jpeg.cpp exif.cpp tdefile_setcomment.cpp +tdefile_jpeg_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdefile_jpeg_la_LIBADD = $(LIB_KIO) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: + $(XGETTEXT) *.cpp -o $(podir)/tdefile_jpeg.pot + +services_DATA = tdefile_jpeg.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/jpeg/README b/tdefile-plugins/jpeg/README new file mode 100644 index 00000000..6b714426 --- /dev/null +++ b/tdefile-plugins/jpeg/README @@ -0,0 +1,35 @@ +------------------------------------------------------------------------------- +Thanks to: +Matthias Wandel +jhead (http://www.sentex.net/~mwandel/jhead/) + +Groult Richard +showimg (http://ric.jalix.org/) + +Bryce Nesbitt for setcomment +based on wrjpgcom.c, Copyright (C) 1994-1997, Thomas G. Lane. + +Frank Pieczynski + +EXIF spec: +http://www.pima.net/standards/it10/PIMA15740/exif.htm +http://www.ba.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html + +------------------------------------------------------------------------------- +Bugs: + 0) Just showing the meta info can cause the file to be rewritten!!! + 1) utf-8 paths must be tested and supported. + 2) Display of EXIF comments need to be tested. + Both Unicode & ASCII need testing. + +New features needed: + 1) Should switch to a multi-line editor for comments. Support "\n". + 2) Should autodetect if the jpeg COM is in utf-8 format. + 3) Allow editing the EXIF "Orientation" flag (without rewriting the exif header). + 4) Extract and return the EXIF thumbnail, oriented properly, as an alternative + to the much slower process of generating a new thumbnail. + +Future features: + 1) Allow the user to erase or move comment in either the EXIF or jpeg COM. + 2) Play or return audio files associated with the exif. + diff --git a/tdefile-plugins/jpeg/exif.cpp b/tdefile-plugins/jpeg/exif.cpp new file mode 100644 index 00000000..60c689bd --- /dev/null +++ b/tdefile-plugins/jpeg/exif.cpp @@ -0,0 +1,961 @@ +//-------------------------------------------------------------------------- +// Program to pull the information out of various types of EFIF digital +// camera files and show it in a reasonably consistent way +// +// This module parses the very complicated exif structures. +// +// Matthias Wandel, Dec 1999 - August 2000 +//-------------------------------------------------------------------------- + + +#include "exif.h" +#include +#include + + +static unsigned char * LastExifRefd; +static int ExifSettingsLength; +static double FocalplaneXRes; +static double FocalplaneUnits; +static int MotorolaOrder = 0; +static int SectionsRead; +//static int HaveAll; + +//-------------------------------------------------------------------------- +// Table of Jpeg encoding process names + +#define M_SOF0 0xC0 // Start Of Frame N +#define M_SOF1 0xC1 // N indicates which compression process +#define M_SOF2 0xC2 // Only SOF0-SOF2 are now in common use +#define M_SOF3 0xC3 +#define M_SOF5 0xC5 // NB: codes C4 and CC are NOT SOF markers +#define M_SOF6 0xC6 +#define M_SOF7 0xC7 +#define M_SOF9 0xC9 +#define M_SOF10 0xCA +#define M_SOF11 0xCB +#define M_SOF13 0xCD +#define M_SOF14 0xCE +#define M_SOF15 0xCF +#define M_SOI 0xD8 // Start Of Image (beginning of datastream) +#define M_EOI 0xD9 // End Of Image (end of datastream) +#define M_SOS 0xDA // Start Of Scan (begins compressed data) +#define M_JFIF 0xE0 // Jfif marker +#define M_EXIF 0xE1 // Exif marker +#define M_COM 0xFE // COMment + + +TagTable_t ProcessTable[] = { + { M_SOF0, "Baseline"}, + { M_SOF1, "Extended sequential"}, + { M_SOF2, "Progressive"}, + { M_SOF3, "Lossless"}, + { M_SOF5, "Differential sequential"}, + { M_SOF6, "Differential progressive"}, + { M_SOF7, "Differential lossless"}, + { M_SOF9, "Extended sequential, arithmetic coding"}, + { M_SOF10, "Progressive, arithmetic coding"}, + { M_SOF11, "Lossless, arithmetic coding"}, + { M_SOF13, "Differential sequential, arithmetic coding"}, + { M_SOF14, "Differential progressive, arithmetic coding"}, + { M_SOF15, "Differential lossless, arithmetic coding"}, + { 0, "Unknown"} +}; + + + +//-------------------------------------------------------------------------- +// Describes format descriptor +static int BytesPerFormat[] = {0,1,1,2,4,8,1,1,2,4,8,4,8}; +#define NUM_FORMATS 12 + +#define FMT_BYTE 1 +#define FMT_STRING 2 +#define FMT_USHORT 3 +#define FMT_ULONG 4 +#define FMT_URATIONAL 5 +#define FMT_SBYTE 6 +#define FMT_UNDEFINED 7 +#define FMT_SSHORT 8 +#define FMT_SLONG 9 +#define FMT_SRATIONAL 10 +#define FMT_SINGLE 11 +#define FMT_DOUBLE 12 + +//-------------------------------------------------------------------------- +// Describes tag values + +#define TAG_EXIF_OFFSET 0x8769 +#define TAG_INTEROP_OFFSET 0xa005 + +#define TAG_MAKE 0x010F +#define TAG_MODEL 0x0110 +#define TAG_ORIENTATION 0x0112 + +#define TAG_EXPOSURETIME 0x829A +#define TAG_FNUMBER 0x829D + +#define TAG_SHUTTERSPEED 0x9201 +#define TAG_APERTURE 0x9202 +#define TAG_MAXAPERTURE 0x9205 +#define TAG_FOCALLENGTH 0x920A + +#define TAG_DATETIME_ORIGINAL 0x9003 +#define TAG_USERCOMMENT 0x9286 + +#define TAG_SUBJECT_DISTANCE 0x9206 +#define TAG_FLASH 0x9209 + +#define TAG_FOCALPLANEXRES 0xa20E +#define TAG_FOCALPLANEUNITS 0xa210 +#define TAG_EXIF_IMAGEWIDTH 0xA002 +#define TAG_EXIF_IMAGELENGTH 0xA003 + +// the following is added 05-jan-2001 vcs +#define TAG_EXPOSURE_BIAS 0x9204 +#define TAG_WHITEBALANCE 0x9208 +#define TAG_METERING_MODE 0x9207 +#define TAG_EXPOSURE_PROGRAM 0x8822 +#define TAG_ISO_EQUIVALENT 0x8827 +#define TAG_COMPRESSION_LEVEL 0x9102 + +#define TAG_THUMBNAIL_OFFSET 0x0201 +#define TAG_THUMBNAIL_LENGTH 0x0202 + + +/*static TagTable_t TagTable[] = { + { 0x100, "ImageWidth"}, + { 0x101, "ImageLength"}, + { 0x102, "BitsPerSample"}, + { 0x103, "Compression"}, + { 0x106, "PhotometricInterpretation"}, + { 0x10A, "FillOrder"}, + { 0x10D, "DocumentName"}, + { 0x10E, "ImageDescription"}, + { 0x10F, "Make"}, + { 0x110, "Model"}, + { 0x111, "StripOffsets"}, + { 0x112, "Orientation"}, + { 0x115, "SamplesPerPixel"}, + { 0x116, "RowsPerStrip"}, + { 0x117, "StripByteCounts"}, + { 0x11A, "XResolution"}, + { 0x11B, "YResolution"}, + { 0x11C, "PlanarConfiguration"}, + { 0x128, "ResolutionUnit"}, + { 0x12D, "TransferFunction"}, + { 0x131, "Software"}, + { 0x132, "DateTime"}, + { 0x13B, "Artist"}, + { 0x13E, "WhitePoint"}, + { 0x13F, "PrimaryChromaticities"}, + { 0x156, "TransferRange"}, + { 0x200, "JPEGProc"}, + { 0x201, "ThumbnailOffset"}, + { 0x202, "ThumbnailLength"}, + { 0x211, "YCbCrCoefficients"}, + { 0x212, "YCbCrSubSampling"}, + { 0x213, "YCbCrPositioning"}, + { 0x214, "ReferenceBlackWhite"}, + { 0x828D, "CFARepeatPatternDim"}, + { 0x828E, "CFAPattern"}, + { 0x828F, "BatteryLevel"}, + { 0x8298, "Copyright"}, + { 0x829A, "ExposureTime"}, + { 0x829D, "FNumber"}, + { 0x83BB, "IPTC/NAA"}, + { 0x8769, "ExifOffset"}, + { 0x8773, "InterColorProfile"}, + { 0x8822, "ExposureProgram"}, + { 0x8824, "SpectralSensitivity"}, + { 0x8825, "GPSInfo"}, + { 0x8827, "ISOSpeedRatings"}, + { 0x8828, "OECF"}, + { 0x9000, "ExifVersion"}, + { 0x9003, "DateTimeOriginal"}, + { 0x9004, "DateTimeDigitized"}, + { 0x9101, "ComponentsConfiguration"}, + { 0x9102, "CompressedBitsPerPixel"}, + { 0x9201, "ShutterSpeedValue"}, + { 0x9202, "ApertureValue"}, + { 0x9203, "BrightnessValue"}, + { 0x9204, "ExposureBiasValue"}, + { 0x9205, "MaxApertureValue"}, + { 0x9206, "SubjectDistance"}, + { 0x9207, "MeteringMode"}, + { 0x9208, "LightSource"}, + { 0x9209, "Flash"}, + { 0x920A, "FocalLength"}, + { 0x927C, "MakerNote"}, + { 0x9286, "UserComment"}, + { 0x9290, "SubSecTime"}, + { 0x9291, "SubSecTimeOriginal"}, + { 0x9292, "SubSecTimeDigitized"}, + { 0xA000, "FlashPixVersion"}, + { 0xA001, "ColorSpace"}, + { 0xA002, "ExifImageWidth"}, + { 0xA003, "ExifImageLength"}, + { 0xA005, "InteroperabilityOffset"}, + { 0xA20B, "FlashEnergy"}, // 0x920B in TIFF/EP + { 0xA20C, "SpatialFrequencyResponse"}, // 0x920C - - + { 0xA20E, "FocalPlaneXResolution"}, // 0x920E - - + { 0xA20F, "FocalPlaneYResolution"}, // 0x920F - - + { 0xA210, "FocalPlaneResolutionUnit"}, // 0x9210 - - + { 0xA214, "SubjectLocation"}, // 0x9214 - - + { 0xA215, "ExposureIndex"}, // 0x9215 - - + { 0xA217, "SensingMethod"}, // 0x9217 - - + { 0xA300, "FileSource"}, + { 0xA301, "SceneType"}, + { 0, NULL} +} ; +*/ + + +//-------------------------------------------------------------------------- +// Parse the marker stream until SOS or EOI is seen; +//-------------------------------------------------------------------------- +int ExifData::ReadJpegSections (TQFile & infile, ReadMode_t ReadMode) +{ + int a; + + a = infile.getch(); + + if (a != 0xff || infile.getch() != M_SOI) { + SectionsRead = 0; + return false; + } + for(SectionsRead = 0; SectionsRead < MAX_SECTIONS-1; ){ + int marker = 0; + int got; + unsigned int ll,lh; + unsigned int itemlen; + uchar * Data; + + for (a=0;a<7;a++){ + marker = infile.getch(); + if (marker != 0xff) break; + + if (a >= 6){ + + kdDebug(7034) << "too many padding bytes\n"; + return false; + + } + } + + if (marker == 0xff){ + // 0xff is legal padding, but if we get that many, something's wrong. + throw FatalError("too many padding bytes!"); + } + + Sections[SectionsRead].Type = marker; + + // Read the length of the section. + lh = (uchar) infile.getch(); + ll = (uchar) infile.getch(); + + itemlen = (lh << 8) | ll; + + if (itemlen < 2) { + throw FatalError("invalid marker"); + } + + Sections[SectionsRead].Size = itemlen; + + Data = (uchar *)malloc(itemlen+1); // Add 1 to allow sticking a 0 at the end. + Sections[SectionsRead].Data = Data; + + // Store first two pre-read bytes. + Data[0] = (uchar)lh; + Data[1] = (uchar)ll; + + got = infile.readBlock((char*)Data+2, itemlen-2); // Read the whole section. + if (( unsigned ) got != itemlen-2){ + throw FatalError("reading from file"); + } + SectionsRead++; + + switch(marker){ + + case M_SOS: // stop before hitting compressed data + // If reading entire image is requested, read the rest of the data. + if (ReadMode & READ_IMAGE){ + unsigned long size; + + size = kMax( 0ul, (unsigned long)(infile.size()-infile.at()) ); + Data = (uchar *)malloc(size); + if (Data == NULL){ + throw FatalError("could not allocate data for entire image"); + } + + got = infile.readBlock((char*)Data, size); + if (( unsigned ) got != size){ + throw FatalError("could not read the rest of the image"); + } + + Sections[SectionsRead].Data = Data; + Sections[SectionsRead].Size = size; + Sections[SectionsRead].Type = PSEUDO_IMAGE_MARKER; + SectionsRead ++; + //HaveAll = 1; + } + return true; + + case M_EOI: // in case it's a tables-only JPEG stream + kdDebug(7034) << "No image in jpeg!\n"; + return false; + + case M_COM: // Comment section + // pieczy 2002-02-12 + // now the User comment goes to UserComment + // so we can store a Comment section also in READ_EXIF mode + process_COM(Data, itemlen); + break; + + case M_JFIF: + // Regular jpegs always have this tag, exif images have the exif + // marker instead, althogh ACDsee will write images with both markers. + // this program will re-create this marker on absence of exif marker. + // hence no need to keep the copy from the file. + free(Sections[--SectionsRead].Data); + break; + + case M_EXIF: + // Seen files from some 'U-lead' software with Vivitar scanner + // that uses marker 31 for non exif stuff. Thus make sure + // it says 'Exif' in the section before treating it as exif. + if ((ReadMode & READ_EXIF) && memcmp(Data+2, "Exif", 4) == 0){ + process_EXIF((uchar *)Data, itemlen); // FIXME: This call + // requires Data to be array of at least 8 bytes. Code + // above only checks for itemlen < 2. + }else{ + // Discard this section. + free(Sections[--SectionsRead].Data); + } + break; + + case M_SOF0: + case M_SOF1: + case M_SOF2: + case M_SOF3: + case M_SOF5: + case M_SOF6: + case M_SOF7: + case M_SOF9: + case M_SOF10: + case M_SOF11: + case M_SOF13: + case M_SOF14: + case M_SOF15: + process_SOFn(Data, marker); //FIXME: This call requires Data to + // be array of at least 8 bytes. Code above only checks for + // itemlen < 2. + break; + default: + break; + } + } + return true; +} + + +//-------------------------------------------------------------------------- +// Discard read data. +//-------------------------------------------------------------------------- +void ExifData::DiscardData(void) +{ + for (int a=0; a < SectionsRead; a++) + free(Sections[a].Data); + SectionsRead = 0; +} + +//-------------------------------------------------------------------------- +// Convert a 16 bit unsigned value from file's native byte order +//-------------------------------------------------------------------------- +int ExifData::Get16u(void * Short) +{ + if (MotorolaOrder){ + return (((uchar *)Short)[0] << 8) | ((uchar *)Short)[1]; + }else{ + return (((uchar *)Short)[1] << 8) | ((uchar *)Short)[0]; + } +} + +//-------------------------------------------------------------------------- +// Convert a 32 bit signed value from file's native byte order +//-------------------------------------------------------------------------- +int ExifData::Get32s(void * Long) +{ + if (MotorolaOrder){ + return ((( char *)Long)[0] << 24) | (((uchar *)Long)[1] << 16) + | (((uchar *)Long)[2] << 8 ) | (((uchar *)Long)[3] << 0 ); + }else{ + return ((( char *)Long)[3] << 24) | (((uchar *)Long)[2] << 16) + | (((uchar *)Long)[1] << 8 ) | (((uchar *)Long)[0] << 0 ); + } +} + +//-------------------------------------------------------------------------- +// Convert a 32 bit unsigned value from file's native byte order +//-------------------------------------------------------------------------- +unsigned ExifData::Get32u(void * Long) +{ + return (unsigned)Get32s(Long) & 0xffffffff; +} + +//-------------------------------------------------------------------------- +// Evaluate number, be it int, rational, or float from directory. +//-------------------------------------------------------------------------- +double ExifData::ConvertAnyFormat(void * ValuePtr, int Format) +{ + double Value; + Value = 0; + + switch(Format){ + case FMT_SBYTE: Value = *(signed char *)ValuePtr; break; + case FMT_BYTE: Value = *(uchar *)ValuePtr; break; + + case FMT_USHORT: Value = Get16u(ValuePtr); break; + + case FMT_ULONG: Value = Get32u(ValuePtr); break; + + case FMT_URATIONAL: + case FMT_SRATIONAL: + { + int Num,Den; + Num = Get32s(ValuePtr); + Den = Get32s(4+(char *)ValuePtr); + if (Den == 0){ + Value = 0; + }else{ + Value = (double)Num/Den; + } + break; + } + + case FMT_SSHORT: Value = (signed short)Get16u(ValuePtr); break; + case FMT_SLONG: Value = Get32s(ValuePtr); break; + + // Not sure if this is correct (never seen float used in Exif format) + case FMT_SINGLE: Value = (double)*(float *)ValuePtr; break; + case FMT_DOUBLE: Value = *(double *)ValuePtr; break; + } + return Value; +} + +//-------------------------------------------------------------------------- +// Process one of the nested EXIF directories. +//-------------------------------------------------------------------------- +void ExifData::ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBase, unsigned ExifLength, unsigned NestingLevel) +{ + int de; + int a; + int NumDirEntries; + unsigned ThumbnailOffset = 0; + unsigned ThumbnailSize = 0; + + if ( NestingLevel > 4) + throw FatalError("Maximum directory nesting exceeded (corrupt exif header)"); + + NumDirEntries = Get16u(DirStart); + #define DIR_ENTRY_ADDR(Start, Entry) (Start+2+12*(Entry)) + + { + unsigned char * DirEnd; + DirEnd = DIR_ENTRY_ADDR(DirStart, NumDirEntries); + if (DirEnd+4 > (OffsetBase+ExifLength)){ + if (DirEnd+2 == OffsetBase+ExifLength || DirEnd == OffsetBase+ExifLength){ + // Version 1.3 of jhead would truncate a bit too much. + // This also caught later on as well. + }else{ + // Note: Files that had thumbnails trimmed with jhead 1.3 or earlier + // might trigger this. + throw FatalError("Illegally sized directory"); + } + } + if (DirEnd < LastExifRefd) LastExifRefd = DirEnd; + } + + for (de=0;de= NUM_FORMATS) { + // (-1) catches illegal zero case as unsigned underflows to positive large. + throw FatalError("Illegal format code in EXIF dir"); + } + + if ((unsigned)Components > 0x10000) { + throw FatalError("Illegal number of components for tag"); + continue; + } + + ByteCount = Components * BytesPerFormat[Format]; + + if (ByteCount > 4){ + unsigned OffsetVal; + OffsetVal = Get32u(DirEntry+8); + // If its bigger than 4 bytes, the dir entry contains an offset. + if (OffsetVal+ByteCount > ExifLength){ + // Bogus pointer offset and / or bytecount value + //printf("Offset %d bytes %d ExifLen %d\n",OffsetVal, ByteCount, ExifLength); + + throw FatalError("Illegal pointer offset value in EXIF"); + } + ValuePtr = OffsetBase+OffsetVal; + }else{ + // 4 bytes or less and value is in the dir entry itself + ValuePtr = (unsigned char *)DirEntry+8; + } + + if (LastExifRefd < ValuePtr+ByteCount){ + // Keep track of last byte in the exif header that was actually referenced. + // That way, we know where the discardable thumbnail data begins. + LastExifRefd = ValuePtr+ByteCount; + } + + // Extract useful components of tag + switch(Tag){ + + case TAG_MAKE: + ExifData::CameraMake = TQString::fromLatin1((const char*)ValuePtr, 31); + break; + + case TAG_MODEL: + ExifData::CameraModel = TQString::fromLatin1((const char*)ValuePtr, 39); + break; + + case TAG_ORIENTATION: + Orientation = (int)ConvertAnyFormat(ValuePtr, Format); + break; + + case TAG_DATETIME_ORIGINAL: + DateTime = TQString::fromLatin1((const char*)ValuePtr, 19); + break; + + case TAG_USERCOMMENT: + // Olympus has this padded with trailing spaces. Remove these first. + for (a=ByteCount;;){ + a--; + if ((ValuePtr)[a] == ' '){ + (ValuePtr)[a] = '\0'; + }else{ + break; + } + if (a == 0) break; + } + + // Copy the comment + if (memcmp(ValuePtr, "ASCII",5) == 0){ + for (a=5;a<10;a++){ + int c; + c = (ValuePtr)[a]; + if (c != '\0' && c != ' '){ + UserComment = TQString::fromLatin1((const char*)(a+ValuePtr), 199); + break; + } + } + }else{ + UserComment = TQString::fromLatin1((const char*)ValuePtr, 199); + } + break; + + case TAG_FNUMBER: + // Simplest way of expressing aperture, so I trust it the most. + // (overwrite previously computd value if there is one) + ExifData::ApertureFNumber = (float)ConvertAnyFormat(ValuePtr, Format); + break; + + case TAG_APERTURE: + case TAG_MAXAPERTURE: + // More relevant info always comes earlier, so only use this field if we don't + // have appropriate aperture information yet. + if (ExifData::ApertureFNumber == 0){ + ExifData::ApertureFNumber + = (float)exp(ConvertAnyFormat(ValuePtr, Format)*log(2.0)*0.5); + } + break; + + case TAG_FOCALLENGTH: + // Nice digital cameras actually save the focal length as a function + // of how far they are zoomed in. + ExifData::FocalLength = (float)ConvertAnyFormat(ValuePtr, Format); + break; + + case TAG_SUBJECT_DISTANCE: + // Inidcates the distacne the autofocus camera is focused to. + // Tends to be less accurate as distance increases. + ExifData::Distance = (float)ConvertAnyFormat(ValuePtr, Format); + break; + + case TAG_EXPOSURETIME: + // Simplest way of expressing exposure time, so I trust it most. + // (overwrite previously computd value if there is one) + ExifData::ExposureTime = (float)ConvertAnyFormat(ValuePtr, Format); + break; + + case TAG_SHUTTERSPEED: + // More complicated way of expressing exposure time, so only use + // this value if we don't already have it from somewhere else. + if (ExifData::ExposureTime == 0){ + ExifData::ExposureTime + = (float)(1/exp(ConvertAnyFormat(ValuePtr, Format)*log(2.0))); + } + break; + + case TAG_FLASH: + ExifData::FlashUsed = (int)ConvertAnyFormat(ValuePtr, Format); + break; + + case TAG_EXIF_IMAGELENGTH: + ExifImageLength = (int)ConvertAnyFormat(ValuePtr, Format); + break; + + case TAG_EXIF_IMAGEWIDTH: + ExifImageWidth = (int)ConvertAnyFormat(ValuePtr, Format); + break; + + case TAG_FOCALPLANEXRES: + FocalplaneXRes = ConvertAnyFormat(ValuePtr, Format); + break; + + case TAG_FOCALPLANEUNITS: + switch((int)ConvertAnyFormat(ValuePtr, Format)){ + case 1: FocalplaneUnits = 25.4; break; // inch + case 2: + // According to the information I was using, 2 means meters. + // But looking at the Cannon powershot's files, inches is the only + // sensible value. + FocalplaneUnits = 25.4; + break; + + case 3: FocalplaneUnits = 10; break; // centimeter + case 4: FocalplaneUnits = 1; break; // milimeter + case 5: FocalplaneUnits = .001; break; // micrometer + } + break; + + // Remaining cases contributed by: Volker C. Schoech (schoech@gmx.de) + + case TAG_EXPOSURE_BIAS: + ExifData::ExposureBias = (float)ConvertAnyFormat(ValuePtr, Format); + break; + + case TAG_WHITEBALANCE: + ExifData::Whitebalance = (int)ConvertAnyFormat(ValuePtr, Format); + break; + + case TAG_METERING_MODE: + ExifData::MeteringMode = (int)ConvertAnyFormat(ValuePtr, Format); + break; + + case TAG_EXPOSURE_PROGRAM: + ExifData::ExposureProgram = (int)ConvertAnyFormat(ValuePtr, Format); + break; + + case TAG_ISO_EQUIVALENT: + ExifData::ISOequivalent = (int)ConvertAnyFormat(ValuePtr, Format); + if ( ExifData::ISOequivalent < 50 ) ExifData::ISOequivalent *= 200; + break; + + case TAG_COMPRESSION_LEVEL: + ExifData::CompressionLevel = (int)ConvertAnyFormat(ValuePtr, Format); + break; + + case TAG_THUMBNAIL_OFFSET: + ThumbnailOffset = (unsigned)ConvertAnyFormat(ValuePtr, Format); + break; + + case TAG_THUMBNAIL_LENGTH: + ThumbnailSize = (unsigned)ConvertAnyFormat(ValuePtr, Format); + break; + + } + + if (Tag == TAG_EXIF_OFFSET || Tag == TAG_INTEROP_OFFSET){ + unsigned char * SubdirStart; + SubdirStart = OffsetBase + Get32u(ValuePtr); + if (SubdirStart <= OffsetBase || SubdirStart >= OffsetBase+ExifLength){ + throw FatalError("Illegal subdirectory link"); + } + ProcessExifDir(SubdirStart, OffsetBase, ExifLength, NestingLevel+1); + continue; + } + } + + { + // In addition to linking to subdirectories via exif tags, + // there's also a potential link to another directory at the end of each + // directory. this has got to be the result of a comitee! + unsigned char * SubdirStart; + unsigned Offset; + + if (DIR_ENTRY_ADDR(DirStart, NumDirEntries) + 4 <= OffsetBase+ExifLength){ + Offset = Get32u(DIR_ENTRY_ADDR(DirStart, NumDirEntries)); + // There is at least one jpeg from an HP camera having an Offset of almost MAXUINT. + // Adding OffsetBase to it produces an overflow, so compare with ExifLength here. + // See http://bugs.kde.org/show_bug.cgi?id=54542 + if (Offset && Offset < ExifLength){ + SubdirStart = OffsetBase + Offset; + if (SubdirStart > OffsetBase+ExifLength){ + if (SubdirStart < OffsetBase+ExifLength+20){ + // Jhead 1.3 or earlier would crop the whole directory! + // As Jhead produces this form of format incorrectness, + // I'll just let it pass silently + kdDebug(7034) << "Thumbnail removed with Jhead 1.3 or earlier\n"; + }else{ + throw FatalError("Illegal subdirectory link 2"); + } + }else{ + if (SubdirStart <= OffsetBase+ExifLength){ + ProcessExifDir(SubdirStart, OffsetBase, ExifLength, NestingLevel+1); + } + } + } + }else{ + // The exif header ends before the last next directory pointer. + } + } + + if (ThumbnailSize && ThumbnailOffset){ + if (ThumbnailSize + ThumbnailOffset < ExifLength){ + // The thumbnail pointer appears to be valid. Store it. + Thumbnail.loadFromData(OffsetBase + ThumbnailOffset, ThumbnailSize, "JPEG"); + } + } +} + +//-------------------------------------------------------------------------- +// Process a COM marker. We want to leave the bytes unchanged. The +// progam that displays this text may decide to remove blanks, convert +// newlines, or otherwise modify the text. In particular we want to be +// safe for passing utf-8 text. +//-------------------------------------------------------------------------- +void ExifData::process_COM (const uchar * Data, int length) +{ + Comment = TQString::fromUtf8((char *)Data+2, (length-2)); +} + + +//-------------------------------------------------------------------------- +// Process a SOFn marker. This is useful for the image dimensions +//-------------------------------------------------------------------------- +void ExifData::process_SOFn (const uchar * Data, int marker) +{ + int data_precision, num_components; + + data_precision = Data[2]; + ExifData::Height = Get16m(Data+3); + ExifData::Width = Get16m(Data+5); + num_components = Data[7]; + + if (num_components == 3){ + ExifData::IsColor = 1; + }else{ + ExifData::IsColor = 0; + } + + ExifData::Process = marker; + +} + +//-------------------------------------------------------------------------- +// Get 16 bits motorola order (always) for jpeg header stuff. +//-------------------------------------------------------------------------- +int ExifData::Get16m(const void * Short) +{ + return (((uchar *)Short)[0] << 8) | ((uchar *)Short)[1]; +} + + +//-------------------------------------------------------------------------- +// Process a EXIF marker +// Describes all the drivel that most digital cameras include... +//-------------------------------------------------------------------------- +void ExifData::process_EXIF(unsigned char * CharBuf, unsigned int length) +{ + ExifData::FlashUsed = 0; // If it s from a digicam, and it used flash, it says so. + + FocalplaneXRes = 0; + FocalplaneUnits = 0; + ExifImageWidth = 0; + ExifImageLength = 0; + + { // Check the EXIF header component + static const uchar ExifHeader[] = "Exif\0\0"; + if (memcmp(CharBuf+2, ExifHeader,6)){ + throw FatalError("Incorrect Exif header"); + } + } + + if (memcmp(CharBuf+8,"II",2) == 0){ + // printf("Exif section in Intel order\n"); + MotorolaOrder = 0; + }else{ + if (memcmp(CharBuf+8,"MM",2) == 0){ + // printf("Exif section in Motorola order\n"); + MotorolaOrder = 1; + }else{ + throw FatalError("Invalid Exif alignment marker."); + } + } + + // Check the next two values for correctness. + if (Get16u(CharBuf+10) != 0x2a){ + throw FatalError("Invalid Exif start (1)"); + } + + long IFDoffset = Get32u(CharBuf+12); + + LastExifRefd = CharBuf; + + // First directory starts 16 bytes in. Offsets start at 8 bytes in. + ProcessExifDir(&CharBuf[8+IFDoffset], CharBuf+8, length-6, 0); + + // This is how far the interesting (non thumbnail) part of the exif went. + ExifSettingsLength = LastExifRefd - CharBuf; + + // Compute the CCD width, in milimeters. + if (FocalplaneXRes != 0){ + kdDebug(7034) << "ExifImageWidth " << ExifImageWidth << " FocalplaneUnits " << FocalplaneUnits << " FocalplaneXRes " << FocalplaneXRes << endl; + ExifData::CCDWidth = (float)(ExifImageWidth * FocalplaneUnits / FocalplaneXRes); + } +} + +//-------------------------------------------------------------------------- +// Convert exif time to Unix time structure +//-------------------------------------------------------------------------- +int ExifData::Exif2tm(struct tm * timeptr, char * ExifTime) +{ + int a; + + timeptr->tm_wday = -1; + + // Check for format: YYYY:MM:DD HH:MM:SS format. + a = sscanf(ExifTime, "%d:%d:%d %d:%d:%d", + &timeptr->tm_year, &timeptr->tm_mon, &timeptr->tm_mday, + &timeptr->tm_hour, &timeptr->tm_min, &timeptr->tm_sec); + + if (a == 6){ + timeptr->tm_isdst = -1; + timeptr->tm_mon -= 1; // Adjust for unix zero-based months + timeptr->tm_year -= 1900; // Adjust for year starting at 1900 + return true; // worked. + } + + return false; // Wasn't in Exif date format. +} + +//-------------------------------------------------------------------------- +// Contructor for initialising +//-------------------------------------------------------------------------- +ExifData::ExifData() +{ + ExifData::Whitebalance = -1; + ExifData::MeteringMode = -1; + ExifData::FlashUsed = 0; + Orientation = 0; + Height = 0; + Width = 0; + IsColor = 0; + Process = 0; + FocalLength = 0; + ExposureTime = 0; + ApertureFNumber = 0; + Distance = 0; + CCDWidth = 0; + ExposureBias = 0; + ExposureProgram = 0; + ISOequivalent = 0; + CompressionLevel = 0; +} + +//-------------------------------------------------------------------------- +// process a EXIF jpeg file +//-------------------------------------------------------------------------- +bool ExifData::scan(const TQString & path) +{ + int ret; + + TQFile f(path); + if ( !f.open(IO_ReadOnly) ) + return false; + + try { + // Scan the JPEG headers. + ret = ReadJpegSections(f, READ_EXIF); + } + catch (FatalError& e) { + e.debug_print(); + f.close(); + return false; + } + + if (ret == false){ + kdDebug(7034) << "Not JPEG file!\n"; + DiscardData(); + f.close(); + return false; + } + f.close(); + DiscardData(); + + //now make the strings clean, + // for exmaple my Casio is a "QV-4000 " + CameraMake = CameraMake.stripWhiteSpace(); + CameraModel = CameraModel.stripWhiteSpace(); + UserComment = UserComment.stripWhiteSpace(); + Comment = Comment.stripWhiteSpace(); + return true; +} + +//-------------------------------------------------------------------------- +// Does the embedded thumbnail match the jpeg image? +//-------------------------------------------------------------------------- +#ifndef JPEG_TOL +#define JPEG_TOL 0.02 +#endif +bool ExifData::isThumbnailSane() { + if (Thumbnail.isNull()) return false; + + // check whether thumbnail dimensions match the image + // not foolproof, but catches some altered images (jpegtran -rotate) + if (ExifImageLength != 0 && ExifImageLength != Height) return false; + if (ExifImageWidth != 0 && ExifImageWidth != Width) return false; + if (Thumbnail.width() == 0 || Thumbnail.height() == 0) return false; + if (Height == 0 || Width == 0) return false; + double d = (double)Height/Width*Thumbnail.width()/Thumbnail.height(); + return (1-JPEG_TOL < d) && (d < 1+JPEG_TOL); +} + + +//-------------------------------------------------------------------------- +// return a thumbnail that respects the orientation flag +// only if it seems sane +//-------------------------------------------------------------------------- +TQImage ExifData::getThumbnail() { + if (!isThumbnailSane()) return NULL; + if (!Orientation || Orientation == 1) return Thumbnail; + + // now fix orientation + TQWMatrix M; + TQWMatrix flip= TQWMatrix(-1,0,0,1,0,0); + switch (Orientation) { // notice intentional fallthroughs + case 2: M = flip; break; + case 4: M = flip; + case 3: M.rotate(180); break; + case 5: M = flip; + case 6: M.rotate(90); break; + case 7: M = flip; + case 8: M.rotate(270); break; + default: break; // should never happen + } + return Thumbnail.xForm(M); +} diff --git a/tdefile-plugins/jpeg/exif.h b/tdefile-plugins/jpeg/exif.h new file mode 100644 index 00000000..f8eb13ef --- /dev/null +++ b/tdefile-plugins/jpeg/exif.h @@ -0,0 +1,127 @@ +#ifndef __EXIF_H__ +#define __EXIF_H__ + +/** + exif.h +*/ + +#include +#include +#include +#include + +#include "tqstring.h" +#include "tqfile.h" +#include "tqimage.h" +#include + +typedef enum { + READ_EXIF = 1, + READ_IMAGE = 2, + READ_ALL = 3 +}ReadMode_t; + +//-------------------------------------------------------------------------- +// This structure is used to store jpeg file sections in memory. +typedef struct { + uchar * Data; + int Type; + unsigned Size; +}Section_t; + +typedef unsigned char uchar; + +typedef struct { + unsigned short Tag; + const char*const Desc; +}TagTable_t; + +#define MAX_SECTIONS 20 +#define PSEUDO_IMAGE_MARKER 0x123; // Extra value. + +class ExifData { + Section_t Sections[MAX_SECTIONS]; + + TQString CameraMake; + TQString CameraModel; + TQString DateTime; + int Orientation; + int Height, Width; + int ExifImageLength, ExifImageWidth; + int IsColor; + int Process; + int FlashUsed; + float FocalLength; + float ExposureTime; + float ApertureFNumber; + float Distance; + int Whitebalance; + int MeteringMode; + float CCDWidth; + float ExposureBias; + int ExposureProgram; + int ISOequivalent; + int CompressionLevel; + TQString UserComment; + TQString Comment; + TQImage Thumbnail; + + int ReadJpegSections (TQFile & infile, ReadMode_t ReadMode); + void DiscardData(void); + int Get16u(void * Short); + int Get32s(void * Long); + unsigned Get32u(void * Long); + double ConvertAnyFormat(void * ValuePtr, int Format); + void ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBase, unsigned ExifLength, + unsigned NestingLevel); + void process_COM (const uchar * Data, int length); + void process_SOFn (const uchar * Data, int marker); + int Get16m(const void * Short); + void process_EXIF(unsigned char * CharBuf, unsigned int length); + int Exif2tm(struct tm * timeptr, char * ExifTime); + +public: + ExifData(); + bool scan(const TQString &); + TQString getCameraMake() { return CameraMake; } + TQString getCameraModel() { return CameraModel; } + TQString getDateTime() { return DateTime; } + int getOrientation() { return Orientation; } + int getHeight() { return Height; } + int getWidth() { return Width; } + int getIsColor() { return IsColor; } + int getProcess() { return Process; } + int getFlashUsed() { return FlashUsed; } + float getFocalLength() { return FocalLength; } + float getExposureTime() { return ExposureTime; } + float getApertureFNumber() { return ApertureFNumber; } + float getDistance() { return Distance; } + int getWhitebalance() { return Whitebalance; } + int getMeteringMode() { return MeteringMode; } + float getCCDWidth() { return CCDWidth; } + float getExposureBias() { return ExposureBias; } + int getExposureProgram() { return ExposureProgram; } + int getISOequivalent() { return ISOequivalent; } + int getCompressionLevel() { return CompressionLevel; } + TQString getUserComment() { return UserComment; } + TQString getComment() { return Comment; } + TQImage getThumbnail(); + bool isThumbnailSane(); + bool isNullThumbnail() { return !isThumbnailSane(); } +}; + +class FatalError { + const char* ex; +public: + FatalError(const char* s) { ex = s; } + void debug_print() const { kdDebug(7034) << "exception: " << ex << endl; } +}; + +extern TagTable_t ProcessTable[]; + +//-------------------------------------------------------------------------- +// Define comment writing code, impelemented in setcomment.c +extern int safe_copy_and_modify( const char * original_filename, const char * comment ); + +#endif + diff --git a/tdefile-plugins/jpeg/tdefile_jpeg.cpp b/tdefile-plugins/jpeg/tdefile_jpeg.cpp new file mode 100644 index 00000000..c902b99b --- /dev/null +++ b/tdefile-plugins/jpeg/tdefile_jpeg.cpp @@ -0,0 +1,531 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Frank Pieczynski , + * 2002 Carsten Pfeiffer + * based on the jhead tool of Matthias Wandel (see below) + * + * 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 +#include "tdefile_jpeg.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "exif.h" + +#define EXIFGROUP "Jpeg EXIF Data" + +typedef KGenericFactory JpegFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_jpeg, JpegFactory("tdefile_jpeg")) + +KJpegPlugin::KJpegPlugin(TQObject *parent, const char *name, + const TQStringList &args ) + : KFilePlugin(parent, name, args) +{ + kdDebug(7034) << "jpeg plugin\n"; + + // + // define all possible meta info items + // + KFileMimeTypeInfo *info = addMimeTypeInfo("image/jpeg"); + KFileMimeTypeInfo::GroupInfo *exifGroup = addGroupInfo( info, EXIFGROUP, + i18n("JPEG Exif") ); + KFileMimeTypeInfo::ItemInfo* item; + + item = addItemInfo( exifGroup, "Comment", i18n("Comment"), TQVariant::String); + setAttributes( item, + KFileMimeTypeInfo::Modifiable | + KFileMimeTypeInfo::Addable | + KFileMimeTypeInfo::MultiLine ); + + item = addItemInfo( exifGroup, "Manufacturer", i18n("Camera Manufacturer"), + TQVariant::String ); + + item = addItemInfo( exifGroup, "Model", i18n("Camera Model"), + TQVariant::String ); + + item = addItemInfo( exifGroup, "Date/time", i18n("Date/Time"), + TQVariant::DateTime ); + + item = addItemInfo( exifGroup, "CreationDate", i18n("Creation Date"), + TQVariant::Date ); + + item = addItemInfo( exifGroup, "CreationTime", i18n("Creation Time"), + TQVariant::Time ); + + item = addItemInfo( exifGroup, "Dimensions", i18n("Dimensions"), + TQVariant::Size ); + setHint( item, KFileMimeTypeInfo::Size ); + setUnit( item, KFileMimeTypeInfo::Pixels ); + + item = addItemInfo( exifGroup, "Orientation", i18n("Orientation"), + TQVariant::Int ); + + item = addItemInfo( exifGroup, "ColorMode", i18n("Color Mode"), + TQVariant::String ); + + item = addItemInfo( exifGroup, "Flash used", i18n("Flash Used"), + TQVariant::String ); + item = addItemInfo( exifGroup, "Focal length", i18n("Focal Length"), + TQVariant::String ); + setUnit( item, KFileMimeTypeInfo::Millimeters ); + + item = addItemInfo( exifGroup, "35mm equivalent", i18n("35mm Equivalent"), + TQVariant::Int ); + setUnit( item, KFileMimeTypeInfo::Millimeters ); + + item = addItemInfo( exifGroup, "CCD width", i18n("CCD Width"), + TQVariant::String ); + setUnit( item, KFileMimeTypeInfo::Millimeters ); + + item = addItemInfo( exifGroup, "Exposure time", i18n("Exposure Time"), + TQVariant::String ); + setHint( item, KFileMimeTypeInfo::Seconds ); + + item = addItemInfo( exifGroup, "Aperture", i18n("Aperture"), + TQVariant::String ); + + item = addItemInfo( exifGroup, "Focus dist.", i18n("Focus Dist."), + TQVariant::String ); + + item = addItemInfo( exifGroup, "Exposure bias", i18n("Exposure Bias"), + TQVariant::String ); + + item = addItemInfo( exifGroup, "Whitebalance", i18n("Whitebalance"), + TQVariant::String ); + + item = addItemInfo( exifGroup, "Metering mode", i18n("Metering Mode"), + TQVariant::String ); + + item = addItemInfo( exifGroup, "Exposure", i18n("Exposure"), + TQVariant::String ); + + item = addItemInfo( exifGroup, "ISO equiv.", i18n("ISO Equiv."), + TQVariant::String ); + + item = addItemInfo( exifGroup, "JPEG quality", i18n("JPEG Quality"), + TQVariant::String ); + + item = addItemInfo( exifGroup, "User comment", i18n("User Comment"), + TQVariant::String ); + setHint(item, KFileMimeTypeInfo::Description); + + item = addItemInfo( exifGroup, "JPEG process", i18n("JPEG Process"), + TQVariant::String ); + + item = addItemInfo( exifGroup, "Thumbnail", i18n("Thumbnail"), + TQVariant::Image ); + setHint( item, KFileMimeTypeInfo::Thumbnail ); + +// ### +// exifGroup.setSupportsVariableKeys(true); +} + +TQValidator* KJpegPlugin::createValidator(const KFileMetaInfoItem& /*item*/, + TQObject */*parent*/, + const char */*name*/ ) const +{ + // no need to return a validator that validates everything as OK :) +// if (item.isEditable()) +// return new TQRegExpValidator(TQRegExp(".*"), parent, name); +// else + return 0L; +} + +bool KJpegPlugin::writeInfo( const KFileMetaInfo& info ) const +{ + TQString comment = info[EXIFGROUP].value("Comment").toString(); + TQString path = info.path(); + + kdDebug(7034) << "exif writeInfo: " << info.path() << " \"" << comment << "\"\n"; + + /* + Do a strictly safe insertion of the comment: + + Scan original to verify it's a proper jpeg + Open a unique temporary file in this directory + Write temporary, replacing all COM blocks with this one. + Scan temporary, to verify it's a proper jpeg + Rename original to another unique name + Rename temporary to original + Unlink original + */ + /* + The jpeg standard does not regulate the contents of the COM block. + I'm assuming the best thing to do here is write as unicode utf-8, + which is fully backwards compatible with readers expecting ascii. + Readers expecting a national character set are out of luck... + */ + if( safe_copy_and_modify( TQFile::encodeName( path ), comment.utf8() ) ) { + return false; + } + return true; +} + +bool KJpegPlugin::readInfo( KFileMetaInfo& info, uint what ) +{ + const TQString path( info.path() ); + if ( path.isEmpty() ) // remote file + return false; + + TQString tag; + ExifData ImageInfo; + + // parse the jpeg file now + try { + if ( !ImageInfo.scan(info.path()) ) { + kdDebug(7034) << "Not a JPEG file!\n"; + return false; + } + } + catch (FatalError& e) { // malformed exif data? + kdDebug(7034) << "Exception caught while parsing Exif data of: " << info.path() << endl; + e.debug_print(); + return false; + } + + KFileMetaInfoGroup exifGroup = appendGroup( info, EXIFGROUP ); + + tag = ImageInfo.getComment(); + if ( tag.length() ) { + kdDebug(7034) << "exif inserting Comment: " << tag << "\n"; + appendItem( exifGroup, "Comment", tag ); + } else { + appendItem( exifGroup, "Comment", tag ); // So user can add new comment + } + + tag = ImageInfo.getCameraMake(); + if (tag.length()) + appendItem( exifGroup, "Manufacturer", tag ); + + tag = ImageInfo.getCameraModel(); + if (tag.length()) + appendItem( exifGroup, "Model", tag ); + + tag = ImageInfo.getDateTime(); + if (tag.length()){ + TQDateTime dt = parseDateTime( tag.stripWhiteSpace() ); + if ( dt.isValid() ) { + appendItem( exifGroup, "Date/time", dt ); + appendItem( exifGroup, "CreationDate", dt.date() ); + appendItem( exifGroup, "CreationTime", dt.time() ); + } + } + + appendItem( exifGroup,"Dimensions", TQSize( ImageInfo.getWidth(), + ImageInfo.getHeight() ) ); + + if ( ImageInfo.getOrientation() ) + appendItem( exifGroup, "Orientation", ImageInfo.getOrientation() ); + + appendItem( exifGroup, "ColorMode", ImageInfo.getIsColor() ? + i18n("Color") : i18n("Black and white") ); + + int flashUsed = ImageInfo.getFlashUsed(); // -1, + if ( flashUsed >= 0 ) { + TQString flash = i18n("Flash", "(unknown)"); + switch ( flashUsed ) { + case 0: flash = i18n("Flash", "No"); + break; + case 1: + case 5: + case 7: + flash = i18n("Flash", "Fired"); + break; + case 9: + case 13: + case 15: + flash = i18n( "Flash", "Fill Fired" ); + break; + case 16: + flash = i18n( "Flash", "Off" ); + break; + case 24: + flash = i18n( "Flash", "Auto Off" ); + break; + case 25: + case 29: + case 31: + flash = i18n( "Flash", "Auto Fired" ); + break; + case 32: + flash = i18n( "Flash", "Not Available" ); + break; + default: + break; + } + appendItem( exifGroup, "Flash used", + flash ); + } + + if (ImageInfo.getFocalLength()){ + appendItem( exifGroup, "Focal length", + TQString(TQString().sprintf("%4.1f", ImageInfo.getFocalLength()) )); + + if (ImageInfo.getCCDWidth()){ + appendItem( exifGroup, "35mm equivalent", + (int)(ImageInfo.getFocalLength()/ImageInfo.getCCDWidth()*35 + 0.5) ); + } + } + + if (ImageInfo.getCCDWidth()){ + appendItem( exifGroup, "CCD width", + TQString(TQString().sprintf("%4.2f", ImageInfo.getCCDWidth()) )); + } + + if (ImageInfo.getExposureTime()){ + tag=TQString().sprintf("%6.3f", ImageInfo.getExposureTime()); + float exposureTime = ImageInfo.getExposureTime(); + if (exposureTime > 0 && exposureTime <= 0.5){ + tag+=TQString().sprintf(" (1/%d)", (int)(0.5 + 1/exposureTime) ); + } + appendItem( exifGroup, "Exposure time", tag ); + } + + if (ImageInfo.getApertureFNumber()){ + appendItem( exifGroup, "Aperture", + TQString(TQString().sprintf("f/%3.1f", + (double)ImageInfo.getApertureFNumber()))); + } + + if (ImageInfo.getDistance()){ + if (ImageInfo.getDistance() < 0){ + tag=i18n("Infinite"); + }else{ + tag=TQString().sprintf("%5.2fm",(double)ImageInfo.getDistance()); + } + appendItem( exifGroup, "Focus dist.", tag ); + } + + if (ImageInfo.getExposureBias()){ + appendItem( exifGroup, "Exposure bias", + TQString(TQString().sprintf("%4.2f", + (double)ImageInfo.getExposureBias()) )); + } + + if (ImageInfo.getWhitebalance() != -1){ + switch(ImageInfo.getWhitebalance()) { + case 0: + tag=i18n("Unknown"); + break; + case 1: + tag=i18n("Daylight"); + break; + case 2: + tag=i18n("Fluorescent"); + break; + case 3: + //tag=i18n("incandescent"); + tag=i18n("Tungsten"); + break; + case 17: + tag=i18n("Standard light A"); + break; + case 18: + tag=i18n("Standard light B"); + break; + case 19: + tag=i18n("Standard light C"); + break; + case 20: + tag=i18n("D55"); + break; + case 21: + tag=i18n("D65"); + break; + case 22: + tag=i18n("D75"); + break; + case 255: + tag=i18n("Other"); + break; + default: + //23 to 254 = reserved + tag=i18n("Unknown"); + } + appendItem( exifGroup, "Whitebalance", tag ); + } + + if (ImageInfo.getMeteringMode() != -1){ + switch(ImageInfo.getMeteringMode()) { + case 0: + tag=i18n("Unknown"); + break; + case 1: + tag=i18n("Average"); + break; + case 2: + tag=i18n("Center weighted average"); + break; + case 3: + tag=i18n("Spot"); + break; + case 4: + tag=i18n("MultiSpot"); + break; + case 5: + tag=i18n("Pattern"); + break; + case 6: + tag=i18n("Partial"); + break; + case 255: + tag=i18n("Other"); + break; + default: + // 7 to 254 = reserved + tag=i18n("Unknown"); + } + appendItem( exifGroup, "Metering mode", tag ); + } + + if (ImageInfo.getExposureProgram()){ + switch(ImageInfo.getExposureProgram()) { + case 0: + tag=i18n("Not defined"); + break; + case 1: + tag=i18n("Manual"); + break; + case 2: + tag=i18n("Normal program"); + break; + case 3: + tag=i18n("Aperture priority"); + break; + case 4: + tag=i18n("Shutter priority"); + break; + case 5: + tag=i18n("Creative program\n(biased toward fast shutter speed)"); + break; + case 6: + tag=i18n("Action program\n(biased toward fast shutter speed)"); + break; + case 7: + tag=i18n("Portrait mode\n(for closeup photos with the background out of focus)"); + break; + case 8: + tag=i18n("Landscape mode\n(for landscape photos with the background in focus)"); + break; + default: + // 9 to 255 = reserved + tag=i18n("Unknown"); + } + appendItem( exifGroup, "Exposure", tag ); + } + + if (ImageInfo.getISOequivalent()){ + appendItem( exifGroup, "ISO equiv.", + TQString(TQString().sprintf("%2d", + (int)ImageInfo.getISOequivalent()) )); + } + + if (ImageInfo.getCompressionLevel()){ + switch(ImageInfo.getCompressionLevel()) { + case 1: + tag=i18n("Basic"); + break; + case 2: + tag=i18n("Normal"); + break; + case 4: + tag=i18n("Fine"); + break; + default: + tag=i18n("Unknown"); + } + appendItem( exifGroup, "JPEG quality", tag ); + } + + tag = ImageInfo.getUserComment(); + if (tag.length()){ + appendItem( exifGroup, "EXIF comment", tag ); + } + + int a; + for (a=0;;a++){ + if (ProcessTable[a].Tag == ImageInfo.getProcess() || ProcessTable[a].Tag == 0){ + appendItem( exifGroup, "JPEG process", + TQString::fromUtf8( ProcessTable[a].Desc) ); + break; + } + } + + if ( what & KFileMetaInfo::Thumbnail && !ImageInfo.isNullThumbnail() ){ + appendItem( exifGroup, "Thumbnail", ImageInfo.getThumbnail() ); + } + + return true; +} + +// format of the string is: +// YYYY:MM:DD HH:MM:SS +TQDateTime KJpegPlugin::parseDateTime( const TQString& string ) +{ + TQDateTime dt; + if ( string.length() != 19 ) + return dt; + + TQString year = string.left( 4 ); + TQString month = string.mid( 5, 2 ); + TQString day = string.mid( 8, 2 ); + TQString hour = string.mid( 11, 2 ); + TQString minute = string.mid( 14, 2 ); + TQString seconds = string.mid( 17, 2 ); + + bool ok; + bool allOk = true; + int y = year.toInt( &ok ); + allOk &= ok; + + int mo = month.toInt( &ok ); + allOk &= ok; + + int d = day.toInt( &ok ); + allOk &= ok; + + int h = hour.toInt( &ok ); + allOk &= ok; + + int mi = minute.toInt( &ok ); + allOk &= ok; + + int s = seconds.toInt( &ok ); + allOk &= ok; + + if ( allOk ) { + dt.setDate( TQDate( y, mo, d ) ); + dt.setTime( TQTime( h, mi, s ) ); + } + + return dt; +} + +#include "tdefile_jpeg.moc" diff --git a/tdefile-plugins/jpeg/tdefile_jpeg.desktop b/tdefile-plugins/jpeg/tdefile_jpeg.desktop new file mode 100644 index 00000000..d2cfa0ff --- /dev/null +++ b/tdefile-plugins/jpeg/tdefile_jpeg.desktop @@ -0,0 +1,64 @@ +[Desktop Entry] +Type=Service +Name=JPEG EXIF Info +Name[ar]=معلومات JPEG EXIF +Name[br]=Titouroù EXIF JPEG +Name[ca]=Informació de JPEG EXIF +Name[cs]=JPEG EXIF info +Name[cy]=Gwybodaeth JPEG EXIF +Name[da]=JPEG EXIF-info +Name[de]=JPEG EXIF-Info +Name[el]=Πληροφορίες JPEG EXIF +Name[eo]=JPEG-EXIF-informo +Name[es]=Info JPEG EXIF +Name[et]=JPEG EXIF info +Name[fa]=اطلاعات JPEG EXIF +Name[fi]=JPEG EXIF -tiedot +Name[fr]=Informations JPEG EXIF +Name[gl]=Inf. JPEG EXIF +Name[he]=מידע JPEG EXIF +Name[hi]=JPEG EXIF जानकारी +Name[hr]=JPEG EXIF Informacije +Name[hu]=JPEG EXIF-jellemzők +Name[is]=JPEG EXIF upplýsingar +Name[it]=Informazioni JPEG EXIF +Name[ja]=JPEG EXIF 情報 +Name[kk]=JPEG EXIF мәліметі +Name[km]=ព័ត៌មាន JPEG EXIF +Name[lt]=JPEG EXIF informacija +Name[ms]=Maklumat JPEG EXIF +Name[nds]=JPEG-EXIF-Info +Name[ne]=JPEG EXIF सूचना +Name[nl]=JPEG EXIF-info +Name[nn]=JPEG EXIF-info +Name[nso]=TshedimoJPEG EXIF Info +Name[pa]=JPEG EXIF ਜਾਣਕਾਰੀ +Name[pl]=Informacja o pliku JPEG EXIF +Name[pt]=Informação do JPEG EXIF +Name[pt_BR]=Informação sobre JPEG EXIF +Name[ro]=Informaţii EXIF JPEG +Name[ru]=Информация о JPEG EXIF +Name[se]=JPEG EXIF-dieđut +Name[sl]=Podatki o JPEG EXIF +Name[sr]=JPEG EXIF информације +Name[sr@Latn]=JPEG EXIF informacije +Name[sv]=JPEG EXIF-information +Name[ta]=JPEG EXIF தகவல் +Name[tg]=Иттилоот оиди JPEG EXIF +Name[th]=ข้อมูลแฟ้ม JPEG EXIF +Name[tr]=JPEG EXIF Bilgisi +Name[uk]=Інформація про JPEG EXIF +Name[uz]=JPEG EXIF haqida maʼlumot +Name[uz@cyrillic]=JPEG EXIF ҳақида маълумот +Name[ven]=Mafhungo a JPEG EXIF +Name[wa]=Informåcion sol imådje JPEG EXIF +Name[xh]=Ulwazi lwe JPEG EXIF +Name[zh_CN]=JPEG EXIF 信息 +Name[zh_HK]=JPEG EXIF 資訊 +Name[zh_TW]=JPEG EXIF 資訊 +Name[zu]=Ulwazi lwe-JPEG EXIF +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_jpeg +MimeType=image/jpeg +PreferredItems=User comment,CreationDate,CreationTime,Dimensions,Exposure time,JPEG quality,Comment +SupportsThumbnail=true diff --git a/tdefile-plugins/jpeg/tdefile_jpeg.h b/tdefile-plugins/jpeg/tdefile_jpeg.h new file mode 100644 index 00000000..979ae515 --- /dev/null +++ b/tdefile-plugins/jpeg/tdefile_jpeg.h @@ -0,0 +1,44 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Frank Pieczynski + * + * 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_JPEG_H__ +#define __KFILE_JPEG_H__ + +#include +#include + +class KJpegPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KJpegPlugin( TQObject *parent, const char *name, + const TQStringList& args ); + + virtual bool readInfo ( KFileMetaInfo& info, uint what ); + virtual bool writeInfo( const KFileMetaInfo& info ) const; + virtual TQValidator* createValidator( const KFileMetaInfoItem& item, + TQObject* parent, const char* name) const; + +private: + TQDateTime parseDateTime( const TQString& string ); +}; + +#endif diff --git a/tdefile-plugins/jpeg/tdefile_setcomment.cpp b/tdefile-plugins/jpeg/tdefile_setcomment.cpp new file mode 100644 index 00000000..07dca273 --- /dev/null +++ b/tdefile-plugins/jpeg/tdefile_setcomment.cpp @@ -0,0 +1,536 @@ +/* + * setcomment.cpp + * + * Copyright 2002 Bryce Nesbitt + * + * Based on wrjpgcom.c, Copyright (C) 1994-1997, Thomas G. Lane. + * Part of the Independent JPEG Group's software release 6b of 27-Mar-1998 + * + * This file contains a very simple stand-alone application that inserts + * user-supplied text as a COM (comment) marker in a JPEG/JFIF file. + * This may be useful as an example of the minimum logic needed to parse + * JPEG markers. + * + * There can be an arbitrary number of COM blocks in each jpeg file, with + * up to 64K of data each. We, however, write just one COM and blow away + * the rest. + * + ***************** + * + * 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. + * + */ + +#undef STANDALONE_COMPILE + +#include +#include +#include +#include +#include +#include +#include "config.h" + +extern int safe_copy_and_modify( const char * original_filename, const char * comment ); + +#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ +#define READ_BINARY "r" +#define WRITE_BINARY "w" +#else +#ifdef VMS /* VMS is very nonstandard */ +#define READ_BINARY "rb", "ctx=stm" +#define WRITE_BINARY "wb", "ctx=stm" +#else /* standard ANSI-compliant case */ +#define READ_BINARY "rb" +#define WRITE_BINARY "wb" +#endif +#endif + +#define WARNING_GARBAGE 1 /* Original file had some unspecified content */ +#define ERROR_NOT_A_JPEG 5 /* Original file not a proper jpeg (must be 1st) */ +#define ERROR_TEMP_FILE 6 /* Problem writing temporay file */ +#define ERROR_SCREWUP 7 /* Original file is now damaged. Ooops. */ +#define ERROR_PREMATURE_EOF 8 /* Unexpected end of file */ +#define ERROR_BAD_MARKER 9 /* Marker with illegal length */ +#define ERROR_MARKER_ORDER 10 /* File seems to be mixed up */ + +static int global_error; /* global error flag. Once set, we're dead. */ + +/****************************************************************************/ +/* + * These macros are used to read the input file and write the output file. + * To reuse this code in another application, you might need to change these. + */ +static FILE * infile; /* input JPEG file */ + +/* Return next input byte, or EOF if no more */ +#define NEXTBYTE() getc(infile) + +static FILE * outfile; /* output JPEG file */ + +/* Emit an output byte */ +#define PUTBYTE(x) putc((x), outfile) + + +/****************************************************************************/ +/* Read one byte, testing for EOF */ +static int +read_1_byte (void) +{ + int c; + + c = NEXTBYTE(); + if (c == EOF) { + global_error = ERROR_PREMATURE_EOF; + } + return c; +} + +/* Read 2 bytes, convert to unsigned int */ +/* All 2-byte quantities in JPEG markers are MSB first */ +static unsigned int +read_2_bytes (void) +{ + int c1, c2; + + c1 = NEXTBYTE(); + if (c1 == EOF) + global_error = ERROR_PREMATURE_EOF; + c2 = NEXTBYTE(); + if (c2 == EOF) + global_error = ERROR_PREMATURE_EOF; + return (((unsigned int) c1) << 8) + ((unsigned int) c2); +} + + +/****************************************************************************/ +/* Routines to write data to output file */ +static void +write_1_byte (int c) +{ + PUTBYTE(c); +} + +static void +write_2_bytes (unsigned int val) +{ + PUTBYTE((val >> 8) & 0xFF); + PUTBYTE(val & 0xFF); +} + +static void +write_marker (int marker) +{ + PUTBYTE(0xFF); + PUTBYTE(marker); +} + +static void +copy_rest_of_file (void) +{ + int c; + + while ((c = NEXTBYTE()) != EOF) + PUTBYTE(c); +} + + +/****************************************************************************/ +/* + * JPEG markers consist of one or more 0xFF bytes, followed by a marker + * code byte (which is not an FF). Here are the marker codes of interest + * in this program. (See jdmarker.c for a more complete list.) + */ + +#define M_SOF0 0xC0 /* Start Of Frame N */ +#define M_SOF1 0xC1 /* N indicates which compression process */ +#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */ +#define M_SOF3 0xC3 +#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */ +#define M_SOF6 0xC6 +#define M_SOF7 0xC7 +#define M_SOF9 0xC9 +#define M_SOF10 0xCA +#define M_SOF11 0xCB +#define M_SOF13 0xCD +#define M_SOF14 0xCE +#define M_SOF15 0xCF +#define M_SOI 0xD8 /* Start Of Image (beginning of datastream) */ +#define M_EOI 0xD9 /* End Of Image (end of datastream) */ +#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */ +#define M_COM 0xFE /* COMment */ + + +/* + * Find the next JPEG marker and return its marker code. + * We expect at least one FF byte, possibly more if the compressor used FFs + * to pad the file. (Padding FFs will NOT be replicated in the output file.) + * There could also be non-FF garbage between markers. The treatment of such + * garbage is unspecified; we choose to skip over it but emit a warning msg. + * NB: this routine must not be used after seeing SOS marker, since it will + * not deal correctly with FF/00 sequences in the compressed image data... + */ +static int +next_marker (void) +{ + int c; + int discarded_bytes = 0; + + /* Find 0xFF byte; count and skip any non-FFs. */ + c = read_1_byte(); + while (c != 0xFF) { + discarded_bytes++; + c = read_1_byte(); + } + /* Get marker code byte, swallowing any duplicate FF bytes. Extra FFs + * are legal as pad bytes, so don't count them in discarded_bytes. + */ + do { + c = read_1_byte(); + } while (c == 0xFF); + + if (discarded_bytes != 0) { + global_error = WARNING_GARBAGE; + } + + return c; +} + + +/* + * Most types of marker are followed by a variable-length parameter segment. + * This routine skips over the parameters for any marker we don't otherwise + * want to process. + * Note that we MUST skip the parameter segment explicitly in order not to + * be fooled by 0xFF bytes that might appear within the parameter segment; + * such bytes do NOT introduce new markers. + */ +static void +copy_variable (void) +/* Copy an unknown or uninteresting variable-length marker */ +{ + unsigned int length; + + /* Get the marker parameter length count */ + length = read_2_bytes(); + write_2_bytes(length); + /* Length includes itself, so must be at least 2 */ + if (length < 2) { + global_error = ERROR_BAD_MARKER; + length = 2; + } + length -= 2; + /* Skip over the remaining bytes */ + while (length > 0) { + write_1_byte(read_1_byte()); + length--; + } +} + +static void +skip_variable (void) +/* Skip over an unknown or uninteresting variable-length marker */ +{ + unsigned int length; + + /* Get the marker parameter length count */ + length = read_2_bytes(); + /* Length includes itself, so must be at least 2 */ + if (length < 2) { + global_error = ERROR_BAD_MARKER; + length = 2; + } + length -= 2; + /* Skip over the remaining bytes */ + while (length > 0) { + (void) read_1_byte(); + length--; + } +} + + +static int +scan_JPEG_header (int keep_COM) +/* + * Parse & copy the marker stream until SOFn or EOI is seen; + * copy data to output, but discard COM markers unless keep_COM is true. + */ +{ + int c1, c2; + int marker; + + /* + * Read the initial marker, which should be SOI. + * For a JFIF file, the first two bytes of the file should be literally + * 0xFF M_SOI. To be more general, we could use next_marker, but if the + * input file weren't actually JPEG at all, next_marker might read the whole + * file and then return a misleading error message... + */ + c1 = NEXTBYTE(); + c2 = NEXTBYTE(); + if (c1 != 0xFF || c2 != M_SOI) { + global_error = ERROR_NOT_A_JPEG; + return EOF; + } + + write_marker(M_SOI); + + /* Scan miscellaneous markers until we reach SOFn. */ + for (;;) { + marker = next_marker(); + switch (marker) { + /* Note that marker codes 0xC4, 0xC8, 0xCC are not, and must not be, + * treated as SOFn. C4 in particular is actually DHT. + */ + case M_SOF0: /* Baseline */ + case M_SOF1: /* Extended sequential, Huffman */ + case M_SOF2: /* Progressive, Huffman */ + case M_SOF3: /* Lossless, Huffman */ + case M_SOF5: /* Differential sequential, Huffman */ + case M_SOF6: /* Differential progressive, Huffman */ + case M_SOF7: /* Differential lossless, Huffman */ + case M_SOF9: /* Extended sequential, arithmetic */ + case M_SOF10: /* Progressive, arithmetic */ + case M_SOF11: /* Lossless, arithmetic */ + case M_SOF13: /* Differential sequential, arithmetic */ + case M_SOF14: /* Differential progressive, arithmetic */ + case M_SOF15: /* Differential lossless, arithmetic */ + return marker; + + case M_SOS: /* should not see compressed data before SOF */ + global_error = ERROR_MARKER_ORDER; + break; + + case M_EOI: /* in case it's a tables-only JPEG stream */ + return marker; + + case M_COM: /* Existing COM: conditionally discard */ + if (keep_COM) { + write_marker(marker); + copy_variable(); + } else { + skip_variable(); + } + break; + + default: /* Anything else just gets copied */ + write_marker(marker); + copy_variable(); /* we assume it has a parameter count... */ + break; + } + } /* end loop */ +} + + +/****************************************************************************/ +/* + Verify we know how to set the comment on this type of file. + + TODO: The actual check! This should verify + the image size promised in the headers matches the file, + and that all markers are properly formatted. +*/ +static int validate_image_file( const char * filename ) +{ +int status = 1; +int c1, c2; + + if ( (infile = fopen(filename, READ_BINARY)) ) { + c1 = NEXTBYTE(); + c2 = NEXTBYTE(); + if (c1 != 0xFF || c2 != M_SOI) + status = ERROR_NOT_A_JPEG; + else + status = 0; + fclose( infile ); + } + return( status ); +} + + +/****************************************************************************/ +/* + Modify the file in place, but be paranoid and safe about it. + It's worth a few extra CPU cycles to make sure we never + destory an original image: + 1) Validate the input file. + 2) Open a temporary file. + 3) Copy the data, writing a new comment block. + 4) Validate the temporary file. + 5) Move the temporary file over the original. + + To be even more paranoid & safe we could: + 5) Rename the original to a different temporary name. + 6) Rename the temporary to the original. + 7) Delete the original. +*/ +extern int safe_copy_and_modify( const char * original_filename, const char * comment ) +{ +char * temp_filename; +int temp_filename_length; +int comment_length = 0; +int marker; +int i; +struct stat statbuf; + + global_error = 0; + + /* + * Make sure we're dealing with a proper input file. Safety first! + */ + if( validate_image_file( original_filename ) ) { + fprintf(stderr, "error validating original file %s\n", original_filename); + return(ERROR_NOT_A_JPEG); + } + + /* Get a unique temporary file in the same directory. Hopefully + * if things go wrong, this file will still be left for recovery purposes. + * + * NB: I hate these stupid string functions in C... the buffer length is too + * hard to manage... + */ + outfile = NULL; + temp_filename_length = strlen( original_filename) + 4; + temp_filename = (char *)calloc( temp_filename_length, 1 ); + for( i=0; i<10; i++ ) { + snprintf( temp_filename, temp_filename_length, "%s%d", original_filename, i ); + if( stat( temp_filename, &statbuf ) ) { + outfile = fopen(temp_filename, WRITE_BINARY); + break; + } + } + if( !outfile ) { + fprintf(stderr, "failed opening temporary file %s\n", temp_filename); + free(temp_filename); + return(ERROR_TEMP_FILE); + } + + + /* + * Let's rock and roll! + */ + if ((infile = fopen(original_filename, READ_BINARY)) == NULL) { + fprintf(stderr, "can't open input file %s\n", original_filename); + free(temp_filename); + return(ERROR_NOT_A_JPEG); + } + /* Copy JPEG headers until SOFn marker; + * we will insert the new comment marker just before SOFn. + * This (a) causes the new comment to appear after, rather than before, + * existing comments; and (b) ensures that comments come after any JFIF + * or JFXX markers, as required by the JFIF specification. + */ + marker = scan_JPEG_header(0); + /* Insert the new COM marker, but only if nonempty text has been supplied */ + if (comment) { + comment_length = strlen( comment ); + } + if (comment_length > 0) { + write_marker(M_COM); + write_2_bytes(comment_length + 2); + while (comment_length > 0) { + write_1_byte(*comment++); + comment_length--; + } + } + /* Duplicate the remainder of the source file. + * Note that any COM markers occurring after SOF will not be touched. + * + * :TODO: Discard COM markers occurring after SOF + */ + write_marker(marker); + copy_rest_of_file(); + fclose( infile ); + fsync( fileno( outfile) ); /* Make sure its really on disk first. !!!VERY IMPORTANT!!! */ + if ( fclose( outfile ) ) { + fprintf(stderr, "error in temporary file %s\n", temp_filename); + free(temp_filename); + return(ERROR_TEMP_FILE); + } + + + /* + * Make sure we did it right. We've already fsync()'ed the file. Safety first! + */ + if( validate_image_file( temp_filename ) ) { + fprintf(stderr, "error in temporary file %s\n", temp_filename); + free(temp_filename); + return(ERROR_TEMP_FILE); + } + + if( global_error >= ERROR_NOT_A_JPEG ) { + fprintf(stderr, "error %d processing %s\n", global_error, original_filename); + free(temp_filename); + return(ERROR_NOT_A_JPEG); + } + + if( rename( temp_filename, original_filename ) ) { + fprintf(stderr, "error renaming %s to %s\n", temp_filename, original_filename); + free(temp_filename); + return(ERROR_TEMP_FILE); + } + free(temp_filename); + + return(0); +} + + +#ifdef STANDALONE_COMPILE +int +main (int argc, char **argv) +{ + char * progname; /* program name for error messages */ + char * filename; + char * comment; + FILE * fp; + int error; + + /* Process command line arguments... */ + progname = argv[0]; + if (progname == NULL || progname[0] == 0) + progname = "writejpgcomment"; /* in case C library doesn't provide it */ + if( argc != 3) { + fprintf(stderr, "Usage: %s \"\"\nOverwrites the comment in a image file with the given comment.\n", progname); + return(5); + } + filename = argv[1]; + comment = argv[2]; + + + /* Check if file is readable... */ + if ((fp = fopen(filename, READ_BINARY)) == NULL) { + fprintf(stderr, "Error: Can't open file %s\n", filename); + fclose(fp); + return(5); + } + fclose(fp); + + /* Check if we really have a commentable image file here... */ + if( validate_image_file( filename ) ) { + fprintf(stderr, "Error: file %s is not of a supported type\n", filename); + return(5); + } + + /* Lets do it... modify the comment in place */ + if ((error = safe_copy_and_modify( filename, comment ) )) { + fprintf(stderr, "Error: %d setting jpg comment\n", error); + return(10); + } + + + /* TODO: Read comment back out of jpg and display it */ + return( 0 ); +} +#endif 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 +*/ + diff --git a/tdefile-plugins/pdf/CMakeLists.txt b/tdefile-plugins/pdf/CMakeLists.txt new file mode 100644 index 00000000..5a81d453 --- /dev/null +++ b/tdefile-plugins/pdf/CMakeLists.txt @@ -0,0 +1,36 @@ +################################################# +# +# (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} + ${CMAKE_SOURCE_DIR}/tdefile-plugins/dependencies/poppler-tqt +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +#### other data ################################# + +install( FILES tdefile_pdf.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +#### tdefile_pdf (module) ######################### + +tde_add_kpart( tdefile_pdf AUTOMOC + SOURCES tdefile_pdf.cpp + LINK tdeio-shared -L${CMAKE_BINARY_DIR}/tdefile-plugins/dependencies/poppler-tqt -lpoppler-tqt + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/pdf/Makefile.am b/tdefile-plugins/pdf/Makefile.am new file mode 100644 index 00000000..a6f38115 --- /dev/null +++ b/tdefile-plugins/pdf/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for the pdf file meta info plugin + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) -I$(top_srcdir)/tdefile-plugins/dependencies/poppler-tqt + +# these are the headers for your project +noinst_HEADERS = tdefile_pdf.h + +kde_module_LTLIBRARIES = tdefile_pdf.la + +tdefile_pdf_la_SOURCES = tdefile_pdf.cpp +tdefile_pdf_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdefile_pdf_la_LIBADD = $(LIB_KIO) -L$(top_builddir)/tdefile-plugins/dependencies/poppler-tqt/ -lpoppler-tqt + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: + $(XGETTEXT) *.cpp -o $(podir)/tdefile_pdf.pot + +services_DATA = tdefile_pdf.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/pdf/configure.in.in b/tdefile-plugins/pdf/configure.in.in new file mode 100644 index 00000000..ec2fff51 --- /dev/null +++ b/tdefile-plugins/pdf/configure.in.in @@ -0,0 +1,16 @@ +AC_ARG_WITH([poppler], + [AC_HELP_STRING([--with-poppler], + [Enable PDF support through poppler @<:@default=check@:>@])], + [], with_poppler=check) + +## Compile the pdf meta info plugin only if Poppler is available +#if test "x$with_poppler" != xno; then +# PKG_CHECK_MODULES(POPPLER, poppler-qt >= 0.3.1, have_poppler=yes, have_poppler=no) +# +# if test "x$with_poppler" != xcheck && test "x$have_poppler" != xyes; then +# AC_MSG_ERROR([--with-poppler was given, but test for poppler failed]) +# fi +#fi + +have_poppler=yes +AM_CONDITIONAL(include_PDF, test "x$have_poppler" = xyes) diff --git a/tdefile-plugins/pdf/tdefile_pdf.cpp b/tdefile-plugins/pdf/tdefile_pdf.cpp new file mode 100644 index 00000000..b3bacc02 --- /dev/null +++ b/tdefile-plugins/pdf/tdefile_pdf.cpp @@ -0,0 +1,104 @@ +/* This file is part of the KDE project + * Copyright (C) 2001, 2002 Rolf Magnus + * + * 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 "tdefile_pdf.h" + +#include +#include + +typedef KGenericFactory PdfFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_pdf, PdfFactory("tdefile_pdf")) + +KPdfPlugin::KPdfPlugin(TQObject *parent, const char *name, const TQStringList &preferredItems) + : KFilePlugin(parent, name, preferredItems) +{ + kdDebug(7034) << "pdf plugin\n"; + + // set up our mime type + KFileMimeTypeInfo* info = addMimeTypeInfo( "application/pdf" ); + + // general group + KFileMimeTypeInfo::GroupInfo* group = addGroupInfo(info, "General", i18n("General")); + + KFileMimeTypeInfo::ItemInfo* item; + + item = addItemInfo(group, "Title", i18n("Title"), TQVariant::String); + setHint(item, KFileMimeTypeInfo::Name); + item = addItemInfo(group, "Subject", i18n("Subject"), TQVariant::String); + setHint(item, KFileMimeTypeInfo::Description); + item = addItemInfo(group, "Author", i18n("Author"), TQVariant::String); + setHint(item, KFileMimeTypeInfo::Author); + addItemInfo(group, "Keywords", i18n("Key Words"), TQVariant::String); + addItemInfo(group, "Creator", i18n("Creator"), TQVariant::String); + addItemInfo(group, "Producer", i18n("Producer"), TQVariant::String); + addItemInfo(group, "CreationDate", i18n("Creation Date"), TQVariant::DateTime); + addItemInfo(group, "ModificationDate", i18n("Modified"), TQVariant::DateTime); + addItemInfo(group, "Pages", i18n("Pages"), TQVariant::Int); + addItemInfo(group, "Protected", i18n("Protected"), TQVariant::String); + addItemInfo(group, "Linearized", i18n("Linearized"), TQVariant::String); + addItemInfo(group, "Version", i18n("Version"), TQVariant::String); +} + +bool KPdfPlugin::readInfo( KFileMetaInfo& info, uint /* what */) +{ + Poppler::Document *doc = Poppler::Document::load(info.path()); + if (!doc || doc->isLocked()) + { + delete doc; + return false; + } + + KFileMetaInfoGroup generalGroup = appendGroup(info, "General"); + + appendItem(generalGroup, "Title", doc->getInfo("Title") ); + appendItem(generalGroup, "Subject", doc->getInfo("Subject") ); + appendItem(generalGroup, "Author", doc->getInfo("Author") ); + appendItem(generalGroup, "Keywords", doc->getInfo("Keywords") ); + appendItem(generalGroup, "Creator", doc->getInfo("Creator") ); + appendItem(generalGroup, "Producer", doc->getInfo("Producer") ); + + appendItem(generalGroup, "CreationDate", doc->getDate("CreationDate") ); + appendItem(generalGroup, "ModificationDate", doc->getDate("ModDate") ); + appendItem(generalGroup, "Pages", doc->getNumPages() ); + + TQString enc; + if (doc->isEncrypted()) + { + enc = i18n("Yes (Can Print:%1 Can Copy:%2 Can Change:%3 Can Add notes:%4)") + .arg(doc->okToPrint() ? i18n("Yes") : i18n("No")) + .arg(doc->okToCopy() ? i18n("Yes") : i18n("No")) + .arg(doc->okToChange() ? i18n("Yes") : i18n("No")) + .arg(doc->okToAddNotes() ? i18n("Yes") : i18n("No")); + } + else enc = i18n("No"); + + appendItem(generalGroup, "Protected", enc ); + appendItem(generalGroup, "Linearized", doc->isLinearized() ? i18n("Yes") : i18n("No") ); + TQString versionString = TQString("%1").arg( doc->getPDFVersion(), 0, 'f', 1 ); + appendItem(generalGroup, "Version", versionString ); + + delete doc; + + return true; +} + +#include "tdefile_pdf.moc" + diff --git a/tdefile-plugins/pdf/tdefile_pdf.desktop b/tdefile-plugins/pdf/tdefile_pdf.desktop new file mode 100644 index 00000000..41f4d21f --- /dev/null +++ b/tdefile-plugins/pdf/tdefile_pdf.desktop @@ -0,0 +1,64 @@ +[Desktop Entry] +Type=Service +Name=PDF Info +Name[af]=Pdf Inligting +Name[ar]=معلومات PDF +Name[br]=Titouroù PDF +Name[ca]=Informació de PDF +Name[cs]=PDF info +Name[cy]=Gybodaeth PDF +Name[da]=PDF-info +Name[de]=PDF-Info +Name[el]=Πληροφορίες PDF +Name[eo]=PDF-informo +Name[es]=Info PDF +Name[et]=PDF info +Name[fa]=اطلاعات PDF +Name[fi]=PDF-tiedot +Name[fr]=Informations PDF +Name[gl]=Inf. PDF +Name[he]=מידע PDF +Name[hi]=PDF जानकारी +Name[hr]=PDF Informacije +Name[hu]=PDF-jellemzők +Name[is]=PDF upplýsingar +Name[it]=Informazioni PDF +Name[ja]=PDF 情報 +Name[kk]=PDF мәліметі +Name[km]=ព័ត៌មាន PDF +Name[lt]=PDF informacija +Name[ms]=Maklumat PDF +Name[nds]=PDF-Info +Name[ne]=PDF सूचना +Name[nl]=PDF-info +Name[nn]=PDF-info +Name[nso]=Tshedimoso ya PDF +Name[pa]=PDF ਜਾਣਕਾਰੀ +Name[pl]=Informacja o pliku PDF +Name[pt]=Informação do PDF +Name[pt_BR]=Informação sobre PDF +Name[ro]=Informaţii PDF +Name[ru]=Информация о PDF +Name[se]=PDF-dieđut +Name[sl]=Podatki o PDF +Name[sr]=PDF информације +Name[sr@Latn]=PDF informacije +Name[sv]=PDF-information +Name[ta]=PDF தகவல் +Name[tg]=Иттилоот оиди PDF +Name[th]=ข้อมูลแฟ้ม PDF +Name[tr]=PDF Bilgisi +Name[uk]=Інформація про PDF +Name[uz]=PDF haqida maʼlumot +Name[uz@cyrillic]=PDF ҳақида маълумот +Name[ven]=Mafhungo a PDF +Name[wa]=Informåcion sol documint PDF +Name[xh]=PDF Ulwazi +Name[zh_CN]=PDF 信息 +Name[zh_HK]=PDF 資訊 +Name[zh_TW]=PDF 資訊 +Name[zu]=Ulwazi lwe-PDF +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_pdf +MimeType=application/pdf +PreferredItems=Title,Subject,Author,Keywords,Creator,Producer,CreationDate,ModificationDate,Pages,Protected,Linearized,Version diff --git a/tdefile-plugins/pdf/tdefile_pdf.h b/tdefile-plugins/pdf/tdefile_pdf.h new file mode 100644 index 00000000..d23971c7 --- /dev/null +++ b/tdefile-plugins/pdf/tdefile_pdf.h @@ -0,0 +1,39 @@ +/* This file is part of the KDE project + * Copyright (C) 2001, 2002 Rolf Magnus + * + * 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_PDF_H__ +#define __KFILE_PDF_H__ + +#include +#include + +class TQStringList; + +class KPdfPlugin: public KFilePlugin +{ +Q_OBJECT + +public: + KPdfPlugin( TQObject *parent, const char *name, const TQStringList& preferredItems ); + + virtual bool readInfo(KFileMetaInfo& info, uint what); +}; + +#endif diff --git a/tdefile-plugins/png/CMakeLists.txt b/tdefile-plugins/png/CMakeLists.txt new file mode 100644 index 00000000..7000bcd7 --- /dev/null +++ b/tdefile-plugins/png/CMakeLists.txt @@ -0,0 +1,34 @@ +################################################# +# +# (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_png.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +#### tdefile_png (module) ######################### +tde_add_kpart( tdefile_png AUTOMOC + SOURCES tdefile_png.cpp + LINK tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/png/Makefile.am b/tdefile-plugins/png/Makefile.am new file mode 100644 index 00000000..7ce05e86 --- /dev/null +++ b/tdefile-plugins/png/Makefile.am @@ -0,0 +1,22 @@ +## 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 = tdefile_png.h + +kde_module_LTLIBRARIES = tdefile_png.la + +tdefile_png_la_SOURCES = tdefile_png.cpp +tdefile_png_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdefile_png_la_LIBADD = $(LIB_KIO) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: + $(XGETTEXT) *.cpp -o $(podir)/tdefile_png.pot + +services_DATA = tdefile_png.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/png/tdefile_png.cpp b/tdefile-plugins/png/tdefile_png.cpp new file mode 100644 index 00000000..9766fbc6 --- /dev/null +++ b/tdefile-plugins/png/tdefile_png.cpp @@ -0,0 +1,315 @@ +/* This file is part of the KDE project + * Copyright (C) 2001, 2002 Rolf Magnus + * + * 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 +#include "tdefile_png.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +// 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 PngFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_png, PngFactory("tdefile_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(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) + 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(key)), + TQString(arr)); + + kdDebug(7034) << "adding " << key << " / " + << TQString(arr) << endl; + + index += CHUNK_SIZE(data, index) + CHUNK_HEADER_SIZE; + } + } + } + } +end: + delete[] data; + return true; +} + +#include "tdefile_png.moc" diff --git a/tdefile-plugins/png/tdefile_png.desktop b/tdefile-plugins/png/tdefile_png.desktop new file mode 100644 index 00000000..ad2b98e0 --- /dev/null +++ b/tdefile-plugins/png/tdefile_png.desktop @@ -0,0 +1,65 @@ +[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=tdefile_png +MimeType=image/png +PreferredGroups=Comment,Technical +PreferredItems=Title,Author,Dimensions,BitDepth,ColorMode,Compression diff --git a/tdefile-plugins/png/tdefile_png.h b/tdefile-plugins/png/tdefile_png.h new file mode 100644 index 00000000..17fa31c8 --- /dev/null +++ b/tdefile-plugins/png/tdefile_png.h @@ -0,0 +1,40 @@ +/* This file is part of the KDE project + * Copyright (C) 2001, 2002 Rolf Magnus + * + * 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 +#include + +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 diff --git a/tdefile-plugins/pnm/CMakeLists.txt b/tdefile-plugins/pnm/CMakeLists.txt new file mode 100644 index 00000000..637fe59d --- /dev/null +++ b/tdefile-plugins/pnm/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_pnm.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +#### tdefile_pnm (module) ######################### + +tde_add_kpart( tdefile_pnm AUTOMOC + SOURCES tdefile_pnm.cpp + LINK tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/pnm/Makefile.am b/tdefile-plugins/pnm/Makefile.am new file mode 100644 index 00000000..f2d9e75e --- /dev/null +++ b/tdefile-plugins/pnm/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for pnm 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_pnm.h + +kde_module_LTLIBRARIES = tdefile_pnm.la + +tdefile_pnm_la_SOURCES = tdefile_pnm.cpp +tdefile_pnm_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdefile_pnm_la_LIBADD = $(LIB_KIO) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: + $(XGETTEXT) *.cpp -o $(podir)/tdefile_pnm.pot + +services_DATA = tdefile_pnm.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/pnm/tdefile_pnm.cpp b/tdefile-plugins/pnm/tdefile_pnm.cpp new file mode 100644 index 00000000..c9bb065e --- /dev/null +++ b/tdefile-plugins/pnm/tdefile_pnm.cpp @@ -0,0 +1,137 @@ +/* This file is part of the KDE project + * Copyright (C) 2003 Volker Krause + * + * 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_pnm.h" + +#include +#include +#include +#include + +static const char* formats[] = { + I18N_NOOP("plain"), + I18N_NOOP("raw") +}; + +typedef KGenericFactory PnmFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_pnm, PnmFactory("tdefile_pnm")) + +KPnmPlugin::KPnmPlugin(TQObject *parent, const char *name, const TQStringList &args) : KFilePlugin(parent, name, args) +{ + makeMimeTypeInfo( "image/x-portable-bitmap" ); + makeMimeTypeInfo( "image/x-portable-greymap" ); + makeMimeTypeInfo( "image/x-portable-pixmap" ); +} + +void KPnmPlugin::makeMimeTypeInfo(const TQString& mimetype) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( mimetype ); + + KFileMimeTypeInfo::GroupInfo* group = 0; + KFileMimeTypeInfo::ItemInfo* item = 0; + + group = addGroupInfo(info, "General", i18n("General")); + + addItemInfo(group, "Format", i18n("Format"), TQVariant::String); + + item = addItemInfo(group, "Dimensions", i18n("Dimensions"), TQVariant::Size); + setUnit(item, KFileMimeTypeInfo::Pixels); + + item = addItemInfo(group, "BitDepth", i18n("Bit Depth"), TQVariant::Int); + setUnit(item, KFileMimeTypeInfo::BitsPerPixel); + + addItemInfo(group, "Comment", i18n("Comment"), TQVariant::String); +} + + +bool KPnmPlugin::readInfo( KFileMetaInfo& info, uint /*what*/) +{ + TQFile f(info.path()); + if(!f.open(IO_ReadOnly)) + return false; + if(f.size() <= 2) + return false; + TQTextStream stream(&f); + + char c; + stream >> c; + if(c != 'P') + return false; + + // image format and type + int n; + stream >> n; + int format = (n - 1) / 3; + if(format != 0 && format != 1) + return false; + int type = (n - 1) % 3; + + TQString comments, buffer; + while(!stream.atEnd()) { + stream >> c; + // comment + if( c == '#') { + buffer = stream.readLine(); + comments += buffer.stripWhiteSpace(); + comments += '\n'; + } + // image size + // unfortunately TQt doesn't have some kind of push-back method for + // TQTextStream, so we need to manually decode the first part of the + // image size. + if( c >= '0' && c <= '9' ) { + buffer = ""; + TQChar tmp(c); + while(!stream.atEnd() && tmp.isDigit()) { + buffer += tmp; + stream >> tmp; + } + break; + } + } + + // image size + int x, y, max; + x = buffer.toInt(); + stream >> y; + stream >> max; + + // bit depth + // PNM doesn't provide a conventional bit depth value, only the highest value + // per pixel. To have comparable values with other formats, we convert it to + // a normal bit depth value. + int bpp = 1; + if(type != 0) + bpp = (int)ceil(log((double)max) / log(2.0)); + if(type == 2) + bpp *= 3; + + KFileMetaInfoGroup group = appendGroup(info, "General"); + appendItem(group, "Format", formats[format]); + appendItem(group, "Dimensions", TQSize(x, y)); + if(!comments.isEmpty()) + appendItem(group, "Comment", comments.stripWhiteSpace()); + appendItem(group, "BitDepth", bpp); + + f.close(); + return true; +} + +#include "tdefile_pnm.moc" diff --git a/tdefile-plugins/pnm/tdefile_pnm.desktop b/tdefile-plugins/pnm/tdefile_pnm.desktop new file mode 100644 index 00000000..1cf4d310 --- /dev/null +++ b/tdefile-plugins/pnm/tdefile_pnm.desktop @@ -0,0 +1,60 @@ +[Desktop Entry] +Type=Service +Name=PNM Info +Name[ar]=معلومات PNM +Name[br]=Titouroù PNM +Name[ca]=Informació de PNM +Name[cs]=PNM info +Name[cy]=Gybodaeth PNM +Name[da]=PNG-info +Name[de]=PNM-Info +Name[el]=Πληροφορίες PNM +Name[eo]=PNM-informo +Name[es]=Info PNM +Name[et]=PNM info +Name[fa]=اطلاعات PNM +Name[fi]=PNM-tiedot +Name[fr]=Informations PNM +Name[gl]=Inf. PNM +Name[he]=מידע PNM +Name[hi]=PNM जानकारी +Name[hu]=PNM-jellemzők +Name[is]=PNM upplýsingar +Name[it]=Informazioni PNM +Name[ja]=PNM 情報 +Name[kk]=PNM мәліметі +Name[km]=ព័ត៌មាន PNM +Name[lt]=PNM informacija +Name[ms]=Maklumat PNM +Name[nb]=PNM-info +Name[nds]=PNM-Info +Name[ne]=PNM सूचना +Name[nl]=PNG-info +Name[nn]=PNM-info +Name[pa]=PNM ਜਾਣਕਾਰੀ +Name[pl]=Informacja o pliku PNM +Name[pt]=Informação do PNM +Name[pt_BR]=Informação sobre PNG +Name[ro]=Informaţii PNM +Name[ru]=Информация о PNM +Name[se]=PNM-dieđut +Name[sl]=Podatki o PNM +Name[sr]=PNM информације +Name[sr@Latn]=PNM informacije +Name[sv]=PNM-information +Name[ta]=PNM தகவல் +Name[tg]=Иттилоот оиди PNM +Name[th]=ข้อมูลแฟ้ม PNM +Name[tr]=PNM Bilgisi +Name[uk]=Інформація про PNM +Name[uz]=PNM haqida maʼlumot +Name[uz@cyrillic]=PNM ҳақида маълумот +Name[wa]=Informåcion sol imådje PNM +Name[zh_CN]=PNM 信息 +Name[zh_HK]=PNM 資訊 +Name[zh_TW]=PNM 資訊 +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_pnm +MimeType=image/x-portable-bitmap;image/x-portable-greymap;image/x-portable-pixmap +PreferredGroups=General +PreferredItems=Format,Dimensions,BitDepth,Comment diff --git a/tdefile-plugins/pnm/tdefile_pnm.h b/tdefile-plugins/pnm/tdefile_pnm.h new file mode 100644 index 00000000..4b16e4cc --- /dev/null +++ b/tdefile-plugins/pnm/tdefile_pnm.h @@ -0,0 +1,40 @@ +/* This file is part of the KDE project + * Copyright (C) 2003 Volker Krause + * + * 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_PNM_H__ +#define __KFILE_PNM_H__ + +#include + +class TQStringList; + +class KPnmPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KPnmPlugin( TQObject *parent, const char *name, const TQStringList& preferredItems ); + virtual bool readInfo( KFileMetaInfo& info, uint ); + +private: + void makeMimeTypeInfo( const TQString&); +}; + +#endif diff --git a/tdefile-plugins/ps/CMakeLists.txt b/tdefile-plugins/ps/CMakeLists.txt new file mode 100644 index 00000000..9a13bcb1 --- /dev/null +++ b/tdefile-plugins/ps/CMakeLists.txt @@ -0,0 +1,46 @@ +################################################# +# +# (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} + ${CMAKE_SOURCE_DIR}/kghostview + ${CMAKE_SOURCE_DIR}/kghostview/dscparse + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +#### other data ################################# + +install( FILES tdefile_ps.desktop gsthumbnail.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +#### tdefile_ps (module) ######################## + +tde_add_kpart( tdefile_ps AUTOMOC + SOURCES tdefile_ps.cpp + LINK dscparse-static tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) + + +##### gsthumbnail (module) ###################### + +tde_add_kpart( gsthumbnail AUTOMOC + SOURCES gscreator.cpp + LINK dscparse-static ${TQT_LIBRARIES} + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/ps/Makefile.am b/tdefile-plugins/ps/Makefile.am new file mode 100644 index 00000000..7e7943c6 --- /dev/null +++ b/tdefile-plugins/ps/Makefile.am @@ -0,0 +1,26 @@ +## Makefile.am for the ps file meta info plugin + +# set the include path for X, qt and KDE +INCLUDES = -I$(top_srcdir)/kghostview/dscparse $(all_includes) + +# these are the headers for your project +noinst_HEADERS = tdefile_ps.h gscreator.h + +kde_module_LTLIBRARIES = tdefile_ps.la gsthumbnail.la + +tdefile_ps_la_SOURCES = tdefile_ps.cpp +tdefile_ps_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdefile_ps_la_LIBADD = $(LIB_KIO) ../../kghostview/libdscparse.la + +gsthumbnail_la_SOURCES = gscreator.cpp +gsthumbnail_la_LIBADD = $(LIB_TDECORE) ../../kghostview/libdscparse.la +gsthumbnail_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: + $(XGETTEXT) *.cpp -o $(podir)/tdefile_ps.pot + +services_DATA = tdefile_ps.desktop gsthumbnail.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/ps/gscreator.cpp b/tdefile-plugins/ps/gscreator.cpp new file mode 100644 index 00000000..c664947b --- /dev/null +++ b/tdefile-plugins/ps/gscreator.cpp @@ -0,0 +1,619 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Malte Starostik + + Handling of EPS previews Copyright (C) 2003 Philipp Hullmann + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/* This function gets a path of a DVI, EPS, PS or PDF file and + produces a PNG-Thumbnail which is stored as a TQImage + + The program works as follows + + 1. Test if file is a DVI file + + 2. Create a child process (1), in which the + file is to be changed into a PNG + + 3. Child-process (1) : + + 4. If file is DVI continue with 6 + + 5. If file is no DVI continue with 9 + + 6. Create another child process (2), in which the DVI is + turned into PS using dvips + + 7. Parent process (2) : + Turn the recently created PS file into a PNG file using gs + + 8. continue with 10 + + 9. Turn the PS,PDF or EPS file into a PNG file using gs + + 10. Parent process (1) + store data in a TQImage +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + + +#include +#include +#include +#include +#include +#include +#ifdef HAVE_SYS_SELECT_H +#include +#endif +#include +#include +#include +#include +#include + +#include +#include +#include +#include + + +#include "gscreator.h" +#include "dscparse_adapter.h" +#include "dscparse.h" + +extern "C" +{ + KDE_EXPORT ThumbCreator *new_creator() + { + return new GSCreator; + } +} + +// This PS snippet will be prepended to the actual file so that only +// the first page is output. +static const char *psprolog = + "%!PS-Adobe-3.0\n" + "/.showpage.orig /showpage load def\n" + "/.showpage.firstonly {\n" + " .showpage.orig\n" + " quit\n" + "} def\n" + "/showpage { .showpage.firstonly } def\n"; + +// This is the code recommended by Adobe tech note 5002 for including +// EPS files. +static const char *epsprolog = + "%!PS-Adobe-3.0\n" + "userdict begin /pagelevel save def /showpage { } def\n" + "0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin 10 setmiterlimit\n" + "[ ] 0 setdash newpath false setoverprint false setstrokeadjust\n"; + +static const char * gsargs_ps[] = { + "gs", + "-sDEVICE=png16m", + "-sOutputFile=-", + "-dSAFER", + "-dPARANOIDSAFER", + "-dNOPAUSE", + "-dFirstPage=1", + "-dLastPage=1", + "-q", + "-", + 0, // file name + "-c", + "showpage", + "-c", + "quit", + 0 +}; + +static const char * gsargs_eps[] = { + "gs", + "-sDEVICE=png16m", + "-sOutputFile=-", + "-dSAFER", + "-dPARANOIDSAFER", + "-dNOPAUSE", + 0, // page size + 0, // resolution + "-q", + "-", + 0, // file name + "-c", + "pagelevel", + "-c", + "restore", + "-c", + "end", + "-c", + "showpage", + "-c", + "quit", + 0 +}; + +static const char *dvipsargs[] = { + "dvips", + "-n", + "1", + "-q", + "-o", + "-", + 0, // file name + 0 +}; + +static bool correctDVI(const TQString& filename); + + +namespace { + bool got_sig_term = false; + void handle_sigterm( int ) { + got_sig_term = true; + } +} + + +bool GSCreator::create(const TQString &path, int width, int height, TQImage &img) +{ +// The code in the loop (when testing whether got_sig_term got set) +// should read some variation of: +// parentJob()->wasKilled() +// +// Unfortunatelly, that's currently impossible without breaking BIC. +// So we need to catch the signal ourselves. +// Otherwise, on certain funny PS files (for example +// http://www.tjhsst.edu/~Eedanaher/pslife/life.ps ) +// gs would run forever after we were dead. +// #### Reconsider for KDE 4 ### +// (24/12/03 - luis_pedro) +// + typedef void ( *sighandler_t )( int ); + // according to linux's "man signal" the above typedef is a gnu extension + sighandler_t oldhandler = signal( SIGTERM, handle_sigterm ); + + int input[2]; + int output[2]; + int dvipipe[2]; + + TQByteArray data(1024); + + bool ok = false; + + // Test if file is DVI + bool no_dvi =!correctDVI(path); + + if (pipe(input) == -1) { + return false; + } + if (pipe(output) == -1) { + close(input[0]); + close(input[1]); + return false; + } + + KDSC dsc; + endComments = false; + dsc.setCommentHandler(this); + + if (no_dvi) + { + FILE* fp = fopen(TQFile::encodeName(path), "r"); + if (fp == 0) return false; + + char buf[4096]; + int count; + while ((count = fread(buf, sizeof(char), 4096, fp)) != 0 + && !endComments) { + dsc.scanData(buf, count); + } + fclose(fp); + + if (dsc.pjl() || dsc.ctrld()) { + // this file is a mess. + return false; + } + } + + const bool is_encapsulated = no_dvi && + (path.find(TQRegExp("\\.epsi?$", false, false)) > 0) && + (dsc.bbox()->width() > 0) && (dsc.bbox()->height() > 0) && + (dsc.page_count() <= 1); + + char translation[64] = ""; + char pagesize[32] = ""; + char resopt[32] = ""; + std::auto_ptr bbox = dsc.bbox(); + if (is_encapsulated) { + // GhostScript's rendering at the extremely low resolutions + // required for thumbnails leaves something to be desired. To + // get nicer images, we render to four times the required + // resolution and let TQImage scale the result. + const int hres = (width * 72) / bbox->width(); + const int vres = (height * 72) / bbox->height(); + const int resolution = (hres > vres ? vres : hres) * 4; + const int gswidth = ((bbox->urx() - bbox->llx()) * resolution) / 72; + const int gsheight = ((bbox->ury() - bbox->lly()) * resolution) / 72; + + snprintf(pagesize, 31, "-g%ix%i", gswidth, gsheight); + snprintf(resopt, 31, "-r%i", resolution); + snprintf(translation, 63, + " 0 %i sub 0 %i sub translate\n", bbox->llx(), + bbox->lly()); + } + + const CDSC_PREVIEW_TYPE previewType = + static_cast(dsc.preview()); + + switch (previewType) { + case CDSC_TIFF: + case CDSC_WMF: + case CDSC_PICT: + // FIXME: these should take precedence, since they can hold + // color previews, which EPSI can't (or can it?). + break; + case CDSC_EPSI: + { + const int xscale = bbox->width() / width; + const int yscale = bbox->height() / height; + const int scale = xscale < yscale ? xscale : yscale; + if (getEPSIPreview(path, + dsc.beginpreview(), + dsc.endpreview(), + img, + bbox->width() / scale, + bbox->height() / scale)) + return true; + // If the preview extraction routine fails, gs is used to + // create a thumbnail. + } + break; + case CDSC_NOPREVIEW: + default: + // need to run ghostscript in these cases + break; + } + + pid_t pid = fork(); + if (pid == 0) { + // Child process (1) + + // close(STDERR_FILENO); + + // find first zero entry in gsargs and put the filename + // or - (stdin) there, if DVI + const char **gsargs = gsargs_ps; + const char **arg = gsargs; + + if (no_dvi && is_encapsulated) { + gsargs = gsargs_eps; + arg = gsargs; + + // find first zero entry and put page size there + while (*arg) ++arg; + *arg = pagesize; + + // find second zero entry and put resolution there + while (*arg) ++arg; + *arg = resopt; + } + + // find next zero entry and put the filename there + TQCString fname = TQFile::encodeName( path ); + while (*arg) + ++arg; + if( no_dvi ) + *arg = fname.data(); + else + *arg = "-"; + + // find first zero entry in dvipsargs and put the filename there + arg = dvipsargs; + while (*arg) + ++arg; + *arg = fname.data(); + + if( !no_dvi ){ + pipe(dvipipe); + pid_t pid_two = fork(); + if( pid_two == 0 ){ + // Child process (2), reopen stdout on the pipe "dvipipe" and exec dvips + + close(input[0]); + close(input[1]); + close(output[0]); + close(output[1]); + close(dvipipe[0]); + + dup2( dvipipe[1], STDOUT_FILENO); + + execvp(dvipsargs[0], const_cast(dvipsargs)); + exit(1); + } + else if(pid_two != -1){ + close(input[1]); + close(output[0]); + close(dvipipe[1]); + + dup2( dvipipe[0], STDIN_FILENO); + dup2( output[1], STDOUT_FILENO); + + execvp(gsargs[0], const_cast(gsargs)); + exit(1); + } + else{ + // fork() (2) failed, close these + close(dvipipe[0]); + close(dvipipe[1]); + } + + } + else if( no_dvi ){ + // Reopen stdin/stdout on the pipes and exec gs + close(input[1]); + close(output[0]); + + dup2(input[0], STDIN_FILENO); + dup2(output[1], STDOUT_FILENO); + + execvp(gsargs[0], const_cast(gsargs)); + exit(1); + } + } + else if (pid != -1) { + // Parent process, write first-page-only-hack (the hack is not + // used if DVI) and read the png output + close(input[0]); + close(output[1]); + const char *prolog; + if (is_encapsulated) + prolog = epsprolog; + else + prolog = psprolog; + int count = write(input[1], prolog, strlen(prolog)); + if (is_encapsulated) + write(input[1], translation, strlen(translation)); + + close(input[1]); + if (count == static_cast(strlen(prolog))) { + int offset = 0; + while (!ok) { + fd_set fds; + FD_ZERO(&fds); + FD_SET(output[0], &fds); + struct timeval tv; + tv.tv_sec = 20; + tv.tv_usec = 0; + + got_sig_term = false; + if (select(output[0] + 1, &fds, 0, 0, &tv) <= 0) { + if ( ( errno == EINTR || errno == EAGAIN ) && !got_sig_term ) continue; + break; // error, timeout or master wants us to quit (SIGTERM) + } + if (FD_ISSET(output[0], &fds)) { + count = read(output[0], data.data() + offset, 1024); + if (count == -1) + break; + else + if (count) // prepare for next block + { + offset += count; + data.resize(offset + 1024); + } + else // got all data + { + data.resize(offset); + ok = true; + } + } + } + } + if (!ok) // error or timeout, gs probably didn't exit yet + { + kill(pid, SIGTERM); + } + + int status = 0; + if (waitpid(pid, &status, 0) != pid || (status != 0 && status != 256) ) + ok = false; + } + else { + // fork() (1) failed, close these + close(input[0]); + close(input[1]); + close(output[1]); + } + close(output[0]); + + int l = img.loadFromData( data ); + + if ( got_sig_term && + oldhandler != SIG_ERR && + oldhandler != SIG_DFL && + oldhandler != SIG_IGN ) { + oldhandler( SIGTERM ); // propagate the signal. Other things might rely on it + } + if ( oldhandler != SIG_ERR ) signal( SIGTERM, oldhandler ); + + return ok && l; +} + +ThumbCreator::Flags GSCreator::flags() const +{ + return static_cast(DrawFrame); +} + +void GSCreator::comment(Name name) +{ + switch (name) { + case EndPreview: + case BeginProlog: + case Page: + endComments = true; + break; + + default: + break; + } +} + +// Quick function to check if the filename corresponds to a valid DVI +// file. Returns true if is a DVI file, false otherwise. + +static bool correctDVI(const TQString& filename) +{ + TQFile f(filename); + if (!f.open(IO_ReadOnly)) + return FALSE; + + unsigned char test[4]; + if ( f.readBlock( (char *)test,2)<2 || test[0] != 247 || test[1] != 2 ) + return FALSE; + + int n = f.size(); + if ( n < 134 ) // Too short for a dvi file + return FALSE; + f.at( n-4 ); + + unsigned char trailer[4] = { 0xdf,0xdf,0xdf,0xdf }; + + if ( f.readBlock( (char *)test, 4 )<4 || strncmp( (char *)test, (char*) trailer, 4 ) ) + return FALSE; + // We suppose now that the dvi file is complete and OK + return TRUE; +} + +bool GSCreator::getEPSIPreview(const TQString &path, long start, long + end, TQImage &outimg, int imgwidth, int imgheight) +{ + FILE *fp; + fp = fopen(TQFile::encodeName(path), "r"); + if (fp == 0) return false; + + const long previewsize = end - start + 1; + + char *buf = (char *) malloc(previewsize); + fseek(fp, start, SEEK_SET); + int count = fread(buf, sizeof(char), previewsize - 1, fp); + fclose(fp); + buf[previewsize - 1] = 0; + if (count != previewsize - 1) + { + free(buf); + return false; + } + + TQString previewstr = TQString::fromLatin1(buf); + free(buf); + + int offset = 0; + while ((offset < previewsize) && !(previewstr[offset].isDigit())) offset++; + int digits = 0; + while ((offset + digits < previewsize) && previewstr[offset + digits].isDigit()) digits++; + int width = previewstr.mid(offset, digits).toInt(); + offset += digits + 1; + while ((offset < previewsize) && !(previewstr[offset].isDigit())) offset++; + digits = 0; + while ((offset + digits < previewsize) && previewstr[offset + digits].isDigit()) digits++; + int height = previewstr.mid(offset, digits).toInt(); + offset += digits + 1; + while ((offset < previewsize) && !(previewstr[offset].isDigit())) offset++; + digits = 0; + while ((offset + digits < previewsize) && previewstr[offset + digits].isDigit()) digits++; + int depth = previewstr.mid(offset, digits).toInt(); + + // skip over the rest of the BeginPreview comment + while ((offset < previewsize) && + previewstr[offset] != '\n' && + previewstr[offset] != '\r') offset++; + while ((offset < previewsize) && previewstr[offset] != '%') offset++; + + unsigned int imagedepth; + switch (depth) { + case 1: + case 2: + case 4: + case 8: + imagedepth = 8; + break; + case 12: // valid, but not (yet) supported + default: // illegal value + return false; + } + + unsigned int colors = (1U << depth); + TQImage img(width, height, imagedepth, colors); + img.setAlphaBuffer(false); + + if (imagedepth <= 8) { + for (unsigned int gray = 0; gray < colors; gray++) { + unsigned int grayvalue = (255U * (colors - 1 - gray)) / + (colors - 1); + img.setColor(gray, tqRgb(grayvalue, grayvalue, grayvalue)); + } + } + + const unsigned int bits_per_scan_line = width * depth; + unsigned int bytes_per_scan_line = bits_per_scan_line / 8; + if (bits_per_scan_line % 8) bytes_per_scan_line++; + const unsigned int bindatabytes = height * bytes_per_scan_line; + TQMemArray bindata(bindatabytes); + + for (unsigned int i = 0; i < bindatabytes; i++) { + if (offset >= previewsize) + return false; + + while (!isxdigit(previewstr[offset].latin1()) && + offset < previewsize) + offset++; + + bool ok = false; + bindata[i] = static_cast(previewstr.mid(offset, 2).toUInt(&ok, 16)); + if (!ok) + return false; + + offset += 2; + } + + for (int scanline = 0; scanline < height; scanline++) { + unsigned char *scanlineptr = img.scanLine(scanline); + + for (int pixelindex = 0; pixelindex < width; pixelindex++) { + unsigned char pixelvalue = 0; + const unsigned int bitoffset = + scanline * bytes_per_scan_line * 8U + pixelindex * depth; + for (int depthindex = 0; depthindex < depth; + depthindex++) { + const unsigned int byteindex = (bitoffset + depthindex) / 8U; + const unsigned int bitindex = + 7 - ((bitoffset + depthindex) % 8U); + const unsigned char bitvalue = + (bindata[byteindex] & static_cast(1U << bitindex)) >> bitindex; + pixelvalue |= (bitvalue << depthindex); + } + scanlineptr[pixelindex] = pixelvalue; + } + } + + outimg = img.convertDepth(32).smoothScale(imgwidth, imgheight); + + return true; +} diff --git a/tdefile-plugins/ps/gscreator.h b/tdefile-plugins/ps/gscreator.h new file mode 100644 index 00000000..b155bfa7 --- /dev/null +++ b/tdefile-plugins/ps/gscreator.h @@ -0,0 +1,42 @@ +/* This file is part of the KDE libraries + Copyright (C) 2000 Malte Starostik + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _GSCREATOR_H_ +#define _GSCREATOR_H_ + +#include +#include "dscparse_adapter.h" + +class GSCreator : public ThumbCreator, public KDSCCommentHandler +{ +public: + GSCreator() {}; + virtual bool create(const TQString &path, int, int, TQImage &img); + virtual Flags flags() const; + void comment(Name name); + +private: + static bool getEPSIPreview(const TQString &path, + long start, long end, + TQImage &outimg, + int imgwidth, int imgheight); + bool endComments; +}; + +#endif diff --git a/tdefile-plugins/ps/gsthumbnail.desktop b/tdefile-plugins/ps/gsthumbnail.desktop new file mode 100644 index 00000000..903f3447 --- /dev/null +++ b/tdefile-plugins/ps/gsthumbnail.desktop @@ -0,0 +1,60 @@ +[Desktop Entry] +Type=Service +Name=PostScript, PDF and DVI Files +Name[ar]=ملفات الــ PostScript ، PDF و DVI +Name[br]=Restroù PostScript, PDF ha DVI +Name[bs]=Postscript, PDF i DVI datoteke +Name[ca]=Fitxers PostScript, PDF i DVI +Name[cs]=Postscriptové, PDF a DVI soubory +Name[cy]=Ffeiliau PostScript, PDF a DVI +Name[da]=PostScript, PDF- og DVI-filer +Name[de]=PostScript-, PDF- und DVI-Dateien +Name[el]=Αρχεία PostScript, PDF και DVI +Name[eo]=Postskriptaj, PDF- kaj DVI-dosieroj +Name[es]=Archivos PostScript, PDF y DVI +Name[et]=PostScript-, PDF- ja DVI-failid +Name[eu]=PostScript, PDF eta DVI fitxategiak +Name[fa]=پرونده‌های PostScript، PDF و DVI +Name[fi]=PostScript-, PDF- ja DVI-tiedostot +Name[fr]=Fichiers PostScript, PDF et DVI +Name[ga]=Comhaid PostScript, PDF agus DVI +Name[gl]=Ficheiros PostScript, PDF e DVI +Name[he]=קבצי PostScript, PDF ו־DVI +Name[hu]=PostScript-, PDF- és DVI-fájlok +Name[is]=PostScript PDF og DVI skrár +Name[it]=File PostScript, PDF e DVI +Name[ja]=Postscript,PDF,DVIファイル +Name[kk]=PostScript, PDF және DVI файлдары +Name[km]=ឯកសារ PostScript, PDF និង DVI +Name[lt]=Postscript, PDF ir DVI bylos +Name[ms]=PostScript, PDF dan Fail DVI +Name[nb]=PostScript, PDF og DVI filer +Name[nds]=PostScript-, PDF- un DVI-Dateien +Name[ne]=पोष्टस्क्रिप्ट, PDF र DVI फाइल +Name[nl]=PostScript-, DVI- en PDF-bestanden +Name[nn]=PostScript-, PDF- og DVI-filer +Name[pl]=Pliki PostScript, PDF i DVI +Name[pt]=Ficheiros PostScript, PDF e DVI +Name[pt_BR]=Arquivos PostScript, PDF e DVI +Name[ro]=Fişiere PostScript, PDF şi DVI +Name[ru]=Файлы PostScript, PDF и DVI +Name[se]=PostScript-, PDF- ja DVI-fiillat +Name[sk]=PostScript, PDF a DVI súbory +Name[sl]=Datoteke PostScript, PDF in DVI +Name[sr]=PostScript, PDF и DVI фајлови +Name[sr@Latn]=PostScript, PDF i DVI fajlovi +Name[sv]=Postscript, PDF och DVI-filer +Name[ta]= போஸ்ட்கிரிப்ட், பிடிஃப் மற்றும் டிவிஐ கோப்புகள் +Name[tg]=Файлҳои PostScript, PDF ва DVI +Name[th]=แฟ้ม PDF, DVI และ โพสต์สคริปต์ +Name[tr]=PostScript, PDF ve DVI Dosyaları +Name[uk]=Файли PostScript, PDF та DVI +Name[uz]=PostScript, PDF va DVI fayllari +Name[uz@cyrillic]=PostScript, PDF ва DVI файллари +Name[zh_CN]=PostScript、PDF 和 DVI 文件 +Name[zh_HK]=PostScript 、PDF 及 DVI 檔案 +Name[zh_TW]=PostScript,PDF 與 DVI 檔 +ServiceTypes=ThumbCreator +MimeTypes=application/x-dvi,application/postscript,application/pdf,image/x-eps +X-TDE-Library=gsthumbnail +CacheThumbnail=true diff --git a/tdefile-plugins/ps/tdefile_ps.cpp b/tdefile-plugins/ps/tdefile_ps.cpp new file mode 100644 index 00000000..87161176 --- /dev/null +++ b/tdefile-plugins/ps/tdefile_ps.cpp @@ -0,0 +1,124 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Wilco Greven + * + * 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 "tdefile_ps.h" + +#include + +#include +#include +#include + +typedef KGenericFactory PSFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_ps, PSFactory("tdefile_ps")) + +KPSPlugin::KPSPlugin(TQObject *parent, const char *name, + const TQStringList &preferredItems) : + KFilePlugin( parent, name, preferredItems ) +{ + kdDebug(7034) << "ps plugin\n"; + + // set up our mimetypes + makeMimeTypeInfo( "application/postscript" ); + makeMimeTypeInfo( "image/x-eps" ); +} + +void KPSPlugin::makeMimeTypeInfo( const char* mimeType ) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( mimeType ); + + // general group + KFileMimeTypeInfo::GroupInfo* group = addGroupInfo(info, "General", i18n("General")); + addItemInfo(group, "Title", i18n("Title"), TQVariant::String); + addItemInfo(group, "Creator", i18n("Creator"), TQVariant::String); + addItemInfo(group, "CreationDate", i18n("Creation Date"), TQVariant::String); + addItemInfo(group, "For", i18n("For"), TQVariant::String); + addItemInfo(group, "Pages", i18n("Pages"), TQVariant::UInt); +} + +bool KPSPlugin::readInfo( KFileMetaInfo& info, uint /* what */) +{ + _info = info; + _group = appendGroup(info, "General"); + _endComments = false; + _setData = 0; + + _dsc = new KDSC; + _dsc->setCommentHandler( this ); + FILE* fp = fopen( TQFile::encodeName( info.path() ), "r" ); + if( fp == 0 ) + return false; + + char buf[4096]; + int count; + while( ( count = fread( buf, sizeof(char), sizeof( buf ), fp ) ) ) { + if ( !_dsc->scanData( buf, count ) ) break; + if ( _endComments || _setData == 5 ) break; // Change if new item scanned + } + fclose( fp ); + delete _dsc; + _dsc = 0; + + return _setData > 0; +} + +void KPSPlugin::comment( Name name ) +{ + switch( name ) + { + case Title: + appendItem(_group, "Title", _dsc->dsc_title()); + ++_setData; + break; + case Creator: + appendItem(_group, "Creator", _dsc->dsc_creator()); + ++_setData; + break; + case CreationDate: + appendItem(_group, "CreationDate", _dsc->dsc_date()); + ++_setData; + break; + case For: + appendItem(_group, "For", _dsc->dsc_for()); + ++_setData; + break; + case Pages: { + int pages = _dsc->page_pages(); + if (pages) + { + appendItem(_group, "Pages", pages); + ++_setData; + } + } + break; + + // Right now we watch for 5 elements: + // Title, Creator, CreationDate, For, Pages + // + // If you add another one(s), please update the 5 in "_setData == 5" above + // + case EndComments: _endComments = true; + default: ; // Ignore + } +} + +#include "tdefile_ps.moc" + diff --git a/tdefile-plugins/ps/tdefile_ps.desktop b/tdefile-plugins/ps/tdefile_ps.desktop new file mode 100644 index 00000000..ec863b8a --- /dev/null +++ b/tdefile-plugins/ps/tdefile_ps.desktop @@ -0,0 +1,66 @@ +[Desktop Entry] +Type=Service +Name=PostScript Info +Name[af]=Postscript Inligting +Name[ar]=معلومات PostScript +Name[br]=Procinfo PostScript +Name[ca]=Informació de PostScript +Name[cs]=PostScript info +Name[cy]=Gwybodaeth PostScript +Name[da]=PostScript-info +Name[de]=PostScript-Info +Name[el]=Πληροφορίες PostScript +Name[eo]=Postskriptinformo +Name[es]=Info PostScript +Name[et]=PostScript info +Name[fa]=اطلاعات PostScript +Name[fi]=PostScript-tiedot +Name[fr]=Informations PostScript +Name[gl]=Inf. PostScript +Name[he]=מידע PostScript +Name[hi]=पोस्टस्क्रिप्ट जानकारी +Name[hr]=Postscript informacije +Name[hu]=PostScript-jellemzők +Name[is]=PostScript upplýsingar +Name[it]=Informazioni PostScript +Name[ja]=PostScript 情報 +Name[kk]=PostScript мәліметі +Name[km]=ព័ត៌មាន PostScript +Name[lt]=PostScript informacija +Name[lv]=Postscript Info +Name[ms]=Maklumat PostScript +Name[nb]=PostScript-info +Name[nds]=PostScript-Info +Name[ne]=पोष्टस्क्रिप्ट सूचना +Name[nl]=PostScript-info +Name[nn]=PostScript-info +Name[nso]=Tshedimoso ya PostScript +Name[pa]=PostScript ਜਾਣਕਾਰੀ +Name[pl]=Informacja o pliku PostScriptu +Name[pt]=Informação do PostScript +Name[pt_BR]=Informação sobre PostScript +Name[ro]=Informaţii PostScript +Name[ru]=Информация о PostScript +Name[se]=PostScript-dieđut +Name[sl]=Podatki o PostScriptu +Name[sr]=PostScript информације +Name[sr@Latn]=PostScript informacije +Name[sv]=Postscript-information +Name[ta]=முன் எழுத்தாக்க தகவல் +Name[tg]=Иттилоот оиди PostScript +Name[th]=ข้อมูลโพสต์สคริปต์ +Name[tr]=PostScript Bilgisi +Name[uk]=Інформація про PostScript +Name[uz]=PostScript haqida maʼlumot +Name[uz@cyrillic]=PostScript ҳақида маълумот +Name[ven]=Mafhungo a mabammbiri a poso +Name[wa]=Informåcion sol documint PostScript +Name[xh]=Ulwazi Lwe PostScript +Name[zh_CN]=PostScript 信息 +Name[zh_HK]=PostScript 資訊 +Name[zh_TW]=PostScript 資訊 +Name[zu]=Ulwazi Lwesi-PostScript +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_ps +MimeType=application/postscript;image/x-eps +PreferredItems=Title,Creator,CreationDate,For,Pages diff --git a/tdefile-plugins/ps/tdefile_ps.h b/tdefile-plugins/ps/tdefile_ps.h new file mode 100644 index 00000000..1b095bdc --- /dev/null +++ b/tdefile-plugins/ps/tdefile_ps.h @@ -0,0 +1,51 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Wilco Greven + * + * 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_PS_H__ +#define __KFILE_PS_H__ + +#include + +#include "dscparse_adapter.h" + +class TQStringList; + +class KPSPlugin: public KFilePlugin, public KDSCCommentHandler +{ + Q_OBJECT + +public: + KPSPlugin( TQObject *parent, const char *name, + const TQStringList& preferredItems ); + + virtual bool readInfo( KFileMetaInfo& info, uint what); + + void comment( Name ); + void makeMimeTypeInfo( const char* mimeType ); + +private: + KFileMetaInfo _info; + KFileMetaInfoGroup _group; + KDSC* _dsc; + bool _endComments; + int _setData; +}; + +#endif diff --git a/tdefile-plugins/raw/CMakeLists.txt b/tdefile-plugins/raw/CMakeLists.txt new file mode 100644 index 00000000..80810e07 --- /dev/null +++ b/tdefile-plugins/raw/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_raw.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +#### tdefile_raw (module) ######################### + +tde_add_kpart( tdefile_raw AUTOMOC + SOURCES kcamerarawplugin.cpp parse.c + LINK tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/raw/Makefile.am b/tdefile-plugins/raw/Makefile.am new file mode 100644 index 00000000..196aa4bd --- /dev/null +++ b/tdefile-plugins/raw/Makefile.am @@ -0,0 +1,19 @@ +## Makefile.am for the raw thumbnail extration plugin + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# these are the headers for your project +noinst_HEADERS = kcamerarawplugin.h + +kde_module_LTLIBRARIES = tdefile_raw.la + +tdefile_raw_la_SOURCES = kcamerarawplugin.cpp parse.c +tdefile_raw_la_LIBADD = $(LIB_KIO) +tdefile_raw_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +services_DATA = tdefile_raw.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/raw/kcamerarawplugin.cpp b/tdefile-plugins/raw/kcamerarawplugin.cpp new file mode 100644 index 00000000..a7a0cb27 --- /dev/null +++ b/tdefile-plugins/raw/kcamerarawplugin.cpp @@ -0,0 +1,141 @@ +/* This file is part of the KDE project + * Copyright (C) Steffen Hansen + * + * 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 "kcamerarawplugin.h" + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +typedef KGenericFactory RawFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_raw, RawFactory("tdefile_raw")) + +#ifndef KDE_EXPORT +# define KDE_EXPORT +#endif + +/* Main entry point into raw parser */ +extern "C" { + int extract_thumbnail( FILE*, FILE*, int* ); + extern char make[]; + extern char model[]; +} + +bool KCameraRawPlugin::createPreview(const TQString &path, TQImage &img) +{ + /* Open file and extract thumbnail */ + FILE* input = fopen( TQFile::encodeName(path), "rb" ); + if( !input ) return false; + KTempFile output; + output.setAutoDelete(true); + int orientation = 0; + if( extract_thumbnail( input, output.fstream(), &orientation ) ) { + fclose(input); + return false; + } + fclose(input); + output.close(); + if( !img.load( output.name() ) ) return false; + + if(orientation) { + TQWMatrix M; + TQWMatrix flip= TQWMatrix(-1,0,0,1,0,0); + switch(orientation+1) { // notice intentional fallthroughs + case 2: M = flip; break; + case 4: M = flip; + case 3: M.rotate(180); break; + case 5: M = flip; + case 6: M.rotate(90); break; + case 7: M = flip; + case 8: M.rotate(270); break; + default: break; // should never happen + } + img = img.xForm(M); + } + return true; +} + +KCameraRawPlugin::KCameraRawPlugin(TQObject *parent, const char *name, + const TQStringList &args ) + : KFilePlugin(parent, name, args) +{ + kdDebug(7034) << "KCameraRawPlugin c'tor" << endl; + + // + // define all possible meta info items + // + KFileMimeTypeInfo *info = addMimeTypeInfo("image/x-raw"); + KFileMimeTypeInfo::GroupInfo *group = addGroupInfo( info, "Info", + i18n("Image Info") ); + KFileMimeTypeInfo::ItemInfo* item; + + item = addItemInfo( group, "Manufacturer", i18n("Camera Manufacturer"), + TQVariant::String ); + item = addItemInfo( group, "Model", i18n("Camera Model"), + TQVariant::String ); + item = addItemInfo( group, "Thumbnail", i18n("Thumbnail"), + TQVariant::Image ); + setHint( item, KFileMimeTypeInfo::Thumbnail ); +} + +bool KCameraRawPlugin::readInfo( KFileMetaInfo& info, uint what ) +{ + kdDebug(7034) << "KCameraRawPlugin::readInfo()" << endl; + + const TQString path( info.path() ); + if ( path.isEmpty() ) // remote file + return false; + + KFileMetaInfoGroup group = appendGroup( info, "Info" ); + if ( what & KFileMetaInfo::Thumbnail ){ + TQImage img; + if( createPreview( path,img ) ) { + appendItem( group, "Thumbnail", img ); + kdDebug(7034) << "thumbnail " << path << " created" << endl; + } + } else { + // HACK: We have to extract thumbnail to get any info... + TQImage img; + createPreview( path,img ); + } + kdDebug(7034) << "make=" << make << endl; + kdDebug(7034) << "model=" << model << endl; + if( make[0] ) { + appendItem( group, "Manufacturer", &make[0] ); + } + if( model[0] ) { + appendItem( group, "Model", &model[0] ); + } + + return true; +} + +#include "kcamerarawplugin.moc" diff --git a/tdefile-plugins/raw/kcamerarawplugin.h b/tdefile-plugins/raw/kcamerarawplugin.h new file mode 100644 index 00000000..d16446e8 --- /dev/null +++ b/tdefile-plugins/raw/kcamerarawplugin.h @@ -0,0 +1,39 @@ +/* This file is part of the KDE project + * Copyright (C) 2005 Steffen Hansen + * + * 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 KCAMERARAWPLUGIN_H +#define KCAMERARAWPLUGIN_H + +#include + +class TQImage; + +class KCameraRawPlugin: public KFilePlugin { + Q_OBJECT + + +public: + KCameraRawPlugin(TQObject *parent, const char *name, const TQStringList& args); + virtual bool readInfo(KFileMetaInfo& info, uint what); + +private: + bool createPreview(const TQString &path, TQImage &img); +}; + +#endif /* KCAMERARAWPLUGIN_H */ diff --git a/tdefile-plugins/raw/parse.c b/tdefile-plugins/raw/parse.c new file mode 100644 index 00000000..a256f04e --- /dev/null +++ b/tdefile-plugins/raw/parse.c @@ -0,0 +1,1080 @@ +/* + Raw Photo Parser + Copyright 2004 by Dave Coffin, dcoffin a cybercom o net + + This program extracts thumbnail images (preferably JPEGs) + from any raw digital camera formats that have them, and + shows table contents. + + $Revision: 1.36 $ + $Date: 2005/05/10 21:43:10 $ + */ + +/* Hacked for thumbnail extraction in KDE by + Steffen Hansen + + Based on parse.c and parts of dcraw.c by Dave Coffin +*/ + +#include +#include +#include +#include +#include +#include + +#ifdef WIN32 +#include +typedef __int64 INT64; +#else +#include +typedef long long INT64; +#endif + +/* + TIFF and CIFF data blocks can be quite large. + Display only the first DLEN bytes. + */ +#ifndef DLEN +#define DLEN 768 +#endif + +typedef unsigned char uchar; +/*typedef unsigned short ushort;*/ + +FILE *ifp; +short order; +char *fname; +char make[128], model[128], model2[128], thumb_head[128]; +int width, height, offset, length, bps, is_dng; +int thumb_offset, thumb_length, thumb_layers; +float cam_mul[4], pre_mul[4], coeff[3][4]; +#define camera_red cam_mul[0] +#define camera_blue cam_mul[2] +/*float flash_used, canon_5814;*/ +time_t timestamp; +/*int data_offset, meta_offset*/ +int raw_height, raw_width, top_margin, left_margin; +static int flip = 0; + +struct decode { + struct decode *branch[2]; + int leaf; +} first_decode[640], *free_decode; + +#define CLASS + +#define FORC3 for (c=0; c < 3; c++) +#define FORC4 for (c=0; c < 4; c++) +#define FORCC for (c=0; c < colors; c++) + +/* + Get a 2-byte integer, making no assumptions about CPU byte order. + Nor should we assume that the compiler evaluates left-to-right. + */ +ushort get2() +{ + uchar a, b; + + a = fgetc(ifp); b = fgetc(ifp); + + if (order == 0x4949) /* "II" means little-endian */ + return a | b << 8; + else /* "MM" means big-endian */ + return a << 8 | b; +} + +/* + Same for a 4-byte integer. + */ +int get4() +{ + uchar a, b, c, d; + + a = fgetc(ifp); b = fgetc(ifp); + c = fgetc(ifp); d = fgetc(ifp); + + if (order == 0x4949) + return a | b << 8 | c << 16 | d << 24; + else + return a << 24 | b << 16 | c << 8 | d; +} + +void tiff_dump(int base, int tag, int type, int count, int level) +{ + int save, j, num, den; + uchar c; + int size[] = { 1,1,1,2,4,8,1,1,2,4,8,4,8 }; + + if (count * size[type < 13 ? type:0] > 4) + fseek (ifp, get4()+base, SEEK_SET); + save = ftell(ifp); + fseek (ifp, save, SEEK_SET); +} + +void nikon_decrypt (uchar ci, uchar cj, int tag, int i, int size, uchar *buf) +{ +} + +int parse_tiff_ifd (int base, int level); + +void nef_parse_makernote (base) +{ + int offset=0, entries, tag, type, count, val, save; + unsigned serial=0, key=0; + uchar buf91[630], buf97[608], buf98[31]; + short sorder; + char buf[10]; + +/* + The MakerNote might have its own TIFF header (possibly with + its own byte-order!), or it might just be a table. + */ + sorder = order; + fread (buf, 1, 10, ifp); + if (!strcmp (buf,"Nikon")) { /* starts with "Nikon\0\2\0\0\0" ? */ + base = ftell(ifp); + order = get2(); /* might differ from file-wide byteorder */ + val = get2(); /* should be 42 decimal */ + offset = get4(); + fseek (ifp, offset-8, SEEK_CUR); + } else if (!strncmp (buf,"FUJIFILM",8) || + !strcmp (buf,"Panasonic")) { + order = 0x4949; + fseek (ifp, 2, SEEK_CUR); + } else if (!strcmp (buf,"OLYMP") || + !strcmp (buf,"LEICA") || + !strcmp (buf,"EPSON")) + fseek (ifp, -2, SEEK_CUR); + else if (!strcmp (buf,"AOC")) + fseek (ifp, -4, SEEK_CUR); + else + fseek (ifp, -10, SEEK_CUR); + + entries = get2(); + if (entries > 100) return; + while (entries--) { + save = ftell(ifp); + tag = get2(); + type = get2(); + count= get4(); + tiff_dump (base, tag, type, count, 2); + if (tag == 0x1d) + fscanf (ifp, "%d", &serial); + if (tag == 0x91) + fread (buf91, sizeof buf91, 1, ifp); + if (tag == 0x97) + fread (buf97, sizeof buf97, 1, ifp); + if (tag == 0x98) + fread (buf98, sizeof buf98, 1, ifp); + if (tag == 0xa7) + key = fgetc(ifp)^fgetc(ifp)^fgetc(ifp)^fgetc(ifp); + + if (tag == 0x100 && type == 7 && !strncmp(make,"OLYMPUS",7)) { + thumb_offset = ftell(ifp); + thumb_length = count; + } + if (tag == 0x280 && type == 1) { /* EPSON */ + strncpy (thumb_head, "\xff", sizeof(thumb_head) ); + thumb_offset = ftell(ifp)+1; + thumb_length = count-1; + } + if (strstr(make,"Minolta") || strstr(make,"MINOLTA")) { + switch (tag) { + case 0x81: + thumb_offset = ftell(ifp); + thumb_length = count; + break; + case 0x88: + thumb_offset = get4() + base; + break; + case 0x89: + thumb_length = get4(); + } + } + if (!strcmp (buf,"OLYMP") && tag >> 8 == 0x20) + parse_tiff_ifd (base, 3); + fseek (ifp, save+12, SEEK_SET); + } + nikon_decrypt (serial, key, 0x91, 4, sizeof buf91, buf91); + nikon_decrypt (serial, key, 0x97, 284, sizeof buf97, buf97); + nikon_decrypt (serial, key, 0x98, 4, sizeof buf98, buf98); + order = sorder; +} + +void nef_parse_exif(int base) +{ + int entries, tag, type, count, save; + + entries = get2(); + while (entries--) { + save = ftell(ifp); + tag = get2(); + type = get2(); + count= get4(); + tiff_dump (base, tag, type, count, 1); + if (tag == 0x927c) + nef_parse_makernote (base); + fseek (ifp, save+12, SEEK_SET); + } +} + +int parse_tiff_ifd (int base, int level) +{ + int entries, tag, type, count, slen, save, save2, val, i; + int comp=0; + static const int flip_map[] = { 0,1,3,2,4,6,7,5 }; + + entries = get2(); + if (entries > 255) return 1; + while (entries--) { + save = ftell(ifp); + tag = get2(); + type = get2(); + count= get4(); + slen = count; + if (slen > 128) slen = 128; + + tiff_dump (base, tag, type, count, level); + + save2 = ftell(ifp); + if (type == 3) /* short int */ + val = get2(); + else + val = get4(); + fseek (ifp, save2, SEEK_SET); + + if (tag > 50700 && tag < 50800) + is_dng = 1; + + if (level == 3) { /* Olympus E-1 and E-300 */ + if (type == 4) { + if (tag == 0x101) + thumb_offset = val; + else if (tag == 0x102) + thumb_length = val; + } + goto cont; + } + switch (tag) { + case 0x100: /* ImageWidth */ + if (!width) width = val; + break; + case 0x101: /* ImageHeight */ + if (!height) height = val; + break; + case 0x102: /* Bits per sample */ + if (bps) break; + bps = val; + if (count == 1) + thumb_layers = 1; + break; + case 0x103: /* Compression */ + comp = val; + break; + case 0x10f: /* Make tag */ + fgets (make, slen, ifp); + break; + case 0x110: /* Model tag */ + fgets (model, slen, ifp); + break; + case 33405: /* Model2 tag */ + fgets (model2, slen, ifp); + break; + case 0x111: /* StripOffset */ + if (!offset || is_dng) offset = val; + break; + case 0x112: /* Qt::Orientation */ + flip = flip_map[(val-1) & 7]; + break; + case 0x117: /* StripByteCounts */ + if (!length || is_dng) length = val; + if (offset > val && !strncmp(make,"KODAK",5) && !is_dng) + offset -= val; + break; + case 0x14a: /* SubIFD tag */ + save2 = ftell(ifp); + for (i=0; i < count; i++) { + fseek (ifp, save2 + i*4, SEEK_SET); + fseek (ifp, get4()+base, SEEK_SET); + parse_tiff_ifd (base, level+1); + } + break; + case 0x201: + if (strncmp(make,"OLYMPUS",7) || !thumb_offset) + thumb_offset = val; + break; + case 0x202: + if (strncmp(make,"OLYMPUS",7) || !thumb_length) + thumb_length = val; + break; + case 34665: + fseek (ifp, get4()+base, SEEK_SET); + nef_parse_exif (base); + break; + case 50706: + is_dng = 1; + } +cont: + fseek (ifp, save+12, SEEK_SET); + } + if ((comp == 6 && !strcmp(make,"Canon")) || + (comp == 7 && is_dng)) { + thumb_offset = offset; + thumb_length = length; + } + return 0; +} + +/* + Parse a TIFF file looking for camera model and decompress offsets. + */ +void parse_tiff (int base) +{ + int doff, spp=3, ifd=0; + + width = height = offset = length = bps = is_dng = 0; + fseek (ifp, base, SEEK_SET); + order = get2(); + if (order != 0x4949 && order != 0x4d4d) return; + get2(); + while ((doff = get4())) { + fseek (ifp, doff+base, SEEK_SET); + printf ("IFD #%d:\n", ifd++); + if (parse_tiff_ifd (base, 0)) break; + } + if (is_dng) return; + + if (strncmp(make,"KODAK",5)) + thumb_layers = 0; + if (!strncmp(make,"Kodak",5)) { + fseek (ifp, 12+base, SEEK_SET); + puts ("\nSpecial Kodak image directory:"); + parse_tiff_ifd (base, 0); + } + if (!strncmp(model,"DCS460A",7)) { + spp = 1; + thumb_layers = 0; + } + if (!thumb_length && offset) { + thumb_offset = offset; + sprintf (thumb_head, "P%d %d %d %d\n", + spp > 1 ? 6:5, width, height, (1 << bps) - 1); + thumb_length = width * height * spp * ((bps+7)/8); + } +} + +void parse_minolta() +{ + int data_offset, save, tag, len; + + fseek (ifp, 4, SEEK_SET); + data_offset = get4() + 8; + while ((save=ftell(ifp)) < data_offset) { + tag = get4(); + len = get4(); + printf ("Tag %c%c%c offset %06x length %06x\n", + tag>>16, tag>>8, tag, save, len); + switch (tag) { + case 0x545457: /* TTW */ + parse_tiff (ftell(ifp)); + } + fseek (ifp, save+len+8, SEEK_SET); + } + strncpy (thumb_head, "\xff", sizeof(thumb_head) ); + thumb_offset++; + thumb_length--; +} + +/* + Parse a CIFF file, better known as Canon CRW format. + */ +void parse_ciff (int offset, int length, int level /*unused*/) +{ + int tboff, nrecs, i, c, type, len, roff, aoff, save, wbi=-1; + static const int remap[] = { 1,2,3,4,5,1 }; + static const int remap_10d[] = { 0,1,3,4,5,6,0,0,2,8 }; + static const int remap_s70[] = { 0,1,2,9,4,3,6,7,8,9,10,0,0,0,7,0,0,8 }; + ushort key[] = { 0x410, 0x45f3 }; + + if (strcmp(model,"Canon PowerShot G6") && + strcmp(model,"Canon PowerShot S60") && + strcmp(model,"Canon PowerShot S70") && + strcmp(model,"Canon PowerShot Pro1")) + key[0] = key[1] = 0; + fseek (ifp, offset+length-4, SEEK_SET); + tboff = get4() + offset; + fseek (ifp, tboff, SEEK_SET); + nrecs = get2(); + if (nrecs > 100) return; + for (i = 0; i < nrecs; i++) { + type = get2(); + len = get4(); + roff = get4(); + aoff = offset + roff; + save = ftell(ifp); + if (type == 0x080a) { /* Get the camera make and model */ + fseek (ifp, aoff, SEEK_SET); + fread (make, 64, 1, ifp); + fseek (ifp, aoff+strlen(make)+1, SEEK_SET); + fread (model, 64, 1, ifp); + } + if (type == 0x102a) { /* Find the White Balance index */ + fseek (ifp, aoff+14, SEEK_SET); /* 0=auto, 1=daylight, 2=cloudy ... */ + wbi = get2(); + if (((!strcmp(model,"Canon EOS DIGITAL REBEL") || + !strcmp(model,"Canon EOS 300D DIGITAL"))) && wbi == 6) + wbi++; + } + if (type == 0x102c) { /* Get white balance (G2) */ + if (!strcmp(model,"Canon PowerShot G1") || + !strcmp(model,"Canon PowerShot Pro90 IS")) { + fseek (ifp, aoff+120, SEEK_SET); + FORC4 cam_mul[c ^ 2] = get2(); + } else { + fseek (ifp, aoff+100, SEEK_SET); + goto common; + } + } + if (type == 0x0032) { /* Get white balance (D30 & G3) */ + if (!strcmp(model,"Canon EOS D30")) { + fseek (ifp, aoff+72, SEEK_SET); +common: + camera_red = get2() ^ key[0]; + camera_red =(get2() ^ key[1]) / camera_red; + camera_blue = get2() ^ key[0]; + camera_blue /= get2() ^ key[1]; + } else if (!strcmp(model,"Canon PowerShot G6") || + !strcmp(model,"Canon PowerShot S60") || + !strcmp(model,"Canon PowerShot S70")) { + fseek (ifp, aoff+96 + remap_s70[wbi]*8, SEEK_SET); + goto common; + } else if (!strcmp(model,"Canon PowerShot Pro1")) { + fseek (ifp, aoff+96 + wbi*8, SEEK_SET); + goto common; + } else { + fseek (ifp, aoff+80 + (wbi < 6 ? remap[wbi]*8 : 0), SEEK_SET); + if (!camera_red) + goto common; + } + } + if (type == 0x10a9) { /* Get white balance (D60) */ + if (!strcmp(model,"Canon EOS 10D")) + wbi = remap_10d[wbi]; + fseek (ifp, aoff+2 + wbi*8, SEEK_SET); + camera_red = get2(); + camera_red /= get2(); + camera_blue = get2(); + camera_blue = get2() / camera_blue; + } + /* Skip this for now /steffen */ +#if 0 + if (type == 0x1030 && (wbi == 6 || wbi == 15)) { + fseek (ifp, aoff, SEEK_SET); /* Get white sample */ + ciff_block_1030(); + } +#endif + if (type == 0x1031) { /* Get the raw width and height */ + fseek (ifp, aoff+2, SEEK_SET); + raw_width = get2(); + raw_height = get2(); + } + if (type == 0x180e) { /* Get the timestamp */ + fseek (ifp, aoff, SEEK_SET); + timestamp = get4(); + } + if (type == 0x580e) + timestamp = len; +#if 0 + if (type == 0x5813) + flash_used = *((float *) &len); + if (type == 0x5814) + canon_5814 = *((float *) &len); +#endif + if (type == 0x1810) { /* Get the rotation */ + fseek (ifp, aoff+12, SEEK_SET); + flip = get4(); + } + /* Skip this for now /steffen */ +#if 0 + if (type == 0x1835) { /* Get the decoder table */ + fseek (ifp, aoff, SEEK_SET); + crw_init_tables (get4()); + } +#endif + if (type == 0x2007) { /* Found the JPEG thumbnail */ + thumb_offset = aoff; + thumb_length = len; + } + if (type >> 8 == 0x28 || type >> 8 == 0x30) /* Get sub-tables */ + parse_ciff(aoff, len, level+1); + fseek (ifp, save, SEEK_SET); + } + if (wbi == 0 && !strcmp(model,"Canon EOS D30")) + camera_red = -1; /* Use my auto WB for this photo */ +} + + +void parse_mos(int level) +{ + uchar data[256]; + int i, j, skip, save; + char *cp; + + save = ftell(ifp); + while (1) { + fread (data, 1, 8, ifp); + if (strcmp(data,"PKTS")) break; + strcpy (model, "Valeo"); + fread (data, 1, 40, ifp); + skip = get4(); + if (!strcmp(data,"icc_camera_to_tone_matrix")) { + for (i=0; i < skip/4; i++) { + j = get4(); + } + continue; + } + if (!strcmp(data,"JPEG_preview_data")) { + thumb_head[0] = 0; + thumb_offset = ftell(ifp); + thumb_length = skip; + } + fread (data, 1, sizeof data, ifp); + fseek (ifp, -sizeof data, SEEK_CUR); + data[sizeof data - 1] = 0; + while ((cp=index(data,'\n'))) + *cp = ' '; + parse_mos(level+2); + fseek (ifp, skip, SEEK_CUR); + } + fseek (ifp, save, SEEK_SET); +} + +void parse_rollei() +{ + char line[128], *val; + + fseek (ifp, 0, SEEK_SET); + do { + fgets (line, 128, ifp); + fputs (line, stdout); + if ((val = strchr(line,'='))) + *val++ = 0; + else + val = line + strlen(line); + if (!strcmp(line,"HDR")) + thumb_offset = atoi(val); + if (!strcmp(line,"TX ")) + width = atoi(val); + if (!strcmp(line,"TY ")) + height = atoi(val); + } while (strncmp(line,"EOHD",4)); + strcpy (make, "Rollei"); + strcpy (model, "d530flex"); + thumb_length = width*height*2; +} + +void rollei_decode (FILE *tfp) +{ + ushort data; + int row, col; + + fseek (ifp, thumb_offset, SEEK_SET); + fprintf (tfp, "P6\n%d %d\n255\n", width, height); + for (row=0; row < height; row++) + for (col=0; col < width; col++) { + fread (&data, 2, 1, ifp); + data = ntohs(data); + putc (data << 3, tfp); + putc (data >> 5 << 2, tfp); + putc (data >> 11 << 3, tfp); + } +} + +void get_utf8 (int offset, char *buf, int len) +{ + ushort c; + char *cp; + + fseek (ifp, offset, SEEK_SET); + for (cp=buf; (c = get2()) && cp+3 < buf+len; ) { + if (c < 0x80) + *cp++ = c; + else if (c < 0x800) { + *cp++ = 0xc0 + (c >> 6); + *cp++ = 0x80 + (c & 0x3f); + } else { + *cp++ = 0xe0 + (c >> 12); + *cp++ = 0x80 + (c >> 6 & 0x3f); + *cp++ = 0x80 + (c & 0x3f); + } + } + *cp = 0; +} + +ushort sget2 (uchar *s) +{ + return s[0] + (s[1]<<8); +} + +int sget4 (uchar *s) +{ + return s[0] + (s[1]<<8) + (s[2]<<16) + (s[3]<<24); +} + +void parse_foveon() +{ + int entries, img=0, off, len, tag, save, i, j, k, pent, poff[256][2]; + char name[128], value[128], camf[0x20000], *pos, *cp, *dp; + unsigned val, key, type, num, ndim, dim[3]; + + order = 0x4949; /* Little-endian */ + fseek (ifp, -4, SEEK_END); + fseek (ifp, get4(), SEEK_SET); + if (get4() != 0x64434553) { /* SECd */ + printf ("Bad Section identifier at %6x\n", (int)ftell(ifp)-4); + return; + } + get4(); + entries = get4(); + while (entries--) { + off = get4(); + len = get4(); + tag = get4(); + save = ftell(ifp); + fseek (ifp, off, SEEK_SET); + if (get4() != (0x20434553 | (tag << 24))) { + printf ("Bad Section identifier at %6x\n", off); + goto next; + } + val = get4(); + switch (tag) { + case 0x32414d49: /* IMA2 */ + case 0x47414d49: /* IMAG */ + if (++img == 2) { /* second image */ + thumb_offset = off; + thumb_length = 1; + } + printf ("type %d, " , get4()); + printf ("format %2d, " , get4()); + printf ("columns %4d, " , get4()); + printf ("rows %4d, " , get4()); + printf ("rowsize %d\n" , get4()); + break; + case 0x464d4143: /* CAMF */ + printf ("type %d, ", get4()); + get4(); + for (i=0; i < 4; i++) + putchar(fgetc(ifp)); + val = get4(); + printf (" version %d.%d:\n",val >> 16, val & 0xffff); + key = get4(); + if ((len -= 28) > 0x20000) + len = 0x20000; + fread (camf, 1, len, ifp); + for (i=0; i < len; i++) { + key = (key * 1597 + 51749) % 244944; + val = key * (INT64) 301593171 >> 24; + camf[i] ^= ((((key << 8) - val) >> 1) + val) >> 17; + } + for (pos=camf; (unsigned) (pos-camf) < len; pos += sget4(pos+8)) { + if (strncmp (pos, "CMb", 3)) { + printf("Bad CAMF tag \"%.4s\"\n", pos); + break; + } + val = sget4(pos+4); + printf (" %4.4s version %d.%d: ", pos, val >> 16, val & 0xffff); + switch (pos[3]) { + case 'M': + cp = pos + sget4(pos+16); + type = sget4(cp); + ndim = sget4(cp+4); + dim[0] = dim[1] = dim[2] = 1; + printf ("%d-dimensonal array %s of type %d:\n Key: (", + ndim, pos+sget4(pos+12), sget4(cp)); + dp = pos + sget4(cp+8); + for (i=ndim; i--; ) { + cp += 12; + dim[i] = sget4(cp); + printf ("%s %d%s", pos+sget4(cp+4), dim[i], i ? ", ":")\n"); + } + for (i=0; i < dim[2]; i++) { + for (j=0; j < dim[1]; j++) { + printf (" "); + for (k=0; k < dim[0]; k++) + switch (type) { + case 0: + case 6: + printf ("%7d", sget2(dp)); + dp += 2; + break; + case 1: + case 2: + printf (" %d", sget4(dp)); + dp += 4; + break; + case 3: { + union { int ival; float fval; } __t; + __t.ival = sget4(dp); + printf (" %9f", __t.fval); + dp += 4; + } + } + printf ("\n"); + } + printf ("\n"); + } + break; + case 'P': + val = sget4(pos+16); + num = sget4(pos+val); + printf ("%s, %d parameters:\n", pos+sget4(pos+12), num); + cp = pos+val+8 + num*8; + for (i=0; i < num; i++) { + val += 8; + printf (" %s = %s\n", cp+sget4(pos+val), cp+sget4(pos+val+4)); + } + break; + case 'T': + cp = pos + sget4(pos+16); + printf ("%s = %.*s\n", pos+sget4(pos+12), sget4(cp), cp+4); + break; + default: + printf ("\n"); + } + } + break; + case 0x504f5250: /* PROP */ + printf ("entries %d, ", pent=get4()); + printf ("charset %d, ", get4()); + get4(); + printf ("nchars %d\n", get4()); + off += pent*8 + 24; + if (pent > 256) pent=256; + for (i=0; i < pent*2; i++) + poff[0][i] = off + get4()*2; + for (i=0; i < pent; i++) { + get_utf8 (poff[i][0], name, 128); + get_utf8 (poff[i][1], value, 128); + printf (" %s = %s\n", name, value); + if (!strcmp (name,"CAMMANUF")) + strncpy (make, value, sizeof(make)); + if (!strcmp (name,"CAMMODEL")) + strncpy (model, value, sizeof(value)); + } + } +next: + fseek (ifp, save, SEEK_SET); + } +} + +void foveon_tree (unsigned huff[1024], unsigned code) +{ + struct decode *cur; + int i, len; + + cur = free_decode++; + if (code) { + for (i=0; i < 1024; i++) + if (huff[i] == code) { + cur->leaf = i; + return; + } + } + if ((len = code >> 27) > 26) return; + code = (len+1) << 27 | (code & 0x3ffffff) << 1; + + cur->branch[0] = free_decode; + foveon_tree (huff, code); + cur->branch[1] = free_decode; + foveon_tree (huff, code+1); +} + +void foveon_decode (FILE *tfp) +{ + int bwide, row, col, bit=-1, c, i; + char *buf; + struct decode *dindex; + short pred[3]; + unsigned huff[1024], bitbuf=0; + + fseek (ifp, thumb_offset+16, SEEK_SET); + width = get4(); + height = get4(); + bwide = get4(); + fprintf (tfp, "P6\n%d %d\n255\n", width, height); + if (bwide > 0) { + buf = malloc(bwide); + for (row=0; row < height; row++) { + fread (buf, 1, bwide, ifp); + fwrite (buf, 3, width, tfp); + } + free (buf); + return; + } + for (i=0; i < 256; i++) + huff[i] = get4(); + memset (first_decode, 0, sizeof first_decode); + free_decode = first_decode; + foveon_tree (huff, 0); + + for (row=0; row < height; row++) { + memset (pred, 0, sizeof pred); + if (!bit) get4(); + for (col=bit=0; col < width; col++) { + for (c=0; c < 3; c++) { + for (dindex=first_decode; dindex->branch[0]; ) { + if ((bit = (bit-1) & 31) == 31) + for (i=0; i < 4; i++) + bitbuf = (bitbuf << 8) + fgetc(ifp); + dindex = dindex->branch[bitbuf >> bit & 1]; + } + pred[c] += dindex->leaf; + fputc (pred[c], tfp); + } + } + } +} + +void kodak_yuv_decode (FILE *tfp) +{ + uchar c, blen[384]; + unsigned row, col, len, bits=0; + INT64 bitbuf=0; + int i, li=0, si, diff, six[6], y[4], cb=0, cr=0, rgb[3]; + ushort *out, *op; + + fseek (ifp, thumb_offset, SEEK_SET); + width = (width+1) & -2; + height = (height+1) & -2; + fprintf (tfp, "P6\n%d %d\n65535\n", width, height); + out = malloc (width * 12); + if (!out) { + fprintf (stderr, "kodak_yuv_decode() malloc failed!\n"); + exit(1); + } + + for (row=0; row < height; row+=2) { + for (col=0; col < width; col+=2) { + if ((col & 127) == 0) { + len = (width - col + 1) * 3 & -4; + if (len > 384) len = 384; + for (i=0; i < len; ) { + c = fgetc(ifp); + blen[i++] = c & 15; + blen[i++] = c >> 4; + } + li = bitbuf = bits = y[1] = y[3] = cb = cr = 0; + if (len % 8 == 4) { + bitbuf = fgetc(ifp) << 8; + bitbuf += fgetc(ifp); + bits = 16; + } + } + for (si=0; si < 6; si++) { + len = blen[li++]; + if (bits < len) { + for (i=0; i < 32; i+=8) + bitbuf += (INT64) fgetc(ifp) << (bits+(i^8)); + bits += 32; + } + diff = bitbuf & (0xffff >> (16-len)); + bitbuf >>= len; + bits -= len; + if ((diff & (1 << (len-1))) == 0) + diff -= (1 << len) - 1; + six[si] = diff; + } + y[0] = six[0] + y[1]; + y[1] = six[1] + y[0]; + y[2] = six[2] + y[3]; + y[3] = six[3] + y[2]; + cb += six[4]; + cr += six[5]; + for (i=0; i < 4; i++) { + op = out + ((i >> 1)*width + col+(i & 1)) * 3; + rgb[0] = y[i] + 1.40200/2 * cr; + rgb[1] = y[i] - 0.34414/2 * cb - 0.71414/2 * cr; + rgb[2] = y[i] + 1.77200/2 * cb; + for (c=0; c < 3; c++) + if (rgb[c] > 0) op[c] = htons(rgb[c]); + } + } + fwrite (out, sizeof *out, width*6, tfp); + } + free(out); +} + +void parse_phase_one (int base) +{ + unsigned entries, tag, type, len, data, save; + char str[256]; + + fseek (ifp, base + 8, SEEK_SET); + fseek (ifp, base + get4(), SEEK_SET); + entries = get4(); + get4(); + while (entries--) { + tag = get4(); + type = get4(); + len = get4(); + data = get4(); + save = ftell(ifp); + printf ("Phase One tag=0x%x, type=%d, len=%2d, data = 0x%x\n", + tag, type, len, data); + if (type == 1 && len < 256) { + fseek (ifp, base + data, SEEK_SET); + fread (str, 256, 1, ifp); + puts (str); + } + if (tag == 0x110) { + thumb_offset = data + base; + thumb_length = len; + } + fseek (ifp, save, SEEK_SET); + } + strcpy (make, "Phase One"); + strcpy (model, "unknown"); +} + +void parse_jpeg (int offset) +{ + int len, save, hlen; + + fseek (ifp, offset, SEEK_SET); + if (fgetc(ifp) != 0xff || fgetc(ifp) != 0xd8) return; + + while (fgetc(ifp) == 0xff && fgetc(ifp) >> 4 != 0xd) { + order = 0x4d4d; + len = get2() - 2; + save = ftell(ifp); + order = get2(); + hlen = get4(); + if (get4() == 0x48454150) /* "HEAP" */ + parse_ciff (save+hlen, len-hlen, 0); + parse_tiff (save+6); + fseek (ifp, save+len, SEEK_SET); + } +} + +char *raw_memmem (char *haystack, size_t haystacklen, + char *needle, size_t needlelen) +{ + char *c; + for (c = haystack; c <= haystack + haystacklen - needlelen; c++) + if (!memcmp (c, needle, needlelen)) + return c; + return NULL; +} + +/* + Identify which camera created this file, and set global variables + accordingly. + Return nonzero if the file cannot be decoded or no thumbnail is found + */ +int identify(FILE* tfp) +{ + char head[32], *thumb, *rgb, *cp; + unsigned hlen, fsize, toff, tlen, lsize, i; + + make[0] = model[0] = model2[0] = is_dng = 0; + thumb_head[0] = thumb_offset = thumb_length = thumb_layers = 0; + order = get2(); + hlen = get4(); + fseek (ifp, 0, SEEK_SET); + fread (head, 1, 32, ifp); + fseek (ifp, 0, SEEK_END); + fsize = ftell(ifp); + if ((cp = raw_memmem (head, 32, "MMMMRawT", 8)) || + (cp = raw_memmem (head, 32, "IIIITwaR", 8))) + parse_phase_one (cp - head); + else if (order == 0x4949 || order == 0x4d4d) { + if (!memcmp(head+6,"HEAPCCDR",8)) { + parse_ciff (hlen, fsize - hlen, 0); + fseek (ifp, hlen, SEEK_SET); + } else + parse_tiff (0); + } else if (!memcmp (head, "\0MRM", 4)) + parse_minolta(); + else if (!memcmp (head, "\xff\xd8\xff\xe1", 4) && + !memcmp (head+6, "Exif", 4)) { + parse_tiff (12); + thumb_length = 0; + } else if (!memcmp (head, "FUJIFILM", 8)) { + fseek (ifp, 84, SEEK_SET); + toff = get4(); + tlen = get4(); + thumb_offset = toff; + thumb_length = tlen; + } else if (!memcmp (head, "DSC-Image", 9)) + parse_rollei(); + else if (!memcmp (head, "FOVb", 4)) + parse_foveon(); + fseek (ifp, 8, SEEK_SET); + parse_mos(0); + fseek (ifp, 3472, SEEK_SET); + parse_mos(0); + parse_jpeg(0); + + if (!thumb_length) { + fprintf (stderr, "Thumbnail image not found\n"); + return -1; + } + + if (is_dng) goto dng_skip; + if (!strncmp(model,"DCS Pro",7)) { + kodak_yuv_decode (tfp); + goto done; + } + if (!strcmp(make,"Rollei")) { + rollei_decode (tfp); + goto done; + } + if (!strcmp(make,"SIGMA")) { + foveon_decode (tfp); + goto done; + } +dng_skip: + thumb = (char *) malloc(thumb_length); + if (!thumb) { + fprintf (stderr, "Cannot allocate %d bytes!!\n", thumb_length); + exit(1); + } + fseek (ifp, thumb_offset, SEEK_SET); + fread (thumb, 1, thumb_length, ifp); + if (thumb_layers && !is_dng) { + rgb = (char *) malloc(thumb_length); + if (!rgb) { + fprintf (stderr, "Cannot allocate %d bytes!!\n", thumb_length); + return -1; + } + lsize = thumb_length/3; + for (i=0; i < thumb_length; i++) + rgb[(i%lsize)*3 + i/lsize] = thumb[i]; + free(thumb); + thumb = rgb; + } + fputs (thumb_head, tfp); + fwrite(thumb, 1, thumb_length, tfp); + free (thumb); +done: + fprintf (stderr, "Thumbnail image written, make=%s, model=%s\n",&(make[0]),&(model[0])); + return 0; +} + +int extract_thumbnail( FILE* input, FILE* output, int* orientation ) +{ + /* Coffin's code has different meaning for orientation + values than TIFF, so we map them to TIFF values */ + static const int flip_map[] = { 0,1,3,2,4,7,5,6 }; + int rc; + ifp = input; + rc = identify(output); + switch ((flip+3600) % 360) { + case 270: flip = 5; break; + case 180: flip = 3; break; + case 90: flip = 6; + } + if( orientation ) *orientation = flip_map[flip%7]; + return rc; +} diff --git a/tdefile-plugins/raw/tdefile_raw.desktop b/tdefile-plugins/raw/tdefile_raw.desktop new file mode 100644 index 00000000..cb9b2a14 --- /dev/null +++ b/tdefile-plugins/raw/tdefile_raw.desktop @@ -0,0 +1,53 @@ +[Desktop Entry] +Type=Service +Name=RAW Camera Files +Name[br]=Restroù kamera kriz +Name[bs]=RAW kamera datoteke +Name[ca]=Fitxers RAW de càmera +Name[cs]=RAW soubory +Name[da]=RAW kamera-filer +Name[de]=RAW Kamera-Dateien +Name[el]=RAW αρχείο κάμερας +Name[es]=Archivos RAW de cámara +Name[et]=Toored kaamerafailid +Name[eu]=RAW kamera-fitxategiak +Name[fa]=پرونده‌های خام دوربین +Name[fi]=RAW-kuvatiedostot +Name[fr]=Fichiers RAW d'appareil photo numérique +Name[ga]=Comhaid Cheamara RAW +Name[gl]=Ficheiros RAW de Cámara +Name[he]=קבצי מצלמה דיגיטלית גולמיים +Name[hu]=RAW-fájlok +Name[is]=RAW myndavélaskrár +Name[it]=File grezzi fotocamera digitale +Name[ja]=RAW カメラファイル +Name[kk]=Камераның RAW пішімдегі файлдары +Name[km]=ឯកសារ​ចេញ​ពី​ម៉ាស៊ីន​ថត​រូប +Name[lt]=RAW fotoaparato bylos +Name[nb]=RAW-kamerafiler +Name[nds]=RAW-Kameradateien +Name[ne]=RAW क्यामेरा फाइल +Name[nl]=Rauwe camerabestanden +Name[nn]=RAW-kamerafiler +Name[pa]=RAW ਕੈਮਰਾ ਫਾਇਲਾਂ +Name[pl]=Pliki RAW z aparatów cyfrowych +Name[pt]=Ficheiros de Máquina Fotográfica Digital RAW +Name[pt_BR]=Arquivos de Câmeras +Name[ro]=Fişiere foto brute +Name[ru]=Необработанные Файлы с цифровой камеры (RAW) +Name[sk]=RAW súbory digitálneho fotoaparátu +Name[sl]=Surove datoteke s fotoaparata +Name[sr]=RAW фајлови слика +Name[sr@Latn]=RAW fajlovi slika +Name[sv]=Obehandlade kamerafiler +Name[th]=แฟ้มภาพ RAW จากกล้อง +Name[tr]=RAW Kamera Dosyaları +Name[uk]=Файли цифрової камери RAW +Name[zh_CN]=RAW 相机文件 +Name[zh_HK]=RAW 相機檔案 +Name[zh_TW]=原始相機檔 +ServiceTypes=KFilePlugin +MimeType=image/x-raw +X-TDE-Library=tdefile_raw +CacheThumbnail=false +SupportsThumbnail=true diff --git a/tdefile-plugins/rgb/CMakeLists.txt b/tdefile-plugins/rgb/CMakeLists.txt new file mode 100644 index 00000000..7596f2cb --- /dev/null +++ b/tdefile-plugins/rgb/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_rgb.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +#### tdefile_rgb (module) ######################### + +tde_add_kpart( tdefile_rgb AUTOMOC + SOURCES tdefile_rgb.cpp + LINK tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/rgb/Makefile.am b/tdefile-plugins/rgb/Makefile.am new file mode 100644 index 00000000..aab98d29 --- /dev/null +++ b/tdefile-plugins/rgb/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for rgb 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_rgb.h + +kde_module_LTLIBRARIES = tdefile_rgb.la + +tdefile_rgb_la_SOURCES = tdefile_rgb.cpp +tdefile_rgb_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdefile_rgb_la_LIBADD = $(LIB_KSYCOCA) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) tdefile_rgb.cpp -o $(podir)/tdefile_rgb.pot + +services_DATA = tdefile_rgb.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/rgb/tdefile_rgb.cpp b/tdefile-plugins/rgb/tdefile_rgb.cpp new file mode 100644 index 00000000..e503e438 --- /dev/null +++ b/tdefile-plugins/rgb/tdefile_rgb.cpp @@ -0,0 +1,208 @@ +/* This file is part of the KDE project + * Copyright (C) 2004 Melchior FRANZ + * + * 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 +#include "tdefile_rgb.h" + +#include +#include + +#include +#include + + +typedef KGenericFactory RgbFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_rgb, RgbFactory("tdefile_rgb")) + + +KRgbPlugin::KRgbPlugin(TQObject *parent, const char *name, const TQStringList &args) : + KFilePlugin(parent, name, args) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo("image/x-rgb"); + + KFileMimeTypeInfo::GroupInfo* group = 0; + KFileMimeTypeInfo::ItemInfo* item; + + + group = addGroupInfo(info, "Comment", i18n("Comment")); + + item = addItemInfo(group, "ImageName", i18n("Name"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + setHint(item, KFileMimeTypeInfo::Description); + + + 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); + + item = addItemInfo(group, "ColorMode", i18n("Color Mode"), TQVariant::String); + item = addItemInfo(group, "Compression", i18n("Compression"), TQVariant::String); + item = addItemInfo(group, "SharedRows", + i18n("percentage of avoided vertical redundancy (the higher the better)", + "Shared Rows"), TQVariant::String); + +} + + +bool KRgbPlugin::readInfo(KFileMetaInfo& info, uint /*what*/) +{ + TQFile file(info.path()); + + if (!file.open(IO_ReadOnly)) { + kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()).data() << endl; + return false; + } + + TQDataStream dstream(&file); + + TQ_UINT16 magic; + TQ_UINT8 storage; + TQ_UINT8 bpc; + TQ_UINT16 dimension; + TQ_UINT16 xsize; + TQ_UINT16 ysize; + TQ_UINT16 zsize; + TQ_UINT32 pixmin; + TQ_UINT32 pixmax; + TQ_UINT32 dummy; + char imagename[80]; + TQ_UINT32 colormap; + + dstream >> magic; + dstream >> storage; + dstream >> bpc; + dstream >> dimension; + dstream >> xsize; + dstream >> ysize; + dstream >> zsize; + dstream >> pixmin; + dstream >> pixmax; + dstream >> dummy; + dstream.readRawBytes(imagename, 80); + imagename[79] = '\0'; + dstream >> colormap; + TQ_UINT8 u8; + for (uint i = 0; i < 404; i++) + dstream >> u8; + + if (magic != 474) + return false; + + KFileMetaInfoGroup group; + + group = appendGroup(info, "Technical"); + + if (dimension == 1) + ysize = 1; + appendItem(group, "Dimensions", TQSize(xsize, ysize)); + appendItem(group, "BitDepth", zsize * 8 * bpc); + + if (zsize == 1) + appendItem(group, "ColorMode", i18n("Grayscale")); + else if (zsize == 2) + appendItem(group, "ColorMode", i18n("Grayscale/Alpha")); + else if (zsize == 3) + appendItem(group, "ColorMode", i18n("RGB")); + else if (zsize == 4) + appendItem(group, "ColorMode", i18n("RGB/Alpha")); + + if (!storage) + appendItem(group, "Compression", i18n("Uncompressed")); + else if (storage == 1) { + long compressed = file.size() - 512; + long verbatim = xsize * ysize * zsize; + appendItem(group, "Compression", i18n("Runlength Encoded") + + TQString(", %1%").arg(compressed * 100.0 / verbatim, 0, 'f', 1)); + + long k; + TQ_UINT32 offs; + TQMap map; + TQMap::Iterator it; + TQMap::Iterator end = map.end(); + for (k = 0; k < (ysize * zsize); k++) { + dstream >> offs; + if ((it = map.find(offs)) != end) + map.replace(offs, it.data() + 1); + else + map[offs] = 0; + } + for (k = 0, it = map.begin(); it != end; ++it) + k += it.data(); + + if (k) + appendItem(group, "SharedRows", TQString("%1%").arg(k * 100.0 + / (ysize * zsize), 0, 'f', 1)); + else + appendItem(group, "SharedRows", i18n("None")); + } else + appendItem(group, "Compression", i18n("Unknown")); + + + group = appendGroup(info, "Comment"); + appendItem(group, "ImageName", imagename); + + file.close(); + return true; +} + + +bool KRgbPlugin::writeInfo(const KFileMetaInfo& info) const +{ + TQFile file(info.path()); + + if (!file.open(IO_WriteOnly|IO_Raw)) { + kdDebug(7034) << "couldn't open " << TQFile::encodeName(info.path()).data() << endl; + return false; + } + + if (!file.at(24)) { + kdDebug(7034) << "couldn't set offset" << endl; + return false; + } + + TQDataStream dstream(&file); + TQString s = info["Comment"]["ImageName"].value().toString(); + s.truncate(79); + + unsigned i; + for (i = 0; i < s.length(); i++) + dstream << TQ_UINT8(s.latin1()[i]); + for (; i < 80; i++) + dstream << TQ_UINT8(0); + + file.close(); + return true; +} + + +// restrict to 79 ASCII characters +TQValidator* KRgbPlugin::createValidator(const TQString&, const TQString &, + const TQString &, TQObject* parent, const char* name) const +{ + return new TQRegExpValidator(TQRegExp("[\x0020-\x007E]{79}"), parent, name); +} + + +#include "tdefile_rgb.moc" diff --git a/tdefile-plugins/rgb/tdefile_rgb.desktop b/tdefile-plugins/rgb/tdefile_rgb.desktop new file mode 100644 index 00000000..9edecac8 --- /dev/null +++ b/tdefile-plugins/rgb/tdefile_rgb.desktop @@ -0,0 +1,61 @@ +[Desktop Entry] +Type=Service +Name=SGI Image (RGB) +Name[br]=Skeudenn SGI (RGB) +Name[bs]=SGI slika (RGB) +Name[ca]=Imatge SGI (RGB) +Name[cs]=SGI obrázek (RGB) +Name[cy]=Delwedd SGI (RGB) +Name[da]=SGI-billede (RGB) +Name[de]=SGI-Bild (RGB) +Name[el]=Εικόνα SGI (RGB) +Name[es]=Imagen SGI (RGB) +Name[et]=SGI pildifail (RGB) +Name[eu]=SGI irudia RGB) +Name[fa]=تصویر SGI (RGB) +Name[fi]=SGI-kuva (RGB) +Name[fr]=Image SGI (RVB) +Name[ga]=Íomhá SGI (RGB) +Name[gl]=Imaxe SGI (RGB) +Name[he]=תמונת SGI (RGB) +Name[hr]=SGI slika (RGB) +Name[hu]=SGI-kép (RGB) +Name[is]=SGI mynd (TGB) +Name[it]=Immagine SGI (RGB) +Name[ja]=SGI 画像 (RGB) +Name[kk]=SGI кескіні (RGB) +Name[km]=រូបភាព SGI (RGB) +Name[lt]=SGI paveiksliukas (RGB) +Name[ms]=Imej SGI (RGB) +Name[nb]=Bildeindeks +Name[nds]=SGI-Bild (RGB) +Name[ne]=SGI छवि (RGB) +Name[nl]=SGI-afbeelding (RGB) +Name[nn]=SGI-bilete (RGB) +Name[pl]=Obrazek SGI (RGB) +Name[pt]=Imagem SGI (RGB) +Name[pt_BR]=Imagem SGI (RGB) +Name[ro]=Imagine SGI (RGB) +Name[ru]=Изображение SGI (RGB) +Name[rw]=SGI Ishusho (RGB) +Name[se]=SGI-govva (RGB) +Name[sk]=SGI obrázok (RGB) +Name[sl]=Slika SGI (RGB) +Name[sr]=SGI слика (RGB) +Name[sr@Latn]=SGI slika (RGB) +Name[sv]=SGI-bild (RGB) +Name[ta]=எஸ்ஜிஐ படிமம் (RGB) +Name[tg]=Тасвироти SGI (RGB) +Name[th]=ภาพ SGI (RGB) +Name[tr]=SGI Resmi(KYM) +Name[uk]=Зображення SGI (RGB) +Name[uz]=SGI-rasm (RGB) +Name[uz@cyrillic]=SGI-расм (RGB) +Name[zh_CN]=SGI 图像(RGB) +Name[zh_HK]=SGI 圖像 (RGB) +Name[zh_TW]=SGI 影像(RGB) +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_rgb +MimeType=image/x-rgb +PreferredGroups=Comment,Technical +PreferredItems=Dimensions,BitDepth,ColorMode,Compression,SharedRows,ImageName diff --git a/tdefile-plugins/rgb/tdefile_rgb.h b/tdefile-plugins/rgb/tdefile_rgb.h new file mode 100644 index 00000000..6a4e0ae2 --- /dev/null +++ b/tdefile-plugins/rgb/tdefile_rgb.h @@ -0,0 +1,42 @@ +/* This file is part of the KDE project + * Copyright (C) 2004 Melcrhio FRANZ + * + * 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_RGB_H__ +#define __KFILE_RGB_H__ + +#include + +class TQStringList; + +class KRgbPlugin : public KFilePlugin +{ + Q_OBJECT + + +public: + KRgbPlugin(TQObject *parent, const char *name, const TQStringList& args); + virtual bool readInfo(KFileMetaInfo& info, uint what); + virtual bool writeInfo(const KFileMetaInfo& info) const; + virtual TQValidator* createValidator(const TQString& mimetype, + const TQString &group, const TQString &key, + TQObject* parent, const char* name) const; + +}; + +#endif diff --git a/tdefile-plugins/tga/CMakeLists.txt b/tdefile-plugins/tga/CMakeLists.txt new file mode 100644 index 00000000..7040c7ca --- /dev/null +++ b/tdefile-plugins/tga/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_tga.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +#### tdefile_tga (module) ######################### + +tde_add_kpart( tdefile_tga AUTOMOC + SOURCES tdefile_tga.cpp + LINK tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/tga/Makefile.am b/tdefile-plugins/tga/Makefile.am new file mode 100644 index 00000000..5aad4b7e --- /dev/null +++ b/tdefile-plugins/tga/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for tga 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_tga.h + +kde_module_LTLIBRARIES = tdefile_tga.la + +tdefile_tga_la_SOURCES = tdefile_tga.cpp +tdefile_tga_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdefile_tga_la_LIBADD = $(LIB_KSYCOCA) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) tdefile_tga.cpp -o $(podir)/tdefile_tga.pot + +services_DATA = tdefile_tga.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/tga/tdefile_tga.cpp b/tdefile-plugins/tga/tdefile_tga.cpp new file mode 100644 index 00000000..36fad13c --- /dev/null +++ b/tdefile-plugins/tga/tdefile_tga.cpp @@ -0,0 +1,165 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Shane Wright + * + * 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 +#include "tdefile_tga.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#if !defined(__osf__) +#include +#else +typedef unsigned long uint32_t; +typedef unsigned short uint16_t; +typedef unsigned char uint8_t; +#endif + +typedef KGenericFactory TgaFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_tga, TgaFactory( "tdefile_tga" )) + +KTgaPlugin::KTgaPlugin(TQObject *parent, const char *name, + const TQStringList &args) + + : KFilePlugin(parent, name, args) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( "image/x-targa" ); + + KFileMimeTypeInfo::GroupInfo* group = 0L; + + group = addGroupInfo(info, "Technical", i18n("Technical Details")); + + 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, "ColorMode", i18n("Color Mode"), TQVariant::String); + item = addItemInfo(group, "Compression", i18n("Compression"), TQVariant::String); + +} + +bool KTgaPlugin::readInfo( KFileMetaInfo& info, uint what) +{ + + + TQFile file(info.path()); + + if (!file.open(IO_ReadOnly)) + { + kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()).data() << endl; + return false; + } + + TQDataStream dstream(&file); + + // TGA files are little-endian + dstream.setByteOrder(TQDataStream::LittleEndian); + + // the vars for the image data + uint8_t tga_idlength; + uint8_t tga_colormaptype; + uint8_t tga_imagetype; + uint16_t tga_colormap_fei; + uint16_t tga_colormap_length; + uint8_t tga_colormap_entrysize; + uint16_t tga_imagespec_origin_x; + uint16_t tga_imagespec_origin_y; + uint16_t tga_imagespec_width; + uint16_t tga_imagespec_height; + uint8_t tga_imagespec_depth; + uint8_t tga_imagespec_descriptor; + + // read the image data + dstream >> tga_idlength; + dstream >> tga_colormaptype; + dstream >> tga_imagetype; + dstream >> tga_colormap_fei; + dstream >> tga_colormap_length; + dstream >> tga_colormap_entrysize; + dstream >> tga_imagespec_origin_x; + dstream >> tga_imagespec_origin_y; + dstream >> tga_imagespec_width; + dstream >> tga_imagespec_height; + dstream >> tga_imagespec_depth; + dstream >> tga_imagespec_descriptor; + + // output the useful bits + KFileMetaInfoGroup group = appendGroup(info, "Technical"); + appendItem(group, "Dimensions", TQSize(tga_imagespec_width, tga_imagespec_height)); + appendItem(group, "BitDepth", tga_imagespec_depth); + + switch (tga_imagetype) { + case 1 : + case 9 : + case 32 : + appendItem(group, "ColorMode", i18n("Color-Mapped")); + break; + case 2 : + case 10 : + case 33 : + appendItem(group, "ColorMode", i18n("RGB")); + break; + case 3 : + case 11 : + appendItem(group, "ColorMode", i18n("Black and White")); + break; + default : + appendItem(group, "ColorMode", i18n("Unknown")); + } + + switch (tga_imagetype) { + case 1 : + case 2 : + case 3 : + appendItem(group, "Compression", i18n("Uncompressed")); + break; + case 9 : + case 10 : + case 11 : + appendItem(group, "Compression", i18n("Runlength Encoded")); + break; + case 32 : + appendItem(group, "Compression", i18n("Huffman, Delta & RLE")); + break; + case 33 : + appendItem(group, "Compression", i18n("Huffman, Delta, RLE (4-pass quadtree)")); + break; + default : + appendItem(group, "Compression", i18n("Unknown")); + }; + + return true; +} + +#include "tdefile_tga.moc" diff --git a/tdefile-plugins/tga/tdefile_tga.desktop b/tdefile-plugins/tga/tdefile_tga.desktop new file mode 100644 index 00000000..30a45faf --- /dev/null +++ b/tdefile-plugins/tga/tdefile_tga.desktop @@ -0,0 +1,64 @@ +[Desktop Entry] +Type=Service +Name=Truevision Targa Info +Name[ar]=معلومات Truevision Targa +Name[br]=Gorretaol Truevision Targa +Name[ca]=Informació de Targa Truevision +Name[cs]=Truevision Targa info +Name[cy]=Gwybodaeth Truevision Targa +Name[da]=Truevision Targa-info +Name[de]=Truevision Targa-Info +Name[el]=Πληροφορίες Truevision Targa +Name[eo]=TARGA-informo +Name[es]=Info de Targa visión verdadera +Name[et]=Truevision Targa info +Name[fa]=اطلاعات Truevision Targa +Name[fi]=Truevision Targa -tiedot +Name[fr]=Informations Truevision +Name[gl]=Inf. Truevision Targa +Name[he]=מידע Truevision Targa +Name[hi]=ट्रू-विज़न टाग्रा जानकारी +Name[hr]=Truevision Targa Infomacije +Name[hu]=Truevision/Targa-jellemzők +Name[is]=Truevision Targa upplýsingar +Name[it]=Informazioni Truevision Targa +Name[ja]=TGA (Truevision Targa) 情報 +Name[kk]=Truevision Targa мәліметі +Name[km]=ព័ត៌មាន Truevision Targa +Name[lt]=Truevision Targa informacija +Name[ms]=Maklumat Targa Truevision +Name[nb]=Truevision Targa-info +Name[nds]="Truevision Targa"-Info +Name[ne]=ट्रुभिजन टार्गा सूचना +Name[nl]=Truevision Targa-info +Name[nn]=Truevision Targa-info +Name[nso]=Tshedimoso ya Targa ya pono ya Nnete +Name[pl]=Informacja o pliku Truevision Targa +Name[pt]=Informação do Targa da Truevision +Name[pt_BR]=Informação sobre Truevision Targa +Name[ro]=Informaţii Targa Truevision +Name[ru]=Информация о Truevision Targa +Name[se]=Truevision Targa-dieđut +Name[sl]=Podatki o Truevision Targa +Name[sr]=Truevision Targa информације +Name[sr@Latn]=Truevision Targa informacije +Name[sv]=Information om Truevision Targa +Name[ta]=சரியான பார்வை தார்கா தகவல் +Name[tg]=Иттилоот оиди Truevision Targa +Name[th]=ข้อมูลแฟ้ม Truevision Targa +Name[tr]=Truevision Targa Bilgisi +Name[uk]=Інформація по Truevision Targa +Name[uz]=TGA haqida maʼlumot +Name[uz@cyrillic]=TGA ҳақида маълумот +Name[ven]=Mafhungo a Targa ya mbonalelo ya vhukuma +Name[wa]=Informåcion sol imådje Truevision Targa +Name[xh]=Ulwazi lwe Truevision Targa +Name[zh_CN]=Truevision Targa 信息 +Name[zh_HK]=Truevision Targa 資訊 +Name[zh_TW]=Truevision Targa 資訊 +Name[zu]=Ulwazi lwe-Truevision Targa +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_tga +MimeType=image/x-targa +PreferredGroups=Technical +PreferredItems=Dimensions,BitDepth,ColorMode,Compression diff --git a/tdefile-plugins/tga/tdefile_tga.h b/tdefile-plugins/tga/tdefile_tga.h new file mode 100644 index 00000000..68b0ae1d --- /dev/null +++ b/tdefile-plugins/tga/tdefile_tga.h @@ -0,0 +1,38 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Shane Wright + * + * 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_TGA_H__ +#define __KFILE_TGA_H__ + +#include + +class TQStringList; + +class KTgaPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KTgaPlugin( TQObject *parent, const char *name, const TQStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint what); +}; + +#endif diff --git a/tdefile-plugins/tiff/CMakeLists.txt b/tdefile-plugins/tiff/CMakeLists.txt new file mode 100644 index 00000000..d3ec9b90 --- /dev/null +++ b/tdefile-plugins/tiff/CMakeLists.txt @@ -0,0 +1,37 @@ +################################################# +# +# (C) 2010-2011 Calvin Morrison +# mutantturkey@gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include( ConfigureChecks.cmake ) + +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_tiff.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +#### tdefile_tiff (module) ######################## + +tde_add_kpart( tdefile_tiff AUTOMOC + SOURCES tdefile_tiff.cpp + LINK tdeio-shared ${TIFF_LIBRARY} + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/tiff/ConfigureChecks.cmake b/tdefile-plugins/tiff/ConfigureChecks.cmake new file mode 100644 index 00000000..c7efb9b7 --- /dev/null +++ b/tdefile-plugins/tiff/ConfigureChecks.cmake @@ -0,0 +1,21 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +# libtiff +check_include_file( tiff.h HAVE_TIFF_H ) +if( HAVE_TIFF_H ) + check_library_exists( tiff TIFFOpen "" HAVE_TIFF ) +endif( ) +if( HAVE_TIFF_H AND HAVE_TIFF ) + set( TIFF_LIBRARY tiff ) +else( ) + tde_message_fatal( "libtiff is required, but was not found on your system" ) +endif( ) diff --git a/tdefile-plugins/tiff/Makefile.am b/tdefile-plugins/tiff/Makefile.am new file mode 100644 index 00000000..9807a66c --- /dev/null +++ b/tdefile-plugins/tiff/Makefile.am @@ -0,0 +1,21 @@ +## Makefile.am for Tiff file meta info plugin + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +noinst_HEADERS = tdefile_tiff.h + +kde_module_LTLIBRARIES = tdefile_tiff.la + +tdefile_tiff_la_SOURCES = tdefile_tiff.cpp +tdefile_tiff_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdefile_tiff_la_LIBADD = $(LIB_KIO) $(LIBTIFF) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: + $(XGETTEXT) *.cpp -o $(podir)/tdefile_tiff.pot + +services_DATA = tdefile_tiff.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/tiff/configure.in.in b/tdefile-plugins/tiff/configure.in.in new file mode 100644 index 00000000..e1a9730a --- /dev/null +++ b/tdefile-plugins/tiff/configure.in.in @@ -0,0 +1,3 @@ +# Compile the tiff meta info plugin only if libtiff was detected +AC_FIND_TIFF +AM_CONDITIONAL(include_TIFF, test -n "$LIBTIFF") diff --git a/tdefile-plugins/tiff/tdefile_tiff.cpp b/tdefile-plugins/tiff/tdefile_tiff.cpp new file mode 100644 index 00000000..dfd813a5 --- /dev/null +++ b/tdefile-plugins/tiff/tdefile_tiff.cpp @@ -0,0 +1,299 @@ +/* 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_tiff.h" + +#include +#include + +#include +#include +#include +#include + +#include +#include + +typedef KGenericFactory TiffFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_tiff, TiffFactory("tdefile_tiff")) + +KTiffPlugin::KTiffPlugin(TQObject *parent, const char *name, + const TQStringList &args) : KFilePlugin(parent, name, args) +{ + kdDebug(7034) << "TIFF file meta info plugin" << endl; + KFileMimeTypeInfo* info = addMimeTypeInfo( "image/tiff" ); + + KFileMimeTypeInfo::GroupInfo* group = + addGroupInfo(info, "General", i18n("General")); + + KFileMimeTypeInfo::ItemInfo* item; + item = addItemInfo(group, "Description", i18n("Description"), + TQVariant::String); + setHint(item, KFileMimeTypeInfo::Description); + item = addItemInfo(group, "Copyright", i18n("Copyright"), + TQVariant::String); + item = addItemInfo(group, "ColorMode", i18n("Color Mode"), + TQVariant::String); + item = addItemInfo(group, "Dimensions", i18n("Dimensions"), + TQVariant::Size); + setHint(item, KFileMimeTypeInfo::Size); + setUnit(item, KFileMimeTypeInfo::Pixels); + item = addItemInfo(group, "Resolution", i18n("Resolution"), + TQVariant::Size); + setUnit(item, KFileMimeTypeInfo::DotsPerInch); + item = addItemInfo(group, "BitDepth", i18n("Bit Depth"), + TQVariant::Int); + setUnit(item, KFileMimeTypeInfo::BitsPerPixel); + item = addItemInfo(group, "Compression", i18n("Compression"), + TQVariant::String); + item = addItemInfo(group, "Software", i18n("Software"), + TQVariant::String); + item = addItemInfo(group, "DateTime", i18n("Date/Time"), + TQVariant::DateTime); + item = addItemInfo(group, "Artist", i18n("Artist"), + TQVariant::String); + setHint(item, KFileMimeTypeInfo::Author); + item = addItemInfo(group, "FaxPages", i18n("Fax Pages"), + TQVariant::Int); + + group = addGroupInfo(info, "Scanner", i18n("Scanner")); + + item = addItemInfo(group, "Make", i18n("Make"), TQVariant::String); + item = addItemInfo(group, "Model", i18n("Model"), TQVariant::String); + + m_colorMode.setAutoDelete(true); + m_imageCompression.setAutoDelete(true); + + m_colorMode.insert(PHOTOMETRIC_MINISWHITE, + new TQString(I18N_NOOP("Monochrome"))); + m_colorMode.insert(PHOTOMETRIC_MINISBLACK, + new TQString(I18N_NOOP("Monochrome"))); + m_colorMode.insert(PHOTOMETRIC_RGB, + new TQString(I18N_NOOP("RGB"))); + m_colorMode.insert(PHOTOMETRIC_PALETTE, + new TQString(I18N_NOOP("Palette color"))); + m_colorMode.insert(PHOTOMETRIC_MASK, + new TQString(I18N_NOOP("Transparency mask"))); + m_colorMode.insert(PHOTOMETRIC_SEPARATED, + new TQString(I18N_NOOP("Color separations"))); + m_colorMode.insert(PHOTOMETRIC_YCBCR, + new TQString(I18N_NOOP("YCbCr"))); + m_colorMode.insert(PHOTOMETRIC_CIELAB, + new TQString(I18N_NOOP("CIE Lab"))); +#ifdef PHOTOMETRIC_ITULAB + m_colorMode.insert(PHOTOMETRIC_ITULAB, + new TQString(I18N_NOOP("ITU Lab"))); +#endif + m_colorMode.insert(PHOTOMETRIC_LOGL, + new TQString(I18N_NOOP("LOGL"))); + m_colorMode.insert(PHOTOMETRIC_LOGLUV, + new TQString(I18N_NOOP("LOGLUV"))); + + m_imageCompression.insert(COMPRESSION_NONE, + new TQString(I18N_NOOP("None"))); + m_imageCompression.insert(COMPRESSION_CCITTRLE, + new TQString(I18N_NOOP("RLE"))); + m_imageCompression.insert(COMPRESSION_CCITTFAX3, + new TQString(I18N_NOOP("G3 Fax"))); + m_imageCompression.insert(COMPRESSION_CCITTFAX4, + new TQString(I18N_NOOP("G4 Fax"))); + m_imageCompression.insert(COMPRESSION_LZW, + new TQString(I18N_NOOP("LZW"))); + m_imageCompression.insert(COMPRESSION_OJPEG, + new TQString(I18N_NOOP("JPEG"))); + m_imageCompression.insert(COMPRESSION_JPEG, + new TQString(I18N_NOOP("JPEG DCT"))); +#ifdef COMPRESSION_ADOBE_DEFLATE + m_imageCompression.insert(COMPRESSION_ADOBE_DEFLATE, + new TQString(I18N_NOOP("Adobe Deflate"))); +#endif + m_imageCompression.insert(COMPRESSION_NEXT, + new TQString(I18N_NOOP("NeXT 2-bit RLE"))); + m_imageCompression.insert(COMPRESSION_CCITTRLEW, + new TQString(I18N_NOOP("RLE Word"))); + m_imageCompression.insert(COMPRESSION_PACKBITS, + new TQString(I18N_NOOP("Packbits"))); + m_imageCompression.insert(COMPRESSION_THUNDERSCAN, + new TQString(I18N_NOOP("Thunderscan RLE"))); + m_imageCompression.insert(COMPRESSION_IT8CTPAD, + new TQString(I18N_NOOP("IT8 CT w/padding"))); + m_imageCompression.insert(COMPRESSION_IT8LW, + new TQString(I18N_NOOP("IT8 linework RLE"))); + m_imageCompression.insert(COMPRESSION_IT8MP, + new TQString(I18N_NOOP("IT8 monochrome"))); + m_imageCompression.insert(COMPRESSION_IT8BL, + new TQString(I18N_NOOP("IT8 binary lineart"))); + m_imageCompression.insert(COMPRESSION_PIXARFILM, + new TQString(I18N_NOOP("Pixar 10-bit LZW"))); + m_imageCompression.insert(COMPRESSION_PIXARLOG, + new TQString(I18N_NOOP("Pixar 11-bit ZIP"))); + m_imageCompression.insert(COMPRESSION_DEFLATE, + new TQString(I18N_NOOP("Pixar deflate"))); + m_imageCompression.insert(COMPRESSION_DCS, + new TQString(I18N_NOOP("Kodak DCS"))); + m_imageCompression.insert(COMPRESSION_JBIG, + new TQString(I18N_NOOP("ISO JBIG"))); + m_imageCompression.insert(COMPRESSION_SGILOG, + new TQString(I18N_NOOP("SGI log luminance RLE"))); + m_imageCompression.insert(COMPRESSION_SGILOG24, + new TQString(I18N_NOOP("SGI log 24-bit packed"))); +} + +TQDateTime KTiffPlugin::tiffDate(const TQString& s) const +{ + TQDateTime dt; + TQRegExp rxDate("^([0-9]{4}):([0-9]{2}):([0-9]{2})\\s" + "([0-9]{2}):([0-9]{2}):([0-9]{2})$"); + + if (rxDate.search(s) != -1) + { + int year = rxDate.cap(1).toInt(); + int month = rxDate.cap(2).toInt(); + int day = rxDate.cap(3).toInt(); + int hour = rxDate.cap(4).toInt(); + int min = rxDate.cap(5).toInt(); + int sec = rxDate.cap(6).toInt(); + + TQDate d = TQDate(year, month, day); + TQTime t = TQTime(hour, min, sec); + + if (d.isValid() && t.isValid()) + { + dt.setDate(d); + dt.setTime(t); + } + } + + return dt; +} + +bool KTiffPlugin::readInfo(KFileMetaInfo& info, uint) +{ + TIFF *tiff = TIFFOpen(TQFile::encodeName(info.path()), "r"); + if (!tiff) + return false; + + uint32 imageLength=0, imageWidth=0; + uint16 bitsPerSample=0, imageCompression=0, colorMode=0, samplesPerPixel=0, + imageAlpha=0, imageResUnit=0, dummy=0, faxPages=0; + float imageXResolution=0, imageYResolution=0; + char *description=0, *copyright=0, *software=0, *datetime=0, *artist=0, + *scannerMake=0, *scannerModel=0; + + TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &imageLength); + TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &imageWidth); + TIFFGetFieldDefaulted(tiff, TIFFTAG_BITSPERSAMPLE, &bitsPerSample); + TIFFGetFieldDefaulted(tiff, TIFFTAG_SAMPLESPERPIXEL, &samplesPerPixel); + TIFFGetField(tiff, TIFFTAG_PHOTOMETRIC, &colorMode); + TIFFGetFieldDefaulted(tiff, TIFFTAG_COMPRESSION, &imageCompression); + TIFFGetField(tiff, TIFFTAG_MATTEING, &imageAlpha); + TIFFGetField(tiff, TIFFTAG_XRESOLUTION, &imageXResolution); + TIFFGetField(tiff, TIFFTAG_YRESOLUTION, &imageYResolution); + TIFFGetFieldDefaulted(tiff, TIFFTAG_RESOLUTIONUNIT, &imageResUnit); + TIFFGetField(tiff, TIFFTAG_IMAGEDESCRIPTION, &description); + TIFFGetField(tiff, TIFFTAG_SOFTWARE, &software); + TIFFGetField(tiff, TIFFTAG_COPYRIGHT, ©right); + TIFFGetField(tiff, TIFFTAG_DATETIME, &datetime); + TIFFGetField(tiff, TIFFTAG_ARTIST, &artist); + TIFFGetField(tiff, TIFFTAG_PAGENUMBER, &dummy, &faxPages); + TIFFGetField(tiff, TIFFTAG_MAKE, &scannerMake); + TIFFGetField(tiff, TIFFTAG_MODEL, &scannerModel); + + kdDebug(7034) << "Description: " << description << endl; + kdDebug(7034) << "Width: " << imageWidth << endl; + kdDebug(7034) << "Height: " << imageLength << endl; + kdDebug(7034) << "BitDepth: " << bitsPerSample << endl; + kdDebug(7034) << "ColorMode: " << colorMode << endl; + kdDebug(7034) << "Compression: " << imageCompression << endl; + kdDebug(7034) << "SamplesPerPixel: " << samplesPerPixel << endl; + kdDebug(7034) << "ImageAlpha: " << imageAlpha << endl; + kdDebug(7034) << "XResolution: " << imageXResolution << endl; + kdDebug(7034) << "YResolution: " << imageYResolution << endl; + kdDebug(7034) << "ResolutionUnit: " << imageResUnit << endl; + kdDebug(7034) << "FaxPages: " << faxPages << endl; + kdDebug(7034) << "DateTime: " << datetime << endl; + kdDebug(7034) << "Copyright: " << copyright << endl; + kdDebug(7034) << "Software: " << software << endl; + kdDebug(7034) << "Artist: " << artist << endl; + kdDebug(7034) << "Make: " << scannerMake << endl; + kdDebug(7034) << "Model: " << scannerModel << endl; + + if (imageResUnit == RESUNIT_CENTIMETER) + { + imageXResolution *= 2.54; + imageYResolution *= 2.54; + } + else if (imageResUnit == RESUNIT_NONE) + { + imageXResolution = 0; + imageYResolution = 0; + } + + int imageBpp = bitsPerSample*samplesPerPixel; + if (imageAlpha && colorMode==PHOTOMETRIC_RGB) + m_colorMode.replace(PHOTOMETRIC_RGB, new TQString(I18N_NOOP("RGBA"))); + + KFileMetaInfoGroup group = appendGroup(info, "General"); + if (description) + appendItem(group, "Description", TQString(description)); + appendItem(group, "Dimensions", TQSize(imageWidth, imageLength)); + appendItem(group, "BitDepth", imageBpp); + if (imageXResolution>0 && imageYResolution>0) + appendItem(group, "Resolution", TQSize( + static_cast(imageXResolution), + static_cast(imageYResolution))); + if (m_colorMode[colorMode]) + appendItem(group, "ColorMode", *m_colorMode[colorMode]); + if (m_imageCompression[imageCompression]) + appendItem(group, "Compression", *m_imageCompression[imageCompression]); + if (datetime) + { + TQDateTime dt = tiffDate(TQString(datetime)); + if (dt.isValid()) + appendItem(group, "DateTime", dt); + } + if (copyright) + appendItem(group, "Copyright", TQString(copyright)); + if (software) + appendItem(group, "Software", TQString(software)); + if (artist) + appendItem(group, "Artist", TQString(artist)); + + if (faxPages>0 && (imageCompression==COMPRESSION_CCITTFAX3 || + imageCompression==COMPRESSION_CCITTFAX4)) + { + appendItem(group, "FaxPages", faxPages); + } + + if (scannerMake || scannerModel) + { + group = appendGroup(info, "Scanner"); + if (scannerMake) + appendItem(group, "Make", TQString(scannerMake)); + if (scannerModel) + appendItem(group, "Model", TQString(scannerModel)); + } + + TIFFClose(tiff); + + return true; +} + +#include "tdefile_tiff.moc" diff --git a/tdefile-plugins/tiff/tdefile_tiff.desktop b/tdefile-plugins/tiff/tdefile_tiff.desktop new file mode 100644 index 00000000..1309e3a3 --- /dev/null +++ b/tdefile-plugins/tiff/tdefile_tiff.desktop @@ -0,0 +1,67 @@ +[Desktop Entry] +Type=Service +Name=TIFF File Meta Info +Name[af]=Tiff Lêer Meta Inligting +Name[ar]=معلومات ملف TIFF +Name[br]=Meta-titouroù ar restr TIFF +Name[ca]=Metainformació de fitxer TIFF +Name[cs]=Metainformace obrázku typu TIFF +Name[cy]=Meta-wybodaeth Ffeil TIFF +Name[da]=TIFF Fil-meta-info +Name[de]=TIFF-Metainformation +Name[el]=Μετα-πληροφορίες αρχείου TIFF +Name[eo]=TIFF-informo +Name[es]=Info meta de archivos TIFF +Name[et]=TIFF faili metainfo +Name[eu]=TIFF fitxategi meta info +Name[fa]=فرااطلاعات پروندۀ TIFF +Name[fi]=TIFF-metatiedot +Name[fr]=Méta Informations sur les fichiers TIFF +Name[gl]=Inf. metaficheiro TIFF +Name[he]=מידע TIFF +Name[hi]=TIFF फ़ाइल मेटा जानकारी +Name[hr]=TIFF meta informacije +Name[hu]=TIFF-metajellemzők +Name[is]=TIFF File Meta upplýsingar +Name[it]=Informazioni TIFF +Name[ja]=TIFF ファイルメタ情報 +Name[kk]=TIFF файлдың мета деректері +Name[km]=ព័ត៌មាន​មេតា​របស់​ឯកសារ TIFF +Name[lt]=TIFF bylos meta informacija +Name[ms]=TIFF Maklumat Meta Fail TIFF +Name[nb]=TIFF-filmetainfo +Name[nds]=TIFF-Metainfo +Name[ne]=TIFF फाइल मेटा सूचना +Name[nl]=TIFF File Meta-info +Name[nn]=TIFF-filmetainfo +Name[nso]=Tshedimoso ya Meta wa Faele ya TIFF +Name[pl]=Informacja o pliku TIFF +Name[pt]=Meta-Informação do Ficheiro TIFF +Name[pt_BR]=Informação sobre Meta Arquivo TIFF +Name[ro]=Metainformaţii TIFF +Name[ru]=Информация о метафайле TIFF +Name[se]=TIFF-filla metadieđut +Name[sk]=Meta-info o súbore TIFF +Name[sl]=Meta podatki o TIFF +Name[sr]=Мета информације TIFF фајла +Name[sr@Latn]=Meta informacije TIFF fajla +Name[sv]=Metainformation om TIFF-fil +Name[ta]=TIFF மீக்கோப்பு தகவல் +Name[tg]=Иттилоот оиди метафайли TIFF +Name[th]=ข้อมูลเมตาแฟ้ม TIFF +Name[tr]=TIFF Dosya Bilgisi +Name[uk]=Метаінформація про файл TIFF +Name[uz]=TIFF-faylining meta-maʼlumoti +Name[uz@cyrillic]=TIFF-файлининг мета-маълумоти +Name[ven]=Mafhungo a Meta faela ya TIFF +Name[wa]=Informåcion sol imådje TIFF +Name[xh]=Ulwazi lwe TIFF Ifayile Esembindini +Name[zh_CN]=TIFF 文件元信息 +Name[zh_HK]=TIFF 檔案 Meta 資訊 +Name[zh_TW]=TIFF 檔案 Meta 資訊 +Name[zu]=Ulwazi Lwefayela yemeta ye-TIFF +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_tiff +MimeType=image/tiff +PreferredGroups=General,Scanner +PreferredItems=Description,Copyright,Type,Dimensions,Resolution,BitDepth,Compression,Software,DateTime,Artist,FaxPages,Make,Model diff --git a/tdefile-plugins/tiff/tdefile_tiff.h b/tdefile-plugins/tiff/tdefile_tiff.h new file mode 100644 index 00000000..e34eef25 --- /dev/null +++ b/tdefile-plugins/tiff/tdefile_tiff.h @@ -0,0 +1,43 @@ +/* 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_TIFF_H_ +#define __KFILE_TIFF_H_ + +#include + +#include + +class KTiffPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KTiffPlugin(TQObject *parent, const char *name, const TQStringList& args); + virtual bool readInfo(KFileMetaInfo& info, uint what); + +private: + TQDateTime tiffDate(const TQString&) const; + + TQIntDict m_colorMode; + TQIntDict m_imageCompression; +}; + +#endif diff --git a/tdefile-plugins/xbm/CMakeLists.txt b/tdefile-plugins/xbm/CMakeLists.txt new file mode 100644 index 00000000..4b96ade8 --- /dev/null +++ b/tdefile-plugins/xbm/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_xbm.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +#### tdefile_xbm (module) ######################## + +tde_add_kpart( tdefile_xbm AUTOMOC + SOURCES tdefile_xbm.cpp + LINK tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/xbm/Makefile.am b/tdefile-plugins/xbm/Makefile.am new file mode 100644 index 00000000..90abdc8e --- /dev/null +++ b/tdefile-plugins/xbm/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for xbm 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_xbm.h + +kde_module_LTLIBRARIES = tdefile_xbm.la + +tdefile_xbm_la_SOURCES = tdefile_xbm.cpp +tdefile_xbm_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdefile_xbm_la_LIBADD = $(LIB_KSYCOCA) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) tdefile_xbm.cpp -o $(podir)/tdefile_xbm.pot + +services_DATA = tdefile_xbm.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/xbm/tdefile_xbm.cpp b/tdefile-plugins/xbm/tdefile_xbm.cpp new file mode 100644 index 00000000..d4871d6f --- /dev/null +++ b/tdefile-plugins/xbm/tdefile_xbm.cpp @@ -0,0 +1,128 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Shane Wright + * + * 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 +#include "tdefile_xbm.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#if !defined(__osf__) +#include +#else +typedef unsigned short uint32_t; +#endif + +typedef KGenericFactory XbmFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_xbm, XbmFactory( "tdefile_xbm" )) + +KXbmPlugin::KXbmPlugin(TQObject *parent, const char *name, + const TQStringList &args) + + : KFilePlugin(parent, name, args) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( "image/x-xbm" ); + + KFileMimeTypeInfo::GroupInfo* group = 0L; + + group = addGroupInfo(info, "Technical", i18n("Technical Details")); + + KFileMimeTypeInfo::ItemInfo* item; + + item = addItemInfo(group, "Dimensions", i18n("Dimensions"), TQVariant::Size); + setHint( item, KFileMimeTypeInfo::Size ); + setUnit(item, KFileMimeTypeInfo::Pixels); +} + + +unsigned long KXbmPlugin::xbm_processLine(char * linebuf) +{ + const char * fsig = "#define "; + + // check it starts with #define + if (memcmp(linebuf, fsig, 8)) + return 0; + + // scan for the 2nd space and set up a pointer + uint32_t slen = strlen(linebuf); + bool done = false; + uint32_t spos = 0; + unsigned char spacecount = 0; + do { + + if (linebuf[spos] == 0x00) + return 0; + + if (linebuf[spos] == ' ') + ++spacecount; + + if (spacecount == 2) + done = true; + else + ++spos; + + } while (!done); + + return atoi(linebuf + spos); +} + + +bool KXbmPlugin::readInfo( KFileMetaInfo& info, uint what) +{ + + TQFile file(info.path()); + + if (!file.open(IO_ReadOnly)) + { + kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()).data() << endl; + return false; + } + + // we need a buffer for lines + char linebuf[1000]; + + // read the first line + file.readLine(linebuf, sizeof( linebuf )); + uint32_t width = xbm_processLine(linebuf); + + // read the 2nd line + file.readLine(linebuf, sizeof( linebuf )); + uint32_t height = xbm_processLine(linebuf); + + if ((width > 0) && (height > 0)) { + // we have valid looking data + KFileMetaInfoGroup group = appendGroup(info, "Technical"); + appendItem(group, "Dimensions", TQSize(width, height)); + return true; + } + + return false; +} + +#include "tdefile_xbm.moc" diff --git a/tdefile-plugins/xbm/tdefile_xbm.desktop b/tdefile-plugins/xbm/tdefile_xbm.desktop new file mode 100644 index 00000000..76102cea --- /dev/null +++ b/tdefile-plugins/xbm/tdefile_xbm.desktop @@ -0,0 +1,65 @@ +[Desktop Entry] +Type=Service +Name=XBM Info +Name[af]=Xbm Inligting +Name[ar]=معلومات XBM +Name[br]=Titouroù XBM +Name[ca]=Informació d'XBM +Name[cs]=XBM info +Name[cy]=Gwybodaeth XBM +Name[da]=XBM-info +Name[de]=XBM-Info +Name[el]=Πληροφορίες XBM +Name[eo]=XBM-informo +Name[es]=Info XBM +Name[et]=XBM info +Name[fa]=اطلاعات XBM +Name[fi]=XBM-tiedot +Name[fr]=Informations sur XBM +Name[gl]=Inf. XBM +Name[he]=מידע XBM +Name[hi]=XBM जानकारी +Name[hr]=XBM Infoformacije +Name[hu]=XBM-jellemzők +Name[is]=XBM upplýsingar +Name[it]=Informazioni XBM +Name[ja]=XBM 情報 +Name[kk]=XBM мәліметі +Name[km]=ព័ត៌មាន XBM +Name[lt]=XBM informacija +Name[ms]=Maklumat XBM +Name[nds]=XBM-Info +Name[ne]=XBM सूचना +Name[nl]=XBM-info +Name[nn]=XBM-info +Name[nso]=Tshedimoso ya XBM +Name[pa]=XBM ਜਾਣਕਾਰੀ +Name[pl]=Informacja o pliku XBM +Name[pt]=Informação do XBM +Name[pt_BR]=Informação sobre XBM +Name[ro]=Informaţii XBM +Name[ru]=Информация о XBM +Name[se]=XBM-dieđut +Name[sl]=Podatki o XBM +Name[sr]=XBM информације +Name[sr@Latn]=XBM informacije +Name[sv]=XBM-information +Name[ta]=XBM தகவல் +Name[tg]=Иттилоот оиди XBM +Name[th]=ข้อมูลแฟ้ม XBM +Name[tr]=XBM Bilgisi +Name[uk]=Інформація по XBM +Name[uz]=XBM haqida maʼlumot +Name[uz@cyrillic]=XBM ҳақида маълумот +Name[ven]=Mafhungo a XBM +Name[wa]=Informåcion sol imådje XBM +Name[xh]=Ulwazi lwe XBM +Name[zh_CN]=XBM 信息 +Name[zh_HK]=XBM 資訊 +Name[zh_TW]=XBM 資訊 +Name[zu]=Ulwazi lwe-XBM +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_xbm +MimeType=image/x-xbm +PreferredGroups=Technical +PreferredItems=Resolution diff --git a/tdefile-plugins/xbm/tdefile_xbm.h b/tdefile-plugins/xbm/tdefile_xbm.h new file mode 100644 index 00000000..5e7f6429 --- /dev/null +++ b/tdefile-plugins/xbm/tdefile_xbm.h @@ -0,0 +1,43 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Shane Wright + * + * 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_XBM_H__ +#define __KFILE_XBM_H__ + +#include + +class TQStringList; + +class KXbmPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KXbmPlugin( TQObject *parent, const char *name, const TQStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint what); + +private: + + unsigned long xbm_processLine(char * linebuf); + +}; + +#endif diff --git a/tdefile-plugins/xpm/CMakeLists.txt b/tdefile-plugins/xpm/CMakeLists.txt new file mode 100644 index 00000000..5b357416 --- /dev/null +++ b/tdefile-plugins/xpm/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_xpm.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +#### tdefile_xpm (module) ######################### + +tde_add_kpart( tdefile_xpm AUTOMOC + SOURCES tdefile_xpm.cpp + LINK tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/xpm/Makefile.am b/tdefile-plugins/xpm/Makefile.am new file mode 100644 index 00000000..3a32555e --- /dev/null +++ b/tdefile-plugins/xpm/Makefile.am @@ -0,0 +1,21 @@ +## Makefile.am for xpm file meta info plugin + +INCLUDES = $(all_includes) + +# these are the headers for your project +noinst_HEADERS = tdefile_xpm.h + +kde_module_LTLIBRARIES = tdefile_xpm.la + +tdefile_xpm_la_SOURCES = tdefile_xpm.cpp +tdefile_xpm_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdefile_xpm_la_LIBADD = $(LIB_KIO) +tdefile_xpm_la_METASOURCES = tdefile_xpm.moc + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +kde_services_DATA = tdefile_xpm.desktop + +messages: + $(XGETTEXT) *.cpp -o $(podir)/tdefile_xpm.pot diff --git a/tdefile-plugins/xpm/tdefile_xpm.cpp b/tdefile-plugins/xpm/tdefile_xpm.cpp new file mode 100644 index 00000000..46b07e51 --- /dev/null +++ b/tdefile-plugins/xpm/tdefile_xpm.cpp @@ -0,0 +1,71 @@ +/*************************************************************************** + * Copyright (C) 2004 by Martin Koller * + * m.koller@surfeu.at * + * * + * 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. * + ***************************************************************************/ + +#include +#include +#include "tdefile_xpm.h" + +#include + +//-------------------------------------------------------------------------------- + +typedef KGenericFactory xpmFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_xpm, xpmFactory( "tdefile_xpm" )) + +//-------------------------------------------------------------------------------- + +xpmPlugin::xpmPlugin(TQObject *parent, const char *name, const TQStringList &args) + : KFilePlugin(parent, name, args) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( "image/x-xpm" ); + + // our new group + KFileMimeTypeInfo::GroupInfo* group = 0; + group = addGroupInfo(info, "xpmInfo", i18n("X PixMap File Information")); + + KFileMimeTypeInfo::ItemInfo* item; + + // our new items in the group + item = addItemInfo(group, "Dimension", i18n("Dimension"), TQVariant::Size); + setHint(item, KFileMimeTypeInfo::Size); + setUnit(item, KFileMimeTypeInfo::Pixels); + + item = addItemInfo(group, "BitDepth", i18n("Bit Depth"), TQVariant::Int); + setUnit(item, KFileMimeTypeInfo::BitsPerPixel); +} + +//-------------------------------------------------------------------------------- + +bool xpmPlugin::readInfo(KFileMetaInfo& info, uint /*what*/) +{ + TQImage pix; + + if ( ! pix.load(info.path(), "XPM") ) return false; + + KFileMetaInfoGroup group = appendGroup(info, "xpmInfo"); + + appendItem(group, "Dimension", TQSize(pix.size())); + appendItem(group, "BitDepth", pix.depth()); + + return true; +} + +#include "tdefile_xpm.moc" diff --git a/tdefile-plugins/xpm/tdefile_xpm.desktop b/tdefile-plugins/xpm/tdefile_xpm.desktop new file mode 100644 index 00000000..43c18514 --- /dev/null +++ b/tdefile-plugins/xpm/tdefile_xpm.desktop @@ -0,0 +1,53 @@ +[Desktop Entry] +Type=Service +Name=XPM Info +Name[br]=Titouroù XPM +Name[ca]=Informació de XPM +Name[cs]=XPM info +Name[de]=XPM-Info +Name[el]=Πληροφορίες XPM +Name[eo]=XPM-informo +Name[es]=Información XPM +Name[et]=XPM info +Name[fa]=اطلاعات XPM +Name[fi]=XPM-tiedot +Name[fr]=Informations XPM +Name[gl]=Información XPM +Name[he]=מידע XPM +Name[hu]=XPM-jellemzők +Name[is]=XPM upplýsingar +Name[it]=Informazioni XPM +Name[ja]=XPM 情報 +Name[kk]=XPM мәліметі +Name[km]=ព័ត៌មាន XPM +Name[lt]=XPM informacija +Name[ms]=Maklumat XPM +Name[nb]=XPM-info +Name[nds]=XPM-Info +Name[ne]=XPM सूचना +Name[nl]=XPM-info +Name[nn]=XPM-info +Name[pa]=XPM ਜਾਣਕਾਰੀ +Name[pl]=Informacja o pliku XPM +Name[pt]=Informação do XPM +Name[pt_BR]=Informações Sobre XPM +Name[ro]=Informaţii XPM +Name[ru]=Информация о XPM +Name[sl]=Podatki o XPM +Name[sr]=XPM информације +Name[sr@Latn]=XPM informacije +Name[sv]=XPM-information +Name[ta]=XPM தகவல் +Name[th]=ข้อมูลแฟ้ม XPM +Name[tr]=XPM Bilgisi +Name[uk]=Інформація про XPM +Name[uz]=XPM haqida maʼlumot +Name[uz@cyrillic]=XPM ҳақида маълумот +Name[zh_CN]=XPM 信息 +Name[zh_HK]=XPM 資訊 +Name[zh_TW]=XPM 資訊 +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_xpm +MimeType=image/x-xpm +PreferredGroups=xpmInfo +PreferredItems=Dimension diff --git a/tdefile-plugins/xpm/tdefile_xpm.h b/tdefile-plugins/xpm/tdefile_xpm.h new file mode 100644 index 00000000..275d3dd7 --- /dev/null +++ b/tdefile-plugins/xpm/tdefile_xpm.h @@ -0,0 +1,46 @@ +/*************************************************************************** + * Copyright (C) 2004 by Martin Koller * + * m.koller@surfeu.at * + * * + * This plugin provides information about the content of a * + * XPM image file. * + * * + * 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. * + ***************************************************************************/ + +#ifndef KFILE_XPM_H +#define KFILE_XPM_H + +/** + * Note: For further information look into <$TDEDIR/include/tdefilemetainfo.h> + */ +#include + +class TQStringList; + +class xpmPlugin: public KFilePlugin +{ + Q_OBJECT + + + public: + xpmPlugin(TQObject *parent, const char *name, const TQStringList& args); + + virtual bool readInfo(KFileMetaInfo& info, uint what); +}; + +#endif + -- cgit v1.2.3