1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-01 18:29:16 +01:00

Updated zoom user controls on the new map plug-in

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@850 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
pip 2010-06-21 18:47:29 +00:00 committed by pip
parent b2840b41ef
commit 8c5375d5ab
3 changed files with 42 additions and 24 deletions

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>647</width> <width>656</width>
<height>441</height> <height>171</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -239,29 +239,28 @@ color: rgb(255, 255, 255);</string>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="labelZoom"> <widget class="QComboBox" name="comboBoxZoom">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="font"> <property name="toolTip">
<font> <string>Zoom level</string>
<pointsize>8</pointsize> </property>
<weight>50</weight> <property name="autoFillBackground">
<bold>false</bold> <bool>false</bool>
</font>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 0); <string notr="true">color: rgb(255, 255, 255);
color: rgb(255, 255, 255);</string> </string>
</property> </property>
<property name="text"> <property name="maxVisibleItems">
<string>Zoom</string> <number>20</number>
</property> </property>
<property name="alignment"> <property name="frame">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
@ -651,8 +650,6 @@ border: none;
</layout> </layout>
</item> </item>
</layout> </layout>
<zorder>labelMapPos</zorder>
<zorder>layoutWidget_2</zorder>
</widget> </widget>
</item> </item>
</layout> </layout>

View File

@ -72,19 +72,23 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
m_map->configuration->DragButton = Qt::LeftButton; // use the left mouse button for map dragging m_map->configuration->DragButton = Qt::LeftButton; // use the left mouse button for map dragging
} }
// **************
createActions();
// ************** // **************
// set the user control options // set the user control options
m_widget->labelZoom->setText(QString::number(m_map->Zoom()));
m_widget->labelRotate->setText(QString::number(m_map->Rotate())); m_widget->labelRotate->setText(QString::number(m_map->Rotate()));
// m_widget->labelNumTilesToLoad->setText(" 0"); // m_widget->labelNumTilesToLoad->setText(" 0");
m_widget->labelMapPos->setText(""); m_widget->labelMapPos->setText("");
m_widget->labelMousePos->setText(""); m_widget->labelMousePos->setText("");
m_widget->progressBarMap->setMaximum(1); m_widget->progressBarMap->setMaximum(1);
// ************** m_widget->comboBoxZoom->clear();
for (int i = 2; i <= 19; i++)
createActions(); m_widget->comboBoxZoom->addItem(QString::number(i), i);
m_widget->comboBoxZoom->setCurrentIndex((int)(m_map->Zoom() + 0.5) - 2);
// ************** // **************
// map stuff // map stuff
@ -141,6 +145,8 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
m_statusUpdateTimer->start(); m_statusUpdateTimer->start();
// ************** // **************
connect(m_widget->comboBoxZoom, SIGNAL(currentIndexChanged(int)), this, SLOT(on_comboBoxZoom_currentIndexChanged(int)));
} }
// ************************************************************************************* // *************************************************************************************
@ -335,7 +341,13 @@ void OPMapGadgetWidget::zoomChanged(double zoom)
int i_zoom = (int)(zoom + 0.5); int i_zoom = (int)(zoom + 0.5);
if (m_widget) if (m_widget)
m_widget->labelZoom->setText(" " + QString::number(zoom)); {
// m_widget->labelZoom->setText(" " + QString::number(zoom));
disconnect(m_widget->comboBoxZoom, SIGNAL(currentIndexChanged(int)), this, 0);
m_widget->comboBoxZoom->setCurrentIndex(i_zoom - 2);
connect(m_widget->comboBoxZoom, SIGNAL(currentIndexChanged(int)), this, SLOT(on_comboBoxZoom_currentIndexChanged(int)));
}
switch (i_zoom) switch (i_zoom)
{ {
@ -364,7 +376,7 @@ void OPMapGadgetWidget::zoomChanged(double zoom)
void OPMapGadgetWidget::OnMapDrag() void OPMapGadgetWidget::OnMapDrag()
{ {
if (followUAVAct->isChecked()) if (followUAVAct->isChecked())
followUAVAct->setChecked(false); // disable follow UAV mode followUAVAct->setChecked(false); // disable follow UAV mode when the user starts to manually drag the map
} }
void OPMapGadgetWidget::OnCurrentPositionChanged(internals::PointLatLng point) void OPMapGadgetWidget::OnCurrentPositionChanged(internals::PointLatLng point)
@ -498,6 +510,14 @@ void OPMapGadgetWidget::on_pushButtonGeoFenceP_clicked()
} }
} }
void OPMapGadgetWidget::on_comboBoxZoom_currentIndexChanged(int index)
{
bool ok;
int i = (int)m_widget->comboBoxZoom->itemData(index).toInt(&ok);
setZoom(2 + index);
}
// ************************************************************************************* // *************************************************************************************
// public functions // public functions

View File

@ -78,6 +78,7 @@ private slots:
void on_toolButtonZoomP_clicked(); void on_toolButtonZoomP_clicked();
void on_pushButtonGeoFenceM_clicked(); void on_pushButtonGeoFenceM_clicked();
void on_pushButtonGeoFenceP_clicked(); void on_pushButtonGeoFenceP_clicked();
void on_comboBoxZoom_currentIndexChanged(int index);
// map signals // map signals
void zoomChanged(double zoom); void zoomChanged(double zoom);