mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-19 04:52:12 +01:00
Add search coloring back to the location search. Google Maps should be functional again. Some locations on the extents of map do not render 'North Pole, South Pole, Antarctica, etc.' currently a *non issue*
This commit is contained in:
parent
38f0a609da
commit
390a8cccb5
@ -579,12 +579,11 @@ internals::PointLatLng UrlFactory::GetLatLngFromGeocoderUrl(const QString &url,
|
||||
return internals::PointLatLng(0, 0);
|
||||
}
|
||||
{
|
||||
geo = reply->readAll();
|
||||
#ifdef DEBUG_URLFACTORY
|
||||
qDebug() << "GetLatLngFromGeocoderUrl:Reply ok";
|
||||
#endif // DEBUG_URLFACTORY
|
||||
geo = reply->readAll();
|
||||
|
||||
qDebug() << geo; // This is the response from the geocode request (no longer in CSV)
|
||||
#endif // DEBUG_URLFACTORY
|
||||
|
||||
// This is SOOOO horribly hackish, code duplication needs to go. Needed a quick fix.
|
||||
QXmlStreamReader reader(geo);
|
||||
|
@ -377,7 +377,7 @@ void Core::OnMapClose()
|
||||
|
||||
CancelAsyncTasks();
|
||||
}
|
||||
GeoCoderStatusCode::Types Core::SetCurrentPositionByKeywords(QString const & keys)
|
||||
QString Core::SetCurrentPositionByKeywords(QString const & keys)
|
||||
{
|
||||
QString status = "ZERO_RESULTS";
|
||||
PointLatLng pos = OPMaps::Instance()->GetLatLngFromGeodecoder(keys, status);
|
||||
@ -389,8 +389,7 @@ GeoCoderStatusCode::Types Core::SetCurrentPositionByKeywords(QString const & key
|
||||
{
|
||||
qDebug() << "Status is not OK: " << status;
|
||||
}
|
||||
//return status;
|
||||
return GeoCoderStatusCode::G_GEO_SUCCESS;
|
||||
return status;
|
||||
}
|
||||
RectLatLng Core::CurrentViewArea()
|
||||
{
|
||||
|
@ -266,7 +266,7 @@ public:
|
||||
|
||||
void OnMapClose(); // TODO had as slot
|
||||
|
||||
GeoCoderStatusCode::Types SetCurrentPositionByKeywords(QString const & keys);
|
||||
QString SetCurrentPositionByKeywords(QString const & keys);
|
||||
|
||||
RectLatLng CurrentViewArea();
|
||||
|
||||
|
@ -229,7 +229,7 @@ private:
|
||||
{
|
||||
core->ReloadMap();
|
||||
}
|
||||
GeoCoderStatusCode::Types SetCurrentPositionByKeywords(QString const & keys)
|
||||
QString SetCurrentPositionByKeywords(QString const & keys)
|
||||
{
|
||||
return core->SetCurrentPositionByKeywords(keys);
|
||||
}
|
||||
|
@ -350,7 +350,7 @@ public:
|
||||
map->ReloadMap(); map->resize();
|
||||
}
|
||||
|
||||
GeoCoderStatusCode::Types SetCurrentPositionByKeywords(QString const & keys)
|
||||
QString SetCurrentPositionByKeywords(QString const & keys)
|
||||
{
|
||||
return map->SetCurrentPositionByKeywords(keys);
|
||||
}
|
||||
|
@ -2320,16 +2320,38 @@ void OPMapGadgetWidget::on_tbFind_clicked()
|
||||
{
|
||||
QPalette pal = m_widget->leFind->palette();
|
||||
|
||||
int result = m_map->SetCurrentPositionByKeywords(m_widget->leFind->text());
|
||||
QString status = m_map->SetCurrentPositionByKeywords(m_widget->leFind->text());
|
||||
|
||||
if (result == core::GeoCoderStatusCode::G_GEO_SUCCESS) {
|
||||
if (status == "OK") {
|
||||
pal.setColor(m_widget->leFind->backgroundRole(), Qt::green);
|
||||
m_widget->leFind->setPalette(pal);
|
||||
m_map->SetZoom(12);
|
||||
} else {
|
||||
} else if (status == "ZERO_RESULTS") {
|
||||
pal.setColor(m_widget->leFind->backgroundRole(), Qt::red);
|
||||
m_widget->leFind->setPalette(pal);
|
||||
qDebug() << "No results";
|
||||
} else if (status == "OVER_QUERY_LIMIT") {
|
||||
pal.setColor(m_widget->leFind->backgroundRole(), Qt::yellow);
|
||||
m_widget->leFind->setPalette(pal);
|
||||
qDebug() << "You are over quota on queries";
|
||||
} else if (status == "REQUEST_DENIED") {
|
||||
pal.setColor(m_widget->leFind->backgroundRole(), Qt::darkRed);
|
||||
m_widget->leFind->setPalette(pal);
|
||||
qDebug() << "Request was denied";
|
||||
} else if (status == "INVALID_REQUEST") {
|
||||
pal.setColor(m_widget->leFind->backgroundRole(), Qt::darkYellow);
|
||||
m_widget->leFind->setPalette(pal);
|
||||
qDebug() << "Invalid request, missing address, lat long or location";
|
||||
} else if (status == "UNKNOWN_ERROR") {
|
||||
pal.setColor(m_widget->leFind->backgroundRole(), Qt::darkYellow);
|
||||
m_widget->leFind->setPalette(pal);
|
||||
qDebug() << "Some sort of server error.";
|
||||
} else {
|
||||
pal.setColor(m_widget->leFind->backgroundRole(), Qt::gray);
|
||||
m_widget->leFind->setPalette(pal);
|
||||
qDebug() << "Some sort of code error!";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void OPMapGadgetWidget::onHomeDoubleClick(HomeItem *)
|
||||
|
Loading…
x
Reference in New Issue
Block a user