Stellarium 0.15.2
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 jd;
39  QString location;
40 };
41 Q_DECLARE_METATYPE(bookmark)
42 
44 {
45  Q_OBJECT
46 
47 public:
48  BookmarksDialog(QObject* parent);
49  virtual ~BookmarksDialog();
50 
52  void styleChanged();
53 
54 public slots:
55  void retranslate();
56 
57 protected:
59  virtual void createDialogContent();
60  Ui_bookmarksDialogForm *ui;
61 
62 private slots:
63  void addBookmarkButtonPressed();
64  void removeBookmarkButtonPressed();
65  void goToBookmarkButtonPressed();
66  void clearBookmarksButtonPressed();
67 
68  void selectCurrentBookmark(const QModelIndex &modelIdx);
69 
70 private:
71  enum BookmarksColumns {
72  ColumnUUID,
73  ColumnName,
74  ColumnNameI18n,
75  ColumnDate,
76  ColumnLocation,
77  ColumnCount
78  };
79  QStandardItemModel * bookmarksListModel;
80 
81  class StelCore* core;
82  class StelObjectMgr* objectMgr;
83 
84  QString bookmarksJsonPath;
85  QHash<QString, bookmark> bookmarksCollection;
86 
88  void setBookmarksHeaderNames();
89 
90  void addModelRow(int number, QString uuid, QString name, QString nameI18n = "", QString date = "", QString Location = "");
91 
92  void loadBookmarks();
93  void saveBookmarks();
94  void goToBookmark(QString uuid);
95 };
96 
97 
98 #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.