1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-29 03:09:14 -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_featureUISet(featureUISet),
m_doApplySettings(true), m_doApplySettings(true),
m_source(nullptr), 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; m_feature = feature;
setAttribute(Qt::WA_DeleteOnClose, true); setAttribute(Qt::WA_DeleteOnClose, true);
@ -294,6 +295,7 @@ void SkyMapGUI::on_map_currentIndexChanged(int index)
m_settings.m_map = ui->map->currentText(); m_settings.m_map = ui->map->currentText();
applySetting("map"); applySetting("map");
m_ready = false;
if (m_settings.m_map == "WWT") { if (m_settings.m_map == "WWT") {
ui->web->load(QUrl(QString("http://127.0.0.1:%1/skymap/html/wwt.html").arg(m_webPort))); 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") { } else if (m_settings.m_map == "ESASky") {
@ -497,6 +499,14 @@ void SkyMapGUI::applyAllSettings()
void SkyMapGUI::find(const QString& text) void SkyMapGUI::find(const QString& text)
{ {
qDebug() << "**********find" << text << m_ready;
if (!m_ready)
{
// Save for when ready
m_find = text;
}
else
{
float ra, dec; float ra, dec;
// WWT's find doesn't support coordinates, so we check here // WWT's find doesn't support coordinates, so we check here
@ -505,6 +515,7 @@ void SkyMapGUI::find(const QString& text)
} else { } else {
m_webInterface->track(text); m_webInterface->track(text);
} }
}
} }
void SkyMapGUI::on_find_returnPressed() void SkyMapGUI::on_find_returnPressed()
@ -765,7 +776,15 @@ void SkyMapGUI::receivedEvent(const QJsonObject &obj)
} }
else if (event == "ready") else if (event == "ready")
{ {
m_ready = true;
initSkyMap(); initSkyMap();
// Run find that was requested while map was initialising
if (!m_find.isEmpty())
{
find(m_find);
m_find = "";
}
} }
} }
else else

View File

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