summaryrefslogtreecommitdiffstats
path: root/kstars/kstars/tools
diff options
context:
space:
mode:
Diffstat (limited to 'kstars/kstars/tools')
-rw-r--r--kstars/kstars/tools/Makefile.am25
-rw-r--r--kstars/kstars/tools/README18
-rw-r--r--kstars/kstars/tools/altvstime.cpp589
-rw-r--r--kstars/kstars/tools/altvstime.h221
-rw-r--r--kstars/kstars/tools/altvstimeui.ui533
-rw-r--r--kstars/kstars/tools/argchangeviewoption.ui141
-rw-r--r--kstars/kstars/tools/argexportimage.ui262
-rw-r--r--kstars/kstars/tools/argloadcolorscheme.ui27
-rw-r--r--kstars/kstars/tools/arglooktoward.ui162
-rw-r--r--kstars/kstars/tools/argprintimage.ui58
-rw-r--r--kstars/kstars/tools/argsetactionindi.ui121
-rw-r--r--kstars/kstars/tools/argsetaltaz.ui144
-rw-r--r--kstars/kstars/tools/argsetccdtempindi.ui123
-rw-r--r--kstars/kstars/tools/argsetcolor.ui225
-rw-r--r--kstars/kstars/tools/argsetfilternumindi.ui126
-rw-r--r--kstars/kstars/tools/argsetfocusspeedindi.ui93
-rw-r--r--kstars/kstars/tools/argsetfocustimeoutindi.ui123
-rw-r--r--kstars/kstars/tools/argsetframetypeindi.ui115
-rw-r--r--kstars/kstars/tools/argsetgeolocation.ui201
-rw-r--r--kstars/kstars/tools/argsetgeolocationindi.ui170
-rw-r--r--kstars/kstars/tools/argsetlocaltime.ui105
-rw-r--r--kstars/kstars/tools/argsetportindi.ui79
-rw-r--r--kstars/kstars/tools/argsetradec.ui144
-rw-r--r--kstars/kstars/tools/argsetscopeactionindi.ui115
-rw-r--r--kstars/kstars/tools/argsettargetcoordindi.ui170
-rw-r--r--kstars/kstars/tools/argsettargetnameindi.ui148
-rw-r--r--kstars/kstars/tools/argsettrack.ui82
-rw-r--r--kstars/kstars/tools/argsetutcindi.ui118
-rw-r--r--kstars/kstars/tools/argshutdownindi.ui75
-rw-r--r--kstars/kstars/tools/argstartexposureindi.ui125
-rw-r--r--kstars/kstars/tools/argstartfocusindi.ui117
-rw-r--r--kstars/kstars/tools/argstartindi.ui124
-rw-r--r--kstars/kstars/tools/argswitchindi.ui129
-rw-r--r--kstars/kstars/tools/argtimescale.ui97
-rw-r--r--kstars/kstars/tools/argwaitfor.ui85
-rw-r--r--kstars/kstars/tools/argwaitforkey.ui92
-rw-r--r--kstars/kstars/tools/argzoom.ui93
-rw-r--r--kstars/kstars/tools/astrocalc.cpp380
-rw-r--r--kstars/kstars/tools/astrocalc.h158
-rw-r--r--kstars/kstars/tools/jmoontool.cpp183
-rw-r--r--kstars/kstars/tools/jmoontool.h47
-rw-r--r--kstars/kstars/tools/kstarsplotwidget.cpp670
-rw-r--r--kstars/kstars/tools/kstarsplotwidget.h128
-rw-r--r--kstars/kstars/tools/lcgenerator.cpp478
-rw-r--r--kstars/kstars/tools/lcgenerator.h160
-rw-r--r--kstars/kstars/tools/modcalcangdist.cpp213
-rw-r--r--kstars/kstars/tools/modcalcangdist.h62
-rw-r--r--kstars/kstars/tools/modcalcangdistdlg.ui682
-rw-r--r--kstars/kstars/tools/modcalcapcoord.cpp318
-rw-r--r--kstars/kstars/tools/modcalcapcoord.h88
-rw-r--r--kstars/kstars/tools/modcalcapcoorddlg.ui871
-rw-r--r--kstars/kstars/tools/modcalcazel.cpp534
-rw-r--r--kstars/kstars/tools/modcalcazel.h124
-rw-r--r--kstars/kstars/tools/modcalcazeldlg.ui1079
-rw-r--r--kstars/kstars/tools/modcalcdaylength.cpp148
-rw-r--r--kstars/kstars/tools/modcalcdaylength.h63
-rw-r--r--kstars/kstars/tools/modcalcdaylengthdlg.ui655
-rw-r--r--kstars/kstars/tools/modcalceclipticcoords.cpp385
-rw-r--r--kstars/kstars/tools/modcalceclipticcoords.h74
-rw-r--r--kstars/kstars/tools/modcalceclipticcoordsdlg.ui919
-rw-r--r--kstars/kstars/tools/modcalcequinox.cpp223
-rw-r--r--kstars/kstars/tools/modcalcequinox.h59
-rw-r--r--kstars/kstars/tools/modcalcequinoxdlg.ui574
-rw-r--r--kstars/kstars/tools/modcalcgalcoord.cpp371
-rw-r--r--kstars/kstars/tools/modcalcgalcoord.h76
-rw-r--r--kstars/kstars/tools/modcalcgalcoorddlg.ui930
-rw-r--r--kstars/kstars/tools/modcalcgeodcoord.cpp402
-rw-r--r--kstars/kstars/tools/modcalcgeodcoord.h83
-rw-r--r--kstars/kstars/tools/modcalcgeoddlg.ui819
-rw-r--r--kstars/kstars/tools/modcalcjd.cpp125
-rw-r--r--kstars/kstars/tools/modcalcjd.h65
-rw-r--r--kstars/kstars/tools/modcalcjddlg.ui510
-rw-r--r--kstars/kstars/tools/modcalcplanets.cpp591
-rw-r--r--kstars/kstars/tools/modcalcplanets.h83
-rw-r--r--kstars/kstars/tools/modcalcplanetsdlg.ui1392
-rw-r--r--kstars/kstars/tools/modcalcprec.cpp297
-rw-r--r--kstars/kstars/tools/modcalcprec.h67
-rw-r--r--kstars/kstars/tools/modcalcprecdlg.ui758
-rw-r--r--kstars/kstars/tools/modcalcsidtime.cpp328
-rw-r--r--kstars/kstars/tools/modcalcsidtime.h88
-rw-r--r--kstars/kstars/tools/modcalcsidtimedlg.ui870
-rw-r--r--kstars/kstars/tools/modcalcvlsr.cpp577
-rw-r--r--kstars/kstars/tools/modcalcvlsr.h152
-rw-r--r--kstars/kstars/tools/modcalcvlsrdlg.ui1212
-rw-r--r--kstars/kstars/tools/observinglist.cpp740
-rw-r--r--kstars/kstars/tools/observinglist.h175
-rw-r--r--kstars/kstars/tools/observinglistui.ui573
-rw-r--r--kstars/kstars/tools/obslistwizard.cpp458
-rw-r--r--kstars/kstars/tools/obslistwizard.h79
-rw-r--r--kstars/kstars/tools/obslistwizardui.ui1025
-rw-r--r--kstars/kstars/tools/optionstreeview.ui137
-rw-r--r--kstars/kstars/tools/planetviewer.cpp473
-rw-r--r--kstars/kstars/tools/planetviewer.h107
-rw-r--r--kstars/kstars/tools/planetviewerui.ui159
-rw-r--r--kstars/kstars/tools/scriptbuilder.cpp3200
-rw-r--r--kstars/kstars/tools/scriptbuilder.h224
-rw-r--r--kstars/kstars/tools/scriptbuilderui.ui646
-rw-r--r--kstars/kstars/tools/scriptfunction.cpp218
-rw-r--r--kstars/kstars/tools/scriptfunction.h73
-rw-r--r--kstars/kstars/tools/scriptnamedialog.ui157
-rw-r--r--kstars/kstars/tools/wutdialog.cpp444
-rw-r--r--kstars/kstars/tools/wutdialog.h132
-rw-r--r--kstars/kstars/tools/wutdialogui.ui565
103 files changed, 34031 insertions, 0 deletions
diff --git a/kstars/kstars/tools/Makefile.am b/kstars/kstars/tools/Makefile.am
new file mode 100644
index 00000000..06193a1a
--- /dev/null
+++ b/kstars/kstars/tools/Makefile.am
@@ -0,0 +1,25 @@
+noinst_LIBRARIES = libkstarstools.a
+
+libkstarstools_a_SOURCES = altvstimeui.ui altvstime.cpp wutdialogui.ui \
+ wutdialog.cpp astrocalc.cpp modcalcapcoorddlg.ui modcalcazeldlg.ui \
+ modcalcdaylengthdlg.ui modcalcgalcoorddlg.ui modcalcgeoddlg.ui modcalcjddlg.ui \
+ modcalcprecdlg.ui modcalcsidtimedlg.ui modcalcapcoord.cpp modcalcazel.cpp \
+ modcalcdaylength.cpp modcalcgalcoord.cpp modcalcgeodcoord.cpp modcalcjd.cpp modcalcprec.cpp \
+ modcalcsidtime.cpp lcgenerator.cpp scriptbuilderui.ui scriptnamedialog.ui \
+ optionstreeview.ui argchangeviewoption.ui arglooktoward.ui argsetaltaz.ui \
+ argsetgeolocation.ui argsetlocaltime.ui argsetradec.ui argsettrack.ui argtimescale.ui \
+ argwaitforkey.ui argwaitfor.ui argzoom.ui argexportimage.ui argprintimage.ui \
+ argsetcolor.ui argloadcolorscheme.ui scriptbuilder.cpp scriptfunction.cpp \
+ planetviewerui.ui planetviewer.cpp jmoontool.cpp kstarsplotwidget.cpp \
+ modcalcequinoxdlg.ui modcalcequinox.cpp modcalcplanetsdlg.ui modcalcplanets.cpp \
+ modcalceclipticcoordsdlg.ui modcalceclipticcoords.cpp modcalcangdistdlg.ui modcalcangdist.cpp \
+ observinglist.cpp observinglistui.ui argstartindi.ui argshutdownindi.ui argswitchindi.ui \
+ argsetportindi.ui argsettargetcoordindi.ui argsettargetnameindi.ui argsetactionindi.ui \
+ argsetfocusspeedindi.ui argstartfocusindi.ui argsetfocustimeoutindi.ui argsetgeolocationindi.ui \
+ argstartexposureindi.ui argsetutcindi.ui argsetframetypeindi.ui argsetscopeactionindi.ui \
+ argsetccdtempindi.ui modcalcvlsrdlg.ui modcalcvlsr.cpp argsetfilternumindi.ui \
+ obslistwizard.cpp obslistwizard.h obslistwizardui.ui
+
+INCLUDES= -I$(srcdir)/.. -I$(top_srcdir) $(all_includes)
+
+METASOURCES = AUTO
diff --git a/kstars/kstars/tools/README b/kstars/kstars/tools/README
new file mode 100644
index 00000000..ce48ab6e
--- /dev/null
+++ b/kstars/kstars/tools/README
@@ -0,0 +1,18 @@
+The tools subdirectory contains code for the following Tools in KStars:
+
+AltVsTime: Plots Altitude of a list of objects as a function of time
+ for any date and any location.
+
+AstroCalculator: Calculator for astronomical functions
+
+JupiterMoons: Plot positions of Jupiter's 4 largest moons vs. time
+
+LCGenerator: Plot light curves for variable stars
+
+PlanetViewer: Plot the positions of planets in their orbits around the Sun
+
+ScriptBuilder: GUI for building complex behavior scripts
+
+WUT: "What's Up Tonight" summary.
+
+
diff --git a/kstars/kstars/tools/altvstime.cpp b/kstars/kstars/tools/altvstime.cpp
new file mode 100644
index 00000000..1ce505ff
--- /dev/null
+++ b/kstars/kstars/tools/altvstime.cpp
@@ -0,0 +1,589 @@
+/***************************************************************************
+ altvstime.cpp - description
+ -------------------
+ begin : wed nov 17 08:05:11 CET 2002
+ copyright : (C) 2002-2003 by Pablo de Vicente
+ email : vicente@oan.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include <qlayout.h>
+#include <qpainter.h>
+#include <klocale.h>
+#include <klineedit.h>
+#include <klistbox.h>
+#include <kpushbutton.h>
+#include <kdialogbase.h>
+
+#include "altvstime.h"
+#include "altvstimeui.h"
+#include "dms.h"
+#include "dmsbox.h"
+#include "kstars.h"
+#include "kstarsdata.h"
+#include "skypoint.h"
+#include "skyobject.h"
+#include "skyobjectname.h"
+#include "ksnumbers.h"
+#include "objectnamelist.h"
+#include "simclock.h"
+#include "finddialog.h"
+#include "locationdialog.h"
+
+#include "kstarsdatetime.h"
+#include "libkdeedu/extdate/extdatetimeedit.h"
+
+AltVsTime::AltVsTime( QWidget* parent) :
+ KDialogBase( KDialogBase::Plain, i18n( "Altitude vs. Time" ), Close, Close, parent )
+{
+ ks = (KStars*) parent;
+
+ QFrame *page = plainPage();
+
+ setMainWidget(page);
+ topLayout = new QVBoxLayout( page, 0, spacingHint() );
+
+ View = new AVTPlotWidget( -12.0, 12.0, -90.0, 90.0, page );
+ View->setMinimumSize( 400, 400 );
+ View->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
+ View->setXAxisType( KStarsPlotWidget::TIME );
+ View->setYAxisType( KStarsPlotWidget::ANGLE );
+ View->setShowGrid( false );
+ View->setXAxisLabel( i18n( "Local Time" ) );
+ View->setXAxisLabel2( i18n( "Local Sidereal Time" ) );
+ View->setYAxisLabel( i18n( "the angle of an object above (or below) the horizon", "Altitude" ) );
+
+ avtUI = new AltVsTimeUI( page );
+ avtUI->raBox->setDegType( false );
+ avtUI->decBox->setDegType( true );
+
+ //POST-3.2
+ //Doesn't make sense to manually adjust long/lat unless we can modify TZ also
+ avtUI->longBox->setReadOnly( true );
+ avtUI->latBox->setReadOnly( true );
+
+ topLayout->addWidget( View );
+ topLayout->addWidget( avtUI );
+
+ geo = ks->geo();
+
+ DayOffset = 0;
+ showCurrentDate();
+ if ( getDate().time().hour() > 12 ) DayOffset = 1;
+
+ avtUI->longBox->show( geo->lng() );
+ avtUI->latBox->show( geo->lat() );
+
+ computeSunRiseSetTimes();
+
+ setLSTLimits();
+ View->updateTickmarks();
+
+ connect( avtUI->browseButton, SIGNAL( clicked() ), this, SLOT( slotBrowseObject() ) );
+ connect( avtUI->cityButton, SIGNAL( clicked() ), this, SLOT( slotChooseCity() ) );
+ connect( avtUI->updateButton, SIGNAL( clicked() ), this, SLOT( slotUpdateDateLoc() ) );
+ connect( avtUI->clearButton, SIGNAL( clicked() ), this, SLOT( slotClear() ) );
+ connect( avtUI->addButton, SIGNAL( clicked() ), this, SLOT( slotAddSource() ) );
+ connect( avtUI->nameBox, SIGNAL( returnPressed() ), this, SLOT( slotAddSource() ) );
+ connect( avtUI->raBox, SIGNAL( returnPressed() ), this, SLOT( slotAddSource() ) );
+ connect( avtUI->decBox, SIGNAL( returnPressed() ), this, SLOT( slotAddSource() ) );
+ connect( avtUI->clearFieldsButton, SIGNAL( clicked() ), this, SLOT( slotClearBoxes() ) );
+ connect( avtUI->longBox, SIGNAL( returnPressed() ), this, SLOT( slotAdvanceFocus() ) );
+ connect( avtUI->latBox, SIGNAL( returnPressed() ), this, SLOT( slotAdvanceFocus() ) );
+ connect( avtUI->PlotList, SIGNAL( highlighted(int) ), this, SLOT( slotHighlight() ) );
+
+ pList.setAutoDelete(FALSE);
+ deleteList.setAutoDelete(TRUE); //needed for skypoints which may be created in this class
+
+ //ther edit boxes should not pass on the return key!
+ avtUI->nameBox->setTrapReturnKey( true );
+ avtUI->raBox->setTrapReturnKey( true );
+ avtUI->decBox->setTrapReturnKey( true );
+
+ setMouseTracking( true );
+}
+
+AltVsTime::~AltVsTime()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+void AltVsTime::slotAddSource(void) {
+ bool objFound( false );
+
+ //First, attempt to find the object name in the list of known objects
+ if ( ! avtUI->nameBox->text().isEmpty() ) {
+ ObjectNameList &ObjNames = ks->data()->ObjNames;
+ QString text = avtUI->nameBox->text().lower();
+
+ for( SkyObjectName *name = ObjNames.first( text ); name; name = ObjNames.next() ) {
+ if ( name->text().lower() == text ) {
+ //object found
+ SkyObject *o = name->skyObject();
+ processObject( o );
+
+ objFound = true;
+ break;
+ }
+ }
+
+ if ( !objFound ) kdDebug() << "No object named " << avtUI->nameBox->text() << " found." << endl;
+ }
+
+ //Next, if the name, RA, and Dec fields are all filled, construct a new skyobject
+ //with these parameters
+ if ( !objFound && ! avtUI->nameBox->text().isEmpty() && ! avtUI->raBox->text().isEmpty() && ! avtUI->decBox->text().isEmpty() ) {
+ bool ok( true );
+ dms newRA( 0.0 ), newDec( 0.0 );
+ newRA = avtUI->raBox->createDms( false, &ok );
+ if ( ok ) newDec = avtUI->decBox->createDms( true, &ok );
+
+ //If the epochName is blank (or any non-double), we assume J2000
+ //Otherwise, precess to J2000.
+ KStarsDateTime dt;
+ dt.setFromEpoch( getEpoch( avtUI->epochName->text() ) );
+ long double jd = dt.djd();
+ if ( jd != J2000 ) {
+ SkyPoint ptest( newRA, newDec );
+ ptest.precessFromAnyEpoch( jd, J2000 );
+ newRA.setH( ptest.ra()->Hours() );
+ newDec.setD( ptest.dec()->Degrees() );
+ }
+
+ //make sure the coords do not already exist from another object
+ bool found(false);
+ for ( SkyPoint *p = pList.first(); p; p = pList.next() ) {
+ //within an arcsecond?
+ if ( fabs( newRA.Degrees() - p->ra()->Degrees() ) < 0.0003 && fabs( newDec.Degrees() - p->dec()->Degrees() ) < 0.0003 ) {
+ found = true;
+ break;
+ }
+ }
+ if ( found ) {
+ kdDebug() << "This point is already displayed; I will not duplicate it." << endl;
+ ok = false;
+ }
+
+ if ( ok ) {
+ SkyObject *obj = new SkyObject( 8, newRA, newDec, 1.0, avtUI->nameBox->text() );
+ deleteList.append( obj ); //this object will be deleted when window is destroyed
+ processObject( obj );
+ }
+
+ //If the Ra and Dec boxes are filled, but the name field is empty,
+ //move input focus to nameBox`
+ } else if ( avtUI->nameBox->text().isEmpty() && ! avtUI->raBox->text().isEmpty() && ! avtUI->decBox->text().isEmpty() ) {
+ avtUI->nameBox->QWidget::setFocus();
+
+ //nameBox is empty, and one of the ra or dec fields is empty. Move input focus to empty coord box
+ } else if ( avtUI->raBox->text().isEmpty() ) {
+ avtUI->raBox->QWidget::setFocus();
+ } else if ( avtUI->decBox->text().isEmpty() ) {
+ avtUI->decBox->QWidget::setFocus();
+ }
+
+ View->repaint(false);
+}
+
+//Use find dialog to choose an object
+void AltVsTime::slotBrowseObject(void) {
+ FindDialog fd(ks);
+ if ( fd.exec() == QDialog::Accepted ) {
+ SkyObject *o = fd.currentItem()->objName()->skyObject();
+ processObject( o );
+ }
+
+ View->repaint();
+}
+
+void AltVsTime::processObject( SkyObject *o, bool forceAdd ) {
+ KSNumbers *num = new KSNumbers( getDate().djd() );
+ KSNumbers *oldNum = 0;
+
+ //If the object is in the solar system, recompute its position for the given epochLabel
+ if ( o && o->isSolarSystem() ) {
+ oldNum = new KSNumbers( ks->data()->ut().djd() );
+ o->updateCoords( num, true, geo->lat(), ks->LST() );
+ }
+
+ //precess coords to target epoch
+ o->updateCoords( num );
+
+ //If this point is not in list already, add it to list
+ bool found(false);
+ for ( SkyPoint *p = pList.first(); p; p = pList.next() ) {
+ if ( o->ra()->Degrees() == p->ra()->Degrees() && o->dec()->Degrees() == p->dec()->Degrees() ) {
+ found = true;
+ break;
+ }
+ }
+ if ( found && !forceAdd ) kdDebug() << "This point is already displayed; I will not duplicate it." << endl;
+ else {
+ pList.append( (SkyPoint*)o );
+
+ //make sure existing curves are thin and red
+ for ( int i=0; i < View->objectCount(); ++i ) {
+ KPlotObject *obj = View->object( i );
+ if ( obj->size() == 2 ) {
+ obj->setColor( "red" );
+ obj->setSize( 1 );
+ }
+ }
+
+ //add new curve with width=2, and color=white
+ KPlotObject *po = new KPlotObject( "", "white", KPlotObject::CURVE, 2, KPlotObject::SOLID );
+ for ( double h=-12.0; h<=12.0; h+=0.5 ) {
+ po->addPoint( new DPoint( h, findAltitude( o, h ) ) );
+ }
+ View->addObject( po );
+
+ avtUI->PlotList->insertItem( o->translatedName() );
+ avtUI->PlotList->setCurrentItem( avtUI->PlotList->count() - 1 );
+ avtUI->raBox->showInHours(o->ra() );
+ avtUI->decBox->showInDegrees(o->dec() );
+ avtUI->nameBox->setText(o->translatedName() );
+
+ //Set epochName to epoch shown in date tab
+ avtUI->epochName->setText( QString().setNum( getDate().epoch() ) );
+ }
+ kdDebug() << "Currently, there are " << View->objectCount() << " objects displayed." << endl;
+
+ //restore original position
+ if ( o->isSolarSystem() ) {
+ o->updateCoords( oldNum, true, ks->geo()->lat(), ks->LST() );
+ delete oldNum;
+ }
+ o->EquatorialToHorizontal( ks->LST(), ks->geo()->lat() );
+ delete num;
+}
+
+double AltVsTime::findAltitude( SkyPoint *p, double hour ) {
+ hour += 24.0*(double)DayOffset;
+
+ //getDate converts the user-entered local time to UT
+ KStarsDateTime ut = getDate().addSecs( hour*3600.0 );
+
+ dms LST = geo->GSTtoLST( ut.gst() );
+ p->EquatorialToHorizontal( &LST, geo->lat() );
+ return p->alt()->Degrees();
+}
+
+void AltVsTime::slotHighlight(void) {
+ int iPlotList = avtUI->PlotList->currentItem();
+
+ //highlight the curve of the selected object
+ for ( int i=0; i<View->objectCount(); ++i ) {
+ KPlotObject *obj = View->object( i );
+
+ if ( i == iPlotList ) {
+ obj->setSize( 2 );
+ obj->setColor( "white" );
+ } else {
+ obj->setSize( 1 );
+ obj->setColor( "red" );
+ }
+ }
+
+ View->update();
+
+ int index = 0;
+ for ( SkyPoint *p = pList.first(); p; p = pList.next() ) {
+ if ( index == iPlotList ) {
+ avtUI->raBox->showInHours(p->ra() );
+ avtUI->decBox->showInDegrees(p->dec() );
+ avtUI->nameBox->setText(avtUI->PlotList->currentText() );
+ }
+ ++index;
+ }
+}
+
+//move input focus to the next logical widget
+void AltVsTime::slotAdvanceFocus(void) {
+ if ( sender()->name() == QString( "nameBox" ) ) avtUI->addButton->setFocus();
+ if ( sender()->name() == QString( "raBox" ) ) avtUI->decBox->setFocus();
+ if ( sender()->name() == QString( "decbox" ) ) avtUI->addButton->setFocus();
+ if ( sender()->name() == QString( "longBox" ) ) avtUI->latBox->setFocus();
+ if ( sender()->name() == QString( "latBox" ) ) avtUI->updateButton->setFocus();
+}
+
+void AltVsTime::slotClear(void) {
+ if ( pList.count() ) pList.clear();
+ if ( deleteList.count() ) deleteList.clear();
+ avtUI->PlotList->clear();
+ avtUI->nameBox->clear();
+ avtUI->raBox->clear();
+ avtUI->decBox->clear();
+ avtUI->epochName->clear();
+ View->clearObjectList();
+ View->repaint();
+}
+
+void AltVsTime::slotClearBoxes(void) {
+ avtUI->nameBox->clear();
+ avtUI->raBox->clear() ;
+ avtUI->decBox->clear();
+ avtUI->epochName->clear();
+}
+
+void AltVsTime::computeSunRiseSetTimes() {
+ //Determine the time of sunset and sunrise for the desired date and location
+ //expressed as doubles, the fraction of a full day.
+ KStarsDateTime today = getDate();
+
+ SkyObject *oSun = (SkyObject*) ks->data()->PCat->planetSun();
+ double sunRise = -1.0 * oSun->riseSetTime( today.djd() + 1.0, geo, true ).secsTo(QTime()) / 86400.0;
+ double sunSet = -1.0 * oSun->riseSetTime( today.djd(), geo, false ).secsTo(QTime()) / 86400.0;
+
+ //check to see if Sun is circumpolar
+ //requires temporary repositioning of Sun to target date
+ KSNumbers *num = new KSNumbers( today.djd() );
+ KSNumbers *oldNum = new KSNumbers( ks->data()->ut().djd() );
+ dms LST = geo->GSTtoLST( getDate().gst() );
+ oSun->updateCoords( num, true, geo->lat(), &LST );
+ if ( oSun->checkCircumpolar( geo->lat() ) ) {
+ if ( oSun->alt()->Degrees() > 0.0 ) {
+ //Circumpolar, signal it this way:
+ sunRise = 0.0;
+ sunSet = 1.0;
+ } else {
+ //never rises, signal it this way:
+ sunRise = 0.0;
+ sunSet = -1.0;
+ }
+ }
+
+ //Notify the View about new sun rise/set times:
+ View->setSunRiseSetTimes( sunRise, sunSet );
+
+ //Restore Sun coordinates:
+ oSun->updateCoords( oldNum, true, ks->geo()->lat(), ks->LST() );
+ oSun->EquatorialToHorizontal( ks->LST(), ks->geo()->lat() );
+
+ delete num;
+ delete oldNum;
+}
+
+void AltVsTime::slotUpdateDateLoc(void) {
+ KStarsDateTime today = getDate();
+ KSNumbers *num = new KSNumbers( today.djd() );
+ KSNumbers *oldNum = 0;
+ dms LST = geo->GSTtoLST( today.gst() );
+
+ //First determine time of sunset and sunrise
+ computeSunRiseSetTimes();
+
+ for ( unsigned int i = 0; i < avtUI->PlotList->count(); ++i ) {
+ QString oName = avtUI->PlotList->text( i ).lower();
+ ObjectNameList &ObjNames = ks->data()->ObjNames;
+ bool objFound(false);
+
+ for( SkyObjectName *name = ObjNames.first( oName ); name; name = ObjNames.next() ) {
+ if ( name->text().lower() == oName ) {
+ //object found
+ SkyObject *o = name->skyObject();
+
+ //If the object is in the solar system, recompute its position for the given date
+ if ( o->isSolarSystem() ) {
+ oldNum = new KSNumbers( ks->data()->ut().djd() );
+ o->updateCoords( num, true, geo->lat(), &LST );
+ }
+
+ //precess coords to target epoch
+ o->updateCoords( num );
+
+ //update pList entry
+ pList.replace( i, (SkyPoint*)o );
+
+ KPlotObject *po = new KPlotObject( "", "white", KPlotObject::CURVE, 1, KPlotObject::SOLID );
+ for ( double h=-12.0; h<=12.0; h+=0.5 ) {
+ po->addPoint( new DPoint( h, findAltitude( o, h ) ) );
+ }
+ View->replaceObject( i, po );
+
+ //restore original position
+ if ( o->isSolarSystem() ) {
+ o->updateCoords( oldNum, true, ks->data()->geo()->lat(), ks->LST() );
+ delete oldNum;
+ oldNum = 0;
+ }
+ o->EquatorialToHorizontal( ks->LST(), ks->data()->geo()->lat() );
+
+ objFound = true;
+ break;
+ }
+ }
+
+ if ( ! objFound ) { //assume unfound object is a custom object
+ pList.at(i)->updateCoords( num ); //precess to desired epoch
+
+ KPlotObject *po = new KPlotObject( "", "white", KPlotObject::CURVE, 1, KPlotObject::SOLID );
+ for ( double h=-12.0; h<=12.0; h+=0.5 ) {
+ po->addPoint( new DPoint( h, findAltitude( pList.at(i), h ) ) );
+ }
+ View->replaceObject( i, po );
+ }
+ }
+
+ if ( getDate().time().hour() > 12 ) DayOffset = 1;
+ else DayOffset = 0;
+
+ setLSTLimits();
+ slotHighlight();
+ View->repaint();
+
+ delete num;
+}
+
+void AltVsTime::slotChooseCity(void) {
+ LocationDialog ld(ks);
+ if ( ld.exec() == QDialog::Accepted ) {
+ GeoLocation *newGeo = ld.selectedCity();
+ if ( newGeo ) {
+ geo = newGeo;
+ avtUI->latBox->showInDegrees( geo->lat() );
+ avtUI->longBox->showInDegrees( geo->lng() );
+ }
+ }
+}
+
+int AltVsTime::currentPlotListItem() const {
+ return avtUI->PlotList->currentItem();
+}
+
+void AltVsTime::setLSTLimits(void) {
+ //UT at noon on target date
+ KStarsDateTime ut = getDate().addSecs( ((double)DayOffset + 0.5)*86400. );
+
+ dms lst = geo->GSTtoLST( ut.gst() );
+ View->setSecondaryLimits( lst.Hours(), lst.Hours() + 24.0, -90.0, 90.0 );
+}
+
+void AltVsTime::showCurrentDate (void)
+{
+ KStarsDateTime dt = KStarsDateTime::currentDateTime();
+ if ( dt.time() > QTime( 12, 0, 0 ) ) dt = dt.addDays( 1 );
+ avtUI->dateBox->setDate( dt.date() );
+}
+
+KStarsDateTime AltVsTime::getDate (void)
+{
+ //convert midnight local time to UT:
+ KStarsDateTime dt( avtUI->dateBox->date(), QTime() );
+ dt = geo->LTtoUT( dt );
+ return dt;
+}
+
+double AltVsTime::getEpoch (QString eName)
+{
+ //If Epoch field not a double, assume J2000
+ bool ok(false);
+ double epoch = eName.toDouble(&ok);
+
+ if ( !ok ) {
+ kdDebug() << "Invalid Epoch. Assuming 2000.0." << endl;
+ return 2000.0;
+ }
+
+ return epoch;
+}
+
+AVTPlotWidget::AVTPlotWidget( double x1, double x2, double y1, double y2, QWidget *parent, const char* name )
+ : KStarsPlotWidget( x1, x2, y1, y2, parent, name )
+{
+ //Default SunRise/SunSet values
+ SunRise = 0.25;
+ SunSet = 0.75;
+}
+
+void AVTPlotWidget::mousePressEvent( QMouseEvent *e ) {
+ mouseMoveEvent( e );
+}
+
+void AVTPlotWidget::mouseMoveEvent( QMouseEvent *e ) {
+ QRect checkRect( leftPadding(), topPadding(), PixRect.width(), PixRect.height() );
+ int Xcursor = e->x();
+ int Ycursor = e->y();
+
+ if ( ! checkRect.contains( e->x(), e->y() ) ) {
+ if ( e->x() < checkRect.left() ) Xcursor = checkRect.left();
+ if ( e->x() > checkRect.right() ) Xcursor = checkRect.right();
+ if ( e->y() < checkRect.top() ) Ycursor = checkRect.top();
+ if ( e->y() > checkRect.bottom() ) Ycursor = checkRect.bottom();
+ }
+
+ Xcursor -= leftPadding();
+ Ycursor -= topPadding();
+
+ QPixmap buffer2( *buffer );
+ QPainter p;
+ p.begin( &buffer2 );
+ p.translate( leftPadding(), topPadding() );
+ p.setPen( QPen( "grey", 1, SolidLine ) );
+ p.drawLine( Xcursor, 0, Xcursor, PixRect.height() );
+ p.drawLine( 0, Ycursor, PixRect.width(), Ycursor );
+ p.end();
+ bitBlt( this, 0, 0, &buffer2 );
+}
+
+void AVTPlotWidget::paintEvent( QPaintEvent */*e*/ ) {
+ QPainter p;
+
+ p.begin( buffer );
+ p.fillRect( 0, 0, width(), height(), bgColor() );
+
+ p.translate( leftPadding(), topPadding() );
+
+ int pW = PixRect.width();
+ int pH = PixRect.height();
+
+ //draw daytime sky if the Sun rises for the current date/location
+ //(when Sun does not rise, SunSet = -1.0)
+ if ( SunSet != -1.0 ) {
+ //If Sun does not set, then just fill the daytime sky color
+ if ( SunSet == 1.0 ) {
+ p.fillRect( 0, 0, pW, int(0.5*pH), QColor( 0, 100, 200 ) );
+ } else {
+ //Display centered on midnight, so need to modulate dawn/dusk by 0.5
+ int dawn = int(pW*(0.5 + SunRise));
+ int dusk = int(pW*(SunSet - 0.5));
+ p.fillRect( 0, 0, dusk, int(0.5*pH), QColor( 0, 100, 200 ) );
+ p.fillRect( dawn, 0, pW - dawn, int(0.5*pH), QColor( 0, 100, 200 ) );
+
+ //draw twilight gradients
+ unsigned short int W = 40;
+ for ( unsigned short int i=0; i<W; ++i ) {
+ p.setPen( QColor( 0, int(100*i/W), 200*i/W ) );
+ p.drawLine( dusk - (i-20), 0, dusk - (i-20), pH );
+ p.drawLine( dawn + (i-20), 0, dawn + (i-20), pH );
+ }
+ }
+ }
+
+ //draw ground
+ p.fillRect( 0, int(0.5*pH), pW, int(0.5*pH), QColor( "#002200" ) );
+
+ drawBox( &p );
+ drawObjects( &p );
+
+ //Add vertical line indicating "now"
+ QTime t = QTime::currentTime();
+ double x = 12.0 + t.hour() + t.minute()/60.0 + t.second()/3600.0;
+ while ( x > 24.0 ) x -= 24.0;
+ int ix = int(x*pW/24.0); //convert to screen pixel coords
+ p.setPen( QPen( "white", 2, DotLine ) );
+ p.drawLine( ix, 0, ix, pH );
+
+ p.end();
+
+ bitBlt( this, 0, 0, buffer );
+}
+
+#include "altvstime.moc"
diff --git a/kstars/kstars/tools/altvstime.h b/kstars/kstars/tools/altvstime.h
new file mode 100644
index 00000000..1f07b05f
--- /dev/null
+++ b/kstars/kstars/tools/altvstime.h
@@ -0,0 +1,221 @@
+/***************************************************************************
+ altvstime.h - description
+ -------------------
+ begin : Mon Dec 23 2002
+ copyright : (C) 2002 by Pablo de Vicente
+ email : vicente@oan.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 ALTVSTIME_H
+#define ALTVSTIME_H
+
+#include "kstarsplotwidget.h"
+
+class KStarsDateTime;
+class QTime;
+class QVariant;
+class QVBoxLayout;
+class KDialogBase;
+class KLocale;
+class SkyObject;
+class SkyPoint;
+class dms;
+class GeoLocation;
+class KStars;
+class AltVsTimeUI;
+
+/**@class AVTPlotWidget
+ *@short An extension of the KStarsPlotWidget for the AltVsTime tool.
+ *The biggest difference is that in addition to the plot objects, it
+ *draws the "ground" below Alt=0 and draws the sky light blue for day
+ *times, and black for night times. The transition between day and
+ *night is drawn with a gradient, and the position follows the actual
+ *sunrise/sunset times of the given date/location.
+ *Also, this plot widget provides two time axes (local time along the
+ *bottom, and local sideral time along the top).
+ *@version 1.0
+ *@author Jason Harris
+ */
+class AVTPlotWidget : public KStarsPlotWidget
+{
+ Q_OBJECT
+public:
+/**Constructor
+ */
+ AVTPlotWidget( double x1=0.0, double x2=1.0, double y1=0.0, double y2=1.0, QWidget *parent=0, const char* name=0 );
+
+/**Set the fractional positions of the Sunrise and Sunset positions,
+ *in units where last midnight was 0.0, and next midnight is 1.0.
+ *i.e., if Sunrise is at 06:00, then we set it as 0.25 in this
+ *function. Likewise, if Sunset is at 18:00, then we set it as
+ *0.75 in this function.
+ *@param sr the fractional position of Sunrise
+ *@param ss the fractional position of Sunset
+ */
+ void setSunRiseSetTimes( double sr, double ss ) { SunRise = sr; SunSet = ss; }
+
+protected:
+/**Handle mouse move events. If the mouse button is down,
+ *draw crosshair lines centered at the cursor position. This
+ *allows the user to pinpoint specific position sin the plot.
+ */
+ void mouseMoveEvent( QMouseEvent *e );
+
+/**Simply calls mouseMoveEvent().
+ */
+ void mousePressEvent( QMouseEvent *e );
+
+/**Redraw the plot.
+ */
+ void paintEvent( QPaintEvent *e );
+
+private:
+ double SunRise, SunSet;
+};
+
+/**@class AltVsTime
+ *@short the Altitude vs. Time Tool.
+ *Plot the altitude as a function of time for any list of
+ *objects, as seen from any location, on any date.
+ *@version 1.0
+ *@author Jason Harris
+ */
+
+class AltVsTime : public KDialogBase
+{
+ Q_OBJECT
+
+public:
+/**Constructor
+ */
+ AltVsTime( QWidget* parent = 0);
+
+/**Destructor
+ */
+ ~AltVsTime();
+
+/**Determine the limits for the sideral time axis, using
+ *the sidereal time at midnight for the current date
+ *and location settings.
+ */
+ void setLSTLimits();
+
+/**Set the AltVsTime Date according to the current Date
+ *in the KStars main window. Currently, this is only
+ *used in the ctor to initialize the Date.
+ */
+ void showCurrentDate (void);
+
+/**@return a KStarsDateTime object constructed from the
+ *current setting in the Date widget.
+ */
+ KStarsDateTime getDate (void);
+
+/**Determine the time of sunset and sunrise for the current
+ *date and location settings. Convert the times to doubles,
+ *expressing the times as fractions of a full day.
+ *Calls AVTPlotWidget::setSunRiseSetTimes() to send the
+ *numbers to the plot widget.
+ */
+ void computeSunRiseSetTimes();
+
+/**Parse a string as an epoch number. If the string can't
+ *be parsed, return 2000.0.
+ *@param eName the epoch string to be parsed
+ *@return the epoch number
+ */
+ double getEpoch (QString eName);
+
+/**@short Add a SkyObject to the display.
+ *Constructs a PLotObject representing the Alt-vs-time curve for the object.
+ *@param o pointer to the SkyObject to be added
+ *@param forceAdd if true, then the object will be added, even if there
+ *is already a curve for the same coordinates.
+ */
+ void processObject( SkyObject *o, bool forceAdd=false );
+
+/**@short Determine the altitude coordinate of a SkyPoint,
+ *given an hour of the day.
+ *
+ *This is called for every 30-minute interval in the displayed Day,
+ *in order to construct the altitude curve for a given object.
+ *@param p the skypoint whose altitude is to be found
+ *@param hour the time in the displayed day, expressed in hours
+ *@return the Altitude, expresse in degrees
+ */
+ double findAltitude( SkyPoint *p, double hour );
+
+/**@return the currently highlighted item in the list of displayed
+ *objects
+ */
+ int currentPlotListItem() const;
+
+/**@return a pointer to the list of SkyPoints representing the
+ *objects being displayed.
+ */
+ QPtrList<SkyPoint>* skyPointList() { return &pList; }
+
+public slots:
+/**@short Update the plot to reflec new Date and Location settings.
+ */
+ void slotUpdateDateLoc(void);
+
+/**@short Clear the list of displayed objects.
+ */
+ void slotClear(void);
+
+/**@short Clear the edit boxes for specifying a new object.
+ */
+ void slotClearBoxes(void);
+
+/**@short Add an object to the list of displayed objects, according
+ *to the data entered in the edit boxes.
+ */
+ void slotAddSource(void);
+
+/**@short Launch the Find Object window to select a new object for
+ *the list of displayed objects.
+ */
+ void slotBrowseObject(void);
+
+/**@short Launch the Location dialog to choose a new location.
+ */
+ void slotChooseCity(void);
+
+/**@short Move input keyboard focus to the next logical widget.
+ *We need a separate slot for this because we are intercepting
+ *Enter key events, which close the window by default, to
+ *advance input focus instead (when the Enter events occur in
+ *certain Edit boxes).
+ */
+ void slotAdvanceFocus(void);
+
+/**Update the plot to highlight the altitude curve of the objects
+ *which is highlighted in the listbox.
+ */
+ void slotHighlight(void);
+
+private:
+ AVTPlotWidget *View;
+ AltVsTimeUI *avtUI;
+ QVBoxLayout *topLayout;
+
+ GeoLocation *geo;
+ KStars *ks;
+ QPtrList<SkyPoint> pList;
+ QPtrList<SkyPoint> deleteList;
+
+ int DayOffset;
+ bool dirtyFlag;
+};
+
+#endif // ALTVSTIME_H
diff --git a/kstars/kstars/tools/altvstimeui.ui b/kstars/kstars/tools/altvstimeui.ui
new file mode 100644
index 00000000..a4d1bb29
--- /dev/null
+++ b/kstars/kstars/tools/altvstimeui.ui
@@ -0,0 +1,533 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>AltVsTimeUI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>AltVsTimeUI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>458</width>
+ <height>209</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Altitude vs. Time</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tabWidget2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Sources</string>
+ </attribute>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout30</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Epoch:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="2" column="1">
+ <property name="name">
+ <cstring>decBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Dec:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>RA:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter</set>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>nameBox</cstring>
+ </property>
+ <property name="trapEnterKeyEvent" stdset="0">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Name of plotted object</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>There are two ways to use this field:
+
+1. Simply type the name of a known object and press the "Plot" button (or press Enter). The object's Altitude vs. Time curve will be added to the plot, and its coordinates will be displayed below.
+
+2. Type a name label for a custom object. You will also need to specify the RA and Dec coordinates of the object, and then press the "Plot" button to add its curve to the plot.</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>raBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="3" column="1">
+ <property name="name">
+ <cstring>epochName</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>80</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>80</width>
+ <height>32767</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Name:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>browseButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Find Object...</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>addButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Plot</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>clearFieldsButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Clear Fields</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>clearButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Clear List</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="KListBox">
+ <property name="name">
+ <cstring>PlotList</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="vScrollBarMode">
+ <enum>AlwaysOn</enum>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Date &amp;&amp; Location</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout57</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>Date:</string>
+ </property>
+ </widget>
+ <widget class="ExtDateEdit">
+ <property name="name">
+ <cstring>dateBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>90</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>257</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout25</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>cityButton</cstring>
+ </property>
+ <property name="text">
+ <string>Choose City...</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel7</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Long.:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox">
+ <property name="name">
+ <cstring>longBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel6</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Lat.:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox">
+ <property name="name">
+ <cstring>latBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout26</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>updateButton</cstring>
+ </property>
+ <property name="text">
+ <string>Update</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>dmsBox</class>
+ <header location="global">../dmsbox.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+ <customwidget>
+ <class>ExtDateEdit</class>
+ <header location="local">libkdeedu/extdate/extdatetimeedit.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image1</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1110">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000041d49444154789c8d95c18b1c4514c67fbb29e5b54ea05b26da1d36b08d09a6c508138cb8c13d647141163de49043bca9f1628eb9294810f24f88c15b728b07617358888785d980427290b4a8d00b19a8821da8228cf42316ac87eed9247ac95c9aeaeef9eaabdffb5ebf85f178ccfcf7f5b79fec07a7280a08a008f25ceb7c29e5da573716e65a0be3f198ef6f5ededff9b9e1b34faf90882092a1ea21428b9220ffbf46054055b19386ba6970ae6665b5e0d2c5eb0b066067bbe1f21757c88f5504eff0c192189081303a5582b16854fccce2fe041f00cdd0a8103b874556405476b62d972ec2c2b90ff3fd8df5cb946549d80b34aea15ccaa94625450e2d0e558b460b7371a734b5e027251a155545678ab62d7eea90b4c504078908c107acb354cb251b1f8f08b1c18631aabbb4d18211404804f22545863561d2f060fb34aa8a18d0086204e72c46a32292e1a796f278c1da7a859d8da9a737506db04d0a24103d8949480b214d3bbee952a05c1d536f9d2684160c744f048311543d459eb1b65ee1754cedae13a64abd5d6127053c9d0281f22d4f75c6a2118a5c09272d7ab740638bf4ef2dd2174032d0d8d04c6fe19c32bedd8bc65e342aa3f785e2784bfd6bc1bd9db24b05505616a4edd67d5a8c1801a03a9962754c504bf34b8986acfb9be91cac7d54315a15541b36b134f74bd2dc53940115a5381e087bc25c6f71be831a8baa234cc1ee3eeb74ed83116beb2b8849d108a3730e8ce27e2bfb82419a7b407ac7c222fd0e6280a8078ce64e47ef54ac9d5be9aaae0162e0de568a44a18d3df90845d919c4f01463406340a44f40efb43a99b371618488e2670d1a2d7ee6f1d3be39342104e937ed85fb86599c33e9ee0be9a004946259d8b858909880d59aa00daa0d3280b5f39e34074c4b3a5434029a76a9e9f5cc0163b5c80024158a1cfc4cb1d3061d5834066cb0a403c008599a70f6bc27b8d03106ea3ae91987278c5b143b015547224ab5e24185cd9b81665273e7b6e7cecd82ddbf8098002de94049737bc09828cf3036f31c3735c8b0e98eb704672f348c7f7c93cd1fb2ae905119ff54e0dff3542b0e9dd983dcea2cc5eea6cf303e74ec687af5c41b6fa38f5e203c7ec8e1238ef85831a214afef21060ea781ec68247b65c6916353cc8b73d1ae79354606af2a930709aa118da1636c274dd7e3774b884a79aa6b5711a538d33cf9c01c1c9b83bc6a1f55c91ccb23b05b1deb43a7decdaffefd2862f61366aa8449c69e33642f012f2bb208fa98eeda1f3346f076c8eeef19475e9be115423364f78f84105a8643d34d90cfbfdcd8cf872589a45dc7f54cf3134a36f4e495c23f9da8db15bccb708d4014f2ca512cb5d4f7c13e84300d5cff6eb39b202bab053bdb9674f0648609427d0f8402ddeac30f4fcd3ced3efc3b422d406c09b340bedc1571e1bfc3d44dc281634c5fe5e758e7395cfbe6d6c130fd17d92372d2cb00c6470000000049454e44ae426082</data>
+ </image>
+ <image name="image1">
+ <data format="PNG" length="1125">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000042c49444154789cb5954f6c14551cc73fefcd7476b65bdaae4bb78bb5502a14d404e4801c88182d1c4c2c693da847400f9c24c68b878684238660e2b1e01f12c19493012ef2478c814412d354a46017a8a564bb6da5bbedccee767776e63d0ffb073751d483bfe49799974c3eeffb7ebf37df9fd05a530b2184040cc0042420aaf9a4d0d554800f045a6b256ae0e1e1e1d6bebebe838ee31c48a7d39b5cd7fd075e251cc7617272f2ded8d8d819cff33e0316819259537aead4a9839d5dd6d1784f91f55b0a94830242088404d304292bef68a89f520802a598fecddaa04f1a876f5c250c7c0a64cdeac686e33807e23d45e6b297c8b877f1831542614550b6599835c83c2a81b6786a75134faf2f1169f12997350881d9021d0903e06de0745d3160a6d3e94dbd5b0a64dcbb94b5831d0e3375ab892b1772dcf9790528543f8dd0d367b36768153b5e31503a0f1aecb004580b44ffac58baae8b1714f0833c7638cc8dab303a320f4822ab4c7a37c69196203de3319d5ce1c4d13c733331dedc67a129a154fd128401ab0616d55a130ac3d42d93d1913940d13fd0c9ee0183685c60da01c5421bd72f7a8c8efccef9afd374267ad93d642365be0636a0d28ec7600941d9e6f23917f0e97f23ce5bef35d19ec863da0ed9059b2be70bec196c66dfa10ec0e49b338f7017258651bf95021035c595429bb0903248fe52a2b5b595dd7b4d945cc2340cdca536be389ee3f67886c5798f773fe8e0dac508c989659277a2180da4ca4ff07821058b8b251445d63d6b13ed1098a6417e39cac85197dbe31962ab9bd9f1f22a226d45366f6d0620fdb08c900d281af6110284b20085b414861d905d88f2e52739ee8cbb8022143259d3dd84691730aa2d52da441a8de0c6958068870022a41e9629ad3473fd3b8fdbe319dadb9b4924da994d2d716c7896fbe35152f78b48245d6b2da4507faf582be8eaf159b721cc837b05ae7debb1f79d08cb8b515edad942a22bc4b1c33eb3d34b1c797f06af90a72d16e2f96d9a74aa11dca8586b222d01af0fb60070f6c402d72f15d97f28c6f6d7027a5f5ce6c3233dc4e2ede496b278be4fff608cee8d3e1add806aeca51094cbb06397c1ecc328e746537c7e3ccdb5cb1136bf60635882d4d41c6ec6836ab37efa214f72208ed9f4d7cdd38ee310280542e38b1c43fb6de26b3672e1ec3cc99bcb246f66a938a3241ab3e91f7c861fbf77710b1e5e49915bae974203ba0e9e9c9cbc373d6d6d305a040a89c2a77f50b27d5782bbbf7acccf28349235dd16cf6dd374f7295e1de8a45c02d37499182b01cc0201a085d61a2144d8b2ac8fb6ed340e77240c4261890e04c250185262546d534a032154b59e0ad394e41c98182bf268ce6721ed9f064e0253356f6da2e24c1f030f783c15fe6da680af8021602bd051532ca9b8521488559f61aa86c29343578fbf0264a94c906c7d3409214c20043457a116ff6de6795578012889ff6b98fe016ea0ce1c203e47720000000049454e44ae426082</data>
+ </image>
+</images>
+<tabstops>
+ <tabstop>tabWidget2</tabstop>
+ <tabstop>nameBox</tabstop>
+ <tabstop>raBox</tabstop>
+ <tabstop>decBox</tabstop>
+ <tabstop>epochName</tabstop>
+ <tabstop>addButton</tabstop>
+ <tabstop>browseButton</tabstop>
+ <tabstop>clearFieldsButton</tabstop>
+ <tabstop>clearButton</tabstop>
+ <tabstop>PlotList</tabstop>
+ <tabstop>cityButton</tabstop>
+ <tabstop>longBox</tabstop>
+ <tabstop>latBox</tabstop>
+ <tabstop>updateButton</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>dmsbox.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argchangeviewoption.ui b/kstars/kstars/tools/argchangeviewoption.ui
new file mode 100644
index 00000000..2445322a
--- /dev/null
+++ b/kstars/kstars/tools/argchangeviewoption.ui
@@ -0,0 +1,141 @@
+<!DOCTYPE UI><UI version="3.1.2" stdsetdef="1">
+<class>ArgChangeViewOption</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgChangeViewOption</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>260</width>
+ <height>171</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>OptionName</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>List of adjustable options</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Select an option from this list to set its value. You may also select the option using an organized Tree List using the "Browse Tree" button.</string>
+ </property>
+ </widget>
+ <spacer row="1" column="0">
+ <property name="name">
+ <cstring>spacer23</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>50</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Value:</string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="1" column="1">
+ <property name="name">
+ <cstring>TreeButton</cstring>
+ </property>
+ <property name="text">
+ <string>Browse Tree</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Show Tree View of options</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Press this button to select a View Option from a Tree list, in which they are grouped by subject. Also shown are a short description of each option, and the data type of the option's value (string, integer, float or boolean).</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="3" column="1">
+ <property name="name">
+ <cstring>OptionValue</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>value for selected option</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Set the value for the selected view option here. Make sure the value you enter matches the data type expected by the option. For example, the "UseAltAz" option expects a boolean value, so you should enter "true", "false", "1", or "0". If you are unsure what data type is expected, examine the Tree View of options using the "Browse Tree" button.</string>
+ </property>
+ </widget>
+ <spacer row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>160</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Option:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer24</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argexportimage.ui b/kstars/kstars/tools/argexportimage.ui
new file mode 100644
index 00000000..f5e0d0fb
--- /dev/null
+++ b/kstars/kstars/tools/argexportimage.ui
@@ -0,0 +1,262 @@
+<!DOCTYPE UI><UI version="3.1.2" stdsetdef="1">
+<class>ArgExportImage</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgExportImage</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>302</width>
+ <height>131</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout7</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>File name:</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester">
+ <property name="name">
+ <cstring>ExportFileName</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>160</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KIntNumInput" row="1" column="1">
+ <property name="name">
+ <cstring>ExportHeight</cstring>
+ </property>
+ <property name="value">
+ <number>600</number>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="maxValue">
+ <number>5000</number>
+ </property>
+ </widget>
+ <widget class="KIntNumInput" row="0" column="1">
+ <property name="name">
+ <cstring>ExportWidth</cstring>
+ </property>
+ <property name="value">
+ <number>800</number>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="maxValue">
+ <number>5000</number>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Image width:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Image height:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>KIntNumInput</class>
+ <header location="local">knuminput.h</header>
+ <sizehint>
+ <width>-1</width>
+ <height>-1</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ <signal>destroyed()</signal>
+ <signal>destroyed(QObject*)</signal>
+ <signal>valueChanged(int)</signal>
+ <signal>relativeValueChanged(double)</signal>
+ <slot access="public" specifier="">deleteLater()</slot>
+ <slot access="private" specifier="">cleanupEventFilter(QObject*)</slot>
+ <slot access="public" specifier="">setEnabled(bool)</slot>
+ <slot access="public" specifier="">setDisabled(bool)</slot>
+ <slot access="public" specifier="">setCaption(const QString&amp;)</slot>
+ <slot access="public" specifier="">setIcon(const QPixmap&amp;)</slot>
+ <slot access="public" specifier="">setIconText(const QString&amp;)</slot>
+ <slot access="public" specifier="">setMouseTracking(bool)</slot>
+ <slot access="public" specifier="">setFocus()</slot>
+ <slot access="public" specifier="">clearFocus()</slot>
+ <slot access="public" specifier="">setUpdatesEnabled(bool)</slot>
+ <slot access="public" specifier="">update()</slot>
+ <slot access="public" specifier="">update(int,int,int,int)</slot>
+ <slot access="public" specifier="">update(const QRect&amp;)</slot>
+ <slot access="public" specifier="">repaint()</slot>
+ <slot access="public" specifier="">repaint(bool)</slot>
+ <slot access="public" specifier="">repaint(int,int,int,int)</slot>
+ <slot access="public" specifier="">repaint(int,int,int,int,bool)</slot>
+ <slot access="public" specifier="">repaint(const QRect&amp;)</slot>
+ <slot access="public" specifier="">repaint(const QRect&amp;,bool)</slot>
+ <slot access="public" specifier="">repaint(const QRegion&amp;)</slot>
+ <slot access="public" specifier="">repaint(const QRegion&amp;,bool)</slot>
+ <slot access="public" specifier="">show()</slot>
+ <slot access="public" specifier="">hide()</slot>
+ <slot access="public" specifier="">setShown(bool)</slot>
+ <slot access="public" specifier="">setHidden(bool)</slot>
+ <slot access="public" specifier="">iconify()</slot>
+ <slot access="public" specifier="">showMinimized()</slot>
+ <slot access="public" specifier="">showMaximized()</slot>
+ <slot access="public" specifier="">showFullScreen()</slot>
+ <slot access="public" specifier="">showNormal()</slot>
+ <slot access="public" specifier="">polish()</slot>
+ <slot access="public" specifier="">constPolish()</slot>
+ <slot access="public" specifier="">close()</slot>
+ <slot access="public" specifier="">raise()</slot>
+ <slot access="public" specifier="">lower()</slot>
+ <slot access="public" specifier="">stackUnder(QWidget*)</slot>
+ <slot access="public" specifier="">move(int,int)</slot>
+ <slot access="public" specifier="">move(const QPoint&amp;)</slot>
+ <slot access="public" specifier="">resize(int,int)</slot>
+ <slot access="public" specifier="">resize(const QSize&amp;)</slot>
+ <slot access="public" specifier="">setGeometry(int,int,int,int)</slot>
+ <slot access="public" specifier="">setGeometry(const QRect&amp;)</slot>
+ <slot access="public" specifier="">adjustSize()</slot>
+ <slot access="private" specifier="">focusProxyDestroyed()</slot>
+ <slot access="public" specifier="">setValue(int)</slot>
+ <slot access="public" specifier="">setRelativeValue(double)</slot>
+ <slot access="public" specifier="">setReferencePoint(int)</slot>
+ <slot access="public" specifier="">setSuffix(const QString&amp;)</slot>
+ <slot access="public" specifier="">setPrefix(const QString&amp;)</slot>
+ <slot access="public" specifier="">setEditFocus()</slot>
+ <slot access="public" specifier="">setEditFocus(bool)</slot>
+ <slot access="private" specifier="">spinValueChanged(int)</slot>
+ <slot access="private" specifier="">slotEmitRelativeValueChanged(int)</slot>
+ <property type="CString">name</property>
+ <property type="Bool">enabled</property>
+ <property type="Rect">geometry</property>
+ <property type="SizePolicy">sizePolicy</property>
+ <property type="Size">minimumSize</property>
+ <property type="Size">maximumSize</property>
+ <property type="Size">sizeIncrement</property>
+ <property type="Size">baseSize</property>
+ <property type="Color">paletteForegroundColor</property>
+ <property type="Color">paletteBackgroundColor</property>
+ <property type="Pixmap">paletteBackgroundPixmap</property>
+ <property type="Palette">palette</property>
+ <property type="BackgroundOrigin">backgroundOrigin</property>
+ <property type="Font">font</property>
+ <property type="Cursor">cursor</property>
+ <property type="String">caption</property>
+ <property type="Pixmap">icon</property>
+ <property type="String">iconText</property>
+ <property type="Bool">mouseTracking</property>
+ <property type="FocusPolicy">focusPolicy</property>
+ <property type="Bool">acceptDrops</property>
+ <property type="String">label</property>
+ <property type="Int">value</property>
+ <property type="Int">minValue</property>
+ <property type="Int">maxValue</property>
+ <property type="Int">referencePoint</property>
+ <property type="String">suffix</property>
+ <property type="String">prefix</property>
+ <property type="String">specialValueText</property>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1125">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000042c49444154789cb5954f6c14551cc73fefcd7476b65bdaae4bb78bb5502a14d404e4801c88182d1c4c2c693da847400f9c24c68b878684238660e2b1e01f12c19493012ef2478c814412d354a46017a8a564bb6da5bbedccee767776e63d0ffb073751d483bfe49799974c3eeffb7ebf37df9fd05a530b2184040cc0042420aaf9a4d0d554800f045a6b256ae0e1e1e1d6bebebe838ee31c48a7d39b5cd7fd075e251cc7617272f2ded8d8d819cff33e0316819259537aead4a9839d5dd6d1784f91f55b0a94830242088404d304292bef68a89f520802a598fecddaa04f1a876f5c250c7c0a64cdeac686e33807e23d45e6b297c8b877f1831542614550b6599835c83c2a81b6786a75134faf2f1169f12997350881d9021d0903e06de0745d3160a6d3e94dbd5b0a64dcbb94b5831d0e3375ab892b1772dcf9790528543f8dd0d367b36768153b5e31503a0f1aecb004580b44ffac58baae8b1714f0833c7638cc8dab303a320f4822ab4c7a37c69196203de3319d5ce1c4d13c733331dedc67a129a154fd128401ab0616d55a130ac3d42d93d1913940d13fd0c9ee0183685c60da01c5421bd72f7a8c8efccef9afd374267ad93d642365be0636a0d28ec7600941d9e6f23917f0e97f23ce5bef35d19ec863da0ed9059b2be70bec196c66dfa10ec0e49b338f7017258651bf95021035c595429bb0903248fe52a2b5b595dd7b4d945cc2340cdca536be389ee3f67886c5798f773fe8e0dac508c989659277a2180da4ca4ff07821058b8b251445d63d6b13ed1098a6417e39cac85197dbe31962ab9bd9f1f22a226d45366f6d0620fdb08c900d281af6110284b20085b414861d905d88f2e52739ee8cbb8022143259d3dd84691730aa2d52da441a8de0c6958068870022a41e9629ad3473fd3b8fdbe319dadb9b4924da994d2d716c7896fbe35152f78b48245d6b2da4507faf582be8eaf159b721cc837b05ae7debb1f79d08cb8b515edad942a22bc4b1c33eb3d34b1c797f06af90a72d16e2f96d9a74aa11dca8586b222d01af0fb60070f6c402d72f15d97f28c6f6d7027a5f5ce6c3233dc4e2ede496b278be4fff608cee8d3e1add806aeca51094cbb06397c1ecc328e746537c7e3ccdb5cb1136bf60635882d4d41c6ec6836ab37efa214f72208ed9f4d7cdd38ee310280542e38b1c43fb6de26b3672e1ec3cc99bcb246f66a938a3241ab3e91f7c861fbf77710b1e5e49915bae974203ba0e9e9c9cbc373d6d6d305a040a89c2a77f50b27d5782bbbf7acccf28349235dd16cf6dd374f7295e1de8a45c02d37499182b01cc0201a085d61a2144d8b2ac8fb6ed340e77240c4261890e04c250185262546d534a032154b59e0ad394e41c98182bf268ce6721ed9f064e0253356f6da2e24c1f030f783c15fe6da680af8021602bd051532ca9b8521488559f61aa86c29343578fbf0264a94c906c7d3409214c20043457a116ff6de6795578012889ff6b98fe016ea0ce1c203e47720000000049454e44ae426082</data>
+ </image>
+</images>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>knuminput.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argloadcolorscheme.ui b/kstars/kstars/tools/argloadcolorscheme.ui
new file mode 100644
index 00000000..addc92eb
--- /dev/null
+++ b/kstars/kstars/tools/argloadcolorscheme.ui
@@ -0,0 +1,27 @@
+<!DOCTYPE UI><UI version="3.1.2" stdsetdef="1">
+<class>ArgLoadColorScheme</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgLoadColorScheme</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>329</width>
+ <height>180</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KListBox">
+ <property name="name">
+ <cstring>SchemeList</cstring>
+ </property>
+ </widget>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kstars/kstars/tools/arglooktoward.ui b/kstars/kstars/tools/arglooktoward.ui
new file mode 100644
index 00000000..5d28243b
--- /dev/null
+++ b/kstars/kstars/tools/arglooktoward.ui
@@ -0,0 +1,162 @@
+<!DOCTYPE UI><UI version="3.1.2" stdsetdef="1">
+<class>ArgLookToward</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgLookToward</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>311</width>
+ <height>69</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout12</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Dir:</string>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <item>
+ <property name="text">
+ <string></string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>north</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>northeast</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>east</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>southeast</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>south</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>southwest</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>west</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>northwest</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>zenith</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>FocusEdit</cstring>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Target object or direction</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Select a direction or object to center on. The combo box provides a list of known directions including cardinal compass points on the horizon, as well as the Zenith. You may also enter the name of a known object here, or select an object from the list of known objects by pressing the "Object" button.</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>FindButton</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>Object</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Select object from a list</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Opens the Find Object dialog, which allows you to select an object from the list of known objects. When an object has been selected, its name will appear in the "dir" box at left.</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argprintimage.ui b/kstars/kstars/tools/argprintimage.ui
new file mode 100644
index 00000000..a8bc4a24
--- /dev/null
+++ b/kstars/kstars/tools/argprintimage.ui
@@ -0,0 +1,58 @@
+<!DOCTYPE UI><UI version="3.1.2" stdsetdef="1">
+<class>ArgPrintImage</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgPrintImage</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>258</width>
+ <height>190</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>UsePrintDialog</cstring>
+ </property>
+ <property name="text">
+ <string>Show print dialog</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>UseChartColors</cstring>
+ </property>
+ <property name="text">
+ <string>Use star chart colors</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>70</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kstars/kstars/tools/argsetactionindi.ui b/kstars/kstars/tools/argsetactionindi.ui
new file mode 100644
index 00000000..8446c010
--- /dev/null
+++ b/kstars/kstars/tools/argsetactionindi.ui
@@ -0,0 +1,121 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ArgSetActionINDI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgSetActionINDI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>282</width>
+ <height>93</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>argSetActionINDI</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout50</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout47</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Device:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Action:</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout48</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>deviceName</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>actionName</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer24</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>61</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>9</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argsetaltaz.ui b/kstars/kstars/tools/argsetaltaz.ui
new file mode 100644
index 00000000..5c40d16a
--- /dev/null
+++ b/kstars/kstars/tools/argsetaltaz.ui
@@ -0,0 +1,144 @@
+<!DOCTYPE UI><UI version="3.1.2" stdsetdef="1">
+<class>ArgSetAltAz</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgSetAltAz</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>285</width>
+ <height>96</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout13</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>AltBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Altitude angle</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Set the Altitude coordinate to be focused on in the sky map, in degrees. You can express the angle as a simple integer ("45") or floating-point ("45.333") value, or as space- or colon-delimited values specifying degrees, arcminutes and arcseconds ("45:20", "45:20:00", "45:20", "45 20.0", etc.).
+
+The Altitude is one of the coordinates in the Horizontal coordinate system. It is defined as the angle of an object above or below the horizon. For example, the Zenith has an Altitude of 90 degrees. Altitude is also known as Elevation.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Az:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>AzBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Azimuth angle</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Set the Azimuth coordinate to be focused on in the skymap, in degrees. You can express the angle as a simple integer ("45") or floating-point ("45.333") value, or as space- or colon-delimited values specifying degrees, arcminutes and arcseconds ("45:20", "45:20:00", "45:20", "45 20.0", etc.).
+
+The azimuth is one of the coordinates in the horizontal coordinate system. It is defined as the angle measured along the horizon, between the North point and the point on the horizon directly below the object. Azimuth increases clockwise around the horizon</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Alt:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>dmsBox</class>
+ <header location="global">dmsbox.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="4350">789c6dd7594f23471007f0f7fd14d6d6db2aaaf58c3db647511eb831b7317794879ac30760cc61c010e5bba7dcf5af5688167664fdb66bbaababbb67cccf1f8dab93c3c68f9fdf5e16b298968d7222cf8d1fd5eb6cf6f1e75f7ffcfded7b9a3656ff9aad46fafdb76fdf078b46d9389a3fd42bf04841699e964933b830b79a7019dd0b96955b895b5a703bcd572e08eea576ff6570ae0eedd477b792103f854b8b2fc6d1163f77237e646e37113f89b6f8307e3bf1785a8b0eedbc696eb7ad9db7e01ee6476ee4ffe0c6fd158c7c69182cde4eec6e87fea50dfbf8176e6ba7d07f96669999cfa325ccaf862bcc97a36dbccf60f178cee11cde706761f16917ae30fe6b7488a7851bf14d7327417f676eb4f756eea41e2f57e6d83e83919f6cba117f04235fd9765b3b0fa36dfc398cf973edc67a6fb951ffe768ab6765ee26b8dff213ef5f4630e2b9e7463ea7ee8ee5ff60ee2618af8eb6fe3238437eb91bf1299cdbfacad3cadd5617f5a11738c7fe4adcb8ffd68d7aeec15e8fc3683b9f62ee2518ef33dafa3f75e3bc957086f86eb4d56f3db8e8e6dd56f01a5cc1bbe65e629673d8ebd18d0efdc9058cf9f2c08df9e630ce037db8719ec37c7a9a7fb708f10267b65e7cef46fb3e9ca3fd23dad6ef0cf67abe99f304f95ec3a8871cbb71be52d8d777e8b6fee412f6f958be3adf5ea817b561afe7d86ded7c67ce13c46fc37ede2766c17a17059cd9f38e466e8c3f8eb6fd700f0b9ef7095c37cd3d37de178f2be76dcf876fa343bd790267f012f67a77cc319f69b4ed872e2ca8e732daeabfe3c6fa9cc235f21f9b8bd4f2a5cd687bfedbfd659ee7ede017b842becf6eb44fa3cbd0df8559b0ffe808ceb0ff37e01afba3652e52cc87a26dbe276ecca7097790ff73b4cdef0616ac4fdf6df1c2d1d67ee8c6f80318eb4bd1180ff529513f0ecf7b694b62f5a002ceccb2662e523c2fb7605f9f0fd8fbbf75e3bc2dcd3e9ebcb9f17ce8c05e8f83685bcf701e44eb2db65e4fd1b65eebe62245be53b8c6f3ffdd8dfd3933fbf884761f5f0edcd88f951bf118bf44bde926dae24fe01ae7af76e3f9169e2f45bb143c0f5fdcf6fea23b18f773eac6f3e63ddac6db75e37df5e8c6fbae65aebcde6d37beaf84f528aa52f03c9dc3359ea79939c627d136deab1befaf75b883ef23e76e3ccfaea36d7dc2f795322b05ebfb0ad738af7db7ad371f99fd7e59b8b13f276e9cdf1318f5e54337e6d78cb67cf761ec170efba1acaa1afd9db92d3f3a36d729ea77efc6f33cbccf2beddfe6478fe6d85e45dbfd851bf1577007f5d877e3bc86f5a9ea3a2d6cffdfc1debe116df5db73a39e37b0e777191dda257c7fa83b6e8a2eaae00eeceb13d6b7d69f325b79b058fd32b170c1a55ebffaac2ccae2b9e6118f79c253bd6ef9ee3fd7587fef79c60f7acf3cc617fcc84ffcac6d8ffcc20b7ee5377ee7257ff027aff1bac66ff0269716cf5b1ab7cd3bbcabb17ddee37d3ee0433ee2633ee1019ff290cff89c2ff89229c48b66f1ac3d5df135df7093134eb9c56dcef4b3c35dee71ce393111dbfa8c784a4205955451cd1d1ad1982634a55bbad3f80eddd38c1ef882e66cf52ab5ff2b8d7ea4277aa6175ad06bb866f446efb4d4df0ffad4fed762ffb7b44e1b9cd2266dd142c75e5ddb3cd0bb3e347a477bd9d5f83ee245e3f7689f0ee830f67d44c77412ee186946033aa5e197fecfe85c7bf7be2fe892aee89a6ea84989f6bfa434f4eff9df52c509b5d0779b32ea684d13ea528f728d1e882ebfce37f6cf077422b4ea5b440ad14af1a15452ab473aee52c65ff39789b64fe955f44eb9937b5d858c5b32d377c0c32a7fee7ecd5fe61aff284ff22c2fb290577993775db1443fb53ef2219f5ff2bf93356d5b970dd9d41eb77820dbb223bbab155ed55ffab2f725ffb1eccb81aed6931cca116ab490633909d10339fd5ffdef795d869ae7923bc27226e772415d5986b51d683663b9d4fcfbb1ff190fe54aaec35aeaa577ee20f24673e94b531249a585fc2b69ebfe3ed7dae91f75ba964b5c03e9d344ba1add93bce0826c3f87f3b2a9fb6f18aeba10ba2f563f25eb1b563771a5d17531e2513c5fba538b3111cd690dd73c7ef6a95f4c8aa99de12fe77da4951de9ffffea730be7fd9fdfbffd0b690edc6c</data>
+ </image>
+</images>
+<tabstops>
+ <tabstop>AzBox</tabstop>
+ <tabstop>AltBox</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argsetccdtempindi.ui b/kstars/kstars/tools/argsetccdtempindi.ui
new file mode 100644
index 00000000..28822d8a
--- /dev/null
+++ b/kstars/kstars/tools/argsetccdtempindi.ui
@@ -0,0 +1,123 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ArgSetCCDTempINDI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgSetCCDTempINDI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>224</width>
+ <height>95</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout64</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout63</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Device:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Temp:</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout62</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>deviceName</cstring>
+ </property>
+ </widget>
+ <widget class="KIntNumInput">
+ <property name="name">
+ <cstring>temp</cstring>
+ </property>
+ <property name="minValue">
+ <number>-150</number>
+ </property>
+ <property name="maxValue">
+ <number>50</number>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer24</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>27</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>9</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argsetcolor.ui b/kstars/kstars/tools/argsetcolor.ui
new file mode 100644
index 00000000..662b1ebe
--- /dev/null
+++ b/kstars/kstars/tools/argsetcolor.ui
@@ -0,0 +1,225 @@
+<!DOCTYPE UI><UI version="3.1.2" stdsetdef="1">
+<class>ArgSetColor</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgSetColor</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>334</width>
+ <height>200</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout11</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Color name:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Color value:</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="1">
+ <property name="name">
+ <cstring>layout10</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KColorButton">
+ <property name="name">
+ <cstring>ColorValue</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer10</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="KComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>ColorName</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer11</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>KColorButton</class>
+ <header location="local">kcolorbutton.h</header>
+ <sizehint>
+ <width>-1</width>
+ <height>-1</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ <signal>destroyed()</signal>
+ <signal>destroyed(QObject*)</signal>
+ <signal>pressed()</signal>
+ <signal>released()</signal>
+ <signal>clicked()</signal>
+ <signal>toggled(bool)</signal>
+ <signal>stateChanged(int)</signal>
+ <signal>changed(const QColor&amp;)</signal>
+ <slot access="public" specifier="">deleteLater()</slot>
+ <slot access="private" specifier="">cleanupEventFilter(QObject*)</slot>
+ <slot access="public" specifier="">setEnabled(bool)</slot>
+ <slot access="public" specifier="">setDisabled(bool)</slot>
+ <slot access="public" specifier="">setCaption(const QString&amp;)</slot>
+ <slot access="public" specifier="">setIcon(const QPixmap&amp;)</slot>
+ <slot access="public" specifier="">setIconText(const QString&amp;)</slot>
+ <slot access="public" specifier="">setMouseTracking(bool)</slot>
+ <slot access="public" specifier="">setFocus()</slot>
+ <slot access="public" specifier="">clearFocus()</slot>
+ <slot access="public" specifier="">setUpdatesEnabled(bool)</slot>
+ <slot access="public" specifier="">update()</slot>
+ <slot access="public" specifier="">update(int,int,int,int)</slot>
+ <slot access="public" specifier="">update(const QRect&amp;)</slot>
+ <slot access="public" specifier="">repaint()</slot>
+ <slot access="public" specifier="">repaint(bool)</slot>
+ <slot access="public" specifier="">repaint(int,int,int,int)</slot>
+ <slot access="public" specifier="">repaint(int,int,int,int,bool)</slot>
+ <slot access="public" specifier="">repaint(const QRect&amp;)</slot>
+ <slot access="public" specifier="">repaint(const QRect&amp;,bool)</slot>
+ <slot access="public" specifier="">repaint(const QRegion&amp;)</slot>
+ <slot access="public" specifier="">repaint(const QRegion&amp;,bool)</slot>
+ <slot access="public" specifier="">show()</slot>
+ <slot access="public" specifier="">hide()</slot>
+ <slot access="public" specifier="">setShown(bool)</slot>
+ <slot access="public" specifier="">setHidden(bool)</slot>
+ <slot access="public" specifier="">iconify()</slot>
+ <slot access="public" specifier="">showMinimized()</slot>
+ <slot access="public" specifier="">showMaximized()</slot>
+ <slot access="public" specifier="">showFullScreen()</slot>
+ <slot access="public" specifier="">showNormal()</slot>
+ <slot access="public" specifier="">polish()</slot>
+ <slot access="public" specifier="">constPolish()</slot>
+ <slot access="public" specifier="">close()</slot>
+ <slot access="public" specifier="">raise()</slot>
+ <slot access="public" specifier="">lower()</slot>
+ <slot access="public" specifier="">stackUnder(QWidget*)</slot>
+ <slot access="public" specifier="">move(int,int)</slot>
+ <slot access="public" specifier="">move(const QPoint&amp;)</slot>
+ <slot access="public" specifier="">resize(int,int)</slot>
+ <slot access="public" specifier="">resize(const QSize&amp;)</slot>
+ <slot access="public" specifier="">setGeometry(int,int,int,int)</slot>
+ <slot access="public" specifier="">setGeometry(const QRect&amp;)</slot>
+ <slot access="public" specifier="">adjustSize()</slot>
+ <slot access="private" specifier="">focusProxyDestroyed()</slot>
+ <slot access="public" specifier="">animateClick()</slot>
+ <slot access="public" specifier="">toggle()</slot>
+ <slot access="private" specifier="">animateTimeout()</slot>
+ <slot access="private" specifier="">autoRepeatTimeout()</slot>
+ <slot access="private" specifier="">emulateClick()</slot>
+ <slot access="public" specifier="">setOn(bool)</slot>
+ <slot access="private" specifier="">popupPressed()</slot>
+ <slot access="protected" specifier="">chooseColor()</slot>
+ <property type="CString">name</property>
+ <property type="Bool">enabled</property>
+ <property type="Rect">geometry</property>
+ <property type="SizePolicy">sizePolicy</property>
+ <property type="Size">minimumSize</property>
+ <property type="Size">maximumSize</property>
+ <property type="Size">sizeIncrement</property>
+ <property type="Size">baseSize</property>
+ <property type="Color">paletteForegroundColor</property>
+ <property type="Color">paletteBackgroundColor</property>
+ <property type="Pixmap">paletteBackgroundPixmap</property>
+ <property type="Palette">palette</property>
+ <property type="BackgroundOrigin">backgroundOrigin</property>
+ <property type="Font">font</property>
+ <property type="Cursor">cursor</property>
+ <property type="String">caption</property>
+ <property type="Pixmap">icon</property>
+ <property type="String">iconText</property>
+ <property type="Bool">mouseTracking</property>
+ <property type="FocusPolicy">focusPolicy</property>
+ <property type="Bool">acceptDrops</property>
+ <property type="String">text</property>
+ <property type="Pixmap">pixmap</property>
+ <property type="KeySequence">accel</property>
+ <property type="Bool">autoRepeat</property>
+ <property type="Bool">autoDefault</property>
+ <property type="Bool">default</property>
+ <property type="IconSet">iconSet</property>
+ <property type="Bool">toggleButton</property>
+ <property type="Bool">on</property>
+ <property type="Bool">flat</property>
+ <property type="Bool">autoMask</property>
+ <property type="Color">color</property>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1125">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000042c49444154789cb5954f6c14551cc73fefcd7476b65bdaae4bb78bb5502a14d404e4801c88182d1c4c2c693da847400f9c24c68b878684238660e2b1e01f12c19493012ef2478c814412d354a46017a8a564bb6da5bbedccee767776e63d0ffb073751d483bfe49799974c3eeffb7ebf37df9fd05a530b2184040cc0042420aaf9a4d0d554800f045a6b256ae0e1e1e1d6bebebe838ee31c48a7d39b5cd7fd075e251cc7617272f2ded8d8d819cff33e0316819259537aead4a9839d5dd6d1784f91f55b0a94830242088404d304292bef68a89f520802a598fecddaa04f1a876f5c250c7c0a64cdeac686e33807e23d45e6b297c8b877f1831542614550b6599835c83c2a81b6786a75134faf2f1169f12997350881d9021d0903e06de0745d3160a6d3e94dbd5b0a64dcbb94b5831d0e3375ab892b1772dcf9790528543f8dd0d367b36768153b5e31503a0f1aecb004580b44ffac58baae8b1714f0833c7638cc8dab303a320f4822ab4c7a37c69196203de3319d5ce1c4d13c733331dedc67a129a154fd128401ab0616d55a130ac3d42d93d1913940d13fd0c9ee0183685c60da01c5421bd72f7a8c8efccef9afd374267ad93d642365be0636a0d28ec7600941d9e6f23917f0e97f23ce5bef35d19ec863da0ed9059b2be70bec196c66dfa10ec0e49b338f7017258651bf95021035c595429bb0903248fe52a2b5b595dd7b4d945cc2340cdca536be389ee3f67886c5798f773fe8e0dac508c989659277a2180da4ca4ff07821058b8b251445d63d6b13ed1098a6417e39cac85197dbe31962ab9bd9f1f22a226d45366f6d0620fdb08c900d281af6110284b20085b414861d905d88f2e52739ee8cbb8022143259d3dd84691730aa2d52da441a8de0c6958068870022a41e9629ad3473fd3b8fdbe319dadb9b4924da994d2d716c7896fbe35152f78b48245d6b2da4507faf582be8eaf159b721cc837b05ae7debb1f79d08cb8b515edad942a22bc4b1c33eb3d34b1c797f06af90a72d16e2f96d9a74aa11dca8586b222d01af0fb60070f6c402d72f15d97f28c6f6d7027a5f5ce6c3233dc4e2ede496b278be4fff608cee8d3e1add806aeca51094cbb06397c1ecc328e746537c7e3ccdb5cb1136bf60635882d4d41c6ec6836ab37efa214f72208ed9f4d7cdd38ee310280542e38b1c43fb6de26b3672e1ec3cc99bcb246f66a938a3241ab3e91f7c861fbf77710b1e5e49915bae974203ba0e9e9c9cbc373d6d6d305a040a89c2a77f50b27d5782bbbf7acccf28349235dd16cf6dd374f7295e1de8a45c02d37499182b01cc0201a085d61a2144d8b2ac8fb6ed340e77240c4261890e04c250185262546d534a032154b59e0ad394e41c98182bf268ce6721ed9f064e0253356f6da2e24c1f030f783c15fe6da680af8021602bd051532ca9b8521488559f61aa86c29343578fbf0264a94c906c7d3409214c20043457a116ff6de6795578012889ff6b98fe016ea0ce1c203e47720000000049454e44ae426082</data>
+ </image>
+</images>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kcolorbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argsetfilternumindi.ui b/kstars/kstars/tools/argsetfilternumindi.ui
new file mode 100644
index 00000000..17e58302
--- /dev/null
+++ b/kstars/kstars/tools/argsetfilternumindi.ui
@@ -0,0 +1,126 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ArgSetFilterNumINDI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgSetFilterNumINDI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>224</width>
+ <height>95</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>ArgSetCCDTempINDI</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout64</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout63</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Device:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Filter:</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout62</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>deviceName</cstring>
+ </property>
+ </widget>
+ <widget class="KIntNumInput">
+ <property name="name">
+ <cstring>filter_num</cstring>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="maxValue">
+ <number>20</number>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer24</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>27</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>9</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argsetfocusspeedindi.ui b/kstars/kstars/tools/argsetfocusspeedindi.ui
new file mode 100644
index 00000000..73023c28
--- /dev/null
+++ b/kstars/kstars/tools/argsetfocusspeedindi.ui
@@ -0,0 +1,93 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ArgSetFocusSpeedINDI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgSetFocusSpeedINDI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>223</width>
+ <height>101</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer row="2" column="1">
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>9</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="0" column="2" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>spacer24</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>45</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>deviceName</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Device:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Speed:</string>
+ </property>
+ </widget>
+ <widget class="KIntNumInput" row="1" column="1">
+ <property name="name">
+ <cstring>speedIN</cstring>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="maxValue">
+ <number>3</number>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argsetfocustimeoutindi.ui b/kstars/kstars/tools/argsetfocustimeoutindi.ui
new file mode 100644
index 00000000..fd7a827c
--- /dev/null
+++ b/kstars/kstars/tools/argsetfocustimeoutindi.ui
@@ -0,0 +1,123 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ArgSetFocusTimeoutINDI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgSetFocusTimeoutINDI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>221</width>
+ <height>95</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout64</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout63</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Device:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Timeout:</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout62</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>deviceName</cstring>
+ </property>
+ </widget>
+ <widget class="KIntNumInput">
+ <property name="name">
+ <cstring>timeOut</cstring>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="maxValue">
+ <number>120</number>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer24</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>27</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>9</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argsetframetypeindi.ui b/kstars/kstars/tools/argsetframetypeindi.ui
new file mode 100644
index 00000000..4400fe06
--- /dev/null
+++ b/kstars/kstars/tools/argsetframetypeindi.ui
@@ -0,0 +1,115 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ArgSetFrameTypeINDI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgSetFrameTypeINDI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>222</width>
+ <height>101</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout55</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout47</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Device:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Type:</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout54</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>deviceName</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <property name="name">
+ <cstring>typeCombo</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer24</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>56</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>9</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argsetgeolocation.ui b/kstars/kstars/tools/argsetgeolocation.ui
new file mode 100644
index 00000000..00e0f7b0
--- /dev/null
+++ b/kstars/kstars/tools/argsetgeolocation.ui
@@ -0,0 +1,201 @@
+<!DOCTYPE UI><UI version="3.1.2" stdsetdef="1">
+<class>ArgSetGeoLocation</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgSetGeoLocation</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>316</width>
+ <height>208</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout36</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout35</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout34</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Province:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>CountryName</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Country name</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Enter the Country name for the desired location. It might be easier to use the "Find City" location to choose your location from the list of predefined cities.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>City:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel1_2_3</cstring>
+ </property>
+ <property name="text">
+ <string>Country:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>CityName</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>City name</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Enter the City name for the desired location. It might be easier to use the "Find City" location to choose your location from the list of predefined cities.</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>ProvinceName</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Province name</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Enter the Province name for the desired location. It might be easier to use the "Find City" location to choose your location from the list of predefined cities.</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout33</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer23_3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>49</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>FindCityButton</cstring>
+ </property>
+ <property name="text">
+ <string>Find City</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Open the Set Location tool</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Press this button to open the Set Location dialog, which will allow you to choose a location from our list of over 2500 cities around the word. Once a location has been selected, the City, Province and Country fields will be filled in.</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer23</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>49</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer27</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<tabstops>
+ <tabstop>CityName</tabstop>
+ <tabstop>ProvinceName</tabstop>
+ <tabstop>CountryName</tabstop>
+ <tabstop>FindCityButton</tabstop>
+</tabstops>
+<slots>
+ <slot>slotFindCity()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argsetgeolocationindi.ui b/kstars/kstars/tools/argsetgeolocationindi.ui
new file mode 100644
index 00000000..6dd5fbf8
--- /dev/null
+++ b/kstars/kstars/tools/argsetgeolocationindi.ui
@@ -0,0 +1,170 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ArgSetGeoLocationINDI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgSetGeoLocationINDI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>267</width>
+ <height>129</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout34</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout32</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_3</cstring>
+ </property>
+ <property name="text">
+ <string>Device:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Long:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Lat:</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout33</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>deviceName</cstring>
+ </property>
+ </widget>
+ <widget class="dmsBox">
+ <property name="name">
+ <cstring>longBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="dmsBox">
+ <property name="name">
+ <cstring>latBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>23</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>dmsBox</class>
+ <header location="global">dmsbox.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1114">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000042149444154789c8d95c18b1c4514c67fbb29e5b54ea05b26da1d36b08d096e8b11261871837bc8e282ac7ac82187e049a317e32d37110992bf42123c694eea414c0e0bf1b0ec6c402139485a54e8810c54c10e741146fa110bd643f74c12bd642e4d75f77cf5d5ef7dafdfc2ce7087d9eff32fdfdff74e5114104011e489d6e952cce5cfbe5998692dec0c77b87aedd3fddd9f2b3efce02291082209aa3504685022e4ffd7a000a82a765c515615ce95acae659c3f7765c100ec6e575cf8f822e991025f3b6a6f890c484f181ccfc1583428f5d4e2fe84da039aa04121b40eb32483a0ec6e5bce9f8385d36fa7fb9b1b17c8f31cbfe7a95c45be94520c72b2141a1caa160d1666e24ea94aa11ee7685054159d2ada34d41387c40dc63b8844f0b5c73a4bb19cb3f9de001f2aac1fa23aa209168c004224902e29d22ff1e38abbdb275055c4800610233867311a1491847a62c98f66ac6f14d8e99072f22daa15b68a8108424d6422e24c88e3966fbce4c9d786945b27f0be0103ed13c16004d59a2c4d58df28a87548e9aee2274ab95d60c7193c9a0281fc959ae2a4450364a9e2572c7a2b43438374ef2dd2154012d050514dbec7396578a3130d9d6850066f0ad9d186f2d78cdbbb799b0a202f2c48d3aebbb418310240b112637588574bf54b8efaa4fd9b691dacbf5b305813542bae63a9eee4c4694d967b5494eca8c7ef0933bdc5d90e6a2caa0e3f013b7adce9fa5b03d637561113a30106a71d18c5fd9677058338ad01e91c0b8b743b880182ce19cd9c0e5e2b583fbdda565d3d04cfedad180942133af201b2bc3588e111c680068f489780ce69b192b279768088524f2b3458ea694d3de99a4323bc976ed34eb86b98c51993f6be10f77240c99685cd731991f1582df15aa15a213d583f5313a7806988fb8a0640e336359d9e9933568bf44062214ba19e2a7652a13d8b068ff596b807182189234e9da9f1ceb78c81b28c3ac6fe21e306c58e41d5118952acd6a0c2f56b9e6a5c72f346cdcd6b19a3bf8010010d714f89533b674c90c7189b598eab12a45fb5c75b8253672b863fbcccf5af93b6904119fe9851bf5153ac3a746ae7b9d5698c1dc58f313e70e4707ce9d84bafa2f79fc23fb8c7c1438ef04031a2642fee21060ec69ee47020796ecaa12313ccd333d1b67935047acf2be3bb11aa010dbe656cc755dbe3b772084a7ebc6d5711253b593dfcc0cc8fcd3cafda455512c7f200ec56cbfac0f1d7d34b7fdf0f98fd88a92a7e9cb0e70cc933c0b38a2c823ea0bd76c70c016adb67f47bc2a117a6d40abeea33fa23c2fb867edfb413e4a34fded94ffb3991c46dc7754cd3634ad2af490b857f5a5137126a97e02a8120a485235b6a28ef80bd077ee2b9f2d54fed04595dcbd8ddb6c4bd87334c10cadb2064e856177e7864e669fbe1df154a0142839f7ad2e5b6880bff1da66eece78e315d959f609da670f98befe6c3f45fb42672c9acff7f660000000049454e44ae426082</data>
+ </image>
+</images>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argsetlocaltime.ui b/kstars/kstars/tools/argsetlocaltime.ui
new file mode 100644
index 00000000..03247473
--- /dev/null
+++ b/kstars/kstars/tools/argsetlocaltime.ui
@@ -0,0 +1,105 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>ArgSetLocalTime</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgSetLocalTime</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>293</width>
+ <height>107</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="ExtDateWidget">
+ <property name="name">
+ <cstring>DateBox</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout43</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>70</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QTimeEdit">
+ <property name="name">
+ <cstring>TimeBox</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Time</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Set the Time</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer8</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>ExtDateWidget</class>
+ <header location="local">libkdeedu/extdate/extdatewidget.h</header>
+ <sizehint>
+ <width>254</width>
+ <height>31</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1125">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000042c49444154789cb5954f6c14551cc73fefcd7476b65bdaae4bb78bb5502a14d404e4801c88182d1c4c2c693da847400f9c24c68b878684238660e2b1e01f12c19493012ef2478c814412d354a46017a8a564bb6da5bbedccee767776e63d0ffb073751d483bfe49799974c3eeffb7ebf37df9fd05a530b2184040cc0042420aaf9a4d0d554800f045a6b256ae0e1e1e1d6bebebe838ee31c48a7d39b5cd7fd075e251cc7617272f2ded8d8d819cff33e0316819259537aead4a9839d5dd6d1784f91f55b0a94830242088404d304292bef68a89f520802a598fecddaa04f1a876f5c250c7c0a64cdeac686e33807e23d45e6b297c8b877f1831542614550b6599835c83c2a81b6786a75134faf2f1169f12997350881d9021d0903e06de0745d3160a6d3e94dbd5b0a64dcbb94b5831d0e3375ab892b1772dcf9790528543f8dd0d367b36768153b5e31503a0f1aecb004580b44ffac58baae8b1714f0833c7638cc8dab303a320f4822ab4c7a37c69196203de3319d5ce1c4d13c733331dedc67a129a154fd128401ab0616d55a130ac3d42d93d1913940d13fd0c9ee0183685c60da01c5421bd72f7a8c8efccef9afd374267ad93d642365be0636a0d28ec7600941d9e6f23917f0e97f23ce5bef35d19ec863da0ed9059b2be70bec196c66dfa10ec0e49b338f7017258651bf95021035c595429bb0903248fe52a2b5b595dd7b4d945cc2340cdca536be389ee3f67886c5798f773fe8e0dac508c989659277a2180da4ca4ff07821058b8b251445d63d6b13ed1098a6417e39cac85197dbe31962ab9bd9f1f22a226d45366f6d0620fdb08c900d281af6110284b20085b414861d905d88f2e52739ee8cbb8022143259d3dd84691730aa2d52da441a8de0c6958068870022a41e9629ad3473fd3b8fdbe319dadb9b4924da994d2d716c7896fbe35152f78b48245d6b2da4507faf582be8eaf159b721cc837b05ae7debb1f79d08cb8b515edad942a22bc4b1c33eb3d34b1c797f06af90a72d16e2f96d9a74aa11dca8586b222d01af0fb60070f6c402d72f15d97f28c6f6d7027a5f5ce6c3233dc4e2ede496b278be4fff608cee8d3e1add806aeca51094cbb06397c1ecc328e746537c7e3ccdb5cb1136bf60635882d4d41c6ec6836ab37efa214f72208ed9f4d7cdd38ee310280542e38b1c43fb6de26b3672e1ec3cc99bcb246f66a938a3241ab3e91f7c861fbf77710b1e5e49915bae974203ba0e9e9c9cbc373d6d6d305a040a89c2a77f50b27d5782bbbf7acccf28349235dd16cf6dd374f7295e1de8a45c02d37499182b01cc0201a085d61a2144d8b2ac8fb6ed340e77240c4261890e04c250185262546d534a032154b59e0ad394e41c98182bf268ce6721ed9f064e0253356f6da2e24c1f030f783c15fe6da680af8021602bd051532ca9b8521488559f61aa86c29343578fbf0264a94c906c7d3409214c20043457a116ff6de6795578012889ff6b98fe016ea0ce1c203e47720000000049454e44ae426082</data>
+ </image>
+</images>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kstars/kstars/tools/argsetportindi.ui b/kstars/kstars/tools/argsetportindi.ui
new file mode 100644
index 00000000..2ca20aa4
--- /dev/null
+++ b/kstars/kstars/tools/argsetportindi.ui
@@ -0,0 +1,79 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ArgSetPortINDI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgSetPortINDI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>226</width>
+ <height>91</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout23</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Device:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Port:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>devicePort</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>deviceName</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>9</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argsetradec.ui b/kstars/kstars/tools/argsetradec.ui
new file mode 100644
index 00000000..b78ac04a
--- /dev/null
+++ b/kstars/kstars/tools/argsetradec.ui
@@ -0,0 +1,144 @@
+<!DOCTYPE UI><UI version="3.1.2" stdsetdef="1">
+<class>ArgSetRaDec</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgSetRaDec</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>284</width>
+ <height>96</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout13</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>DecBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Declination</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Enter the Declination coordinate to be focused on in the skymap, in degrees. You can express the angle as a simple integer ("45") or floating-point ("45.333") value, or as space- or colon-delimited values specifying degrees, arcminutes and arcseconds ("45:20", "45:20:00", "45:20", "45 20.0", etc.).
+
+Declination is one of the coordinates in the Equatorial coordinate system; it measures the angle of an object North or South of the Celestial Equator. The star Polaris, which is near the celestial north pole, has a Declination of nearly 90 degrees.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>RA:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>RaBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Right Ascension</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Enter the Right Ascension coordinate to be focused on in the skymap, in hours. You can express the angle as a simple integer ("12") or floating-point ("12.333") value, or as space- or colon-delimited values specifying hours, minutes and seconds ("12:20", "12:20:00", "12:20", "12 20.0", etc.).
+
+Right Ascension is one of the coordinates in the Equatorial coordinate system. It measures the angle around the celestial equator from the Vernal equinox, increasing to the East. Right Ascension (RA) is almost always expressed in Hours instead of Degrees; the Celestial Equator is divided into 24 Hours, so 1 Hour of RA is equal to 360/24=15 Degrees. See the AstroInfo article for more details,</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Dec:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>dmsBox</class>
+ <header location="global">dmsbox.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="4350">789c6dd7594f23471007f0f7fd14d6d6db2aaaf58c3db647511eb831b7317794879ac30760cc61c010e5bba7dcf5af5688167664fdb66bbaababbb67cccf1f8dab93c3c68f9fdf5e16b298968d7222cf8d1fd5eb6cf6f1e75f7ffcfded7b9a3656ff9aad46fafdb76fdf078b46d9389a3fd42bf04841699e964933b830b79a7019dd0b96955b895b5a703bcd572e08eea576ff6570ae0eedd477b792103f854b8b2fc6d1163f77237e646e37113f89b6f8307e3bf1785a8b0eedbc696eb7ad9db7e01ee6476ee4ffe0c6fd158c7c69182cde4eec6e87fea50dfbf8176e6ba7d07f96669999cfa325ccaf862bcc97a36dbccf60f178cee11cde706761f16917ae30fe6b7488a7851bf14d7327417f676eb4f756eea41e2f57e6d83e83919f6cba117f04235fd9765b3b0fa36dfc398cf973edc67a6fb951ffe768ab6765ee26b8dff213ef5f4630e2b9e7463ea7ee8ee5ff60ee2618af8eb6fe3238437eb91bf1299cdbfacad3cadd5617f5a11738c7fe4adcb8ffd68d7aeec15e8fc3683b9f62ee2518ef33dafa3f75e3bc957086f86eb4d56f3db8e8e6dd56f01a5cc1bbe65e629673d8ebd18d0efdc9058cf9f2c08df9e630ce037db8719ec37c7a9a7fb708f10267b65e7cef46fb3e9ca3fd23dad6ef0cf67abe99f304f95ec3a8871cbb71be52d8d777e8b6fee412f6f958be3adf5ea817b561afe7d86ded7c67ce13c46fc37ede2766c17a17059cd9f38e466e8c3f8eb6fd700f0b9ef7095c37cd3d37de178f2be76dcf876fa343bd790267f012f67a77cc319f69b4ed872e2ca8e732daeabfe3c6fa9cc235f21f9b8bd4f2a5cd687bfedbfd659ee7ede017b842becf6eb44fa3cbd0df8559b0ffe808ceb0ff37e01afba3652e52cc87a26dbe276ecca7097790ff73b4cdef0616ac4fdf6df1c2d1d67ee8c6f80318eb4bd1180ff529513f0ecf7b694b62f5a002ceccb2662e523c2fb7605f9f0fd8fbbf75e3bc2dcd3e9ebcb9f17ce8c05e8f83685bcf701e44eb2db65e4fd1b65eebe62245be53b8c6f3ffdd8dfd3933fbf884761f5f0edcd88f951bf118bf44bde926dae24fe01ae7af76e3f9169e2f45bb143c0f5fdcf6fea23b18f773eac6f3e63ddac6db75e37df5e8c6fbae65aebcde6d37beaf84f528aa52f03c9dc3359ea79939c627d136deab1befaf75b883ef23e76e3ccfaea36d7dc2f795322b05ebfb0ad738af7db7ad371f99fd7e59b8b13f276e9cdf1318f5e54337e6d78cb67cf761ec170efba1acaa1afd9db92d3f3a36d729ea77efc6f33cbccf2beddfe6478fe6d85e45dbfd851bf1577007f5d877e3bc86f5a9ea3a2d6cffdfc1debe116df5db73a39e37b0e777191dda257c7fa83b6e8a2eaae00eeceb13d6b7d69f325b79b058fd32b170c1a55ebffaac2ccae2b9e6118f79c253bd6ef9ee3fd7587fef79c60f7acf3cc617fcc84ffcac6d8ffcc20b7ee5377ee7257ff027aff1bac66ff0269716cf5b1ab7cd3bbcabb17ddee37d3ee0433ee2633ee1019ff290cff89c2ff89229c48b66f1ac3d5df135df7093134eb9c56dcef4b3c35dee71ce393111dbfa8c784a4205955451cd1d1ad1982634a55bbad3f80eddd38c1ef882e66cf52ab5ff2b8d7ea4277aa6175ad06bb866f446efb4d4df0ffad4fed762ffb7b44e1b9cd2266dd142c75e5ddb3cd0bb3e347a477bd9d5f83ee245e3f7689f0ee830f67d44c77412ee186946033aa5e197fecfe85c7bf7be2fe892aee89a6ea84989f6bfa434f4eff9df52c509b5d0779b32ea684d13ea528f728d1e882ebfce37f6cf077422b4ea5b440ad14af1a15452ab473aee52c65ff39789b64fe955f44eb9937b5d858c5b32d377c0c32a7fee7ecd5fe61aff284ff22c2fb290577993775db1443fb53ef2219f5ff2bf93356d5b970dd9d41eb77820dbb223bbab155ed55ffab2f725ffb1eccb81aed6931cca116ab490633909d10339fd5ffdef795d869ae7923bc27226e772415d5986b51d683663b9d4fcfbb1ff190fe54aaec35aeaa577ee20f24673e94b531249a585fc2b69ebfe3ed7dae91f75ba964b5c03e9d344ba1add93bce0826c3f87f3b2a9fb6f18aeba10ba2f563f25eb1b563771a5d17531e2513c5fba538b3111cd690dd73c7ef6a95f4c8aa99de12fe77da4951de9ffffea730be7fd9fdfbffd0b690edc6c</data>
+ </image>
+</images>
+<tabstops>
+ <tabstop>RaBox</tabstop>
+ <tabstop>DecBox</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argsetscopeactionindi.ui b/kstars/kstars/tools/argsetscopeactionindi.ui
new file mode 100644
index 00000000..528e783e
--- /dev/null
+++ b/kstars/kstars/tools/argsetscopeactionindi.ui
@@ -0,0 +1,115 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ArgSetScopeActionINDI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgSetScopeActionINDI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>230</width>
+ <height>101</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout55</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout47</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Device:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Action:</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout54</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>deviceName</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <property name="name">
+ <cstring>actionCombo</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer24</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>56</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>9</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argsettargetcoordindi.ui b/kstars/kstars/tools/argsettargetcoordindi.ui
new file mode 100644
index 00000000..8973b24b
--- /dev/null
+++ b/kstars/kstars/tools/argsettargetcoordindi.ui
@@ -0,0 +1,170 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ArgSetTargetCoordINDI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgSetTargetCoordINDI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>270</width>
+ <height>129</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout34</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout32</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_3</cstring>
+ </property>
+ <property name="text">
+ <string>Device:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>RA:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Dec:</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout33</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>deviceName</cstring>
+ </property>
+ </widget>
+ <widget class="dmsBox">
+ <property name="name">
+ <cstring>RaBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="dmsBox">
+ <property name="name">
+ <cstring>DecBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>24</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>dmsBox</class>
+ <header location="global">dmsbox.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1114">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000042149444154789c8d95c18b1c4514c67fbb29e5b54ea05b26da1d36b08d096e8b11261871837bc8e282ac7ac82187e049a317e32d37110992bf42123c694eea414c0e0bf1b0ec6c402139485a54e8810c54c10e741146fa110bd643f74c12bd642e4d75f77cf5d5ef7dafdfc2ce7087d9eff32fdfdff74e5114104011e489d6e952cce5cfbe5998692dec0c77b87aedd3fddd9f2b3efce02291082209aa3504685022e4ffd7a000a82a765c515615ce95acae659c3f7765c100ec6e575cf8f822e991025f3b6a6f890c484f181ccfc1583428f5d4e2fe84da039aa04121b40eb32483a0ec6e5bce9f8385d36fa7fb9b1b17c8f31cbfe7a95c45be94520c72b2141a1caa160d1666e24ea94aa11ee7685054159d2ada34d41387c40dc63b8844f0b5c73a4bb19cb3f9de001f2aac1fa23aa209168c004224902e29d22ff1e38abbdb275055c4800610233867311a1491847a62c98f66ac6f14d8e99072f22daa15b68a8108424d6422e24c88e3966fbce4c9d786945b27f0be0103ed13c16004d59a2c4d58df28a87548e9aee2274ab95d60c7193c9a0281fc959ae2a4450364a9e2572c7a2b43438374ef2dd2154012d050514dbec7396578a3130d9d6850066f0ad9d186f2d78cdbbb799b0a202f2c48d3aebbb418310240b112637588574bf54b8efaa4fd9b691dacbf5b305813542bae63a9eee4c4694d967b5494eca8c7ef0933bdc5d90e6a2caa0e3f013b7adce9fa5b03d637561113a30106a71d18c5fd9677058338ad01e91c0b8b743b880182ce19cd9c0e5e2b583fbdda565d3d04cfedad180942133af201b2bc3588e111c680068f489780ce69b192b279768088524f2b3458ea694d3de99a4323bc976ed34eb86b98c51993f6be10f77240c99685cd731991f1582df15aa15a213d583f5313a7806988fb8a0640e336359d9e9933568bf44062214ba19e2a7652a13d8b068ff596b807182189234e9da9f1ceb78c81b28c3ac6fe21e306c58e41d5118952acd6a0c2f56b9e6a5c72f346cdcd6b19a3bf8010010d714f89533b674c90c7189b598eab12a45fb5c75b8253672b863fbcccf5af93b6904119fe9851bf5153ac3a746ae7b9d5698c1dc58f313e70e4707ce9d84bafa2f79fc23fb8c7c1438ef04031a2642fee21060ec69ee47020796ecaa12313ccd333d1b67935047acf2be3bb11aa010dbe656cc755dbe3b772084a7ebc6d5711253b593dfcc0cc8fcd3cafda455512c7f200ec56cbfac0f1d7d34b7fdf0f98fd88a92a7e9cb0e70cc933c0b38a2c823ea0bd76c70c016adb67f47bc2a117a6d40abeea33fa23c2fb867edfb413e4a34fded94ffb3991c46dc7754cd3634ad2af490b857f5a5137126a97e02a8120a485235b6a28ef80bd077ee2b9f2d54fed04595dcbd8ddb6c4bd87334c10cadb2064e856177e7864e669fbe1df154a0142839f7ad2e5b6880bff1da66eece78e315d959f609da670f98befe6c3f45fb42672c9acff7f660000000049454e44ae426082</data>
+ </image>
+</images>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argsettargetnameindi.ui b/kstars/kstars/tools/argsettargetnameindi.ui
new file mode 100644
index 00000000..0f4b17f9
--- /dev/null
+++ b/kstars/kstars/tools/argsettargetnameindi.ui
@@ -0,0 +1,148 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ArgSetTargetNameINDI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgSetTargetNameINDI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>271</width>
+ <height>104</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout44</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout40</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Device:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Object:</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout41</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>deviceName</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>objectName</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout42</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>52</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>FindButton</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>Object</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Select object from a list</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Opens the Find Object dialog, which allows you to select an object from the list of known objects. When an object has been selected, its name will appear in the "dir" box at left.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>8</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argsettrack.ui b/kstars/kstars/tools/argsettrack.ui
new file mode 100644
index 00000000..bacb0597
--- /dev/null
+++ b/kstars/kstars/tools/argsettrack.ui
@@ -0,0 +1,82 @@
+<!DOCTYPE UI><UI version="3.1.2" stdsetdef="1">
+<class>ArgSetTrack</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgSetTrack</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>274</width>
+ <height>61</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout24</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>CheckTrack</cstring>
+ </property>
+ <property name="text">
+ <string>Track</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Toggle Tracking on/off</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If checked, the sky will remain focused on its current position or object as time passes. This is called "Tracking". Note that tracking is automatically engaged whenever an object is centered at the focus point. So, if you use "lookToward" with an object name, you do not need to engage tracking.
+
+If unchecked, then Tracking will be forced off, even if an object has been centered, As time passes, the sky will then appear to drift by (due to the rotation of the Earth).</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer21</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer22</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kstars/kstars/tools/argsetutcindi.ui b/kstars/kstars/tools/argsetutcindi.ui
new file mode 100644
index 00000000..9c0f1302
--- /dev/null
+++ b/kstars/kstars/tools/argsetutcindi.ui
@@ -0,0 +1,118 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ArgSetUTCINDI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgSetUTCINDI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>274</width>
+ <height>97</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout88</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout86</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Device:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Date/Time:</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout87</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>deviceName</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>UTC</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer44</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>51</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>9</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argshutdownindi.ui b/kstars/kstars/tools/argshutdownindi.ui
new file mode 100644
index 00000000..ce7be2f4
--- /dev/null
+++ b/kstars/kstars/tools/argshutdownindi.ui
@@ -0,0 +1,75 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ArgShutdownINDI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgShutdownINDI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>237</width>
+ <height>64</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Device:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>deviceName</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>33</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argstartexposureindi.ui b/kstars/kstars/tools/argstartexposureindi.ui
new file mode 100644
index 00000000..47a631e6
--- /dev/null
+++ b/kstars/kstars/tools/argstartexposureindi.ui
@@ -0,0 +1,125 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ArgStartExposureINDI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgStartExposureINDI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>227</width>
+ <height>95</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout64</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout63</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Device:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>duration</cstring>
+ </property>
+ <property name="text">
+ <string>Duration:</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout62</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>deviceName</cstring>
+ </property>
+ </widget>
+ <widget class="KIntNumInput">
+ <property name="name">
+ <cstring>timeOut</cstring>
+ </property>
+ <property name="minValue">
+ <number>0</number>
+ </property>
+ <property name="maxValue">
+ <number>86400</number>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer24</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>27</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>9</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>knuminput.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argstartfocusindi.ui b/kstars/kstars/tools/argstartfocusindi.ui
new file mode 100644
index 00000000..3bd5503c
--- /dev/null
+++ b/kstars/kstars/tools/argstartfocusindi.ui
@@ -0,0 +1,117 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ArgStartFocusINDI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgStartFocusINDI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>240</width>
+ <height>101</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout55</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout47</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Device:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Dir:</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout54</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>deviceName</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <property name="name">
+ <cstring>directionCombo</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer24</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>56</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>9</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argstartindi.ui b/kstars/kstars/tools/argstartindi.ui
new file mode 100644
index 00000000..554ea363
--- /dev/null
+++ b/kstars/kstars/tools/argstartindi.ui
@@ -0,0 +1,124 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ArgStartINDI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgStartINDI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>289</width>
+ <height>181</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Device:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>deviceName</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer row="1" column="1">
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>61</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QButtonGroup" row="1" column="0">
+ <property name="name">
+ <cstring>INDIMode</cstring>
+ </property>
+ <property name="title">
+ <string>Mode</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>LocalButton</cstring>
+ </property>
+ <property name="text">
+ <string>Local</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>ServerButton</cstring>
+ </property>
+ <property name="text">
+ <string>Server</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argswitchindi.ui b/kstars/kstars/tools/argswitchindi.ui
new file mode 100644
index 00000000..f4c85a1c
--- /dev/null
+++ b/kstars/kstars/tools/argswitchindi.ui
@@ -0,0 +1,129 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ArgSwitchINDI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgSwitchINDI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>237</width>
+ <height>157</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Device:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>deviceName</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer row="1" column="1">
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>61</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QButtonGroup" row="1" column="0">
+ <property name="name">
+ <cstring>INDIConnection</cstring>
+ </property>
+ <property name="title">
+ <string>Connection</string>
+ </property>
+ <property name="exclusive">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>OnButton</cstring>
+ </property>
+ <property name="text">
+ <string>On</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>OffButton</cstring>
+ </property>
+ <property name="text">
+ <string>Off</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>33</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argtimescale.ui b/kstars/kstars/tools/argtimescale.ui
new file mode 100644
index 00000000..f2b0eab3
--- /dev/null
+++ b/kstars/kstars/tools/argtimescale.ui
@@ -0,0 +1,97 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>ArgTimeScale</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgTimeScale</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>283</width>
+ <height>64</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TimeStepBox">
+ <property name="name">
+ <cstring>TimeScale</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>150</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>TimeStepBox</class>
+ <header location="local">timestepbox.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="2926">789c9d95594f32591086effd15c4ba3393fae895ee4ce6824540141011b7c95cf406a202caa6f065fefb549faaea0b24996fc623cb937aeb3d55754e871f67a587eb6ee9ecc7c96a1dada74929798e96a5b374339bedfefceb8f9f27a7b65da27fcb724bf6e96f27a783752929f516f32c070402289b3fc39d8203c3136157e276c1260eac0f0ade0907927f2d9c58261f929cad72be0cef8535ff5959e277c201ef0fa02cf1ae7022f9efca12ff301ca81e87c21a5f32db5acf95b0eebfcdd92e2be3a5b0fa7986435bfd6e981d99278c0ae6795c288b3e2b98e3036157d8f839961308af985df51b1b0e9dc0098ddf5a3811fd7dceaee52a370d475e28f9b7ca1c07539f67173c144e65be2fcae2d763f62d89df2acb7cc282393e57b6b9ff58d893fca632c7d1ccc78bbcd48b4c7cc2ec4bfdf0aa2cfbf50be6fa2c65d9af2aacfd2c94e53cccf9fa7645eb7794a59ebdb027fe5565895f09cb7e981a267f9febaf3117fab6702af599e7a5e2049e6dce1377c25affa6608e4786e34a58894dfc8b59f5f890731087e28f2de648fbdb16ccfd6c9465bf7365c732f12f61ed3f5016fd4a59f4e6790fddd00a5d137f638eb4bfa532df5ffc148ea4be5ac17c5ea9b2ecd72b98efff403893fa1accb12d5c5696fd4d7f6152c41f95c53f2a98f56b6597fbf3857da9b75e30fb5584b59fa78239de5596fd3e0be6fdccf311b99115f1fcdaccb12fe77927ac7e2365f1c382793e63e14cfccdf3132571e69b1f07e83327d23fbac2bee4d785d57f2a9c89de9c6fecaa1fce98135bf845b9e2189e2a07e6fee287b0cfcf3bce9525ff5d38927a1bcca9cc1b66ca528ff93d89d338e3f9e182b9c86f31a752ff609d2f847f5f83b5ea31c218137a4f8fac0cc738e10cd6d3b7189f718a2ff88a6f38c339ad05adfcf31d3f7089ab037d42ea356e708b9ff8853bdc6395de6b58c706ad736c1ee823f2de608b146dbcc08e8976f012afb04b3975ec1de853aa2457f749d5c16b1ce00d0ecdf75b1ce1dd11fd1b55d236cef7f8808ff88465b4d02676d03da29f51dd9e513fa28f150c3004246d07002288bfe9e7d45f0712f22635a490d15ef730361e3b389c67aedf2390ea3157e73dc333e9a6f042d13ebc7ed32f6882405d3ee1c678030ee10d6630a76f162c8ee8f37adeb14c0aaa0b3e68b725ac80a2b039a29f630db6e46bc127d5fd45de4b5226b0833d8ea07a445f871ae96dacc218ead08073c835136842eba8be016db830e77a419f21aca143f76c025b9ae7e5813ea35bd5a0731fd1c4877a7f614fde57d085deb7f31ad31dccf54fd087883ab7a88f6baabb45fdf760003707fa09ddd826f66048af1826f00a0bb3aa7009b73082bb03fd2faeffa7fff58cfffcbcfffdfbc93f7f7d62d7</data>
+ </image>
+</images>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>timestepbox.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argwaitfor.ui b/kstars/kstars/tools/argwaitfor.ui
new file mode 100644
index 00000000..21478f29
--- /dev/null
+++ b/kstars/kstars/tools/argwaitfor.ui
@@ -0,0 +1,85 @@
+<!DOCTYPE UI><UI version="3.1.2" stdsetdef="1">
+<class>ArgWaitFor</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgWaitFor</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>270</width>
+ <height>76</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout17</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;font color="#00007f"&gt;Sec:&lt;/font&gt;</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>DelayBox</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Pause delay in seconds</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Enter the number of seconds that the script should pause before executing the remaining commands.</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer10</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer9</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kstars/kstars/tools/argwaitforkey.ui b/kstars/kstars/tools/argwaitforkey.ui
new file mode 100644
index 00000000..cb3f8610
--- /dev/null
+++ b/kstars/kstars/tools/argwaitforkey.ui
@@ -0,0 +1,92 @@
+<!DOCTYPE UI><UI version="3.1.2" stdsetdef="1">
+<class>ArgWaitForKey</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgWaitForKey</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>288</width>
+ <height>124</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout18</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Key:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>WaitKeyEdit</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Wait for this key to be pressed</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The script execution will pause until the user presses the key specified here.
+
+Only simple keys can currently be used; you cannot use modifier keys such as Ctrl or Shift. Type "space" to specify the spacebar, otherwise use the key itself.</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer11</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer12</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/argzoom.ui b/kstars/kstars/tools/argzoom.ui
new file mode 100644
index 00000000..8b93e300
--- /dev/null
+++ b/kstars/kstars/tools/argzoom.ui
@@ -0,0 +1,93 @@
+<!DOCTYPE UI><UI version="3.1.2" stdsetdef="1">
+<class>ArgZoom</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ArgZoom</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>295</width>
+ <height>69</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Zoom level:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>ZoomBox</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>New Zoom level</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Set the Zoom level for the display. You can incrementally change this value using "ZoomIn" and "ZoomOut".
+
+The Zoom level specifies the number of pixels which span one radian of arc. Reasonable values should be between 300 and 10,000,000.
+</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>30</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/astrocalc.cpp b/kstars/kstars/tools/astrocalc.cpp
new file mode 100644
index 00000000..5deec02f
--- /dev/null
+++ b/kstars/kstars/tools/astrocalc.cpp
@@ -0,0 +1,380 @@
+/***************************************************************************
+ astrocalc.cpp - description
+ -------------------
+ begin : wed dec 19 16:20:11 CET 2002
+ copyright : (C) 2001-2005 by Pablo de Vicente
+ email : p.devicente@wanadoo.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "astrocalc.h"
+#include "astrocalc.moc"
+#include "dms.h"
+#include "dmsbox.h"
+#include "modcalcjd.h"
+#include "modcalcgeodcoord.h"
+#include "modcalcgalcoord.h"
+#include "modcalcsidtime.h"
+#include "modcalcprec.h"
+#include "modcalcapcoord.h"
+#include "modcalcdaylength.h"
+#include "modcalcazel.h"
+#include "modcalcplanets.h"
+#include "modcalceclipticcoords.h"
+#include "modcalcangdist.h"
+#include "modcalcequinox.h"
+#include "modcalcvlsr.h"
+
+#include <klocale.h>
+#include <qlistview.h>
+#include <qtextview.h>
+
+
+AstroCalc::AstroCalc( QWidget* parent ) :
+ KDialogBase( parent, "starscalculator", true, i18n("Calculator"), Close ),
+ JDFrame(0), GeodCoordFrame(0), GalFrame(0), SidFrame(0), PrecFrame(0),
+ AppFrame(0), DayFrame(0), AzelFrame(0), PlanetsFrame(0), EquinoxFrame(0),
+ EclFrame(0), AngDistFrame(0)
+{
+ split = new QSplitter ( this );
+ setMainWidget(split);
+
+ navigationPanel = new QListView (split,"NavigationPanel");
+ splashScreen = new QTextView (i18n("<H2>KStars Astrocalculator</H2>"),"",split);
+
+ splashScreen->setMaximumWidth(550);
+ splashScreen->setMinimumWidth(400);
+
+ rightPanel = GenText;
+
+ navigationPanel->addColumn("Section");
+ navigationPanel->setRootIsDecorated(1);
+
+ QPixmap jdIcon = QPixmap ("jd.png");
+ QPixmap geodIcon = QPixmap ("geodetic.png");
+ QPixmap solarIcon = QPixmap ("geodetic.png");
+ QPixmap sunsetIcon = QPixmap ("sunset.png");
+ QPixmap timeIcon = QPixmap ("sunclock.png");
+
+ QListViewItem * timeItem = new QListViewItem(navigationPanel,i18n("Time Calculators"));
+ timeItem->setPixmap(0,timeIcon);
+
+ QListViewItem * jdItem = new QListViewItem(timeItem,i18n("Julian Day"));
+ jdItem->setPixmap(0,jdIcon);
+
+ new QListViewItem(timeItem,i18n("Sidereal Time"));
+ new QListViewItem(timeItem,i18n("Day Duration"));
+ new QListViewItem(timeItem,i18n("Equinoxes & Solstices"));
+// dayItem->setPixmap(0,sunsetIcon);
+
+ QListViewItem * coordItem = new QListViewItem(navigationPanel,i18n("Celestial Coordinates"));
+ new QListViewItem(coordItem,i18n("Galactic Coordinates"));
+ new QListViewItem(coordItem,i18n("Precession"));
+ new QListViewItem(coordItem,i18n("Apparent Coordinates"));
+ new QListViewItem(coordItem,i18n("Horizontal Coordinates"));
+ new QListViewItem(coordItem,i18n("Ecliptic Coordinates"));
+ new QListViewItem(coordItem,i18n("Angular Distance"));
+ new QListViewItem(coordItem,i18n("LSR Velocity"));
+
+ QListViewItem * geoItem = new QListViewItem(navigationPanel,i18n("Earth Coordinates"));
+ geoItem->setPixmap(0,geodIcon);
+ /*QListViewItem * cartItem = */new QListViewItem(geoItem,i18n("Geodetic Coordinates"));
+
+ QListViewItem * solarItem = new QListViewItem(navigationPanel,i18n("Solar System"));
+ solarItem->setPixmap(0,solarIcon);
+ /*QListViewItem * planetsItem = */new QListViewItem(solarItem,i18n("Planets Coordinates"));
+
+ connect(navigationPanel, SIGNAL(clicked(QListViewItem *)), this,
+ SLOT(slotItemSelection(QListViewItem *)));
+}
+
+AstroCalc::~AstroCalc()
+{
+}
+
+void AstroCalc::slotItemSelection(QListViewItem *item)
+{
+ QString election;
+
+ if (item==0L) return;
+
+ election = item->text(0);
+ if(!(election.compare(i18n("Time Calculators"))))
+ genTimeText();
+ if(!(election.compare(i18n("Sidereal Time"))))
+ genSidFrame();
+ if(!(election.compare(i18n("Celestial Coordinates"))))
+ genCoordText();
+ if(!(election.compare(i18n("Julian Day"))))
+ genJdFrame();
+ if(!(election.compare(i18n("Galactic Coordinates"))))
+ genGalFrame();
+ if(!(election.compare(i18n("Precession"))))
+ genPrecFrame();
+ if(!(election.compare(i18n("Apparent Coordinates"))))
+ genAppFrame();
+ if(!(election.compare(i18n("Horizontal Coordinates"))))
+ genAzelFrame();
+ if(!(election.compare(i18n("Ecliptic Coordinates"))))
+ genEclFrame();
+ if(!(election.compare(i18n("Earth Coordinates"))))
+ genGeodText();
+ if(!(election.compare(i18n("Geodetic Coordinates"))))
+ genGeodCoordFrame();
+ if(!(election.compare(i18n("Day Duration"))))
+ genDayFrame();
+ if(!(election.compare(i18n("Equinoxes & Solstices"))))
+ genEquinoxFrame();
+ if(!(election.compare(i18n("Solar System"))))
+ genSolarText();
+ if(!(election.compare(i18n("Planets Coordinates"))))
+ genPlanetsFrame();
+ if(!(election.compare(i18n("Angular Distance"))))
+ genAngDistFrame();
+ if(!(election.compare(i18n("LSR Velocity"))))
+ genVlsrFrame();
+
+ previousElection = election;
+
+}
+
+void AstroCalc::genTimeText(void)
+{
+
+ delRightPanel();
+ splashScreen = new QTextView ("","",split);
+ splashScreen->setMaximumWidth(550);
+ splashScreen->setMinimumWidth(400);
+ splashScreen->show();
+
+ splashScreen->setText(i18n("<QT>"
+ "Section for time-related astronomical calculations"
+ "<UL><LI>"
+ "<B>Julian Day:</B> Julian Day/Calendar conversion"
+ "</LI><LI>"
+ "<B>Sidereal Time:</B> Sidereal/Universal time conversion"
+ "</LI><LI>"
+ "<B>Day duration:</B> Sunrise, Sunset and noon time and "
+ "positions for those events"
+ "</LI><LI>"
+ "<B>Equinoxes & Solstices:</B> Equinoxes, Solstices and duration of the "
+ "seasons"
+ "</LI></UL>"
+ "</QT>"));
+
+ rightPanel=TimeText;
+
+}
+
+void AstroCalc::genCoordText(void)
+{
+ delRightPanel();
+ splashScreen = new QTextView ("","",split);
+ splashScreen->setMaximumWidth(550);
+ splashScreen->setMinimumWidth(400);
+ splashScreen->show();
+
+ splashScreen->setText(i18n("<QT>"
+ "Section with algorithms for the conversion of "
+ "different astronomical systems of coordinates"
+ "<UL><LI>"
+ "<B>Precessor:</B> Precession of coordinates between epochs"
+ "</LI><LI>"
+ "<B>Galactic:</B> Galactic/Equatorial coordinates conversion"
+ "</LI><LI>"
+ "<B>Apparent:</B> Computation of current equatorial coordinates"
+ " from a given epoch"
+ "</LI><LI>"
+ "<B>Ecliptic:</B> Ecliptic/Equatorial coordinates conversion"
+ "</LI><LI>"
+ "<B>Horizontal:</B> Computation of azimuth and elevation for a "
+ "given source, time, and location on the Earth"
+ "</LI><LI>"
+ "<B>Angular Distance:</B> Computation of angular distance between "
+ "two objects whose positions are given in equatorial coordinates"
+ "</LI><LI>"
+ "<B>LSR Velocity:</B> Computation of the heliocentric, geocentric "
+ "and topocentric radial velocity of a source from its LSR velocity"
+ "</LI></UL>"
+ "</QT>"));
+
+ rightPanel=CoordText;
+
+}
+
+void AstroCalc::genGeodText(void)
+{
+ delRightPanel();
+ splashScreen = new QTextView ("","",split);
+ splashScreen->setMaximumWidth(550);
+ splashScreen->setMinimumWidth(400);
+ splashScreen->show();
+
+ splashScreen->setText(i18n("<QT>"
+ "Section with algorithms for the conversion of "
+ "systems of coordinates for the Earth"
+ "<UL><LI>"
+ "<B>Geodetic Coordinates:</B> Geodetic/XYZ coordinate conversion"
+ "</LI></UL>"
+ "</QT>"));
+
+ rightPanel=GeoText;
+}
+
+void AstroCalc::genSolarText(void)
+{
+ delRightPanel();
+ splashScreen = new QTextView ("","",split);
+ splashScreen->setMaximumWidth(550);
+ splashScreen->setMinimumWidth(400);
+ splashScreen->show();
+
+ splashScreen->setText(i18n("<QT>"
+ "Section with algorithms regarding information "
+ "on solar system bodies coordinates and times"
+ "<UL><LI>"
+ "<B>Planets Coordinates:</B> Coordinates for the planets, moon and sun "
+ " at a given time and from a given position on Earth "
+ "</LI></UL>"
+ "</QT>"));
+
+ rightPanel=SolarText;
+}
+
+
+void AstroCalc::delRightPanel(void)
+{
+ if (rightPanel <= CoordText)
+ delete splashScreen;
+ else if (rightPanel == JD)
+ delete JDFrame;
+ else if (rightPanel == SidTime)
+ delete SidFrame;
+ else if (rightPanel == DayLength)
+ delete DayFrame;
+ else if (rightPanel == Equinox)
+ delete EquinoxFrame;
+ else if (rightPanel == GeoCoord)
+ delete GeodCoordFrame;
+ else if (rightPanel == Galactic)
+ delete GalFrame;
+ else if (rightPanel == Ecliptic)
+ delete EclFrame;
+ else if (rightPanel == Precessor)
+ delete PrecFrame;
+ else if (rightPanel == Apparent)
+ delete AppFrame;
+ else if (rightPanel == Azel)
+ delete AzelFrame;
+ else if (rightPanel == Planets)
+ delete PlanetsFrame;
+ else if (rightPanel == AngDist)
+ delete AngDistFrame;
+ else if (rightPanel == Vlsr)
+ delete VlsrFrame;
+
+}
+
+void AstroCalc::genJdFrame(void)
+{
+ delRightPanel();
+ JDFrame = new modCalcJD(split,"JulianDay");
+ rightPanel = JD;
+}
+
+void AstroCalc::genSidFrame(void)
+{
+ delRightPanel();
+ SidFrame = new modCalcSidTime(split,"SiderealTime");
+ rightPanel = SidTime;
+}
+
+void AstroCalc::genDayFrame(void)
+{
+ delRightPanel();
+ DayFrame = new modCalcDayLength(split,"DayDuration");
+ rightPanel = DayLength;
+}
+
+void AstroCalc::genEquinoxFrame(void)
+{
+ delRightPanel();
+ EquinoxFrame = new modCalcEquinox(split,"Equinox");
+ rightPanel = Equinox;
+}
+
+void AstroCalc::genGeodCoordFrame(void)
+{
+ delRightPanel();
+ GeodCoordFrame = new modCalcGeodCoord(split,"GeoCoord");
+ rightPanel = GeoCoord;
+}
+
+void AstroCalc::genGalFrame(void)
+{
+ delRightPanel();
+ GalFrame = new modCalcGalCoord(split,"Galactic");
+ rightPanel = Galactic;
+}
+
+void AstroCalc::genEclFrame(void)
+{
+ delRightPanel();
+ EclFrame = new modCalcEclCoords(split,"Ecliptic");
+ rightPanel = Ecliptic;
+}
+
+void AstroCalc::genPrecFrame(void)
+{
+ delRightPanel();
+ PrecFrame = new modCalcPrec(split,"Precession");
+ rightPanel = Precessor;
+}
+
+void AstroCalc::genAppFrame(void)
+{
+ delRightPanel();
+ AppFrame = new modCalcApCoord(split,"Apparent");
+ rightPanel = Apparent;
+}
+
+void AstroCalc::genAzelFrame(void)
+{
+ delRightPanel();
+ AzelFrame = new modCalcAzel(split,"Horizontal");
+ rightPanel = Azel;
+}
+
+void AstroCalc::genPlanetsFrame(void)
+{
+ delRightPanel();
+ PlanetsFrame = new modCalcPlanets(split,"Planet");
+ rightPanel = Planets;
+}
+
+void AstroCalc::genAngDistFrame(void)
+{
+ delRightPanel();
+ AngDistFrame = new modCalcAngDist(split,"AngDist");
+ rightPanel = AngDist;
+}
+
+void AstroCalc::genVlsrFrame(void)
+{
+ delRightPanel();
+ VlsrFrame = new modCalcVlsr(split,"Vlsr");
+ rightPanel = Vlsr;
+}
+
+QSize AstroCalc::sizeHint() const
+{
+ return QSize(640,430);
+}
diff --git a/kstars/kstars/tools/astrocalc.h b/kstars/kstars/tools/astrocalc.h
new file mode 100644
index 00000000..84604103
--- /dev/null
+++ b/kstars/kstars/tools/astrocalc.h
@@ -0,0 +1,158 @@
+/***************************************************************************
+ astrocalc.h - description
+ -------------------
+ begin : wed dec 19 16:20:11 CET 2002
+ copyright : (C) 2001-2002 by Pablo de Vicente
+ email : vicente@oan.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 ASTROCALC_H
+#define ASTROCALC_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qwidget.h>
+#include <kdialogbase.h>
+
+#include <kapplication.h>
+
+#include "dms.h"
+
+class QSplitter;
+class QListView;
+class QTextView;
+class QListViewItem;
+class QVBox;
+class QString;
+class modCalcJD;
+class modCalcGeodCoord;
+class modCalcGalCoord;
+class modCalcSidTime;
+class modCalcPrec;
+class modCalcApCoord;
+class modCalcDayLength;
+class modCalcAzel;
+class modCalcEquinox;
+class modCalcPlanets;
+class modCalcEclCoords;
+class modCalcAngDist;
+class modCalcVlsr;
+
+/** Astrocalc is the base class for the KStars astronomical calculator
+ * @author: Pablo de Vicente
+ * @version 0.9
+ */
+
+class AstroCalc : public KDialogBase
+{
+
+Q_OBJECT
+ public:
+ /** construtor */
+ AstroCalc(QWidget *parent = 0);
+
+ /** destructor */
+ ~AstroCalc();
+
+ /**Generate explanatory text for time modules. */
+ void genTimeText(void);
+
+ /**Generate explanatory text for coordinate modules. */
+ void genCoordText(void);
+
+ /**Generate explanatory text for geodetic modules. */
+ void genGeodText(void);
+
+ /**Generate explanatory text for solar system modules. */
+ void genSolarText(void);
+
+ /**Generate frame for Julian Date functions. */
+ void genJdFrame(void);
+
+ /**Generate frame for Sidereal Time functions. */
+ void genSidFrame(void);
+
+ /**Generate frame for Day Length functions. */
+ void genDayFrame(void);
+
+ /**Generates the frame for the Equinox and Solstice functions */
+ void genEquinoxFrame(void);
+
+ /**Generate frame for geodetic coordinates frame. */
+ void genGeodCoordFrame(void);
+
+ /**Generate frame for galactic coordinates frame. */
+ void genGalFrame(void);
+
+ /**Generate frame for ecliptic coordinates frame. */
+ void genEclFrame(void);
+
+ /**Generate frame for Precession frame. */
+ void genPrecFrame(void);
+
+ /**Generate frame for apparent coordinates frame. */
+ void genAppFrame(void);
+
+ /**Generate frame for horizontal coordinates frame. */
+ void genAzelFrame(void);
+
+ /**Generate frame for planets coordinates frame. */
+ void genPlanetsFrame(void);
+
+ /**Generate frame for angular distances frame. */
+ void genAngDistFrame(void);
+
+ /**Generate frame for Vlsr frame. */
+ void genVlsrFrame(void);
+
+ /**remove whatever frame is loaded in the right panel. */
+ void delRightPanel(void);
+
+ /**@returns suggested size of calculator window. */
+ QSize sizeHint() const;
+
+ public slots:
+ /**Determine which item is selected in the function menu QListBox.
+ *Generate the corresponding calculator module.
+ */
+ void slotItemSelection(QListViewItem *it);
+
+ private:
+
+ QSplitter *split;
+ QListView *navigationPanel, *auxiliar;
+ QTextView *splashScreen;
+// QListViewItem *timeItem, *coordItem, *jdItem, *stItem, *dayItem;
+ QVBox *vbox, *rightBox;
+ QString previousElection;
+
+ enum typeOfPanel {GenText, TimeText, GeoText, SolarText, CoordText, JD, SidTime, DayLength, Equinox, GeoCoord, Galactic, Precessor, Apparent, Azel, Planets, Ecliptic, AngDist, Vlsr};
+ typeOfPanel rightPanel;
+
+ modCalcJD *JDFrame;
+ modCalcGeodCoord *GeodCoordFrame;
+ modCalcGalCoord *GalFrame;
+ modCalcSidTime *SidFrame;
+ modCalcPrec *PrecFrame;
+ modCalcApCoord *AppFrame;
+ modCalcDayLength *DayFrame;
+ modCalcAzel *AzelFrame;
+ modCalcPlanets *PlanetsFrame;
+ modCalcEquinox *EquinoxFrame;
+ modCalcEclCoords *EclFrame;
+ modCalcAngDist *AngDistFrame;
+ modCalcVlsr *VlsrFrame;
+};
+
+#endif
diff --git a/kstars/kstars/tools/jmoontool.cpp b/kstars/kstars/tools/jmoontool.cpp
new file mode 100644
index 00000000..76d4aa67
--- /dev/null
+++ b/kstars/kstars/tools/jmoontool.cpp
@@ -0,0 +1,183 @@
+/***************************************************************************
+ jmoontool.cpp - Display overhead view of the solar system
+ -------------------
+ begin : Sun May 25 2003
+ copyright : (C) 2003 by Jason Harris
+ email : jharris@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. *
+ * *
+ ***************************************************************************/
+
+#include <qlayout.h>
+#include <qlabel.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+
+#include "jmoontool.h"
+#include "jupitermoons.h"
+#include "kstars.h"
+#include "kstarsdata.h"
+#include "ksplanet.h"
+#include "simclock.h"
+#include "planetcatalog.h"
+#include "dms.h"
+#include "ksnumbers.h"
+
+JMoonTool::JMoonTool(QWidget *parent, const char *name)
+ : KDialogBase( KDialogBase::Plain, i18n("Jupiter Moons Tool"), Close, Close, parent, name )
+{
+ ksw = (KStars*)parent;
+
+ QFrame *page = plainPage();
+ QVBoxLayout *vlay = new QVBoxLayout( page, 0, 0 );
+
+ colJp = "White";
+ colIo = "Red";
+ colEu = "Yellow";
+ colGn = "Orange";
+ colCa = "YellowGreen";
+
+ QLabel *labIo = new QLabel( "Io", page );
+ QLabel *labEu = new QLabel( "Europa", page );
+ QLabel *labGn = new QLabel( "Ganymede", page );
+ QLabel *labCa = new QLabel( "Callisto", page );
+
+ labIo->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+ labEu->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+ labGn->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+ labCa->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+ labIo->setAlignment( AlignHCenter );
+ labEu->setAlignment( AlignHCenter );
+ labGn->setAlignment( AlignHCenter );
+ labCa->setAlignment( AlignHCenter );
+
+ labIo->setPaletteForegroundColor( colIo );
+ labEu->setPaletteForegroundColor( colEu );
+ labGn->setPaletteForegroundColor( colGn );
+ labCa->setPaletteForegroundColor( colCa );
+ labIo->setPaletteBackgroundColor( "Black" );
+ labEu->setPaletteBackgroundColor( "Black" );
+ labGn->setPaletteBackgroundColor( "Black" );
+ labCa->setPaletteBackgroundColor( "Black" );
+
+ QGridLayout *glay = new QGridLayout( 2, 2, 0 );
+ glay->addWidget( labIo, 0, 0 );
+ glay->addWidget( labEu, 1, 0 );
+ glay->addWidget( labGn, 0, 1 );
+ glay->addWidget( labCa, 1, 1 );
+
+ pw = new KStarsPlotWidget( 0.0, 1.0, 0.0, 1.0, page );
+ pw->setShowGrid( false );
+ pw->setYAxisType0( KStarsPlotWidget::TIME );
+ pw->setLimits( -12.0, 12.0, -240.0, 240.0 );
+ pw->setXAxisLabel( i18n( "offset from Jupiter (arcmin)" ) );
+ pw->setYAxisLabel( i18n( "time since now (days)" ) );
+ vlay->addLayout( glay );
+ vlay->addWidget( pw );
+ resize( 250, 500 );
+
+ initPlotObjects();
+ update();
+}
+
+JMoonTool::~JMoonTool()
+{
+}
+
+void JMoonTool::initPlotObjects() {
+ KPlotObject *orbit[4];
+ KPlotObject *jpath;
+ long double jd0 = ksw->data()->ut().djd();
+ KSSun *ksun = (KSSun*)ksw->data()->PCat->findByName( "Sun" );
+ KSPlanet *jup = (KSPlanet*)ksw->data()->PCat->findByName( "Jupiter" );
+ JupiterMoons jm;
+
+ if ( pw->objectCount() ) pw->clearObjectList();
+
+ orbit[0] = new KPlotObject( "io", colIo, KPlotObject::CURVE, 1, KPlotObject::SOLID );
+ orbit[1] = new KPlotObject( "europa", colEu, KPlotObject::CURVE, 1, KPlotObject::SOLID );
+ orbit[2] = new KPlotObject( "ganymede", colGn, KPlotObject::CURVE, 1, KPlotObject::SOLID );
+ orbit[3] = new KPlotObject( "callisto", colCa, KPlotObject::CURVE, 1, KPlotObject::SOLID );
+ jpath = new KPlotObject( "jupiter", colJp, KPlotObject::CURVE, 1, KPlotObject::SOLID );
+
+ double dy = 0.01*pw->dataHeight();
+
+ //t is the offset from jd0, in hours.
+ for ( double t=pw->y(); t<=pw->y2(); t+=dy ) {
+ KSNumbers num( jd0 + t/24.0 );
+ jm.findPosition( &num, jup, ksun );
+
+ //jm.x(i) tells the offset from Jupiter, in units of Jupiter's angular radius.
+ //multiply by 0.5*jup->angSize() to get arcminutes
+ for ( unsigned int i=0; i<4; ++i )
+ orbit[i]->addPoint( new DPoint( 0.5*jup->angSize()*jm.x(i), t ) );
+
+ jpath->addPoint( new DPoint( 0.0, t ) );
+ }
+
+ for ( unsigned int i=0; i<4; ++i )
+ pw->addObject( orbit[i] );
+
+ pw->addObject( jpath );
+}
+
+void JMoonTool::keyPressEvent( QKeyEvent *e ) {
+ switch ( e->key() ) {
+ case Key_BracketRight:
+ {
+ double dy = 0.02*pw->dataHeight();
+ pw->setLimits( pw->x(), pw->x2(), pw->y()+dy, pw->y2()+dy );
+ initPlotObjects();
+ pw->update();
+ break;
+ }
+ case Key_BracketLeft:
+ {
+ double dy = 0.02*pw->dataHeight();
+ pw->setLimits( pw->x(), pw->x2(), pw->y()-dy, pw->y2()-dy );
+ initPlotObjects();
+ pw->update();
+ break;
+ }
+ case Key_Plus:
+ case Key_Equal:
+ {
+ if ( pw->dataHeight() > 48.0 ) {
+ double dy = 0.45*pw->dataHeight();
+ double y0 = pw->y() + 0.5*pw->dataHeight();
+ pw->setLimits( pw->x(), pw->x2(), y0-dy, y0+dy );
+ initPlotObjects();
+ pw->update();
+ }
+ break;
+ }
+ case Key_Minus:
+ case Key_Underscore:
+ {
+ if ( pw->dataHeight() < 960.0 ) {
+ double dy = 0.55*pw->dataHeight();
+ double y0 = pw->y() + 0.5*pw->dataHeight();
+ pw->setLimits( pw->x(), pw->x2(), y0-dy, y0+dy );
+ initPlotObjects();
+ pw->update();
+ }
+ break;
+ }
+ case Key_Escape:
+ {
+ close();
+ break;
+ }
+
+ default: { e->ignore(); break; }
+ }
+}
+
+#include "jmoontool.moc"
diff --git a/kstars/kstars/tools/jmoontool.h b/kstars/kstars/tools/jmoontool.h
new file mode 100644
index 00000000..57ba53ab
--- /dev/null
+++ b/kstars/kstars/tools/jmoontool.h
@@ -0,0 +1,47 @@
+/***************************************************************************
+ jmoontool.h - Display overhead view of the solar system
+ -------------------
+ begin : Sun May 25 2003
+ copyright : (C) 2003 by Jason Harris
+ email : jharris@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 JMOONTOOL_H
+#define JMOONTOOL_H
+
+#include <kdialogbase.h>
+#include "kstarsplotwidget.h"
+
+class KStars;
+
+/**@class JMoonTool
+ *@short Display the positions of Jupiter's moons as a function of time
+ *@version 1.0
+ *@author Jason Harris
+ */
+class JMoonTool : public KDialogBase
+{
+Q_OBJECT
+public:
+ JMoonTool(QWidget *parent = 0, const char *name = 0);
+ ~JMoonTool();
+
+protected:
+ virtual void keyPressEvent( QKeyEvent *e );
+
+private:
+ void initPlotObjects();
+ KStarsPlotWidget *pw;
+ KStars *ksw;
+ QString colJp, colIo, colEu, colGn, colCa;
+};
+
+#endif
diff --git a/kstars/kstars/tools/kstarsplotwidget.cpp b/kstars/kstars/tools/kstarsplotwidget.cpp
new file mode 100644
index 00000000..5e66e2a6
--- /dev/null
+++ b/kstars/kstars/tools/kstarsplotwidget.cpp
@@ -0,0 +1,670 @@
+/***************************************************************************
+ kstarsplotwidget.cpp - A widget for data plotting in KStars
+ -------------------
+ begin : Sun 18 May 2003
+ copyright : (C) 2003 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. *
+ * *
+ ***************************************************************************/
+
+#include <math.h> //for log10(), pow(), modf()
+#include <kdebug.h>
+#include <kglobal.h>
+#include <klocale.h>
+#include <qcolor.h>
+#include <qpainter.h>
+#include <qpixmap.h>
+#include <qstring.h>
+
+#include "kstarsplotwidget.h"
+
+
+
+KStarsPlotWidget::KStarsPlotWidget( double x1, double x2, double y1, double y2, QWidget *parent, const char* name )
+ : KPlotWidget( x1, x2, y1, y2, parent, name ),
+ dXtick2(0.0), dYtick2(0.0),
+ nmajX2(0), nminX2(0), nmajY2(0), nminY2(0),
+ XAxisType(DOUBLE), YAxisType(DOUBLE), XAxisType_0(DOUBLE), YAxisType_0(DOUBLE),
+ XScaleFactor(1.0), YScaleFactor(1.0)
+ {
+
+ setLimits( x1, x2, y1, y2 );
+ setSecondaryLimits( 0.0, 0.0, 0.0, 0.0 );
+}
+
+void KStarsPlotWidget::setLimits( double x1, double x2, double y1, double y2 ) {
+ double X1=0, X2=0, Y1=0, Y2=0;
+ if (x2<x1) { X1=x2; X2=x1; }
+ else { X1=x1; X2=x2; }
+ if ( y2<y1) { Y1=y2; Y2=y1; }
+ else { Y1=y1; Y2=y2; }
+
+ DataRect = DRect( X1, Y1, X2 - X1, Y2 - Y1 );
+ checkLimits();
+
+ updateTickmarks();
+}
+
+void KStarsPlotWidget::setSecondaryLimits( double x1, double x2, double y1, double y2 ) {
+ double XB1=0, XB2=0, YB1=0, YB2=0;
+ if (x2<x1) { XB1=x2; XB2=x1; }
+ else { XB1=x1; XB2=x2; }
+ if ( y2<y1) { YB1=y2; YB2=y1; }
+ else { YB1=y1; YB2=y2; }
+
+ DataRect2 = DRect( XB1, YB1, XB2 - XB1, YB2 - YB1 );
+ updateTickmarks();
+}
+
+void KStarsPlotWidget::checkLimits() {
+ AXIS_TYPE type(DOUBLE);
+ double Range(0.0), sc(1.0);
+
+ for ( unsigned int i=0; i<2; ++i ) {
+ if ( i==0 ) {
+ type = xAxisType0();
+ Range = DataRect.x2() - DataRect.x();
+ } else {
+ type = yAxisType0();
+ Range = DataRect.y2() - DataRect.y();
+ }
+
+ //we switch from TIME type to DOUBLE type if :
+ // Range >36 (we measure in days) or
+ // Range <1 (we measure in minutes)
+ if ( type==TIME ) {
+ if ( Range > 36.0 ) {
+ type = DOUBLE;
+ sc = 1.0/24.0;
+ } else if ( Range < 1.0 ) {
+ type = DOUBLE;
+ sc = 60.0;
+ }
+ }
+
+ //we switch from ANGLE type to DOUBLE type if :
+ // Range >450 (== 1.25 revolutions) (we still measure in degrees, but use DOUBLE rules) or
+ // Range <1 (we measure in arcminutes)
+ if ( type==ANGLE ) {
+ if ( Range > 450.0 ) {
+ type = DOUBLE;
+ } else if ( Range < 1.0 ) {
+ type = DOUBLE;
+ sc = 60.0;
+ }
+ }
+
+ //set the effective DataRect with a bootstrap method; first the x-values
+ //(temporarily using the intrinsic DataRect0 for the y-values), then the
+ //y-values (using the new x-values already in DataRect)
+ if ( i==0 ) {
+ setXAxisType( type );
+ setXScale( sc );
+ } else {
+ setYAxisType( type );
+ setYScale( sc );
+ }
+ }
+}
+
+void KStarsPlotWidget::updateTickmarks() {
+ //This function differs from KPlotWidget::updateTickmarks() in two ways:
+ //the placement of tickmarks is dependent on the Data type of the axis,
+ //and we add the possibility of secondary limits for the top/right axes.
+ if ( dataWidth() == 0.0 ) {
+ kdWarning() << "X range invalid! " << x() << " to " << x2() << endl;
+ DataRect.setWidth( 1.0 );
+ checkLimits();
+ return;
+ }
+ if ( dataHeight() == 0.0 ) {
+ kdWarning() << "Y range invalid! " << y() << " to " << y2() << endl;
+ DataRect.setHeight( 1.0 );
+ checkLimits();
+ return;
+ }
+
+ AXIS_TYPE type(DOUBLE);
+ int nmajor(0), nminor(0);
+ double z1(0.0), z2(0.0), zb1(0.0), zb2(0.0), scale(1.0);
+ double Range(0.0), s(0.0), t(0.0), pwr(0.0), dTick(0.0);
+
+ //loop over X and Y axes...the z variables substitute for either X or Y
+ for ( unsigned int iaxis=0; iaxis<2; ++iaxis ) {
+ if ( iaxis == 1 ) {
+ z1 = x(); z2 = x2(); zb1 = xb(); zb2 = xb2();
+ type = xAxisType();
+ scale = xScale();
+ } else {
+ z1 = y(); z2 = y2(); zb1 = yb(); zb2 = yb2();
+ type = yAxisType();
+ scale = yScale();
+ }
+
+ unsigned int nLimits(1);
+ if ( zb2 - zb1 > 0.0 ) nLimits=2; //secondary limits are defined
+
+ for ( unsigned int itry=1; itry<=nLimits; ++itry ) {
+ //determine size of region to be drawn, in draw units
+ if ( itry==1 ) Range = scale*(z2 - z1);
+ else Range = scale*(zb2 - zb1);
+
+ switch ( type ) {
+ case DOUBLE :
+ {
+ //s is the power-of-ten factor of Range:
+ //Range = t * s; s = 10^(pwr). e.g., Range=350.0 then t=3.5, s = 100.0; pwr = 2.0
+ modf( log10(Range), &pwr );
+ s = pow( 10.0, pwr );
+ t = Range/s;
+
+ //adjust s and t such that t is between 3 and 5:
+ if ( t < 3.0 ) { t *= 10.0; s /= 10.0; } //t now btwn 3 and 30
+ if ( t < 6.0 ) { //accept current values
+ dTick = s/scale;
+ nmajor = int(t);
+ nminor = 5;
+ } else if ( t < 10.0 ) { //factor of 2
+ dTick = s*2.0/scale;
+ nmajor = int(t/2.0);
+ nminor = 4;
+ } else if ( t < 20.0 ) { //factor of 4
+ dTick = s*4.0/scale;
+ nmajor = int(t/4.0);
+ nminor = 4;
+ } else { //factor of 5
+ dTick = s*5.0/scale;
+ nmajor = int(t/5.0);
+ nminor = 5;
+ }
+
+ break;
+ } // end case DOUBLE
+
+ case TIME:
+ {
+ if ( Range < 3.0 ) {
+ dTick = 0.5/scale;
+ nmajor = int(Range/dTick);
+ nminor = 3;
+ } else if ( Range < 6.0 ) {
+ dTick = 1.0/scale;
+ nmajor = int(Range/dTick);
+ nminor = 4;
+ } else if ( Range < 12.0 ) {
+ dTick = 2.0/scale;
+ nmajor = int(Range/dTick);
+ nminor = 4;
+ } else {
+ dTick = 4.0/scale;
+ nmajor = int(Range/dTick);
+ nminor = 4;
+ }
+
+ break;
+ } //end case TIME
+
+ case ANGLE:
+ {
+ if ( Range < 3.0 ) {
+ dTick = 0.5/scale;
+ nmajor = int(Range/dTick);
+ nminor = 3;
+ } else if ( Range < 6.0 ) {
+ dTick = 1.0/scale;
+ nmajor = int(Range/dTick);
+ nminor = 4;
+ } else if ( Range < 12.0 ) {
+ dTick = 2.0/scale;
+ nmajor = int(Range/dTick);
+ nminor = 4;
+ } else if ( Range < 20.0 ) {
+ dTick = 4.0/scale;
+ nmajor = int(Range/dTick);
+ nminor = 5;
+ } else if ( Range < 30.0 ) {
+ dTick = 5.0/scale;
+ nmajor = int(Range/dTick);
+ nminor = 5;
+ } else if ( Range < 60.0 ) {
+ dTick = 10.0/scale;
+ nmajor = int(Range/dTick);
+ nminor = 5;
+ } else if ( Range < 190.0 ) {
+ dTick = 30.0/scale;
+ nmajor = int(Range/dTick);
+ nminor = 3;
+ } else {
+ dTick = 45.0/scale;
+ nmajor = int(Range/dTick);
+ nminor = 3;
+ }
+
+ break;
+ } //end case TIME
+
+ case UNKNOWN_TYPE: break;
+
+ } //end type switch
+
+ if ( iaxis==1 ) { //X axis
+ if ( itry==1 ) {
+ nmajX = nmajor;
+ nminX = nminor;
+ dXtick = dTick;
+ } else {
+ nmajX2 = nmajor;
+ nminX2 = nminor;
+ dXtick2 = dTick;
+ }
+ } else { //Y axis
+ if ( itry==1 ) {
+ nmajY = nmajor;
+ nminY = nminor;
+ dYtick = dTick;
+ } else {
+ nmajY2 = nmajor;
+ nminY2 = nminor;
+ dYtick2 = dTick;
+ }
+ } //end if iaxis
+ } //end for itry
+ } //end for iaxis
+}
+
+void KStarsPlotWidget::drawBox( QPainter *p ) {
+ int pW = PixRect.width(), pH = PixRect.height();
+
+ //First, fill in padding region with bgColor() to mask out-of-bounds plot data
+ p->setPen( bgColor() );
+ p->setBrush( bgColor() );
+
+ //left padding ( don't forget: we have translated by XPADDING, YPADDING )
+ p->drawRect( -leftPadding(), -topPadding(), leftPadding(), height() );
+
+ //right padding
+ p->drawRect( pW, -topPadding(), rightPadding(), height() );
+
+ //top padding
+ p->drawRect( 0, -topPadding(), pW, topPadding() );
+
+ //bottom padding
+ p->drawRect( 0, pH, pW, bottomPadding() );
+
+ if ( ShowGrid ) {
+ //Grid lines are placed at locations of primary axes' major tickmarks
+ p->setPen( gridColor() );
+
+ //vertical grid lines
+ double x0 = x() - dmod( x(), dXtick ); //zeropoint; x(i) is this plus i*dXtick1
+ for ( int ix = 0; ix <= nmajX+1; ix++ ) {
+ int px = int( pW * ( (x0 + ix*dXtick - x())/dataWidth() ) );
+ p->drawLine( px, 0, px, pH );
+ }
+
+ //horizontal grid lines
+ double y0 = y() - dmod( y(), dYtick ); //zeropoint; y(i) is this plus i*mX
+ for ( int iy = 0; iy <= nmajY+1; iy++ ) {
+ int py = int( pH * ( (y0 + iy*dYtick - y())/dataHeight() ) );
+ p->drawLine( 0, py, pW, py );
+ }
+ }
+
+ p->setPen( fgColor() );
+ p->setBrush( Qt::NoBrush );
+
+ if ( LeftAxis.isVisible() || BottomAxis.isVisible() ) p->drawRect( PixRect ); //box outline
+
+ if ( ShowTickMarks ) {
+ //spacing between minor tickmarks (in data units)
+ double dminX = dXtick/nminX;
+ double dminY = dYtick/nminY;
+
+ bool secondaryXLimits( false );
+ bool secondaryYLimits( false );
+ if ( dataWidth2() > 0.0 && ( xb() != x() || xb2() != x2() ) ) secondaryXLimits = true;
+ if ( dataHeight2() > 0.0 && ( yb() != y() || yb2() != y2() ) ) secondaryYLimits = true;
+
+ //set small font for tick labels
+ QFont f = p->font();
+ int s = f.pointSize();
+ f.setPointSize( s - 2 );
+ p->setFont( f );
+
+ //--- Draw primary X tickmarks on bottom axis---//
+ double x0 = x() - dmod( x(), dXtick ); //zeropoint; tickmark i is this plus i*dXtick1 (in data units)
+ if ( x() < 0 ) x0 -= dXtick;
+
+ for ( int ix = 0; ix <= nmajX+1; ix++ ) {
+ int px = int( pW * ( (x0 + ix*dXtick - x())/dataWidth() ) ); //position of tickmark i (in screen units)
+ if ( px > 0 && px < pW ) {
+ p->drawLine( px, pH - 2, px, pH - BIGTICKSIZE - 2 ); //move tickmarks 2 pixels (avoids sticking out other side)
+ if ( !secondaryXLimits ) p->drawLine( px, 0, px, BIGTICKSIZE );
+ }
+
+ //tick label
+ if ( ShowTickLabels ) {
+ double lab = xScale()*(x0 + ix*dXtick);
+ if ( fabs(lab)/dXtick < 0.00001 ) lab = 0.0; //fix occassional roundoff error with "0.0" label
+
+ switch ( xAxisType() ) {
+ case DOUBLE :
+ {
+ QString str = QString( "%1" ).arg( lab, 0, 'g', 2 );
+ int idot = str.find( '.' );
+ if ( idot >= 0 )
+ str = str.replace( idot, 1, KGlobal::locale()->decimalSymbol() );
+
+ if ( px > 0 && px < pW ) {
+ QRect r( px - BIGTICKSIZE, pH+BIGTICKSIZE, 2*BIGTICKSIZE, BIGTICKSIZE );
+ p->drawText( r, Qt::AlignCenter | Qt::DontClip, str );
+ }
+ break;
+ }
+ case TIME :
+ {
+ int h = int(lab);
+ int m = int(60.*(lab - h));
+ while ( h > 24 ) { h -= 24; }
+ while ( h < 0 ) { h += 24; }
+
+ QString str = QString().sprintf( "%02d:%02d", h, m );
+ if ( px > 0 && px < pW ) {
+ QRect r( px - BIGTICKSIZE, pH+BIGTICKSIZE, 2*BIGTICKSIZE, BIGTICKSIZE );
+ p->drawText( r, Qt::AlignCenter | Qt::DontClip, str );
+ }
+ break;
+ }
+ case ANGLE :
+ {
+ QString str = QString().sprintf( "%d%c", int(lab), 176 );
+ if ( px > 0 && px < pW ) {
+ QRect r( px - BIGTICKSIZE, pH+BIGTICKSIZE, 2*BIGTICKSIZE, BIGTICKSIZE );
+ p->drawText( r, Qt::AlignCenter | Qt::DontClip, str );
+ }
+ break;
+ }
+
+ case UNKNOWN_TYPE : break;
+ }
+ }
+
+ //draw minor ticks
+ for ( int j=0; j < nminX; j++ ) {
+ int pmin = int( px + pW*j*dminX/dataWidth() ); //position of minor tickmark j (in screen units)
+ if ( pmin > 0 && pmin < pW ) {
+ p->drawLine( pmin, pH-2, pmin, pH-SMALLTICKSIZE-2 );
+ if ( !secondaryXLimits ) p->drawLine( pmin, 0, pmin, SMALLTICKSIZE );
+ }
+ }
+ }
+
+ //--- Draw primary Y tickmarks on left axis---//
+ double y0 = y() - dmod( y(), dYtick ); //zeropoint; tickmark i is this plus i*dYtick1 (in data units)
+ if ( y() < 0 ) y0 -= dYtick;
+
+ for ( int iy = 0; iy <= nmajY+1; iy++ ) {
+ int py = pH - int( pH * ( (y0 + iy*dYtick - y())/dataHeight() ) ); //position of tickmark i (in screen units)
+ if ( py > 0 && py < pH ) {
+ p->drawLine( 0, py, BIGTICKSIZE, py );
+ if ( !secondaryXLimits ) p->drawLine( pW - BIGTICKSIZE - 2, py, pW - 2, py );
+ }
+
+ //tick label
+ if ( ShowTickLabels ) {
+ double lab = yScale()*(y0 + iy*dYtick);
+ if ( fabs(lab)/dYtick < 0.00001 ) lab = 0.0; //fix occassional roundoff error with "0.0" label
+
+ switch ( yAxisType() ) {
+ case DOUBLE :
+ {
+ QString str = QString( "%1" ).arg( lab, 0, 'g', 2 );
+ int idot = str.find( '.' );
+ if ( idot >= 0 )
+ str = str.replace( idot, 1, KGlobal::locale()->decimalSymbol() );
+
+ if ( py > 0 && py < pH ) {
+ QRect r( -2*BIGTICKSIZE, py-SMALLTICKSIZE, 2*BIGTICKSIZE, 2*SMALLTICKSIZE );
+ p->drawText( r, Qt::AlignCenter | Qt::DontClip, str );
+ }
+ break;
+ }
+ case TIME :
+ {
+ int h = int(lab);
+ int m = int(60.*(lab - h));
+ while ( h > 24 ) { h -= 24; }
+ while ( h < 0 ) { h += 24; }
+
+ QString str = QString().sprintf( "%02d:%02d", h, m );
+ if ( py > 0 && py < pH ) {
+ QRect r( -3*BIGTICKSIZE, py-SMALLTICKSIZE, 2*BIGTICKSIZE, 2*SMALLTICKSIZE );
+ p->drawText( r, Qt::AlignCenter | Qt::DontClip, str );
+ }
+ break;
+ }
+ case ANGLE :
+ {
+ QString str = QString().sprintf( "%d%c", int(lab), 176 );
+ if ( py > 0 && py < pH ) {
+ QRect r( -3*BIGTICKSIZE, py-SMALLTICKSIZE, 2*BIGTICKSIZE, 2*SMALLTICKSIZE );
+ p->drawText( r, Qt::AlignCenter | Qt::DontClip, str );
+ }
+ break;
+ }
+
+ case UNKNOWN_TYPE : break;
+ }
+ }
+
+ //draw minor ticks
+ for ( int j=0; j < nminY; j++ ) {
+ int pmin = int( py - pH*j*dminY/dataHeight() ); //position of minor tickmark j (in screen units)
+ if ( pmin > 0 && pmin < pH ) {
+ p->drawLine( 0, pmin, SMALLTICKSIZE, pmin );
+ if ( !secondaryYLimits ) p->drawLine( pW - 2, pmin, pW-SMALLTICKSIZE-2, pmin );
+ }
+ }
+ }
+
+ //--- Draw secondary X tickmarks on top axis---//
+ if ( secondaryXLimits ) {
+ double dminX2 = dXtick2/nminX2;
+ double x0 = xb() - dmod( xb(), dXtick2 ); //zeropoint; tickmark i is this plus i*dXtick2 (in data units)
+
+ for ( int ix = 0; ix <= nmajX2; ix++ ) {
+ int px = int( pW * ( (x0 + ix*dXtick2 - xb())/dataWidth2() ) ); //position of tickmark i (in screen units)
+ if ( px > 0 && px < pW ) p->drawLine( px, 0, px, BIGTICKSIZE );
+
+ //tick label
+ if ( ShowTickLabels ) {
+ double lab = xScale()*(x0 + ix*dXtick2);
+ if ( fabs(lab)/dXtick2 < 0.00001 ) lab = 0.0; //fix occassional roundoff error with "0.0" label
+
+ switch ( xAxisType() ) {
+ case DOUBLE :
+ {
+ QString str = QString( "%1" ).arg( lab, 0, 'g', 2 );
+ int idot = str.find( '.' );
+ if ( idot >= 0 )
+ str = str.replace( idot, 1, KGlobal::locale()->decimalSymbol() );
+
+ if ( px > 0 && px < pW ) {
+ QRect r( px - BIGTICKSIZE, -2*BIGTICKSIZE, 2*BIGTICKSIZE, BIGTICKSIZE );
+ p->drawText( r, Qt::AlignCenter | Qt::DontClip, str );
+ }
+ break;
+ }
+ case TIME :
+ {
+ int h = int(lab);
+ int m = int(60.*(lab - h));
+ while ( h > 24 ) { h -= 24; }
+ while ( h < 0 ) { h += 24; }
+
+ QString str = QString().sprintf( "%02d:%02d", h, m );
+ if ( px > 0 && px < pW ) {
+ QRect r( px - BIGTICKSIZE, -2*BIGTICKSIZE, 2*BIGTICKSIZE, BIGTICKSIZE );
+ p->drawText( r, Qt::AlignCenter | Qt::DontClip, str );
+ }
+ break;
+ }
+ case ANGLE :
+ {
+ QString str = QString().sprintf( "%d%c", int(lab), 176 );
+ if ( px > 0 && px < pW ) {
+ QRect r( px - BIGTICKSIZE, -2*BIGTICKSIZE, 2*BIGTICKSIZE, BIGTICKSIZE );
+ p->drawText( r, Qt::AlignCenter | Qt::DontClip, str );
+ }
+ break;
+ }
+
+ case UNKNOWN_TYPE : break;
+ }
+ }
+
+ //draw minor ticks
+ for ( int j=0; j < nminX2; j++ ) {
+ int pmin = int( px + pW*j*dminX2/dataWidth2() ); //position of minor tickmark j (in screen units)
+ if ( pmin > 0 && pmin < pW ) p->drawLine( pmin, 0, pmin, SMALLTICKSIZE );
+ }
+ }
+ } //end if ( secondaryXLimits )
+
+ //--- Draw secondary Y tickmarks on right axis ---//
+ if ( secondaryYLimits ) {
+ double dminY2 = dYtick2/nminY2;
+ double y0 = yScale()*(yb() - dmod( yb(), dYtick2 )); //zeropoint; tickmark i is this plus i*mX (in data units)
+
+ for ( int iy = 0; iy <= nmajY2; iy++ ) {
+ int py = pH - int( pH * ( (y0 + iy*dYtick2 - yb())/dataWidth2() ) ); //position of tickmark i (in screen units)
+ if ( py > 0 && py < pH ) p->drawLine( pH, py, pW-BIGTICKSIZE, py );
+
+ //tick label
+ if ( ShowTickLabels ) {
+ double lab = y0 + iy*dYtick2;
+ if ( fabs(lab)/dYtick2 < 0.00001 ) lab = 0.0; //fix occassional roundoff error with "0.0" label
+
+ switch ( yAxisType() ) {
+ case DOUBLE :
+ {
+ QString str = QString( "%1" ).arg( lab, 0, 'g', 2 );
+ int idot = str.find( '.' );
+ if ( idot >= 0 )
+ str = str.replace( idot, 1, KGlobal::locale()->decimalSymbol() );
+
+ if ( py > 0 && py < pH ) {
+ QRect r( pW + 2*BIGTICKSIZE, py-SMALLTICKSIZE, 2*BIGTICKSIZE, 2*SMALLTICKSIZE );
+ p->drawText( r, Qt::AlignCenter | Qt::DontClip, str );
+ }
+ break;
+ }
+ case TIME :
+ {
+ int h = int(lab);
+ int m = int(60.*(lab - h));
+ while ( h > 24 ) { h -= 24; }
+ while ( h < 0 ) { h += 24; }
+
+ QString str = QString().sprintf( "%02d:%02d", h, m );
+ if ( py > 0 && py < pH ) {
+ QRect r( pW + 2*BIGTICKSIZE, py-SMALLTICKSIZE, 2*BIGTICKSIZE, 2*SMALLTICKSIZE );
+ p->drawText( r, Qt::AlignCenter | Qt::DontClip, str );
+ }
+ break;
+ }
+ case ANGLE :
+ {
+ QString str = QString().sprintf( "%d%c", int(lab), 176 );
+ if ( py > 0 && py < pH ) {
+ QRect r( pW + 3*BIGTICKSIZE, py-SMALLTICKSIZE, 2*BIGTICKSIZE, 2*SMALLTICKSIZE );
+ p->drawText( r, Qt::AlignCenter | Qt::DontClip, str );
+ }
+ break;
+ }
+
+ case UNKNOWN_TYPE : break;
+ }
+ }
+
+ //minor ticks
+ for ( int j=0; j < nminY2; j++ ) {
+ int pmin = py - int( pH*j*dminY2/dataHeight2() ); //position of minor tickmark j (in screen units)
+ if ( pmin > 0 && pmin < pH ) p->drawLine( pW, pmin, pW-SMALLTICKSIZE, pmin );
+ }
+ }
+ } //end if ( secondaryYLimits )
+
+ f.setPointSize( s );
+ p->setFont( f );
+
+ } //end if ( showTickmarks )
+
+ //Draw X Axis Label(s)
+ if ( ! BottomAxis.label().isEmpty() ) {
+ QRect r( 0, PixRect.height() + 2*YPADDING, PixRect.width(), YPADDING );
+ p->drawText( r, Qt::AlignCenter | Qt::DontClip, BottomAxis.label() );
+ }
+ if ( ! XAxisLabel2.isEmpty() ) {
+ QRect r( 0, -3*YPADDING, PixRect.width(), YPADDING );
+ p->drawText( r, Qt::AlignCenter | Qt::DontClip, XAxisLabel2 );
+ }
+
+ //Draw Y Axis Label(s). We need to draw the text sideways.
+ if ( ! LeftAxis.label().isEmpty() ) {
+ //store current painter translation/rotation state
+ p->save();
+
+ //translate coord sys to left corner of axis label rectangle, then rotate 90 degrees.
+ p->translate( -3*XPADDING, PixRect.height() );
+ p->rotate( -90.0 );
+
+ QRect r( 0, 0, PixRect.height(), XPADDING );
+ p->drawText( r, Qt::AlignCenter | Qt::DontClip, LeftAxis.label() ); //draw the label, now that we are sideways
+
+ p->restore(); //restore translation/rotation state
+ }
+ if ( ! YAxisLabel2.isEmpty() ) {
+ //store current painter translation/rotation state
+ p->save();
+
+ //translate coord sys to left corner of axis label rectangle, then rotate 90 degrees.
+ p->translate( PixRect.width() + 2*XPADDING, PixRect.height() );
+ p->rotate( -90.0 );
+
+ QRect r( 0, 0, PixRect.height(), XPADDING );
+ p->drawText( r, Qt::AlignCenter | Qt::DontClip, YAxisLabel2 ); //draw the label, now that we are sideways
+
+ p->restore(); //restore translation/rotation state
+ }
+}
+
+int KStarsPlotWidget::rightPadding() const {
+ if ( RightPadding >= 0 ) return RightPadding;
+
+ bool secondaryYLimits( false );
+ if ( dataHeight2() > 0.0 && ( yb() != y() || yb2() != y2() ) ) secondaryYLimits = true;
+ if ( secondaryYLimits && ( ShowTickLabels && ! XAxisLabel2 ) ) return 3*XPADDING;
+ if ( secondaryYLimits && ( ShowTickLabels || ! XAxisLabel2 ) ) return 2*XPADDING;
+ return XPADDING;
+}
+
+int KStarsPlotWidget::topPadding() const {
+ if ( TopPadding >= 0 ) return TopPadding;
+
+ bool secondaryXLimits( false );
+ if ( dataWidth2() > 0.0 && ( xb() != x() || xb2() != x2() ) ) secondaryXLimits = true;
+ if ( secondaryXLimits && ( ShowTickLabels && ! YAxisLabel2 ) ) return 3*YPADDING;
+ if ( secondaryXLimits && ( ShowTickLabels || ! YAxisLabel2 ) ) return 2*YPADDING;
+ return YPADDING;
+}
+
+#include "kstarsplotwidget.moc"
diff --git a/kstars/kstars/tools/kstarsplotwidget.h b/kstars/kstars/tools/kstarsplotwidget.h
new file mode 100644
index 00000000..554f4a80
--- /dev/null
+++ b/kstars/kstars/tools/kstarsplotwidget.h
@@ -0,0 +1,128 @@
+/***************************************************************************
+ kstarsplotwidget.h - A widget for dat plotting in KStars
+ -------------------
+ begin : Sun 18 May 2003
+ copyright : (C) 2003 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 _KSTARSPLOTWIDGET_H_
+#define _KSTARSPLOTWIDGET_H_
+
+#include <qwidget.h>
+#include <libkdeedu/kdeeduplot/kplotwidget.h>
+
+#define BIGTICKSIZE 10
+#define SMALLTICKSIZE 4
+#define XPADDING 20
+#define YPADDING 20
+
+class QColor;
+class QPixmap;
+
+/**@class KStarsPlotWidget
+ *@short A plotting widget for KStars tools, derived from the more generic class KPlotWidget.
+ *@author Jason Harris
+ *@version 1.0
+ *Widget for drawing plots. Features added to KPlotWidget: secondary Axis labels, data types
+ */
+
+class KStarsPlotWidget : public KPlotWidget {
+ Q_OBJECT
+public:
+/**Constructor
+ */
+ KStarsPlotWidget( double x1=0.0, double x2=1.0, double y1=0.0, double y2=1.0, QWidget *parent=0, const char* name=0 );
+
+/**Destructor (empty)
+ */
+ ~KStarsPlotWidget() {}
+
+/**@enum AXIS_TYPE
+ *Specifies the data type of the axis.
+ */
+ enum AXIS_TYPE { DOUBLE=0, TIME=1, ANGLE=2, UNKNOWN_TYPE };
+
+/**@short Determine the placement of major and minor tickmarks, based on the current Limit settings
+ */
+ void updateTickmarks();
+ void setLimits( double xb1, double xb2, double yb1, double yb2 );
+ void setSecondaryLimits( double xb1, double xb2, double yb1, double yb2 );
+ void checkLimits();
+
+ double xb() const { return DataRect2.x(); }
+ double xb2() const { return DataRect2.x2(); }
+ double yb() const { return DataRect2.y(); }
+ double yb2() const { return DataRect2.y2(); }
+ double dataWidth2() const { return DataRect2.width(); }
+ double dataHeight2() const { return DataRect2.height(); }
+
+ double xScale() const { return XScaleFactor; }
+ void setXScale( double s ) { XScaleFactor = s; }
+ double yScale() const { return YScaleFactor; }
+ void setYScale( double s ) { YScaleFactor = s; }
+
+ /**@return the data type of the x-axis (DOUBLE, TIME or ANGLE)
+ */
+ AXIS_TYPE xAxisType() const { return XAxisType; }
+ AXIS_TYPE xAxisType0() const { return XAxisType_0; }
+ /**@return the data type of the y-axis (DOUBLE, TIME or ANGLE)
+ */
+ AXIS_TYPE yAxisType() const { return YAxisType; }
+ AXIS_TYPE yAxisType0() const { return YAxisType_0; }
+
+ /**@short set the data type of the x-axis
+ *@param xtype the new data type (DOUBLE, TIME, or ANGLE)
+ */
+ void setXAxisType( AXIS_TYPE xtype ) { XAxisType = xtype; }
+ void setXAxisType0( AXIS_TYPE xtype ) { XAxisType_0 = xtype; }
+ /**@short set the data type of the y-axis
+ *@param ytype the new data type (DOUBLE, TIME, or ANGLE)
+ */
+ void setYAxisType( AXIS_TYPE ytype ) { YAxisType = ytype; }
+ void setYAxisType0( AXIS_TYPE ytype ) { YAxisType_0 = ytype; }
+
+ /**@short set the secondary X-axis label
+ *@param xlabel a short string describing the data plotted on the x-axis.
+ *Set the label to an empty string to omit the axis label.
+ */
+ virtual void setXAxisLabel2( QString xlabel ) { XAxisLabel2 = xlabel; }
+ /**@short set the secondary Y-axis label
+ *@param ylabel a short string describing the data plotted on the y-axis.
+ *Set the label to an empty string to omit the axis label.
+ */
+ virtual void setYAxisLabel2( QString ylabel ) { YAxisLabel2 = ylabel; }
+
+ /**@returns the number of pixels to the right of the plot area.
+ *Padding values are set to -1 by default; if unchanged, this function will try to guess
+ *a good value, based on whether ticklabels and/or axis labels are to be drawn.
+ */
+ int rightPadding() const;
+ /**@returns the number of pixels above the plot area.
+ *Padding values are set to -1 by default; if unchanged, this function will try to guess
+ *a good value, based on whether ticklabels and/or axis labels are to be drawn.
+ */
+ int topPadding() const;
+
+protected:
+ void drawBox( QPainter *p );
+
+ double dXtick2, dYtick2;
+ int nmajX2, nminX2, nmajY2, nminY2;
+ AXIS_TYPE XAxisType, YAxisType, XAxisType_0, YAxisType_0;
+ double XScaleFactor, YScaleFactor;
+ DRect DataRect2;
+
+ QString XAxisLabel2, YAxisLabel2;
+};
+
+#endif
diff --git a/kstars/kstars/tools/lcgenerator.cpp b/kstars/kstars/tools/lcgenerator.cpp
new file mode 100644
index 00000000..39a535f2
--- /dev/null
+++ b/kstars/kstars/tools/lcgenerator.cpp
@@ -0,0 +1,478 @@
+/***************************************************************************
+ lcgenerator.cpp - description
+ -------------------
+ begin : Tue Oct 1 18:01:48 CDT 2002
+ copyright : (C) 2002 by Jasem Mutlaq
+ email : mutlaqja@ku.edu
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include <qvariant.h>
+#include <klineedit.h>
+#include <klistbox.h>
+#include <kpushbutton.h>
+#include <qcheckbox.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+#include <qfile.h>
+
+#include <kio/netaccess.h>
+#include <kmessagebox.h>
+#include <kstandarddirs.h>
+
+#include "lcgenerator.h"
+#include "imageviewer.h"
+#include "kstars.h"
+#include "kstarsdata.h"
+
+#include <kapplication.h>
+
+LCGenerator::LCGenerator( QWidget* parent)
+ : KDialogBase( parent, "lcgenerator", false, i18n( "AAVSO Light Curve Generator"),0) , Hostprefix("http://www.aavso.org/cgi-bin/kstar.pl"), JDCutOff(2437600)
+{
+
+ ksw = (KStars*) parent;
+ createGUI();
+
+ downloadJob = 0;
+
+ file = new QFile();
+}
+
+LCGenerator::~LCGenerator()
+{
+ delete file;
+ delete downloadJob;
+}
+
+void LCGenerator::createGUI()
+{
+
+ QWidget *page = new QWidget(this);
+ setMainWidget(page);
+
+ LCGeneratorDialogLayout = new QVBoxLayout( page, 11, 6, "LCGeneratorDialogLayout");
+
+ SDLayout = new QHBoxLayout( 0, 0, 6, "SDLayout");
+
+ StarInfoBox = new QGroupBox( page, "StarInfoBox" );
+ StarInfoBox->setColumnLayout(0, Qt::Vertical );
+ StarInfoBox->layout()->setSpacing( 6 );
+ StarInfoBox->layout()->setMargin( 11 );
+ StarInfoBoxLayout = new QVBoxLayout( StarInfoBox->layout() );
+ StarInfoBoxLayout->setAlignment( Qt::AlignTop );
+
+ DesignHLayout = new QHBoxLayout( 0, 0, 6, "DesignHLayout");
+
+ desigLabel = new QLabel( StarInfoBox, "desigLabel" );
+ desigLabel->setMinimumSize( QSize( 70, 0 ) );
+ DesignHLayout->addWidget( desigLabel );
+
+ DesignationIn = new KListBox( StarInfoBox, "DesignationIn" );
+ DesignHLayout->addWidget( DesignationIn );
+ StarInfoBoxLayout->addLayout( DesignHLayout );
+
+ // Fill stars designations
+ for (uint i=0; i< (ksw->data()->VariableStarsList.count()); i++)
+ DesignationIn->insertItem(ksw->data()->VariableStarsList.at(i)->Designation);
+
+ NameHLayout = new QHBoxLayout( 0, 0, 6, "NameHLayout");
+
+ nameLabel = new QLabel( StarInfoBox, "nameLabel" );
+ nameLabel->setMinimumSize( QSize( 70, 0 ) );
+ NameHLayout->addWidget( nameLabel );
+
+ NameIn = new KListBox( StarInfoBox, "NameIn" );
+ NameHLayout->addWidget( NameIn );
+ StarInfoBoxLayout->addLayout( NameHLayout );
+
+ // Fill star names
+ for (uint i=0; i<ksw->data()->VariableStarsList.count(); i++)
+ NameIn->insertItem(ksw->data()->VariableStarsList.at(i)->Name);
+
+ StartHLayout = new QHBoxLayout( 0, 0, 6, "StartHLayout");
+
+ startLabel = new QLabel( StarInfoBox, "startLabel" );
+ startLabel->setMinimumSize( QSize( 70, 0 ) );
+ StartHLayout->addWidget( startLabel );
+
+ StartDateIn = new KLineEdit( StarInfoBox, "StartDateIn" );
+ StartHLayout->addWidget( StartDateIn );
+ StarInfoBoxLayout->addLayout( StartHLayout );
+
+ EndHLayout = new QHBoxLayout( 0, 0, 6, "EndHLayout");
+
+ endLabel = new QLabel( StarInfoBox, "endLabel" );
+ endLabel->setMinimumSize( QSize( 70, 0 ) );
+ EndHLayout->addWidget( endLabel );
+
+ EndDateIn = new KLineEdit( StarInfoBox, "EndDateIn" );
+ EndHLayout->addWidget( EndDateIn );
+ StarInfoBoxLayout->addLayout( EndHLayout );
+ SDLayout->addWidget( StarInfoBox );
+
+ DataSelectBox = new QGroupBox( page, "DataSelectBox" );
+ DataSelectBox->setColumnLayout(0, Qt::Vertical );
+ DataSelectBox->layout()->setSpacing( 6 );
+ DataSelectBox->layout()->setMargin( 11 );
+ DataSelectBoxLayout = new QVBoxLayout( DataSelectBox->layout() );
+ DataSelectBoxLayout->setAlignment( Qt::AlignTop );
+
+ VisualCheck = new QCheckBox( DataSelectBox, "VisualCheck" );
+ VisualCheck->setChecked( TRUE );
+ DataSelectBoxLayout->addWidget( VisualCheck );
+
+ FainterCheck = new QCheckBox( DataSelectBox, "FainterCheck" );
+ FainterCheck->setChecked( TRUE );
+ DataSelectBoxLayout->addWidget( FainterCheck );
+
+ DiscrepantCheck = new QCheckBox( DataSelectBox, "DiscrepantCheck" );
+ DataSelectBoxLayout->addWidget( DiscrepantCheck );
+
+ CCDBCheck = new QCheckBox( DataSelectBox, "CCDBCheck" );
+ CCDBCheck->setChecked( TRUE );
+ DataSelectBoxLayout->addWidget( CCDBCheck );
+
+ CCDVCheck = new QCheckBox( DataSelectBox, "CCDVCheck" );
+ CCDVCheck->setChecked( TRUE );
+ DataSelectBoxLayout->addWidget( CCDVCheck );
+
+ CCDRCheck = new QCheckBox( DataSelectBox, "CCDRCheck" );
+ CCDRCheck->setChecked( TRUE );
+ DataSelectBoxLayout->addWidget( CCDRCheck );
+
+ CCDICheck = new QCheckBox( DataSelectBox, "CCDICheck" );
+ CCDICheck->setChecked( TRUE );
+ DataSelectBoxLayout->addWidget( CCDICheck );
+
+ PlotHLayout = new QHBoxLayout( 0, 0, 6, "PlotHLayout");
+
+ plotLabel = new QLabel( DataSelectBox, "plotLabel" );
+ PlotHLayout->addWidget( plotLabel );
+
+ AverageDayIn = new KLineEdit( DataSelectBox, "AverageDayIn" );
+ PlotHLayout->addWidget( AverageDayIn );
+
+ daysLabel = new QLabel( DataSelectBox, "daysLabel" );
+ PlotHLayout->addWidget( daysLabel );
+ DataSelectBoxLayout->addLayout( PlotHLayout );
+ SDLayout->addWidget( DataSelectBox );
+ LCGeneratorDialogLayout->addLayout( SDLayout );
+
+ ButtonHLayout = new QHBoxLayout( 0, 0, 6, "ButtonHLayout");
+
+ GetCurveButton = new KPushButton( page, "GetCurveButton" );
+ ButtonHLayout->addWidget( GetCurveButton );
+
+ UpdateListButton = new KPushButton( page, "UpdateListButton" );
+ ButtonHLayout->addWidget( UpdateListButton );
+ QSpacerItem* spacer = new QSpacerItem( 128, 16, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ ButtonHLayout->addItem( spacer );
+
+ CloseButton = new KPushButton( page, "closeButton" );
+ ButtonHLayout->addWidget( CloseButton );
+ LCGeneratorDialogLayout->addLayout( ButtonHLayout );
+
+
+ StarInfoBox->setTitle( i18n( "Star Info" ) );
+ desigLabel->setText( i18n( "Designation:" ) );
+ nameLabel->setText( i18n( "Or name:" ) );
+ startLabel->setText( i18n( "Start date:" ) );
+ QWhatsThis::add( startLabel, i18n( "Start date for the light curve plot in mm/dd/yy or JD" ) );
+ endLabel->setText( i18n( "End date:" ) );
+ QWhatsThis::add( endLabel, i18n( "End date for the light curve plot in mm/dd/yy or JD" ) );
+ StartDateIn->setText( i18n( "default" ) );
+ EndDateIn->setText( i18n( "default" ) );
+ DataSelectBox->setTitle( i18n( "Data Selection" ) );
+ VisualCheck->setText( i18n( "Visual" ) );
+ FainterCheck->setText( i18n( "Fainter thans" ) );
+ DiscrepantCheck->setText( i18n( "Discrepant data" ) );
+ CCDBCheck->setText( i18n( "CCDB" ) );
+ CCDVCheck->setText( i18n( "CCDV" ) );
+ CCDRCheck->setText( i18n( "CCDR" ) );
+ CCDICheck->setText( i18n( "CCDI" ) );
+ plotLabel->setText( i18n( "Plot average:" ) );
+ daysLabel->setText( i18n( "days" ) );
+ GetCurveButton->setText( i18n( "Retrieve Curve" ) );
+ UpdateListButton->setText( i18n( "Update List" ) );
+ CloseButton->setText( i18n( "Close" ) );
+
+ resize( QSize(500, 360) );
+
+ // Signals/Slots
+ QObject::connect(CloseButton, SIGNAL(clicked()), this, SLOT(close()));
+ QObject::connect(GetCurveButton, SIGNAL(clicked()), this, SLOT(VerifyData()));
+ QObject::connect(UpdateListButton, SIGNAL(clicked()), this, SLOT(updateStarList()));
+ QObject::connect(DesignationIn, SIGNAL(highlighted(int)), this, SLOT(updateNameList(int)));
+ QObject::connect(NameIn, SIGNAL(highlighted(int)), this, SLOT(updateDesigList(int)));
+
+
+}
+
+void LCGenerator::VerifyData()
+{
+ QString InitialStartDate, InitialEndDate;
+ QString FinalDesignation, FinalStartDate, FinalEndDate, AverageDays;
+ bool AverageDaysOK;
+
+ // Get initial user input
+ if ( StartDateIn->text().isEmpty() ) StartDateIn->setText( i18n( "default" ) );
+ if ( EndDateIn->text().isEmpty() ) EndDateIn->setText( i18n( "default" ) );
+ InitialStartDate = StartDateIn->text().lower();
+ InitialEndDate = EndDateIn->text().lower();
+ AverageDays = AverageDayIn->text();
+ FinalDesignation = DesignationIn->currentText();
+
+ // set Julian day
+ if (!setJD(InitialStartDate, &FinalStartDate, 0))
+ return;
+ if (!setJD(InitialEndDate, &FinalEndDate, 1))
+ return;
+
+ if (FinalEndDate.toInt() < FinalStartDate.toInt())
+ {
+ KMessageBox::error(this, i18n("End date must occur after start date."));
+ return;
+ }
+
+ // Check that we have an integer for average number of days, if data field empty, then make it 'default'
+ if (!AverageDays.isEmpty())
+ {
+ AverageDays.toInt(&AverageDaysOK);
+ if (!AverageDaysOK)
+ {
+ KMessageBox::error(this, i18n("Average days must be a positive integer."));
+ return;
+ }
+ else
+ {
+ if (AverageDays.toInt() < 0)
+ {
+ KMessageBox::error(this, i18n("Average days must be a positive integer."));
+ return;
+ }
+ }
+
+ }
+ else AverageDays = QString("default");
+
+ //Download the curve!
+ DownloadCurve(FinalStartDate, FinalEndDate, FinalDesignation, AverageDays);
+
+}
+
+bool LCGenerator::setJD(QString Date, QString *JD, int JDType)
+{
+ uint i=0;
+ int TempJD=0;
+ int slashCount =0;
+ int slashRefrence[2];
+
+ int dateFormat[3];
+ bool isNumber;
+
+ const QString invalidFormatStartJD(i18n("Invalid date format. Correct format is mm/dd/yyyy or JD, leave 'default' to generate light curves for the past 500 days."));
+ const QString invalidFormatENDJD(i18n("Invalid date format. Correct format is mm/dd/yyyy or JD, leave 'default' to generate light curves until today."));
+ QString invalidFormatMsg(JDType ? invalidFormatENDJD : invalidFormatStartJD);
+
+
+ // check for "default" date
+ if (Date == i18n("default"))
+ {
+ *JD = "default";
+ return true;
+ }
+
+ // Get slashcount and and slash refrences
+ for (i=0; i<Date.length(); i++)
+ if (Date.at(i) == '/')
+ {
+ slashRefrence[slashCount++] = i;
+ if (slashCount > 2)
+ {
+ KMessageBox::error(this, invalidFormatMsg);
+ return false;
+ }
+ }
+
+ // check if the data appears to be in JD format
+ if (!slashCount)
+ {
+ TempJD = Date.toInt(&isNumber, 10);
+ if (!isNumber)
+ {
+ KMessageBox::error(this, invalidFormatMsg);
+ return false;
+ }
+
+ if (TempJD >= JDCutOff)
+ {
+ JD->setNum(TempJD, 10);
+ return true;
+ }
+ else
+ {
+ const char* invalidJD = I18N_NOOP("No data available for JD prior to %d");
+ KMessageBox::error(this, QString().sprintf(invalidJD, JDCutOff));
+ return false;
+ }
+ }
+
+ // If it's not a Julian day, check for the format of the date
+ // check if year is 4 digits
+ if ( (Date.length() - slashRefrence[1] - 1) != 4)
+ {
+ KMessageBox::error(this, invalidFormatMsg);
+ return false;
+ }
+
+ // form mm/dd/yyy fields
+ dateFormat[0] = Date.mid(0, slashRefrence[0]).toInt();
+ dateFormat[1] = Date.mid(slashRefrence[0]+1, slashRefrence[1] - (slashRefrence[0] +1)).toInt();
+ dateFormat[2] = Date.mid(slashRefrence[1]+1, Date.length()).toInt();
+
+ ExtDate tempdate(dateFormat[2], dateFormat[0], dateFormat[1]);
+ if (!tempdate.isValid())
+ {
+ KMessageBox::error(this, invalidFormatMsg);
+ return false;
+ }
+
+ // Convert to JD and verify its lower limit
+ TempJD = tempdate.jd();
+
+ if (TempJD >= JDCutOff)
+ {
+ JD->setNum(TempJD, 10);
+ return true;
+ }
+ else
+ {
+ const char* invalidJD = I18N_NOOP("No data available for JD prior to %d");
+ KMessageBox::error(this, QString().sprintf(invalidJD, JDCutOff));
+ return false;
+ }
+
+}
+
+void LCGenerator::DownloadCurve(QString FinalStartDate, QString FinalEndDate, QString FinalDesignation, QString AverageDay)
+{
+
+ QString buf(Hostprefix);
+ QString Yes("yes");
+ QString No("no");
+
+ //FainterCheck;
+ //CCDVCheck;
+ //CCDICheck;
+ //CCDRCheck;
+ //CCDBCheck;
+ //VisualCheck;
+ //DiscrepantCheck;
+
+
+ buf.append("?"+FinalStartDate);
+ buf.append("?"+FinalEndDate);
+ buf.append("?"+FinalDesignation);
+ buf.append("?"+AverageDay);
+ buf.append("?"+ (FainterCheck->isOn() ? Yes : No));
+ buf.append("?"+ (CCDVCheck->isOn() ? Yes : No));
+ buf.append("?"+ (CCDICheck->isOn() ? Yes : No));
+ buf.append("?"+ (CCDRCheck->isOn() ? Yes : No));
+ buf.append("?"+ (CCDBCheck->isOn() ? Yes : No));
+ buf.append("?"+ (VisualCheck->isOn() ? Yes : No));
+ buf.append("?"+ (DiscrepantCheck->isOn() ? Yes : No));
+
+
+ KURL url(buf);
+ QString message = i18n( "Light Curve produced by the American Amateur Variable Star Observers" );
+ // parent of imageview is KStars
+ new ImageViewer(&url, message, ksw, "lightcurve");
+
+}
+
+void LCGenerator::updateDesigList(int index)
+{
+
+ DesignationIn->setSelected(index, true);
+ DesignationIn->centerCurrentItem();
+
+}
+
+void LCGenerator::updateNameList(int index)
+{
+
+ NameIn->setSelected(index, true);
+ NameIn->centerCurrentItem();
+
+}
+
+void LCGenerator::updateStarList()
+{
+ file->setName( locateLocal( "appdata", "valaav.txt" ) );
+
+ KURL AAVSOFile("http://www.aavso.org/observing/aids/valaav.txt");
+ KURL saveFile (file->name());
+
+ downloadJob = KIO::file_copy (AAVSOFile, saveFile, -1, true);
+ connect (downloadJob, SIGNAL (result (KIO::Job *)), SLOT (downloadReady (KIO::Job *)));
+}
+
+void LCGenerator::downloadReady(KIO::Job * job)
+{
+
+downloadJob = 0;
+
+ if ( job->error() )
+ {
+ job->showErrorDialog();
+ closeEvent (0);
+ return; // exit this function
+ }
+
+ file->close(); // to get the newest informations of the file and not any informations from opening of the file
+
+ if ( file->exists() )
+ {
+ ksw->data()->readVARData();
+
+ DesignationIn->clear();
+ NameIn->clear();
+
+ // Fill stars designations
+ for (uint i=0; i< (ksw->data()->VariableStarsList.count()); i++)
+ DesignationIn->insertItem(ksw->data()->VariableStarsList.at(i)->Designation);
+
+ // Fill star names
+ for (uint i=0; i<ksw->data()->VariableStarsList.count(); i++)
+ NameIn->insertItem(ksw->data()->VariableStarsList.at(i)->Name);
+
+ KMessageBox::information(this, i18n("AAVSO Star list downloaded successfully."));
+
+
+ return;
+ }
+ closeEvent (0);
+
+}
+
+void LCGenerator::closeEvent (QCloseEvent *ev)
+{
+ if (ev) // not if closeEvent (0) is called, because segfault
+ ev->accept(); // parent-widgets should not get this event, so it will be filtered
+ //this->~LCGenerator(); // destroy the object, so the object can only allocated with operator new, not as a global/local variable
+}
+
+#include "lcgenerator.moc"
diff --git a/kstars/kstars/tools/lcgenerator.h b/kstars/kstars/tools/lcgenerator.h
new file mode 100644
index 00000000..0aeb177f
--- /dev/null
+++ b/kstars/kstars/tools/lcgenerator.h
@@ -0,0 +1,160 @@
+/***************************************************************************
+ lcgenerator.cpp - description
+ -------------------
+ begin : Tue Oct 1 18:01:48 CDT 2002
+ copyright : (C) 2002 by Jasem Mutlaq
+ email : mutlaqja@ku.edu
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+/**
+ *@class LCGenerator
+ *@short KStars Light Curve Generator
+ *This class provides a simple interface that enables a user to download
+ *variable stars light curves from an online AAVSO database given few basic parameters.
+ *@author Jasem Mutlaq
+ *@version 1.0
+ */
+
+#ifndef LCGENERATOR_H
+#define LCGENERATOR_H
+
+#include <qvariant.h>
+#include <kdialogbase.h>
+#include <kio/job.h>
+
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QFile;
+class KLineEdit;
+class KListBox;
+class KPushButton;
+class QCheckBox;
+class QGroupBox;
+class QLabel;
+class QListBoxItem;
+
+class KStars;
+
+struct VariableStarInfo
+{
+ QString Name;
+ QString Designation;
+};
+
+class LCGenerator : public KDialogBase
+{
+Q_OBJECT
+
+public:
+/**Constructor
+ *@p parent pointer to the parent widget
+ */
+ LCGenerator( QWidget* parent = 0);
+/**Destructor */
+ ~LCGenerator();
+
+private:
+
+/** Initilizes and positions the dialog child widgets. */
+ void createGUI();
+
+/** Converts date Julian days, unless date is 'default'.
+ *@param date The date to be converted
+ *@param *JD pointer to a Julian Day string
+ *@param JDType start or end JD
+ *@returns true if conversion is successful
+ */
+ bool setJD(QString date, QString * JD, int JDType);
+
+/** Parses star information and connects to the AAVSO server with the information embedded in the URL
+ *@param FinalStartDate The start date in Julian days
+ *@param FinalEndDate The end date in Julian days
+ *@param FinalDesignation The AAVSO star designation
+ *@param AverageDay Number of average days for binning the light curve
+ */
+ void DownloadCurve(QString FinalStartDate, QString FinalEndDate, QString FinalDesignation, QString AverageDay);
+
+
+ KStars *ksw;
+ const QString Hostprefix;
+ const int JDCutOff;
+
+ QGroupBox* StarInfoBox;
+ QLabel* desigLabel;
+ KListBox* DesignationIn;
+ QLabel* nameLabel;
+ KListBox* NameIn;
+ QLabel* startLabel;
+ KLineEdit* StartDateIn;
+ QLabel* endLabel;
+ KLineEdit* EndDateIn;
+ QGroupBox* DataSelectBox;
+ QCheckBox* VisualCheck;
+ QCheckBox* FainterCheck;
+ QCheckBox* DiscrepantCheck;
+ QCheckBox* CCDBCheck;
+ QCheckBox* CCDVCheck;
+ QCheckBox* CCDRCheck;
+ QCheckBox* CCDICheck;
+ QLabel* plotLabel;
+ KLineEdit* AverageDayIn;
+ QLabel* daysLabel;
+ KPushButton* GetCurveButton;
+ KPushButton* UpdateListButton;
+ KPushButton* CloseButton;
+
+ QVBoxLayout* LCGeneratorDialogLayout;
+ QHBoxLayout* SDLayout;
+ QVBoxLayout* StarInfoBoxLayout;
+ QHBoxLayout* DesignHLayout;
+ QHBoxLayout* NameHLayout;
+ QHBoxLayout* StartHLayout;
+ QHBoxLayout* EndHLayout;
+ QVBoxLayout* DataSelectBoxLayout;
+ QHBoxLayout* PlotHLayout;
+ QHBoxLayout* ButtonHLayout;
+
+
+ KIO::Job *downloadJob; // download job of image -> 0 == no job is running
+
+ QFile *file;
+
+/**Make sure all events have been processed before closing the dialog
+ *@p ev pointer to the QCloseEvent object
+ */
+ void closeEvent (QCloseEvent *ev);
+
+public slots:
+/** Checks if a star name or designation exists in the database,
+ *verifies date format, and connects to server if no errors occur
+ */
+ void VerifyData();
+
+/**Select the star name that matches the current star designation
+ *@p index the index of the selected designation
+ */
+ void updateNameList(int index);
+
+/**Select the star designation that matches the current star name
+ *@p index the index of the selected star name
+ */
+ void updateDesigList(int index);
+
+/** Connects to AAVSO database server and downloads a fresh list of Variable stars.*/
+ void updateStarList();
+
+/** Reload file and update lists after download */
+ void downloadReady(KIO::Job *);
+};
+
+#endif // LCGENERATOR_H
diff --git a/kstars/kstars/tools/modcalcangdist.cpp b/kstars/kstars/tools/modcalcangdist.cpp
new file mode 100644
index 00000000..40969152
--- /dev/null
+++ b/kstars/kstars/tools/modcalcangdist.cpp
@@ -0,0 +1,213 @@
+/***************************************************************************
+ modcalcapcoord.cpp - description
+ -------------------
+ begin : Sun May 30 2004
+ copyright : (C) 2004 by Pablo de Vicente
+ email : vicente@oan.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "modcalcangdist.h"
+#include "modcalcangdist.moc"
+#include "dms.h"
+#include "dmsbox.h"
+#include "skypoint.h"
+
+#include <qcheckbox.h>
+#include <qradiobutton.h>
+#include <qtextstream.h>
+#include <klocale.h>
+#include <kfiledialog.h>
+#include <kmessagebox.h>
+
+//#include <kapplication.h> ..already included in modcalcapcoord.h
+
+modCalcAngDist::modCalcAngDist(QWidget *parentSplit, const char *name) : modCalcAngDistDlg(parentSplit,name) {
+
+ ra0Box->setDegType(FALSE);
+ ra1Box->setDegType(FALSE);
+ show();
+
+}
+
+modCalcAngDist::~modCalcAngDist(){
+}
+
+SkyPoint modCalcAngDist::getCoords (dmsBox* rBox, dmsBox* dBox) {
+ dms raCoord, decCoord;
+
+ raCoord = rBox->createDms(FALSE);
+ decCoord = dBox->createDms();
+
+ SkyPoint sp = SkyPoint (raCoord, decCoord);
+
+ return sp;
+}
+
+void modCalcAngDist::showDist ( dms angDist ) {
+ distBox->show( angDist );
+}
+
+void modCalcAngDist::slotClearCoords(){
+
+ ra0Box->clearFields();
+ dec0Box->clearFields();
+ ra1Box->clearFields();
+ dec1Box->clearFields();
+ distBox->clearFields();
+}
+
+void modCalcAngDist::slotComputeDist(){
+
+ SkyPoint sp0,sp1;
+ sp0 = getCoords(ra0Box, dec0Box);
+ sp1 = getCoords(ra1Box, dec1Box);
+
+ dms aDist = sp0.angularDistanceTo(&sp1);
+ showDist( aDist );
+}
+
+void modCalcAngDist::slotInputFile() {
+ QString inputFileName;
+ inputFileName = KFileDialog::getOpenFileName( );
+ InputLineEditBatch->setText( inputFileName );
+}
+
+void modCalcAngDist::slotOutputFile() {
+ QString outputFileName;
+ outputFileName = KFileDialog::getSaveFileName( );
+ OutputLineEditBatch->setText( outputFileName );
+}
+
+void modCalcAngDist::slotRunBatch() {
+
+ QString inputFileName;
+
+ inputFileName = InputLineEditBatch->text();
+
+ // We open the input file and read its content
+
+ if ( QFile::exists(inputFileName) ) {
+ QFile f( inputFileName );
+ if ( !f.open( IO_ReadOnly) ) {
+ QString message = i18n( "Could not open file %1.").arg( f.name() );
+ KMessageBox::sorry( 0, message, i18n( "Could Not Open File" ) );
+ inputFileName = "";
+ return;
+ }
+
+// processLines(&f);
+ QTextStream istream(&f);
+ processLines(istream);
+// readFile( istream );
+ f.close();
+ } else {
+ QString message = i18n( "Invalid file: %1" ).arg( inputFileName );
+ KMessageBox::sorry( 0, message, i18n( "Invalid file" ) );
+ inputFileName = "";
+ InputLineEditBatch->setText( inputFileName );
+ return;
+ }
+}
+
+//void modCalcAngDist::processLines( const QFile * fIn ) {
+void modCalcAngDist::processLines( QTextStream &istream ) {
+
+ // we open the output file
+
+// QTextStream istream(&fIn);
+ QString outputFileName;
+ outputFileName = OutputLineEditBatch->text();
+ QFile fOut( outputFileName );
+ fOut.open(IO_WriteOnly);
+ QTextStream ostream(&fOut);
+
+ QString line;
+ QString space = " ";
+ int i = 0;
+ SkyPoint sp0, sp1;
+ dms ra0B, dec0B, ra1B, dec1B, dist;
+
+ while ( ! istream.eof() ) {
+ line = istream.readLine();
+ line.stripWhiteSpace();
+
+ //Go through the line, looking for parameters
+
+ QStringList fields = QStringList::split( " ", line );
+
+ i = 0;
+
+ // Read RA and write in ostream if corresponds
+
+ if(ra0CheckBatch->isChecked() ) {
+ ra0B = dms::fromString( fields[i],FALSE);
+ i++;
+ } else
+ ra0B = ra0BoxBatch->createDms(FALSE);
+
+ if ( allRadioBatch->isChecked() )
+ ostream << ra0B.toHMSString() << space;
+ else
+ if(ra0CheckBatch->isChecked() )
+ ostream << ra0B.toHMSString() << space;
+
+ // Read DEC and write in ostream if corresponds
+
+ if(dec0CheckBatch->isChecked() ) {
+ dec0B = dms::fromString( fields[i], TRUE);
+ i++;
+ } else
+ dec0B = dec0BoxBatch->createDms();
+
+ if ( allRadioBatch->isChecked() )
+ ostream << dec0B.toDMSString() << space;
+ else
+ if(dec0CheckBatch->isChecked() )
+ ostream << dec0B.toDMSString() << space;
+
+ // Read RA and write in ostream if corresponds
+
+ if(ra1CheckBatch->isChecked() ) {
+ ra1B = dms::fromString( fields[i],FALSE);
+ i++;
+ } else
+ ra1B = ra1BoxBatch->createDms(FALSE);
+
+ if ( allRadioBatch->isChecked() )
+ ostream << ra1B.toHMSString() << space;
+ else
+ if(ra1CheckBatch->isChecked() )
+ ostream << ra1B.toHMSString() << space;
+
+ // Read DEC and write in ostream if corresponds
+
+ if(dec1CheckBatch->isChecked() ) {
+ dec1B = dms::fromString( fields[i], TRUE);
+ i++;
+ } else
+ dec1B = dec1BoxBatch->createDms();
+
+ if ( allRadioBatch->isChecked() )
+ ostream << dec1B.toDMSString() << space;
+ else
+ if(dec1CheckBatch->isChecked() )
+ ostream << dec1B.toDMSString() << space;
+
+ sp0 = SkyPoint (ra0B, dec0B);
+ sp1 = SkyPoint (ra1B, dec1B);
+ dist = sp0.angularDistanceTo(&sp1);
+
+ ostream << dist.toDMSString() << endl;
+ }
+
+ fOut.close();
+}
diff --git a/kstars/kstars/tools/modcalcangdist.h b/kstars/kstars/tools/modcalcangdist.h
new file mode 100644
index 00000000..27176945
--- /dev/null
+++ b/kstars/kstars/tools/modcalcangdist.h
@@ -0,0 +1,62 @@
+/***************************************************************************
+ modcalcapcoord.h - description
+ -------------------
+ begin : Sun May 30 2004
+ copyright : (C) 2004 by Pablo de Vicente
+ email : vicente@oan.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 MODCALCANGDIST_H
+#define MODCALCANGDIST_H
+
+#include "modcalcangdistdlg.h"
+#include <kapplication.h>
+
+/** Module to compute the angular distance between two points in the sky
+ *@author Pablo de Vicente
+ *@version 0.9
+ */
+
+class dms;
+class dmsBox;
+class SkyPoint;
+class QTextStream;
+
+class modCalcAngDist : public modCalcAngDistDlg {
+
+Q_OBJECT
+public:
+/**Constructor. */
+ modCalcAngDist(QWidget *p, const char *n);
+/**Destructor. */
+ ~modCalcAngDist();
+
+public slots:
+ void slotComputeDist();
+ void slotClearCoords();
+ void slotInputFile();
+ void slotOutputFile();
+ void slotRunBatch();
+
+private:
+ /** Process Lines **/
+ void processLines( QTextStream &istream );
+
+ /**@returns a SkyPoint constructed from the coordinates in the RA and Dec dmsBoxes. */
+ SkyPoint getCoords(dmsBox * rBox, dmsBox* dBox);
+
+ /**Fill the angular distance. */
+ void showDist ( dms dist );
+
+};
+
+#endif
diff --git a/kstars/kstars/tools/modcalcangdistdlg.ui b/kstars/kstars/tools/modcalcangdistdlg.ui
new file mode 100644
index 00000000..72290976
--- /dev/null
+++ b/kstars/kstars/tools/modcalcangdistdlg.ui
@@ -0,0 +1,682 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>modCalcAngDistDlg</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>modCalcAngDistDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>572</width>
+ <height>438</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Angular Distance</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tabWidget3</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Interactive Mode</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout8</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>origCoordBox</cstring>
+ </property>
+ <property name="title">
+ <string>Initial Coordinates</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>ra0Box</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>dec0Box</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>dec0Label</cstring>
+ </property>
+ <property name="text">
+ <string>Declination:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>ra0Label</cstring>
+ </property>
+ <property name="text">
+ <string>Right ascension:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>origCoordBox_2</cstring>
+ </property>
+ <property name="title">
+ <string>Final Coordinates</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>ra1Box</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>dec1Box</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>dec0Label_2</cstring>
+ </property>
+ <property name="text">
+ <string>Declination:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>ra0Label_2</cstring>
+ </property>
+ <property name="text">
+ <string>Right ascension:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout7</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>145</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>Compute</cstring>
+ </property>
+ <property name="text">
+ <string>Compute</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>146</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>Clear</cstring>
+ </property>
+ <property name="text">
+ <string>Clear</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>145</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>outputBox</cstring>
+ </property>
+ <property name="title">
+ <string>Angular Distance</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer15</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>102</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>rafLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Distance:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox">
+ <property name="name">
+ <cstring>distBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer12</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>70</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer16</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>171</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Batch Mode</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>InputBox_2_2</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Select Fields in Input File</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>ra0BoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>dec0BoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="2" column="1">
+ <property name="name">
+ <cstring>ra1BoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="3" column="1">
+ <property name="name">
+ <cstring>dec1BoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="0">
+ <property name="name">
+ <cstring>ra1CheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Final right ascension:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="3" column="0">
+ <property name="name">
+ <cstring>dec1CheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Final declination:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>dec0CheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Initial declination:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>ra0CheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Initial right ascension:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup4</cstring>
+ </property>
+ <property name="title">
+ <string>Fields in Output File Plus Result</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>allRadioBatch</cstring>
+ </property>
+ <property name="text">
+ <string>All parameters</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>inputRadioBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Only parameters in input file</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox4_2</cstring>
+ </property>
+ <property name="title">
+ <string>Files</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton" row="0" column="0">
+ <property name="name">
+ <cstring>InputButtonBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Input File...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>File with the input data</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>InputLineEditBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>OutputLineEditBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>OutButtonBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Output File...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>File for the output data</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout14</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer20</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>151</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>runButtonBatch</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Run</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer19</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>131</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer19_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>dmsBox</class>
+ <header location="global">../dmsbox.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1163">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000045249444154388d8d95bf8b1d5514c73fbb19e40cbce81d788199b8911d48304f8cf0524876316016031ab14819acfcd1f8a34ba72222fe0b369a54a216a216c158049222645f131221c10928dc852cdc0bfb600e66dc39c58558ccee6ab0c93497c3650edff339df99efc28df51bec3e9f7cfee6438b8662800086431eab2e971c5f7cf4edc26eaf851beb37b8f8fd870f67d73c6fbf759e5c0427156a0149d0621414b4b414c8bf756a013033c2a6a7f19e181b564e56bc73eec2420630bbee39ffdec7b8aac61e2861ee294460046bd309860720a8079f13e60149156a8a2000d4076a48c6ec7ae09d73b070ead5f2e199d31f50d735b66534b161b254524f6bea25a14d1b90c2300146d080ce8de68ed06ed65832cc0ceb0ceb7bda79445c4f66117211ec81e1a3677a78c299d7a6281e3fbf0c29d29a2717a14d4231ca2153a6e386b8e1f1b355821a4e84f8a0a7c81c3e06324d86938a103d93c335aba76ba2cdb8152f42f2f83f1c39397d6a29b21cad846a6ca841b9acf45ca5bd721cd516b26127206464825aa05eaa583b3d41d33ab736bfc4d4b87d6d421b6b2c2992392c296e24544703d395801ad44b861e0d70b326a67687b9b148322401fb0dc3f37bfc0e9d1b572f4d089b15660a0866caea4b42b1dcd2dcac985daf910c34c1e458c0b21d97240320739960c0f1e74b7c77154b8166564357018ac8a0f4ccd9299313400afc8427dc9de0ca96fa88a2c9a88f2ab7b784227328b0a8c910725a3ca4488c10361e557ae69515565f9e528843cd58391d319478b7460d9c808c5b4068d3f0de229960f4149283192e1b188938c0583d3165edd4142742df298231fbd5e170f4095cc6c0fac880808cff30065a0bc8c86129df533a3d5a72eaec041941d006231034d0ce0bd4142c27ce0527a0dd4ee3341c8bbb8c498225a17413c0a80f3bd6ce55146284ee369622da790a27ac9d6da99604b29eb21cac276998b0c8dc207c97b1760dce0123a84b21a8a2ea310b80e2e781ca419f846a5c307d2360731d186730bb93ff9f714b4b1b05eb22c508ea9516498e1fbf51426cb87ca965fd879ae61ee41458eaa91cc838ec3116dc238c33924182e68e21638f594fb90cc7cf7ad67f7e8e9fbe2e201348cafaa58a76ab657a32a21a061f9b8139fc9ff208e37d470ebacfea675f80edfdc46dcf812ad26d1ba39171a0dec289903f39a77a26b1df751caa3bd2e2fd9da6e0b20cb5c4f8a0b1713707cbe8d27c601c36fdb0c0cde1d737990e9fab1b194c1b6a618fe530f6e002c964cfc7fdfec8f214665706d6fb8ebd587ef6f75f89d1be02ddeeb058717f13aaa7c09e30dc13a0db0ca78164d019d8d698e66ec1a1a73b4207767fcc9ff772547bc6e36c489077df7ffd6139aec9c541b21da64679c428c62de531831e72c06f086d2c885e2009e524522df534bf41b80f3a572e7cf5cb90202b272b66d7036e6414385a8664686e4341cdfa15ddcbc5dd7b3048463f733402a41eed947ad9fd9b79ff0dd3b8a97b8ac976b6fc187559c2179ffeb817a6ff006d91847a48e5abd70000000049454e44ae426082</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>Compute</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcAngDistDlg</receiver>
+ <slot>slotComputeDist()</slot>
+ </connection>
+ <connection>
+ <sender>Clear</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcAngDistDlg</receiver>
+ <slot>slotClearCoords()</slot>
+ </connection>
+ <connection>
+ <sender>runButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcAngDistDlg</receiver>
+ <slot>slotRunBatch()</slot>
+ </connection>
+ <connection>
+ <sender>InputButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcAngDistDlg</receiver>
+ <slot>slotInputFile()</slot>
+ </connection>
+ <connection>
+ <sender>OutButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcAngDistDlg</receiver>
+ <slot>slotOutputFile()</slot>
+ </connection>
+</connections>
+<slots>
+ <slot>slotComputeDist()</slot>
+ <slot>slotClearCoords()</slot>
+ <slot>slotInputFile()</slot>
+ <slot>slotOutputFile()</slot>
+ <slot>slotRunBatch()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/modcalcapcoord.cpp b/kstars/kstars/tools/modcalcapcoord.cpp
new file mode 100644
index 00000000..1c9a4578
--- /dev/null
+++ b/kstars/kstars/tools/modcalcapcoord.cpp
@@ -0,0 +1,318 @@
+/***************************************************************************
+ modcalcapcoord.cpp - description
+ -------------------
+ begin : Wed Apr 10 2002
+ copyright : (C) 2002 by Pablo de Vicente
+ email : vicente@oan.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "modcalcapcoord.h"
+#include "modcalcapcoord.moc"
+#include "modcalcprec.h"
+#include "dms.h"
+#include "dmsbox.h"
+#include "skypoint.h"
+#include "kstars.h"
+#include "kstarsdata.h"
+#include "kstarsdatetime.h"
+#include "libkdeedu/extdate/extdatetimeedit.h"
+
+#include <qcheckbox.h>
+#include <qradiobutton.h>
+#include <qdatetimeedit.h> //needed for QTimeEdit
+#include <klineedit.h>
+#include <qtextstream.h>
+#include <klocale.h>
+#include <kfiledialog.h>
+#include <kmessagebox.h>
+
+//#include <kapplication.h> ..already included in modcalcapcoord.h
+
+modCalcApCoord::modCalcApCoord(QWidget *parentSplit, const char *name) : modCalcApCoordDlg(parentSplit,name) {
+
+ showCurrentTime();
+ ra0Box->setDegType(FALSE);
+ rafBox->setDegType(FALSE);
+ show();
+
+}
+
+modCalcApCoord::~modCalcApCoord(){
+}
+
+SkyPoint modCalcApCoord::getEquCoords (void) {
+ dms raCoord, decCoord;
+
+ raCoord = ra0Box->createDms(FALSE);
+ decCoord = dec0Box->createDms();
+
+ SkyPoint sp = SkyPoint (raCoord, decCoord);
+
+ return sp;
+}
+
+void modCalcApCoord::showCurrentTime (void)
+{
+ KStars *ks = (KStars*) parent()->parent()->parent();
+
+ KStarsDateTime dt = ks->data()->geo()->LTtoUT( KStarsDateTime::currentDateTime() );
+ datBox->setDate( dt.date() );
+ timBox->setTime( dt.time() );
+}
+
+KStarsDateTime modCalcApCoord::getDateTime (void)
+{
+ return KStarsDateTime( datBox->date() , timBox->time() );
+}
+
+double modCalcApCoord::getEpoch (QString eName) {
+ bool ok = false;
+ double epoch = eName.toDouble(&ok);
+
+ if ( ok )
+ return epoch;
+ else {
+ kdDebug() << i18n( "Could not parse epoch string; assuming J2000" ) << endl;
+ return 2000.0;
+ }
+}
+
+void modCalcApCoord::showEquCoords ( SkyPoint sp ) {
+ rafBox->show( sp.ra() , FALSE);
+ decfBox->show( sp.dec() );
+}
+
+void modCalcApCoord::slotClearCoords(){
+
+ ra0Box->clearFields();
+ dec0Box->clearFields();
+ rafBox->clearFields();
+ decfBox->clearFields();
+ epoch0Name->setText("");
+ datBox->setDate(ExtDate::currentDate());
+ timBox->setTime(QTime(0,0,0));
+}
+
+void modCalcApCoord::slotComputeCoords(){
+ long double jd = getDateTime().djd();
+ KStarsDateTime dt;
+ dt.setFromEpoch( getEpoch( epoch0Name->text() ) );
+ long double jd0 = dt.djd();
+
+ SkyPoint sp;
+ sp = getEquCoords();
+
+ sp.apparentCoord(jd0, jd);
+ showEquCoords( sp );
+}
+
+void modCalcApCoord::slotUtCheckedBatch(){
+ if ( utCheckBatch->isChecked() )
+ utBoxBatch->setEnabled( false );
+ else {
+ utBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcApCoord::slotDateCheckedBatch(){
+
+ if ( dateCheckBatch->isChecked() )
+ dateBoxBatch->setEnabled( false );
+ else {
+ dateBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcApCoord::slotRaCheckedBatch(){
+
+ if ( raCheckBatch->isChecked() )
+ raBoxBatch->setEnabled( false );
+ else {
+ raBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcApCoord::slotDecCheckedBatch(){
+
+ if ( decCheckBatch->isChecked() )
+ decBoxBatch->setEnabled( false );
+ else {
+ decBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcApCoord::slotEpochCheckedBatch(){
+
+ if ( epochCheckBatch->isChecked() )
+ epochBoxBatch->setEnabled( false );
+ else {
+ epochBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcApCoord::slotInputFile() {
+ QString inputFileName;
+ inputFileName = KFileDialog::getOpenFileName( );
+ InputLineEditBatch->setText( inputFileName );
+}
+
+void modCalcApCoord::slotOutputFile() {
+ QString outputFileName;
+ outputFileName = KFileDialog::getSaveFileName( );
+ OutputLineEditBatch->setText( outputFileName );
+}
+
+void modCalcApCoord::slotRunBatch() {
+
+ QString inputFileName;
+
+ inputFileName = InputLineEditBatch->text();
+
+ // We open the input file and read its content
+
+ if ( QFile::exists(inputFileName) ) {
+ QFile f( inputFileName );
+ if ( !f.open( IO_ReadOnly) ) {
+ QString message = i18n( "Could not open file %1.").arg( f.name() );
+ KMessageBox::sorry( 0, message, i18n( "Could Not Open File" ) );
+ inputFileName = "";
+ return;
+ }
+
+// processLines(&f);
+ QTextStream istream(&f);
+ processLines(istream);
+// readFile( istream );
+ f.close();
+ } else {
+ QString message = i18n( "Invalid file: %1" ).arg( inputFileName );
+ KMessageBox::sorry( 0, message, i18n( "Invalid file" ) );
+ inputFileName = "";
+ InputLineEditBatch->setText( inputFileName );
+ return;
+ }
+}
+
+//void modCalcApCoord::processLines( const QFile * fIn ) {
+void modCalcApCoord::processLines( QTextStream &istream ) {
+
+ // we open the output file
+
+// QTextStream istream(&fIn);
+ QString outputFileName;
+ outputFileName = OutputLineEditBatch->text();
+ QFile fOut( outputFileName );
+ fOut.open(IO_WriteOnly);
+ QTextStream ostream(&fOut);
+
+ QString line;
+ QString space = " ";
+ int i = 0;
+ long double jd, jd0;
+ SkyPoint sp;
+ QTime utB;
+ ExtDate dtB;
+ dms raB, decB;
+ double epoch0B;
+
+ while ( ! istream.eof() ) {
+ line = istream.readLine();
+ line.stripWhiteSpace();
+
+ //Go through the line, looking for parameters
+
+ QStringList fields = QStringList::split( " ", line );
+
+ i = 0;
+
+ // Read Ut and write in ostream if corresponds
+
+ if(utCheckBatch->isChecked() ) {
+ utB = QTime::fromString( fields[i] );
+ i++;
+ } else
+ utB = utBoxBatch->time();
+
+ if ( allRadioBatch->isChecked() )
+ ostream << utB.toString() << space;
+ else
+ if(utCheckBatch->isChecked() )
+ ostream << utB.toString() << space;
+
+ // Read date and write in ostream if corresponds
+
+ if(dateCheckBatch->isChecked() ) {
+ dtB = ExtDate::fromString( fields[i] );
+ i++;
+ } else
+ dtB = dateBoxBatch->date();
+
+ if ( allRadioBatch->isChecked() )
+ ostream << dtB.toString().append(space);
+ else
+ if(dateCheckBatch->isChecked() )
+ ostream << dtB.toString().append(space);
+
+ // Read RA and write in ostream if corresponds
+
+ if(raCheckBatch->isChecked() ) {
+ raB = dms::fromString( fields[i],FALSE);
+ i++;
+ } else
+ raB = raBoxBatch->createDms(FALSE);
+
+ if ( allRadioBatch->isChecked() )
+ ostream << raB.toHMSString() << space;
+ else
+ if(raCheckBatch->isChecked() )
+ ostream << raB.toHMSString() << space;
+
+ // Read DEC and write in ostream if corresponds
+
+ if(decCheckBatch->isChecked() ) {
+ decB = dms::fromString( fields[i], TRUE);
+ i++;
+ } else
+ decB = decBoxBatch->createDms();
+
+ if ( allRadioBatch->isChecked() )
+ ostream << decB.toDMSString() << space;
+ else
+ if(decCheckBatch->isChecked() )
+ ostream << decB.toHMSString() << space;
+
+ // Read Epoch and write in ostream if corresponds
+
+ if(epochCheckBatch->isChecked() ) {
+ epoch0B = fields[i].toDouble();
+ i++;
+ } else
+ epoch0B = getEpoch( epochBoxBatch->text() );
+
+ if ( allRadioBatch->isChecked() )
+ ostream << epoch0B;
+ else
+ if(decCheckBatch->isChecked() )
+ ostream << epoch0B;
+
+ KStarsDateTime dt;
+ dt.setFromEpoch( epoch0B );
+ jd = KStarsDateTime(dtB,utB).djd();
+ jd0 = dt.djd();
+ sp = SkyPoint (raB, decB);
+ sp.apparentCoord(jd0, jd);
+
+ ostream << sp.ra()->toHMSString() << sp.dec()->toDMSString() << endl;
+ }
+
+ fOut.close();
+}
diff --git a/kstars/kstars/tools/modcalcapcoord.h b/kstars/kstars/tools/modcalcapcoord.h
new file mode 100644
index 00000000..dae968fe
--- /dev/null
+++ b/kstars/kstars/tools/modcalcapcoord.h
@@ -0,0 +1,88 @@
+/***************************************************************************
+ modcalcapcoord.h - description
+ -------------------
+ begin : Wed Apr 10 2002
+ copyright : (C) 2002 by Pablo de Vicente
+ email : vicente@oan.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 MODCALCAPCOORD_H
+#define MODCALCAPCOORD_H
+
+#include "modcalcapcoorddlg.h"
+#include <kapplication.h>
+
+/** Module to compute the equatorial coordinates for a given date and time
+ * from a given epoch or equinox
+ *@author Pablo de Vicente
+ *@version 0.9
+ */
+
+class dms;
+class dmsBox;
+class SkyPoint;
+class KStarsDateTime;
+class QTextStream;
+
+class modCalcApCoord : public modCalcApCoordDlg {
+
+Q_OBJECT
+public:
+/**Constructor. */
+ modCalcApCoord(QWidget *p, const char *n);
+/**Destructor. */
+ ~modCalcApCoord();
+
+/**Precess the coordinates from epoch 1 to epoch 2 */
+ SkyPoint precess (dms ra0, dms dec0, long double j0, long double jf);
+
+/**Apply precession, nutation and aberration corrections to coordinates. */
+ SkyPoint apparentCoordinates (dms r0, dms d0, long double j0, long double jf);
+
+ /** Process Lines **/
+// void processLines( const QFile * f );
+ void processLines( QTextStream &istream );
+public slots:
+
+
+ /** No descriptions */
+ void slotComputeCoords();
+ /** No descriptions */
+ void slotClearCoords();
+ void slotUtCheckedBatch();
+ void slotDateCheckedBatch();
+ void slotRaCheckedBatch();
+ void slotDecCheckedBatch();
+ void slotEpochCheckedBatch();
+ void slotInputFile();
+ void slotOutputFile();
+ void slotRunBatch();
+
+private:
+/**@returns a SkyPoint constructed from the coordinates in the RA and Dec dmsBoxes. */
+ SkyPoint getEquCoords(void);
+
+/**Fill the Time and Date fields with the current values from the CPU clock. */
+ void showCurrentTime(void);
+
+/**@returns a KStarsDateTime constructed from the Time and Date fields. */
+ KStarsDateTime getDateTime (void);
+
+/**Parse the string argument as a double */
+ double getEpoch (QString eName);
+
+/**Fill the RA and Dec dmsBoxes with values of the SkyPoint argument. */
+ void showEquCoords ( SkyPoint sp );
+
+};
+
+#endif
diff --git a/kstars/kstars/tools/modcalcapcoorddlg.ui b/kstars/kstars/tools/modcalcapcoorddlg.ui
new file mode 100644
index 00000000..5ddec248
--- /dev/null
+++ b/kstars/kstars/tools/modcalcapcoorddlg.ui
@@ -0,0 +1,871 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>modCalcApCoordDlg</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>modCalcApCoordDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>500</width>
+ <height>467</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Apparent Coordinates</string>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>InteractiveTab</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Interactive Mode</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout11</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>InputBox</cstring>
+ </property>
+ <property name="title">
+ <string>Target Time &amp;&amp; Date</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>dateLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Date:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>timeLabel</cstring>
+ </property>
+ <property name="text">
+ <string>UT:</string>
+ </property>
+ </widget>
+ <spacer row="2" column="0">
+ <property name="name">
+ <cstring>spacer16</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QTimeEdit" row="0" column="1">
+ <property name="name">
+ <cstring>timBox</cstring>
+ </property>
+ </widget>
+ <widget class="ExtDateEdit" row="1" column="1">
+ <property name="name">
+ <cstring>datBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>origCoordBox</cstring>
+ </property>
+ <property name="title">
+ <string>Catalog Coordinates</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>ra0Box</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>dec0Box</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>dec0Label</cstring>
+ </property>
+ <property name="text">
+ <string>Declination:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>ra0Label</cstring>
+ </property>
+ <property name="text">
+ <string>Right ascension:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>epoch0Name</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>epoch0Label</cstring>
+ </property>
+ <property name="text">
+ <string>Epoch:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>81</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>Compute</cstring>
+ </property>
+ <property name="text">
+ <string>Compute</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>70</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>Clear</cstring>
+ </property>
+ <property name="text">
+ <string>Clear</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>91</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>outputBox</cstring>
+ </property>
+ <property name="title">
+ <string>Apparent Coordinates</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer15</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>102</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout12</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>rafLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Right ascension:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>decfLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Declination:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>rafBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>decfBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer12</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>70</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>70</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Batch Mode</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>InputBox_2_2</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Select Fields in Input File</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit" row="4" column="2">
+ <property name="name">
+ <cstring>epochBoxBatch</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="3" column="2">
+ <property name="name">
+ <cstring>decBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="2" column="2">
+ <property name="name">
+ <cstring>raBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>utCheckBatch</cstring>
+ </property>
+ <property name="autoMask">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>UT:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QTimeEdit" row="0" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>utBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>dateCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Date:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="3" column="0">
+ <property name="name">
+ <cstring>decCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Declination:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="4" column="0">
+ <property name="name">
+ <cstring>epochCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Epoch:</string>
+ </property>
+ </widget>
+ <widget class="ExtDateEdit" row="1" column="2">
+ <property name="name">
+ <cstring>dateBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>raCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Right ascension:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup4</cstring>
+ </property>
+ <property name="title">
+ <string>Fields in Output File Plus Result</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>allRadioBatch</cstring>
+ </property>
+ <property name="text">
+ <string>All parameters</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>inputRadioBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Only parameters in input file</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox4_2</cstring>
+ </property>
+ <property name="title">
+ <string>Files</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton" row="0" column="0">
+ <property name="name">
+ <cstring>InputButtonBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Input File...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>File with the input data</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>InputLineEditBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>OutputLineEditBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>OutButtonBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Output File...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>File for the output data</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout14</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer20</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>151</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>runButtonBatch</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Run</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer19</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>131</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer36</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>31</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>dmsBox</class>
+ <header location="global">../dmsbox.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+ <customwidget>
+ <class>ExtDateEdit</class>
+ <header location="local">libkdeedu/extdate/extdatetimeedit.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image1</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1163">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000045249444154388d8d95bf8b1d5514c73fbb19e40cbce81d788199b8911d48304f8cf0524876316016031ab14819acfcd1f8a34ba72222fe0b369a54a216a216c158049222645f131221c10928dc852cdc0bfb600e66dc39c58558ccee6ab0c93497c3650edff339df99efc28df51bec3e9f7cfee6438b8662800086431eab2e971c5f7cf4edc26eaf851beb37b8f8fd870f67d73c6fbf759e5c0427156a0149d0621414b4b414c8bf756a013033c2a6a7f19e181b564e56bc73eec2420630bbee39ffdec7b8aac61e2861ee294460046bd309860720a8079f13e60149156a8a2000d4076a48c6ec7ae09d73b070ead5f2e199d31f50d735b66534b161b254524f6bea25a14d1b90c2300146d080ce8de68ed06ed65832cc0ceb0ceb7bda79445c4f66117211ec81e1a3677a78c299d7a6281e3fbf0c29d29a2717a14d4231ca2153a6e386b8e1f1b355821a4e84f8a0a7c81c3e06324d86938a103d93c335aba76ba2cdb8152f42f2f83f1c39397d6a29b21cad846a6ca841b9acf45ca5bd721cd516b26127206464825aa05eaa583b3d41d33ab736bfc4d4b87d6d421b6b2c2992392c296e24544703d395801ad44b861e0d70b326a67687b9b148322401fb0dc3f37bfc0e9d1b572f4d089b15660a0866caea4b42b1dcd2dcac985daf910c34c1e458c0b21d97240320739960c0f1e74b7c77154b8166564357018ac8a0f4ccd9299313400afc8427dc9de0ca96fa88a2c9a88f2ab7b784227328b0a8c910725a3ca4488c10361e557ae69515565f9e528843cd58391d319478b7460d9c808c5b4068d3f0de229960f4149283192e1b188938c0583d3165edd4142742df298231fbd5e170f4095cc6c0fac880808cff30065a0bc8c86129df533a3d5a72eaec041941d006231034d0ce0bd4142c27ce0527a0dd4ee3341c8bbb8c498225a17413c0a80f3bd6ce55146284ee369622da790a27ac9d6da99604b29eb21cac276998b0c8dc207c97b1760dce0123a84b21a8a2ea310b80e2e781ca419f846a5c307d2360731d186730bb93ff9f714b4b1b05eb22c508ea9516498e1fbf51426cb87ca965fd879ae61ee41458eaa91cc838ec3116dc238c33924182e68e21638f594fb90cc7cf7ad67f7e8e9fbe2e201348cafaa58a76ab657a32a21a061f9b8139fc9ff208e37d470ebacfea675f80edfdc46dcf812ad26d1ba39171a0dec289903f39a77a26b1df751caa3bd2e2fd9da6e0b20cb5c4f8a0b1713707cbe8d27c601c36fdb0c0cde1d737990e9fab1b194c1b6a618fe530f6e002c964cfc7fdfec8f214665706d6fb8ebd587ef6f75f89d1be02ddeeb058717f13aaa7c09e30dc13a0db0ca78164d019d8d698e66ec1a1a73b4207767fcc9ff772547bc6e36c489077df7ffd6139aec9c541b21da64679c428c62de531831e72c06f086d2c885e2009e524522df534bf41b80f3a572e7cf5cb90202b272b66d7036e6414385a8664686e4341cdfa15ddcbc5dd7b3048463f733402a41eed947ad9fd9b79ff0dd3b8a97b8ac976b6fc187559c2179ffeb817a6ff006d91847a48e5abd70000000049454e44ae426082</data>
+ </image>
+ <image name="image1">
+ <data format="PNG" length="872">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000032f49444154388db5953148254718c77f1e5b7c030ab3e0c12e5ce00927f88a14af7d87c5590ac29d6013b0497b844008a9120e1248938354a6b1482131cde5a510b4f03081f07c8d4421c2063cd85708bbe0831938613ec8c0a5588dd1dc33452e5f33bb33c36f7ffbed7fd889fe7e9fcb7ad07df09ab750fdfdfec4c425787b6bfb757bae8df79e6a54e1bcc36008845b47e71dc549c1e06000f10a9e5c9a3effee39690ef92cb4a25e2c3b4804709844807035cfd57d7122f0ad65f0c25f0703d4a39af41d28473fa0af4a42548c81f007f85aa86a4510cc34cccc8288420405640ad2bbcadfeb2fb01b39021e7d5513a2c74c59ca43d8db510e0f6a24018d8a2496ecbeb0b892d29d0f08cdbc9d149ac7dc0057bea2831262853196fd5d6573dd43046b85fcbe2002d55019be54bef9a2a45ecd585e059106fe46639318403153427908bd0be8e2a38c874b90e70692806acade4ea0b7eee96d0cc9b2360b8f0d92e835e33b97172106400801b6b73c1a95c54719cbef439a2b9a54f833c3f68f8ec59594f73eb090089b1b153afa67e4ae1b270e5fa7144725d636a6228d853fcf59fbca511e7bdc193cf92467b0eb297f578a2220721d7ccdd82442553b48206f417a1714c5fb94b5cf2b8a638f58a13b9fc2a4a3ddb16854aa53d03806dcf4180481a8d8c98b8f7296b3f6a5a33c6ee2652785fc1ea4d2bcaf248246901bca377a0c661a482cc5505135ecbd088de9a490ddb30c8735cf9e5614872955a96854665a066e4f85a33d0bad96500f95bd9dc0f26a8a3b53ba0f53f20c9e3d85e1cb9a4f3facd0734f9659da1da8ea5b7a0c02a22cae081a95deba676fc7f1e4a39cce7ca0d5097cfc594e9659fca88608dd25cbccdcbfe6384014baf3509f66f436866c7e0d835d4ffb5d0b0954a5c38fb4e92d4af18b521c19ac8c39796ee42ecebe22c0f2aa90656d7adf5714c74a71346c7647b0d39685c7965f7f52aa738fc6947a34c6b83829284a41d2c6441258580a74e7738a22509d36d0bc65687760660e8a25033187c451fec69bc1838301ac0b69de444ad53779c32317bb2481f2d437b9dd6adae13d14874a558f3126c2e0e7cbc59be3b81abf7e67ecca7fac3bd0fca3fe17f0db86f7f7fb137f0208c29bb2c76e387f0000000049454e44ae426082</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>Compute</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcApCoordDlg</receiver>
+ <slot>slotComputeCoords()</slot>
+ </connection>
+ <connection>
+ <sender>Clear</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcApCoordDlg</receiver>
+ <slot>slotClearCoords()</slot>
+ </connection>
+ <connection>
+ <sender>utCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcApCoordDlg</receiver>
+ <slot>slotUtCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>dateCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcApCoordDlg</receiver>
+ <slot>slotDateCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>raCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcApCoordDlg</receiver>
+ <slot>slotRaCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>decCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcApCoordDlg</receiver>
+ <slot>slotDecCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>epochCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcApCoordDlg</receiver>
+ <slot>slotEpochCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>allRadioBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcApCoordDlg</receiver>
+ <slot>slotRadioBatch()</slot>
+ </connection>
+ <connection>
+ <sender>runButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcApCoordDlg</receiver>
+ <slot>slotRunBatch()</slot>
+ </connection>
+ <connection>
+ <sender>InputButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcApCoordDlg</receiver>
+ <slot>slotInputFile()</slot>
+ </connection>
+ <connection>
+ <sender>OutButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcApCoordDlg</receiver>
+ <slot>slotOutputFile()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>InteractiveTab</tabstop>
+ <tabstop>timBox</tabstop>
+ <tabstop>datBox</tabstop>
+ <tabstop>ra0Box</tabstop>
+ <tabstop>dec0Box</tabstop>
+ <tabstop>epoch0Name</tabstop>
+ <tabstop>Compute</tabstop>
+ <tabstop>Clear</tabstop>
+ <tabstop>rafBox</tabstop>
+ <tabstop>decfBox</tabstop>
+ <tabstop>utCheckBatch</tabstop>
+ <tabstop>utBoxBatch</tabstop>
+ <tabstop>dateCheckBatch</tabstop>
+ <tabstop>raCheckBatch</tabstop>
+ <tabstop>raBoxBatch</tabstop>
+ <tabstop>decCheckBatch</tabstop>
+ <tabstop>decBoxBatch</tabstop>
+ <tabstop>epochCheckBatch</tabstop>
+ <tabstop>epochBoxBatch</tabstop>
+ <tabstop>inputRadioBatch</tabstop>
+ <tabstop>InputButtonBatch</tabstop>
+ <tabstop>InputLineEditBatch</tabstop>
+ <tabstop>OutButtonBatch</tabstop>
+ <tabstop>OutputLineEditBatch</tabstop>
+ <tabstop>runButtonBatch</tabstop>
+</tabstops>
+<slots>
+ <slot>slotComputeCoords()</slot>
+ <slot>slotRadioBatch()</slot>
+ <slot>slotUtCheckedBatch()</slot>
+ <slot>slotDateCheckedBatch()</slot>
+ <slot>slotRaCheckedBatch()</slot>
+ <slot>slotDecCheckedBatch()</slot>
+ <slot>slotEpochCheckedBatch()</slot>
+ <slot>slotClearCoords()</slot>
+ <slot>slotRunBatch()</slot>
+ <slot>slotInputFile()</slot>
+ <slot>slotOutputFile()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/modcalcazel.cpp b/kstars/kstars/tools/modcalcazel.cpp
new file mode 100644
index 00000000..a9ba9881
--- /dev/null
+++ b/kstars/kstars/tools/modcalcazel.cpp
@@ -0,0 +1,534 @@
+/***************************************************************************
+ modcalcazel.cpp - description
+ -------------------
+ begin : s� oct 26 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. *
+ * *
+ ***************************************************************************/
+
+#include "modcalcazel.h"
+
+#include "modcalcazel.moc"
+#include "dms.h"
+#include "dmsbox.h"
+#include "skypoint.h"
+#include "geolocation.h"
+#include "kstars.h"
+#include "kstarsdata.h"
+#include "kstarsdatetime.h"
+#include "libkdeedu/extdate/extdatetimeedit.h"
+
+#include <qdatetimeedit.h> //need for QTimeEdit
+#include <qcheckbox.h>
+#include <qradiobutton.h>
+#include <qstring.h>
+#include <qtextstream.h>
+#include <kfiledialog.h>
+#include <kmessagebox.h>
+
+
+modCalcAzel::modCalcAzel(QWidget *parentSplit, const char *name) : modCalcAzelDlg (parentSplit,name) {
+
+ showCurrentDateTime();
+ initGeo();
+ showLongLat();
+ horInputCoords = FALSE;
+ raBox->setDegType(FALSE);
+ show();
+}
+
+modCalcAzel::~modCalcAzel(){
+ delete geoPlace;
+}
+
+SkyPoint modCalcAzel::getEquCoords (void)
+{
+ dms raCoord, decCoord;
+
+ raCoord = raBox->createDms(FALSE);
+ decCoord = decBox->createDms();
+
+ SkyPoint sp = SkyPoint (raCoord, decCoord);
+
+ return sp;
+}
+
+SkyPoint modCalcAzel::getHorCoords (void)
+{
+ dms azCoord, elCoord;
+
+ azCoord = azBox->createDms();
+ elCoord = elBox->createDms();
+
+ SkyPoint sp = SkyPoint();
+
+ sp.setAz(azCoord);
+ sp.setAlt(elCoord);
+
+ return sp;
+}
+
+void modCalcAzel::showCurrentDateTime (void)
+{
+ KStars *ks = (KStars*) parent()->parent()->parent();
+
+ KStarsDateTime dt = ks->data()->geo()->LTtoUT( KStarsDateTime::currentDateTime() );
+
+ datBox->setDate( dt.date() );
+ timBox->setTime( dt.time() );
+ dateBoxBatch->setDate( dt.date() );
+ utBoxBatch->setTime( dt.time() );
+}
+
+KStarsDateTime modCalcAzel::getDateTime (void)
+{
+ return KStarsDateTime( datBox->date() , timBox->time() );
+}
+
+double modCalcAzel::getEpoch (QString eName)
+{
+ bool ok = false;
+ double epoch = eName.toDouble(&ok);
+ if ( ok )
+ return epoch;
+ else {
+ kdDebug() << i18n( "Could not parse epoch string; assuming J2000" ) << endl;
+ return 2000.0;
+ }
+}
+
+dms modCalcAzel::getLongitude(void)
+{
+ dms longitude;
+ longitude = longBox->createDms();
+ return longitude;
+}
+
+dms modCalcAzel::getLatitude(void)
+{
+ dms latitude;
+ latitude = latBox->createDms();
+ return latitude;
+}
+
+void modCalcAzel::getGeoLocation (void)
+{
+ geoPlace->setLong( longBox->createDms() );
+ geoPlace->setLat( latBox->createDms() );
+ geoPlace->setHeight( 0.0);
+
+}
+
+void modCalcAzel::initGeo(void)
+{
+ KStars *ks = (KStars*) parent()->parent()->parent(); // QSplitter->AstroCalc->KStars
+ geoPlace = new GeoLocation( ks->geo() );
+}
+
+
+
+void modCalcAzel::showLongLat(void)
+{
+
+ KStars *ks = (KStars*) parent()->parent()->parent(); // QSplitter->AstroCalc->KStars
+ longBox->show( ks->geo()->lng() );
+ latBox->show( ks->geo()->lat() );
+ longBoxBatch->show( ks->geo()->lng() );
+ latBoxBatch->show( ks->geo()->lat() );
+}
+
+void modCalcAzel::showHorCoords ( SkyPoint sp )
+{
+
+ azBox->show( sp.az() );
+ elBox->show( sp.alt() );
+
+}
+
+void modCalcAzel::showEquCoords ( SkyPoint sp )
+{
+ raBox->show( sp.ra(), FALSE );
+ decBox->show( sp.dec() );
+ showEpoch( getDateTime() );
+}
+
+void modCalcAzel::showEpoch( const KStarsDateTime &dt )
+{
+ double epochN = dt.epoch();
+// Localization
+// epochName->setText(KGlobal::locale()->formatNumber(epochN,3));
+ epochName->setText( KGlobal::locale()->formatNumber( epochN ) );
+
+}
+
+void modCalcAzel::slotClearCoords()
+{
+
+ raBox->clearFields();
+ decBox->clearFields();
+ azBox->clearFields();
+ elBox->clearFields();
+ epochName->setText("");
+
+ datBox->setDate(ExtDate::currentDate());
+ timBox->setTime(QTime(0,0,0));
+
+}
+
+void modCalcAzel::slotComputeCoords()
+{
+ SkyPoint sp;
+ double epoch0 = getEpoch( epochName->text() );
+ KStarsDateTime dt;
+ dt.setFromEpoch( epoch0 );
+ long double jd = getDateTime().djd();
+ long double jd0 = dt.djd();
+
+ dms LST( getDateTime().gst().Degrees() + getLongitude().Degrees() );
+
+ if(radioApCoords->isChecked()) {
+ sp = getEquCoords();
+ sp.apparentCoord(jd0, jd);
+ dms lat(getLatitude());
+ sp.EquatorialToHorizontal( &LST, &lat );
+ showHorCoords( sp );
+
+ } else {
+ sp = getHorCoords();
+ dms lat(getLatitude());
+ sp.HorizontalToEquatorial( &LST, &lat );
+ showEquCoords( sp );
+ }
+
+}
+void modCalcAzel::slotUtChecked(){
+ if ( utCheckBatch->isChecked() )
+ utBoxBatch->setEnabled( false );
+ else {
+ utBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcAzel::slotDateChecked(){
+ if ( dateCheckBatch->isChecked() )
+ dateBoxBatch->setEnabled( false );
+ else {
+ dateBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcAzel::slotRaChecked(){
+ if ( raCheckBatch->isChecked() ) {
+ raBoxBatch->setEnabled( false );
+ horNoCheck();
+ }
+ else {
+ raBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcAzel::slotDecChecked(){
+ if ( decCheckBatch->isChecked() ) {
+ decBoxBatch->setEnabled( false );
+ horNoCheck();
+ }
+ else {
+ decBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcAzel::slotEpochChecked(){
+ if ( epochCheckBatch->isChecked() )
+ epochBoxBatch->setEnabled( false );
+ else
+ epochBoxBatch->setEnabled( true );
+}
+
+void modCalcAzel::slotLongChecked(){
+ if ( longCheckBatch->isChecked() )
+ longBoxBatch->setEnabled( false );
+ else
+ longBoxBatch->setEnabled( true );
+}
+
+void modCalcAzel::slotLatChecked(){
+ if ( latCheckBatch->isChecked() )
+ latBoxBatch->setEnabled( false );
+ else {
+ latBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcAzel::slotAzChecked(){
+ if ( azCheckBatch->isChecked() ) {
+ azBoxBatch->setEnabled( false );
+ equNoCheck();
+ }
+ else {
+ azBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcAzel::slotElChecked(){
+ if ( elCheckBatch->isChecked() ) {
+ elBoxBatch->setEnabled( false );
+ equNoCheck();
+ }
+ else {
+ elBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcAzel::horNoCheck() {
+ azCheckBatch->setChecked(false);
+ azBoxBatch->setEnabled(false);
+ elCheckBatch->setChecked(false);
+ elBoxBatch->setEnabled(false);
+ horInputCoords = FALSE;
+
+}
+
+void modCalcAzel::equNoCheck() {
+ raCheckBatch->setChecked(false);
+ raBoxBatch->setEnabled(false);
+ decCheckBatch->setChecked(false);
+ decBoxBatch->setEnabled(false);
+ horInputCoords = TRUE;
+}
+
+
+void modCalcAzel::slotInputFile() {
+ QString inputFileName;
+ inputFileName = KFileDialog::getOpenFileName( );
+ InputLineEditBatch->setText( inputFileName );
+}
+
+void modCalcAzel::slotOutputFile() {
+ QString outputFileName;
+ outputFileName = KFileDialog::getSaveFileName( );
+ OutputLineEditBatch->setText( outputFileName );
+}
+
+void modCalcAzel::slotRunBatch() {
+ QString inputFileName;
+
+ inputFileName = InputLineEditBatch->text();
+
+ // We open the input file and read its content
+
+ if ( QFile::exists(inputFileName) ) {
+ QFile f( inputFileName );
+ if ( !f.open( IO_ReadOnly) ) {
+ QString message = i18n( "Could not open file %1.").arg( f.name() );
+ KMessageBox::sorry( 0, message, i18n( "Could Not Open File" ) );
+ inputFileName = "";
+ return;
+ }
+
+// processLines(&f);
+ QTextStream istream(&f);
+ processLines(istream);
+// readFile( istream );
+ f.close();
+ } else {
+ QString message = i18n( "Invalid file: %1" ).arg( inputFileName );
+ KMessageBox::sorry( 0, message, i18n( "Invalid file" ) );
+ inputFileName = "";
+ InputLineEditBatch->setText( inputFileName );
+ return;
+ }
+}
+
+void modCalcAzel::processLines( QTextStream &istream ) {
+
+ // we open the output file
+
+// QTextStream istream(&fIn);
+ QString outputFileName;
+ outputFileName = OutputLineEditBatch->text();
+ QFile fOut( outputFileName );
+ fOut.open(IO_WriteOnly);
+ QTextStream ostream(&fOut);
+
+ QString line;
+ QString space = " ";
+ int i = 0;
+ long double jd0, jdf;
+ dms LST;
+ SkyPoint sp;
+ dms raB, decB, latB, longB, azB, elB;
+ double epoch0B;
+ QTime utB;
+ ExtDate dtB;
+
+ while ( ! istream.eof() ) {
+ line = istream.readLine();
+ line.stripWhiteSpace();
+
+ //Go through the line, looking for parameters
+
+ QStringList fields = QStringList::split( " ", line );
+
+ i = 0;
+
+ // Read Ut and write in ostream if corresponds
+
+ if(utCheckBatch->isChecked() ) {
+ utB = QTime::fromString( fields[i] );
+ i++;
+ } else
+ utB = utBoxBatch->time();
+
+ if ( allRadioBatch->isChecked() )
+ ostream << utB.toString() << space;
+ else
+ if(utCheckBatch->isChecked() )
+ ostream << utB.toString() << space;
+
+ // Read date and write in ostream if corresponds
+
+ if(dateCheckBatch->isChecked() ) {
+ dtB = ExtDate::fromString( fields[i] );
+ i++;
+ } else
+ dtB = dateBoxBatch->date();
+ if ( allRadioBatch->isChecked() )
+ ostream << dtB.toString().append(space);
+ else
+ if(dateCheckBatch->isChecked() )
+ ostream << dtB.toString().append(space);
+
+ // Read Longitude and write in ostream if corresponds
+
+ if (longCheckBatch->isChecked() ) {
+ longB = dms::fromString( fields[i],TRUE);
+ i++;
+ } else
+ longB = longBoxBatch->createDms(TRUE);
+
+ if ( allRadioBatch->isChecked() )
+ ostream << longB.toDMSString() << space;
+ else
+ if (longCheckBatch->isChecked() )
+ ostream << longB.toDMSString() << space;
+
+ // Read Latitude
+
+
+ if (latCheckBatch->isChecked() ) {
+ latB = dms::fromString( fields[i], TRUE);
+ i++;
+ } else
+ latB = latBoxBatch->createDms(TRUE);
+ if ( allRadioBatch->isChecked() )
+ ostream << latB.toDMSString() << space;
+ else
+ if (latCheckBatch->isChecked() )
+ ostream << latB.toDMSString() << space;
+
+ // Read Epoch and write in ostream if corresponds
+
+ if(epochCheckBatch->isChecked() ) {
+ epoch0B = fields[i].toDouble();
+ i++;
+ } else
+ epoch0B = getEpoch( epochBoxBatch->text() );
+
+ if ( allRadioBatch->isChecked() )
+ ostream << epoch0B << space;
+ else
+ if(epochCheckBatch->isChecked() )
+ ostream << epoch0B << space;
+
+ // We make the first calculations
+ KStarsDateTime dt;
+ dt.setFromEpoch( epoch0B );
+ jdf = KStarsDateTime(dtB,utB).djd();
+ jd0 = dt.djd();
+
+ LST = KStarsDateTime(dtB,utB).gst().Degrees() + longB.Degrees();
+
+ // Equatorial coordinates are the input coords.
+ if (!horInputCoords) {
+ // Read RA and write in ostream if corresponds
+
+ if(raCheckBatch->isChecked() ) {
+ raB = dms::fromString( fields[i],FALSE);
+ i++;
+ } else
+ raB = raBoxBatch->createDms(FALSE);
+
+ if ( allRadioBatch->isChecked() )
+ ostream << raB.toHMSString() << space;
+ else
+ if(raCheckBatch->isChecked() )
+ ostream << raB.toHMSString() << space;
+
+ // Read DEC and write in ostream if corresponds
+
+ if(decCheckBatch->isChecked() ) {
+ decB = dms::fromString( fields[i], TRUE);
+ i++;
+ } else
+ decB = decBoxBatch->createDms();
+
+ if ( allRadioBatch->isChecked() )
+ ostream << decB.toDMSString() << space;
+ else
+ if(decCheckBatch->isChecked() )
+ ostream << decB.toDMSString() << space;
+
+ sp = SkyPoint (raB, decB);
+ sp.apparentCoord(jd0, jdf);
+ sp.EquatorialToHorizontal( &LST, &latB );
+ ostream << sp.az()->toDMSString() << space << sp.alt()->toDMSString() << endl;
+
+ // Input coords are horizontal coordinates
+
+ } else {
+ if(azCheckBatch->isChecked() ) {
+ azB = dms::fromString( fields[i],FALSE);
+ i++;
+ } else
+ azB = azBoxBatch->createDms();
+
+ if ( allRadioBatch->isChecked() )
+ ostream << azB.toHMSString() << space;
+ else
+ if(raCheckBatch->isChecked() )
+ ostream << azB.toHMSString() << space;
+
+ // Read DEC and write in ostream if corresponds
+
+ if(elCheckBatch->isChecked() ) {
+ elB = dms::fromString( fields[i], TRUE);
+ i++;
+ } else
+ elB = decBoxBatch->createDms();
+
+ if ( allRadioBatch->isChecked() )
+ ostream << elB.toDMSString() << space;
+ else
+ if(elCheckBatch->isChecked() )
+ ostream << elB.toDMSString() << space;
+
+ sp.setAz(azB);
+ sp.setAlt(elB);
+ sp.HorizontalToEquatorial( &LST, &latB );
+ ostream << sp.ra()->toHMSString() << space << sp.dec()->toDMSString() << endl;
+ }
+
+ }
+
+
+ fOut.close();
+}
diff --git a/kstars/kstars/tools/modcalcazel.h b/kstars/kstars/tools/modcalcazel.h
new file mode 100644
index 00000000..9bbe0546
--- /dev/null
+++ b/kstars/kstars/tools/modcalcazel.h
@@ -0,0 +1,124 @@
+/***************************************************************************
+ modcalcazel.h - description
+ -------------------
+ begin : sáb oct 26 2002
+ copyright : (C) 2002 by Pablo de Vicente
+ email : pvicentea@wanadoo.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 MODCALCAZEL_H
+#define MODCALCAZEL_H
+
+#include <kapplication.h>
+#include <qwidget.h>
+#include "modcalcazeldlg.h"
+
+class QWidget;
+class SkyPoint;
+class KStarsDateTime;
+class GeoLocation;
+class dms;
+
+/**
+ *@author Pablo de Vicente
+ */
+
+class modCalcAzel : public modCalcAzelDlg {
+
+Q_OBJECT
+
+public:
+ modCalcAzel(QWidget *p, const char *n);
+ ~modCalcAzel();
+
+public slots:
+
+ /** No descriptions */
+ void slotComputeCoords();
+ /** No descriptions */
+ void slotClearCoords();
+ void slotUtChecked();
+ void slotDateChecked();
+ void slotRaChecked();
+ void slotDecChecked();
+ void slotEpochChecked();
+ void slotLongChecked();
+ void slotLatChecked();
+ void slotAzChecked();
+ void slotElChecked();
+ void slotInputFile();
+ void slotOutputFile();
+ void slotRunBatch();
+
+private:
+
+ /**@returns a SkyPoint constructed from the coordinates in the
+ * RA and Dec dmsBoxes. */
+ SkyPoint getEquCoords(void);
+
+ /**@returns a SkyPoint constructed from the coordinates in the
+ * Az and El dmsBoxes. */
+ SkyPoint getHorCoords(void);
+
+ /**Fill the Time and Date fields with the current values from the
+ * CPU clock. */
+ void showCurrentDateTime(void);
+
+ /**@returns a KStarsDateTime constructed from the Time and Date fields. */
+ KStarsDateTime getDateTime (void);
+
+ /**Parse the string argument as a double
+ * @param eName String from which the epoch is to be constructed
+ * once it is converted to a double
+ */
+ double getEpoch (QString eName);
+
+ /**Fill the Az and El dmsBoxes with values of the SkyPoint argument.
+ * @param sp SkypPoint object which contains the coordinates to
+ * be displayed */
+ void showHorCoords ( SkyPoint sp );
+
+ /**Fill the Az and El dmsBoxes with values of the SkyPoint argument.
+ * @param sp SkypPoint object which contains the coordinates to
+ * be displayed
+ * @param jd Julian day for which the conversion has been performed
+ * The epoch is constructed for that day
+ */
+ void showEquCoords ( SkyPoint sp );
+
+ /**Fills the epoch box with the value corresponding to a julian day
+ * @param dt date/time from which to construct the epoch string
+ */
+ void showEpoch ( const KStarsDateTime &dt );
+
+ /* Creates a dms object from the latitude box */
+ dms getLatitude (void);
+
+ /* Creates a dms object from the longitude box */
+ dms getLongitude (void);
+
+ void initGeo(void);
+
+ void showLongLat(void);
+
+ void getGeoLocation (void);
+
+ void horNoCheck();
+ void equNoCheck();
+ void processLines( QTextStream &istream );
+
+ GeoLocation *geoPlace;
+ bool horInputCoords;
+
+};
+
+#endif
diff --git a/kstars/kstars/tools/modcalcazeldlg.ui b/kstars/kstars/tools/modcalcazeldlg.ui
new file mode 100644
index 00000000..0e1bb9fc
--- /dev/null
+++ b/kstars/kstars/tools/modcalcazeldlg.ui
@@ -0,0 +1,1079 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>modCalcAzelDlg</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>modCalcAzelDlg</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>554</width>
+ <height>473</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Horizontal Coordinates</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tabWidget3</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Interactive Mode</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>inputGroupBox</cstring>
+ </property>
+ <property name="title">
+ <string>Time &amp;&amp; Location</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout20</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="ExtDateEdit" row="1" column="1">
+ <property name="name">
+ <cstring>datBox</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QTimeEdit" row="0" column="1">
+ <property name="name">
+ <cstring>timBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>timLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Universal time:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>dateLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Date:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout11</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>longLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Longitude:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>longBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>latLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Latitude:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>latBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup4_2</cstring>
+ </property>
+ <property name="title">
+ <string>Select Input</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioApCoords</cstring>
+ </property>
+ <property name="text">
+ <string>Apparent coordinates</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioHorCoords</cstring>
+ </property>
+ <property name="text">
+ <string>Horizontal coordinates</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout10</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>Compute</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>25</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>120</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Convert</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>Clear</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>25</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>120</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Clear</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout21</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Equatorial Coordinates</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>raLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Right ascension:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>raBox</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>decLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Declination:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>decBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>epochName</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>epochLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Epoch:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox3</cstring>
+ </property>
+ <property name="title">
+ <string>Horizontal Coordinates</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>azBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>azLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Azimuth:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>elLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Altitude:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>elBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>77</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Batch Mode</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>InputBox_2_2</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Select Fields in Input File</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>utCheckBatch</cstring>
+ </property>
+ <property name="autoMask">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>UT:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>dateCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Date:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="0" rowspan="2" colspan="3">
+ <property name="name">
+ <cstring>raCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Right ascension:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="4" column="0">
+ <property name="name">
+ <cstring>decCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Declination:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="5" column="0">
+ <property name="name">
+ <cstring>epochCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Epoch:</string>
+ </property>
+ </widget>
+ <widget class="QTimeEdit" row="0" column="1">
+ <property name="name">
+ <cstring>utBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="3" column="1">
+ <property name="name">
+ <cstring>raBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="4" column="1">
+ <property name="name">
+ <cstring>decBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="5" column="1">
+ <property name="name">
+ <cstring>epochBoxBatch</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="3" column="2">
+ <property name="name">
+ <cstring>azCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Azimuth:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="3">
+ <property name="name">
+ <cstring>latBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="3" column="3">
+ <property name="name">
+ <cstring>azBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="4" column="3">
+ <property name="name">
+ <cstring>elBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="2">
+ <property name="name">
+ <cstring>latCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Latitude:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="3">
+ <property name="name">
+ <cstring>longBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="2">
+ <property name="name">
+ <cstring>longCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Longitude:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="4" column="2">
+ <property name="name">
+ <cstring>elCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Altitude:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="ExtDateEdit" row="1" column="1">
+ <property name="name">
+ <cstring>dateBoxBatch</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup4</cstring>
+ </property>
+ <property name="title">
+ <string>Fields in Output File Plus Result</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>allRadioBatch</cstring>
+ </property>
+ <property name="text">
+ <string>All parameters</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>inputRadioBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Only parameters in input file</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox4_2</cstring>
+ </property>
+ <property name="title">
+ <string>Files</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton" row="0" column="0">
+ <property name="name">
+ <cstring>InputButtonBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Input File...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>File with the input data</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>InputLineEditBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>OutputLineEditBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>OutButtonBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Output File...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>File for the output data</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout14</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer20</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>151</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>runButtonBatch</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Run</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer19</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>131</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>31</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </widget>
+ </hbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>dmsBox</class>
+ <header location="global">../dmsbox.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+ <customwidget>
+ <class>ExtDateEdit</class>
+ <header location="local">libkdeedu/extdate/extdatetimeedit.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image1</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1163">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000045249444154388d8d95bf8b1d5514c73fbb19e40cbce81d788199b8911d48304f8cf0524876316016031ab14819acfcd1f8a34ba72222fe0b369a54a216a216c158049222645f131221c10928dc852cdc0bfb600e66dc39c58558ccee6ab0c93497c3650edff339df99efc28df51bec3e9f7cfee6438b8662800086431eab2e971c5f7cf4edc26eaf851beb37b8f8fd870f67d73c6fbf759e5c0427156a0149d0621414b4b414c8bf756a013033c2a6a7f19e181b564e56bc73eec2420630bbee39ffdec7b8aac61e2861ee294460046bd309860720a8079f13e60149156a8a2000d4076a48c6ec7ae09d73b070ead5f2e199d31f50d735b66534b161b254524f6bea25a14d1b90c2300146d080ce8de68ed06ed65832cc0ceb0ceb7bda79445c4f66117211ec81e1a3677a78c299d7a6281e3fbf0c29d29a2717a14d4231ca2153a6e386b8e1f1b355821a4e84f8a0a7c81c3e06324d86938a103d93c335aba76ba2cdb8152f42f2f83f1c39397d6a29b21cad846a6ca841b9acf45ca5bd721cd516b26127206464825aa05eaa583b3d41d33ab736bfc4d4b87d6d421b6b2c2992392c296e24544703d395801ad44b861e0d70b326a67687b9b148322401fb0dc3f37bfc0e9d1b572f4d089b15660a0866caea4b42b1dcd2dcac985daf910c34c1e458c0b21d97240320739960c0f1e74b7c77154b8166564357018ac8a0f4ccd9299313400afc8427dc9de0ca96fa88a2c9a88f2ab7b784227328b0a8c910725a3ca4488c10361e557ae69515565f9e528843cd58391d319478b7460d9c808c5b4068d3f0de229960f4149283192e1b188938c0583d3165edd4142742df298231fbd5e170f4095cc6c0fac880808cff30065a0bc8c86129df533a3d5a72eaec041941d006231034d0ce0bd4142c27ce0527a0dd4ee3341c8bbb8c498225a17413c0a80f3bd6ce55146284ee369622da790a27ac9d6da99604b29eb21cac276998b0c8dc207c97b1760dce0123a84b21a8a2ea310b80e2e781ca419f846a5c307d2360731d186730bb93ff9f714b4b1b05eb22c508ea9516498e1fbf51426cb87ca965fd879ae61ee41458eaa91cc838ec3116dc238c33924182e68e21638f594fb90cc7cf7ad67f7e8e9fbe2e201348cafaa58a76ab657a32a21a061f9b8139fc9ff208e37d470ebacfea675f80edfdc46dcf812ad26d1ba39171a0dec289903f39a77a26b1df751caa3bd2e2fd9da6e0b20cb5c4f8a0b1713707cbe8d27c601c36fdb0c0cde1d737990e9fab1b194c1b6a618fe530f6e002c964cfc7fdfec8f214665706d6fb8ebd587ef6f75f89d1be02ddeeb058717f13aaa7c09e30dc13a0db0ca78164d019d8d698e66ec1a1a73b4207767fcc9ff772547bc6e36c489077df7ffd6139aec9c541b21da64679c428c62de531831e72c06f086d2c885e2009e524522df534bf41b80f3a572e7cf5cb90202b272b66d7036e6414385a8664686e4341cdfa15ddcbc5dd7b3048463f733402a41eed947ad9fd9b79ff0dd3b8a97b8ac976b6fc187559c2179ffeb817a6ff006d91847a48e5abd70000000049454e44ae426082</data>
+ </image>
+ <image name="image1">
+ <data format="PNG" length="872">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000032f49444154388db5953148254718c77f1e5b7c030ab3e0c12e5ce00927f88a14af7d87c5590ac29d6013b0497b844008a9120e1248938354a6b1482131cde5a510b4f03081f07c8d4421c2063cd85708bbe0831938613ec8c0a5588dd1dc33452e5f33bb33c36f7ffbed7fd889fe7e9fcb7ad07df09ab750fdfdfec4c425787b6bfb757bae8df79e6a54e1bcc36008845b47e71dc549c1e06000f10a9e5c9a3effee39690ef92cb4a25e2c3b4804709844807035cfd57d7122f0ad65f0c25f0703d4a39af41d28473fa0af4a42548c81f007f85aa86a4510cc34cccc8288420405640ad2bbcadfeb2fb01b39021e7d5513a2c74c59ca43d8db510e0f6a24018d8a2496ecbeb0b892d29d0f08cdbc9d149ac7dc0057bea2831262853196fd5d6573dd43046b85fcbe2002d55019be54bef9a2a45ecd585e059106fe46639318403153427908bd0be8e2a38c874b90e70692806acade4ea0b7eee96d0cc9b2360b8f0d92e835e33b97172106400801b6b73c1a95c54719cbef439a2b9a54f833c3f68f8ec59594f73eb090089b1b153afa67e4ae1b270e5fa7144725d636a6228d853fcf59fbca511e7bdc193cf92467b0eb297f578a2220721d7ccdd82442553b48206f417a1714c5fb94b5cf2b8a638f58a13b9fc2a4a3ddb16854aa53d03806dcf4180481a8d8c98b8f7296b3f6a5a33c6ee2652785fc1ea4d2bcaf248246901bca377a0c661a482cc5505135ecbd088de9a490ddb30c8735cf9e5614872955a96854665a066e4f85a33d0bad96500f95bd9dc0f26a8a3b53ba0f53f20c9e3d85e1cb9a4f3facd0734f9659da1da8ea5b7a0c02a22cae081a95deba676fc7f1e4a39cce7ca0d5097cfc594e9659fca88608dd25cbccdcbfe6384014baf3509f66f436866c7e0d835d4ffb5d0b0954a5c38fb4e92d4af18b521c19ac8c39796ee42ecebe22c0f2aa90656d7adf5714c74a71346c7647b0d39685c7965f7f52aa738fc6947a34c6b83829284a41d2c6441258580a74e7738a22509d36d0bc65687760660e8a25033187c451fec69bc1838301ac0b69de444ad53779c32317bb2481f2d437b9dd6adae13d14874a558f3126c2e0e7cbc59be3b81abf7e67ecca7fac3bd0fca3fe17f0db86f7f7fb137f0208c29bb2c76e387f0000000049454e44ae426082</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>Clear</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcAzelDlg</receiver>
+ <slot>slotClearCoords()</slot>
+ </connection>
+ <connection>
+ <sender>Compute</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcAzelDlg</receiver>
+ <slot>slotComputeCoords()</slot>
+ </connection>
+ <connection>
+ <sender>runButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcAzelDlg</receiver>
+ <slot>slotRunBatch()</slot>
+ </connection>
+ <connection>
+ <sender>InputButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcAzelDlg</receiver>
+ <slot>slotInputFile()</slot>
+ </connection>
+ <connection>
+ <sender>OutButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcAzelDlg</receiver>
+ <slot>slotOutputFile()</slot>
+ </connection>
+ <connection>
+ <sender>utCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcAzelDlg</receiver>
+ <slot>slotUtChecked()</slot>
+ </connection>
+ <connection>
+ <sender>dateCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcAzelDlg</receiver>
+ <slot>slotDateChecked()</slot>
+ </connection>
+ <connection>
+ <sender>azCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcAzelDlg</receiver>
+ <slot>slotAzChecked()</slot>
+ </connection>
+ <connection>
+ <sender>elCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcAzelDlg</receiver>
+ <slot>slotElChecked()</slot>
+ </connection>
+ <connection>
+ <sender>latCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcAzelDlg</receiver>
+ <slot>slotLatChecked()</slot>
+ </connection>
+ <connection>
+ <sender>longCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcAzelDlg</receiver>
+ <slot>slotLongChecked()</slot>
+ </connection>
+ <connection>
+ <sender>raCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcAzelDlg</receiver>
+ <slot>slotRaChecked()</slot>
+ </connection>
+ <connection>
+ <sender>decCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcAzelDlg</receiver>
+ <slot>slotDecChecked()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>tabWidget3</tabstop>
+ <tabstop>timBox</tabstop>
+ <tabstop>datBox</tabstop>
+ <tabstop>longBox</tabstop>
+ <tabstop>latBox</tabstop>
+ <tabstop>radioApCoords</tabstop>
+ <tabstop>Compute</tabstop>
+ <tabstop>Clear</tabstop>
+ <tabstop>raBox</tabstop>
+ <tabstop>decBox</tabstop>
+ <tabstop>epochName</tabstop>
+ <tabstop>azBox</tabstop>
+ <tabstop>elBox</tabstop>
+ <tabstop>utCheckBatch</tabstop>
+ <tabstop>dateCheckBatch</tabstop>
+ <tabstop>raCheckBatch</tabstop>
+ <tabstop>decCheckBatch</tabstop>
+ <tabstop>epochCheckBatch</tabstop>
+ <tabstop>utBoxBatch</tabstop>
+ <tabstop>raBoxBatch</tabstop>
+ <tabstop>decBoxBatch</tabstop>
+ <tabstop>epochBoxBatch</tabstop>
+ <tabstop>azCheckBatch</tabstop>
+ <tabstop>latBoxBatch</tabstop>
+ <tabstop>azBoxBatch</tabstop>
+ <tabstop>elBoxBatch</tabstop>
+ <tabstop>latCheckBatch</tabstop>
+ <tabstop>longBoxBatch</tabstop>
+ <tabstop>longCheckBatch</tabstop>
+ <tabstop>elCheckBatch</tabstop>
+ <tabstop>inputRadioBatch</tabstop>
+ <tabstop>InputButtonBatch</tabstop>
+ <tabstop>InputLineEditBatch</tabstop>
+ <tabstop>OutputLineEditBatch</tabstop>
+ <tabstop>OutButtonBatch</tabstop>
+ <tabstop>runButtonBatch</tabstop>
+</tabstops>
+<slots>
+ <slot>slotClearCoords()</slot>
+ <slot>slotComputeCoords()</slot>
+ <slot>slotInputFile()</slot>
+ <slot>slotOutputFile()</slot>
+ <slot>slotRunBatch()</slot>
+ <slot>slotUtChecked()</slot>
+ <slot>slotDateChecked()</slot>
+ <slot>slotRaChecked()</slot>
+ <slot>slotDecChecked()</slot>
+ <slot>slotEpochChecked()</slot>
+ <slot>slotLatChecked()</slot>
+ <slot>slotLongChecked()</slot>
+ <slot>slotAzChecked()</slot>
+ <slot>slotElChecked()</slot>
+ <slot>newSlot()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/modcalcdaylength.cpp b/kstars/kstars/tools/modcalcdaylength.cpp
new file mode 100644
index 00000000..9a31dfe2
--- /dev/null
+++ b/kstars/kstars/tools/modcalcdaylength.cpp
@@ -0,0 +1,148 @@
+/***************************************************************************
+ modcalcdaylength.cpp - description
+ -------------------
+ begin : wed jun 12 2002
+ copyright : (C) 2002 by Pablo de Vicente
+ email : vicente@oan.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "modcalcdaylength.h"
+#include "modcalcprec.h"
+#include "dms.h"
+#include "dmsbox.h"
+#include "skyobject.h"
+#include "geolocation.h"
+#include "kstars.h"
+#include "timebox.h"
+#include "kssun.h"
+#include "ksnumbers.h"
+#include "kstarsdatetime.h"
+#include "libkdeedu/extdate/extdatetimeedit.h"
+
+#include <kapplication.h>
+
+modCalcDayLength::modCalcDayLength(QWidget *parentSplit, const char *name) : modCalcDayLengthDlg(parentSplit,name) {
+ showCurrentDate();
+ initGeo();
+ show();
+}
+
+modCalcDayLength::~modCalcDayLength() {}
+
+void modCalcDayLength::showCurrentDate (void)
+{
+ KStarsDateTime dt( KStarsDateTime::currentDateTime() );
+ datBox->setDate( dt.date() );
+}
+
+void modCalcDayLength::initGeo(void)
+{
+ KStars *ks = (KStars*) parent()->parent()->parent(); // QSplitter->AstroCalc->KStars
+ geoPlace = ks->geo();
+ longBox->show( geoPlace->lng() );
+ latBox->show( geoPlace->lat() );
+}
+
+void modCalcDayLength::getGeoLocation (void)
+{
+ geoPlace->setLong( longBox->createDms() );
+ geoPlace->setLat( latBox->createDms() );
+ geoPlace->setHeight( 0.0);
+}
+
+KStarsDateTime modCalcDayLength::getDateTime (void)
+{
+ return KStarsDateTime( datBox->date() , QTime(8,0,0) );
+}
+
+void modCalcDayLength::slotClearCoords(){
+
+ azSetBox->clearFields();
+ azRiseBox->clearFields();
+ elTransitBox->clearFields();
+
+ // reset to current date
+ datBox->setDate(ExtDate::currentDate());
+
+// reset times to 00:00:00
+ setTimeBox->clearFields();
+ riseTimeBox->clearFields();
+ transitTimeBox->clearFields();
+
+// dayLBox->setTime(time);
+ dayLBox->clearFields();
+}
+
+QTime modCalcDayLength::lengthOfDay(QTime setQTime, QTime riseQTime){
+ QTime dL(0,0,0);
+ int dds = riseQTime.secsTo(setQTime);
+ QTime dLength = dL.addSecs( dds );
+
+ return dLength;
+}
+
+void modCalcDayLength::slotComputePosTime()
+{
+ long double jd0 = getDateTime().djd();
+ getGeoLocation();
+
+ KSNumbers * num = new KSNumbers(jd0);
+ KSSun *Sun = new KSSun(((KStars*) parent()->parent()->parent())->data());
+ Sun->findPosition(num);
+
+ QTime setQtime = Sun->riseSetTime( jd0 , geoPlace, false );
+ QTime riseQtime = Sun->riseSetTime( jd0 , geoPlace, true );
+ QTime transitQtime = Sun->transitTime(jd0 , geoPlace);
+
+ dms setAz = Sun->riseSetTimeAz(jd0, geoPlace, false);
+ dms riseAz = Sun->riseSetTimeAz(jd0, geoPlace, true);
+ dms transAlt = Sun->transitAltitude(jd0, geoPlace);
+
+ if (setQtime.isValid() ) {
+ azSetBox->show( setAz );
+ elTransitBox->show( transAlt );
+ azRiseBox->show( riseAz );
+
+ setTimeBox->showTime( setQtime );
+ riseTimeBox->showTime( riseQtime );
+ transitTimeBox->showTime( transitQtime );
+
+ QTime dayLQtime = lengthOfDay (setQtime,riseQtime);
+
+ dayLBox->showTime( dayLQtime );
+ } else if (transAlt.Degrees() > 0. ) {
+ azSetBox->setDMS(i18n("Circumpolar"));
+ elTransitBox->show( transAlt );
+ azRiseBox->setDMS(i18n("Circumpolar"));
+
+ setTimeBox->showTime( setQtime );
+ riseTimeBox->showTime( riseQtime );
+ transitTimeBox->showTime( transitQtime );
+
+ dayLBox->setEntry("24:00:00");
+
+ } else if (transAlt.Degrees() < 0. ) {
+ azSetBox->setDMS("does not rise");
+ elTransitBox->setDMS("does not rise");
+ azRiseBox->setDMS("does not rise");
+
+ setTimeBox->clearFields();
+ riseTimeBox->clearFields();
+ transitTimeBox->clearFields();
+
+ dayLBox->showTime( QTime(0,0,0) );
+ }
+
+ delete num;
+}
+
+#include "modcalcdaylength.moc"
diff --git a/kstars/kstars/tools/modcalcdaylength.h b/kstars/kstars/tools/modcalcdaylength.h
new file mode 100644
index 00000000..1c644157
--- /dev/null
+++ b/kstars/kstars/tools/modcalcdaylength.h
@@ -0,0 +1,63 @@
+/***************************************************************************
+ modcalcdaylength.h - description
+ -------------------
+ begin : wed jun 12 2002
+ copyright : (C) 2002 by Pablo de Vicente
+ email : vicente@oan.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 MODCALCDAYLENGTH_H
+#define MODCALCDAYLENGTH_H
+
+#include "modcalcdaylengthdlg.h"
+
+/** Module to compute the equatorial coordinates for a given date and time
+ * from a given epoch or equinox
+ *@author Pablo de Vicente
+ */
+
+class KStarsDateTime;
+class GeoLocation;
+
+class modCalcDayLength : public modCalcDayLengthDlg {
+Q_OBJECT
+public:
+/**Constructor. */
+ modCalcDayLength(QWidget *p, const char *n);
+/**Destructor. */
+ ~modCalcDayLength();
+
+public slots:
+ /** No descriptions */
+ void slotComputePosTime();
+ /** No descriptions */
+ void slotClearCoords();
+
+private:
+/**@returns a SkyPoint constructed from the coordinates in the RA and Dec dmsBoxes. */
+ QTime lengthOfDay(QTime setQTime, QTime riseQTime);
+
+/**Fills the Date fields with the current values from the current date. */
+ void showCurrentDate(void);
+
+/**@returns a KStarsDateTime constructed from the Time and Date fields. */
+ KStarsDateTime getDateTime (void);
+
+/**@returns a GeoLocation constructed from the Longitude and Latitude fields.
+ * Height is arbitrarily set to 0.0 */
+ void getGeoLocation(void);
+ void initGeo(void);
+
+ GeoLocation *geoPlace;
+};
+
+#endif
diff --git a/kstars/kstars/tools/modcalcdaylengthdlg.ui b/kstars/kstars/tools/modcalcdaylengthdlg.ui
new file mode 100644
index 00000000..d5d5c1f8
--- /dev/null
+++ b/kstars/kstars/tools/modcalcdaylengthdlg.ui
@@ -0,0 +1,655 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>modCalcDayLengthDlg</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>modCalcDayLengthDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>578</width>
+ <height>395</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Day Length</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>InputBox</cstring>
+ </property>
+ <property name="title">
+ <string>Location &amp;&amp; Date</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout37</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>latLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Latitude:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>latBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>longLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Longitude:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>longBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer11</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>60</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>datLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Date:</string>
+ </property>
+ </widget>
+ <widget class="ExtDateEdit">
+ <property name="name">
+ <cstring>datBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer53</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>71</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>Compute</cstring>
+ </property>
+ <property name="text">
+ <string>Compute</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>51</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>Clear</cstring>
+ </property>
+ <property name="text">
+ <string>Clear</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>81</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>resultsBox</cstring>
+ </property>
+ <property name="title">
+ <string>Sunrise, Noon &amp;&amp; Sunset Data</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout10</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="timeBox" row="3" column="1">
+ <property name="name">
+ <cstring>dayLBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>90</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>riseTimeLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Sunrise:</string>
+ </property>
+ </widget>
+ <widget class="timeBox" row="1" column="1">
+ <property name="name">
+ <cstring>transitTimeBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>90</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>transitTimeLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Noon:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>dayLLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Day length:</string>
+ </property>
+ </widget>
+ <widget class="timeBox" row="2" column="1">
+ <property name="name">
+ <cstring>setTimeBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>90</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ </widget>
+ <widget class="timeBox" row="0" column="1">
+ <property name="name">
+ <cstring>riseTimeBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>90</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>setTimeLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Sunset:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer12</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout20</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>azRiseLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Sunrise azimuth:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>azSetLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Sunset azimuth:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>azRiseBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>elTransitLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Altitude at noon:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="2" column="1">
+ <property name="name">
+ <cstring>azSetBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>elTransitBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ </widget>
+ <spacer row="3" column="0">
+ <property name="name">
+ <cstring>spacer26</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer27</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>30</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>110</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>dmsBox</class>
+ <header location="global">../dmsbox.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+ <customwidget>
+ <class>ExtDateEdit</class>
+ <header location="local">libkdeedu/extdate/extdatetimeedit.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image1</pixmap>
+ </customwidget>
+ <customwidget>
+ <class>timeBox</class>
+ <header location="local">timebox.h</header>
+ <sizehint>
+ <width>-1</width>
+ <height>-1</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image2</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1163">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000045249444154388d8d95bf8b1d5514c73fbb19e40cbce81d788199b8911d48304f8cf0524876316016031ab14819acfcd1f8a34ba72222fe0b369a54a216a216c158049222645f131221c10928dc852cdc0bfb600e66dc39c58558ccee6ab0c93497c3650edff339df99efc28df51bec3e9f7cfee6438b8662800086431eab2e971c5f7cf4edc26eaf851beb37b8f8fd870f67d73c6fbf759e5c0427156a0149d0621414b4b414c8bf756a013033c2a6a7f19e181b564e56bc73eec2420630bbee39ffdec7b8aac61e2861ee294460046bd309860720a8079f13e60149156a8a2000d4076a48c6ec7ae09d73b070ead5f2e199d31f50d735b66534b161b254524f6bea25a14d1b90c2300146d080ce8de68ed06ed65832cc0ceb0ceb7bda79445c4f66117211ec81e1a3677a78c299d7a6281e3fbf0c29d29a2717a14d4231ca2153a6e386b8e1f1b355821a4e84f8a0a7c81c3e06324d86938a103d93c335aba76ba2cdb8152f42f2f83f1c39397d6a29b21cad846a6ca841b9acf45ca5bd721cd516b26127206464825aa05eaa583b3d41d33ab736bfc4d4b87d6d421b6b2c2992392c296e24544703d395801ad44b861e0d70b326a67687b9b148322401fb0dc3f37bfc0e9d1b572f4d089b15660a0866caea4b42b1dcd2dcac985daf910c34c1e458c0b21d97240320739960c0f1e74b7c77154b8166564357018ac8a0f4ccd9299313400afc8427dc9de0ca96fa88a2c9a88f2ab7b784227328b0a8c910725a3ca4488c10361e557ae69515565f9e528843cd58391d319478b7460d9c808c5b4068d3f0de229960f4149283192e1b188938c0583d3165edd4142742df298231fbd5e170f4095cc6c0fac880808cff30065a0bc8c86129df533a3d5a72eaec041941d006231034d0ce0bd4142c27ce0527a0dd4ee3341c8bbb8c498225a17413c0a80f3bd6ce55146284ee369622da790a27ac9d6da99604b29eb21cac276998b0c8dc207c97b1760dce0123a84b21a8a2ea310b80e2e781ca419f846a5c307d2360731d186730bb93ff9f714b4b1b05eb22c508ea9516498e1fbf51426cb87ca965fd879ae61ee41458eaa91cc838ec3116dc238c33924182e68e21638f594fb90cc7cf7ad67f7e8e9fbe2e201348cafaa58a76ab657a32a21a061f9b8139fc9ff208e37d470ebacfea675f80edfdc46dcf812ad26d1ba39171a0dec289903f39a77a26b1df751caa3bd2e2fd9da6e0b20cb5c4f8a0b1713707cbe8d27c601c36fdb0c0cde1d737990e9fab1b194c1b6a618fe530f6e002c964cfc7fdfec8f214665706d6fb8ebd587ef6f75f89d1be02ddeeb058717f13aaa7c09e30dc13a0db0ca78164d019d8d698e66ec1a1a73b4207767fcc9ff772547bc6e36c489077df7ffd6139aec9c541b21da64679c428c62de531831e72c06f086d2c885e2009e524522df534bf41b80f3a572e7cf5cb90202b272b66d7036e6414385a8664686e4341cdfa15ddcbc5dd7b3048463f733402a41eed947ad9fd9b79ff0dd3b8a97b8ac976b6fc187559c2179ffeb817a6ff006d91847a48e5abd70000000049454e44ae426082</data>
+ </image>
+ <image name="image1">
+ <data format="PNG" length="872">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000032f49444154388db5953148254718c77f1e5b7c030ab3e0c12e5ce00927f88a14af7d87c5590ac29d6013b0497b844008a9120e1248938354a6b1482131cde5a510b4f03081f07c8d4421c2063cd85708bbe0831938613ec8c0a5588dd1dc33452e5f33bb33c36f7ffbed7fd889fe7e9fcb7ad07df09ab750fdfdfec4c425787b6bfb757bae8df79e6a54e1bcc36008845b47e71dc549c1e06000f10a9e5c9a3effee39690ef92cb4a25e2c3b4804709844807035cfd57d7122f0ad65f0c25f0703d4a39af41d28473fa0af4a42548c81f007f85aa86a4510cc34cccc8288420405640ad2bbcadfeb2fb01b39021e7d5513a2c74c59ca43d8db510e0f6a24018d8a2496ecbeb0b892d29d0f08cdbc9d149ac7dc0057bea2831262853196fd5d6573dd43046b85fcbe2002d55019be54bef9a2a45ecd585e059106fe46639318403153427908bd0be8e2a38c874b90e70692806acade4ea0b7eee96d0cc9b2360b8f0d92e835e33b97172106400801b6b73c1a95c54719cbef439a2b9a54f833c3f68f8ec59594f73eb090089b1b153afa67e4ae1b270e5fa7144725d636a6228d853fcf59fbca511e7bdc193cf92467b0eb297f578a2220721d7ccdd82442553b48206f417a1714c5fb94b5cf2b8a638f58a13b9fc2a4a3ddb16854aa53d03806dcf4180481a8d8c98b8f7296b3f6a5a33c6ee2652785fc1ea4d2bcaf248246901bca377a0c661a482cc5505135ecbd088de9a490ddb30c8735cf9e5614872955a96854665a066e4f85a33d0bad96500f95bd9dc0f26a8a3b53ba0f53f20c9e3d85e1cb9a4f3facd0734f9659da1da8ea5b7a0c02a22cae081a95deba676fc7f1e4a39cce7ca0d5097cfc594e9659fca88608dd25cbccdcbfe6384014baf3509f66f436866c7e0d835d4ffb5d0b0954a5c38fb4e92d4af18b521c19ac8c39796ee42ecebe22c0f2aa90656d7adf5714c74a71346c7647b0d39685c7965f7f52aa738fc6947a34c6b83829284a41d2c6441258580a74e7738a22509d36d0bc65687760660e8a25033187c451fec69bc1838301ac0b69de444ad53779c32317bb2481f2d437b9dd6adae13d14874a558f3126c2e0e7cbc59be3b81abf7e67ecca7fac3bd0fca3fe17f0db86f7f7fb137f0208c29bb2c76e387f0000000049454e44ae426082</data>
+ </image>
+ <image name="image2">
+ <data format="PNG" length="881">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000033849444154388dad9431681c471486bf3353bc05096641c52d38700711e88a1417111772544890e6888b33b848828ba448235205dcb88ae354c6659242e0c64429ecd885402914a43477074a4e27706003173815821dd0c10ec4b0af58508ad149bac488147ab0c5ecce7cf3cddb7fb7d2dfeb43091858bcb178c21554bfdbaf543add0e6284172f5f9c34179a38efc85d4ef63afb5f10ef3da3e188deefbd20785a468cb07863f1e4f90fcf4912259e87a2f434014a2512a140898c20281821d7302e5022847408ac0bbd5ff51cac6518b8b123aec368fc13793e02947856c90bc11d09f95801219e83c6bc8204809660638893e993183161463ece294a8ffe3d023cf1acb03fb0f4363d83030f4c6c84da82d0ba63797719acd1009ff91778629cf98c264a5106e8ce366c7cef026a46a82f58c44076a41cfea97cf7b5a3f591e5e34f052b01fe46e3c844502af12cec0fe414aaac7c58a5d5169204d42894093b9b051beb8ead1f1db5eb3556db3162fc14f8dac4b8280b2281bc10765ffa33e8279f0bc95b1e351e3d16b69ee5dcbe13f1d9175540d878ea517fdea8371a1728de09e91f1e6b2dadb620e2c3a2d7966f1f29e981273f86b57b31bded3077f0ca62651a3c6d6c20730a2849edf4f8a7d0c70f3ce981c7ce094bcb0233058d66a065878a96d3e46b178d05988cad849eeab1e5f103253d081b8a40723d229e01cc0426c865c618886c98981e2994313bbf104cad50ad5adc91e7e1fd8cfddf62b261589bd4a2cb5391abd298576a6f0b877f293b9b05b7efc6e4c7caea8a1057231ede0777e8f9666d84aa62e78466b32077d3afef3f3d46a0d5b6006cac3b767ece59bb17d35886c67b395f7e55c7562dde7bb45456db55ea0b5c6e5c9c6eb2b402de59369e3a9e3c72f4b685e63b821ac886193a563001b0bfeb496f2558112e86eefccb1b674426ec2ca2b4ee0a325763eb5948437a706e63e78456bb4677d7e355a104379e6ec599f16838221d82c417e06d61f5833a835739f951b85fafc5349a39f50558bd9520a5a064a4836970a5d3ed7073e9e609069aef87ec8a70f6f3c780989094c9f143296204ef211d289953bcbbf0b8bfd70738b9eaeb2c15575dd7c408fd6ebf72e5602d43743addce95c1fb7bfdca3fdcb3ae17a3e19dbf0000000049454e44ae426082</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>Clear</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcDayLengthDlg</receiver>
+ <slot>slotClearCoords()</slot>
+ </connection>
+ <connection>
+ <sender>Compute</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcDayLengthDlg</receiver>
+ <slot>slotComputePosTime()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>longBox</tabstop>
+ <tabstop>latBox</tabstop>
+ <tabstop>datBox</tabstop>
+ <tabstop>Compute</tabstop>
+ <tabstop>Clear</tabstop>
+ <tabstop>dayLBox</tabstop>
+ <tabstop>transitTimeBox</tabstop>
+ <tabstop>setTimeBox</tabstop>
+ <tabstop>riseTimeBox</tabstop>
+ <tabstop>elTransitBox</tabstop>
+ <tabstop>azSetBox</tabstop>
+ <tabstop>azRiseBox</tabstop>
+</tabstops>
+<slots>
+ <slot>slotComputePosTime()</slot>
+ <slot>slotClearCoords()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+
+ <includehint>timebox.h</includehint>
+ <includehint>timebox.h</includehint>
+ <includehint>timebox.h</includehint>
+ <includehint>timebox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/modcalceclipticcoords.cpp b/kstars/kstars/tools/modcalceclipticcoords.cpp
new file mode 100644
index 00000000..36a7e75b
--- /dev/null
+++ b/kstars/kstars/tools/modcalceclipticcoords.cpp
@@ -0,0 +1,385 @@
+/***************************************************************************
+ modcalceclipticcoords.cpp - description
+ -------------------
+ begin : Fri May 14 2004
+ copyright : (C) 2004 by Pablo de Vicente
+ email : vicente@oan.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "dms.h"
+#include "dmsbox.h"
+#include "modcalceclipticcoords.h"
+#include "modcalceclipticcoords.moc"
+#include "skypoint.h"
+#include "ksutils.h"
+#include "ksnumbers.h"
+#include "kstarsdatetime.h"
+#include <qradiobutton.h>
+#include <qstring.h>
+#include <qcheckbox.h>
+#include <qradiobutton.h>
+#include <qtextstream.h>
+#include <klocale.h>
+#include <klineedit.h>
+#include <kapplication.h>
+#include <kfiledialog.h>
+#include <kmessagebox.h>
+
+
+modCalcEclCoords::modCalcEclCoords(QWidget *parentSplit, const char *name) : modCalcEclCoordsDlg(parentSplit,name) {
+
+ equRadio->setChecked(TRUE);
+ raBox->setDegType(FALSE);
+ this->show();
+}
+
+modCalcEclCoords::~modCalcEclCoords() {
+}
+
+void modCalcEclCoords::getEclCoords (void) {
+
+ eclipLong = ecLongBox->createDms();
+ eclipLat = ecLatBox->createDms();
+ epoch = getEpoch( epochName->text() );
+}
+
+void modCalcEclCoords::getEquCoords (void) {
+
+ raCoord = raBox->createDms(FALSE);
+ decCoord = decBox->createDms();
+ epoch = getEpoch( epochName->text() );
+}
+
+double modCalcEclCoords::getEpoch (QString eName) {
+
+ double epoch = eName.toDouble();
+
+ return epoch;
+}
+
+void modCalcEclCoords::slotClearCoords (void) {
+
+ raBox->clearFields();
+ decBox->clearFields();
+ ecLongBox->clearFields();
+ ecLatBox->clearFields();
+
+}
+
+void modCalcEclCoords::slotComputeCoords (void) {
+
+ if(eclRadio->isChecked()) {
+ getEclCoords();
+ EclToEqu();
+ showEquCoords();
+ } else {
+ getEquCoords();
+ EquToEcl();
+ showEclCoords();
+ }
+
+}
+
+void modCalcEclCoords::showEquCoords(void) {
+ raBox->show( raCoord , FALSE);
+ decBox->show( decCoord );
+}
+
+void modCalcEclCoords::showEclCoords(void) {
+ ecLongBox->show( eclipLong );
+ ecLatBox->show( eclipLat );
+}
+
+void modCalcEclCoords::EclToEqu(void) {
+
+ SkyPoint sp = SkyPoint();
+
+ KStarsDateTime dt;
+ dt.setFromEpoch( epoch );
+ KSNumbers *num = new KSNumbers( dt.djd() );
+
+// sp.setEclLong(eclipLong);
+// sp.setEclLat(eclipLat);
+ sp.setFromEcliptic(num->obliquity(), &eclipLong, &eclipLat);
+
+ raCoord.set( *sp.ra() );
+ decCoord.set( *sp.dec() );
+
+ delete num;
+}
+
+void modCalcEclCoords::EquToEcl(void) {
+
+ SkyPoint sp = SkyPoint (raCoord, decCoord);
+ KStarsDateTime dt;
+ dt.setFromEpoch( epoch );
+ KSNumbers *num = new KSNumbers( dt.djd() );
+
+ sp.findEcliptic(num->obliquity(), eclipLong, eclipLat);
+
+ delete num;
+}
+
+void modCalcEclCoords::eclCheck() {
+
+ eclLatCheckBatch->setChecked(false);
+ eclLatBoxBatch->setEnabled(false);
+ eclLongCheckBatch->setChecked(false);
+ eclLongBoxBatch->setEnabled(false);
+ eclInputCoords = FALSE;
+
+}
+
+void modCalcEclCoords::equCheck() {
+
+ raCheckBatch->setChecked(false);
+ raBoxBatch->setEnabled(false);
+ decCheckBatch->setChecked(false);
+ decBoxBatch->setEnabled(false);
+ //epochCheckBatch->setChecked(false);
+ eclInputCoords = TRUE;
+
+}
+
+void modCalcEclCoords::slotRaCheckedBatch(){
+
+ if ( raCheckBatch->isChecked() ) {
+ raBoxBatch->setEnabled( false );
+ eclCheck();
+ } else {
+ raBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcEclCoords::slotDecCheckedBatch(){
+
+ if ( decCheckBatch->isChecked() ) {
+ decBoxBatch->setEnabled( false );
+ eclCheck();
+ } else {
+ decBoxBatch->setEnabled( true );
+ }
+}
+
+
+void modCalcEclCoords::slotEpochCheckedBatch(){
+ if ( epochCheckBatch->isChecked() ) {
+ epochBoxBatch->setEnabled( false );
+ } else {
+ epochBoxBatch->setEnabled( true );
+ }
+}
+
+
+void modCalcEclCoords::slotEclLatCheckedBatch(){
+
+ if ( eclLatCheckBatch->isChecked() ) {
+ eclLatBoxBatch->setEnabled( false );
+ equCheck();
+ } else {
+ eclLatBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcEclCoords::slotEclLongCheckedBatch(){
+
+ if ( eclLongCheckBatch->isChecked() ) {
+ eclLongBoxBatch->setEnabled( false );
+ equCheck();
+ } else {
+ eclLongBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcEclCoords::slotInputFile() {
+ QString inputFileName;
+ inputFileName = KFileDialog::getOpenFileName( );
+ InputLineEditBatch->setText( inputFileName );
+}
+
+void modCalcEclCoords::slotOutputFile() {
+ QString outputFileName;
+ outputFileName = KFileDialog::getSaveFileName( );
+ OutputLineEditBatch->setText( outputFileName );
+}
+
+void modCalcEclCoords::slotRunBatch() {
+
+ QString inputFileName;
+
+ inputFileName = InputLineEditBatch->text();
+
+ // We open the input file and read its content
+
+ if ( QFile::exists(inputFileName) ) {
+ QFile f( inputFileName );
+ if ( !f.open( IO_ReadOnly) ) {
+ QString message = i18n( "Could not open file %1.").arg( f.name() );
+ KMessageBox::sorry( 0, message, i18n( "Could Not Open File" ) );
+ inputFileName = "";
+ return;
+ }
+
+// processLines(&f);
+ QTextStream istream(&f);
+ processLines(istream);
+// readFile( istream );
+ f.close();
+ } else {
+ QString message = i18n( "Invalid file: %1" ).arg( inputFileName );
+ KMessageBox::sorry( 0, message, i18n( "Invalid file" ) );
+ inputFileName = "";
+ InputLineEditBatch->setText( inputFileName );
+ return;
+ }
+}
+
+void modCalcEclCoords::processLines( QTextStream &istream ) {
+
+ // we open the output file
+
+// QTextStream istream(&fIn);
+ QString outputFileName;
+ outputFileName = OutputLineEditBatch->text();
+ QFile fOut( outputFileName );
+ fOut.open(IO_WriteOnly);
+ QTextStream ostream(&fOut);
+
+ QString line;
+ QString space = " ";
+ int i = 0;
+ SkyPoint sp;
+ dms raB, decB, eclLatB, eclLongB;
+ double epoch0B;
+
+ while ( ! istream.eof() ) {
+ line = istream.readLine();
+ line.stripWhiteSpace();
+
+ //Go through the line, looking for parameters
+
+ QStringList fields = QStringList::split( " ", line );
+
+ i = 0;
+
+ // Input coords are ecliptic coordinates:
+
+ if (eclInputCoords) {
+
+ // Read Ecliptic Longitude and write in ostream if corresponds
+
+ if(eclLongCheckBatch->isChecked() ) {
+ eclLongB = dms::fromString( fields[i], TRUE);
+ i++;
+ } else
+ eclLongB = eclLongBoxBatch->createDms(TRUE);
+
+ if ( allRadioBatch->isChecked() )
+ ostream << eclLongB.toDMSString() << space;
+ else
+ if(eclLongCheckBatch->isChecked() )
+ ostream << eclLongB.toDMSString() << space;
+
+ // Read Ecliptic Latitude and write in ostream if corresponds
+
+ if(eclLatCheckBatch->isChecked() ) {
+ eclLatB = dms::fromString( fields[i], TRUE);
+ i++;
+ } else
+ if ( allRadioBatch->isChecked() )
+ ostream << eclLatB.toDMSString() << space;
+ else
+ if(eclLatCheckBatch->isChecked() )
+ ostream << eclLatB.toDMSString() << space;
+
+ // Read Epoch and write in ostream if corresponds
+
+ if(epochCheckBatch->isChecked() ) {
+ epoch0B = fields[i].toDouble();
+ i++;
+ } else
+ epoch0B = getEpoch( epochBoxBatch->text() );
+
+ if ( allRadioBatch->isChecked() )
+ ostream << epoch0B << space;
+ else
+ if(epochCheckBatch->isChecked() )
+ ostream << epoch0B << space;
+
+ sp = SkyPoint ();
+
+ KStarsDateTime dt;
+ dt.setFromEpoch( epoch0B );
+ KSNumbers *num = new KSNumbers( dt.djd() );
+ sp.setFromEcliptic(num->obliquity(), &eclLongB, &eclLatB);
+ ostream << sp.ra()->toHMSString() << space << sp.dec()->toDMSString() << endl;
+ // Input coords. are equatorial coordinates:
+
+ } else {
+
+ // Read RA and write in ostream if corresponds
+
+ if(raCheckBatch->isChecked() ) {
+ raB = dms::fromString( fields[i],FALSE);
+ i++;
+ } else
+ raB = raBoxBatch->createDms(FALSE);
+
+ if ( allRadioBatch->isChecked() )
+ ostream << raB.toHMSString() << space;
+ else
+ if(raCheckBatch->isChecked() )
+ ostream << raB.toHMSString() << space;
+
+ // Read DEC and write in ostream if corresponds
+
+ if(decCheckBatch->isChecked() ) {
+ decB = dms::fromString( fields[i], TRUE);
+ i++;
+ } else
+ decB = decBoxBatch->createDms();
+
+ if ( allRadioBatch->isChecked() )
+ ostream << decB.toDMSString() << space;
+ else
+ if(decCheckBatch->isChecked() )
+ ostream << decB.toDMSString() << space;
+
+ // Read Epoch and write in ostream if corresponds
+
+ if(epochCheckBatch->isChecked() ) {
+ epoch0B = fields[i].toDouble();
+ i++;
+ } else
+ epoch0B = getEpoch( epochBoxBatch->text() );
+
+ if ( allRadioBatch->isChecked() )
+ ostream << epoch0B << space;
+ else
+ if(epochCheckBatch->isChecked() )
+ ostream << epoch0B << space;
+
+ sp = SkyPoint (raB, decB);
+ KStarsDateTime dt;
+ dt.setFromEpoch( epoch0B );
+ KSNumbers *num = new KSNumbers( dt.djd() );
+ sp.findEcliptic(num->obliquity(), eclLongB, eclLatB);
+ ostream << eclLongB.toDMSString() << space << eclLatB.toDMSString() << endl;
+ delete num;
+
+ }
+
+ }
+
+
+ fOut.close();
+}
diff --git a/kstars/kstars/tools/modcalceclipticcoords.h b/kstars/kstars/tools/modcalceclipticcoords.h
new file mode 100644
index 00000000..809928c9
--- /dev/null
+++ b/kstars/kstars/tools/modcalceclipticcoords.h
@@ -0,0 +1,74 @@
+/***************************************************************************
+ modcalceclipticcoords.h - description
+ -------------------
+ begin : Fri May 14 2004
+ copyright : (C) 2004 by Pablo de Vicente
+ email : p.devicente@wanadoo.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 MODCALCECLIPTICCOORDS_H
+#define MODCALCECLIPTICCOORDS_H
+
+#include "modcalceclipticcoordsdlg.h"
+#include "dms.h"
+
+class QString;
+
+/**
+ * Class which implements the KStars calculator module to compute
+ * geocentric ecliptic coordinates to/from geocentric equatorial coordinates.
+ *
+ * Inherits QWidget
+ *@author Pablo de Vicente
+ */
+
+class modCalcEclCoords : public modCalcEclCoordsDlg {
+
+Q_OBJECT
+
+public:
+
+ modCalcEclCoords(QWidget *p, const char *n);
+ ~modCalcEclCoords();
+
+ void getEclCoords (void);
+ void getEquCoords (void);
+ double getEpoch( QString t );
+ void showEquCoords(void);
+ void showEclCoords(void);
+ void EclToEqu(void);
+ void EquToEcl(void);
+
+public slots:
+
+ void slotClearCoords (void);
+ void slotComputeCoords (void);
+ void slotEclLatCheckedBatch(void);
+ void slotEclLongCheckedBatch(void);
+ void slotRaCheckedBatch(void);
+ void slotDecCheckedBatch(void);
+ void slotEpochCheckedBatch(void);
+ void slotInputFile(void);
+ void slotOutputFile(void);
+ void slotRunBatch();
+
+private:
+ void equCheck(void);
+ void eclCheck(void);
+ void processLines( QTextStream &is );
+
+ dms eclipLong, eclipLat, raCoord, decCoord;
+ double epoch;
+ bool eclInputCoords;
+};
+#endif
+
diff --git a/kstars/kstars/tools/modcalceclipticcoordsdlg.ui b/kstars/kstars/tools/modcalceclipticcoordsdlg.ui
new file mode 100644
index 00000000..1a164a9b
--- /dev/null
+++ b/kstars/kstars/tools/modcalceclipticcoordsdlg.ui
@@ -0,0 +1,919 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>modCalcEclCoordsDlg</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>modCalcEclCoordsDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>560</width>
+ <height>409</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Geocentric Ecliptic Coordinates</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tabWidget8</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Interactive Mode</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>ButtonGroup1</cstring>
+ </property>
+ <property name="title">
+ <string>Choose Input Coordinates</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>97</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>equRadio</cstring>
+ </property>
+ <property name="text">
+ <string>Geocentric equatorial</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>96</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>eclRadio</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>TabFocus</enum>
+ </property>
+ <property name="text">
+ <string>Geocentric ecliptic</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>97</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>51</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>Compute</cstring>
+ </property>
+ <property name="text">
+ <string>Convert</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>51</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>Clear</cstring>
+ </property>
+ <property name="text">
+ <string>Clear</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>71</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout9</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>equBox</cstring>
+ </property>
+ <property name="title">
+ <string>Equatorial Coordinates</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>raBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>raLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Right ascension:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>decBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>decLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Declination:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>epochLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Epoch:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>epochName</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer31</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox7</cstring>
+ </property>
+ <property name="title">
+ <string>Ecliptic Coordinates</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>bgLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Latitude:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>lgLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Longitude:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>ecLongBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>ecLatBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer33</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>230</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>110</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Batch Mode</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>InputBox_2_2_2</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Select Fields in Input File</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>raBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>decBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>raCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Right ascension:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>If checked, value will be read from input file. If not, value will be read from adjacent box</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>decCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Declination:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>If checked, value will be read from input file. If not, value will be read from adjacent box</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="3">
+ <property name="name">
+ <cstring>eclLatBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="3">
+ <property name="name">
+ <cstring>eclLongBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>epochBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>1950.0</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="0">
+ <property name="name">
+ <cstring>epochCheckBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Epoch:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>If checked, value will be read from input file. If not, value will be read from adjacent box</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="2">
+ <property name="name">
+ <cstring>eclLongCheckBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Long.:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>If checked, value will be read from input file. If not, value will be read from adjacent box</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="2">
+ <property name="name">
+ <cstring>eclLatCheckBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Lat.:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>If checked, value will be read from input file. If not, value will be read from adjacent box</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonFieldsGroup</cstring>
+ </property>
+ <property name="title">
+ <string>Fields in Output File Plus Result</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>allRadioBatch</cstring>
+ </property>
+ <property name="text">
+ <string>All parameters</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>inputRadioBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Only parameters in input file</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupFilesBox</cstring>
+ </property>
+ <property name="title">
+ <string>Files</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton" row="0" column="0">
+ <property name="name">
+ <cstring>InputButtonBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Input File...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>File with the input data</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>InputLineEditBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>OutputLineEditBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>OutButtonBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Output File...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>File for the output data</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout22_3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer20_2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>151</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>runButtonBatch</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Run</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer19_2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>131</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer50</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>31</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>dmsBox</class>
+ <header location="global">../dmsbox.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1163">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000045249444154388d8d95bf8b1d5514c73fbb19e40cbce81d788199b8911d48304f8cf0524876316016031ab14819acfcd1f8a34ba72222fe0b369a54a216a216c158049222645f131221c10928dc852cdc0bfb600e66dc39c58558ccee6ab0c93497c3650edff339df99efc28df51bec3e9f7cfee6438b8662800086431eab2e971c5f7cf4edc26eaf851beb37b8f8fd870f67d73c6fbf759e5c0427156a0149d0621414b4b414c8bf756a013033c2a6a7f19e181b564e56bc73eec2420630bbee39ffdec7b8aac61e2861ee294460046bd309860720a8079f13e60149156a8a2000d4076a48c6ec7ae09d73b070ead5f2e199d31f50d735b66534b161b254524f6bea25a14d1b90c2300146d080ce8de68ed06ed65832cc0ceb0ceb7bda79445c4f66117211ec81e1a3677a78c299d7a6281e3fbf0c29d29a2717a14d4231ca2153a6e386b8e1f1b355821a4e84f8a0a7c81c3e06324d86938a103d93c335aba76ba2cdb8152f42f2f83f1c39397d6a29b21cad846a6ca841b9acf45ca5bd721cd516b26127206464825aa05eaa583b3d41d33ab736bfc4d4b87d6d421b6b2c2992392c296e24544703d395801ad44b861e0d70b326a67687b9b148322401fb0dc3f37bfc0e9d1b572f4d089b15660a0866caea4b42b1dcd2dcac985daf910c34c1e458c0b21d97240320739960c0f1e74b7c77154b8166564357018ac8a0f4ccd9299313400afc8427dc9de0ca96fa88a2c9a88f2ab7b784227328b0a8c910725a3ca4488c10361e557ae69515565f9e528843cd58391d319478b7460d9c808c5b4068d3f0de229960f4149283192e1b188938c0583d3165edd4142742df298231fbd5e170f4095cc6c0fac880808cff30065a0bc8c86129df533a3d5a72eaec041941d006231034d0ce0bd4142c27ce0527a0dd4ee3341c8bbb8c498225a17413c0a80f3bd6ce55146284ee369622da790a27ac9d6da99604b29eb21cac276998b0c8dc207c97b1760dce0123a84b21a8a2ea310b80e2e781ca419f846a5c307d2360731d186730bb93ff9f714b4b1b05eb22c508ea9516498e1fbf51426cb87ca965fd879ae61ee41458eaa91cc838ec3116dc238c33924182e68e21638f594fb90cc7cf7ad67f7e8e9fbe2e201348cafaa58a76ab657a32a21a061f9b8139fc9ff208e37d470ebacfea675f80edfdc46dcf812ad26d1ba39171a0dec289903f39a77a26b1df751caa3bd2e2fd9da6e0b20cb5c4f8a0b1713707cbe8d27c601c36fdb0c0cde1d737990e9fab1b194c1b6a618fe530f6e002c964cfc7fdfec8f214665706d6fb8ebd587ef6f75f89d1be02ddeeb058717f13aaa7c09e30dc13a0db0ca78164d019d8d698e66ec1a1a73b4207767fcc9ff772547bc6e36c489077df7ffd6139aec9c541b21da64679c428c62de531831e72c06f086d2c885e2009e524522df534bf41b80f3a572e7cf5cb90202b272b66d7036e6414385a8664686e4341cdfa15ddcbc5dd7b3048463f733402a41eed947ad9fd9b79ff0dd3b8a97b8ac976b6fc187559c2179ffeb817a6ff006d91847a48e5abd70000000049454e44ae426082</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>Compute</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcEclCoordsDlg</receiver>
+ <slot>slotComputeCoords()</slot>
+ </connection>
+ <connection>
+ <sender>Clear</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcEclCoordsDlg</receiver>
+ <slot>slotClearCoords()</slot>
+ </connection>
+ <connection>
+ <sender>eclLatCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcEclCoordsDlg</receiver>
+ <slot>slotEclLatCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>eclLongCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcEclCoordsDlg</receiver>
+ <slot>slotEclLongCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>epochCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcEclCoordsDlg</receiver>
+ <slot>slotEpochCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>raCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcEclCoordsDlg</receiver>
+ <slot>slotRaCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>decCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcEclCoordsDlg</receiver>
+ <slot>slotDecCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>runButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcEclCoordsDlg</receiver>
+ <slot>slotRunBatch()</slot>
+ </connection>
+ <connection>
+ <sender>InputButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcEclCoordsDlg</receiver>
+ <slot>slotInputFile()</slot>
+ </connection>
+ <connection>
+ <sender>OutButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcEclCoordsDlg</receiver>
+ <slot>slotOutputFile()</slot>
+ </connection>
+</connections>
+<slots>
+ <slot>slotComputeCoords()</slot>
+ <slot>slotClearCoords()</slot>
+ <slot>slotEclLatCheckedBatch()</slot>
+ <slot>slotEclLongCheckedBatch()</slot>
+ <slot>slotRaCheckedBatch()</slot>
+ <slot>slotDecCheckedBatch()</slot>
+ <slot>slotEpochCheckedBatch()</slot>
+ <slot>slotInputFile()</slot>
+ <slot>slotOutputFile()</slot>
+ <slot>slotRunBatch()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/modcalcequinox.cpp b/kstars/kstars/tools/modcalcequinox.cpp
new file mode 100644
index 00000000..01d89447
--- /dev/null
+++ b/kstars/kstars/tools/modcalcequinox.cpp
@@ -0,0 +1,223 @@
+/***************************************************************************
+ modcalcequinox.cpp - description
+ -------------------
+ begin : dom apr 18 2002
+ copyright : (C) 2004 by Pablo de Vicente
+ email : p.devicentea@wanadoo.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+#include "modcalcequinox.h"
+
+#include "modcalcequinox.moc"
+#include "dms.h"
+#include "dmsbox.h"
+#include "kstars.h"
+#include "kstarsdata.h"
+#include "kstarsdatetime.h"
+#include "kssun.h"
+#include "libkdeedu/extdate/extdatetimeedit.h"
+
+#include <qcombobox.h>
+#include <qstring.h>
+#include <qtextstream.h>
+#include <kfiledialog.h>
+#include <kmessagebox.h>
+#include <qcheckbox.h>
+#include <qradiobutton.h>
+
+modCalcEquinox::modCalcEquinox(QWidget *parentSplit, const char *name)
+ : modCalcEquinoxDlg (parentSplit,name) {
+ showCurrentYear();
+ show();
+}
+
+modCalcEquinox::~modCalcEquinox(){
+}
+
+int modCalcEquinox::getYear (QString eName)
+{
+ bool ok = FALSE;
+ int equinoxYear = eName.toInt(&ok);
+ if ( ok )
+ return equinoxYear;
+ else {
+ kdDebug() << i18n( "Could not parse epoch string; assuming J2000" ) << endl;
+ return 2000;
+ }
+}
+
+void modCalcEquinox::showCurrentYear (void)
+{
+ KStarsDateTime dt( KStarsDateTime::currentDateTime() );
+ yearEdit->setText( QString( "%1").arg( dt.date().year() ) );
+}
+
+void modCalcEquinox::slotComputeEquinoxesAndSolstices (void)
+{
+ long double julianDay = 0., jdf = 0.;
+ float deltaJd;
+ KStarsData *kd = (KStarsData*) parent()->parent()->parent();
+ KSSun *Sun = new KSSun(kd);
+ int year0 = getYear( yearEdit->text() );
+
+ if (equinoxSolsticesComboBox->currentItem() == 0 ) {
+ julianDay = Sun->springEquinox(year0);
+ jdf = Sun->summerSolstice(year0);
+ }
+ else if(equinoxSolsticesComboBox->currentItem() == 1) {
+ julianDay = Sun->summerSolstice(year0);
+ jdf = Sun->autumnEquinox(year0);
+ }
+ else if (equinoxSolsticesComboBox->currentItem() == 2 ) {
+ julianDay = Sun->autumnEquinox(year0);
+ jdf = Sun->winterSolstice(year0);
+ }
+ else if(equinoxSolsticesComboBox->currentItem() == 3) {
+ julianDay = Sun->winterSolstice(year0);
+ jdf = Sun->springEquinox(year0+1);
+ }
+
+ deltaJd = (float) (jdf - julianDay);
+ showStartDateTime(julianDay);
+ showSeasonDuration(deltaJd);
+
+}
+
+void modCalcEquinox::slotClear(void){
+ yearEdit->setText("");
+ seasonDuration->setText("");
+}
+
+void modCalcEquinox::showStartDateTime(long double jd)
+{
+ KStarsDateTime dt( jd );
+ startDateTimeEquinox->setDateTime( dt );
+}
+
+void modCalcEquinox::showSeasonDuration(float deltaJd)
+{
+ seasonDuration->setText( QString( "%1").arg( deltaJd ) );
+}
+
+void modCalcEquinox::slotYearCheckedBatch(){
+ if ( yearCheckBatch->isChecked() )
+ yearCheckBatch->setEnabled( false );
+ else {
+ yearCheckBatch->setEnabled( true );
+ }
+}
+
+void modCalcEquinox::slotInputFile() {
+ QString inputFileName;
+ inputFileName = KFileDialog::getOpenFileName( );
+ InputLineEditBatch->setText( inputFileName );
+}
+
+void modCalcEquinox::slotOutputFile() {
+ QString outputFileName;
+ outputFileName = KFileDialog::getSaveFileName( );
+ OutputLineEditBatch->setText( outputFileName );
+}
+
+void modCalcEquinox::slotRunBatch() {
+
+ QString inputFileName;
+
+ inputFileName = InputLineEditBatch->text();
+
+ // We open the input file and read its content
+
+ if ( QFile::exists(inputFileName) ) {
+ QFile f( inputFileName );
+ if ( !f.open( IO_ReadOnly) ) {
+ QString message = i18n( "Could not open file %1.").arg( f.name() );
+ KMessageBox::sorry( 0, message, i18n( "Could Not Open File" ) );
+ inputFileName = "";
+ return;
+ }
+
+// processLines(&f);
+ QTextStream istream(&f);
+ processLines(istream);
+// readFile( istream );
+ f.close();
+ } else {
+ QString message = i18n( "Invalid file: %1" ).arg( inputFileName );
+ KMessageBox::sorry( 0, message, i18n( "Invalid file" ) );
+ inputFileName = "";
+ InputLineEditBatch->setText( inputFileName );
+ return;
+ }
+}
+
+void modCalcEquinox::processLines( QTextStream &istream ) {
+
+ // we open the output file
+
+// QTextStream istream(&fIn);
+ QString outputFileName;
+ outputFileName = OutputLineEditBatch->text();
+ QFile fOut( outputFileName );
+ fOut.open(IO_WriteOnly);
+ QTextStream ostream(&fOut);
+
+ QString line;
+ QString space = " ";
+ int yearB;
+ int i = 0;
+ long double jdsp = 0., jdsu = 0., jdau = 0., jdwin = 0., jdsp1 = 0.;
+ KStarsData *kd = (KStarsData*) parent()->parent()->parent();
+ KSSun *Sun = new KSSun(kd);
+
+ while ( ! istream.eof() ) {
+ line = istream.readLine();
+ line.stripWhiteSpace();
+
+ //Go through the line, looking for parameters
+
+ QStringList fields = QStringList::split( " ", line );
+
+ i = 0;
+
+ // Read year and write in ostream if corresponds
+
+ if(yearCheckBatch->isChecked() ) {
+ yearB = fields[i].toInt();
+ i++;
+ } else
+ yearB = yearEditBatch->text().toInt();
+
+ if ( allRadioBatch->isChecked() )
+ ostream << yearB << space;
+ else
+ if(yearCheckBatch->isChecked() )
+ ostream << yearB << space;
+
+ jdsp = Sun->springEquinox(yearB);
+ jdsu = Sun->summerSolstice(yearB);
+ jdau = Sun->autumnEquinox(yearB);
+ jdwin = Sun->winterSolstice(yearB);
+ jdsp1 = Sun->springEquinox(yearB+1);
+
+ KStarsDateTime dts( jdsp );
+ KStarsDateTime dtu( jdsu );
+ KStarsDateTime dta( jdau );
+ KStarsDateTime dtw( jdwin );
+
+ ostream << dts.toString(Qt::ISODate) << space << (float)(jdsu - jdsp) << space
+ << dtu.toString(Qt::ISODate) << space << (float)(jdau - jdsu) << space
+ << dta.toString(Qt::ISODate) << space << (float)(jdwin - jdau) << space
+ << dtw.toString(Qt::ISODate) << space << (float)(jdsp1 - jdwin) << endl;
+ }
+
+
+ fOut.close();
+}
diff --git a/kstars/kstars/tools/modcalcequinox.h b/kstars/kstars/tools/modcalcequinox.h
new file mode 100644
index 00000000..25645202
--- /dev/null
+++ b/kstars/kstars/tools/modcalcequinox.h
@@ -0,0 +1,59 @@
+/***************************************************************************
+ modcalcazel.h - description
+ -------------------
+ begin : mier abr 20 2004
+ copyright : (C) 2004 by Pablo de Vicente
+ email : pvicentea@wanadoo.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 MODCALCEQUINOX_H
+#define MODCALCEQUINOX_H
+
+#include <kapplication.h>
+#include <qwidget.h>
+#include "modcalcequinoxdlg.h"
+
+class QWidget;
+class QTextStream;
+
+/**
+ *@author Pablo de Vicente
+ */
+
+class modCalcEquinox : public modCalcEquinoxDlg {
+
+Q_OBJECT
+
+public:
+ modCalcEquinox(QWidget *p, const char *n);
+ ~modCalcEquinox();
+
+public slots:
+
+ void slotComputeEquinoxesAndSolstices(void);
+ void slotClear(void);
+ void slotYearCheckedBatch();
+ void slotInputFile();
+ void slotOutputFile();
+ void slotRunBatch();
+
+private:
+
+ int getYear (QString eName);
+ void showCurrentYear (void);
+ void showStartDateTime(long double jd);
+ void showSeasonDuration(float deltaJd);
+ void processLines( QTextStream &istream );
+
+};
+
+#endif
diff --git a/kstars/kstars/tools/modcalcequinoxdlg.ui b/kstars/kstars/tools/modcalcequinoxdlg.ui
new file mode 100644
index 00000000..025802ba
--- /dev/null
+++ b/kstars/kstars/tools/modcalcequinoxdlg.ui
@@ -0,0 +1,574 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>modCalcEquinoxDlg</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>modCalcEquinoxDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>459</width>
+ <height>477</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Equinoxes, Solstices &amp; Seasons</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tabWidget3</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Interactive Mode</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox6</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>GroupBoxPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="title">
+ <string>Select Input</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer20_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>70</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QComboBox">
+ <item>
+ <property name="text">
+ <string>Spring Equinox</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Summer Solstice</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Autumn Equinox</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Winter Solstice</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>equinoxSolsticesComboBox</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer20</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Year:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>yearEdit</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer19</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>30</width>
+ <height>31</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>81</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>Compute</cstring>
+ </property>
+ <property name="text">
+ <string>Compute</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>51</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>Clear</cstring>
+ </property>
+ <property name="text">
+ <string>Clear</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>91</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox7</cstring>
+ </property>
+ <property name="title">
+ <string>Season Information</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit" row="1" column="2">
+ <property name="name">
+ <cstring>seasonDuration</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Duration of the season:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Start date &amp; time:</string>
+ </property>
+ </widget>
+ <widget class="ExtDateTimeEdit" row="0" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>startDateTimeEquinox</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer22</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>41</width>
+ <height>237</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Batch Mode</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>InputBox_2_2</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Select Fields in Input File</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>yearCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Year:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer23</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>111</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>yearEditBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonFieldsGroup</cstring>
+ </property>
+ <property name="title">
+ <string>Fields in Output File Plus Result</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>allRadioBatch</cstring>
+ </property>
+ <property name="text">
+ <string>All parameters</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>inputRadioBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Only parameters in input file</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupFilesBox</cstring>
+ </property>
+ <property name="title">
+ <string>Files</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton" row="0" column="0">
+ <property name="name">
+ <cstring>InputButtonBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Input File...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>File with the input data</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>InputLineEditBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>OutputLineEditBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>OutButtonBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Output File...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>File for the output data</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout22</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer20_2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>151</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>runButtonBatch</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Run</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer19_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>131</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer27</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>41</width>
+ <height>71</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>ExtDateTimeEdit</class>
+ <header location="local">libkdeedu/extdate/extdatetimeedit.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1002">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000003b149444154388dad945f4c5b551cc73fe7dc4b7b4bcba0762d45c43114323599ee6192609c51d883892ce083f1718b3ebb185f8dc91e972cf39d2d2a2f1af664b6f1e0fe3863a0718969700eb0c52142da0242a1bd6d696f7bcff101585203ceb8fd9ece39f99dcff9fe7edf939f88c562ec465f5f9fe609442c161362173c3e3eae7b7a7ac8e7f36432196cdbfe4f907c3e4f2291201e8fe338cec3737357e9e8e828aded1e229d650e1f2d51754b082110124c13a4dc5ea341eb9dc284c0558a853f3ce8cb0677ef500fde7d39d2596679e326597b8e9abb85d7a770ab16ab6983ec5a05b487a70e36f0f4e10afe408d6a558310980108478dba4a1e8233990c5d474b64ed39aa3a8fe5f3317fbf81dbd70bccfeb205947632fd74f6589c1c6ea2f70d03a58ba0c1f2c9bdc1b66de3b8256a6e11cbe7e3ee1d181b590124fe2693aeee08d223c82c3a2c24b7b874bec8f26288774f7bd054504aef0dde6e99c0eb83f9fb266323cb80a27fb0958141836044605a2ee5523393371cc646fee2da37195aa35d0c0c5b4859ac03d7e91712dcaac5adab3650a3ff9d08ef7dd8404bb48869e5d958b5b87dadc4c9a1464e9f0d0326df7ebd86bd2e310cb1bf62d384d59441f2d70a070e1c60e09489929b988681bdd9cc97170bcc4c65595f71f8e0e3301337fc24a7732467831875a47f289652b0be5e4151e6d07316c1b0c0340d8ab92023e76d66a6b2840e36d2fb7a13fee632475e6edc367ea98a90fb98b7dd6310ca0328a44761582e1bab41befabcc0ec940d28bc5e93b68e064cab84e1d9beaeb48934eac1f53b01c1b000fca496aa54b61a99fcde61662a4b4b4b23d1680be9d426173e4df3602a48ea411989a4fd590f52a8fd156b05ed9d350e3defe3cfdf4b4c7ce770ea7d3fb9f520afbe1620daeee5c26735d20b9b9cfb6811a754a439e4e5c5639a4caa1e5caf586bfc0197b78702005cb9b4cae4cd3267ce8638fe964bd72b393e39d74928d242617303a756a37f284447770dcdbffc6384a05a85de1306e9a52057c7527c7131c3c42d3f475eb2303c82d4fc3276d6811db37efeb148723082d9b08f79f97c1e5729109a9a28307cc622d2d6cdf52b2b24efe548dedb00142009862cfa879ee1a71f6cec928353511472fbf4389148b0b0e0c108081412458dfe21c9f11351e67e7358595468246d1d1e5e38a6e9e851bc39d84ab502a669331dafec0d8ec7e3e8cb06e1a881d727d1ae40180a434a8c9db129a54126ad48a7358c2b4c5352c8c374bcccdab2bb37d8719cba79fab8211f9df218e0582c261e95f8bfc04f1a1e8bc5c4dfe0a190172af6a9690000000049454e44ae426082</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>Compute</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcEquinoxDlg</receiver>
+ <slot>slotComputeEquinoxesAndSolstices()</slot>
+ </connection>
+ <connection>
+ <sender>InputButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcEquinoxDlg</receiver>
+ <slot>slotInputFile()</slot>
+ </connection>
+ <connection>
+ <sender>OutButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcEquinoxDlg</receiver>
+ <slot>slotOutputFile()</slot>
+ </connection>
+ <connection>
+ <sender>runButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcEquinoxDlg</receiver>
+ <slot>slotRunBatch()</slot>
+ </connection>
+</connections>
+<slots>
+ <slot>slotComputeEquinoxesAndSolstices()</slot>
+ <slot>slotInputFile()</slot>
+ <slot>slotOutputFile()</slot>
+ <slot>slotRunBatch()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/modcalcgalcoord.cpp b/kstars/kstars/tools/modcalcgalcoord.cpp
new file mode 100644
index 00000000..0ec896db
--- /dev/null
+++ b/kstars/kstars/tools/modcalcgalcoord.cpp
@@ -0,0 +1,371 @@
+/***************************************************************************
+ modcalcgal.cpp - description
+ -------------------
+ begin : Thu Jan 17 2002
+ copyright : (C) 2002 by Pablo de Vicente
+ email : vicente@oan.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "dms.h"
+#include "dmsbox.h"
+#include "skypoint.h"
+#include "modcalcgalcoord.h"
+#include "modcalcgalcoord.moc"
+#include "kstarsdatetime.h"
+
+#include <qradiobutton.h>
+#include <qstring.h>
+#include <qcheckbox.h>
+#include <qradiobutton.h>
+#include <qtextstream.h>
+#include <klocale.h>
+#include <klineedit.h>
+#include <kapplication.h>
+#include <kfiledialog.h>
+#include <kmessagebox.h>
+
+
+modCalcGalCoord::modCalcGalCoord(QWidget *parentSplit, const char *name) : modCalcGalCoordDlg(parentSplit,name) {
+
+ equRadio->setChecked(TRUE);
+ raBox->setDegType(FALSE);
+ show();
+}
+
+modCalcGalCoord::~modCalcGalCoord() {
+}
+
+void modCalcGalCoord::getGalCoords (void) {
+
+ galLong = lgBox->createDms();
+ galLat = bgBox->createDms();
+ epoch = getEpoch( epochName->text() );
+}
+
+void modCalcGalCoord::getEquCoords (void) {
+
+ raCoord = raBox->createDms(FALSE);
+ decCoord = decBox->createDms();
+ epoch = getEpoch( epochName->text() );
+}
+
+double modCalcGalCoord::getEpoch (QString eName) {
+
+ double epoch = eName.toDouble();
+
+ return epoch;
+}
+
+void modCalcGalCoord::slotClearCoords (void) {
+
+ raBox->clearFields();
+ decBox->clearFields();
+ lgBox->clearFields();
+ bgBox->clearFields();
+
+}
+
+void modCalcGalCoord::slotComputeCoords (void) {
+
+ if(galRadio->isChecked()) {
+ getGalCoords();
+// checkEpoch();
+ GalToEqu();
+ showEquCoords();
+ } else {
+ getEquCoords();
+// checkEpoch();
+ EquToGal();
+ showGalCoords();
+ }
+
+}
+
+void modCalcGalCoord::showEquCoords(void) {
+ raBox->show( raCoord , FALSE);
+ decBox->show( decCoord );
+}
+
+void modCalcGalCoord::showGalCoords(void) {
+ lgBox->show( galLong );
+ bgBox->show( galLat );
+}
+
+void modCalcGalCoord::GalToEqu(void) {
+
+ SkyPoint sp = SkyPoint();
+
+ sp.GalacticToEquatorial1950(&galLong, &galLat);
+ sp.set(*sp.ra(), *sp.dec() );
+
+ KStarsDateTime dt;
+ dt.setFromEpoch( epoch );
+ long double jdf = dt.djd();
+ sp.precessFromAnyEpoch(B1950,jdf);
+
+ raCoord.set( *sp.ra() );
+ decCoord.set( *sp.dec() );
+}
+
+void modCalcGalCoord::EquToGal(void) {
+
+ SkyPoint sp = SkyPoint (raCoord, decCoord);
+
+ KStarsDateTime dt;
+ dt.setFromEpoch( epoch );
+ long double jd0 = dt.djd();
+ sp.precessFromAnyEpoch(jd0,B1950);
+
+ sp.Equatorial1950ToGalactic(galLong, galLat);
+
+}
+
+void modCalcGalCoord::galCheck() {
+
+ galLatCheckBatch->setChecked(false);
+ galLatBoxBatch->setEnabled(false);
+ galLongCheckBatch->setChecked(false);
+ galLongBoxBatch->setEnabled(false);
+ galInputCoords = FALSE;
+
+}
+
+void modCalcGalCoord::equCheck() {
+
+ raCheckBatch->setChecked(false);
+ raBoxBatch->setEnabled(false);
+ decCheckBatch->setChecked(false);
+ decBoxBatch->setEnabled(false);
+ epochCheckBatch->setChecked(false);
+ galInputCoords = TRUE;
+
+}
+
+void modCalcGalCoord::slotRaCheckedBatch(){
+
+ if ( raCheckBatch->isChecked() ) {
+ raBoxBatch->setEnabled( false );
+ galCheck();
+ } else {
+ raBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcGalCoord::slotDecCheckedBatch(){
+
+ if ( decCheckBatch->isChecked() ) {
+ decBoxBatch->setEnabled( false );
+ galCheck();
+ } else {
+ decBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcGalCoord::slotEpochCheckedBatch(){
+
+ epochCheckBatch->setChecked(false);
+
+ if ( epochCheckBatch->isChecked() ) {
+ epochBoxBatch->setEnabled( false );
+ galCheck();
+ } else {
+ epochBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcGalCoord::slotGalLatCheckedBatch(){
+
+ if ( galLatCheckBatch->isChecked() ) {
+ galLatBoxBatch->setEnabled( false );
+ equCheck();
+ } else {
+ galLatBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcGalCoord::slotGalLongCheckedBatch(){
+
+ if ( galLongCheckBatch->isChecked() ) {
+ galLongBoxBatch->setEnabled( false );
+ equCheck();
+ } else {
+ galLongBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcGalCoord::slotInputFile() {
+ QString inputFileName;
+ inputFileName = KFileDialog::getOpenFileName( );
+ InputLineEditBatch->setText( inputFileName );
+}
+
+void modCalcGalCoord::slotOutputFile() {
+ QString outputFileName;
+ outputFileName = KFileDialog::getSaveFileName( );
+ OutputLineEditBatch->setText( outputFileName );
+}
+
+void modCalcGalCoord::slotRunBatch() {
+
+ QString inputFileName;
+
+ inputFileName = InputLineEditBatch->text();
+
+ // We open the input file and read its content
+
+ if ( QFile::exists(inputFileName) ) {
+ QFile f( inputFileName );
+ if ( !f.open( IO_ReadOnly) ) {
+ QString message = i18n( "Could not open file %1.").arg( f.name() );
+ KMessageBox::sorry( 0, message, i18n( "Could Not Open File" ) );
+ inputFileName = "";
+ return;
+ }
+
+// processLines(&f);
+ QTextStream istream(&f);
+ processLines(istream);
+// readFile( istream );
+ f.close();
+ } else {
+ QString message = i18n( "Invalid file: %1" ).arg( inputFileName );
+ KMessageBox::sorry( 0, message, i18n( "Invalid file" ) );
+ inputFileName = "";
+ InputLineEditBatch->setText( inputFileName );
+ return;
+ }
+}
+
+void modCalcGalCoord::processLines( QTextStream &istream ) {
+
+ // we open the output file
+
+// QTextStream istream(&fIn);
+ QString outputFileName;
+ outputFileName = OutputLineEditBatch->text();
+ QFile fOut( outputFileName );
+ fOut.open(IO_WriteOnly);
+ QTextStream ostream(&fOut);
+
+ QString line;
+ QString space = " ";
+ int i = 0;
+ SkyPoint sp;
+ dms raB, decB, galLatB, galLongB;
+ double epoch0B(0.0);
+ KStarsDateTime dt;
+
+ while ( ! istream.eof() ) {
+ line = istream.readLine();
+ line.stripWhiteSpace();
+
+ //Go through the line, looking for parameters
+
+ QStringList fields = QStringList::split( " ", line );
+
+ i = 0;
+
+ // Input coords are galactic coordinates:
+
+ if (galInputCoords) {
+
+ // Read Galactic Longitude and write in ostream if corresponds
+
+ if(galLongCheckBatch->isChecked() ) {
+ galLongB = dms::fromString( fields[i], TRUE);
+ i++;
+ } else
+ galLongB = galLongBoxBatch->createDms(TRUE);
+
+ if ( allRadioBatch->isChecked() )
+ ostream << galLongB.toDMSString() << space;
+ else
+ if(galLongCheckBatch->isChecked() )
+ ostream << galLongB.toDMSString() << space;
+
+ // Read Galactic Latitude and write in ostream if corresponds
+
+ if(galLatCheckBatch->isChecked() ) {
+ galLatB = dms::fromString( fields[i], TRUE);
+ i++;
+ } else
+ galLatB = galLatBoxBatch->createDms(TRUE);
+
+ if ( allRadioBatch->isChecked() )
+ ostream << galLatB.toDMSString() << space;
+ else
+ if(galLatCheckBatch->isChecked() )
+ ostream << galLatB.toDMSString() << space;
+
+ sp = SkyPoint ();
+ sp.GalacticToEquatorial1950(&galLongB, &galLatB);
+ ostream << sp.ra()->toHMSString() << space << sp.dec()->toDMSString() << epoch0B << endl;
+ // Input coords. are equatorial coordinates:
+
+ } else {
+
+ // Read RA and write in ostream if corresponds
+
+ if(raCheckBatch->isChecked() ) {
+ raB = dms::fromString( fields[i],FALSE);
+ i++;
+ } else
+ raB = raBoxBatch->createDms(FALSE);
+
+ if ( allRadioBatch->isChecked() )
+ ostream << raB.toHMSString() << space;
+ else
+ if(raCheckBatch->isChecked() )
+ ostream << raB.toHMSString() << space;
+
+ // Read DEC and write in ostream if corresponds
+
+ if(decCheckBatch->isChecked() ) {
+ decB = dms::fromString( fields[i], TRUE);
+ i++;
+ } else
+ decB = decBoxBatch->createDms();
+
+ if ( allRadioBatch->isChecked() )
+ ostream << decB.toDMSString() << space;
+ else
+ if(decCheckBatch->isChecked() )
+ ostream << decB.toDMSString() << space;
+
+ // Read Epoch and write in ostream if corresponds
+
+ if(epochCheckBatch->isChecked() ) {
+ epoch0B = fields[i].toDouble();
+ i++;
+ } else
+ epoch0B = getEpoch( epochBoxBatch->text() );
+
+ if ( allRadioBatch->isChecked() )
+ ostream << epoch0B << space;
+ else
+ if(epochCheckBatch->isChecked() )
+ ostream << epoch0B << space;
+
+ sp = SkyPoint (raB, decB);
+ dt.setFromEpoch( epoch0B );
+ long double jdf = dt.djd();
+ sp.precessFromAnyEpoch(B1950,jdf);
+ sp.Equatorial1950ToGalactic(galLongB, galLatB);
+ ostream << galLongB.toDMSString() << space << galLatB.toDMSString() << endl;
+
+ }
+
+ }
+
+
+ fOut.close();
+}
diff --git a/kstars/kstars/tools/modcalcgalcoord.h b/kstars/kstars/tools/modcalcgalcoord.h
new file mode 100644
index 00000000..94acd572
--- /dev/null
+++ b/kstars/kstars/tools/modcalcgalcoord.h
@@ -0,0 +1,76 @@
+/***************************************************************************
+ modcalcgal.h - description
+ -------------------
+ begin : Thu Jan 17 2002
+ copyright : (C) 2002 by Pablo de Vicente
+ email : vicente@oan.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 MODCALCGALCOORD_H
+#define MODCALCGALCOORD_H
+
+#include "dms.h"
+#include "modcalcgalcoorddlg.h"
+
+/**
+ * Class which implements the KStars calculator module to compute
+ * Galactic coordinates to/from Equatorial coordinates.
+ *
+ * Inherits QWidget
+ *@author Pablo de Vicente
+ *@version 0.9
+ */
+
+class modCalcGalCoord : public modCalcGalCoordDlg {
+
+Q_OBJECT
+
+public:
+
+ modCalcGalCoord(QWidget *p, const char *n);
+ ~modCalcGalCoord();
+ /**
+ * Obtains the galactic coords. from the Box.
+ */
+ void getGalCoords (void);
+ void getEquCoords (void);
+ void getEpoch (void);
+ double getEpoch( QString t );
+ void showEquCoords(void);
+ void showGalCoords(void);
+ void GalToEqu(void);
+ void EquToGal(void);
+
+public slots:
+
+ void slotClearCoords (void);
+ void slotComputeCoords (void);
+ void slotGalLatCheckedBatch(void);
+ void slotGalLongCheckedBatch(void);
+ void slotRaCheckedBatch(void);
+ void slotDecCheckedBatch(void);
+ void slotEpochCheckedBatch(void);
+ void slotInputFile(void);
+ void slotOutputFile(void);
+ void slotRunBatch();
+
+private:
+ void equCheck(void);
+ void galCheck(void);
+ void processLines( QTextStream &is );
+
+ dms galLong, galLat, raCoord, decCoord;
+ double epoch;
+ bool galInputCoords;
+};
+#endif
+
diff --git a/kstars/kstars/tools/modcalcgalcoorddlg.ui b/kstars/kstars/tools/modcalcgalcoorddlg.ui
new file mode 100644
index 00000000..dfb59183
--- /dev/null
+++ b/kstars/kstars/tools/modcalcgalcoorddlg.ui
@@ -0,0 +1,930 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>modCalcGalCoordDlg</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>modCalcGalCoordDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>549</width>
+ <height>409</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Galactic Coordinates</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tabWidget8</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Interactive Mode</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>ButtonGroup1</cstring>
+ </property>
+ <property name="title">
+ <string>Choose Input Coordinates</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>97</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>equRadio</cstring>
+ </property>
+ <property name="text">
+ <string>Equatorial</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>96</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>galRadio</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>TabFocus</enum>
+ </property>
+ <property name="text">
+ <string>Galactic</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>97</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>51</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>Compute</cstring>
+ </property>
+ <property name="text">
+ <string>Convert</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>51</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>Clear</cstring>
+ </property>
+ <property name="text">
+ <string>Clear</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>71</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout22</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>equBox</cstring>
+ </property>
+ <property name="title">
+ <string>Equatorial Coordinates</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>raBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>raLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Right ascension:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>decBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>epochLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Epoch:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>decLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Declination:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>epochName</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer31</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>15</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox7</cstring>
+ </property>
+ <property name="title">
+ <string>Galactic Coordinates</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>bgLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Latitude:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>lgLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Longitude:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>lgBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>bgBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>160</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Batch Mode</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>InputBox_2_2_2</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Select Fields in Input File</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>raBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>decBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>epochBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>1950.0</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>raCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Right ascension:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>If checked, value will be read from input file. If not, value will be read from adjacent box</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>decCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Declination:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>If checked, value will be read from input file. If not, value will be read from adjacent box</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="0">
+ <property name="name">
+ <cstring>epochCheckBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Epoch:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>If checked, value will be read from input file. If not, value will be read from adjacent box</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="2">
+ <property name="name">
+ <cstring>galLongCheckBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Gal. long.:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>If checked, value will be read from input file. If not, value will be read from adjacent box</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="2">
+ <property name="name">
+ <cstring>galLatCheckBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Gal. lat.:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>If checked, value will be read from input file. If not, value will be read from adjacent box</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="3">
+ <property name="name">
+ <cstring>galLatBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="3">
+ <property name="name">
+ <cstring>galLongBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonFieldsGroup</cstring>
+ </property>
+ <property name="title">
+ <string>Fields in Output File Plus Result</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>allRadioBatch</cstring>
+ </property>
+ <property name="text">
+ <string>All parameters</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>inputRadioBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Only parameters in input file</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupFilesBox</cstring>
+ </property>
+ <property name="title">
+ <string>Files</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton" row="0" column="0">
+ <property name="name">
+ <cstring>InputButtonBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Input File...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>File with the input data</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>InputLineEditBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>OutputLineEditBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>OutButtonBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Output File...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>File for the output data</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout22_3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer20_2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>151</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>runButtonBatch</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Run</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer19_2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>131</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer50</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>31</width>
+ <height>71</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>dmsBox</class>
+ <header location="global">../dmsbox.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1163">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000045249444154388d8d95bf8b1d5514c73fbb19e40cbce81d788199b8911d48304f8cf0524876316016031ab14819acfcd1f8a34ba72222fe0b369a54a216a216c158049222645f131221c10928dc852cdc0bfb600e66dc39c58558ccee6ab0c93497c3650edff339df99efc28df51bec3e9f7cfee6438b8662800086431eab2e971c5f7cf4edc26eaf851beb37b8f8fd870f67d73c6fbf759e5c0427156a0149d0621414b4b414c8bf756a013033c2a6a7f19e181b564e56bc73eec2420630bbee39ffdec7b8aac61e2861ee294460046bd309860720a8079f13e60149156a8a2000d4076a48c6ec7ae09d73b070ead5f2e199d31f50d735b66534b161b254524f6bea25a14d1b90c2300146d080ce8de68ed06ed65832cc0ceb0ceb7bda79445c4f66117211ec81e1a3677a78c299d7a6281e3fbf0c29d29a2717a14d4231ca2153a6e386b8e1f1b355821a4e84f8a0a7c81c3e06324d86938a103d93c335aba76ba2cdb8152f42f2f83f1c39397d6a29b21cad846a6ca841b9acf45ca5bd721cd516b26127206464825aa05eaa583b3d41d33ab736bfc4d4b87d6d421b6b2c2992392c296e24544703d395801ad44b861e0d70b326a67687b9b148322401fb0dc3f37bfc0e9d1b572f4d089b15660a0866caea4b42b1dcd2dcac985daf910c34c1e458c0b21d97240320739960c0f1e74b7c77154b8166564357018ac8a0f4ccd9299313400afc8427dc9de0ca96fa88a2c9a88f2ab7b784227328b0a8c910725a3ca4488c10361e557ae69515565f9e528843cd58391d319478b7460d9c808c5b4068d3f0de229960f4149283192e1b188938c0583d3165edd4142742df298231fbd5e170f4095cc6c0fac880808cff30065a0bc8c86129df533a3d5a72eaec041941d006231034d0ce0bd4142c27ce0527a0dd4ee3341c8bbb8c498225a17413c0a80f3bd6ce55146284ee369622da790a27ac9d6da99604b29eb21cac276998b0c8dc207c97b1760dce0123a84b21a8a2ea310b80e2e781ca419f846a5c307d2360731d186730bb93ff9f714b4b1b05eb22c508ea9516498e1fbf51426cb87ca965fd879ae61ee41458eaa91cc838ec3116dc238c33924182e68e21638f594fb90cc7cf7ad67f7e8e9fbe2e201348cafaa58a76ab657a32a21a061f9b8139fc9ff208e37d470ebacfea675f80edfdc46dcf812ad26d1ba39171a0dec289903f39a77a26b1df751caa3bd2e2fd9da6e0b20cb5c4f8a0b1713707cbe8d27c601c36fdb0c0cde1d737990e9fab1b194c1b6a618fe530f6e002c964cfc7fdfec8f214665706d6fb8ebd587ef6f75f89d1be02ddeeb058717f13aaa7c09e30dc13a0db0ca78164d019d8d698e66ec1a1a73b4207767fcc9ff772547bc6e36c489077df7ffd6139aec9c541b21da64679c428c62de531831e72c06f086d2c885e2009e524522df534bf41b80f3a572e7cf5cb90202b272b66d7036e6414385a8664686e4341cdfa15ddcbc5dd7b3048463f733402a41eed947ad9fd9b79ff0dd3b8a97b8ac976b6fc187559c2179ffeb817a6ff006d91847a48e5abd70000000049454e44ae426082</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>Clear</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcGalCoordDlg</receiver>
+ <slot>slotClearCoords()</slot>
+ </connection>
+ <connection>
+ <sender>Compute</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcGalCoordDlg</receiver>
+ <slot>slotComputeCoords()</slot>
+ </connection>
+ <connection>
+ <sender>decCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcGalCoordDlg</receiver>
+ <slot>slotDecCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>raCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcGalCoordDlg</receiver>
+ <slot>slotRaCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>epochCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcGalCoordDlg</receiver>
+ <slot>slotEpochCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>galLongCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcGalCoordDlg</receiver>
+ <slot>slotGalLongCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>InputButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcGalCoordDlg</receiver>
+ <slot>slotInputFile()</slot>
+ </connection>
+ <connection>
+ <sender>OutButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcGalCoordDlg</receiver>
+ <slot>slotOutputFile()</slot>
+ </connection>
+ <connection>
+ <sender>galLatCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcGalCoordDlg</receiver>
+ <slot>slotGalLatCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>runButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcGalCoordDlg</receiver>
+ <slot>slotRunBatch()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>tabWidget8</tabstop>
+ <tabstop>equRadio</tabstop>
+ <tabstop>galRadio</tabstop>
+ <tabstop>Compute</tabstop>
+ <tabstop>Clear</tabstop>
+ <tabstop>raBox</tabstop>
+ <tabstop>decBox</tabstop>
+ <tabstop>epochName</tabstop>
+ <tabstop>lgBox</tabstop>
+ <tabstop>bgBox</tabstop>
+ <tabstop>raCheckBatch</tabstop>
+ <tabstop>raBoxBatch</tabstop>
+ <tabstop>decCheckBatch</tabstop>
+ <tabstop>decBoxBatch</tabstop>
+ <tabstop>epochCheckBatch</tabstop>
+ <tabstop>epochBoxBatch</tabstop>
+ <tabstop>galLongCheckBatch</tabstop>
+ <tabstop>galLongBoxBatch</tabstop>
+ <tabstop>galLatCheckBatch</tabstop>
+ <tabstop>galLatBoxBatch</tabstop>
+ <tabstop>inputRadioBatch</tabstop>
+ <tabstop>InputButtonBatch</tabstop>
+ <tabstop>InputLineEditBatch</tabstop>
+ <tabstop>OutputLineEditBatch</tabstop>
+ <tabstop>OutButtonBatch</tabstop>
+ <tabstop>runButtonBatch</tabstop>
+</tabstops>
+<slots>
+ <slot>slotComputeCoords()</slot>
+ <slot>slotClearCoords()</slot>
+ <slot>slotInputFile()</slot>
+ <slot>slotOutputFile()</slot>
+ <slot>slotRaCheckedBatch()</slot>
+ <slot>slotDecCheckedBatch()</slot>
+ <slot>slotEpochCheckedBatch()</slot>
+ <slot>slotGalLatCheckedBatch()</slot>
+ <slot>slotGalLongCheckedBatch()</slot>
+ <slot>slotRunBatch()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/modcalcgeodcoord.cpp b/kstars/kstars/tools/modcalcgeodcoord.cpp
new file mode 100644
index 00000000..dd913ef6
--- /dev/null
+++ b/kstars/kstars/tools/modcalcgeodcoord.cpp
@@ -0,0 +1,402 @@
+/***************************************************************************
+ modcalcgeodcoord.cpp - description
+ -------------------
+ begin : Tue Jan 15 2002
+ copyright : (C) 2002 by Pablo de Vicente
+ email : vicente@oan.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "modcalcgeodcoord.h"
+#include "modcalcgeodcoord.moc"
+#include "dms.h"
+#include "dmsbox.h"
+#include "geolocation.h"
+#include "kstars.h"
+
+#include <qradiobutton.h>
+#include <qstring.h>
+#include <qcheckbox.h>
+#include <qtextstream.h>
+
+#include <kcombobox.h>
+#include <klineedit.h>
+#include <kapplication.h>
+#include <knumvalidator.h>
+#include <klocale.h>
+#include <klineedit.h>
+#include <kfiledialog.h>
+#include <kmessagebox.h>
+
+
+modCalcGeodCoord::modCalcGeodCoord(QWidget *parentSplit, const char *name) : modCalcGeodCoordDlg(parentSplit,name) {
+
+ static const char *ellipsoidList[] = {
+ "IAU76", "GRS80", "MERIT83", "WGS84", "IERS89"};
+
+ spheRadio->setChecked(TRUE);
+ ellipsoidBox->insertStrList (ellipsoidList,5);
+ geoPlace = new GeoLocation();
+ showLongLat();
+ setEllipsoid(0);
+ show();
+
+}
+
+modCalcGeodCoord::~modCalcGeodCoord(){
+ delete geoPlace;
+}
+
+void modCalcGeodCoord::showLongLat(void)
+{
+
+ KStars *ks = (KStars*) parent()->parent()->parent(); // QSplitter->AstroCalc->KStars
+ lonGeoBox->show( ks->geo()->lng() );
+ latGeoBox->show( ks->geo()->lat() );
+ altGeoBox->setText( QString("0.0") );
+}
+
+void modCalcGeodCoord::setEllipsoid(int index) {
+
+ geoPlace->changeEllipsoid(index);
+
+}
+
+void modCalcGeodCoord::getCartGeoCoords (void)
+{
+
+ geoPlace->setXPos( KGlobal::locale()->readNumber(xGeoName->text())*1000. );
+ geoPlace->setYPos( KGlobal::locale()->readNumber(yGeoName->text())*1000. );
+ geoPlace->setZPos( KGlobal::locale()->readNumber(zGeoName->text())*1000. );
+ //geoPlace->setXPos( xGeoName->text().toDouble()*1000. );
+ //geoPlace->setYPos( yGeoName->text().toDouble()*1000. );
+ //geoPlace->setZPos( zGeoName->text().toDouble()*1000. );
+}
+
+void modCalcGeodCoord::getSphGeoCoords (void)
+{
+ geoPlace->setLong( lonGeoBox->createDms() );
+ geoPlace->setLat( latGeoBox->createDms() );
+ geoPlace->setHeight( altGeoBox->text().toDouble() );
+}
+
+void modCalcGeodCoord::slotClearGeoCoords (void)
+{
+
+ geoPlace->setLong( 0.0 );
+ geoPlace->setLat( 0.0 );
+ geoPlace->setHeight( 0.0 );
+ latGeoBox->clearFields();
+ lonGeoBox->clearFields();
+ //showSpheGeoCoords();
+ //showCartGeoCoords();
+
+}
+
+void modCalcGeodCoord::slotComputeGeoCoords (void)
+{
+
+ if(cartRadio->isChecked()) {
+ getCartGeoCoords();
+ showSpheGeoCoords();
+ } else {
+ getSphGeoCoords();
+ showCartGeoCoords();
+ }
+
+}
+
+void modCalcGeodCoord::showSpheGeoCoords(void)
+{
+ lonGeoBox->show( geoPlace->lng() );
+ latGeoBox->show( geoPlace->lat() );
+ altGeoBox->setText( KGlobal::locale()->formatNumber( geoPlace->height(), 3) );
+}
+
+void modCalcGeodCoord::showCartGeoCoords(void)
+{
+
+ xGeoName->setText( KGlobal::locale()->formatNumber( geoPlace->xPos()/1000. ,6));
+ yGeoName->setText( KGlobal::locale()->formatNumber( geoPlace->yPos()/1000. ,6));
+ zGeoName->setText( KGlobal::locale()->formatNumber( geoPlace->zPos()/1000. ,6));
+}
+
+void modCalcGeodCoord::geoCheck(void) {
+
+ xBoxBatch->setEnabled( false );
+ xCheckBatch->setChecked( false );
+ yBoxBatch->setEnabled( false );
+ yCheckBatch->setChecked( false );
+ zBoxBatch->setEnabled( false );
+ zCheckBatch->setChecked( false );
+ xyzInputCoords = FALSE;
+}
+
+void modCalcGeodCoord::xyzCheck(void) {
+
+ longBoxBatch->setEnabled( false );
+ longCheckBatch->setChecked( false );
+ latBoxBatch->setEnabled( false );
+ latCheckBatch->setChecked( false );
+ elevBoxBatch->setEnabled( false );
+ elevCheckBatch->setChecked( false );
+ xyzInputCoords = TRUE;
+
+}
+
+void modCalcGeodCoord::slotLongCheckedBatch(){
+
+ if ( longCheckBatch->isChecked() ) {
+ longBoxBatch->setEnabled( false );
+ geoCheck();
+ } else {
+ longBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcGeodCoord::slotLatCheckedBatch(){
+
+ if ( latCheckBatch->isChecked() ) {
+ latBoxBatch->setEnabled( false );
+ geoCheck();
+ } else {
+ latBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcGeodCoord::slotElevCheckedBatch(){
+
+ if ( elevCheckBatch->isChecked() ) {
+ elevBoxBatch->setEnabled( false );
+ geoCheck();
+ } else {
+ elevBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcGeodCoord::slotXCheckedBatch(){
+
+ if ( xCheckBatch->isChecked() ) {
+ xBoxBatch->setEnabled( false );
+ xyzCheck();
+ } else {
+ xBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcGeodCoord::slotYCheckedBatch(){
+
+ if ( yCheckBatch->isChecked() ) {
+ yBoxBatch->setEnabled( false );
+ xyzCheck();
+ } else {
+ yBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcGeodCoord::slotZCheckedBatch(){
+
+ if ( zCheckBatch->isChecked() ) {
+ zBoxBatch->setEnabled( false );
+ xyzCheck();
+ } else {
+ zBoxBatch->setEnabled( true );
+ }
+}
+void modCalcGeodCoord::slotInputFile() {
+
+ QString inputFileName;
+ inputFileName = KFileDialog::getOpenFileName( );
+ InputLineEditBatch->setText( inputFileName );
+}
+
+void modCalcGeodCoord::slotOutputFile() {
+
+ QString outputFileName;
+ outputFileName = KFileDialog::getSaveFileName( );
+ OutputLineEditBatch->setText( outputFileName );
+}
+
+void modCalcGeodCoord::slotRunBatch(void) {
+
+ QString inputFileName;
+
+ inputFileName = InputLineEditBatch->text();
+
+ // We open the input file and read its content
+
+ if ( QFile::exists(inputFileName) ) {
+ QFile f( inputFileName );
+ if ( !f.open( IO_ReadOnly) ) {
+ QString message = i18n( "Could not open file %1.").arg( f.name() );
+ KMessageBox::sorry( 0, message, i18n( "Could Not Open File" ) );
+ inputFileName = "";
+ return;
+ }
+
+// processLines(&f);
+ QTextStream istream(&f);
+ processLines(istream);
+// readFile( istream );
+ f.close();
+ } else {
+ QString message = i18n( "Invalid file: %1" ).arg( inputFileName );
+ KMessageBox::sorry( 0, message, i18n( "Invalid file" ) );
+ inputFileName = "";
+ InputLineEditBatch->setText( inputFileName );
+ return;
+ }
+}
+
+void modCalcGeodCoord::processLines( QTextStream &istream ) {
+
+ // we open the output file
+
+// QTextStream istream(&fIn);
+ QString outputFileName;
+ outputFileName = OutputLineEditBatch->text();
+ QFile fOut( outputFileName );
+ fOut.open(IO_WriteOnly);
+ QTextStream ostream(&fOut);
+
+ QString line;
+ QString space = " ";
+ int i = 0;
+ GeoLocation *geoPl = new GeoLocation();
+ geoPl->setEllipsoid(0);
+
+ double xB, yB, zB, hB;
+ dms latB, longB;
+
+
+ while ( ! istream.eof() ) {
+ line = istream.readLine();
+ line.stripWhiteSpace();
+
+ //Go through the line, looking for parameters
+
+ QStringList fields = QStringList::split( " ", line );
+
+ i = 0;
+
+ // Input coords are XYZ:
+
+ if (xyzInputCoords) {
+
+ // Read X and write in ostream if corresponds
+
+ if(xCheckBatch->isChecked() ) {
+ xB = fields[i].toDouble();
+ i++;
+ } else
+ xB = KGlobal::locale()->readNumber(xBoxBatch->text()) ;
+
+ if ( allRadioBatch->isChecked() )
+ ostream << xB << space;
+ else
+ if(xCheckBatch->isChecked() )
+ ostream << xB << space;
+
+ // Read Y and write in ostream if corresponds
+
+ if(yCheckBatch->isChecked() ) {
+ yB = fields[i].toDouble();
+ i++;
+ } else
+ yB = KGlobal::locale()->readNumber( yBoxBatch->text()) ;
+
+ if ( allRadioBatch->isChecked() )
+ ostream << yB << space;
+ else
+ if(yCheckBatch->isChecked() )
+ ostream << yB << space;
+ // Read Z and write in ostream if corresponds
+
+ if(zCheckBatch->isChecked() ) {
+ zB = fields[i].toDouble();
+ i++;
+ } else
+ zB = KGlobal::locale()->readNumber( zBoxBatch->text());
+
+ if ( allRadioBatch->isChecked() )
+ ostream << zB << space;
+ else
+ if(yCheckBatch->isChecked() )
+ ostream << zB << space;
+
+ geoPl->setXPos( xB*1000.0 );
+ geoPl->setYPos( yB*1000.0 );
+ geoPl->setZPos( zB*1000.0 );
+ ostream << geoPl->lng()->toDMSString() << space <<
+ geoPl->lat()->toDMSString() << space <<
+ geoPl->height() << endl;
+
+ // Input coords. are Long, Lat and Height
+
+ } else {
+
+ // Read Longitude and write in ostream if corresponds
+
+ if(longCheckBatch->isChecked() ) {
+ longB = dms::fromString( fields[i],TRUE);
+ i++;
+ } else
+ longB = longBoxBatch->createDms(TRUE);
+
+ if ( allRadioBatch->isChecked() )
+ ostream << longB.toDMSString() << space;
+ else
+ if(longCheckBatch->isChecked() )
+ ostream << longB.toDMSString() << space;
+
+ // Read Latitude and write in ostream if corresponds
+
+ if(latCheckBatch->isChecked() ) {
+ latB = dms::fromString( fields[i], TRUE);
+ i++;
+ } else
+ latB = latBoxBatch->createDms(TRUE);
+
+ if ( allRadioBatch->isChecked() )
+ ostream << latB.toDMSString() << space;
+ else
+ if(latCheckBatch->isChecked() )
+ ostream << latB.toDMSString() << space;
+
+ // Read Height and write in ostream if corresponds
+
+ if(elevCheckBatch->isChecked() ) {
+ hB = fields[i].toDouble();
+ i++;
+ } else
+ hB = elevBoxBatch->text().toDouble() ;
+
+ if ( allRadioBatch->isChecked() )
+ ostream << hB << space;
+ else
+ if(elevCheckBatch->isChecked() )
+ ostream << hB << space;
+
+ geoPl->setLong( longB );
+ geoPl->setLat( latB );
+ geoPl->setHeight( hB );
+
+ ostream << geoPl->xPos()/1000.0 << space <<
+ geoPl->yPos()/1000.0 << space <<
+ geoPl->zPos()/1000.0 << endl;
+
+ }
+
+ }
+
+
+ fOut.close();
+}
diff --git a/kstars/kstars/tools/modcalcgeodcoord.h b/kstars/kstars/tools/modcalcgeodcoord.h
new file mode 100644
index 00000000..e4ae86e2
--- /dev/null
+++ b/kstars/kstars/tools/modcalcgeodcoord.h
@@ -0,0 +1,83 @@
+/***************************************************************************
+ modcalcgeodcoord.h - description
+ -------------------
+ begin : Tue Jan 15 2002
+ copyright : (C) 2002 by Pablo de Vicente
+ email : vicente@oan.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 MODCALCGEODCOORD_H
+#define MODCALCGEODCOORD_H
+
+#include "modcalcgeoddlg.h"
+
+/**
+ * Class which implements the KStars calculator module to compute
+ * Geodetic coordinates to/from Cartesian coordinates.
+ *
+ * Inherits QVBox
+ *@author Pablo de Vicente
+ *@version 0.9
+ */
+
+//class QWidget;
+//class QLineEdit;
+//class QRadioButton;
+//class dmsBox;
+class GeoLocation;
+
+class modCalcGeodCoord : public modCalcGeodCoordDlg {
+
+ Q_OBJECT
+ public:
+
+ modCalcGeodCoord(QWidget *p, const char *n);
+ ~modCalcGeodCoord();
+
+ void genGeoCoords(void);
+ void getCartGeoCoords (void);
+ void getSphGeoCoords (void);
+ void showSpheGeoCoords(void);
+ void showCartGeoCoords(void);
+
+ public slots:
+
+ void slotComputeGeoCoords (void);
+ void slotClearGeoCoords (void);
+ void setEllipsoid(int i);
+ void slotLongCheckedBatch();
+ void slotLatCheckedBatch();
+ void slotElevCheckedBatch();
+ void slotXCheckedBatch();
+ void slotYCheckedBatch();
+ void slotZCheckedBatch();
+ void slotOutputFile();
+ void slotInputFile();
+ private:
+
+ void geoCheck(void);
+ void xyzCheck(void);
+ void showLongLat(void);
+ void processLines( QTextStream &istream );
+ void slotRunBatch(void);
+
+// QRadioButton *cartRadio, *spheRadio;
+// QVBox *vbox, *rightBox;
+// QLineEdit *xGeoName, *yGeoName, *zGeoName, *altGeoName;
+// dmsBox *timeBox, *dateBox, *lonGeoBox, *latGeoBox;
+
+ GeoLocation *geoPlace;
+ bool xyzInputCoords;
+
+};
+
+#endif
diff --git a/kstars/kstars/tools/modcalcgeoddlg.ui b/kstars/kstars/tools/modcalcgeoddlg.ui
new file mode 100644
index 00000000..890eb4c0
--- /dev/null
+++ b/kstars/kstars/tools/modcalcgeoddlg.ui
@@ -0,0 +1,819 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>modCalcGeodCoordDlg</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>modCalcGeodCoordDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>548</width>
+ <height>444</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Geodetic Coordinates</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tabWidget</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Interactive Mode</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout31</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>InputBox</cstring>
+ </property>
+ <property name="title">
+ <string>Choose Input Coordinates</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>cartRadio</cstring>
+ </property>
+ <property name="text">
+ <string>Cartesian</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>spheRadio</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>TabFocus</enum>
+ </property>
+ <property name="text">
+ <string>Geographic</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox11</cstring>
+ </property>
+ <property name="title">
+ <string>Ellipsoid Model</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KComboBox">
+ <property name="name">
+ <cstring>ellipsoidBox</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>81</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>Compute</cstring>
+ </property>
+ <property name="text">
+ <string>Convert</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>51</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>Clear</cstring>
+ </property>
+ <property name="text">
+ <string>Clear</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>91</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout32</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>cartBox</cstring>
+ </property>
+ <property name="title">
+ <string>Cartesian Coordinates</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>yLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Y (km):</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>zLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Z (km):</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>xLabel</cstring>
+ </property>
+ <property name="text">
+ <string>X (km):</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>xGeoName</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>zGeoName</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>yGeoName</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>spheBox</cstring>
+ </property>
+ <property name="title">
+ <string>Geographic Coordinates</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="dmsBox" row="0" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>lonGeoBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>70</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>latGeoBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>70</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>latLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Latitude:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>longLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Longitude:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>TextLabel3_2</cstring>
+ </property>
+ <property name="text">
+ <string>Elevation (meters):</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="2">
+ <property name="name">
+ <cstring>altGeoBox</cstring>
+ </property>
+ <property name="text">
+ <string>0.0</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>120</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Batch Mode</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>InputBox_2_2</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Select Fields in Input File</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit" row="0" column="3">
+ <property name="name">
+ <cstring>xBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="3">
+ <property name="name">
+ <cstring>yBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="3">
+ <property name="name">
+ <cstring>zBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>longBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>latBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>elevBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>longCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Longitude:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>latCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Latitude:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="0">
+ <property name="name">
+ <cstring>elevCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Elev. (m):</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="2">
+ <property name="name">
+ <cstring>xCheckBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>X (km):</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="2">
+ <property name="name">
+ <cstring>yCheckBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Y (km):</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="2">
+ <property name="name">
+ <cstring>zCheckBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Z (km):</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonFieldsGroup</cstring>
+ </property>
+ <property name="title">
+ <string>Fields in Output File Plus Result</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>allRadioBatch</cstring>
+ </property>
+ <property name="text">
+ <string>All parameters</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>inputRadioBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Only parameters in input file</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupFilesBox</cstring>
+ </property>
+ <property name="title">
+ <string>Files</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton" row="0" column="0">
+ <property name="name">
+ <cstring>InputButtonBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Input File...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>File with the input data</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>InputLineEditBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>OutputLineEditBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>OutButtonBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Output File...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>File for the output data</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout22</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer20_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>151</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>runButtonBatch</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Run</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer19_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>131</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer36</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>41</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>dmsBox</class>
+ <header location="global">../dmsbox.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1163">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000045249444154388d8d95bf8b1d5514c73fbb19e40cbce81d788199b8911d48304f8cf0524876316016031ab14819acfcd1f8a34ba72222fe0b369a54a216a216c158049222645f131221c10928dc852cdc0bfb600e66dc39c58558ccee6ab0c93497c3650edff339df99efc28df51bec3e9f7cfee6438b8662800086431eab2e971c5f7cf4edc26eaf851beb37b8f8fd870f67d73c6fbf759e5c0427156a0149d0621414b4b414c8bf756a013033c2a6a7f19e181b564e56bc73eec2420630bbee39ffdec7b8aac61e2861ee294460046bd309860720a8079f13e60149156a8a2000d4076a48c6ec7ae09d73b070ead5f2e199d31f50d735b66534b161b254524f6bea25a14d1b90c2300146d080ce8de68ed06ed65832cc0ceb0ceb7bda79445c4f66117211ec81e1a3677a78c299d7a6281e3fbf0c29d29a2717a14d4231ca2153a6e386b8e1f1b355821a4e84f8a0a7c81c3e06324d86938a103d93c335aba76ba2cdb8152f42f2f83f1c39397d6a29b21cad846a6ca841b9acf45ca5bd721cd516b26127206464825aa05eaa583b3d41d33ab736bfc4d4b87d6d421b6b2c2992392c296e24544703d395801ad44b861e0d70b326a67687b9b148322401fb0dc3f37bfc0e9d1b572f4d089b15660a0866caea4b42b1dcd2dcac985daf910c34c1e458c0b21d97240320739960c0f1e74b7c77154b8166564357018ac8a0f4ccd9299313400afc8427dc9de0ca96fa88a2c9a88f2ab7b784227328b0a8c910725a3ca4488c10361e557ae69515565f9e528843cd58391d319478b7460d9c808c5b4068d3f0de229960f4149283192e1b188938c0583d3165edd4142742df298231fbd5e170f4095cc6c0fac880808cff30065a0bc8c86129df533a3d5a72eaec041941d006231034d0ce0bd4142c27ce0527a0dd4ee3341c8bbb8c498225a17413c0a80f3bd6ce55146284ee369622da790a27ac9d6da99604b29eb21cac276998b0c8dc207c97b1760dce0123a84b21a8a2ea310b80e2e781ca419f846a5c307d2360731d186730bb93ff9f714b4b1b05eb22c508ea9516498e1fbf51426cb87ca965fd879ae61ee41458eaa91cc838ec3116dc238c33924182e68e21638f594fb90cc7cf7ad67f7e8e9fbe2e201348cafaa58a76ab657a32a21a061f9b8139fc9ff208e37d470ebacfea675f80edfdc46dcf812ad26d1ba39171a0dec289903f39a77a26b1df751caa3bd2e2fd9da6e0b20cb5c4f8a0b1713707cbe8d27c601c36fdb0c0cde1d737990e9fab1b194c1b6a618fe530f6e002c964cfc7fdfec8f214665706d6fb8ebd587ef6f75f89d1be02ddeeb058717f13aaa7c09e30dc13a0db0ca78164d019d8d698e66ec1a1a73b4207767fcc9ff772547bc6e36c489077df7ffd6139aec9c541b21da64679c428c62de531831e72c06f086d2c885e2009e524522df534bf41b80f3a572e7cf5cb90202b272b66d7036e6414385a8664686e4341cdfa15ddcbc5dd7b3048463f733402a41eed947ad9fd9b79ff0dd3b8a97b8ac976b6fc187559c2179ffeb817a6ff006d91847a48e5abd70000000049454e44ae426082</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>Clear</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcGeodCoordDlg</receiver>
+ <slot>slotClearGeoCoords()</slot>
+ </connection>
+ <connection>
+ <sender>Compute</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcGeodCoordDlg</receiver>
+ <slot>slotComputeGeoCoords()</slot>
+ </connection>
+ <connection>
+ <sender>InputButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcGeodCoordDlg</receiver>
+ <slot>slotInputFile()</slot>
+ </connection>
+ <connection>
+ <sender>OutButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcGeodCoordDlg</receiver>
+ <slot>slotOutputFile()</slot>
+ </connection>
+ <connection>
+ <sender>longCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcGeodCoordDlg</receiver>
+ <slot>slotLongCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>latCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcGeodCoordDlg</receiver>
+ <slot>slotLatCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>xCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcGeodCoordDlg</receiver>
+ <slot>slotXCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>yCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcGeodCoordDlg</receiver>
+ <slot>slotYCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>zCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcGeodCoordDlg</receiver>
+ <slot>slotZCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>runButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcGeodCoordDlg</receiver>
+ <slot>slotRunBatch()</slot>
+ </connection>
+ <connection>
+ <sender>elevCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcGeodCoordDlg</receiver>
+ <slot>slotElevCheckedBatch()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>tabWidget</tabstop>
+ <tabstop>cartRadio</tabstop>
+ <tabstop>spheRadio</tabstop>
+ <tabstop>ellipsoidBox</tabstop>
+ <tabstop>Compute</tabstop>
+ <tabstop>Clear</tabstop>
+ <tabstop>xGeoName</tabstop>
+ <tabstop>yGeoName</tabstop>
+ <tabstop>zGeoName</tabstop>
+ <tabstop>lonGeoBox</tabstop>
+ <tabstop>latGeoBox</tabstop>
+ <tabstop>altGeoBox</tabstop>
+ <tabstop>longCheckBatch</tabstop>
+ <tabstop>longBoxBatch</tabstop>
+ <tabstop>latCheckBatch</tabstop>
+ <tabstop>latBoxBatch</tabstop>
+ <tabstop>elevCheckBatch</tabstop>
+ <tabstop>elevBoxBatch</tabstop>
+ <tabstop>xCheckBatch</tabstop>
+ <tabstop>xBoxBatch</tabstop>
+ <tabstop>yCheckBatch</tabstop>
+ <tabstop>yBoxBatch</tabstop>
+ <tabstop>zCheckBatch</tabstop>
+ <tabstop>zBoxBatch</tabstop>
+ <tabstop>inputRadioBatch</tabstop>
+ <tabstop>InputButtonBatch</tabstop>
+ <tabstop>InputLineEditBatch</tabstop>
+ <tabstop>OutButtonBatch</tabstop>
+ <tabstop>OutputLineEditBatch</tabstop>
+ <tabstop>runButtonBatch</tabstop>
+</tabstops>
+<slots>
+ <slot>slotComputeGeoCoords()</slot>
+ <slot>slotClearGeoCoords()</slot>
+ <slot>slotInputFile()</slot>
+ <slot>slotRunBatch()</slot>
+ <slot>slotOutputFile()</slot>
+ <slot>slotLatCheckedBatch()</slot>
+ <slot>slotLongCheckedBatch()</slot>
+ <slot>slotElevCheckedBatch()</slot>
+ <slot>slotXCheckedBatch()</slot>
+ <slot>slotYCheckedBatch()</slot>
+ <slot>slotZCheckedBatch()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kcombobox.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/modcalcjd.cpp b/kstars/kstars/tools/modcalcjd.cpp
new file mode 100644
index 00000000..68434f39
--- /dev/null
+++ b/kstars/kstars/tools/modcalcjd.cpp
@@ -0,0 +1,125 @@
+/***************************************************************************
+ modcalcjd.cpp - description
+ -------------------
+ begin : Tue Jan 15 2002
+ copyright : (C) 2002 by Pablo de Vicente
+ email : vicente@oan.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "modcalcjd.h"
+#include "modcalcjd.moc"
+#include "kstars.h"
+#include "kstarsdata.h"
+#include "geolocation.h"
+#include "libkdeedu/extdate/extdatetimeedit.h"
+
+#include <qdatetimeedit.h> //need for QTimeEdit
+#include <qradiobutton.h>
+#include <klineedit.h>
+#include <klocale.h>
+#include <kglobal.h>
+
+#include "kstarsdatetime.h"
+
+#define MJD0 2400000.5
+
+modCalcJD::modCalcJD(QWidget *parentSplit, const char *name) : modCalcJdDlg(parentSplit,name) {
+
+ showCurrentTime();
+ show();
+}
+
+modCalcJD::~modCalcJD(void)
+{
+}
+
+void modCalcJD::slotComputeTime (void)
+{
+
+ if(DateRadio->isChecked()) {
+ computeFromCalendar();
+ } else if (JdRadio->isChecked()) {
+ JdName->setFocus();
+ computeFromJd();
+ } else if (MjdRadio->isChecked()) {
+ MjdName->setFocus();
+ computeFromMjd();
+ }
+}
+
+void modCalcJD::computeFromCalendar (void)
+{
+ long double julianDay, modjulianDay;
+
+ julianDay = getDateTime().djd();
+ showJd( julianDay );
+
+ modjulianDay = julianDay - MJD0;
+ showMjd(modjulianDay);
+}
+
+void modCalcJD::computeFromMjd (void)
+{
+ long double julianDay, modjulianDay;
+
+ modjulianDay = KGlobal::locale()->readNumber( MjdName->text() );
+ julianDay = MJD0 + modjulianDay;
+ showJd( julianDay );
+ computeFromJd();
+}
+
+void modCalcJD::computeFromJd (void)
+{
+ long double julianDay, modjulianDay;
+ julianDay = KGlobal::locale()->readNumber( JdName->text() );
+ KStarsDateTime dt( julianDay );
+
+ datBox->setDate( dt.date() );
+ timBox->setTime( dt.time() );
+
+ modjulianDay = julianDay - MJD0;
+ showMjd( modjulianDay );
+}
+
+
+void modCalcJD::slotClearTime (void)
+{
+ JdName->setText ("");
+ MjdName->setText ("");
+ datBox->setDate( ExtDate::currentDate() );
+ timBox->setTime(QTime(0,0,0));
+}
+
+void modCalcJD::showCurrentTime (void)
+{
+ KStars *ks = (KStars*) parent()->parent()->parent();
+
+ KStarsDateTime dt = ks->data()->geo()->LTtoUT( KStarsDateTime::currentDateTime() );
+ datBox->setDate( dt.date() );
+ timBox->setTime( dt.time() );
+ computeFromCalendar();
+}
+
+KStarsDateTime modCalcJD::getDateTime (void)
+{
+ return KStarsDateTime( datBox->date() , timBox->time() );
+}
+
+void modCalcJD::showJd(long double julianDay)
+{
+ JdName->setText(KGlobal::locale()->formatNumber( (double)julianDay, 5 ) );
+}
+
+void modCalcJD::showMjd(long double modjulianDay)
+{
+ MjdName->setText(KGlobal::locale()->formatNumber( (double)modjulianDay, 5 ) );
+}
diff --git a/kstars/kstars/tools/modcalcjd.h b/kstars/kstars/tools/modcalcjd.h
new file mode 100644
index 00000000..054e2156
--- /dev/null
+++ b/kstars/kstars/tools/modcalcjd.h
@@ -0,0 +1,65 @@
+/***************************************************************************
+ modcalcjd.h - description
+ -------------------
+ begin : Tue Jan 15 2002
+ copyright : (C) 2002 by Pablo de Vicente
+ email : vicente@oan.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 MODCALCJD_H
+#define MODCALCJD_H
+
+#include <qvbox.h>
+
+#include <kapplication.h>
+#include "modcalcjddlg.h"
+
+/**
+ * Class for KStars module which computes JD, MJD and Date/Time from the
+ * any of the other entries.
+ *
+ * Inherits QVBox
+ *@author Pablo de Vicente
+ *@version 0.9
+ */
+
+class QWidget;
+class VBox;
+class KStarsDateTime;
+
+class modCalcJD : public modCalcJdDlg
+{
+Q_OBJECT
+public:
+ modCalcJD(QWidget *p, const char *n);
+ ~modCalcJD();
+
+ void computeFromCalendar (void);
+ void computeFromMjd (void);
+ void computeFromJd (void);
+ KStarsDateTime getDateTime (void);
+
+public slots:
+
+ void slotComputeTime(void);
+ void slotClearTime(void);
+ void showCurrentTime(void);
+
+private:
+
+ /** Shows Julian Day in the Box */
+ void showJd(long double jd);
+ /** Shows the modified Julian Day in the Box */
+ void showMjd(long double mjd);
+};
+
+#endif
diff --git a/kstars/kstars/tools/modcalcjddlg.ui b/kstars/kstars/tools/modcalcjddlg.ui
new file mode 100644
index 00000000..6550c546
--- /dev/null
+++ b/kstars/kstars/tools/modcalcjddlg.ui
@@ -0,0 +1,510 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>modCalcJdDlg</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>modCalcJdDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>407</width>
+ <height>387</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Julian Day</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>InputBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Choose Input Field</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout9</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>JdRadio</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Julian day</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>MjdRadio</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Modified Julian day</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>DateRadio</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Date</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout37</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>JdBox</cstring>
+ </property>
+ <property name="title">
+ <string>Julian Day</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>JdLabel</cstring>
+ </property>
+ <property name="text">
+ <string>JD:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>JdName</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>130</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>MjdBox</cstring>
+ </property>
+ <property name="title">
+ <string>Modified Julian Day</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>MjdLabel</cstring>
+ </property>
+ <property name="text">
+ <string>MJD:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>MjdName</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>130</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>Datebox</cstring>
+ </property>
+ <property name="title">
+ <string>Date &amp;&amp; Time</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer60</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>timeLabel</cstring>
+ </property>
+ <property name="text">
+ <string>UT:</string>
+ </property>
+ </widget>
+ <widget class="QTimeEdit">
+ <property name="name">
+ <cstring>timBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer61</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>dateLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Date:</string>
+ </property>
+ </widget>
+ <widget class="ExtDateEdit">
+ <property name="name">
+ <cstring>datBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>110</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer62</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout7</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer8</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>23</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>Now</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Now</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>39</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>Clear</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>25</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Clear</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>37</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>Compute</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>25</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Convert</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>38</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer55</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>30</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>ExtDateEdit</class>
+ <header location="local">libkdeedu/extdate/extdatetimeedit.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="872">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000032f49444154388db5953148254718c77f1e5b7c030ab3e0c12e5ce00927f88a14af7d87c5590ac29d6013b0497b844008a9120e1248938354a6b1482131cde5a510b4f03081f07c8d4421c2063cd85708bbe0831938613ec8c0a5588dd1dc33452e5f33bb33c36f7ffbed7fd889fe7e9fcb7ad07df09ab750fdfdfec4c425787b6bfb757bae8df79e6a54e1bcc36008845b47e71dc549c1e06000f10a9e5c9a3effee39690ef92cb4a25e2c3b4804709844807035cfd57d7122f0ad65f0c25f0703d4a39af41d28473fa0af4a42548c81f007f85aa86a4510cc34cccc8288420405640ad2bbcadfeb2fb01b39021e7d5513a2c74c59ca43d8db510e0f6a24018d8a2496ecbeb0b892d29d0f08cdbc9d149ac7dc0057bea2831262853196fd5d6573dd43046b85fcbe2002d55019be54bef9a2a45ecd585e059106fe46639318403153427908bd0be8e2a38c874b90e70692806acade4ea0b7eee96d0cc9b2360b8f0d92e835e33b97172106400801b6b73c1a95c54719cbef439a2b9a54f833c3f68f8ec59594f73eb090089b1b153afa67e4ae1b270e5fa7144725d636a6228d853fcf59fbca511e7bdc193cf92467b0eb297f578a2220721d7ccdd82442553b48206f417a1714c5fb94b5cf2b8a638f58a13b9fc2a4a3ddb16854aa53d03806dcf4180481a8d8c98b8f7296b3f6a5a33c6ee2652785fc1ea4d2bcaf248246901bca377a0c661a482cc5505135ecbd088de9a490ddb30c8735cf9e5614872955a96854665a066e4f85a33d0bad96500f95bd9dc0f26a8a3b53ba0f53f20c9e3d85e1cb9a4f3facd0734f9659da1da8ea5b7a0c02a22cae081a95deba676fc7f1e4a39cce7ca0d5097cfc594e9659fca88608dd25cbccdcbfe6384014baf3509f66f436866c7e0d835d4ffb5d0b0954a5c38fb4e92d4af18b521c19ac8c39796ee42ecebe22c0f2aa90656d7adf5714c74a71346c7647b0d39685c7965f7f52aa738fc6947a34c6b83829284a41d2c6441258580a74e7738a22509d36d0bc65687760660e8a25033187c451fec69bc1838301ac0b69de444ad53779c32317bb2481f2d437b9dd6adae13d14874a558f3126c2e0e7cbc59be3b81abf7e67ecca7fac3bd0fca3fe17f0db86f7f7fb137f0208c29bb2c76e387f0000000049454e44ae426082</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>Now</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcJdDlg</receiver>
+ <slot>showCurrentTime()</slot>
+ </connection>
+ <connection>
+ <sender>Clear</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcJdDlg</receiver>
+ <slot>slotClearTime()</slot>
+ </connection>
+ <connection>
+ <sender>Compute</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcJdDlg</receiver>
+ <slot>slotComputeTime()</slot>
+ </connection>
+</connections>
+<slots>
+ <slot>slotClearTime()</slot>
+ <slot>slotComputeTime()</slot>
+ <slot>showCurrentTime()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/modcalcplanets.cpp b/kstars/kstars/tools/modcalcplanets.cpp
new file mode 100644
index 00000000..c927d71e
--- /dev/null
+++ b/kstars/kstars/tools/modcalcplanets.cpp
@@ -0,0 +1,591 @@
+/***************************************************************************
+ modcalcequinox.cpp - description
+ -------------------
+ begin : dom may 2 2004
+ copyright : (C) 2004-2005 by Pablo de Vicente
+ email : p.devicentea@wanadoo.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "modcalcplanets.h"
+#include "modcalcplanets.moc"
+#include "dms.h"
+#include "dmsbox.h"
+#include "kstars.h"
+#include "kstarsdata.h"
+#include "kssun.h"
+#include "ksplanet.h"
+#include "ksmoon.h"
+#include "kspluto.h"
+#include "libkdeedu/extdate/extdatetimeedit.h"
+#include "ksnumbers.h"
+
+#include <qcombobox.h>
+#include <qdatetimeedit.h>
+#include <qstring.h>
+#include <qtextstream.h>
+#include <kfiledialog.h>
+#include <kmessagebox.h>
+#include <qcheckbox.h>
+#include <qradiobutton.h>
+
+
+modCalcPlanets::modCalcPlanets(QWidget *parentSplit, const char *name) : modCalcPlanetsDlg (parentSplit,name) {
+ showCurrentDateTime();
+ showLongLat();
+ raBox->setDegType(FALSE);
+ show();
+}
+
+modCalcPlanets::~modCalcPlanets(){
+}
+
+void modCalcPlanets::showCurrentDateTime (void)
+{
+ KStars *ks = (KStars*) parent()->parent()->parent(); // QSplitter->AstroCalc->KStars
+ KStarsDateTime dt = ks->data()->geo()->LTtoUT( KStarsDateTime::currentDateTime() );
+
+ dateBox->setDate( dt.date() );
+ timeBox->setTime( dt.time() );
+
+ dateBoxBatch->setDate( dt.date() );
+ utBoxBatch->setTime( dt.time() );
+}
+
+KStarsDateTime modCalcPlanets::getDateTime (void)
+{
+ return KStarsDateTime( dateBox->date() , timeBox->time() );
+}
+
+void modCalcPlanets::showLongLat(void)
+{
+
+ KStars *ks = (KStars*) parent()->parent()->parent(); // QSplitter->AstroCalc->KStars
+ longBox->show( ks->geo()->lng() );
+ latBox->show( ks->geo()->lat() );
+
+ longBoxBatch->show( ks->geo()->lng() );
+ latBoxBatch->show( ks->geo()->lat() );
+}
+
+
+GeoLocation modCalcPlanets::getObserverPosition (void)
+{
+ GeoLocation geoPlace;
+
+ geoPlace.setLong( longBox->createDms() );
+ geoPlace.setLat( latBox->createDms() );
+ geoPlace.setHeight( 0.0 );
+
+ return geoPlace;
+}
+
+void modCalcPlanets::slotComputePosition (void)
+{
+ KStarsData *kd = (KStarsData*) parent()->parent()->parent();
+ KStarsDateTime dt = getDateTime();
+ long double julianDay = dt.djd();
+ GeoLocation position( getObserverPosition() );
+ KSNumbers num( julianDay );
+ dms LST( position.GSTtoLST( dt.gst() ) );
+
+ // Earth
+ KSPlanet Earth( kd, I18N_NOOP( "Earth" ));
+ Earth.findPosition( &num );
+
+ // Mercury
+ if (planetComboBox->currentItem() == 0 ) {
+ KSPlanet p( kd, I18N_NOOP( "Mercury" ));
+ p.findPosition( &num, position.lat(), &LST, &Earth);
+ p.EquatorialToHorizontal( &LST, position.lat());
+ showCoordinates( p );
+ }
+ else if(planetComboBox->currentItem() == 1) {
+ KSPlanet p( kd, I18N_NOOP( "Venus" ));
+ p.findPosition( &num, position.lat(), &LST, &Earth);
+ p.EquatorialToHorizontal( &LST, position.lat());
+ showCoordinates( p );
+ }
+ else if(planetComboBox->currentItem() == 2) {
+ showCoordinates( Earth );
+ }
+ else if(planetComboBox->currentItem() == 3) {
+ KSPlanet p( kd, I18N_NOOP( "Mars" ));
+ p.findPosition( &num, position.lat(), &LST, &Earth);
+ p.EquatorialToHorizontal( &LST, position.lat());
+ showCoordinates( p );
+ }
+ else if(planetComboBox->currentItem() == 4) {
+ KSPlanet p( kd, I18N_NOOP( "Jupiter" ));
+ p.findPosition( &num, position.lat(), &LST, &Earth);
+ p.EquatorialToHorizontal( &LST, position.lat());
+ showCoordinates( p );
+ }
+ else if(planetComboBox->currentItem() == 5) {
+ KSPlanet p( kd, I18N_NOOP( "Saturn" ));
+ p.findPosition( &num, position.lat(), &LST, &Earth);
+ p.EquatorialToHorizontal( &LST, position.lat());
+ showCoordinates( p );
+ }
+ else if(planetComboBox->currentItem() == 6) {
+ KSPlanet p( kd, I18N_NOOP( "Uranus" ));
+ p.findPosition( &num, position.lat(), &LST, &Earth);
+ p.EquatorialToHorizontal( &LST, position.lat());
+ showCoordinates( p );
+ }
+ else if(planetComboBox->currentItem() == 7) {
+ KSPlanet p( kd, I18N_NOOP( "Neptune" ));
+ p.findPosition( &num, position.lat(), &LST, &Earth);
+ p.EquatorialToHorizontal( &LST, position.lat());
+ showCoordinates( p );
+ }
+ else if(planetComboBox->currentItem() == 8) {
+ KSPluto p( kd );
+ p.findPosition( &num, position.lat(), &LST, &Earth);
+ p.EquatorialToHorizontal( &LST, position.lat());
+ showCoordinates( p );
+ }
+ else if(planetComboBox->currentItem() == 9) {
+ KSMoon p( kd );
+ p.findPosition( &num, position.lat(), &LST, &Earth);
+ p.EquatorialToHorizontal( &LST, position.lat());
+ showCoordinates( p );
+ }
+ else if(planetComboBox->currentItem() == 10) {
+ KSSun p( kd );
+ p.findPosition( &num, position.lat(), &LST, &Earth);
+ p.EquatorialToHorizontal( &LST, position.lat());
+ p.setRsun(0.0);
+ showCoordinates( p );
+ }
+}
+
+void modCalcPlanets::showCoordinates( const KSPlanet &ksp) {
+
+ showHeliocentricEclipticCoords(ksp.helEcLong(), ksp.helEcLat(), ksp.rsun() );
+ showGeocentricEclipticCoords(ksp.ecLong(), ksp.ecLat(), ksp.rearth() );
+ showEquatorialCoords(ksp.ra(), ksp.dec() );
+ showTopocentricCoords(ksp.az(), ksp.alt() );
+
+}
+
+void modCalcPlanets::showCoordinates( const KSMoon &ksp ) {
+
+ showHeliocentricEclipticCoords(ksp.helEcLong(), ksp.helEcLat(), ksp.rsun() );
+ showGeocentricEclipticCoords(ksp.ecLong(), ksp.ecLat(), ksp.rearth() );
+ showEquatorialCoords(ksp.ra(), ksp.dec() );
+ showTopocentricCoords(ksp.az(), ksp.alt() );
+
+}
+void modCalcPlanets::showCoordinates( const KSPluto &ksp ) {
+
+ showHeliocentricEclipticCoords(ksp.helEcLong(), ksp.helEcLat(), ksp.rsun() );
+ showGeocentricEclipticCoords(ksp.ecLong(), ksp.ecLat(), ksp.rearth() );
+ showEquatorialCoords(ksp.ra(), ksp.dec() );
+ showTopocentricCoords(ksp.az(), ksp.alt() );
+
+}
+
+void modCalcPlanets::showCoordinates( const KSSun &ksp ) {
+
+ showHeliocentricEclipticCoords(ksp.helEcLong(), ksp.helEcLat(), ksp.rsun() );
+ showGeocentricEclipticCoords(ksp.ecLong(), ksp.ecLat(), ksp.rearth() );
+ showEquatorialCoords(ksp.ra(), ksp.dec() );
+ showTopocentricCoords(ksp.az(), ksp.alt() );
+
+}
+
+void modCalcPlanets::slotClear(void){
+ helLongBox->setText( "" );
+ helLatBox->setText( "" );
+ sunDistBox->setText( "" );
+ geoLongBox->setText("");
+ geoLatBox->setText("");
+ earthDistBox->setText("");
+ raBox->clearFields();
+ decBox->clearFields();
+ azBox->setText("");
+ altBox->setText("");
+}
+
+void modCalcPlanets::showHeliocentricEclipticCoords(const dms *hLong, const dms *hLat, double dist)
+{
+ helLongBox->show( hLong );
+ helLatBox->show( hLat );
+ sunDistBox->setText( KGlobal::locale()->formatNumber( dist,6));
+}
+
+void modCalcPlanets::showGeocentricEclipticCoords(const dms *eLong, const dms *eLat, double dist)
+{
+ geoLongBox->show( eLong );
+ geoLatBox->show( eLat );
+ earthDistBox->setText( KGlobal::locale()->formatNumber( dist,6));
+}
+
+void modCalcPlanets::showEquatorialCoords(const dms *ra, const dms *dec)
+{
+ raBox->show( ra, FALSE );
+ decBox->show( dec );
+}
+
+void modCalcPlanets::showTopocentricCoords(const dms *az, const dms *el)
+{
+ azBox->show( az );
+ altBox->show( el );
+}
+
+void modCalcPlanets::slotPlanetsCheckedBatch(){
+
+ if ( planetCheckBatch->isChecked() )
+ planetComboBoxBatch->setEnabled( false );
+ else {
+ planetComboBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcPlanets::slotUtCheckedBatch(){
+
+ if ( utCheckBatch->isChecked() )
+ utBoxBatch->setEnabled( false );
+ else {
+ utBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcPlanets::slotDateCheckedBatch(){
+
+ if ( dateCheckBatch->isChecked() )
+ dateBoxBatch->setEnabled( false );
+ else {
+ dateBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcPlanets::slotLongCheckedBatch(){
+
+ if ( longCheckBatch->isChecked() )
+ longBoxBatch->setEnabled( false );
+ else {
+ longBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcPlanets::slotLatCheckedBatch(){
+
+ if ( latCheckBatch->isChecked() )
+ latBoxBatch->setEnabled( false );
+ else {
+ latBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcPlanets::slotInputFile() {
+ QString inputFileName;
+ inputFileName = KFileDialog::getOpenFileName( );
+ InputLineEditBatch->setText( inputFileName );
+}
+
+void modCalcPlanets::slotOutputFile() {
+ QString outputFileName;
+ outputFileName = KFileDialog::getSaveFileName( );
+ OutputLineEditBatch->setText( outputFileName );
+}
+
+void modCalcPlanets::slotRunBatch() {
+
+ QString inputFileName;
+
+ inputFileName = InputLineEditBatch->text();
+
+ // We open the input file and read its content
+
+ if ( QFile::exists(inputFileName) ) {
+ QFile f( inputFileName );
+ if ( !f.open( IO_ReadOnly) ) {
+ QString message = i18n( "Could not open file %1.").arg( f.name() );
+ KMessageBox::sorry( 0, message, i18n( "Could Not Open File" ) );
+ inputFileName = "";
+ return;
+ }
+
+ QTextStream istream(&f);
+ processLines(istream);
+ f.close();
+ } else {
+ QString message = i18n( "Invalid file: %1" ).arg( inputFileName );
+ KMessageBox::sorry( 0, message, i18n( "Invalid file" ) );
+ inputFileName = "";
+ InputLineEditBatch->setText( inputFileName );
+ return;
+ }
+}
+
+unsigned int modCalcPlanets::requiredBatchFields(void) {
+ unsigned int i = 0;
+
+ if(planetCheckBatch->isChecked() )
+ i++;
+ if(utCheckBatch->isChecked() )
+ i++;
+ if(dateCheckBatch->isChecked() )
+ i++;
+ if (longCheckBatch->isChecked() )
+ i++;
+ if (latCheckBatch->isChecked() )
+ i++;
+
+ return i;
+
+}
+
+void modCalcPlanets::processLines( QTextStream &istream ) {
+
+ // we open the output file
+
+ QString outputFileName, lineToWrite;
+ outputFileName = OutputLineEditBatch->text();
+ QFile fOut( outputFileName );
+ fOut.open(IO_WriteOnly);
+ QTextStream ostream(&fOut);
+ bool lineIsValid = true;
+ QString message;
+
+ QString line;
+ QString space = " ";
+ QString planetB;
+ unsigned int i = 0, nline = 0;
+ QTime utB;
+ ExtDate dtB;
+ dms longB, latB, hlongB, hlatB, glongB, glatB, raB, decB, azmB, altB;
+ double rSunB(0.0), rEarthB(0.0);
+ KStarsData *kd = (KStarsData*) parent()->parent()->parent(); // QSplitter->AstroCalc->KStars
+ PlanetCatalog PCat( kd );
+ PCat.initialize();
+
+ QString pName[11], pNamei18n[11];
+
+ pName[0] = "Mercury"; pNamei18n[0]= i18n("Mercury");
+ pName[1] = "Venus"; pNamei18n[1]= i18n("Venus");
+ pName[2] = "Earth"; pNamei18n[2]= i18n("Earth");
+ pName[3] = "Mars"; pNamei18n[3]= i18n("Mars");
+ pName[4] = "Jupiter"; pNamei18n[4]= i18n("Jupiter");
+ pName[5] = "Saturn"; pNamei18n[5]= i18n("Saturn");
+ pName[6] = "Uranus"; pNamei18n[6]= i18n("Uranus");
+ pName[7] = "Neptune"; pNamei18n[7]= i18n("Neptune");
+ pName[8] = "Pluto"; pNamei18n[8]= i18n("Pluto");
+ pName[9] = "Sun"; pNamei18n[9]= i18n("Sun");
+ pName[10] = "Moon"; pNamei18n[10]= i18n("Moon");
+
+ unsigned int numberOfRequiredFields = requiredBatchFields();
+
+ while ( ! istream.eof() ) {
+ lineToWrite="";
+ line = istream.readLine();
+ line.stripWhiteSpace();
+
+ //Go through the line, looking for parameters
+
+ QStringList fields = QStringList::split( " ", line );
+
+ if (fields.count() != numberOfRequiredFields ) {
+ lineIsValid = false;
+ kdWarning() << i18n( "Incorrect number of fields in line %1: " ).arg(nline)
+ << i18n( "Present fields %1. " ).arg(fields.count())
+ << i18n( "Required fields %1. " ).arg(numberOfRequiredFields) << endl;
+ nline++;
+ continue;
+ }
+
+ i = 0;
+ if(planetCheckBatch->isChecked() ) {
+ planetB = fields[i];
+ unsigned int result = 1;
+ int j = 0;
+ while (j < 11) {
+ //while (result != 0 && j < 11) {
+ result = QString::compare( pNamei18n[j] , planetB );
+ if (result == 0)
+ break;
+ j++;
+ }
+ if (j == 11) {
+ kdWarning() << i18n("Unknown planet ")
+ << fields[i]
+ << i18n(" in line %1: ").arg(nline) << endl;
+ continue;
+ }
+ i++;
+ } else
+ planetB = planetComboBoxBatch->currentText( );
+
+ if ( allRadioBatch->isChecked() ) {
+ lineToWrite = planetB;
+ lineToWrite += space;
+ }
+ else
+ if(planetCheckBatch->isChecked() ) {
+ lineToWrite = planetB;
+ lineToWrite += space;
+ }
+
+ // Read Ut and write in ostream if corresponds
+
+ if(utCheckBatch->isChecked() ) {
+ utB = QTime::fromString( fields[i] );
+ if ( !utB.isValid() ) {
+ kdWarning() << i18n( "Line %1 contains an invalid time" ).arg(nline) << endl;
+ lineIsValid=false;
+ nline++;
+ continue;
+ }
+ i++;
+ } else
+ utB = utBoxBatch->time();
+
+ if ( allRadioBatch->isChecked() )
+ lineToWrite += utB.toString().append(space);
+ else
+ if(utCheckBatch->isChecked() )
+ lineToWrite += utB.toString().append(space);
+
+ // Read date and write in ostream if corresponds
+
+ if(dateCheckBatch->isChecked() ) {
+ dtB = ExtDate::fromString( fields[i], Qt::ISODate );
+ if ( !dtB.isValid() ) {
+ kdWarning() << i18n( "Line %1 contains an invalid date: " ).arg(nline) <<
+ fields[i] << endl ;
+ lineIsValid=false;
+ nline++;
+ continue;
+ }
+ i++;
+ } else
+ dtB = dateBoxBatch->date();
+ if ( allRadioBatch->isChecked() )
+ lineToWrite += dtB.toString().append(space);
+ else
+ if(dateCheckBatch->isChecked() )
+ lineToWrite += dtB.toString().append(space);
+
+ // Read Longitude and write in ostream if corresponds
+
+ if (longCheckBatch->isChecked() ) {
+ longB = dms::fromString( fields[i],TRUE);
+ i++;
+ } else
+ longB = longBoxBatch->createDms(TRUE);
+
+ if ( allRadioBatch->isChecked() )
+ lineToWrite += longB.toDMSString() + space;
+ else
+ if (longCheckBatch->isChecked() )
+ lineToWrite += longB.toDMSString() + space;
+
+ // Read Latitude
+
+ if (latCheckBatch->isChecked() ) {
+ latB = dms::fromString( fields[i], TRUE);
+ i++;
+ } else
+ latB = latBoxBatch->createDms(TRUE);
+ if ( allRadioBatch->isChecked() )
+ lineToWrite += latB.toDMSString() + space;
+ else
+ if (latCheckBatch->isChecked() )
+ lineToWrite += latB.toDMSString() + space;
+
+ KStarsDateTime edt( dtB, utB );
+ dms LST = edt.gst().Degrees() + longB.Degrees();
+
+ KSNumbers num( edt.djd() );
+
+ PCat.findPosition( &num, &latB, &LST );
+ PCat.EquatorialToHorizontal(&LST, &latB);
+
+ KSPlanet Earth( kd, I18N_NOOP( "Earth" ));
+ Earth.findPosition( &num );
+
+ KSMoon Moon( kd );
+ Moon.findPosition( &num, &latB, &LST, &Earth );
+ Moon.EquatorialToHorizontal( &LST, &latB );
+
+ int result = 1;
+ int jp = -1;
+ while (result != 0 && jp < 10) {
+ jp++;
+ result = QString::compare( pNamei18n[jp] , planetB );
+ }
+
+ if (jp < 11) {
+ if (jp < 10) {
+ // Heliocentric Ecl. coords.
+ hlongB.setD(PCat.findByName( pName[jp] )->helEcLong()->Degrees());
+ hlatB.setD( PCat.findByName( pName[jp] )->helEcLat()->Degrees());
+ rSunB = PCat.findByName( pName[jp] )->rsun();
+
+ // Geocentric Ecl. coords.
+ glongB .setD( PCat.findByName( pName[jp] )->ecLong()->Degrees() );
+ glatB.setD( PCat.findByName( pName[jp] )->ecLat()->Degrees() );
+ rEarthB = PCat.findByName( pName[jp] )->rearth();
+
+ // Equatorial coords.
+ decB.setD( PCat.findByName( pName[jp] )->dec()->Degrees() );
+ raB.setD( PCat.findByName( pName[jp] )->ra()->Degrees() );
+
+ // Topocentric Coords.
+ azmB.setD( PCat.findByName( pName[jp] )->az()->Degrees() );
+ altB.setD( PCat.findByName( pName[jp] )->alt()->Degrees() );
+ } else {
+
+ // Heliocentric Ecl. coords.
+ hlongB.setD( Moon.helEcLong()->Degrees() );
+ hlatB.setD( Moon.helEcLat()->Degrees() );
+
+ // Geocentric Ecl. coords.
+ glongB .setD( Moon.ecLong()->Degrees() );
+ glatB.setD( Moon.ecLat()->Degrees() );
+ rEarthB = Moon.rearth();
+
+ // Equatorial coords.
+ decB.setD( Moon.dec()->Degrees() );
+ raB.setD( Moon.ra()->Degrees() );
+
+ // Topocentric Coords.
+ azmB.setD( Moon.az()->Degrees() );
+ altB.setD( Moon.alt()->Degrees() );
+ }
+
+
+ ostream << lineToWrite;
+
+ if ( helEclCheckBatch->isChecked() )
+ ostream << hlongB.toDMSString() << space << hlatB.toDMSString() << space << rSunB << space ;
+ if ( geoEclCheckBatch->isChecked() )
+ ostream << glongB.toDMSString() << space << glatB.toDMSString() << space << rEarthB << space ;
+ if ( equGeoCheckBatch->isChecked() )
+ ostream << raB.toHMSString() << space << decB.toDMSString() << space ;
+ if ( topoCheckBatch->isChecked() )
+ ostream << azmB.toDMSString() << space << altB.toDMSString() << space ;
+
+ ostream << endl;
+ }
+ nline++;
+
+ }
+
+ if (!lineIsValid) {
+ QString message = i18n("Errors found while parsing some lines in the input file");
+ KMessageBox::sorry( 0, message, i18n( "Errors in lines" ) );
+ }
+
+ fOut.close();
+}
diff --git a/kstars/kstars/tools/modcalcplanets.h b/kstars/kstars/tools/modcalcplanets.h
new file mode 100644
index 00000000..c3d6bceb
--- /dev/null
+++ b/kstars/kstars/tools/modcalcplanets.h
@@ -0,0 +1,83 @@
+/***************************************************************************
+ modcalcazel.h - description
+ -------------------
+ begin : mier abr 20 2004
+ copyright : (C) 2004-2005 by Pablo de Vicente
+ email : pvicentea@wanadoo.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 MODCALCPLANETS_H
+#define MODCALCPLANETS_H
+
+#include <kapplication.h>
+#include <qwidget.h>
+#include "modcalcplanetsdlg.h"
+#include "geolocation.h"
+#include "kstarsdatetime.h"
+
+class QWidget;
+class QTextStream;
+class KSPlanet;
+class KSMoon;
+class KSSun;
+class KSPluto;
+
+/**
+ *@author Pablo de Vicente
+ */
+
+class modCalcPlanets : public modCalcPlanetsDlg {
+
+Q_OBJECT
+
+public:
+ modCalcPlanets(QWidget *p, const char *n);
+ ~modCalcPlanets();
+
+public slots:
+
+ void slotComputePosition (void);
+ void slotClear(void);
+ void slotUtCheckedBatch();
+ void slotDateCheckedBatch();
+ void slotLongCheckedBatch();
+ void slotLatCheckedBatch();
+ void slotPlanetsCheckedBatch();
+ void slotInputFile();
+ void slotOutputFile();
+ void slotRunBatch();
+ void processLines( QTextStream &istream );
+ //void slotInputFile();
+ //void slotOutputFile();
+ //void slotRunBatch();
+
+private:
+
+ void showCurrentDateTime (void);
+ KStarsDateTime getDateTime (void);
+ void showLongLat(void);
+ GeoLocation getObserverPosition (void);
+ void showCoordinates( const KSPlanet &ksp );
+ void showCoordinates( const KSMoon &ksp );
+ void showCoordinates( const KSSun &ksp );
+ void showCoordinates( const KSPluto &ksp );
+ void showHeliocentricEclipticCoords( const dms *hLong, const dms *hLat, double dist);
+ void showGeocentricEclipticCoords( const dms *eLong, const dms *eLat, double r);
+ void showEquatorialCoords( const dms *ra, const dms *dec);
+ void showTopocentricCoords( const dms *az, const dms *el);
+ unsigned int requiredBatchFields(void);
+
+ // void processLines( QTextStream &istream );
+
+};
+
+#endif
diff --git a/kstars/kstars/tools/modcalcplanetsdlg.ui b/kstars/kstars/tools/modcalcplanetsdlg.ui
new file mode 100644
index 00000000..3788816f
--- /dev/null
+++ b/kstars/kstars/tools/modcalcplanetsdlg.ui
@@ -0,0 +1,1392 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>modCalcPlanetsDlg</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>modCalcPlanetsDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>625</width>
+ <height>510</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Solar System Bodies Coordinates</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>Interactive_Mode</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Interactive Mode</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Input Selection</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout13</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer21</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>101</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Solar system body:</string>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <item>
+ <property name="text">
+ <string>Mercury</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Venus</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Earth</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Mars</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Jupiter</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Saturn</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Uranus</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Neptune</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Pluto</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Moon</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Sun</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>planetComboBox</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer22</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>151</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout14</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout20</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="ExtDateEdit" row="1" column="1">
+ <property name="name">
+ <cstring>dateBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QTimeEdit" row="0" column="1">
+ <property name="name">
+ <cstring>timeBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>timLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Universal time:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>dateLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Date:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer10</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>50</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout11</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>longLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Longitude:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>longBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>latLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Latitude:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>latBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer14</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout13</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox3</cstring>
+ </property>
+ <property name="title">
+ <string>Equatorial Coordinates</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout11</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>raBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel9</cstring>
+ </property>
+ <property name="text">
+ <string>Right ascension:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel10</cstring>
+ </property>
+ <property name="text">
+ <string>Declination:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>decBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer13</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox4</cstring>
+ </property>
+ <property name="title">
+ <string>Topocentric Coordinates</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout12</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel11</cstring>
+ </property>
+ <property name="text">
+ <string>Azimuth:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>altBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel12</cstring>
+ </property>
+ <property name="text">
+ <string>Altitude:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>azBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer16_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Ecliptic Coordinates</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout8</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>sunDistBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel8</cstring>
+ </property>
+ <property name="text">
+ <string>Dist. to Sun (AU):</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>helLongBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Heliocentric long.:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>helLatBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>Heliocentric lat.:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer11</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout9</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel8_2</cstring>
+ </property>
+ <property name="text">
+ <string>Dist. to Earth (AU):</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>earthDistBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel6</cstring>
+ </property>
+ <property name="text">
+ <string>Geocentric long.:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>geoLongBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>geoLatBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel7</cstring>
+ </property>
+ <property name="text">
+ <string>Geocentric lat.:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer17</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>111</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>computeButton</cstring>
+ </property>
+ <property name="text">
+ <string>Compute</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>61</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>clearButton</cstring>
+ </property>
+ <property name="text">
+ <string>Clear</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>91</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>60</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Batch Mode</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>InputBox_2_2</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Select Fields in Input File</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTimeEdit" row="1" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>utBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="2" column="4">
+ <property name="name">
+ <cstring>latBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="0">
+ <property name="name">
+ <cstring>dateCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Date:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="ExtDateEdit" row="2" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>dateBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="3">
+ <property name="name">
+ <cstring>latCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Latitude:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="4">
+ <property name="name">
+ <cstring>longBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="3">
+ <property name="name">
+ <cstring>longCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Longitude:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>utCheckBatch</cstring>
+ </property>
+ <property name="autoMask">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>UT:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>planetCheckBatch</cstring>
+ </property>
+ <property name="autoMask">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Solar system body:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="0" column="2" rowspan="1" colspan="2">
+ <item>
+ <property name="text">
+ <string>Mercury</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Venus</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Earth</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Mars</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Jupiter</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Saturn</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Uranus</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Neptune</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Pluto</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Moon</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Sun</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>planetComboBoxBatch</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>InputBox_2_2_2</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Select Fields in Output File</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>helEclCheckBatch</cstring>
+ </property>
+ <property name="autoMask">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Heliocentric ecliptic coordinates</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>equGeoCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Equatorial geocentric coordinates</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="2">
+ <property name="name">
+ <cstring>topoCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Topocentric coordinates</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="2">
+ <property name="name">
+ <cstring>geoEclCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Geocentric ecliptic coordinates</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup4_2</cstring>
+ </property>
+ <property name="title">
+ <string>Fields in Output File Plus Result</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>allRadioBatch</cstring>
+ </property>
+ <property name="text">
+ <string>All parameters</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>inputRadioBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Only parameters in input file</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox4_2</cstring>
+ </property>
+ <property name="title">
+ <string>Files</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton" row="0" column="0">
+ <property name="name">
+ <cstring>InputButtonBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Input File...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>File with the input data</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>InputLineEditBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>OutputLineEditBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>OutButtonBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Output File...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>File for the output data</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout14_2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer20</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>151</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>runButtonBatch</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Run</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer19</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>131</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer16</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>dmsBox</class>
+ <header location="global">../dmsbox.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+ <customwidget>
+ <class>ExtDateEdit</class>
+ <header location="local">libkdeedu/extdate/extdatetimeedit.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image1</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1163">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000045249444154388d8d95bf8b1d5514c73fbb19e40cbce81d788199b8911d48304f8cf0524876316016031ab14819acfcd1f8a34ba72222fe0b369a54a216a216c158049222645f131221c10928dc852cdc0bfb600e66dc39c58558ccee6ab0c93497c3650edff339df99efc28df51bec3e9f7cfee6438b8662800086431eab2e971c5f7cf4edc26eaf851beb37b8f8fd870f67d73c6fbf759e5c0427156a0149d0621414b4b414c8bf756a013033c2a6a7f19e181b564e56bc73eec2420630bbee39ffdec7b8aac61e2861ee294460046bd309860720a8079f13e60149156a8a2000d4076a48c6ec7ae09d73b070ead5f2e199d31f50d735b66534b161b254524f6bea25a14d1b90c2300146d080ce8de68ed06ed65832cc0ceb0ceb7bda79445c4f66117211ec81e1a3677a78c299d7a6281e3fbf0c29d29a2717a14d4231ca2153a6e386b8e1f1b355821a4e84f8a0a7c81c3e06324d86938a103d93c335aba76ba2cdb8152f42f2f83f1c39397d6a29b21cad846a6ca841b9acf45ca5bd721cd516b26127206464825aa05eaa583b3d41d33ab736bfc4d4b87d6d421b6b2c2992392c296e24544703d395801ad44b861e0d70b326a67687b9b148322401fb0dc3f37bfc0e9d1b572f4d089b15660a0866caea4b42b1dcd2dcac985daf910c34c1e458c0b21d97240320739960c0f1e74b7c77154b8166564357018ac8a0f4ccd9299313400afc8427dc9de0ca96fa88a2c9a88f2ab7b784227328b0a8c910725a3ca4488c10361e557ae69515565f9e528843cd58391d319478b7460d9c808c5b4068d3f0de229960f4149283192e1b188938c0583d3165edd4142742df298231fbd5e170f4095cc6c0fac880808cff30065a0bc8c86129df533a3d5a72eaec041941d006231034d0ce0bd4142c27ce0527a0dd4ee3341c8bbb8c498225a17413c0a80f3bd6ce55146284ee369622da790a27ac9d6da99604b29eb21cac276998b0c8dc207c97b1760dce0123a84b21a8a2ea310b80e2e781ca419f846a5c307d2360731d186730bb93ff9f714b4b1b05eb22c508ea9516498e1fbf51426cb87ca965fd879ae61ee41458eaa91cc838ec3116dc238c33924182e68e21638f594fb90cc7cf7ad67f7e8e9fbe2e201348cafaa58a76ab657a32a21a061f9b8139fc9ff208e37d470ebacfea675f80edfdc46dcf812ad26d1ba39171a0dec289903f39a77a26b1df751caa3bd2e2fd9da6e0b20cb5c4f8a0b1713707cbe8d27c601c36fdb0c0cde1d737990e9fab1b194c1b6a618fe530f6e002c964cfc7fdfec8f214665706d6fb8ebd587ef6f75f89d1be02ddeeb058717f13aaa7c09e30dc13a0db0ca78164d019d8d698e66ec1a1a73b4207767fcc9ff772547bc6e36c489077df7ffd6139aec9c541b21da64679c428c62de531831e72c06f086d2c885e2009e524522df534bf41b80f3a572e7cf5cb90202b272b66d7036e6414385a8664686e4341cdfa15ddcbc5dd7b3048463f733402a41eed947ad9fd9b79ff0dd3b8a97b8ac976b6fc187559c2179ffeb817a6ff006d91847a48e5abd70000000049454e44ae426082</data>
+ </image>
+ <image name="image1">
+ <data format="PNG" length="872">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000032f49444154388db5953148254718c77f1e5b7c030ab3e0c12e5ce00927f88a14af7d87c5590ac29d6013b0497b844008a9120e1248938354a6b1482131cde5a510b4f03081f07c8d4421c2063cd85708bbe0831938613ec8c0a5588dd1dc33452e5f33bb33c36f7ffbed7fd889fe7e9fcb7ad07df09ab750fdfdfec4c425787b6bfb757bae8df79e6a54e1bcc36008845b47e71dc549c1e06000f10a9e5c9a3effee39690ef92cb4a25e2c3b4804709844807035cfd57d7122f0ad65f0c25f0703d4a39af41d28473fa0af4a42548c81f007f85aa86a4510cc34cccc8288420405640ad2bbcadfeb2fb01b39021e7d5513a2c74c59ca43d8db510e0f6a24018d8a2496ecbeb0b892d29d0f08cdbc9d149ac7dc0057bea2831262853196fd5d6573dd43046b85fcbe2002d55019be54bef9a2a45ecd585e059106fe46639318403153427908bd0be8e2a38c874b90e70692806acade4ea0b7eee96d0cc9b2360b8f0d92e835e33b97172106400801b6b73c1a95c54719cbef439a2b9a54f833c3f68f8ec59594f73eb090089b1b153afa67e4ae1b270e5fa7144725d636a6228d853fcf59fbca511e7bdc193cf92467b0eb297f578a2220721d7ccdd82442553b48206f417a1714c5fb94b5cf2b8a638f58a13b9fc2a4a3ddb16854aa53d03806dcf4180481a8d8c98b8f7296b3f6a5a33c6ee2652785fc1ea4d2bcaf248246901bca377a0c661a482cc5505135ecbd088de9a490ddb30c8735cf9e5614872955a96854665a066e4f85a33d0bad96500f95bd9dc0f26a8a3b53ba0f53f20c9e3d85e1cb9a4f3facd0734f9659da1da8ea5b7a0c02a22cae081a95deba676fc7f1e4a39cce7ca0d5097cfc594e9659fca88608dd25cbccdcbfe6384014baf3509f66f436866c7e0d835d4ffb5d0b0954a5c38fb4e92d4af18b521c19ac8c39796ee42ecebe22c0f2aa90656d7adf5714c74a71346c7647b0d39685c7965f7f52aa738fc6947a34c6b83829284a41d2c6441258580a74e7738a22509d36d0bc65687760660e8a25033187c451fec69bc1838301ac0b69de444ad53779c32317bb2481f2d437b9dd6adae13d14874a558f3126c2e0e7cbc59be3b81abf7e67ecca7fac3bd0fca3fe17f0db86f7f7fb137f0208c29bb2c76e387f0000000049454e44ae426082</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>computeButton</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcPlanetsDlg</receiver>
+ <slot>slotComputePosition()</slot>
+ </connection>
+ <connection>
+ <sender>clearButton</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcPlanetsDlg</receiver>
+ <slot>slotClear()</slot>
+ </connection>
+ <connection>
+ <sender>runButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcPlanetsDlg</receiver>
+ <slot>slotRunBatch()</slot>
+ </connection>
+ <connection>
+ <sender>InputButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcPlanetsDlg</receiver>
+ <slot>slotInputFile()</slot>
+ </connection>
+ <connection>
+ <sender>OutButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcPlanetsDlg</receiver>
+ <slot>slotOutputFile()</slot>
+ </connection>
+ <connection>
+ <sender>utCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcPlanetsDlg</receiver>
+ <slot>slotUtCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>dateCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcPlanetsDlg</receiver>
+ <slot>slotDateCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>latCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcPlanetsDlg</receiver>
+ <slot>slotLatCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>longCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcPlanetsDlg</receiver>
+ <slot>slotLongCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>planetCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcPlanetsDlg</receiver>
+ <slot>slotPlanetsCheckedBatch()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>Interactive_Mode</tabstop>
+ <tabstop>planetComboBox</tabstop>
+ <tabstop>timeBox</tabstop>
+ <tabstop>dateBox</tabstop>
+ <tabstop>longBox</tabstop>
+ <tabstop>latBox</tabstop>
+ <tabstop>sunDistBox</tabstop>
+ <tabstop>earthDistBox</tabstop>
+ <tabstop>computeButton</tabstop>
+ <tabstop>clearButton</tabstop>
+ <tabstop>utBoxBatch</tabstop>
+ <tabstop>latBoxBatch</tabstop>
+ <tabstop>dateCheckBatch</tabstop>
+ <tabstop>latCheckBatch</tabstop>
+ <tabstop>longBoxBatch</tabstop>
+ <tabstop>longCheckBatch</tabstop>
+ <tabstop>utCheckBatch</tabstop>
+ <tabstop>planetCheckBatch</tabstop>
+ <tabstop>planetComboBoxBatch</tabstop>
+ <tabstop>helEclCheckBatch</tabstop>
+ <tabstop>equGeoCheckBatch</tabstop>
+ <tabstop>topoCheckBatch</tabstop>
+ <tabstop>geoEclCheckBatch</tabstop>
+ <tabstop>inputRadioBatch</tabstop>
+ <tabstop>InputButtonBatch</tabstop>
+ <tabstop>InputLineEditBatch</tabstop>
+ <tabstop>OutputLineEditBatch</tabstop>
+ <tabstop>OutButtonBatch</tabstop>
+ <tabstop>runButtonBatch</tabstop>
+</tabstops>
+<slots>
+ <slot>slotComputePosition()</slot>
+ <slot>slotClear()</slot>
+ <slot>slotInputFile()</slot>
+ <slot>slotOutputFile()</slot>
+ <slot>slotUtCheckedBatch()</slot>
+ <slot>slotDateCheckedBatch()</slot>
+ <slot>slotLongCheckedBatch()</slot>
+ <slot>slotLatCheckedBatch()</slot>
+ <slot>slotRunBatch()</slot>
+ <slot>slotPlanetsCheckedBatch()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+
+ <includehint>dmsbox.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/modcalcprec.cpp b/kstars/kstars/tools/modcalcprec.cpp
new file mode 100644
index 00000000..236bad05
--- /dev/null
+++ b/kstars/kstars/tools/modcalcprec.cpp
@@ -0,0 +1,297 @@
+/***************************************************************************
+ modcalcprec.cpp - description
+ -------------------
+ begin : Sun Jan 27 2002
+ copyright : (C) 2002 by Pablo de Vicente
+ email : vicente@oan.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "modcalcprec.h"
+#include "modcalcprec.moc"
+#include "dmsbox.h"
+#include "skypoint.h"
+#include "dms.h"
+#include "kstarsdatetime.h"
+
+#include <qcheckbox.h>
+#include <qradiobutton.h>
+#include <qtextstream.h>
+#include <klocale.h>
+#include <klineedit.h>
+#include <kapplication.h>
+#include <kfiledialog.h>
+#include <kmessagebox.h>
+
+modCalcPrec::modCalcPrec(QWidget *parentSplit, const char *name) : modCalcPrecDlg(parentSplit,name) {
+
+ ra0Box->setDegType(FALSE);
+ rafBox->setDegType(FALSE);
+ show();
+
+}
+
+modCalcPrec::~modCalcPrec(){
+
+}
+
+SkyPoint modCalcPrec::getEquCoords (void) {
+ dms raCoord, decCoord;
+
+ raCoord = ra0Box->createDms(FALSE);
+ decCoord = dec0Box->createDms();
+
+ SkyPoint sp = SkyPoint (raCoord, decCoord);
+
+ return sp;
+}
+
+QString modCalcPrec:: showCurrentEpoch () {
+
+ double epoch = setCurrentEpoch();
+ QString eName = QString("%1").arg(epoch,7,'f',2);
+
+ return eName;
+}
+
+double modCalcPrec::setCurrentEpoch () {
+ return KStarsDateTime::currentDateTime().epoch();
+}
+
+double modCalcPrec::getEpoch (QString eName) {
+ bool ok = false;
+ double epoch = eName.toDouble(&ok);
+
+ if ( ok )
+ return epoch;
+ else {
+ kdDebug() << i18n( "Could not parse epoch string; assuming J2000" ) << endl;
+ return 2000.0;
+ }
+}
+
+void modCalcPrec::slotClearCoords (void) {
+
+ ra0Box->clearFields();
+ dec0Box->clearFields();
+ rafBox->clearFields();
+ decfBox->clearFields();
+ epoch0Name->setText("");
+ epochfName->setText("");
+
+}
+
+void modCalcPrec::slotComputeCoords (void) {
+
+ SkyPoint sp;
+
+ sp = getEquCoords();
+
+ double epoch0 = getEpoch( epoch0Name->text() );
+ double epochf = getEpoch( epochfName->text() );
+
+ KStarsDateTime dt;
+ dt.setFromEpoch( epoch0 );
+ long double jd0 = dt.djd();
+ dt.setFromEpoch( epochf );
+ long double jdf = dt.djd();
+
+ sp.precessFromAnyEpoch(jd0, jdf);
+
+ showEquCoords( sp );
+
+}
+
+void modCalcPrec::showEquCoords ( SkyPoint sp ) {
+ rafBox->show( sp.ra(),FALSE );
+ decfBox->show( sp.dec() );
+}
+
+void modCalcPrec::slotRaCheckedBatch(){
+
+ if ( raCheckBatch->isChecked() )
+ raBoxBatch->setEnabled( false );
+ else {
+ raBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcPrec::slotDecCheckedBatch(){
+
+ if ( decCheckBatch->isChecked() )
+ decBoxBatch->setEnabled( false );
+ else {
+ decBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcPrec::slotEpochCheckedBatch(){
+
+ if ( epochCheckBatch->isChecked() )
+ epochBoxBatch->setEnabled( false );
+ else {
+ epochBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcPrec::slotTargetEpochCheckedBatch(){
+
+ if ( targetEpochCheckBatch->isChecked() )
+ targetEpochBoxBatch->setEnabled( false );
+ else {
+ targetEpochBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcPrec::slotInputFile() {
+ QString inputFileName;
+ inputFileName = KFileDialog::getOpenFileName( );
+ InputLineEditBatch->setText( inputFileName );
+}
+
+void modCalcPrec::slotOutputFile() {
+ QString outputFileName;
+ outputFileName = KFileDialog::getSaveFileName( );
+ OutputLineEditBatch->setText( outputFileName );
+
+
+}
+
+void modCalcPrec::slotRunBatch() {
+
+ QString inputFileName;
+
+ inputFileName = InputLineEditBatch->text();
+
+ // We open the input file and read its content
+
+ if ( QFile::exists(inputFileName) ) {
+ QFile f( inputFileName );
+ if ( !f.open( IO_ReadOnly) ) {
+ QString message = i18n( "Could not open file %1.").arg( f.name() );
+ KMessageBox::sorry( 0, message, i18n( "Could Not Open File" ) );
+ inputFileName = "";
+ return;
+ }
+
+// processLines(&f);
+ QTextStream istream(&f);
+ processLines(istream);
+// readFile( istream );
+ f.close();
+ } else {
+ QString message = i18n( "Invalid file: %1" ).arg( inputFileName );
+ KMessageBox::sorry( 0, message, i18n( "Invalid file" ) );
+ inputFileName = "";
+ InputLineEditBatch->setText( inputFileName );
+ return;
+ }
+}
+
+void modCalcPrec::processLines( QTextStream &istream ) {
+
+ // we open the output file
+
+// QTextStream istream(&fIn);
+ QString outputFileName;
+ outputFileName = OutputLineEditBatch->text();
+ QFile fOut( outputFileName );
+ fOut.open(IO_WriteOnly);
+ QTextStream ostream(&fOut);
+
+ QString line;
+ QString space = " ";
+ int i = 0;
+ long double jd0, jdf;
+ SkyPoint sp;
+ dms raB, decB;
+ double epoch0B, epochfB;
+ KStarsDateTime dt0, dtf;
+
+ while ( ! istream.eof() ) {
+ line = istream.readLine();
+ line.stripWhiteSpace();
+
+ //Go through the line, looking for parameters
+
+ QStringList fields = QStringList::split( " ", line );
+
+ i = 0;
+
+ // Read RA and write in ostream if corresponds
+
+ if(raCheckBatch->isChecked() ) {
+ raB = dms::fromString( fields[i],FALSE);
+ i++;
+ } else
+ raB = raBoxBatch->createDms(FALSE);
+
+ if ( allRadioBatch->isChecked() )
+ ostream << raB.toHMSString() << space;
+ else
+ if(raCheckBatch->isChecked() )
+ ostream << raB.toHMSString() << space;
+
+ // Read DEC and write in ostream if corresponds
+
+ if(decCheckBatch->isChecked() ) {
+ decB = dms::fromString( fields[i], TRUE);
+ i++;
+ } else
+ decB = decBoxBatch->createDms();
+
+ if ( allRadioBatch->isChecked() )
+ ostream << decB.toDMSString() << space;
+ else
+ if(decCheckBatch->isChecked() )
+ ostream << decB.toDMSString() << space;
+
+ // Read Epoch and write in ostream if corresponds
+
+ if(epochCheckBatch->isChecked() ) {
+ epoch0B = fields[i].toDouble();
+ i++;
+ } else
+ epoch0B = getEpoch( epochBoxBatch->text() );
+
+ if ( allRadioBatch->isChecked() )
+ ostream << epoch0B;
+ else
+ if(epochCheckBatch->isChecked() )
+ ostream << epoch0B;
+
+ // Read Target epoch and write in ostream if corresponds
+
+ if(targetEpochCheckBatch->isChecked() ) {
+ epochfB = fields[i].toDouble();
+ i++;
+ } else
+ epochfB = getEpoch( targetEpochBoxBatch->text() );
+
+ if ( allRadioBatch->isChecked() )
+ ostream << epochfB << space;
+ else
+ if(targetEpochCheckBatch->isChecked() )
+ ostream << epochfB << space;
+
+ dt0.setFromEpoch( epoch0B );
+ dtf.setFromEpoch( epoch0B );
+ jd0 = dt0.djd();
+ jdf = dtf.djd();
+ sp = SkyPoint (raB, decB);
+ sp.precessFromAnyEpoch(jd0, jdf);
+
+ ostream << sp.ra()->toHMSString() << space << sp.dec()->toDMSString() << endl;
+ }
+
+
+ fOut.close();
+}
diff --git a/kstars/kstars/tools/modcalcprec.h b/kstars/kstars/tools/modcalcprec.h
new file mode 100644
index 00000000..f5b28078
--- /dev/null
+++ b/kstars/kstars/tools/modcalcprec.h
@@ -0,0 +1,67 @@
+/***************************************************************************
+ modcalcprec.h - description
+ -------------------
+ begin : Sun Jan 27 2002
+ copyright : (C) 2002 by Pablo de Vicente
+ email : vicente@oan.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 MODCALCPREC_H
+#define MODCALCPREC_H
+
+#include "modcalcprecdlg.h"
+
+/**
+ * Class which implements the KStars calculator precession module. Precesses
+ * coordinates between different epochs. Conversions are performed assuming
+ * that coordinates are in the FK5 system. For example the conversion between
+ * B1950 and J2000 is not exact.
+ *
+ * Inherits modCalcPrecDlg
+ *@author Pablo de Vicente
+ *@version 0.9
+ */
+
+class QString;
+class dms;
+class SkyPoint;
+
+class modCalcPrec : public modCalcPrecDlg {
+
+Q_OBJECT
+public:
+ modCalcPrec(QWidget *p, const char *n);
+ ~modCalcPrec();
+ SkyPoint precess (dms ra0, dms dec0, double e0, double ef);
+
+public slots:
+ void slotClearCoords (void);
+ void slotComputeCoords (void);
+ void slotRaCheckedBatch(void);
+ void slotDecCheckedBatch(void);
+ void slotEpochCheckedBatch(void);
+ void slotTargetEpochCheckedBatch(void);
+ void slotInputFile(void);
+ void slotOutputFile(void);
+ void slotRunBatch(void);
+
+private:
+ SkyPoint getEquCoords(void);
+ QString showCurrentEpoch(void);
+ double setCurrentEpoch(void);
+ double getEpoch (QString eName);
+ void showEquCoords ( SkyPoint sp );
+ void processLines( QTextStream &istream );
+
+};
+
+#endif
diff --git a/kstars/kstars/tools/modcalcprecdlg.ui b/kstars/kstars/tools/modcalcprecdlg.ui
new file mode 100644
index 00000000..ae895f9d
--- /dev/null
+++ b/kstars/kstars/tools/modcalcprecdlg.ui
@@ -0,0 +1,758 @@
+<!DOCTYPE UI><UI version="3.1.2" stdsetdef="1">
+<class>modCalcPrecDlg</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>modCalcPrecDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>548</width>
+ <height>481</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Precession</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tabWidget3</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Interactive Mode</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>InputBox</cstring>
+ </property>
+ <property name="title">
+ <string>Input Coordinates</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer35</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>98</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout25</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>epoch0Label</cstring>
+ </property>
+ <property name="text">
+ <string>Input epoch:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>dec0Box</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>ra0Box</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>ra0Label</cstring>
+ </property>
+ <property name="text">
+ <string>Right ascension:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="3" column="1">
+ <property name="name">
+ <cstring>epochfName</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>epoch0Name</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>dec0Label</cstring>
+ </property>
+ <property name="text">
+ <string>Declination:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>epochfLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Target epoch:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer34</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>98</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>91</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>Compute</cstring>
+ </property>
+ <property name="text">
+ <string>Compute</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>51</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>Clear</cstring>
+ </property>
+ <property name="text">
+ <string>Clear</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>91</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer15</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>outputBox</cstring>
+ </property>
+ <property name="title">
+ <string>Precessed Coordinates</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer36</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>90</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout26</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>rafLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Right ascension:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>decfLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Declination:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>decfBox</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>rafBox</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer37</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>90</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer14</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>70</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Batch Mode</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>InputBox_2_2</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Select Fields in Input File</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>decBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>raBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>decCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Declination:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="0">
+ <property name="name">
+ <cstring>epochCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Input epoch:</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="3" column="0">
+ <property name="name">
+ <cstring>targetEpochCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Target epoch:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>epochBoxBatch</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="3" column="1">
+ <property name="name">
+ <cstring>targetEpochBoxBatch</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>raCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Right ascension:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup4_2</cstring>
+ </property>
+ <property name="title">
+ <string>Fields in Output File Plus Result</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>allRadioBatch</cstring>
+ </property>
+ <property name="text">
+ <string>All parameters</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>inputRadioBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Only parameters in input file</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox4_2</cstring>
+ </property>
+ <property name="title">
+ <string>Files</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton" row="0" column="0">
+ <property name="name">
+ <cstring>InputButtonBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Input File...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>File with the input data</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>InputLineEditBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>OutputLineEditBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>OutButtonBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Output File...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>File for the output data</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout14_2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer20_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>151</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>runButtonBatch_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Run</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer19_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>131</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer25</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>30</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>dmsBox</class>
+ <header location="global">dmsbox.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="4350">789c6dd7594f23471007f0f7fd14d6d6db2aaaf58c3db647511eb831b7317794879ac30760cc61c010e5bba7dcf5af5688167664fdb66bbaababbb67cccf1f8dab93c3c68f9fdf5e16b298968d7222cf8d1fd5eb6cf6f1e75f7ffcfded7b9a3656ff9aad46fafdb76fdf078b46d9389a3fd42bf04841699e964933b830b79a7019dd0b96955b895b5a703bcd572e08eea576ff6570ae0eedd477b792103f854b8b2fc6d1163f77237e646e37113f89b6f8307e3bf1785a8b0eedbc696eb7ad9db7e01ee6476ee4ffe0c6fd158c7c69182cde4eec6e87fea50dfbf8176e6ba7d07f96669999cfa325ccaf862bcc97a36dbccf60f178cee11cde706761f16917ae30fe6b7488a7851bf14d7327417f676eb4f756eea41e2f57e6d83e83919f6cba117f04235fd9765b3b0fa36dfc398cf973edc67a6fb951ffe768ab6765ee26b8dff213ef5f4630e2b9e7463ea7ee8ee5ff60ee2618af8eb6fe3238437eb91bf1299cdbfacad3cadd5617f5a11738c7fe4adcb8ffd68d7aeec15e8fc3683b9f62ee2518ef33dafa3f75e3bc957086f86eb4d56f3db8e8e6dd56f01a5cc1bbe65e629673d8ebd18d0efdc9058cf9f2c08df9e630ce037db8719ec37c7a9a7fb708f10267b65e7cef46fb3e9ca3fd23dad6ef0cf67abe99f304f95ec3a8871cbb71be52d8d777e8b6fee412f6f958be3adf5ea817b561afe7d86ded7c67ce13c46fc37ede2766c17a17059cd9f38e466e8c3f8eb6fd700f0b9ef7095c37cd3d37de178f2be76dcf876fa343bd790267f012f67a77cc319f69b4ed872e2ca8e732daeabfe3c6fa9cc235f21f9b8bd4f2a5cd687bfedbfd659ee7ede017b842becf6eb44fa3cbd0df8559b0ffe808ceb0ff37e01afba3652e52cc87a26dbe276ecca7097790ff73b4cdef0616ac4fdf6df1c2d1d67ee8c6f80318eb4bd1180ff529513f0ecf7b694b62f5a002ceccb2662e523c2fb7605f9f0fd8fbbf75e3bc2dcd3e9ebcb9f17ce8c05e8f83685bcf701e44eb2db65e4fd1b65eebe62245be53b8c6f3ffdd8dfd3933fbf884761f5f0edcd88f951bf118bf44bde926dae24fe01ae7af76e3f9169e2f45bb143c0f5fdcf6fea23b18f773eac6f3e63ddac6db75e37df5e8c6fbae65aebcde6d37beaf84f528aa52f03c9dc3359ea79939c627d136deab1befaf75b883ef23e76e3ccfaea36d7dc2f795322b05ebfb0ad738af7db7ad371f99fd7e59b8b13f276e9cdf1318f5e54337e6d78cb67cf761ec170efba1acaa1afd9db92d3f3a36d729ea77efc6f33cbccf2beddfe6478fe6d85e45dbfd851bf1577007f5d877e3bc86f5a9ea3a2d6cffdfc1debe116df5db73a39e37b0e777191dda257c7fa83b6e8a2eaae00eeceb13d6b7d69f325b79b058fd32b170c1a55ebffaac2ccae2b9e6118f79c253bd6ef9ee3fd7587fef79c60f7acf3cc617fcc84ffcac6d8ffcc20b7ee5377ee7257ff027aff1bac66ff0269716cf5b1ab7cd3bbcabb17ddee37d3ee0433ee2633ee1019ff290cff89c2ff89229c48b66f1ac3d5df135df7093134eb9c56dcef4b3c35dee71ce393111dbfa8c784a4205955451cd1d1ad1982634a55bbad3f80eddd38c1ef882e66cf52ab5ff2b8d7ea4277aa6175ad06bb866f446efb4d4df0ffad4fed762ffb7b44e1b9cd2266dd142c75e5ddb3cd0bb3e347a477bd9d5f83ee245e3f7689f0ee830f67d44c77412ee186946033aa5e197fecfe85c7bf7be2fe892aee89a6ea84989f6bfa434f4eff9df52c509b5d0779b32ea684d13ea528f728d1e882ebfce37f6cf077422b4ea5b440ad14af1a15452ab473aee52c65ff39789b64fe955f44eb9937b5d858c5b32d377c0c32a7fee7ecd5fe61aff284ff22c2fb290577993775db1443fb53ef2219f5ff2bf93356d5b970dd9d41eb77820dbb223bbab155ed55ffab2f725ffb1eccb81aed6931cca116ab490633909d10339fd5ffdef795d869ae7923bc27226e772415d5986b51d683663b9d4fcfbb1ff190fe54aaec35aeaa577ee20f24673e94b531249a585fc2b69ebfe3ed7dae91f75ba964b5c03e9d344ba1add93bce0826c3f87f3b2a9fb6f18aeba10ba2f563f25eb1b563771a5d17531e2513c5fba538b3111cd690dd73c7ef6a95f4c8aa99de12fe77da4951de9ffffea730be7fd9fdfbffd0b690edc6c</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>Compute</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcPrecDlg</receiver>
+ <slot>slotComputeCoords()</slot>
+ </connection>
+ <connection>
+ <sender>Clear</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcPrecDlg</receiver>
+ <slot>slotClearCoords()</slot>
+ </connection>
+ <connection>
+ <sender>raCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcPrecDlg</receiver>
+ <slot>slotRaCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>decCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcPrecDlg</receiver>
+ <slot>slotDecCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>epochCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcPrecDlg</receiver>
+ <slot>slotEpochCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>targetEpochCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcPrecDlg</receiver>
+ <slot>slotTargetEpochCheckedBatch()</slot>
+ </connection>
+ <connection>
+ <sender>InputButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcPrecDlg</receiver>
+ <slot>slotInputFile()</slot>
+ </connection>
+ <connection>
+ <sender>OutButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcPrecDlg</receiver>
+ <slot>slotOutputFile()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>tabWidget3</tabstop>
+ <tabstop>ra0Box</tabstop>
+ <tabstop>dec0Box</tabstop>
+ <tabstop>epoch0Name</tabstop>
+ <tabstop>epochfName</tabstop>
+ <tabstop>Compute</tabstop>
+ <tabstop>Clear</tabstop>
+ <tabstop>rafBox</tabstop>
+ <tabstop>decfBox</tabstop>
+ <tabstop>raCheckBatch</tabstop>
+ <tabstop>raBoxBatch</tabstop>
+ <tabstop>decCheckBatch</tabstop>
+ <tabstop>decBoxBatch</tabstop>
+ <tabstop>epochCheckBatch</tabstop>
+ <tabstop>epochBoxBatch</tabstop>
+ <tabstop>targetEpochCheckBatch</tabstop>
+ <tabstop>targetEpochBoxBatch</tabstop>
+ <tabstop>inputRadioBatch</tabstop>
+ <tabstop>InputButtonBatch</tabstop>
+ <tabstop>InputLineEditBatch</tabstop>
+ <tabstop>OutButtonBatch</tabstop>
+ <tabstop>OutputLineEditBatch</tabstop>
+ <tabstop>runButtonBatch_2</tabstop>
+</tabstops>
+<slots>
+ <slot>slotComputeCoords()</slot>
+ <slot>slotClearCoords()</slot>
+ <slot>slotRaCheckedBatch()</slot>
+ <slot>slotDecCheckedBatch()</slot>
+ <slot>slotEpochCheckedBatch()</slot>
+ <slot>slotTargetEpochCheckedBatch()</slot>
+ <slot>slotAllRadioBatch()</slot>
+ <slot>slotInputBatch()</slot>
+ <slot>slotInputFile()</slot>
+ <slot>slotOutputFile()</slot>
+ <slot>slotRunBatch()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/modcalcsidtime.cpp b/kstars/kstars/tools/modcalcsidtime.cpp
new file mode 100644
index 00000000..b8eccfe5
--- /dev/null
+++ b/kstars/kstars/tools/modcalcsidtime.cpp
@@ -0,0 +1,328 @@
+/***************************************************************************
+ modcalcsidtime.cpp - description
+ -------------------
+ begin : Wed Jan 23 2002
+ copyright : (C) 2002 by Pablo de Vicente
+ email : vicente@oan.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include <qdatetimeedit.h> //need for QTimeEdit
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qstring.h>
+#include <qtextstream.h>
+#include <kfiledialog.h>
+#include <kmessagebox.h>
+
+#include "dmsbox.h"
+#include "modcalcsidtime.h"
+#include "modcalcsidtime.moc"
+#include "kstars.h"
+#include "kstarsdata.h"
+#include "kstarsdatetime.h"
+#include "simclock.h"
+#include "libkdeedu/extdate/extdatetimeedit.h"
+
+modCalcSidTime::modCalcSidTime(QWidget *parentSplit, const char *name) : modCalcSidTimeDlg (parentSplit,name) {
+
+ showCurrentTimeAndLong();
+ show();
+}
+
+modCalcSidTime::~modCalcSidTime(void) {
+
+}
+
+void modCalcSidTime::showCurrentTimeAndLong (void)
+{
+ KStars *ks = (KStars*) parent()->parent()->parent();
+ // modCalcSidTimeDlg -> QSplitter->AstroCalc->KStars
+
+ showUT( ks->data()->ut().time() );
+ datBox->setDate( ks->data()->ut().date() );
+
+ longBox->show( ks->geo()->lng() );
+}
+
+QTime modCalcSidTime::computeUTtoST (QTime ut, ExtDate dt, dms longitude)
+{
+ KStarsDateTime utdt = KStarsDateTime( dt, ut);
+ dms st = longitude.Degrees() + utdt.gst().Degrees();
+ return QTime( st.hour(), st.minute(), st.second() );
+}
+
+QTime modCalcSidTime::computeSTtoUT (QTime st, ExtDate dt, dms longitude)
+{
+ KStarsDateTime dtt = KStarsDateTime( dt, QTime());
+ dms lst(st.hour(), st.minute(), st.second());
+ dms gst( lst.Degrees() - longitude.Degrees() );
+ return dtt.GSTtoUT( gst );
+}
+
+void modCalcSidTime::showUT( QTime dt )
+{
+ UtBox->setTime( dt );
+}
+
+void modCalcSidTime::showST( QTime st )
+{
+ StBox->setTime( st );
+}
+
+QTime modCalcSidTime::getUT( void )
+{
+ return UtBox->time();
+}
+
+QTime modCalcSidTime::getST( void )
+{
+ return StBox->time();
+}
+
+ExtDate modCalcSidTime::getDate( void )
+{
+ return datBox->date();
+}
+
+dms modCalcSidTime::getLongitude( void )
+{
+ return longBox->createDms();
+}
+
+void modCalcSidTime::slotClearFields(){
+ datBox->setDate(ExtDate::currentDate());
+ QTime time(0,0,0);
+ UtBox->setTime(time);
+ StBox->setTime(time);
+}
+
+void modCalcSidTime::slotComputeTime(){
+ QTime ut, st;
+
+ ExtDate dt = getDate();
+ dms longitude = getLongitude();
+
+ if(UtRadio->isChecked()) {
+ ut = getUT();
+ st = computeUTtoST( ut, dt, longitude );
+ showST( st );
+ } else {
+ st = getST();
+ ut = computeSTtoUT( st, dt, longitude );
+ showUT( ut );
+ }
+
+}
+
+void modCalcSidTime::slotUtChecked(){
+
+ if ( utCheckBatch->isChecked() )
+ utBoxBatch->setEnabled( false );
+ else
+ utBoxBatch->setEnabled( true );
+}
+
+void modCalcSidTime::slotDateChecked(){
+
+ if ( dateCheckBatch->isChecked() )
+ dateBoxBatch->setEnabled( false );
+ else
+ dateBoxBatch->setEnabled( true );
+}
+
+void modCalcSidTime::slotStChecked(){
+
+ if ( stCheckBatch->isChecked() )
+ stBoxBatch->setEnabled( false );
+ else
+ stBoxBatch->setEnabled( true );
+}
+
+void modCalcSidTime::slotLongChecked(){
+
+ if ( longCheckBatch->isChecked() )
+ longBoxBatch->setEnabled( false );
+ else
+ longBoxBatch->setEnabled( true );
+}
+
+void modCalcSidTime::sidNoCheck() {
+
+ stBoxBatch->setEnabled(false);
+ stInputTime = FALSE;
+
+}
+
+void modCalcSidTime::utNoCheck() {
+
+ utBoxBatch->setEnabled(false);
+ stInputTime = TRUE;
+}
+
+void modCalcSidTime::slotInputFile() {
+ QString inputFileName;
+ inputFileName = KFileDialog::getOpenFileName( );
+ InputLineEditBatch->setText( inputFileName );
+}
+
+void modCalcSidTime::slotOutputFile() {
+ QString outputFileName;
+ outputFileName = KFileDialog::getSaveFileName( );
+ OutputLineEditBatch->setText( outputFileName );
+}
+
+
+void modCalcSidTime::slotRunBatch() {
+
+ QString inputFileName;
+
+ inputFileName = InputLineEditBatch->text();
+
+ // We open the input file and read its content
+
+ if ( QFile::exists(inputFileName) ) {
+ QFile f( inputFileName );
+ if ( !f.open( IO_ReadOnly) ) {
+ QString message = i18n( "Could not open file %1.").arg( f.name() );
+ KMessageBox::sorry( 0, message, i18n( "Could Not Open File" ) );
+ inputFileName = "";
+ return;
+ }
+
+// processLines(&f);
+ QTextStream istream(&f);
+ processLines(istream);
+// readFile( istream );
+ f.close();
+ } else {
+ QString message = i18n( "Invalid file: %1" ).arg( inputFileName );
+ KMessageBox::sorry( 0, message, i18n( "Invalid file" ) );
+ inputFileName = "";
+ InputLineEditBatch->setText( inputFileName );
+ return;
+ }
+}
+
+void modCalcSidTime::processLines( QTextStream &istream ) {
+
+ // we open the output file
+
+// QTextStream istream(&fIn);
+ QString outputFileName;
+ outputFileName = OutputLineEditBatch->text();
+ QFile fOut( outputFileName );
+ fOut.open(IO_WriteOnly);
+ QTextStream ostream(&fOut);
+
+ QString line;
+ QString space = " ";
+ int i = 0;
+ long double jd0, jdf;
+ dms longB, LST;
+ double epoch0B(0.0);
+ QTime utB, stB;
+ ExtDate dtB;
+
+ while ( ! istream.eof() ) {
+ line = istream.readLine();
+ line.stripWhiteSpace();
+
+ //Go through the line, looking for parameters
+
+ QStringList fields = QStringList::split( " ", line );
+
+ i = 0;
+
+ // Read Longitude and write in ostream if corresponds
+
+ if (longCheckBatch->isChecked() ) {
+ longB = dms::fromString( fields[i],TRUE);
+ i++;
+ } else
+ longB = longBoxBatch->createDms(TRUE);
+
+ if ( allRadioBatch->isChecked() )
+ ostream << longB.toDMSString() << space;
+ else
+ if (longCheckBatch->isChecked() )
+ ostream << longB.toDMSString() << space;
+
+ // Read date and write in ostream if corresponds
+
+ if(dateCheckBatch->isChecked() ) {
+ dtB = ExtDate::fromString( fields[i] );
+ i++;
+ } else
+ dtB = dateBoxBatch->date();
+ if ( allRadioBatch->isChecked() )
+ ostream << dtB.toString().append(space);
+ else
+ if(dateCheckBatch->isChecked() )
+ ostream << dtB.toString().append(space);
+
+
+ // We make the first calculations
+ KStarsDateTime dt;
+ dt.setFromEpoch( epoch0B );
+ jdf = KStarsDateTime(dtB,utB).djd();
+ jd0 = dt.djd();
+
+ LST = dms( longB.Degrees() + KStarsDateTime(dtB,utB).gst().Degrees() );
+
+ // Universal Time is the input time.
+ if (!stInputTime) {
+
+ // Read Ut and write in ostream if corresponds
+
+ if(utCheckBatch->isChecked() ) {
+ utB = QTime::fromString( fields[i] );
+ i++;
+ } else
+ utB = utBoxBatch->time();
+
+ if ( allRadioBatch->isChecked() )
+ ostream << utB.toString() << space;
+ else
+ if(utCheckBatch->isChecked() )
+ ostream << utB.toString() << space;
+
+
+ stB = computeUTtoST( utB, dtB, longB );
+ ostream << stB.toString() << endl;
+
+ // Input coords are horizontal coordinates
+
+ } else {
+
+ if(stCheckBatch->isChecked() ) {
+ stB = QTime::fromString( fields[i] );
+ i++;
+ } else
+ stB = stBoxBatch->time();
+
+ if ( allRadioBatch->isChecked() )
+ ostream << stB.toString() << space;
+ else
+ if(stCheckBatch->isChecked() )
+ ostream << stB.toString() << space;
+
+
+ utB = computeSTtoUT( stB, dtB, longB );
+ ostream << utB.toString() << endl;
+
+ }
+
+ }
+
+
+ fOut.close();
+}
diff --git a/kstars/kstars/tools/modcalcsidtime.h b/kstars/kstars/tools/modcalcsidtime.h
new file mode 100644
index 00000000..8e0f3842
--- /dev/null
+++ b/kstars/kstars/tools/modcalcsidtime.h
@@ -0,0 +1,88 @@
+/***************************************************************************
+ modcalcsidtime.h - description
+ -------------------
+ begin : Wed Jan 23 2002
+ copyright : (C) 2002 by Pablo de Vicente
+ email : vicente@oan.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 MODCALCSIDTIME_H
+#define MODCALCSIDTIME_H
+
+#include "modcalcsidtimedlg.h"
+#include <kapplication.h>
+
+/**
+ * Class which implements the KStars calculator module to compute Universal
+ * time to/from Sidereal time.
+ *
+ * Inherits modCalcSidTimeDlg
+ *@author Pablo de Vicente
+ *@version 0.9
+ */
+
+class dms;
+class QTime;
+class ExtDate;
+
+class modCalcSidTime : public modCalcSidTimeDlg {
+
+Q_OBJECT
+
+public:
+
+ modCalcSidTime(QWidget *p, const char *n);
+ ~modCalcSidTime();
+
+ QTime computeUTtoST (QTime u, ExtDate d, dms l);
+ QTime computeSTtoUT (QTime s, ExtDate d, dms l);
+
+public slots:
+
+
+ /** No descriptions */
+ void slotClearFields();
+
+ /** No descriptions */
+ void slotComputeTime();
+
+ void slotUtChecked();
+ void slotDateChecked();
+ void slotStChecked();
+ void slotLongChecked();
+ void slotInputFile();
+ void slotOutputFile();
+ void slotRunBatch();
+ void processLines( QTextStream &istream );
+
+private:
+
+ void showUT ( QTime ut );
+ void showST ( QTime st );
+
+ /* Fills the UT, Date boxes with the current time
+ * and date and the longitude box with the current Geo location
+ */
+ void showCurrentTimeAndLong (void);
+
+ void sidNoCheck();
+ void utNoCheck();
+
+ QTime getUT (void);
+ QTime getST (void);
+ ExtDate getDate (void);
+ dms getLongitude (void);
+ bool stInputTime;
+
+};
+
+#endif
diff --git a/kstars/kstars/tools/modcalcsidtimedlg.ui b/kstars/kstars/tools/modcalcsidtimedlg.ui
new file mode 100644
index 00000000..eea8681c
--- /dev/null
+++ b/kstars/kstars/tools/modcalcsidtimedlg.ui
@@ -0,0 +1,870 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>modCalcSidTimeDlg</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>modCalcSidTimeDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>580</width>
+ <height>421</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Sidereal Time</string>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tabWidget2</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Interactive Mode</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout47</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>InputBox</cstring>
+ </property>
+ <property name="title">
+ <string>Input Selection</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>UtRadio</cstring>
+ </property>
+ <property name="text">
+ <string>Universal time</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>StRadio</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>TabFocus</enum>
+ </property>
+ <property name="text">
+ <string>Sidereal time</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>longdataBox</cstring>
+ </property>
+ <property name="title">
+ <string>Date &amp;&amp; Location</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>dateBox</cstring>
+ </property>
+ <property name="text">
+ <string>Date:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>longLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Longitude:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>longBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="ExtDateEdit" row="0" column="1">
+ <property name="name">
+ <cstring>datBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer8</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>41</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>Compute</cstring>
+ </property>
+ <property name="text">
+ <string>Convert</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>101</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>Clear</cstring>
+ </property>
+ <property name="text">
+ <string>Clear</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>41</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout47</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>UtimeBox</cstring>
+ </property>
+ <property name="title">
+ <string>Universal Time</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer76</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>UtLabel</cstring>
+ </property>
+ <property name="text">
+ <string>UT:</string>
+ </property>
+ </widget>
+ <widget class="QTimeEdit">
+ <property name="name">
+ <cstring>UtBox</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>30</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>St0Box</cstring>
+ </property>
+ <property name="title">
+ <string>Sidereal Time</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer77</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>StLabel</cstring>
+ </property>
+ <property name="text">
+ <string>ST:</string>
+ </property>
+ </widget>
+ <widget class="QTimeEdit">
+ <property name="name">
+ <cstring>StBox</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>30</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>204</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Batch Mode</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>InputBox_2_2_2</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>90</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Select Fields in Input File</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout30</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>longCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Longitude:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>If checked, value will be read from input file. If not, value will be read from adjacent box</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>utCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Univ. time:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>If checked, value will be read from input file. If not, value will be read from adjacent box</string>
+ </property>
+ </widget>
+ <widget class="QTimeEdit" row="1" column="1">
+ <property name="name">
+ <cstring>utBoxBatch</cstring>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>longBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer48</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout32</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="ExtDateEdit" row="0" column="1">
+ <property name="name">
+ <cstring>dateBoxBatch</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QTimeEdit" row="1" column="1">
+ <property name="name">
+ <cstring>stBoxBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>stCheckBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Sid. time:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>If checked, value will be read from input file. If not, value will be read from adjacent box</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>dateCheckBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Date:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>If checked, value will be read from input file. If not, value will be read from adjacent box</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer49</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonFieldsGroup</cstring>
+ </property>
+ <property name="title">
+ <string>Fields in Output File Plus Result</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>allRadioBatch</cstring>
+ </property>
+ <property name="text">
+ <string>All parameters</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>inputRadioBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Only parameters in input file</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupFilesBox</cstring>
+ </property>
+ <property name="title">
+ <string>Files</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton" row="0" column="0">
+ <property name="name">
+ <cstring>InputButtonBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Input File...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>File with the input data</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>InputLineEditBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>OutputLineEditBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>OutButtonBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Output File...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>File for the output data</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout22_3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer20_2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>151</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>runButtonBatch</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Run</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer19_2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>131</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer50</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>31</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>dmsBox</class>
+ <header location="global">../dmsbox.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+ <customwidget>
+ <class>ExtDateEdit</class>
+ <header location="local">libkdeedu/extdate/extdatetimeedit.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image1</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1163">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000045249444154388d8d95bf8b1d5514c73fbb19e40cbce81d788199b8911d48304f8cf0524876316016031ab14819acfcd1f8a34ba72222fe0b369a54a216a216c158049222645f131221c10928dc852cdc0bfb600e66dc39c58558ccee6ab0c93497c3650edff339df99efc28df51bec3e9f7cfee6438b8662800086431eab2e971c5f7cf4edc26eaf851beb37b8f8fd870f67d73c6fbf759e5c0427156a0149d0621414b4b414c8bf756a013033c2a6a7f19e181b564e56bc73eec2420630bbee39ffdec7b8aac61e2861ee294460046bd309860720a8079f13e60149156a8a2000d4076a48c6ec7ae09d73b070ead5f2e199d31f50d735b66534b161b254524f6bea25a14d1b90c2300146d080ce8de68ed06ed65832cc0ceb0ceb7bda79445c4f66117211ec81e1a3677a78c299d7a6281e3fbf0c29d29a2717a14d4231ca2153a6e386b8e1f1b355821a4e84f8a0a7c81c3e06324d86938a103d93c335aba76ba2cdb8152f42f2f83f1c39397d6a29b21cad846a6ca841b9acf45ca5bd721cd516b26127206464825aa05eaa583b3d41d33ab736bfc4d4b87d6d421b6b2c2992392c296e24544703d395801ad44b861e0d70b326a67687b9b148322401fb0dc3f37bfc0e9d1b572f4d089b15660a0866caea4b42b1dcd2dcac985daf910c34c1e458c0b21d97240320739960c0f1e74b7c77154b8166564357018ac8a0f4ccd9299313400afc8427dc9de0ca96fa88a2c9a88f2ab7b784227328b0a8c910725a3ca4488c10361e557ae69515565f9e528843cd58391d319478b7460d9c808c5b4068d3f0de229960f4149283192e1b188938c0583d3165edd4142742df298231fbd5e170f4095cc6c0fac880808cff30065a0bc8c86129df533a3d5a72eaec041941d006231034d0ce0bd4142c27ce0527a0dd4ee3341c8bbb8c498225a17413c0a80f3bd6ce55146284ee369622da790a27ac9d6da99604b29eb21cac276998b0c8dc207c97b1760dce0123a84b21a8a2ea310b80e2e781ca419f846a5c307d2360731d186730bb93ff9f714b4b1b05eb22c508ea9516498e1fbf51426cb87ca965fd879ae61ee41458eaa91cc838ec3116dc238c33924182e68e21638f594fb90cc7cf7ad67f7e8e9fbe2e201348cafaa58a76ab657a32a21a061f9b8139fc9ff208e37d470ebacfea675f80edfdc46dcf812ad26d1ba39171a0dec289903f39a77a26b1df751caa3bd2e2fd9da6e0b20cb5c4f8a0b1713707cbe8d27c601c36fdb0c0cde1d737990e9fab1b194c1b6a618fe530f6e002c964cfc7fdfec8f214665706d6fb8ebd587ef6f75f89d1be02ddeeb058717f13aaa7c09e30dc13a0db0ca78164d019d8d698e66ec1a1a73b4207767fcc9ff772547bc6e36c489077df7ffd6139aec9c541b21da64679c428c62de531831e72c06f086d2c885e2009e524522df534bf41b80f3a572e7cf5cb90202b272b66d7036e6414385a8664686e4341cdfa15ddcbc5dd7b3048463f733402a41eed947ad9fd9b79ff0dd3b8a97b8ac976b6fc187559c2179ffeb817a6ff006d91847a48e5abd70000000049454e44ae426082</data>
+ </image>
+ <image name="image1">
+ <data format="PNG" length="872">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000032f49444154388db5953148254718c77f1e5b7c030ab3e0c12e5ce00927f88a14af7d87c5590ac29d6013b0497b844008a9120e1248938354a6b1482131cde5a510b4f03081f07c8d4421c2063cd85708bbe0831938613ec8c0a5588dd1dc33452e5f33bb33c36f7ffbed7fd889fe7e9fcb7ad07df09ab750fdfdfec4c425787b6bfb757bae8df79e6a54e1bcc36008845b47e71dc549c1e06000f10a9e5c9a3effee39690ef92cb4a25e2c3b4804709844807035cfd57d7122f0ad65f0c25f0703d4a39af41d28473fa0af4a42548c81f007f85aa86a4510cc34cccc8288420405640ad2bbcadfeb2fb01b39021e7d5513a2c74c59ca43d8db510e0f6a24018d8a2496ecbeb0b892d29d0f08cdbc9d149ac7dc0057bea2831262853196fd5d6573dd43046b85fcbe2002d55019be54bef9a2a45ecd585e059106fe46639318403153427908bd0be8e2a38c874b90e70692806acade4ea0b7eee96d0cc9b2360b8f0d92e835e33b97172106400801b6b73c1a95c54719cbef439a2b9a54f833c3f68f8ec59594f73eb090089b1b153afa67e4ae1b270e5fa7144725d636a6228d853fcf59fbca511e7bdc193cf92467b0eb297f578a2220721d7ccdd82442553b48206f417a1714c5fb94b5cf2b8a638f58a13b9fc2a4a3ddb16854aa53d03806dcf4180481a8d8c98b8f7296b3f6a5a33c6ee2652785fc1ea4d2bcaf248246901bca377a0c661a482cc5505135ecbd088de9a490ddb30c8735cf9e5614872955a96854665a066e4f85a33d0bad96500f95bd9dc0f26a8a3b53ba0f53f20c9e3d85e1cb9a4f3facd0734f9659da1da8ea5b7a0c02a22cae081a95deba676fc7f1e4a39cce7ca0d5097cfc594e9659fca88608dd25cbccdcbfe6384014baf3509f66f436866c7e0d835d4ffb5d0b0954a5c38fb4e92d4af18b521c19ac8c39796ee42ecebe22c0f2aa90656d7adf5714c74a71346c7647b0d39685c7965f7f52aa738fc6947a34c6b83829284a41d2c6441258580a74e7738a22509d36d0bc65687760660e8a25033187c451fec69bc1838301ac0b69de444ad53779c32317bb2481f2d437b9dd6adae13d14874a558f3126c2e0e7cbc59be3b81abf7e67ecca7fac3bd0fca3fe17f0db86f7f7fb137f0208c29bb2c76e387f0000000049454e44ae426082</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>Clear</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcSidTimeDlg</receiver>
+ <slot>slotClearFields()</slot>
+ </connection>
+ <connection>
+ <sender>Compute</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcSidTimeDlg</receiver>
+ <slot>slotComputeTime()</slot>
+ </connection>
+ <connection>
+ <sender>longCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcSidTimeDlg</receiver>
+ <slot>slotLongChecked()</slot>
+ </connection>
+ <connection>
+ <sender>dateCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcSidTimeDlg</receiver>
+ <slot>slotDateChecked()</slot>
+ </connection>
+ <connection>
+ <sender>utCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcSidTimeDlg</receiver>
+ <slot>slotUtChecked()</slot>
+ </connection>
+ <connection>
+ <sender>stCheckBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcSidTimeDlg</receiver>
+ <slot>slotStChecked()</slot>
+ </connection>
+ <connection>
+ <sender>InputButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcSidTimeDlg</receiver>
+ <slot>slotInputFile()</slot>
+ </connection>
+ <connection>
+ <sender>OutButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcSidTimeDlg</receiver>
+ <slot>slotOutputFile()</slot>
+ </connection>
+ <connection>
+ <sender>runButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcSidTimeDlg</receiver>
+ <slot>slotRunBatch()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>tabWidget2</tabstop>
+ <tabstop>UtRadio</tabstop>
+ <tabstop>StRadio</tabstop>
+ <tabstop>datBox</tabstop>
+ <tabstop>longBox</tabstop>
+ <tabstop>Compute</tabstop>
+ <tabstop>Clear</tabstop>
+ <tabstop>UtBox</tabstop>
+ <tabstop>StBox</tabstop>
+ <tabstop>longCheckBatch</tabstop>
+ <tabstop>utCheckBatch</tabstop>
+ <tabstop>utBoxBatch</tabstop>
+ <tabstop>longBoxBatch</tabstop>
+ <tabstop>stBoxBatch</tabstop>
+ <tabstop>stCheckBatch</tabstop>
+ <tabstop>dateCheckBatch</tabstop>
+ <tabstop>inputRadioBatch</tabstop>
+ <tabstop>InputButtonBatch</tabstop>
+ <tabstop>InputLineEditBatch</tabstop>
+ <tabstop>OutputLineEditBatch</tabstop>
+ <tabstop>OutButtonBatch</tabstop>
+ <tabstop>runButtonBatch</tabstop>
+</tabstops>
+<slots>
+ <slot>slotComputeTime()</slot>
+ <slot>slotClearFields()</slot>
+ <slot>slotLongChecked()</slot>
+ <slot>slotDateChecked()</slot>
+ <slot>slotUtChecked()</slot>
+ <slot>slotStChecked()</slot>
+ <slot>slotRunBatch()</slot>
+ <slot>slotInputFile()</slot>
+ <slot>slotOutputFile()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>dmsbox.h</includehint>
+
+ <includehint>dmsbox.h</includehint>
+
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/modcalcvlsr.cpp b/kstars/kstars/tools/modcalcvlsr.cpp
new file mode 100644
index 00000000..601f9e77
--- /dev/null
+++ b/kstars/kstars/tools/modcalcvlsr.cpp
@@ -0,0 +1,577 @@
+/***************************************************************************
+ modcalcvlsr.cpp - description
+ -------------------
+ begin : sun mar 13 2005
+ copyright : (C) 2005 by Pablo de Vicente
+ email : p.devicente@wanadoo.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "modcalcvlsr.h"
+
+#include "modcalcvlsr.moc"
+#include "ksnumbers.h"
+#include "dms.h"
+#include "dmsbox.h"
+#include "skypoint.h"
+#include "geolocation.h"
+#include "kstars.h"
+#include "kstarsdata.h"
+#include "kstarsdatetime.h"
+#include "libkdeedu/extdate/extdatetimeedit.h"
+
+#include <qdatetimeedit.h> //need for QTimeEdit
+#include <qcheckbox.h>
+#include <qradiobutton.h>
+#include <qstring.h>
+#include <qtextstream.h>
+#include <kfiledialog.h>
+#include <kmessagebox.h>
+
+
+modCalcVlsr::modCalcVlsr(QWidget *parentSplit, const char *name) : modCalcVlsrDlg (parentSplit,name) {
+
+ showCurrentDateTime();
+ initGeo();
+ showLongLat();
+ raBox->setDegType(FALSE);
+ show();
+}
+
+modCalcVlsr::~modCalcVlsr(){
+ delete geoPlace;
+}
+
+SkyPoint modCalcVlsr::getEquCoords (void)
+{
+ dms raCoord, decCoord;
+
+ raCoord = raBox->createDms(FALSE);
+ decCoord = decBox->createDms();
+
+ SkyPoint sp = SkyPoint (raCoord, decCoord);
+
+ return sp;
+}
+
+double modCalcVlsr::getVLSR (void)
+{
+ double vlsr = vlsrBox->text().toDouble();
+ return vlsr;
+}
+
+double modCalcVlsr::getVhel (void)
+{
+ double vh = vHelioBox->text().toDouble();
+ return vh;
+}
+
+double modCalcVlsr::getVgeo (void)
+{
+ double vg = vGeoBox->text().toDouble();
+ return vg;
+}
+
+double modCalcVlsr::getVtopo (void)
+{
+ double vt = vTopoBox->text().toDouble();
+ return vt;
+}
+
+
+KStarsDateTime modCalcVlsr::getDateTime (void)
+{
+ return KStarsDateTime( datBox->date() , timBox->time() );
+}
+
+double modCalcVlsr::getEpoch (QString eName)
+{
+ bool ok = false;
+ double epoch = eName.toDouble(&ok);
+ if ( ok )
+ return epoch;
+ else {
+ kdDebug() << i18n( "Could not parse epoch string; assuming J2000" ) << endl;
+ return 2000.0;
+ }
+}
+
+dms modCalcVlsr::getLongitude(void)
+{
+ dms longitude;
+ longitude = longBox->createDms();
+ return longitude;
+}
+
+dms modCalcVlsr::getLatitude(void)
+{
+ dms latitude;
+ latitude = latBox->createDms();
+ return latitude;
+}
+
+double modCalcVlsr::getHeight(void)
+{
+ bool ok = false;
+ double height = heightBox->text().toDouble(&ok);
+ if (ok)
+ return height;
+ else {
+ kdDebug() << i18n( "Could not parse height string; assuming 0" ) << endl;
+ return 0.0;
+ }
+
+}
+
+void modCalcVlsr::getGeoLocation (void)
+{
+ geoPlace->setLong( getLongitude() );
+ geoPlace->setLat( getLatitude() );
+ geoPlace->setHeight( getHeight() );
+
+}
+
+void modCalcVlsr::showCurrentDateTime (void)
+{
+ KStars *ks = (KStars*) parent()->parent()->parent();
+
+ KStarsDateTime dt = ks->data()->geo()->LTtoUT( KStarsDateTime::currentDateTime() );
+
+ datBox->setDate( dt.date() );
+ timBox->setTime( dt.time() );
+ dateBoxBatch->setDate( dt.date() );
+ utBoxBatch->setTime( dt.time() );
+}
+
+// SIRVE para algo?
+void modCalcVlsr::initGeo(void)
+{
+ KStars *ks = (KStars*) parent()->parent()->parent(); // QSplitter->AstroCalc->KStars
+ geoPlace = new GeoLocation( ks->geo() );
+}
+
+
+
+void modCalcVlsr::showLongLat(void)
+{
+
+ KStars *ks = (KStars*) parent()->parent()->parent(); // QSplitter->AstroCalc->KStars
+ longBox->show( ks->geo()->lng() );
+ latBox->show( ks->geo()->lat() );
+ longBoxBatch->show( ks->geo()->lng() );
+ latBoxBatch->show( ks->geo()->lat() );
+}
+
+void modCalcVlsr::showVlsr (const double vlsr )
+{
+ vlsrBox->setText( KGlobal::locale()->formatNumber( vlsr ) );
+}
+
+void modCalcVlsr::showHelVel (const double vhel )
+{
+ vHelioBox->setText( KGlobal::locale()->formatNumber( vhel ) );
+}
+
+void modCalcVlsr::showGeoVel (const double vgeo )
+{
+ vGeoBox->setText( KGlobal::locale()->formatNumber( vgeo ) );
+}
+
+void modCalcVlsr::showTopoVel (const double vtop )
+{
+ vTopoBox->setText( KGlobal::locale()->formatNumber( vtop ) );
+}
+
+void modCalcVlsr::showEpoch( const KStarsDateTime &dt )
+{
+ double epochN = dt.epoch();
+// Localization
+// epochName->setText(KGlobal::locale()->formatNumber(epochN,3));
+ epochName->setText( KGlobal::locale()->formatNumber( epochN ) );
+
+}
+
+void modCalcVlsr::slotClearCoords()
+{
+
+ raBox->clearFields();
+ decBox->clearFields();
+ longBox->clearFields();
+ latBox->clearFields();
+ epochName->setText("");
+ vlsrBox->setText("");
+ vHelioBox->setText("");
+ vGeoBox->setText("");
+ vTopoBox->setText("");
+
+ datBox->setDate(ExtDate::currentDate());
+ timBox->setTime(QTime(0,0,0));
+
+}
+
+void modCalcVlsr::slotComputeVelocities()
+{
+ SkyPoint sp = getEquCoords();
+ getGeoLocation();
+
+
+ double epoch0 = getEpoch( epochName->text() );
+ KStarsDateTime dt0;
+ dt0.setFromEpoch(epoch0);
+ KStarsDateTime dt1 = getDateTime();
+ double vst[3];
+ dms gsidt = dt1.gst();
+ geoPlace->TopocentricVelocity(vst, gsidt);
+
+ if ( radioVlsr->isChecked() ) {
+
+ double vlsr = getVLSR();
+ double vhelio = sp.vHeliocentric(vlsr, dt0.djd() );
+ showHelVel( vhelio );
+
+ double vg = sp.vGeocentric(vhelio, dt1.djd());
+ showGeoVel( vg );
+
+ showTopoVel ( sp.vTopocentric(vg, vst) );
+
+ } else if (radioVhelio->isChecked() ) {
+
+ double vhel = getVhel();
+ double vlsr = sp.vHelioToVlsr(vhel, dt0.djd() );
+ showVlsr(vlsr);
+
+ double vg = sp.vGeocentric(vhel, dt1.djd());
+ showGeoVel( vg );
+
+ showTopoVel ( sp.vTopocentric(vg, vst) );
+
+ } else if (radioVgeo->isChecked() ) {
+
+ double vgeo = getVgeo();
+ double vhel = sp.vGeoToVHelio(vgeo, dt1.djd() );
+ showHelVel(vhel) ;
+
+ double vlsr = sp.vHelioToVlsr(vhel, dt0.djd() );
+ showVlsr(vlsr);
+
+
+ showTopoVel ( sp.vTopocentric(vgeo, vst) );
+
+ } else {
+ double vtopo = getVtopo();
+ double vgeo = sp.vTopoToVGeo(vtopo, vst);
+ showGeoVel( vgeo );
+
+ double vhel = sp.vGeoToVHelio(vgeo, dt1.djd() );
+ showHelVel(vhel) ;
+
+ double vlsr = sp.vHelioToVlsr(vhel, dt0.djd() );
+ showVlsr(vlsr);
+ }
+
+}
+
+void modCalcVlsr::slotUtChecked(){
+ if ( utCheckBatch->isChecked() )
+ utBoxBatch->setEnabled( false );
+ else {
+ utBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcVlsr::slotDateChecked(){
+ if ( dateCheckBatch->isChecked() )
+ dateBoxBatch->setEnabled( false );
+ else {
+ dateBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcVlsr::slotRaChecked(){
+ if ( raCheckBatch->isChecked() ) {
+ raBoxBatch->setEnabled( false );
+ }
+ else {
+ raBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcVlsr::slotDecChecked(){
+ if ( decCheckBatch->isChecked() ) {
+ decBoxBatch->setEnabled( false );
+ }
+ else {
+ decBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcVlsr::slotEpochChecked(){
+ if ( epochCheckBatch->isChecked() )
+ epochBoxBatch->setEnabled( false );
+ else
+ epochBoxBatch->setEnabled( true );
+}
+
+void modCalcVlsr::slotLongChecked(){
+ if ( longCheckBatch->isChecked() )
+ longBoxBatch->setEnabled( false );
+ else
+ longBoxBatch->setEnabled( true );
+}
+
+void modCalcVlsr::slotLatChecked(){
+ if ( latCheckBatch->isChecked() )
+ latBoxBatch->setEnabled( false );
+ else {
+ latBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcVlsr::slotHeightChecked(){
+ if ( heightCheckBatch->isChecked() )
+ heightBoxBatch->setEnabled( false );
+ else {
+ heightBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcVlsr::slotVlsrChecked(){
+ if ( vlsrCheckBatch->isChecked() )
+ vlsrBoxBatch->setEnabled( false );
+ else {
+ vlsrBoxBatch->setEnabled( true );
+ }
+}
+
+void modCalcVlsr::slotInputFile() {
+ QString inputFileName;
+ inputFileName = KFileDialog::getOpenFileName( );
+ InputLineEditBatch->setText( inputFileName );
+}
+
+void modCalcVlsr::slotOutputFile() {
+ QString outputFileName;
+ outputFileName = KFileDialog::getSaveFileName( );
+ OutputLineEditBatch->setText( outputFileName );
+}
+
+void modCalcVlsr::slotRunBatch() {
+ QString inputFileName;
+
+ inputFileName = InputLineEditBatch->text();
+
+ // We open the input file and read its content
+
+ if ( QFile::exists(inputFileName) ) {
+ QFile f( inputFileName );
+ if ( !f.open( IO_ReadOnly) ) {
+ QString message = i18n( "Could not open file %1.").arg( f.name() );
+ KMessageBox::sorry( 0, message, i18n( "Could Not Open File" ) );
+ inputFileName = "";
+ return;
+ }
+
+// processLines(&f);
+ QTextStream istream(&f);
+ processLines(istream);
+// readFile( istream );
+ f.close();
+ } else {
+ QString message = i18n( "Invalid file: %1" ).arg( inputFileName );
+ KMessageBox::sorry( 0, message, i18n( "Invalid file" ) );
+ inputFileName = "";
+ InputLineEditBatch->setText( inputFileName );
+ return;
+ }
+}
+
+void modCalcVlsr::processLines( QTextStream &istream ) {
+
+ // we open the output file
+
+// QTextStream istream(&fIn);
+ QString outputFileName;
+ outputFileName = OutputLineEditBatch->text();
+ QFile fOut( outputFileName );
+ fOut.open(IO_WriteOnly);
+ QTextStream ostream(&fOut);
+
+ QString line;
+ QString space = " ";
+ int i = 0;
+ long double jd0;
+ SkyPoint spB;
+ double sra, cra, sdc, cdc;
+ dms raB, decB, latB, longB;
+ double epoch0B, vhB, vgB, vtB, vlsrB, heightB;
+ double vtopo[3];
+ QTime utB;
+ ExtDate dtB;
+ KStarsDateTime dt0B;
+
+ while ( ! istream.eof() ) {
+ line = istream.readLine();
+ line.stripWhiteSpace();
+
+ //Go through the line, looking for parameters
+
+ QStringList fields = QStringList::split( " ", line );
+
+ i = 0;
+
+ // Read Ut and write in ostream if corresponds
+
+ if(utCheckBatch->isChecked() ) {
+ utB = QTime::fromString( fields[i] );
+ i++;
+ } else
+ utB = utBoxBatch->time();
+
+ if ( allRadioBatch->isChecked() )
+ ostream << utB.toString() << space;
+ else
+ if(utCheckBatch->isChecked() )
+ ostream << utB.toString() << space;
+
+ // Read date and write in ostream if corresponds
+
+ if(dateCheckBatch->isChecked() ) {
+ dtB = ExtDate::fromString( fields[i] );
+ i++;
+ } else
+ dtB = dateBoxBatch->date();
+ if ( allRadioBatch->isChecked() )
+ ostream << dtB.toString().append(space);
+ else
+ if(dateCheckBatch->isChecked() )
+ ostream << dtB.toString().append(space);
+
+ // Read RA and write in ostream if corresponds
+
+ if(raCheckBatch->isChecked() ) {
+ raB = dms::fromString( fields[i],FALSE);
+ i++;
+ } else
+ raB = raBoxBatch->createDms(FALSE);
+
+ if ( allRadioBatch->isChecked() )
+ ostream << raB.toHMSString() << space;
+ else
+ if(raCheckBatch->isChecked() )
+ ostream << raB.toHMSString() << space;
+
+ // Read DEC and write in ostream if corresponds
+
+ if(decCheckBatch->isChecked() ) {
+ decB = dms::fromString( fields[i], TRUE);
+ i++;
+ } else
+ decB = decBoxBatch->createDms();
+
+ if ( allRadioBatch->isChecked() )
+ ostream << decB.toDMSString() << space;
+ else
+ if(decCheckBatch->isChecked() )
+ ostream << decB.toDMSString() << space;
+
+ // Read Epoch and write in ostream if corresponds
+
+ if(epochCheckBatch->isChecked() ) {
+ epoch0B = fields[i].toDouble();
+ i++;
+ } else
+ epoch0B = getEpoch( epochBoxBatch->text() );
+
+ if ( allRadioBatch->isChecked() )
+ ostream << epoch0B << space;
+ else
+ if(epochCheckBatch->isChecked() )
+ ostream << epoch0B << space;
+
+ // Read vlsr and write in ostream if corresponds
+
+ if(vlsrCheckBatch->isChecked() ) {
+ vlsrB = fields[i].toDouble();
+ i++;
+ } else
+ vlsrB = getEpoch( epochBoxBatch->text() );
+
+ if ( allRadioBatch->isChecked() )
+ ostream << vlsrB << space;
+ else
+ if(vlsrCheckBatch->isChecked() )
+ ostream << vlsrB << space;
+
+ // Read Longitude and write in ostream if corresponds
+
+ if (longCheckBatch->isChecked() ) {
+ longB = dms::fromString( fields[i],TRUE);
+ i++;
+ } else
+ longB = longBoxBatch->createDms(TRUE);
+
+ if ( allRadioBatch->isChecked() )
+ ostream << longB.toDMSString() << space;
+ else
+ if (longCheckBatch->isChecked() )
+ ostream << longB.toDMSString() << space;
+
+ // Read Latitude
+
+
+ if (latCheckBatch->isChecked() ) {
+ latB = dms::fromString( fields[i], TRUE);
+ i++;
+ } else
+ latB = latBoxBatch->createDms(TRUE);
+ if ( allRadioBatch->isChecked() )
+ ostream << latB.toDMSString() << space;
+ else
+ if (latCheckBatch->isChecked() )
+ ostream << latB.toDMSString() << space;
+
+ // Read height and write in ostream if corresponds
+
+ if(heightCheckBatch->isChecked() ) {
+ heightB = fields[i].toDouble();
+ i++;
+ } else
+ heightB = getEpoch( epochBoxBatch->text() );
+
+ if ( allRadioBatch->isChecked() )
+ ostream << heightB << space;
+ else
+ if(heightCheckBatch->isChecked() )
+ ostream << heightB << space;
+
+ // We make the first calculations
+
+ spB = SkyPoint (raB, decB);
+ dt0B.setFromEpoch(epoch0B);
+ vhB = spB.vHeliocentric(vlsrB, dt0B.djd());
+ jd0 = KStarsDateTime(dtB,utB).djd();
+ vgB = spB.vGeocentric(vlsrB, jd0);
+ geoPlace->setLong( longB );
+ geoPlace->setLat( latB );
+ geoPlace->setHeight( heightB );
+ dms gsidt = KStarsDateTime(dtB,utB).gst();
+ geoPlace->TopocentricVelocity(vtopo, gsidt);
+ spB.ra()->SinCos(sra, cra);
+ spB.dec()->SinCos(sdc, cdc);
+ vtB = vgB - (vtopo[0]*cdc*cra + vtopo[1]*cdc*sra + vtopo[2]*sdc);
+
+ ostream << vhB << space << vgB << space << vtB << endl;
+
+ }
+
+
+ fOut.close();
+}
diff --git a/kstars/kstars/tools/modcalcvlsr.h b/kstars/kstars/tools/modcalcvlsr.h
new file mode 100644
index 00000000..2320bd19
--- /dev/null
+++ b/kstars/kstars/tools/modcalcvlsr.h
@@ -0,0 +1,152 @@
+/***************************************************************************
+ modcalcLSRVel.h - description
+ -------------------
+ begin : dom mar 13 2005
+ copyright : (C) 2005 by Pablo de Vicente
+ email : pvicentea@wanadoo.es
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 MODCALCVLSR_H
+#define MODCALCVLSR_H
+
+#include <kapplication.h>
+#include <qwidget.h>
+#include "modcalcvlsrdlg.h"
+
+class QWidget;
+class SkyPoint;
+class KStarsDateTime;
+class GeoLocation;
+class dms;
+
+/**
+ *@author Pablo de Vicente
+ *Module to compute the heliocentric radial velocity, geocentric radial velocity and
+ *topocentric radial velocity for a source, given its coordinates, its Vlsr and the date and
+ *location on the Earth.
+ */
+
+class modCalcVlsr : public modCalcVlsrDlg {
+
+Q_OBJECT
+
+public:
+ modCalcVlsr(QWidget *p, const char *n);
+ ~modCalcVlsr();
+
+public slots:
+
+ void slotClearCoords();
+ void slotComputeVelocities();
+ void slotUtChecked();
+ void slotDateChecked();
+ void slotRaChecked();
+ void slotDecChecked();
+ void slotEpochChecked();
+ void slotLongChecked();
+ void slotLatChecked();
+ void slotHeightChecked();
+ void slotVlsrChecked();
+ void slotInputFile();
+ void slotOutputFile();
+ void slotRunBatch();
+
+private:
+
+ /**@returns a SkyPoint constructed from the coordinates in the
+ * RA and Dec dmsBoxes. */
+ SkyPoint getEquCoords(void);
+
+ /* @return a double with the Vlsr from the vlsrBox in the UI
+ */
+ double getVLSR (void);
+
+ /* @return a double with the Vhel from the vhelBox in the UI
+ */
+ double getVhel (void);
+
+ /* @return a double with the Vgeo from the vgeoBox in the UI
+ */
+ double getVgeo (void);
+
+ /* @return a double with the Vtopo from the vtopoBox in the UI
+ */
+ double getVtopo (void);
+
+ /**@returns a KStarsDateTime constructed from the Time and Date fields. */
+ KStarsDateTime getDateTime (void);
+
+ /**Parse the string argument as a double
+ * @param eName String from which the epoch is to be constructed
+ * once it is converted to a double
+ */
+ double getEpoch (QString eName);
+
+ /* Creates a dms object from the latitude box */
+ dms getLatitude (void);
+
+ /* Creates a dms object from the longitude box */
+ dms getLongitude (void);
+
+ /* creates a double from the height box */
+ double getHeight(void);
+
+ /* Constructs a GeoLocation object from the longitude, latitude and height fields */
+
+ void getGeoLocation(void);
+
+ /**Fill the Time and Date fields with the current values from the
+ * CPU clock. */
+ void showCurrentDateTime(void);
+
+ /* Constructs the a GeoLocation object (geoPlace) from the calling classes.
+ * This is for using as Geolocation the location setup in KStars
+ * */
+ void initGeo(void);
+
+ /* Fills the longitude, latitude and height fields with the values in the
+ * geoPlace object, which come from the calling classes.
+ */
+ void showLongLat(void);
+
+ /**Fills the VLSR box with its value
+ **/
+ void showVlsr (const double vlsr );
+
+ /**Fills the Heliocentric velocity box with its value
+ **/
+ void showHelVel (const double vhel );
+
+ /**Fills the geocentric velocity box with its value
+ **/
+ void showGeoVel (const double vgeo );
+
+ /**Fills the topocentric velocity box with its value
+ **/
+ void showTopoVel (const double vtopo );
+
+ /**Fills the epoch box with the value corresponding to a julian day
+ * @param dt date/time from which to construct the epoch string
+ */
+ void showEpoch (const KStarsDateTime &dt );
+
+ /* Method to process the lines from a file
+ */
+ void processLines( QTextStream &istream );
+
+ GeoLocation *geoPlace;
+
+};
+
+
+
+#endif
diff --git a/kstars/kstars/tools/modcalcvlsrdlg.ui b/kstars/kstars/tools/modcalcvlsrdlg.ui
new file mode 100644
index 00000000..80311fb8
--- /dev/null
+++ b/kstars/kstars/tools/modcalcvlsrdlg.ui
@@ -0,0 +1,1212 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>modCalcVlsrDlg</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>modCalcVlsrDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>670</width>
+ <height>640</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>LSR Velocity</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tabWidget3</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Interactive Mode</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>inputGroupBox</cstring>
+ </property>
+ <property name="title">
+ <string>Time &amp;&amp; Location</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout7</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer row="2" column="0">
+ <property name="name">
+ <cstring>spacer10</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QTimeEdit" row="0" column="1">
+ <property name="name">
+ <cstring>timBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <spacer row="2" column="1">
+ <property name="name">
+ <cstring>spacer8</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="ExtDateEdit" row="1" column="1">
+ <property name="name">
+ <cstring>datBox</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>dateLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Date:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>timLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Universal time:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout8</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>heightBox</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>1000</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>0.0</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>longBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>latLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Latitude:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>longLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Longitude:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Height:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>latBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout14</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer23</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>120</width>
+ <height>31</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Equatorial Coordinates</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>raLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Right ascension:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>raBox</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>decLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Declination:</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>decBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>epochName</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>epochLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Epoch:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>100</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout15</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox8</cstring>
+ </property>
+ <property name="title">
+ <string>Radial Velocities</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>vlsrBox</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>azLabel</cstring>
+ </property>
+ <property name="text">
+ <string>VLSR:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>vHelioBox</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Heliocentric velocity:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>vGeoBox</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Geocentric velocity:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Topocentric velocity:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="3" column="1">
+ <property name="name">
+ <cstring>vTopoBox</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer24</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>30</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup6</cstring>
+ </property>
+ <property name="title">
+ <string>Input Velocity</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioVlsr</cstring>
+ </property>
+ <property name="text">
+ <string>LSR</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioVhelio</cstring>
+ </property>
+ <property name="text">
+ <string>Heliocentric</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioVgeo</cstring>
+ </property>
+ <property name="text">
+ <string>Geocentric</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioVtopo</cstring>
+ </property>
+ <property name="text">
+ <string>Topocentric</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout10</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>Compute</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>25</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>120</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Convert</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>Clear</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>25</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>120</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Clear</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer11</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Batch Mode</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>InputBox_2_2</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Select Fields in Input File</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox" row="3" column="0">
+ <property name="name">
+ <cstring>decCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Declination:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="4" column="0">
+ <property name="name">
+ <cstring>epochCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Epoch:</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>dateCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Date:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>utCheckBatch</cstring>
+ </property>
+ <property name="autoMask">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>UT:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="0">
+ <property name="name">
+ <cstring>raCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Right ascension:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QTimeEdit" row="0" column="1">
+ <property name="name">
+ <cstring>utBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="ExtDateEdit" row="1" column="1">
+ <property name="name">
+ <cstring>dateBoxBatch</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="3" column="1">
+ <property name="name">
+ <cstring>decBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="2" column="1">
+ <property name="name">
+ <cstring>raBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="4" column="1">
+ <property name="name">
+ <cstring>epochBoxBatch</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="5" column="1">
+ <property name="name">
+ <cstring>longBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="5" column="0">
+ <property name="name">
+ <cstring>longCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Longitude:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="3">
+ <property name="name">
+ <cstring>latBoxBatch</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="2">
+ <property name="name">
+ <cstring>latCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Latitude:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="2">
+ <property name="name">
+ <cstring>heightCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Height:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="2">
+ <property name="name">
+ <cstring>vlsrCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>LSR velocity:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="3" column="2">
+ <property name="name">
+ <cstring>helioVCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Heliocentric v.:</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="4" column="2">
+ <property name="name">
+ <cstring>geoVCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Geocentric v.:</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="5" column="2">
+ <property name="name">
+ <cstring>topoVCheckBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Topocentric v.:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="3">
+ <property name="name">
+ <cstring>vlsrBoxBatch</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="3">
+ <property name="name">
+ <cstring>heightBoxBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="3" column="3">
+ <property name="name">
+ <cstring>vhelioBoxBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="4" column="3">
+ <property name="name">
+ <cstring>vgeoBoxBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="5" column="3">
+ <property name="name">
+ <cstring>vtopoBoxBatch</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup4</cstring>
+ </property>
+ <property name="title">
+ <string>Fields in Output File Plus Result</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>allRadioBatch</cstring>
+ </property>
+ <property name="text">
+ <string>All parameters</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>inputRadioBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Only parameters in input file</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox4_2</cstring>
+ </property>
+ <property name="title">
+ <string>Files</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton" row="0" column="0">
+ <property name="name">
+ <cstring>InputButtonBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Input File...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>File with the input data</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>InputLineEditBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>OutputLineEditBatch</cstring>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>OutButtonBatch</cstring>
+ </property>
+ <property name="text">
+ <string>Output File...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>File for the output data</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout14</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer20</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>151</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>runButtonBatch</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Run</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer19</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>131</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>50</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>TabPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Overview</string>
+ </attribute>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KTextBrowser">
+ <property name="name">
+ <cstring>kTextBrowser1</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;p&gt; The Local Standard of Rest (LSR) is the location in which the mean value of the velocity of a selection of the stars in solar neighboorhood is zero. The local solar motion, that is, the velocity of the sun referred to the Local Standard of Rest is not null: the sun moves with a velocity of 20 km/s towards a point called, solar apex, whose coordinates are:&lt;/p&gt;
+&lt;li&gt;Ra= 18:03:50.2 (J2000)&lt;/li&gt;
+&lt;li&gt;Dec = 30:0:16.8 (J2000)&lt;/li&gt;
+&lt;p&gt;Astronomical sources move relative to the Sun and their velocity can be decomposed in radial velocity, and velocity on the plane of the sky, also know as proper motion in right ascension and declination. The radial velocity is usually obtained by analyzing their spectral emission and the frequency shift of the lines due to Doppler effect. Observational astronomers usually refer source's radial velocity to the LSR.&lt;/p&gt;
+&lt;p&gt;This calculator module allows to obtain the radial velocity of the source referred to the center of the sun (what we call heliocentric velocity), referred to the center of the Earth (geocentric velocity) and to the observer site (topocentric velocity) from the LSR radial velocity&lt;/p&gt;
+&lt;li&gt;The heliocentric velocity (V&lt;sub&gt;hel&lt;/sub&gt;) is computed by obtaining the scalar product of the radial velocity of the source referred to the LSR (V&lt;sub&gt;lsr&lt;/sub&gt;) with the velocity of the Sun referred to the LSR (V&lt;sub&gt;sun&lt;/sub&gt;:
+&lt;img src="vlsr1.png"&gt;
+&lt;/li&gt;
+&lt;li&gt;The geocentric velocity (V&lt;sub&gt;geo&lt;/sub&gt;) is obtained from the heliocentric velocity, the velocity of the Earth (V&lt;sub&gt;E&lt;/sub&gt;) and its position for a given date and time:
+&lt;img src="vlsr2.png"&gt;
+&lt;/li&gt;
+&lt;li&gt;The topocentric velocity is obtained from the geocentric velocity, the position on the Earth, and the date and time at which we desire to know the radial velocity of the source.&lt;/li&gt;</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </widget>
+ </hbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>dmsBox</class>
+ <header location="global">../dmsbox.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+ <customwidget>
+ <class>ExtDateEdit</class>
+ <header location="local">libkdeedu/extdate/extdatetimeedit.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image1</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1163">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000045249444154388d8d95bf8b1d5514c73fbb19e40cbce81d788199b8911d48304f8cf0524876316016031ab14819acfcd1f8a34ba72222fe0b369a54a216a216c158049222645f131221c10928dc852cdc0bfb600e66dc39c58558ccee6ab0c93497c3650edff339df99efc28df51bec3e9f7cfee6438b8662800086431eab2e971c5f7cf4edc26eaf851beb37b8f8fd870f67d73c6fbf759e5c0427156a0149d0621414b4b414c8bf756a013033c2a6a7f19e181b564e56bc73eec2420630bbee39ffdec7b8aac61e2861ee294460046bd309860720a8079f13e60149156a8a2000d4076a48c6ec7ae09d73b070ead5f2e199d31f50d735b66534b161b254524f6bea25a14d1b90c2300146d080ce8de68ed06ed65832cc0ceb0ceb7bda79445c4f66117211ec81e1a3677a78c299d7a6281e3fbf0c29d29a2717a14d4231ca2153a6e386b8e1f1b355821a4e84f8a0a7c81c3e06324d86938a103d93c335aba76ba2cdb8152f42f2f83f1c39397d6a29b21cad846a6ca841b9acf45ca5bd721cd516b26127206464825aa05eaa583b3d41d33ab736bfc4d4b87d6d421b6b2c2992392c296e24544703d395801ad44b861e0d70b326a67687b9b148322401fb0dc3f37bfc0e9d1b572f4d089b15660a0866caea4b42b1dcd2dcac985daf910c34c1e458c0b21d97240320739960c0f1e74b7c77154b8166564357018ac8a0f4ccd9299313400afc8427dc9de0ca96fa88a2c9a88f2ab7b784227328b0a8c910725a3ca4488c10361e557ae69515565f9e528843cd58391d319478b7460d9c808c5b4068d3f0de229960f4149283192e1b188938c0583d3165edd4142742df298231fbd5e170f4095cc6c0fac880808cff30065a0bc8c86129df533a3d5a72eaec041941d006231034d0ce0bd4142c27ce0527a0dd4ee3341c8bbb8c498225a17413c0a80f3bd6ce55146284ee369622da790a27ac9d6da99604b29eb21cac276998b0c8dc207c97b1760dce0123a84b21a8a2ea310b80e2e781ca419f846a5c307d2360731d186730bb93ff9f714b4b1b05eb22c508ea9516498e1fbf51426cb87ca965fd879ae61ee41458eaa91cc838ec3116dc238c33924182e68e21638f594fb90cc7cf7ad67f7e8e9fbe2e201348cafaa58a76ab657a32a21a061f9b8139fc9ff208e37d470ebacfea675f80edfdc46dcf812ad26d1ba39171a0dec289903f39a77a26b1df751caa3bd2e2fd9da6e0b20cb5c4f8a0b1713707cbe8d27c601c36fdb0c0cde1d737990e9fab1b194c1b6a618fe530f6e002c964cfc7fdfec8f214665706d6fb8ebd587ef6f75f89d1be02ddeeb058717f13aaa7c09e30dc13a0db0ca78164d019d8d698e66ec1a1a73b4207767fcc9ff772547bc6e36c489077df7ffd6139aec9c541b21da64679c428c62de531831e72c06f086d2c885e2009e524522df534bf41b80f3a572e7cf5cb90202b272b66d7036e6414385a8664686e4341cdfa15ddcbc5dd7b3048463f733402a41eed947ad9fd9b79ff0dd3b8a97b8ac976b6fc187559c2179ffeb817a6ff006d91847a48e5abd70000000049454e44ae426082</data>
+ </image>
+ <image name="image1">
+ <data format="PNG" length="872">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000032f49444154388db5953148254718c77f1e5b7c030ab3e0c12e5ce00927f88a14af7d87c5590ac29d6013b0497b844008a9120e1248938354a6b1482131cde5a510b4f03081f07c8d4421c2063cd85708bbe0831938613ec8c0a5588dd1dc33452e5f33bb33c36f7ffbed7fd889fe7e9fcb7ad07df09ab750fdfdfec4c425787b6bfb757bae8df79e6a54e1bcc36008845b47e71dc549c1e06000f10a9e5c9a3effee39690ef92cb4a25e2c3b4804709844807035cfd57d7122f0ad65f0c25f0703d4a39af41d28473fa0af4a42548c81f007f85aa86a4510cc34cccc8288420405640ad2bbcadfeb2fb01b39021e7d5513a2c74c59ca43d8db510e0f6a24018d8a2496ecbeb0b892d29d0f08cdbc9d149ac7dc0057bea2831262853196fd5d6573dd43046b85fcbe2002d55019be54bef9a2a45ecd585e059106fe46639318403153427908bd0be8e2a38c874b90e70692806acade4ea0b7eee96d0cc9b2360b8f0d92e835e33b97172106400801b6b73c1a95c54719cbef439a2b9a54f833c3f68f8ec59594f73eb090089b1b153afa67e4ae1b270e5fa7144725d636a6228d853fcf59fbca511e7bdc193cf92467b0eb297f578a2220721d7ccdd82442553b48206f417a1714c5fb94b5cf2b8a638f58a13b9fc2a4a3ddb16854aa53d03806dcf4180481a8d8c98b8f7296b3f6a5a33c6ee2652785fc1ea4d2bcaf248246901bca377a0c661a482cc5505135ecbd088de9a490ddb30c8735cf9e5614872955a96854665a066e4f85a33d0bad96500f95bd9dc0f26a8a3b53ba0f53f20c9e3d85e1cb9a4f3facd0734f9659da1da8ea5b7a0c02a22cae081a95deba676fc7f1e4a39cce7ca0d5097cfc594e9659fca88608dd25cbccdcbfe6384014baf3509f66f436866c7e0d835d4ffb5d0b0954a5c38fb4e92d4af18b521c19ac8c39796ee42ecebe22c0f2aa90656d7adf5714c74a71346c7647b0d39685c7965f7f52aa738fc6947a34c6b83829284a41d2c6441258580a74e7738a22509d36d0bc65687760660e8a25033187c451fec69bc1838301ac0b69de444ad53779c32317bb2481f2d437b9dd6adae13d14874a558f3126c2e0e7cbc59be3b81abf7e67ecca7fac3bd0fca3fe17f0db86f7f7fb137f0208c29bb2c76e387f0000000049454e44ae426082</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>Compute</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcVlsrDlg</receiver>
+ <slot>slotComputeVelocities()</slot>
+ </connection>
+ <connection>
+ <sender>Clear</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcVlsrDlg</receiver>
+ <slot>slotClearCoords()</slot>
+ </connection>
+ <connection>
+ <sender>InputButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcVlsrDlg</receiver>
+ <slot>slotInputFile()</slot>
+ </connection>
+ <connection>
+ <sender>OutButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcVlsrDlg</receiver>
+ <slot>slotOutputFile()</slot>
+ </connection>
+ <connection>
+ <sender>runButtonBatch</sender>
+ <signal>clicked()</signal>
+ <receiver>modCalcVlsrDlg</receiver>
+ <slot>slotRunBatch()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>tabWidget3</tabstop>
+ <tabstop>timBox</tabstop>
+ <tabstop>datBox</tabstop>
+ <tabstop>longBox</tabstop>
+ <tabstop>latBox</tabstop>
+ <tabstop>heightBox</tabstop>
+ <tabstop>raBox</tabstop>
+ <tabstop>decBox</tabstop>
+ <tabstop>epochName</tabstop>
+ <tabstop>vlsrBox</tabstop>
+ <tabstop>vHelioBox</tabstop>
+ <tabstop>vGeoBox</tabstop>
+ <tabstop>vTopoBox</tabstop>
+ <tabstop>radioVlsr</tabstop>
+ <tabstop>Compute</tabstop>
+ <tabstop>Clear</tabstop>
+ <tabstop>decCheckBatch</tabstop>
+ <tabstop>epochCheckBatch</tabstop>
+ <tabstop>dateCheckBatch</tabstop>
+ <tabstop>utCheckBatch</tabstop>
+ <tabstop>raCheckBatch</tabstop>
+ <tabstop>utBoxBatch</tabstop>
+ <tabstop>decBoxBatch</tabstop>
+ <tabstop>raBoxBatch</tabstop>
+ <tabstop>epochBoxBatch</tabstop>
+ <tabstop>longBoxBatch</tabstop>
+ <tabstop>longCheckBatch</tabstop>
+ <tabstop>latBoxBatch</tabstop>
+ <tabstop>latCheckBatch</tabstop>
+ <tabstop>heightCheckBatch</tabstop>
+ <tabstop>vlsrCheckBatch</tabstop>
+ <tabstop>helioVCheckBatch</tabstop>
+ <tabstop>geoVCheckBatch</tabstop>
+ <tabstop>topoVCheckBatch</tabstop>
+ <tabstop>vlsrBoxBatch</tabstop>
+ <tabstop>heightBoxBatch</tabstop>
+ <tabstop>vhelioBoxBatch</tabstop>
+ <tabstop>vgeoBoxBatch</tabstop>
+ <tabstop>vtopoBoxBatch</tabstop>
+ <tabstop>inputRadioBatch</tabstop>
+ <tabstop>InputButtonBatch</tabstop>
+ <tabstop>InputLineEditBatch</tabstop>
+ <tabstop>OutputLineEditBatch</tabstop>
+ <tabstop>OutButtonBatch</tabstop>
+ <tabstop>runButtonBatch</tabstop>
+ <tabstop>kTextBrowser1</tabstop>
+</tabstops>
+<slots>
+ <slot>slotComputeVelocities()</slot>
+ <slot>slotClearCoords()</slot>
+ <slot>slotUtChecked()</slot>
+ <slot>slotDateChecked()</slot>
+ <slot>slotRaChecked()</slot>
+ <slot>slotDecChecked()</slot>
+ <slot>slotEpochChecked()</slot>
+ <slot>slotLongChecked()</slot>
+ <slot>slotLatChecked()</slot>
+ <slot>slotHeightChecked()</slot>
+ <slot>slotVlsrChecked()</slot>
+ <slot>slotInputFile()</slot>
+ <slot>slotOutputFile()</slot>
+ <slot>slotRunBatch()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+
+ <includehint>klineedit.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>ktextbrowser.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/observinglist.cpp b/kstars/kstars/tools/observinglist.cpp
new file mode 100644
index 00000000..dae78bc0
--- /dev/null
+++ b/kstars/kstars/tools/observinglist.cpp
@@ -0,0 +1,740 @@
+/***************************************************************************
+ observinglist.cpp - K Desktop Planetarium
+ -------------------
+ begin : 29 Nov 2004
+ copyright : (C) 2004 by Jeff Woods, Jason Harris
+ email : jcwoods@bellsouth.net, jharris@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. *
+ * *
+ ***************************************************************************/
+
+#include <stdio.h>
+#include <qfile.h>
+#include <qdir.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qstringlist.h>
+#include <qwidgetstack.h>
+#include <klistview.h>
+#include <kpushbutton.h>
+#include <kstatusbar.h>
+#include <ktextedit.h>
+#include <kinputdialog.h>
+#include <kicontheme.h>
+#include <kiconloader.h>
+#include <kio/netaccess.h>
+#include <kmessagebox.h>
+#include <kfiledialog.h>
+#include <ktempfile.h>
+#include <klineedit.h>
+
+#include "observinglist.h"
+#include "observinglistui.h"
+#include "obslistwizard.h"
+#include "kstars.h"
+#include "kstarsdata.h"
+#include "skyobject.h"
+#include "starobject.h"
+#include "skymap.h"
+#include "detaildialog.h"
+#include "tools/altvstime.h"
+
+#include "indimenu.h"
+#include "indielement.h"
+#include "indiproperty.h"
+#include "indidevice.h"
+#include "devicemanager.h"
+#include "indistd.h"
+
+ObservingList::ObservingList( KStars *_ks, QWidget* parent )
+ : KDialogBase( KDialogBase::Plain, i18n( "Observing List" ),
+ Close, Close, parent, "observinglist", false ), ks( _ks ), LogObject(0), oCurrent(0),
+ noNameStars(0), isModified(false), bIsLarge(true)
+{
+ QFrame *page = plainPage();
+ QVBoxLayout *vlay = new QVBoxLayout( page, 0, 0 );
+ ui = new ObservingListUI( page );
+ vlay->addWidget( ui );
+
+ //FIXME: enable MiniButton when I figure out how to resize the window correctly
+ ui->MiniButton->hide();
+
+ //Connections
+ connect( this, SIGNAL( closeClicked() ), this, SLOT( slotClose() ) );
+ connect( ui->TableStack, SIGNAL( aboutToShow( QWidget* ) ),
+ this, SLOT( slotPrepTable( QWidget* ) ) );
+ connect( ui->FullTable, SIGNAL( selectionChanged() ),
+ this, SLOT( slotNewSelection() ) );
+ connect( ui->TinyTable, SIGNAL( selectionChanged() ),
+ this, SLOT( slotNewSelection() ) );
+ connect( ui->FullTable, SIGNAL( doubleClicked( QListViewItem*, const QPoint&, int) ),
+ this, SLOT( slotCenterObject() ) );
+ connect( ui->TinyTable, SIGNAL( doubleClicked( QListBoxItem* ) ),
+ this, SLOT( slotCenterObject() ) );
+ connect( ui->RemoveButton, SIGNAL( clicked() ),
+ this, SLOT( slotRemoveObjects() ) );
+ connect( ui->CenterButton, SIGNAL( clicked() ),
+ this, SLOT( slotCenterObject() ) );
+ connect( ui->ScopeButton, SIGNAL( clicked() ),
+ this, SLOT( slotSlewToObject() ) );
+ connect( ui->DetailsButton, SIGNAL( clicked() ),
+ this, SLOT( slotDetails() ) );
+ connect( ui->AVTButton, SIGNAL( clicked() ),
+ this, SLOT( slotAVT() ) );
+
+ connect( ui->OpenButton, SIGNAL( clicked() ),
+ this, SLOT( slotOpenList() ) );
+ connect( ui->SaveButton, SIGNAL( clicked() ),
+ this, SLOT( slotSaveList() ) );
+ connect( ui->SaveAsButton, SIGNAL( clicked() ),
+ this, SLOT( slotSaveListAs() ) );
+ connect( ui->WizardButton, SIGNAL( clicked() ),
+ this, SLOT( slotWizard() ) );
+
+ //FIXME: enable MiniButton
+// connect( ui->MiniButton, SIGNAL( clicked() ),
+// this, SLOT( slotToggleSize() ) );
+
+ obsList.setAutoDelete( false ); //do NOT delete removed pointers!
+
+ //Add icons to Push Buttons
+ KIconLoader *icons = KGlobal::iconLoader();
+ ui->OpenButton->setPixmap( icons->loadIcon( "fileopen", KIcon::Toolbar ) );
+ ui->SaveButton->setPixmap( icons->loadIcon( "filesave", KIcon::Toolbar ) );
+ ui->SaveAsButton->setPixmap( icons->loadIcon( "filesaveas", KIcon::Toolbar ) );
+ ui->WizardButton->setPixmap( icons->loadIcon( "wizard", KIcon::Toolbar ) );
+ ui->MiniButton->setPixmap( icons->loadIcon( "window_nofullscreen", KIcon::Toolbar ) );
+
+ ui->CenterButton->setEnabled( false );
+ ui->ScopeButton->setEnabled( false );
+ ui->DetailsButton->setEnabled( false );
+ ui->AVTButton->setEnabled( false );
+ ui->RemoveButton->setEnabled( false );
+ ui->NotesLabel->setEnabled( false );
+ ui->NotesEdit->setEnabled( false );
+}
+
+bool ObservingList::contains( const SkyObject *q ) {
+ for ( SkyObject* o = obsList.first(); o; o = obsList.next() ) {
+ if ( o == q ) return true;
+ }
+
+ return false;
+}
+
+
+//SLOTS
+void ObservingList::slotPrepTable( QWidget *tab ) {
+ if ( tab == ui->FullTable ) {
+ } else {
+ }
+}
+
+void ObservingList::slotAddObject( SkyObject *obj ) {
+ if ( ! obj ) obj = ks->map()->clickedObject();
+
+ //First, make sure object is not already in the list
+ for ( SkyObject *o = obsList.first(); o; o = obsList.next() ) {
+ if ( obj == o ) {
+ //FIXME STRINGS FREEZE
+ //ks->statusBar()->changeItem( i18n( "%1 is already in the observing list." ).arg( obj->name() ), 0 );
+ return;
+ }
+ }
+
+ //Insert object in obsList
+ obsList.append( obj );
+ if ( ! isModified ) isModified = true;
+
+ //Insert object entry in FullTable and TinyTable
+ QString smag("--");
+ if ( obj->mag() < 90.0 ) smag = QString::number( obj->mag(), 'g', 2 );
+ new KListViewItem( ui->FullTable, obj->translatedName(),
+ obj->ra()->toHMSString(),
+ obj->dec()->toDMSString(),
+ smag,
+ obj->typeName() );
+ ui->TinyTable->insertItem( obj->translatedName() );
+
+ //Note addition in statusbar
+ ks->statusBar()->changeItem( i18n( "Added %1 to observing list." ).arg( obj->name() ), 0 );
+}
+
+void ObservingList::slotRemoveObject( SkyObject *o ) {
+ if ( !o )
+ o = ks->map()->clickedObject();
+
+ obsList.remove(o);
+ if ( ! isModified ) isModified = true;
+
+ if ( o == LogObject )
+ saveCurrentUserLog();
+
+ //Remove entry from FullTable
+ bool objectFound = false;
+ QListViewItemIterator it( ui->FullTable );
+ while ( it.current() ) {
+ QListViewItem *item = it.current();
+
+ //If the object is named "star" then match coordinates instead of name
+ if ( o->translatedName() == i18n( "star" ) ) {
+ if ( item->text(1) == o->ra()->toHMSString()
+ && item->text(2) == o->dec()->toDMSString() ) {
+ delete item;
+ objectFound = true;
+ break;
+ }
+ } else if ( item->text( 0 ) == o->translatedName() ) {
+ delete item;
+ objectFound = true;
+ break;
+ }
+ ++it;
+ }
+
+ if ( ! objectFound ) {
+ kdDebug() << i18n( "Cannot remove Object %1; not found in table." ).arg(o->translatedName()) << endl;
+ } else {
+ //Remove object from TinyTable
+ for ( uint i=0; i < ui->TinyTable->count(); i++ ) {
+ if ( o->translatedName() == ui->TinyTable->text(i) ) {
+ ui->TinyTable->removeItem(i);
+ break;
+ }
+ }
+ }
+}
+
+void ObservingList::slotRemoveObjects() {
+ if ( SelectedObjects.count() == 0) return;
+
+ for ( SkyObject *o = SelectedObjects.first(); o; o = SelectedObjects.next() )
+ slotRemoveObject( o );
+
+ slotNewSelection();
+}
+
+void ObservingList::slotNewSelection() {
+ //If the TinyTable is visible, we need to sync the selection in the FullTable
+ if ( sender() == ui->TinyTable ) syncTableSelection();
+
+ //Construct list of selected objects
+ SelectedObjects.clear();
+ QListViewItemIterator it( ui->FullTable, QListViewItemIterator::Selected ); //loop over selected items
+ while ( it.current() ) {
+ for ( SkyObject *o = obsList.first(); o; o = obsList.next() ) {
+ if ( it.current()->text(0) == i18n("star") ) {
+ if ( it.current()->text(1) == o->ra()->toHMSString()
+ && it.current()->text(2) == o->dec()->toDMSString() ) {
+ SelectedObjects.append(o);
+ break;
+ }
+ } else if ( o->translatedName() == it.current()->text(0) ) {
+ SelectedObjects.append( o );
+ break;
+ }
+ }
+ it++;
+ }
+
+ //Enable widgets when one object selected
+ if ( SelectedObjects.count() == 1 ) {
+ QString newName( SelectedObjects.first()->translatedName() );
+ QString oldName( obsList.current()->translatedName() );
+
+ //Enable buttons
+ ui->CenterButton->setEnabled( true );
+ ui->ScopeButton->setEnabled( true );
+ ui->DetailsButton->setEnabled( true );
+ ui->AVTButton->setEnabled( true );
+ ui->RemoveButton->setEnabled( true );
+
+ //Find the selected object in the obsList,
+ //then break the loop. Now obsList.current()
+ //points to the new selected object (until now it was the previous object)
+ bool found( false );
+ for ( SkyObject* o = obsList.first(); o; o = obsList.next() ) {
+ if ( o->translatedName() == newName ) {
+ found = true;
+ break;
+ }
+ }
+
+ if ( ! found ) {
+ kdDebug() << i18n( "Object %1 not found in obsList." ).arg( newName ) << endl;
+ } else if ( newName != i18n( "star" ) ) {
+ //Display the object's current user notes in the NotesEdit
+ //First, save the last object's user log to disk, if necessary
+ saveCurrentUserLog();
+
+ //set LogObject to the new selected object
+ LogObject = obsList.current();
+
+ ui->NotesLabel->setEnabled( true );
+ ui->NotesEdit->setEnabled( true );
+
+ ui->NotesLabel->setText( i18n( "observing notes for %1:" ).arg( LogObject->translatedName() ) );
+ if ( LogObject->userLog.isEmpty() ) {
+ ui->NotesEdit->setText( i18n("Record here observation logs and/or data on %1.").arg( LogObject->translatedName() ) );
+ } else {
+ ui->NotesEdit->setText( LogObject->userLog );
+ }
+ } else { //selected object is named "star"
+ //clear the log text box
+ saveCurrentUserLog();
+ ui->NotesLabel->setEnabled( false );
+ ui->NotesEdit->setEnabled( false );
+ }
+
+ //This shouldn't be necessary. For some reason, obsList.current()
+ //is valid here, but in subsequent functions (such as slotCenterObject)
+ //called *right after* this one, obsList.current()==NULL. No idea why.
+ oCurrent = obsList.current();
+
+ } else if ( SelectedObjects.count() == 0 ) {
+ //Disable buttons
+ ui->CenterButton->setEnabled( false );
+ ui->ScopeButton->setEnabled( false );
+ ui->DetailsButton->setEnabled( false );
+ ui->AVTButton->setEnabled( false );
+ ui->RemoveButton->setEnabled( false );
+ ui->NotesLabel->setEnabled( false );
+ ui->NotesEdit->setEnabled( false );
+ oCurrent = 0;
+
+ //Clear the user log text box.
+ saveCurrentUserLog();
+ } else { //more than one object selected.
+ ui->CenterButton->setEnabled( false );
+ ui->ScopeButton->setEnabled( false );
+ ui->DetailsButton->setEnabled( false );
+ ui->AVTButton->setEnabled( true );
+ ui->RemoveButton->setEnabled( true );
+ ui->NotesLabel->setEnabled( false );
+ ui->NotesEdit->setEnabled( false );
+ oCurrent = 0;
+
+ //Clear the user log text box.
+ saveCurrentUserLog();
+ }
+
+}
+
+void ObservingList::slotCenterObject() {
+ if ( oCurrent ) {
+ ks->map()->setClickedObject( oCurrent );
+ ks->map()->setClickedPoint( oCurrent );
+ ks->map()->slotCenter();
+ }
+}
+
+void ObservingList::slotSlewToObject()
+{
+
+ INDI_D *indidev(NULL);
+ INDI_P *prop(NULL), *onset(NULL);
+ INDI_E *RAEle(NULL), *DecEle(NULL), *AzEle(NULL), *AltEle(NULL), *ConnectEle(NULL), *nameEle(NULL);
+ bool useJ2000( false);
+ int selectedCoord(0);
+ SkyPoint sp;
+
+ // Find the first device with EQUATORIAL_EOD_COORD or EQUATORIAL_COORD and with SLEW element
+ // i.e. the first telescope we find!
+
+ INDIMenu *imenu = ks->getINDIMenu();
+
+
+ for (unsigned int i=0; i < imenu->mgr.count() ; i++)
+ {
+ for (unsigned int j=0; j < imenu->mgr.at(i)->indi_dev.count(); j++)
+ {
+ indidev = imenu->mgr.at(i)->indi_dev.at(j);
+ indidev->stdDev->currentObject = NULL;
+ prop = indidev->findProp("EQUATORIAL_EOD_COORD");
+ if (prop == NULL)
+ {
+ prop = indidev->findProp("EQUATORIAL_COORD");
+ if (prop == NULL)
+ {
+ prop = indidev->findProp("HORIZONTAL_COORD");
+ if (prop == NULL)
+ continue;
+ else
+ selectedCoord = 1; /* Select horizontal */
+ }
+ else
+ useJ2000 = true;
+ }
+
+ ConnectEle = indidev->findElem("CONNECT");
+ if (!ConnectEle) continue;
+
+ if (ConnectEle->state == PS_OFF)
+ {
+ KMessageBox::error(0, i18n("Telescope %1 is offline. Please connect and retry again.").arg(indidev->label));
+ return;
+ }
+
+ switch (selectedCoord)
+ {
+ // Equatorial
+ case 0:
+ if (prop->perm == PP_RO) continue;
+ RAEle = prop->findElement("RA");
+ if (!RAEle) continue;
+ DecEle = prop->findElement("DEC");
+ if (!DecEle) continue;
+ break;
+
+ // Horizontal
+ case 1:
+ if (prop->perm == PP_RO) continue;
+ AzEle = prop->findElement("AZ");
+ if (!AzEle) continue;
+ AltEle = prop->findElement("ALT");
+ if (!AltEle) continue;
+ break;
+ }
+
+ onset = indidev->findProp("ON_COORD_SET");
+ if (!onset) continue;
+
+ onset->activateSwitch("SLEW");
+
+ indidev->stdDev->currentObject = oCurrent;
+
+ /* Send object name if available */
+ if (indidev->stdDev->currentObject)
+ {
+ nameEle = indidev->findElem("OBJECT_NAME");
+ if (nameEle && nameEle->pp->perm != PP_RO)
+ {
+ nameEle->write_w->setText(indidev->stdDev->currentObject->name());
+ nameEle->pp->newText();
+ }
+ }
+
+ switch (selectedCoord)
+ {
+ case 0:
+ if (indidev->stdDev->currentObject)
+ sp.set (indidev->stdDev->currentObject->ra(), indidev->stdDev->currentObject->dec());
+ else
+ sp.set (ks->map()->clickedPoint()->ra(), ks->map()->clickedPoint()->dec());
+
+ if (useJ2000)
+ sp.apparentCoord(ks->data()->ut().djd(), (long double) J2000);
+
+ RAEle->write_w->setText(QString("%1:%2:%3").arg(sp.ra()->hour()).arg(sp.ra()->minute()).arg(sp.ra()->second()));
+ DecEle->write_w->setText(QString("%1:%2:%3").arg(sp.dec()->degree()).arg(sp.dec()->arcmin()).arg(sp.dec()->arcsec()));
+
+ break;
+
+ case 1:
+ if (indidev->stdDev->currentObject)
+ {
+ sp.setAz(*indidev->stdDev->currentObject->az());
+ sp.setAlt(*indidev->stdDev->currentObject->alt());
+ }
+ else
+ {
+ sp.setAz(*ks->map()->clickedPoint()->az());
+ sp.setAlt(*ks->map()->clickedPoint()->alt());
+ }
+
+ AzEle->write_w->setText(QString("%1:%2:%3").arg(sp.az()->degree()).arg(sp.az()->arcmin()).arg(sp.az()->arcsec()));
+ AltEle->write_w->setText(QString("%1:%2:%3").arg(sp.alt()->degree()).arg(sp.alt()->arcmin()).arg(sp.alt()->arcsec()));
+
+ break;
+ }
+
+ prop->newText();
+
+ return;
+ }
+ }
+
+ // We didn't find any telescopes
+ KMessageBox::sorry(0, i18n("KStars did not find any active telescopes."));
+
+}
+
+//FIXME: This will open multiple Detail windows for each object;
+//Should have one window whose target object changes with selection
+void ObservingList::slotDetails() {
+ if ( oCurrent ) {
+ DetailDialog dd( oCurrent, ks->data()->lt(), ks->geo(), ks );
+ dd.exec();
+ }
+}
+
+void ObservingList::slotAVT() {
+ if ( SelectedObjects.count() ) {
+ AltVsTime avt( ks );
+ for ( SkyObject *o = SelectedObjects.first(); o; o = SelectedObjects.next() ) {
+ avt.processObject( o );
+ }
+
+ avt.exec();
+ }
+}
+
+//FIXME: On close, we will need to close any open Details/AVT windows
+void ObservingList::slotClose() {
+ //Save the current User log text
+ if ( oCurrent && ! ui->NotesEdit->text().isEmpty() && ui->NotesEdit->text()
+ != i18n("Record here observation logs and/or data on %1.").arg( oCurrent->name()) ) {
+ oCurrent->saveUserLog( ui->NotesEdit->text() );
+ }
+
+ hide();
+}
+
+void ObservingList::saveCurrentUserLog() {
+ if ( ! ui->NotesEdit->text().isEmpty() &&
+ ui->NotesEdit->text() !=
+ i18n("Record here observation logs and/or data on %1.").arg( LogObject->translatedName() ) ) {
+ LogObject->saveUserLog( ui->NotesEdit->text() );
+
+ ui->NotesEdit->clear();
+ ui->NotesLabel->setText( i18n( "Observing notes for object:" ) );
+ LogObject = NULL;
+ }
+}
+
+void ObservingList::slotOpenList() {
+ KURL fileURL = KFileDialog::getOpenURL( QDir::homeDirPath(), "*.obslist|KStars Observing List (*.obslist)" );
+ QFile f;
+
+ if ( fileURL.isValid() ) {
+ if ( ! fileURL.isLocalFile() ) {
+ //Save remote list to a temporary local file
+ KTempFile tmpfile;
+ tmpfile.setAutoDelete(true);
+ FileName = tmpfile.name();
+ if( KIO::NetAccess::download( fileURL, FileName, this ) )
+ f.setName( FileName );
+
+ } else {
+ FileName = fileURL.path();
+ f.setName( FileName );
+ }
+
+ if ( !f.open( IO_ReadOnly) ) {
+ QString message = i18n( "Could not open file %1" ).arg( f.name() );
+ KMessageBox::sorry( 0, message, i18n( "Could Not Open File" ) );
+ return;
+ }
+
+ saveCurrentList();
+ //First line is the name of the list. The rest of the file should
+ //be object names, one per line.
+ QTextStream istream(&f);
+ QString line;
+ ListName = istream.readLine();
+
+ while ( ! istream.eof() ) {
+ line = istream.readLine();
+ //DEBUG
+ kdDebug() << line << endl;
+
+ //If the object is named "star", add it by coordinates
+ SkyObject *o = 0;
+ if ( line.startsWith( "star" ) ) {
+ QStringList fields = QStringList::split( " ", line );
+ //DEBUG
+ kdDebug() << fields << endl;
+
+ double ra = dms::fromString( fields[1], false ).Degrees(); //false = hours
+ double dc = dms::fromString( fields[2], true ).Degrees(); //true = degrees
+
+ //Identify the star with these coordinates
+ double rmax = 1.;
+ for ( uint i=0; i < ks->data()->starList.count(); ++i ) {
+ SkyObject *s = (SkyObject*)(ks->data()->starList.at(i));
+ double dra = fabs( ra - s->ra()->Degrees() );
+ double ddc = fabs( dc - s->dec()->Degrees() );
+ if ( dra < rmax && ddc < rmax ) {
+ o = s;
+ rmax = sqrt( dra*dra + ddc*ddc );
+ }
+ }
+ } else {
+ o = ks->data()->objectNamed( line );
+ }
+
+ if ( o ) slotAddObject( o );
+ }
+
+ //Newly-opened list should not trigger isModified flag
+ isModified = false;
+
+ f.close();
+
+ } else if ( fileURL.path() != "" ) {
+ QString message = i18n( "The specified file is invalid. Try another file?" );
+ if ( KMessageBox::warningYesNo( this, message, i18n("Invalid File"), i18n("Try Another"), i18n("Do Not Try") ) == KMessageBox::Yes ) {
+ slotOpenList();
+ }
+ }
+}
+
+void ObservingList::saveCurrentList() {
+ //Before loading a new list, do we need to save the current one?
+ //Assume that if the list is empty, then there's no need to save
+ if ( obsList.count() ) {
+ if ( isModified ) {
+ QString message = i18n( "Do you want to save the current list before opening a new list?" );
+ if ( KMessageBox::questionYesNo( this, message,
+ i18n( "Save Current List?" ), KStdGuiItem::save(), KStdGuiItem::discard() ) == KMessageBox::Yes )
+ slotSaveList();
+ }
+
+ //If we ever allow merging the loaded list with
+ //the existing one, that code would go here
+ obsList.clear();
+ ui->FullTable->clear();
+ }
+}
+
+void ObservingList::slotSaveListAs() {
+ bool ok(false);
+ ListName = KInputDialog::getText( i18n( "Enter List Name" ),
+ i18n( "List name:" ), "", &ok );
+
+ if ( ok ) {
+ KURL fileURL = KFileDialog::getSaveURL( QDir::homeDirPath(), "*.obslist|KStars Observing List (*.obslist)" );
+
+ if ( fileURL.isValid() )
+ FileName = fileURL.path();
+
+ slotSaveList();
+ }
+}
+
+void ObservingList::slotSaveList() {
+ if ( ListName.isEmpty() || FileName.isEmpty() ) {
+ slotSaveListAs();
+ return;
+ }
+
+ QFile f( FileName );
+ if ( !f.open( IO_WriteOnly) ) {
+ QString message = i18n( "Could not open file %1. Try a different filename?" ).arg( f.name() );
+
+ if ( KMessageBox::warningYesNo( 0, message, i18n( "Could Not Open File" ), i18n("Try Different"), i18n("Do Not Try") ) == KMessageBox::Yes ) {
+ FileName == "";
+ slotSaveList();
+ }
+ return;
+ }
+
+ QTextStream ostream(&f);
+ ostream << ListName << endl;
+
+ //Save objects to the list using their name. If it's a star with a genetive name
+ //(i.e., "sigma orionis"), save the name with ascii characters, not greek letters.
+ //If it's an unnamed star, save "star" and the star's coordinates.
+ for ( SkyObject* o = obsList.first(); o; o = obsList.next() ) {
+ if ( o->name() == "star" ) {
+ ostream << o->name() << " " << o->ra()->Hours() << " " << o->dec()->Degrees() << endl;
+ } else if ( o->type() == SkyObject::STAR ) {
+ StarObject *s = (StarObject*)o;
+
+ if ( s->name() == s->gname() ) {
+ ostream << s->gname( false ) << endl;
+ } else {
+ ostream << o->name() << endl;
+ }
+ } else {
+ ostream << o->name() << endl;
+ }
+ }
+
+ f.close();
+ isModified = false;
+}
+
+void ObservingList::slotWizard() {
+ ObsListWizard wizard( ks );
+ if ( wizard.exec() == QDialog::Accepted ) {
+ //Make sure current list is saved
+ saveCurrentList();
+
+ for ( SkyObject *o = wizard.obsList().first(); o; o = wizard.obsList().next() ) {
+ slotAddObject( o );
+ }
+ }
+}
+
+void ObservingList::slotToggleSize() {
+ if ( isLarge() ) {
+ ui->MiniButton->setPixmap( KGlobal::iconLoader()->loadIcon( "window_fullscreen", KIcon::Toolbar ) );
+
+ //switch widget stack to show TinyTable
+ ui->TableStack->raiseWidget( ui->TinyTable );
+
+ //Abbreviate text on each button
+ ui->CenterButton->setText( i18n( "First letter in 'Center'", "C" ) );
+ ui->ScopeButton->setText( i18n( "First letter in 'Scope'", "S" ) );
+ ui->DetailsButton->setText( i18n( "First letter in 'Details'", "D" ) );
+ ui->AVTButton->setText( i18n( "First letter in 'Alt vs Time'", "A" ) );
+ ui->RemoveButton->setText( i18n( "First letter in 'Remove'", "R" ) );
+
+ //Hide Observing notes
+ ui->NotesLabel->hide();
+ ui->NotesEdit->hide();
+
+ syncTableSelection( false ); //sync TinyTable with FullTable
+ adjustSize();
+ bIsLarge = false;
+
+ } else {
+ ui->MiniButton->setPixmap( KGlobal::iconLoader()->loadIcon( "window_nofullscreen", KIcon::Toolbar ) );
+
+ //switch widget stack to show FullTable
+ ui->TableStack->raiseWidget( ui->FullTable );
+
+ //Expand text on each button
+ ui->CenterButton->setText( i18n( "Center" ) );
+ ui->ScopeButton->setText( i18n( "Scope" ) );
+ ui->DetailsButton->setText( i18n( "Details" ) );
+ ui->AVTButton->setText( i18n( "Alt vs Time" ) );
+ ui->RemoveButton->setText( i18n( "Remove" ) );
+
+ //Show Observing notes
+ ui->NotesLabel->show();
+ ui->NotesEdit->show();
+
+ syncTableSelection( true ); //sync FullTable with TinyTable
+ adjustSize();
+ bIsLarge = true;
+ }
+}
+
+void ObservingList::syncTableSelection( bool syncFullTable ) {
+ if ( syncFullTable ) {
+ int i=0;
+ QListViewItem *it = ui->FullTable->firstChild();
+ while ( it ) {
+ it->setSelected( ui->TinyTable->isSelected( i++ ) );
+ it->nextSibling();
+ }
+ } else {
+ int i=0;
+ QListViewItem *it = ui->FullTable->firstChild();
+ while ( it ) {
+ ui->TinyTable->setSelected( i++, it->isSelected() );
+ it->nextSibling();
+ }
+ }
+}
+
+#include "observinglist.moc"
diff --git a/kstars/kstars/tools/observinglist.h b/kstars/kstars/tools/observinglist.h
new file mode 100644
index 00000000..dd60dc8c
--- /dev/null
+++ b/kstars/kstars/tools/observinglist.h
@@ -0,0 +1,175 @@
+/***************************************************************************
+ observinglist.h - K Desktop Planetarium
+ -------------------
+ begin : 29 Nov 2004
+ copyright : (C) 2004 by Jeff Woods, Jason Harris
+ email : jcwoods@bellsouth.net, jharris@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 OBSERVINGLIST_H
+#define OBSERVINGLIST_H
+
+#include <kdialogbase.h>
+#include "skyobject.h"
+
+class KStars;
+class ObservingListUI;
+class QStringList;
+
+/**@class ObservingList
+ *Tool window for managing a custom list of objects. The window
+ *displays the Name, RA, Dec, mag, and type of each object in the list.
+ *
+ *By selecting an object in the list, you can perform a number of functions
+ *on that object:
+ *+ Center it in the display (TBD)
+ *+ Examine its Details Window (TBD)
+ *+ Point the telescope at it (TBD)
+ *+ Attach a custom icon or name label (TBD)
+ *+ Attach a trail (solar system only) (TBD)
+ *+ Open the AltVsTime tool (TBD)
+ *
+ *The user can also save/load their observing lists, and can export
+ *list data (TBD: as HTML table? CSV format? plain text?)
+ *
+ *The observing notes associated with the selected object are displayed
+ *below the list. (TBD)
+ *
+ *TODO:
+ *+ Implement a "shaded" state, in which the UI is compressed to
+ * make it easier to float on the KStars window. Displays only
+ * object names, and single-letter action buttons, and no user log.
+ *+ Implement an InfoBox version (the ultimate shaded state)
+ *
+ *@short Tool for managing a custom list of objects
+ *@author Jeff Woods, Jason Harris
+ *@version 1.0
+ */
+
+class ObservingList : public KDialogBase
+{
+ Q_OBJECT
+
+public:
+/**@short Cunstructor
+ */
+ ObservingList( KStars *_ks, QWidget* parent = 0 );
+/**@short Destuctor (empty)
+ */
+ ~ObservingList() {}
+
+/**@return true if the object is in the observing list
+ *@p o pointer to the object to test.
+ */
+ bool contains( const SkyObject *o );
+
+ SkyObject* first() { return obsList.first(); }
+ SkyObject* next() { return obsList.next(); }
+ uint count() const { return obsList.count(); }
+
+/**@return true if the window is in its default "large" state.
+ */
+ bool isLarge() const { return bIsLarge; }
+
+/**@short If the current list has unsaved changes, ask the user about saving it.
+ *@note also clears the list in preparation of opening a new one
+ */
+ void saveCurrentList();
+
+public slots:
+/**@short about to switch the visible table in the widget stack
+ *@p tab pointer to the table which is about to be shown
+ */
+ void slotPrepTable( QWidget *tab );
+
+/**@short add a new object to list
+ *@p o pointer to the object to add to the list
+ */
+ void slotAddObject( SkyObject *o=NULL );
+
+/**@short Remove skyobjects which are highlighted in the
+ *observing list tool from the observing list.
+ */
+ void slotRemoveObjects();
+
+/**@short Remove skyobject from the observing list.
+ *@p o pointer to the SkyObject to be removed.
+ *Use SkyMap::clickedObject() if o is NULL (default)
+ */
+ void slotRemoveObject( SkyObject *o=NULL );
+
+/**@short center the selected object in the display
+ */
+ void slotCenterObject();
+
+/**@short slew the telescope to the selected object
+ */
+ void slotSlewToObject();
+
+/**@short Show the details window for the selected object
+ */
+ void slotDetails();
+
+/**@short Show the details window for the selected object
+ */
+ void slotAVT();
+
+/**@short Tasks needed when changing the selected object
+ *Save the user log of the previous selected object,
+ *find the new selected object in the obsList, and
+ *show the notes associated with the new selected object
+ */
+ void slotNewSelection();
+
+/**@short load an observing list from disk.
+ */
+ void slotOpenList();
+
+/**@short save the current observing list to disk.
+ */
+ void slotSaveList();
+
+/**@short save the current observing list to disk, specify filename.
+ */
+ void slotSaveListAs();
+
+/**@short construct a new observing list using the wizard.
+ */
+ void slotWizard();
+
+/**@short toggle between the large and small window states
+ */
+ void slotToggleSize();
+
+/**@short Save the user log text to a file.
+ *@note the log is attached to the current object in obsList.
+ */
+ void saveCurrentUserLog();
+
+protected slots:
+ void slotClose();
+
+private:
+ void syncTableSelection( bool syncFullTable=true );
+
+ KStars *ks;
+ ObservingListUI *ui;
+ QPtrList<SkyObject> obsList;
+ QPtrList<SkyObject> SelectedObjects;
+ SkyObject *LogObject, *oCurrent;
+ uint noNameStars;
+
+ bool isModified, bIsLarge;
+ QString ListName, FileName;
+};
+
+#endif // OBSERVINGLIST_H
diff --git a/kstars/kstars/tools/observinglistui.ui b/kstars/kstars/tools/observinglistui.ui
new file mode 100644
index 00000000..040f6970
--- /dev/null
+++ b/kstars/kstars/tools/observinglistui.ui
@@ -0,0 +1,573 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ObservingListUI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ObservingListUI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>543</width>
+ <height>506</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Observing List</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout68</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>OpenButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Open observing list</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Load an observing list from disk</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>SaveButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Save observing list</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Save the current observing list to disk</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>SaveAsButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Save observing list as...</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Save the current observing list to disk, specifying the filename</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>WizardButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Observing List Wizard</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The list wizard helps you construct observing lists based on filtering by object type, position on the sky, and magnitude.</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>350</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>MiniButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Make window small</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>This button toggles between large and small states. The small state may be useful if you want the Observing list open while working in the main window.</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>CenterButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Ce&amp;nter</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Center sky map on highlighted object</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Center the sky map on the highlighted object in the list</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>ScopeButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Scope</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Point telescope at highlighted object</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Point the telescope at the highlighted object in the list</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>DetailsButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Details</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Show details for highlighted object</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Open the Details window for the highlighted object</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>AVTButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Alt vs Time</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Show altitude plot</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Open the Altitude vs. Time tool, with curves for the highlighted objects shown</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>RemoveButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Remove</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Remove from list</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Remove the highlighted object(s) from the observing list</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QWidgetStack">
+ <property name="name">
+ <cstring>TableStack</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>WStackPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>0</number>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="KListView">
+ <column>
+ <property name="text">
+ <string>Name</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>RA</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Dec</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Mag</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Type</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>FullTable</cstring>
+ </property>
+ <property name="selectionMode" stdset="0">
+ <enum>Extended</enum>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="showSortIndicator">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Table showing the current observing list. The list can be sorted by any of the data columns</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>WStackPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>1</number>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="KListBox">
+ <property name="name">
+ <cstring>TinyTable</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>4</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>100</height>
+ </size>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>NotesLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <italic>1</italic>
+ </font>
+ </property>
+ <property name="text">
+ <string>observing notes for object:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter</set>
+ </property>
+ </widget>
+ <widget class="KTextEdit">
+ <property name="name">
+ <cstring>NotesEdit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>100</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>160</height>
+ </size>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Your observing notes for the highlighted object</string>
+ </property>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klistview.h</includehint>
+ <includehint>klistbox.h</includehint>
+ <includehint>ktextedit.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/obslistwizard.cpp b/kstars/kstars/tools/obslistwizard.cpp
new file mode 100644
index 00000000..12eb2416
--- /dev/null
+++ b/kstars/kstars/tools/obslistwizard.cpp
@@ -0,0 +1,458 @@
+/***************************************************************************
+ obslistwizard.cpp - Display overhead view of the solar system
+ -------------------
+ begin : Thu 23 Jun 2005
+ copyright : (C) 2005 by Jason Harris
+ email : jharris@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. *
+ * *
+ ***************************************************************************/
+
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qwidgetstack.h>
+#include <knuminput.h>
+#include <klistbox.h>
+#include <klistview.h>
+#include <kpushbutton.h>
+
+#include "dmsbox.h"
+#include "kstars.h"
+#include "kstarsdata.h"
+#include "locationdialog.h"
+#include "magnitudespinbox.h"
+#include "skyobject.h"
+#include "starobject.h"
+//#include "libkdeedu/extdate/extdatetimeedit.h"
+
+#include "obslistwizard.h"
+
+ObsListWizard::ObsListWizard( QWidget *parent, const char *name )
+ : KDialogBase( KDialogBase::Plain, i18n("Observing List Wizard"), Ok|Cancel, Ok, parent, name )
+{
+ ksw = (KStars*)parent;
+ QFrame *page = plainPage();
+ QVBoxLayout *vlay = new QVBoxLayout( page, 0, 0 );
+
+ olw = new ObsListWizardUI( page );
+ vlay->addWidget( olw );
+
+ connect( olw->AllButton, SIGNAL( clicked() ), this, SLOT( slotAllButton() ) );
+ connect( olw->NoneButton, SIGNAL( clicked() ), this, SLOT( slotNoneButton() ) );
+ connect( olw->DeepSkyButton, SIGNAL( clicked() ), this, SLOT( slotDeepSkyButton() ) );
+ connect( olw->SolarSystemButton, SIGNAL( clicked() ), this, SLOT( slotSolarSystemButton() ) );
+ connect( olw->LocationButton, SIGNAL( clicked() ), this, SLOT( slotChangeLocation() ) );
+
+ connect( olw->FilterList, SIGNAL( clicked(QListViewItem*) ), this, SLOT( slotShowStackWidget(QListViewItem*) ) );
+
+ //Update the selected observing list when certain UI elements are modified
+ connect( olw->TypeList, SIGNAL( selectionChanged() ), this, SLOT( slotUpdateObjectCount() ) );
+ connect( olw->ConstellationList, SIGNAL( selectionChanged() ), this, SLOT( slotUpdateObjectCount() ) );
+ connect( olw->RAMin, SIGNAL( lostFocus() ), this, SLOT( slotUpdateObjectCount() ) );
+ connect( olw->RAMax, SIGNAL( lostFocus() ), this, SLOT( slotUpdateObjectCount() ) );
+ connect( olw->DecMin, SIGNAL( lostFocus() ), this, SLOT( slotUpdateObjectCount() ) );
+ connect( olw->DecMax, SIGNAL( lostFocus() ), this, SLOT( slotUpdateObjectCount() ) );
+ connect( olw->RA, SIGNAL( lostFocus() ), this, SLOT( slotUpdateObjectCount() ) );
+ connect( olw->Dec, SIGNAL( lostFocus() ), this, SLOT( slotUpdateObjectCount() ) );
+ connect( olw->Radius, SIGNAL( valueChanged(double) ), this, SLOT( slotUpdateObjectCount() ) );
+// connect( olw->Date, SIGNAL( valueChanged( const ExtDate& ) ), this, SLOT( slotApplyFilters() ) );
+ connect( olw->Mag, SIGNAL( valueChanged( double ) ), this, SLOT( slotUpdateObjectCount() ) );
+ connect( olw->ExcludeNoMag, SIGNAL( clicked() ), this, SLOT( slotUpdateObjectCount() ) );
+
+ connect( olw->SelectByConstellation, SIGNAL( toggled(bool) ), this, SLOT( slotEnableConstellationPage(bool) ) );
+ connect( olw->SelectByRect, SIGNAL( toggled(bool) ), this, SLOT( slotEnableRectPage(bool) ) );
+ connect( olw->SelectByCirc, SIGNAL( toggled(bool) ), this, SLOT( slotEnableCircPage(bool) ) );
+// connect( olw->SelectByDate, SIGNAL( toggled(bool) ), this, SLOT( slotEnableDatePage(bool) ) );
+ connect( olw->SelectByMag, SIGNAL( toggled(bool) ), this, SLOT( slotEnableMagPage(bool) ) );
+
+ connect( this, SIGNAL( okClicked() ), this, SLOT( slotApplyFilters() ) );
+
+ initialize();
+}
+
+ObsListWizard::~ObsListWizard()
+{
+}
+
+void ObsListWizard::initialize()
+{
+ //Populate the list of constellations
+ for ( SkyObject *p = ksw->data()->cnameList.first(); p; p = ksw->data()->cnameList.next() ) {
+ olw->ConstellationList->insertItem( p->name() );
+ }
+
+// //Initialize date
+// olw->Date->setDate( ksw->data()->lt().date() );
+
+ //unSelect all object types
+ olw->TypeList->selectAll( false );
+
+ olw->Mag->setMinValue( -5.0 );
+ olw->Mag->setMaxValue( 20.0 );
+ olw->Mag->setValue( 6.0 );
+
+ olw->FilterList->setSelected( olw->FilterList->firstChild(), true );
+
+ olw->RA->setDegType( false );
+ olw->RAMin->setDegType( false );
+ olw->RAMax->setDegType( false );
+
+ //Initialize object counts
+ ObjectCount = 0; //number of objects in observing list
+ StarCount = ksw->data()->starList.count(); //total number of stars
+ PlanetCount = 10; //Sun, Moon, 8 planets
+ AsteroidCount = ksw->data()->asteroidList.count(); //total number of asteroids
+ CometCount = ksw->data()->cometList.count(); //total number of comets
+ //DeepSkyObjects
+ OpenClusterCount = 0;
+ GlobClusterCount = 0;
+ GasNebCount = 0;
+ PlanNebCount = 0;
+ GalaxyCount = 0;
+ for ( SkyObject *o = (SkyObject*)(ksw->data()->deepSkyList.first()); o; o = (SkyObject*)(ksw->data()->deepSkyList.next()) ) {
+ if ( o->type() == SkyObject::GALAXY ) ++GalaxyCount; //most deepsky obj are galaxies, so check them first
+ else if ( o->type() == SkyObject::STAR || o->type() == SkyObject::CATALOG_STAR ) ++StarCount;
+ else if ( o->type() == SkyObject::OPEN_CLUSTER ) ++OpenClusterCount;
+ else if ( o->type() == SkyObject::GLOBULAR_CLUSTER ) ++GlobClusterCount;
+ else if ( o->type() == SkyObject::GASEOUS_NEBULA || o->type() == SkyObject::SUPERNOVA_REMNANT ) ++GasNebCount;
+ else if ( o->type() == SkyObject::PLANETARY_NEBULA ) ++PlanNebCount;
+ }
+
+// //DEBUG
+// kdDebug() << "StarCount: " << StarCount << endl;
+// kdDebug() << "OpenClusterCount: " << OpenClusterCount << endl;
+// kdDebug() << "GlobClusterCount: " << GlobClusterCount << endl;
+// kdDebug() << "GasNebCount: " << GasNebCount << endl;
+// kdDebug() << "PlanNebCount: " << PlanNebCount << endl;
+// kdDebug() << "GalaxyCount: " << GalaxyCount << endl;
+
+}
+
+void ObsListWizard::slotAllButton() { olw->TypeList->selectAll( true ); }
+void ObsListWizard::slotNoneButton() { olw->TypeList->selectAll( false ); }
+
+void ObsListWizard::slotEnableConstellationPage( bool t ) {
+ olw->ConstellationList->setEnabled(t);
+
+ //disable the other two region options
+ if ( t ) {
+ olw->SelectByRect->setChecked( false );
+ olw->SelectByCirc->setChecked( false );
+ }
+
+ slotUpdateObjectCount();
+}
+
+void ObsListWizard::slotEnableRectPage( bool t ) {
+ olw->RAMin->setEnabled(t);
+ olw->RAMax->setEnabled(t);
+ olw->DecMin->setEnabled(t);
+ olw->DecMax->setEnabled(t);
+
+ //disable the other two region options
+ if ( t ) {
+ olw->SelectByConstellation->setChecked( false );
+ olw->SelectByCirc->setChecked( false );
+ }
+
+ slotUpdateObjectCount();
+}
+
+void ObsListWizard::slotEnableCircPage( bool t ) {
+ olw->RA->setEnabled(t);
+ olw->Dec->setEnabled(t);
+ olw->Radius->setEnabled(t);
+
+ //disable the other two region options
+ if ( t ) {
+ olw->SelectByConstellation->setChecked( false );
+ olw->SelectByRect->setChecked( false );
+ }
+
+ slotUpdateObjectCount();
+}
+
+// void ObsListWizard::slotEnableDatePage( bool t ) {
+// olw->Date->setEnabled(t);
+// olw->LocationButton->setEnabled(t);
+// }
+
+void ObsListWizard::slotEnableMagPage( bool t ) {
+ olw->Mag->setEnabled(t);
+ olw->ExcludeNoMag->setEnabled(t);
+ slotUpdateObjectCount();
+}
+
+void ObsListWizard::slotShowStackWidget( QListViewItem *i )
+{
+ if ( i ) {
+ QString t = i->text(0);
+
+ if ( t.contains( i18n( "Object type(s)" ) ) ) olw->FilterStack->raiseWidget( olw->ObjTypePage );
+ if ( t.contains( i18n( "Region" ) ) ) olw->FilterStack->raiseWidget( olw->RegionPage );
+ if ( t.contains( i18n( "In constellation(s)" ) ) ) olw->FilterStack->raiseWidget( olw->ConstellationPage );
+ if ( t.contains( i18n( "Circular" ) ) ) olw->FilterStack->raiseWidget( olw->CircRegionPage );
+ if ( t.contains( i18n( "Rectangular" ) ) ) olw->FilterStack->raiseWidget( olw->RectRegionPage );
+// if ( t.contains( i18n( "Observable on date" ) ) ) olw->FilterStack->raiseWidget( olw->ObsDatePage );
+ if ( t.contains( i18n( "Magnitude limit" ) ) ) olw->FilterStack->raiseWidget( olw->MagLimitPage );
+ }
+}
+
+void ObsListWizard::slotDeepSkyButton()
+{
+ olw->TypeList->selectAll( false );
+ olw->TypeList->setSelected( olw->TypeList->findItem( i18n( "Open Clusters" ) ), true );
+ olw->TypeList->setSelected( olw->TypeList->findItem( i18n( "Globular Clusters" ) ), true );
+ olw->TypeList->setSelected( olw->TypeList->findItem( i18n( "Gaseous Nebulae" ) ), true );
+ olw->TypeList->setSelected( olw->TypeList->findItem( i18n( "Planetary Nebulae" ) ), true );
+ olw->TypeList->setSelected( olw->TypeList->findItem( i18n( "Galaxies" ) ), true );
+}
+
+void ObsListWizard::slotSolarSystemButton()
+{
+ olw->TypeList->selectAll( false );
+ olw->TypeList->setSelected( olw->TypeList->findItem( i18n( "Sun, Moon, Planets" ) ), true );
+ olw->TypeList->setSelected( olw->TypeList->findItem( i18n( "Comets" ) ), true );
+ olw->TypeList->setSelected( olw->TypeList->findItem( i18n( "Asteroids" ) ), true );
+}
+
+void ObsListWizard::slotChangeLocation()
+{
+ LocationDialog ld( ksw );
+
+ if ( ld.exec() == QDialog::Accepted ) {
+ //set geographic location
+ }
+}
+
+void ObsListWizard::slotUpdateObjectCount()
+{
+ ObjectCount = 0;
+ if ( olw->TypeList->findItem( i18n( "Stars" ) )->isSelected() )
+ ObjectCount += StarCount;
+ if ( olw->TypeList->findItem( i18n( "Sun, Moon, Planets" ) )->isSelected() )
+ ObjectCount += PlanetCount;
+ if ( olw->TypeList->findItem( i18n( "Comets" ) )->isSelected() )
+ ObjectCount += CometCount;
+ if ( olw->TypeList->findItem( i18n( "Asteroids" ) )->isSelected() )
+ ObjectCount += AsteroidCount;
+ if ( olw->TypeList->findItem( i18n( "Galaxies" ) )->isSelected() )
+ ObjectCount += GalaxyCount;
+ if ( olw->TypeList->findItem( i18n( "Open Clusters" ) )->isSelected() )
+ ObjectCount += OpenClusterCount;
+ if ( olw->TypeList->findItem( i18n( "Globular Clusters" ) )->isSelected() )
+ ObjectCount += GlobClusterCount;
+ if ( olw->TypeList->findItem( i18n( "Gaseous Nebulae" ) )->isSelected() )
+ ObjectCount += GasNebCount;
+ if ( olw->TypeList->findItem( i18n( "Planetary Nebulae" ) )->isSelected() )
+ ObjectCount += PlanNebCount;
+
+ applyFilters( false ); //false = only adjust counts, do not build list
+}
+
+void ObsListWizard::applyFilters( bool doBuildList )
+{
+ if ( doBuildList )
+ obsList().clear();
+
+ //make sure rect region data are valid
+ rectOk = false;
+ if ( olw->SelectByRect->isChecked() ) {
+ ra1 = olw->RAMin->createDms( false, &rectOk ).Hours();
+ if ( rectOk ) ra2 = olw->RAMax->createDms( false, &rectOk ).Hours();
+ if ( rectOk ) dc1 = olw->DecMin->createDms( true, &rectOk ).Degrees();
+ if ( rectOk ) dc2 = olw->DecMax->createDms( true, &rectOk ).Degrees();
+ if ( ra2 == 0.0 ) ra2 = 24.0;
+
+ //Make sure dc1 < dc2.
+ if ( dc1 > dc2 ) {
+ double temp = dc2;
+ dc2 = dc1;
+ dc1 = temp;
+ }
+
+ //If ra1 > ra2, we may need to swap the two values, or subtract 24h from ra1.
+ if ( ra1 > ra2 ) {
+ if ( ra1 - ra2 > 12.0 ) { //the user probably wants a region that straddles 0h
+ ra1 -= 24.0;
+ } else { //the user probably wants ra2 to be the lower limit
+ double temp = ra2;
+ ra2 = ra1;
+ ra1 = temp;
+ }
+ }
+ }
+
+ //make sure circ region data are valid
+ circOk = false;
+ if ( olw->SelectByCirc->isChecked() ) {
+ double ra = olw->RA->createDms( false, &circOk ).Hours();
+ double dc(0.0);
+ if ( circOk ) dc = olw->Dec->createDms( true, &circOk ).Degrees();
+ if ( circOk ) {
+ pCirc.set( ra, dc );
+ rCirc = olw->Radius->value();
+ }
+ }
+
+ double maglimit = 100.;
+ if ( olw->SelectByMag->isChecked() ) maglimit = olw->Mag->value();
+
+ //Stars
+ int starIndex(ksw->data()->starList.count());
+ if ( olw->TypeList->findItem( i18n( "Stars" ) )->isSelected() ) {
+ if ( maglimit < 100. ) {
+ //Stars are sorted by mag, so use binary search algo to find index of faintest mag
+ int low(0), high(ksw->data()->starList.count()-1), middle;
+ while ( low < high ) {
+ middle = (low + high)/2;
+ if ( maglimit == ksw->data()->starList.at(middle)->mag() ) break;
+ if ( maglimit < ksw->data()->starList.at(middle)->mag() ) high = middle - 1;
+ if ( maglimit > ksw->data()->starList.at(middle)->mag() ) low = middle + 1;
+ }
+ //now, the star at "middle" has the right mag, but we want the *last* star that has this mag.
+ for ( starIndex=middle+1; starIndex<ksw->data()->starList.count(); ++starIndex ) {
+ if ( ksw->data()->starList.at(starIndex)->mag() > maglimit ) break;
+ }
+ }
+
+ if ( doBuildList ) {
+ for ( uint i=0; i < starIndex; ++i ) {
+ SkyObject *o = (SkyObject*)(ksw->data()->starList.at(i));
+ applyRegionFilter( o, doBuildList, false ); //false = don't adjust ObjectCount
+ }
+ } else {
+ ObjectCount -= (ksw->data()->starList.count() - starIndex); //reduce StarCount by appropriate amount
+ for ( uint i=0; i < starIndex; ++i ) {
+ SkyObject *o = (SkyObject*)(ksw->data()->starList.at(i));
+ applyRegionFilter( o, doBuildList );
+ }
+ }
+ }
+
+ //Sun, Moon, Planets
+ if ( olw->TypeList->findItem( i18n( "Sun, Moon, Planets" ) )->isSelected() ) {
+ applyRegionFilter( (SkyObject*)ksw->data()->PCat->planetSun(), doBuildList );
+ applyRegionFilter( (SkyObject*)ksw->data()->Moon, doBuildList );
+ applyRegionFilter( (SkyObject*)ksw->data()->PCat->findByName("Mercury"), doBuildList );
+ applyRegionFilter( (SkyObject*)ksw->data()->PCat->findByName("Venus"), doBuildList );
+ applyRegionFilter( (SkyObject*)ksw->data()->PCat->findByName("Mars"), doBuildList );
+ applyRegionFilter( (SkyObject*)ksw->data()->PCat->findByName("Jupiter"), doBuildList );
+ applyRegionFilter( (SkyObject*)ksw->data()->PCat->findByName("Saturn"), doBuildList );
+ applyRegionFilter( (SkyObject*)ksw->data()->PCat->findByName("Uranus"), doBuildList );
+ applyRegionFilter( (SkyObject*)ksw->data()->PCat->findByName("Neptune"), doBuildList );
+ applyRegionFilter( (SkyObject*)ksw->data()->PCat->findByName("Pluto"), doBuildList );
+ }
+
+ //Deep sky objects
+ for ( SkyObject *o = (SkyObject*)(ksw->data()->deepSkyList.first()); o; o = (SkyObject*)(ksw->data()->deepSkyList.next()) ) {
+ //Skip unselected object types
+ if ( (o->type() == SkyObject::STAR || o->type() == SkyObject::CATALOG_STAR) && ! olw->TypeList->findItem( i18n( "Stars" ) )->isSelected() ) continue;
+ if ( o->type() == SkyObject::OPEN_CLUSTER && ! olw->TypeList->findItem( i18n( "Open Clusters" ) )->isSelected() ) continue;
+ if ( o->type() == SkyObject::GLOBULAR_CLUSTER && ! olw->TypeList->findItem( i18n( "Globular Clusters" ) )->isSelected() ) continue;
+ if ( (o->type() == SkyObject::GASEOUS_NEBULA || o->type() == SkyObject::SUPERNOVA_REMNANT) && ! olw->TypeList->findItem( i18n( "Gaseous Nebulae" ) )->isSelected() ) continue;
+ if ( o->type() == SkyObject::PLANETARY_NEBULA && ! olw->TypeList->findItem( i18n( "Planetary Nebulae" ) )->isSelected() ) continue;
+ if ( o->type() == SkyObject::GALAXY && ! olw->TypeList->findItem( i18n( "Galaxies" ) )->isSelected() ) continue;
+ if ( o->type() == SkyObject::TYPE_UNKNOWN ) continue;
+
+ if ( olw->SelectByMag->isChecked() ) {
+ if ( o->mag() > 90. ) {
+ if ( ! olw->ExcludeNoMag->isChecked() )
+ applyRegionFilter( o, doBuildList );
+ else if ( ! doBuildList )
+ --ObjectCount;
+ } else {
+ if ( o->mag() <= maglimit )
+ applyRegionFilter( o, doBuildList );
+ else if ( ! doBuildList )
+ --ObjectCount;
+ }
+ } else {
+ applyRegionFilter( o, doBuildList );
+ }
+ }
+
+ //Comets
+ if ( olw->TypeList->findItem( i18n( "Comets" ) )->isSelected() ) {
+ for ( SkyObject *o = (SkyObject*)(ksw->data()->cometList.first()); o; o = (SkyObject*)(ksw->data()->cometList.next()) ) {
+ //comets don't have magnitudes at this point, so skip mag check
+ applyRegionFilter( o, doBuildList );
+ }
+ }
+
+ //Asteroids
+ if ( olw->TypeList->findItem( i18n( "Asteroids" ) )->isSelected() ) {
+ for ( SkyObject *o = (SkyObject*)(ksw->data()->asteroidList.first()); o; o = (SkyObject*)(ksw->data()->asteroidList.next()) ) {
+
+ if ( olw->SelectByMag->isChecked() ) {
+ if ( o->mag() > 90. ) {
+ if ( ! olw->ExcludeNoMag->isChecked() )
+ applyRegionFilter( o, doBuildList );
+ else if ( ! doBuildList )
+ --ObjectCount;
+ } else {
+ if ( o->mag() <= maglimit )
+ applyRegionFilter( o, doBuildList );
+ else if ( ! doBuildList )
+ --ObjectCount;
+ }
+ } else {
+ applyRegionFilter( o, doBuildList );
+ }
+ }
+ }
+
+ //Update the object count label
+ if ( doBuildList ) ObjectCount = obsList().count();
+ olw->CountLabel->setText( i18n("Current selection: %1 objects").arg( ObjectCount ) );
+}
+
+void ObsListWizard::applyRegionFilter( SkyObject *o, bool doBuildList, bool doAdjustCount ) {
+ //select by constellation
+ if ( olw->SelectByConstellation->isChecked() ) {
+ QString c( o->constellation( ksw->data()->csegmentList, ksw->data()->cnameList ) );
+ QListBoxItem *it = olw->ConstellationList->findItem( c );
+
+ if ( it && it->isSelected() ) {
+ if ( doBuildList ) obsList().append ( o );
+ } else if ( doAdjustCount ) --ObjectCount;
+ }
+
+ //select by rectangular region
+ else if ( rectOk ) {
+ double ra = o->ra()->Hours();
+ double dec = o->dec()->Degrees();
+ bool addObject = false;
+ if ( dec >= dc1 && dec <= dc2 ) {
+ if ( ra1 < 0.0 ) {
+ if (ra >= ra1 + 24.0 || ra <= ra2 ) { addObject = true; }
+ } else {
+ if ( ra >= ra1 && ra <= ra2 ) { addObject = true; }
+ }
+ }
+
+ if ( addObject && doBuildList ) obsList().append( o );
+ if ( ! addObject && doAdjustCount ) --ObjectCount;
+ }
+
+ //select by circular region
+ else if ( circOk ) {
+ if ( o->angularDistanceTo( &pCirc ).Degrees() < rCirc ) {
+ if ( doBuildList ) obsList().append( o );
+ } else if ( doAdjustCount ) --ObjectCount;
+ }
+
+ //No region filter, just add the object
+ else if ( doBuildList ) {
+ obsList().append( o );
+ }
+}
+
+#include "obslistwizard.moc"
diff --git a/kstars/kstars/tools/obslistwizard.h b/kstars/kstars/tools/obslistwizard.h
new file mode 100644
index 00000000..5c04b93f
--- /dev/null
+++ b/kstars/kstars/tools/obslistwizard.h
@@ -0,0 +1,79 @@
+/***************************************************************************
+ obslistwizard.h - Display overhead view of the solar system
+ -------------------
+ begin : Thu 23 Jun 2005
+ copyright : (C) 2005 by Jason Harris
+ email : jharris@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 OBSLISTWIZARD_H
+#define OBSLISTWIZARD_H
+
+#include <kdialogbase.h>
+
+#include "obslistwizardui.h"
+
+class KStars;
+class QListViewItem;
+
+/**@class ObsListWizard
+ *@short Wizard for constructing observing lists
+ */
+
+class ObsListWizard : public KDialogBase
+{
+ Q_OBJECT
+ public:
+ /**@short Constructor
+ */
+ ObsListWizard( QWidget *parent = 0, const char *name = 0 );
+ /**@short Destructor
+ */
+ ~ObsListWizard();
+
+ /**@return reference to QPtrList of objects selected by the wizard
+ */
+ QPtrList<SkyObject>& obsList() { return ObsList; }
+
+ private slots:
+ void slotAllButton();
+ void slotNoneButton();
+ void slotDeepSkyButton();
+ void slotSolarSystemButton();
+ void slotChangeLocation();
+ void slotShowStackWidget(QListViewItem*);
+ void slotEnableConstellationPage(bool);
+ void slotEnableRectPage(bool);
+ void slotEnableCircPage(bool);
+// void slotEnableDatePage(bool);
+ void slotEnableMagPage(bool);
+
+ /**@short Construct the observing list by applying the selected filters
+ */
+ void slotUpdateObjectCount();
+ void slotApplyFilters() { applyFilters( true ); }
+
+ private:
+ void initialize();
+ void applyFilters( bool doBuildList );
+ void applyRegionFilter( SkyObject *o, bool doBuildList, bool doAdjustCount=true );
+
+ QPtrList<SkyObject> ObsList;
+ KStars *ksw;
+ ObsListWizardUI *olw;
+ uint ObjectCount, StarCount, PlanetCount, CometCount, AsteroidCount;
+ uint GalaxyCount, OpenClusterCount, GlobClusterCount, GasNebCount, PlanNebCount;
+ bool rectOk, circOk;
+ double ra1, ra2, dc1, dc2, rCirc;
+ SkyPoint pCirc;
+};
+
+#endif
diff --git a/kstars/kstars/tools/obslistwizardui.ui b/kstars/kstars/tools/obslistwizardui.ui
new file mode 100644
index 00000000..a501e152
--- /dev/null
+++ b/kstars/kstars/tools/obslistwizardui.ui
@@ -0,0 +1,1025 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ObsListWizardUI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ObsListWizardUI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>763</width>
+ <height>403</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Observing List Wizard</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout79</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout55</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Selection filters:</string>
+ </property>
+ </widget>
+ <widget class="KListView">
+ <column>
+ <property name="text">
+ <string>Filter</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <item>
+ <property name="text">
+ <string>1. Object type(s)</string>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>2. Region</string>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ <item>
+ <property name="text">
+ <string>a. In constellation(s)</string>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>b. Rectangular</string>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>c. Circular</string>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ </item>
+ </item>
+ <item>
+ <property name="text">
+ <string>3. Magnitude limit</string>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>FilterList</cstring>
+ </property>
+ <property name="fullWidth">
+ <bool>true</bool>
+ </property>
+ <property name="itemsMovable">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout12</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Filter arguments:</string>
+ </property>
+ </widget>
+ <widget class="QWidgetStack">
+ <property name="name">
+ <cstring>FilterStack</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>ObjTypePage</cstring>
+ </property>
+ <attribute name="id">
+ <number>0</number>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Select object types:</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout13</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KListBox">
+ <item>
+ <property name="text">
+ <string>Stars</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Sun, Moon, Planets</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Comets</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Asteroids</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Open Clusters</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Globular Clusters</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Gaseous Nebulae</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Planetary Nebulae</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Galaxies</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>TypeList</cstring>
+ </property>
+ <property name="selectionMode">
+ <enum>Multi</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout12</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>AllButton</cstring>
+ </property>
+ <property name="text">
+ <string>All</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>NoneButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;None</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>DeepSkyButton</cstring>
+ </property>
+ <property name="text">
+ <string>Deep-Sk&amp;y</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>SolarSystemButton</cstring>
+ </property>
+ <property name="text">
+ <string>Sol&amp;ar System</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>90</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>ConstellationPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>1</number>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>SelectByConstellation</cstring>
+ </property>
+ <property name="text">
+ <string>Select objects in constell&amp;ation(s):</string>
+ </property>
+ </widget>
+ <widget class="KListBox">
+ <property name="name">
+ <cstring>ConstellationList</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="selectionMode">
+ <enum>Multi</enum>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>RectRegionPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>2</number>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>SelectByRect</cstring>
+ </property>
+ <property name="text">
+ <string>Select objects in region:</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout48</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="1" column="2">
+ <property name="name">
+ <cstring>textLabel4_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>to</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>RAMin</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>20</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="3">
+ <property name="name">
+ <cstring>RAMax</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>20</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>RA:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel4_3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Dec:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="2">
+ <property name="name">
+ <cstring>textLabel4_2</cstring>
+ </property>
+ <property name="text">
+ <string>to</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>DecMin</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>20</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="3">
+ <property name="name">
+ <cstring>DecMax</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>20</height>
+ </size>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>215</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>CircRegionPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>3</number>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>SelectByCirc</cstring>
+ </property>
+ <property name="text">
+ <string>Select objects within circle:</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout9</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1_4</cstring>
+ </property>
+ <property name="text">
+ <string>Center RA:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2_3</cstring>
+ </property>
+ <property name="text">
+ <string>Center Dec:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel3_3</cstring>
+ </property>
+ <property name="text">
+ <string>Radius (degrees):</string>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="0" column="1">
+ <property name="name">
+ <cstring>RA</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>20</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="dmsBox" row="1" column="1">
+ <property name="name">
+ <cstring>Dec</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>20</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="KDoubleNumInput" row="2" column="1">
+ <property name="name">
+ <cstring>Radius</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="value">
+ <number>1</number>
+ </property>
+ <property name="maxValue">
+ <number>180</number>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer9</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>170</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>ObsDatePage</cstring>
+ </property>
+ <attribute name="id">
+ <number>4</number>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>SelectByDate</cstring>
+ </property>
+ <property name="text">
+ <string>Select objects observ&amp;able on:</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="ExtDateEdit">
+ <property name="name">
+ <cstring>Date</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>160</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>from</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>LocationLabel</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Tucson, Arizona, USA</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout5_2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>LocationButton</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Cha&amp;nge Location</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>176</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>MagLimitPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>5</number>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>SelectByMag</cstring>
+ </property>
+ <property name="text">
+ <string>Select objects &amp;brighter than:</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout36</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="MagnitudeSpinBox">
+ <property name="name">
+ <cstring>Mag</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel4_4</cstring>
+ </property>
+ <property name="text">
+ <string>mag</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer8</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>295</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>ExcludeNoMag</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Exclude objects which
+have &amp;no magnitude</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>179</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>RegionPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>6</number>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>There are three ways to select objects from
+a specific region on the sky:
+
+a. select objects in a constellation
+b. select objects in a rectangular region
+c. select objects in a circular region
+
+Choose one of these sub-items to
+select from a region on the sky.</string>
+ </property>
+ <property name="alignment">
+ <set>AlignTop</set>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>CountLabel</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>Box</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="text">
+ <string>Current selection: 100 objects</string>
+ </property>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>ExtDateEdit</class>
+ <header location="local">libkdeedu/extdate/extdatetimeedit.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+ <customwidget>
+ <class>dmsBox</class>
+ <header location="local">dmsbox.h</header>
+ <sizehint>
+ <width>-1</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>0</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+ <customwidget>
+ <class>MagnitudeSpinBox</class>
+ <header location="local">magnitudespinbox.h</header>
+ <sizehint>
+ <width>60</width>
+ <height>18</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="XBM.GZ" length="79">789c534e494dcbcc4b554829cdcdad8c2fcf4c29c95030e0524611cd48cd4ccf28010a1797249664262b2467241641a592324b8aa363156c15aab914146aadb90067111b1f</data>
+ </image>
+</images>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klistview.h</includehint>
+ <includehint>klistbox.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klistbox.h</includehint>
+ <includehint>dmsbox.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>magnitudespinbox.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/optionstreeview.ui b/kstars/kstars/tools/optionstreeview.ui
new file mode 100644
index 00000000..acae2c0d
--- /dev/null
+++ b/kstars/kstars/tools/optionstreeview.ui
@@ -0,0 +1,137 @@
+<!DOCTYPE UI><UI version="3.1.2" stdsetdef="1">
+<class>OptionsTreeView</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>OptionsTreeView</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>428</width>
+ <height>436</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>View Options</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KListView">
+ <column>
+ <property name="text">
+ <string>Option Name</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Description</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Type</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>OptionsList</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>80</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>OptionsTreeView</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>OptionsTreeView</receiver>
+ <slot>accept()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klistview.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/planetviewer.cpp b/kstars/kstars/tools/planetviewer.cpp
new file mode 100644
index 00000000..725e5318
--- /dev/null
+++ b/kstars/kstars/tools/planetviewer.cpp
@@ -0,0 +1,473 @@
+/***************************************************************************
+ planetviewer.cpp - Display overhead view of the solar system
+ -------------------
+ begin : Sun May 25 2003
+ copyright : (C) 2003 by Jason Harris
+ email : jharris@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. *
+ * *
+ ***************************************************************************/
+
+#include <stdlib.h> //needed for abs() on some platforms
+
+#include <qfile.h>
+#include <qlayout.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kglobal.h>
+#include <kiconloader.h>
+
+#include "planetviewer.h"
+#include "kstars.h"
+#include "kstarsdata.h"
+#include "ksutils.h"
+#include "ksnumbers.h"
+#include "ksplanetbase.h"
+#include "dms.h"
+#include "timestepbox.h"
+#include "libkdeedu/extdate/extdatetimeedit.h"
+
+#define AUMAX 48
+
+PlanetViewer::PlanetViewer(QWidget *parent, const char *name)
+ : KDialogBase( KDialogBase::Plain, i18n("Solar System Viewer"), Close, Close, parent, name ), PCat( ((KStars*)parent)->data() ), scale(1.0), isClockRunning(false), tmr(this)
+{
+ QFrame *page = plainPage();
+ QVBoxLayout *vlay = new QVBoxLayout( page, 0, spacingHint() );
+ pw = new PlanetViewerUI( page );
+ pw->map->setLimits( -48.0, 48.0, -48.0, 48.0 );
+ pw->map->setXAxisLabel( i18n( "axis label for x-coordinate of solar system viewer. AU means astronomical unit.", "X-position (AU)" ) );
+ pw->map->setYAxisLabel( i18n( "axis label for y-coordinate of solar system viewer. AU means astronomical unit.", "Y-position (AU)" ) );
+
+ pw->timeStep->setDaysOnly( true );
+ pw->timeStep->tsbox()->setValue( 1 ); //start with 1-day timestep
+
+ pw->RunButton->setPixmap( KGlobal::iconLoader()->loadIcon( "1rightarrow", KIcon::Toolbar ) );
+ pw->dateBox->setDate( ((KStars*)parent)->data()->lt().date() );
+
+ vlay->addWidget( pw );
+ resize( 500, 500 );
+ pw->map->QWidget::setFocus(); //give keyboard focus to the plot widget for key and mouse events
+
+ pName[0] = "Mercury"; pColor[0] = "SlateBlue1";
+ pName[1] = "Venus"; pColor[1] = "LightGreen";
+ pName[2] = "Earth"; pColor[2] = "Blue";
+ pName[3] = "Mars"; pColor[3] = "Red";
+ pName[4] = "Jupiter"; pColor[4] = "Goldenrod";
+ pName[5] = "Saturn"; pColor[5] = "LightYellow2";
+ pName[6] = "Uranus"; pColor[6] = "LightSeaGreen";
+ pName[7] = "Neptune"; pColor[7] = "SkyBlue";
+ pName[8] = "Pluto"; pColor[8] = "gray";
+
+ setCenterPlanet("");
+
+ PCat.initialize();
+ ut = ((KStars*)parent)->data()->ut();
+ KSNumbers num( ut.djd() );
+ PCat.findPosition( &num, 0, 0 ); //NULL args: don't need geocent. coords.
+
+ for ( uint i=0; i<9; ++i )
+ LastUpdate[i] = int( ut.date().jd() );
+
+ //The planets' update intervals are 0.25% of one period:
+ UpdateInterval[0] = 0;
+ UpdateInterval[1] = 0;
+ UpdateInterval[2] = 0;
+ UpdateInterval[3] = 1;
+ UpdateInterval[4] = 5;
+ UpdateInterval[5] = 13;
+ UpdateInterval[6] = 38;
+ UpdateInterval[7] = 75;
+ UpdateInterval[8] = 113;
+
+ QTimer::singleShot( 0, this, SLOT( initPlotObjects() ) );
+
+ connect( &tmr, SIGNAL( timeout() ), SLOT( tick() ) );
+ connect( pw->timeStep, SIGNAL( scaleChanged(float) ), SLOT( setTimeScale(float) ) );
+ connect( pw->RunButton, SIGNAL( clicked() ), SLOT( slotRunClock() ) );
+ connect( pw->dateBox, SIGNAL( valueChanged( const ExtDate & ) ), SLOT( slotChangeDate( const ExtDate & ) ) );
+ connect( pw->TodayButton, SIGNAL( clicked() ), SLOT( slotToday() ) );
+}
+
+PlanetViewer::~PlanetViewer()
+{
+}
+
+void PlanetViewer::tick() {
+ //Update the time/date
+ ut.setDJD( ut.djd() + scale*0.1 );
+ pw->dateBox->setDate( ut.date() );
+
+ updatePlanets();
+}
+
+void PlanetViewer::setTimeScale(float f) {
+ scale = f/86400.; //convert seconds to days
+}
+
+void PlanetViewer::slotRunClock() {
+ isClockRunning = !isClockRunning;
+
+ if ( isClockRunning ) {
+ pw->RunButton->setPixmap( KGlobal::iconLoader()->loadIcon( "player_pause", KIcon::Toolbar ) );
+ tmr.start( 100 );
+// pw->dateBox->setEnabled( false );
+ } else {
+ pw->RunButton->setPixmap( KGlobal::iconLoader()->loadIcon( "1rightarrow", KIcon::Toolbar ) );
+ tmr.stop();
+// pw->dateBox->setEnabled( true );
+ }
+}
+
+void PlanetViewer::slotChangeDate( const ExtDate & ) {
+ if ( pw->dateBox->date().isValid() ) {
+ ut.setDate( pw->dateBox->date() );
+ updatePlanets();
+ }
+}
+
+void PlanetViewer::updatePlanets() {
+ KSNumbers num( ut.djd() );
+ bool changed(false);
+
+ //Check each planet to see if it needs to be updated
+ for ( unsigned int i=0; i<9; ++i ) {
+ if ( abs( int(ut.date().jd()) - LastUpdate[i] ) > UpdateInterval[i] ) {
+ KSPlanetBase *p = PCat.findByName( pName[i] );
+ p->findPosition( &num );
+
+ double s, c, s2, c2;
+ p->helEcLong()->SinCos( s, c );
+ p->helEcLat()->SinCos( s2, c2 );
+ planet[i]->point(0)->setX( p->rsun()*c*c2 );
+ planet[i]->point(0)->setY( p->rsun()*s*c2 );
+ planetLabel[i]->point(0)->setX( p->rsun()*c*c2 );
+ planetLabel[i]->point(0)->setY( p->rsun()*s*c2 );
+
+ if ( centerPlanet() == pName[i] ) {
+ double xc = (pw->map->x2() + pw->map->x())*0.5;
+ double yc = (pw->map->y2() + pw->map->y())*0.5;
+ double dx = planet[i]->point(0)->x() - xc;
+ double dy = planet[i]->point(0)->y() - yc;
+ pw->map->setLimits( pw->map->x() + dx, pw->map->x2() + dx,
+ pw->map->y() + dy, pw->map->y2() + dy );
+ }
+
+ LastUpdate[i] = int(ut.date().jd());
+ changed = true;
+ }
+ }
+
+ if ( changed ) pw->map->update();
+}
+
+void PlanetViewer::slotToday() {
+ KStars *ks = (KStars*)parent();
+ pw->dateBox->setDate( ks->data()->lt().date() );
+}
+
+void PlanetViewer::paintEvent( QPaintEvent* ) {
+ pw->map->update();
+}
+
+void PlanetViewer::initPlotObjects() {
+ // Planets
+ ksun = new KPlotObject( "Sun", "yellow", KPlotObject::POINTS, 12, KPlotObject::CIRCLE );
+ ksun->addPoint( new DPoint( 0.0, 0.0 ) );
+ pw->map->addObject( ksun );
+
+ //Read in the orbit curves
+ KPlotObject *orbit[9];
+ for ( unsigned int i=0; i<9; ++i ) {
+ orbit[i] = new KPlotObject( "", "white", KPlotObject::CURVE, 1, KPlotObject::SOLID );
+
+ QFile orbitFile;
+ if ( KSUtils::openDataFile( orbitFile, pName[i].lower() + ".orbit" ) ) {
+ QTextStream orbitStream( &orbitFile );
+ double x, y, z;
+ while ( !orbitStream.eof() ) {
+ orbitStream >> x >> y >> z;
+ orbit[i]->addPoint( new DPoint( x, y ) );
+ }
+ }
+
+ pw->map->addObject( orbit[i] );
+ }
+
+ for ( unsigned int i=0; i<9; ++i ) {
+ planet[i] = new KPlotObject( pName[i], pColor[i], KPlotObject::POINTS, 6, KPlotObject::CIRCLE );
+ planetLabel[i] = new KPlotObject( i18n(pName[i].local8Bit()), pColor[i], KPlotObject::LABEL );
+
+ double s, c;
+ KSPlanetBase *p = PCat.findByName( pName[i] );
+ p->helEcLong()->SinCos( s, c );
+
+ planet[i]->addPoint( new DPoint( p->rsun()*c, p->rsun()*s ) );
+ planetLabel[i]->addPoint( new DPoint( p->rsun()*c, p->rsun()*s ) );
+ pw->map->addObject( planet[i] );
+ pw->map->addObject( planetLabel[i] );
+ }
+
+ update();
+}
+
+void PlanetViewer::keyPressEvent( QKeyEvent *e ) {
+ switch ( e->key() ) {
+ case Key_Escape:
+ close();
+ break;
+ default:
+ e->ignore();
+ break;
+ }
+}
+
+PVPlotWidget::PVPlotWidget( double x1, double x2, double y1, double y2, QWidget *par, const char *name ) :
+ KStarsPlotWidget( x1, x2, y1, y2, par, name ),
+ mouseButtonDown(false), oldx(0), oldy(0) {
+ setFocusPolicy( QWidget::StrongFocus );
+ setMouseTracking (true);
+ pv = (PlanetViewer*)topLevelWidget();
+}
+
+PVPlotWidget::PVPlotWidget( QWidget *parent, const char *name ) :
+ KStarsPlotWidget( 0.0, 1.0, 0.0, 1.0, parent, name ),
+ mouseButtonDown(false), oldx(0), oldy(0) {
+ setFocusPolicy( QWidget::StrongFocus );
+ setMouseTracking (true);
+ pv = (PlanetViewer*)topLevelWidget();
+}
+
+PVPlotWidget::~ PVPlotWidget() {}
+
+void PVPlotWidget::keyPressEvent( QKeyEvent *e ) {
+ double xc = (x2() + x())*0.5;
+ double yc = (y2() + y())*0.5;
+ double xstep = 0.01*(x2() - x());
+ double ystep = 0.01*(y2() - y());
+ double dx = 0.5*dataWidth();
+ double dy = 0.5*dataHeight();
+
+ switch ( e->key() ) {
+ case Key_Left:
+ if ( xc - xstep > -AUMAX ) {
+ setLimits( x() - xstep, x2() - xstep, y(), y2() );
+ pv->setCenterPlanet("");
+ update();
+ }
+ break;
+
+ case Key_Right:
+ if ( xc + xstep < AUMAX ) {
+ setLimits( x() + xstep, x2() + xstep, y(), y2() );
+ pv->setCenterPlanet("");
+ update();
+ }
+ break;
+
+ case Key_Down:
+ if ( yc - ystep > -AUMAX ) {
+ setLimits( x(), x2(), y() - ystep, y2() - ystep );
+ pv->setCenterPlanet("");
+ update();
+ }
+ break;
+
+ case Key_Up:
+ if ( yc + ystep < AUMAX ) {
+ setLimits( x(), x2(), y() + ystep, y2() + ystep );
+ pv->setCenterPlanet("");
+ update();
+ }
+ break;
+
+ case Key_Plus:
+ case Key_Equal:
+ slotZoomIn();
+ break;
+
+ case Key_Minus:
+ case Key_Underscore:
+ slotZoomOut();
+ break;
+
+ case Key_0: //Sun
+ setLimits( -dx, dx, -dy, dy );
+ pv->setCenterPlanet( "Sun" );
+ update();
+ break;
+
+ case Key_1: //Mercury
+ {
+ DPoint *p = object(10)->point(0);
+ setLimits( p->x() - dx, p->x() + dx, p->y() - dy, p->y() + dy );
+ pv->setCenterPlanet( "Mercury" );
+ update();
+ break;
+ }
+
+ case Key_2: //Venus
+ {
+ DPoint *p = object(12)->point(0);
+ setLimits( p->x() - dx, p->x() + dx, p->y() - dy, p->y() + dy );
+ pv->setCenterPlanet( "Venus" );
+ update();
+ break;
+ }
+
+ case Key_3: //Earth
+ {
+ DPoint *p = object(14)->point(0);
+ setLimits( p->x() - dx, p->x() + dx, p->y() - dy, p->y() + dy );
+ pv->setCenterPlanet( "Earth" );
+ update();
+ break;
+ }
+
+ case Key_4: //Mars
+ {
+ DPoint *p = object(16)->point(0);
+ setLimits( p->x() - dx, p->x() + dx, p->y() - dy, p->y() + dy );
+ pv->setCenterPlanet( "Mars" );
+ update();
+ break;
+ }
+
+ case Key_5: //Jupiter
+ {
+ DPoint *p = object(18)->point(0);
+ setLimits( p->x() - dx, p->x() + dx, p->y() - dy, p->y() + dy );
+ pv->setCenterPlanet( "Jupiter" );
+ update();
+ break;
+ }
+
+ case Key_6: //Saturn
+ {
+ DPoint *p = object(20)->point(0);
+ setLimits( p->x() - dx, p->x() + dx, p->y() - dy, p->y() + dy );
+ pv->setCenterPlanet( "Saturn" );
+ update();
+ break;
+ }
+
+ case Key_7: //Uranus
+ {
+ DPoint *p = object(22)->point(0);
+ setLimits( p->x() - dx, p->x() + dx, p->y() - dy, p->y() + dy );
+ pv->setCenterPlanet( "Uranus" );
+ update();
+ break;
+ }
+
+ case Key_8: //Neptune
+ {
+ DPoint *p = object(24)->point(0);
+ setLimits( p->x() - dx, p->x() + dx, p->y() - dy, p->y() + dy );
+ pv->setCenterPlanet( "Neptune" );
+ update();
+ break;
+ }
+
+ case Key_9: //Pluto
+ {
+ DPoint *p = object(26)->point(0);
+ setLimits( p->x() - dx, p->x() + dx, p->y() - dy, p->y() + dy );
+ pv->setCenterPlanet( "Pluto" );
+ update();
+ break;
+ }
+
+ default:
+ e->ignore();
+ break;
+ }
+}
+
+void PVPlotWidget::mousePressEvent( QMouseEvent *e ) {
+ mouseButtonDown = true;
+ oldx = e->x();
+ oldy = e->y();
+}
+
+void PVPlotWidget::mouseReleaseEvent( QMouseEvent * ) {
+ mouseButtonDown = false;
+ update();
+}
+
+void PVPlotWidget::mouseMoveEvent( QMouseEvent *e ) {
+ if ( mouseButtonDown ) {
+ //Determine how far we've moved
+ double xc = (x2() + x())*0.5;
+ double yc = (y2() + y())*0.5;
+ double xscale = dataWidth()/( width() - leftPadding() - rightPadding() );
+ double yscale = dataHeight()/( height() - topPadding() - bottomPadding() );
+
+ xc += ( oldx - e->x() )*xscale;
+ yc -= ( oldy - e->y() )*yscale; //Y data axis is reversed...
+
+ if ( xc > -AUMAX && xc < AUMAX && yc > -AUMAX && yc < AUMAX ) {
+ setLimits( xc - 0.5*dataWidth(), xc + 0.5*dataWidth(),
+ yc - 0.5*dataHeight(), yc + 0.5*dataHeight() );
+ update();
+ kapp->processEvents(20);
+ }
+
+ oldx = e->x();
+ oldy = e->y();
+ }
+}
+
+void PVPlotWidget::mouseDoubleClickEvent( QMouseEvent *e ) {
+ double xscale = dataWidth()/( width() - leftPadding() - rightPadding() );
+ double yscale = dataHeight()/( height() - topPadding() - bottomPadding() );
+
+ double xc = x() + xscale*( e->x() - leftPadding() );
+ double yc = y2() - yscale*( e->y() - topPadding() );
+
+ if ( xc > -AUMAX && xc < AUMAX && yc > -AUMAX && yc < AUMAX ) {
+ setLimits( xc - 0.5*dataWidth(), xc + 0.5*dataWidth(),
+ yc - 0.5*dataHeight(), yc + 0.5*dataHeight() );
+ update();
+ }
+
+ pv->setCenterPlanet( "" );
+ for ( unsigned int i=0; i<9; ++i ) {
+ double dx = ( pv->planetObject(i)->point(0)->x() - xc )/xscale;
+ if ( dx < 4.0 ) {
+ double dy = ( pv->planetObject(i)->point(0)->y() - yc )/yscale;
+ if ( sqrt( dx*dx + dy*dy ) < 4.0 ) {
+ pv->setCenterPlanet( pv->planetName(i) );
+ }
+ }
+ }
+}
+
+void PVPlotWidget::wheelEvent( QWheelEvent *e ) {
+ if ( e->delta() > 0 ) slotZoomIn();
+ else slotZoomOut();
+}
+
+void PVPlotWidget::slotZoomIn() {
+ double size( x2() - x() );
+ if ( size > 0.8 ) {
+ setLimits( x() + 0.02*size, x2() - 0.02*size, y() + 0.02*size, y2() - 0.02*size );
+ update();
+ }
+}
+
+void PVPlotWidget::slotZoomOut() {
+ double size( x2() - x() );
+ if ( (x2() - x()) < 100.0 ) {
+ setLimits( x() - 0.02*size, x2() + 0.02*size, y() - 0.02*size, y2() + 0.02*size );
+ update();
+ }
+}
+
+#include "planetviewer.moc"
diff --git a/kstars/kstars/tools/planetviewer.h b/kstars/kstars/tools/planetviewer.h
new file mode 100644
index 00000000..6df052a8
--- /dev/null
+++ b/kstars/kstars/tools/planetviewer.h
@@ -0,0 +1,107 @@
+/***************************************************************************
+ planetviewer.h - Display overhead view of the solar system
+ -------------------
+ begin : Sun May 25 2003
+ copyright : (C) 2003 by Jason Harris
+ email : jharris@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 PLANETVIEWER_H
+#define PLANETVIEWER_H
+
+#include <kdialogbase.h>
+#include <kpushbutton.h>
+#include <qtimer.h>
+
+#include "kstarsplotwidget.h"
+#include "planetviewerui.h"
+#include "kstarsdatetime.h"
+#include "planetcatalog.h"
+
+/**@class PlanetViewer
+ *@short Display an overhead view of the solar system
+ *@version 1.0
+ *@author Jason Harris
+ */
+class PlanetViewer : public KDialogBase
+{
+Q_OBJECT
+public:
+ PlanetViewer(QWidget *parent = 0, const char *name = 0);
+ ~PlanetViewer();
+
+ QString centerPlanet() const { return CenterPlanet; }
+ void setCenterPlanet( const QString &cp ) { CenterPlanet = cp; }
+
+ KPlotObject* planetObject(uint i) const { return planet[i]; }
+ QString planetName(uint i) const { return pName[i]; }
+
+protected:
+ virtual void keyPressEvent( QKeyEvent *e );
+ virtual void paintEvent( QPaintEvent* );
+
+private slots:
+ void initPlotObjects();
+ void tick();
+ void setTimeScale(float);
+ void slotChangeDate( const ExtDate &d );
+ void slotRunClock();
+ void slotToday();
+
+private:
+ void updatePlanets();
+
+ PlanetViewerUI *pw;
+ KStarsDateTime ut;
+ PlanetCatalog PCat;
+ double scale;
+ bool isClockRunning;
+ QTimer tmr;
+ int UpdateInterval[9], LastUpdate[9];
+ QString pName[9], pColor[9];
+ QString CenterPlanet;
+
+ KPlotObject *ksun;
+ KPlotObject *planet[9];
+ KPlotObject *planetLabel[9];
+};
+
+class PVPlotWidget : public KStarsPlotWidget
+{
+Q_OBJECT
+public:
+ PVPlotWidget( double x1, double x2, double y1, double y2,
+ QWidget *parent=0, const char *name=0 );
+ PVPlotWidget( QWidget *parent=0, const char *name=0 );
+ ~PVPlotWidget();
+
+public slots:
+ void slotZoomIn();
+ void slotZoomOut();
+
+signals:
+ void doubleClicked( double, double );
+
+protected:
+ virtual void keyPressEvent( QKeyEvent *e );
+ virtual void mousePressEvent( QMouseEvent *e );
+ virtual void mouseMoveEvent( QMouseEvent *e );
+ virtual void mouseReleaseEvent( QMouseEvent * );
+ virtual void mouseDoubleClickEvent( QMouseEvent *e );
+ virtual void wheelEvent( QWheelEvent *e );
+
+private:
+ bool mouseButtonDown;
+ int oldx, oldy;
+ PlanetViewer *pv;
+};
+
+#endif
diff --git a/kstars/kstars/tools/planetviewerui.ui b/kstars/kstars/tools/planetviewerui.ui
new file mode 100644
index 00000000..77f3e085
--- /dev/null
+++ b/kstars/kstars/tools/planetviewerui.ui
@@ -0,0 +1,159 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>PlanetViewerUI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>PlanetViewerUI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>537</width>
+ <height>560</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Planet Viewer</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="PVPlotWidget">
+ <property name="name">
+ <cstring>map</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>RunButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>34</width>
+ <height>34</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="TimeStepBox">
+ <property name="name">
+ <cstring>timeStep</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>120</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="ExtDateEdit">
+ <property name="name">
+ <cstring>dateBox</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>TodayButton</cstring>
+ </property>
+ <property name="text">
+ <string>Today</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>TimeStepBox</class>
+ <header location="local">timestepbox.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+ <customwidget>
+ <class>ExtDateEdit</class>
+ <header location="local">libkdeedu/extdate/extdatetimeedit.h</header>
+ <sizehint>
+ <width>70</width>
+ <height>20</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+ <customwidget>
+ <class>PVPlotWidget</class>
+ <header location="local">planetviewer.h</header>
+ <sizehint>
+ <width>500</width>
+ <height>500</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1002">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000003b149444154388dad945f4c5b551cc73fe7dc4b7b4bcba0762d45c43114323599ee6192609c51d883892ce083f1718b3ebb185f8dc91e972cf39d2d2a2f1af664b6f1e0fe3863a0718969700eb0c52142da0242a1bd6d696f7bcff101585203ceb8fd9ece39f99dcff9fe7edf939f88c562ec465f5f9fe609442c161362173c3e3eae7b7a7ac8e7f36432196cdbfe4f907c3e4f2291201e8fe338cec3737357e9e8e828aded1e229d650e1f2d51754b082110124c13a4dc5ea341eb9dc284c0558a853f3ce8cb0677ef500fde7d39d2596679e326597b8e9abb85d7a770ab16ab6983ec5a05b487a70e36f0f4e10afe408d6a558310980108478dba4a1e8233990c5d474b64ed39aa3a8fe5f3317fbf81dbd70bccfeb205947632fd74f6589c1c6ea2f70d03a58ba0c1f2c9bdc1b66de3b8256a6e11cbe7e3ee1d181b590124fe2693aeee08d223c82c3a2c24b7b874bec8f26288774f7bd054504aef0dde6e99c0eb83f9fb266323cb80a27fb0958141836044605a2ee5523393371cc646fee2da37195aa35d0c0c5b4859ac03d7e91712dcaac5adab3650a3ff9d08ef7dd8404bb48869e5d958b5b87dadc4c9a1464e9f0d0326df7ebd86bd2e310cb1bf62d384d59441f2d70a070e1c60e09489929b988681bdd9cc97170bcc4c65595f71f8e0e3301337fc24a7732467831875a47f289652b0be5e4151e6d07316c1b0c0340d8ab92023e76d66a6b2840e36d2fb7a13fee632475e6edc367ea98a90fb98b7dd6310ca0328a44761582e1bab41befabcc0ec940d28bc5e93b68e064cab84e1d9beaeb48934eac1f53b01c1b000fca496aa54b61a99fcde61662a4b4b4b23d1680be9d426173e4df3602a48ea411989a4fd590f52a8fd156b05ed9d350e3defe3cfdf4b4c7ce770ea7d3fb9f520afbe1620daeee5c26735d20b9b9cfb6811a754a439e4e5c5639a4caa1e5caf586bfc0197b78702005cb9b4cae4cd3267ce8638fe964bd72b393e39d74928d242617303a756a37f284447770dcdbffc6384a05a85de1306e9a52057c7527c7131c3c42d3f475eb2303c82d4fc3276d6811db37efeb148723082d9b08f79f97c1e5729109a9a28307cc622d2d6cdf52b2b24efe548dedb00142009862cfa879ee1a71f6cec928353511472fbf4389148b0b0e0c108081412458dfe21c9f11351e67e7358595468246d1d1e5e38a6e9e851bc39d84ab502a669331dafec0d8ec7e3e8cb06e1a881d727d1ae40180a434a8c9db129a54126ad48a7358c2b4c5352c8c374bcccdab2bb37d8719cba79fab8211f9df218e0582c261e95f8bfc04f1a1e8bc5c4dfe0a190172af6a9690000000049454e44ae426082</data>
+ </image>
+</images>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>timestepbox.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/scriptbuilder.cpp b/kstars/kstars/tools/scriptbuilder.cpp
new file mode 100644
index 00000000..51922785
--- /dev/null
+++ b/kstars/kstars/tools/scriptbuilder.cpp
@@ -0,0 +1,3200 @@
+/***************************************************************************
+ scriptbuilder.cpp - description
+ -------------------
+ begin : Thu Apr 17 2003
+ copyright : (C) 2003 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. *
+ * *
+ ***************************************************************************/
+
+//needed in slotSave() for chmod() syscall
+#include <sys/stat.h>
+
+#include <kdebug.h>
+#include <kpushbutton.h>
+#include <kcolorbutton.h>
+#include <klocale.h>
+#include <kcombobox.h>
+#include <kicontheme.h>
+#include <kiconloader.h>
+#include <kio/netaccess.h>
+#include <klistbox.h>
+#include <klistview.h>
+#include <kprocess.h>
+#include <ktextedit.h>
+#include <ktempfile.h>
+#include <kdatewidget.h>
+#include <kmessagebox.h>
+#include <kfiledialog.h>
+#include <kstdguiitem.h>
+#include <kstandarddirs.h>
+#include <kurl.h>
+#include <kurlrequester.h>
+#include <knuminput.h>
+
+#include <qcheckbox.h>
+#include <qspinbox.h>
+#include <qwidgetstack.h>
+#include <qwidget.h>
+#include <qptrlist.h>
+#include <qlayout.h>
+#include <qdatetimeedit.h>
+#include <qradiobutton.h>
+#include <qbuttongroup.h>
+
+#include "scriptfunction.h"
+#include "scriptbuilderui.h"
+#include "scriptnamedialog.h"
+#include "optionstreeview.h"
+
+#include "arglooktoward.h"
+#include "argsetradec.h"
+#include "argsetaltaz.h"
+#include "argsetlocaltime.h"
+#include "argwaitfor.h"
+#include "argwaitforkey.h"
+#include "argsettrack.h"
+#include "argchangeviewoption.h"
+#include "argsetgeolocation.h"
+#include "argtimescale.h"
+#include "argzoom.h"
+#include "argexportimage.h"
+#include "argprintimage.h"
+#include "argsetcolor.h"
+#include "argloadcolorscheme.h"
+#include "argstartindi.h"
+#include "argshutdownindi.h"
+#include "argswitchindi.h"
+#include "argsetportindi.h"
+#include "argsettargetcoordindi.h"
+#include "argsettargetnameindi.h"
+#include "argsetactionindi.h"
+#include "argsetfocusspeedindi.h"
+#include "argstartfocusindi.h"
+#include "argsetfocustimeoutindi.h"
+#include "argsetgeolocationindi.h"
+#include "argstartexposureindi.h"
+#include "argsetutcindi.h"
+#include "argsetscopeactionindi.h"
+#include "argsetframetypeindi.h"
+#include "argsetccdtempindi.h"
+#include "argsetfilternumindi.h"
+
+#include "scriptbuilder.h"
+#include "kstars.h"
+#include "kstarsdata.h"
+#include "skymap.h"
+#include "kstarsdatetime.h"
+#include "dmsbox.h"
+#include "finddialog.h"
+#include "locationdialog.h"
+#include "skyobjectname.h"
+#include "timestepbox.h"
+#include "libkdeedu/extdate/extdatewidget.h"
+
+ScriptBuilder::ScriptBuilder( QWidget *parent, const char *name )
+ : KDialogBase( KDialogBase::Plain, i18n( "Script Builder" ), Close, Close, parent, name ),
+ UnsavedChanges(false), currentFileURL(), currentDir( QDir::homeDirPath() ),
+ currentScriptName(), currentAuthor() {
+
+ QFrame *page = plainPage();
+
+ ks = (KStars*)parent;
+ QVBoxLayout *vlay = new QVBoxLayout( page, 0, 0 );
+ sb = new ScriptBuilderUI( page );
+ vlay->addWidget( sb );
+
+ KStarsFunctionList.setAutoDelete( TRUE );
+ INDIFunctionList.setAutoDelete( TRUE);
+ ScriptList.setAutoDelete( TRUE );
+
+ //Initialize function templates and descriptions
+ KStarsFunctionList.append( new ScriptFunction( "lookTowards", i18n( "Point the display at the specified location. %1 can be the name of an object, a cardinal point on the compass, or 'zenith'." ),
+ false, "QString", "dir" ) );
+ KStarsFunctionList.append( new ScriptFunction( "setRaDec", i18n( "Point the display at the specified RA/Dec coordinates. %1 is expressed in Hours; %2 is expressed in Degrees." ),
+ false, "double", "ra", "double", "dec" ) );
+ KStarsFunctionList.append( new ScriptFunction( "setAltAz", i18n( "Point the display at the specified Alt/Az coordinates. %1 and %2 are expressed in Degrees." ),
+ false, "double", "alt", "double", "az" ) );
+ KStarsFunctionList.append( new ScriptFunction( "zoomIn", i18n( "Increase the display Zoom Level." ), false ) );
+ KStarsFunctionList.append( new ScriptFunction( "zoomOut", i18n( "Decrease the display Zoom Level." ), false ) );
+ KStarsFunctionList.append( new ScriptFunction( "defaultZoom", i18n( "Set the display Zoom Level to its default value." ), false ) );
+ KStarsFunctionList.append( new ScriptFunction( "zoom", i18n( "Set the display Zoom Level manually." ), false, "double", "z" ) );
+ KStarsFunctionList.append( new ScriptFunction( "setLocalTime", i18n( "Set the system clock to the specified Local Time." ),
+ false, "int", "year", "int", "month", "int", "day", "int", "hour", "int", "minute", "int", "second" ) );
+ KStarsFunctionList.append( new ScriptFunction( "waitFor", i18n( "Pause script execution for %1 seconds." ), false, "double", "sec" ) );
+ KStarsFunctionList.append( new ScriptFunction( "waitForKey", i18n( "Halt script execution until the key %1 is pressed. Only single-key strokes are possible; use 'space' for the spacebar." ),
+ false, "QString", "key" ) );
+ KStarsFunctionList.append( new ScriptFunction( "setTracking", i18n( "Set whether the display is tracking the current location." ), false, "bool", "track" ) );
+ KStarsFunctionList.append( new ScriptFunction( "changeViewOption", i18n( "Change view option named %1 to value %2." ), false, "QString", "opName", "QString", "opValue" ) );
+ KStarsFunctionList.append( new ScriptFunction( "setGeoLocation", i18n( "Set the geographic location to the city specified by %1, %2 and %3." ),
+ false, "QString", "cityName", "QString", "provinceName", "QString", "countryName" ) );
+ KStarsFunctionList.append( new ScriptFunction( "setColor", i18n( "Set the color named %1 to the value %2." ), false, "QString", "colorName", "QString", "value" ) );
+ KStarsFunctionList.append( new ScriptFunction( "loadColorScheme", i18n( "Load the color scheme named %1." ), false, "QString", "name" ) );
+ KStarsFunctionList.append( new ScriptFunction( "exportImage", i18n( "Export the sky image to the file %1, with width %2 and height %3." ), false, "QString", "fileName", "int", "width", "int", "height" ) );
+ KStarsFunctionList.append( new ScriptFunction( "printImage", i18n( "Print the sky image to a printer or file. If %1 is true, it will show the print dialog. If %2 is true, it will use the Star Chart color scheme for printing." ), false, "bool", "usePrintDialog", "bool", "useChartColors" ) );
+ KStarsFunctionList.append( new ScriptFunction( "stop", i18n( "Halt the simulation clock." ), true ) );
+ KStarsFunctionList.append( new ScriptFunction( "start", i18n( "Start the simulation clock." ), true ) );
+ KStarsFunctionList.append( new ScriptFunction( "setClockScale", i18n( "Set the timescale of the simulation clock to %1. 1.0 means real-time; 2.0 means twice real-time; etc." ), true, "double", "scale" ) );
+
+ // INDI fuctions
+ ScriptFunction *startINDIFunc(NULL), *shutdownINDIFunc(NULL), *switchINDIFunc(NULL), *setINDIPortFunc(NULL), *setINDIScopeActionFunc(NULL), *setINDITargetCoordFunc(NULL), *setINDITargetNameFunc(NULL), *setINDIGeoLocationFunc(NULL), *setINDIUTCFunc(NULL), *setINDIActionFunc(NULL), *waitForINDIActionFunc(NULL), *setINDIFocusSpeedFunc(NULL), *startINDIFocusFunc(NULL), *setINDIFocusTimeoutFunc(NULL), *setINDICCDTempFunc(NULL), *setINDIFilterNumFunc(NULL), *setINDIFrameTypeFunc(NULL), *startINDIExposureFunc(NULL);
+
+ startINDIFunc = new ScriptFunction( "startINDI", i18n("Establish an INDI device either in local mode or server mode."), false, "QString", "deviceName", "bool", "useLocal");
+ INDIFunctionList.append ( startINDIFunc );
+
+ shutdownINDIFunc = new ScriptFunction( "shutdownINDI", i18n("Shutdown an INDI device."), false, "QString", "deviceName");
+ INDIFunctionList.append ( shutdownINDIFunc);
+
+ switchINDIFunc = new ScriptFunction( "switchINDI", i18n("Connect or Disconnect an INDI device."), false, "QString", "deviceName", "bool", "turnOn");
+ switchINDIFunc->setINDIProperty("CONNECTION");
+ INDIFunctionList.append ( switchINDIFunc);
+
+ setINDIPortFunc = new ScriptFunction( "setINDIPort", i18n("Set INDI's device connection port."), false, "QString", "deviceName", "QString", "port");
+ setINDIPortFunc->setINDIProperty("DEVICE_PORT");
+ INDIFunctionList.append ( setINDIPortFunc);
+
+ setINDIScopeActionFunc = new ScriptFunction( "setINDIScopeAction", i18n("Set the telescope action. Available actions are SLEW, TRACK, SYNC, PARK, and ABORT."), false, "QString", "deviceName", "QString", "action");
+ setINDIScopeActionFunc->setINDIProperty("CHECK");
+ INDIFunctionList.append( setINDIScopeActionFunc);
+
+ setINDITargetCoordFunc = new ScriptFunction ( "setINDITargetCoord", i18n( "Set the telescope target coordinates to the RA/Dec coordinates. RA is expressed in Hours; DEC is expressed in Degrees." ), false, "QString", "deviceName", "double", "RA", "double", "DEC" );
+ setINDITargetCoordFunc->setINDIProperty("EQUATORIAL_EOD_COORD");
+ INDIFunctionList.append ( setINDITargetCoordFunc );
+
+ setINDITargetNameFunc = new ScriptFunction( "setINDITargetName", i18n("Set the telescope target coorinates to the RA/Dec coordinates of the selected object."), false, "QString", "deviceName", "QString", "objectName");
+ setINDITargetNameFunc->setINDIProperty("EQUATORIAL_EOD_COORD");
+ INDIFunctionList.append( setINDITargetNameFunc);
+
+ setINDIGeoLocationFunc = new ScriptFunction ( "setINDIGeoLocation", i18n("Set the telescope longitude and latitude. The longitude is E of N."), false, "QString", "deviceName", "double", "long", "double", "lat");
+ setINDIGeoLocationFunc->setINDIProperty("GEOGRAPHIC_COORD");
+ INDIFunctionList.append( setINDIGeoLocationFunc);
+
+ setINDIUTCFunc = new ScriptFunction ( "setINDIUTC", i18n("Set the device UTC time in ISO 8601 format YYYY/MM/DDTHH:MM:SS."), false, "QString", "deviceName", "QString", "UTCDateTime");
+ setINDIUTCFunc->setINDIProperty("TIME");
+ INDIFunctionList.append( setINDIUTCFunc);
+
+ setINDIActionFunc = new ScriptFunction( "setINDIAction", i18n("Activate an INDI action. The action is the name of any INDI switch property element supported by the device."), false, "QString", "deviceName", "QString", "actionName");
+ INDIFunctionList.append( setINDIActionFunc);
+
+ waitForINDIActionFunc = new ScriptFunction ("waitForINDIAction", i18n("Pause script execution until action returns with OK status. The action can be the name of any INDI property supported by the device."), false, "QString", "deviceName", "QString", "actionName");
+ INDIFunctionList.append( waitForINDIActionFunc );
+
+ setINDIFocusSpeedFunc = new ScriptFunction ("setINDIFocusSpeed", i18n("Set the telescope focuser speed. Set speed to 0 to halt the focuser. 1-3 correspond to slow, medium, and fast speeds respectively."), false, "QString", "deviceName", "unsigned int", "speed");
+ setINDIFocusSpeedFunc->setINDIProperty("FOCUS_SPEED");
+ INDIFunctionList.append( setINDIFocusSpeedFunc );
+
+ startINDIFocusFunc = new ScriptFunction ("startINDIFocus", i18n("Start moving the focuser in the direction Dir, and for the duration specified by setINDIFocusTimeout."), false, "QString", "deviceName", "QString", "Dir");
+ startINDIFocusFunc->setINDIProperty("FOCUS_MOTION");
+ INDIFunctionList.append( startINDIFocusFunc);
+
+ setINDIFocusTimeoutFunc = new ScriptFunction ( "setINDIFocusTimeout", i18n("Set the telescope focuser timer in seconds. This is the duration of any focusing procedure performed by calling startINDIFocus."), false, "QString", "deviceName", "int", "timeout");
+ setINDIFocusTimeoutFunc->setINDIProperty("FOCUS_TIMER");
+ INDIFunctionList.append( setINDIFocusTimeoutFunc);
+
+ setINDICCDTempFunc = new ScriptFunction( "setINDICCDTemp", i18n("Set the target CCD chip temperature."), false, "QString", "deviceName", "int", "temp");
+ setINDICCDTempFunc->setINDIProperty("CCD_TEMPERATURE");
+ INDIFunctionList.append( setINDICCDTempFunc);
+
+ setINDIFilterNumFunc = new ScriptFunction( "setINDIFilterNum", i18n("Set the target filter position."), false, "QString", "deviceName", "int", "filter_num");
+ setINDIFilterNumFunc->setINDIProperty("FILTER_SLOT");
+ INDIFunctionList.append ( setINDIFilterNumFunc);
+
+ setINDIFrameTypeFunc = new ScriptFunction( "setINDIFrameType", i18n("Set the CCD camera frame type. Available options are FRAME_LIGHT, FRAME_BIAS, FRAME_DARK, and FRAME_FLAT."), false, "QString", "deviceName", "QString", "type");
+ setINDIFrameTypeFunc->setINDIProperty("FRAME_TYPE");
+ INDIFunctionList.append( setINDIFrameTypeFunc);
+
+ startINDIExposureFunc = new ScriptFunction ( "startINDIExposure", i18n("Start Camera/CCD exposure. The duration is in seconds."), false, "QString", "deviceName", "int", "timeout");
+ startINDIExposureFunc->setINDIProperty("CCD_EXPOSE_DURATION");
+ INDIFunctionList.append( startINDIExposureFunc);
+
+
+ // Modified by JM
+ // We're using KListView instead of listbox to arrange the functions in two
+ // main categories: KStars and INDI. INDI is further subdivided.
+
+ sb->FunctionListView->addColumn(i18n("Functions"));
+ sb->FunctionListView->setSorting(-1);
+
+ QListViewItem *INDI_tree = new QListViewItem( sb->FunctionListView, "INDI");
+ QListViewItem *INDI_filter = new QListViewItem( INDI_tree, "Filter");
+ QListViewItem *INDI_focuser = new QListViewItem( INDI_tree, "Focuser");
+ QListViewItem *INDI_ccd = new QListViewItem( INDI_tree, "Camera/CCD");
+ QListViewItem *INDI_telescope = new QListViewItem( INDI_tree, "Telescope");
+ QListViewItem *INDI_general = new QListViewItem( INDI_tree, "General");
+
+ QListViewItem *kstars_tree = new QListViewItem( sb->FunctionListView, "KStars");
+
+
+ for ( ScriptFunction *sf = KStarsFunctionList.last(); sf; sf = KStarsFunctionList.prev() )
+ new QListViewItem (kstars_tree, sf->prototype());
+
+ // General
+ new QListViewItem(INDI_general, waitForINDIActionFunc->prototype());
+ new QListViewItem(INDI_general, setINDIActionFunc->prototype());
+ new QListViewItem(INDI_general, setINDIPortFunc->prototype());
+ new QListViewItem(INDI_general, switchINDIFunc->prototype());
+ new QListViewItem(INDI_general, shutdownINDIFunc->prototype());
+ new QListViewItem(INDI_general, startINDIFunc->prototype());
+
+ // Telescope
+ new QListViewItem(INDI_telescope, setINDIUTCFunc->prototype());
+ new QListViewItem(INDI_telescope, setINDIGeoLocationFunc->prototype());
+ new QListViewItem(INDI_telescope, setINDITargetNameFunc->prototype());
+ new QListViewItem(INDI_telescope, setINDITargetCoordFunc->prototype());
+ new QListViewItem(INDI_telescope, setINDIScopeActionFunc->prototype());
+
+ // CCD
+ new QListViewItem(INDI_ccd, startINDIExposureFunc->prototype());
+ new QListViewItem(INDI_ccd, setINDIFrameTypeFunc->prototype());
+ new QListViewItem(INDI_ccd, setINDICCDTempFunc->prototype());
+
+ // Focuser
+ new QListViewItem(INDI_focuser, startINDIFocusFunc->prototype());
+ new QListViewItem(INDI_focuser, setINDIFocusTimeoutFunc->prototype());
+ new QListViewItem(INDI_focuser, setINDIFocusSpeedFunc->prototype());
+
+ // Filter
+ new QListViewItem(INDI_filter, setINDIFilterNumFunc->prototype());
+
+ //Add icons to Push Buttons
+ KIconLoader *icons = KGlobal::iconLoader();
+ sb->NewButton->setIconSet( icons->loadIcon( "filenew", KIcon::Toolbar ) );
+ sb->OpenButton->setIconSet( icons->loadIcon( "fileopen", KIcon::Toolbar ) );
+ sb->SaveButton->setIconSet( icons->loadIconSet( "filesave", KIcon::Toolbar ) );
+ sb->SaveAsButton->setIconSet( icons->loadIconSet( "filesaveas", KIcon::Toolbar ) );
+ sb->RunButton->setIconSet( icons->loadIconSet( "launch", KIcon::Toolbar ) );
+ sb->CopyButton->setIconSet( icons->loadIconSet( "reload", KIcon::Toolbar ) );
+ sb->AddButton->setIconSet( icons->loadIconSet( "back", KIcon::Toolbar ) );
+ sb->RemoveButton->setIconSet( icons->loadIconSet( "forward", KIcon::Toolbar ) );
+ sb->UpButton->setIconSet( icons->loadIconSet( "up", KIcon::Toolbar ) );
+ sb->DownButton->setIconSet( icons->loadIconSet( "down", KIcon::Toolbar ) );
+
+ //Prepare the widget stack
+ argBlank = new QWidget( sb->ArgStack );
+ argLookToward = new ArgLookToward( sb->ArgStack );
+ argSetRaDec = new ArgSetRaDec( sb->ArgStack );
+ argSetAltAz = new ArgSetAltAz( sb->ArgStack );
+ argSetLocalTime = new ArgSetLocalTime( sb->ArgStack );
+ argWaitFor = new ArgWaitFor( sb->ArgStack );
+ argWaitForKey = new ArgWaitForKey( sb->ArgStack );
+ argSetTracking = new ArgSetTrack( sb->ArgStack );
+ argChangeViewOption = new ArgChangeViewOption( sb->ArgStack );
+ argSetGeoLocation = new ArgSetGeoLocation( sb->ArgStack );
+ argTimeScale = new ArgTimeScale( sb->ArgStack );
+ argZoom = new ArgZoom( sb->ArgStack );
+ argExportImage = new ArgExportImage( sb->ArgStack );
+ argPrintImage = new ArgPrintImage( sb->ArgStack );
+ argSetColor = new ArgSetColor( sb->ArgStack );
+ argLoadColorScheme = new ArgLoadColorScheme( sb->ArgStack );
+ argStartINDI = new ArgStartINDI (sb->ArgStack);
+ argShutdownINDI = new ArgShutdownINDI (sb->ArgStack);
+ argSwitchINDI = new ArgSwitchINDI (sb->ArgStack);
+ argSetPortINDI = new ArgSetPortINDI (sb->ArgStack);
+ argSetTargetCoordINDI = new ArgSetTargetCoordINDI (sb->ArgStack);
+ argSetTargetNameINDI = new ArgSetTargetNameINDI (sb->ArgStack);
+ argSetActionINDI = new ArgSetActionINDI (sb->ArgStack);
+ argWaitForActionINDI = new ArgSetActionINDI (sb->ArgStack);
+ argSetFocusSpeedINDI = new ArgSetFocusSpeedINDI (sb->ArgStack);
+ argStartFocusINDI = new ArgStartFocusINDI(sb->ArgStack);
+ argSetFocusTimeoutINDI = new ArgSetFocusTimeoutINDI( sb->ArgStack);
+ argSetGeoLocationINDI = new ArgSetGeoLocationINDI( sb->ArgStack);
+ argStartExposureINDI = new ArgStartExposureINDI( sb->ArgStack);
+ argSetUTCINDI = new ArgSetUTCINDI( sb->ArgStack);
+ argSetScopeActionINDI = new ArgSetScopeActionINDI( sb->ArgStack);
+ argSetFrameTypeINDI = new ArgSetFrameTypeINDI (sb->ArgStack);
+ argSetCCDTempINDI = new ArgSetCCDTempINDI(sb->ArgStack);
+ argSetFilterNumINDI = new ArgSetFilterNumINDI(sb->ArgStack);
+
+ argStartFocusINDI->directionCombo->insertItem("IN");
+ argStartFocusINDI->directionCombo->insertItem("OUT");
+
+ argSetScopeActionINDI->actionCombo->insertItem("SLEW");
+ argSetScopeActionINDI->actionCombo->insertItem("TRACK");
+ argSetScopeActionINDI->actionCombo->insertItem("SYNC");
+ argSetScopeActionINDI->actionCombo->insertItem("PARK");
+ argSetScopeActionINDI->actionCombo->insertItem("ABORT");
+
+ argSetFrameTypeINDI->typeCombo->insertItem("FRAME_LIGHT");
+ argSetFrameTypeINDI->typeCombo->insertItem("FRAME_BIAS");
+ argSetFrameTypeINDI->typeCombo->insertItem("FRAME_DARK");
+ argSetFrameTypeINDI->typeCombo->insertItem("FRAME_FLAT");
+
+ sb->ArgStack->addWidget( argBlank );
+ sb->ArgStack->addWidget( argLookToward );
+ sb->ArgStack->addWidget( argSetRaDec );
+ sb->ArgStack->addWidget( argSetAltAz );
+ sb->ArgStack->addWidget( argSetLocalTime );
+ sb->ArgStack->addWidget( argWaitFor );
+ sb->ArgStack->addWidget( argWaitForKey );
+ sb->ArgStack->addWidget( argSetTracking );
+ sb->ArgStack->addWidget( argChangeViewOption );
+ sb->ArgStack->addWidget( argSetGeoLocation );
+ sb->ArgStack->addWidget( argTimeScale );
+ sb->ArgStack->addWidget( argZoom );
+ sb->ArgStack->addWidget( argExportImage );
+ sb->ArgStack->addWidget( argPrintImage );
+ sb->ArgStack->addWidget( argSetColor );
+ sb->ArgStack->addWidget( argLoadColorScheme );
+
+ sb->ArgStack->addWidget( argStartINDI);
+ sb->ArgStack->addWidget( argShutdownINDI);
+ sb->ArgStack->addWidget( argSwitchINDI);
+ sb->ArgStack->addWidget( argSetPortINDI);
+ sb->ArgStack->addWidget( argSetTargetCoordINDI);
+ sb->ArgStack->addWidget( argSetTargetNameINDI);
+ sb->ArgStack->addWidget( argSetActionINDI);
+ sb->ArgStack->addWidget( argWaitForActionINDI );
+ sb->ArgStack->addWidget( argSetFocusSpeedINDI );
+ sb->ArgStack->addWidget( argStartFocusINDI);
+ sb->ArgStack->addWidget( argSetFocusTimeoutINDI);
+ sb->ArgStack->addWidget( argSetGeoLocationINDI);
+ sb->ArgStack->addWidget( argStartExposureINDI);
+ sb->ArgStack->addWidget( argSetUTCINDI);
+ sb->ArgStack->addWidget( argSetScopeActionINDI);
+ sb->ArgStack->addWidget( argSetFrameTypeINDI);
+ sb->ArgStack->addWidget( argSetCCDTempINDI);
+ sb->ArgStack->addWidget( argSetFilterNumINDI);
+
+ sb->ArgStack->raiseWidget( 0 );
+
+ snd = new ScriptNameDialog( ks );
+ otv = new OptionsTreeView( ks );
+
+ initViewOptions();
+
+ //connect widgets in ScriptBuilderUI
+ connect( sb->FunctionListView, SIGNAL( doubleClicked(QListViewItem *, const QPoint &, int )), this, SLOT( slotAddFunction() ) );
+ connect( sb->FunctionListView, SIGNAL( currentChanged(QListViewItem*) ), this, SLOT( slotShowDoc() ) );
+ connect( sb->UpButton, SIGNAL( clicked() ), this, SLOT( slotMoveFunctionUp() ) );
+ connect( sb->ScriptListBox, SIGNAL( currentChanged(QListBoxItem*) ), this, SLOT( slotArgWidget() ) );
+ connect( sb->DownButton, SIGNAL( clicked() ), this, SLOT( slotMoveFunctionDown() ) );
+ connect( sb->CopyButton, SIGNAL( clicked() ), this, SLOT( slotCopyFunction() ) );
+ connect( sb->RemoveButton, SIGNAL( clicked() ), this, SLOT( slotRemoveFunction() ) );
+ connect( sb->NewButton, SIGNAL( clicked() ), this, SLOT( slotNew() ) );
+ connect( sb->OpenButton, SIGNAL( clicked() ), this, SLOT( slotOpen() ) );
+ connect( sb->SaveButton, SIGNAL( clicked() ), this, SLOT( slotSave() ) );
+ connect( sb->SaveAsButton, SIGNAL( clicked() ), this, SLOT( slotSaveAs() ) );
+ connect( sb->AddButton, SIGNAL( clicked() ), this, SLOT( slotAddFunction() ) );
+ connect( sb->RunButton, SIGNAL( clicked() ), this, SLOT( slotRunScript() ) );
+
+ //Connections for Arg Widgets
+ connect( argSetGeoLocation->FindCityButton, SIGNAL( clicked() ), this, SLOT( slotFindCity() ) );
+ connect( argLookToward->FindButton, SIGNAL( clicked() ), this, SLOT( slotFindObject() ) );
+ connect( argChangeViewOption->TreeButton, SIGNAL( clicked() ), this, SLOT( slotShowOptions() ) );
+
+ connect( argLookToward->FocusEdit, SIGNAL( textChanged(const QString &) ), this, SLOT( slotLookToward() ) );
+ connect( argSetRaDec->RaBox, SIGNAL( textChanged(const QString &) ), this, SLOT( slotRa() ) );
+ connect( argSetRaDec->DecBox, SIGNAL( textChanged(const QString &) ), this, SLOT( slotDec() ) );
+ connect( argSetAltAz->AltBox, SIGNAL( textChanged(const QString &) ), this, SLOT( slotAlt() ) );
+ connect( argSetAltAz->AzBox, SIGNAL( textChanged(const QString &) ), this, SLOT( slotAz() ) );
+ connect( argSetLocalTime->DateBox, SIGNAL( changed(ExtDate) ), this, SLOT( slotChangeDate() ) );
+ connect( argSetLocalTime->TimeBox, SIGNAL( valueChanged(const QTime&) ), this, SLOT( slotChangeTime() ) );
+ connect( argWaitFor->DelayBox, SIGNAL( valueChanged(int) ), this, SLOT( slotWaitFor() ) );
+ connect( argWaitForKey->WaitKeyEdit, SIGNAL( textChanged(const QString &) ), this, SLOT( slotWaitForKey() ) );
+ connect( argSetTracking->CheckTrack, SIGNAL( stateChanged(int) ), this, SLOT( slotTracking() ) );
+ connect( argChangeViewOption->OptionName, SIGNAL( activated(const QString &) ), this, SLOT( slotViewOption() ) );
+ connect( argChangeViewOption->OptionValue, SIGNAL( textChanged(const QString &) ), this, SLOT( slotViewOption() ) );
+ connect( argSetGeoLocation->CityName, SIGNAL( textChanged(const QString &) ), this, SLOT( slotChangeCity() ) );
+ connect( argSetGeoLocation->ProvinceName, SIGNAL( textChanged(const QString &) ), this, SLOT( slotChangeProvince() ) );
+ connect( argSetGeoLocation->CountryName, SIGNAL( textChanged(const QString &) ), this, SLOT( slotChangeCountry() ) );
+ connect( argTimeScale->TimeScale, SIGNAL( scaleChanged(float) ), this, SLOT( slotTimeScale() ) );
+ connect( argZoom->ZoomBox, SIGNAL( textChanged(const QString &) ), this, SLOT( slotZoom() ) );
+ connect( argExportImage->ExportFileName, SIGNAL( textChanged(const QString &) ), this, SLOT( slotExportImage() ) );
+ connect( argExportImage->ExportWidth, SIGNAL( valueChanged(int) ), this, SLOT( slotExportImage() ) );
+ connect( argExportImage->ExportHeight, SIGNAL( valueChanged(int) ), this, SLOT( slotExportImage() ) );
+ connect( argPrintImage->UsePrintDialog, SIGNAL( toggled(bool) ), this, SLOT( slotPrintImage() ) );
+ connect( argPrintImage->UseChartColors, SIGNAL( toggled(bool) ), this, SLOT( slotPrintImage() ) );
+ connect( argSetColor->ColorName, SIGNAL( activated(const QString &) ), this, SLOT( slotChangeColorName() ) );
+ connect( argSetColor->ColorValue, SIGNAL( changed(const QColor &) ), this, SLOT( slotChangeColor() ) );
+ connect( argLoadColorScheme->SchemeList, SIGNAL( clicked( QListBoxItem* ) ), this, SLOT( slotLoadColorScheme( QListBoxItem* ) ) );
+ connect( snd->ScriptName, SIGNAL( textChanged(const QString &) ), this, SLOT( slotEnableScriptNameOK() ) );
+
+ connect( sb->AppendINDIWait, SIGNAL ( toggled(bool) ), this, SLOT(slotINDIWaitCheck(bool)));
+
+ // Connections for INDI's Arg widgets
+
+ // INDI Start Device
+ connect (argStartINDI->deviceName, SIGNAL( textChanged(const QString &) ), this, SLOT(slotINDIStartDeviceName()));
+ connect (argStartINDI->INDIMode, SIGNAL ( clicked( int)), this, SLOT (slotINDIStartDeviceMode()));
+
+ // INDI Shutdown Device
+ connect (argShutdownINDI->deviceName, SIGNAL( textChanged(const QString &) ), this, SLOT(slotINDIShutdown()));
+
+ // INDI Swtich Device
+ connect (argSwitchINDI->deviceName, SIGNAL( textChanged(const QString &) ), this, SLOT(slotINDISwitchDeviceName()));
+ connect (argSwitchINDI->INDIConnection, SIGNAL ( clicked( int)), this, SLOT (slotINDISwitchDeviceConnection()));
+
+ // INDI Set Device Port
+ connect (argSetPortINDI->deviceName, SIGNAL( textChanged(const QString &) ), this, SLOT(slotINDISetPortDeviceName()));
+ connect (argSetPortINDI->devicePort, SIGNAL( textChanged(const QString &) ), this, SLOT(slotINDISetPortDevicePort()));
+
+ // INDI Set Target Coord
+ connect (argSetTargetCoordINDI->deviceName, SIGNAL( textChanged(const QString &) ), this, SLOT(slotINDISetTargetCoordDeviceName()));
+ connect( argSetTargetCoordINDI->RaBox, SIGNAL( textChanged(const QString &) ), this, SLOT( slotINDISetTargetCoordDeviceRA() ) );
+ connect( argSetTargetCoordINDI->DecBox, SIGNAL( textChanged(const QString &) ), this, SLOT( slotINDISetTargetCoordDeviceDEC() ) );
+
+ // INDI Set Target Name
+ connect( argSetTargetNameINDI->FindButton, SIGNAL( clicked() ), this, SLOT( slotINDIFindObject() ) );
+ connect (argSetTargetNameINDI->deviceName, SIGNAL( textChanged(const QString &) ), this, SLOT(slotINDISetTargetNameDeviceName()));
+ connect (argSetTargetNameINDI->objectName, SIGNAL( textChanged(const QString &) ), this, SLOT(slotINDISetTargetNameObjectName()));
+
+ // INDI Set Action
+ connect (argSetActionINDI->deviceName, SIGNAL( textChanged(const QString &) ), this, SLOT(slotINDISetActionDeviceName()));
+ connect (argSetActionINDI->actionName, SIGNAL( textChanged(const QString &) ), this, SLOT(slotINDISetActionName()));
+
+ // INDI Wait For Action
+ connect (argWaitForActionINDI->deviceName, SIGNAL( textChanged(const QString &) ), this, SLOT(slotINDIWaitForActionDeviceName()));
+ connect (argWaitForActionINDI->actionName, SIGNAL( textChanged(const QString &) ), this, SLOT(slotINDIWaitForActionName()));
+
+ // INDI Set Focus Speed
+ connect (argSetFocusSpeedINDI->deviceName, SIGNAL( textChanged(const QString &) ), this, SLOT(slotINDISetFocusSpeedDeviceName()));
+ connect (argSetFocusSpeedINDI->speedIN, SIGNAL( valueChanged(int) ), this, SLOT(slotINDISetFocusSpeed()));
+
+ // INDI Start Focus
+ connect (argStartFocusINDI->deviceName, SIGNAL( textChanged(const QString &) ), this, SLOT(slotINDIStartFocusDeviceName()));
+ connect (argStartFocusINDI->directionCombo, SIGNAL( activated(const QString &) ), this, SLOT(slotINDIStartFocusDirection()));
+
+ // INDI Set Focus Timeout
+ connect (argSetFocusTimeoutINDI->deviceName, SIGNAL( textChanged(const QString &) ), this, SLOT(slotINDISetFocusTimeoutDeviceName()));
+ connect (argSetFocusTimeoutINDI->timeOut, SIGNAL( valueChanged(int) ), this, SLOT(slotINDISetFocusTimeout()));
+
+ // INDI Set Geo Location
+ connect (argSetGeoLocationINDI->deviceName, SIGNAL( textChanged(const QString &) ), this, SLOT(slotINDISetGeoLocationDeviceName()));
+ connect( argSetGeoLocationINDI->longBox, SIGNAL( textChanged(const QString &) ), this, SLOT( slotINDISetGeoLocationDeviceLong() ) );
+ connect( argSetGeoLocationINDI->latBox, SIGNAL( textChanged(const QString &) ), this, SLOT( slotINDISetGeoLocationDeviceLat() ) );
+
+ // INDI Start Exposure
+ connect (argStartExposureINDI->deviceName, SIGNAL( textChanged(const QString &) ), this, SLOT(slotINDIStartExposureDeviceName()));
+ connect (argStartExposureINDI->timeOut, SIGNAL( valueChanged(int) ), this, SLOT(slotINDIStartExposureTimeout()));
+
+ // INDI Set UTC
+ connect (argSetUTCINDI->deviceName, SIGNAL( textChanged(const QString &) ), this, SLOT(slotINDISetUTCDeviceName()));
+ connect (argSetUTCINDI->UTC, SIGNAL( textChanged(const QString &) ), this, SLOT(slotINDISetUTC()));
+
+ // INDI Set Scope Action
+ connect (argSetScopeActionINDI->deviceName, SIGNAL( textChanged(const QString &) ), this, SLOT(slotINDISetScopeActionDeviceName()));
+ connect (argSetScopeActionINDI->actionCombo, SIGNAL( activated(const QString &) ), this, SLOT(slotINDISetScopeAction()));
+
+ // INDI Set Frame type
+ connect (argSetFrameTypeINDI->deviceName, SIGNAL( textChanged(const QString &) ), this, SLOT(slotINDISetFrameTypeDeviceName()));
+ connect (argSetFrameTypeINDI->typeCombo, SIGNAL( activated(const QString &) ), this, SLOT(slotINDISetFrameType()));
+
+ // INDI Set CCD Temp
+ connect (argSetCCDTempINDI->deviceName, SIGNAL( textChanged(const QString &) ), this, SLOT(slotINDISetCCDTempDeviceName()));
+ connect (argSetCCDTempINDI->temp, SIGNAL( valueChanged(int) ), this, SLOT(slotINDISetCCDTemp()));
+
+ // INDI Set Filter Num
+ connect (argSetFilterNumINDI->deviceName, SIGNAL( textChanged(const QString &) ), this, SLOT(slotINDISetFilterNumDeviceName()));
+ connect (argSetFilterNumINDI->filter_num, SIGNAL( valueChanged(int) ), this, SLOT(slotINDISetFilterNum()));
+
+
+ //disbale some buttons
+ sb->CopyButton->setEnabled( false );
+ sb->AddButton->setEnabled( false );
+ sb->RemoveButton->setEnabled( false );
+ sb->UpButton->setEnabled( false );
+ sb->DownButton->setEnabled( false );
+ sb->SaveButton->setEnabled( false );
+ sb->SaveAsButton->setEnabled( false );
+ sb->RunButton->setEnabled( false );
+}
+
+ScriptBuilder::~ScriptBuilder()
+{
+}
+
+void ScriptBuilder::initViewOptions() {
+ otv->OptionsList->setRootIsDecorated( true );
+
+ //InfoBoxes
+ opsGUI = new QListViewItem( otv->OptionsList, i18n( "InfoBoxes" ) );
+ new QListViewItem( opsGUI, "ShowInfoBoxes", i18n( "Toggle display of all InfoBoxes" ), i18n( "bool" ) );
+ new QListViewItem( opsGUI, "ShowTimeBox", i18n( "Toggle display of Time InfoBox" ), i18n( "bool" ) );
+ new QListViewItem( opsGUI, "ShowGeoBox", i18n( "Toggle display of Geographic InfoBox" ), i18n( "bool" ) );
+ new QListViewItem( opsGUI, "ShowFocusBox", i18n( "Toggle display of Focus InfoBox" ), i18n( "bool" ) );
+ new QListViewItem( opsGUI, "ShadeTimeBox", i18n( "(un)Shade Time InfoBox" ), i18n( "bool" ) );
+ new QListViewItem( opsGUI, "ShadeGeoBox", i18n( "(un)Shade Geographic InfoBox" ), i18n( "bool" ) );
+ new QListViewItem( opsGUI, "ShadeFocusBox", i18n( "(un)Shade Focus InfoBox" ), i18n( "bool" ) );
+ argChangeViewOption->OptionName->insertItem( "ShowInfoBoxes" );
+ argChangeViewOption->OptionName->insertItem( "ShowTimeBox" );
+ argChangeViewOption->OptionName->insertItem( "ShowGeoBox" );
+ argChangeViewOption->OptionName->insertItem( "ShowFocusBox" );
+ argChangeViewOption->OptionName->insertItem( "ShadeTimeBox" );
+ argChangeViewOption->OptionName->insertItem( "ShadeGeoBox" );
+ argChangeViewOption->OptionName->insertItem( "ShadeFocusBox" );
+
+ //Toolbars
+ opsToolbar = new QListViewItem( otv->OptionsList, i18n( "Toolbars" ) );
+ new QListViewItem( opsToolbar, "ShowMainToolBar", i18n( "Toggle display of main toolbar" ), i18n( "bool" ) );
+ new QListViewItem( opsToolbar, "ShowViewToolBar", i18n( "Toggle display of view toolbar" ), i18n( "bool" ) );
+ argChangeViewOption->OptionName->insertItem( "ShowMainToolBar" );
+ argChangeViewOption->OptionName->insertItem( "ShowViewToolBar" );
+
+ //Show Objects
+ opsShowObj = new QListViewItem( otv->OptionsList, i18n( "Show Objects" ) );
+ new QListViewItem( opsShowObj, "ShowStars", i18n( "Toggle display of Stars" ), i18n( "bool" ) );
+ new QListViewItem( opsShowObj, "ShowDeepSky", i18n( "Toggle display of all deep-sky objects" ), i18n( "bool" ) );
+ new QListViewItem( opsShowObj, "ShowMessier", i18n( "Toggle display of Messier object symbols" ), i18n( "bool" ) );
+ new QListViewItem( opsShowObj, "ShowMessierImages", i18n( "Toggle display of Messier object images" ), i18n( "bool" ) );
+ new QListViewItem( opsShowObj, "ShowNGC", i18n( "Toggle display of NGC objects" ), i18n( "bool" ) );
+ new QListViewItem( opsShowObj, "ShowIC", i18n( "Toggle display of IC objects" ), i18n( "bool" ) );
+ new QListViewItem( opsShowObj, "ShowPlanets", i18n( "Toggle display of all solar system bodies" ), i18n( "bool" ) );
+ new QListViewItem( opsShowObj, "ShowSun", i18n( "Toggle display of Sun" ), i18n( "bool" ) );
+ new QListViewItem( opsShowObj, "ShowMoon", i18n( "Toggle display of Moon" ), i18n( "bool" ) );
+ new QListViewItem( opsShowObj, "ShowMercury", i18n( "Toggle display of Mercury" ), i18n( "bool" ) );
+ new QListViewItem( opsShowObj, "ShowVenus", i18n( "Toggle display of Venus" ), i18n( "bool" ) );
+ new QListViewItem( opsShowObj, "ShowMars", i18n( "Toggle display of Mars" ), i18n( "bool" ) );
+ new QListViewItem( opsShowObj, "ShowJupiter", i18n( "Toggle display of Jupiter" ), i18n( "bool" ) );
+ new QListViewItem( opsShowObj, "ShowSaturn", i18n( "Toggle display of Saturn" ), i18n( "bool" ) );
+ new QListViewItem( opsShowObj, "ShowUranus", i18n( "Toggle display of Uranus" ), i18n( "bool" ) );
+ new QListViewItem( opsShowObj, "ShowNeptune", i18n( "Toggle display of Neptune" ), i18n( "bool" ) );
+ new QListViewItem( opsShowObj, "ShowPluto", i18n( "Toggle display of Pluto" ), i18n( "bool" ) );
+ new QListViewItem( opsShowObj, "ShowAsteroids", i18n( "Toggle display of Asteroids" ), i18n( "bool" ) );
+ new QListViewItem( opsShowObj, "ShowComets", i18n( "Toggle display of Comets" ), i18n( "bool" ) );
+ argChangeViewOption->OptionName->insertItem( "ShowSAO" );
+ argChangeViewOption->OptionName->insertItem( "ShowDeepSky" );
+ argChangeViewOption->OptionName->insertItem( "ShowMess" );
+ argChangeViewOption->OptionName->insertItem( "ShowMessImages" );
+ argChangeViewOption->OptionName->insertItem( "ShowNGC" );
+ argChangeViewOption->OptionName->insertItem( "ShowIC" );
+ argChangeViewOption->OptionName->insertItem( "ShowPlanets" );
+ argChangeViewOption->OptionName->insertItem( "ShowSun" );
+ argChangeViewOption->OptionName->insertItem( "ShowMoon" );
+ argChangeViewOption->OptionName->insertItem( "ShowMercury" );
+ argChangeViewOption->OptionName->insertItem( "ShowVenus" );
+ argChangeViewOption->OptionName->insertItem( "ShowMars" );
+ argChangeViewOption->OptionName->insertItem( "ShowJupiter" );
+ argChangeViewOption->OptionName->insertItem( "ShowSaturn" );
+ argChangeViewOption->OptionName->insertItem( "ShowUranus" );
+ argChangeViewOption->OptionName->insertItem( "ShowNeptune" );
+ argChangeViewOption->OptionName->insertItem( "ShowPluto" );
+ argChangeViewOption->OptionName->insertItem( "ShowAsteroids" );
+ argChangeViewOption->OptionName->insertItem( "ShowComets" );
+
+ opsShowOther = new QListViewItem( otv->OptionsList, i18n( "Show Other" ) );
+ new QListViewItem( opsShowOther, "ShowCLines", i18n( "Toggle display of constellation lines" ), i18n( "bool" ) );
+ new QListViewItem( opsShowOther, "ShowCBounds", i18n( "Toggle display of constellation boundaries" ), i18n( "bool" ) );
+ new QListViewItem( opsShowOther, "ShowCNames", i18n( "Toggle display of constellation names" ), i18n( "bool" ) );
+ new QListViewItem( opsShowOther, "ShowMilkyWay", i18n( "Toggle display of Milky Way" ), i18n( "bool" ) );
+ new QListViewItem( opsShowOther, "ShowGrid", i18n( "Toggle display of the coordinate grid" ), i18n( "bool" ) );
+ new QListViewItem( opsShowOther, "ShowEquator", i18n( "Toggle display of the celestial equator" ), i18n( "bool" ) );
+ new QListViewItem( opsShowOther, "ShowEcliptic", i18n( "Toggle display of the ecliptic" ), i18n( "bool" ) );
+ new QListViewItem( opsShowOther, "ShowHorizon", i18n( "Toggle display of the horizon line" ), i18n( "bool" ) );
+ new QListViewItem( opsShowOther, "ShowGround", i18n( "Toggle display of the opaque ground" ), i18n( "bool" ) );
+ new QListViewItem( opsShowOther, "ShowStarNames", i18n( "Toggle display of star name labels" ), i18n( "bool" ) );
+ new QListViewItem( opsShowOther, "ShowStarMagnitudes", i18n( "Toggle display of star magnitude labels" ), i18n( "bool" ) );
+ new QListViewItem( opsShowOther, "ShowAsteroidNames", i18n( "Toggle display of asteroid name labels" ), i18n( "bool" ) );
+ new QListViewItem( opsShowOther, "ShowCometNames", i18n( "Toggle display of comet name labels" ), i18n( "bool" ) );
+ new QListViewItem( opsShowOther, "ShowPlanetNames", i18n( "Toggle display of planet name labels" ), i18n( "bool" ) );
+ new QListViewItem( opsShowOther, "ShowPlanetImages", i18n( "Toggle display of planet images" ), i18n( "bool" ) );
+ argChangeViewOption->OptionName->insertItem( "ShowCLines" );
+ argChangeViewOption->OptionName->insertItem( "ShowCBounds" );
+ argChangeViewOption->OptionName->insertItem( "ShowCNames" );
+ argChangeViewOption->OptionName->insertItem( "ShowMilkyWay" );
+ argChangeViewOption->OptionName->insertItem( "ShowGrid" );
+ argChangeViewOption->OptionName->insertItem( "ShowEquator" );
+ argChangeViewOption->OptionName->insertItem( "ShowEcliptic" );
+ argChangeViewOption->OptionName->insertItem( "ShowHorizon" );
+ argChangeViewOption->OptionName->insertItem( "ShowGround" );
+ argChangeViewOption->OptionName->insertItem( "ShowStarNames" );
+ argChangeViewOption->OptionName->insertItem( "ShowStarMagnitudes" );
+ argChangeViewOption->OptionName->insertItem( "ShowAsteroidNames" );
+ argChangeViewOption->OptionName->insertItem( "ShowCometNames" );
+ argChangeViewOption->OptionName->insertItem( "ShowPlanetNames" );
+ argChangeViewOption->OptionName->insertItem( "ShowPlanetImages" );
+
+ opsCName = new QListViewItem( otv->OptionsList, i18n( "Constellation Names" ) );
+ new QListViewItem( opsCName, "UseLatinConstellNames", i18n( "Show Latin constellation names" ), i18n( "bool" ) );
+ new QListViewItem( opsCName, "UseLocalConstellNames", i18n( "Show constellation names in local language" ), i18n( "bool" ) );
+ new QListViewItem( opsCName, "UseAbbrevConstellNames", i18n( "Show IAU-standard constellation abbreviations" ), i18n( "bool" ) );
+ argChangeViewOption->OptionName->insertItem( "UseLatinConstellNames" );
+ argChangeViewOption->OptionName->insertItem( "UseLocalConstellNames" );
+ argChangeViewOption->OptionName->insertItem( "UseAbbrevConstellNames" );
+
+ opsHide = new QListViewItem( otv->OptionsList, i18n( "Hide Items" ) );
+ new QListViewItem( opsHide, "HideOnSlew", i18n( "Toggle whether objects hidden while slewing display" ), i18n( "bool" ) );
+ new QListViewItem( opsHide, "SlewTimeScale", i18n( "Timestep threshold (in seconds) for hiding objects" ), i18n( "double" ) );
+ new QListViewItem( opsHide, "HideStars", i18n( "Hide faint stars while slewing?" ), i18n( "bool" ) );
+ new QListViewItem( opsHide, "HidePlanets", i18n( "Hide solar system bodies while slewing?" ), i18n( "bool" ) );
+ new QListViewItem( opsHide, "HideMessier", i18n( "Hide Messier objects while slewing?" ), i18n( "bool" ) );
+ new QListViewItem( opsHide, "HideNGC", i18n( "Hide NGC objects while slewing?" ), i18n( "bool" ) );
+ new QListViewItem( opsHide, "HideIC", i18n( "Hide IC objects while slewing?" ), i18n( "bool" ) );
+ new QListViewItem( opsHide, "HideMilkyWay", i18n( "Hide Milky Way while slewing?" ), i18n( "bool" ) );
+ new QListViewItem( opsHide, "HideCNames", i18n( "Hide constellation names while slewing?" ), i18n( "bool" ) );
+ new QListViewItem( opsHide, "HideCLines", i18n( "Hide constellation lines while slewing?" ), i18n( "bool" ) );
+ new QListViewItem( opsHide, "HideCBounds", i18n( "Hide constellation boundaries while slewing?" ), i18n( "bool" ) );
+ new QListViewItem( opsHide, "HideGrid", i18n( "Hide coordinate grid while slewing?" ), i18n( "bool" ) );
+ argChangeViewOption->OptionName->insertItem( "HideOnSlew" );
+ argChangeViewOption->OptionName->insertItem( "SlewTimeScale" );
+ argChangeViewOption->OptionName->insertItem( "HideStars" );
+ argChangeViewOption->OptionName->insertItem( "HidePlanets" );
+ argChangeViewOption->OptionName->insertItem( "HideMessier" );
+ argChangeViewOption->OptionName->insertItem( "HideNGC" );
+ argChangeViewOption->OptionName->insertItem( "HideIC" );
+ argChangeViewOption->OptionName->insertItem( "HideMilkyWay" );
+ argChangeViewOption->OptionName->insertItem( "HideCNames" );
+ argChangeViewOption->OptionName->insertItem( "HideCLines" );
+ argChangeViewOption->OptionName->insertItem( "HideCBounds" );
+ argChangeViewOption->OptionName->insertItem( "HideGrid" );
+
+ opsSkymap = new QListViewItem( otv->OptionsList, i18n( "Skymap Options" ) );
+ new QListViewItem( opsSkymap, "UseAltAz", i18n( "Use Horizontal coordinates? (otherwise, use Equatorial)" ), i18n( "bool" ) );
+ new QListViewItem( opsSkymap, "ZoomFactor", i18n( "Set the Zoom Factor" ), i18n( "double" ) );
+ new QListViewItem( opsSkymap, "FOV Size", i18n( "Select angular size for the FOV symbol (in arcmin)" ), i18n( "double" ) );
+ new QListViewItem( opsSkymap, "FOV Shape", i18n( "Select shape for the FOV symbol (0=Square, 1=Circle, 2=Crosshairs, 4=Bullseye)" ), i18n( "int" ) );
+ new QListViewItem( opsSkymap, "FOV Color", i18n( "Select color for the FOV symbol" ), i18n( "string" ) );
+ new QListViewItem( opsSkymap, "AnimateSlewing", i18n( "Use animated slewing? (otherwise, \"snap\" to new focus)" ), i18n( "bool" ) );
+ new QListViewItem( opsSkymap, "UseRefraction", i18n( "Correct for atmospheric refraction?" ), i18n( "bool" ) );
+ new QListViewItem( opsSkymap, "UseAutoLabel", i18n( "Automatically attach name label to centered object?" ), i18n( "bool" ) );
+ new QListViewItem( opsSkymap, "UseHoverLabel", i18n( "Attach temporary name label when hovering mouse over an object?" ), i18n( "bool" ) );
+ new QListViewItem( opsSkymap, "UseAutoTrail", i18n( "Automatically add trail to centered solar system body?" ), i18n( "bool" ) );
+ new QListViewItem( opsSkymap, "FadePlanetTrails", i18n( "Planet trails fade to sky color? (otherwise color is constant)" ), i18n( "bool" ) );
+ argChangeViewOption->OptionName->insertItem( "UseAltAz" );
+ argChangeViewOption->OptionName->insertItem( "ZoomFactor" );
+ argChangeViewOption->OptionName->insertItem( "FOVName" );
+ argChangeViewOption->OptionName->insertItem( "FOVSize" );
+ argChangeViewOption->OptionName->insertItem( "FOVShape" );
+ argChangeViewOption->OptionName->insertItem( "FOVColor" );
+ argChangeViewOption->OptionName->insertItem( "UseRefraction" );
+ argChangeViewOption->OptionName->insertItem( "UseAutoLabel" );
+ argChangeViewOption->OptionName->insertItem( "UseHoverLabel" );
+ argChangeViewOption->OptionName->insertItem( "UseAutoTrail" );
+ argChangeViewOption->OptionName->insertItem( "AnimateSlewing" );
+ argChangeViewOption->OptionName->insertItem( "FadePlanetTrails" );
+
+ opsLimit = new QListViewItem( otv->OptionsList, i18n( "Limits" ) );
+ new QListViewItem( opsLimit, "magLimitDrawStar", i18n( "magnitude of faintest star drawn on map when zoomed in" ), i18n( "double" ) );
+ new QListViewItem( opsLimit, "magLimitDrawStarZoomOut", i18n( "magnitude of faintest star drawn on map when zoomed out" ), i18n( "double" ) );
+ new QListViewItem( opsLimit, "magLimitDrawDeepSky", i18n( "magnitude of faintest nonstellar object drawn on map when zoomed in" ), i18n( "double" ) );
+ new QListViewItem( opsLimit, "magLimitDrawDeepSkyZoomOut", i18n( "magnitude of faintest nonstellar object drawn on map when zoomed out" ), i18n( "double" ) );
+ new QListViewItem( opsLimit, "magLimitDrawStarInfo", i18n( "magnitude of faintest star labeled on map" ), i18n( "double" ) );
+ new QListViewItem( opsLimit, "magLimitHideStar", i18n( "magnitude of brightest star hidden while slewing" ), i18n( "double" ) );
+ new QListViewItem( opsLimit, "magLimitAsteroid", i18n( "magnitude of faintest asteroid drawn on map" ), i18n( "double" ) );
+ new QListViewItem( opsLimit, "magLimitAsteroidName", i18n( "magnitude of faintest asteroid labeled on map" ), i18n( "double" ) );
+ new QListViewItem( opsLimit, "maxRadCometName", i18n( "comets nearer to the Sun than this (in AU) are labeled on map" ), i18n( "double" ) );
+ argChangeViewOption->OptionName->insertItem( "magLimitDrawStar" );
+ argChangeViewOption->OptionName->insertItem( "magLimitDrawStarZoomOut" );
+ argChangeViewOption->OptionName->insertItem( "magLimitDrawDeepSky" );
+ argChangeViewOption->OptionName->insertItem( "magLimitDrawDeepSkyZoomOut" );
+ argChangeViewOption->OptionName->insertItem( "magLimitDrawStarInfo" );
+ argChangeViewOption->OptionName->insertItem( "magLimitHideStar" );
+ argChangeViewOption->OptionName->insertItem( "magLimitAsteroid" );
+ argChangeViewOption->OptionName->insertItem( "magLimitAsteroidName" );
+ argChangeViewOption->OptionName->insertItem( "maxRadCometName" );
+
+ //init the list of color names and values
+ for ( unsigned int i=0; i < ks->data()->colorScheme()->numberOfColors(); ++i ) {
+ argSetColor->ColorName->insertItem( ks->data()->colorScheme()->nameAt(i) );
+ }
+
+ //init list of color scheme names
+ argLoadColorScheme->SchemeList->insertItem( i18n( "use default color scheme", "Default Colors" ) );
+ argLoadColorScheme->SchemeList->insertItem( i18n( "use 'star chart' color scheme", "Star Chart" ) );
+ argLoadColorScheme->SchemeList->insertItem( i18n( "use 'night vision' color scheme", "Night Vision" ) );
+ argLoadColorScheme->SchemeList->insertItem( i18n( "use 'moonless night' color scheme", "Moonless Night" ) );
+
+ QFile file;
+ QString line;
+ file.setName( locate( "appdata", "colors.dat" ) ); //determine filename in local user KDE directory tree.
+ if ( file.open( IO_ReadOnly ) ) {
+ QTextStream stream( &file );
+
+ while ( !stream.eof() ) {
+ line = stream.readLine();
+ argLoadColorScheme->SchemeList->insertItem( line.left( line.find( ':' ) ) );
+ }
+ file.close();
+ }
+}
+
+//Slots defined in ScriptBuilderUI
+void ScriptBuilder::slotNew() {
+ saveWarning();
+ if ( !UnsavedChanges ) {
+ ScriptList.clear();
+ sb->ScriptListBox->clear();
+ sb->ArgStack->raiseWidget( argBlank );
+
+ sb->CopyButton->setEnabled( false );
+ sb->RemoveButton->setEnabled( false );
+ sb->RunButton->setEnabled( false );
+
+ currentFileURL = "";
+ currentScriptName = "";
+ }
+}
+
+void ScriptBuilder::slotOpen() {
+ saveWarning();
+
+ QString fname;
+ KTempFile tmpfile;
+ tmpfile.setAutoDelete(true);
+
+ if ( !UnsavedChanges ) {
+ currentFileURL = KFileDialog::getOpenURL( currentDir, "*.kstars|KStars Scripts (*.kstars)" );
+
+ if ( currentFileURL.isValid() ) {
+ currentDir = currentFileURL.directory();
+
+ ScriptList.clear();
+ sb->ScriptListBox->clear();
+ sb->ArgStack->raiseWidget( argBlank );
+
+ if ( currentFileURL.isLocalFile() ) {
+ fname = currentFileURL.path();
+ } else {
+ fname = tmpfile.name();
+ if ( ! KIO::NetAccess::download( currentFileURL, fname, (QWidget*) 0 ) )
+ KMessageBox::sorry( 0, i18n( "Could not download remote file." ), i18n( "Download Error" ) );
+ }
+
+ QFile f( fname );
+ if ( !f.open( IO_ReadOnly) ) {
+ QString message = i18n( "Could not open file %1." ).arg( f.name() );
+ KMessageBox::sorry( 0, message, i18n( "Could Not Open File" ) );
+ currentFileURL = "";
+ return;
+ }
+
+ QTextStream istream(&f);
+ readScript( istream );
+
+ f.close();
+ } else if ( ! currentFileURL.url().isEmpty() ) {
+ QString message = i18n( "Invalid URL: %1" ).arg( currentFileURL.url() );
+ KMessageBox::sorry( 0, message, i18n( "Invalid URL" ) );
+ currentFileURL = "";
+ }
+ }
+}
+
+void ScriptBuilder::slotSave() {
+ QString fname;
+ KTempFile tmpfile;
+ tmpfile.setAutoDelete(true);
+
+ if ( currentScriptName.isEmpty() ) {
+ //Get Script Name and Author info
+ if ( snd->exec() == QDialog::Accepted ) {
+ currentScriptName = snd->ScriptName->text();
+ currentAuthor = snd->AuthorName->text();
+ } else {
+ return;
+ }
+ }
+
+ if ( currentFileURL.isEmpty() )
+ currentFileURL = KFileDialog::getSaveURL( currentDir, "*.kstars|KStars Scripts (*.kstars)" );
+
+ if ( currentFileURL.isValid() ) {
+ currentDir = currentFileURL.directory();
+
+ if ( currentFileURL.isLocalFile() ) {
+ fname = currentFileURL.path();
+
+ //Warn user if file exists
+ if (QFile::exists(currentFileURL.path())) {
+ int r=KMessageBox::warningContinueCancel(static_cast<QWidget *>(parent()),
+ i18n( "A file named \"%1\" already exists. "
+ "Overwrite it?" ).arg(currentFileURL.fileName()),
+ i18n( "Overwrite File?" ),
+ i18n( "&Overwrite" ) );
+
+ if(r==KMessageBox::Cancel) return;
+ }
+ } else {
+ fname = tmpfile.name();
+ }
+
+ if ( fname.right( 7 ).lower() != ".kstars" ) fname += ".kstars";
+
+ QFile f( fname );
+ if ( !f.open( IO_WriteOnly) ) {
+ QString message = i18n( "Could not open file %1." ).arg( f.name() );
+ KMessageBox::sorry( 0, message, i18n( "Could Not Open File" ) );
+ currentFileURL = "";
+ return;
+ }
+
+ QTextStream ostream(&f);
+ writeScript( ostream );
+ f.close();
+
+ //set rwx for owner, rx for group, rx for other
+ chmod( fname.ascii(), S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH );
+
+ if ( tmpfile.name() == fname ) { //need to upload to remote location
+ if ( ! KIO::NetAccess::upload( tmpfile.name(), currentFileURL, (QWidget*) 0 ) ) {
+ QString message = i18n( "Could not upload image to remote location: %1" ).arg( currentFileURL.prettyURL() );
+ KMessageBox::sorry( 0, message, i18n( "Could not upload file" ) );
+ }
+ }
+
+ setUnsavedChanges( false );
+
+ } else {
+ QString message = i18n( "Invalid URL: %1" ).arg( currentFileURL.url() );
+ KMessageBox::sorry( 0, message, i18n( "Invalid URL" ) );
+ currentFileURL = "";
+ }
+}
+
+void ScriptBuilder::slotSaveAs() {
+ currentFileURL = "";
+ currentScriptName = "";
+ slotSave();
+}
+
+void ScriptBuilder::saveWarning() {
+ if ( UnsavedChanges ) {
+ QString caption = i18n( "Save Changes to Script?" );
+ QString message = i18n( "The current script has unsaved changes. Would you like to save before closing it?" );
+ int ans = KMessageBox::warningYesNoCancel( 0, message, caption, KStdGuiItem::save(), KStdGuiItem::discard() );
+ if ( ans == KMessageBox::Yes ) {
+ slotSave();
+ setUnsavedChanges( false );
+ } else if ( ans == KMessageBox::No ) {
+ setUnsavedChanges( false );
+ }
+
+ //Do nothing if 'cancel' selected
+ }
+}
+
+void ScriptBuilder::slotRunScript() {
+ //hide window while script runs
+// If this is uncommented, the program hangs before the script is executed. Why?
+// hide();
+
+ //Save current script to a temporary file, then execute that file.
+ //For some reason, I can't use KTempFile here! If I do, then the temporary script
+ //is not executable. Bizarre...
+ //KTempFile tmpfile;
+ //QString fname = tmpfile.name();
+ QString fname = locateLocal( "tmp", "kstars-tempscript" );
+
+ QFile f( fname );
+ if ( f.exists() ) f.remove();
+ if ( !f.open( IO_WriteOnly) ) {
+ QString message = i18n( "Could not open file %1." ).arg( f.name() );
+ KMessageBox::sorry( 0, message, i18n( "Could Not Open File" ) );
+ currentFileURL = "";
+ return;
+ }
+
+ QTextStream ostream(&f);
+ writeScript( ostream );
+ f.close();
+
+ //set rwx for owner, rx for group, rx for other
+ chmod( f.name().ascii(), S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH );
+
+ KProcess p;
+ p << f.name();
+ if ( ! p.start( KProcess::DontCare ) )
+ kdDebug() << "Process did not start." << endl;
+
+ while ( p.isRunning() ) kapp->processEvents( 50 ); //otherwise tempfile may get deleted before script completes.
+
+ //delete temp file
+ if ( f.exists() ) f.remove();
+
+ //uncomment if 'hide()' is uncommented...
+// show();
+}
+
+void ScriptBuilder::writeScript( QTextStream &ostream ) {
+ QString mainpre = "dcop $KSTARS $MAIN ";
+ QString clockpre = "dcop $KSTARS $CLOCK ";
+
+ //Write script header
+ ostream << "#!/bin/bash" << endl;
+ ostream << "#KStars DCOP script: " << currentScriptName << endl;
+ ostream << "#by " << currentAuthor << endl;
+ ostream << "#last modified: " << KStarsDateTime::currentDateTime().toString() << endl;
+ ostream << "#" << endl;
+ ostream << "KSTARS=`dcopfind -a 'kstars*'`" << endl;
+ ostream << "MAIN=KStarsInterface" << endl;
+ ostream << "CLOCK=clock#1" << endl;
+
+ for ( ScriptFunction *sf = ScriptList.first(); sf; sf = ScriptList.next() )
+ {
+ if (!sf->valid()) continue;
+ if ( sf->isClockFunction() ) {
+ ostream << clockpre << sf->scriptLine() << endl;
+ } else {
+ ostream << mainpre << sf->scriptLine() << endl;
+ if (sb->AppendINDIWait->isChecked() && !sf->INDIProperty().isEmpty())
+ {
+ // Special case for telescope action, we need to know the parent property
+ if (sf->INDIProperty() == "CHECK")
+ {
+ if (sf->argVal(1) == "SLEW" || sf->argVal(1) == "TRACK" || sf->argVal(1) == "SYNC")
+ sf->setINDIProperty("ON_COORD_SET");
+ else if (sf->argVal(1) == "ABORT")
+ sf->setINDIProperty("ABORT_MOTION");
+ else
+ sf->setINDIProperty("PARK");
+ }
+
+ if ( sf->argVal(0).contains(" "))
+ ostream << mainpre << "waitForINDIAction " << "\"" << sf->argVal(0) << "\" " << sf->INDIProperty() << endl;
+ else
+ ostream << mainpre << "waitForINDIAction " << sf->argVal(0) << " " << sf->INDIProperty() << endl;
+ }
+ }
+ }
+
+ //Write script footer
+ ostream << "##" << endl;
+}
+
+void ScriptBuilder::readScript( QTextStream &istream ) {
+ QString line;
+
+ while ( ! istream.eof() ) {
+ line = istream.readLine();
+
+ //look for name of script
+ if ( line.contains( "#KStars DCOP script: " ) )
+ currentScriptName = line.mid( 21 ).stripWhiteSpace();
+
+ //look for author of scriptbuilder
+ if ( line.contains( "#by " ) )
+ currentAuthor = line.mid( 4 ).stripWhiteSpace();
+
+ //Actual script functions
+ if ( line.left(4) == "dcop" ) {
+
+ //is ClockFunction?
+ bool clockfcn( false );
+ if ( line.contains( "$CLOCK" ) ) clockfcn = true;
+
+ //remove leading dcop prefix
+ line = line.mid( 20 );
+
+ //construct a stringlist that is fcn name and its arg name/value pairs
+ QStringList fn = QStringList::split( " ", line );
+ if ( parseFunction( fn ) )
+ {
+ sb->ScriptListBox->insertItem( ScriptList.current()->name() );
+ // Initially, any read script is valid!
+ ScriptList.current()->setValid(true);
+ }
+ else kdWarning() << i18n( "Could not parse script. Line was: %1" ).arg( line ) << endl;
+
+ } // end if left(4) == "dcop"
+ } // end while !eof()
+
+ //Select first item in sb->ScriptListBox
+ if ( sb->ScriptListBox->count() ) {
+ sb->ScriptListBox->setCurrentItem( 0 );
+ slotArgWidget();
+ }
+}
+
+bool ScriptBuilder::parseFunction( QStringList &fn )
+{
+ // clean up the string list first if needed
+ // We need to perform this in case we havea quoted string "NGC 3000" because this will counted
+ // as two arguments, and it should be counted as one.
+ bool foundQuote(false), quoteProcessed(false);
+ QString cur, arg;
+ QStringList::iterator it;
+
+ for (it = fn.begin(); it != fn.end(); ++it)
+ {
+ cur = (*it);
+
+ if ( cur.startsWith("\""))
+ {
+ arg += cur.right(cur.length() - 1);
+ arg += " ";
+ foundQuote = true;
+ quoteProcessed = true;
+ }
+ else if (cur.endsWith("\""))
+ {
+ arg += cur.left(cur.length() -1);
+ arg += "'";
+ foundQuote = false;
+ }
+ else if (foundQuote)
+ {
+ arg += cur;
+ arg += " ";
+ }
+ else
+ {
+ arg += cur;
+ arg += "'";
+ }
+ }
+
+ if (quoteProcessed)
+ fn = QStringList::split( "'", arg );
+
+ //loop over known functions to find a name match
+ for ( ScriptFunction *sf = KStarsFunctionList.first(); sf; sf = KStarsFunctionList.next() )
+ {
+ if ( fn[0] == sf->name() ) {
+
+ if ( fn[0] == "setGeoLocation" ) {
+ QString city( fn[1] ), prov( "" ), cntry( fn[2] );
+ if ( fn.count() == 4 ) { prov = fn[2]; cntry = fn[3]; }
+ if ( fn.count() == 3 || fn.count() == 4 ) {
+ ScriptList.append( new ScriptFunction( sf ) );
+ ScriptList.current()->setArg( 0, city );
+ ScriptList.current()->setArg( 1, prov );
+ ScriptList.current()->setArg( 2, cntry );
+ } else return false;
+
+ } else if ( fn.count() != sf->numArgs() + 1 ) return false;
+
+ ScriptList.append( new ScriptFunction( sf ) );
+
+ for ( unsigned int i=0; i<sf->numArgs(); ++i )
+ ScriptList.current()->setArg( i, fn[i+1] );
+
+ return true;
+ }
+
+ for ( ScriptFunction *sf = INDIFunctionList.first(); sf; sf = INDIFunctionList.next() )
+ {
+ if ( fn[0] == sf->name() )
+ {
+
+ if ( fn.count() != sf->numArgs() + 1 ) return false;
+
+ ScriptList.append( new ScriptFunction( sf ) );
+
+ for ( unsigned int i=0; i<sf->numArgs(); ++i )
+ ScriptList.current()->setArg( i, fn[i+1] );
+
+ return true;
+ }
+ }
+ }
+
+ //if we get here, no function-name match was found
+ return false;
+}
+
+void ScriptBuilder::setUnsavedChanges( bool b ) {
+ UnsavedChanges = b;
+ sb->SaveButton->setEnabled( b );
+ sb->SaveAsButton->setEnabled( b );
+}
+
+void ScriptBuilder::slotEnableScriptNameOK() {
+ snd->OKButton->setEnabled( ! snd->ScriptName->text().isEmpty() );
+}
+
+void ScriptBuilder::slotCopyFunction() {
+ if ( ! UnsavedChanges ) setUnsavedChanges( true );
+
+ int Pos = sb->ScriptListBox->currentItem() + 1;
+ ScriptList.insert( Pos, new ScriptFunction( ScriptList.at( Pos-1 ) ) );
+ //copy ArgVals
+ for ( unsigned int i=0; i < ScriptList.at( Pos-1 )->numArgs(); ++i )
+ ScriptList.at(Pos)->setArg(i, ScriptList.at( Pos-1 )->argVal(i) );
+
+ sb->ScriptListBox->insertItem( ScriptList.current()->name(), Pos );
+ sb->ScriptListBox->setSelected( Pos, true );
+}
+
+void ScriptBuilder::slotRemoveFunction() {
+ setUnsavedChanges( true );
+
+ int Pos = sb->ScriptListBox->currentItem();
+ ScriptList.remove( Pos );
+ sb->ScriptListBox->removeItem( Pos );
+ if ( sb->ScriptListBox->count() == 0 ) {
+ sb->ArgStack->raiseWidget( argBlank );
+ sb->CopyButton->setEnabled( false );
+ sb->RemoveButton->setEnabled( false );
+ } else {
+ sb->ScriptListBox->setSelected( Pos, true );
+ }
+}
+
+void ScriptBuilder::slotAddFunction() {
+
+ ScriptFunction *sc = NULL;
+ QListViewItem *currentItem = sb->FunctionListView->currentItem();
+
+ if ( currentItem == NULL || currentItem->depth() == 0)
+ return;
+
+ for (sc = KStarsFunctionList.first(); sc; sc = KStarsFunctionList.next())
+ if (sc->prototype() == currentItem->text(0))
+ break;
+
+ if (sc == NULL)
+ {
+ for (sc = INDIFunctionList.first(); sc; sc = INDIFunctionList.next())
+ if (sc->prototype() == currentItem->text(0))
+ break;
+
+ }
+
+ if (sc == NULL) return;
+
+ setUnsavedChanges( true );
+
+ int Pos = sb->ScriptListBox->currentItem() + 1;
+
+ ScriptList.insert( Pos, new ScriptFunction(sc) );
+ sb->ScriptListBox->insertItem( ScriptList.current()->name(), Pos );
+ sb->ScriptListBox->setSelected( Pos, true );
+}
+
+void ScriptBuilder::slotMoveFunctionUp() {
+ if ( sb->ScriptListBox->currentItem() > 0 ) {
+ setUnsavedChanges( true );
+
+ QString t = sb->ScriptListBox->currentText();
+ unsigned int n = sb->ScriptListBox->currentItem();
+
+ ScriptFunction *tmp = ScriptList.take( n );
+ ScriptList.insert( n-1, tmp );
+
+ sb->ScriptListBox->removeItem( n );
+ sb->ScriptListBox->insertItem( t, n-1 );
+ sb->ScriptListBox->setSelected( n-1, true );
+ }
+}
+
+void ScriptBuilder::slotMoveFunctionDown() {
+ if ( sb->ScriptListBox->currentItem() > -1 &&
+ sb->ScriptListBox->currentItem() < ((int) sb->ScriptListBox->count())-1 ) {
+ setUnsavedChanges( true );
+
+ QString t = sb->ScriptListBox->currentText();
+ unsigned int n = sb->ScriptListBox->currentItem();
+
+ ScriptFunction *tmp = ScriptList.take( n );
+ ScriptList.insert( n+1, tmp );
+
+ sb->ScriptListBox->removeItem( n );
+ sb->ScriptListBox->insertItem( t, n+1 );
+ sb->ScriptListBox->setSelected( n+1, true );
+ }
+}
+
+void ScriptBuilder::slotArgWidget() {
+ //First, setEnabled on buttons that act on the selected script function
+ if ( sb->ScriptListBox->currentItem() == -1 ) { //no selection
+ sb->CopyButton->setEnabled( false );
+ sb->RemoveButton->setEnabled( false );
+ sb->UpButton->setEnabled( false );
+ sb->DownButton->setEnabled( false );
+ } else if ( sb->ScriptListBox->count() == 1 ) { //only one item, so disable up/down buttons
+ sb->CopyButton->setEnabled( true );
+ sb->RemoveButton->setEnabled( true );
+ sb->UpButton->setEnabled( false );
+ sb->DownButton->setEnabled( false );
+ } else if ( sb->ScriptListBox->currentItem() == 0 ) { //first item selected
+ sb->CopyButton->setEnabled( true );
+ sb->RemoveButton->setEnabled( true );
+ sb->UpButton->setEnabled( false );
+ sb->DownButton->setEnabled( true );
+ } else if ( sb->ScriptListBox->currentItem() == ((int) sb->ScriptListBox->count())-1 ) { //last item selected
+ sb->CopyButton->setEnabled( true );
+ sb->RemoveButton->setEnabled( true );
+ sb->UpButton->setEnabled( true );
+ sb->DownButton->setEnabled( false );
+ } else { //other item selected
+ sb->CopyButton->setEnabled( true );
+ sb->RemoveButton->setEnabled( true );
+ sb->UpButton->setEnabled( true );
+ sb->DownButton->setEnabled( true );
+ }
+
+ //sb->RunButton enabled when script not empty.
+ if ( sb->ScriptListBox->count() ) {
+ sb->RunButton->setEnabled( true );
+ } else {
+ sb->RunButton->setEnabled( false );
+ setUnsavedChanges( false );
+ }
+
+ //Display the function's arguments widget
+ if ( sb->ScriptListBox->currentItem() > -1 &&
+ sb->ScriptListBox->currentItem() < ((int) sb->ScriptListBox->count()) ) {
+ QString t = sb->ScriptListBox->currentText();
+ unsigned int n = sb->ScriptListBox->currentItem();
+ ScriptFunction *sf = ScriptList.at( n );
+
+ if ( sf->name() == "lookTowards" ) {
+ sb->ArgStack->raiseWidget( argLookToward );
+ QString s = sf->argVal(0);
+ argLookToward->FocusEdit->setCurrentText( s );
+
+ } else if ( sf->name() == "setRaDec" ) {
+ bool ok(false);
+ double r(0.0),d(0.0);
+ dms ra(0.0);
+
+ sb->ArgStack->raiseWidget( argSetRaDec );
+
+ ok = !sf->argVal(0).isEmpty();
+ if (ok) r = sf->argVal(0).toDouble(&ok);
+ else argSetRaDec->RaBox->clear();
+ if (ok) { ra.setH(r); argSetRaDec->RaBox->showInHours( ra ); }
+
+ ok = !sf->argVal(1).isEmpty();
+ if (ok) d = sf->argVal(1).toDouble(&ok);
+ else argSetRaDec->DecBox->clear();
+ if (ok) argSetRaDec->DecBox->showInDegrees( dms(d) );
+
+ } else if ( sf->name() == "setAltAz" ) {
+ bool ok(false);
+ double x(0.0),y(0.0);
+
+ sb->ArgStack->raiseWidget( argSetAltAz );
+
+ ok = !sf->argVal(0).isEmpty();
+ if (ok) y = sf->argVal(0).toDouble(&ok);
+ else argSetAltAz->AzBox->clear();
+ if (ok) argSetAltAz->AltBox->showInDegrees( dms(y) );
+ else argSetAltAz->AltBox->clear();
+
+ ok = !sf->argVal(1).isEmpty();
+ x = sf->argVal(1).toDouble(&ok);
+ if (ok) argSetAltAz->AzBox->showInDegrees( dms(x) );
+
+ } else if ( sf->name() == "zoomIn" ) {
+ sb->ArgStack->raiseWidget( argBlank );
+ //no Args
+
+ } else if ( sf->name() == "zoomOut" ) {
+ sb->ArgStack->raiseWidget( argBlank );
+ //no Args
+
+ } else if ( sf->name() == "defaultZoom" ) {
+ sb->ArgStack->raiseWidget( argBlank );
+ //no Args
+
+ } else if ( sf->name() == "zoom" ) {
+ sb->ArgStack->raiseWidget( argZoom );
+ bool ok(false);
+ /*double z = */sf->argVal(0).toDouble(&ok);
+ if (ok) argZoom->ZoomBox->setText( sf->argVal(0) );
+ else argZoom->ZoomBox->setText( "2000." );
+
+ } else if ( sf->name() == "exportImage" ) {
+ sb->ArgStack->raiseWidget( argExportImage );
+ argExportImage->ExportFileName->setURL( sf->argVal(0) );
+ bool ok(false);
+ int w, h;
+ w = sf->argVal(1).toInt( &ok );
+ if (ok) h = sf->argVal(2).toInt( &ok );
+ if (ok) {
+ argExportImage->ExportWidth->setValue( w );
+ argExportImage->ExportHeight->setValue( h );
+ } else {
+ argExportImage->ExportWidth->setValue( ks->map()->width() );
+ argExportImage->ExportHeight->setValue( ks->map()->height() );
+ }
+
+ } else if ( sf->name() == "printImage" ) {
+ if ( sf->argVal(0) == i18n( "true" ) ) argPrintImage->UsePrintDialog->setChecked( true );
+ else argPrintImage->UsePrintDialog->setChecked( false );
+ if ( sf->argVal(1) == i18n( "true" ) ) argPrintImage->UseChartColors->setChecked( true );
+ else argPrintImage->UseChartColors->setChecked( false );
+
+ } else if ( sf->name() == "setLocalTime" ) {
+ sb->ArgStack->raiseWidget( argSetLocalTime );
+ bool ok(false);
+ int year, month, day, hour, min, sec;
+
+ year = sf->argVal(0).toInt(&ok);
+ if (ok) month = sf->argVal(1).toInt(&ok);
+ if (ok) day = sf->argVal(2).toInt(&ok);
+ if (ok) argSetLocalTime->DateBox->setDate( ExtDate( year, month, day ) );
+ else argSetLocalTime->DateBox->setDate( ExtDate::currentDate() );
+
+ hour = sf->argVal(3).toInt(&ok);
+ if ( sf->argVal(3).isEmpty() ) ok = false;
+ if (ok) min = sf->argVal(4).toInt(&ok);
+ if (ok) sec = sf->argVal(5).toInt(&ok);
+ if (ok) argSetLocalTime->TimeBox->setTime( QTime( hour, min, sec ) );
+ else argSetLocalTime->TimeBox->setTime( QTime( QTime::currentTime() ) );
+
+ } else if ( sf->name() == "waitFor" ) {
+ sb->ArgStack->raiseWidget( argWaitFor );
+ bool ok(false);
+ int sec = sf->argVal(0).toInt(&ok);
+ if (ok) argWaitFor->DelayBox->setValue( sec );
+ else argWaitFor->DelayBox->setValue( 0 );
+
+ } else if ( sf->name() == "waitForKey" ) {
+ sb->ArgStack->raiseWidget( argWaitForKey );
+ if ( sf->argVal(0).length()==1 || sf->argVal(0).lower() == "space" )
+ argWaitForKey->WaitKeyEdit->setText( sf->argVal(0) );
+ else argWaitForKey->WaitKeyEdit->setText( "" );
+
+ } else if ( sf->name() == "setTracking" ) {
+ sb->ArgStack->raiseWidget( argSetTracking );
+ if ( sf->argVal(0) == i18n( "true" ) ) argSetTracking->CheckTrack->setChecked( true );
+ else argSetTracking->CheckTrack->setChecked( false );
+
+ } else if ( sf->name() == "changeViewOption" ) {
+ sb->ArgStack->raiseWidget( argChangeViewOption );
+ //find argVal(0) in the combobox...if it isn't there, it will select nothing
+ argChangeViewOption->OptionName->setCurrentItem( sf->argVal(0) );
+ argChangeViewOption->OptionValue->setText( sf->argVal(1) );
+
+ } else if ( sf->name() == "setGeoLocation" ) {
+ sb->ArgStack->raiseWidget( argSetGeoLocation );
+ argSetGeoLocation->CityName->setText( sf->argVal(0) );
+ argSetGeoLocation->ProvinceName->setText( sf->argVal(1) );
+ argSetGeoLocation->CountryName->setText( sf->argVal(2) );
+
+ } else if ( sf->name() == "setColor" ) {
+ sb->ArgStack->raiseWidget( argSetColor );
+ if ( sf->argVal(0).isEmpty() ) sf->setArg( 0, "SkyColor" ); //initialize default value
+ argSetColor->ColorName->setCurrentItem( ks->data()->colorScheme()->nameFromKey( sf->argVal(0) ) );
+ argSetColor->ColorValue->setColor( QColor( sf->argVal(1).remove('\\') ) );
+
+ } else if ( sf->name() == "loadColorScheme" ) {
+ sb->ArgStack->raiseWidget( argLoadColorScheme );
+ argLoadColorScheme->SchemeList->setCurrentItem( argLoadColorScheme->SchemeList->findItem( sf->argVal(0).remove('\"'), 0 ) );
+
+ } else if ( sf->name() == "stop" ) {
+ sb->ArgStack->raiseWidget( argBlank );
+ //no Args
+
+ } else if ( sf->name() == "start" ) {
+ sb->ArgStack->raiseWidget( argBlank );
+ //no Args
+
+ } else if ( sf->name() == "setClockScale" ) {
+ sb->ArgStack->raiseWidget( argTimeScale );
+ bool ok(false);
+ double ts = sf->argVal(0).toDouble(&ok);
+ if (ok) argTimeScale->TimeScale->tsbox()->changeScale( float(ts) );
+ else argTimeScale->TimeScale->tsbox()->changeScale( 0.0 );
+
+ }
+ else if (sf->name() == "startINDI") {
+ sb->ArgStack->raiseWidget( argStartINDI);
+
+ argStartINDI->deviceName->setText(sf->argVal(0));
+ if (sf->argVal(1) == "true")
+ argStartINDI->LocalButton->setChecked(true);
+ else if (! sf->argVal(1).isEmpty())
+ argStartINDI->LocalButton->setChecked(false);
+ }
+ else if (sf->name() == "shutdownINDI") {
+ sb->ArgStack->raiseWidget( argShutdownINDI);
+
+ //if (sf->valid()) kdDebug() << "begin: shutdown is valid" << endl;
+ if (sb->ReuseINDIDeviceName->isChecked())
+ {
+ if (!sf->argVal(0).isEmpty())
+ argShutdownINDI->deviceName->setText(sf->argVal(0));
+ else if (argShutdownINDI->deviceName->text().isEmpty() || sf->argVal(0).isEmpty())
+ argShutdownINDI->deviceName->setText(lastINDIDeviceName);
+ else
+ slotINDIShutdown();
+ }
+ else argShutdownINDI->deviceName->setText(sf->argVal(0));
+
+ //if (sf->valid()) kdDebug() << "end: shutdown is valid" << endl;
+ }
+ else if (sf->name() == "switchINDI") {
+ sb->ArgStack->raiseWidget( argSwitchINDI);
+
+ if (sf->argVal(1) == "true" || sf->argVal(1).isEmpty())
+ argSwitchINDI->OnButton->setChecked(true);
+ else
+ argSwitchINDI->OffButton->setChecked(true);
+
+ argSwitchINDI->deviceName->clear();
+
+ if (sb->ReuseINDIDeviceName->isChecked())
+ {
+ if (!sf->argVal(0).isEmpty())
+ argSwitchINDI->deviceName->setText(sf->argVal(0));
+ else
+ argSwitchINDI->deviceName->setText(lastINDIDeviceName);
+ }
+ else argSwitchINDI->deviceName->setText(sf->argVal(0));
+
+ }
+ else if (sf->name() == "setINDIPort") {
+ sb->ArgStack->raiseWidget( argSetPortINDI);
+
+ argSetPortINDI->devicePort->setText(sf->argVal(1));
+
+ argSetPortINDI->deviceName->clear();
+
+ if (sb->ReuseINDIDeviceName->isChecked())
+ {
+ if (!sf->argVal(0).isEmpty())
+ argSetPortINDI->deviceName->setText(sf->argVal(0));
+ else
+ argSetPortINDI->deviceName->setText(lastINDIDeviceName);
+ }
+ else argSetPortINDI->deviceName->setText(sf->argVal(0));
+
+ }
+ else if (sf->name() == "setINDITargetCoord") {
+ bool ok(false);
+ double r(0.0),d(0.0);
+ dms ra(0.0);
+
+ sb->ArgStack->raiseWidget( argSetTargetCoordINDI);
+
+ ok = !sf->argVal(1).isEmpty();
+ if (ok) r = sf->argVal(1).toDouble(&ok);
+ else argSetTargetCoordINDI->RaBox->clear();
+ if (ok) { ra.setH(r); argSetTargetCoordINDI->RaBox->showInHours( ra ); }
+
+ ok = !sf->argVal(2).isEmpty();
+ if (ok) d = sf->argVal(2).toDouble(&ok);
+ else argSetTargetCoordINDI->DecBox->clear();
+ if (ok) argSetTargetCoordINDI->DecBox->showInDegrees( dms(d) );
+
+ argSetTargetCoordINDI->deviceName->clear();
+
+ if (sb->ReuseINDIDeviceName->isChecked())
+ {
+ if (!sf->argVal(0).isEmpty())
+ argSetTargetCoordINDI->deviceName->setText(sf->argVal(0));
+ else
+ argSetTargetCoordINDI->deviceName->setText(lastINDIDeviceName);
+ }
+ else argSetTargetCoordINDI->deviceName->setText(sf->argVal(0));
+
+ }
+ else if (sf->name() == "setINDITargetName") {
+ sb->ArgStack->raiseWidget( argSetTargetNameINDI);
+
+ argSetTargetNameINDI->objectName->setText(sf->argVal(1));
+
+ argSetTargetNameINDI->deviceName->clear();
+
+ if (sb->ReuseINDIDeviceName->isChecked())
+ {
+ if (!sf->argVal(0).isEmpty())
+ argSetTargetNameINDI->deviceName->setText(sf->argVal(0));
+ else
+ argSetTargetNameINDI->deviceName->setText(lastINDIDeviceName);
+ }
+ else argSetTargetNameINDI->deviceName->setText(sf->argVal(0));
+
+ }
+ else if (sf->name() == "setINDIAction") {
+ sb->ArgStack->raiseWidget( argSetActionINDI);
+
+ argSetActionINDI->actionName->setText(sf->argVal(1));
+
+ argSetActionINDI->deviceName->clear();
+
+ if (sb->ReuseINDIDeviceName->isChecked())
+ {
+ if (!sf->argVal(0).isEmpty())
+ argSetActionINDI->deviceName->setText(sf->argVal(0));
+ else
+ argSetActionINDI->deviceName->setText(lastINDIDeviceName);
+ }
+ else argSetActionINDI->deviceName->setText(sf->argVal(0));
+
+ }
+ else if (sf->name() == "waitForINDIAction") {
+ sb->ArgStack->raiseWidget( argWaitForActionINDI);
+
+ argWaitForActionINDI->actionName->setText(sf->argVal(1));
+
+ argWaitForActionINDI->deviceName->clear();
+
+ if (sb->ReuseINDIDeviceName->isChecked())
+ {
+ if (!sf->argVal(0).isEmpty())
+ argWaitForActionINDI->deviceName->setText(sf->argVal(0));
+ else
+ argWaitForActionINDI->deviceName->setText(lastINDIDeviceName);
+ }
+ else argWaitForActionINDI->deviceName->setText(sf->argVal(0));
+
+ }
+ else if (sf->name() == "setINDIFocusSpeed") {
+ int t(0);
+ bool ok(false);
+
+ sb->ArgStack->raiseWidget( argSetFocusSpeedINDI);
+
+ t = sf->argVal(1).toInt(&ok);
+ if (ok) argSetFocusSpeedINDI->speedIN->setValue(t);
+ else argSetFocusSpeedINDI->speedIN->setValue(0);
+
+ argSetFocusSpeedINDI->deviceName->clear();
+
+ if (sb->ReuseINDIDeviceName->isChecked())
+ {
+ if (!sf->argVal(0).isEmpty())
+ argSetFocusSpeedINDI->deviceName->setText(sf->argVal(0));
+ else
+ argSetFocusSpeedINDI->deviceName->setText(lastINDIDeviceName);
+ }
+ else argSetFocusSpeedINDI->deviceName->setText(sf->argVal(0));
+
+ }
+ else if (sf->name() == "startINDIFocus") {
+ sb->ArgStack->raiseWidget( argStartFocusINDI);
+ bool itemSet(false);
+
+ for (int i=0; i < argStartFocusINDI->directionCombo->count(); i++)
+ {
+ if (argStartFocusINDI->directionCombo->text(i) == sf->argVal(1))
+ {
+ argStartFocusINDI->directionCombo->setCurrentItem(i);
+ itemSet = true;
+ break;
+ }
+ }
+
+ if (!itemSet) argStartFocusINDI->directionCombo->setCurrentItem(0);
+
+ argStartFocusINDI->deviceName->clear();
+
+ if (sb->ReuseINDIDeviceName->isChecked())
+ {
+ if (!sf->argVal(0).isEmpty())
+ argStartFocusINDI->deviceName->setText(sf->argVal(0));
+ else
+ argStartFocusINDI->deviceName->setText(lastINDIDeviceName);
+ }
+ else argStartFocusINDI->deviceName->setText(sf->argVal(0));
+
+ }
+ else if (sf->name() == "setINDIFocusTimeout") {
+ int t(0);
+ bool ok(false);
+
+ sb->ArgStack->raiseWidget( argSetFocusTimeoutINDI);
+
+ t = sf->argVal(1).toInt(&ok);
+ if (ok) argSetFocusTimeoutINDI->timeOut->setValue(t);
+ else argSetFocusTimeoutINDI->timeOut->setValue(0);
+
+ argSetFocusTimeoutINDI->deviceName->clear();
+
+ if (sb->ReuseINDIDeviceName->isChecked())
+ {
+ if (!sf->argVal(0).isEmpty())
+ argSetFocusTimeoutINDI->deviceName->setText(sf->argVal(0));
+ else
+ argSetFocusTimeoutINDI->deviceName->setText(lastINDIDeviceName);
+ }
+ else argSetFocusTimeoutINDI->deviceName->setText(sf->argVal(0));
+
+ }
+ else if (sf->name() == "setINDIGeoLocation") {
+ bool ok(false);
+ double lo(0.0),la(0.0);
+
+ sb->ArgStack->raiseWidget( argSetGeoLocationINDI);
+
+ ok = !sf->argVal(1).isEmpty();
+ if (ok) lo = sf->argVal(1).toDouble(&ok);
+ else argSetGeoLocationINDI->longBox->clear();
+ if (ok) { argSetGeoLocationINDI->longBox->showInDegrees( dms(lo) ); }
+
+ ok = !sf->argVal(2).isEmpty();
+ if (ok) la = sf->argVal(2).toDouble(&ok);
+ else argSetGeoLocationINDI->latBox->clear();
+ if (ok) argSetGeoLocationINDI->latBox->showInDegrees( dms(la) );
+
+ argSetGeoLocationINDI->deviceName->clear();
+
+ if (sb->ReuseINDIDeviceName->isChecked())
+ {
+ if (!sf->argVal(0).isEmpty())
+ argSetGeoLocationINDI->deviceName->setText(sf->argVal(0));
+ else
+ argSetGeoLocationINDI->deviceName->setText(lastINDIDeviceName);
+ }
+ else argSetGeoLocationINDI->deviceName->setText(sf->argVal(0));
+
+ }
+ else if (sf->name() == "startINDIExposure") {
+ int t(0);
+ bool ok(false);
+
+ sb->ArgStack->raiseWidget( argStartExposureINDI);
+
+ t = sf->argVal(1).toInt(&ok);
+ if (ok) argStartExposureINDI->timeOut->setValue(t);
+ else argStartExposureINDI->timeOut->setValue(0);
+
+ argStartExposureINDI->deviceName->clear();
+
+ if (sb->ReuseINDIDeviceName->isChecked())
+ {
+ if (!sf->argVal(0).isEmpty())
+ argStartExposureINDI->deviceName->setText(sf->argVal(0));
+ else
+ argStartExposureINDI->deviceName->setText(lastINDIDeviceName);
+ }
+ else argStartExposureINDI->deviceName->setText(sf->argVal(0));
+
+ }
+ else if (sf->name() == "setINDIUTC") {
+ sb->ArgStack->raiseWidget( argSetUTCINDI);
+
+ argSetUTCINDI->UTC->setText(sf->argVal(1));
+
+ argSetUTCINDI->deviceName->clear();
+
+ if (sb->ReuseINDIDeviceName->isChecked())
+ {
+ if (!sf->argVal(0).isEmpty())
+ argSetUTCINDI->deviceName->setText(sf->argVal(0));
+ else
+ argSetUTCINDI->deviceName->setText(lastINDIDeviceName);
+ }
+ else argSetUTCINDI->deviceName->setText(sf->argVal(0));
+
+ }
+ else if (sf->name() == "setINDIScopeAction") {
+ sb->ArgStack->raiseWidget( argSetScopeActionINDI);
+ bool itemSet(false);
+
+ for (int i=0; i < argSetScopeActionINDI->actionCombo->count(); i++)
+ {
+ if (argSetScopeActionINDI->actionCombo->text(i) == sf->argVal(1))
+ {
+ argSetScopeActionINDI->actionCombo->setCurrentItem(i);
+ itemSet = true;
+ break;
+ }
+ }
+
+ if (!itemSet) argSetScopeActionINDI->actionCombo->setCurrentItem(0);
+
+ argSetScopeActionINDI->deviceName->clear();
+
+ if (sb->ReuseINDIDeviceName->isChecked())
+ {
+ if (!sf->argVal(0).isEmpty())
+ argSetScopeActionINDI->deviceName->setText(sf->argVal(0));
+ else
+ argSetScopeActionINDI->deviceName->setText(lastINDIDeviceName);
+ }
+ else argSetScopeActionINDI->deviceName->setText(sf->argVal(0));
+
+ }
+ else if (sf->name() == "setINDIFrameType") {
+ sb->ArgStack->raiseWidget( argSetFrameTypeINDI);
+ bool itemSet(false);
+
+ for (int i=0; i < argSetFrameTypeINDI->typeCombo->count(); i++)
+ {
+ if (argSetFrameTypeINDI->typeCombo->text(i) == sf->argVal(1))
+ {
+ argSetFrameTypeINDI->typeCombo->setCurrentItem(i);
+ itemSet = true;
+ break;
+ }
+ }
+
+ if (!itemSet) argSetFrameTypeINDI->typeCombo->setCurrentItem(0);
+
+ argSetFrameTypeINDI->deviceName->clear();
+
+ if (sb->ReuseINDIDeviceName->isChecked())
+ {
+ if (!sf->argVal(0).isEmpty())
+ argSetFrameTypeINDI->deviceName->setText(sf->argVal(0));
+ else
+ argSetFrameTypeINDI->deviceName->setText(lastINDIDeviceName);
+ }
+ else argSetFrameTypeINDI->deviceName->setText(sf->argVal(0));
+
+ }
+ else if (sf->name() == "setINDICCDTemp") {
+ int t(0);
+ bool ok(false);
+
+ sb->ArgStack->raiseWidget( argSetCCDTempINDI);
+
+ t = sf->argVal(1).toInt(&ok);
+ if (ok) argSetCCDTempINDI->temp->setValue(t);
+ else argSetCCDTempINDI->temp->setValue(0);
+
+ argSetCCDTempINDI->deviceName->clear();
+
+ if (sb->ReuseINDIDeviceName->isChecked())
+ {
+ if (!sf->argVal(0).isEmpty())
+ argSetCCDTempINDI->deviceName->setText(sf->argVal(0));
+ else
+ argSetCCDTempINDI->deviceName->setText(lastINDIDeviceName);
+ }
+ else argSetCCDTempINDI->deviceName->setText(sf->argVal(0));
+
+ }
+ else if (sf->name() == "setINDIFilterNum") {
+ int t(0);
+ bool ok(false);
+
+ sb->ArgStack->raiseWidget( argSetFilterNumINDI);
+
+ t = sf->argVal(1).toInt(&ok);
+ if (ok) argSetFilterNumINDI->filter_num->setValue(t);
+ else argSetFilterNumINDI->filter_num->setValue(0);
+
+ argSetFilterNumINDI->deviceName->clear();
+
+ if (sb->ReuseINDIDeviceName->isChecked())
+ {
+ if (!sf->argVal(0).isEmpty())
+ argSetFilterNumINDI->deviceName->setText(sf->argVal(0));
+ else
+ argSetFilterNumINDI->deviceName->setText(lastINDIDeviceName);
+ }
+ else argSetFilterNumINDI->deviceName->setText(sf->argVal(0));
+
+ }
+ }
+}
+
+void ScriptBuilder::slotShowDoc() {
+ ScriptFunction *sc = NULL;
+ QListViewItem *currentItem = sb->FunctionListView->currentItem();
+
+ if ( currentItem == NULL || currentItem->depth() == 0)
+ return;
+
+ for (sc = KStarsFunctionList.first(); sc; sc = KStarsFunctionList.next())
+ if (sc->prototype() == currentItem->text(0))
+ break;
+
+ if (sc == NULL)
+ {
+ for (sc = INDIFunctionList.first(); sc; sc = INDIFunctionList.next())
+ if (sc->prototype() == currentItem->text(0))
+ break;
+ }
+
+ if (sc == NULL)
+ {
+ sb->AddButton->setEnabled( false );
+ kdWarning() << i18n( "Function index out of bounds." ) << endl;
+ return;
+ }
+
+ sb->AddButton->setEnabled( true );
+ sb->FuncDoc->setText( sc->description() );
+}
+
+//Slots for Arg Widgets
+void ScriptBuilder::slotFindCity() {
+ LocationDialog ld( ks );
+
+ if ( ld.exec() == QDialog::Accepted ) {
+ if ( ld.selectedCity() ) {
+ // set new location names
+ argSetGeoLocation->CityName->setText( ld.selectedCityName() );
+ argSetGeoLocation->ProvinceName->setText( ld.selectedProvinceName() );
+ argSetGeoLocation->CountryName->setText( ld.selectedCountryName() );
+
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+ if ( sf->name() == "setGeoLocation" ) {
+ setUnsavedChanges( true );
+
+ sf->setArg( 0, ld.selectedCityName() );
+ sf->setArg( 1, ld.selectedProvinceName() );
+ sf->setArg( 2, ld.selectedCountryName() );
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setGeoLocation" ) << endl;
+ }
+ }
+ }
+}
+
+void ScriptBuilder::slotFindObject() {
+ FindDialog fd( ks );
+
+ if ( fd.exec() == QDialog::Accepted && fd.currentItem() ) {
+ setUnsavedChanges( true );
+
+ argLookToward->FocusEdit->setCurrentText( fd.currentItem()->objName()->text() );
+ }
+}
+
+void ScriptBuilder::slotINDIFindObject() {
+ FindDialog fd( ks );
+
+ if ( fd.exec() == QDialog::Accepted && fd.currentItem() ) {
+ setUnsavedChanges( true );
+
+ argSetTargetNameINDI->objectName->setText( fd.currentItem()->objName()->text() );
+ }
+}
+
+void ScriptBuilder::slotINDIWaitCheck(bool /*toggleState*/)
+{
+
+ setUnsavedChanges(true);
+
+}
+
+void ScriptBuilder::slotShowOptions() {
+ //Show tree-view of view options
+ if ( otv->exec() == QDialog::Accepted ) {
+ argChangeViewOption->OptionName->setCurrentItem( otv->OptionsList->currentItem()->text(0) );
+ }
+}
+
+void ScriptBuilder::slotLookToward() {
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "lookTowards" ) {
+ setUnsavedChanges( true );
+
+ sf->setArg( 0, argLookToward->FocusEdit->currentText() );
+ sf->setValid(true);
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "lookTowards" ) << endl;
+ }
+}
+
+void ScriptBuilder::slotRa() {
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setRaDec" ) {
+ //do nothing if box is blank (because we could be clearing boxes while switcing argWidgets)
+ if ( argSetRaDec->RaBox->text().isEmpty() ) return;
+
+ bool ok(false);
+ dms ra = argSetRaDec->RaBox->createDms(false, &ok);
+ if ( ok ) {
+ setUnsavedChanges( true );
+
+ sf->setArg( 0, QString( "%1" ).arg( ra.Hours() ) );
+ if ( ! sf->argVal(1).isEmpty() ) sf->setValid( true );
+
+ } else {
+ sf->setArg( 0, "" );
+ sf->setValid( false );
+ }
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setRaDec" ) << endl;
+ }
+}
+
+void ScriptBuilder::slotDec() {
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setRaDec" ) {
+ //do nothing if box is blank (because we could be clearing boxes while switcing argWidgets)
+ if ( argSetRaDec->DecBox->text().isEmpty() ) return;
+
+ bool ok(false);
+ dms dec = argSetRaDec->DecBox->createDms(true, &ok);
+ if ( ok ) {
+ setUnsavedChanges( true );
+
+ sf->setArg( 1, QString( "%1" ).arg( dec.Degrees() ) );
+ if ( ! sf->argVal(0).isEmpty() ) sf->setValid( true );
+
+ } else {
+ sf->setArg( 1, "" );
+ sf->setValid( false );
+ }
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setRaDec" ) << endl;
+ }
+}
+
+void ScriptBuilder::slotAz() {
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setAltAz" ) {
+ //do nothing if box is blank (because we could be clearing boxes while switcing argWidgets)
+ if ( argSetAltAz->AzBox->text().isEmpty() ) return;
+
+ bool ok(false);
+ dms az = argSetAltAz->AzBox->createDms(true, &ok);
+ if ( ok ) {
+ setUnsavedChanges( true );
+ sf->setArg( 1, QString( "%1" ).arg( az.Degrees() ) );
+ if ( ! sf->argVal(0).isEmpty() ) sf->setValid( true );
+ } else {
+ sf->setArg( 1, "" );
+ sf->setValid( false );
+ }
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setAltAz" ) << endl;
+ }
+}
+
+void ScriptBuilder::slotAlt() {
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setAltAz" ) {
+ //do nothing if box is blank (because we could be clearing boxes while switcing argWidgets)
+ if ( argSetAltAz->AltBox->text().isEmpty() ) return;
+
+ bool ok(false);
+ dms alt = argSetAltAz->AltBox->createDms(true, &ok);
+ if ( ok ) {
+ setUnsavedChanges( true );
+
+ sf->setArg( 0, QString( "%1" ).arg( alt.Degrees() ) );
+ if ( ! sf->argVal(1).isEmpty() ) sf->setValid( true );
+ } else {
+ sf->setArg( 0, "" );
+ sf->setValid( false );
+ }
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setAltAz" ) << endl;
+ }
+}
+
+void ScriptBuilder::slotChangeDate() {
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setLocalTime" ) {
+ setUnsavedChanges( true );
+
+ ExtDate date = argSetLocalTime->DateBox->date();
+
+ sf->setArg( 0, QString( "%1" ).arg( date.year() ) );
+ sf->setArg( 1, QString( "%1" ).arg( date.month() ) );
+ sf->setArg( 2, QString( "%1" ).arg( date.day() ) );
+ if ( ! sf->argVal(3).isEmpty() ) sf->setValid( true );
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setLocalTime" ) << endl;
+ }
+}
+
+void ScriptBuilder::slotChangeTime() {
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setLocalTime" ) {
+ setUnsavedChanges( true );
+
+ QTime time = argSetLocalTime->TimeBox->time();
+
+ sf->setArg( 3, QString( "%1" ).arg( time.hour() ) );
+ sf->setArg( 4, QString( "%1" ).arg( time.minute() ) );
+ sf->setArg( 5, QString( "%1" ).arg( time.second() ) );
+ if ( ! sf->argVal(0).isEmpty() ) sf->setValid( true );
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setLocalTime" ) << endl;
+ }
+}
+
+void ScriptBuilder::slotWaitFor() {
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "waitFor" ) {
+ bool ok(false);
+ int delay = argWaitFor->DelayBox->text().toInt( &ok );
+
+ if ( ok ) {
+ setUnsavedChanges( true );
+
+ sf->setArg( 0, QString( "%1" ).arg( delay ) );
+ sf->setValid( true );
+ } else {
+ sf->setValid( false );
+ }
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "waitFor" ) << endl;
+ }
+}
+
+void ScriptBuilder::slotWaitForKey() {
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "waitForKey" ) {
+ QString sKey = argWaitForKey->WaitKeyEdit->text().stripWhiteSpace();
+
+ //DCOP script can only use single keystrokes; make sure entry is either one character,
+ //or the word 'space'
+ if ( sKey.length() == 1 || sKey == "space" ) {
+ setUnsavedChanges( true );
+
+ sf->setArg( 0, sKey );
+ sf->setValid( true );
+ } else {
+ sf->setValid( false );
+ }
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "waitForKey" ) << endl;
+ }
+}
+
+void ScriptBuilder::slotTracking() {
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setTracking" ) {
+ setUnsavedChanges( true );
+
+ sf->setArg( 0, ( argSetTracking->CheckTrack->isChecked() ? i18n( "true" ) : i18n( "false" ) ) );
+ sf->setValid( true );
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setTracking" ) << endl;
+ }
+}
+
+void ScriptBuilder::slotViewOption() {
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "changeViewOption" ) {
+ if ( argChangeViewOption->OptionName->currentItem() >= 0
+ && argChangeViewOption->OptionValue->text().length() ) {
+ setUnsavedChanges( true );
+
+ sf->setArg( 0, argChangeViewOption->OptionName->currentText() );
+ sf->setArg( 1, argChangeViewOption->OptionValue->text() );
+ sf->setValid( true );
+ } else {
+ sf->setValid( false );
+ }
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "changeViewOption" ) << endl;
+ }
+}
+
+void ScriptBuilder::slotChangeCity() {
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setGeoLocation" ) {
+ QString city = argSetGeoLocation->CityName->text();
+
+ if ( city.length() ) {
+ setUnsavedChanges( true );
+
+ sf->setArg( 0, city );
+ if ( sf->argVal(2).length() ) sf->setValid( true );
+ } else {
+ sf->setArg( 0, "" );
+ sf->setValid( false );
+ }
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setGeoLocation" ) << endl;
+ }
+}
+
+void ScriptBuilder::slotChangeProvince() {
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setGeoLocation" ) {
+ QString province = argSetGeoLocation->ProvinceName->text();
+
+ if ( province.length() ) {
+ setUnsavedChanges( true );
+
+ sf->setArg( 1, province );
+ if ( sf->argVal(0).length() && sf->argVal(2).length() ) sf->setValid( true );
+ } else {
+ sf->setArg( 1, "" );
+ //might not be invalid
+ }
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setGeoLocation" ) << endl;
+ }
+}
+
+void ScriptBuilder::slotChangeCountry() {
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setGeoLocation" ) {
+ QString country = argSetGeoLocation->CountryName->text();
+
+ if ( country.length() ) {
+ setUnsavedChanges( true );
+
+ sf->setArg( 2, country );
+ if ( sf->argVal(0).length() ) sf->setValid( true );
+ } else {
+ sf->setArg( 2, "" );
+ sf->setValid( false );
+ }
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setGeoLocation" ) << endl;
+ }
+}
+
+void ScriptBuilder::slotTimeScale() {
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setClockScale" ) {
+ setUnsavedChanges( true );
+
+ sf->setArg( 0, QString( "%1" ).arg( argTimeScale->TimeScale->tsbox()->timeScale() ) );
+ sf->setValid( true );
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setClockScale" ) << endl;
+ }
+}
+
+void ScriptBuilder::slotZoom() {
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "zoom" ) {
+ setUnsavedChanges( true );
+
+ bool ok(false);
+ argZoom->ZoomBox->text().toDouble(&ok);
+ if ( ok ) {
+ sf->setArg( 0, argZoom->ZoomBox->text() );
+ sf->setValid( true );
+ }
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "zoom" ) << endl;
+ }
+}
+
+void ScriptBuilder::slotExportImage() {
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "exportImage" ) {
+ setUnsavedChanges( true );
+
+ sf->setArg( 0, argExportImage->ExportFileName->url() );
+ sf->setArg( 1, QString("%1").arg( argExportImage->ExportWidth->value() ) );
+ sf->setArg( 2, QString("%1").arg( argExportImage->ExportHeight->value() ) );
+ sf->setValid( true );
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "exportImage" ) << endl;
+ }
+}
+
+void ScriptBuilder::slotPrintImage() {
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "printImage" ) {
+ setUnsavedChanges( true );
+
+ sf->setArg( 0, ( argPrintImage->UsePrintDialog->isChecked() ? i18n( "true" ) : i18n( "false" ) ) );
+ sf->setArg( 1, ( argPrintImage->UseChartColors->isChecked() ? i18n( "true" ) : i18n( "false" ) ) );
+ sf->setValid( true );
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "exportImage" ) << endl;
+ }
+}
+
+void ScriptBuilder::slotChangeColorName() {
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setColor" ) {
+ setUnsavedChanges( true );
+
+ argSetColor->ColorValue->setColor( ks->data()->colorScheme()->colorAt( argSetColor->ColorName->currentItem() ) );
+ sf->setArg( 0, ks->data()->colorScheme()->keyAt( argSetColor->ColorName->currentItem() ) );
+ QString cname( argSetColor->ColorValue->color().name() );
+ if ( cname.at(0) == '#' ) cname = "\\" + cname; //prepend a "\" so bash doesn't think we have a comment
+ sf->setArg( 1, cname );
+ sf->setValid( true );
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setColor" ) << endl;
+ }
+}
+
+void ScriptBuilder::slotChangeColor() {
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setColor" ) {
+ setUnsavedChanges( true );
+
+ sf->setArg( 0, ks->data()->colorScheme()->keyAt( argSetColor->ColorName->currentItem() ) );
+ QString cname( argSetColor->ColorValue->color().name() );
+ if ( cname.at(0) == '#' ) cname = "\\" + cname; //prepend a "\" so bash doesn't think we have a comment
+ sf->setArg( 1, cname );
+ sf->setValid( true );
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setColor" ) << endl;
+ }
+}
+
+void ScriptBuilder::slotLoadColorScheme(QListBoxItem */*i*/) {
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "loadColorScheme" ) {
+ setUnsavedChanges( true );
+
+ sf->setArg( 0, "\"" + argLoadColorScheme->SchemeList->currentText() + "\"" );
+ sf->setValid( true );
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "loadColorScheme" ) << endl;
+ }
+}
+
+void ScriptBuilder::slotClose() {
+ saveWarning();
+
+ if ( !UnsavedChanges ) {
+ emit closeClicked();
+ reject();
+ }
+}
+
+void ScriptBuilder::slotINDIStartDeviceName()
+{
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "startINDI" )
+ {
+ setUnsavedChanges( true );
+
+ lastINDIDeviceName = argStartINDI->deviceName->text();
+
+ sf->setArg(0, lastINDIDeviceName);
+ sf->setArg(1, argStartINDI->LocalButton->isChecked() ? "true" : "false");
+ sf->setValid(true);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "startINDI" ) << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDIStartDeviceMode()
+{
+
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "startINDI" )
+ {
+ setUnsavedChanges( true );
+
+ sf->setArg(1, argStartINDI->LocalButton->isChecked() ? "true" : "false");
+ if (! sf->argVal(0).isEmpty()) sf->setValid(true);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "startINDI" ) << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDIShutdown()
+{
+
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "shutdownINDI" )
+ {
+ if (argShutdownINDI->deviceName->text().isEmpty())
+ {
+ sf->setValid(false);
+ return;
+ }
+
+ if (sf->argVal(0) != argShutdownINDI->deviceName->text())
+ setUnsavedChanges( true );
+
+ sf->setArg(0, argShutdownINDI->deviceName->text());
+ sf->setValid(true);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "shutdownINDI" ) << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDISwitchDeviceName()
+{
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "switchINDI" )
+ {
+ if (argSwitchINDI->deviceName->text().isEmpty())
+ {
+ sf->setValid(false);
+ return;
+ }
+
+ if (sf->argVal(0) != argSwitchINDI->deviceName->text())
+ setUnsavedChanges( true );
+
+ sf->setArg(0, argSwitchINDI->deviceName->text());
+ sf->setArg(1, argSwitchINDI->OnButton->isChecked() ? "true" : "false");
+ sf->setValid(true);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "switchdownINDI" ) << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDISwitchDeviceConnection()
+{
+
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "switchINDI" )
+ {
+
+ if (sf->argVal(1) != (argSwitchINDI->OnButton->isChecked() ? "true" : "false"))
+ setUnsavedChanges( true );
+
+ sf->setArg(1, argSwitchINDI->OnButton->isChecked() ? "true" : "false");
+ if (! sf->argVal(0).isEmpty()) sf->setValid(true);
+ else sf->setValid(false);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "switchINDI" ) << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDISetPortDeviceName()
+{
+
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDIPort" )
+ {
+ if (argSetPortINDI->deviceName->text().isEmpty())
+ {
+ sf->setValid(false);
+ return;
+ }
+
+ if (sf->argVal(0) != argSetPortINDI->deviceName->text())
+ setUnsavedChanges( true );
+
+ sf->setArg(0, argSetPortINDI->deviceName->text());
+ if (! sf->argVal(1).isEmpty()) sf->setValid(true);
+ else sf->setValid(false);
+
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDIPort" ) << endl;
+ }
+
+
+}
+
+void ScriptBuilder::slotINDISetPortDevicePort()
+{
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDIPort" )
+ {
+
+ if (argSetPortINDI->devicePort->text().isEmpty())
+ {
+ sf->setValid(false);
+ return;
+ }
+
+ if (sf->argVal(1) != argSetPortINDI->devicePort->text())
+ setUnsavedChanges( true );
+
+ sf->setArg(1, argSetPortINDI->devicePort->text());
+ if (! sf->argVal(0).isEmpty()) sf->setValid(true);
+ else sf->setValid(false);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDIPort" ) << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDISetTargetCoordDeviceName()
+{
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDITargetCoord" )
+ {
+ if (argSetTargetCoordINDI->deviceName->text().isEmpty())
+ {
+ sf->setValid(false);
+ return;
+ }
+
+ if (sf->argVal(0) != argSetTargetCoordINDI->deviceName->text())
+ setUnsavedChanges( true );
+
+ sf->setArg(0, argSetTargetCoordINDI->deviceName->text());
+ if ((! sf->argVal(1).isEmpty()) && (! sf->argVal(2).isEmpty())) sf->setValid(true);
+ else sf->setValid(false);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDITargetCoord" ) << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDISetTargetCoordDeviceRA()
+{
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDITargetCoord" ) {
+ //do nothing if box is blank (because we could be clearing boxes while switcing argWidgets)
+ if ( argSetTargetCoordINDI->RaBox->text().isEmpty() )
+ {
+ sf->setValid(false);
+ return;
+ }
+
+ bool ok(false);
+ dms ra = argSetTargetCoordINDI->RaBox->createDms(false, &ok);
+ if ( ok ) {
+
+ if (sf->argVal(1) != QString( "%1" ).arg( ra.Hours() ))
+ setUnsavedChanges( true );
+
+ sf->setArg( 1, QString( "%1" ).arg( ra.Hours() ) );
+ if ( ( ! sf->argVal(0).isEmpty() ) && ( ! sf->argVal(2).isEmpty() )) sf->setValid( true );
+ else sf->setValid(false);
+
+ } else {
+ sf->setArg( 1, "" );
+ sf->setValid( false );
+ }
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDITargetCoord" ) << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDISetTargetCoordDeviceDEC()
+{
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDITargetCoord" ) {
+ //do nothing if box is blank (because we could be clearing boxes while switcing argWidgets)
+ if ( argSetTargetCoordINDI->DecBox->text().isEmpty() )
+ {
+ sf->setValid(false);
+ return;
+ }
+
+ bool ok(false);
+ dms dec = argSetTargetCoordINDI->DecBox->createDms(true, &ok);
+ if ( ok ) {
+
+ if (sf->argVal(2) != QString( "%1" ).arg( dec.Degrees() ))
+ setUnsavedChanges( true );
+
+ sf->setArg( 2, QString( "%1" ).arg( dec.Degrees() ) );
+ if ( ( ! sf->argVal(0).isEmpty() ) && ( ! sf->argVal(1).isEmpty() )) sf->setValid( true );
+ else sf->setValid(false);
+
+ } else {
+ sf->setArg( 2, "" );
+ sf->setValid( false );
+ }
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDITargetCoord" ) << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDISetTargetNameDeviceName()
+{
+
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDITargetName" )
+ {
+ if (argSetTargetNameINDI->deviceName->text().isEmpty())
+ {
+ sf->setValid(false);
+ return;
+ }
+
+ if (sf->argVal(0) != argSetTargetNameINDI->deviceName->text())
+ setUnsavedChanges( true );
+
+ sf->setArg(0, argSetTargetNameINDI->deviceName->text());
+ if ((! sf->argVal(1).isEmpty())) sf->setValid(true);
+ else sf->setValid(false);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDITargetName" ) << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDISetTargetNameObjectName()
+{
+
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDITargetName" )
+ {
+ if (argSetTargetNameINDI->objectName->text().isEmpty())
+ {
+ sf->setValid(false);
+ return;
+ }
+
+ if (sf->argVal(1) != argSetTargetNameINDI->objectName->text())
+ setUnsavedChanges( true );
+
+ sf->setArg(1, argSetTargetNameINDI->objectName->text());
+ if ((! sf->argVal(0).isEmpty())) sf->setValid(true);
+ else sf->setValid(false);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDITargetName" ) << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDISetActionDeviceName()
+{
+
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDIAction" )
+ {
+ if (argSetActionINDI->deviceName->text().isEmpty())
+ {
+ sf->setValid(false);
+ return;
+ }
+
+ if (sf->argVal(0) != argSetActionINDI->deviceName->text())
+ setUnsavedChanges( true );
+
+ sf->setArg(0, argSetActionINDI->deviceName->text());
+ if ((! sf->argVal(1).isEmpty())) sf->setValid(true);
+ else sf->setValid(false);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDIAction") << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDISetActionName()
+{
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDIAction" )
+ {
+ if (argSetActionINDI->actionName->text().isEmpty())
+ {
+ sf->setValid(false);
+ return;
+ }
+
+ if (sf->argVal(1) != argSetActionINDI->actionName->text())
+ setUnsavedChanges( true );
+
+ sf->setArg(1, argSetActionINDI->actionName->text());
+ if ((! sf->argVal(0).isEmpty())) sf->setValid(true);
+ else sf->setValid(false);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDIAction") << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDIWaitForActionDeviceName()
+{
+
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "waitForINDIAction" )
+ {
+ if (argWaitForActionINDI->deviceName->text().isEmpty())
+ {
+ return;
+ sf->setValid(false);
+ }
+
+ if (sf->argVal(0) != argWaitForActionINDI->deviceName->text())
+ setUnsavedChanges( true );
+
+ sf->setArg(0, argWaitForActionINDI->deviceName->text());
+ if ((! sf->argVal(1).isEmpty())) sf->setValid(true);
+ else sf->setValid(false);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "waitForINDIAction") << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDIWaitForActionName()
+{
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "waitForINDIAction" )
+ {
+ if (argWaitForActionINDI->actionName->text().isEmpty())
+ {
+ sf->setValid(false);
+ return;
+ }
+
+ if (sf->argVal(1) != argWaitForActionINDI->actionName->text())
+ setUnsavedChanges( true );
+
+ sf->setArg(1, argWaitForActionINDI->actionName->text());
+ if ((! sf->argVal(0).isEmpty())) sf->setValid(true);
+ else sf->setValid(false);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "waitForINDIAction") << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDISetFocusSpeedDeviceName()
+{
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDIFocusSpeed" )
+ {
+ if (argSetFocusSpeedINDI->deviceName->text().isEmpty())
+ {
+ sf->setValid(false);
+ return;
+ }
+
+ if (sf->argVal(0) != argSetFocusSpeedINDI->deviceName->text())
+ setUnsavedChanges( true );
+
+ sf->setArg(0, argSetFocusSpeedINDI->deviceName->text());
+ sf->setArg(1, QString("%1").arg(argSetFocusSpeedINDI->speedIN->value()));
+ sf->setValid(true);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDIFocusSpeed") << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDISetFocusSpeed()
+{
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDIFocusSpeed" )
+ {
+
+ if (sf->argVal(1).toInt() != argSetFocusSpeedINDI->speedIN->value())
+ setUnsavedChanges( true );
+
+ sf->setArg(1, QString("%1").arg(argSetFocusSpeedINDI->speedIN->value()));
+ if ((! sf->argVal(0).isEmpty())) sf->setValid(true);
+ else sf->setValid(false);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDIFocusSpeed") << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDIStartFocusDeviceName()
+{
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "startINDIFocus" )
+ {
+ if (argStartFocusINDI->deviceName->text().isEmpty())
+ {
+ sf->setValid(false);
+ return;
+ }
+
+ if (sf->argVal(0) != argStartFocusINDI->deviceName->text())
+ setUnsavedChanges( true );
+
+ sf->setArg(0, argStartFocusINDI->deviceName->text());
+ sf->setArg(1, argStartFocusINDI->directionCombo->currentText());
+ sf->setValid(true);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "StartINDIFocus") << endl;
+ }
+
+}
+
+
+void ScriptBuilder::slotINDIStartFocusDirection()
+{
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "startINDIFocus" )
+ {
+ if (sf->argVal(1) != argStartFocusINDI->directionCombo->currentText())
+ setUnsavedChanges( true );
+
+ sf->setArg(1, argStartFocusINDI->directionCombo->currentText());
+ if ((! sf->argVal(0).isEmpty())) sf->setValid(true);
+ else sf->setValid(false);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "startINDIFocus") << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDISetFocusTimeoutDeviceName()
+{
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDIFocusTimeout" )
+ {
+ if (argSetFocusTimeoutINDI->deviceName->text().isEmpty())
+ {
+ sf->setValid(false);
+ return;
+ }
+
+ if (sf->argVal(0) != argSetFocusTimeoutINDI->deviceName->text())
+ setUnsavedChanges( true );
+
+ sf->setArg(0, argSetFocusTimeoutINDI->deviceName->text());
+ sf->setArg(1, QString("%1").arg(argSetFocusTimeoutINDI->timeOut->value()));
+ sf->setValid(true);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDIFocusTimeout") << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDISetFocusTimeout()
+{
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDIFocusTimeout" )
+ {
+ if (sf->argVal(1).toInt() != argSetFocusTimeoutINDI->timeOut->value())
+ setUnsavedChanges( true );
+
+ sf->setArg(1, QString("%1").arg(argSetFocusTimeoutINDI->timeOut->value()));
+ if (! sf->argVal(0).isEmpty()) sf->setValid(true);
+ else sf->setValid(false);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDIFocusTimeout") << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDISetGeoLocationDeviceName()
+{
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDIGeoLocation" )
+ {
+ if (argSetGeoLocationINDI->deviceName->text().isEmpty())
+ {
+ sf->setValid(false);
+ return;
+ }
+
+ if (sf->argVal(0) != argSetGeoLocationINDI->deviceName->text())
+ setUnsavedChanges( true );
+
+ sf->setArg(0, argSetGeoLocationINDI->deviceName->text());
+ if ((! sf->argVal(1).isEmpty()) && (! sf->argVal(2).isEmpty())) sf->setValid(true);
+ else sf->setValid(false);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDIGeoLocation" ) << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDISetGeoLocationDeviceLong()
+{
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDIGeoLocation" ) {
+ //do nothing if box is blank (because we could be clearing boxes while switcing argWidgets)
+ if ( argSetGeoLocationINDI->longBox->text().isEmpty())
+ {
+ sf->setValid(false);
+ return;
+ }
+
+ bool ok(false);
+ dms longitude = argSetGeoLocationINDI->longBox->createDms(true, &ok);
+ if ( ok ) {
+
+ if (sf->argVal(1) != QString( "%1" ).arg( longitude.Degrees()))
+ setUnsavedChanges( true );
+
+ sf->setArg( 1, QString( "%1" ).arg( longitude.Degrees() ) );
+ if ( ( ! sf->argVal(0).isEmpty() ) && ( ! sf->argVal(2).isEmpty() )) sf->setValid( true );
+ else sf->setValid(false);
+
+ } else {
+ sf->setArg( 1, "" );
+ sf->setValid( false );
+ }
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDIGeoLocation" ) << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDISetGeoLocationDeviceLat()
+{
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDIGeoLocation" ) {
+ //do nothing if box is blank (because we could be clearing boxes while switcing argWidgets)
+ if ( argSetGeoLocationINDI->latBox->text().isEmpty() )
+ {
+ sf->setValid(false);
+ return;
+ }
+
+ bool ok(false);
+ dms latitude = argSetGeoLocationINDI->latBox->createDms(true, &ok);
+ if ( ok ) {
+
+ if (sf->argVal(2) != QString( "%1" ).arg( latitude.Degrees()))
+ setUnsavedChanges( true );
+
+ sf->setArg( 2, QString( "%1" ).arg( latitude.Degrees() ) );
+ if ( ( ! sf->argVal(0).isEmpty() ) && ( ! sf->argVal(1).isEmpty() )) sf->setValid( true );
+ else sf->setValid(false);
+
+ } else {
+ sf->setArg( 2, "" );
+ sf->setValid( false );
+ }
+ } else {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDIGeoLocation" ) << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDIStartExposureDeviceName()
+{
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "startINDIExposure" )
+ {
+ if (argStartExposureINDI->deviceName->text().isEmpty())
+ {
+ sf->setValid(false);
+ return;
+ }
+
+ if (sf->argVal(0) != argStartExposureINDI->deviceName->text())
+ setUnsavedChanges( true );
+
+ sf->setArg(0, argStartExposureINDI->deviceName->text());
+ sf->setArg(1, QString("%1").arg(argStartExposureINDI->timeOut->value()));
+ sf->setValid(true);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "startINDIExposure") << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDIStartExposureTimeout()
+{
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "startINDIExposure" )
+ {
+
+ if (sf->argVal(1).toInt() != argStartExposureINDI->timeOut->value())
+ setUnsavedChanges( true );
+
+ sf->setArg(1, QString("%1").arg(argStartExposureINDI->timeOut->value()));
+ if (! sf->argVal(0).isEmpty()) sf->setValid(true);
+ else sf->setValid(false);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "startINDIExposure") << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDISetUTCDeviceName()
+{
+
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDIUTC" )
+ {
+ if (argSetUTCINDI->deviceName->text().isEmpty())
+ {
+ sf->setValid(false);
+ return;
+ }
+
+ if (sf->argVal(0) != argSetUTCINDI->deviceName->text())
+ setUnsavedChanges( true );
+
+ sf->setArg(0, argSetUTCINDI->deviceName->text());
+ if (! sf->argVal(1).isEmpty()) sf->setValid(true);
+ else sf->setValid(false);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDIUTC" ) << endl;
+ }
+
+
+}
+
+void ScriptBuilder::slotINDISetUTC()
+{
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDIUTC" )
+ {
+
+ if (argSetUTCINDI->UTC->text().isEmpty())
+ {
+ sf->setValid(false);
+ return;
+ }
+
+ if (sf->argVal(1) != argSetUTCINDI->UTC->text())
+ setUnsavedChanges( true );
+
+ sf->setArg(1, argSetUTCINDI->UTC->text());
+ if (! sf->argVal(0).isEmpty()) sf->setValid(true);
+ else sf->setValid(false);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDIUTC" ) << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDISetScopeActionDeviceName()
+{
+
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDIScopeAction" )
+ {
+ if (argSetScopeActionINDI->deviceName->text().isEmpty())
+ {
+ sf->setValid(false);
+ return;
+ }
+
+ if (sf->argVal(0) != argSetScopeActionINDI->deviceName->text())
+ setUnsavedChanges( true );
+
+ sf->setArg(0, argSetScopeActionINDI->deviceName->text());
+ sf->setArg(1, argSetScopeActionINDI->actionCombo->currentText());
+ sf->setINDIProperty("CHECK");
+ sf->setValid(true);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDIScopeAction" ) << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDISetScopeAction()
+{
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDIScopeAction" )
+ {
+
+ if (sf->argVal(1) != argSetScopeActionINDI->actionCombo->currentText())
+ setUnsavedChanges( true );
+
+ sf->setArg(1, argSetScopeActionINDI->actionCombo->currentText());
+ sf->setINDIProperty("CHECK");
+ if ((! sf->argVal(0).isEmpty())) sf->setValid(true);
+ else sf->setValid(false);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDIScopeAction") << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDISetFrameTypeDeviceName()
+{
+
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDIFrameType" )
+ {
+ if (argSetFrameTypeINDI->deviceName->text().isEmpty())
+ {
+ sf->setValid(false);
+ return;
+ }
+
+ if (sf->argVal(0) != argSetFrameTypeINDI->deviceName->text())
+ setUnsavedChanges( true );
+
+ sf->setArg(0, argSetFrameTypeINDI->deviceName->text());
+ sf->setArg(1, argSetFrameTypeINDI->typeCombo->currentText());
+ sf->setValid(true);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDIFrameType" ) << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDISetFrameType()
+{
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDIFrameType" )
+ {
+
+ if (sf->argVal(1) != argSetFrameTypeINDI->typeCombo->currentText())
+ setUnsavedChanges( true );
+
+ sf->setArg(1, argSetFrameTypeINDI->typeCombo->currentText());
+ if ((! sf->argVal(0).isEmpty())) sf->setValid(true);
+ else sf->setValid(false);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDIFrameType") << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDISetCCDTempDeviceName()
+{
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDICCDTemp" )
+ {
+ if (argSetCCDTempINDI->deviceName->text().isEmpty())
+ {
+ sf->setValid(false);
+ return;
+ }
+
+ if (sf->argVal(0) != argSetCCDTempINDI->deviceName->text())
+ setUnsavedChanges( true );
+
+ sf->setArg(0, argSetCCDTempINDI->deviceName->text());
+ sf->setArg(1, QString("%1").arg(argSetCCDTempINDI->temp->value()));
+ sf->setValid(true);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDICCDTemp") << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDISetCCDTemp()
+{
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDICCDTemp" )
+ {
+
+ if (sf->argVal(1).toInt() != argSetCCDTempINDI->temp->value())
+ setUnsavedChanges( true );
+
+ sf->setArg(1, QString("%1").arg(argSetCCDTempINDI->temp->value()));
+ if (! sf->argVal(0).isEmpty()) sf->setValid(true);
+ else sf->setValid(false);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDICCDTemp") << endl;
+ }
+
+}
+
+void ScriptBuilder::slotINDISetFilterNumDeviceName()
+{
+
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDIFilterNum" )
+ {
+ if (argSetFilterNumINDI->deviceName->text().isEmpty())
+ {
+ sf->setValid(false);
+ return;
+ }
+
+ if (sf->argVal(0) != argSetFilterNumINDI->deviceName->text())
+ setUnsavedChanges( true );
+
+ sf->setArg(0, argSetFilterNumINDI->deviceName->text());
+ sf->setArg(1, QString("%1").arg(argSetFilterNumINDI->filter_num->value()));
+ sf->setValid(true);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDIFilterNum") << endl;
+ }
+}
+
+void ScriptBuilder::slotINDISetFilterNum()
+{
+
+ ScriptFunction *sf = ScriptList.at( sb->ScriptListBox->currentItem() );
+
+ if ( sf->name() == "setINDIFilterNum" )
+ {
+
+ if (sf->argVal(1).toInt() != argSetFilterNumINDI->filter_num->value())
+ setUnsavedChanges( true );
+
+ sf->setArg(1, QString("%1").arg(argSetFilterNumINDI->filter_num->value()));
+ if (! sf->argVal(0).isEmpty()) sf->setValid(true);
+ else sf->setValid(false);
+ }
+ else
+ {
+ kdWarning() << i18n( "Mismatch between function and Arg widget (expected %1.)" ).arg( "setINDIFilterNum") << endl;
+ }
+
+
+}
+
+#include "scriptbuilder.moc"
diff --git a/kstars/kstars/tools/scriptbuilder.h b/kstars/kstars/tools/scriptbuilder.h
new file mode 100644
index 00000000..7b78bc1c
--- /dev/null
+++ b/kstars/kstars/tools/scriptbuilder.h
@@ -0,0 +1,224 @@
+/***************************************************************************
+ scriptbuilder.h - description
+ -------------------
+ begin : Thu Apr 17 2003
+ copyright : (C) 2003 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 SCRIPTBUILDER_H
+#define SCRIPTBUILDER_H
+
+class KStars;
+class QListViewItem;
+class QWidget;
+class QLayout;
+class KURL;
+class ScriptFunction;
+class ScriptBuilderUI;
+class ScriptNameDialog;
+class OptionsTreeView;
+class ArgLookToward;
+class ArgSetRaDec;
+class ArgSetAltAz;
+class ArgSetLocalTime;
+class ArgWaitFor;
+class ArgWaitForKey;
+class ArgSetTrack;
+class ArgChangeViewOption;
+class ArgSetGeoLocation;
+class ArgTimeScale;
+class ArgZoom;
+class ArgExportImage;
+class ArgPrintImage;
+class ArgSetColor;
+class ArgLoadColorScheme;
+class ArgStartINDI;
+class ArgShutdownINDI;
+class ArgSwitchINDI;
+class ArgSetPortINDI;
+class ArgSetTargetCoordINDI;
+class ArgSetTargetNameINDI;
+class ArgSetActionINDI;
+class ArgSetFocusSpeedINDI;
+class ArgStartFocusINDI;
+class ArgSetFocusTimeoutINDI;
+class ArgSetGeoLocationINDI;
+class ArgStartExposureINDI;
+class ArgSetUTCINDI;
+class ArgSetScopeActionINDI;
+class ArgSetFrameTypeINDI;
+class ArgSetCCDTempINDI;
+class ArgSetFilterNumINDI;
+
+/**@class ScriptBuilder
+ *A GUI tool for building behavioral DCOP scripts for KStars.
+ *@author Jason Harris
+ *@version 1.0
+ */
+class ScriptBuilder : public KDialogBase
+{
+Q_OBJECT
+public:
+ ScriptBuilder( QWidget *parent, const char *name=0 );
+ ~ScriptBuilder();
+
+ bool unsavedChanges() const { return UnsavedChanges; }
+ void setUnsavedChanges( bool b=true );
+ void saveWarning();
+ void readScript( QTextStream &istream );
+ void writeScript( QTextStream &ostream );
+ bool parseFunction( QStringList &fn );
+
+public slots:
+ void slotAddFunction();
+ void slotMoveFunctionUp();
+ void slotMoveFunctionDown();
+ void slotArgWidget();
+ void slotShowDoc();
+
+ void slotNew();
+ void slotOpen();
+ void slotSave();
+ void slotSaveAs();
+ void slotRunScript();
+ void slotClose();
+
+ void slotCopyFunction();
+ void slotRemoveFunction();
+
+ void slotFindCity();
+ void slotFindObject();
+ void slotShowOptions();
+ void slotLookToward();
+ void slotRa();
+ void slotDec();
+ void slotAz();
+ void slotAlt();
+ void slotChangeDate();
+ void slotChangeTime();
+ void slotWaitFor();
+ void slotWaitForKey();
+ void slotTracking();
+ void slotViewOption();
+ void slotChangeCity();
+ void slotChangeProvince();
+ void slotChangeCountry();
+ void slotTimeScale();
+ void slotZoom();
+ void slotExportImage();
+ void slotPrintImage();
+ void slotChangeColor();
+ void slotChangeColorName();
+ void slotLoadColorScheme(QListBoxItem*);
+
+ void slotEnableScriptNameOK();
+
+ void slotINDIWaitCheck(bool toggleState);
+ void slotINDIFindObject();
+ void slotINDIStartDeviceName();
+ void slotINDIStartDeviceMode();
+ void slotINDIShutdown();
+ void slotINDISwitchDeviceName();
+ void slotINDISwitchDeviceConnection();
+ void slotINDISetPortDeviceName();
+ void slotINDISetPortDevicePort();
+ void slotINDISetTargetCoordDeviceName();
+ void slotINDISetTargetCoordDeviceRA();
+ void slotINDISetTargetCoordDeviceDEC();
+ void slotINDISetTargetNameDeviceName();
+ void slotINDISetTargetNameObjectName();
+ void slotINDISetActionDeviceName();
+ void slotINDISetActionName();
+ void slotINDIWaitForActionDeviceName();
+ void slotINDIWaitForActionName();
+ void slotINDISetFocusSpeedDeviceName();
+ void slotINDISetFocusSpeed();
+ void slotINDIStartFocusDeviceName();
+ void slotINDIStartFocusDirection();
+ void slotINDISetFocusTimeoutDeviceName();
+ void slotINDISetFocusTimeout();
+ void slotINDISetGeoLocationDeviceName();
+ void slotINDISetGeoLocationDeviceLong();
+ void slotINDISetGeoLocationDeviceLat();
+ void slotINDIStartExposureDeviceName();
+ void slotINDIStartExposureTimeout();
+ void slotINDISetUTCDeviceName();
+ void slotINDISetUTC();
+ void slotINDISetScopeActionDeviceName();
+ void slotINDISetScopeAction();
+ void slotINDISetFrameTypeDeviceName();
+ void slotINDISetFrameType();
+ void slotINDISetCCDTempDeviceName();
+ void slotINDISetCCDTemp();
+ void slotINDISetFilterNumDeviceName();
+ void slotINDISetFilterNum();
+
+private:
+ void initViewOptions();
+
+ ScriptBuilderUI *sb;
+
+ KStars *ks; //parent needed for sub-dialogs
+ QPtrList<ScriptFunction> KStarsFunctionList;
+ QPtrList<ScriptFunction> INDIFunctionList;
+ QPtrList<ScriptFunction> ScriptList;
+ QVBoxLayout *vlay;
+
+ QWidget *argBlank;
+ ArgLookToward *argLookToward;
+ ArgSetRaDec *argSetRaDec;
+ ArgSetAltAz *argSetAltAz;
+ ArgSetLocalTime *argSetLocalTime;
+ ArgWaitFor *argWaitFor;
+ ArgWaitForKey *argWaitForKey;
+ ArgSetTrack *argSetTracking;
+ ArgChangeViewOption *argChangeViewOption;
+ ArgSetGeoLocation *argSetGeoLocation;
+ ArgTimeScale *argTimeScale;
+ ArgZoom *argZoom;
+ ArgExportImage *argExportImage;
+ ArgPrintImage *argPrintImage;
+ ArgSetColor *argSetColor;
+ ArgLoadColorScheme *argLoadColorScheme;
+ ArgStartINDI *argStartINDI;
+ ArgShutdownINDI *argShutdownINDI;
+ ArgSwitchINDI *argSwitchINDI;
+ ArgSetPortINDI *argSetPortINDI;
+ ArgSetTargetCoordINDI *argSetTargetCoordINDI;
+ ArgSetTargetNameINDI *argSetTargetNameINDI;
+ ArgSetActionINDI *argSetActionINDI;
+ ArgSetActionINDI *argWaitForActionINDI;
+ ArgSetFocusSpeedINDI *argSetFocusSpeedINDI;
+ ArgStartFocusINDI *argStartFocusINDI;
+ ArgSetFocusTimeoutINDI *argSetFocusTimeoutINDI;
+ ArgSetGeoLocationINDI *argSetGeoLocationINDI;
+ ArgStartExposureINDI *argStartExposureINDI;
+ ArgSetUTCINDI *argSetUTCINDI;
+ ArgSetScopeActionINDI *argSetScopeActionINDI;
+ ArgSetFrameTypeINDI *argSetFrameTypeINDI;
+ ArgSetCCDTempINDI *argSetCCDTempINDI;
+ ArgSetFilterNumINDI *argSetFilterNumINDI;
+
+ ScriptNameDialog *snd;
+ OptionsTreeView *otv;
+
+ QListViewItem *opsGUI, *opsToolbar, *opsShowObj, *opsShowOther, *opsCName, *opsHide, *opsSkymap, *opsLimit;
+
+ bool UnsavedChanges;
+ KURL currentFileURL;
+ QString currentDir;
+ QString currentScriptName, currentAuthor;
+ QString lastINDIDeviceName;
+};
+
+#endif
diff --git a/kstars/kstars/tools/scriptbuilderui.ui b/kstars/kstars/tools/scriptbuilderui.ui
new file mode 100644
index 00000000..9de4797f
--- /dev/null
+++ b/kstars/kstars/tools/scriptbuilderui.ui
@@ -0,0 +1,646 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ScriptBuilderUI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ScriptBuilderUI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>708</width>
+ <height>791</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Script Builder</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>NewButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>New Script</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Discards current script and starts a new one. Will prompt to save any unsaved changes in the current script.</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>OpenButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Open Script</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Opens an existing script. Will prompt to save any unsaved changes in the current script.</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>SaveButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Save Script</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Save the current script. If the script has not been saved before, this is equivalent to "Save As..."</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>SaveAsButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Save Script As...</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Saves the script to a file, allowing you to first specify the filename and a name for the script.</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>RunButton</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Test Script</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Executes the script in the KStars main window. You may want to reposition the Script Builder tool so that the Sky map is visible. </string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>490</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QSplitter" row="1" column="0">
+ <property name="name">
+ <cstring>splitter1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>GroupBoxPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="title">
+ <string>Current Script</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KListBox">
+ <property name="name">
+ <cstring>ScriptListBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="currentItem">
+ <number>-1</number>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>This shows the list of commands present in the current working script. Highlighting any command will present a widget where you can specify its arguments below. Use the action buttons at right to copy, remove, or change the position of the selected command. </string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>AddButton</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Add Function</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If a function is highlighted in the "Function Browser" box, this button will add it to the current working script. The new function is inserted directly after the highlighted function in the "Current Script" box.
+</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>RemoveButton</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Remove Function</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If a function is highlighted in the "Current Script" box, this button will remove it from the script.</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>CopyButton</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Copy Function</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If a function is highlighted in the "Current Script" box, this button will add a duplicate of the function.</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>UpButton</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Move Up</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If a function is highlighted in the "Current Script" box, this button will move it up one position in the script.</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>DownButton</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Move Down</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If a function is highlighted in the "Current Script" box, this button will move it down one position in the script.</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>118</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>FuncArgBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>140</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Function Arguments</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QWidgetStack">
+ <property name="name">
+ <cstring>ArgStack</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>page</cstring>
+ </property>
+ <attribute name="id">
+ <number>0</number>
+ </attribute>
+ </widget>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>FunctionBrowser</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>GroupBoxPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="title">
+ <string>Function Browser</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QSplitter">
+ <property name="name">
+ <cstring>splitter7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <widget class="KListView">
+ <property name="name">
+ <cstring>FunctionListView</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>2</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="rootIsDecorated">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="KTextEdit">
+ <property name="name">
+ <cstring>FuncDoc</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Function Help</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If a function is highlighted in the Function Browser, this area will show some brief documentation about the function.</string>
+ </property>
+ </widget>
+ </widget>
+ </vbox>
+ </widget>
+ </widget>
+ <widget class="QLayoutWidget" row="2" column="0">
+ <property name="name">
+ <cstring>layout11</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout10</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>AppendINDIWait</cstring>
+ </property>
+ <property name="text">
+ <string>Append WaitForINDIAction after any INDI action</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>ReuseINDIDeviceName</cstring>
+ </property>
+ <property name="text">
+ <string>Reuse INDI device name</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>91</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </grid>
+</widget>
+<slots>
+ <slot>slotAddFunction()</slot>
+ <slot>slotMoveFunctionUp()</slot>
+ <slot>slotMoveFunctionDown()</slot>
+ <slot>slotShowDoc()</slot>
+ <slot>slotArgWidget()</slot>
+ <slot>slotNew()</slot>
+ <slot>slotOpen()</slot>
+ <slot>slotSave()</slot>
+ <slot>slotSaveAs()</slot>
+ <slot>slotCopyFunction()</slot>
+ <slot>slotRemoveFunction()</slot>
+ <slot>slotRunScript()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="4"/>
+<includehints>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klistbox.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klistview.h</includehint>
+ <includehint>ktextedit.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/scriptfunction.cpp b/kstars/kstars/tools/scriptfunction.cpp
new file mode 100644
index 00000000..d87942ee
--- /dev/null
+++ b/kstars/kstars/tools/scriptfunction.cpp
@@ -0,0 +1,218 @@
+/***************************************************************************
+ scriptfunction.cpp - description
+ -------------------
+ begin : Thu Apr 17 2003
+ copyright : (C) 2003 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. *
+ * *
+ ***************************************************************************/
+
+#include <kdebug.h>
+
+#include "scriptfunction.h"
+
+
+ScriptFunction::ScriptFunction( QString name, QString desc, bool clockfcn,
+ QString at1, QString an1, QString at2, QString an2, QString at3, QString an3,
+ QString at4, QString an4, QString at5, QString an5, QString at6, QString an6 ) : INDIProp("") {
+ Name = name;
+ ClockFunction = clockfcn;
+
+ ArgType[0] = at1; ArgName[0] = an1;
+ ArgType[1] = at2; ArgName[1] = an2;
+ ArgType[2] = at3; ArgName[2] = an3;
+ ArgType[3] = at4; ArgName[3] = an4;
+ ArgType[4] = at5; ArgName[4] = an5;
+ ArgType[5] = at6; ArgName[5] = an6;
+
+ //Construct a richtext description of the function
+ QString nameStyle = "<span style=\"font-family:monospace;font-weight:600\">%1</span>"; //bold
+ QString typeStyle = "<span style=\"font-family:monospace;color:#009d00\">%1</span>"; //green
+ QString paramStyle = "<span style=\"font-family:monospace;color:#00007f\">%1</span>"; //blue
+
+ Description = "<html><head><meta name=\"qrichtext\" content=\"1\" /></head>";
+ Description += "<body style=\"font-size:11pt;font-family:sans\">";
+ Description += "<p>" + nameStyle.arg( Name + "(" );
+
+ NumArgs = 0;
+ if ( ! at1.isEmpty() && ! an1.isEmpty() ) {
+ Description += " " + typeStyle.arg( at1 );
+ Description += " " + paramStyle.arg( an1 );
+ NumArgs++;
+ }
+
+ if ( ! at2.isEmpty() && ! an2.isEmpty() ) {
+ Description += ", " + typeStyle.arg( at2 );
+ Description += " " + paramStyle.arg( an2 );
+ NumArgs++;
+ }
+
+ if ( ! at3.isEmpty() && ! an3.isEmpty() ) {
+ Description += ", " + typeStyle.arg( at3 );
+ Description += " " + paramStyle.arg( an3 );
+ NumArgs++;
+ }
+
+ if ( ! at4.isEmpty() && ! an4.isEmpty() ) {
+ Description += ", " + typeStyle.arg( at4 );
+ Description += " " + paramStyle.arg( an4 );
+ NumArgs++;
+ }
+
+ if ( ! at5.isEmpty() && ! an5.isEmpty() ) {
+ Description += ", " + typeStyle.arg( at5 );
+ Description += " " + paramStyle.arg( an5 );
+ NumArgs++;
+ }
+
+ if ( ! at6.isEmpty() && ! an6.isEmpty() ) {
+ Description += ", " + typeStyle.arg( at6 );
+ Description += " " + paramStyle.arg( an6 );
+ NumArgs++;
+ }
+
+ //Set Valid=false if there are arguments (indicates that this fcn's args must be filled in)
+ Valid = true;
+ if ( NumArgs ) Valid = false;
+
+ //Finish writing function prototype
+ if ( NumArgs ) Description += " ";
+ Description += nameStyle.arg( ")" ) + "</p><p>";
+
+ //before adding description, replace any '%n' instances with the corresponding
+ //argument name in color. For now, assume that the %n's occur in order, with no skips.
+ //Also assume that '%' is *only* used to indicate argument instances
+ int narg = desc.contains( '%' );
+ switch (narg ) {
+ case 1:
+ Description += desc.arg( paramStyle.arg( an1 ) );
+ break;
+ case 2:
+ Description +=
+ desc.arg( paramStyle.arg( an1 ) )
+ .arg( paramStyle.arg( an2 ) );
+ break;
+ case 3:
+ Description +=
+ desc.arg( paramStyle.arg( an1 ) )
+ .arg( paramStyle.arg( an2 ) )
+ .arg( paramStyle.arg( an3 ) );
+ break;
+ case 4:
+ Description +=
+ desc.arg( paramStyle.arg( an1 ) )
+ .arg( paramStyle.arg( an2 ) )
+ .arg( paramStyle.arg( an3 ) )
+ .arg( paramStyle.arg( an4 ) );
+ break;
+ case 5:
+ Description +=
+ desc.arg( paramStyle.arg( an1 ) )
+ .arg( paramStyle.arg( an2 ) )
+ .arg( paramStyle.arg( an3 ) )
+ .arg( paramStyle.arg( an4 ) )
+ .arg( paramStyle.arg( an5 ) );
+ break;
+ case 6:
+ Description +=
+ desc.arg( paramStyle.arg( an1 ) )
+ .arg( paramStyle.arg( an2 ) )
+ .arg( paramStyle.arg( an3 ) )
+ .arg( paramStyle.arg( an4 ) )
+ .arg( paramStyle.arg( an5 ) )
+ .arg( paramStyle.arg( an6 ) );
+ break;
+ default:
+ Description += desc;
+ break;
+ }
+
+ //Finish up
+ Description += "</p></body></html>";
+}
+
+//Copy constructor
+ScriptFunction::ScriptFunction( ScriptFunction *sf )
+{
+ Name = sf->name();
+ Description = sf->description();
+ ClockFunction = sf->isClockFunction();
+ NumArgs = sf->numArgs();
+ INDIProp = sf->INDIProperty();
+ Valid = sf->valid();
+
+ for ( unsigned int i=0; i<6; i++ ) {
+ ArgType[i] = sf->argType(i);
+ ArgName[i] = sf->argName(i);
+ ArgVal[i] = "";
+ }
+}
+
+ScriptFunction::~ScriptFunction()
+{
+}
+
+QString ScriptFunction::prototype() const {
+ QString p = Name + "(";
+
+ bool args( false );
+ if ( ! ArgType[0].isEmpty() && ! ArgName[0].isEmpty() ) {
+ p += " " + ArgType[0];
+ p += " " + ArgName[0];
+ args = true; //assume that if any args are present, 1st arg is present
+ }
+
+ if ( ! ArgType[1].isEmpty() && ! ArgName[1].isEmpty() ) {
+ p += ", " + ArgType[1];
+ p += " " + ArgName[1];
+ }
+
+ if ( ! ArgType[2].isEmpty() && ! ArgName[2].isEmpty() ) {
+ p += ", " + ArgType[2];
+ p += " " + ArgName[2];
+ }
+
+ if ( ! ArgType[3].isEmpty() && ! ArgName[3].isEmpty() ) {
+ p += ", " + ArgType[3];
+ p += " " + ArgName[3];
+ }
+
+ if ( ! ArgType[4].isEmpty() && ! ArgName[4].isEmpty() ) {
+ p += ", " + ArgType[4];
+ p += " " + ArgName[4];
+ }
+
+ if ( ! ArgType[5].isEmpty() && ! ArgName[5].isEmpty() ) {
+ p += ", " + ArgType[5];
+ p += " " + ArgName[5];
+ }
+
+ if ( args ) p += " ";
+ p += ")";
+
+ return p;
+}
+
+QString ScriptFunction::scriptLine() const {
+ QString out( Name );
+ unsigned int i=0;
+ while ( ! ArgName[i].isEmpty() && i < 6 ) {
+ // Wrap arg in quotes if it contains a space
+ if ( ArgVal[i].contains(" ") ) {
+ out += " \"" + ArgVal[i] + "\"";
+ } else {
+ out += " " + ArgVal[i];
+ }
+ ++i;
+ }
+
+ return out;
+}
diff --git a/kstars/kstars/tools/scriptfunction.h b/kstars/kstars/tools/scriptfunction.h
new file mode 100644
index 00000000..abb63707
--- /dev/null
+++ b/kstars/kstars/tools/scriptfunction.h
@@ -0,0 +1,73 @@
+/***************************************************************************
+ scriptfunction.h - description
+ -------------------
+ begin : Thu Apr 17 2003
+ copyright : (C) 2003 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 SCRIPTFUNCTION_H
+#define SCRIPTFUNCTION_H
+
+#include <qstring.h>
+
+/**
+ *
+ * Jason Harris
+ **/
+class ScriptFunction
+{
+public:
+ ScriptFunction( QString name, QString desc, bool clockfcn=false,
+ QString at1="", QString an1="",
+ QString at2="", QString an2="",
+ QString at3="", QString an3="",
+ QString at4="", QString an4="",
+ QString at5="", QString an5="",
+ QString at6="", QString an6=""
+ );
+ ScriptFunction( ScriptFunction *sf );
+ ~ScriptFunction();
+
+ QString name() const { return Name; }
+ QString prototype() const;
+ QString description() const { return Description; }
+ QString argType( unsigned int n ) const { return ArgType[n]; }
+ QString argName( unsigned int n ) const { return ArgName[n]; }
+ QString argVal( unsigned int n ) const { return ArgVal[n]; }
+
+ void setValid( bool b ) { Valid = b; }
+ bool valid() const { return Valid; }
+
+ void setClockFunction( bool b=true ) { ClockFunction = b; }
+ bool isClockFunction() const { return ClockFunction; }
+
+ void setArg( unsigned int n, QString newVal ) { ArgVal[n] = newVal; }
+ bool checkArgs();
+ unsigned int numArgs() const { return NumArgs; }
+
+ QString scriptLine() const;
+
+ void setINDIProperty(QString prop) { INDIProp = prop; }
+ QString INDIProperty() const { return INDIProp; }
+
+private:
+ QString Name, Description;
+ QString ArgType[6];
+ QString ArgName[6];
+ QString ArgVal[6];
+ QString INDIProp;
+ bool Valid, ClockFunction;
+ unsigned int NumArgs;
+};
+
+#endif
diff --git a/kstars/kstars/tools/scriptnamedialog.ui b/kstars/kstars/tools/scriptnamedialog.ui
new file mode 100644
index 00000000..bc493ad3
--- /dev/null
+++ b/kstars/kstars/tools/scriptnamedialog.ui
@@ -0,0 +1,157 @@
+<!DOCTYPE UI><UI version="3.1.2" stdsetdef="1">
+<class>ScriptNameDialog</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>ScriptNameDialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>403</width>
+ <height>143</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Enter Name for Script</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>ScriptName</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Enter name for the script</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Enter a name for the script. This is not the file name, just a short descriptive line of text.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="text">
+ <string>Script name:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Author:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>AuthorName</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Enter author's name</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>330</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>OKButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>CancelButton</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Press Ok to accept the script name and author name, and open the Save File Dialog.</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>OKButton</sender>
+ <signal>clicked()</signal>
+ <receiver>ScriptNameDialog</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>CancelButton</sender>
+ <signal>clicked()</signal>
+ <receiver>ScriptNameDialog</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/kstars/kstars/tools/wutdialog.cpp b/kstars/kstars/tools/wutdialog.cpp
new file mode 100644
index 00000000..b046a550
--- /dev/null
+++ b/kstars/kstars/tools/wutdialog.cpp
@@ -0,0 +1,444 @@
+/***************************************************************************
+ wutdialog.cpp - K Desktop Planetarium
+ -------------------
+ begin : Die Feb 25 2003
+ copyright : (C) 2003 by Thomas Kabelmann
+ email : tk78@gmx.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "wutdialog.h"
+#include "wutdialogui.h"
+
+#include "kstars.h"
+#include "kstarsdata.h"
+#include "skymap.h"
+#include "ksnumbers.h"
+#include "skyobjectname.h"
+#include "objectnamelist.h"
+#include "simclock.h"
+#include "detaildialog.h"
+#include "locationdialog.h"
+#include "timedialog.h"
+#include "kssun.h"
+#include "ksmoon.h"
+
+#include <kcombobox.h>
+#include <klocale.h>
+#include <klistbox.h>
+#include <kpushbutton.h>
+
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qframe.h>
+#include <qtabbar.h>
+#include <qtimer.h>
+#include <qcursor.h>
+
+WUTDialog::WUTDialog(KStars *ks) :
+ KDialogBase (KDialogBase::Plain, i18n("What's up Tonight"), Close, Close, (QWidget*)ks),
+ kstars(ks), EveningFlag(0) {
+
+ QFrame *page = plainPage();
+ setMainWidget(page);
+ QVBoxLayout *vlay = new QVBoxLayout( page, 0, spacingHint() );
+ WUT = new WUTDialogUI( page );
+ vlay->addWidget( WUT );
+
+ objectList = &(ks->data()->ObjNames);
+// objectList->setLanguage( Options::useLatinConstellNames() );
+
+ //initialize location and date to current KStars settings:
+ geo = kstars->geo();
+
+ T0 = kstars->data()->lt();
+ //If the Time is earlier than 6:00 am, assume the user wants the night of the previous date
+ if ( T0.time().hour() < 6 )
+ T0 = T0.addDays( -1 );
+
+ //Now, set time T0 to midnight (of the following day)
+ T0.setTime( QTime( 0, 0, 0 ) );
+ T0 = T0.addDays( 1 );
+ UT0 = geo->LTtoUT( T0 );
+
+ //Set the Tomorrow date/time to Noon the following day
+ Tomorrow = T0.addSecs( 12*3600 );
+ TomorrowUT = geo->LTtoUT( Tomorrow );
+
+ //Set the Evening date/time to 6:00 pm
+ Evening = T0.addSecs( -6*3600 );
+ EveningUT = geo->LTtoUT( Evening );
+
+ QString sGeo = geo->translatedName();
+ if ( ! geo->translatedProvince().isEmpty() ) sGeo += ", " + geo->translatedProvince();
+ sGeo += ", " + geo->translatedCountry();
+ WUT->LocationLabel->setText( i18n( "at %1" ).arg( sGeo ) );
+ WUT->DateLabel->setText( i18n( "The night of %1" ).arg( Evening.date().toString( Qt::LocalDate ) ) );
+
+ initCategories();
+
+ makeConnections();
+
+ QTimer::singleShot(0, this, SLOT(init()));
+}
+
+WUTDialog::~WUTDialog(){
+}
+
+void WUTDialog::makeConnections() {
+ connect( WUT->DateButton, SIGNAL( clicked() ), SLOT( slotChangeDate() ) );
+ connect( WUT->LocationButton, SIGNAL( clicked() ), SLOT( slotChangeLocation() ) );
+ connect( WUT->CenterButton, SIGNAL( clicked() ), SLOT( slotCenter() ) );
+ connect( WUT->DetailButton, SIGNAL( clicked() ), SLOT( slotDetails() ) );
+ connect( WUT->CategoryListBox, SIGNAL( highlighted(int) ), SLOT( slotLoadList(int) ) );
+ connect( WUT->ObjectListBox, SIGNAL( selectionChanged(QListBoxItem*) ),
+ SLOT( slotDisplayObject(QListBoxItem*) ) );
+ connect( WUT->EveningMorningBox, SIGNAL( activated(int) ), SLOT( slotEveningMorning(int) ) );
+}
+
+void WUTDialog::initCategories() {
+ WUT->CategoryListBox->insertItem( i18n( "Planets" ) );
+ WUT->CategoryListBox->insertItem( i18n( "Comets" ) );
+ WUT->CategoryListBox->insertItem( i18n( "Asteroids" ) );
+ WUT->CategoryListBox->insertItem( i18n( "Stars" ) );
+ WUT->CategoryListBox->insertItem( i18n( "Constellations" ) );
+ WUT->CategoryListBox->insertItem( i18n( "Star Clusters" ) );
+ WUT->CategoryListBox->insertItem( i18n( "Nebulae" ) );
+ WUT->CategoryListBox->insertItem( i18n( "Galaxies" ) );
+ WUT->CategoryListBox->setSelected(0, true);
+}
+
+void WUTDialog::init() {
+ QString sRise, sSet, sDuration;
+
+ // reset all lists
+ for (int i=0; i<NCATEGORY; i++) {
+ lists.visibleList[i].clear();
+ lists.initialized[i] = false;
+ }
+
+ // sun almanac information
+ KSSun *oSun = (KSSun*) kstars->data()->PCat->planetSun();
+ sunRiseTomorrow = oSun->riseSetTime( TomorrowUT, geo, true );
+ sunSetToday = oSun->riseSetTime( EveningUT, geo, false );
+ sunRiseToday = oSun->riseSetTime( EveningUT, geo, true );
+
+ //check to see if Sun is circumpolar
+ KSNumbers *num = new KSNumbers( UT0.djd() );
+ KSNumbers *oldNum = new KSNumbers( kstars->data()->ut().djd() );
+ dms LST = geo->GSTtoLST( T0.gst() );
+
+ oSun->updateCoords( num, true, geo->lat(), &LST );
+ if ( oSun->checkCircumpolar( geo->lat() ) ) {
+ if ( oSun->alt()->Degrees() > 0.0 ) {
+ sRise = i18n( "circumpolar" );
+ sSet = i18n( "circumpolar" );
+ sDuration = "00:00";
+ } else {
+ sRise = i18n( "does not rise" );
+ sSet = i18n( "does not rise" );
+ sDuration = "24:00";
+ }
+ } else {
+ //Round times to the nearest minute by adding 30 seconds to the time
+ sRise = sunRiseTomorrow.addSecs(30).toString("hh:mm");
+ sSet = sunSetToday.addSecs(30).toString("hh:mm");
+
+ float Dur = 24.0 + (float)sunRiseTomorrow.hour()
+ + (float)sunRiseTomorrow.minute()/60.0
+ + (float)sunRiseTomorrow.second()/3600.0
+ - (float)sunSetToday.hour()
+ - (float)sunSetToday.minute()/60.0
+ - (float)sunSetToday.second()/3600.0;
+ int hDur = int(Dur);
+ int mDur = int(60.0*(Dur - (float)hDur));
+ sDuration = QString().sprintf( "%02d:%02d", hDur, mDur );
+ }
+
+ WUT->SunSetLabel->setText( i18n( "Sunset: %1" ).arg(sSet) );
+ WUT->SunRiseLabel->setText( i18n( "Sunrise: %1" ).arg(sRise) );
+ WUT->NightDurationLabel->setText( i18n( "Night duration: %1 hours" ).arg( sDuration ) );
+
+ // moon almanac information
+ KSMoon *oMoon = (KSMoon*) kstars->data()->Moon;
+ moonRise = oMoon->riseSetTime( UT0, geo, true );
+ moonSet = oMoon->riseSetTime( UT0, geo, false );
+
+ //check to see if Moon is circumpolar
+ oMoon->updateCoords( num, true, geo->lat(), &LST );
+ if ( oMoon->checkCircumpolar( geo->lat() ) ) {
+ if ( oMoon->alt()->Degrees() > 0.0 ) {
+ sRise = i18n( "circumpolar" );
+ sSet = i18n( "circumpolar" );
+ } else {
+ sRise = i18n( "does not rise" );
+ sSet = i18n( "does not rise" );
+ }
+ } else {
+ //Round times to the nearest minute by adding 30 seconds to the time
+ sRise = moonRise.addSecs(30).toString("hh:mm");
+ sSet = moonSet.addSecs(30).toString("hh:mm");
+ }
+
+ WUT->MoonRiseLabel->setText( i18n( "Moon rises at: %1" ).arg( sRise ) );
+ WUT->MoonSetLabel->setText( i18n( "Moon sets at: %1" ).arg( sSet ) );
+ oMoon->findPhase( oSun );
+ WUT->MoonIllumLabel->setText( oMoon->phaseName() + QString( " (%1%)" ).arg(
+ int(100.0*oMoon->illum() ) ) );
+
+ //Restore Sun's and Moon's coordinates, and recompute Moon's original Phase
+ oMoon->updateCoords( oldNum, true, geo->lat(), kstars->LST() );
+ oSun->updateCoords( oldNum, true, geo->lat(), kstars->LST() );
+ oMoon->findPhase( oSun );
+
+ splitObjectList();
+ // load first list
+ slotLoadList(0);
+
+ delete num;
+ delete oldNum;
+}
+
+void WUTDialog::splitObjectList() {
+ // don't append objects which are never visible
+ for (SkyObjectName *oname=objectList->first(); oname; oname=objectList->next()) {
+ bool visible = true;
+ SkyObject *o = oname->skyObject();
+ // is object circumpolar or never visible
+ if (o->checkCircumpolar(geo->lat()) == true) {
+ // never visible
+ if (o->alt()->Degrees() <= 0) visible = false;
+ }
+ if (visible == true) appendToList(oname);
+ }
+}
+
+void WUTDialog::appendToList(SkyObjectName *o) {
+ // split into several lists
+ switch (o->skyObject()->type()) {
+ //case SkyObject::CATALOG_STAR : //Omitting CATALOG_STARs from list
+ case SkyObject::PLANET : lists.visibleList[0].append(o); break;
+ case SkyObject::COMET : lists.visibleList[1].append(o); break;
+ case SkyObject::ASTEROID : lists.visibleList[2].append(o); break;
+ case SkyObject::STAR : lists.visibleList[3].append(o); break;
+ case SkyObject::CONSTELLATION : lists.visibleList[4].append(o); break;
+ case SkyObject::OPEN_CLUSTER :
+ case SkyObject::GLOBULAR_CLUSTER : lists.visibleList[5].append(o); break;
+ case SkyObject::GASEOUS_NEBULA :
+ case SkyObject::PLANETARY_NEBULA :
+ case SkyObject::SUPERNOVA_REMNANT : lists.visibleList[6].append(o); break;
+ case SkyObject::GALAXY : lists.visibleList[7].append(o); break;
+ }
+}
+
+void WUTDialog::slotLoadList(int i) {
+ WUT->ObjectListBox->clear();
+ setCursor(QCursor(Qt::WaitCursor));
+ QPtrList <SkyObjectName> invisibleList;
+ for (SkyObjectName *oname=lists.visibleList[i].first(); oname; oname=lists.visibleList[i].next()) {
+ bool visible = true;
+ if (lists.initialized[i] == false) {
+ if (i == 0) { //planets, sun and moon
+ if (oname->skyObject()->name() == "Sun" ) visible = false; // don't ever display the sun
+ else visible = checkVisibility(oname);
+ }
+ if (visible == false) {
+ // collect all invisible objects
+ invisibleList.append(oname);
+ }
+ }
+ // append to listbox
+ if (visible == true) new SkyObjectNameListItem(WUT->ObjectListBox, oname);
+ }
+ // remove all invisible objects from list
+ if (invisibleList.isEmpty() == false) {
+ for (SkyObjectName *o=invisibleList.first(); o; o=invisibleList.next()) {
+ lists.visibleList[i].removeRef(o);
+ }
+ }
+ setCursor(QCursor(Qt::ArrowCursor));
+ lists.initialized[i] = true;
+
+ // highlight first item
+ if ( WUT->ObjectListBox->count() ) {
+ WUT->ObjectListBox->setSelected(0, true);
+ WUT->ObjectListBox->setFocus();
+ }
+}
+
+bool WUTDialog::checkVisibility(SkyObjectName *oname) {
+ bool visible( false );
+ double minAlt = 6.0; //An object is considered 'visible' if it is above horizon during civil twilight.
+
+ //Initial values for T1, T2 assume all night option of EveningMorningBox
+ KStarsDateTime T1 = Evening;
+ T1.setTime( sunSetToday );
+ KStarsDateTime T2 = Tomorrow;
+ T2.setTime( sunRiseTomorrow );
+
+ //Check Evening/Morning only state:
+ if ( EveningFlag==0 ) { //Evening only
+ T2 = T0; //midnight
+ } else if ( EveningFlag==1 ) { //Morning only
+ T1 = T0; //midnight
+ }
+
+ for ( KStarsDateTime test = T1; test < T2; test = test.addSecs(3600) ) {
+ //Need LST of the test time, expressed as a dms object.
+ KStarsDateTime ut = geo->LTtoUT( test );
+ dms LST = geo->GSTtoLST( ut.gst() );
+ SkyPoint sp = oname->skyObject()->recomputeCoords( ut, geo );
+
+ //check altitude of object at this time.
+ sp.EquatorialToHorizontal( &LST, geo->lat() );
+
+ if ( sp.alt()->Degrees() > minAlt ) {
+ visible = true;
+ break;
+ }
+ }
+
+ return visible;
+}
+
+void WUTDialog::slotDisplayObject(QListBoxItem *item) {
+ QTime tRise, tSet, tTransit;
+ QString sRise, sTransit, sSet;
+
+ if ( item==0 ) { //no object selected
+ WUT->ObjectBox->setTitle( i18n( "No Object Selected" ) );
+
+ sRise = "--:--";
+ sTransit = "--:--";
+ sSet = "--:--";
+ WUT->DetailButton->setEnabled( false );
+ } else {
+ SkyObject *o = ((SkyObjectNameListItem*)item)->objName()->skyObject();
+ WUT->ObjectBox->setTitle( o->name() );
+
+ if ( o->checkCircumpolar( geo->lat() ) ) {
+ if ( o->alt()->Degrees() > 0.0 ) {
+ sRise = i18n( "circumpolar" );
+ sSet = i18n( "circumpolar" );
+ } else {
+ sRise = i18n( "does not rise" );
+ sSet = i18n( "does not rise" );
+ }
+ } else {
+ tRise = o->riseSetTime( T0, geo, true );
+ tSet = o->riseSetTime( T0, geo, false );
+// if ( tSet < tRise )
+// tSet = o->riseSetTime( JDTomorrow, geo, false );
+
+ sRise = QString().sprintf( "%02d:%02d", tRise.hour(), tRise.minute() );
+ sSet = QString().sprintf( "%02d:%02d", tSet.hour(), tSet.minute() );
+ }
+
+ tTransit = o->transitTime( T0, geo );
+// if ( tTransit < tRise )
+// tTransit = o->transitTime( JDTomorrow, geo );
+
+ sTransit = QString().sprintf( "%02d:%02d", tTransit.hour(), tTransit.minute() );
+
+ WUT->DetailButton->setEnabled( true );
+ }
+
+ WUT->ObjectRiseLabel->setText( i18n( "Rises at: %1" ).arg( sRise ) );
+ WUT->ObjectTransitLabel->setText( i18n( "Transits at: %1" ).arg( sTransit ) );
+ WUT->ObjectSetLabel->setText( i18n( "Sets at: %1" ).arg( sSet ) );
+}
+
+void WUTDialog::slotCenter() {
+ SkyObject *o = 0;
+ // get selected item
+ if (WUT->ObjectListBox->selectedItem() != 0) {
+ o = ((SkyObjectNameListItem*)WUT->ObjectListBox->selectedItem())->objName()->skyObject();
+ }
+ if (o != 0) {
+ kstars->map()->setFocusPoint( o );
+ kstars->map()->setFocusObject( o );
+ kstars->map()->setDestination( kstars->map()->focusPoint() );
+ }
+}
+
+void WUTDialog::slotDetails() {
+ SkyObject *o = 0;
+ // get selected item
+ if (WUT->ObjectListBox->selectedItem() != 0) {
+ o = ((SkyObjectNameListItem*)WUT->ObjectListBox->selectedItem())->objName()->skyObject();
+ }
+ if (o != 0) {
+ DetailDialog detail(o, kstars->data()->LTime, geo, kstars);
+ detail.exec();
+ }
+}
+
+void WUTDialog::slotChangeDate() {
+ TimeDialog td( T0, this );
+ if ( td.exec() == QDialog::Accepted ) {
+ T0 = td.selectedDateTime();
+ //If the Time is earlier than 6:00 am, assume the user wants the night of the previous date
+ if ( T0.time().hour() < 6 )
+ T0 = T0.addDays( -1 );
+
+ //Now, set time T0 to midnight (of the following day)
+ T0.setTime( QTime( 0, 0, 0 ) );
+ T0 = T0.addDays( 1 );
+ UT0 = geo->LTtoUT( T0 );
+
+ //Set the Tomorrow date/time to Noon the following day
+ Tomorrow = T0.addSecs( 12*3600 );
+ TomorrowUT = geo->LTtoUT( Tomorrow );
+
+ //Set the Evening date/time to 6:00 pm
+ Evening = T0.addSecs( -6*3600 );
+ EveningUT = geo->LTtoUT( Evening );
+
+ WUT->DateLabel->setText( i18n( "The night of %1" ).arg( Evening.date().toString() ) );
+
+ int i = WUT->CategoryListBox->currentItem();
+ init();
+ slotLoadList( i );
+ }
+}
+
+void WUTDialog::slotChangeLocation() {
+ LocationDialog ld( kstars );
+ if ( ld.exec() == QDialog::Accepted ) {
+ GeoLocation *newGeo = ld.selectedCity();
+ if ( newGeo ) {
+ geo = newGeo;
+ UT0 = geo->LTtoUT( T0 );
+ TomorrowUT = geo->LTtoUT( Tomorrow );
+ EveningUT = geo->LTtoUT( Evening );
+
+ WUT->LocationLabel->setText( i18n( "at %1" ).arg( geo->fullName() ) );
+
+ int i = WUT->CategoryListBox->currentItem();
+ init();
+ slotLoadList( i );
+ }
+ }
+}
+
+void WUTDialog::slotEveningMorning( int index ) {
+ if ( EveningFlag != index ) {
+ EveningFlag = index;
+// splitObjectList();
+// slotLoadList( WUT->CategoryListBox->currentItem() );
+ int i = WUT->CategoryListBox->currentItem();
+ init();
+ slotLoadList( i );
+ }
+}
+
+#include "wutdialog.moc"
diff --git a/kstars/kstars/tools/wutdialog.h b/kstars/kstars/tools/wutdialog.h
new file mode 100644
index 00000000..3423ace0
--- /dev/null
+++ b/kstars/kstars/tools/wutdialog.h
@@ -0,0 +1,132 @@
+/***************************************************************************
+ wutdialog.h - K Desktop Planetarium
+ -------------------
+ begin : Die Feb 25 2003
+ copyright : (C) 2003 by Thomas Kabelmann
+ email : tk78@gmx.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 WUTDIALOG_H
+#define WUTDIALOG_H
+
+#include <qwidget.h>
+#include <kdialogbase.h>
+#include "kstarsdatetime.h"
+
+#define NCATEGORY 8
+
+class KStars;
+class ObjectNameList;
+class GeoLocation;
+class SkyObject;
+class SkyObjectName;
+class WUTDialogUI;
+class QFrame;
+
+/**@class WUTDialog
+ *What's up tonight dialog is a window which lists all skyobjects that will
+ *be visible during the next night.
+ *@author Thomas Kabelmann
+ *@version 1.0
+ */
+
+class WUTDialog : public KDialogBase {
+ Q_OBJECT
+
+ public:
+
+ /**@short Constructor*/
+ WUTDialog(KStars *ks);
+ /**@short Destructor*/
+ ~WUTDialog();
+
+ private slots:
+
+ /**@short Load the list of visible objects for selected object type.
+ *@p type the object-type classification number
+ *@see the SkyObject TYPE enum
+ */
+ void slotLoadList(int type);
+
+ /**@short Determine which objects are visible, and store them in
+ *an array of lists, classified by object type
+ */
+ void init();
+
+ /**@short display the rise/transit/set times for selected object
+ */
+ void slotDisplayObject(QListBoxItem *item);
+
+ /**@short Apply user's choice of what part of the night should
+ *be examined:
+ *@li 0: Evening only (sunset to midnight)
+ *@li 1: Morning only (midnight to sunrise)
+ *@li 2: All night (sunset to sunrise)
+ */
+ void slotEveningMorning( int index );
+
+ /**@short Adjust the date for the WUT tool
+ *@note this does NOT affect the date of the sky map
+ */
+ void slotChangeDate();
+
+ /**@short Adjust the geographic location for the WUT tool
+ *@note this does NOT affect the geographic location for the sky map
+ */
+ void slotChangeLocation();
+
+ /**@short open the detail dialog for the current object
+ */
+ void slotDetails();
+
+ /**@short center the display on the current object
+ */
+ void slotCenter();
+ private:
+
+ KStars *kstars;
+ WUTDialogUI *WUT;
+
+ /**@short Initialize all SIGNAL/SLOT connections, used in constructor */
+ void makeConnections();
+
+ /**@short Initialize catgory list, used in constructor */
+ void initCategories();
+
+ /**@short Check visibility of object
+ *@p oname the name of the object to check
+ *@return true if visible
+ */
+ bool checkVisibility(SkyObjectName *oname);
+
+ /**@short split the objects in object-type categories */
+ void splitObjectList();
+
+ /**@short Append object to the correct object-type list. */
+ void appendToList(SkyObjectName *o);
+
+ ObjectNameList *objectList;
+
+ QTime sunRiseTomorrow, sunSetToday, sunRiseToday, moonRise, moonSet;
+ KStarsDateTime T0, UT0, Tomorrow, TomorrowUT, Evening, EveningUT;
+
+ GeoLocation *geo;
+ int EveningFlag;
+
+ struct List {
+ QPtrList <SkyObjectName> visibleList[NCATEGORY];
+ bool initialized[NCATEGORY];
+ } lists;
+
+};
+
+#endif
diff --git a/kstars/kstars/tools/wutdialogui.ui b/kstars/kstars/tools/wutdialogui.ui
new file mode 100644
index 00000000..824ffe20
--- /dev/null
+++ b/kstars/kstars/tools/wutdialogui.ui
@@ -0,0 +1,565 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>WUTDialogUI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>WUTDialogUI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>652</width>
+ <height>589</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>What's Up Tonight?</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout25</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout24</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout23</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>LocationLabel</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="text">
+ <string>at LOCATION</string>
+ </property>
+ </widget>
+ <spacer row="0" column="1">
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>30</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="1" column="1">
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>DateLabel</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>The night of DATE</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout13</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>108</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel14</cstring>
+ </property>
+ <property name="text">
+ <string>Show objects which are up:</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout9</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>DateButton</cstring>
+ </property>
+ <property name="text">
+ <string>Change Date...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Choose a new date</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Press this button to select a new date for the "What's Up Tonight" tool. Note that the date of the main window is not changed.</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>LocationButton</cstring>
+ </property>
+ <property name="text">
+ <string>Change Location...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Choose a new geographic location</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Press this button to select a new geographic location for the "What's Up Tonight" tool. Note that the location of the main window is not changed.</string>
+ </property>
+ </widget>
+ <widget class="KComboBox">
+ <item>
+ <property name="text">
+ <string>In the Evening</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>In the Morning</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Any Time Tonight</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>EveningMorningBox</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Choose time interval</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>By default, the "What's Up Tonight" tool displays all objects which are above the horizon between sunset and midnight (i.e., "in the evening"). You can also choose to show objects which are up between midnight and dawn (i.e., "in the morning"), or objects which are up at any time between sunset and sunrise (i.e., "any time tonight")</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Almanac</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>SunRiseLabel</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Sunrise: 07:15</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Time of sunrise</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Displays the time of sunrise for the selected date.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>MoonRiseLabel</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Moon rise: 13:19</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Time of moon rise</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Displays the time at which the moon rises on the selected date.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>MoonSetLabel</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Moon set: 04:27 </string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Time of moon set</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Displays the time at which the moon sets on the selected date.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>SunSetLabel</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Sunset: 19:15</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Time of sunset</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Displays the time of sunset for the selected date.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>NightDurationLabel</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Night duration: 11:00 hours</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Duration of night for selected date</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Displays the duration between sunset and sunrise for the selected date.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="1">
+ <property name="name">
+ <cstring>MoonIllumLabel</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Moon illum: 42%</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Moon's illumination fraction</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Displays the illumination fraction of the Moon for the selected date.</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout10</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer row="0" column="2">
+ <property name="name">
+ <cstring>spacer9</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>164</width>
+ <height>12</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel15</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>10</pointsize>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Choose a category:</string>
+ </property>
+ </widget>
+ <widget class="KListBox" row="1" column="1">
+ <property name="name">
+ <cstring>ObjectListBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>150</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>List of objects above horizon tonight</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Objects listed here are above the horizon on the selected date, and have the object type which is highlighted in the "Choose a Category" list.</string>
+ </property>
+ </widget>
+ <widget class="QGroupBox" row="1" column="2">
+ <property name="name">
+ <cstring>ObjectBox</cstring>
+ </property>
+ <property name="title">
+ <string>Object Name</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>ObjectRiseLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Rises at: 22:12</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter</set>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Displays the time at which the highlighted object rises above the horizon on the selected date.</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>ObjectTransitLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Transits at: 03:45</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter</set>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Displays the time at which the highlighted object transits across the local meridian on the selected date.</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>ObjectSetLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Sets at: 08:22</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter</set>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Displays the time at which the highlighted object sets below the horizon on the selected date.</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>CenterButton</cstring>
+ </property>
+ <property name="text">
+ <string>Center Object</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Center this object in the sky display</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Center the sky display on this object, and begin tracking it. Equivalent to the "Center and Track" item in the popup menu.</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>DetailButton</cstring>
+ </property>
+ <property name="text">
+ <string>Object Details</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Open the Object Details window</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Open the Details window for the highlighted object.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="KListBox" row="1" column="0">
+ <property name="name">
+ <cstring>CategoryListBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>List of object categories</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Select an item in the Categories list to display objects in that category which are above the horizon on the selected date.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>textLabel16</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>10</pointsize>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Matching objects:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kcombobox.h</includehint>
+ <includehint>klistbox.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klistbox.h</includehint>
+</includehints>
+</UI>