1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 17:28:50 -05:00

SkyMap: Handle find requests, even if map not ready.

This commit is contained in:
srcejon 2024-03-28 15:29:28 +00:00
parent 13ba98eb8a
commit 20455519f0
2 changed files with 28 additions and 7 deletions

View File

@ -200,7 +200,8 @@ SkyMapGUI::SkyMapGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *
m_featureUISet(featureUISet),
m_doApplySettings(true),
m_source(nullptr),
m_availableChannelOrFeatureHandler(SkyMapSettings::m_pipeURIs, {"target", "skymap.target"})
m_availableChannelOrFeatureHandler(SkyMapSettings::m_pipeURIs, {"target", "skymap.target"}),
m_ready(false)
{
m_feature = feature;
setAttribute(Qt::WA_DeleteOnClose, true);
@ -294,6 +295,7 @@ void SkyMapGUI::on_map_currentIndexChanged(int index)
m_settings.m_map = ui->map->currentText();
applySetting("map");
m_ready = false;
if (m_settings.m_map == "WWT") {
ui->web->load(QUrl(QString("http://127.0.0.1:%1/skymap/html/wwt.html").arg(m_webPort)));
} else if (m_settings.m_map == "ESASky") {
@ -497,13 +499,22 @@ void SkyMapGUI::applyAllSettings()
void SkyMapGUI::find(const QString& text)
{
float ra, dec;
qDebug() << "**********find" << text << m_ready;
if (!m_ready)
{
// Save for when ready
m_find = text;
}
else
{
float ra, dec;
// WWT's find doesn't support coordinates, so we check here
if (Units::stringToRADec(text, ra, dec)) {
m_webInterface->setView(ra, dec);
} else {
m_webInterface->track(text);
// WWT's find doesn't support coordinates, so we check here
if (Units::stringToRADec(text, ra, dec)) {
m_webInterface->setView(ra, dec);
} else {
m_webInterface->track(text);
}
}
}
@ -765,7 +776,15 @@ void SkyMapGUI::receivedEvent(const QJsonObject &obj)
}
else if (event == "ready")
{
m_ready = true;
initSkyMap();
// Run find that was requested while map was initialising
if (!m_find.isEmpty())
{
find(m_find);
m_find = "";
}
}
}
else

View File

@ -88,6 +88,8 @@ private:
quint16 m_webPort;
WTML m_wtml;
WebInterface *m_webInterface;
bool m_ready; //!< Web app is ready
QString m_find;
double m_ra; //!< Target from source plugin
double m_dec;