Stellarium  0.90.0
BookmarksDialog.hpp
1 /*
2  * Stellarium
3  *
4  * Copyright (C) 2016 Alexander Wolf
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
18 */
19 
20 #ifndef _BOOKMARKSDIALOG_HPP_
21 #define _BOOKMARKSDIALOG_HPP_
22 
23 #include <QObject>
24 #include <QStandardItemModel>
25 #include <QMap>
26 #include <QDir>
27 #include <QUuid>
28 
29 #include "StelDialog.hpp"
30 #include "StelCore.hpp"
31 
32 class Ui_bookmarksDialogForm;
33 
34 struct bookmark
35 {
36  QString name;
37  QString nameI18n;
38  QString ra;
39  QString dec;
40  bool isVisibleMarker;
41  QString jd;
42  QString location;
43 };
44 Q_DECLARE_METATYPE(bookmark)
45 
47 {
48  Q_OBJECT
49 
50 public:
51  BookmarksDialog(QObject* parent);
52  virtual ~BookmarksDialog();
53 
55  void styleChanged();
56 
57 public slots:
58  void retranslate();
59 
60 protected:
62  virtual void createDialogContent();
63  Ui_bookmarksDialogForm *ui;
64 
65 private slots:
66  void addBookmarkButtonPressed();
67  void removeBookmarkButtonPressed();
68  void goToBookmarkButtonPressed();
69  void clearBookmarksButtonPressed();
70 
71  void exportBookmarks();
72  void importBookmarks();
73 
74  void selectCurrentBookmark(const QModelIndex &modelIdx);
75 
76 private:
77  enum BookmarksColumns {
78  ColumnUUID,
79  ColumnName,
80  ColumnNameI18n,
81  ColumnDate,
82  ColumnLocation,
83  ColumnCount
84  };
85  QStandardItemModel * bookmarksListModel;
86 
87  class StelCore* core;
88  class StelObjectMgr* objectMgr;
89 
90  QString bookmarksJsonPath;
91  QHash<QString, bookmark> bookmarksCollection;
92 
94  void setBookmarksHeaderNames();
95 
96  void addModelRow(int number, QString uuid, QString name, QString nameI18n = "", QString date = "", QString Location = "");
97 
98  void loadBookmarks();
99  void saveBookmarks();
100  void goToBookmark(QString uuid);
101 };
102 
103 
104 #endif // _BOOKMARKSDIALOG_HPP_
Main class for Stellarium core processing.
Definition: StelCore.hpp:48
Base class for all the GUI windows in Stellarium.
Definition: StelDialog.hpp:72
Manage the selection and queries on one or more StelObjects.