Skip to content

Commit

Permalink
Don't manipulate StelSkyCultureMgr's signals outside of the class
Browse files Browse the repository at this point in the history
Although technically this works, architecturally it's unclean since it
breaks incapsulation (which technically doesn't exist since the signals
are public since Qt5, but this is only because of language limitations).
  • Loading branch information
10110111 committed Nov 22, 2023
1 parent 7fc07e8 commit 2b8625f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/core/StelSkyCultureMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ void StelSkyCultureMgr::init()
setCurrentSkyCultureID(defaultSkyCultureID);
}

void StelSkyCultureMgr::reloadSkyCulture()
{
emit currentSkyCultureChanged(currentSkyCultureDir);
}

//! Set the current sky culture from the passed directory
bool StelSkyCultureMgr::setCurrentSkyCultureID(const QString& cultureDir)
{
Expand Down
2 changes: 2 additions & 0 deletions src/core/StelSkyCultureMgr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ public slots:
//! @param id the sky culture ID.
//! @return true on success; else false.
bool setCurrentSkyCultureID(const QString& id);
//! Reload the current sky culture
void reloadSkyCulture();

//! Get the type of boundaries of the current sky culture
//! Config option: info/boundaries
Expand Down
3 changes: 1 addition & 2 deletions src/core/modules/ConstellationMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ double ConstellationMgr::getCallOrder(StelModuleActionName actionName) const

void ConstellationMgr::reloadSkyCulture()
{
StelSkyCultureMgr* skyCulMgr = &StelApp::getInstance().getSkyCultureMgr();
emit skyCulMgr->currentSkyCultureChanged(skyCulMgr->getCurrentSkyCultureID());
StelApp::getInstance().getSkyCultureMgr().reloadSkyCulture();
}

void ConstellationMgr::updateSkyCulture(const QString& skyCultureDir)
Expand Down

0 comments on commit 2b8625f

Please sign in to comment.