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

Cleaning up the new map user control colours, trying to fix the tooltip popups.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@896 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
pip 2010-06-26 12:44:28 +00:00 committed by pip
parent 55f13788de
commit 0cc894c94a
5 changed files with 284 additions and 81 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

View File

@ -11,5 +11,6 @@
<file>images/minus.png</file> <file>images/minus.png</file>
<file>images/waypoint.png</file> <file>images/waypoint.png</file>
<file>images/hold.png</file> <file>images/hold.png</file>
<file>images/combobox_down_arrow.png</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -22,6 +22,9 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
@ -58,7 +61,79 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(110, 110, 110, 255), stop:1 rgba(71, 71, 71, 255));</string> <string notr="true">QFrame {
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(110, 110, 110, 255), stop:1 rgba(71, 71, 71, 255));
color: rgba(255, 255, 255, 70);
}
QLabel { /* all label types */
/* background-color: rgba(255, 255, 255, 0); */
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(64, 64, 64, 255), stop:1 rgba(128, 128, 128, 255));
color: rgb(255, 255, 255);
}
QToolButton { /* all types of tool button */
background-color: rgba(255, 255, 255, 0);
color: rgb(255, 255, 255);
/*border-style: none;*/
border: 0px;
}
QToolButton:hover {
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(255, 160, 0, 255), stop:1 rgba(160, 100, 0, 255));
color: rgb(255, 255, 255);
}
QToolButton:pressed {
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(48, 48, 48, 255), stop:1 rgba(120, 120, 120, 255));
color: rgb(255, 255, 255);
}
QToolButton:checked {
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(48, 48, 48, 255), stop:1 rgba(120, 120, 120, 255));
color: rgb(255, 255, 255);
}
QSlider::groove:horizontal {
border: none;
height: 4px;
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(48, 48, 48, 255), stop:1 rgba(80, 80, 80, 255));
margin: 2px 0;
}
QSlider::handle:horizontal {
border: 1px solid #5c5c5c;
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(255, 255, 255, 255), stop:1 rgba(128, 128, 128, 255));
width: 24px;
margin: -2px 0;
border-radius: 3px;
}
QComboBox {
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(48, 48, 48, 255), stop:1 rgba(120, 120, 120, 255));
color: rgb(255, 255, 255);
}
QComboBox:hover {
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(48, 48, 48, 255), stop:1 rgba(120, 120, 120, 255));
background-color: rgb(197, 138, 0);
}
QComboBox::down-arrow {
image: url(:/opmap/images/combobox_down_arrow.png);
}
QComboBox:drop-down {
subcontrol-origin: padding;
subcontrol-position: top right;
border-left-style: none;
border-top-right-radius: 1px;
border-bottom-right-radius: 1px;
}
QToolTip {
background-color: white;
color: black;
border: 1px solid black;
padding: 5px;
border-radius: 2px;
/* opacity: 170; */
}
</string>
</property> </property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::NoFrame</enum> <enum>QFrame::NoFrame</enum>
@ -105,8 +180,7 @@
<string>Show/Hide Waypoint Treeview</string> <string>Show/Hide Waypoint Treeview</string>
</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);</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
@ -130,15 +204,44 @@ color: rgb(255, 255, 255);</string>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QComboBox" name="comboBoxFindPlace">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="editable">
<bool>true</bool>
</property>
<property name="maxVisibleItems">
<number>20</number>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
<property name="frame">
<bool>false</bool>
</property>
</widget>
</item>
<item> <item>
<widget class="QToolButton" name="toolButtonFindPlace"> <widget class="QToolButton" name="toolButtonFindPlace">
<property name="toolTip"> <property name="toolTip">
<string>Find place</string> <string>Find place</string>
</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);
</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
@ -177,8 +280,7 @@ color: rgb(255, 255, 255);
<string>Center map over home position</string> <string>Center map over home position</string>
</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);</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
@ -207,8 +309,7 @@ color: rgb(255, 255, 255);</string>
<string>Center map over UAV position</string> <string>Center map over UAV position</string>
</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);</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
@ -250,8 +351,7 @@ color: rgb(255, 255, 255);</string>
<string>Add a waypoint</string> <string>Add a waypoint</string>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">background-color: rgba(71, 71, 71, 0); <string notr="true"/>
color: rgb(255, 255, 255);</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
@ -280,8 +380,7 @@ color: rgb(255, 255, 255);</string>
<string>Opens the waypoint editor</string> <string>Opens the waypoint editor</string>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">background-color: rgba(71, 71, 71, 0); <string notr="true"/>
color: rgb(255, 255, 255);</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
@ -320,8 +419,7 @@ color: rgb(255, 255, 255);</string>
<string>Zoom out</string> <string>Zoom out</string>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">background-color: rgba(71, 71, 71, 0); <string notr="true"/>
color: rgb(255, 255, 255);</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
@ -351,8 +449,7 @@ p, li { white-space: pre-wrap; }
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt; color:#ffffff;&quot;&gt;Zoom in&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt; color:#ffffff;&quot;&gt;Zoom in&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">background-color: rgba(71, 71, 71, 0); <string notr="true"/>
color: rgb(255, 255, 255);</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
@ -395,6 +492,9 @@ color: rgb(255, 255, 255);</string>
<property name="toolTip"> <property name="toolTip">
<string>Zoom level</string> <string>Zoom level</string>
</property> </property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 0); <string notr="true">background-color: rgba(255, 255, 255, 0);
color: rgb(255, 255, 255);</string> color: rgb(255, 255, 255);</string>
@ -411,6 +511,15 @@ color: rgb(255, 255, 255);</string>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="invertedControls">
<bool>false</bool>
</property>
<property name="tickPosition">
<enum>QSlider::NoTicks</enum>
</property>
<property name="tickInterval">
<number>2</number>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -458,8 +567,7 @@ color: rgb(255, 255, 255);</string>
<string>Reload map</string> <string>Reload map</string>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255); <string notr="true"/>
background-color: rgba(255, 255, 255, 0);</string>
</property> </property>
<property name="text"> <property name="text">
<string>Reload</string> <string>Reload</string>
@ -500,8 +608,7 @@ background-color: rgba(255, 255, 255, 0);</string>
<string>Show/Hide Flight Controls</string> <string>Show/Hide Flight Controls</string>
</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);</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
@ -530,7 +637,7 @@ color: rgb(255, 255, 255);</string>
<item> <item>
<widget class="QSplitter" name="splitter"> <widget class="QSplitter" name="splitter">
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(71, 71, 71, 255), stop:1 rgba(110, 110, 110, 255));</string> <string notr="true">background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));</string>
</property> </property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::NoFrame</enum> <enum>QFrame::NoFrame</enum>
@ -621,7 +728,19 @@ QTreeView::branch:open:has-children:!has-siblings, QTreeView::branch:open:has-ch
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">background-color: rgb(0, 0, 0);</string> <string notr="true">QWidget {
background-color: black;
}
QToolTip {
background-color: white;
color: black;
border: 1px solid black;
padding: 2px;
border-radius: 3px;
/* opacity: 170; */
}
</string>
</property> </property>
</widget> </widget>
</widget> </widget>
@ -650,18 +769,45 @@ QTreeView::branch:open:has-children:!has-siblings, QTreeView::branch:open:has-ch
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(71, 71, 71, 255), stop:1 rgba(110, 110, 110, 255)); <string notr="true">QWidget { /* all types of qwidget */
color: rgb(255, 255, 255);</string> background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(71, 71, 71, 255), stop:1 rgba(110, 110, 110, 255));
color: rgb(255, 255, 255);
}
QToolButton { /* all types of tool button */
background-color: rgba(255, 255, 255, 0);
color: rgb(255, 255, 255);
/*border-style: none;*/
border: 0px;
}
QToolButton:hover {
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(128, 128, 128, 255), stop:1 rgba(64, 64, 64, 255));
color: rgb(255, 255, 255);
}
QToolButton:pressed {
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(48, 48, 48, 255), stop:1 rgba(120, 120, 120, 255));
color: rgb(255, 255, 255);
}
QToolTip {
background-color: white;
color: black;
border: 1px solid black;
padding: 2px;
border-radius: 3px;
/* opacity: 170; */
}
</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_4"> <layout class="QVBoxLayout" name="verticalLayout_4">
<property name="leftMargin"> <property name="leftMargin">
<number>5</number> <number>8</number>
</property> </property>
<property name="topMargin"> <property name="topMargin">
<number>0</number> <number>0</number>
</property> </property>
<property name="rightMargin"> <property name="rightMargin">
<number>5</number> <number>0</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
@ -675,8 +821,7 @@ color: rgb(255, 255, 255);</string>
<bool>false</bool> <bool>false</bool>
</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);</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
@ -705,8 +850,7 @@ color: rgb(255, 255, 255);</string>
<string>UAV hold position</string> <string>UAV hold position</string>
</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);</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
@ -732,8 +876,7 @@ color: rgb(255, 255, 255);</string>
<string>UAV go!</string> <string>UAV go!</string>
</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);</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
@ -784,7 +927,26 @@ color: rgb(255, 255, 255);</string>
</size> </size>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(110, 110, 110, 255), stop:1 rgba(71, 71, 71, 255));</string> <string notr="true">QFrame{
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(110, 110, 110, 255), stop:1 rgba(71, 71, 71, 255));
color: rgba(255, 255, 255, 70);
}
QLabel { /* all label types */
/* background-color: rgba(255, 255, 255, 0); */
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(64, 64, 64, 255), stop:1 rgba(128, 128, 128, 255));
color: rgb(255, 255, 255);
}
QToolTip {
background-color: rgb(255, 255, 255);
color: rgb(0, 0, 0);
border: 1px solid blacki;
padding: 5px;
border-radius: 3px;
/* opacity: 170; */
}
</string>
</property> </property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::NoFrame</enum> <enum>QFrame::NoFrame</enum>
@ -802,10 +964,10 @@ color: rgb(255, 255, 255);</string>
<item> <item>
<layout class="QHBoxLayout" name="layoutWidgetStatusBar"> <layout class="QHBoxLayout" name="layoutWidgetStatusBar">
<property name="spacing"> <property name="spacing">
<number>0</number> <number>3</number>
</property> </property>
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>3</number>
</property> </property>
<property name="rightMargin"> <property name="rightMargin">
<number>8</number> <number>8</number>
@ -831,8 +993,7 @@ color: rgb(255, 255, 255);</string>
<string>Map position</string> <string>Map position</string>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255); <string notr="true"/>
background-color: rgba(255, 255, 255, 0);</string>
</property> </property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::NoFrame</enum> <enum>QFrame::NoFrame</enum>
@ -848,16 +1009,6 @@ background-color: rgba(255, 255, 255, 0);</string>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="Line" name="line">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item> <item>
<widget class="QLabel" name="labelMousePos"> <widget class="QLabel" name="labelMousePos">
<property name="sizePolicy"> <property name="sizePolicy">
@ -879,8 +1030,7 @@ background-color: rgba(255, 255, 255, 0);</string>
<string>Mouse position</string> <string>Mouse position</string>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255); <string notr="true"/>
background-color: rgba(255, 255, 255, 0);</string>
</property> </property>
<property name="text"> <property name="text">
<string>labelMousePos</string> <string>labelMousePos</string>
@ -893,16 +1043,6 @@ background-color: rgba(255, 255, 255, 0);</string>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="Line" name="line_2">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer_3"> <spacer name="horizontalSpacer_3">
<property name="orientation"> <property name="orientation">
@ -941,14 +1081,10 @@ background-color: rgba(255, 255, 255, 0);</string>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">QProgressBar { <string notr="true">QProgressBar {
/*border: 1px solid black;*/
border: none; border: none;
padding: 1px; padding: 1px;
/*border-top-left-radius: 7px; background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(48, 48, 48, 255), stop:1 rgba(120, 120, 120, 255));
border-bottom-left-radius: 7px;*/ color: rgb(255, 255, 255);
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(100, 100, 100, 255));
/*width: 15px;*/
color: rgb(255, 255, 255);
} }
QProgressBar::chunk { QProgressBar::chunk {
background-color: rgb(85, 85, 255); background-color: rgb(85, 85, 255);

View File

@ -46,8 +46,11 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
m_map = NULL; m_map = NULL;
waypoint_editor = NULL; waypoint_editor = NULL;
wayPoint_treeView_model = NULL; wayPoint_treeView_model = NULL;
findPlaceCompleter = NULL;
setMouseTracking(true); // setMouseTracking(true);
prev_tile_number = 0;
// ************** // **************
// Get required UAVObjects // Get required UAVObjects
@ -94,6 +97,21 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
m_widget->treeViewWaypoints->setVisible(false); m_widget->treeViewWaypoints->setVisible(false);
m_widget->toolButtonWaypointsTreeViewShowHide->setIcon(QIcon(QString::fromUtf8(":/core/images/next.png"))); m_widget->toolButtonWaypointsTreeViewShowHide->setIcon(QIcon(QString::fromUtf8(":/core/images/next.png")));
// **************
// add an auto-completer to the find-place line edit box
/*
findPlaceWordList << "england" << "london" << "birmingham" << "shropshire";
QCompleter *findPlaceCompleter = new QCompleter(findPlaceWordList, this);
findPlaceCompleter->setCaseSensitivity(Qt::CaseInsensitive);
findPlaceCompleter->setCompletionMode(QCompleter::PopupCompletion);
findPlaceCompleter->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
m_widget->comboBoxFindPlace->setCompleter(findPlaceCompleter);
*/
m_widget->comboBoxFindPlace->setAutoCompletion(true);
connect( m_widget->comboBoxFindPlace->lineEdit(), SIGNAL(returnPressed()), this, SLOT(on_comboBoxFindPlace_returnPressed()));
// ************** // **************
// map stuff // map stuff
@ -483,11 +501,17 @@ void OPMapGadgetWidget::OnTilesStillToLoad(int number)
{ {
if (m_widget) if (m_widget)
{ {
// if (prev_tile_number < number || m_widget->progressBarMap->maximum() < number)
// m_widget->progressBarMap->setMaximum(number);
if (m_widget->progressBarMap->maximum() < number) if (m_widget->progressBarMap->maximum() < number)
m_widget->progressBarMap->setMaximum(number); // update the maximum number of tiles used m_widget->progressBarMap->setMaximum(number);
m_widget->progressBarMap->setValue(m_widget->progressBarMap->maximum() - number); // update the progress bar m_widget->progressBarMap->setValue(m_widget->progressBarMap->maximum() - number); // update the progress bar
// m_widget->labelNumTilesToLoad->setText(" " + QString::number(number)); // m_widget->labelNumTilesToLoad->setText(" " + QString::number(number));
prev_tile_number = number;
} }
} }
@ -522,9 +546,36 @@ void OPMapGadgetWidget::on_toolButtonReload_clicked()
m_map->ReloadMap(); m_map->ReloadMap();
} }
void OPMapGadgetWidget::on_comboBoxFindPlace_returnPressed()
{
QString place = m_widget->comboBoxFindPlace->currentText().simplified();
if (place.isNull() || place.isEmpty()) return;
if (!findPlaceWordList.contains(place, Qt::CaseInsensitive))
{
findPlaceWordList << place; // add the new word into the history list
/*
m_widget->comboBoxFindPlace->setCompleter(NULL);
delete findPlaceCompleter;
findPlaceCompleter = new QCompleter(findPlaceWordList, this);
findPlaceCompleter->setCaseSensitivity(Qt::CaseInsensitive);
findPlaceCompleter->setCompletionMode(QCompleter::PopupCompletion);
findPlaceCompleter->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
m_widget->comboBoxFindPlace->setCompleter(findPlaceCompleter);
*/
}
if (!m_map) return;
core::GeoCoderStatusCode::Types x = m_map->SetCurrentPositionByKeywords(place);
QString returned_text = mapcontrol::Helper::StrFromGeoCoderStatusCode(x);
QMessageBox::information(this, tr("OpenPilot GCS"), returned_text, QMessageBox::Ok);
}
void OPMapGadgetWidget::on_toolButtonFindPlace_clicked() void OPMapGadgetWidget::on_toolButtonFindPlace_clicked()
{ {
findPlace(); on_comboBoxFindPlace_returnPressed();
} }
void OPMapGadgetWidget::on_toolButtonZoomP_clicked() void OPMapGadgetWidget::on_toolButtonZoomP_clicked()
@ -661,7 +712,7 @@ void OPMapGadgetWidget::setUseMemoryCache(bool useMemoryCache)
void OPMapGadgetWidget::setCacheLocation(QString cacheLocation) void OPMapGadgetWidget::setCacheLocation(QString cacheLocation)
{ {
cacheLocation = cacheLocation.trimmed(); // remove any surrounding spaces cacheLocation = cacheLocation.simplified(); // remove any surrounding spaces
if (cacheLocation.isEmpty()) return; if (cacheLocation.isEmpty()) return;
@ -943,18 +994,26 @@ void OPMapGadgetWidget::reload()
void OPMapGadgetWidget::findPlace() void OPMapGadgetWidget::findPlace()
{ {
bool ok; m_widget->comboBoxFindPlace->setFocus(); // move focus to the 'find place' text box
QString text = QInputDialog::getText(this, tr("OpenPilot GCS"), tr("Find place"), QLineEdit::Normal, QString::null, &ok);
if (ok && !text.isEmpty())
{
if (m_map)
{
core::GeoCoderStatusCode::Types x = m_map->SetCurrentPositionByKeywords(text);
QString returned_text = mapcontrol::Helper::StrFromGeoCoderStatusCode(x);
int ret = QMessageBox::information(this, tr("OpenPilot GCS"), returned_text, QMessageBox::Ok); /*
} bool ok;
QString place = QInputDialog::getText(this, tr("OpenPilot GCS"), tr("Find place"), QLineEdit::Normal, QString::null, &ok);
place = place.simplified();
if (!ok || place.isNull() || place.isEmpty()) return;
if (!findPlaceWordList.contains(place, Qt::CaseInsensitive))
{
findPlaceWordList += place; // add the new word into the history list
} }
if (!m_map) return;
core::GeoCoderStatusCode::Types x = m_map->SetCurrentPositionByKeywords(place);
QString returned_text = mapcontrol::Helper::StrFromGeoCoderStatusCode(x);
QMessageBox::information(this, tr("OpenPilot GCS"), returned_text, QMessageBox::Ok);
*/
} }
void OPMapGadgetWidget::goZoomIn() void OPMapGadgetWidget::goZoomIn()

View File

@ -32,6 +32,7 @@
#include <QtGui/QWidget> #include <QtGui/QWidget>
#include <QtGui/QMenu> #include <QtGui/QMenu>
#include <QStringList>
#include <QStandardItemModel> #include <QStandardItemModel>
#include "uavobjects/uavobjectmanager.h" #include "uavobjects/uavobjectmanager.h"
@ -78,6 +79,7 @@ private slots:
// user control signals // user control signals
void on_toolButtonReload_clicked(); void on_toolButtonReload_clicked();
void on_comboBoxFindPlace_returnPressed();
void on_toolButtonFindPlace_clicked(); void on_toolButtonFindPlace_clicked();
void on_toolButtonZoomM_clicked(); void on_toolButtonZoomM_clicked();
void on_toolButtonZoomP_clicked(); void on_toolButtonZoomP_clicked();
@ -145,6 +147,11 @@ private:
internals::PointLatLng mouse_lat_lon; internals::PointLatLng mouse_lat_lon;
int prev_tile_number;
QStringList findPlaceWordList;
QCompleter *findPlaceCompleter;
QTimer *m_updateTimer; QTimer *m_updateTimer;
QTimer *m_statusUpdateTimer; QTimer *m_statusUpdateTimer;