~ubuntu-branches/ubuntu/karmic/digikam/karmic-backports

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
/* ============================================================
 *
 * This file is a part of digiKam project
 * http://www.digikam.org
 *
 * Date        : 2006-02-20
 * Description : a widget to display GPS info on a world map
 *
 * Copyright (C) 2006-2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
 *
 * This program is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General
 * Public License as published by the Free Software Foundation;
 * either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * ============================================================ */

#ifndef WORLDMAPWIDGET_H
#define WORLDMAPWIDGET_H

// Qt includes

#include <QFrame>
#include <QDateTime>
#include <QList>
#include <QToolButton>

// KDE includes

#include <kurl.h>
#include <kconfiggroup.h>

// Local includes

#include "digikam_export.h"
#include "loadingdescription.h"
#include "config-digikam.h"
#ifdef HAVE_MARBLEWIDGET
#include "markerclusterholder.h"
#endif // HAVE_MARBLEWIDGET

class QAction;

namespace Digikam
{

class DIGIKAM_EXPORT GPSInfo
{
public:

    GPSInfo()
    : latitude(0.0),
      longitude(0.0),
      altitude(0.0),
      dateTime(),
      rating(0),
      url(),
      dimensions()
    {
    };

    double    latitude;
    double    longitude;
    double    altitude;

    QDateTime dateTime;
    int       rating;
    KUrl      url;
    QSize     dimensions;
};

typedef QList<GPSInfo> GPSInfoList;

// ------------------------------------------------------------------------------

class WorldMapWidgetPriv;

class DIGIKAM_EXPORT WorldMapWidget : public QFrame
{
    Q_OBJECT

public:

    enum MapTheme
    {
        AtlasMap = 0,
        OpenStreetMap
    };

public:

    WorldMapWidget(int w, int h, QWidget *parent);
    virtual ~WorldMapWidget();

    void   setGPSPositions(const GPSInfoList& list);
    void   addGPSPositions(const GPSInfoList& list);
    void   clearGPSPositions();

    double getLatitude();
    double getLongitude();

    void   getCenterPosition(double& lat, double& lng);
    void   setCenterPosition(double lat, double lng);

    int    getZoomLevel();
    void   setZoomLevel(int l);

    void     setMapTheme(MapTheme theme);
    MapTheme getMapTheme();

    QAction* getZoomAction(const bool zoomIn);

    void readConfig(KConfigGroup& group);
    void writeConfig(KConfigGroup& group);
#ifdef HAVE_MARBLEWIDGET
    void setCustomPaintFunction(const MarkerClusterHolder::CustomPaintFunction customPaintFunction, void* const yourdata);
    MarkerClusterHolder* getMarkerClusterHolder() const;
#if MARBLE_VERSION >= 0x000800
    QAction* getMouseModeAction(const MarkerClusterHolder::MouseMode mouseMode);
#endif // MARBLE_VERSION >= 0x000800
#endif // HAVE_MARBLEWIDGET
    void setMultiMarkerSettings(const bool showSingleImages, const bool showGroupImages, const bool showHighestRatingFirst, const bool showOldestFirst, const bool showNumbers);
    void getMultiMarkerSettings(bool* const showSingleImages, bool* const showGroupImages, bool* const showHighestRatingFirst, bool* const showOldestFirst, bool* const showNumbers) const;

Q_SIGNALS:

    void signalSettingsChanged();
    void signalSelectedItems(const GPSInfoList infoList);
    void signalSoloItems(const GPSInfoList infoList);

public Q_SLOTS:

    void slotZoomIn();
    void slotZoomOut();
    void slotZoomChanged(int zoom);
    void slotSetSelectedImages(const GPSInfoList &infoList);
    void slotMapMarkerSelectionChanged();
    void slotMapMarkerSoloChanged();
    void slotSetAllowItemSelection(const bool allow);
    void slotSetAllowItemFiltering(const bool allow);
    void slotSetFocusOnAddedItems(const bool doIt);
    void slotSetEnableTooltips(const bool doIt);
    void slotThumbnailLoaded(const LoadingDescription& loadingDescription, const QPixmap& pix);
//#ifdef HAVE_MARBLEWIDGET
//    MarkerClusterHolder* getMarkerClusterHolder() const;
//#endif // HAVE_MARBLEWIDGET

protected:

    QWidget* marbleWidget() const;

private:

#ifdef HAVE_MARBLEWIDGET
    static MarkerClusterHolder::PixmapOperations getClusterPixmap(const int clusterIndex, MarkerClusterHolder* const mch, const QSize& maxSize, void* const yourdata, QPixmap* const clusterPixmap);
#endif // HAVE_MARBLEWIDGET

private:

    WorldMapWidgetPriv* const d;
};

// ------------------------------------------------------------------------------

class WorldMapThemeBtnPriv;

class DIGIKAM_EXPORT WorldMapThemeBtn : public QToolButton
{
    Q_OBJECT

public:

    WorldMapThemeBtn(WorldMapWidget *map, QWidget *parent);
    virtual ~WorldMapThemeBtn();

private Q_SLOTS:

    void slotUpdateMenu();
    void slotMapThemeChanged(QAction*);

private:

    WorldMapThemeBtnPriv* const d;
};

}  // namespace Digikam

#endif /* WORLDMAPWIDGET_H */