Kstars

addcatalogobject.h
1 /*
2  SPDX-FileCopyrightText: 2021 Valentin Boettcher <hiro at protagon.space; @hiro98:tchncs.de>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #ifndef ADDCATALOGOBJECT_H
8 #define ADDCATALOGOBJECT_H
9 
10 #include <QDialog>
11 #include "catalogobject.h"
12 
13 namespace Ui
14 {
15 class AddCatalogObject;
16 }
17 
18 /**
19  * A simple data entry dialog to create and edit objects in
20  * `CatalogDB` catalogs. It takes a `CatalogObject` and mutates it
21  * according to user input.
22  *
23  * After the dialog is closed, the contained can then be retrieved by
24  * calling `get_object`.
25  */
26 class AddCatalogObject : public QDialog
27 {
28  Q_OBJECT
29 
30  public:
31  /**
32  * \param parent the parent widget, nullptr allowed
33  * \parame obj the objects to be mutated, default constructed by default
34  */
35  explicit AddCatalogObject(QWidget *parent, const CatalogObject &obj = {});
37 
38  /**
39  * Retrieve the edited object.
40  */
41  CatalogObject get_object() { return m_object; }
42 
43  private:
44  Ui::AddCatalogObject *ui;
45 
46  /** The object to be edited. */
47  CatalogObject m_object;
48 
49  /** Fill the form fields with the information from the object. */
50  void fill_form_from_object();
51 
52  /** Enable/Disable the `flux` field depending on object type. */
53  void refresh_flux();
54 
55  /** Guess the contents of the form by parsing the supplied text. */
56  void guess_form_contents_from_text(QString text);
57 
58  private slots:
59  /** Overload of the above that prompts for the text using an input box. */
60  void guess_form_contents_from_text();
61 };
62 
63 #endif // ADDCATALOGOBJECT_H
Q_OBJECTQ_OBJECT
CatalogObject get_object()
Retrieve the edited object.
A simple data entry dialog to create and edit objects in CatalogDB catalogs.
AddCatalogObject(QWidget *parent, const CatalogObject &obj={})
A simple container object to hold the minimum information for a Deeb Sky Object to be drawn on the sk...
Definition: catalogobject.h:40
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 12 2022 04:00:52 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.