Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · File Structure

core/StelLocationMgr.hpp

00001 /*
00002  * Copyright (C) 2008 Fabien Chereau
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017  */
00018 
00019 #ifndef _STELLOCATIONMGR_HPP_
00020 #define _STELLOCATIONMGR_HPP_
00021 
00022 #include "StelLocation.hpp"
00023 #include <QString>
00024 #include <QObject>
00025 #include <QMetaType>
00026 #include <QMap>
00027 
00028 class QStringListModel;
00029 
00032 class StelLocationMgr : public QObject
00033 {
00034     Q_OBJECT
00035 
00036 public:
00038     StelLocationMgr();
00040     ~StelLocationMgr();
00041 
00043     QStringListModel* getModelAll() {return modelAllLocation;}
00044 
00046     QList<StelLocation> getAll() const {return locations.values();}
00047 
00049     const StelLocation locationForSmallString(const QString& s) const;
00050 
00053     bool canSaveUserLocation(const StelLocation& loc) const;
00054 
00057     bool saveUserLocation(const StelLocation& loc);
00058 
00062     bool canDeleteUserLocation(const QString& id) const;
00063 
00067     bool deleteUserLocation(const QString& id);
00068 
00069 private:
00070     void generateBinaryLocationFile(const QString& txtFile, bool isUserLocation, const QString& binFile) const;
00071 
00073     QMap<QString, StelLocation> loadCities(const QString& fileName, bool isUserLocation) const;
00074     QMap<QString, StelLocation> loadCitiesBin(const QString& fileName) const;
00075 
00077     QStringListModel* modelAllLocation;
00078 
00080     QMap<QString, StelLocation> locations;
00081 };
00082 
00083 #endif // _STELLOCATIONMGR_HPP_

Generated on Wed Jun 2 13:11:13 2010 for Stellarium by  doxygen 1.5.5