From 0cc894c94a4bc09134b8df657c2a3f005a83e375 Mon Sep 17 00:00:00 2001 From: pip Date: Sat, 26 Jun 2010 12:44:28 +0000 Subject: [PATCH] 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 --- .../opmap/images/combobox_down_arrow.png | Bin 0 -> 384 bytes ground/src/plugins/opmap/opmap.qrc | 1 + ground/src/plugins/opmap/opmap_widget.ui | 270 +++++++++++++----- .../src/plugins/opmap/opmapgadgetwidget.cpp | 87 +++++- ground/src/plugins/opmap/opmapgadgetwidget.h | 7 + 5 files changed, 284 insertions(+), 81 deletions(-) create mode 100644 ground/src/plugins/opmap/images/combobox_down_arrow.png diff --git a/ground/src/plugins/opmap/images/combobox_down_arrow.png b/ground/src/plugins/opmap/images/combobox_down_arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..b54967f94d4eef205ae124e2ed8f89047ed87a96 GIT binary patch literal 384 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!PKj$oiE~kEVo7FxoUq)W=@p>FdgVi%p74UplIK@l&7> zXMsm#F#`kF2M}g-T4OQ;D9DoT=gwvU zv$L6)m_kBA_U+rZb?a7reSHN5h2_haA2@KJxw)BxgCi#=XYbyDT3zw`ug(ro36f*nG>Utmzb8A>Rc+TEF3wHiJ8HLf#uRsi#%JP O9SokXelF{r5}E+Z{BKimages/minus.png images/waypoint.png images/hold.png + images/combobox_down_arrow.png diff --git a/ground/src/plugins/opmap/opmap_widget.ui b/ground/src/plugins/opmap/opmap_widget.ui index c6acf17c7..b6713207b 100644 --- a/ground/src/plugins/opmap/opmap_widget.ui +++ b/ground/src/plugins/opmap/opmap_widget.ui @@ -22,6 +22,9 @@ Form + + + 0 @@ -58,7 +61,79 @@ false - 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)); + 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; */ +} + QFrame::NoFrame @@ -105,8 +180,7 @@ Show/Hide Waypoint Treeview - background-color: rgba(255, 255, 255, 0); -color: rgb(255, 255, 255); + @@ -130,15 +204,44 @@ color: rgb(255, 255, 255); + + + + + 0 + 0 + + + + + 120 + 0 + + + + + + + true + + + 20 + + + QComboBox::AdjustToContents + + + false + + + Find place - background-color: rgba(255, 255, 255, 0); -color: rgb(255, 255, 255); - + @@ -177,8 +280,7 @@ color: rgb(255, 255, 255); Center map over home position - background-color: rgba(255, 255, 255, 0); -color: rgb(255, 255, 255); + @@ -207,8 +309,7 @@ color: rgb(255, 255, 255); Center map over UAV position - background-color: rgba(255, 255, 255, 0); -color: rgb(255, 255, 255); + @@ -250,8 +351,7 @@ color: rgb(255, 255, 255); Add a waypoint - background-color: rgba(71, 71, 71, 0); -color: rgb(255, 255, 255); + @@ -280,8 +380,7 @@ color: rgb(255, 255, 255); Opens the waypoint editor - background-color: rgba(71, 71, 71, 0); -color: rgb(255, 255, 255); + @@ -320,8 +419,7 @@ color: rgb(255, 255, 255); Zoom out - background-color: rgba(71, 71, 71, 0); -color: rgb(255, 255, 255); + @@ -351,8 +449,7 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt; color:#ffffff;">Zoom in</span></p></body></html> - background-color: rgba(71, 71, 71, 0); -color: rgb(255, 255, 255); + @@ -395,6 +492,9 @@ color: rgb(255, 255, 255); Zoom level + + false + background-color: rgba(255, 255, 255, 0); color: rgb(255, 255, 255); @@ -411,6 +511,15 @@ color: rgb(255, 255, 255); Qt::Horizontal + + false + + + QSlider::NoTicks + + + 2 + @@ -458,8 +567,7 @@ color: rgb(255, 255, 255); Reload map - color: rgb(255, 255, 255); -background-color: rgba(255, 255, 255, 0); + Reload @@ -500,8 +608,7 @@ background-color: rgba(255, 255, 255, 0); Show/Hide Flight Controls - background-color: rgba(255, 255, 255, 0); -color: rgb(255, 255, 255); + @@ -530,7 +637,7 @@ color: rgb(255, 255, 255); - 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)); + 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)); QFrame::NoFrame @@ -621,7 +728,19 @@ QTreeView::branch:open:has-children:!has-siblings, QTreeView::branch:open:has-ch true - background-color: rgb(0, 0, 0); + QWidget { +background-color: black; +} + +QToolTip { +background-color: white; +color: black; +border: 1px solid black; +padding: 2px; +border-radius: 3px; +/* opacity: 170; */ +} + @@ -650,18 +769,45 @@ QTreeView::branch:open:has-children:!has-siblings, QTreeView::branch:open:has-ch false - 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); + QWidget { /* all types of qwidget */ +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; */ +} + - 5 + 8 0 - 5 + 0 0 @@ -675,8 +821,7 @@ color: rgb(255, 255, 255); false - background-color: rgba(255, 255, 255, 0); -color: rgb(255, 255, 255); + @@ -705,8 +850,7 @@ color: rgb(255, 255, 255); UAV hold position - background-color: rgba(255, 255, 255, 0); -color: rgb(255, 255, 255); + @@ -732,8 +876,7 @@ color: rgb(255, 255, 255); UAV go! - background-color: rgba(255, 255, 255, 0); -color: rgb(255, 255, 255); + @@ -784,7 +927,26 @@ color: rgb(255, 255, 255); - 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)); + 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; */ +} + QFrame::NoFrame @@ -802,10 +964,10 @@ color: rgb(255, 255, 255); - 0 + 3 - 0 + 3 8 @@ -831,8 +993,7 @@ color: rgb(255, 255, 255); Map position - color: rgb(255, 255, 255); -background-color: rgba(255, 255, 255, 0); + QFrame::NoFrame @@ -848,16 +1009,6 @@ background-color: rgba(255, 255, 255, 0); - - - - QFrame::Plain - - - Qt::Vertical - - - @@ -879,8 +1030,7 @@ background-color: rgba(255, 255, 255, 0); Mouse position - color: rgb(255, 255, 255); -background-color: rgba(255, 255, 255, 0); + labelMousePos @@ -893,16 +1043,6 @@ background-color: rgba(255, 255, 255, 0); - - - - QFrame::Plain - - - Qt::Vertical - - - @@ -941,14 +1081,10 @@ background-color: rgba(255, 255, 255, 0); QProgressBar { -/*border: 1px solid black;*/ border: none; padding: 1px; -/*border-top-left-radius: 7px; -border-bottom-left-radius: 7px;*/ -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); +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); } QProgressBar::chunk { background-color: rgb(85, 85, 255); diff --git a/ground/src/plugins/opmap/opmapgadgetwidget.cpp b/ground/src/plugins/opmap/opmapgadgetwidget.cpp index be208e1d6..25369c8a8 100644 --- a/ground/src/plugins/opmap/opmapgadgetwidget.cpp +++ b/ground/src/plugins/opmap/opmapgadgetwidget.cpp @@ -46,8 +46,11 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent) m_map = NULL; waypoint_editor = NULL; wayPoint_treeView_model = NULL; + findPlaceCompleter = NULL; - setMouseTracking(true); +// setMouseTracking(true); + + prev_tile_number = 0; // ************** // Get required UAVObjects @@ -94,6 +97,21 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent) m_widget->treeViewWaypoints->setVisible(false); 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 @@ -483,11 +501,17 @@ void OPMapGadgetWidget::OnTilesStillToLoad(int number) { if (m_widget) { +// if (prev_tile_number < number || m_widget->progressBarMap->maximum() < number) +// m_widget->progressBarMap->setMaximum(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->labelNumTilesToLoad->setText(" " + QString::number(number)); + + prev_tile_number = number; } } @@ -522,9 +546,36 @@ void OPMapGadgetWidget::on_toolButtonReload_clicked() 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() { - findPlace(); + on_comboBoxFindPlace_returnPressed(); } void OPMapGadgetWidget::on_toolButtonZoomP_clicked() @@ -661,7 +712,7 @@ void OPMapGadgetWidget::setUseMemoryCache(bool useMemoryCache) void OPMapGadgetWidget::setCacheLocation(QString cacheLocation) { - cacheLocation = cacheLocation.trimmed(); // remove any surrounding spaces + cacheLocation = cacheLocation.simplified(); // remove any surrounding spaces if (cacheLocation.isEmpty()) return; @@ -943,18 +994,26 @@ void OPMapGadgetWidget::reload() void OPMapGadgetWidget::findPlace() { - bool ok; - 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); + m_widget->comboBoxFindPlace->setFocus(); // move focus to the 'find place' text box - 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() diff --git a/ground/src/plugins/opmap/opmapgadgetwidget.h b/ground/src/plugins/opmap/opmapgadgetwidget.h index 8aae6a77e..6800e194a 100644 --- a/ground/src/plugins/opmap/opmapgadgetwidget.h +++ b/ground/src/plugins/opmap/opmapgadgetwidget.h @@ -32,6 +32,7 @@ #include #include +#include #include #include "uavobjects/uavobjectmanager.h" @@ -78,6 +79,7 @@ private slots: // user control signals void on_toolButtonReload_clicked(); + void on_comboBoxFindPlace_returnPressed(); void on_toolButtonFindPlace_clicked(); void on_toolButtonZoomM_clicked(); void on_toolButtonZoomP_clicked(); @@ -145,6 +147,11 @@ private: internals::PointLatLng mouse_lat_lon; + int prev_tile_number; + + QStringList findPlaceWordList; + QCompleter *findPlaceCompleter; + QTimer *m_updateTimer; QTimer *m_statusUpdateTimer;