DateTimeDialog.cpp   DateTimeDialog.cpp 
skipping to change at line 57 skipping to change at line 57
DateTimeDialog::~DateTimeDialog() DateTimeDialog::~DateTimeDialog()
{ {
delete ui; delete ui;
ui=NULL; ui=NULL;
} }
void DateTimeDialog::createDialogContent() void DateTimeDialog::createDialogContent()
{ {
ui->setupUi(dialog); ui->setupUi(dialog);
double cjd = StelApp::getInstance().getCore()->getJDay(); double jd = StelApp::getInstance().getCore()->getJD();
// UTC -> local tz // UTC -> local tz
// Add in a DeltaT correction. Divide DeltaT by 86400 to convert fro setDateTime(jd + (StelApp::getInstance().getLocaleMgr().getGMTShift(
m seconds to days. jd)/24.0));
double deltaT = 0.;
if (StelApp::getInstance().getCore()->getCurrentLocation().planetNam
e=="Earth")
deltaT = StelApp::getInstance().getCore()->getDeltaT(cjd)/86
400.;
setDateTime(cjd + (StelApp::getInstance().getLocaleMgr().getGMTShift
(cjd)/24.0)-deltaT);
connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SL OT(retranslate())); connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SL OT(retranslate()));
connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())) ; connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())) ;
connectSpinnerEvents(); connectSpinnerEvents();
} }
void DateTimeDialog::connectSpinnerEvents() const void DateTimeDialog::connectSpinnerEvents() const
{ {
connect(ui->spinner_year, SIGNAL(valueChanged(int)), this, SLOT(year Changed(int))); connect(ui->spinner_year, SIGNAL(valueChanged(int)), this, SLOT(year Changed(int)));
skipping to change at line 117 skipping to change at line 113
ds = s; ds = s;
} }
year = dy; year = dy;
month = dm; month = dm;
day = dd; day = dd;
hour = dh; hour = dh;
minute = dmin; minute = dmin;
second = ds; second = ds;
pushToWidgets(); pushToWidgets();
StelApp::getInstance().getCore()->setJDay(newJd()); StelApp::getInstance().getCore()->setJD(newJd());
return true; return true;
} }
bool DateTimeDialog::validJd(double jday) bool DateTimeDialog::validJd(double jday)
{ {
pushToWidgets(); pushToWidgets();
StelCore *core = StelApp::getInstance().getCore(); StelApp::getInstance().getCore()->setJD(jday);
core->setJDay(jday+core->getDeltaT(jday)/86400.);
return true; return true;
} }
void DateTimeDialog::retranslate() void DateTimeDialog::retranslate()
{ {
if (dialog) { if (dialog) {
ui->retranslateUi(dialog); ui->retranslateUi(dialog);
} }
} }
skipping to change at line 212 skipping to change at line 208
if ( mjd != nmjd) if ( mjd != nmjd)
{ {
validJd(2400000.5 + nmjd); validJd(2400000.5 + nmjd);
} }
} }
double DateTimeDialog::newJd() double DateTimeDialog::newJd()
{ {
double cjd; double cjd;
StelUtils::getJDFromDate(&cjd, year, month, day, hour, minute, secon d); StelUtils::getJDFromDate(&cjd, year, month, day, hour, minute, secon d);
// Add in a DeltaT correction. Divide DeltaT by 86400 to convert fro cjd -= (StelApp::getInstance().getLocaleMgr().getGMTShift(cjd)/24.0)
m seconds to days. ; // local tz -> UTC
double deltaT = 0.;
if (StelApp::getInstance().getCore()->getCurrentLocation().planetNam
e=="Earth")
deltaT = StelApp::getInstance().getCore()->getDeltaT(cjd)/86
400.;
cjd -= (StelApp::getInstance().getLocaleMgr().getGMTShift(cjd)/24.0-
deltaT); // local tz -> UTC
return cjd; return cjd;
} }
void DateTimeDialog::pushToWidgets() void DateTimeDialog::pushToWidgets()
{ {
disconnectSpinnerEvents(); disconnectSpinnerEvents();
ui->spinner_year->setValue(year); ui->spinner_year->setValue(year);
ui->spinner_month->setValue(month); ui->spinner_month->setValue(month);
ui->spinner_day->setValue(day); ui->spinner_day->setValue(day);
ui->spinner_hour->setValue(hour); ui->spinner_hour->setValue(hour);
if (!ui->spinner_minute->hasFocus() || (ui->spinner_minute->value() == -1) || (ui->spinner_minute->value() == 60)) if (!ui->spinner_minute->hasFocus() || (ui->spinner_minute->value() == -1) || (ui->spinner_minute->value() == 60))
{ {
ui->spinner_minute->setValue(minute); ui->spinner_minute->setValue(minute);
} }
if (!ui->spinner_second->hasFocus() || (ui->spinner_second->value() == -1) || (ui->spinner_second->value() == 60)) if (!ui->spinner_second->hasFocus() || (ui->spinner_second->value() == -1) || (ui->spinner_second->value() == 60))
{ {
ui->spinner_second->setValue(second); ui->spinner_second->setValue(second);
} }
ui->spinner_jd->setValue(jd); ui->spinner_jd->setValue(jd);
ui->spinner_mjd->setValue(mjd); ui->spinner_mjd->setValue(mjd);
if (jd<2299161) // 1582-10-15
ui->dateTimeTab->setToolTip(q_("Date and Time in Julian cale
ndar"));
else
ui->dateTimeTab->setToolTip(q_("Date and Time in Gregorian c
alendar"));
connectSpinnerEvents(); connectSpinnerEvents();
} }
/************************************************************************ /************************************************************************
Send newJd to spinner_* Prepare date elements from newJd and send to spinner_*
************************************************************************/ ************************************************************************/
void DateTimeDialog::setDateTime(double newJd) void DateTimeDialog::setDateTime(double newJd)
{ {
if (this->visible()) { if (this->visible()) {
// Add in a DeltaT correction. Divide DeltaT by 86400 to con // JD and MJD should be at the UTC scale on the window!
vert from seconds to days. double newJdC = newJd + StelApp::getInstance().getLocaleMgr(
double deltaT = 0.; ).getGMTShift(newJd)/24.0; // UTC -> local tz
if (StelApp::getInstance().getCore()->getCurrentLocation().p StelUtils::getDateFromJulianDay(newJdC, &year, &month, &day)
lanetName=="Earth") ;
deltaT = StelApp::getInstance().getCore()->getDeltaT StelUtils::getTimeFromJulianDay(newJdC, &hour, &minute, &sec
(newJd)/86400.; ond);
double newJdC = newJd - deltaT; jd = newJd;
newJd += (StelApp::getInstance().getLocaleMgr().getGMTShift( mjd = newJd-2400000.5;
newJd)/24.0-deltaT); // UTC -> local tz
StelUtils::getDateFromJulianDay(newJd, &year, &month, &day);
StelUtils::getTimeFromJulianDay(newJd, &hour, &minute, &seco
nd);
jd = newJdC;
mjd = newJdC-2400000.5;
pushToWidgets(); pushToWidgets();
} }
} }
 End of changes. 8 change blocks. 
38 lines changed or deleted 26 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/