Kstars

viewsdialog.h
1/*
2 SPDX-FileCopyrightText: 2003 Jason Harris <kstars@30doradus.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#ifndef VIEWSDIALOG_H_
8#define VIEWSDIALOG_H_
9
10#include <QPaintEvent>
11#include <QDialog>
12#include <QDoubleSpinBox>
13#include <QStringList>
14#include <QStringListModel>
15#include <optional>
16#include "skymapview.h"
17
18#include "ui_viewsdialog.h"
19#include "ui_newview.h"
20
21class ViewsDialogUI : public QFrame, public Ui::ViewsDialog
22{
24 public:
25 explicit ViewsDialogUI(QWidget *parent = nullptr);
26};
27
28class ViewsDialogStringListModel : public QStringListModel
29{
30 public:
31 explicit ViewsDialogStringListModel(QObject* parent = nullptr)
33
34 Qt::ItemFlags flags(const QModelIndex &index) const override;
35};
36
37/**
38 * @class ViewsDialog
39 * @brief ViewsDialog is dialog to select a Sky Map View (or create a new one)
40 *
41 * A sky map view is a collection of settings that defines the
42 * orientation and scale of the sky map and how it changes as the user
43 * pans around.
44 *
45 * @author Akarsh Simha
46 * @version 1.0
47 */
48class ViewsDialog : public QDialog
49{
51 public:
52 explicit ViewsDialog(QWidget *parent = nullptr);
53
54 private slots:
55 void slotNewView();
56 void slotEditView();
57 void slotRemoveView();
58 void slotSelectionChanged(const QModelIndex &, const QModelIndex &);
59
60 private:
61
62 /** Sync the model from the view manager */
63 void syncModel();
64
65 /** Sync the model to the view manager */
66 void syncFromModel();
67
68 QStringListModel* m_model;
69 unsigned int currentItem() const;
70 ViewsDialogUI *ui;
71 static int viewID;
72};
73
74/**
75 * @class NewView
76 * Dialog for defining a new View
77 * @author Akarsh Simha
78 * @version 1.0
79 */
80class NewView : public QDialog, private Ui::NewView
81{
83 public:
84 /** Create new dialog
85 * @param parent parent widget
86 * @param view to copy data from. If it's empty will create empty one.
87 */
88 explicit NewView(QWidget *parent = nullptr, std::optional<SkyMapView> view = std::nullopt);
89 ~NewView() override;
90
91 /** Return the view struct. */
92 const SkyMapView getView() const;
93
94 public slots:
95 void updateViewingAnglePreviews();
96 virtual void done(int r) override;
97
98 private:
99 QString m_originalName;
100 QPixmap *m_observerPixmap; // Icon for an observer
101 QPixmap *m_topPreview, *m_bottomPreview;
102};
103
104#endif
Dialog for defining a new View.
Definition viewsdialog.h:81
const SkyMapView getView() const
Return the view struct.
NewView(QWidget *parent=nullptr, std::optional< SkyMapView > view=std::nullopt)
Create new dialog.
ViewsDialog is dialog to select a Sky Map View (or create a new one)
Definition viewsdialog.h:49
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const override
Q_OBJECTQ_OBJECT
QObject * parent() const const
typedef ItemFlags
Carries parameters of a sky map view.
Definition skymapview.h:19
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:42 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.