moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kstars / kstars / kstars.h
blob3dba7bbbcc1c4f3d3bca9fb1ff34f0279d7b9264
1 /***************************************************************************
2 kstars.h - K Desktop Planetarium
3 -------------------
4 begin : Mon Feb 5 01:11:45 PST 2001
5 copyright : (C) 2001 by Jason Harris
6 email : jharris@30doradus.org
7 ***************************************************************************/
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
17 #ifndef KSTARS_H
18 #define KSTARS_H
20 #ifdef HAVE_CONFIG_H
21 #include <config.h>
22 #endif
24 #include <dcopclient.h>
25 #include <kapplication.h>
26 #include <kmainwindow.h>
27 #include <qwidget.h>
29 #include "kstarsinterface.h"
30 #include "observinglist.h"
32 // forward declaration is enough. We only need pointers
33 class QPalette;
34 class QVBoxLayout;
35 class KActionMenu;
36 class KDialogBase;
37 class KKey;
38 class KToolBar;
40 class dms;
41 class KSNewStuff;
42 class KStarsData;
43 class KStarsSplash;
44 class SkyMap;
45 class GeoLocation;
46 class FindDialog;
47 class LocationDialog;
48 class TimeDialog;
49 class ViewOpsDialog;
50 class InfoBoxes;
51 class ToggleAction;
52 class TimeStepBox;
54 //class AstroCalc;
55 class INDIMenu;
56 class INDIDriver;
57 class imagesequence;
59 /**@class KStars
60 *This is the main window for KStars. It is derived from KMainWindow.
61 *In addition to the GUI elements, the class contains the program clock,
62 *KStarsData, and SkyMap objects.
63 *It also contains functions for the DCOP interface.
64 *@short KStars base class
65 *@author Jason Harris
66 *@version 1.0
69 class KStars : public KMainWindow, virtual public KStarsInterface
72 Q_OBJECT
73 public:
74 /**Constructor.
75 *@param kstarsData the KStars Data object
77 KStars( KStarsData* kstarsData );
79 /**Constructor.
80 *@param doSplash should the splash panel be displayed during
81 *initialization.
82 *@param startClockRunning should the clock be running on startup?
84 KStars( bool doSplash, bool startClockRunning = true, const QString &startDateString = "" );
86 /**Destructor. Synchs config file. Deletes objects.
88 ~KStars();
90 /**@return pointer to KStarsData object which contains application data.
92 KStarsData* data();
94 /**@return pointer to the local sidereal time.
96 dms* LST();
98 /**@return pointer to SkyMap object which is the sky display widget.
100 SkyMap* map();
102 ObservingList* observingList();
104 /**@return pointer to GeoLocation object which is the current geographic location.
106 GeoLocation* geo();
108 /**@return pointer to InfoBoxes object.
110 InfoBoxes* infoBoxes();
112 /**@returns pointer to the INDI driver
114 INDIDriver* getINDIDriver(void) { return indidriver; }
116 /**@returns pointer to the INDI menu
118 INDIMenu* getINDIMenu(void) { return indimenu; }
120 /** Establish the INDI system. No GUI
122 void establishINDI();
124 /**Add an item to the color-scheme action manu
125 *@param name The name to use in the menu
126 *@param actionName The internal name for the action (derived from filename)
128 void addColorMenuItem( QString name, QString actionName );
130 void removeColorMenuItem( QString actionName );
132 /**DCOP interface function. Set focus to given Ra/Dec coordinates */
133 ASYNC setRaDec( double ra, double dec );
135 /**DCOP interface function. Set focus to given Alt/Az coordinates. */
136 ASYNC setAltAz(double alt, double az);
138 /**DCOP interface function.
139 *Point in the direction described by the string argument. */
140 ASYNC lookTowards( const QString direction );
142 /**DCOP interface function. Zoom in. */
143 ASYNC zoomIn(void) { slotZoomIn(); };
145 /**DCOP interface function. Zoom out. */
146 ASYNC zoomOut(void){ slotZoomOut(); };
148 /**DCOP interface function. Default Zoom. */
149 ASYNC defaultZoom(void) { slotDefaultZoom(); }
151 /**DCOP interface function. Set ZoomLevel manually. */
152 ASYNC zoom(double);
154 /**DCOP interface function. Set local time and date. */
155 ASYNC setLocalTime(int yr, int mth, int day, int hr, int min, int sec);
157 /**DCOP interface function. Pause for t seconds. */
158 ASYNC waitFor( double t );
160 /**DCOP interface function. Pause until Key k is pressed. */
161 ASYNC waitForKey( const QString k );
163 /**DCOP interface function. Toggle tracking. */
164 ASYNC setTracking( bool track );
166 /**DCOP interface function. modify option. */
167 ASYNC changeViewOption( const QString option, const QString value );
169 /**DCOP interface function. Show text message in a popup window. */
170 ASYNC popupMessage( int x, int y, const QString message );
172 /**DCOP interface function. Draw a line on the sky. */
173 ASYNC drawLine( int x1, int y1, int x2, int y2, int speed );
175 /**DCOP interface function. Set the geographic location. */
176 ASYNC setGeoLocation( const QString city, const QString province, const QString country );
178 /**DCOP interface function. Set a color. */
179 ASYNC setColor( const QString colorName, const QString value );
181 /**DCOP interface function. Load a color scheme. */
182 ASYNC loadColorScheme( const QString name );
184 /**DCOP interface function. Export the sky image to a file. */
185 ASYNC exportImage( const QString filename, int width, int height );
187 /**DCOP interface function. Print the sky image. */
188 ASYNC printImage( bool usePrintDialog, bool useChartColors );
190 /**DCOP interface function. Establish an INDI driver. */
191 ASYNC startINDI (QString driverName, bool useLocal);
193 /**DCOP interface function. Shutdown an INDI driver. */
194 ASYNC shutdownINDI (QString driverName);
196 /**DCOP interface function. Turn INDI driver on/off. */
197 ASYNC switchINDI(QString driverName, bool turnOn);
199 /**DCOP interface function. Set INDI connection port. */
200 ASYNC setINDIPort(QString driverName, QString port);
202 /**DCOP interface function. Set INDI target RA/DEC. */
203 ASYNC setINDITargetCoord(QString driverName, double RA, double DEC);
205 /**DCOP interface function. Set INDI target RA/DEC. */
206 ASYNC setINDITargetName(QString driverName, QString objectName);
208 /**DCOP interface function. Set INDI target by name lookup. */
209 ASYNC setINDIAction(QString driverName, QString action);
211 /**DCOP interface function. Set INDI target by name lookup. */
212 ASYNC waitForINDIAction(QString driverName, QString action);
214 /**DCOP interface function. Set INDI focus speed. */
215 ASYNC setINDIFocusSpeed(QString driverName, QString action);
217 /**DCOP interface function. Set INDI focus direction and focus. */
218 ASYNC startINDIFocus(QString driverName, int focusDir);
220 /**DCOP interface function. Set INDI geographical information. */
221 ASYNC setINDIGeoLocation(QString driverName, double longitude, double latitude);
223 /**DCOP interface function. Sets focus operation timeout. */
224 ASYNC setINDIFocusTimeout(QString driverName, int timeout);
226 /**DCOP interface function. Start camera exposure with a timeout. */
227 ASYNC startINDIExposure(QString driverName, int timeout);
229 /**DCOP interface function. Set INDI UTC date and time. */
230 ASYNC setINDIUTC(QString driverName, QString UTCDateTime);
232 /**DCOP interface function. Set INDI Telescope action. */
233 ASYNC setINDIScopeAction(QString deviceName, QString action);
235 /**DCOP interface function. Set CCD camera frame type. */
236 ASYNC setINDIFrameType(QString deviceName, QString type);
238 /**DCOP interface function. Set CCD target temperature. */
239 ASYNC setINDIFilterNum(QString deviceName, int filter_num);
241 /**DCOP interface function. Set CCD target temperature. */
242 ASYNC setINDICCDTemp(QString deviceName, int temp);
244 public slots:
246 *Update time-dependent data and (possibly) repaint the sky map.
248 void updateTime( const bool automaticDSTchange = true );
251 *Apply new settings and redraw skymap
253 void slotApplySettings( void );
256 *Zoom in
258 void slotZoomIn();
261 *Zoom out
263 void slotZoomOut();
265 void slotDefaultZoom();
266 void slotSetZoom();
269 *action slot: Toggle whether kstars is tracking current position
271 void slotTrack();
274 *action slot: open dialog for selecting a new geographic location
276 void slotGeoLocator();
278 /* Delete FindDialog because ObjNames list has changed in KStarsData due to
279 *reloading star data. So list in FindDialog must be new filled with current data.
281 void clearCachedFindDialog();
283 void resumeDCOP( void ) { kapp->dcopClient()->resume(); }
285 void slotClearAllTrails();
287 private slots:
289 *action slot: synch kstars clock to system time
291 void slotSetTimeToNow();
294 *action slot: open a dialog for setting the time and date
296 void slotSetTime();
299 *action slot: toggle whether kstars clock is running or not
301 void slotToggleTimer();
304 *action slot: open dialog for finding a named object
306 void slotFind();
309 * action slot: open KStars setup wizard
311 void slotWizard();
314 * action slot: open KNewStuff window to download extra data.
316 void slotDownload();
319 * action slot: open KStars calculator to compute astronomical
320 * ephemeris
323 void slotCalculator();
326 * action slot: open KStars AAVSO Light Curve Generator
329 void slotLCGenerator();
332 * action slot: open Elevation vs. Time tool
335 void slotAVT();
338 * action slot: open What's up tonight dialog
340 void slotWUT();
343 * action slot: open ScriptBuilder dialog
345 void slotScriptBuilder();
348 * action slot: open Solar system viewer
350 void slotSolarSystem();
353 * action slot: open Jupiter Moons tool
355 void slotJMoonTool();
358 * action slot: open Telescope wizard
360 void slotTelescopeWizard();
363 * action slot: open Image Sequence dialog
365 void slotImageSequence();
368 * action slot: open INDI driver panel
370 void slotINDIDriver();
373 * action slot: open INDI control panel
375 void slotINDIPanel();
378 * action slot: open INDI configuration dialog
380 void slotINDIConf();
383 *action slot: open dialog for setting the view options
385 void slotViewOps();
387 /** finish setting up after the kstarsData has finished
389 void datainitFinished(bool worked);
391 /**Open new KStars window. */
392 void newWindow();
394 /**Close KStars window. */
395 void closeWindow();
397 /** Open FITS image. */
398 void slotOpenFITS();
400 /**Action slot to save the sky image to a file.*/
401 void slotExportImage();
403 /**Action slot to select a DCOP script and run it.*/
404 void slotRunScript();
406 /**Action slot to print skymap. */
407 void slotPrint();
409 /**Action slot to show tip-of-the-day window. */
410 void slotTipOfDay();
412 /**Action slot to set focus coordinates manually (opens FocusDialog). */
413 void slotManualFocus();
415 /**Meta-slot to point the focus at special points (zenith, N, S, E, W).
416 *Uses the name of the Action which sent the Signal to identify the
417 *desired direction. */
418 void slotPointFocus();
420 /**Meta-slot to set the color scheme according to the name of the
421 *Action which sent the activating signal. */
422 void slotColorScheme();
424 /**Select the Target symbol (a.k.a. field-of-view indicator) */
425 void slotTargetSymbol();
427 void slotFOVEdit();
429 /**Toggle between Equatorial and Ecliptic coordinte systems */
430 void slotCoordSys();
432 /** Toggle display of the observing list */
433 void slotObsList();
435 /**Meta-slot to handle display toggles for all of the viewtoolbar buttons.
436 *uses the name of the sender to identify the item to change. */
437 void slotViewToolBar();
439 /**Meta-slot to handle toggling display of GUI elements (toolbars and infoboxes)
440 *uses name of the sender action to identify the widget to hide/show. */
441 void slotShowGUIItem( bool );
443 /**Re-assign the input focus to the SkyMap widget.
445 void mapGetsFocus();
447 /**Toggle to and from full screen mode */
448 void slotFullScreen();
450 private:
452 *Initialize Menu bar.
454 void initActions();
456 void initFOV();
459 *Initialize Status bar.
461 void initStatusBar();
463 SkyMap *skymap;
465 QWidget *centralWidget;
466 QVBoxLayout *topLayout;
468 KToolBar *viewToolBar;
469 TimeStepBox *TimeStep;
471 ToggleAction *actCoordSys;
472 ToggleAction *actObsList;
473 KActionMenu *colorActionMenu, *fovActionMenu;
475 KDialogBase *AAVSODialog;
476 FindDialog *findDialog;
477 KSNewStuff *kns;
479 INDIMenu *indimenu;
480 INDIDriver *indidriver;
481 imagesequence *indiseq; /* We need imgsequence here because it runs in batch mode */
483 int idSpinBox;
484 bool DialogIsObsolete;
485 bool StartClockRunning;
486 QString StartDateString;
488 QPalette OriginalPalette, DarkPalette;
490 class privatedata;
491 friend class privatedata;
492 privatedata *pd;
493 ObservingList *obsList;
496 class KStars::privatedata {
497 public:
498 KStars *ks;
499 KStarsSplash *splash;
500 KStarsData *kstarsData;
502 privatedata(KStars *parent) : ks(parent), splash(0), kstarsData(0) {};
503 void buildGUI();
505 ~privatedata();
508 #endif