1 /***************************************************************************
2 detaildialog.h - description
5 copyright : (C) 2002 by Jason Harris
6 email : kstars@30doradus.org
7 ***************************************************************************/
9 /***************************************************************************
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. *
16 ***************************************************************************/
18 #ifndef DETAILDIALOG_H
19 #define DETAILDIALOG_H
24 #include <kdialogbase.h>
25 #include <ktextedit.h>
27 #include "skyobject.h"
40 class DetailsPositionUI
;
42 class DetailsDatabaseUI
;
52 /**@class LogEdit is a simple derivative of KTextEdit, that just adds a
53 *focusOut() signal, emitted when the edit loses focus.
57 class LogEdit
: public KTextEdit
{
60 LogEdit( QWidget
*parent
=0, const char *name
=0 );
67 void focusOutEvent( QFocusEvent
*e
);
70 /**@class ClickLabel is a QLabel with a clicked() signal.
74 class ClickLabel
: public QLabel
{
77 ClickLabel( QWidget
*parent
=0, const char *name
=0 );
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
92 *@li Stars: common name, genetive name, Spectral type, magnitude, distance
93 *@li Solar System: name, object type (planet/comet/asteroid), Distance, magnitude (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
105 class DetailDialog
: public KDialogBase
{
110 DetailDialog(SkyObject
*o
, const KStarsDateTime
&ut
, GeoLocation
*geo
, QWidget
*parent
=0, const char *name
=0);
112 /**Destructor (empty)
116 QPixmap
* thumbnail() { return Thumbnail
; }
119 /**@short Add this object to the observing list.
121 void addToObservingList();
123 /**@short Center this object in the display.
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.
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.
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.
173 /**Save the User's text in the Log Tab to the userlog.dat file.
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();
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
;
230 QHBoxLayout
*editLinkLayout
;
232 QLineEdit
*editLinkField
;
235 int currentItemIndex
;
236 QString currentItemURL
, currentItemTitle
;
237 QStringList dataList
;
239 QPtrListIterator
<ADVTreeData
> * treeIt
;
242 DetailsPositionUI
*Pos
;
243 DetailsLinksUI
*Links
;
244 DetailsDatabaseUI
*Adv
;