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 #pragma once 8 9 #include <QDialog> 10 #include "catalogsdb.h" 11 12 namespace Ui 13 { 14 class CatalogEditForm; 15 } 16 17 /** 18 * A simple data entry form for creating/editing catalog meta 19 * information. 20 * 21 * As this is intended to be used for custom catalogs only, the 22 * minimum for the catalog `id` is set to 23 * `CatalogsDB::custom_cat_min_id`. 24 */ 25 class CatalogEditForm : public QDialog 26 { 27 Q_OBJECT 28 29 public: 30 explicit CatalogEditForm(QWidget *parent, const CatalogsDB::Catalog &catalog, 31 const int min_id = CatalogsDB::custom_cat_min_id, 32 const bool allow_id_edit = true); 33 ~CatalogEditForm(); 34 35 /** 36 * Get the result of the catalog edit. 37 */ getCatalog()38 CatalogsDB::Catalog getCatalog() { return m_catalog; }; 39 40 private: 41 Ui::CatalogEditForm *ui; 42 CatalogsDB::Catalog m_catalog; 43 44 /** 45 * Fills the form fields with the given catalog information. 46 */ 47 void fill_form_from_catalog(); 48 }; 49