File indexing completed on 2025-01-05 03:59:45

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2010-01-10
0007  * Description : a tool bar for preview mode
0008  *
0009  * SPDX-FileCopyrightText: 2010-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_PREVIEW_TOOL_BAR_H
0016 #define DIGIKAM_PREVIEW_TOOL_BAR_H
0017 
0018 // Qt includes
0019 
0020 #include <QWidget>
0021 #include <QAction>
0022 
0023 // Local includes
0024 
0025 #include "digikam_export.h"
0026 
0027 class KConfigGroup;
0028 
0029 namespace Digikam
0030 {
0031 
0032 class EditorWindow;
0033 
0034 class DIGIKAM_EXPORT PreviewToolBar : public QWidget
0035 {
0036     Q_OBJECT
0037 
0038 public:
0039 
0040     enum PreviewMode
0041     {
0042         PreviewOriginalImage      = 0x00000001,      ///< Original image only.
0043         PreviewBothImagesHorz     = 0x00000002,      ///< Horizontal with original and target duplicated.
0044         PreviewBothImagesVert     = 0x00000004,      ///< Vertical with original and target duplicated.
0045         PreviewBothImagesHorzCont = 0x00000008,      ///< Horizontal with original and target in contiguous.
0046         PreviewBothImagesVertCont = 0x00000010,      ///< Vertical with original and target in contiguous.
0047         PreviewTargetImage        = 0x00000020,      ///< Target image only.
0048         PreviewToggleOnMouseOver  = 0x00000040,      ///< Original image if mouse is over image area, else target image.
0049         NoPreviewMode             = 0x00000080,      ///< Target image only without information displayed.
0050 
0051         AllPreviewModes           = PreviewOriginalImage      | PreviewBothImagesHorz     |
0052                                     PreviewBothImagesVert     | PreviewBothImagesHorzCont |
0053                                     PreviewBothImagesVertCont | PreviewTargetImage        |
0054                                     PreviewToggleOnMouseOver,
0055 
0056         UnSplitPreviewModes       = PreviewOriginalImage | PreviewTargetImage | PreviewToggleOnMouseOver
0057     };
0058 
0059 public:
0060 
0061     explicit PreviewToolBar(QWidget* const parent = nullptr);
0062     ~PreviewToolBar() override;
0063 
0064     void setPreviewModeMask(int mask);
0065 
0066     void setPreviewMode(PreviewMode mode);
0067     PreviewMode previewMode() const;
0068 
0069     void readSettings(KConfigGroup& group);
0070     void writeSettings(KConfigGroup& group);
0071 
0072     void registerMenuActionGroup(EditorWindow* const editor);
0073 
0074 Q_SIGNALS:
0075 
0076     void signalPreviewModeChanged(int);
0077 
0078 private Q_SLOTS:
0079 
0080     void slotButtonReleased(int);
0081     void slotActionTriggered(QAction*);
0082 
0083 private:
0084 
0085     void setCheckedAction(int id);
0086 
0087 private:
0088 
0089     class Private;
0090     Private* const d;
0091 };
0092 
0093 } // namespace Digikam
0094 
0095 #endif // DIGIKAM_PREVIEW_TOOL_BAR_H