• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kstars

  • sources
  • kde-4.12
  • kdeedu
  • kstars
  • kstars
ksuserdb.h
Go to the documentation of this file.
1 /***************************************************************************
2  ksuserdb.h - K Desktop Planetarium
3  -------------------
4  begin : Wed May 2 2012
5  copyright : (C) 2012 by Rishab Arora
6  email : ra.rishab@gmail.com
7  ***************************************************************************/
8 
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 #ifndef KSTARS_KSUSERDB_H
20 #define KSTARS_KSUSERDB_H
21 #define KSTARS_USERDB "data/userdb.sqlite"
22 #include <kstandarddirs.h>
23 #include <klocale.h>
24 #include <QSqlDatabase>
25 #include <QDebug>
26 #include <QSqlQuery>
27 #include <QSqlRecord>
28 #include <QSqlTableModel>
29 #include <QString>
30 #include <QHash>
31 #include <QSqlError>
32 #include <QVariant>
33 #include <QFile>
34 #include <QXmlStreamReader>
35 #include "skyobjects/skyobject.h"
36 #include "oal/oal.h"
37 
38 
46 class KSUserDB {
47  public:
51  bool Initialize();
52  ~KSUserDB();
53 
57  void AddObserver(const QString &name, const QString &surname, const QString &contact);
63  int FindObserver(const QString &name, const QString &surname);
70  bool DeleteObserver(const QString &id);
77  void GetAllObservers(QList<OAL::Observer *> &observer_list);
78 
84  void EraseAllFlags();
96  void AddFlag(const QString &ra, const QString &dec, const QString &epoch,
97  const QString &image_name, const QString &label, const QString &labelColor);
104  QList<QStringList> ReturnAllFlags();
105 
114  void EraseEquipment(const QString &type, const int &id);
121  void EraseAllEquipment(const QString &type);
122 
128  void AddScope(const QString &model, const QString &vendor, const QString &driver,
129  const QString &type, const double &focalLength, const double &aperture);
135  void AddScope(const QString &model, const QString &vendor, const QString &driver,
136  const QString &type, const double &focalLength, const double &aperture,
137  const QString &id);
145  void GetAllScopes(QList<OAL::Scope *> &m_scopeList);
146 
152  void AddEyepiece(const QString &vendor, const QString &model, const double &focalLength,
153  const double &fov, const QString &fovunit);
159  void AddEyepiece(const QString &vendor, const QString &model, const double &focalLength,
160  const double &fov, const QString &fovunit, const QString &id);
167  void GetAllEyepieces(QList<OAL::Eyepiece *> &m_eyepieceList);
168 
174  void AddLens(const QString &vendor, const QString &model, const double &factor);
180  void AddLens(const QString &vendor, const QString &model, const double &factor, const QString &id);
187  void GetAllLenses(QList<OAL::Lens *>& m_lensList);
188 
194  void AddFilter(const QString &vendor, const QString &model, const QString &type, const QString &color);
200  void AddFilter(const QString &vendor, const QString &model, const QString &type, const QString &color,
201  const QString &id);
208  void GetAllFilters(QList<OAL::Filter *>& m_filterList);
209 
210  private:
218  bool RebuildDB();
225  bool FirstRun();
231  bool ImportFlags();
237  bool ImportUsers();
243  bool ImportEquipment();
249  void readScopes();
250  void readScope(QString id);
251  void readEyepieces();
252  void readEyepiece(QString id);
253  void readLenses();
254  void readLens(QString id);
255  void readFilters();
256  void readFilter(QString id);
260  QSqlDatabase userdb_;
264  QXmlStreamReader *reader_;
270  inline QSqlError LastError();
271 };
272 
273 #endif // KSTARS_KSUSERDB_H
KSUserDB::FindObserver
int FindObserver(const QString &name, const QString &surname)
Returns the unique id of the user with given name & surname.
Definition: ksuserdb.cpp:196
KSUserDB::AddScope
void AddScope(const QString &model, const QString &vendor, const QString &driver, const QString &type, const double &focalLength, const double &aperture)
Appends the scope with given details in the database.
Definition: ksuserdb.cpp:353
KSUserDB::EraseAllEquipment
void EraseAllEquipment(const QString &type)
Erases the whole equipment table of given type.
Definition: ksuserdb.cpp:337
KSUserDB::~KSUserDB
~KSUserDB()
Definition: ksuserdb.cpp:57
KSUserDB::ReturnAllFlags
QList< QStringList > ReturnAllFlags()
Returns a QList populated with all stored flags Order: const QString &ra, const QString &dec...
Definition: ksuserdb.cpp:288
skyobject.h
KSUserDB::GetAllObservers
void GetAllObservers(QList< OAL::Observer * > &observer_list)
Updates the passed reference of observer_list with all observers The original content of the list is ...
Definition: ksuserdb.cpp:229
KSUserDB::GetAllFilters
void GetAllFilters(QList< OAL::Filter * > &m_filterList)
Populate the reference passed with all filters.
Definition: ksuserdb.cpp:601
KSUserDB::Initialize
bool Initialize()
Initialize KStarsDB while running splash screen.
Definition: ksuserdb.cpp:32
KSUserDB::EraseAllFlags
void EraseAllFlags()
Erases all the flags from the database.
Definition: ksuserdb.cpp:254
KSUserDB::GetAllScopes
void GetAllScopes(QList< OAL::Scope * > &m_scopeList)
updates the scope list with all scopes from database List is cleared and then filled with content...
Definition: ksuserdb.cpp:399
KSUserDB::AddFilter
void AddFilter(const QString &vendor, const QString &model, const QString &type, const QString &color)
Add a new filter to the database.
Definition: ksuserdb.cpp:562
oal.h
KSUserDB::AddLens
void AddLens(const QString &vendor, const QString &model, const double &factor)
Add a new lens to the database.
Definition: ksuserdb.cpp:501
KSUserDB::GetAllEyepieces
void GetAllEyepieces(QList< OAL::Eyepiece * > &m_eyepieceList)
Populate the reference passed with all eyepieces.
Definition: ksuserdb.cpp:472
KSUserDB
Single class to delegate all User database I/O.
Definition: ksuserdb.h:46
KSUserDB::AddEyepiece
void AddEyepiece(const QString &vendor, const QString &model, const double &focalLength, const double &fov, const QString &fovunit)
Add new eyepiece to database.
Definition: ksuserdb.cpp:429
KSUserDB::GetAllLenses
void GetAllLenses(QList< OAL::Lens * > &m_lensList)
Populate the reference passed with all lenses.
Definition: ksuserdb.cpp:537
KSUserDB::DeleteObserver
bool DeleteObserver(const QString &id)
Removes the user with unique id as given by FindObserver Returns false if the user is not found...
Definition: ksuserdb.cpp:212
KSUserDB::AddObserver
void AddObserver(const QString &name, const QString &surname, const QString &contact)
Adds a new observer into the database.
Definition: ksuserdb.cpp:168
KSUserDB::EraseEquipment
void EraseEquipment(const QString &type, const int &id)
Erase the equipment with given type and unique id Valid equipment types: "telescope","lens","filter".
Definition: ksuserdb.cpp:323
KSUserDB::AddFlag
void AddFlag(const QString &ra, const QString &dec, const QString &epoch, const QString &image_name, const QString &label, const QString &labelColor)
Add a new Flag with given parameters.
Definition: ksuserdb.cpp:267
QList
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kstars

Skip menu "kstars"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal