Skip to content

Commit

Permalink
Change the meaning of the show DSS button
Browse files Browse the repository at this point in the history
Previously I tried to keep the old behavior of actually showing the DSS
survey, but now that we have a surveys manager, it makes more sense to
use the button as a global toggle for it.

We probably need to add the toggle in the survey list window as well.
  • Loading branch information
guillaumechereau committed Mar 18, 2018
1 parent 398048d commit ef010c6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 26 deletions.
20 changes: 8 additions & 12 deletions src/core/modules/HipsMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void HipsMgr::init()
}
conf->endGroup();

addAction("actionShow_DSS", N_("Display Options"), N_("Digitized Sky Survey (experimental)"), "showDSS", "Ctrl+Alt+D");
addAction("actionShow_Hips_Surveys", N_("Display Options"), N_("Toggle Hips Surveys (experimental)"), "flagShow", "Ctrl+Alt+D");
}

void HipsMgr::deinit()
Expand All @@ -85,6 +85,7 @@ void HipsMgr::deinit()

void HipsMgr::draw(StelCore* core)
{
if (!visible) return;
StelPainter sPainter(core->getProjection(StelCore::FrameJ2000));
for (auto survey: surveys)
{
Expand Down Expand Up @@ -119,21 +120,16 @@ HipsSurveyP HipsMgr::getSurveyByUrl(const QString &url)
return HipsSurveyP(NULL);
}

bool HipsMgr::getShowDSS() const
bool HipsMgr::getFlagShow(void) const
{
for (auto survey: surveys)
{
if (survey->isVisible() && survey->getUrl().endsWith("DSSColor"))
return true;
}
return false;
return visible;
}

void HipsMgr::setShowDSS(bool value)
void HipsMgr::setFlagShow(bool b)
{
for (auto survey: surveys)
if (visible != b)
{
survey->setVisible(value && survey->getUrl().endsWith("DSSColor"));
visible = b;
emit showChanged(b);
}
emit showDSSChanged();
}
16 changes: 7 additions & 9 deletions src/core/modules/HipsMgr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ class HipsMgr : public StelModule
MEMBER surveys
NOTIFY surveysChanged)

//! Special property to quicky show the DSS hips survey.
Q_PROPERTY(bool showDSS READ getShowDSS WRITE setShowDSS NOTIFY showDSSChanged)
Q_PROPERTY(bool flagShow READ getFlagShow WRITE setFlagShow NOTIFY showChanged)

public:
HipsMgr();
Expand All @@ -47,21 +46,20 @@ class HipsMgr : public StelModule
Q_INVOKABLE
HipsSurveyP getSurveyByUrl(const QString &url);

//! Return whether the DSS survey is visible.
bool getShowDSS() const;
//! Set whether the DSS survey is visible.
void setShowDSS(bool value);
//! Get whether the surveys are displayed.
bool getFlagShow(void) const;
//! Set whether the surveys are displayed.
void setFlagShow(bool b);

signals:
void surveyDisplayedChanged(const bool displayed) const;
void showChanged(bool value) const;
void surveysChanged() const;
//! Emitted when a new survey has been loaded.
void gotNewSurvey(HipsSurveyP survey) const;
//! Emitted when the DSS survey visible status has changed.
void showDSSChanged() const;

private:
QList<HipsSurveyP> surveys;
bool visible = true;
};

#endif // _HIPSMGR_HPP_
10 changes: 5 additions & 5 deletions src/gui/StelGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,9 @@ void StelGui::update()
if (getAction("actionShow_DSO_Textures")->isChecked() != flag)
getAction("actionShow_DSO_Textures")->setChecked(flag);

flag = propMgr->getProperty("HipsMgr.showDSS")->getValue().toBool();
if (getAction("actionShow_DSS")->isChecked() != flag)
getAction("actionShow_DSS")->setChecked(flag);
flag = propMgr->getProperty("HipsMgr.flagShow")->getValue().toBool();
if (getAction("actionShow_Hips_Surveys")->isChecked() != flag)
getAction("actionShow_Hips_Surveys")->setChecked(flag);

flag = propMgr->getProperty("GridLinesMgr.equatorJ2000GridDisplayed")->getValue().toBool();
if (getAction("actionShow_Equatorial_J2000_Grid")->isChecked() != flag)
Expand Down Expand Up @@ -843,11 +843,11 @@ void StelGui::setFlagShowDSSButton(bool b)
QPixmap pxmapGlow32x32(":/graphicGui/glow32x32.png");
QPixmap pxmapOn(":/graphicGui/btToastSurvey-on.png");
QPixmap pxmapOff(":/graphicGui/btToastSurvey-off.png");
btShowDSS = new StelButton(Q_NULLPTR, pxmapOn, pxmapOff, pxmapGlow32x32, "actionShow_DSS");
btShowDSS = new StelButton(Q_NULLPTR, pxmapOn, pxmapOff, pxmapGlow32x32, "actionShow_Hips_Surveys");
}
getButtonBar()->addButton(btShowDSS, "040-nebulaeGroup");
} else {
getButtonBar()->hideButton("actionShow_DSS");
getButtonBar()->hideButton("actionShow_Hips_Surveys");
}
flagShowDSSButton = b;
}
Expand Down

0 comments on commit ef010c6

Please sign in to comment.