[qt] Replace gps pos for testing (with alt key pressed)

This commit is contained in:
Denis Koronchik 2014-09-19 17:58:03 +03:00 committed by Alex Zolotarev
parent 642c8d5c02
commit 04dc2ccba1
3 changed files with 28 additions and 4 deletions

View file

@ -79,7 +79,8 @@ namespace qt
m_isRotate(false),
//m_redrawInterval(100),
m_ratio(1.0),
m_pScale(0)
m_pScale(0),
m_emulatingLocation(false)
{
// Initialize with some stubs for test.
PinClickManager & manager = GetBalloonManager();
@ -397,6 +398,18 @@ namespace qt
else
m_framework->StartRoutingSession(m_framework->PtoG(pt));
}
if (e->modifiers() & Qt::AltModifier)
{
m_emulatingLocation = true;
m2::PointD const point = m_framework->PtoG(pt);
location::GpsInfo info;
info.m_latitude = MercatorBounds::YToLat(point.y);
info.m_longitude = MercatorBounds::XToLon(point.x);
info.m_horizontalAccuracy = 10.0;
m_framework->OnLocationUpdate(info);
}
else
{
// init press task params
@ -513,6 +526,9 @@ namespace qt
QGLWidget::keyReleaseEvent(e);
StopRotating(e);
if (e->key() == Qt::Key_Alt)
m_emulatingLocation = false;
}
void DrawWidget::StopRotating(QMouseEvent * e)
@ -529,9 +545,7 @@ namespace qt
void DrawWidget::StopRotating(QKeyEvent * e)
{
if (m_isRotate && (e->key() == Qt::Key_Control))
{
m_framework->StopRotate(GetRotateEvent(mapFromGlobal(QCursor::pos())));
}
}
void DrawWidget::StopDragging(QMouseEvent * e)
@ -613,6 +627,12 @@ namespace qt
setFocus();
}
void DrawWidget::OnLocationUpdate(location::GpsInfo const & info)
{
if (!m_emulatingLocation)
m_framework->OnLocationUpdate(info);
}
void DrawWidget::QueryMaxScaleMode()
{
m_framework->XorQueryMaxScaleMode();

View file

@ -93,6 +93,8 @@ namespace qt
void ShowSearchResult(search::Result const & res);
void CloseSearch();
void OnLocationUpdate(location::GpsInfo const & info);
void SaveState();
void LoadState();
@ -144,6 +146,8 @@ namespace qt
m2::PointD m_taskPoint;
bool m_wasLongClick, m_isCleanSingleClick;
bool m_emulatingLocation;
PinClickManager & GetBalloonManager() { return m_framework->GetBalloonManager(); }
};
}

View file

@ -331,7 +331,7 @@ void MainWindow::OnLocationError(location::TLocationError errorCode)
void MainWindow::OnLocationUpdated(location::GpsInfo const & info)
{
m_pDrawWidget->GetFramework().OnLocationUpdate(info);
m_pDrawWidget->OnLocationUpdate(info);
}
void MainWindow::OnMyPosition()