File indexing completed on 2025-01-19 03:55:43

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2006-09-13
0007  * Description : a widget to provide options to save image.
0008  *
0009  * SPDX-FileCopyrightText: 2006-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 #ifndef DIGIKAM_DSAVE_SETTINGS_WIDGET_H
0016 #define DIGIKAM_DSAVE_SETTINGS_WIDGET_H
0017 
0018 // Qt includes
0019 
0020 #include <QWidget>
0021 
0022 // Local includes
0023 
0024 #include "digikam_export.h"
0025 #include "filesaveconflictbox.h"
0026 
0027 class KConfigGroup;
0028 
0029 namespace Digikam
0030 {
0031 
0032 class DIGIKAM_EXPORT DSaveSettingsWidget : public QWidget
0033 {
0034     Q_OBJECT
0035 
0036 public:
0037 
0038     enum OutputFormat
0039     {
0040         OUTPUT_PNG = 0,
0041         OUTPUT_TIFF,
0042         OUTPUT_JPEG,
0043         OUTPUT_PPM
0044     };
0045 
0046 public:
0047 
0048     explicit DSaveSettingsWidget(QWidget* const parent);
0049     ~DSaveSettingsWidget() override;
0050 
0051 public:
0052 
0053     void setCustomSettingsWidget(QWidget* const custom);
0054 
0055     OutputFormat fileFormat()                           const;
0056     void setFileFormat(OutputFormat f);
0057 
0058     FileSaveConflictBox::ConflictRule conflictRule()    const;
0059     void setConflictRule(FileSaveConflictBox::ConflictRule r);
0060 
0061     QString extension()                                 const;
0062     QString typeMime()                                  const;
0063 
0064     void resetToDefault();
0065 
0066     void readSettings(KConfigGroup& group);
0067     void writeSettings(KConfigGroup& group);
0068 
0069     static QString extensionForFormat(OutputFormat format);
0070 
0071 public Q_SLOTS:
0072 
0073     void slotPopulateImageFormat(bool sixteenBits);
0074 
0075 Q_SIGNALS:
0076 
0077     void signalSaveFormatChanged();
0078     void signalConflictButtonChanged(int);
0079 
0080 private:
0081 
0082     class Private;
0083     Private* const d;
0084 };
0085 
0086 } // namespace Digikam
0087 
0088 #endif // DIGIKAM_DSAVE_SETTINGS_WIDGET_H