From 693d9631fff3b53e40dbe2de9970df9af1051cea Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sat, 18 Mar 2017 00:25:55 +0100 Subject: [PATCH] refs #911, wizard improvements * disable enter button for next * role QTextEdit size (logoff UI) * no filter bar for log --- src/blackgui/components/dblogincomponent.ui | 65 +++++++++++-------- .../components/dbquickmappingwizard.cpp | 24 +++++-- .../components/dbquickmappingwizard.h | 8 ++- .../components/dbquickmappingwizard.ui | 2 +- 4 files changed, 65 insertions(+), 34 deletions(-) diff --git a/src/blackgui/components/dblogincomponent.ui b/src/blackgui/components/dblogincomponent.ui index 8f0eb7d93..e09cacbc6 100644 --- a/src/blackgui/components/dblogincomponent.ui +++ b/src/blackgui/components/dblogincomponent.ui @@ -6,8 +6,8 @@ 0 0 - 457 - 318 + 361 + 371 @@ -252,7 +252,7 @@ 6 - + logoff @@ -275,22 +275,6 @@ - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 75 - 10 - - - - @@ -318,13 +302,6 @@ - - - - Info: - - - @@ -335,6 +312,42 @@ + + + + Info: + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 75 + 10 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + diff --git a/src/blackgui/components/dbquickmappingwizard.cpp b/src/blackgui/components/dbquickmappingwizard.cpp index 28d97f8dc..7981d36b1 100644 --- a/src/blackgui/components/dbquickmappingwizard.cpp +++ b/src/blackgui/components/dbquickmappingwizard.cpp @@ -53,6 +53,8 @@ namespace BlackGui connect(ui->selector_AirlineIcaoCode, &CDbAirlineIcaoSelectorComponent::changedAirlineIcao, this, &CDbQuickMappingWizard::ps_airlineSelected); connect(ui->selector_AirlineName, &CDbAirlineIcaoSelectorComponent::changedAirlineIcao, this, &CDbQuickMappingWizard::ps_airlineSelected); + ui->comp_Log->showFilterDialog(); // filter for log normally not needed, so dialog (not bar) + // init if data already available this->ps_webDataRead(); } @@ -66,6 +68,20 @@ namespace BlackGui return cats; } + void CDbQuickMappingWizard::keyPressEvent(QKeyEvent *event) + { + Qt::Key key = static_cast(event->key()); + if (key == Qt::Key_Enter || key == Qt::Key_Return) + { + // disable enter, interferes with filter returnPressed + event->accept(); + } + else + { + QWizard::keyPressEvent(event); + } + } + void CDbQuickMappingWizard::presetAircraftIcao(const BlackMisc::Aviation::CAircraftIcaoCode &aircraftIcao) { this->clear(); @@ -78,9 +94,7 @@ namespace BlackGui QString ms = model.getModelString(); if (!model.getDescription().isEmpty()) { - ms += " ("; - ms += model.getDescription(); - ms += ")"; + ms += " (" + model.getDescription() + ")"; } this->presetAircraftIcao(model.getAircraftIcaoCode()); @@ -232,7 +246,7 @@ namespace BlackGui break; case PageSendStatus: { - this->writeModeltoDb(); + this->writeModelToDb(); } break; default: @@ -287,7 +301,7 @@ namespace BlackGui this->m_model = model; } - void CDbQuickMappingWizard::writeModeltoDb() + void CDbQuickMappingWizard::writeModelToDb() { this->consolidateModel(); const CStatusMessageList msgs = sGui->getWebDataServices()->getDatabaseWriter()->asyncPublishModel(this->m_model); diff --git a/src/blackgui/components/dbquickmappingwizard.h b/src/blackgui/components/dbquickmappingwizard.h index 355fd467b..2e167a007 100644 --- a/src/blackgui/components/dbquickmappingwizard.h +++ b/src/blackgui/components/dbquickmappingwizard.h @@ -47,7 +47,7 @@ namespace BlackGui explicit CDbQuickMappingWizard(QWidget *parent = nullptr); //! Destructor - ~CDbQuickMappingWizard(); + virtual ~CDbQuickMappingWizard(); //! Preset values void presetAircraftIcao(const BlackMisc::Aviation::CAircraftIcaoCode &aircraftIcao); @@ -64,6 +64,10 @@ namespace BlackGui //! Log categories static const BlackMisc::CLogCategoryList &getLogCategories(); + protected: + //! \copydoc QWizard::keyPressEvent + virtual void keyPressEvent(QKeyEvent *event) override; + private: QScopedPointer ui; int m_lastId = 0; @@ -94,7 +98,7 @@ namespace BlackGui void consolidateModel(); //! Write the model to DB - void writeModeltoDb(); + void writeModelToDb(); private slots: //! Web data have been read diff --git a/src/blackgui/components/dbquickmappingwizard.ui b/src/blackgui/components/dbquickmappingwizard.ui index d04cd5530..e64f7a859 100644 --- a/src/blackgui/components/dbquickmappingwizard.ui +++ b/src/blackgui/components/dbquickmappingwizard.ui @@ -152,7 +152,7 @@ - Hint: You can also search on the next page + Hint: You can also search for the aircraft ICAO on the next page.