File indexing completed on 2025-01-19 12:35:03
0001 /* 0002 SPDX-FileCopyrightText: 2021 Valentin Boettcher <hiro at protagon.space; @hiro98:tchncs.de> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <QDialog> 0010 #include "catalogsdb.h" 0011 0012 namespace Ui 0013 { 0014 class CatalogEditForm; 0015 } 0016 0017 /** 0018 * A simple data entry form for creating/editing catalog meta 0019 * information. 0020 * 0021 * As this is intended to be used for custom catalogs only, the 0022 * minimum for the catalog `id` is set to 0023 * `CatalogsDB::custom_cat_min_id`. 0024 */ 0025 class CatalogEditForm : public QDialog 0026 { 0027 Q_OBJECT 0028 0029 public: 0030 explicit CatalogEditForm(QWidget *parent, const CatalogsDB::Catalog &catalog, 0031 const int min_id = CatalogsDB::custom_cat_min_id, 0032 const bool allow_id_edit = true); 0033 ~CatalogEditForm(); 0034 0035 /** 0036 * Get the result of the catalog edit. 0037 */ 0038 CatalogsDB::Catalog getCatalog() { return m_catalog; }; 0039 0040 private: 0041 Ui::CatalogEditForm *ui; 0042 CatalogsDB::Catalog m_catalog; 0043 0044 /** 0045 * Fills the form fields with the given catalog information. 0046 */ 0047 void fill_form_from_catalog(); 0048 };