moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kstars / kstars / detaildialog.h
blob94d9eac83d1a53f5f1df84845468ecd69b15f542
1 /***************************************************************************
2 detaildialog.h - description
3 -------------------
4 begin : Sun May 5 2002
5 copyright : (C) 2002 by Jason Harris
6 email : kstars@30doradus.org
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
18 #ifndef DETAILDIALOG_H
19 #define DETAILDIALOG_H
21 #include <qfile.h>
22 #include <qlabel.h>
23 #include <qptrlist.h>
24 #include <kdialogbase.h>
25 #include <ktextedit.h>
27 #include "skyobject.h"
29 class GeoLocation;
30 class QHBoxLayout;
31 class QLineEdit;
32 class QFile;
33 class QPixmap;
34 class QString;
35 class QStringList;
36 class KStars;
37 class KStarsDateTime;
39 class DetailsDataUI;
40 class DetailsPositionUI;
41 class DetailsLinksUI;
42 class DetailsDatabaseUI;
43 class DetailsLogUI;
45 struct ADVTreeData
47 QString Name;
48 QString Link;
49 int Type;
52 /**@class LogEdit is a simple derivative of KTextEdit, that just adds a
53 *focusOut() signal, emitted when the edit loses focus.
54 *@author Jason Harris
55 *@version 1.0
57 class LogEdit : public KTextEdit {
58 Q_OBJECT
59 public:
60 LogEdit( QWidget *parent=0, const char *name=0 );
61 ~LogEdit() {}
63 signals:
64 void focusOut();
66 protected:
67 void focusOutEvent( QFocusEvent *e );
70 /**@class ClickLabel is a QLabel with a clicked() signal.
71 *@author Jason Harris
72 *@version 1.0
74 class ClickLabel : public QLabel {
75 Q_OBJECT
76 public:
77 ClickLabel( QWidget *parent=0, const char *name=0 );
78 ~ClickLabel() {}
80 signals:
81 void clicked();
83 protected:
84 void mousePressEvent( QMouseEvent * ) { emit clicked(); }
87 /**@class DetailDialog is a window showing detailed information for a selected object.
88 *The window is split into four Tabs: General, Links, Advanced and Log.
89 *The General Tab displays some type-specific data about the object, as well as its
90 *present coordinates and Rise/Set/Transit times for the current date. The Type-specific
91 *data are:
92 *@li Stars: common name, genetive name, Spectral type, magnitude, distance
93 *@li Solar System: name, object type (planet/comet/asteroid), Distance, magnitude (TBD),
94 *angular size (TBD)
95 *@li Deep Sky: Common name, other names, object type, magnitude, angular size
97 *The Links Tab allows the user to manage the list of Image and Information links
98 *listed in the object's popup menu. The Advanced Tab allows the user to query
99 *a number of professional-grade online astronomical databases for data on the object.
100 *The Log tab allows the user to attach their own text notes about the object.
101 *@author Jason Harris, Jasem Mutlaq
102 *@version 1.0
105 class DetailDialog : public KDialogBase {
106 Q_OBJECT
107 public:
108 /**Constructor
110 DetailDialog(SkyObject *o, const KStarsDateTime &ut, GeoLocation *geo, QWidget *parent=0, const char *name=0);
112 /**Destructor (empty)
114 ~DetailDialog() {}
116 QPixmap* thumbnail() { return Thumbnail; }
118 public slots:
119 /**@short Add this object to the observing list.
121 void addToObservingList();
123 /**@short Center this object in the display.
125 void centerMap();
127 /**@short Center this object in the telescope.
129 void centerTelescope();
131 /**@short Display thumbnail image for the object
133 void showThumbnail();
135 /**@short Update thumbnail image for the object
137 void updateThumbnail();
139 /**@short View the selected image or info URL in the web browser.
141 void viewLink();
143 /**@short Unselect the currently selected item in the Images list
144 *@note used when an item is selected in the Info list
146 void unselectImagesList();
148 /**@short Unselect the currently selected item in the Info list
149 *@note used when an item is selected in the Images list
151 void unselectInfoList();
153 /**@short Rebuild the Image and Info URL lists for this object.
154 *@note used when an item is added to either list.
156 void updateLists();
158 /**@short Open a dialog to edit a URL in either the Images or Info lists,
159 *and update the user's *url.dat file.
161 void editLinkDialog();
163 /**@short remove a URL entry from either the Images or Info lists, and
164 *update the user's *url.dat file.
166 void removeLinkDialog();
168 /**Open the web browser to the selected online astronomy database,
169 *with a query to the object of this Detail Dialog.
171 void viewADVData();
173 /**Save the User's text in the Log Tab to the userlog.dat file.
175 void saveLogData();
177 private:
179 /**Read in the user's customized URL file (either images or info webpages),
180 *and store the file's lines in a QStringList.
181 *@param type 0=Image URLs; 1=Info URLs
183 bool readUserFile(int type);
185 /**Parse the QStringList containing the User's URLs.
186 *@param type 0=Image URLs; 1=Info URLs
188 bool verifyUserData(int type);
190 /**Build the General Data Tab for the current object.
192 void createGeneralTab();
194 /**Build the Position Tab for the current object.
196 void createPositionTab( const KStarsDateTime &ut, GeoLocation *geo );
198 /**Build the Links Tab, populating the image and info lists with the
199 *known URLs for the current Object.
201 void createLinksTab();
203 /**Build the Advanced Tab
205 void createAdvancedTab();
207 /**Build the Log Tab
209 void createLogTab();
212 /**Populate the TreeView of known astronomical databases in the Advanced Tab
214 void populateADVTree(QListViewItem *parent);
216 /**For the databases TreeView
218 void forkTree(QListViewItem *parent);
220 /**Data for the Advanced Tab TreeView is stored in the file advinterface.dat.
221 *This function parses advinterface.dat.
223 QString parseADVData(QString link);
226 SkyObject *selectedObject;
227 KStars* ksw;
229 // Edit Link Dialog
230 QHBoxLayout *editLinkLayout;
231 QLabel *editLinkURL;
232 QLineEdit *editLinkField;
233 QFile file;
234 QPixmap *Thumbnail;
235 int currentItemIndex;
236 QString currentItemURL, currentItemTitle;
237 QStringList dataList;
239 QPtrListIterator<ADVTreeData> * treeIt;
241 DetailsDataUI *Data;
242 DetailsPositionUI *Pos;
243 DetailsLinksUI *Links;
244 DetailsDatabaseUI *Adv;
245 DetailsLogUI *Log;
249 #endif