summaryrefslogtreecommitdiffstats
path: root/kstars/kstars/addcatdialog.h
blob: 46b108ba0cf01b8db74439c36df9d3dbe9bf013c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/***************************************************************************
                          addcatdialog.h  -  description
                             -------------------
    begin                : Sun Mar 3 2002
    copyright            : (C) 2002 by Jason Harris
    email                : kstars@30doradus.org
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef ADDCATDIALOG_H
#define ADDCATDIALOG_H

#include <qglobal.h>
#include <qptrlist.h>

#include <kdialogbase.h>
#include <klineedit.h>
#include <kurlrequester.h>
#include "deepskyobject.h"
#include "addcatdialogui.h"
#include "draglistbox.h"

/**@class AddCatDialog
	*@short Dialog for adding custom object catalogs to KStars
	*@author Jason Harris
	*@version 1.0
	*/

class AddCatDialog : public KDialogBase  {
	Q_OBJECT
public:
/**Default constructor
	*/
	AddCatDialog( QWidget *parent=0 );

/**Destructor (empty)
	*/
	~AddCatDialog();

/**@return the name for the custom catalog.
	*/
	QString name() const { return acd->CatalogName->text(); }

/**@return the filename of the custom catalog.
	*/
	QString filename() const { return acd->CatalogURL->url(); }

private slots:
/**Display contents of the import file.
	*/
	void slotShowDataFile();

/**Create the object catalog file, populate the objectList, 
	*and close the dialog.
	*/
	void slotCreateCatalog();

/**Preview the catalog file as constructed by the current parameters
	*/
	void slotPreviewCatalog();

/**Overridden from KDialogBase to show short help in a dialog rather 
	*than launch KHelpCenter.
	*/
	void slotHelp();

/**Overridden from KDialogBase, so that the entered file can be parsed
	*before window is closed.
	*/
	void slotOk();

private:
/**Attempt to parse the user's data file according to the fields 
	*specified in the Catalog fields list.
	*/
	bool validateDataFile();

/**Write a header line describing the data fields in the catalog, and 
	*defining the catalog name, ID prefix, and coordinate epoch.
	*/
	QString writeCatalogHeader();

	QVBoxLayout *vlay;
	AddCatDialogUI *acd;
	QString CatalogContents;
};

#endif