mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-22 12:54:14 +01:00
A couple of right click context menu fixes on the new map plug-in.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@841 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
d7390a07a5
commit
d48e80c684
@ -242,6 +242,7 @@ void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
|
|
||||||
menu.addSeparator()->setText(tr("Position"));
|
menu.addSeparator()->setText(tr("Position"));
|
||||||
|
|
||||||
|
menu.addAction(goMouseClickAct);
|
||||||
menu.addAction(goHomeAct);
|
menu.addAction(goHomeAct);
|
||||||
menu.addAction(goUAVAct);
|
menu.addAction(goUAVAct);
|
||||||
menu.addAction(followUAVAct);
|
menu.addAction(followUAVAct);
|
||||||
@ -509,7 +510,14 @@ void OPMapGadgetWidget::zoomOut()
|
|||||||
void OPMapGadgetWidget::setZoom(int value)
|
void OPMapGadgetWidget::setZoom(int value)
|
||||||
{
|
{
|
||||||
if (m_map)
|
if (m_map)
|
||||||
|
{
|
||||||
|
internals::MouseWheelZoomType::Types zoom_type = m_map->GetMouseWheelZoomType();
|
||||||
|
m_map->SetMouseWheelZoomType(internals::MouseWheelZoomType::ViewCenter);
|
||||||
|
|
||||||
m_map->SetZoom(value);
|
m_map->SetZoom(value);
|
||||||
|
|
||||||
|
m_map->SetMouseWheelZoomType(zoom_type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPMapGadgetWidget::setPosition(QPointF pos)
|
void OPMapGadgetWidget::setPosition(QPointF pos)
|
||||||
@ -659,14 +667,18 @@ void OPMapGadgetWidget::createActions()
|
|||||||
connect(findPlaceAct, SIGNAL(triggered()), this, SLOT(findPlace()));
|
connect(findPlaceAct, SIGNAL(triggered()), this, SLOT(findPlace()));
|
||||||
|
|
||||||
zoomInAct = new QAction(tr("Zoom &In"), this);
|
zoomInAct = new QAction(tr("Zoom &In"), this);
|
||||||
zoomInAct->setShortcut(tr("PageDown"));
|
zoomInAct->setShortcut(Qt::Key_PageUp);
|
||||||
zoomInAct->setStatusTip(tr("Zoom the map in"));
|
zoomInAct->setStatusTip(tr("Zoom the map in"));
|
||||||
connect(zoomInAct, SIGNAL(triggered()), this, SLOT(zoomIn()));
|
connect(zoomInAct, SIGNAL(triggered()), this, SLOT(goZoomIn()));
|
||||||
|
|
||||||
zoomOutAct = new QAction(tr("Zoom &Out"), this);
|
zoomOutAct = new QAction(tr("Zoom &Out"), this);
|
||||||
zoomOutAct->setShortcut(tr("PageUp"));
|
zoomOutAct->setShortcut(Qt::Key_PageDown);
|
||||||
zoomOutAct->setStatusTip(tr("Zoom the map out"));
|
zoomOutAct->setStatusTip(tr("Zoom the map out"));
|
||||||
connect(zoomOutAct, SIGNAL(triggered()), this, SLOT(zoomOut()));
|
connect(zoomOutAct, SIGNAL(triggered()), this, SLOT(goZoomOut()));
|
||||||
|
|
||||||
|
goMouseClickAct = new QAction(tr("Go too where you right clicked the mouse"), this);
|
||||||
|
goMouseClickAct->setStatusTip(tr("Center the map onto where you right clicked the mouse"));
|
||||||
|
connect(goMouseClickAct, SIGNAL(triggered()), this, SLOT(goMouseClick()));
|
||||||
|
|
||||||
goHomeAct = new QAction(tr("Go too &Home location"), this);
|
goHomeAct = new QAction(tr("Go too &Home location"), this);
|
||||||
goHomeAct->setShortcut(tr("Ctrl+H"));
|
goHomeAct->setShortcut(tr("Ctrl+H"));
|
||||||
@ -797,7 +809,7 @@ void OPMapGadgetWidget::reload()
|
|||||||
void OPMapGadgetWidget::findPlace()
|
void OPMapGadgetWidget::findPlace()
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
QString text = QInputDialog::getText(this, tr("GCS"), tr("Find place"), QLineEdit::Normal, QString::null, &ok);
|
QString text = QInputDialog::getText(this, tr("OpenPilot GCS"), tr("Find place"), QLineEdit::Normal, QString::null, &ok);
|
||||||
if (ok && !text.isEmpty())
|
if (ok && !text.isEmpty())
|
||||||
{
|
{
|
||||||
if (m_map)
|
if (m_map)
|
||||||
@ -805,11 +817,29 @@ void OPMapGadgetWidget::findPlace()
|
|||||||
core::GeoCoderStatusCode::Types x = m_map->SetCurrentPositionByKeywords(text);
|
core::GeoCoderStatusCode::Types x = m_map->SetCurrentPositionByKeywords(text);
|
||||||
QString returned_text = mapcontrol::Helper::StrFromGeoCoderStatusCode(x);
|
QString returned_text = mapcontrol::Helper::StrFromGeoCoderStatusCode(x);
|
||||||
|
|
||||||
int ret = QMessageBox::information(this, tr("GCS"), returned_text, QMessageBox::Ok);
|
int ret = QMessageBox::information(this, tr("OpenPilot GCS"), returned_text, QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OPMapGadgetWidget::goZoomIn()
|
||||||
|
{
|
||||||
|
if (m_map)
|
||||||
|
setZoom(m_map->Zoom() + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OPMapGadgetWidget::goZoomOut()
|
||||||
|
{
|
||||||
|
if (m_map)
|
||||||
|
setZoom(m_map->Zoom() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OPMapGadgetWidget::goMouseClick()
|
||||||
|
{
|
||||||
|
if (m_map)
|
||||||
|
m_map->SetCurrentPosition(m_map->currentMousePosition()); // center the map onto the mouse position
|
||||||
|
}
|
||||||
|
|
||||||
void OPMapGadgetWidget::goHome()
|
void OPMapGadgetWidget::goHome()
|
||||||
{
|
{
|
||||||
followUAVAct->setChecked(false);
|
followUAVAct->setChecked(false);
|
||||||
|
@ -91,6 +91,9 @@ private slots:
|
|||||||
// context menu signals
|
// context menu signals
|
||||||
void reload();
|
void reload();
|
||||||
void findPlace();
|
void findPlace();
|
||||||
|
void goZoomIn();
|
||||||
|
void goZoomOut();
|
||||||
|
void goMouseClick();
|
||||||
void goHome();
|
void goHome();
|
||||||
void goUAV();
|
void goUAV();
|
||||||
void followUAV();
|
void followUAV();
|
||||||
@ -143,6 +146,7 @@ private:
|
|||||||
QAction *findPlaceAct;
|
QAction *findPlaceAct;
|
||||||
QAction *zoomInAct;
|
QAction *zoomInAct;
|
||||||
QAction *zoomOutAct;
|
QAction *zoomOutAct;
|
||||||
|
QAction *goMouseClickAct;
|
||||||
QAction *goHomeAct;
|
QAction *goHomeAct;
|
||||||
QAction *goUAVAct;
|
QAction *goUAVAct;
|
||||||
QAction *followUAVAct;
|
QAction *followUAVAct;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user