1 /* 2 * Stellarium 3 * Copyright (C) 2020 Jocelyn GIROD 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License along 16 * with this program; if not, write to the Free Software Foundation, Inc., 17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 */ 19 20 #ifndef OBSLISTDIALOG_H 21 #define OBSLISTDIALOG_H 22 23 #include <QObject> 24 #include <QStandardItemModel> 25 26 #include "StelDialog.hpp" 27 #include "StelCore.hpp" 28 #include "ObsListCreateEditDialog.hpp" 29 #include "ObservingListCommon.hpp" 30 31 class Ui_obsListDialogForm; 32 33 class ObsListDialog : public StelDialog 34 { 35 Q_OBJECT 36 37 public: 38 ObsListDialog ( QObject* parent ); 39 virtual ~ObsListDialog() Q_DECL_OVERRIDE; 40 41 //! Notify that the application style changed 42 virtual void styleChanged() Q_DECL_OVERRIDE; 43 44 protected: 45 Ui_obsListDialogForm *ui; 46 //! Initialize the dialog widgets and connect the signals/slots. 47 virtual void createDialogContent() Q_DECL_OVERRIDE; 48 49 private: 50 QStandardItemModel * obsListListModel; 51 class StelCore* core; 52 class StelObjectMgr* objectMgr; 53 class LabelMgr* labelMgr; 54 std::string selectedObservingListUuid; 55 QString observingListJsonPath; 56 QHash<QString, observingListItem> observingListItemCollection; 57 QList<int> highlightLabelIDs; 58 QString defaultListUuid_; 59 60 //! Set header names for observing list table 61 void setObservingListHeaderNames(); 62 63 void invokeObsListCreateEditDialog ( std::string listUuid ); 64 65 ObsListCreateEditDialog * createEditDialog_instance; 66 67 //! Add row in the obsListListModel 68 //! @param number row number 69 //! @param uuid id of the record 70 //! @param name name or the designation of the object 71 //! @param type type of the object 72 //! @param ra right ascencion of the object 73 //! @param dec declination of the object 74 //! @param magnitude magnitude of the object 75 //! @param constellation constellation in which the object is located 76 void addModelRow ( int number, QString uuid, QString name, QString nameI18n, QString type, QString ra, QString dec, QString magnitude, QString constellation ); 77 78 //! Load the selected observing list 79 //! @param listUuid the uuid of the list 80 void loadObservingList ( QString listUuid ); 81 82 //! Load the lists names for populate the combo box and get the default list uuid 83 void loadListsName(); 84 85 //! Load the default list 86 void loadDefaultList(); 87 88 //! Load list from JSON file 89 QVariantList loadListFromJson(QFile &jsonFile, QString listUuid); 90 91 92 public slots: 93 virtual void retranslate() Q_DECL_OVERRIDE; 94 95 private slots: 96 void obsListHighLightAllButtonPressed(); 97 void obsListClearHighLightButtonPressed(); 98 void obsListNewListButtonPressed(); 99 void obsListEditButtonPressed(); 100 void obsListCreateEditDialogClosed(); 101 void obsListExitButtonPressed(); 102 void obsListDeleteButtonPressed(); 103 104 //! Method called when a list name is selected in the combobox 105 //! @param selectedIndex the index of the list name in the combo box 106 void loadSelectedObservingList ( int selectedIndex ); 107 108 //! Select and go to object 109 //! @param index the QModelIndex of the list 110 void selectAndGoToObject ( QModelIndex index ); 111 }; 112 113 #endif // OBSLISTDIALOG_H 114