Kstars

obslistwizard.h
1/*
2 SPDX-FileCopyrightText: 2005 Jason Harris <jharris@30doradus.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "ui_obslistwizard.h"
10#include "skyobjects/skypoint.h"
11
12#include <QDialog>
13
14class QListWidget;
15class QPushButton;
16
17class SkyObject;
18class GeoLocation;
19
20struct FilterParameters
21{
22 double maglimit;
23 bool needMagnitude;
24 bool needNoMagnitude;
25 bool needRegion;
26 bool needDate;
27 bool doBuildList;
28};
29
30class ObsListWizardUI : public QFrame, public Ui::ObsListWizard
31{
33
34 public:
35 explicit ObsListWizardUI(QWidget *p);
36};
37
38/**
39 * @class ObsListWizard
40 * @short Wizard for constructing observing lists
41 *
42 * @author Jason Harris
43 */
44class ObsListWizard : public QDialog
45{
47 public:
48 explicit ObsListWizard(QWidget *parent);
49 virtual ~ObsListWizard() override = default;
50
51 /** @return reference to QPtrList of objects selected by the wizard */
52 QList<SkyObject *> &obsList() { return ObsList; }
53
54 private slots:
55 void slotNextPage();
56 void slotPrevPage();
57 void slotAllButton();
58 void slotNoneButton();
59 void slotDeepSkyButton();
60 void slotSolarSystemButton();
61 void slotChangeLocation();
62 void slotToggleDateWidgets();
63 void slotToggleMagWidgets();
64
65 void slotParseRegion();
66
67 /** @short Construct the observing list by applying the selected filters */
68 void slotObjectCountDirty();
69 void slotUpdateObjectCount();
70 void slotApplyFilters() { applyFilters(true); }
71
72 private:
73 void initialize();
74 void applyFilters(bool doBuildList);
75
76 /** @return true if the object passes the filter region constraints, false otherwise.*/
77 bool applyMagnitudeAndRegionAndObservableFilter(SkyObject *o, FilterParameters filterParameters);
78 bool applyMagnitudeFilter(SkyObject *o, FilterParameters filterParameters);
79 bool applyRegionFilter(SkyObject *o, bool doBuildList);
80 bool applyObservableFilter(SkyObject *o, bool doBuildList);
81
82 /**
83 * Convenience function for safely getting the selected state of a QListWidget item by name.
84 * QListWidget has no method for easily selecting a single item based on its text.
85 * @return true if the named QListWidget item is selected.
86 * @param name the QListWidget item to be queried is the one whose text matches this string
87 * @param listWidget pointer to the QListWidget whose item is to be queried
88 * @param ok pointer to a bool, which if present will return true if a matching list item was found
89 */
90 bool isItemSelected(const QString &name, QListWidget *listWidget);
91 /**
92 * Convenience function for safely setting the selected state of a QListWidget item by name.
93 * QListWidget has no method for easily selecting a single item based on its text.
94 * @param name the QListWidget item to be (de)selected is the one whose text matches this string
95 * @param listWidget pointer to the QListWidget whose item is to be (de)selected
96 * @param value set the item's selected state to this bool value
97 */
98 void setItemSelected(const QString &name, QListWidget *listWidget, bool value);
99
100 QList<SkyObject *> ObsList;
101 ObsListWizardUI *olw { nullptr };
102 uint ObjectCount { 0 };
103 uint StarCount { 0 };
104 uint PlanetCount { 0 };
105 uint CometCount { 0 };
106 uint AsteroidCount { 0 };
107 uint GalaxyCount { 0 };
108 uint OpenClusterCount { 0 };
109 uint GlobClusterCount { 0 };
110 uint GasNebCount { 0 };
111 uint PlanNebCount { 0 };
112 const char* sun_moon_planets_list[9] = { // Move this def? And pNames in modCalcPlanets.cpp etc...
113 "Sun" ,"Moon" ,"Mercury" ,"Venus" ,"Mars" ,"Jupiter" ,"Saturn" ,"Uranus" ,"Neptune" };
114 const char* ALL_OVER_THE_SKY = "all over the sky";
115 const char* BY_CONSTELLATION = "by constellation";
116 const char* IN_A_RECTANGULAR_REGION = "in a rectangular region";
117 const char* IN_A_CIRCULAR_REGION = "in a circular region";
118 const int PAGE_ID_MAIN = 0;
119 const int PAGE_ID_OBJECT_TYPE = 1;
120 const int PAGE_ID_REGION_TYPE = 2;
121 const int PAGE_ID_CONSTELLATION = 3;
122 const int PAGE_ID_RECTANGULAR = 4;
123 const int PAGE_ID_CIRCULAR = 5;
124 const int PAGE_ID_DATE = 6;
125 const int PAGE_ID_MAGNITUDE = 7;
126
127 double xRect1 { 0 };
128 double xRect2 { 0 };
129 double yRect1 { 0 };
130 double yRect2 { 0 };
131 double rCirc { 0 };
132 SkyPoint pCirc;
133 GeoLocation *geo { nullptr };
134 QPushButton *nextB { nullptr };
135 QPushButton *backB { nullptr };
136
137};
138
Contains all relevant information for specifying a location on Earth: City Name, State/Province name,...
Definition geolocation.h:28
Wizard for constructing observing lists.
QList< SkyObject * > & obsList()
Provides all necessary information about an object in the sky: its coordinates, name(s),...
Definition skyobject.h:42
The sky coordinates of a point in the sky.
Definition skypoint.h:45
Q_OBJECTQ_OBJECT
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 12 2024 12:00:42 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.