Created new class GpsLocation that handles communication with gps. It
[ptas] / zouba / src / logic / locations.h
1 #ifndef LOCATIONS_H
2 #define LOCATIONS_H
3
4 #include "location.h"
5 #include "gpslocation.h"
6
7 #include <QHash>
8 #include <QList>
9 #include <QString>
10 #include <QObject>
11
12 class Locations: public QObject
13 {
14     Q_OBJECT
15
16 public:
17     static Locations *GetInstance();
18     //static void destroyLocations();
19
20     bool addEditLocation(Location *location);
21     bool removeLocation(Location *location);
22
23     bool increaseLocationIndex(const QString &label);
24     bool lowerLocationIndex(const QString &label);
25
26     Location *getLocation(const QString &label) const;
27     Location *getLocation(const int&) const;
28     GpsLocation *getGpsLocation() const;
29     int size() const;
30
31     //const QHash<QString, Location *>& getLocations() const;
32
33 signals:
34     void locationsChanged();
35
36 private:
37     Locations();
38     //~Locations();
39     Locations(const Locations&);
40     void operator=(const Locations&);
41
42     void restoreLocations();
43     void saveLocation(Location *location);
44     bool findLabel(const int &index, QString &label) const;
45     void changeIndex(const QString &label, const int &index, bool signal = true);
46
47     QHash<QString, Location*> m_locationStorage;
48     QList<QString> m_indexStorage;
49     GpsLocation* m_gpsLocation;
50
51     static Locations *m_instance;
52 };
53 #endif // LOCATIONS_H