1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date        : 2004-11-17
7  * Description : item properties side bar (without support of digiKam database).
8  *
9  * Copyright (C) 2004-2021 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_ITEM_PROPERTIES_SIDEBAR_H
25 #define DIGIKAM_ITEM_PROPERTIES_SIDEBAR_H
26 
27 // Qt includes
28 
29 #include <QUrl>
30 #include <QWidget>
31 #include <QRect>
32 #include <QStackedWidget>
33 
34 // Local includes
35 
36 #include "digikam_config.h"
37 #include "sidebar.h"
38 #include "digikam_export.h"
39 #include "searchtextbar.h"
40 
41 namespace Digikam
42 {
43 
44 class DImg;
45 class SidebarSplitter;
46 class ItemPropertiesTab;
47 class ItemSelectionPropertiesTab;
48 class ItemPropertiesMetadataTab;
49 class ItemPropertiesColorsTab;
50 
51 #ifdef HAVE_MARBLE
52 
53 class ItemPropertiesGPSTab;
54 
55 #endif // HAVE_MARBLE
56 
57 class DIGIKAM_EXPORT ItemPropertiesSideBar : public Sidebar
58 {
59     Q_OBJECT
60 
61 public:
62     explicit ItemPropertiesSideBar(QWidget* const parent,
63                                    SidebarSplitter* const splitter,
64                                    Qt::Edge side = Qt::LeftEdge,
65                                    bool mimimizedDefault = false);
66     ~ItemPropertiesSideBar() override;
67 
68     virtual void itemChanged(const QUrl& url, const QRect& rect = QRect(), DImg* const img = nullptr);
69 
70 Q_SIGNALS:
71 
72     void signalSetupMetadataFilters(int);
73     void signalSetupExifTool();
74 
75 public Q_SLOTS:
76 
77     void slotLoadMetadataFilters();
78     void slotImageSelectionChanged(const QRect& rect);
79     virtual void slotNoCurrentItem();
80 
81 protected Q_SLOTS:
82 
83     virtual void slotChangedTab(QWidget* tab);
84 
85 protected:
86 
87     /**
88      * load the last view state from disk - called by StateSavingObject#loadState()
89      */
90     void doLoadState() override;
91 
92     /**
93      * save the view state to disk - called by StateSavingObject#saveState()
94      */
95     void doSaveState() override;
96 
97     virtual void setImagePropertiesInformation(const QUrl& url);
98 
99 protected:
100 
101     bool                        m_dirtyPropertiesTab;
102     bool                        m_dirtyMetadataTab;
103     bool                        m_dirtyColorTab;
104     bool                        m_dirtyGpsTab;
105     bool                        m_dirtyHistoryTab;
106 
107     QRect                       m_currentRect;
108 
109     QUrl                        m_currentURL;
110 
111     DImg*                       m_image;
112 
113     QStackedWidget*             m_propertiesStackedView;
114 
115     ItemPropertiesTab*          m_propertiesTab;
116     ItemSelectionPropertiesTab* m_selectionPropertiesTab;
117     ItemPropertiesMetadataTab*  m_metadataTab;
118     ItemPropertiesColorsTab*    m_colorTab;
119 
120 #ifdef HAVE_MARBLE
121 
122     ItemPropertiesGPSTab*       m_gpsTab;
123 
124 #endif // HAVE_MARBLE
125 
126 };
127 
128 } // namespace Digikam
129 
130 #endif // DIGIKAM_ITEM_PROPERTIES_SIDEBAR_H
131