Kstars

wiview.h
1/*
2 SPDX-FileCopyrightText: 2012 Samikshan Bairagya <samikshan@gmail.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include <QString>
10#include <QWidget>
11
12#include <memory>
13
15class QQmlContext;
16class QQuickItem;
17class QQuickView;
18
19class ModelManager;
20class ObsConditions;
21class SkyObject;
22class SkyObjItem;
23
24/**
25 * @class WIView
26 * @brief Manages the QML user interface for What's Interesting. WIView is used to display the
27 * QML UI using a QQuickView. It acts on all signals emitted by the UI and manages the data
28 * sent to the UI for display.
29 *
30 * @author Samikshan Bairagya
31 */
32class WIView : public QWidget
33{
35 public:
36 /**
37 * @brief Constructor - Store QML components as QObject pointers.
38 * Connect signals from various QML components into public slots.
39 * Displays the user interface for What's Interesting
40 */
41 explicit WIView(QWidget *parent = nullptr);
42
43 virtual ~WIView() override = default;
44
45 /** Load details-view for selected sky-object */
46 void loadDetailsView(SkyObjItem *soitem, int index);
47
48 /** Updates sky-object list models */
49 void updateModel(ObsConditions& obs);
50
51 inline QQuickView *getWIBaseView() const { return m_BaseView; }
52
53 public slots:
54
55 /**
56 * @brief public slot - Act upon signal emitted when category of sky-object is selected
57 * from category selection view of the QML UI.
58 * @param model Category selected
59 */
60 void onCategorySelected(QString model);
61
62 /**
63 * @brief public slot - Act upon signal emitted when an item is selected from list of sky-objects.
64 * Display details-view for the skyobject selected.
65 * @param index Index of item in the list of skyobjects.
66 */
67 void onSoListItemClicked(int index);
68
69 /** public slot - Show details-view for next sky-object from list of current sky-objects's category. */
70 void onNextObjClicked();
71
72 /**
73 * @brief public slot - Show details-view for previous sky-object from list of current sky-objects's
74 * category.
75 */
76 void onPrevObjClicked();
77
78 /** public slot - Slew map to current sky-object in the details view. */
80
81 /** public slot - Slew map to current sky-object in the details view. */
83
84 /** public slot - Open Details Dialog to show more details for current sky-object. */
86
87 /** public slot - Open WI settings dialog. */
89
90 void onInspectIconClicked(bool checked) { inspectOnClick = checked; }
91
92 /** public slot - Reload list of visible sky-objects. */
94
95 void onVisibleIconClicked(bool checked);
96
97 void onFavoriteIconClicked(bool checked);
98
99 void onUpdateIconClicked();
100
101 void updateWikipediaDescription(SkyObjItem *soitem);
102 void loadObjectDescription(SkyObjItem *soitem);
103 void tryToUpdateWikipediaInfo(SkyObjItem *soitem, QString name);
104 void loadObjectInfoBox(SkyObjItem *soitem);
105 void saveImageURL(SkyObjItem *soitem, QString imageURL);
106 void saveInfoURL(SkyObjItem *soitem, QString infoURL);
107 void saveObjectInfoBoxText(SkyObjItem *soitem, QString type, QString infoText);
108 void downloadWikipediaImage(SkyObjItem *soitem, QString imageURL);
109 void inspectSkyObject(const QString& name);
110 void inspectSkyObjectOnClick(SkyObject *obj);
111 void inspectSkyObject(SkyObject *obj);
112 bool inspectOnClickIsActive() { return inspectOnClick; }
114 void tryToUpdateWikipediaInfoInModel(bool onlyMissing);
115 void refreshListView();
116 void updateProgress(double value);
117 void setProgressBarVisible(bool visible);
118 void setNightVisionOn(bool on);
119
120 private:
121 QString getWikipediaName(SkyObjItem *soitem);
122
123 QQuickItem *m_BaseObj { nullptr };
124 QQuickItem *m_ViewsRowObj { nullptr };
125 QQuickItem *m_CategoryTitle { nullptr };
126 QQuickItem *m_SoListObj { nullptr };
127 QQuickItem *m_DetailsViewObj { nullptr };
128 QQuickItem *m_ProgressBar { nullptr };
129 QQuickItem *m_loadingMessage { nullptr };
130 QQuickItem *m_NextObj { nullptr };
131 QQuickItem *m_PrevObj { nullptr };
132 QQuickItem *m_CenterButtonObj { nullptr };
133 QQuickItem *m_SlewTelescopeButtonObj { nullptr };
134 QQuickItem *m_DetailsButtonObj { nullptr };
135 QQuickItem *inspectIconObj { nullptr };
136 QQuickItem *visibleIconObj { nullptr };
137 QQuickItem *favoriteIconObj { nullptr };
138 QQmlContext *m_Ctxt { nullptr };
139 QObject *infoBoxText { nullptr };
140 QObject *descTextObj { nullptr };
141 QObject *nightVision { nullptr };
142 QObject *autoTrackCheckbox { nullptr };
143 QObject *autoCenterCheckbox { nullptr };
144
145 QQuickView *m_BaseView { nullptr };
146 ObsConditions *m_Obs { nullptr };
147 std::unique_ptr<ModelManager> m_ModManager;
148 /// Current sky object item.
149 SkyObjItem *m_CurSoItem { nullptr };
150 /// Created sky object item on-demand
151 std::unique_ptr<SkyObjItem> trackedItem;
152 /// Index of current sky-object item in Details view.
153 int m_CurIndex { 0 };
154 /// Currently selected category from WI QML view
155 QString m_CurrentObjectListName;
156 std::unique_ptr<QNetworkAccessManager> manager;
157 bool inspectOnClick { false };
158};
Manages models for QML listviews of different types of sky-objects.
This class deals with the observing conditions of the night sky.
Represents an item in the list of interesting sky-objects.
Definition skyobjitem.h:21
Provides all necessary information about an object in the sky: its coordinates, name(s),...
Definition skyobject.h:42
Manages the QML user interface for What's Interesting.
Definition wiview.h:33
void loadDetailsView(SkyObjItem *soitem, int index)
Load details-view for selected sky-object.
Definition wiview.cpp:505
void onSettingsIconClicked()
public slot - Open WI settings dialog.
Definition wiview.cpp:387
void onReloadIconClicked()
public slot - Reload list of visible sky-objects.
Definition wiview.cpp:393
void onSoListItemClicked(int index)
public slot - Act upon signal emitted when an item is selected from list of sky-objects.
Definition wiview.cpp:282
void onDetailsButtonClicked()
public slot - Open Details Dialog to show more details for current sky-object.
Definition wiview.cpp:374
void onNextObjClicked()
public slot - Show details-view for next sky-object from list of current sky-objects's category.
Definition wiview.cpp:289
void onCenterButtonClicked()
public slot - Slew map to current sky-object in the details view.
Definition wiview.cpp:317
void onCategorySelected(QString model)
public slot - Act upon signal emitted when category of sky-object is selected from category selection...
Definition wiview.cpp:254
void updateModel(ObsConditions &obs)
Updates sky-object list models.
Definition wiview.cpp:464
WIView(QWidget *parent=nullptr)
Constructor - Store QML components as QObject pointers.
Definition wiview.cpp:40
void onSlewTelescopeButtonClicked()
public slot - Slew map to current sky-object in the details view.
Definition wiview.cpp:332
void updateObservingConditions()
Definition wiview.cpp:215
void onPrevObjClicked()
public slot - Show details-view for previous sky-object from list of current sky-objects's category.
Definition wiview.cpp:303
Q_OBJECTQ_OBJECT
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:47 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.