Skip to content

Commit

Permalink
Re-implement AstroCalc/Almanac/Specific Time tool
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-w committed Jan 29, 2024
1 parent 2559add commit bab29ff
Show file tree
Hide file tree
Showing 11 changed files with 1,649 additions and 26 deletions.
9 changes: 9 additions & 0 deletions data/gui/normalStyle.css
Original file line number Diff line number Diff line change
Expand Up @@ -1181,3 +1181,12 @@ QMessageBox {
QColorDialog {
background-color: rgb(143, 143, 143);
}

/*************************************************************************
* AstroCalcAlmanacWidget
*************************************************************************/

AstroCalcAlmanacWidget QFrame[frameShape="4"], /* QFrame::HLine == 0x0004 */
AstroCalcAlmanacWidget QFrame[frameShape="5"] { /* QFrame::VLine == 0x0005 */
border: 1px solid rgb(238, 238, 238);
}
2 changes: 2 additions & 0 deletions po/stellarium/POTFILES.in
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ src/gui/AstroCalcDialog.cpp
src/gui/AstroCalcChart.cpp
src/gui/AstroCalcExtraEphemerisDialog.cpp
src/gui/AstroCalcCustomStepsDialog.cpp
src/gui/AstroCalcAlmanacWidget.cpp
src/gui/ObsListDialog.cpp
src/gui/ConfigureDSOColorsDialog.cpp
src/gui/ConfigureOrbitColorsDialog.cpp
Expand Down Expand Up @@ -86,6 +87,7 @@ src/ui_scriptConsole.h
src/ui_astroCalcDialog.h
src/ui_astroCalcExtraEphemerisDialog.h
src/ui_astroCalcCustomStepsDialog.h
src/ui_astroCalcAlmanacWidget.h
src/ui_obsListDialog.h
src/ui_dsoColorsDialog.h
src/ui_orbitColorsDialog.h
Expand Down
7 changes: 5 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -350,12 +350,14 @@ IF(STELLARIUM_GUI_MODE STREQUAL "Standard")
gui/ConfigureScreenshotsDialog.cpp
gui/AstroCalcDialog.hpp
gui/AstroCalcDialog.cpp
gui/AstroCalcChart.hpp
gui/AstroCalcChart.cpp
gui/AstroCalcExtraEphemerisDialog.hpp
gui/AstroCalcExtraEphemerisDialog.cpp
gui/AstroCalcCustomStepsDialog.hpp
gui/AstroCalcCustomStepsDialog.cpp
gui/AstroCalcChart.hpp
gui/AstroCalcChart.cpp
gui/AstroCalcAlmanacWidget.hpp
gui/AstroCalcAlmanacWidget.cpp
gui/ObsListDialog.hpp
gui/ObsListDialog.cpp
gui/StelDialog.hpp
Expand Down Expand Up @@ -392,6 +394,7 @@ IF(STELLARIUM_GUI_MODE STREQUAL "Standard")
gui/astroCalcDialog.ui
gui/astroCalcExtraEphemerisDialog.ui
gui/astroCalcCustomStepsDialog.ui
gui/astroCalcAlmanacWidget.ui
gui/obsListDialog.ui
gui/addRemoveLandscapesDialog.ui
gui/dsoColorsDialog.ui
Expand Down
64 changes: 40 additions & 24 deletions src/core/modules/SpecificTimeMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,120 +518,136 @@ double SpecificTimeMgr::getSolstice(int year, SpecificTimeMgr::Solstice solstice

void SpecificTimeMgr::currentMarchEquinox()
{
double JD = core->getJDE();
double JD = core->getJD();
int year, month, day;
StelUtils::getDateFromJulianDay(JD, &year, &month, &day);
double estime = getEquinox(year, Equinox::March);
if (estime>0.)
core->setJDE(estime);
core->setJD(estime);
}

void SpecificTimeMgr::nextMarchEquinox()
{
double JD = core->getJDE();
double JD = core->getJD();
int year, month, day;
StelUtils::getDateFromJulianDay(JD, &year, &month, &day);
double estime = getEquinox(year + 1, Equinox::March);
if (estime>0.)
core->setJDE(estime);
core->setJD(estime);

emit eventYearChanged();
}

void SpecificTimeMgr::previousMarchEquinox()
{
double JD = core->getJDE();
double JD = core->getJD();
int year, month, day;
StelUtils::getDateFromJulianDay(JD, &year, &month, &day);
double estime = getEquinox(year - 1, Equinox::March);
if (estime>0.)
core->setJDE(estime);
core->setJD(estime);

emit eventYearChanged();
}

void SpecificTimeMgr::currentSeptemberEquinox()
{
double JD = core->getJDE();
double JD = core->getJD();
int year, month, day;
StelUtils::getDateFromJulianDay(JD, &year, &month, &day);
double estime = getEquinox(year, Equinox::September);
if (estime>0.)
core->setJDE(estime);
core->setJD(estime);
}

void SpecificTimeMgr::nextSeptemberEquinox()
{
double JD = core->getJDE();
double JD = core->getJD();
int year, month, day;
StelUtils::getDateFromJulianDay(JD, &year, &month, &day);
double estime = getEquinox(year + 1, Equinox::September);
if (estime>0.)
core->setJDE(estime);
core->setJD(estime);

emit eventYearChanged();
}

void SpecificTimeMgr::previousSeptemberEquinox()
{
double JD = core->getJDE();
double JD = core->getJD();
int year, month, day;
StelUtils::getDateFromJulianDay(JD, &year, &month, &day);
double estime = getEquinox(year - 1, Equinox::September);
if (estime>0.)
core->setJDE(estime);
core->setJD(estime);

emit eventYearChanged();
}

void SpecificTimeMgr::currentJuneSolstice()
{
double JD = core->getJDE();
double JD = core->getJD();
int year, month, day;
StelUtils::getDateFromJulianDay(JD, &year, &month, &day);
double estime = getSolstice(year, Solstice::June);
if (estime>0.)
core->setJDE(estime);
core->setJD(estime);
}

void SpecificTimeMgr::nextJuneSolstice()
{
double JD = core->getJDE();
double JD = core->getJD();
int year, month, day;
StelUtils::getDateFromJulianDay(JD, &year, &month, &day);
double estime = getSolstice(year + 1, Solstice::June);
if (estime>0.)
core->setJDE(estime);
core->setJD(estime);

emit eventYearChanged();
}

void SpecificTimeMgr::previousJuneSolstice()
{
double JD = core->getJDE();
double JD = core->getJD();
int year, month, day;
StelUtils::getDateFromJulianDay(JD, &year, &month, &day);
double estime = getSolstice(year - 1, Solstice::June);
if (estime>0.)
core->setJDE(estime);
core->setJD(estime);

emit eventYearChanged();
}

void SpecificTimeMgr::currentDecemberSolstice()
{
double JD = core->getJDE();
double JD = core->getJD();
int year, month, day;
StelUtils::getDateFromJulianDay(JD, &year, &month, &day);
double estime = getSolstice(year, Solstice::December);
if (estime>0.)
core->setJDE(estime);
core->setJD(estime);
}

void SpecificTimeMgr::nextDecemberSolstice()
{
double JD = core->getJDE();
double JD = core->getJD();
int year, month, day;
StelUtils::getDateFromJulianDay(JD, &year, &month, &day);
double estime = getSolstice(year + 1, Solstice::December);
if (estime>0.)
core->setJDE(estime);
core->setJD(estime);

emit eventYearChanged();
}

void SpecificTimeMgr::previousDecemberSolstice()
{
double JD = core->getJDE();
double JD = core->getJD();
int year, month, day;
StelUtils::getDateFromJulianDay(JD, &year, &month, &day);
double estime = getSolstice(year - 1, Solstice::December);
if (estime>0.)
core->setJDE(estime);
core->setJD(estime);

emit eventYearChanged();
}
1 change: 1 addition & 0 deletions src/core/modules/SpecificTimeMgr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ public slots:
signals:
//! Signal that the configurable twilight altitude for the sun has changed.
void twilightAltitudeChanged(double alt);
void eventYearChanged();

private:
QSettings* conf;
Expand Down
Loading

0 comments on commit bab29ff

Please sign in to comment.