forked from chozabu/FriendMap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGeoPeer.h
85 lines (73 loc) · 2.06 KB
/
GeoPeer.h
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
#ifndef GEOPEER_H
#define GEOPEER_H
#include <GeoIP.h>
#include <GeoIPCity.h>
#include <marble/GeoDataCoordinates.h>
#include <marble/GeoDataDocument.h>
#include <QPixmap>
#include "PositionManager.h"
#include "gui/common/AvatarDefs.h"
#include "interface.h"
#include "paintable.h"
using namespace Marble;
//!
//! \brief The GeoPeerLoc class
//!
class GeoPeerLoc : public GeoDataPlacemark, public Paintable {
public:
static const GeoDataCoordinates DEFAULT;
explicit GeoPeerLoc(const RsPeerId& ssl_id);
QString getName() const;
QString getLocation() const;
QString getIP() const;
bool isOnline() const;
/*!
* \brief getExactCoordinates Return the exact coordinates without offset. Use the inherited coordinate() for the placemarks position on the map.
* \return exact coordinates like without offset.
*/
const GeoDataCoordinates& getExactCoordinates() const;
QString getCity() const;
QString getCountryCode() const;
QString getCountryName() const;
QString getRegion() const;
const RsPeerId getSslId() const;
QString toString() const;
void checkOnline();
void updateAvatar();
bool isOwn() const;
virtual void paint(GeoPainter* painter) const override;
private:
RsPeerDetails peer_ssl_details;
QString city, country_name, country_code, region;
GeoDataCoordinates coord;
QPixmap avatar;
bool is_online;
};
//!
//! \brief The GeoPeer class
//!
class GeoPeer {
public:
static const GeoPeer NULLPEER;
GeoPeer() : is_null(true) {}
explicit GeoPeer(const RsPgpId& gpg_id);
const RsPgpId& getGpgId() const;
const std::string& getName() const {
return peer_details.name;
}
bool hasOwnSign() const {
return peer_details.ownsign;
}
void setAvatar();
bool isNull() const {
return is_null;
}
bool isSelf() const;
std::list<RsPeerId> getAssociatedSSLIds() const;
std::list<RsPgpId> getConnectionsList() const;
private:
RsPeerDetails peer_details;
QPixmap avatar;
bool is_null;
};
#endif // GEOPEER_H