1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date        : 2006-05-16
7  * Description : a tool to export GPS data to KML file.
8  *
9  * Copyright (C) 2006-2007 by Stephane Pontier <shadow dot walker at free dot fr>
10  * Copyright (C) 2008-2021 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option) 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_KML_WIDGET_H
25 #define DIGIKAM_KML_WIDGET_H
26 
27 // Qt includes
28 
29 #include <QWidget>
30 #include <QList>
31 #include <QUrl>
32 
33 // Local includes
34 
35 #include "kmlexport.h"
36 #include "dfileselector.h"
37 #include "dcolorselector.h"
38 #include "dinfointerface.h"
39 #include "geolocationedit.h"
40 #include "gpsitemmodel.h"
41 
42 class QButtonGroup;
43 class QCheckBox;
44 class QGridLayout;
45 class QGroupBox;
46 class QLabel;
47 class QLineEdit;
48 class QRadioButton;
49 class QSpacerItem;
50 class QComboBox;
51 class QCloseEvent;
52 class QSpinBox;
53 class QPushButton;
54 
55 using namespace Digikam;
56 
57 namespace DigikamGenericGeolocationEditPlugin
58 {
59 
60 class KmlWidget : public QWidget
61 {
62     Q_OBJECT
63 
64 public:
65 
66     explicit KmlWidget(GeolocationEdit* const dlg,
67                        GPSItemModel* const imageModel,
68                        DInfoInterface* const iface);
69     ~KmlWidget() override;
70 
71 public:
72 
73     QLabel*           ImageSizeLabel;
74     QLabel*           IconSizeLabel;
75     QLabel*           destinationDirectoryLabel_;
76     QLabel*           FileNameLabel_;
77     QLabel*           DestinationUrlLabel_;
78     QLabel*           GPXFileLabel_;
79     QLabel*           timeZoneLabel_;
80     QLabel*           GPXLineWidthLabel_;
81     QLabel*           GPXColorLabel_;
82     QLabel*           GPXAltitudeLabel_;
83     QLabel*           GPXTracksOpacityLabel_;
84 
85     QGroupBox*        TargetPreferenceGroupBox;
86     QGroupBox*        TargetTypeGroupBox;
87 
88     QButtonGroup*     buttonGroupTargetType;
89 
90     QRadioButton*     LocalTargetRadioButton_;
91     QRadioButton*     GoogleMapTargetRadioButton_;
92 
93     QLineEdit*        DestinationUrl_;
94     QLineEdit*        FileName_;
95 
96     QCheckBox*        GPXTracksCheckBox_;
97 
98     QComboBox*        AltitudeCB_;
99     QComboBox*        timeZoneCB;
100     QComboBox*        GPXAltitudeCB_;
101 
102     DColorSelector*   GPXTrackColor_;
103 
104     DFileSelector*    DestinationDirectory_;
105     DFileSelector*    GPXFileUrlRequester_;
106     QPushButton*      m_geneBtn;
107 
108     QSpinBox*         ImageSizeInput_;
109     QSpinBox*         IconSizeInput_;
110     QSpinBox*         GPXTracksOpacityInput_;
111     QSpinBox*         GPXLineWidthInput_;
112 
113     GPSItemModel*     m_model;
114     GeolocationEdit*  m_dlg;
115 
116 Q_SIGNALS:
117 
118     void signalSetUIEnabled(const bool enabledState);
119     void signalProgressSetup(const int maxProgress, const QString& progressText);
120 
121 public Q_SLOTS:
122 
123     void slotGoogleMapTargetRadioButtonToggled(bool);
124     void slotKMLTracksCheckButtonToggled(bool);
125 
126 protected:
127 
128     void saveSettings();
129     void readSettings();
130 
131 protected Q_SLOTS:
132 
133     void slotKMLGenerate();
134 
135 protected:
136 
137     QGridLayout* KMLExportConfigLayout;
138     QGridLayout* SizeGroupBoxLayout;
139     QGridLayout* TargetPreferenceGroupBoxLayout;
140     QGridLayout* buttonGroupTargetTypeLayout;
141 
142     KmlExport    m_kmlExport;
143 };
144 
145 } // namespace DigikamGenericGeolocationEditPlugin
146 
147 #endif // DIGIKAM_KML_WIDGET_H
148