File indexing completed on 2025-01-05 03:58:31

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2010-03-22
0007  * Description : A view to display a list of items with GPS info.
0008  *
0009  * SPDX-FileCopyrightText: 2010-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText: 2010      by Michael G. Hansen <mike at mghansen dot de>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_GPS_ITEM_LIST_H
0017 #define DIGIKAM_GPS_ITEM_LIST_H
0018 
0019 // Qt includes
0020 
0021 #include <QTreeView>
0022 
0023 // Local includes
0024 
0025 #include "gpsitemmodel.h"
0026 #include "gpsitemsortproxymodel.h"
0027 #include "digikam_export.h"
0028 
0029 class QWheelEvent;
0030 class KConfigGroup;
0031 
0032 namespace Digikam
0033 {
0034 
0035 class ItemListDragDropHandler;
0036 
0037 class DIGIKAM_EXPORT GPSItemList : public QTreeView
0038 {
0039     Q_OBJECT
0040 
0041 public:
0042 
0043     explicit GPSItemList(QWidget* const parent = nullptr);
0044     ~GPSItemList() override;
0045 
0046     void setModelAndSelectionModel(GPSItemModel* const model, QItemSelectionModel* const selectionModel);
0047     GPSItemModel* getModel()                    const;
0048     QItemSelectionModel* getSelectionModel()    const;
0049     void setDragDropHandler(ItemListDragDropHandler* const dragDropHandler);
0050     void setThumbnailSize(const int size);
0051     GPSItemSortProxyModel* getSortProxyModel()  const;
0052 
0053     void saveSettingsToGroup(KConfigGroup* const group);
0054     void readSettingsFromGroup(const KConfigGroup* const group);
0055     void setEditEnabled(const bool state);
0056     void setDragEnabled(const bool state);
0057 
0058 Q_SIGNALS:
0059 
0060     void signalImageActivated(const QModelIndex& index);
0061 
0062 public Q_SLOTS:
0063 
0064     void slotIncreaseThumbnailSize();
0065     void slotDecreaseThumbnailSize();
0066     void slotUpdateActionsEnabled();
0067 
0068 private Q_SLOTS:
0069 
0070     void slotInternalTreeViewImageActivated(const QModelIndex& current, const QModelIndex& previous);
0071     void slotThumbnailFromModel(const QPersistentModelIndex& index, const QPixmap& pixmap);
0072     void slotColumnVisibilityActionTriggered(QAction* action);
0073 
0074 protected:
0075 
0076     bool eventFilter(QObject* watched, QEvent* event) override;
0077     void startDrag(Qt::DropActions supportedActions)  override;
0078     void wheelEvent(QWheelEvent* we)                  override;
0079 
0080 private:
0081 
0082     class Private;
0083     Private* const d;
0084 };
0085 
0086 } // namespace Digikam
0087 
0088 #endif // DIGIKAM_GPS_ITEM_LIST_H