diff options
Diffstat (limited to 'src/utilities/setup')
35 files changed, 5501 insertions, 0 deletions
diff --git a/src/utilities/setup/Makefile.am b/src/utilities/setup/Makefile.am new file mode 100644 index 00000000..bd6fd66e --- /dev/null +++ b/src/utilities/setup/Makefile.am @@ -0,0 +1,29 @@ +METASOURCES = AUTO + +INCLUDES = -I$(top_srcdir)/src/digikam \ + -I$(top_srcdir)/src/utilities/cameragui \ + -I$(top_srcdir)/src/utilities/batch \ + -I$(top_srcdir)/src/utilities/imageeditor/canvas \ + -I$(top_srcdir)/src/libs/dialogs \ + -I$(top_srcdir)/src/libs/dimg \ + -I$(top_srcdir)/src/libs/dimg/loaders \ + -I$(top_srcdir)/src/libs/widgets/common \ + $(LIBKIPI_CFLAGS) $(LIBKDCRAW_CFLAGS) $(all_includes) + +noinst_LTLIBRARIES = libsetup.la libshowfotosetup.la + +libsetup_la_SOURCES = cameraselection.cpp setupcamera.cpp \ + setupmime.cpp setupplugins.cpp setupidentity.cpp \ + setupgeneral.cpp setup.cpp \ + setupcollections.cpp setupmetadata.cpp \ + setupeditor.cpp setupmisc.cpp setupicc.cpp \ + setupiofiles.cpp setupdcraw.cpp setupslideshow.cpp \ + setuptooltip.cpp setuplighttable.cpp + +libsetup_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_GPHOTO) + +libshowfotosetup_la_SOURCES = setupiofiles.cpp setupdcraw.cpp \ + setupicc.cpp setupslideshow.cpp + +libshowfotosetup_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_TQT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor + diff --git a/src/utilities/setup/cameraselection.cpp b/src/utilities/setup/cameraselection.cpp new file mode 100644 index 00000000..2cf2635c --- /dev/null +++ b/src/utilities/setup/cameraselection.cpp @@ -0,0 +1,494 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2003-02-10 + * Description : Camera type selection dialog + * + * Copyright (C) 2003-2005 by Renchi Raju <renchi@pooh.tam.uiuc.edu> + * Copyright (C) 2006-2009 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 <tqcombobox.h> +#include <tqvgroupbox.h> +#include <tqlabel.h> +#include <tqpushbutton.h> +#include <tqradiobutton.h> +#include <tqlistview.h> +#include <tqvbuttongroup.h> +#include <tqlayout.h> +#include <tqwhatsthis.h> + +// KDE includes. + +#include <kiconloader.h> +#include <tdeglobalsettings.h> +#include <kactivelabel.h> +#include <kurlrequester.h> +#include <tdelocale.h> +#include <klineedit.h> +#include <kcursor.h> +#include <tdeapplication.h> + +// Local includes. + +#include "searchtextbar.h" +#include "gpcamera.h" +#include "cameraselection.h" +#include "cameraselection.moc" + +namespace Digikam +{ + +class CameraSelectionPriv +{ +public: + + CameraSelectionPriv() + { + listView = 0; + titleEdit = 0; + portButtonGroup = 0; + usbButton = 0; + serialButton = 0; + portPathLabel = 0; + portPathComboBox = 0; + umsMountURL = 0; + searchBar = 0; + } + + TQVButtonGroup *portButtonGroup; + + TQRadioButton *usbButton; + TQRadioButton *serialButton; + + TQLabel *portPathLabel; + + TQComboBox *portPathComboBox; + + TQString UMSCameraNameActual; + TQString UMSCameraNameShown; + TQString PTPCameraNameShown; + + TQStringList serialPortList; + + TQListView *listView; + + KLineEdit *titleEdit; + + KURLRequester *umsMountURL; + + SearchTextBar *searchBar; +}; + +CameraSelection::CameraSelection( TQWidget* parent ) + : KDialogBase(Plain, i18n("Camera Configuration"), + Help|Ok|Cancel, Ok, parent, 0, true, true) +{ + d = new CameraSelectionPriv; + + kapp->setOverrideCursor(KCursor::waitCursor()); + setHelp("cameraselection.anchor", "digikam"); + d->UMSCameraNameActual = TQString("Directory Browse"); // Don't be i18n! + d->UMSCameraNameShown = i18n("Mounted Camera"); + d->PTPCameraNameShown = TQString("USB PTP Class Camera"); + + TQGridLayout* mainBoxLayout = new TQGridLayout(plainPage(), 6, 1, 0, KDialog::spacingHint()); + mainBoxLayout->setColStretch(0, 10); + mainBoxLayout->setRowStretch(6, 10); + + // -------------------------------------------------------------- + + d->listView = new TQListView(plainPage()); + d->listView->addColumn(i18n("Camera List")); + d->listView->setAllColumnsShowFocus(true); + d->listView->setResizeMode(TQListView::LastColumn); + d->listView->setMinimumWidth(350); + TQWhatsThis::add(d->listView, i18n("<p>Select the camera name that you want to use. All " + "default settings on the right panel " + "will be set automatically.</p><p>This list has been generated " + "using the gphoto2 library installed on your computer.</p>")); + + d->searchBar = new SearchTextBar(plainPage(), "CameraSelectionSearchBar"); + + // -------------------------------------------------------------- + + TQVGroupBox* titleBox = new TQVGroupBox( i18n("Camera Title"), plainPage() ); + d->titleEdit = new KLineEdit( titleBox ); + TQWhatsThis::add(d->titleEdit, i18n("<p>Set here the name used in digiKam interface to " + "identify this camera.</p>")); + + // -------------------------------------------------------------- + + d->portButtonGroup = new TQVButtonGroup( i18n("Camera Port Type"), plainPage() ); + d->portButtonGroup->setRadioButtonExclusive( true ); + + d->usbButton = new TQRadioButton( d->portButtonGroup ); + d->usbButton->setText( i18n( "USB" ) ); + TQWhatsThis::add(d->usbButton, i18n("<p>Select this option if your camera is connected to your " + "computer using an USB cable.</p>")); + + d->serialButton = new TQRadioButton( d->portButtonGroup ); + d->serialButton->setText( i18n( "Serial" ) ); + TQWhatsThis::add(d->serialButton, i18n("<p>Select this option if your camera is connected to your " + "computer using a serial cable.</p>")); + + // -------------------------------------------------------------- + + TQVGroupBox* portPathBox = new TQVGroupBox( i18n( "Camera Port Path" ), plainPage() ); + d->portPathLabel = new TQLabel( portPathBox); + d->portPathLabel->setText( i18n( "Note: only for serial port camera" ) ); + + d->portPathComboBox = new TQComboBox( false, portPathBox ); + d->portPathComboBox->setDuplicatesEnabled( false ); + TQWhatsThis::add(d->portPathComboBox, i18n("<p>Select the serial port to use on your computer. " + "This option is only required if you use a serial camera.</p>")); + + // -------------------------------------------------------------- + + TQVGroupBox* umsMountBox = new TQVGroupBox(i18n("Camera Mount Path"), plainPage()); + + TQLabel* umsMountLabel = new TQLabel( umsMountBox ); + umsMountLabel->setText(i18n("Note: only for USB/IEEE mass storage camera")); + + d->umsMountURL = new KURLRequester( TQString("/mnt/camera"), umsMountBox); + d->umsMountURL->setMode(KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly); + TQWhatsThis::add(d->umsMountURL, i18n("<p>Set here the mount path to use on your computer. This " + "option is only required if you use a <b>USB Mass Storage</b> " + "camera.</p>")); + + // -------------------------------------------------------------- + + TQGroupBox* box2 = new TQGroupBox( 0, TQt::Vertical, plainPage() ); + box2->setFrameStyle( TQFrame::NoFrame ); + TQGridLayout* box2Layout = new TQGridLayout( box2->layout(), 1, 5 ); + + TQLabel* logo = new TQLabel( box2 ); + + TDEIconLoader* iconLoader = TDEApplication::kApplication()->iconLoader(); + logo->setPixmap(iconLoader->loadIcon("digikam", TDEIcon::NoGroup, 64, + TDEIcon::DefaultState, 0, true)); + + KActiveLabel* link = new KActiveLabel(box2); + link->setText(i18n("<p>To set a <b>USB Mass Storage</b> camera<br>" + "(which looks like a removable drive when mounted on your desktop), please<br>" + "use <a href=\"umscamera\">%1</a> from camera list.</p>") + .arg(d->UMSCameraNameShown)); + + KActiveLabel* link2 = new KActiveLabel(box2); + link2->setText(i18n("<p>To set a <b>Generic PTP USB Device</b><br>" + "(which uses the Picture Transfer Protocol), please<br>" + "use <a href=\"ptpcamera\">%1</a> from the camera list.</p>") + .arg(d->PTPCameraNameShown)); + + KActiveLabel* explanation = new KActiveLabel(box2); + explanation->setText(i18n("<p>A complete list of camera settings to use is<br>" + "available at <a href='http://www.teaser.fr/~hfiguiere/linux/digicam.html'>" + "this url</a>.</p>")); + + box2Layout->addMultiCellWidget(logo, 0, 0, 0, 0); + box2Layout->addMultiCellWidget(link, 0, 1, 1, 1); + box2Layout->addMultiCellWidget(link2, 2, 3, 1, 1); + box2Layout->addMultiCellWidget(explanation, 4, 5, 1, 1); + + // -------------------------------------------------------------- + + mainBoxLayout->addMultiCellWidget(d->listView, 0, 5, 0, 0); + mainBoxLayout->addMultiCellWidget(d->searchBar, 6, 6, 0, 0); + mainBoxLayout->addMultiCellWidget(titleBox, 0, 0, 1, 1); + mainBoxLayout->addMultiCellWidget(d->portButtonGroup, 1, 1, 1, 1); + mainBoxLayout->addMultiCellWidget(portPathBox, 2, 2, 1, 1); + mainBoxLayout->addMultiCellWidget(umsMountBox, 3, 3, 1, 1); + mainBoxLayout->addMultiCellWidget(box2, 4, 5, 1, 1); + + // Connections -------------------------------------------------- + + disconnect(link, TQ_SIGNAL(linkClicked(const TQString &)), + link, TQ_SLOT(openLink(const TQString &))); + + connect(link, TQ_SIGNAL(linkClicked(const TQString &)), + this, TQ_SLOT(slotUMSCameraLinkUsed())); + + disconnect(link2, TQ_SIGNAL(linkClicked(const TQString &)), + link2, TQ_SLOT(openLink(const TQString &))); + + connect(link2, TQ_SIGNAL(linkClicked(const TQString &)), + this, TQ_SLOT(slotPTPCameraLinkUsed())); + + connect(d->listView, TQ_SIGNAL(selectionChanged(TQListViewItem *)), + this, TQ_SLOT(slotSelectionChanged(TQListViewItem *))); + + connect(d->portButtonGroup, TQ_SIGNAL(clicked(int)), + this, TQ_SLOT(slotPortChanged())); + + connect(this, TQ_SIGNAL(okClicked()), + this, TQ_SLOT(slotOkClicked())); + + connect(d->searchBar, TQ_SIGNAL(signalTextChanged(const TQString&)), + this, TQ_SLOT(slotSearchTextChanged(const TQString&))); + + // Initialize -------------------------------------------------- + + getCameraList(); + getSerialPortList(); + kapp->restoreOverrideCursor(); +} + +CameraSelection::~CameraSelection() +{ + delete d; +} + +void CameraSelection::slotUMSCameraLinkUsed() +{ + TQListViewItem *item = d->listView->findItem(d->UMSCameraNameShown, 0); + if (item) + { + d->listView->setCurrentItem(item); + d->listView->ensureItemVisible(item); + } +} + +void CameraSelection::slotPTPCameraLinkUsed() +{ + TQListViewItem *item = d->listView->findItem(d->PTPCameraNameShown, 0); + if (item) + { + d->listView->setCurrentItem(item); + d->listView->ensureItemVisible(item); + } +} + +void CameraSelection::setCamera(const TQString& title, const TQString& model, + const TQString& port, const TQString& path) +{ + TQString camModel(model); + + if (camModel == d->UMSCameraNameActual) + camModel = d->UMSCameraNameShown; + + TQListViewItem* item = d->listView->findItem(camModel, 0); + if (!item) return; + + d->listView->setSelected(item, true); + d->listView->ensureItemVisible(item); + + d->titleEdit->setText(title); + + if (port.contains("usb")) + { + d->usbButton->setChecked(true); + slotPortChanged(); + } + else if (port.contains("serial")) + { + d->serialButton->setChecked(true); + + for (int i=0; i<d->portPathComboBox->count(); i++) + { + if (port == d->portPathComboBox->text(i)) + { + d->portPathComboBox->setCurrentItem(i); + break; + } + } + slotPortChanged(); + } + + d->umsMountURL->setURL(path); +} + +void CameraSelection::getCameraList() +{ + int count = 0; + TQStringList clist; + TQString cname; + + GPCamera::getSupportedCameras(count, clist); + + for (int i = 0 ; i < count ; i++) + { + cname = clist[i]; + if (cname == d->UMSCameraNameActual) + new TQListViewItem(d->listView, d->UMSCameraNameShown); + else + new TQListViewItem(d->listView, cname); + } +} + +void CameraSelection::getSerialPortList() +{ + TQStringList plist; + + GPCamera::getSupportedPorts(plist); + + d->serialPortList.clear(); + + for (unsigned int i=0; i<plist.count(); i++) + { + if ((plist[i]).startsWith("serial:")) + d->serialPortList.append(plist[i]); + } +} + +void CameraSelection::slotSelectionChanged(TQListViewItem *item) +{ + if (!item) return; + + TQString model(item->text(0)); + + if (model == d->UMSCameraNameShown) + { + model = d->UMSCameraNameActual; + + d->titleEdit->setText(model); + + d->serialButton->setEnabled(true); + d->serialButton->setChecked(false); + d->serialButton->setEnabled(false); + d->usbButton->setEnabled(true); + d->usbButton->setChecked(false); + d->usbButton->setEnabled(false); + d->portPathComboBox->setEnabled(true); + d->portPathComboBox->insertItem(TQString("NONE"), 0); + d->portPathComboBox->setEnabled(false); + + d->umsMountURL->setEnabled(true); + d->umsMountURL->clear(); + d->umsMountURL->setURL(TQString("/mnt/camera")); + return; + } + else + { + d->umsMountURL->setEnabled(true); + d->umsMountURL->clear(); + d->umsMountURL->setURL(TQString("/")); + d->umsMountURL->setEnabled(false); + } + + d->titleEdit->setText(model); + + TQStringList plist; + GPCamera::getCameraSupportedPorts(model, plist); + + if (plist.contains("serial")) + { + d->serialButton->setEnabled(true); + d->serialButton->setChecked(true); + } + else + { + d->serialButton->setEnabled(true); + d->serialButton->setChecked(false); + d->serialButton->setEnabled(false); + } + + if (plist.contains("usb")) + { + d->usbButton->setEnabled(true); + d->usbButton->setChecked(true); + } + else + { + d->usbButton->setEnabled(true); + d->usbButton->setChecked(false); + d->usbButton->setEnabled(false); + } + + slotPortChanged(); +} + +void CameraSelection::slotPortChanged() +{ + if (d->usbButton->isChecked()) + { + d->portPathComboBox->setEnabled(true); + d->portPathComboBox->clear(); + d->portPathComboBox->insertItem( TQString("usb:"), 0 ); + d->portPathComboBox->setEnabled(false); + return; + } + + if (d->serialButton->isChecked()) + { + d->portPathComboBox->setEnabled(true); + d->portPathComboBox->clear(); + d->portPathComboBox->insertStringList(d->serialPortList); + } +} + +TQString CameraSelection::currentTitle() +{ + return d->titleEdit->text(); +} + +TQString CameraSelection::currentModel() +{ + TQListViewItem* item = d->listView->currentItem(); + if (!item) + return TQString(); + + TQString model(item->text(0)); + if (model == d->UMSCameraNameShown) + model = d->UMSCameraNameActual; + + return model; +} + +TQString CameraSelection::currentPortPath() +{ + return d->portPathComboBox->currentText(); +} + +TQString CameraSelection::currentCameraPath() +{ + return d->umsMountURL->url(); +} + +void CameraSelection::slotOkClicked() +{ + emit signalOkClicked(currentTitle(), currentModel(), + currentPortPath(), currentCameraPath()); +} + +void CameraSelection::slotSearchTextChanged(const TQString& filter) +{ + bool query = false; + TQString search = filter.lower(); + + TQListViewItemIterator it(d->listView); + + for ( ; it.current(); ++it ) + { + TQListViewItem *item = it.current(); + + if (item->text(0).lower().contains(search)) + { + query = true; + item->setVisible(true); + } + else + { + item->setVisible(false); + } + } + + d->searchBar->slotSearchResult(query); +} + +} // namespace Digikam diff --git a/src/utilities/setup/cameraselection.h b/src/utilities/setup/cameraselection.h new file mode 100644 index 00000000..0458f13b --- /dev/null +++ b/src/utilities/setup/cameraselection.h @@ -0,0 +1,88 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2003-02-10 + * Description : Camera type selection dialog + * + * Copyright (C) 2003-2005 by Renchi Raju <renchi@pooh.tam.uiuc.edu> + * Copyright (C) 2006-2009 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 CAMERASELECTION_H +#define CAMERASELECTION_H + +// TQt includes. + +#include <tqstring.h> +#include <tqstringlist.h> + +// KDE includes. + +#include <kdialogbase.h> + +class TQListViewItem; + +namespace Digikam +{ + +class CameraSelectionPriv; + +class CameraSelection : public KDialogBase +{ + TQ_OBJECT + + +public: + + CameraSelection(TQWidget *parent=0); + ~CameraSelection(); + + void setCamera(const TQString& title, const TQString& model, + const TQString& port, const TQString& path); + + TQString currentTitle(); + TQString currentModel(); + TQString currentPortPath(); + TQString currentCameraPath(); + +signals: + + void signalOkClicked(const TQString& title, const TQString& model, + const TQString& port, const TQString& path); + +private: + + void getCameraList(); + void getSerialPortList(); + +private slots: + + void slotPTPCameraLinkUsed(); + void slotUMSCameraLinkUsed(); + void slotSelectionChanged(TQListViewItem *item); + void slotPortChanged(); + void slotOkClicked(); + void slotSearchTextChanged(const TQString&); + +private: + + CameraSelectionPriv *d; +}; + +} // namespace Digikam + +#endif // CAMERASELECTION_H diff --git a/src/utilities/setup/setup.cpp b/src/utilities/setup/setup.cpp new file mode 100644 index 00000000..bd47796f --- /dev/null +++ b/src/utilities/setup/setup.cpp @@ -0,0 +1,266 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2003-02-03 + * Description : digiKam setup dialog. + * + * Copyright (C) 2003-2005 by Renchi Raju <renchi at pooh.tam.uiuc.edu> + * Copyright (C) 2003-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 <tdemessagebox.h> +#include <tdeconfig.h> +#include <tdeapplication.h> + +// Local includes. + +#include "batchthumbsgenerator.h" +#include "setupgeneral.h" +#include "setuptooltip.h" +#include "setupmetadata.h" +#include "setupidentity.h" +#include "setupcollections.h" +#include "setupmime.h" +#include "setuplighttable.h" +#include "setupeditor.h" +#include "setupdcraw.h" +#include "setupiofiles.h" +#include "setupslideshow.h" +#include "setupicc.h" +#include "setupplugins.h" +#include "setupcamera.h" +#include "setupmisc.h" +#include "setup.h" +#include "setup.moc" + +namespace Digikam +{ + +class SetupPrivate +{ +public: + + SetupPrivate() + { + page_general = 0; + page_tooltip = 0; + page_metadata = 0; + page_identity = 0; + page_collections = 0; + page_mime = 0; + page_lighttable = 0; + page_editor = 0; + page_dcraw = 0; + page_iofiles = 0; + page_slideshow = 0; + page_icc = 0; + page_plugins = 0; + page_camera = 0; + page_misc = 0; + + generalPage = 0; + tooltipPage = 0; + metadataPage = 0; + identityPage = 0; + collectionsPage = 0; + mimePage = 0; + lighttablePage = 0; + editorPage = 0; + dcrawPage = 0; + iofilesPage = 0; + slideshowPage = 0; + iccPage = 0; + cameraPage = 0; + miscPage = 0; + pluginsPage = 0; + } + + TQFrame *page_general; + TQFrame *page_tooltip; + TQFrame *page_metadata; + TQFrame *page_identity; + TQFrame *page_collections; + TQFrame *page_mime; + TQFrame *page_lighttable; + TQFrame *page_editor; + TQFrame *page_dcraw; + TQFrame *page_iofiles; + TQFrame *page_slideshow; + TQFrame *page_icc; + TQFrame *page_plugins; + TQFrame *page_camera; + TQFrame *page_misc; + + SetupGeneral *generalPage; + SetupToolTip *tooltipPage; + SetupMetadata *metadataPage; + SetupIdentity *identityPage; + SetupCollections *collectionsPage; + SetupMime *mimePage; + SetupLightTable *lighttablePage; + SetupEditor *editorPage; + SetupDcraw *dcrawPage; + SetupIOFiles *iofilesPage; + SetupSlideShow *slideshowPage; + SetupICC *iccPage; + SetupCamera *cameraPage; + SetupMisc *miscPage; + SetupPlugins *pluginsPage; +}; + +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", "digikam"); + + d->page_general = addPage(i18n("Albums"), i18n("Album Settings"), + BarIcon("folder_image", TDEIcon::SizeMedium)); + d->generalPage = new SetupGeneral(d->page_general, this); + + d->page_collections = addPage(i18n("Collections"), i18n("Album Collections"), + BarIcon("document-open", TDEIcon::SizeMedium)); + d->collectionsPage = new SetupCollections(d->page_collections); + + d->page_identity = addPage(i18n("Identity"), i18n("Default IPTC identity information"), + BarIcon("identity", TDEIcon::SizeMedium)); + d->identityPage = new SetupIdentity(d->page_identity); + + d->page_metadata = addPage(i18n("Metadata"), i18n("Embedded Image Information Management"), + BarIcon("exifinfo", TDEIcon::SizeMedium)); + d->metadataPage = new SetupMetadata(d->page_metadata); + + d->page_tooltip = addPage(i18n("Tool Tip"), i18n("Album Items Tool Tip Settings"), + BarIcon("filetypes", TDEIcon::SizeMedium)); + d->tooltipPage = new SetupToolTip(d->page_tooltip); + + d->page_mime = addPage(i18n("Mime Types"), i18n("File (MIME) Types Settings"), + BarIcon("preferences-system", TDEIcon::SizeMedium)); + d->mimePage = new SetupMime(d->page_mime); + + d->page_lighttable = addPage(i18n("Light Table"), i18n("Light Table Settings"), + BarIcon("lighttable", TDEIcon::SizeMedium)); + d->lighttablePage = new SetupLightTable(d->page_lighttable); + + d->page_editor = addPage(i18n("Image Editor"), i18n("Image Editor General Settings"), + BarIcon("image-x-generic", TDEIcon::SizeMedium)); + d->editorPage = new SetupEditor(d->page_editor); + + d->page_iofiles = addPage(i18n("Save Images"), i18n("Image Editor: Settings for Saving Images Files"), + BarIcon("document-save", TDEIcon::SizeMedium)); + d->iofilesPage = new SetupIOFiles(d->page_iofiles); + + d->page_dcraw = addPage(i18n("RAW decoding"), i18n("RAW Files Decoding Settings"), + BarIcon("kdcraw", TDEIcon::SizeMedium)); + d->dcrawPage = new SetupDcraw(d->page_dcraw); + + d->page_icc = addPage(i18n("Color Management"), i18n("Image Editor Color Management Settings"), + BarIcon("colorize", TDEIcon::SizeMedium)); + d->iccPage = new SetupICC(d->page_icc, this); + + d->page_plugins = addPage(i18n("Kipi Plugins"), i18n("Main Interface Plug-in Settings"), + BarIcon("kipi", TDEIcon::SizeMedium)); + d->pluginsPage = new SetupPlugins(d->page_plugins); + + d->page_slideshow = addPage(i18n("Slide Show"), i18n("Slide Show Settings"), + BarIcon("slideshow", TDEIcon::SizeMedium)); + d->slideshowPage = new SetupSlideShow(d->page_slideshow); + + d->page_camera = addPage(i18n("Cameras"), i18n("Camera Settings"), + BarIcon("digitalcam", TDEIcon::SizeMedium)); + d->cameraPage = new SetupCamera(d->page_camera); + + d->page_misc = addPage(i18n("Miscellaneous"), i18n("Miscellaneous Settings"), + BarIcon("misc", TDEIcon::SizeMedium)); + d->miscPage = new SetupMisc(d->page_misc); + + 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", General)); + } + + show(); +} + +Setup::~Setup() +{ + TDEConfig* config = kapp->config(); + config->setGroup("General Settings"); + config->writeEntry("Setup Page", activePageIndex()); + config->sync(); + delete d; +} + +void Setup::slotOkClicked() +{ + d->generalPage->applySettings(); + d->tooltipPage->applySettings(); + d->metadataPage->applySettings(); + d->identityPage->applySettings(); + d->collectionsPage->applySettings(); + d->mimePage->applySettings(); + d->cameraPage->applySettings(); + d->lighttablePage->applySettings(); + d->editorPage->applySettings(); + d->dcrawPage->applySettings(); + d->iofilesPage->applySettings(); + d->slideshowPage->applySettings(); + d->iccPage->applySettings(); + d->miscPage->applySettings(); + + if (d->metadataPage->exifAutoRotateAsChanged()) + { + TQString msg = i18n("The Exif auto-rotate thumbnails option has been changed.\n" + "Do you want to rebuild all albums' items' thumbnails now?\n\n" + "Note: thumbnail processing can take a while! You can start " + "this job later from the \"Tools\" menu."); + int result = KMessageBox::warningYesNo(this, msg); + if (result != KMessageBox::Yes) + return; + + BatchThumbsGenerator *thumbsGenerator = new BatchThumbsGenerator(this); + thumbsGenerator->exec(); + } + + close(); +} + +SetupPlugins* Setup::kipiPluginsPage() +{ + return d->pluginsPage; +} + +} // namespace Digikam + diff --git a/src/utilities/setup/setup.h b/src/utilities/setup/setup.h new file mode 100644 index 00000000..ce5e57b1 --- /dev/null +++ b/src/utilities/setup/setup.h @@ -0,0 +1,81 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2003-02-03 + * Description : digiKam setup dialog. + * + * Copyright (C) 2003-2005 by Renchi Raju <renchi at pooh.tam.uiuc.edu> + * Copyright (C) 2003-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> + +namespace Digikam +{ + +class SetupPlugins; +class SetupPrivate; + +class Setup : public KDialogBase +{ + TQ_OBJECT + + +public: + + enum Page + { + LastPageUsed = -1, + General = 0, + ToolTip, + Metadata, + Identify, + Collections, + Mime, + LightTable, + Editor, + Dcraw, + IOFiles, + Slideshow, + IccProfiles, + KipiPlugins, + Camera, + Miscellaneous + }; + + Setup(TQWidget* parent=0, const char* name=0, Page page=LastPageUsed); + ~Setup(); + + SetupPlugins *kipiPluginsPage(); + +private slots: + + void slotOkClicked(); + +private: + + SetupPrivate* d; +}; + +} // namespace Digikam + +#endif // SETUP_H diff --git a/src/utilities/setup/setupcamera.cpp b/src/utilities/setup/setupcamera.cpp new file mode 100644 index 00000000..1b8d0bb8 --- /dev/null +++ b/src/utilities/setup/setupcamera.cpp @@ -0,0 +1,315 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2003-02-10 + * Description : camera setup tab. + * + * Copyright (C) 2003-2005 by Renchi Raju <renchi@pooh.tam.uiuc.edu> + * 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 <tqgroupbox.h> +#include <tqpushbutton.h> +#include <tqlayout.h> +#include <tqwhatsthis.h> +#include <tqtooltip.h> +#include <tqdatetime.h> +#include <tqlistview.h> + +// KDE includes. + +#include <tdelocale.h> +#include <tdemessagebox.h> +#include <kurllabel.h> +#include <kiconloader.h> +#include <tdeglobalsettings.h> +#include <kstandarddirs.h> +#include <kcursor.h> +#include <tdeapplication.h> + +// Local includes. + +#include "cameraselection.h" +#include "cameralist.h" +#include "cameratype.h" +#include "gpcamera.h" +#include "setupcamera.h" +#include "setupcamera.moc" + +namespace Digikam +{ +class SetupCameraPriv +{ +public: + + SetupCameraPriv() + { + listView = 0; + addButton = 0; + removeButton = 0; + editButton = 0; + autoDetectButton = 0; + } + + TQPushButton *addButton; + TQPushButton *removeButton; + TQPushButton *editButton; + TQPushButton *autoDetectButton; + + TQListView *listView; +}; + +SetupCamera::SetupCamera( TQWidget* parent ) + : TQWidget( parent ) +{ + d = new SetupCameraPriv; + + TQVBoxLayout *mainLayout = new TQVBoxLayout(parent); + TQGridLayout* groupBoxLayout = new TQGridLayout( this, 2, 5, 0, KDialog::spacingHint() ); + + d->listView = new TQListView( this ); + d->listView->addColumn( i18n("Title") ); + d->listView->addColumn( i18n("Model") ); + d->listView->addColumn( i18n("Port") ); + d->listView->addColumn( i18n("Path") ); + d->listView->addColumn( "Last Access Date", 0 ); // No i18n here. Hidden column with the last access date. + d->listView->setAllColumnsShowFocus(true); + TQWhatsThis::add( d->listView, i18n("<p>Here you can see the digital camera list used by digiKam " + "via the Gphoto interface.")); + + // ------------------------------------------------------------- + + d->addButton = new TQPushButton( this ); + d->removeButton = new TQPushButton( this ); + d->editButton = new TQPushButton( this ); + d->autoDetectButton = new TQPushButton( this ); + + d->addButton->setText( i18n( "&Add..." ) ); + d->addButton->setIconSet(SmallIcon("add")); + d->removeButton->setText( i18n( "&Remove" ) ); + d->removeButton->setIconSet(SmallIcon("remove")); + d->editButton->setText( i18n( "&Edit..." ) ); + d->editButton->setIconSet(SmallIcon("configure")); + d->autoDetectButton->setText( i18n( "Auto-&Detect" ) ); + d->autoDetectButton->setIconSet(SmallIcon("edit-find")); + d->removeButton->setEnabled(false); + d->editButton->setEnabled(false); + + TQSpacerItem* spacer = new TQSpacerItem( 20, 20, TQSizePolicy::Minimum, TQSizePolicy::Expanding ); + + KURLLabel *gphotoLogoLabel = new KURLLabel(this); + gphotoLogoLabel->setText(TQString()); + gphotoLogoLabel->setURL("http://www.gphoto.org"); + TDEGlobal::dirs()->addResourceType("logo-gphoto", TDEGlobal::dirs()->kde_default("data") + "digikam/data"); + TQString directory = TDEGlobal::dirs()->findResourceDir("logo-gphoto", "logo-gphoto.png"); + gphotoLogoLabel->setPixmap( TQPixmap( directory + "logo-gphoto.png" ) ); + TQToolTip::add(gphotoLogoLabel, i18n("Visit Gphoto project website")); + + groupBoxLayout->setAlignment( TQt::AlignTop ); + groupBoxLayout->addMultiCellWidget( d->listView, 0, 5, 0, 0 ); + groupBoxLayout->addWidget( d->addButton, 0, 1 ); + groupBoxLayout->addWidget( d->removeButton, 1, 1 ); + groupBoxLayout->addWidget( d->editButton, 2, 1 ); + groupBoxLayout->addWidget( d->autoDetectButton, 3, 1 ); + groupBoxLayout->addItem( spacer, 4, 1 ); + groupBoxLayout->addWidget( gphotoLogoLabel, 5, 1 ); + + adjustSize(); + mainLayout->addWidget(this); + + // ------------------------------------------------------------- + + connect(gphotoLogoLabel, TQ_SIGNAL(leftClickedURL(const TQString&)), + this, TQ_SLOT(processGphotoURL(const TQString&))); + + connect(d->listView, TQ_SIGNAL(selectionChanged()), + this, TQ_SLOT(slotSelectionChanged())); + + connect(d->addButton, TQ_SIGNAL(clicked()), + this, TQ_SLOT(slotAddCamera())); + + connect(d->removeButton, TQ_SIGNAL(clicked()), + this, TQ_SLOT(slotRemoveCamera())); + + connect(d->editButton, TQ_SIGNAL(clicked()), + this, TQ_SLOT(slotEditCamera())); + + connect(d->autoDetectButton, TQ_SIGNAL(clicked()), + this, TQ_SLOT(slotAutoDetectCamera())); + + // Add cameras -------------------------------------- + + CameraList* clist = CameraList::instance(); + + if (clist) + { + TQPtrList<CameraType>* cl = clist->cameraList(); + + for (CameraType *ctype = cl->first(); ctype; + ctype = cl->next()) + { + new TQListViewItem(d->listView, ctype->title(), ctype->model(), + ctype->port(), ctype->path(), + ctype->lastAccess().toString(TQt::ISODate)); + } + } +} + +SetupCamera::~SetupCamera() +{ + delete d; +} + +void SetupCamera::processGphotoURL(const TQString& url) +{ + TDEApplication::kApplication()->invokeBrowser(url); +} + +void SetupCamera::slotSelectionChanged() +{ + TQListViewItem *item = d->listView->selectedItem(); + + if (!item) + { + d->removeButton->setEnabled(false); + d->editButton->setEnabled(false); + return; + } + + d->removeButton->setEnabled(true); + d->editButton->setEnabled(true); +} + +void SetupCamera::slotAddCamera() +{ + CameraSelection *select = new CameraSelection; + + connect(select, TQ_SIGNAL(signalOkClicked(const TQString&, const TQString&, + const TQString&, const TQString&)), + this, TQ_SLOT(slotAddedCamera(const TQString&, const TQString&, + const TQString&, const TQString&))); + + select->show(); +} + +void SetupCamera::slotRemoveCamera() +{ + TQListViewItem *item = d->listView->currentItem(); + if (!item) return; + + delete item; +} + +void SetupCamera::slotEditCamera() +{ + TQListViewItem *item = d->listView->currentItem(); + if (!item) return; + + CameraSelection *select = new CameraSelection; + select->setCamera(item->text(0), item->text(1), item->text(2), item->text(3)); + + connect(select, TQ_SIGNAL(signalOkClicked(const TQString&, const TQString&, + const TQString&, const TQString&)), + this, TQ_SLOT(slotEditedCamera(const TQString&, const TQString&, + const TQString&, const TQString&))); + + select->show(); +} + +void SetupCamera::slotAutoDetectCamera() +{ + TQString model, port; + + kapp->setOverrideCursor( KCursor::waitCursor() ); + int ret = GPCamera::autoDetect(model, port); + kapp->restoreOverrideCursor(); + + if (ret != 0) + { + KMessageBox::error(this,i18n("Failed to auto-detect camera.\n" + "Please check if your camera is turned on " + "and retry or try setting it manually.")); + return; + } + + // NOTE: See note in digikam/digikam/cameralist.cpp + if (port.startsWith("usb:")) + port = "usb:"; + + if (d->listView->findItem(model, 1)) + { + KMessageBox::information(this, i18n("Camera '%1' (%2) is already in list.").arg(model).arg(port)); + } + else + { + KMessageBox::information(this, i18n("Found camera '%1' (%2) and added it to the list.") + .arg(model).arg(port)); + new TQListViewItem(d->listView, model, model, port, "/", + TQDateTime::currentDateTime().toString(TQt::ISODate)); + } +} + +void SetupCamera::slotAddedCamera(const TQString& title, const TQString& model, + const TQString& port, const TQString& path) +{ + new TQListViewItem(d->listView, title, model, port, path, + TQDateTime::currentDateTime().toString(TQt::ISODate)); +} + +void SetupCamera::slotEditedCamera(const TQString& title, const TQString& model, + const TQString& port, const TQString& path) +{ + TQListViewItem *item = d->listView->currentItem(); + if (!item) return; + + item->setText(0, title); + item->setText(1, model); + item->setText(2, port); + item->setText(3, path); +} + +void SetupCamera::applySettings() +{ + CameraList* clist = CameraList::instance(); + + if (clist) + { + clist->clear(); + + TQListViewItemIterator it(d->listView); + + for ( ; it.current(); ++it ) + { + TQListViewItem *item = it.current(); + TQDateTime lastAccess = TQDateTime::currentDateTime(); + + if (!item->text(4).isEmpty()) + lastAccess = TQDateTime::fromString(item->text(4), TQt::ISODate); + + CameraType *ctype = new CameraType(item->text(0), item->text(1), item->text(2), + item->text(3), lastAccess); + clist->insert(ctype); + } + + clist->save(); + } +} + +} // namespace Digikam + diff --git a/src/utilities/setup/setupcamera.h b/src/utilities/setup/setupcamera.h new file mode 100644 index 00000000..f0df8a71 --- /dev/null +++ b/src/utilities/setup/setupcamera.h @@ -0,0 +1,73 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2003-02-10 + * Description : camera setup tab. + * + * Copyright (C) 2003-2005 by Renchi Raju <renchi@pooh.tam.uiuc.edu> + * Copyright (C) 2003-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 SETUPCAMERA_H +#define SETUPCAMERA_H + +// TQt includes. + +#include <tqwidget.h> + +namespace Digikam +{ + +class SetupCameraPriv; + +class SetupCamera : public TQWidget +{ + TQ_OBJECT + + +public: + + SetupCamera( TQWidget* parent = 0 ); + ~SetupCamera(); + + void applySettings(); + +private slots: + + void processGphotoURL(const TQString& url); + + void slotSelectionChanged(); + + void slotAddCamera(); + void slotRemoveCamera(); + void slotEditCamera(); + void slotAutoDetectCamera(); + + void slotAddedCamera(const TQString& title, const TQString& model, + const TQString& port, const TQString& path); + void slotEditedCamera(const TQString& title, const TQString& model, + const TQString& port, const TQString& path); + +private: + + SetupCameraPriv* d; + +}; + +} // namespace Digikam + +#endif // SETUPCAMERA_H diff --git a/src/utilities/setup/setupcollections.cpp b/src/utilities/setup/setupcollections.cpp new file mode 100644 index 00000000..10a25c31 --- /dev/null +++ b/src/utilities/setup/setupcollections.cpp @@ -0,0 +1,218 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2004-01-02 + * Description : collection setup tab. + * + * Copyright (C) 2004-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 <tqvbuttongroup.h> +#include <tqvgroupbox.h> +#include <tqhgroupbox.h> +#include <tqgroupbox.h> +#include <tqradiobutton.h> +#include <tqcheckbox.h> +#include <tqlabel.h> +#include <tqlineedit.h> +#include <tqpushbutton.h> +#include <tqdir.h> +#include <tqwhatsthis.h> + +// KDE includes. + +#include <tdelistbox.h> +#include <tdelocale.h> +#include <kdialog.h> +#include <tdefiledialog.h> +#include <kurl.h> +#include <tdemessagebox.h> +#include <kiconloader.h> +#include <tdeversion.h> + +#if KDE_IS_VERSION(3,2,0) +#include <kinputdialog.h> +#else +#include <klineeditdlg.h> +#endif + +// Local includes. + +#include "thumbnailsize.h" +#include "albumsettings.h" +#include "setupcollections.h" +#include "setupcollections.moc" + +namespace Digikam +{ + +class SetupCollectionsPriv +{ +public: + + SetupCollectionsPriv() + { + albumCollectionBox = 0; + addCollectionButton = 0; + delCollectionButton = 0; + } + + TQListBox *albumCollectionBox; + + TQPushButton *addCollectionButton; + TQPushButton *delCollectionButton; +}; + +SetupCollections::SetupCollections(TQWidget* parent ) + : TQWidget(parent) +{ + d = new SetupCollectionsPriv; + + TQVBoxLayout *mainLayout = new TQVBoxLayout(parent); + TQGridLayout *collectionGroupLayout = new TQGridLayout( this, 2, 5, 0, KDialog::spacingHint() ); + + // -------------------------------------------------------- + + d->albumCollectionBox = new TDEListBox(this); + TQWhatsThis::add( d->albumCollectionBox, i18n("<p>You can add or remove Album " + "collection types here to improve how " + "your Albums are sorted in digiKam.")); + + d->albumCollectionBox->setVScrollBarMode(TQScrollView::AlwaysOn); + + d->addCollectionButton = new TQPushButton( i18n("&Add..."), this); + d->delCollectionButton = new TQPushButton( i18n("&Delete"), this); + + d->addCollectionButton->setIconSet(SmallIcon("add")); + d->delCollectionButton->setIconSet(SmallIcon("remove")); + d->delCollectionButton->setEnabled(false); + + TQSpacerItem* spacer = new TQSpacerItem( 20, 20, TQSizePolicy::Minimum, TQSizePolicy::Expanding ); + + collectionGroupLayout->setAlignment( TQt::AlignTop ); + collectionGroupLayout->addMultiCellWidget( d->albumCollectionBox, 0, 4, 0, 0 ); + collectionGroupLayout->addWidget( d->addCollectionButton, 0, 1); + collectionGroupLayout->addWidget( d->delCollectionButton, 1, 1); + collectionGroupLayout->addItem( spacer, 4, 1 ); + + // -------------------------------------------------------- + + connect(d->albumCollectionBox, TQ_SIGNAL(selectionChanged()), + this, TQ_SLOT(slotCollectionSelectionChanged())); + + connect(d->addCollectionButton, TQ_SIGNAL(clicked()), + this, TQ_SLOT(slotAddCollection())); + + connect(d->delCollectionButton, TQ_SIGNAL(clicked()), + this, TQ_SLOT(slotDelCollection())); + + // -------------------------------------------------------- + + readSettings(); + adjustSize(); + mainLayout->addWidget(this); +} + +SetupCollections::~SetupCollections() +{ + delete d; +} + +void SetupCollections::applySettings() +{ + AlbumSettings* settings = AlbumSettings::instance(); + + if (!settings) return; + + TQStringList collectionList; + + for (TQListBoxItem *item = d->albumCollectionBox->firstItem(); + item; item = item->next()) + { + collectionList.append(item->text()); + } + + settings->setAlbumCollectionNames(collectionList); + + settings->saveSettings(); +} + +void SetupCollections::readSettings() +{ + AlbumSettings* settings = AlbumSettings::instance(); + + if (!settings) return; + + d->albumCollectionBox->insertStringList(settings->getAlbumCollectionNames()); +} + +void SetupCollections::slotCollectionSelectionChanged() +{ + if (d->albumCollectionBox->currentItem() != -1) + d->delCollectionButton->setEnabled(true); + else + d->delCollectionButton->setEnabled(false); +} + +void SetupCollections::slotAddCollection() +{ + bool ok; + +#if KDE_IS_VERSION(3,2,0) + TQString newCollection = + KInputDialog::getText(i18n("New Collection Name"), + i18n("Enter new collection name:"), + TQString(), &ok, this); +#else + TQString newCollection = + KLineEditDlg::getText(i18n("New Collection Name"), + i18n("Enter new collection name:"), + TQString(), &ok, this); +#endif + + if (!ok) return; + + bool found = false; + for (TQListBoxItem *item = d->albumCollectionBox->firstItem(); + item; item = item->next()) + { + if (newCollection == item->text()) + { + found = true; + break; + } + } + + if (!found) + d->albumCollectionBox->insertItem(newCollection); +} + +void SetupCollections::slotDelCollection() +{ + int index = d->albumCollectionBox->currentItem(); + if (index == -1) + return; + + TQListBoxItem* item = d->albumCollectionBox->item(index); + if (!item) return; + delete item; +} + +} // namespace Digikam diff --git a/src/utilities/setup/setupcollections.h b/src/utilities/setup/setupcollections.h new file mode 100644 index 00000000..c65b93e1 --- /dev/null +++ b/src/utilities/setup/setupcollections.h @@ -0,0 +1,66 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2004-01-02 + * Description : collection setup tab. + * + * Copyright (C) 2004-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 SETUPCOLLECTIONS_H +#define SETUPCOLLECTIONS_H + +// TQt includes. + +#include <tqwidget.h> + +namespace Digikam +{ + +class SetupCollectionsPriv; + +class SetupCollections : public TQWidget +{ + TQ_OBJECT + + +public: + + SetupCollections(TQWidget* parent = 0); + ~SetupCollections(); + + void applySettings(); + +private: + + void readSettings(); + +private slots: + + void slotCollectionSelectionChanged(); + void slotAddCollection(); + void slotDelCollection(); + +private: + + SetupCollectionsPriv* d; + +}; + +} // namespace Digikam + +#endif // SETUPCOLLECTIONS_H diff --git a/src/utilities/setup/setupdcraw.cpp b/src/utilities/setup/setupdcraw.cpp new file mode 100644 index 00000000..57f9cb2d --- /dev/null +++ b/src/utilities/setup/setupdcraw.cpp @@ -0,0 +1,150 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2007-02-06 + * Description : setup RAW decoding settings. + * + * Copyright (C) 2007-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. + * + * ============================================================ */ + +// TQt includes. + +#include <tqlayout.h> +#include <tqlabel.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 <kiconloader.h> +#include <kdialog.h> +#include <tdeconfig.h> +#include <tdeapplication.h> + +// LibKDcraw includes. + +#include <libkdcraw/version.h> +#include <libkdcraw/dcrawsettingswidget.h> + +// Local includes. + +#include "drawdecoding.h" +#include "setupdcraw.h" +#include "setupdcraw.moc" + +using namespace KDcrawIface; + +namespace Digikam +{ + +class SetupDcrawPriv +{ +public: + + + SetupDcrawPriv() + { + dcrawSettings = 0; + } + + KDcrawIface::DcrawSettingsWidget *dcrawSettings; +}; + +SetupDcraw::SetupDcraw(TQWidget* parent ) + : TQWidget(parent) +{ + d = new SetupDcrawPriv; + TQVBoxLayout *layout = new TQVBoxLayout(parent, 0, KDialog::spacingHint()); + d->dcrawSettings = new DcrawSettingsWidget(parent, DcrawSettingsWidget::SIXTEENBITS); + d->dcrawSettings->setItemIconSet(0, SmallIconSet("kdcraw")); + d->dcrawSettings->setItemIconSet(1, SmallIconSet("whitebalance")); + d->dcrawSettings->setItemIconSet(2, SmallIconSet("lensdistortion")); + layout->addWidget(d->dcrawSettings); + layout->addStretch(); + + connect(d->dcrawSettings, TQ_SIGNAL(signalSixteenBitsImageToggled(bool)), + this, TQ_SLOT(slotSixteenBitsImageToggled(bool))); + + readSettings(); +} + +SetupDcraw::~SetupDcraw() +{ + delete d; +} + +void SetupDcraw::slotSixteenBitsImageToggled(bool) +{ + // Dcraw do not provide a way to set brigness of image in 16 bits color depth. + // We always set on this option. We drive brightness adjustment in digiKam Raw image loader. + d->dcrawSettings->setEnabledBrightnessSettings(true); +} + +void SetupDcraw::applySettings() +{ + TDEConfig* config = kapp->config(); + config->setGroup("ImageViewer Settings"); + config->writeEntry("SixteenBitsImage", d->dcrawSettings->sixteenBits()); + config->writeEntry("WhiteBalance", d->dcrawSettings->whiteBalance()); + config->writeEntry("CustomWhiteBalance", d->dcrawSettings->customWhiteBalance()); + config->writeEntry("CustomWhiteBalanceGreen", d->dcrawSettings->customWhiteBalanceGreen()); + config->writeEntry("RGBInterpolate4Colors", d->dcrawSettings->useFourColor()); + config->writeEntry("DontStretchPixels", d->dcrawSettings->useDontStretchPixels()); + config->writeEntry("EnableNoiseReduction", d->dcrawSettings->useNoiseReduction()); + config->writeEntry("NRThreshold", d->dcrawSettings->NRThreshold()); + config->writeEntry("EnableCACorrection", d->dcrawSettings->useCACorrection()); + config->writeEntry("caRedMultiplier", d->dcrawSettings->caRedMultiplier()); + config->writeEntry("caBlueMultiplier", d->dcrawSettings->caBlueMultiplier()); + config->writeEntry("UnclipColors", d->dcrawSettings->unclipColor()); + config->writeEntry("RAWBrightness", d->dcrawSettings->brightness()); + config->writeEntry("RAWQuality", d->dcrawSettings->quality()); + config->writeEntry("MedianFilterPasses", d->dcrawSettings->medianFilterPasses()); + config->sync(); +} + +void SetupDcraw::readSettings() +{ + TDEConfig* config = kapp->config(); + config->setGroup("ImageViewer Settings"); + d->dcrawSettings->setSixteenBits(config->readBoolEntry("SixteenBitsImage", false)); + d->dcrawSettings->setNoiseReduction(config->readBoolEntry("EnableNoiseReduction", false)); + d->dcrawSettings->setNRThreshold(config->readNumEntry("NRThreshold", 100)); + d->dcrawSettings->setUseCACorrection(config->readBoolEntry("EnableCACorrection", false)); + d->dcrawSettings->setcaRedMultiplier(config->readDoubleNumEntry("caRedMultiplier", 1.0)); + d->dcrawSettings->setcaBlueMultiplier(config->readDoubleNumEntry("caBlueMultiplier", 1.0)); + d->dcrawSettings->setDontStretchPixels(config->readBoolEntry("DontStretchPixels", false)); + d->dcrawSettings->setUnclipColor(config->readNumEntry("UnclipColors", 0)); + d->dcrawSettings->setWhiteBalance((DRawDecoding::WhiteBalance) + config->readNumEntry("WhiteBalance", + DRawDecoding::CAMERA)); + d->dcrawSettings->setCustomWhiteBalance(config->readNumEntry("CustomWhiteBalance", 6500)); + d->dcrawSettings->setCustomWhiteBalanceGreen(config->readDoubleNumEntry("CustomWhiteBalanceGreen", 1.0)); + d->dcrawSettings->setFourColor(config->readBoolEntry("RGBInterpolate4Colors", false)); + d->dcrawSettings->setQuality((DRawDecoding::DecodingQuality) + config->readNumEntry("RAWQuality", + DRawDecoding::BILINEAR)); + d->dcrawSettings->setBrightness(config->readDoubleNumEntry("RAWBrightness", 1.0)); + d->dcrawSettings->setMedianFilterPasses(config->readNumEntry("MedianFilterPasses", 0)); +} + +} // namespace Digikam diff --git a/src/utilities/setup/setupdcraw.h b/src/utilities/setup/setupdcraw.h new file mode 100644 index 00000000..835199f4 --- /dev/null +++ b/src/utilities/setup/setupdcraw.h @@ -0,0 +1,67 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2007-02-06 + * Description : setup RAW decoding settings. + * + * Copyright (C) 2007-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 SETUPDCRAW_H +#define SETUPDCRAW_H + +// TQt includes. + +#include <tqwidget.h> + +// Local includes. + +#include "digikam_export.h" + +namespace Digikam +{ + +class SetupDcrawPriv; + +class DIGIKAM_EXPORT SetupDcraw : public TQWidget +{ + TQ_OBJECT + + +public: + + SetupDcraw(TQWidget* parent = 0); + ~SetupDcraw(); + + void applySettings(); + +private: + + void readSettings(); + +private slots: + + void slotSixteenBitsImageToggled(bool); + +private: + + SetupDcrawPriv* d; +}; + +} // namespace Digikam + +#endif // SETUPDCRAW_H diff --git a/src/utilities/setup/setupeditor.cpp b/src/utilities/setup/setupeditor.cpp new file mode 100644 index 00000000..337b5655 --- /dev/null +++ b/src/utilities/setup/setupeditor.cpp @@ -0,0 +1,176 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2004-08-03 + * Description : setup Image Editor tab. + * + * 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. + * + * ============================================================ */ + +// TQt includes. + +#include <tqlayout.h> +#include <tqcolor.h> +#include <tqhbox.h> +#include <tqvgroupbox.h> +#include <tqlabel.h> +#include <tqwhatsthis.h> +#include <tqcheckbox.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 Digikam +{ +class SetupEditorPriv +{ +public: + + SetupEditorPriv() + { + hideToolBar = 0; + themebackgroundColor = 0; + backgroundColor = 0; + colorBox = 0; + overExposureColor = 0; + underExposureColor = 0; + useRawImportTool = 0; + } + + TQHBox *colorBox; + + TQCheckBox *hideToolBar; + TQCheckBox *themebackgroundColor; + TQCheckBox *useRawImportTool; + + 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>Customize background color to use " + "in image editor area.")); + + d->hideToolBar = new TQCheckBox(i18n("H&ide toolbar in fullscreen mode"), 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 the 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 the color used in image editor to identify " + "over-exposed pixels.")); + + // -------------------------------------------------------- + + layout->addWidget(interfaceOptionsGroup); + layout->addWidget(exposureOptionsGroup); + 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->underExposureColor->setColor(config->readColorEntry("UnderExposureColor", &White)); + d->overExposureColor->setColor(config->readColorEntry("OverExposureColor", &Black)); + 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("UnderExposureColor", d->underExposureColor->color()); + config->writeEntry("OverExposureColor", d->overExposureColor->color()); + config->writeEntry("UseRawImportTool", d->useRawImportTool->isChecked()); + config->sync(); +} + +} // namespace Digikam diff --git a/src/utilities/setup/setupeditor.h b/src/utilities/setup/setupeditor.h new file mode 100644 index 00000000..bc7793ad --- /dev/null +++ b/src/utilities/setup/setupeditor.h @@ -0,0 +1,63 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2004-08-03 + * Description : setup Image Editor tab. + * + * 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. + * + * ============================================================ */ + +#ifndef SETUPEDITOR_H +#define SETUPEDITOR_H + +// TQt includes. + +#include <tqwidget.h> + +namespace Digikam +{ + +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 Digikam + +#endif // SETUPEDITOR_H diff --git a/src/utilities/setup/setupgeneral.cpp b/src/utilities/setup/setupgeneral.cpp new file mode 100644 index 00000000..2a8db22c --- /dev/null +++ b/src/utilities/setup/setupgeneral.cpp @@ -0,0 +1,313 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2003-02-01 + * Description : general configuration setup tab + * + * Copyright (C) 2003-2004 by Renchi Raju <renchi@pooh.tam.uiuc.edu> + * 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 <tqlayout.h> +#include <tqcombobox.h> +#include <tqvbuttongroup.h> +#include <tqvgroupbox.h> +#include <tqhgroupbox.h> +#include <tqgroupbox.h> +#include <tqradiobutton.h> +#include <tqcheckbox.h> +#include <tqlabel.h> +#include <tqdir.h> +#include <tqlistbox.h> +#include <tqwhatsthis.h> +#include <tqtooltip.h> +#include <tqfileinfo.h> + +// KDE includes. + +#include <tdelocale.h> +#include <kdialogbase.h> +#include <tdefiledialog.h> +#include <kurl.h> +#include <tdemessagebox.h> +#include <kurlrequester.h> + +// Local includes. + +#include "albumsettings.h" +#include "setupgeneral.h" +#include "setupgeneral.moc" + +namespace Digikam +{ + +class SetupGeneralPriv +{ +public: + + SetupGeneralPriv() + { + albumPathEdit = 0; + iconTreeThumbSize = 0; + iconTreeThumbLabel = 0; + iconShowNameBox = 0; + iconShowSizeBox = 0; + iconShowDateBox = 0; + iconShowModDateBox = 0; + iconShowResolutionBox = 0; + iconShowCommentsBox = 0; + iconShowTagsBox = 0; + iconShowRatingBox = 0; + rightClickActionComboBox = 0; + previewLoadFullImageSize = 0; + showFolderTreeViewItemsCount = 0; + } + + TQLabel *iconTreeThumbLabel; + + TQCheckBox *iconShowNameBox; + TQCheckBox *iconShowSizeBox; + TQCheckBox *iconShowDateBox; + TQCheckBox *iconShowModDateBox; + TQCheckBox *iconShowResolutionBox; + TQCheckBox *iconShowCommentsBox; + TQCheckBox *iconShowTagsBox; + TQCheckBox *iconShowRatingBox; + TQCheckBox *previewLoadFullImageSize; + TQCheckBox *showFolderTreeViewItemsCount; + + TQComboBox *iconTreeThumbSize; + TQComboBox *rightClickActionComboBox; + + KURLRequester *albumPathEdit; + + KDialogBase *mainDialog; +}; + +SetupGeneral::SetupGeneral(TQWidget* parent, KDialogBase* dialog ) + : TQWidget(parent) +{ + d = new SetupGeneralPriv; + d->mainDialog = dialog; + TQVBoxLayout *layout = new TQVBoxLayout( parent, 0, KDialog::spacingHint() ); + + // -------------------------------------------------------- + + TQHGroupBox *albumPathBox = new TQHGroupBox(parent); + albumPathBox->setTitle(i18n("Album &Library Path")); + + d->albumPathEdit = new KURLRequester(albumPathBox); + d->albumPathEdit->setMode(KFile::Directory | KFile::LocalOnly | KFile::ExistingOnly); + TQToolTip::add( d->albumPathEdit, i18n("<p>Here you can set the main path to the digiKam album " + "library in your computer." + "<p>Write access is required for this path and do not use a " + "remote path here, like an NFS mounted file system.")); + + connect(d->albumPathEdit, TQ_SIGNAL(urlSelected(const TQString &)), + this, TQ_SLOT(slotChangeAlbumPath(const TQString &))); + + connect(d->albumPathEdit, TQ_SIGNAL(textChanged(const TQString&)), + this, TQ_SLOT(slotPathEdited(const TQString&)) ); + + layout->addWidget(albumPathBox); + + // -------------------------------------------------------- + + TQVGroupBox *iconTextGroup = new TQVGroupBox(i18n("Thumbnail Information"), parent); + + d->iconShowNameBox = new TQCheckBox(i18n("Show file &name"), iconTextGroup); + TQWhatsThis::add( d->iconShowNameBox, i18n("<p>Set this option to show the file name below the image thumbnail.")); + + d->iconShowSizeBox = new TQCheckBox(i18n("Show file si&ze"), iconTextGroup); + TQWhatsThis::add( d->iconShowSizeBox, i18n("<p>Set this option to show the file size below the image thumbnail.")); + + d->iconShowDateBox = new TQCheckBox(i18n("Show camera creation &date"), iconTextGroup); + TQWhatsThis::add( d->iconShowDateBox, i18n("<p>Set this option to show the camera creation date " + "below the image thumbnail.")); + + d->iconShowModDateBox = new TQCheckBox(i18n("Show file &modification date"), iconTextGroup); + TQWhatsThis::add( d->iconShowModDateBox, i18n("<p>Set this option to show the file modification date " + "below the image thumbnail.")); + + d->iconShowCommentsBox = new TQCheckBox(i18n("Show digiKam &captions"), iconTextGroup); + TQWhatsThis::add( d->iconShowCommentsBox, i18n("<p>Set this option to show the digiKam captions " + "below the image thumbnail.")); + + d->iconShowTagsBox = new TQCheckBox(i18n("Show digiKam &tags"), iconTextGroup); + TQWhatsThis::add( d->iconShowTagsBox, i18n("<p>Set this option to show the digiKam tags " + "below the image thumbnail.")); + + d->iconShowRatingBox = new TQCheckBox(i18n("Show digiKam &rating"), iconTextGroup); + TQWhatsThis::add( d->iconShowRatingBox, i18n("<p>Set this option to show the digiKam rating " + "below the image thumbnail.")); + + d->iconShowResolutionBox = new TQCheckBox(i18n("Show ima&ge dimensions (warning: slow)"), iconTextGroup); + TQWhatsThis::add( d->iconShowResolutionBox, i18n("<p>Set this option to show the image size in pixels " + "below the image thumbnail.")); + + layout->addWidget(iconTextGroup); + + // -------------------------------------------------------- + + TQVGroupBox *interfaceOptionsGroup = new TQVGroupBox(i18n("Interface Options"), parent); + interfaceOptionsGroup->setColumnLayout(0, TQt::Vertical ); + interfaceOptionsGroup->layout()->setMargin(KDialog::marginHint()); + TQGridLayout* ifaceSettingsLayout = new TQGridLayout(interfaceOptionsGroup->layout(), 3, 4, KDialog::spacingHint()); + + d->iconTreeThumbLabel = new TQLabel(i18n("Sidebar thumbnail size:"), interfaceOptionsGroup); + d->iconTreeThumbSize = new TQComboBox(false, interfaceOptionsGroup); + d->iconTreeThumbSize->insertItem("16"); + d->iconTreeThumbSize->insertItem("22"); + d->iconTreeThumbSize->insertItem("32"); + d->iconTreeThumbSize->insertItem("48"); + TQToolTip::add( d->iconTreeThumbSize, i18n("<p>Set this option to configure the size " + "in pixels of the thumbnails in digiKam's sidebars. " + "This option will take effect when you restart " + "digiKam.")); + ifaceSettingsLayout->addMultiCellWidget(d->iconTreeThumbLabel, 0, 0, 0, 0); + ifaceSettingsLayout->addMultiCellWidget(d->iconTreeThumbSize, 0, 0, 1, 1); + + d->showFolderTreeViewItemsCount = new TQCheckBox(i18n("Show count of items in all tree-view"), interfaceOptionsGroup); + ifaceSettingsLayout->addMultiCellWidget(d->showFolderTreeViewItemsCount, 1, 1, 0, 4); + + + TQLabel *rightClickLabel = new TQLabel(i18n("Thumbnail click action:"), interfaceOptionsGroup); + d->rightClickActionComboBox = new TQComboBox(false, interfaceOptionsGroup); + d->rightClickActionComboBox->insertItem(i18n("Show embedded preview"), AlbumSettings::ShowPreview); + d->rightClickActionComboBox->insertItem(i18n("Start image editor"), AlbumSettings::StartEditor); + TQToolTip::add( d->rightClickActionComboBox, i18n("<p>Here, choose what should happen when you " + "click on a thumbnail.")); + ifaceSettingsLayout->addMultiCellWidget(rightClickLabel, 2 ,2, 0, 0); + ifaceSettingsLayout->addMultiCellWidget(d->rightClickActionComboBox, 2, 2, 1, 4); + + d->previewLoadFullImageSize = new TQCheckBox(i18n("Embedded preview loads full image size"), interfaceOptionsGroup); + TQWhatsThis::add( d->previewLoadFullImageSize, i18n("<p>Set this option to load the full image size " + "with an embedded preview, instead a reduced one. Because this option will take more time " + "to load images, use it only if you have a fast computer.")); + ifaceSettingsLayout->addMultiCellWidget(d->previewLoadFullImageSize, 3, 3, 0, 4); + + layout->addWidget(interfaceOptionsGroup); + + // -------------------------------------------------------- + + layout->addStretch(); + + readSettings(); + adjustSize(); +} + +SetupGeneral::~SetupGeneral() +{ + delete d; +} + +void SetupGeneral::applySettings() +{ + AlbumSettings* settings = AlbumSettings::instance(); + if (!settings) return; + + settings->setAlbumLibraryPath(d->albumPathEdit->url()); + + settings->setDefaultTreeIconSize(d->iconTreeThumbSize->currentText().toInt()); + settings->setIconShowName(d->iconShowNameBox->isChecked()); + settings->setIconShowTags(d->iconShowTagsBox->isChecked()); + settings->setIconShowSize(d->iconShowSizeBox->isChecked()); + settings->setIconShowDate(d->iconShowDateBox->isChecked()); + settings->setIconShowModDate(d->iconShowModDateBox->isChecked()); + settings->setIconShowResolution(d->iconShowResolutionBox->isChecked()); + settings->setIconShowComments(d->iconShowCommentsBox->isChecked()); + settings->setIconShowRating(d->iconShowRatingBox->isChecked()); + + settings->setItemRightClickAction((AlbumSettings::ItemRightClickAction) + d->rightClickActionComboBox->currentItem()); + + settings->setPreviewLoadFullImageSize(d->previewLoadFullImageSize->isChecked()); + settings->setShowFolderTreeViewItemsCount(d->showFolderTreeViewItemsCount->isChecked()); + settings->saveSettings(); +} + +void SetupGeneral::readSettings() +{ + AlbumSettings* settings = AlbumSettings::instance(); + + if (!settings) return; + + d->albumPathEdit->setURL(settings->getAlbumLibraryPath()); + + if (settings->getDefaultTreeIconSize() == 16) + d->iconTreeThumbSize->setCurrentItem(0); + else if (settings->getDefaultTreeIconSize() == 22) + d->iconTreeThumbSize->setCurrentItem(1); + else if (settings->getDefaultTreeIconSize() == 32) + d->iconTreeThumbSize->setCurrentItem(2); + else + d->iconTreeThumbSize->setCurrentItem(3); + + d->iconShowNameBox->setChecked(settings->getIconShowName()); + d->iconShowTagsBox->setChecked(settings->getIconShowTags()); + d->iconShowSizeBox->setChecked(settings->getIconShowSize()); + d->iconShowDateBox->setChecked(settings->getIconShowDate()); + d->iconShowModDateBox->setChecked(settings->getIconShowModDate()); + d->iconShowResolutionBox->setChecked(settings->getIconShowResolution()); + d->iconShowCommentsBox->setChecked(settings->getIconShowComments()); + d->iconShowRatingBox->setChecked(settings->getIconShowRating()); + + d->rightClickActionComboBox->setCurrentItem((int)settings->getItemRightClickAction()); + + d->previewLoadFullImageSize->setChecked(settings->getPreviewLoadFullImageSize()); + d->showFolderTreeViewItemsCount->setChecked(settings->getShowFolderTreeViewItemsCount()); +} + +void SetupGeneral::slotChangeAlbumPath(const TQString &result) +{ + if (KURL(result).equals(KURL(TQDir::homeDirPath()), true)) + { + KMessageBox::sorry(0, i18n("Sorry you can't use your home directory as album library.")); + return; + } + + TQFileInfo targetPath(result); + + if (!result.isEmpty() && !targetPath.isWritable()) + { + KMessageBox::information(0, i18n("No write access for this path.\n" + "Warning: the caption and tag features will not work.")); + } +} + +void SetupGeneral::slotPathEdited(const TQString& newPath) +{ + if (newPath.isEmpty()) + { + d->mainDialog->enableButtonOK(false); + return; + } + + if (!newPath.startsWith("/")) + { + d->albumPathEdit->setURL(TQDir::homeDirPath() + '/' + newPath); + } + + TQFileInfo targetPath(newPath); + TQDir dir(newPath); + d->mainDialog->enableButtonOK(dir.exists() && dir.path() != TQDir::homeDirPath()); +} + +} // namespace Digikam + diff --git a/src/utilities/setup/setupgeneral.h b/src/utilities/setup/setupgeneral.h new file mode 100644 index 00000000..768c4154 --- /dev/null +++ b/src/utilities/setup/setupgeneral.h @@ -0,0 +1,67 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2003-02-01 + * Description : general configuration setup tab + * + * Copyright (C) 2003-2004 by Renchi Raju <renchi@pooh.tam.uiuc.edu> + * 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 SETUPGENERAL_H +#define SETUPGENERAL_H + +// TQt includes. + +#include <tqwidget.h> + +class KDialogBase; + +namespace Digikam +{ + +class SetupGeneralPriv; + +class SetupGeneral : public TQWidget +{ + TQ_OBJECT + + +public: + + SetupGeneral(TQWidget* parent = 0, KDialogBase* dialog = 0); + ~SetupGeneral(); + + void applySettings(); + +private: + + void readSettings(); + +private slots: + + void slotChangeAlbumPath(const TQString &); + void slotPathEdited(const TQString&); + +private: + + SetupGeneralPriv* d; +}; + +} // namespace Digikam + +#endif // SETUPGENERAL_H diff --git a/src/utilities/setup/setupicc.cpp b/src/utilities/setup/setupicc.cpp new file mode 100644 index 00000000..b08750c1 --- /dev/null +++ b/src/utilities/setup/setupicc.cpp @@ -0,0 +1,727 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2005-11-24 + * Description : Color management setup tab. + * + * Copyright (C) 2005-2007 by F.J. Cruz <fj.cruz@supercable.es> + * Copyright (C) 2005-2009 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. + * + * ============================================================ */ + +#include <config.h> + +// TQt includes. + +#include <tqlayout.h> +#include <tqvbuttongroup.h> +#include <tqvgroupbox.h> +#include <tqhgroupbox.h> +#include <tqgroupbox.h> +#include <tqcheckbox.h> +#include <tqradiobutton.h> +#include <tqlabel.h> +#include <tqwhatsthis.h> +#include <tqiconset.h> +#include <tqpixmap.h> +#include <tqpushbutton.h> +#include <tqstringlist.h> +#include <tqmap.h> +#include <tqdir.h> +#include <tqtooltip.h> + +// KDE includes. + +#include <tdelocale.h> +#include <kdialog.h> +#include <kdialogbase.h> +#include <kurlrequester.h> +#include <klineedit.h> +#include <tdeconfig.h> +#include <kcombobox.h> +#include <tdeapplication.h> +#include <tdemessagebox.h> +#include <kurllabel.h> +#include <kiconloader.h> +#include <tdeglobalsettings.h> +#include <kstandarddirs.h> + +// lcms includes. + +#include LCMS_HEADER +#if LCMS_VERSION < 114 +#define cmsTakeCopyright(profile) "Unknown" +#endif // LCMS_VERSION < 114 + +// Local includes. + +#include "ddebug.h" +#include "squeezedcombobox.h" +#include "iccprofileinfodlg.h" +#include "albumsettings.h" +#include "setupicc.h" +#include "setupicc.moc" + +namespace Digikam +{ + +class SetupICCPriv +{ +public: + + SetupICCPriv() + { + enableColorManagement = 0; + bpcAlgorithm = 0; + managedView = 0; + defaultApplyICC = 0; + defaultAskICC = 0; + defaultPathKU = 0; + inProfilesKC = 0; + workProfilesKC = 0; + proofProfilesKC = 0; + monitorProfilesKC = 0; + renderingIntentKC = 0; + infoWorkProfiles = 0; + infoMonitorProfiles = 0; + infoInProfiles = 0; + infoProofProfiles = 0; + behaviourGB = 0; + defaultPathGB = 0; + profilesGB = 0; + advancedSettingsGB = 0; + monitorIcon = 0; + monitorProfiles = 0; + } + + TQLabel *monitorIcon; + TQLabel *monitorProfiles; + + TQCheckBox *enableColorManagement; + TQCheckBox *bpcAlgorithm; + TQCheckBox *managedView; + + TQRadioButton *defaultApplyICC; + TQRadioButton *defaultAskICC; + + TQPushButton *infoWorkProfiles; + TQPushButton *infoMonitorProfiles; + TQPushButton *infoInProfiles; + TQPushButton *infoProofProfiles; + + TQVGroupBox *behaviourGB; + TQHGroupBox *defaultPathGB; + TQGroupBox *profilesGB; + TQVGroupBox *advancedSettingsGB; + + // Maps to store profile descriptions and profile file path + TQMap<TQString, TQString> inICCPath; + TQMap<TQString, TQString> workICCPath; + TQMap<TQString, TQString> proofICCPath; + TQMap<TQString, TQString> monitorICCPath; + + KURLRequester *defaultPathKU; + + KComboBox *renderingIntentKC; + + KDialogBase *mainDialog; + + SqueezedComboBox *inProfilesKC; + SqueezedComboBox *workProfilesKC; + SqueezedComboBox *proofProfilesKC; + SqueezedComboBox *monitorProfilesKC; +}; + +SetupICC::SetupICC(TQWidget* parent, KDialogBase* dialog ) + : TQWidget(parent) +{ + d = new SetupICCPriv(); + d->mainDialog = dialog; + TQVBoxLayout *layout = new TQVBoxLayout( parent, 0, KDialog::spacingHint()); + + // -------------------------------------------------------- + + TQGroupBox *colorPolicy = new TQGroupBox(0, TQt::Horizontal, i18n("Color Management Policy"), parent); + TQGridLayout* grid = new TQGridLayout( colorPolicy->layout(), 1, 2, KDialog::spacingHint()); + + d->enableColorManagement = new TQCheckBox(colorPolicy); + d->enableColorManagement->setText(i18n("Enable Color Management")); + TQWhatsThis::add( d->enableColorManagement, i18n("<ul><li>Checked: Color Management is enabled</li>" + "<li>Unchecked: Color Management is disabled</li></ul>")); + + KURLLabel *lcmsLogoLabel = new KURLLabel(colorPolicy); + lcmsLogoLabel->setText(TQString()); + lcmsLogoLabel->setURL("http://www.littlecms.com"); + TDEGlobal::dirs()->addResourceType("logo-lcms", TDEGlobal::dirs()->kde_default("data") + "digikam/data"); + TQString directory = TDEGlobal::dirs()->findResourceDir("logo-lcms", "logo-lcms.png"); + lcmsLogoLabel->setPixmap( TQPixmap( directory + "logo-lcms.png" ) ); + TQToolTip::add(lcmsLogoLabel, i18n("Visit Little CMS project website")); + + d->behaviourGB = new TQVGroupBox(i18n("Behavior"), colorPolicy); + TQButtonGroup *behaviourOptions = new TQButtonGroup(2, TQt::Vertical, d->behaviourGB); + behaviourOptions->setFrameStyle( TQFrame::NoFrame ); + behaviourOptions->setInsideMargin(0); + + d->defaultApplyICC = new TQRadioButton(behaviourOptions); + d->defaultApplyICC->setText(i18n("Apply when opening an image in the Image Editor")); + TQWhatsThis::add( d->defaultApplyICC, i18n("<p>If this option is enabled, digiKam applies the " + "Workspace default color profile to an image, without prompting you about missing " + "embedded profiles or embedded profiles different from the workspace profile.</p>")); + + d->defaultAskICC = new TQRadioButton(behaviourOptions); + d->defaultAskICC->setText(i18n("Ask when opening an image in the Image Editor")); + TQWhatsThis::add( d->defaultAskICC, i18n("<p>If this option is enabled, digiKam asks to user " + "before it applies the Workspace default color profile to an image which has no " + "embedded profile or, if the image has an embedded profile, when it's not the same " + "as the workspace profile.</p>")); + + grid->addMultiCellWidget(d->enableColorManagement, 0, 0, 0, 0); + grid->addMultiCellWidget(lcmsLogoLabel, 0, 0, 2, 2); + grid->addMultiCellWidget(d->behaviourGB, 1, 1, 0, 2); + grid->setColStretch(1, 10); + + layout->addWidget(colorPolicy); + + // -------------------------------------------------------- + + d->defaultPathGB = new TQHGroupBox(parent); + d->defaultPathGB->setTitle(i18n("Color Profiles Directory")); + + d->defaultPathKU = new KURLRequester(d->defaultPathGB); + d->defaultPathKU->lineEdit()->setReadOnly(true); + d->defaultPathKU->setMode(KFile::Directory | KFile::LocalOnly | KFile::ExistingOnly); + TQWhatsThis::add( d->defaultPathKU, i18n("<p>Default path to the color profiles folder. " + "You must store all your color profiles in this directory.</p>")); + + layout->addWidget(d->defaultPathGB); + + // -------------------------------------------------------- + + d->profilesGB = new TQGroupBox(0, TQt::Horizontal, i18n("ICC Profiles Settings"), parent); + TQGridLayout* grid2 = new TQGridLayout( d->profilesGB->layout(), 4, 3, KDialog::spacingHint()); + grid2->setColStretch(2, 10); + + d->managedView = new TQCheckBox(d->profilesGB); + d->managedView->setText(i18n("Use color managed view (warning: slow)")); + TQWhatsThis::add( d->managedView, i18n("<p>Turn on this option if " + "you want to use your <b>Monitor Color Profile</b> to show your pictures in " + "the Image Editor window with a color correction adapted to your monitor. " + "Warning: this option can take a while to render " + "pictures on the screen, especially with a slow computer.</p>")); + + d->monitorIcon = new TQLabel(d->profilesGB); + d->monitorIcon->setPixmap(SmallIcon("tv")); + d->monitorProfiles = new TQLabel(i18n("Monitor:"), d->profilesGB); + d->monitorProfilesKC = new SqueezedComboBox(d->profilesGB); + d->monitorProfiles->setBuddy(d->monitorProfilesKC); + TQWhatsThis::add( d->monitorProfilesKC, i18n("<p>Select the color profile for your monitor. " + "You need to enable the <b>Use color managed view</b> option to use this profile.</p>")); + d->infoMonitorProfiles = new TQPushButton(i18n("Info..."), d->profilesGB); + TQWhatsThis::add( d->infoMonitorProfiles, i18n("<p>You can use this button to get more detailed " + "information about the selected monitor profile.</p>")); + + grid2->addMultiCellWidget(d->managedView, 0, 0, 0, 3); + grid2->addMultiCellWidget(d->monitorIcon, 1, 1, 0, 0); + grid2->addMultiCellWidget(d->monitorProfiles, 1, 1, 1, 1); + grid2->addMultiCellWidget(d->monitorProfilesKC, 1, 1, 2, 2); + grid2->addMultiCellWidget(d->infoMonitorProfiles, 1, 1, 3, 3); + + TQLabel *workIcon = new TQLabel(d->profilesGB); + workIcon->setPixmap(SmallIcon("input-tablet")); + TQLabel *workProfiles = new TQLabel(i18n("Workspace:"), d->profilesGB); + d->workProfilesKC = new SqueezedComboBox(d->profilesGB); + workProfiles->setBuddy(d->workProfilesKC); + TQWhatsThis::add( d->workProfilesKC, i18n("<p>All the images will be converted to the color " + "space of this profile, so you must select a profile appropriate for editing.</p>" + "<p>These color profiles are device independent.</p>")); + d->infoWorkProfiles = new TQPushButton(i18n("Info..."), d->profilesGB); + TQWhatsThis::add( d->infoWorkProfiles, i18n("<p>You can use this button to get more detailed " + "information about the selected workspace profile.</p>")); + + grid2->addMultiCellWidget(workIcon, 2, 2, 0, 0); + grid2->addMultiCellWidget(workProfiles, 2, 2, 1, 1); + grid2->addMultiCellWidget(d->workProfilesKC, 2, 2, 2, 2); + grid2->addMultiCellWidget(d->infoWorkProfiles, 2, 2, 3, 3); + + TQLabel *inIcon = new TQLabel(d->profilesGB); + inIcon->setPixmap(SmallIcon("camera-photo")); + TQLabel *inProfiles = new TQLabel(i18n("Input:"), d->profilesGB); + d->inProfilesKC = new SqueezedComboBox(d->profilesGB); + inProfiles->setBuddy(d->inProfilesKC); + TQWhatsThis::add( d->inProfilesKC, i18n("<p>You must select the profile for your input device " + "(usually, your camera, scanner...)</p>")); + d->infoInProfiles = new TQPushButton(i18n("Info..."), d->profilesGB); + TQWhatsThis::add( d->infoInProfiles, i18n("<p>You can use this button to get more detailed " + "information about the selected input profile.</p>")); + + grid2->addMultiCellWidget(inIcon, 3, 3, 0, 0); + grid2->addMultiCellWidget(inProfiles, 3, 3, 1, 1); + grid2->addMultiCellWidget(d->inProfilesKC, 3, 3, 2, 2); + grid2->addMultiCellWidget(d->infoInProfiles, 3, 3, 3, 3); + + TQLabel *proofIcon = new TQLabel(d->profilesGB); + proofIcon->setPixmap(SmallIcon("printer")); + TQLabel *proofProfiles = new TQLabel(i18n("Soft proof:"), d->profilesGB); + d->proofProfilesKC = new SqueezedComboBox(d->profilesGB); + proofProfiles->setBuddy(d->proofProfilesKC); + TQWhatsThis::add( d->proofProfilesKC, i18n("<p>You must select the profile for your output device " + "(usually, your printer). This profile will be used to do a soft proof, so you will " + "be able to preview how an image will be rendered via an output device.</p>")); + d->infoProofProfiles = new TQPushButton(i18n("Info..."), d->profilesGB); + TQWhatsThis::add( d->infoProofProfiles, i18n("<p>You can use this button to get more detailed " + "information about the selected soft proof profile.</p>")); + + grid2->addMultiCellWidget(proofIcon, 4, 4, 0, 0); + grid2->addMultiCellWidget(proofProfiles, 4, 4, 1, 1); + grid2->addMultiCellWidget(d->proofProfilesKC, 4, 4, 2, 2); + grid2->addMultiCellWidget(d->infoProofProfiles, 4, 4, 3, 3); + + layout->addWidget(d->profilesGB); + + // -------------------------------------------------------- + + d->advancedSettingsGB = new TQVGroupBox(i18n("Advanced Settings"), parent); + + d->bpcAlgorithm = new TQCheckBox(d->advancedSettingsGB); + d->bpcAlgorithm->setText(i18n("Use black point compensation")); + TQWhatsThis::add( d->bpcAlgorithm, i18n("<p><b>Black Point Compensation</b> is a way to make " + "adjustments between the maximum " + "black levels of digital files and the black capabilities of various " + "digital devices.</p>")); + + TQHBox *hbox2 = new TQHBox(d->advancedSettingsGB); + TQLabel *lablel = new TQLabel(hbox2); + lablel->setText(i18n("Rendering Intents:")); + + d->renderingIntentKC = new KComboBox(false, hbox2); + d->renderingIntentKC->insertItem("Perceptual"); + d->renderingIntentKC->insertItem("Relative Colorimetric"); + d->renderingIntentKC->insertItem("Saturation"); + d->renderingIntentKC->insertItem("Absolute Colorimetric"); + TQWhatsThis::add( d->renderingIntentKC, i18n("<ul><li><p><b>Perceptual intent</b> causes the full gamut of the image to be " + "compressed or expanded to fill the gamut of the destination device, so that gray balance is " + "preserved but colorimetric accuracy may not be preserved.</p>" + "<p>In other words, if certain colors in an image fall outside of the range of colors that the output " + "device can render, the image intent will cause all the colors in the image to be adjusted so that " + "the every color in the image falls within the range that can be rendered and so that the relationship " + "between colors is preserved as much as possible.</p>" + "<p>This intent is most suitable for display of photographs and images, and is the default intent.</p></li>" + "<li><p><b>Absolute Colorimetric intent</b> causes any colors that fall outside the range that the output device " + "can render are adjusted to the closest color that can be rendered, while all other colors are " + "left unchanged.</p>" + "<p>This intent preserves the white point and is most suitable for spot colors (Pantone, TruMatch, " + "logo colors, ...).</p></li>" + "<li><p><b>Relative Colorimetric intent</b> is defined such that any colors that fall outside the range that the " + "output device can render are adjusted to the closest color that can be rendered, while all other colors " + "are left unchanged. Proof intent does not preserve the white point.</p></li>" + "<li><p><b>Saturation intent</b> preserves the saturation of colors in the image at the possible expense of " + "hue and lightness.</p>" + "<p>Implementation of this intent remains somewhat problematic, and the ICC is still working on methods to " + "achieve the desired effects.</p>" + "<p>This intent is most suitable for business graphics such as charts, where it is more important that the " + "colors be vivid and contrast well with each other rather than a specific color.</p></li></ul>")); + + layout->addWidget(d->advancedSettingsGB); + layout->addStretch(); + + // -------------------------------------------------------- + + connect(d->managedView, TQ_SIGNAL(toggled(bool)), + this, TQ_SLOT(slotToggleManagedView(bool))); + + connect(lcmsLogoLabel, TQ_SIGNAL(leftClickedURL(const TQString&)), + this, TQ_SLOT(processLCMSURL(const TQString&))); + + connect(d->enableColorManagement, TQ_SIGNAL(toggled(bool)), + this, TQ_SLOT(slotToggledWidgets(bool))); + + connect(d->infoProofProfiles, TQ_SIGNAL(clicked()), + this, TQ_SLOT(slotClickedProof()) ); + + connect(d->infoInProfiles, TQ_SIGNAL(clicked()), + this, TQ_SLOT(slotClickedIn()) ); + + connect(d->infoMonitorProfiles, TQ_SIGNAL(clicked()), + this, TQ_SLOT(slotClickedMonitor()) ); + + connect(d->infoWorkProfiles, TQ_SIGNAL(clicked()), + this, TQ_SLOT(slotClickedWork())); + + connect(d->defaultPathKU, TQ_SIGNAL(urlSelected(const TQString&)), + this, TQ_SLOT(slotFillCombos(const TQString&))); + + // -------------------------------------------------------- + + adjustSize(); + readSettings(); + slotToggledWidgets(d->enableColorManagement->isChecked()); + slotToggleManagedView(d->managedView->isChecked()); +} + +SetupICC::~SetupICC() +{ + delete d; +} + +void SetupICC::processLCMSURL(const TQString& url) +{ + TDEApplication::kApplication()->invokeBrowser(url); +} + +void SetupICC::applySettings() +{ + TDEConfig* config = kapp->config(); + config->setGroup("Color Management"); + + config->writeEntry("EnableCM", d->enableColorManagement->isChecked()); + + if (!d->enableColorManagement->isChecked()) + return; // No need to write settings in this case. + + if (d->defaultApplyICC->isChecked()) + config->writeEntry("BehaviourICC", true); + else + config->writeEntry("BehaviourICC", false); + + config->writePathEntry("DefaultPath", d->defaultPathKU->url()); + config->writeEntry("WorkSpaceProfile", d->workProfilesKC->currentItem()); + config->writeEntry("MonitorProfile", d->monitorProfilesKC->currentItem()); + config->writeEntry("InProfile", d->inProfilesKC->currentItem()); + config->writeEntry("ProofProfile", d->proofProfilesKC->currentItem()); + config->writeEntry("BPCAlgorithm", d->bpcAlgorithm->isChecked()); + config->writeEntry("RenderingIntent", d->renderingIntentKC->currentItem()); + config->writeEntry("ManagedView", d->managedView->isChecked()); + + config->writePathEntry("InProfileFile", + *(d->inICCPath.find(d->inProfilesKC->itemHighlighted()))); + config->writePathEntry("WorkProfileFile", + *(d->workICCPath.find(d->workProfilesKC->itemHighlighted()))); + config->writePathEntry("MonitorProfileFile", + *(d->monitorICCPath.find(d->monitorProfilesKC->itemHighlighted()))); + config->writePathEntry("ProofProfileFile", + *(d->proofICCPath.find(d->proofProfilesKC->itemHighlighted()))); +} + +void SetupICC::readSettings(bool restore) +{ + TDEConfig* config = kapp->config(); + config->setGroup("Color Management"); + + if (!restore) + d->enableColorManagement->setChecked(config->readBoolEntry("EnableCM", false)); + + d->defaultPathKU->setURL(config->readPathEntry("DefaultPath", TQString())); + d->bpcAlgorithm->setChecked(config->readBoolEntry("BPCAlgorithm", false)); + d->renderingIntentKC->setCurrentItem(config->readNumEntry("RenderingIntent", 0)); + d->managedView->setChecked(config->readBoolEntry("ManagedView", false)); + + if (config->readBoolEntry("BehaviourICC")) + d->defaultApplyICC->setChecked(true); + else + d->defaultAskICC->setChecked(true); + + fillCombos(d->defaultPathKU->url(), false); + + d->workProfilesKC->setCurrentItem(config->readNumEntry("WorkSpaceProfile", 0)); + d->monitorProfilesKC->setCurrentItem(config->readNumEntry("MonitorProfile", 0)); + d->inProfilesKC->setCurrentItem(config->readNumEntry("InProfile", 0)); + d->proofProfilesKC->setCurrentItem(config->readNumEntry("ProofProfile", 0)); +} + +void SetupICC::slotFillCombos(const TQString& path) +{ + fillCombos(path, true); +} + +void SetupICC::fillCombos(const TQString& path, bool report) +{ + if (!d->enableColorManagement->isChecked()) + return; + + d->inProfilesKC->clear(); + d->monitorProfilesKC->clear(); + d->workProfilesKC->clear(); + d->proofProfilesKC->clear(); + d->inICCPath.clear(); + d->workICCPath.clear(); + d->proofICCPath.clear(); + d->monitorICCPath.clear(); + TQDir dir(path); + + if (path.isEmpty() || !dir.exists() || !dir.isReadable()) + { + if (report) + KMessageBox::sorry(this, i18n("<p>You must set a correct default " + "path for your ICC color profiles files.</p>")); + + d->mainDialog->enableButtonOK(false); + return; + } + d->mainDialog->enableButtonOK(true); + + // Look the ICC profile path repository set by user. + TQDir userProfilesDir(path, "*.icc;*.icm", TQDir::Files); + const TQFileInfoList* usersFiles = userProfilesDir.entryInfoList(); + DDebug() << "Scanning ICC profiles from user repository: " << path << endl; + + if ( !parseProfilesfromDir(usersFiles) ) + { + if (report) + { + TQString message = i18n("<p>Sorry, there are no ICC profiles files in "); + message.append(path); + message.append(i18n("</p>")); + KMessageBox::sorry(this, message); + } + + DDebug() << "No ICC profile files found!!!" << endl; + d->mainDialog->enableButtonOK(false); + return; + } + + // Look the ICC color-space profile path include with digiKam dist. + TDEGlobal::dirs()->addResourceType("profiles", TDEGlobal::dirs()->kde_default("data") + "digikam/profiles"); + TQString digiKamProfilesPath = TDEGlobal::dirs()->findResourceDir("profiles", "srgb.icm"); + TQDir digiKamProfilesDir(digiKamProfilesPath, "*.icc;*.icm", TQDir::Files); + const TQFileInfoList* digiKamFiles = digiKamProfilesDir.entryInfoList(); + DDebug() << "Scanning ICC profiles included with digiKam: " << digiKamProfilesPath << endl; + parseProfilesfromDir(digiKamFiles); + + d->monitorProfilesKC->insertSqueezedList(d->monitorICCPath.keys(), 0); + if (d->monitorICCPath.keys().isEmpty()) + { + d->managedView->setEnabled(false); + d->managedView->setChecked(false); + } + else + { + d->managedView->setEnabled(true); + } + + d->inProfilesKC->insertSqueezedList(d->inICCPath.keys(), 0); + d->proofProfilesKC->insertSqueezedList(d->proofICCPath.keys(), 0); + + d->workProfilesKC->insertSqueezedList(d->workICCPath.keys(), 0); + if (d->workICCPath.keys().isEmpty()) + { + // If there is no workspace icc profiles available, + // the CM is broken and cannot be used. + d->mainDialog->enableButtonOK(false); + return; + } + + d->mainDialog->enableButtonOK(true); +} + +bool SetupICC::parseProfilesfromDir(const TQFileInfoList* files) +{ + cmsHPROFILE tmpProfile=0; + bool findIccFiles=false; + + if (files) + { + TQFileInfoListIterator it(*files); + TQFileInfo *fileInfo=0; + + while ((fileInfo = it.current()) != 0) + { + if (fileInfo->isFile() && fileInfo->isReadable()) + { + TQString fileName = fileInfo->filePath(); + tmpProfile = cmsOpenProfileFromFile(TQFile::encodeName(fileName), "r"); + + if (tmpProfile == NULL) + { + DDebug() << "Error: Parsed profile is NULL (invalid profile); " << fileName << endl; + cmsCloseProfile(tmpProfile); + ++it; + TQString message = i18n("<p>The following profile is invalid:</p><p><b>"); + message.append(fileName); + message.append("</b></p><p>To avoid this message remove it from color profiles repository</p>"); + message.append("<p>Do you want digiKam do it for you?</p>"); + if (KMessageBox::warningYesNo(this, message, i18n("Invalid Profile")) == 3) + { + if (TQFile::remove(fileName)) + { + KMessageBox::information(this, i18n("Invalid color profile has been removed")); + } + else + { + KMessageBox::information(this, i18n("<p>digiKam has failed to remove the invalid color profile</p><p>You have to do it manually</p>")); + } + } + + continue; + } + + TQString profileDescription = TQString((cmsTakeProductDesc(tmpProfile))); + + switch ((int)cmsGetDeviceClass(tmpProfile)) + { + case icSigInputClass: + { + if (TQString(cmsTakeProductDesc(tmpProfile)).isEmpty()) + d->inICCPath.insert(fileName, fileName); + else + d->inICCPath.insert(TQString(cmsTakeProductDesc(tmpProfile)), fileName); + + DDebug() << "ICC file: " << fileName << " ==> Input device class (" + << cmsGetDeviceClass(tmpProfile) << ")" << endl; + findIccFiles = true; + break; + } + case icSigDisplayClass: + { + if (TQString(cmsTakeProductDesc(tmpProfile)).isEmpty()) + { + d->monitorICCPath.insert(fileName, fileName); + d->workICCPath.insert(fileName, fileName); + } + else + { + d->monitorICCPath.insert(TQString(cmsTakeProductDesc(tmpProfile)), fileName); + d->workICCPath.insert(TQString(cmsTakeProductDesc(tmpProfile)), fileName); + } + + DDebug() << "ICC file: " << fileName << " ==> Monitor device class (" + << cmsGetDeviceClass(tmpProfile) << ")" << endl; + findIccFiles = true; + break; + } + case icSigOutputClass: + { + if (TQString(cmsTakeProductDesc(tmpProfile)).isEmpty()) + d->proofICCPath.insert(fileName, fileName); + else + d->proofICCPath.insert(TQString(cmsTakeProductDesc(tmpProfile)), fileName); + + DDebug() << "ICC file: " << fileName << " ==> Output device class (" + << cmsGetDeviceClass(tmpProfile) << ")" << endl; + findIccFiles = true; + break; + } + case icSigColorSpaceClass: + { + if (TQString(cmsTakeProductDesc(tmpProfile)).isEmpty()) + { + d->inICCPath.insert(fileName, fileName); + d->workICCPath.insert(fileName, fileName); + } + else + { + d->inICCPath.insert(TQString(cmsTakeProductDesc(tmpProfile)), fileName); + d->workICCPath.insert(TQString(cmsTakeProductDesc(tmpProfile)), fileName); + } + + DDebug() << "ICC file: " << fileName << " ==> WorkingSpace device class (" + << cmsGetDeviceClass(tmpProfile) << ")" << endl; + findIccFiles = true; + break; + } + default: + { + DDebug() << "ICC file: " << fileName << " ==> UNKNOW device class (" + << cmsGetDeviceClass(tmpProfile) << ")" << endl; + break; + } + } + + cmsCloseProfile(tmpProfile); + } + ++it; + } + } + + return findIccFiles; +} + +void SetupICC::slotToggledWidgets(bool t) +{ + d->behaviourGB->setEnabled(t); + d->defaultPathGB->setEnabled(t); + d->profilesGB->setEnabled(t); + d->advancedSettingsGB->setEnabled(t); + + if (t) + { + readSettings(true); + slotToggleManagedView(d->managedView->isChecked()); + } + else + d->mainDialog->enableButtonOK(true); +} + +void SetupICC::slotClickedWork() +{ + profileInfo(*(d->workICCPath.find(d->workProfilesKC->itemHighlighted()))); +} + +void SetupICC::slotClickedIn() +{ + profileInfo(*(d->inICCPath.find(d->inProfilesKC->itemHighlighted()))); +} + +void SetupICC::slotClickedMonitor() +{ + profileInfo(*(d->monitorICCPath.find(d->monitorProfilesKC->itemHighlighted()))); +} + +void SetupICC::slotClickedProof() +{ + profileInfo(*(d->proofICCPath.find(d->proofProfilesKC->itemHighlighted()))); +} + +void SetupICC::profileInfo(const TQString& profile) +{ + if (profile.isEmpty()) + { + KMessageBox::error(this, i18n("Sorry, there is not any selected profile"), i18n("Profile Error")); + return; + } + + ICCProfileInfoDlg infoDlg(this, profile); + infoDlg.exec(); +} + +void SetupICC::slotToggleManagedView(bool b) +{ + d->monitorIcon->setEnabled(b); + d->monitorProfiles->setEnabled(b); + d->monitorProfilesKC->setEnabled(b); + d->infoMonitorProfiles->setEnabled(b); +} + +bool SetupICC::iccRepositoryIsValid() +{ + TDEConfig* config = kapp->config(); + config->setGroup("Color Management"); + + // If color management is disable, no need to check anymore. + if (!config->readBoolEntry("EnableCM", false)) + return true; + + // To be valid, the ICC profiles repository must exist and be readable. + + TQDir tmpPath(config->readPathEntry("DefaultPath", TQString())); + DDebug() << "ICC profiles repository is: " << tmpPath.dirName() << endl; + + if ( tmpPath.exists() && tmpPath.isReadable() ) + return true; + + return false; +} + +} // namespace Digikam diff --git a/src/utilities/setup/setupicc.h b/src/utilities/setup/setupicc.h new file mode 100644 index 00000000..8eaaece1 --- /dev/null +++ b/src/utilities/setup/setupicc.h @@ -0,0 +1,86 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2005-11-24 + * Description : Color management setup tab. + * + * Copyright (C) 2005-2007 by F.J. Cruz <fj.cruz@supercable.es> + * Copyright (C) 2005-2009 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 SETUPICC_H +#define SETUPICC_H + +// TQt includes. + +#include <tqwidget.h> +#include <tqmap.h> +#include <tqdir.h> + +// Local includes. + +#include "digikam_export.h" + +class KDialogBase; + +namespace Digikam +{ + +class SetupICCPriv; + +class DIGIKAM_EXPORT SetupICC : public TQWidget +{ + TQ_OBJECT + + +public: + + SetupICC(TQWidget* parent = 0, KDialogBase* dialog = 0); + ~SetupICC(); + + void applySettings(); + + static bool iccRepositoryIsValid(); + +private: + + void readSettings(bool restore=false); + void fillCombos(const TQString& path, bool report); + void enableWidgets(); + void disableWidgets(); + void profileInfo(const TQString&); + bool parseProfilesfromDir(const TQFileInfoList* files); + +private slots: + + void processLCMSURL(const TQString&); + void slotToggledWidgets(bool); + void slotToggleManagedView(bool); + void slotFillCombos(const TQString&); + void slotClickedIn(); + void slotClickedWork(); + void slotClickedMonitor(); + void slotClickedProof(); + +private: + + SetupICCPriv* d; +}; + +} // namespace Digikam + +#endif // SETUPICC_H diff --git a/src/utilities/setup/setupidentity.cpp b/src/utilities/setup/setupidentity.cpp new file mode 100644 index 00000000..ecbfdfbf --- /dev/null +++ b/src/utilities/setup/setupidentity.cpp @@ -0,0 +1,217 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2006-07-04 + * Description : default IPTC identity 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 <tqhgroupbox.h> +#include <tqgroupbox.h> +#include <tqlabel.h> +#include <tqwhatsthis.h> +#include <tqvalidator.h> + +// KDE includes. + +#include <tdelocale.h> +#include <kdialog.h> +#include <klineedit.h> +#include <kactivelabel.h> + +// Local includes. + +#include "albumsettings.h" +#include "setupidentity.h" +#include "setupidentity.moc" + +namespace Digikam +{ + +class SetupIdentityPriv +{ +public: + + SetupIdentityPriv() + { + authorEdit = 0; + authorTitleEdit = 0; + creditEdit = 0; + sourceEdit = 0; + copyrightEdit = 0; + } + + KLineEdit *authorEdit; + KLineEdit *authorTitleEdit; + KLineEdit *creditEdit; + KLineEdit *sourceEdit; + KLineEdit *copyrightEdit; +}; + +SetupIdentity::SetupIdentity(TQWidget* parent ) + : TQWidget(parent) +{ + d = new SetupIdentityPriv; + TQVBoxLayout *layout = new TQVBoxLayout( parent, 0, KDialog::spacingHint() ); + + // -------------------------------------------------------- + + // IPTC only accept printable Ascii char. + TQRegExp asciiRx("[\x20-\x7F]+$"); + TQValidator *asciiValidator = new TQRegExpValidator(asciiRx, this); + + TQGroupBox *photographerIdGroup = new TQGroupBox(0, TQt::Horizontal, i18n("Photographer and Copyright Information"), parent); + TQGridLayout* grid = new TQGridLayout( photographerIdGroup->layout(), 1, 1, KDialog::spacingHint()); + + TQLabel *label1 = new TQLabel(i18n("Author:"), photographerIdGroup); + d->authorEdit = new KLineEdit(photographerIdGroup); + d->authorEdit->setValidator(asciiValidator); + d->authorEdit->setMaxLength(32); + label1->setBuddy(d->authorEdit); + grid->addMultiCellWidget(label1, 0, 0, 0, 0); + grid->addMultiCellWidget(d->authorEdit, 0, 0, 1, 1); + TQWhatsThis::add( d->authorEdit, i18n("<p>This field should contain your name, or the name of the person who created the photograph. " + "If it is not appropriate to add the name of the photographer (for example, if the identify of " + "the photographer needs to be protected) the name of a company or organization can also be used. " + "Once saved, this field should not be changed by anyone. This field does not support the use of " + "commas or semi-colons as separator. \nThis field is limited to 32 ASCII characters.</p>")); + + TQLabel *label2 = new TQLabel(i18n("Author Title:"), photographerIdGroup); + d->authorTitleEdit = new KLineEdit(photographerIdGroup); + d->authorTitleEdit->setValidator(asciiValidator); + d->authorTitleEdit->setMaxLength(32); + label2->setBuddy(d->authorTitleEdit); + grid->addMultiCellWidget(label2, 1, 1, 0, 0); + grid->addMultiCellWidget(d->authorTitleEdit, 1, 1, 1, 1); + TQWhatsThis::add( d->authorTitleEdit, i18n("<p>This field should contain the job title of the photographer. Examples might include " + "titles such as: Staff Photographer, Freelance Photographer, or Independent Commercial " + "Photographer. Since this is a qualifier for the Author field, the Author field must also " + "be filled out. \nThis field is limited to 32 ASCII characters.</p>")); + + // -------------------------------------------------------- + + TQGroupBox *creditsGroup = new TQGroupBox(0, TQt::Horizontal, i18n("Credit and Copyright"), parent); + TQGridLayout* grid2 = new TQGridLayout( creditsGroup->layout(), 2, 1, KDialog::spacingHint()); + + TQLabel *label3 = new TQLabel(i18n("Credit:"), creditsGroup); + d->creditEdit = new KLineEdit(creditsGroup); + d->creditEdit->setValidator(asciiValidator); + d->creditEdit->setMaxLength(32); + label3->setBuddy(d->creditEdit); + grid2->addMultiCellWidget(label3, 0, 0, 0, 0); + grid2->addMultiCellWidget(d->creditEdit, 0, 0, 1, 1); + TQWhatsThis::add( d->creditEdit, i18n("<p>(synonymous to Provider): Use the Provider field to identify who is providing the photograph. " + "This does not necessarily have to be the author. If a photographer is working for a news agency " + "such as Reuters or the Associated Press, these organizations could be listed here as they are " + "\"providing\" the image for use by others. If the image is a stock photograph, then the group " + "(agency) involved in supplying the image should be listed here. " + "\nThis field is limited to 32 ASCII characters.</p>")); + + TQLabel *label4 = new TQLabel(i18n("Source:"), creditsGroup); + d->sourceEdit = new KLineEdit(creditsGroup); + d->sourceEdit->setValidator(asciiValidator); + d->sourceEdit->setMaxLength(32); + label4->setBuddy(d->sourceEdit); + grid2->addMultiCellWidget(label4, 1, 1, 0, 0); + grid2->addMultiCellWidget(d->sourceEdit, 1, 1, 1, 1); + TQWhatsThis::add( d->sourceEdit, i18n("<p>The Source field should be used to identify the original owner or copyright holder of the " + "photograph. The value of this field should never be changed after the information is entered " + "following the image's creation. While not yet enforced by the custom panels, you should consider " + "this to be a \"write-once\" field. The source could be an individual, an agency, or a " + "member of an agency. To aid in later searches, it is suggested to separate any slashes " + "\"/\" with a blank space. Use the form \"photographer / agency\" rather than " + "\"photographer/agency.\" Source may also be different from Creator and from the names " + "listed in the Copyright Notice.\nThis field is limited to 32 ASCII characters.</p>")); + + TQLabel *label5 = new TQLabel(i18n("Copyright:"), creditsGroup); + d->copyrightEdit = new KLineEdit(creditsGroup); + d->copyrightEdit->setValidator(asciiValidator); + d->copyrightEdit->setMaxLength(128); + label5->setBuddy(d->copyrightEdit); + grid2->addMultiCellWidget(label5, 2, 2, 0, 0); + grid2->addMultiCellWidget(d->copyrightEdit, 2, 2, 1, 1); + TQWhatsThis::add( d->copyrightEdit, i18n("<p>The Copyright Notice should contain any necessary copyright notice for claiming the intellectual " + "property, and should identify the current owner(s) of the copyright for the photograph. Usually, " + "this would be the photographer, but if the image was done by an employee or as work-for-hire, " + "then the agency or company should be listed. Use the form appropriate to your country. USA: " + "© {date of first publication} name of copyright owner, as in \"©2005 John Doe.\" " + "Note, the word \"copyright\" or the abbreviation \"copr\" may be used in place of the © symbol. " + "In some foreign countries only the copyright symbol is recognized and the abbreviation does not work. " + "Furthermore the copyright symbol must be a full circle with a \"c\" inside; using something like (c) " + "where the parentheses form a partial circle is not sufficient. For additional protection worldwide, " + "use of the phrase, \"all rights reserved\" following the notice above is encouraged. \nIn Europe " + "you would use: Copyright {Year} {Copyright owner}, all rights reserved. \nIn Japan, for maximum " + "protection, the following three items should appear in the copyright field of the IPTC Core: " + "(a) the word, Copyright; (b) year of the first publication; and (c) name of the author. " + "You may also wish to include the phrase \"all rights reserved.\"\n" + "This field is limited to 128 ASCII characters.</p>")); + + // -------------------------------------------------------- + + KActiveLabel *note = new KActiveLabel(i18n("<b>Note: These informations are used to set " + "<b><a href='http://en.wikipedia.org/wiki/IPTC'>IPTC</a></b> tags contents. " + "IPTC text tags only support the printable " + "<b><a href='http://en.wikipedia.org/wiki/Ascii'>ASCII</a></b> " + "characters set and limit strings size. " + "Use contextual help for details.</b>"), parent); + + // -------------------------------------------------------- + + layout->addWidget(photographerIdGroup); + layout->addWidget(creditsGroup); + layout->addWidget(note); + layout->addStretch(); + + readSettings(); +} + +SetupIdentity::~SetupIdentity() +{ + delete d; +} + +void SetupIdentity::applySettings() +{ + AlbumSettings* settings = AlbumSettings::instance(); + if (!settings) return; + + settings->setIptcAuthor(d->authorEdit->text()); + settings->setIptcAuthorTitle(d->authorTitleEdit->text()); + settings->setIptcCredit(d->creditEdit->text()); + settings->setIptcSource(d->sourceEdit->text()); + settings->setIptcCopyright(d->copyrightEdit->text()); + settings->saveSettings(); +} + +void SetupIdentity::readSettings() +{ + AlbumSettings* settings = AlbumSettings::instance(); + if (!settings) return; + + d->authorEdit->setText(settings->getIptcAuthor()); + d->authorTitleEdit->setText(settings->getIptcAuthorTitle()); + d->creditEdit->setText(settings->getIptcCredit()); + d->sourceEdit->setText(settings->getIptcSource()); + d->copyrightEdit->setText(settings->getIptcCopyright()); +} + +} // namespace Digikam + diff --git a/src/utilities/setup/setupidentity.h b/src/utilities/setup/setupidentity.h new file mode 100644 index 00000000..ae26dc77 --- /dev/null +++ b/src/utilities/setup/setupidentity.h @@ -0,0 +1,60 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2006-07-04 + * Description : default IPTC identity 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 SETUP_IDENTITY_H +#define SETUP_IDENTITY_H + +// TQt includes. + +#include <tqwidget.h> + +namespace Digikam +{ + +class SetupIdentityPriv; + +class SetupIdentity : public TQWidget +{ + TQ_OBJECT + + +public: + + SetupIdentity(TQWidget* parent = 0); + ~SetupIdentity(); + + void applySettings(); + +private: + + void readSettings(); + +private: + + SetupIdentityPriv* d; + +}; + +} // namespace Digikam + +#endif // SETUP_IDENTITY_H diff --git a/src/utilities/setup/setupiofiles.cpp b/src/utilities/setup/setupiofiles.cpp new file mode 100644 index 00000000..6cdf23de --- /dev/null +++ b/src/utilities/setup/setupiofiles.cpp @@ -0,0 +1,137 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2006-01-23 + * Description : setup image editor output files settings. + * + * 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> + +// KDE includes. + +#include <tdelocale.h> +#include <kdialog.h> +#include <tdeconfig.h> +#include <tdeapplication.h> +#include <kseparator.h> + +// Local includes. + +#include "jpegsettings.h" +#include "pngsettings.h" +#include "tiffsettings.h" +#include "jp2ksettings.h" +#include "setupiofiles.h" +#include "setupiofiles.moc" + +namespace Digikam +{ + +class SetupIOFilesPriv +{ +public: + + + SetupIOFilesPriv() + { + JPEGOptions = 0; + PNGOptions = 0; + TIFFOptions = 0; + JPEG2000Options = 0; + } + + JPEGSettings *JPEGOptions; + + PNGSettings *PNGOptions; + + TIFFSettings *TIFFOptions; + + JP2KSettings *JPEG2000Options; +}; + +SetupIOFiles::SetupIOFiles(TQWidget* parent ) + : TQWidget(parent) +{ + d = new SetupIOFilesPriv; + + TQVBoxLayout* vbox = new TQVBoxLayout(parent); + + //-- JPEG Settings ------------------------------------------------------ + + d->JPEGOptions = new JPEGSettings(parent); + KSeparator *line1 = new KSeparator(TQt::Horizontal, parent); + vbox->addWidget(d->JPEGOptions); + vbox->addWidget(line1); + + //-- PNG Settings ------------------------------------------------------- + + d->PNGOptions = new PNGSettings(parent); + KSeparator *line2 = new KSeparator(TQt::Horizontal, parent); + vbox->addWidget(d->PNGOptions); + vbox->addWidget(line2); + + //-- TIFF Settings ------------------------------------------------------ + + d->TIFFOptions = new TIFFSettings(parent); + KSeparator *line3 = new KSeparator(TQt::Horizontal, parent); + vbox->addWidget(d->TIFFOptions); + vbox->addWidget(line3); + + //-- JPEG 2000 Settings ------------------------------------------------- + + d->JPEG2000Options = new JP2KSettings(parent); + vbox->addWidget(d->JPEG2000Options); + + vbox->addStretch(10); + readSettings(); +} + +SetupIOFiles::~SetupIOFiles() +{ + delete d; +} + +void SetupIOFiles::applySettings() +{ + TDEConfig* config = kapp->config(); + config->setGroup("ImageViewer Settings"); + config->writeEntry("JPEGCompression", d->JPEGOptions->getCompressionValue()); + config->writeEntry("JPEGSubSampling", d->JPEGOptions->getSubSamplingValue()); + config->writeEntry("PNGCompression", d->PNGOptions->getCompressionValue()); + config->writeEntry("TIFFCompression", d->TIFFOptions->getCompression()); + config->writeEntry("JPEG2000Compression", d->JPEG2000Options->getCompressionValue()); + config->writeEntry("JPEG2000LossLess", d->JPEG2000Options->getLossLessCompression()); + config->sync(); +} + +void SetupIOFiles::readSettings() +{ + TDEConfig* config = kapp->config(); + config->setGroup("ImageViewer Settings"); + d->JPEGOptions->setCompressionValue( config->readNumEntry("JPEGCompression", 75) ); + d->JPEGOptions->setSubSamplingValue( config->readNumEntry("JPEGSubSampling", 1) ); // Medium subsampling + d->PNGOptions->setCompressionValue( config->readNumEntry("PNGCompression", 9) ); + d->TIFFOptions->setCompression(config->readBoolEntry("TIFFCompression", false)); + d->JPEG2000Options->setCompressionValue( config->readNumEntry("JPEG2000Compression", 75) ); + d->JPEG2000Options->setLossLessCompression( config->readBoolEntry("JPEG2000LossLess", true) ); +} + +} // namespace Digikam diff --git a/src/utilities/setup/setupiofiles.h b/src/utilities/setup/setupiofiles.h new file mode 100644 index 00000000..060dbba1 --- /dev/null +++ b/src/utilities/setup/setupiofiles.h @@ -0,0 +1,63 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2006-01-23 + * Description : setup image editor output files settings. + * + * 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 SETUPIOFILES_H +#define SETUPIOFILES_H + +// TQt includes. + +#include <tqwidget.h> + +// Local includes. + +#include "digikam_export.h" + +namespace Digikam +{ + +class SetupIOFilesPriv; + +class DIGIKAM_EXPORT SetupIOFiles : public TQWidget +{ + TQ_OBJECT + + +public: + + SetupIOFiles(TQWidget* parent = 0); + ~SetupIOFiles(); + + void applySettings(); + +private: + + void readSettings(); + +private: + + SetupIOFilesPriv* d; +}; + +} // namespace Digikam + +#endif // SETUPIOFILES_H diff --git a/src/utilities/setup/setuplighttable.cpp b/src/utilities/setup/setuplighttable.cpp new file mode 100644 index 00000000..0ed01eab --- /dev/null +++ b/src/utilities/setup/setuplighttable.cpp @@ -0,0 +1,133 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2007-05-11 + * Description : setup Light Table tab. + * + * Copyright (C) 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 <tqcolor.h> +#include <tqhbox.h> +#include <tqvgroupbox.h> +#include <tqlabel.h> +#include <tqwhatsthis.h> +#include <tqcheckbox.h> + +// KDE includes. + +#include <tdelocale.h> +#include <kdialog.h> +#include <tdeconfig.h> +#include <tdeapplication.h> + +// Local includes. + +#include "setuplighttable.h" +#include "setuplighttable.moc" + +namespace Digikam +{ +class SetupLightTablePriv +{ +public: + + SetupLightTablePriv() + { + hideToolBar = 0; + autoSyncPreview = 0; + autoLoadOnRightPanel = 0; + loadFullImageSize = 0; + } + + TQCheckBox *hideToolBar; + TQCheckBox *autoSyncPreview; + TQCheckBox *autoLoadOnRightPanel; + TQCheckBox *loadFullImageSize; +}; + +SetupLightTable::SetupLightTable(TQWidget* parent ) + : TQWidget(parent) +{ + d = new SetupLightTablePriv; + TQVBoxLayout *layout = new TQVBoxLayout( parent, 0, KDialog::spacingHint() ); + + // -------------------------------------------------------- + + TQVGroupBox *interfaceOptionsGroup = new TQVGroupBox(i18n("Interface Options"), parent); + + + d->autoSyncPreview = new TQCheckBox(i18n("Synchronize panels automatically"), interfaceOptionsGroup); + TQWhatsThis::add( d->autoSyncPreview, i18n("<p>Set this option to automatically synchronize " + "zooming and panning between left and right panels if the images have " + "the same size.")); + + d->autoLoadOnRightPanel = new TQCheckBox(i18n("Selecting a thumbbar item loads image to the right panel"), + interfaceOptionsGroup); + TQWhatsThis::add( d->autoLoadOnRightPanel, i18n("<p>Set this option to automatically load an image " + "into the right panel when the corresponding item is selected on the thumbbar.")); + + d->loadFullImageSize = new TQCheckBox(i18n("Load full image size"), interfaceOptionsGroup); + TQWhatsThis::add( d->loadFullImageSize, i18n("<p>Set this option to load full image size " + "into the preview panel instead of a reduced size. Because this option will take more time " + "to load images, use it only if you have a fast computer.")); + + d->hideToolBar = new TQCheckBox(i18n("H&ide toolbar in fullscreen mode"), interfaceOptionsGroup); + + // -------------------------------------------------------- + + layout->addWidget(interfaceOptionsGroup); + layout->addStretch(); + + // -------------------------------------------------------- + + readSettings(); +} + +SetupLightTable::~SetupLightTable() +{ + delete d; +} + +void SetupLightTable::readSettings() +{ + TDEConfig* config = kapp->config(); + TQColor Black(TQt::black); + TQColor White(TQt::white); + config->setGroup("LightTable Settings"); + d->hideToolBar->setChecked(config->readBoolEntry("FullScreen Hide ToolBar", false)); + d->autoSyncPreview->setChecked(config->readBoolEntry("Auto Sync Preview", true)); + d->autoLoadOnRightPanel->setChecked(config->readBoolEntry("Auto Load Right Panel", true)); + d->loadFullImageSize->setChecked(config->readBoolEntry("Load Full Image size", false)); +} + +void SetupLightTable::applySettings() +{ + TDEConfig* config = kapp->config(); + config->setGroup("LightTable Settings"); + config->writeEntry("FullScreen Hide ToolBar", d->hideToolBar->isChecked()); + config->writeEntry("Auto Sync Preview", d->autoSyncPreview->isChecked()); + config->writeEntry("Auto Load Right Panel", d->autoLoadOnRightPanel->isChecked()); + config->writeEntry("Load Full Image size", d->loadFullImageSize->isChecked()); + config->sync(); +} + +} // namespace Digikam + diff --git a/src/utilities/setup/setuplighttable.h b/src/utilities/setup/setuplighttable.h new file mode 100644 index 00000000..20af9a64 --- /dev/null +++ b/src/utilities/setup/setuplighttable.h @@ -0,0 +1,59 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2007-05-11 + * Description : setup Light Table tab. + * + * Copyright (C) 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 SETUPLIGHTTABLE_H +#define SETUPLIGHTTABLE_H + +// TQt includes. + +#include <tqwidget.h> + +namespace Digikam +{ + +class SetupLightTablePriv; + +class SetupLightTable : public TQWidget +{ + TQ_OBJECT + + +public: + + SetupLightTable(TQWidget* parent = 0); + ~SetupLightTable(); + + void applySettings(); + +private: + + void readSettings(); + +private: + + SetupLightTablePriv* d; +}; + +} // namespace Digikam + +#endif // SETUPLIGHTTABLE_H diff --git a/src/utilities/setup/setupmetadata.cpp b/src/utilities/setup/setupmetadata.cpp new file mode 100644 index 00000000..e4f74ede --- /dev/null +++ b/src/utilities/setup/setupmetadata.cpp @@ -0,0 +1,238 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2003-08-03 + * Description : setup Metadata tab. + * + * Copyright (C) 2003-2004 by Ralf Holzer <ralf at well.com> + * Copyright (C) 2003-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 <tqvbuttongroup.h> +#include <tqvgroupbox.h> +#include <tqhgroupbox.h> +#include <tqgroupbox.h> +#include <tqcheckbox.h> +#include <tqlabel.h> +#include <tqwhatsthis.h> +#include <tqtooltip.h> +#include <tqhbox.h> + +// KDE includes. + +#include <tdelocale.h> +#include <kactivelabel.h> +#include <kdialog.h> +#include <kurllabel.h> +#include <kiconloader.h> +#include <tdeglobalsettings.h> +#include <kstandarddirs.h> +#include <tdeapplication.h> + +// Local includes. + +#include "albumsettings.h" +#include "setupmetadata.h" +#include "setupmetadata.moc" + +namespace Digikam +{ + +class SetupMetadataPriv +{ +public: + + SetupMetadataPriv() + { + ExifAutoRotateAsChanged = false; + saveCommentsBox = 0; + ExifRotateBox = 0; + ExifSetOrientationBox = 0; + saveRatingBox = 0; + saveTagsIptcBox = 0; + saveDateTimeBox = 0; + savePhotographerIdIptcBox = 0; + saveCreditsIptcBox = 0; + } + + bool ExifAutoRotateAsChanged; + bool ExifAutoRotateOrg; + + TQCheckBox *saveCommentsBox; + TQCheckBox *ExifRotateBox; + TQCheckBox *ExifSetOrientationBox; + TQCheckBox *saveRatingBox; + TQCheckBox *saveTagsIptcBox; + TQCheckBox *saveDateTimeBox; + TQCheckBox *savePhotographerIdIptcBox; + TQCheckBox *saveCreditsIptcBox; +}; + +SetupMetadata::SetupMetadata(TQWidget* parent ) + : TQWidget(parent) +{ + d = new SetupMetadataPriv; + TQVBoxLayout *mainLayout = new TQVBoxLayout(parent, 0, KDialog::spacingHint()); + + // -------------------------------------------------------- + + TQGroupBox *ExifGroup = new TQGroupBox(1, TQt::Horizontal, i18n("EXIF Actions"), parent); + + d->ExifRotateBox = new TQCheckBox(ExifGroup); + d->ExifRotateBox->setText(i18n("Show images/thumbs &rotated according to orientation tag")); + + d->ExifSetOrientationBox = new TQCheckBox(ExifGroup); + d->ExifSetOrientationBox->setText(i18n("Set orientation tag to normal after rotate/flip")); + + // -------------------------------------------------------- + + TQGroupBox *IptcGroup = new TQGroupBox(1, TQt::Horizontal, i18n("IPTC Actions"), parent); + + d->saveTagsIptcBox = new TQCheckBox(IptcGroup); + d->saveTagsIptcBox->setText(i18n("&Save image tags as \"Keywords\" tag")); + TQWhatsThis::add( d->saveTagsIptcBox, i18n("<p>Turn this option on to store the image tags " + "in the IPTC <i>Keywords</i> tag.")); + + d->savePhotographerIdIptcBox = new TQCheckBox(IptcGroup); + d->savePhotographerIdIptcBox->setText(i18n("&Save default photographer identity as tags")); + TQWhatsThis::add( d->savePhotographerIdIptcBox, i18n("<p>Turn this option on to store the default " + "photographer identity in the IPTC tags. You can set this " + "value in the Identity setup page.")); + + d->saveCreditsIptcBox = new TQCheckBox(IptcGroup); + d->saveCreditsIptcBox->setText(i18n("&Save default credit and copyright identity as tags")); + TQWhatsThis::add( d->saveCreditsIptcBox, i18n("<p>Turn this option on to store the default " + "credit and copyright identity in the IPTC tags. " + "You can set this value in the Identity setup page.")); + + // -------------------------------------------------------- + + TQGroupBox *commonGroup = new TQGroupBox(1, TQt::Horizontal, i18n("Common Metadata Actions"), parent); + + d->saveCommentsBox = new TQCheckBox(commonGroup); + d->saveCommentsBox->setText(i18n("&Save image captions as embedded text")); + TQWhatsThis::add( d->saveCommentsBox, i18n("<p>Turn this option on to store image captions " + "in the JFIF section, EXIF tag, and IPTC tag.")); + + d->saveDateTimeBox = new TQCheckBox(commonGroup); + d->saveDateTimeBox->setText(i18n("&Save image timestamps as tags")); + TQWhatsThis::add( d->saveDateTimeBox, i18n("<p>Turn this option on to store the image date and time " + "in the EXIF and IPTC tags.")); + + d->saveRatingBox = new TQCheckBox(commonGroup); + d->saveRatingBox->setText(i18n("&Save image rating as tags")); + TQWhatsThis::add( d->saveRatingBox, i18n("<p>Turn this option on to store the image rating " + "in the EXIF tag and IPTC <i>Urgency</i> tag.")); + + // -------------------------------------------------------- + + TQHBox *hbox = new TQHBox(parent); + + KURLLabel *exiv2LogoLabel = new KURLLabel(hbox); + exiv2LogoLabel->setText(TQString()); + exiv2LogoLabel->setURL("http://www.exiv2.org"); + TDEGlobal::dirs()->addResourceType("logo-exiv2", TDEGlobal::dirs()->kde_default("data") + "digikam/data"); + TQString directory = TDEGlobal::dirs()->findResourceDir("logo-exiv2", "logo-exiv2.png"); + exiv2LogoLabel->setPixmap( TQPixmap( directory + "logo-exiv2.png" ) ); + TQToolTip::add(exiv2LogoLabel, i18n("Visit Exiv2 project website")); + + KActiveLabel* explanation = new KActiveLabel(hbox); + explanation->setText(i18n("<p><b><a href='http://en.wikipedia.org/wiki/Exif'>EXIF</a></b> is " + "a standard used by most digital cameras today to store technical " + "informations about photograph.</p>" + "<p><b><a href='http://en.wikipedia.org/wiki/IPTC'>IPTC</a></b> is " + "an standard used in digital photography to store " + "photographer informations in pictures.</p>")); + + mainLayout->addWidget(ExifGroup); + mainLayout->addWidget(IptcGroup); + mainLayout->addWidget(commonGroup); + mainLayout->addSpacing(KDialog::spacingHint()); + mainLayout->addWidget(hbox); + mainLayout->addStretch(); + + readSettings(); + + // -------------------------------------------------------- + + connect(exiv2LogoLabel, TQ_SIGNAL(leftClickedURL(const TQString&)), + this, TQ_SLOT(processExiv2URL(const TQString&))); + + connect(d->ExifRotateBox, TQ_SIGNAL(toggled(bool)), + this, TQ_SLOT(slotExifAutoRotateToggled(bool))); +} + +SetupMetadata::~SetupMetadata() +{ + delete d; +} + +void SetupMetadata::processExiv2URL(const TQString& url) +{ + TDEApplication::kApplication()->invokeBrowser(url); +} + +void SetupMetadata::applySettings() +{ + AlbumSettings* settings = AlbumSettings::instance(); + if (!settings) return; + + settings->setExifRotate(d->ExifRotateBox->isChecked()); + settings->setExifSetOrientation(d->ExifSetOrientationBox->isChecked()); + settings->setSaveComments(d->saveCommentsBox->isChecked()); + settings->setSaveDateTime(d->saveDateTimeBox->isChecked()); + settings->setSaveRating(d->saveRatingBox->isChecked()); + settings->setSaveIptcTags(d->saveTagsIptcBox->isChecked()); + settings->setSaveIptcPhotographerId(d->savePhotographerIdIptcBox->isChecked()); + settings->setSaveIptcCredits(d->saveCreditsIptcBox->isChecked()); + + settings->saveSettings(); +} + +void SetupMetadata::readSettings() +{ + AlbumSettings* settings = AlbumSettings::instance(); + if (!settings) return; + + d->ExifAutoRotateOrg = settings->getExifRotate(); + d->ExifRotateBox->setChecked(d->ExifAutoRotateOrg); + d->ExifSetOrientationBox->setChecked(settings->getExifSetOrientation()); + d->saveCommentsBox->setChecked(settings->getSaveComments()); + d->saveDateTimeBox->setChecked(settings->getSaveDateTime()); + d->saveRatingBox->setChecked(settings->getSaveRating()); + d->saveTagsIptcBox->setChecked(settings->getSaveIptcTags()); + d->savePhotographerIdIptcBox->setChecked(settings->getSaveIptcPhotographerId()); + d->saveCreditsIptcBox->setChecked(settings->getSaveIptcCredits()); +} + +bool SetupMetadata::exifAutoRotateAsChanged() +{ + return d->ExifAutoRotateAsChanged; +} + +void SetupMetadata::slotExifAutoRotateToggled(bool b) +{ + if ( b != d->ExifAutoRotateOrg) + d->ExifAutoRotateAsChanged = true; + else + d->ExifAutoRotateAsChanged = false; +} + +} // namespace Digikam diff --git a/src/utilities/setup/setupmetadata.h b/src/utilities/setup/setupmetadata.h new file mode 100644 index 00000000..45511065 --- /dev/null +++ b/src/utilities/setup/setupmetadata.h @@ -0,0 +1,67 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2003-08-03 + * Description : setup Metadata tab. + * + * Copyright (C) 2003-2004 by Ralf Holzer <ralf at well.com> + * Copyright (C) 2003-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 SETUPMETADATA_H +#define SETUPMETADATA_H + +// TQt includes. + +#include <tqwidget.h> + +namespace Digikam +{ + +class SetupMetadataPriv; + +class SetupMetadata : public TQWidget +{ + TQ_OBJECT + + +public: + + SetupMetadata(TQWidget* parent = 0); + ~SetupMetadata(); + + void applySettings(); + + bool exifAutoRotateAsChanged(); + +private: + + void readSettings(); + +private slots: + + void processExiv2URL(const TQString&); + void slotExifAutoRotateToggled(bool); + +private: + + SetupMetadataPriv* d; +}; + +} // namespace Digikam + +#endif // SETUPMETADATA_H diff --git a/src/utilities/setup/setupmime.cpp b/src/utilities/setup/setupmime.cpp new file mode 100644 index 00000000..6ac069e3 --- /dev/null +++ b/src/utilities/setup/setupmime.cpp @@ -0,0 +1,280 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2003-05-03 + * Description : mime types setup tab + * + * Copyright (C) 2004-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 <tqhbox.h> +#include <tqhgroupbox.h> +#include <tqgroupbox.h> +#include <tqlabel.h> +#include <tqlineedit.h> +#include <tqwhatsthis.h> +#include <tqtoolbutton.h> +#include <tqtooltip.h> + +// KDE includes. + +#include <tdelocale.h> +#include <kdialog.h> +#include <klineeditdlg.h> +#include <kiconloader.h> + +// Local includes. + +#include "albumsettings.h" +#include "setupmime.h" +#include "setupmime.moc" + +namespace Digikam +{ + +class SetupMimePriv +{ +public: + + SetupMimePriv() + { + imageFileFilterEdit = 0; + movieFileFilterEdit = 0; + audioFileFilterEdit = 0; + rawFileFilterEdit = 0; + revertImageFileFilterBtn = 0; + revertMovieFileFilterBtn = 0; + revertAudioFileFilterBtn = 0; + revertRawFileFilterBtn = 0; + } + + TQToolButton *revertImageFileFilterBtn; + TQToolButton *revertMovieFileFilterBtn; + TQToolButton *revertAudioFileFilterBtn; + TQToolButton *revertRawFileFilterBtn; + + TQLineEdit *imageFileFilterEdit; + TQLineEdit *movieFileFilterEdit; + TQLineEdit *audioFileFilterEdit; + TQLineEdit *rawFileFilterEdit; +}; + +SetupMime::SetupMime(TQWidget* parent ) + : TQWidget(parent) +{ + d = new SetupMimePriv; + TQVBoxLayout *layout = new TQVBoxLayout(parent, 0, KDialog::spacingHint()); + + // -------------------------------------------------------- + + TQGroupBox *imageFileFilterBox = new TQGroupBox(0, TQt::Horizontal, i18n("Image Files"), parent); + TQGridLayout* grid1 = new TQGridLayout(imageFileFilterBox->layout(), 1, 1, KDialog::spacingHint()); + + TQLabel *logoLabel1 = new TQLabel(imageFileFilterBox); + logoLabel1->setPixmap(DesktopIcon("image-x-generic")); + + TQLabel *imageFileFilterLabel = new TQLabel(imageFileFilterBox); + imageFileFilterLabel->setText(i18n("Show only &image files with extensions:")); + + TQHBox *hbox1 = new TQHBox(imageFileFilterBox); + d->imageFileFilterEdit = new TQLineEdit(hbox1); + TQWhatsThis::add( d->imageFileFilterEdit, i18n("<p>Here you can set the extensions of image files " + "to be displayed in Albums (such as JPEG or TIFF); " + "clicking on these files will " + "open them in the digiKam Image Editor.")); + imageFileFilterLabel->setBuddy(d->imageFileFilterEdit); + hbox1->setStretchFactor(d->imageFileFilterEdit, 10); + + d->revertImageFileFilterBtn = new TQToolButton(hbox1); + d->revertImageFileFilterBtn->setIconSet(SmallIcon("reload_page")); + TQToolTip::add(d->revertImageFileFilterBtn, i18n("Revert to default settings")); + + grid1->addMultiCellWidget(logoLabel1, 0, 1, 0, 0); + grid1->addMultiCellWidget(imageFileFilterLabel, 0, 0, 1, 1); + grid1->addMultiCellWidget(hbox1, 1, 1, 1, 1); + grid1->setColStretch(1, 10); + + layout->addWidget(imageFileFilterBox); + + // -------------------------------------------------------- + + TQGroupBox *movieFileFilterBox = new TQGroupBox(0, TQt::Horizontal, i18n("Movie Files"), parent); + TQGridLayout* grid2 = new TQGridLayout(movieFileFilterBox->layout(), 1, 1, KDialog::spacingHint()); + + TQLabel *logoLabel2 = new TQLabel(movieFileFilterBox); + logoLabel2->setPixmap(DesktopIcon("video-x-generic")); + + TQLabel *movieFileFilterLabel = new TQLabel(movieFileFilterBox); + movieFileFilterLabel->setText(i18n("Show only &movie files with extensions:")); + + TQHBox *hbox2 = new TQHBox(movieFileFilterBox); + d->movieFileFilterEdit = new TQLineEdit(hbox2); + TQWhatsThis::add( d->movieFileFilterEdit, i18n("<p>Here you can set the extensions of movie files " + "to be displayed in Albums (such as MPEG or AVI); " + "clicking on these files will " + "open them with the default TDE movie player.")); + movieFileFilterLabel->setBuddy(d->movieFileFilterEdit); + hbox2->setStretchFactor(d->movieFileFilterEdit, 10); + + d->revertMovieFileFilterBtn = new TQToolButton(hbox2); + d->revertMovieFileFilterBtn->setIconSet(SmallIcon("reload_page")); + TQToolTip::add(d->revertMovieFileFilterBtn, i18n("Revert to default settings")); + + grid2->addMultiCellWidget(logoLabel2, 0, 1, 0, 0); + grid2->addMultiCellWidget(movieFileFilterLabel, 0, 0, 1, 1); + grid2->addMultiCellWidget(hbox2, 1, 1, 1, 1); + grid2->setColStretch(1, 10); + + layout->addWidget(movieFileFilterBox); + + // -------------------------------------------------------- + + TQGroupBox *audioFileFilterBox = new TQGroupBox(0, TQt::Horizontal, i18n("Audio Files"), parent); + TQGridLayout* grid3 = new TQGridLayout(audioFileFilterBox->layout(), 1, 1, KDialog::spacingHint()); + + TQLabel *logoLabel3 = new TQLabel(audioFileFilterBox); + logoLabel3->setPixmap(DesktopIcon("audio-x-generic")); + + TQLabel *audioFileFilterLabel = new TQLabel(audioFileFilterBox); + audioFileFilterLabel->setText(i18n("Show only &audio files with extensions:")); + + TQHBox *hbox3 = new TQHBox(audioFileFilterBox); + d->audioFileFilterEdit = new TQLineEdit(hbox3); + TQWhatsThis::add( d->audioFileFilterEdit, i18n("<p>Here you can set the extensions of audio files " + "to be displayed in Albums (such as MP3 or OGG); " + "clicking on these files will " + "open them with the default TDE audio player.")); + audioFileFilterLabel->setBuddy(d->audioFileFilterEdit); + hbox3->setStretchFactor(d->audioFileFilterEdit, 10); + + d->revertAudioFileFilterBtn = new TQToolButton(hbox3); + d->revertAudioFileFilterBtn->setIconSet(SmallIcon("reload_page")); + TQToolTip::add(d->revertAudioFileFilterBtn, i18n("Revert to default settings")); + + grid3->addMultiCellWidget(logoLabel3, 0, 1, 0, 0); + grid3->addMultiCellWidget(audioFileFilterLabel, 0, 0, 1, 1); + grid3->addMultiCellWidget(hbox3, 1, 1, 1, 1); + grid3->setColStretch(1, 10); + + layout->addWidget(audioFileFilterBox); + + // -------------------------------------------------------- + + TQGroupBox *rawFileFilterBox = new TQGroupBox(0, TQt::Horizontal, i18n("RAW Files"), parent); + TQGridLayout* grid4 = new TQGridLayout(rawFileFilterBox->layout(), 1, 1, KDialog::spacingHint()); + + TQLabel *logoLabel4 = new TQLabel(rawFileFilterBox); + logoLabel4->setPixmap(DesktopIcon("kdcraw")); + + TQLabel *rawFileFilterLabel = new TQLabel(rawFileFilterBox); + rawFileFilterLabel->setText(i18n("Show only &RAW files with extensions:")); + + TQHBox *hbox4 = new TQHBox(rawFileFilterBox); + d->rawFileFilterEdit = new TQLineEdit(hbox4); + TQWhatsThis::add( d->rawFileFilterEdit, i18n("<p>Here you can set the extensions of RAW image files " + "to be displayed in Albums (such as CRW, for Canon cameras, " + "or NEF, for Nikon cameras).")); + rawFileFilterLabel->setBuddy(d->rawFileFilterEdit); + hbox4->setStretchFactor(d->rawFileFilterEdit, 10); + + d->revertRawFileFilterBtn = new TQToolButton(hbox4); + d->revertRawFileFilterBtn->setIconSet(SmallIcon("reload_page")); + TQToolTip::add(d->revertRawFileFilterBtn, i18n("Revert to default settings")); + + grid4->addMultiCellWidget(logoLabel4, 0, 1, 0, 0); + grid4->addMultiCellWidget(rawFileFilterLabel, 0, 0, 1, 1); + grid4->addMultiCellWidget(hbox4, 1, 1, 1, 1); + grid4->setColStretch(1, 10); + + layout->addWidget(rawFileFilterBox); + layout->addStretch(); + + // -------------------------------------------------------- + + connect(d->revertImageFileFilterBtn, TQ_SIGNAL(clicked()), + this, TQ_SLOT(slotRevertImageFileFilter())); + + connect(d->revertMovieFileFilterBtn, TQ_SIGNAL(clicked()), + this, TQ_SLOT(slotRevertMovieFileFilter())); + + connect(d->revertAudioFileFilterBtn, TQ_SIGNAL(clicked()), + this, TQ_SLOT(slotRevertAudioFileFilter())); + + connect(d->revertRawFileFilterBtn, TQ_SIGNAL(clicked()), + this, TQ_SLOT(slotRevertRawFileFilter())); + + // -------------------------------------------------------- + + readSettings(); +} + +SetupMime::~SetupMime() +{ + delete d; +} + +void SetupMime::applySettings() +{ + AlbumSettings* settings = AlbumSettings::instance(); + + if (!settings) return; + + settings->setImageFileFilter(d->imageFileFilterEdit->text()); + settings->setMovieFileFilter(d->movieFileFilterEdit->text()); + settings->setAudioFileFilter(d->audioFileFilterEdit->text()); + settings->setRawFileFilter(d->rawFileFilterEdit->text()); + + settings->saveSettings(); +} + +void SetupMime::readSettings() +{ + AlbumSettings* settings = AlbumSettings::instance(); + + if (!settings) return; + + d->imageFileFilterEdit->setText(settings->getImageFileFilter()); + d->movieFileFilterEdit->setText(settings->getMovieFileFilter()); + d->audioFileFilterEdit->setText(settings->getAudioFileFilter()); + d->rawFileFilterEdit->setText(settings->getRawFileFilter()); +} + +void SetupMime::slotRevertImageFileFilter() +{ + d->imageFileFilterEdit->setText(AlbumSettings::instance()->getDefaultImageFileFilter()); +} + +void SetupMime::slotRevertMovieFileFilter() +{ + d->movieFileFilterEdit->setText(AlbumSettings::instance()->getDefaultMovieFileFilter()); +} + +void SetupMime::slotRevertAudioFileFilter() +{ + d->audioFileFilterEdit->setText(AlbumSettings::instance()->getDefaultAudioFileFilter()); +} + +void SetupMime::slotRevertRawFileFilter() +{ + d->rawFileFilterEdit->setText(AlbumSettings::instance()->getDefaultRawFileFilter()); +} + +} // namespace Digikam + diff --git a/src/utilities/setup/setupmime.h b/src/utilities/setup/setupmime.h new file mode 100644 index 00000000..3bff1525 --- /dev/null +++ b/src/utilities/setup/setupmime.h @@ -0,0 +1,66 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2003-05-03 + * Description : mime types setup tab. + * + * Copyright (C) 2004-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 SETUPMIME_H +#define SETUPMIME_H + +// TQt includes. + +#include <tqwidget.h> + +namespace Digikam +{ + +class SetupMimePriv; + +class SetupMime : public TQWidget +{ + TQ_OBJECT + + +public: + + SetupMime(TQWidget* parent = 0); + ~SetupMime(); + + void applySettings(); + +private: + + void readSettings(); + +private slots: + + void slotRevertImageFileFilter(); + void slotRevertMovieFileFilter(); + void slotRevertAudioFileFilter(); + void slotRevertRawFileFilter(); + +private: + + SetupMimePriv* d; +}; + +} // namespace Digikam + +#endif // SETUPMIME_H diff --git a/src/utilities/setup/setupmisc.cpp b/src/utilities/setup/setupmisc.cpp new file mode 100644 index 00000000..8dc16e96 --- /dev/null +++ b/src/utilities/setup/setupmisc.cpp @@ -0,0 +1,124 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2004-08-23 + * Description : mics configuration setup tab + * + * Copyright (C) 2004 by Renchi Raju <renchi@pooh.tam.uiuc.edu> + * 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 <tqlayout.h> +#include <tqvgroupbox.h> +#include <tqcheckbox.h> + +// KDE includes. + +#include <tdelocale.h> +#include <kdialog.h> + +// Local includes. + +#include "albumsettings.h" +#include "setupmisc.h" + +namespace Digikam +{ + +class SetupMiscPriv +{ +public: + + SetupMiscPriv() + { + showSplashCheck = 0; + showTrashDeleteDialogCheck = 0; + sidebarApplyDirectlyCheck = 0; + scanAtStart = 0; + } + + TQCheckBox* showSplashCheck; + TQCheckBox* showTrashDeleteDialogCheck; + TQCheckBox* sidebarApplyDirectlyCheck; + TQCheckBox* scanAtStart; +}; + +SetupMisc::SetupMisc(TQWidget* parent) + : TQWidget( parent ) +{ + d = new SetupMiscPriv; + + TQVBoxLayout *mainLayout = new TQVBoxLayout(parent); + TQVBoxLayout *layout = new TQVBoxLayout( this, 0, KDialog::spacingHint() ); + + // -------------------------------------------------------- + + d->showTrashDeleteDialogCheck = new TQCheckBox(i18n("Show confirmation dialog when moving items to the &trash"), this); + layout->addWidget(d->showTrashDeleteDialogCheck); + + // -------------------------------------------------------- + + d->sidebarApplyDirectlyCheck = new TQCheckBox(i18n("Apply changes in the &right sidebar without confirmation"), this); + layout->addWidget(d->sidebarApplyDirectlyCheck); + + // -------------------------------------------------------- + + d->showSplashCheck = new TQCheckBox(i18n("&Show splash screen at startup"), this); + layout->addWidget(d->showSplashCheck); + + // -------------------------------------------------------- + + d->scanAtStart = new TQCheckBox(i18n("&Scan for new items on startup (slows down startup)"), this); + layout->addWidget(d->scanAtStart); + + // -------------------------------------------------------- + + layout->addStretch(); + readSettings(); + adjustSize(); + mainLayout->addWidget(this); +} + +SetupMisc::~SetupMisc() +{ + delete d; +} + +void SetupMisc::applySettings() +{ + AlbumSettings* settings = AlbumSettings::instance(); + + settings->setShowSplashScreen(d->showSplashCheck->isChecked()); + settings->setShowTrashDeleteDialog(d->showTrashDeleteDialogCheck->isChecked()); + settings->setApplySidebarChangesDirectly(d->sidebarApplyDirectlyCheck->isChecked()); + settings->setScanAtStart(d->scanAtStart->isChecked()); + settings->saveSettings(); +} + +void SetupMisc::readSettings() +{ + AlbumSettings* settings = AlbumSettings::instance(); + + d->showSplashCheck->setChecked(settings->getShowSplashScreen()); + d->showTrashDeleteDialogCheck->setChecked(settings->getShowTrashDeleteDialog()); + d->sidebarApplyDirectlyCheck->setChecked(settings->getApplySidebarChangesDirectly()); + d->scanAtStart->setChecked(settings->getScanAtStart()); +} + +} // namespace Digikam diff --git a/src/utilities/setup/setupmisc.h b/src/utilities/setup/setupmisc.h new file mode 100644 index 00000000..92918ba4 --- /dev/null +++ b/src/utilities/setup/setupmisc.h @@ -0,0 +1,58 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2004-08-23 + * Description : mics configuration setup tab + * + * Copyright (C) 2004 by Renchi Raju <renchi@pooh.tam.uiuc.edu> + * 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 SETUPMISC_H +#define SETUPMISC_H + +// TQt includes. + +#include <tqwidget.h> + +namespace Digikam +{ + +class SetupMiscPriv; + +class SetupMisc : public TQWidget +{ +public: + + SetupMisc(TQWidget* parent); + ~SetupMisc(); + + void applySettings(); + +private: + + void readSettings(); + +private: + + SetupMiscPriv* d; + +}; + +} // namespace Digikam + +#endif /* SETUPMISC_H */ diff --git a/src/utilities/setup/setupplugins.cpp b/src/utilities/setup/setupplugins.cpp new file mode 100644 index 00000000..e0d9c494 --- /dev/null +++ b/src/utilities/setup/setupplugins.cpp @@ -0,0 +1,104 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2004-01-02 + * Description : setup Kipi plugins tab. + * + * 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 + +// TQt includes. + +#include <tqlayout.h> +#include <tqstring.h> +#include <tqgroupbox.h> +#include <tqlabel.h> +#include <tqwhatsthis.h> + +// KDE includes. + +#include <tdelocale.h> +#include <kdialog.h> + +// libkipi includes. + +#include <libkipi/pluginloader.h> +#include <libkipi/version.h> + +// Local includes. + +#include "setupplugins.h" +#include "setupplugins.moc" + +namespace Digikam +{ + +class SetupPluginsPriv +{ +public: + + SetupPluginsPriv() + { + pluginsNumber = 0; + kipiConfig = 0; + } + + TQLabel* pluginsNumber; + + KIPI::ConfigWidget* kipiConfig; +}; + +SetupPlugins::SetupPlugins(TQWidget* parent ) + : TQWidget(parent) +{ + d = new SetupPluginsPriv; + TQVBoxLayout *layout = new TQVBoxLayout(parent); + d->pluginsNumber = new TQLabel(parent); + d->pluginsNumber->setAlignment(TQt::AlignLeft | TQt::AlignVCenter); + + d->kipiConfig = KIPI::PluginLoader::instance()->configWidget( parent ); + TQString pluginsListHelp = i18n("<p>A list of available Kipi plugins appears below."); + TQWhatsThis::add(d->kipiConfig, pluginsListHelp); + + layout->addWidget(d->pluginsNumber); + layout->addWidget(d->kipiConfig); + layout->setMargin(0); + layout->setSpacing(KDialog::spacingHint()); +} + +SetupPlugins::~SetupPlugins() +{ + delete d; +} + +void SetupPlugins::initPlugins(int kipiPluginsNumber) +{ + d->pluginsNumber->setText(i18n("1 Kipi plugin found", + "%n Kipi plugins found", + kipiPluginsNumber)); +} + +void SetupPlugins::applyPlugins() +{ + d->kipiConfig->apply(); +} + +} // namespace Digikam diff --git a/src/utilities/setup/setupplugins.h b/src/utilities/setup/setupplugins.h new file mode 100644 index 00000000..31b71121 --- /dev/null +++ b/src/utilities/setup/setupplugins.h @@ -0,0 +1,56 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2004-01-02 + * Description : setup Kipi plugins tab. + * + * 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. + * + * ============================================================ */ + +#ifndef SETUPPLUGINS_H +#define SETUPPLUGINS_H + +// TQt includes. + +#include <tqwidget.h> + +namespace Digikam +{ + +class SetupPluginsPriv; + +class SetupPlugins : public TQWidget +{ + TQ_OBJECT + + +public: + + SetupPlugins(TQWidget* parent = 0); + ~SetupPlugins(); + + void initPlugins(int kipiPluginsNumber); + void applyPlugins(); + +private: + + SetupPluginsPriv* d; +}; + +} // namespace Digikam + +#endif // SETUPPLUGINS_H diff --git a/src/utilities/setup/setupslideshow.cpp b/src/utilities/setup/setupslideshow.cpp new file mode 100644 index 00000000..970d9c67 --- /dev/null +++ b/src/utilities/setup/setupslideshow.cpp @@ -0,0 +1,165 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2005-05-21 + * Description : setup tab for slideshow options. + * + * 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 <tqlayout.h> +#include <tqlabel.h> +#include <tqwhatsthis.h> +#include <tqcheckbox.h> + +// KDE includes. + +#include <tdelocale.h> +#include <kdialog.h> +#include <knuminput.h> +#include <tdeconfig.h> +#include <tdeapplication.h> + +// Local includes. + +#include "setupslideshow.h" +#include "setupslideshow.moc" + +namespace Digikam +{ + +class SetupSlideShowPriv +{ +public: + + SetupSlideShowPriv() + { + delayInput = 0; + startWithCurrent = 0; + loopMode = 0; + printName = 0; + printDate = 0; + printApertureFocal = 0; + printExpoSensitivity = 0; + printMakeModel = 0; + printComment = 0; + } + + TQCheckBox *startWithCurrent; + TQCheckBox *loopMode; + TQCheckBox *printName; + TQCheckBox *printDate; + TQCheckBox *printApertureFocal; + TQCheckBox *printExpoSensitivity; + TQCheckBox *printMakeModel; + TQCheckBox *printComment; + + KIntNumInput *delayInput; +}; + +SetupSlideShow::SetupSlideShow(TQWidget* parent ) + : TQWidget(parent) +{ + d = new SetupSlideShowPriv; + TQVBoxLayout *layout = new TQVBoxLayout( parent ); + + d->delayInput = new KIntNumInput(5, parent); + d->delayInput->setRange(1, 3600, 1, true ); + d->delayInput->setLabel( i18n("&Delay between images:"), AlignLeft|AlignTop ); + TQWhatsThis::add( d->delayInput, i18n("<p>The delay, in seconds, between images.")); + + d->startWithCurrent = new TQCheckBox(i18n("Start with current image"), parent); + TQWhatsThis::add( d->startWithCurrent, i18n("<p>If this option is enabled, slideshow will be started " + "with currently selected image.")); + + d->loopMode = new TQCheckBox(i18n("Display in a loop"), parent); + TQWhatsThis::add( d->loopMode, i18n("<p>Run the slideshow in endless repetition.")); + + d->printName = new TQCheckBox(i18n("Print image file name"), parent); + TQWhatsThis::add( d->printName, i18n("<p>Print the image file name at the bottom of the screen.")); + + d->printDate = new TQCheckBox(i18n("Print image creation date"), parent); + TQWhatsThis::add( d->printDate, i18n("<p>Print the image creation time/date at the bottom of the screen.")); + + d->printApertureFocal = new TQCheckBox(i18n("Print camera aperture and focal length"), parent); + TQWhatsThis::add( d->printApertureFocal, i18n("<p>Print the camera aperture and focal length at the bottom of the screen.")); + + d->printExpoSensitivity = new TQCheckBox(i18n("Print camera exposure and sensitivity"), parent); + TQWhatsThis::add( d->printExpoSensitivity, i18n("<p>Print the camera exposure and sensitivity at the bottom of the screen.")); + + d->printMakeModel = new TQCheckBox(i18n("Print camera make and model"), parent); + TQWhatsThis::add( d->printMakeModel, i18n("<p>Print the camera make and model at the bottom of the screen.")); + + d->printComment = new TQCheckBox(i18n("Print image caption"), parent); + TQWhatsThis::add( d->printComment, i18n("<p>Print the image caption at the bottom of the screen.")); + + layout->addWidget(d->delayInput); + layout->addWidget(d->startWithCurrent); + layout->addWidget(d->loopMode); + layout->addWidget(d->printName); + layout->addWidget(d->printDate); + layout->addWidget(d->printApertureFocal); + layout->addWidget(d->printExpoSensitivity); + layout->addWidget(d->printMakeModel); + layout->addWidget(d->printComment); + layout->addStretch(); + + readSettings(); +} + +SetupSlideShow::~SetupSlideShow() +{ + delete d; +} + +void SetupSlideShow::applySettings() +{ + TDEConfig* config = kapp->config(); + + config->setGroup("ImageViewer Settings"); + config->writeEntry("SlideShowDelay", d->delayInput->value()); + config->writeEntry("SlideShowStartCurrent", d->startWithCurrent->isChecked()); + config->writeEntry("SlideShowLoop", d->loopMode->isChecked()); + config->writeEntry("SlideShowPrintName", d->printName->isChecked()); + config->writeEntry("SlideShowPrintDate", d->printDate->isChecked()); + config->writeEntry("SlideShowPrintApertureFocal", d->printApertureFocal->isChecked()); + config->writeEntry("SlideShowPrintExpoSensitivity", d->printExpoSensitivity->isChecked()); + config->writeEntry("SlideShowPrintMakeModel", d->printMakeModel->isChecked()); + config->writeEntry("SlideShowPrintComment", d->printComment->isChecked()); + config->sync(); +} + +void SetupSlideShow::readSettings() +{ + TDEConfig* config = kapp->config(); + + config->setGroup("ImageViewer Settings"); + d->delayInput->setValue(config->readNumEntry("SlideShowDelay", 5)); + d->startWithCurrent->setChecked(config->readBoolEntry("SlideShowStartCurrent", false)); + d->loopMode->setChecked(config->readBoolEntry("SlideShowLoop", false)); + d->printName->setChecked(config->readBoolEntry("SlideShowPrintName", true)); + d->printDate->setChecked(config->readBoolEntry("SlideShowPrintDate", false)); + d->printApertureFocal->setChecked(config->readBoolEntry("SlideShowPrintApertureFocal", false)); + d->printExpoSensitivity->setChecked(config->readBoolEntry("SlideShowPrintExpoSensitivity", false)); + d->printMakeModel->setChecked(config->readBoolEntry("SlideShowPrintMakeModel", false)); + d->printComment->setChecked(config->readBoolEntry("SlideShowPrintComment", false)); +} + +} // namespace Digikam + diff --git a/src/utilities/setup/setupslideshow.h b/src/utilities/setup/setupslideshow.h new file mode 100644 index 00000000..9ba68035 --- /dev/null +++ b/src/utilities/setup/setupslideshow.h @@ -0,0 +1,64 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2005-05-21 + * Description : setup tab for slideshow options. + * + * 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 SETUPSLIDESHOW_H +#define SETUPSLIDESHOW_H + +// TQt includes. + +#include <tqwidget.h> + +// Local includes. + +#include "digikam_export.h" + +namespace Digikam +{ + +class SetupSlideShowPriv; + +class DIGIKAM_EXPORT SetupSlideShow : public TQWidget +{ + TQ_OBJECT + + +public: + + SetupSlideShow(TQWidget* parent = 0); + ~SetupSlideShow(); + + void applySettings(); + +private: + + void readSettings(); + +private: + + SetupSlideShowPriv* d; + +}; + +} // namespace Digikam + +#endif /* SETUPSLIDESHOW_H */ diff --git a/src/utilities/setup/setuptooltip.cpp b/src/utilities/setup/setuptooltip.cpp new file mode 100644 index 00000000..2a5c62c8 --- /dev/null +++ b/src/utilities/setup/setuptooltip.cpp @@ -0,0 +1,272 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2006-07-09 + * Description : album item tool tip 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> + +// Local includes. + +#include "albumsettings.h" +#include "setuptooltip.h" +#include "setuptooltip.moc" + +namespace Digikam +{ + +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; + + showAlbumNameBox = 0; + showCommentsBox = 0; + showTagsBox = 0; + showRatingBox = 0; + + fileSettingBox = 0; + photoSettingBox = 0; + digikamSettingBox = 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; + + TQCheckBox *showAlbumNameBox; + TQCheckBox *showCommentsBox; + TQCheckBox *showTagsBox; + TQCheckBox *showRatingBox; + + TQVGroupBox *fileSettingBox; + TQVGroupBox *photoSettingBox; + TQVGroupBox *digikamSettingBox; +}; + +SetupToolTip::SetupToolTip(TQWidget* parent) + : TQWidget(parent) +{ + d = new SetupToolTipPriv; + TQVBoxLayout *layout = new TQVBoxLayout( parent, 0, KDialog::spacingHint() ); + + d->showToolTipsBox = new TQCheckBox(i18n("Show album items toolti&ps"), parent); + TQWhatsThis::add( d->showToolTipsBox, i18n("<p>Set this option to display image information when " + "the mouse hovers over an album 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"), 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); + + // -------------------------------------------------------- + + d->digikamSettingBox = new TQVGroupBox(i18n("digiKam Information"), parent); + + d->showAlbumNameBox = new TQCheckBox(i18n("Show album name"), d->digikamSettingBox); + TQWhatsThis::add( d->showAlbumNameBox, i18n("<p>Set this option to display the album name.")); + + d->showCommentsBox = new TQCheckBox(i18n("Show image caption"), d->digikamSettingBox); + TQWhatsThis::add( d->showCommentsBox, i18n("<p>Set this option to display the image captions.")); + + d->showTagsBox = new TQCheckBox(i18n("Show image tags"), d->digikamSettingBox); + TQWhatsThis::add( d->showTagsBox, i18n("<p>Set this option to display the image tags.")); + + d->showRatingBox = new TQCheckBox(i18n("Show image rating"), d->digikamSettingBox); + TQWhatsThis::add( d->showRatingBox, i18n("<p>Set this option to display the image rating.")); + + layout->addWidget(d->digikamSettingBox); + 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))); + + connect(d->showToolTipsBox, TQ_SIGNAL(toggled(bool)), + d->digikamSettingBox, TQ_SLOT(setEnabled(bool))); + + // -------------------------------------------------------- + + readSettings(); + adjustSize(); +} + +SetupToolTip::~SetupToolTip() +{ + delete d; +} + +void SetupToolTip::applySettings() +{ + AlbumSettings* settings = AlbumSettings::instance(); + if (!settings) return; + + settings->setShowToolTips(d->showToolTipsBox->isChecked()); + + settings->setToolTipsShowFileName(d->showFileNameBox->isChecked()); + settings->setToolTipsShowFileDate(d->showFileDateBox->isChecked()); + settings->setToolTipsShowFileSize(d->showFileSizeBox->isChecked()); + settings->setToolTipsShowImageType(d->showImageTypeBox->isChecked()); + settings->setToolTipsShowImageDim(d->showImageDimBox->isChecked()); + + settings->setToolTipsShowPhotoMake(d->showPhotoMakeBox->isChecked()); + settings->setToolTipsShowPhotoDate(d->showPhotoDateBox->isChecked()); + settings->setToolTipsShowPhotoFocal(d->showPhotoFocalBox->isChecked()); + settings->setToolTipsShowPhotoExpo(d->showPhotoExpoBox->isChecked()); + settings->setToolTipsShowPhotoMode(d->showPhotoModeBox->isChecked()); + settings->setToolTipsShowPhotoFlash(d->showPhotoFlashBox->isChecked()); + settings->setToolTipsShowPhotoWB(d->showPhotoWbBox->isChecked()); + + settings->setToolTipsShowAlbumName(d->showAlbumNameBox->isChecked()); + settings->setToolTipsShowComments(d->showCommentsBox->isChecked()); + settings->setToolTipsShowTags(d->showTagsBox->isChecked()); + settings->setToolTipsShowRating(d->showRatingBox->isChecked()); + + settings->saveSettings(); +} + +void SetupToolTip::readSettings() +{ + AlbumSettings* settings = AlbumSettings::instance(); + + if (!settings) return; + + d->showToolTipsBox->setChecked(settings->getShowToolTips()); + + d->showFileNameBox->setChecked(settings->getToolTipsShowFileName()); + d->showFileDateBox->setChecked(settings->getToolTipsShowFileDate()); + d->showFileSizeBox->setChecked(settings->getToolTipsShowFileSize()); + d->showImageTypeBox->setChecked(settings->getToolTipsShowImageType()); + d->showImageDimBox->setChecked(settings->getToolTipsShowImageDim()); + + d->showPhotoMakeBox->setChecked(settings->getToolTipsShowPhotoMake()); + d->showPhotoDateBox->setChecked(settings->getToolTipsShowPhotoDate()); + d->showPhotoFocalBox->setChecked(settings->getToolTipsShowPhotoFocal()); + d->showPhotoExpoBox->setChecked(settings->getToolTipsShowPhotoExpo()); + d->showPhotoModeBox->setChecked(settings->getToolTipsShowPhotoMode()); + d->showPhotoFlashBox->setChecked(settings->getToolTipsShowPhotoFlash()); + d->showPhotoWbBox->setChecked(settings->getToolTipsShowPhotoWB()); + + d->showAlbumNameBox->setChecked(settings->getToolTipsShowAlbumName()); + d->showCommentsBox->setChecked(settings->getToolTipsShowComments()); + d->showTagsBox->setChecked(settings->getToolTipsShowTags()); + d->showRatingBox->setChecked(settings->getToolTipsShowRating()); + + d->fileSettingBox->setEnabled(d->showToolTipsBox->isChecked()); + d->photoSettingBox->setEnabled(d->showToolTipsBox->isChecked()); + d->digikamSettingBox->setEnabled(d->showToolTipsBox->isChecked()); +} + +} // namespace Digikam + diff --git a/src/utilities/setup/setuptooltip.h b/src/utilities/setup/setuptooltip.h new file mode 100644 index 00000000..8474de78 --- /dev/null +++ b/src/utilities/setup/setuptooltip.h @@ -0,0 +1,59 @@ +/* ============================================================ + * + * This file is a part of digiKam project + * http://www.digikam.org + * + * Date : 2006-07-09 + * Description : album item tool tip 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 Digikam +{ + +class SetupToolTipPriv; + +class SetupToolTip : public TQWidget +{ + TQ_OBJECT + + +public: + + SetupToolTip(TQWidget* parent = 0); + ~SetupToolTip(); + + void applySettings(); + +private: + + void readSettings(); + +private: + + SetupToolTipPriv* d; +}; + +} // namespace Digikam + +#endif // SETUPTOOLTIP_H |