File indexing completed on 2025-01-19 03:51:18

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2006-05-16
0007  * Description : A tool to edit geolocation
0008  *
0009  * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText: 2010-2014 by Michael G. Hansen <mike at mghansen dot de>
0011  * SPDX-FileCopyrightText: 2010      by Gabriel Voicu <ping dot gabi at gmail dot com>
0012  * SPDX-FileCopyrightText: 2014      by Justus Schwartz <justus at gmx dot li>
0013  *
0014  * SPDX-License-Identifier: GPL-2.0-or-later
0015  *
0016  * ============================================================ */
0017 
0018 #ifndef DIGIKAM_GEO_LOCATION_EDIT_H
0019 #define DIGIKAM_GEO_LOCATION_EDIT_H
0020 
0021 // Qt includes
0022 
0023 #include <QModelIndex>
0024 #include <QWidget>
0025 #include <QUrl>
0026 
0027 // Local includes
0028 
0029 #include "dplugindialog.h"
0030 #include "geoifacetypes.h"
0031 #include "geomodelhelper.h"
0032 #include "trackmanager.h"
0033 #include "gpsitemcontainer.h"
0034 #include "dinfointerface.h"
0035 #include "mapwidget.h"
0036 #include "gpsundocommand.h"
0037 
0038 class QAbstractItemModel;
0039 
0040 using namespace Digikam;
0041 
0042 namespace DigikamGenericGeolocationEditPlugin
0043 {
0044 
0045 class GeolocationEdit : public DPluginDialog
0046 {
0047     Q_OBJECT
0048 
0049 public:
0050 
0051     explicit GeolocationEdit(QWidget* const parent, DInfoInterface* const iface);
0052     ~GeolocationEdit() override;
0053 
0054     /**
0055      * Populate items in dialog list based on url. To be used in case of non database as with Showfoto.
0056      */
0057     void setImages(const QList<QUrl>& images);
0058 
0059     /**
0060      * Populate items in dialog list based dedicated GPSItemContainer instances filled with DB info
0061      */
0062     void setItems(const QList<GPSItemContainer*>& items);
0063 
0064 Q_SIGNALS:
0065 
0066     void signalMetadataChangedForUrl(const QUrl&);
0067 
0068 protected:
0069 
0070     void reject()                       override;
0071     void closeEvent(QCloseEvent* e)     override;
0072     bool eventFilter(QObject*, QEvent*) override;
0073 
0074 private:
0075 
0076     void readSettings();
0077     void saveSettings();
0078     void saveChanges(const bool closeAfterwards);
0079     MapWidget* makeMapWidget(QWidget** const pvbox);
0080     void adjustMapLayout(const bool syncSettings);
0081 
0082 private Q_SLOTS:
0083 
0084     void slotImageActivated(const QModelIndex& index);
0085     void slotSetUIEnabled(const bool enabledState, QObject* const cancelObject, const QString& cancelSlot);
0086     void slotSetUIEnabled(const bool enabledState);
0087     void slotOkClicked();
0088     void slotApplyClicked();
0089     void slotFileChangesSaved(int beginIndex, int endIndex);
0090     void slotFileMetadataLoaded(int beginIndex, int endIndex);
0091     void slotProgressChanged(const int currentProgress);
0092     void slotProgressSetup(const int maxProgress, const QString& progressText);
0093     void slotGPSUndoCommand(GPSUndoCommand* undoCommand);
0094     void slotSortOptionTriggered(QAction* sortAction);
0095     void setCurrentTab(const int index);
0096     void slotProgressCancelButtonClicked();
0097     void slotCurrentTabChanged(int);
0098     void slotBookmarkVisibilityToggled();
0099     void slotLayoutChanged(int);
0100     void slotTrackListChanged(const Digikam::GeoCoordinates& coordinate);
0101 
0102 private:
0103 
0104     class Private;
0105     Private* const d;
0106 };
0107 
0108 } // namespace DigikamGenericGeolocationEditPlugin
0109 
0110 #endif // DIGIKAM_GEO_LOCATION_EDIT_H