File indexing completed on 2025-01-19 03:59:42

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2003-02-10
0007  * Description : camera setup tab.
0008  *
0009  * SPDX-FileCopyrightText: 2003-2005 by Renchi Raju <renchi dot raju at gmail dot com>
0010  * SPDX-FileCopyrightText: 2003-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_SETUP_CAMERA_H
0017 #define DIGIKAM_SETUP_CAMERA_H
0018 
0019 // Qt includes
0020 
0021 #include <QScrollArea>
0022 #include <QString>
0023 
0024 // Local includes
0025 
0026 #include "dbusydlg.h"
0027 
0028 namespace Digikam
0029 {
0030 
0031 class SetupCamera : public QScrollArea
0032 {
0033     Q_OBJECT
0034 
0035 public:
0036 
0037     enum CameraTab
0038     {
0039         Devices = 0,
0040         Behavior,
0041         ImportFilters,
0042         ImportWindow
0043     };
0044 
0045     enum ConflictRule
0046     {
0047         OVERWRITE = 0,
0048         DIFFNAME,
0049         SKIPFILE
0050     };
0051 
0052 public:
0053 
0054     explicit SetupCamera(QWidget* const parent = nullptr);
0055     ~SetupCamera() override;
0056 
0057     void applySettings();
0058     bool checkSettings();
0059 
0060     bool useFileMetadata();
0061 
0062     void setActiveTab(CameraTab tab);
0063     CameraTab activeTab() const;
0064 
0065 Q_SIGNALS:
0066 
0067     void signalUseFileMetadataChanged(bool);
0068 
0069 private Q_SLOTS:
0070 
0071     void slotSelectionChanged();
0072 
0073     void slotAddCamera();
0074     void slotRemoveCamera();
0075     void slotEditCamera();
0076     void slotAutoDetectCamera();
0077 
0078     void slotAddedCamera(const QString& title, const QString& model,
0079                          const QString& port,  const QString& path);
0080     void slotEditedCamera(const QString& title, const QString& model,
0081                           const QString& port,  const QString& path);
0082 
0083     void slotImportSelectionChanged();
0084     void slotAddFilter();
0085     void slotRemoveFilter();
0086     void slotEditFilter();
0087     void slotPreviewItemsClicked();
0088     void slotPreviewFullImageSizeClicked();
0089 
0090 private:
0091 
0092     void readSettings();
0093 
0094 private:
0095 
0096     class Private;
0097     Private* const d;
0098 };
0099 
0100 // -------------------------------------------------------------------------
0101 
0102 class CameraAutoDetectThread : public DBusyThread
0103 {
0104     Q_OBJECT
0105 
0106 public:
0107 
0108     explicit CameraAutoDetectThread(QObject* const parent);
0109     ~CameraAutoDetectThread() override;
0110 
0111     int     result()    const;
0112     QString model()     const;
0113     QString port()      const;
0114 
0115 private:
0116 
0117     void run()                override;
0118 
0119 private:
0120 
0121     class Private;
0122     Private* const d;
0123 };
0124 
0125 } // namespace Digikam
0126 
0127 #endif // DIGIKAM_SETUP_CAMERA_H