GPS Sport Sniffer is a open source GPS application developed with Qt and made in...
[gpssportsniffer] / settings.cpp
1 #include "settings.h"
2
3 Settings::Settings(Log *log)
4     :servicesStarted(false),isConfigured(false),log(log),autosaveInterval(5){
5
6     horizontalAccuracy=200; //200
7     verticalAccuracy=100;   //100
8     trackToSniffColor="#ff0000";
9     trackColor="#5bff24";
10 }
11
12 Settings::Settings(const Settings& set, Log *log):
13     activity(set.activity),gpsInterval(set.gpsInterval),mapType(set.mapType),isOnline(set.isOnline)
14   ,xmlFile(set.xmlFile),servicesStarted(set.servicesStarted),isConfigured(set.isConfigured),log(log){
15     log->debug("--Settings 2n constuctor ---");
16     log->debug("isConfigured:" + isConfigured);
17     horizontalAccuracy=200;
18     verticalAccuracy=100;
19     trackToSniffColor="#ff0000";
20     trackColor="#5bff24";
21 }
22
23
24
25 QString Settings::toString(){
26
27     return activity;
28 }
29
30 Settings& Settings::operator= (const Settings &set){
31     activity=set.activity;
32     gpsInterval=set.gpsInterval;
33     mapType=set.mapType;
34     isOnline=set.isOnline;
35     xmlFile=set.xmlFile;
36     servicesStarted=set.servicesStarted;
37
38     return(*this);
39 }
40
41 int operator== (const Settings& a, const Settings& b)
42 {
43 if (a.activity==b.activity&&a.gpsInterval==b.gpsInterval&&a.mapType==b.mapType&&a.isOnline==b.isOnline&&a.xmlFile==b.xmlFile &&a.servicesStarted==b.servicesStarted)
44     return 1;
45 else
46     return 0;
47 }
48
49 int operator!= (const Settings& a, const Settings& b)
50 {
51 if (a.activity!=b.activity||a.gpsInterval!=b.gpsInterval||a.mapType!=b.mapType||a.isOnline!=b.isOnline||a.xmlFile!=b.xmlFile || a.servicesStarted!=b.servicesStarted)
52     return 1;
53 else
54     return 0;
55 }
56
57 QDataStream& operator << (QDataStream &stream, const Settings &a)
58 {
59     QString settings = QString("Settings{latitude=%1, longitude=%2}").arg(a.activity).arg(a.gpsInterval);
60
61     stream << settings;
62     return stream;
63 }