mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
Added compass show/hide context menu option and fixed initial map provider on the new map plug-in.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@943 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
76dbf62375
commit
1f924cf5b0
@ -17,7 +17,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
@ -140,7 +140,7 @@ QComboBox QAbstractItemView { /* the drop down list */
|
||||
background-color: rgb(255, 255, 255);
|
||||
color: rgb(0, 0, 0);
|
||||
border: 1px solid black;
|
||||
selection-background-color: rgb(128, 128, 128);
|
||||
selection-background-color: rgb(160, 160, 255);
|
||||
border-radius: 2px;
|
||||
}
|
||||
</string>
|
||||
@ -595,37 +595,6 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonReload">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reload map</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reload</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="arrowType">
|
||||
<enum>Qt::NoArrow</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonFlightControlsShowHide">
|
||||
<property name="sizePolicy">
|
||||
@ -762,6 +731,9 @@ QTreeView::branch:open:has-children:!has-siblings, QTreeView::branch:open:has-ch
|
||||
<property name="tabKeyNavigation">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectItems</enum>
|
||||
</property>
|
||||
<property name="animated">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@ -783,7 +755,7 @@ QTreeView::branch:open:has-children:!has-siblings, QTreeView::branch:open:has-ch
|
||||
</size>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="acceptDrops">
|
||||
<bool>true</bool>
|
||||
|
@ -167,12 +167,15 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
}
|
||||
|
||||
// **************
|
||||
// init the waypoint tree
|
||||
|
||||
wayPoint_treeView_model = new QStandardItemModel();
|
||||
m_widget->treeViewWaypoints->setModel(wayPoint_treeView_model);
|
||||
|
||||
|
||||
/*
|
||||
// test
|
||||
wayPoint_treeView_model = new QStandardItemModel(5, 2);
|
||||
// wayPoint_treeView_model = new QStandardItemModel(5, 2);
|
||||
for (int r = 0; r < 5; r++)
|
||||
{
|
||||
for (int c = 0; c < 2; c++)
|
||||
@ -195,31 +198,37 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
wayPoint_treeView_model->setHorizontalHeaderItem(0, new QStandardItem("Foo"));
|
||||
wayPoint_treeView_model->setHorizontalHeaderItem(1, new QStandardItem("Bar-Baz"));
|
||||
|
||||
m_widget->treeViewWaypoints->setModel(wayPoint_treeView_model);
|
||||
// m_widget->treeViewWaypoints->setModel(wayPoint_treeView_model);
|
||||
*/
|
||||
|
||||
// test
|
||||
wayPoint_treeView_model = new QStandardItemModel();
|
||||
for (int r = 0; r < 5; r++)
|
||||
{
|
||||
// waypoint group
|
||||
QStandardItem *item = new QStandardItem(QString("UK waypoint group %0").arg(r));
|
||||
|
||||
// add the way points
|
||||
for (int i = 1; i < 5; i++)
|
||||
{
|
||||
QStandardItem *child = new QStandardItem(QIcon(QString::fromUtf8(":/opmap/images/waypoint.png")), QString("Waypoint %0").arg(i));
|
||||
child->setEditable(false);
|
||||
item->appendRow(child);
|
||||
}
|
||||
|
||||
wayPoint_treeView_model->appendRow(item);
|
||||
|
||||
|
||||
// test only
|
||||
|
||||
// create a waypoint group
|
||||
QStandardItem *item = new QStandardItem(tr("Camera shoot at the town hall"));
|
||||
for (int i = 1; i < 5; i++)
|
||||
{ // add some way points
|
||||
QStandardItem *child = new QStandardItem(QIcon(QString::fromUtf8(":/opmap/images/waypoint.png")), QString("Waypoint %0").arg(i));
|
||||
child->setEditable(true);
|
||||
item->appendRow(child);
|
||||
}
|
||||
// wayPoint_treeView_model->setHorizontalHeaderItem(0, new QStandardItem("Waypoint list"));
|
||||
wayPoint_treeView_model->appendRow(item);
|
||||
|
||||
m_widget->treeViewWaypoints->setModel(wayPoint_treeView_model);
|
||||
|
||||
|
||||
// create another waypoint group
|
||||
item = new QStandardItem(tr("Flight path 62"));
|
||||
for (int i = 1; i < 8; i++)
|
||||
{ // add some way points
|
||||
QStandardItem *child = new QStandardItem(QIcon(QString::fromUtf8(":/opmap/images/waypoint.png")), QString("Waypoint %0").arg(i));
|
||||
child->setEditable(true);
|
||||
item->appendRow(child);
|
||||
}
|
||||
wayPoint_treeView_model->appendRow(item);
|
||||
|
||||
|
||||
|
||||
|
||||
@ -276,7 +285,7 @@ void OPMapGadgetWidget::mouseMoveEvent(QMouseEvent *event)
|
||||
// { // the mouse has moved
|
||||
// mouse_lat_lon = lat_lon;
|
||||
//
|
||||
// QString coord_str = " " + QString::number(mouse_lat_lon.Lat(), 'f', 6) + " " + QString::number(mouse_lat_lon.Lng(), 'f', 6) + " ";
|
||||
// QString coord_str = " " + QString::number(mouse_lat_lon.Lat(), 'f', 7) + " " + QString::number(mouse_lat_lon.Lng(), 'f', 7) + " ";
|
||||
//
|
||||
// statusLabel.setText(coord_str);
|
||||
// widget->labelStatus->setText(coord_str);
|
||||
@ -309,6 +318,8 @@ void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
// ****************
|
||||
// create the popup menu
|
||||
|
||||
QMenu menu(this);
|
||||
|
||||
QMenu zoomMenu(tr("&Zoom ") + "(" + QString::number(m_map->Zoom()) + ")", this);
|
||||
zoomMenu.addAction(zoom2Act);
|
||||
zoomMenu.addAction(zoom3Act);
|
||||
@ -329,10 +340,6 @@ void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
zoomMenu.addAction(zoom18Act);
|
||||
zoomMenu.addAction(zoom19Act);
|
||||
|
||||
// ****************
|
||||
|
||||
QMenu menu(this);
|
||||
|
||||
menu.addAction(closeAct);
|
||||
|
||||
menu.addSeparator();
|
||||
@ -343,6 +350,10 @@ void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
|
||||
menu.addAction(findPlaceAct);
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
menu.addAction(showCompassAct);
|
||||
|
||||
menu.addSeparator()->setText(tr("Zoom"));
|
||||
|
||||
menu.addAction(zoomInAct);
|
||||
@ -437,8 +448,8 @@ void OPMapGadgetWidget::updatePosition()
|
||||
double uav_ground_speed = data.Groundspeed; // current UAV ground speed
|
||||
|
||||
// display the UAV lat/lon position
|
||||
QString str = " lat:" + QString::number(uav_pos.Lat(), 'f', 6) +
|
||||
" lon:" + QString::number(uav_pos.Lng(), 'f', 6) +
|
||||
QString str = " lat:" + QString::number(uav_pos.Lat(), 'f', 7) +
|
||||
" lon:" + QString::number(uav_pos.Lng(), 'f', 7) +
|
||||
" " + QString::number(uav_heading, 'f', 1) + "deg" +
|
||||
" " + QString::number(uav_height_feet, 'f', 1) + "feet" +
|
||||
" " + QString::number(uav_ground_speed, 'f', 1) + "mph";
|
||||
@ -473,7 +484,7 @@ void OPMapGadgetWidget::updateMousePos()
|
||||
{ // the mouse has moved
|
||||
mouse_lat_lon = lat_lon;
|
||||
|
||||
QString str = " " + QString::number(mouse_lat_lon.Lat(), 'f', 6) + " " + QString::number(mouse_lat_lon.Lng(), 'f', 6);
|
||||
QString str = " " + QString::number(mouse_lat_lon.Lat(), 'f', 7) + " " + QString::number(mouse_lat_lon.Lng(), 'f', 7);
|
||||
if (m_widget) m_widget->labelMousePos->setText(str);
|
||||
}
|
||||
}
|
||||
@ -523,7 +534,7 @@ void OPMapGadgetWidget::OnCurrentPositionChanged(internals::PointLatLng point)
|
||||
{
|
||||
if (m_widget)
|
||||
{
|
||||
QString coord_str = " " + QString::number(point.Lat(), 'f', 6) + " " + QString::number(point.Lng(), 'f', 6) + " ";
|
||||
QString coord_str = " " + QString::number(point.Lat(), 'f', 7) + " " + QString::number(point.Lng(), 'f', 7) + " ";
|
||||
m_widget->labelMapPos->setText(coord_str);
|
||||
}
|
||||
}
|
||||
@ -548,12 +559,14 @@ void OPMapGadgetWidget::OnTilesStillToLoad(int number)
|
||||
|
||||
void OPMapGadgetWidget::OnTileLoadStart()
|
||||
{
|
||||
if (m_widget) m_widget->progressBarMap->setVisible(true);
|
||||
if (m_widget)
|
||||
m_widget->progressBarMap->setVisible(true);
|
||||
}
|
||||
|
||||
void OPMapGadgetWidget::OnTileLoadComplete()
|
||||
{
|
||||
if (m_widget) m_widget->progressBarMap->setVisible(false);
|
||||
if (m_widget)
|
||||
m_widget->progressBarMap->setVisible(false);
|
||||
}
|
||||
|
||||
void OPMapGadgetWidget::OnMapZoomChanged()
|
||||
@ -571,22 +584,22 @@ void OPMapGadgetWidget::OnEmptyTileError(int zoom, core::Point pos)
|
||||
// to do
|
||||
}
|
||||
|
||||
void OPMapGadgetWidget::WPNumberChanged(int const& oldnumber, int const& newnumber, WayPointItem* waypoint)
|
||||
void OPMapGadgetWidget::WPNumberChanged(int const &oldnumber, int const &newnumber, WayPointItem *waypoint)
|
||||
{
|
||||
// to do
|
||||
}
|
||||
|
||||
void OPMapGadgetWidget::WPValuesChanged(WayPointItem* waypoint)
|
||||
void OPMapGadgetWidget::WPValuesChanged(WayPointItem *waypoint)
|
||||
{
|
||||
// to do
|
||||
}
|
||||
|
||||
void OPMapGadgetWidget::WPInserted(int const& number, WayPointItem* waypoint)
|
||||
void OPMapGadgetWidget::WPInserted(int const &number, WayPointItem *waypoint)
|
||||
{
|
||||
// to do
|
||||
}
|
||||
|
||||
void OPMapGadgetWidget::WPDeleted(int const& number)
|
||||
void OPMapGadgetWidget::WPDeleted(int const &number)
|
||||
{
|
||||
// to do
|
||||
}
|
||||
@ -594,12 +607,6 @@ void OPMapGadgetWidget::WPDeleted(int const& number)
|
||||
// *************************************************************************************
|
||||
// user control signals
|
||||
|
||||
void OPMapGadgetWidget::on_toolButtonReload_clicked()
|
||||
{
|
||||
if (m_map)
|
||||
m_map->ReloadMap();
|
||||
}
|
||||
|
||||
void OPMapGadgetWidget::on_comboBoxFindPlace_returnPressed()
|
||||
{
|
||||
QString place = m_widget->comboBoxFindPlace->currentText().simplified();
|
||||
@ -727,7 +734,7 @@ void OPMapGadgetWidget::on_treeViewWaypoints_clicked(QModelIndex index)
|
||||
QStandardItem *item = wayPoint_treeView_model->itemFromIndex(index);
|
||||
if (!item) return;
|
||||
|
||||
// Do something with the item ...
|
||||
// to do
|
||||
}
|
||||
|
||||
// *************************************************************************************
|
||||
@ -767,8 +774,7 @@ void OPMapGadgetWidget::setPosition(QPointF pos)
|
||||
void OPMapGadgetWidget::setMapProvider(QString provider)
|
||||
{
|
||||
if (m_map)
|
||||
if (m_map->isStarted())
|
||||
m_map->SetMapType(mapcontrol::Helper::MapTypeFromString(provider));
|
||||
m_map->SetMapType(mapcontrol::Helper::MapTypeFromString(provider));
|
||||
}
|
||||
|
||||
void OPMapGadgetWidget::setAccessMode(QString accessMode)
|
||||
@ -842,6 +848,13 @@ void OPMapGadgetWidget::createActions()
|
||||
findPlaceAct->setStatusTip(tr("Find a location"));
|
||||
connect(findPlaceAct, SIGNAL(triggered()), this, SLOT(findPlace()));
|
||||
|
||||
showCompassAct = new QAction(tr("Show compass"), this);
|
||||
// showCompassAct->setShortcut(tr("Ctrl+M"));
|
||||
showCompassAct->setStatusTip(tr("Show/Hide the map compass"));
|
||||
showCompassAct->setCheckable(true);
|
||||
showCompassAct->setChecked(true);
|
||||
connect(showCompassAct, SIGNAL(toggled(bool)), this, SLOT(on_showCompassAct_toggled(bool)));
|
||||
|
||||
zoomInAct = new QAction(tr("Zoom &In"), this);
|
||||
zoomInAct->setShortcut(Qt::Key_PageUp);
|
||||
zoomInAct->setStatusTip(tr("Zoom the map in"));
|
||||
@ -1012,6 +1025,12 @@ void OPMapGadgetWidget::findPlace()
|
||||
*/
|
||||
}
|
||||
|
||||
void OPMapGadgetWidget::on_showCompassAct_toggled(bool show_compass)
|
||||
{
|
||||
if (m_map)
|
||||
m_map->SetShowCompass(show_compass);
|
||||
}
|
||||
|
||||
void OPMapGadgetWidget::goZoomIn()
|
||||
{
|
||||
if (m_map)
|
||||
|
@ -106,7 +106,6 @@ private slots:
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
void on_toolButtonReload_clicked();
|
||||
void on_comboBoxFindPlace_returnPressed();
|
||||
void on_toolButtonFindPlace_clicked();
|
||||
void on_toolButtonZoomM_clicked();
|
||||
@ -151,6 +150,7 @@ private slots:
|
||||
*/
|
||||
void reload();
|
||||
void findPlace();
|
||||
void on_showCompassAct_toggled(bool show_compass);
|
||||
void goZoomIn();
|
||||
void goZoomOut();
|
||||
void goMouseClick();
|
||||
@ -221,6 +221,7 @@ private:
|
||||
QAction *closeAct;
|
||||
QAction *reloadAct;
|
||||
QAction *findPlaceAct;
|
||||
QAction *showCompassAct;
|
||||
QAction *zoomInAct;
|
||||
QAction *zoomOutAct;
|
||||
QAction *goMouseClickAct;
|
||||
|
Loading…
x
Reference in New Issue
Block a user