1 /* 2 SPDX-FileCopyrightText: 2002 Jason Harris <kstars@30doradus.org> 3 4 SPDX-License-Identifier: GPL-2.0-or-later 5 */ 6 7 #pragma once 8 9 #include "ui_addcatdialog.h" 10 11 class AddCatDialogUI : public QFrame, public Ui::AddCatDialog 12 { 13 Q_OBJECT 14 15 public: 16 explicit AddCatDialogUI(QWidget *parent = nullptr); 17 }; 18 19 /** 20 * @class AddCatDialog 21 * @short Dialog for adding custom object catalogs to KStars 22 * 23 * @author Jason Harris 24 * @version 1.0 25 */ 26 class AddCatDialog : public QDialog 27 { 28 Q_OBJECT 29 30 public: 31 explicit AddCatDialog(QWidget *parent); 32 33 /** @return the name for the custom catalog. */ name()34 QString name() const { return acd->CatalogName->text(); } 35 36 /** @return the filename of the custom catalog. */ filename()37 QString filename() const { return acd->CatalogURL->url().toLocalFile(); } 38 39 private slots: 40 /** Display contents of the import file. */ 41 void slotShowDataFile(); 42 43 /** Create the object catalog file, populate the objectList, and close the dialog. */ 44 void slotCreateCatalog(); 45 46 /** Preview the catalog file as constructed by the current parameters */ 47 void slotPreviewCatalog(); 48 49 /** Overridden from QDialog to show short help in a dialog rather than launch KHelpCenter. */ 50 void slotHelp(); 51 52 private: 53 /** 54 * Attempt to parse the user's data file according to the fields 55 * specified in the Catalog fields list. 56 */ 57 bool validateDataFile(); 58 59 /** 60 * Write a header line describing the data fields in the catalog, and 61 * defining the catalog name, ID prefix, and coordinate epoch. 62 */ 63 QString writeCatalogHeader(); 64 65 AddCatDialogUI *acd { nullptr }; 66 QString CatalogContents; 67 }; 68