File indexing completed on 2025-01-05 03:56:42
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2010-12-26 0007 * Description : images versions tree view overlays 0008 * 0009 * SPDX-FileCopyrightText: 2010 by Martin Klapetek <martin dot klapetek at gmail dot com> 0010 * SPDX-FileCopyrightText: 2010 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de> 0011 * 0012 * SPDX-License-Identifier: GPL-2.0-or-later 0013 * 0014 * ============================================================ */ 0015 0016 #ifndef DIGIKAM_VERSIONS_OVERLAYS_H 0017 #define DIGIKAM_VERSIONS_OVERLAYS_H 0018 0019 #include <QString> 0020 #include <QIcon> 0021 0022 // Local includes 0023 0024 #include "digikam_export.h" 0025 #include "itemdelegateoverlay.h" 0026 #include "itemfiltersettings.h" 0027 0028 namespace Digikam 0029 { 0030 0031 class ItemInfo; 0032 class ItemModel; 0033 class VersionManagerSettings; 0034 0035 class ShowHideVersionsOverlay : public HoverButtonDelegateOverlay 0036 { 0037 Q_OBJECT 0038 0039 public: 0040 0041 explicit ShowHideVersionsOverlay(QObject* const parent); 0042 void setActive(bool active) override; 0043 0044 void setSettings(const VersionManagerSettings& settings); 0045 0046 protected: 0047 0048 ItemViewHoverButton* createButton() override; 0049 void updateButton(const QModelIndex& index) override; 0050 bool checkIndex(const QModelIndex& index) const override; 0051 0052 protected Q_SLOTS: 0053 0054 void slotClicked(bool checked); 0055 0056 protected: 0057 0058 VersionItemFilterSettings m_filter; 0059 class Button; 0060 }; 0061 0062 // ------------------------------------------------------------------- 0063 0064 class ActionVersionsOverlay : public HoverButtonDelegateOverlay 0065 { 0066 Q_OBJECT 0067 0068 public: 0069 0070 explicit ActionVersionsOverlay(QObject* const parent, 0071 const QIcon& icon, 0072 const QString& text, 0073 const QString& tip = QString()); 0074 void setActive(bool active) override; 0075 0076 void setReferenceModel(const ItemModel* model); 0077 0078 Q_SIGNALS: 0079 0080 void activated(const ItemInfo& info); 0081 0082 protected: 0083 0084 ItemViewHoverButton* createButton() override; 0085 void updateButton(const QModelIndex& index) override; 0086 bool checkIndex(const QModelIndex& index) const override; 0087 0088 protected Q_SLOTS: 0089 0090 void slotClicked(bool checked); 0091 0092 protected: 0093 0094 class Button; 0095 Button* button() const; 0096 0097 protected: 0098 0099 QIcon m_icon; 0100 QString m_text; 0101 QString m_tip; 0102 const ItemModel* m_referenceModel; 0103 }; 0104 0105 } // namespace Digikam 0106 0107 #endif // DIGIKAM_VERSIONS_OVERLAYS_H