diff options
Diffstat (limited to 'src/showfoto')
-rw-r--r-- | src/showfoto/Makefile.am | 42 | ||||
-rw-r--r-- | src/showfoto/main.cpp | 95 | ||||
-rw-r--r-- | src/showfoto/setup/Makefile.am | 14 | ||||
-rw-r--r-- | src/showfoto/setup/setup.cpp | 153 | ||||
-rw-r--r-- | src/showfoto/setup/setup.h | 78 | ||||
-rw-r--r-- | src/showfoto/setup/setupeditor.cpp | 246 | ||||
-rw-r--r-- | src/showfoto/setup/setupeditor.h | 63 | ||||
-rw-r--r-- | src/showfoto/setup/setuptooltip.cpp | 228 | ||||
-rw-r--r-- | src/showfoto/setup/setuptooltip.h | 59 | ||||
-rw-r--r-- | src/showfoto/showfoto.cpp | 1240 | ||||
-rw-r--r-- | src/showfoto/showfoto.desktop | 151 | ||||
-rw-r--r-- | src/showfoto/showfoto.h | 135 | ||||
-rw-r--r-- | src/showfoto/showfotoui.rc | 131 |
13 files changed, 2635 insertions, 0 deletions
diff --git a/src/showfoto/Makefile.am b/src/showfoto/Makefile.am new file mode 100644 index 00000000..9f5f5064 --- /dev/null +++ b/src/showfoto/Makefile.am @@ -0,0 +1,42 @@ +SUBDIRS = setup + +METASOURCES = AUTO + +bin_PROGRAMS = showfoto + +INCLUDES = -I$(top_srcdir)/src/showfoto/setup \ + -I$(top_srcdir)/src/utilities/setup \ + -I$(top_srcdir)/src/libs/thumbbar \ + -I$(top_srcdir)/src/libs/widgets/common \ + -I$(top_srcdir)/src/libs/imageproperties \ + -I$(top_srcdir)/src/libs/histogram \ + -I$(top_srcdir)/src/libs/dimg \ + -I$(top_srcdir)/src/libs/dmetadata \ + -I$(top_srcdir)/src/libs/threadimageio \ + -I$(top_srcdir)/src/libs/themeengine \ + -I$(top_srcdir)/src/libs/dialogs \ + -I$(top_srcdir)/src/digikam \ + -I$(top_srcdir)/src/utilities/slideshow \ + -I$(top_srcdir)/src/utilities/imageeditor/canvas \ + -I$(top_srcdir)/src/utilities/imageeditor/editor \ + -I$(top_srcdir)/src/utilities/imageeditor/tools \ + $(LIBKEXIV2_CFLAGS) $(LIBKDCRAW_CFLAGS) $(all_includes) + +showfoto_SOURCES = main.cpp showfoto.cpp + +showfoto_LDADD = $(top_builddir)/src/showfoto/setup/libsetup.la \ + $(top_builddir)/src/libs/imageproperties/libimagepropertiesshowfoto.la \ + $(top_builddir)/src/libs/thumbbar/libthumbbar.la \ + $(top_builddir)/src/utilities/imageeditor/editor/libshowfoto.la \ + $(top_builddir)/src/utilities/slideshow/libslideshow.la \ + $(top_builddir)/src/libs/threadimageio/libthreadimageio.la \ + $(top_builddir)/src/libs/themeengine/libthemeengine.la \ + $(top_builddir)/src/libs/jpegutils/libjpegutils.la \ + $(LIB_TDEUTILS) $(LIB_TDEPARTS) $(LIBJPEG) + +showfoto_LDFLAGS = $(LIBKEXIV2_LIBS) $(LIBKDCRAW_LIBS) $(KDE_RPATH) $(all_libraries) + +rcdir = $(kde_datadir)/showfoto +rc_DATA = showfotoui.rc + +xdg_apps_DATA = showfoto.desktop diff --git a/src/showfoto/main.cpp b/src/showfoto/main.cpp new file mode 100644 index 00000000..0be2a542 --- /dev/null +++ b/src/showfoto/main.cpp @@ -0,0 +1,95 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2004-11-22 + * Description : showfoto is a stand alone version of image + * editor with no support of digiKam database. + * + * Copyright (C) 2004-2005 by Renchi Raju <renchi@pooh.tam.uiuc.edu> + * Copyright (C) 2004-2008 by Gilles Caulier <caulier dot gilles at gmail dot com> + * + * 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. + * + * ============================================================ */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +// KDE includes. + +#include <tdeapplication.h> +#include <tdecmdlineargs.h> +#include <tdeaboutdata.h> +#include <tdelocale.h> +#include <tdeconfig.h> +#include <tdeglobal.h> +#include <kimageio.h> + +// Local includes. + +#include "daboutdata.h" +#include "showfoto.h" + +static TDECmdLineOptions options[] = +{ + { "+[file(s) or folder(s)]", I18N_NOOP("File(s) or folder(s) to open"), 0 }, + TDECmdLineLastOption +}; + +int main(int argc, char *argv[]) +{ + TQString libInfo = Digikam::libraryInfo(); + + TQString Description = Digikam::showFotoDescription(); + + TDEAboutData aboutData( "showfoto", + I18N_NOOP("showFoto"), + showfoto_version, + Description.latin1(), + TDEAboutData::License_GPL, + Digikam::copyright(), + 0, + Digikam::webProjectUrl()); + + aboutData.setOtherText(libInfo.latin1()); + + Digikam::authorsRegistration(aboutData); + + TDECmdLineArgs::init( argc, argv, &aboutData ); + TDECmdLineArgs::addCmdLineOptions( options ); + + TDEApplication app; + KImageIO::registerFormats(); + + KURL::List urlList; + TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); + for(int i = 0; i < args->count(); i++) + { + urlList.append(args->url(i)); + } + args->clear(); + + ShowFoto::ShowFoto *w = new ShowFoto::ShowFoto(urlList); + app.setMainWidget(w); + w->show(); + + TDEGlobal::locale()->setMainCatalogue("digikam"); + TDEGlobal::locale()->insertCatalogue("libkdcraw"); + + int ret = app.exec(); + + delete w; + return ret; +} diff --git a/src/showfoto/setup/Makefile.am b/src/showfoto/setup/Makefile.am new file mode 100644 index 00000000..d2767031 --- /dev/null +++ b/src/showfoto/setup/Makefile.am @@ -0,0 +1,14 @@ +METASOURCES = AUTO + +INCLUDES = -I$(top_srcdir)/src/utilities/setup \ + -I$(top_srcdir)/src/digikam \ + $(all_includes) + +noinst_LTLIBRARIES = libsetup.la + +libsetup_la_SOURCES = setup.cpp setupeditor.cpp setuptooltip.cpp + +libsetup_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_TQT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor + +libsetup_la_LIBADD = $(top_builddir)/src/utilities/setup/libshowfotosetup.la + diff --git a/src/showfoto/setup/setup.cpp b/src/showfoto/setup/setup.cpp new file mode 100644 index 00000000..85ec82d2 --- /dev/null +++ b/src/showfoto/setup/setup.cpp @@ -0,0 +1,153 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2005-04-02 + * Description : showfoto setup dialog. + * + * Copyright (C) 2005-2007 by Gilles Caulier <caulier dot gilles at gmail dot com> + * + * 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. + * + * ============================================================ */ + +// TQt includes. + +#include <tqtabwidget.h> +#include <tqapplication.h> +#include <tqframe.h> + +// KDE includes. + +#include <tdelocale.h> +#include <kiconloader.h> +#include <tdeconfig.h> +#include <tdeapplication.h> + +// Local includes. + +#include "setuptooltip.h" +#include "setupeditor.h" +#include "setupdcraw.h" +#include "setupiofiles.h" +#include "setupslideshow.h" +#include "setupicc.h" +#include "setup.h" +#include "setup.moc" + +namespace ShowFoto +{ + +class SetupPrivate +{ +public: + + SetupPrivate() + { + editorPage = 0; + toolTipPage = 0; + dcrawPage = 0; + iofilesPage = 0; + slideshowPage = 0; + iccPage = 0; + page_editor = 0; + page_toolTip = 0; + page_dcraw = 0; + page_iofiles = 0; + page_slideshow = 0; + page_icc = 0; + } + + TQFrame *page_editor; + TQFrame *page_toolTip; + TQFrame *page_dcraw; + TQFrame *page_iofiles; + TQFrame *page_slideshow; + TQFrame *page_icc; + + SetupEditor *editorPage; + SetupToolTip *toolTipPage; + + Digikam::SetupDcraw *dcrawPage; + Digikam::SetupIOFiles *iofilesPage; + Digikam::SetupSlideShow *slideshowPage; + Digikam::SetupICC *iccPage; +}; + +Setup::Setup(TQWidget* parent, const char* name, Setup::Page page) + : KDialogBase(IconList, i18n("Configure"), Help|Ok|Cancel, Ok, parent, + name, true, true ) +{ + d = new SetupPrivate; + setHelp("setupdialog.anchor", "showfoto"); + + d->page_editor = addPage(i18n("General"), i18n("General Settings"), + BarIcon("showfoto", TDEIcon::SizeMedium)); + d->editorPage = new SetupEditor(d->page_editor); + + d->page_toolTip = addPage(i18n("Tool Tip"), i18n("Thumbbar Items Tool Tip Settings"), + BarIcon("filetypes", TDEIcon::SizeMedium)); + d->toolTipPage = new SetupToolTip(d->page_toolTip); + + d->page_dcraw = addPage(i18n("RAW decoding"), i18n("RAW Files Decoding Settings"), + BarIcon("kdcraw", TDEIcon::SizeMedium)); + d->dcrawPage = new Digikam::SetupDcraw(d->page_dcraw); + + d->page_icc = addPage(i18n("Color Management"), i18n("Color Management Settings"), + BarIcon("colorize", TDEIcon::SizeMedium)); + d->iccPage = new Digikam::SetupICC(d->page_icc, this); + + d->page_iofiles = addPage(i18n("Save Images"), i18n("Save Images' Files' Settings"), + BarIcon("document-save", TDEIcon::SizeMedium)); + d->iofilesPage = new Digikam::SetupIOFiles(d->page_iofiles); + + d->page_slideshow = addPage(i18n("Slide Show"), i18n("Slide Show Settings"), + BarIcon("slideshow", TDEIcon::SizeMedium)); + d->slideshowPage = new Digikam::SetupSlideShow(d->page_slideshow); + + connect(this, TQ_SIGNAL(okClicked()), + this, TQ_SLOT(slotOkClicked()) ); + + if (page != LastPageUsed) + showPage((int) page); + else + { + TDEConfig* config = kapp->config(); + config->setGroup("General Settings"); + showPage(config->readNumEntry("Setup Page", EditorPage)); + } + + show(); +} + +Setup::~Setup() +{ + TDEConfig* config = kapp->config(); + config->setGroup("General Settings"); + config->writeEntry("Setup Page", activePageIndex()); + config->sync(); + delete d; +} + +void Setup::slotOkClicked() +{ + d->editorPage->applySettings(); + d->toolTipPage->applySettings(); + d->dcrawPage->applySettings(); + d->iofilesPage->applySettings(); + d->slideshowPage->applySettings(); + d->iccPage->applySettings(); + close(); +} + +} // namespace ShowFoto diff --git a/src/showfoto/setup/setup.h b/src/showfoto/setup/setup.h new file mode 100644 index 00000000..8f97acbd --- /dev/null +++ b/src/showfoto/setup/setup.h @@ -0,0 +1,78 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2005-04-02 + * Description : showfoto setup dialog. + * + * Copyright (C) 2005-2007 by Gilles Caulier <caulier dot gilles at gmail dot com> + * + * 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. + * + * ============================================================ */ + +#ifndef SETUP_H +#define SETUP_H + +// KDE includes. + +#include <kdialogbase.h> + +class TQFrame; + +namespace Digikam +{ +class SetupIOFiles; +class SetupSlideShow; +class SetupICC; +} + +namespace ShowFoto +{ + +class SetupEditor; +class SetupPrivate; + +class Setup : public KDialogBase +{ + TQ_OBJECT + + +public: + + enum Page + { + LastPageUsed = -1, + EditorPage=0, + ToolTipPage, + DcrawPage, + IOFilesPage, + SlideshowPage, + ICCPage + }; + + Setup(TQWidget* parent=0, const char* name=0, Page page=LastPageUsed); + ~Setup(); + +private slots: + + void slotOkClicked(); + +private: + + SetupPrivate* d; +}; + +} // namespace ShowFoto + +#endif /* SETUP_H */ diff --git a/src/showfoto/setup/setupeditor.cpp b/src/showfoto/setup/setupeditor.cpp new file mode 100644 index 00000000..19bab8fb --- /dev/null +++ b/src/showfoto/setup/setupeditor.cpp @@ -0,0 +1,246 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2005-04-02 + * Description : setup showfoto tab. + * + * Copyright (C) 2005-2008 by Gilles Caulier <caulier dot gilles at gmail dot com> + * Copyright (C) 2008 by Arnd Baecker <arnd dot baecker at web dot de> + * + * 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. + * + * ============================================================ */ + +// TQt includes. + +#include <tqlayout.h> +#include <tqcolor.h> +#include <tqhbox.h> +#include <tqvgroupbox.h> +#include <tqlabel.h> +#include <tqwhatsthis.h> +#include <tqcheckbox.h> +#include <tqcombobox.h> + +// KDE includes. + +#include <tdelocale.h> +#include <kdialog.h> +#include <kcolorbutton.h> +#include <knuminput.h> +#include <tdeconfig.h> +#include <tdeapplication.h> + +// Local includes. + +#include "setupeditor.h" +#include "setupeditor.moc" + +namespace ShowFoto +{ + +class SetupEditorPriv +{ +public: + + SetupEditorPriv() + { + backgroundColor = 0; + hideToolBar = 0; + hideThumbBar = 0; + horizontalThumbBar = 0; + showSplash = 0; + useTrash = 0; + exifRotateBox = 0; + exifSetOrientationBox = 0; + overExposureColor = 0; + underExposureColor = 0; + themebackgroundColor = 0; + colorBox = 0; + sortOrderComboBox = 0; + sortReverse = 0; + useRawImportTool = 0; + } + + TQHBox *colorBox; + + TQCheckBox *sortReverse; + TQCheckBox *hideToolBar; + TQCheckBox *hideThumbBar; + TQCheckBox *horizontalThumbBar; + TQCheckBox *showSplash; + TQCheckBox *useTrash; + TQCheckBox *exifRotateBox; + TQCheckBox *exifSetOrientationBox; + TQCheckBox *themebackgroundColor; + TQCheckBox *useRawImportTool; + + TQComboBox *sortOrderComboBox; + + KColorButton *backgroundColor; + KColorButton *underExposureColor; + KColorButton *overExposureColor; +}; + +SetupEditor::SetupEditor(TQWidget* parent ) + : TQWidget(parent) +{ + d = new SetupEditorPriv; + TQVBoxLayout *layout = new TQVBoxLayout( parent, 0, KDialog::spacingHint() ); + + // -------------------------------------------------------- + + TQVGroupBox *interfaceOptionsGroup = new TQVGroupBox(i18n("Interface Options"), parent); + + d->themebackgroundColor = new TQCheckBox(i18n("&Use theme background color"), + interfaceOptionsGroup); + + TQWhatsThis::add( d->themebackgroundColor, i18n("<p>Enable this option to use background theme " + "color in image editor area") ); + + d->colorBox = new TQHBox(interfaceOptionsGroup); + TQLabel *backgroundColorlabel = new TQLabel( i18n("&Background color:"), d->colorBox); + d->backgroundColor = new KColorButton(d->colorBox); + backgroundColorlabel->setBuddy(d->backgroundColor); + TQWhatsThis::add( d->backgroundColor, i18n("<p>Select background color to use " + "for image editor area.") ); + + d->hideToolBar = new TQCheckBox(i18n("H&ide toolbar in fullscreen mode"), interfaceOptionsGroup); + d->hideThumbBar = new TQCheckBox(i18n("Hide &thumbbar in fullscreen mode"), interfaceOptionsGroup); + d->horizontalThumbBar = new TQCheckBox(i18n("Use &horizontal thumbbar (need to restart showFoto)"), interfaceOptionsGroup); + TQWhatsThis::add( d->horizontalThumbBar, i18n("<p>If this option is enabled, the thumbnails bar will be displayed horizontally behind " + "the image area. You need to restart showFoto for this option take effect.<p>")); + d->useTrash = new TQCheckBox(i18n("&Deleting items should move them to trash"), interfaceOptionsGroup); + d->showSplash = new TQCheckBox(i18n("&Show splash screen at startup"), interfaceOptionsGroup); + + d->useRawImportTool = new TQCheckBox(i18n("Use Raw Import Tool to handle Raw image"), interfaceOptionsGroup); + TQWhatsThis::add(d->useRawImportTool, i18n("<p>Set on this option to use Raw Import " + "tool before to load a Raw image, " + "to customize indeep decoding settings.")); + + // -------------------------------------------------------- + + TQVGroupBox *exposureOptionsGroup = new TQVGroupBox(i18n("Exposure Indicators"), parent); + + TQHBox *underExpoBox = new TQHBox(exposureOptionsGroup); + TQLabel *underExpoColorlabel = new TQLabel( i18n("&Under-exposure color:"), underExpoBox); + d->underExposureColor = new KColorButton(underExpoBox); + underExpoColorlabel->setBuddy(d->underExposureColor); + TQWhatsThis::add( d->underExposureColor, i18n("<p>Customize color used in image editor to identify " + "under-exposed pixels.") ); + + TQHBox *overExpoBox = new TQHBox(exposureOptionsGroup); + TQLabel *overExpoColorlabel = new TQLabel( i18n("&Over-exposure color:"), overExpoBox); + d->overExposureColor = new KColorButton(overExpoBox); + overExpoColorlabel->setBuddy(d->overExposureColor); + TQWhatsThis::add( d->overExposureColor, i18n("<p>Customize color used in image editor to identify " + "over-exposed pixels.") ); + + // -------------------------------------------------------- + + TQVGroupBox *ExifGroupOptions = new TQVGroupBox(i18n("EXIF Actions"), parent); + + d->exifRotateBox = new TQCheckBox(ExifGroupOptions); + d->exifRotateBox->setText(i18n("Show images/thumbs &rotated according to orientation tag")); + + d->exifSetOrientationBox = new TQCheckBox(ExifGroupOptions); + d->exifSetOrientationBox->setText(i18n("Set orientation tag to normal after rotate/flip")); + + // -------------------------------------------------------- + + TQVGroupBox *sortOptionsGroup = new TQVGroupBox(i18n("Sort order for images"), parent); + + TQHBox* sortBox = new TQHBox(sortOptionsGroup); + new TQLabel(i18n("Sort images by:"), sortBox); + d->sortOrderComboBox = new TQComboBox(false, sortBox); + d->sortOrderComboBox->insertItem(i18n("File Date"), 0); + d->sortOrderComboBox->insertItem(i18n("File Name"), 1); + d->sortOrderComboBox->insertItem(i18n("File size"), 2); + TQWhatsThis::add(d->sortOrderComboBox, i18n("<p>Here, select whether newly-loaded " + "images are sorted by file-date, file-name, or file-size.")); + + d->sortReverse = new TQCheckBox(i18n("Reverse ordering"), sortOptionsGroup); + TQWhatsThis::add(d->sortReverse, i18n("<p>If this option is enabled, newly-loaded " + "images will be sorted in descending order.")); + + // -------------------------------------------------------- + + layout->addWidget(interfaceOptionsGroup); + layout->addWidget(exposureOptionsGroup); + layout->addWidget(ExifGroupOptions); + layout->addWidget(sortOptionsGroup); + layout->addStretch(); + + // -------------------------------------------------------- + + connect(d->themebackgroundColor, TQ_SIGNAL(toggled(bool)), + this, TQ_SLOT(slotThemeBackgroundColor(bool))); + + readSettings(); +} + +SetupEditor::~SetupEditor() +{ + delete d; +} + +void SetupEditor::slotThemeBackgroundColor(bool e) +{ + d->colorBox->setEnabled(!e); +} + +void SetupEditor::readSettings() +{ + TDEConfig* config = kapp->config(); + TQColor Black(TQt::black); + TQColor White(TQt::white); + config->setGroup("ImageViewer Settings"); + d->themebackgroundColor->setChecked(config->readBoolEntry("UseThemeBackgroundColor", true)); + d->backgroundColor->setColor( config->readColorEntry("BackgroundColor", &Black ) ); + d->hideToolBar->setChecked(config->readBoolEntry("FullScreen Hide ToolBar", false)); + d->hideThumbBar->setChecked(config->readBoolEntry("FullScreenHideThumbBar", true)); + d->horizontalThumbBar->setChecked(config->readBoolEntry("HorizontalThumbbar", false)); + d->useTrash->setChecked(config->readBoolEntry("DeleteItem2Trash", false)); + d->showSplash->setChecked(config->readBoolEntry("ShowSplash", true)); + d->exifRotateBox->setChecked(config->readBoolEntry("EXIF Rotate", true)); + d->exifSetOrientationBox->setChecked(config->readBoolEntry("EXIF Set Orientation", true)); + d->underExposureColor->setColor(config->readColorEntry("UnderExposureColor", &White)); + d->overExposureColor->setColor(config->readColorEntry("OverExposureColor", &Black)); + d->sortOrderComboBox->setCurrentItem(config->readNumEntry("SortOrder", 0)); + d->sortReverse->setChecked(config->readBoolEntry("ReverseSort", false)); + d->useRawImportTool->setChecked(config->readBoolEntry("UseRawImportTool", false)); +} + +void SetupEditor::applySettings() +{ + TDEConfig* config = kapp->config(); + config->setGroup("ImageViewer Settings"); + config->writeEntry("UseThemeBackgroundColor", d->themebackgroundColor->isChecked()); + config->writeEntry("BackgroundColor", d->backgroundColor->color()); + config->writeEntry("FullScreen Hide ToolBar", d->hideToolBar->isChecked()); + config->writeEntry("FullScreenHideThumbBar", d->hideThumbBar->isChecked()); + config->writeEntry("HorizontalThumbbar", d->horizontalThumbBar->isChecked()); + config->writeEntry("DeleteItem2Trash", d->useTrash->isChecked()); + config->writeEntry("ShowSplash", d->showSplash->isChecked()); + config->writeEntry("EXIF Rotate", d->exifRotateBox->isChecked()); + config->writeEntry("EXIF Set Orientation", d->exifSetOrientationBox->isChecked()); + config->writeEntry("UnderExposureColor", d->underExposureColor->color()); + config->writeEntry("OverExposureColor", d->overExposureColor->color()); + config->writeEntry("SortOrder", d->sortOrderComboBox->currentItem()); + config->writeEntry("ReverseSort", d->sortReverse->isChecked()); + config->writeEntry("UseRawImportTool", d->useRawImportTool->isChecked()); + config->sync(); +} + +} // namespace ShowFoto diff --git a/src/showfoto/setup/setupeditor.h b/src/showfoto/setup/setupeditor.h new file mode 100644 index 00000000..877af8de --- /dev/null +++ b/src/showfoto/setup/setupeditor.h @@ -0,0 +1,63 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2005-04-02 + * Description : setup showfoto tab. + * + * Copyright (C) 2005-2008 by Gilles Caulier <caulier dot gilles at gmail dot com> + * + * 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. + * + * ============================================================ */ + +#ifndef SETUPEDITOR_H +#define SETUPEDITOR_H + +// TQt includes. + +#include <tqwidget.h> + +namespace ShowFoto +{ + +class SetupEditorPriv; + +class SetupEditor : public TQWidget +{ + TQ_OBJECT + + +public: + + SetupEditor(TQWidget* parent=0); + ~SetupEditor(); + + void applySettings(); + +private slots: + + void slotThemeBackgroundColor(bool); + +private: + + void readSettings(); + +private: + + SetupEditorPriv* d; +}; + +} // namespace ShowFoto + +#endif /* SETUPEDITOR_H */ diff --git a/src/showfoto/setup/setuptooltip.cpp b/src/showfoto/setup/setuptooltip.cpp new file mode 100644 index 00000000..d3a08678 --- /dev/null +++ b/src/showfoto/setup/setuptooltip.cpp @@ -0,0 +1,228 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2006-07-09 + * Description : tool tip contents configuration setup tab + * + * Copyright (C) 2006-2007 by Gilles Caulier <caulier dot gilles at gmail dot com> + * + * 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. + * + * ============================================================ */ + +// TQt includes. + +#include <tqlayout.h> +#include <tqvgroupbox.h> +#include <tqcheckbox.h> +#include <tqwhatsthis.h> + +// KDE includes. + +#include <tdelocale.h> +#include <kdialogbase.h> +#include <tdeapplication.h> +#include <tdeconfig.h> + +// Local includes. + +#include "setuptooltip.h" +#include "setuptooltip.moc" + +namespace ShowFoto +{ + +class SetupToolTipPriv +{ +public: + + SetupToolTipPriv() + { + showToolTipsBox = 0; + + showFileNameBox = 0; + showFileDateBox = 0; + showFileSizeBox = 0; + showImageTypeBox = 0; + showImageDimBox = 0; + + showPhotoMakeBox = 0; + showPhotoDateBox = 0; + showPhotoFocalBox = 0; + showPhotoExpoBox = 0; + showPhotoModeBox = 0; + showPhotoFlashBox = 0; + showPhotoWbBox = 0; + + fileSettingBox = 0; + photoSettingBox = 0; + } + + TQCheckBox *showToolTipsBox; + + TQCheckBox *showFileNameBox; + TQCheckBox *showFileDateBox; + TQCheckBox *showFileSizeBox; + TQCheckBox *showImageTypeBox; + TQCheckBox *showImageDimBox; + + TQCheckBox *showPhotoMakeBox; + TQCheckBox *showPhotoDateBox; + TQCheckBox *showPhotoFocalBox; + TQCheckBox *showPhotoExpoBox; + TQCheckBox *showPhotoModeBox; + TQCheckBox *showPhotoFlashBox; + TQCheckBox *showPhotoWbBox; + + TQVGroupBox *fileSettingBox; + TQVGroupBox *photoSettingBox; +}; + +SetupToolTip::SetupToolTip(TQWidget* parent) + : TQWidget(parent) +{ + d = new SetupToolTipPriv; + TQVBoxLayout *layout = new TQVBoxLayout( parent, 0, KDialog::spacingHint() ); + + d->showToolTipsBox = new TQCheckBox(i18n("Show Thumbbar items toolti&ps"), parent); + TQWhatsThis::add( d->showToolTipsBox, i18n("<p>Set this option to display image information when " + "the mouse hovers over a thumbbar item.")); + + layout->addWidget(d->showToolTipsBox); + + // -------------------------------------------------------- + + d->fileSettingBox = new TQVGroupBox(i18n("File/Image Information"), parent); + + d->showFileNameBox = new TQCheckBox(i18n("Show file name"), d->fileSettingBox); + TQWhatsThis::add( d->showFileNameBox, i18n("<p>Set this option to display the image file name.")); + + d->showFileDateBox = new TQCheckBox(i18n("Show file date"), d->fileSettingBox); + TQWhatsThis::add( d->showFileDateBox, i18n("<p>Set this option to display the image file date.")); + + d->showFileSizeBox = new TQCheckBox(i18n("Show file size"), d->fileSettingBox); + TQWhatsThis::add( d->showFileSizeBox, i18n("<p>Set this option to display the image file size.")); + + d->showImageTypeBox = new TQCheckBox(i18n("Show image type"), d->fileSettingBox); + TQWhatsThis::add( d->showImageTypeBox, i18n("<p>Set this option to display the image type.")); + + d->showImageDimBox = new TQCheckBox(i18n("Show image dimensions"), d->fileSettingBox); + TQWhatsThis::add( d->showImageDimBox, i18n("<p>Set this option to display the image dimensions in pixels.")); + + layout->addWidget(d->fileSettingBox); + + // -------------------------------------------------------- + + d->photoSettingBox = new TQVGroupBox(i18n("Photograph Information"), parent); + + d->showPhotoMakeBox = new TQCheckBox(i18n("Show camera make and model"), d->photoSettingBox); + TQWhatsThis::add( d->showPhotoMakeBox, i18n("<p>Set this option to display the make and model of the " + "camera with which the image has been taken.")); + + d->showPhotoDateBox = new TQCheckBox(i18n("Show camera date"), d->photoSettingBox); + TQWhatsThis::add( d->showPhotoDateBox, i18n("<p>Set this option to display the date when the image was taken.")); + + d->showPhotoFocalBox = new TQCheckBox(i18n("Show camera aperture and focal length"), d->photoSettingBox); + TQWhatsThis::add( d->showPhotoFocalBox, i18n("<p>Set this option to display the camera aperture and focal settings " + "used to take the image.")); + + d->showPhotoExpoBox = new TQCheckBox(i18n("Show camera exposure and sensitivity"), d->photoSettingBox); + TQWhatsThis::add( d->showPhotoExpoBox, i18n("<p>Set this option to display the camera exposure and sensitivity " + "used to take the image.")); + + d->showPhotoModeBox = new TQCheckBox(i18n("Show camera mode and program"), d->photoSettingBox); + TQWhatsThis::add( d->showPhotoModeBox, i18n("<p>Set this option to display the camera mode and program " + "used to take the image.")); + + d->showPhotoFlashBox = new TQCheckBox(i18n("Show camera flash settings"), d->photoSettingBox); + TQWhatsThis::add( d->showPhotoFlashBox, i18n("<p>Set this option to display the camera flash settings " + "used to take the image.")); + + d->showPhotoWbBox = new TQCheckBox(i18n("Show camera white balance settings"), d->photoSettingBox); + TQWhatsThis::add( d->showPhotoWbBox, i18n("<p>Set this option to display the camera white balance settings " + "used to take the image.")); + + layout->addWidget(d->photoSettingBox); + layout->addStretch(); + + // -------------------------------------------------------- + + connect(d->showToolTipsBox, TQ_SIGNAL(toggled(bool)), + d->fileSettingBox, TQ_SLOT(setEnabled(bool))); + + connect(d->showToolTipsBox, TQ_SIGNAL(toggled(bool)), + d->photoSettingBox, TQ_SLOT(setEnabled(bool))); + + // -------------------------------------------------------- + + readSettings(); + adjustSize(); +} + +SetupToolTip::~SetupToolTip() +{ + delete d; +} + +void SetupToolTip::readSettings() +{ + TDEConfig* config = kapp->config(); + config->setGroup("ImageViewer Settings"); + + d->showToolTipsBox->setChecked(config->readBoolEntry("Show ToolTips", true)); + + d->showFileNameBox->setChecked(config->readBoolEntry("ToolTips Show File Name", true)); + d->showFileDateBox->setChecked(config->readBoolEntry("ToolTips Show File Date", false)); + d->showFileSizeBox->setChecked(config->readBoolEntry("ToolTips Show File Size", false)); + d->showImageTypeBox->setChecked(config->readBoolEntry("ToolTips Show Image Type", false)); + d->showImageDimBox->setChecked(config->readBoolEntry("ToolTips Show Image Dim", true)); + + d->showPhotoMakeBox->setChecked(config->readBoolEntry("ToolTips Show Photo Make", true)); + d->showPhotoDateBox->setChecked(config->readBoolEntry("ToolTips Show Photo Date", true)); + d->showPhotoFocalBox->setChecked(config->readBoolEntry("ToolTips Show Photo Focal", true)); + d->showPhotoExpoBox->setChecked(config->readBoolEntry("ToolTips Show Photo Expo", true)); + d->showPhotoModeBox->setChecked(config->readBoolEntry("ToolTips Show Photo Mode", true)); + d->showPhotoFlashBox->setChecked(config->readBoolEntry("ToolTips Show Photo Flash", false)); + d->showPhotoWbBox->setChecked(config->readBoolEntry("ToolTips Show Photo WB", false)); + + d->fileSettingBox->setEnabled(d->showToolTipsBox->isChecked()); + d->photoSettingBox->setEnabled(d->showToolTipsBox->isChecked()); +} + +void SetupToolTip::applySettings() +{ + TDEConfig* config = kapp->config(); + config->setGroup("ImageViewer Settings"); + + config->writeEntry("Show ToolTips", d->showToolTipsBox->isChecked()); + + config->writeEntry("ToolTips Show File Name", d->showFileNameBox->isChecked()); + config->writeEntry("ToolTips Show File Date", d->showFileDateBox->isChecked()); + config->writeEntry("ToolTips Show File Size", d->showFileSizeBox->isChecked()); + config->writeEntry("ToolTips Show Image Type", d->showImageTypeBox->isChecked()); + config->writeEntry("ToolTips Show Image Dim", d->showImageDimBox->isChecked()); + + config->writeEntry("ToolTips Show Photo Make", d->showPhotoMakeBox->isChecked()); + config->writeEntry("ToolTips Show Photo Date", d->showPhotoDateBox->isChecked()); + config->writeEntry("ToolTips Show Photo Focal", d->showPhotoFocalBox->isChecked()); + config->writeEntry("ToolTips Show Photo Expo", d->showPhotoExpoBox->isChecked()); + config->writeEntry("ToolTips Show Photo Mode", d->showPhotoModeBox->isChecked()); + config->writeEntry("ToolTips Show Photo Flash", d->showPhotoFlashBox->isChecked()); + config->writeEntry("ToolTips Show Photo WB", d->showPhotoWbBox->isChecked()); + + config->sync(); +} + +} // namespace ShowFoto + diff --git a/src/showfoto/setup/setuptooltip.h b/src/showfoto/setup/setuptooltip.h new file mode 100644 index 00000000..ebd73f6e --- /dev/null +++ b/src/showfoto/setup/setuptooltip.h @@ -0,0 +1,59 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2006-07-09 + * Description : tool tip contents configuration setup tab + * + * Copyright (C) 2006-2007 by Gilles Caulier <caulier dot gilles at gmail dot com> + * + * 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. + * + * ============================================================ */ + +#ifndef SETUPTOOLTIP_H +#define SETUPTOOLTIP_H + +// TQt includes. + +#include <tqwidget.h> + +namespace ShowFoto +{ + +class SetupToolTipPriv; + +class SetupToolTip : public TQWidget +{ + TQ_OBJECT + + +public: + + SetupToolTip(TQWidget* parent = 0); + ~SetupToolTip(); + + void applySettings(); + +private: + + void readSettings(); + +private: + + SetupToolTipPriv* d; +}; + +} // namespace ShowFoto + +#endif // SETUPTOOLTIP_H diff --git a/src/showfoto/showfoto.cpp b/src/showfoto/showfoto.cpp new file mode 100644 index 00000000..42575833 --- /dev/null +++ b/src/showfoto/showfoto.cpp @@ -0,0 +1,1240 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2004-11-22 + * Description : stand alone digiKam image editor GUI + * + * Copyright (C) 2004-2005 by Renchi Raju <renchi@pooh.tam.uiuc.edu> + * Copyright (C) 2005-2006 by Tom Albers <tomalbers@kde.nl> + * Copyright (C) 2004-2008 by Gilles Caulier <caulier dot gilles at gmail dot com> + * Copyright (C) 2006-2008 by Marcel Wiesweg <marcel.wiesweg@gmx.de> + * Copyright (C) 2008 by Arnd Baecker <arnd dot baecker at web dot de> + * + * 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. + * + * ============================================================ */ + +// C Ansi includes. + +extern "C" +{ +#include <unistd.h> +} + +// C++ includes. + +#include <cstdio> + +// TQt includes. + +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqsplitter.h> +#include <tqdir.h> +#include <tqfileinfo.h> +#include <tqfile.h> +#include <tqcursor.h> + +// KDE includes. + +#include <kcursor.h> +#include <tdeaction.h> +#include <kstdaction.h> +#include <tdeapplication.h> +#include <tdeconfig.h> +#include <tdelocale.h> +#include <tdefiledialog.h> +#include <tdemenubar.h> +#include <kimageio.h> +#include <tdeaccel.h> +#include <tdeversion.h> +#include <tdemessagebox.h> +#include <tdeglobal.h> +#include <kstandarddirs.h> +#include <kiconloader.h> +#include <tdeio/netaccess.h> +#include <tdeio/job.h> +#include <kprotocolinfo.h> +#include <tdeglobalsettings.h> +#include <tdetoolbar.h> +#include <kstatusbar.h> +#include <kprogress.h> + +// LibKDcraw includes. + +#include <libkdcraw/version.h> +#include <libkdcraw/kdcraw.h> + +#if KDCRAW_VERSION < 0x000106 +#include <libkdcraw/dcrawbinary.h> +#endif + +// Local includes. + +#include "ddebug.h" +#include "dpopupmenu.h" +#include "dmetadata.h" +#include "canvas.h" +#include "thumbbar.h" +#include "imagepropertiessidebar.h" +#include "imageplugin.h" +#include "imagepluginloader.h" +#include "imagedialog.h" +#include "dimginterface.h" +#include "splashscreen.h" +#include "slideshow.h" +#include "setup.h" +#include "setupicc.h" +#include "statusprogressbar.h" +#include "iccsettingscontainer.h" +#include "iofilesettingscontainer.h" +#include "loadingcacheinterface.h" +#include "savingcontextcontainer.h" +#include "themeengine.h" +#include "editorstackview.h" +#include "showfoto.h" +#include "showfoto.moc" + +namespace ShowFoto +{ + +class ShowFotoPriv +{ +public: + + ShowFotoPriv() + { + currentItem = 0; + itemsNb = 0; + splash = 0; + BCGAction = 0; + showBarAction = 0; + openFilesInFolderAction = 0; + fileOpenAction = 0; + thumbBar = 0; + rightSidebar = 0; + splash = 0; + itemsNb = 0; + vSplitter = 0; + deleteItem2Trash = true; + fullScreenHideThumbBar = true; + validIccPath = true; + } + + bool fullScreenHideThumbBar; + bool deleteItem2Trash; + bool validIccPath; + + int itemsNb; + + TQSplitter *vSplitter; + + KURL lastOpenedDirectory; + + TDEToggleAction *showBarAction; + + TDEAction *openFilesInFolderAction; + TDEAction *fileOpenAction; + + TDEActionMenu *BCGAction; + + Digikam::ThumbBarView *thumbBar; + Digikam::ThumbBarItem *currentItem; + Digikam::ImagePropertiesSideBar *rightSidebar; + Digikam::SplashScreen *splash; +}; + +ShowFoto::ShowFoto(const KURL::List& urlList) + : Digikam::EditorWindow( "Showfoto" ) +{ + d = new ShowFotoPriv(); + + // -- Show splash at start ---------------------------- + + TDEConfig* config = kapp->config(); + config->setGroup("ImageViewer Settings"); + TDEGlobal::dirs()->addResourceType("data", TDEGlobal::dirs()->kde_default("data") + "digikam"); + TDEGlobal::iconLoader()->addAppDir("digikam"); + + if(config->readBoolEntry("ShowSplash", true) && !kapp->isRestored()) + { + d->splash = new Digikam::SplashScreen("showfoto-splash.png"); + d->splash->show(); + } + + // Check ICC profiles repository availability + + if(d->splash) + d->splash->message(i18n("Checking ICC repository")); + + d->validIccPath = Digikam::SetupICC::iccRepositoryIsValid(); + +#if KDCRAW_VERSION < 0x000106 + // Check witch dcraw version available + + if(d->splash) + d->splash->message(i18n("Checking dcraw version")); + + KDcrawIface::DcrawBinary::instance()->checkSystem(); +#endif + + // Populate Themes + + if(d->splash) + d->splash->message(i18n("Loading themes")); + + Digikam::ThemeEngine::instance()->scanThemes(); + + // -- Build the GUI ----------------------------------- + + setupUserArea(); + setupStatusBar(); + setupActions(); + + // Load image plugins to GUI + + m_imagePluginLoader = new Digikam::ImagePluginLoader(this, d->splash); + loadImagePlugins(); + + // If plugin core is not available, plug BCG actions to collection instead. + + if ( !m_imagePluginLoader->pluginLibraryIsLoaded("digikamimageplugin_core") ) + { + d->BCGAction = new TDEActionMenu(i18n("Brightness/Contrast/Gamma"), 0, 0, "showfoto_bcg"); + d->BCGAction->setDelayed(false); + + TDEAction *incGammaAction = new TDEAction(i18n("Increase Gamma"), 0, ALT+Key_G, + this, TQ_SLOT(slotChangeBCG()), + actionCollection(), "gamma_plus"); + TDEAction *decGammaAction = new TDEAction(i18n("Decrease Gamma"), 0, ALT+SHIFT+Key_G, + this, TQ_SLOT(slotChangeBCG()), + actionCollection(), "gamma_minus"); + TDEAction *incBrightAction = new TDEAction(i18n("Increase Brightness"), 0, ALT+Key_B, + this, TQ_SLOT(slotChangeBCG()), + actionCollection(), "brightness_plus"); + TDEAction *decBrightAction = new TDEAction(i18n("Decrease Brightness"), 0, ALT+SHIFT+Key_B, + this, TQ_SLOT(slotChangeBCG()), + actionCollection(), "brightness_minus"); + TDEAction *incContrastAction = new TDEAction(i18n("Increase Contrast"), 0, ALT+Key_C, + this, TQ_SLOT(slotChangeBCG()), + actionCollection(), "contrast_plus"); + TDEAction *decContrastAction = new TDEAction(i18n("Decrease Contrast"), 0, ALT+SHIFT+Key_C, + this, TQ_SLOT(slotChangeBCG()), + actionCollection(), "contrast_minus"); + + d->BCGAction->insert(incBrightAction); + d->BCGAction->insert(decBrightAction); + d->BCGAction->insert(incContrastAction); + d->BCGAction->insert(decContrastAction); + d->BCGAction->insert(incGammaAction); + d->BCGAction->insert(decGammaAction); + + TQPtrList<TDEAction> bcg_actions; + bcg_actions.append( d->BCGAction ); + unplugActionList( "showfoto_bcg" ); + plugActionList( "showfoto_bcg", bcg_actions ); + } + + // Create context menu. + + setupContextMenu(); + + // Make signals/slots connections + + setupConnections(); + + // -- Read settings -------------------------------- + + readSettings(); + applySettings(); + setAutoSaveSettings("ImageViewer Settings"); + + // -- Load current items --------------------------- + + for (KURL::List::const_iterator it = urlList.begin(); + it != urlList.end(); ++it) + { + KURL url = *it; + if (url.isLocalFile()) + { + TQFileInfo fi(url.path()); + if (fi.isDir()) + { + // Local Dir + openFolder(url); + } + else + { + // Local file + new Digikam::ThumbBarItem(d->thumbBar, url); + d->lastOpenedDirectory=(*it); + } + } + else + { + // Remote file. + new Digikam::ThumbBarItem(d->thumbBar, url); + d->lastOpenedDirectory=(*it); + } + } + + if ( urlList.isEmpty() ) + { + emit signalNoCurrentItem(); + toggleActions(false); + toggleNavigation(0); + } + else + { + toggleNavigation(1); + toggleActions(true); + } +} + +ShowFoto::~ShowFoto() +{ + unLoadImagePlugins(); + + delete m_imagePluginLoader; + delete d->thumbBar; + delete d->rightSidebar; + delete d; +} + +Digikam::Sidebar* ShowFoto::rightSideBar() const +{ + return dynamic_cast<Digikam::Sidebar*>(d->rightSidebar); +} + +bool ShowFoto::queryClose() +{ + // wait if a save operation is currently running + if (!waitForSavingToComplete()) + return false; + + if (d->currentItem && !promptUserSave(d->currentItem->url())) + return false; + + // put right side bar in a defined state + emit signalNoCurrentItem(); + m_canvas->resetImage(); + + return true; +} + +bool ShowFoto::queryExit() +{ + saveSettings(); + return true; +} + +void ShowFoto::show() +{ + // Remove Splashscreen. + + if(d->splash) + { + d->splash->finish(this); + delete d->splash; + d->splash = 0; + } + + // Display application window. + + TDEMainWindow::show(); + + // Report errors from ICC repository path. + + TDEConfig* config = kapp->config(); + if(!d->validIccPath) + { + TQString message = i18n("<qt><p>The ICC profile path seems to be invalid.</p>" + "<p>If you want to set it now, select \"Yes\", otherwise " + "select \"No\". In this case, \"Color Management\" feature " + "will be disabled until you solve this issue</p></qt>"); + + if (KMessageBox::warningYesNo(this, message) == KMessageBox::Yes) + { + if (!setup(true)) + { + config->setGroup("Color Management"); + config->writeEntry("EnableCM", false); + config->sync(); + } + } + else + { + config->setGroup("Color Management"); + config->writeEntry("EnableCM", false); + config->sync(); + } + } + +#if KDCRAW_VERSION < 0x000106 + // Report errors from dcraw detection. + + KDcrawIface::DcrawBinary::instance()->checkReport(); +#endif +} + +void ShowFoto::setupConnections() +{ + setupStandardConnections(); + + connect(d->thumbBar, TQ_SIGNAL(signalURLSelected(const KURL&)), + this, TQ_SLOT(slotOpenURL(const KURL&))); + + connect(d->thumbBar, TQ_SIGNAL(signalItemAdded()), + this, TQ_SLOT(slotUpdateItemInfo())); + + connect(this, TQ_SIGNAL(signalSelectionChanged(const TQRect &)), + d->rightSidebar, TQ_SLOT(slotImageSelectionChanged(const TQRect &))); + + connect(this, TQ_SIGNAL(signalNoCurrentItem()), + d->rightSidebar, TQ_SLOT(slotNoCurrentItem())); +} + +void ShowFoto::setupUserArea() +{ + TDEConfig* config = kapp->config(); + config->setGroup("ImageViewer Settings"); + + TQWidget* widget = new TQWidget(this); + TQSizePolicy rightSzPolicy(TQSizePolicy::Preferred, TQSizePolicy::Expanding, 2, 1); + + if(!config->readBoolEntry("HorizontalThumbbar", false)) // Vertical thumbbar layout + { + TQHBoxLayout *hlay = new TQHBoxLayout(widget); + m_splitter = new TQSplitter(widget); + d->thumbBar = new Digikam::ThumbBarView(m_splitter, Digikam::ThumbBarView::Vertical); + m_stackView = new Digikam::EditorStackView(m_splitter); + m_canvas = new Digikam::Canvas(m_stackView); + m_canvas->setSizePolicy(rightSzPolicy); + + d->rightSidebar = new Digikam::ImagePropertiesSideBar(widget, "ShowFoto Sidebar Right", m_splitter, + Digikam::Sidebar::Right); + + hlay->addWidget(m_splitter); + hlay->addWidget(d->rightSidebar); + } + else // Horizontal thumbbar layout + { + m_splitter = new TQSplitter(TQt::Horizontal, widget); + TQWidget* widget2 = new TQWidget(m_splitter); + TQVBoxLayout *vlay = new TQVBoxLayout(widget2); + d->vSplitter = new TQSplitter(TQt::Vertical, widget2); + m_stackView = new Digikam::EditorStackView(d->vSplitter); + m_canvas = new Digikam::Canvas(m_stackView); + d->thumbBar = new Digikam::ThumbBarView(d->vSplitter, Digikam::ThumbBarView::Horizontal); + + m_canvas->setSizePolicy(rightSzPolicy); + + d->vSplitter->setFrameStyle( TQFrame::NoFrame ); + d->vSplitter->setFrameShadow( TQFrame::Plain ); + d->vSplitter->setFrameShape( TQFrame::NoFrame ); + d->vSplitter->setOpaqueResize(false); + + vlay->addWidget(d->vSplitter); + + TQHBoxLayout *hlay = new TQHBoxLayout(widget); + d->rightSidebar = new Digikam::ImagePropertiesSideBar(widget, "ShowFoto Sidebar Right", m_splitter, + Digikam::Sidebar::Right); + hlay->addWidget(m_splitter); + hlay->addWidget(d->rightSidebar); + } + + m_canvas->makeDefaultEditingCanvas(); + m_stackView->setCanvas(m_canvas); + m_stackView->setViewMode(Digikam::EditorStackView::CanvasMode); + + m_splitter->setFrameStyle( TQFrame::NoFrame ); + m_splitter->setFrameShadow( TQFrame::Plain ); + m_splitter->setFrameShape( TQFrame::NoFrame ); + m_splitter->setOpaqueResize(false); + setCentralWidget(widget); + d->rightSidebar->loadViewState(); +} + +void ShowFoto::setupActions() +{ + setupStandardActions(); + + // Provides a menu entry that allows showing/hiding the toolbar(s) + setStandardToolBarMenuEnabled(true); + + // Provides a menu entry that allows showing/hiding the statusbar + createStandardStatusBarAction(); + + // Extra 'File' menu actions --------------------------------------------- + + d->fileOpenAction = KStdAction::open(this, TQ_SLOT(slotOpenFile()), + actionCollection(), "showfoto_open_file"); + + d->openFilesInFolderAction = new TDEAction(i18n("Open folder"), + "folder_image", + CTRL+SHIFT+Key_O, + this, + TQ_SLOT(slotOpenFilesInFolder()), + actionCollection(), + "showfoto_open_folder"); + + KStdAction::quit(this, TQ_SLOT(close()), actionCollection(), "showfoto_quit"); + + // Extra 'View' menu actions --------------------------------------------- + + d->showBarAction = new TDEToggleAction(i18n("Show Thumbnails"), 0, + CTRL+Key_T, + this, TQ_SLOT(slotToggleShowBar()), + actionCollection(), "shofoto_showthumbs"); + + // --- Create the gui -------------------------------------------------------------- + + createGUI("showfotoui.rc", false); + + setupStandardAccelerators(); +} + +void ShowFoto::readSettings() +{ + readStandardSettings(); + + TDEConfig* config = kapp->config(); + config->setGroup("ImageViewer Settings"); + + d->showBarAction->setChecked(config->readBoolEntry("Show Thumbnails", true)); + slotToggleShowBar(); + + d->lastOpenedDirectory.setPath( config->readEntry("Last Opened Directory", + TDEGlobalSettings::documentPath()) ); + + TQSizePolicy szPolicy(TQSizePolicy::Preferred, TQSizePolicy::Expanding, 2, 1); + if(config->hasKey("Vertical Splitter Sizes") && d->vSplitter) + d->vSplitter->setSizes(config->readIntListEntry("Vertical Splitter Sizes")); + else + m_canvas->setSizePolicy(szPolicy); + + Digikam::ThemeEngine::instance()->setCurrentTheme(config->readEntry("Theme", i18n("Default"))); +} + +void ShowFoto::saveSettings() +{ + saveStandardSettings(); + + TDEConfig* config = kapp->config(); + config->setGroup("ImageViewer Settings"); + + config->writeEntry("Last Opened Directory", d->lastOpenedDirectory.path() ); + config->writeEntry("Show Thumbnails", d->showBarAction->isChecked()); + + if (d->vSplitter) + config->writeEntry("Vertical Splitter Sizes", d->vSplitter->sizes()); + + config->writeEntry("Theme", Digikam::ThemeEngine::instance()->getCurrentThemeName()); + + config->sync(); +} + +void ShowFoto::applySettings() +{ + applyStandardSettings(); + + TDEConfig* config = kapp->config(); + config->setGroup("ImageViewer Settings"); + + // Current image deleted go to trash ? + d->deleteItem2Trash = config->readBoolEntry("DeleteItem2Trash", true); + if (d->deleteItem2Trash) + { + m_fileDeleteAction->setIcon("edittrash"); + m_fileDeleteAction->setText(i18n("Move to Trash")); + } + else + { + m_fileDeleteAction->setIcon("edit-delete"); + m_fileDeleteAction->setText(i18n("Delete File")); + } + + bool exifRotate = config->readBoolEntry("EXIF Rotate", true); + m_canvas->setExifOrient(exifRotate); + d->thumbBar->setExifRotate(exifRotate); + + m_setExifOrientationTag = config->readBoolEntry("EXIF Set Orientation", true); + + d->fullScreenHideThumbBar = config->readBoolEntry("FullScreenHideThumbBar", true); + + Digikam::ThumbBarToolTipSettings settings; + settings.showToolTips = config->readBoolEntry("Show ToolTips", true); + settings.showFileName = config->readBoolEntry("ToolTips Show File Name", true); + settings.showFileDate = config->readBoolEntry("ToolTips Show File Date", false); + settings.showFileSize = config->readBoolEntry("ToolTips Show File Size", false); + settings.showImageType = config->readBoolEntry("ToolTips Show Image Type", false); + settings.showImageDim = config->readBoolEntry("ToolTips Show Image Dim", true); + settings.showPhotoMake = config->readBoolEntry("ToolTips Show Photo Make", true); + settings.showPhotoDate = config->readBoolEntry("ToolTips Show Photo Date", true); + settings.showPhotoFocal = config->readBoolEntry("ToolTips Show Photo Focal", true); + settings.showPhotoExpo = config->readBoolEntry("ToolTips Show Photo Expo", true); + settings.showPhotoMode = config->readBoolEntry("ToolTips Show Photo Mode", true); + settings.showPhotoFlash = config->readBoolEntry("ToolTips Show Photo Flash", false); + settings.showPhotoWB = config->readBoolEntry("ToolTips Show Photo WB", false); + d->thumbBar->setToolTipSettings(settings); +} + +void ShowFoto::slotOpenFile() +{ + if (d->currentItem && !promptUserSave(d->currentItem->url())) + return; + + KURL::List urls = Digikam::ImageDialog::getImageURLs(this, d->lastOpenedDirectory); + + if (!urls.isEmpty()) + { + d->currentItem = 0; + d->thumbBar->clear(); + + for (KURL::List::const_iterator it = urls.begin(); + it != urls.end(); ++it) + { + new Digikam::ThumbBarItem(d->thumbBar, *it); + d->lastOpenedDirectory=(*it); + } + + toggleActions(true); + } +} + +void ShowFoto::slotOpenURL(const KURL& url) +{ + if(d->currentItem && !promptUserSave(d->currentItem->url())) + { + d->thumbBar->blockSignals(true); + d->thumbBar->setSelected(d->currentItem); + d->thumbBar->blockSignals(false); + return; + } + + d->currentItem = d->thumbBar->currentItem(); + if(!d->currentItem) + return; + + TQString localFile; +#if KDE_IS_VERSION(3,2,0) + TDEIO::NetAccess::download(url, localFile, this); +#else + TDEIO::NetAccess::download(url, localFile); +#endif + + m_canvas->load(localFile, m_IOFileSettings); + + // TODO : add preload here like in ImageWindow::slotLoadCurrent() ??? +} + +void ShowFoto::toggleGUI2FullScreen() +{ + if (m_fullScreen) + { + d->rightSidebar->restore(); + + // If show Thumbbar option is checked, restore it. + if (d->showBarAction->isChecked()) + d->thumbBar->show(); + } + else + { + d->rightSidebar->backup(); + + // If Hide Thumbbar option is checked, catch it if necessary. + if (d->showBarAction->isChecked()) + { + if (d->fullScreenHideThumbBar) + d->thumbBar->hide(); + } + } +} + +void ShowFoto::slotToggleShowBar() +{ + if (d->showBarAction->isChecked()) + d->thumbBar->show(); + else + d->thumbBar->hide(); +} + +void ShowFoto::slotChangeBCG() +{ + TQString name; + if (sender()) + name = sender()->name(); + + if (name == "gamma_plus") + { + m_canvas->increaseGamma(); + } + else if (name == "gamma_minus") + { + m_canvas->decreaseGamma(); + } + else if (name == "brightness_plus") + { + m_canvas->increaseBrightness(); + } + else if (name == "brightness_minus") + { + m_canvas->decreaseBrightness(); + } + else if (name == "contrast_plus") + { + m_canvas->increaseContrast(); + } + else if (name == "contrast_minus") + { + m_canvas->decreaseContrast(); + } +} + +void ShowFoto::slotChanged() +{ + TQString mpixels; + TQSize dims(m_canvas->imageWidth(), m_canvas->imageHeight()); + mpixels.setNum(dims.width()*dims.height()/1000000.0, 'f', 2); + TQString str = (!dims.isValid()) ? i18n("Unknown") : i18n("%1x%2 (%3Mpx)") + .arg(dims.width()).arg(dims.height()).arg(mpixels); + m_resLabel->setText(str); + + if (d->currentItem) + { + if (d->currentItem->url().isValid()) + { + TQRect sel = m_canvas->getSelectedArea(); + Digikam::DImg* img = m_canvas->interface()->getImg(); + d->rightSidebar->itemChanged(d->currentItem->url(), sel, img); + } + } +} + +void ShowFoto::slotUndoStateChanged(bool moreUndo, bool moreRedo, bool canSave) +{ + m_revertAction->setEnabled(canSave); + m_undoAction->setEnabled(moreUndo); + m_redoAction->setEnabled(moreRedo); + m_saveAction->setEnabled(canSave); + + if (!moreUndo) + m_rotatedOrFlipped = false; +} + +void ShowFoto::toggleActions(bool val) +{ + toggleStandardActions(val); + + // if BCG actions exists then toggle it. + if (d->BCGAction) + d->BCGAction->setEnabled(val); +} + +void ShowFoto::slotFilePrint() +{ + printImage(d->currentItem->url()); +} + +bool ShowFoto::setup(bool iccSetupPage) +{ + Setup setup(this, 0, iccSetupPage ? Setup::ICCPage : Setup::LastPageUsed); + + if (setup.exec() != TQDialog::Accepted) + return false; + + kapp->config()->sync(); + + applySettings(); + + if ( d->itemsNb == 0 ) + { + slotUpdateItemInfo(); + toggleActions(false); + } + + return true; +} + +void ShowFoto::slotUpdateItemInfo(void) +{ + d->itemsNb = d->thumbBar->countItems(); + + m_rotatedOrFlipped = false; + int index = 0; + TQString text; + + if (d->itemsNb > 0) + { + index = 1; + + for (Digikam::ThumbBarItem *item = d->thumbBar->firstItem(); item; item = item->next()) + { + if (item->url().equals(d->currentItem->url())) + { + break; + } + index++; + } + + text = d->currentItem->url().filename() + + i18n(" (%2 of %3)") + .arg(TQString::number(index)) + .arg(TQString::number(d->itemsNb)); + + setCaption(d->currentItem->url().directory()); + } + else + { + text = ""; + setCaption(""); + } + + m_nameLabel->setText(text); + + toggleNavigation( index ); +} + +void ShowFoto::slotOpenFolder(const KURL& url) +{ + if (d->currentItem && !promptUserSave(d->currentItem->url())) + return; + + m_canvas->load(TQString(), m_IOFileSettings); + d->thumbBar->clear(true); + emit signalNoCurrentItem(); + d->currentItem = 0; + openFolder(url); + toggleActions(true); + toggleNavigation(1); +} + +void ShowFoto::openFolder(const KURL& url) +{ + if (!url.isValid() || !url.isLocalFile()) + return; + + // Parse KDE image IO mime types registration to get files filter pattern. + + TQStringList mimeTypes = KImageIO::mimeTypes(KImageIO::Reading); + TQString filter; + + for (TQStringList::ConstIterator it = mimeTypes.begin() ; it != mimeTypes.end() ; ++it) + { + TQString format = KImageIO::typeForMime(*it); + filter.append ("*."); + filter.append (format); + filter.append (" "); + } + + // Because KImageIO return only *.JPEG and *.TIFF mime types. + if ( filter.contains("*.TIFF") ) + filter.append (" *.TIF"); + if ( filter.contains("*.JPEG") ) + { + filter.append (" *.JPG"); + filter.append (" *.JPE"); + } + + // Added RAW files estentions supported by dcraw program and + // defines to digikam/libs/dcraw/rawfiles.h + filter.append (" "); +#if KDCRAW_VERSION < 0x000106 + filter.append ( TQString(KDcrawIface::DcrawBinary::instance()->rawFiles()) ); +#else + filter.append ( TQString(KDcrawIface::KDcraw::rawFiles()) ); +#endif + filter.append (" "); + + TQString patterns = filter.lower(); + patterns.append (" "); + patterns.append (filter.upper()); + + DDebug() << "patterns=" << patterns << endl; + + // Get all image files from directory. + + TQDir dir(url.path(), patterns); + dir.setFilter ( TQDir::Files | TQDir::NoSymLinks ); + + if (!dir.exists()) + return; + + // Determine sort ordering for the entries from configuration setting: + + TDEConfig* config = kapp->config(); + config->setGroup("ImageViewer Settings"); + int flag; + + switch(config->readNumEntry("SortOrder", 0)) + { + case 1: + flag = TQDir::Name; // Ordering by file name. + break; + case 2: + flag = TQDir::Size; // Ordering by file size. + break; + default: + flag = TQDir::Time; // Ordering by file date. + break; + } + + // Disabled reverse in the settings leads e.g. to increasing dates + // Note, that this is just the opposite to the sort order for TQDir. + + if (!config->readBoolEntry("ReverseSort", false)) + flag = flag | TQDir::Reversed; + + dir.setSorting(flag); + + const TQFileInfoList* fileinfolist = dir.entryInfoList(); + if (!fileinfolist || fileinfolist->isEmpty()) + { + KMessageBox::sorry(this, i18n("There are no images in this folder.")); + return; + } + + TQFileInfoListIterator it(*fileinfolist); + TQFileInfo* fi; + + // And open all items in image editor. + + while( (fi = it.current() ) ) + { + new Digikam::ThumbBarItem( d->thumbBar, KURL(fi->filePath()) ); + ++it; + } +} + +void ShowFoto::slotOpenFilesInFolder() +{ + if (d->currentItem && !promptUserSave(d->currentItem->url())) + return; + + KURL url(KFileDialog::getExistingDirectory(d->lastOpenedDirectory.directory(), + this, i18n("Open Images From Folder"))); + + if (!url.isEmpty()) + { + d->lastOpenedDirectory = url; + slotOpenFolder(url); + } +} + +void ShowFoto::slotFirst() +{ + if (d->currentItem && !promptUserSave(d->currentItem->url())) + return; + + d->thumbBar->setSelected( d->thumbBar->firstItem() ); + d->currentItem = d->thumbBar->firstItem(); +} + +void ShowFoto::slotLast() +{ + if (d->currentItem && !promptUserSave(d->currentItem->url())) + return; + + d->thumbBar->setSelected( d->thumbBar->lastItem() ); + d->currentItem = d->thumbBar->lastItem(); +} + +void ShowFoto::slotForward() +{ + if (d->currentItem && !promptUserSave(d->currentItem->url())) + return; + + Digikam::ThumbBarItem* curr = d->thumbBar->currentItem(); + if (curr && curr->next()) + { + d->thumbBar->setSelected(curr->next()); + d->currentItem = d->thumbBar->currentItem(); + } +} + +void ShowFoto::slotBackward() +{ + if (d->currentItem && !promptUserSave(d->currentItem->url())) + return; + + Digikam::ThumbBarItem* curr = d->thumbBar->currentItem(); + if (curr && curr->prev()) + { + d->thumbBar->setSelected(curr->prev()); + d->currentItem = d->thumbBar->currentItem(); + } +} + +void ShowFoto::toggleNavigation(int index) +{ + if ( d->itemsNb == 0 || d->itemsNb == 1 ) + { + m_backwardAction->setEnabled(false); + m_forwardAction->setEnabled(false); + m_firstAction->setEnabled(false); + m_lastAction->setEnabled(false); + } + else + { + m_backwardAction->setEnabled(true); + m_forwardAction->setEnabled(true); + m_firstAction->setEnabled(true); + m_lastAction->setEnabled(true); + } + + if (index == 1) + { + m_backwardAction->setEnabled(false); + m_firstAction->setEnabled(false); + } + + if (index == d->itemsNb) + { + m_forwardAction->setEnabled(false); + m_lastAction->setEnabled(false); + } +} + +void ShowFoto::slotLoadingStarted(const TQString& filename) +{ + Digikam::EditorWindow::slotLoadingStarted(filename); + + // Here we disable specific actions on showfoto. + d->openFilesInFolderAction->setEnabled(false); + d->fileOpenAction->setEnabled(false); +} + +void ShowFoto::slotLoadingFinished(const TQString& filename, bool success) +{ + Digikam::EditorWindow::slotLoadingFinished(filename, success); + + // Here we re-enable specific actions on showfoto. + d->openFilesInFolderAction->setEnabled(true); + d->fileOpenAction->setEnabled(true); +} + +void ShowFoto::slotSavingStarted(const TQString& filename) +{ + Digikam::EditorWindow::slotSavingStarted(filename); + + // Here we disable specific actions on showfoto. + d->openFilesInFolderAction->setEnabled(false); + d->fileOpenAction->setEnabled(false); +} + +void ShowFoto::finishSaving(bool success) +{ + Digikam::EditorWindow::finishSaving(success); + + // Here we re-enable specific actions on showfoto. + d->openFilesInFolderAction->setEnabled(true); + d->fileOpenAction->setEnabled(true); +} + +void ShowFoto::saveIsComplete() +{ + Digikam::LoadingCacheInterface::putImage(m_savingContext->destinationURL.path(), m_canvas->currentImage()); + d->thumbBar->invalidateThumb(d->currentItem); +} + +void ShowFoto::saveAsIsComplete() +{ + m_canvas->switchToLastSaved(m_savingContext->destinationURL.path()); + Digikam::LoadingCacheInterface::putImage(m_savingContext->destinationURL.path(), m_canvas->currentImage()); + + // Add the file to the list of thumbbar images if it's not there already + Digikam::ThumbBarItem* foundItem = d->thumbBar->findItemByURL(m_savingContext->destinationURL); + d->thumbBar->invalidateThumb(foundItem); + + if (!foundItem) + foundItem = new Digikam::ThumbBarItem(d->thumbBar, m_savingContext->destinationURL); + + // shortcut slotOpenURL + d->thumbBar->blockSignals(true); + d->thumbBar->setSelected(foundItem); + d->thumbBar->blockSignals(false); + d->currentItem = foundItem; +} + +bool ShowFoto::save() +{ + if (!d->currentItem) + { + DWarning() << k_funcinfo << "This should not happen" << endl; + return true; + } + + if (!d->currentItem->url().isLocalFile()) + { + return false; + } + + startingSave(d->currentItem->url()); + return true; +} + +bool ShowFoto::saveAs() +{ + if (!d->currentItem) + { + DWarning() << k_funcinfo << "This should not happen" << endl; + return false; + } + + return ( startingSaveAs(d->currentItem->url()) ); +} + +void ShowFoto::slotDeleteCurrentItem() +{ + KURL urlCurrent(d->currentItem->url()); + + if (!d->deleteItem2Trash) + { + TQString warnMsg(i18n("About to delete file \"%1\"\nAre you sure?") + .arg(urlCurrent.filename())); + if (KMessageBox::warningContinueCancel(this, + warnMsg, + i18n("Warning"), + i18n("Delete")) + != KMessageBox::Continue) + { + return; + } + else + { + TDEIO::Job* job = TDEIO::del( urlCurrent ); + connect( job, TQ_SIGNAL(result( TDEIO::Job* )), + this, TQ_SLOT(slotDeleteCurrentItemResult( TDEIO::Job*)) ); + } + } + else + { + KURL dest("trash:/"); + + if (!KProtocolInfo::isKnownProtocol(dest)) + { + dest = TDEGlobalSettings::trashPath(); + } + + TDEIO::Job* job = TDEIO::move( urlCurrent, dest ); + connect( job, TQ_SIGNAL(result( TDEIO::Job* )), + this, TQ_SLOT(slotDeleteCurrentItemResult( TDEIO::Job*)) ); + } +} + +void ShowFoto::slotDeleteCurrentItemResult( TDEIO::Job * job ) +{ + if (job->error() != 0) + { + TQString errMsg(job->errorString()); + KMessageBox::error(this, errMsg); + return; + } + + // No error, remove item in thumbbar. + + Digikam::ThumbBarItem *item2remove = d->currentItem; + Digikam::ThumbBarItem *nextItem = 0; + + for (Digikam::ThumbBarItem *item = d->thumbBar->firstItem(); item; item = item->next()) + { + if (item->url().equals(item2remove->url())) + { + // Find item next to the current item + nextItem = item->next(); + d->thumbBar->removeItem(item); + d->currentItem = 0; + break; + } + } + + d->itemsNb = d->thumbBar->countItems(); + + // Disable menu actions and SideBar if no current image. + + if ( d->itemsNb == 0 ) + { + emit signalNoCurrentItem(); + slotUpdateItemInfo(); + toggleActions(false); + m_canvas->load(TQString(), m_IOFileSettings); + } + else + { + // If there is an image after the deleted one, make that selected. + if (nextItem) + d->thumbBar->setSelected(nextItem); + + d->currentItem = d->thumbBar->currentItem(); + slotOpenURL(d->currentItem->url()); + } +} + +void ShowFoto::slotContextMenu() +{ + m_contextMenu->exec(TQCursor::pos()); +} + +void ShowFoto::slideShow(bool startWithCurrent, Digikam::SlideShowSettings& settings) +{ + if (!d->thumbBar->countItems()) return; + + TDEConfig* config = kapp->config(); + config->setGroup("ImageViewer Settings"); + + settings.exifRotate = config->readBoolEntry("EXIF Rotate", true); + settings.fileList = d->thumbBar->itemsURLs(); + + int i = 0; + float cnt = settings.fileList.count(); + Digikam::DMetadata meta; + m_cancelSlideShow = false; + + m_nameLabel->progressBarMode(Digikam::StatusProgressBar::CancelProgressBarMode, + i18n("Preparing slideshow. Please wait...")); + + for (KURL::List::Iterator it = settings.fileList.begin() ; + !m_cancelSlideShow && (it != settings.fileList.end()) ; ++it) + { + Digikam::SlidePictureInfo pictInfo; + meta.load((*it).path()); + pictInfo.comment = meta.getImageComment(); + pictInfo.photoInfo = meta.getPhotographInformations(); + settings.pictInfoMap.insert(*it, pictInfo); + + m_nameLabel->setProgressValue((int)((i++/cnt)*100.0)); + kapp->processEvents(); + } + + m_nameLabel->progressBarMode(Digikam::StatusProgressBar::TextMode, TQString()); + + if (!m_cancelSlideShow) + { + Digikam::SlideShow *slide = new Digikam::SlideShow(settings); + if (startWithCurrent) + slide->setCurrent(d->currentItem->url()); + + slide->show(); + } +} + +void ShowFoto::slotRevert() +{ + if(!promptUserSave(d->currentItem->url())) + return; + + m_canvas->slotRestore(); +} + +} // namespace ShowFoto diff --git a/src/showfoto/showfoto.desktop b/src/showfoto/showfoto.desktop new file mode 100644 index 00000000..a4492c35 --- /dev/null +++ b/src/showfoto/showfoto.desktop @@ -0,0 +1,151 @@ +[Desktop Entry] +Name=ShowFoto +Name[ast]=ShowFoto +Name[bg]=ShowFoto +Name[bs]=ShowFoto +Name[ca]=ShowFoto +Name[ca@valencia]=ShowFoto +Name[cs]=ShowFoto +Name[da]=ShowFoto +Name[de]=ShowFoto +Name[el]=ShowFoto +Name[en_GB]=ShowFoto +Name[es]=ShowFoto +Name[et]=ShowFoto +Name[eu]=ShowFoto +Name[fi]=ShowFoto +Name[fr]=ShowFoto +Name[ga]=ShowFoto +Name[gl]=ShowFoto +Name[he]=ShowFoto +Name[hne]=सो-फोटो +Name[hr]=ShowFoto +Name[hu]=ShowFoto +Name[is]=ShowFoto +Name[it]=ShowFoto +Name[ja]=ShowFoto +Name[km]=ShowFoto +Name[lt]=ShowFoto +Name[lv]=ShowFoto +Name[mr]=शो-फोटो +Name[nb]=ShowFoto +Name[nds]=ShowFoto +Name[ne]=फोटो देखाउनुहोस् +Name[nl]=ShowFoto +Name[pa]=ਫੋਟੋ ਵੇਖੋ +Name[pl]=ShowFoto +Name[pt]=ShowFoto +Name[pt_BR]=ShowFoto +Name[ro]=ShowFoto +Name[ru]=ShowFoto +Name[sk]=ShowFoto +Name[sl]=ShowFoto +Name[sq]=ShowFoto +Name[sv]=Showfoto +Name[th]=ShowFoto +Name[tr]=ShowFoto +Name[ug]=ShowFoto +Name[uk]=ShowFoto +Name[vi]=ShowFoto +Name[xx]=xxShowFotoxx +Name[zh_CN]=ShowFoto +Name[zh_TW]=ShowFoto +GenericName=Photo Viewer and Editor +GenericName[ast]=Visor ya editor de semeyes +GenericName[bg]=Програма за преглед и редакция на снимки +GenericName[bs]=Preglednik i editor slika +GenericName[ca]=Visualitzador de fotografies i editor +GenericName[ca@valencia]=Visualitzador de fotografies i editor +GenericName[cs]=Prohlížeč a editor fotografií +GenericName[da]=Fotovisning og -redigering +GenericName[de]=Fotobetrachter und Editor +GenericName[el]=Εφαρμογή προβολής και επεξεργασίας φωτογραφιών +GenericName[en_GB]=Photo Viewer and Editor +GenericName[es]=Visor y editor de fotografías +GenericName[et]=Fotode näitaja ja redaktor +GenericName[eu]=Argazkien ikustaile eta editorea +GenericName[fi]=Valokuvien katselu ja käsittely +GenericName[fr]=Afficheur et éditeur de photos +GenericName[gl]=Visor e editor de fotos +GenericName[hne]=फोटो देखइया अउ संपादक +GenericName[hr]=Preglednik i uređivač fotografija +GenericName[hu]=Fényképmegjelenítő és szerkesztő +GenericName[is]=Ljósmyndaskoðari og ritill +GenericName[it]=Visore ed editor di foto +GenericName[ja]=フォトビューア/エディタ +GenericName[km]=កម្មវិធីមើល និងកែសម្រួលរូបថត +GenericName[lt]=Nuotraukų žiūryklė ir redaktorius +GenericName[lv]=Fotogrāfiju skatītājs un redaktors +GenericName[mr]=फोटो प्रदर्शक व संपादक +GenericName[nb]=Fotovisning og -redigering +GenericName[nds]=Fotokieker un -editor +GenericName[nl]=Fotoviewer en -bewerker +GenericName[pa]=ਫੋਟੋ ਦਰਸ਼ਕ ਅਤੇ ਐਡੀਟਰ +GenericName[pl]=Przeglądarka i edytor zdjęć +GenericName[pt]=Visualizador e Editor de Imagens +GenericName[pt_BR]=Visualizador e editor de fotos +GenericName[ro]=Vizualizator și editor de fotografii +GenericName[ru]=Просмотр и редактирование фотографий +GenericName[sk]=Prehliadač a editor fotografií +GenericName[sl]=Pregledovalnik in urejevalnik fotografij +GenericName[sv]=Fotovisning och editor +GenericName[th]=เครื่องมือแสดงและและแก้ไขภาพถ่าย +GenericName[tr]=Fotoğraf Görüntüleyici ve Düzenleyici +GenericName[uk]=Переглядач і редактор фотографій +GenericName[x-test]=xxPhoto Viewer and Editorxx +GenericName[zh_CN]=照片查看器和编辑器 +GenericName[zh_TW]=照片檢視器與編輯器 +Comment=Manage your photographs like a professional with the power of open source +Comment[ast]=Xestiona les tos semeyes como un profesional usando software llibre +Comment[bg]=Обработвайте снимките си професионално с помощта на свободния софтуер +Comment[bs]=Upravljajte fotografijama kao profesionalac snagom otvorenog izvornog koda +Comment[ca]=Gestioneu les vostres fotografies com un professional amb la potència del programari lliure +Comment[ca@valencia]=Gestioneu les vostres fotografies com un professional amb la potència del programari lliure +Comment[cs]=Spravujte své fotografie jako profesionál pomocí open source +Comment[da]=Håndtér dine fotografier som en professionel med kraften fra open source +Comment[de]=Verwalten Sie Ihre Bilder wie ein Profi mit allen Möglichkeiten von Open Source. +Comment[el]=Διαχειριστείτε τις φωτογραφίες σας όπως οι επαγγελματίες με τη δύναμη του ελεύθερου λογισμικού +Comment[en_GB]=Manage your photographs like a professional with the power of open source +Comment[es]=Gestione sus fotos como un profesional usando software libre +Comment[et]=Fotode haldamine profina avatud lähtekoodiga tarkvara võimsust kasutades +Comment[eu]=Kudeatu zure argazkiak profesional baten antzera iturburu irekiaren indarrarekin +Comment[fi]=Ammattilaistasoinen avoimen lähdekoodin ohjelma valokuvien hallintaan +Comment[fr]=Gérez vos photos comme un professionnel avec la puissance de l'« Open Source » +Comment[gl]=Xestione as súas fotografías como un profesional coa potencia do software de fontes abertas +Comment[hne]=ओपन सोर्स के पावर से आप मन अपन फोटो ल प्रोफेसनल जइसन मैनेज कर सकथो +Comment[hr]=Upravljajte svojim fotografijama kao profesionalac uz moć slobodnog softvera +Comment[hu]=Kezelje fényképeit profiként a nyílt forrás erejével +Comment[is]=Sýslaðu með ljósmyndirnar þínar í krafti opins hugbúnaðar +Comment[it]=Gestisci le tue fotografie come un professionista con la forza del software libero +Comment[ja]=オープンソースの力であなたの写真をプロのように管理します +Comment[km]=គ្រប់គ្រងរូបថតរបស់អ្នក ដូចជាអ្នកអាជីពដែលមានថាមពលលើកម្មវិធីប្រភពកូដចំហ +Comment[lt]=Tvarkykite savo nuotraukas kaip profesionalas su atviro kodo jėga +Comment[lv]=Pārvaldiet savas fotogrāfijas kā profesionālis, izmantojot atvērtā pirmkoda spēku +Comment[mr]=ओपन सोर्सच्या बळाने तुमचे फोटो व्यावसायिकाप्रमाणे व्यवस्थापीत करा +Comment[nb]=Håndter dine fotografier som en proff med kraften i åpen programvare +Comment[nds]=Pleeg Dien Fotos as'n Fachmann. - Mit de Knööv vun Apenborn. +Comment[nl]=Beheer uw foto's als een professional met de kracht van opensource +Comment[pa]=ਆਪਣੀਆਂ ਫੋਟੋਆਂ ਨੂੰ ਇੱਕ ਪਰੋਫੈਸ਼ਨਲ ਵਾਂਗ ਓਪਨ ਸੋਰਸ ਦੀ ਮੱਦਦ ਨਾਲ ਸੰਭਾਲੋ +Comment[pl]=Zarządzaj swoimi zdjęciami jak profesjonalista z mocą open source +Comment[pt]=Faça a gestão das suas fotografias como um profissional, graças ao 'software' livre +Comment[pt_BR]=Gerencie suas fotografias como um profissional, com o poder do código aberto +Comment[ro]=Gestionați-vă fotografiile ca un profesionist profitînd de puterea aplicațiilor cu sursă deschisă +Comment[ru]=Управляйте своей коллекцией фотографий на профессиональном уровне с помощью свободного программного обеспечения +Comment[sk]=Spravujte svoje fotografie ako profesionál pomocou open source +Comment[sl]=Upravljajte s svojimi fotografijami kot profesionalec z močjo odprte kode +Comment[sq]=Menaxho fotografitë e tua si një profesionist me fuqinë e burimit të hapur +Comment[sv]=Hantera dina fotografier som ett proffs med kraftfull öppen källkod +Comment[th]=จัดการภาพถ่ายของคุณดั่งมืออาชีพ ด้วยพลังสร้างสรรค์ของโอเพนซอร์ส +Comment[tr]=Açık kaynağın gücüyle fotoğraflarınızı bir profesyonel gibi düzenleyin +Comment[ug]=ئوچۇق مەنبەلىك يۇمشاق دېتاللارنىڭ كۈچىدىن پايدىلىنىپ سۈرەتلىرىڭىزنى كەسپىي خادىملاردەك باشقۇرالايسىز +Comment[uk]=Керуйте вашими фотографіями як професіонал за допомогою вільного програмного забезпечення +Comment[x-test]=xxManage your photographs like a professional with the power of open sourcexx +Comment[zh_CN]=专业照片管理 彰显开源力量 +Comment[zh_TW]=運用開放原始碼的力量像專業人士般管理您的照片 +Exec=showfoto %i -caption "%c" %U +Icon=showfoto +Type=Application +MimeType=image/gif;image/x-xpm;image/x-xbm;image/jpeg;image/png;image/webp;image/tiff;image/x-bmp;image/x-psd;image/x-eim;image/x-portable-bitmap;image/x-portable-pixmap;image/x-portable-greymap;image/x-raw; +Terminal=false +Categories=Qt;TDE;Graphics; +X-DocPath=showfoto/index.html diff --git a/src/showfoto/showfoto.h b/src/showfoto/showfoto.h new file mode 100644 index 00000000..8bd3618e --- /dev/null +++ b/src/showfoto/showfoto.h @@ -0,0 +1,135 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2004-11-22 + * Description : stand alone digiKam image editor GUI + * + * Copyright (C) 2004-2005 by Renchi Raju <renchi@pooh.tam.uiuc.edu> + * Copyright (C) 2005-2006 by Tom Albers <tomalbers@kde.nl> + * Copyright (C) 2004-2008 by Gilles Caulier <caulier dot gilles at gmail dot com> + * Copyright (C) 2006-2008 by Marcel Wiesweg <marcel.wiesweg@gmx.de> + * + * 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. + * + * ============================================================ */ + +#ifndef SHOWFOTO_H +#define SHOWFOTO_H + +// KDE includes. + +#include <kurl.h> + +// Local includes. + +#include "editorwindow.h" + +namespace TDEIO +{ +class Job; +} + +namespace Digikam +{ +class SlideshowSettings; +} + +namespace ShowFoto +{ + +class ShowFotoPriv; + +class ShowFoto : public Digikam::EditorWindow +{ + TQ_OBJECT + + +public: + + ShowFoto(const KURL::List& urlList); + ~ShowFoto(); + + virtual void show(); + bool setup(bool iccSetupPage=false); + +private: + + bool queryClose(); + bool queryExit(); + + void setupActions(); + void setupConnections(); + void setupUserArea(); + + void readSettings(); + void saveSettings(); + void applySettings(); + + void toggleActions(bool val); + + void toggleGUI2FullScreen(); + + void toggleNavigation(int index); + + bool save(); + bool saveAs(); + void finishSaving(bool success); + + void saveIsComplete(); + void saveAsIsComplete(); + + void slideShow(bool startWithCurrent, Digikam::SlideShowSettings& settings); + + void openFolder(const KURL& url); + + Digikam::Sidebar* rightSideBar() const; + +private slots: + + void slotForward(); + void slotBackward(); + void slotLast(); + void slotFirst(); + void slotFilePrint(); + + void slotOpenFile(); + void slotOpenURL(const KURL& url); + void slotOpenFolder(const KURL& url); + void slotOpenFilesInFolder(); + void slotDeleteCurrentItem(); + + void slotToggleShowBar(); + void slotChangeBCG(); + + void slotChanged(); + void slotUndoStateChanged(bool, bool, bool); + void slotUpdateItemInfo(); + + void slotDeleteCurrentItemResult( TDEIO::Job * job ); + + void slotLoadingStarted(const TQString &filename); + void slotLoadingFinished(const TQString &filename, bool success); + void slotSavingStarted(const TQString &filename); + + void slotContextMenu(); + void slotRevert(); + +private: + + ShowFotoPriv* d; +}; + +} // namespace ShowFoto + +#endif /* SHOWFOTO_H */ diff --git a/src/showfoto/showfotoui.rc b/src/showfoto/showfotoui.rc new file mode 100644 index 00000000..7e8e497d --- /dev/null +++ b/src/showfoto/showfotoui.rc @@ -0,0 +1,131 @@ +<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> +<gui version="29" name="showfoto" > + +<MenuBar> + + <Menu name="file" ><text>&File</text> + <Action name="showfoto_open_file" /> + <Action name="showfoto_open_folder" /> + <Separator/> + <Action name="editorwindow_backward" /> + <Action name="editorwindow_forward" /> + <Separator/> + <Action name="editorwindow_first" /> + <Action name="editorwindow_last" /> + <Separator/> + <Action name="editorwindow_print" /> + <Separator/> + <Action name="editorwindow_save" /> + <Action name="editorwindow_saveas" /> + <Action name="editorwindow_revert" /> + <Separator/> + <Action name="editorwindow_delete" /> + <Separator/> + <Action name="showfoto_quit" /> + </Menu> + + <Menu name="Edit" ><text>&Edit</text> + <Action name="editorwindow_copy" /> + <Separator/> + <Action name="editorwindow_undo" /> + <Action name="editorwindow_redo" /> + <Separator/> + <Action name="editorwindow_selectAll" /> + <Action name="editorwindow_selectNone" /> + </Menu> + + <Menu name="View" ><text>&View</text> + <Action name="editorwindow_fullscreen" /> + <Action name="editorwindow_slideshow" /> + <Separator/> + <Action name="editorwindow_zoomplus" /> + <Action name="editorwindow_zoomminus" /> + <Action name="editorwindow_zoomto100percents" /> + <Action name="editorwindow_zoomfit2window" /> + <Action name="editorwindow_zoomfit2select" /> + <Separator/> + <Action name="shofoto_showthumbs" /> + <Separator/> + <Action name="editorwindow_underexposure" /> + <Action name="editorwindow_overexposure" /> + <Action name="editorwindow_cmview" /> + </Menu> + + <Menu name="Color" ><text>&Color</text> + </Menu> + + <Menu name="Enhance" ><text>Enh&ance</text> + <ActionList name="showfoto_bcg" /> + </Menu> + + <Menu name="Transform" ><text>Tra&nsform</text> + <Action name="editorwindow_rotate_left" /> + <Action name="editorwindow_rotate_right" /> + <Separator/> + <Action name="editorwindow_flip_horiz" /> + <Action name="editorwindow_flip_vert" /> + <Separator/> + <Action name="editorwindow_crop" /> + <Action name="editorwindow_resize" /> + </Menu> + + <Menu name="Decorate" ><text>&Decorate</text> + </Menu> + + <Menu name="Filters" ><text>F&ilters</text> + </Menu> + + <Menu name="help" ><text>&Help</text> + <Action name="editorwindow_rawcameralist"/> + <Action name="editorwindow_donatemoney" /> + <Action name="editorwindow_contribute" /> + </Menu> + + <Merge/> + + <Menu name="settings" noMerge="1"><Text>&Settings</Text> + <Merge name="StandardToolBarMenuHandler" /> + <Action name="options_show_menubar"/> + <Action name="options_show_statusbar"/> + <Action name="options_show_toolbar"/> + <Separator/> + <Action name="theme_menu" /> + <Action name="options_configure_keybinding" /> + <Action name="options_configure_toolbars" /> + <Action name="options_configure" /> + </Menu> + +</MenuBar> + +<ToolBar name="ToolBar"><text>Main Toolbar</text> + <Action name="editorwindow_first" /> + <Action name="editorwindow_backward" /> + <Action name="editorwindow_forward" /> + <Action name="editorwindow_last" /> + <Separator/> + <Action name="showfoto_open_file" /> + <Action name="showfoto_open_folder" /> + <Action name="editorwindow_save" /> + <Action name="editorwindow_saveas" /> + <Action name="editorwindow_undo" /> + <Action name="editorwindow_redo" /> + <Action name="editorwindow_revert" /> + <Separator/> + <Action name="editorwindow_zoomplus" /> + <Action name="editorwindow_zoomto" /> + <Action name="editorwindow_zoomminus" /> + <Action name="editorwindow_zoomfit2window" /> + <Action name="editorwindow_zoomfit2select" /> + <Separator/> + <Action name="editorwindow_rotate_left" /> + <Action name="editorwindow_rotate_right" /> + <Action name="editorwindow_crop" /> + <Separator/> + <Action name="editorwindow_fullscreen" /> + <Action name="editorwindow_slideshow" /> + <Merge /> +</ToolBar> + +<ActionProperties/> + +</gui> |