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        : 2010-09-18
0007  * Description : A tool to calibrate the tiling levels
0008  *               used in geolocation interface
0009  *
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_CALIBRATOR_H
0017 #define DIGIKAM_CALIBRATOR_H
0018 
0019 // Qt includes
0020 
0021 #include <QMainWindow>
0022 
0023 // Local includes
0024 
0025 #include "geomodelhelper.h"
0026 
0027 class QStandardItemModel;
0028 
0029 using namespace Digikam;
0030 
0031 class CalibratorModelHelper : public GeoModelHelper
0032 {
0033     Q_OBJECT
0034 
0035 public:
0036 
0037     explicit CalibratorModelHelper(QStandardItemModel* const model, QObject* const parent = nullptr);
0038     ~CalibratorModelHelper() override;
0039 
0040     void setItemCoordinates(const QModelIndex& index, const GeoCoordinates& coordinates);
0041 
0042     // these are necessary for grouped and ungrouped models
0043     QAbstractItemModel*  model()          const override;
0044     QItemSelectionModel* selectionModel() const override;
0045     PropertyFlags        modelFlags()     const override;
0046     bool itemCoordinates(const QModelIndex& index, GeoCoordinates* const coordinates) const override;
0047 
0048 private:
0049 
0050     class Private;
0051     Private* const d;
0052 
0053     Q_DISABLE_COPY(CalibratorModelHelper)
0054 };
0055 
0056 // -----------------------------------------------------------------------------------------------------------
0057 
0058 class Calibrator : public QMainWindow
0059 {
0060     Q_OBJECT
0061 
0062 public:
0063 
0064     explicit Calibrator(QWidget* const parent = nullptr);
0065     ~Calibrator() override;
0066 
0067 private:
0068 
0069     void addMarkerAt(const GeoCoordinates& coordinates);
0070 
0071 private Q_SLOTS:
0072 
0073     void updateGroupingMode();
0074     void updateMarkers();
0075     void updateZoomView();
0076     void slotAddMapWidget();
0077     void slotRemoveMapWidget();
0078     void slotActivateMapActionTriggered(bool state);
0079 
0080 private:
0081 
0082     class Private;
0083     Private* const d;
0084 
0085     Q_DISABLE_COPY(Calibrator)
0086 };
0087 
0088 #endif // DIGIKAM_CALIBRATOR_H