Stellarium 0.15.2
LogBook.hpp
1 /*
2  * Copyright (C) 2009 Timothy Reaves
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
17  */
18 
19 #ifndef LOGBOOK_HPP_
20 #define LOGBOOK_HPP_
21 
22 #include "StelModule.hpp"
23 #include <QMap>
24 
26 class ObservationsDialog;
27 class SessionsDialog;
28 class TargetsDialog;
29 
30 class QKeyEvent;
31 class QMouseEvent;
32 class QPixmap;
33 class QSqlDatabase;
34 class QSqlTableModel;
35 class QSqlQuery;
36 
37 class StelButton;
38 class StelStyle;
39 
41 class LogBook : public StelModule
42 {
43  Q_OBJECT
44 public:
45  LogBook();
46  virtual ~LogBook();
47 
49  // Methods defined in the StelModule class
50  virtual bool configureGui(bool show=true);
51  virtual void draw(StelCore* core);
52  virtual double getCallOrder(StelModuleActionName actionName) const;
55  const StelStyle getModuleStyleSheet(const StelStyle& style);
56  virtual void init();
57  virtual void setStelStyle(const QString& section);
58  virtual void update(double) {;}
59 
60 public slots:
64  void enableLogBook(bool b);
65  void setConfigDialogVisible(bool b);
66  void setTargetsDialogVisible(bool b);
67 
68 private:
73  bool createDatabaseStructures();
74 
78  bool executeSql(QString &sql);
79 
80  void initializeActions();
81 
83  bool initializeDatabase();
84 
85  //Styles
86  QByteArray normalStyleSheet;
87  QByteArray nightStyleSheet;
88 
92  bool processSqlFile(QString &fileName);
93 
94  LogBookConfigDialog *configDialog;
95  SessionsDialog *sessionsDialog;
96  TargetsDialog *targetsDialog;
97 
99  bool flagShowLogBook;
100  QMap<QString, QSqlTableModel *> tableModels;
101 
102  // for toolbar button
103  QPixmap* pxmapGlow;
104  QPixmap* pxmapOnIcon;
105  QPixmap* pxmapOffIcon;
106  StelButton* toolbarButton;
107 };
108 
109 
110 #include <QObject>
111 #include "StelPluginInterface.hpp"
112 
114 class LogBookStelPluginInterface : public QObject, public StelPluginInterface
115 {
116  Q_OBJECT
117  Q_PLUGIN_METADATA(IID StelPluginInterface_iid)
118  Q_INTERFACES(StelPluginInterface)
119 public:
120  virtual StelModule* getStelModule() const;
121  virtual StelPluginInfo getPluginInfo() const;
122 };
123 
124 #endif /*LOGBOOK_HPP_*/
Define the interface to implement when creating a plugin.
virtual bool configureGui(bool show=true)
Detect or show the configuration GUI elements for the module.
virtual void update(double)
Update the module with respect to the time.
Definition: LogBook.hpp:58
const StelStyle getModuleStyleSheet(const StelStyle &style)
Returns the module-specific style sheet.
Main class for Stellarium core processing.
Definition: StelCore.hpp:48
virtual void draw(StelCore *core)
Execute all the drawing functions for this module.
This is an example of a plug-in which can be dynamically loaded into stellarium.
Definition: LogBook.hpp:41
virtual void init()
Initialize itself.
A Button Graphicsitem for use in Stellarium&#39;s graphic widgets.
This class is used by Qt to manage a plug-in interface.
Definition: LogBook.hpp:114
StelModuleActionName
Define the possible action for which an order is defined.
Definition: StelModule.hpp:121
virtual double getCallOrder(StelModuleActionName actionName) const
Return the value defining the order of call for the given action For example if stars.callOrder[ActionDraw] == 10 and constellation.callOrder[ActionDraw] == 11, the stars module will be drawn before the constellations.
Holds the information related to a color style for GUI and modules of Stellarium. ...
Definition: StelStyle.hpp:28
void enableLogBook(bool b)
This method is called with we detect that our hot key is pressed.
This is the common base class for all the main components of stellarium.
Definition: StelModule.hpp:49
Contains information about a Stellarium plugin.