File indexing completed on 2025-01-19 03:51:03
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2007-08-02 0007 * Description : TIFF image export settings widget. 0008 * 0009 * SPDX-FileCopyrightText: 2007-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #include "dimgtiffexportsettings.h" 0016 0017 // Qt includes 0018 0019 #include <QString> 0020 #include <QLabel> 0021 #include <QCheckBox> 0022 #include <QLayout> 0023 #include <QGridLayout> 0024 #include <QApplication> 0025 #include <QStyle> 0026 0027 // KDE includes 0028 0029 #include <klocalizedstring.h> 0030 0031 namespace Digikam 0032 { 0033 0034 class Q_DECL_HIDDEN DImgTIFFExportSettings::Private 0035 { 0036 0037 public: 0038 0039 explicit Private() 0040 : TIFFGrid (nullptr), 0041 TIFFcompression(nullptr) 0042 { 0043 } 0044 0045 QGridLayout* TIFFGrid; 0046 0047 QCheckBox* TIFFcompression; 0048 }; 0049 0050 DImgTIFFExportSettings::DImgTIFFExportSettings(QWidget* const parent) 0051 : DImgLoaderSettings(parent), 0052 d (new Private) 0053 { 0054 const int spacing = qMin(QApplication::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing), 0055 QApplication::style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing)); 0056 0057 d->TIFFGrid = new QGridLayout(this); 0058 d->TIFFcompression = new QCheckBox(i18n("Compress TIFF files"), this); 0059 0060 d->TIFFcompression->setWhatsThis(i18n("<p>Toggle compression for TIFF images.</p>" 0061 "<p>If this option is enabled, the final size " 0062 "of the TIFF image is reduced.</p>" 0063 "<p>A lossless compression format (Deflate) " 0064 "is used to save the file.</p>")); 0065 0066 d->TIFFGrid->addWidget(d->TIFFcompression, 0, 0, 1, 2); 0067 d->TIFFGrid->setColumnStretch(1, 10); 0068 d->TIFFGrid->setRowStretch(1, 10); 0069 d->TIFFGrid->setContentsMargins(spacing, spacing, spacing, spacing); 0070 d->TIFFGrid->setSpacing(spacing); 0071 0072 connect(d->TIFFcompression, SIGNAL(toggled(bool)), 0073 this, SIGNAL(signalSettingsChanged())); 0074 } 0075 0076 DImgTIFFExportSettings::~DImgTIFFExportSettings() 0077 { 0078 delete d; 0079 } 0080 0081 void DImgTIFFExportSettings::setSettings(const DImgLoaderPrms& set) 0082 { 0083 for (DImgLoaderPrms::const_iterator it = set.constBegin() ; it != set.constEnd() ; ++it) 0084 { 0085 if (it.key() == QLatin1String("compress")) 0086 { 0087 d->TIFFcompression->setChecked(it.value().toBool()); 0088 } 0089 } 0090 } 0091 0092 DImgLoaderPrms DImgTIFFExportSettings::settings() const 0093 { 0094 DImgLoaderPrms set; 0095 set.insert(QLatin1String("compress"), d->TIFFcompression->isChecked()); 0096 0097 return set; 0098 } 0099 0100 } // namespace Digikam 0101 0102 #include "moc_dimgtiffexportsettings.cpp"