From 6fbdd700aeac364496252f74056af12a60f29b3e Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sun, 5 Aug 2018 23:15:37 +0200 Subject: [PATCH] Ref T298, matching setup form added --- src/blackgui/components/settingscomponent.cpp | 13 +- src/blackgui/components/settingscomponent.h | 7 +- src/blackgui/components/settingscomponent.ui | 481 ++++++++++-------- src/blackgui/editors/matchingform.cpp | 73 +++ src/blackgui/editors/matchingform.h | 61 +++ src/blackgui/editors/matchingform.ui | 65 +++ 6 files changed, 493 insertions(+), 207 deletions(-) create mode 100644 src/blackgui/editors/matchingform.cpp create mode 100644 src/blackgui/editors/matchingform.h create mode 100644 src/blackgui/editors/matchingform.ui diff --git a/src/blackgui/components/settingscomponent.cpp b/src/blackgui/components/settingscomponent.cpp index 7e435c8f9..333a74f2c 100644 --- a/src/blackgui/components/settingscomponent.cpp +++ b/src/blackgui/components/settingscomponent.cpp @@ -62,8 +62,9 @@ namespace BlackGui connect(ui->pb_Servers, &QPushButton::released, this, &CSettingsComponent::onOverviewButtonClicked); connect(ui->pb_Simulator, &QPushButton::released, this, &CSettingsComponent::onOverviewButtonClicked); connect(ui->pb_SimulatorBasics, &QPushButton::released, this, &CSettingsComponent::onOverviewButtonClicked); - connect(ui->pb_DataLoadAndCaches, &QPushButton::released, this, &CSettingsComponent::onOverviewButtonClicked); connect(ui->pb_SimulatorMessages, &QPushButton::released, this, &CSettingsComponent::onOverviewButtonClicked); + connect(ui->pb_Matching, &QPushButton::released, this, &CSettingsComponent::onOverviewButtonClicked); + connect(ui->pb_DataLoadAndCaches, &QPushButton::released, this, &CSettingsComponent::onOverviewButtonClicked); this->initActions(); } @@ -122,6 +123,13 @@ namespace BlackGui ui->pb_Simulator->setToolTip(a->shortcut().toString()); connect(a, &QAction::triggered, this, &CSettingsComponent::onActionTriggered); this->addAction(a); + + a = new QAction(this); + a->setObjectName("matching"); + a->setShortcut(QKeySequence(Qt::ALT + Qt::Key_S, Qt::Key_M)); + ui->pb_Matching->setToolTip(a->shortcut().toString()); + connect(a, &QAction::triggered, this, &CSettingsComponent::onActionTriggered); + this->addAction(a); } bool CSettingsComponent::playNotificationSounds() const @@ -162,6 +170,7 @@ namespace BlackGui if (sender == ui->pb_SimulatorBasics) { this->setCurrentIndex(SettingTabSimulatorBasics); return; } if (sender == ui->pb_DataLoadAndCaches) { this->setCurrentIndex(SettingTabDataAndCaches); return; } if (sender == ui->pb_SimulatorMessages) { this->setCurrentIndex(SettingTabSimulatorMessages); return; } + if (sender == ui->pb_Matching) { this->setCurrentIndex(SettingTabMatching); return; } this->setCurrentIndex(SettingTabOverview); } @@ -176,6 +185,8 @@ namespace BlackGui if (a.contains("network")) { this->setCurrentIndex(SettingTabNetwork); return; } if (a.contains("overview")) { this->setCurrentIndex(SettingTabOverview); return; } if (a.contains("simulator")) { this->setCurrentIndex(SettingTabSimulator); return; } + if (a.contains("matching")) { this->setCurrentIndex(SettingTabMatching); return; } + if (a.contains("advanced")) { this->setCurrentIndex(SettingTabAdvanced); return; } } } } // namespace diff --git a/src/blackgui/components/settingscomponent.h b/src/blackgui/components/settingscomponent.h index 90b064a13..8126fcdad 100644 --- a/src/blackgui/components/settingscomponent.h +++ b/src/blackgui/components/settingscomponent.h @@ -38,14 +38,15 @@ namespace BlackGui { SettingTabOverview, SettingTabServers, + SettingTabGui, SettingTabNetwork, + SettingTabHotkeys, SettingTabAudio, + SettingTabDataAndCaches, SettingTabSimulator, SettingTabSimulatorBasics, SettingTabSimulatorMessages, - SettingTabGui, - SettingTabHotkeys, - SettingTabDataAndCaches, + SettingTabMatching, SettingTabAdvanced }; diff --git a/src/blackgui/components/settingscomponent.ui b/src/blackgui/components/settingscomponent.ui index 6c0f2d85c..4339fcc8b 100644 --- a/src/blackgui/components/settingscomponent.ui +++ b/src/blackgui/components/settingscomponent.ui @@ -6,8 +6,8 @@ 0 0 - 204 - 340 + 211 + 378 @@ -30,7 +30,46 @@ 20 - + + + + + 0 + 0 + + + + Simulator (basics) + + + + + + + + 0 + 0 + + + + Simulator + + + + + + + + 0 + 0 + + + + Network + + + + Qt::Vertical @@ -56,45 +95,6 @@ - - - - - 0 - 0 - - - - Advanced - - - - - - - - 0 - 0 - - - - Network - - - - - - - - 0 - 0 - - - - Simulator (basics) - - - @@ -121,6 +121,19 @@ + + + + + 0 + 0 + + + + Hotkeys + + + @@ -150,8 +163,15 @@ - - + + + + Hint: see tooltips for shortcuts. + + + + + 0 @@ -159,11 +179,24 @@ - Hotkeys + Advanced - + + + + + 0 + 0 + + + + Matching + + + + @@ -176,26 +209,6 @@ - - - - - 0 - 0 - - - - Simulator - - - - - - - Hint: see tooltips for shortcuts. - - - @@ -246,6 +259,52 @@ + + + GUI + + + + 3 + + + 3 + + + 3 + + + 1 + + + + + + + + + + + + 3 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + Network @@ -278,6 +337,44 @@ + + + + 0 + 0 + + + + Hotkeys + + + + 2 + + + 1 + + + 1 + + + 1 + + + 1 + + + + + + 0 + 0 + + + + + + Audio @@ -310,11 +407,11 @@ - + - Simulator + Data and caches - + 2 @@ -328,16 +425,50 @@ 1 - 1 + 15 - - - QFrame::StyledPanel - - - QFrame::Raised + + + true + + + + 0 + 0 + 203 + 336 + + + + + 2 + + + 1 + + + 1 + + + 1 + + + 1 + + + + + + 0 + 250 + + + + + + @@ -387,6 +518,38 @@ + + + Simulator + + + + 2 + + + 1 + + + 1 + + + 1 + + + 1 + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + Simulator (messages) @@ -425,66 +588,11 @@ - + - GUI + Matching - - - 3 - - - 3 - - - 3 - - - 1 - - - - - - - - - - - - 3 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - - 0 - 0 - - - - Hotkeys - - - - 2 - + 1 @@ -498,80 +606,27 @@ 1 - - - - 0 - 0 - + + + + 0 + 100 + - - - - - Data and caches - - - - 2 - - - 1 - - - 1 - - - 1 - - - 15 - - - - true + + + Qt::Vertical - - - - 0 - 0 - 196 - 298 - - - - - 2 - - - 1 - - - 1 - - - 1 - - - 1 - - - - - - 0 - 250 - - - - - - - + + + 20 + 40 + + + @@ -675,7 +730,27 @@
blackgui/components/settingsviewupdatetimes.h
1 + + BlackGui::Editors::CMatchingForm + QFrame +
blackgui/editors/matchingform.h
+ 1 +
+ + pb_Servers + pb_Gui + pb_Network + pb_Hotkeys + pb_Audio + pb_DataLoadAndCaches + pb_SimulatorBasics + pb_Simulator + pb_SimulatorMessages + pb_Matching + pb_Advanced + sa_DataLoad + diff --git a/src/blackgui/editors/matchingform.cpp b/src/blackgui/editors/matchingform.cpp new file mode 100644 index 000000000..d4eadedd1 --- /dev/null +++ b/src/blackgui/editors/matchingform.cpp @@ -0,0 +1,73 @@ +/* Copyright (C) 2018 + * swift project Community / Contributors + * + * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level + * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, + * including this file, may be copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE file. + */ + +#include "ui_matchingform.h" +#include "matchingform.h" +#include "guiutility.h" + +using namespace BlackMisc; +using namespace BlackMisc::Simulation; +using namespace BlackCore; + +namespace BlackGui +{ + namespace Editors + { + CMatchingForm::CMatchingForm(QWidget *parent) : + CForm(parent), + ui(new Ui::CMatchingForm) + { + ui->setupUi(this); + } + + CMatchingForm::~CMatchingForm() + { } + + void CMatchingForm::setReadOnly(bool readonly) + { + CGuiUtility::checkBoxReadOnly(ui->cb_ByModelString, readonly); + CGuiUtility::checkBoxReadOnly(ui->cb_ByICAOdata, readonly); + CGuiUtility::checkBoxReadOnly(ui->cb_ByFamily, readonly); + CGuiUtility::checkBoxReadOnly(ui->cb_ByLivery, readonly); + CGuiUtility::checkBoxReadOnly(ui->cb_ByCombinedCode, readonly); + } + + CStatusMessageList CMatchingForm::validate(bool withNestedForms) const + { + Q_UNUSED(withNestedForms); + return CStatusMessageList(); + } + + void CMatchingForm::setValue(const CAircraftMatcherSetup &setup) + { + const CAircraftMatcherSetup::MatchingMode mode = setup.getMatchingMode(); + ui->cb_ByModelString->setChecked(mode.testFlag(CAircraftMatcherSetup::ByModelString)); + ui->cb_ByCombinedCode->setChecked(mode.testFlag(CAircraftMatcherSetup::ByCombinedType)); + ui->cb_ByICAOdata->setChecked(mode.testFlag(CAircraftMatcherSetup::ByIcaoData)); + ui->cb_ByLivery->setChecked(mode.testFlag(CAircraftMatcherSetup::ByLivery)); + ui->cb_ByFamily->setChecked(mode.testFlag(CAircraftMatcherSetup::ByFamily)); + } + + CAircraftMatcherSetup CMatchingForm::value() const + { + CAircraftMatcherSetup setup; + setup.setMatchingMode(matchingMode()); + return setup; + } + + CAircraftMatcherSetup::MatchingMode CMatchingForm::matchingMode() const + { + return CAircraftMatcherSetup::matchingMode( + ui->cb_ByModelString->isChecked(), ui->cb_ByICAOdata->isChecked(), + ui->cb_ByFamily->isChecked(), ui->cb_ByLivery->isChecked(), + ui->cb_ByCombinedCode->isChecked() + ); + } + } // ns +} // ns diff --git a/src/blackgui/editors/matchingform.h b/src/blackgui/editors/matchingform.h new file mode 100644 index 000000000..eaacd29b7 --- /dev/null +++ b/src/blackgui/editors/matchingform.h @@ -0,0 +1,61 @@ +/* Copyright (C) 2018 + * swift project Community / Contributors + * + * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level + * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, + * including this file, may be copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE file. + */ + +//! \file + +#ifndef BLACKGUI_EDITORS_MATCHINGFORM_H +#define BLACKGUI_EDITORS_MATCHINGFORM_H + +#include "form.h" +#include "blackmisc/simulation/aircraftmatchersetup.h" +#include + +namespace Ui { class CMatchingForm; } +namespace BlackGui +{ + namespace Editors + { + //! Matching form + class CMatchingForm : public CForm + { + Q_OBJECT + + public: + //! Constructor + explicit CMatchingForm(QWidget *parent = nullptr); + + //! Destructor + virtual ~CMatchingForm() override; + + //! \name Form class implementations + //! @{ + virtual void setReadOnly(bool readonly) override; + virtual BlackMisc::CStatusMessageList validate(bool withNestedForms) const override; + //! @} + + //! Set valued + void setValue(const BlackMisc::Simulation::CAircraftMatcherSetup &setup); + + //! Value + BlackMisc::Simulation::CAircraftMatcherSetup value() const; + + //! Clear data + void clear(); + + private: + //! Mode + BlackMisc::Simulation::CAircraftMatcherSetup::MatchingMode matchingMode() const; + + QScopedPointer ui; + }; + } // ns +} // ns + + +#endif // guard diff --git a/src/blackgui/editors/matchingform.ui b/src/blackgui/editors/matchingform.ui new file mode 100644 index 000000000..b13a9b7c1 --- /dev/null +++ b/src/blackgui/editors/matchingform.ui @@ -0,0 +1,65 @@ + + + CMatchingForm + + + + 0 + 0 + 287 + 87 + + + + Frame + + + + + + Mode + + + + + + by model string + + + + + + + by ICAO data + + + + + + + by family + + + + + + + combined code + + + + + + + by livery + + + + + + + + + + +