Kstars

catalogdetails.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 CATALOGDETAILS_H
8#define CATALOGDETAILS_H
9
10#include <QDialog>
11#include "catalogsdb.h"
12#include "catalogobject.h"
13#include "catalogobjectlistmodel.h"
14
15class QTimer;
16class QListWidgetItem;
17namespace Ui
18{
19class CatalogDetails;
20}
21
22/**
23 * A dialog that shows catalog information and provides facilities to
24 * edit catalog meta information and manage its contents (if the catalog
25 * is mutable). It holds its own instance of `CatalogsDB::DBManager` and
26 * can thus be instanciated with minimal dependencies on other parts of
27 * KStars.
28 *
29 * The dialog displays the 100 most visible objects matching the
30 * search query.
31 *
32 * Supported operations are insertion, deletion and editing of catalog
33 * entries.
34 *
35 * Dedublication for custom catalogs still has to be implemented.
36 */
37class CatalogDetails : public QDialog
38{
40
41 public:
42 /**
43 * How many catalog entries to show in the list.
44 */
45 static constexpr int list_size{ 10000 };
46
47 /**
48 * \param parent the parent widget, `nullptr` allowed
49 * \param db_path the path to the catalog database to be used
50 * \param catalog_id the id of the catalog to be edited
51 *
52 * If the catalog is not found, an error message will be displayed
53 * and the dialog will be closed.
54 */
55 explicit CatalogDetails(QWidget *parent, const QString &db_path,
56 const int catalog_id);
58
59 private:
60 Ui::CatalogDetails *ui;
61
62 /**
63 * The database instance for accessing a catalog database.
64 */
65 CatalogsDB::DBManager m_manager;
66
67 /**
68 * The id of the backing catalog.
69 */
70 const int m_catalog_id;
71
72 /**
73 * The backing catalog.
74 */
75 CatalogsDB::Catalog m_catalog;
76
77 /**
78 * A timer to check for idle in the filter input.
79 */
80 QTimer *m_timer;
81
82 /**
83 * A model that holds all the objects which are being viewed in a
84 * `DetailDialog`.
85 */
86 CatalogObjectListModel m_model;
87
88 private slots:
89 /** Reload the catalog meta info display. */
90 void reload_catalog();
91
92 /** Reload the displayed list of objects. */
93 void reload_objects();
94
95 /** Shows a `DetailDialog` for the double clicked list item. */
96 void show_object_details(const QModelIndex &index);
97
98 /** Opens a `CatalogEditForm` to edit the currently selected catalog. */
99 void edit_catalog_meta();
100
101 /** Opens an `AddCatalogObject` dialog to add an object to the catalog. */
102 void add_object();
103
104 /** Removes the selected objects from the catalog. */
105 void remove_objects();
106
107 /** Opens an `AddCatalogObject` dialog to edit the selected objects in the catalog. */
108 void edit_objects();
109
110 /** Opens a `CatalogCSVImport` dialog and imports objects from a csv. */
111 void import_csv();
112};
113
114#endif // CATALOGDETAILS_H
A dialog that shows catalog information and provides facilities to edit catalog meta information and ...
static constexpr int list_size
How many catalog entries to show in the list.
CatalogDetails(QWidget *parent, const QString &db_path, const int catalog_id)
Manages the catalog database and provides an interface to provide an interface to query and modify th...
Definition catalogsdb.h:183
Q_OBJECTQ_OBJECT
QObject * parent() const const
A simple struct to hold information about catalogs.
Definition catalogsdb.h:37
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:19:02 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.