From b7d689d63d231750bca087c1a6b363cc8cc73642 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Thu, 25 Aug 2016 00:28:48 +0200 Subject: [PATCH] refs #742, allow to search for color liveries in livery form (using dialog) --- src/blackgui/editors/liveryform.cpp | 19 +++- src/blackgui/editors/liveryform.h | 7 +- src/blackgui/editors/liveryform.ui | 169 +++++++++++++++------------- 3 files changed, 111 insertions(+), 84 deletions(-) diff --git a/src/blackgui/editors/liveryform.cpp b/src/blackgui/editors/liveryform.cpp index ba5d6487a..e6041cb6a 100644 --- a/src/blackgui/editors/liveryform.cpp +++ b/src/blackgui/editors/liveryform.cpp @@ -57,8 +57,9 @@ namespace BlackGui // embedded form connect(ui->editor_AirlineIcao, &CAirlineIcaoForm::airlineChanged, this, &CLiveryForm::ps_airlineChanged); - // Set as temp.livery + // Set as temp.livery or search color connect(ui->pb_TempLivery, &QPushButton::pressed, this, &CLiveryForm::ps_setTemporaryLivery); + connect(ui->pb_SearchColor, &QPushButton::pressed, this, &CLiveryForm::ps_searchForColor); } CLiveryForm::~CLiveryForm() { } @@ -204,5 +205,21 @@ namespace BlackGui this->setValue(l); } } + + void CLiveryForm::ps_searchForColor() + { + if (!this->m_colorSearch) + { + this->m_colorSearch = new CDbLiveryColorSearch(this); + this->m_colorSearch->setModal(true); + } + const QDialog::DialogCode c = static_cast(this->m_colorSearch->exec()); + if (c == QDialog::Rejected) { return; } + const CLivery found = this->m_colorSearch->getLivery(); + if (found.isLoadedFromDb()) + { + this->setValue(found); + } + } } // ns } // ns diff --git a/src/blackgui/editors/liveryform.h b/src/blackgui/editors/liveryform.h index 562f93030..49a9fdde5 100644 --- a/src/blackgui/editors/liveryform.h +++ b/src/blackgui/editors/liveryform.h @@ -14,6 +14,7 @@ #include "blackgui/blackguiexport.h" #include "blackgui/editors/form.h" +#include "blackgui/components/dbliverycolorsearch.h" #include "blackmisc/aviation/airlineicaocode.h" #include "blackmisc/aviation/livery.h" #include "blackmisc/statusmessagelist.h" @@ -25,7 +26,6 @@ class QWidget; namespace Ui { class CLiveryForm; } - namespace BlackGui { namespace Editors @@ -83,10 +83,13 @@ namespace BlackGui //! Set data for a temp.livery void ps_setTemporaryLivery(); + //! Search for color + void ps_searchForColor(); + private: QScopedPointer ui; BlackMisc::Aviation::CLivery m_originalLivery; //!< object allowing to override values - + BlackGui::Components::CDbLiveryColorSearch *m_colorSearch = nullptr; //!< search for color }; } // ns } // ns diff --git a/src/blackgui/editors/liveryform.ui b/src/blackgui/editors/liveryform.ui index 2b598d82b..774d89cbc 100644 --- a/src/blackgui/editors/liveryform.ui +++ b/src/blackgui/editors/liveryform.ui @@ -6,7 +6,7 @@ 0 0 - 221 + 361 422 @@ -35,29 +35,13 @@ Livery - - - - QFrame::StyledPanel + + + + Last updated: - - QFrame::Raised - - - - - - - - 10 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised + + le_Updated @@ -71,16 +55,6 @@ - - - - Last updated: - - - le_Updated - - - @@ -111,7 +85,71 @@ - + + + + true + + + + + + + Livery description + + + + + + + Drop data here + + + + + + + Military livery + + + Mil. + + + + + + + temp. + + + + + + + + 10 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + @@ -121,28 +159,7 @@ - - - - Drop data here - - - - - - - true - - - - - - - Livery description - - - - + @@ -162,21 +179,21 @@ - - QFrame::StyledPanel - - - QFrame::Raised + + + 75 + 0 + - - QFrame::StyledPanel - - - QFrame::Raised + + + 75 + 0 + @@ -196,26 +213,16 @@ - - - - - - - Military livery - - - Mil. - - - - + - temp. + search color + + +