File indexing completed on 2025-01-19 03:57:44

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2009-12-01
0007  * Description : main-window of the demo application
0008  *
0009  * SPDX-FileCopyrightText: 2009-2010 by Michael G. Hansen <mike at mghansen dot de>
0010  * SPDX-FileCopyrightText:      2014 by Justus Schwartz <justus at gmx dot li>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_GEO_MAIN_WINDOW_H
0017 #define DIGIKAM_GEO_MAIN_WINDOW_H
0018 
0019 // Qt includes
0020 
0021 #include <QItemSelection>
0022 #include <QMainWindow>
0023 
0024 // Local includes
0025 
0026 #include "geoifacetypes.h"
0027 #include "geomodelhelper.h"
0028 #include "trackmanager.h"
0029 
0030 class QCommandLineParser;
0031 
0032 using namespace Digikam;
0033 
0034 class MarkerModelHelper : public GeoModelHelper
0035 {
0036     Q_OBJECT
0037 
0038 public:
0039 
0040     explicit MarkerModelHelper(QAbstractItemModel* const itemModel,
0041                                QItemSelectionModel* const itemSelectionModel);
0042     ~MarkerModelHelper()                                                        override;
0043 
0044     QAbstractItemModel*  model()                                          const override;
0045     QItemSelectionModel* selectionModel()                                 const override;
0046     PropertyFlags        modelFlags()                                     const override;
0047     bool itemCoordinates(const QModelIndex& index,
0048                          GeoCoordinates* const coordinates)               const override;
0049     void onIndicesMoved(const QList<QPersistentModelIndex>& movedIndices,
0050                         const GeoCoordinates& targetCoordinates,
0051                         const QPersistentModelIndex& targetSnapIndex)           override;
0052 
0053 private:
0054 
0055     QAbstractItemModel* const  m_itemModel;
0056     QItemSelectionModel* const m_itemSelectionModel;
0057 
0058 Q_SIGNALS:
0059 
0060     void signalMarkersMoved(const QList<QPersistentModelIndex>& movedIndices);
0061 };
0062 
0063 // ------------------------------------------------------------------------------------------------
0064 
0065 class MyTrackModelHelper : public QObject
0066 {
0067     Q_OBJECT
0068 
0069 public:
0070 
0071     explicit MyTrackModelHelper(QAbstractItemModel* const imageItemsModel);
0072 
0073     virtual TrackManager::Track::List getTracks() const;
0074 
0075 Q_SIGNALS:
0076 
0077     void signalModelChanged();
0078 
0079 public Q_SLOTS:
0080 
0081     void slotTrackModelChanged();
0082 
0083 private:
0084 
0085     TrackManager::Track::List m_tracks;
0086     QAbstractItemModel*       m_itemModel;
0087 };
0088 
0089 // ------------------------------------------------------------------------------------------------
0090 
0091 class MainWindow : public QMainWindow
0092 {
0093     Q_OBJECT
0094 
0095 public:
0096 
0097     explicit MainWindow(QCommandLineParser* const cmdLineArgs,
0098                         QWidget* const parent = nullptr);
0099     ~MainWindow()                       override;
0100 
0101 public Q_SLOTS:
0102 
0103     void slotScheduleImagesForLoading(const QList<QUrl>& imagesToSchedule);
0104 
0105 protected:
0106 
0107     void readSettings();
0108     void saveSettings();
0109     void closeEvent(QCloseEvent* e)     override;
0110     void createMenus();
0111 
0112 private Q_SLOTS:
0113 
0114     void slotFutureResultsReadyAt(int startIndex, int endIndex);
0115     void slotImageLoadingBunchReady();
0116     void slotMarkersMoved(const QList<QPersistentModelIndex>& markerIndices);
0117     void slotAltitudeRequestsReady(const QList<int>& readyRequests);
0118     void slotAltitudeLookupDone();
0119     void slotAddImages();
0120 
0121 private:
0122 
0123     class Private;
0124     Private* const d;
0125 };
0126 
0127 #endif // DIGIKAM_GEO_MAIN_WINDOW_H