From bac77e233d25c54b1d38b697cb4ecdec802e7c45 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Thu, 5 Jan 2017 02:36:25 +0100 Subject: [PATCH] refs #849, statistics UI in pilot client --- src/blackgui/components/mappingcomponent.cpp | 2 +- src/blackgui/components/mappingcomponent.ui | 463 +++++++++--------- .../matchingstatisticscomponent.cpp | 46 ++ .../components/matchingstatisticscomponent.h | 46 ++ .../components/matchingstatisticscomponent.ui | 98 ++++ 5 files changed, 431 insertions(+), 224 deletions(-) create mode 100644 src/blackgui/components/matchingstatisticscomponent.cpp create mode 100644 src/blackgui/components/matchingstatisticscomponent.h create mode 100644 src/blackgui/components/matchingstatisticscomponent.ui diff --git a/src/blackgui/components/mappingcomponent.cpp b/src/blackgui/components/mappingcomponent.cpp index 6aaab160d..9fcb251cb 100644 --- a/src/blackgui/components/mappingcomponent.cpp +++ b/src/blackgui/components/mappingcomponent.cpp @@ -344,7 +344,7 @@ namespace BlackGui void CMappingComponent::ps_onModelsUpdateRequested() { const CAircraftModelList ml(sGui->getIContextSimulator()->getModelSet()); - ui->tvp_AircraftModels->updateContainer(ml); + ui->tvp_AircraftModels->updateContainerMaybeAsync(ml); } void CMappingComponent::ps_onRemoteAircraftModelChanged(const CSimulatedAircraft &aircraft, const CIdentifier &originator) diff --git a/src/blackgui/components/mappingcomponent.ui b/src/blackgui/components/mappingcomponent.ui index df60ba61f..d5c38f465 100644 --- a/src/blackgui/components/mappingcomponent.ui +++ b/src/blackgui/components/mappingcomponent.ui @@ -27,253 +27,264 @@ 0 - - - 0 + + + Qt::Vertical - - - Rendered aircraft - - + + + 0 + + + + Rendered aircraft + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + false + + + + + + + + Aircraft models + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + false + + + + + + + + Statistics + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + Matching log + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + Aircraft parts log + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + + + 16777215 + 80 + + + - 0 + 3 - 0 + 3 - 0 + 3 - 0 + 3 - - - - - 0 - 0 - + + + + Aircraft - - QAbstractItemView::SingleSelection + + + + + + enabled / disable - - QAbstractItemView::SelectRows + + - + + + + + + show / hide icon + + + + + false - + - - - - - Aircraft models - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QAbstractItemView::SingleSelection + + + + icon will go here - - QAbstractItemView::SelectRows - - - false - - - - - - Matching log - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QFrame::StyledPanel + + + + Icon - - QFrame::Raised + + + + + + load models + + + load + + + + + + + reset + + + + + + + 15 + + + true + + + callsign + + + + + + + save + + + + + + + + 0 + 20 + - - - Aircraft parts log - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - - - - - 0 - 75 - - - - - 3 - - - 3 - - - 3 - - - 3 - - - - - show / hide icon - - - - - - false - - - - - - - Aircraft - - - - - - - save - - - - - - - reset - - - - - - - icon will go here - - - - - - - enabled / disable - - - - - - - - - - Icon - - - - - - - - 0 - 20 - - - - - - - - load models - - - load - - - - - - - 15 - - - true - - - callsign - - - - @@ -307,6 +318,12 @@
blackgui/components/aircraftmodelstringcompleter.h
1 + + BlackGui::Components::CMatchingStatisticsComponent + QFrame +
blackgui/components/matchingstatisticscomponent.h
+ 1 +
diff --git a/src/blackgui/components/matchingstatisticscomponent.cpp b/src/blackgui/components/matchingstatisticscomponent.cpp new file mode 100644 index 000000000..cb3dae69a --- /dev/null +++ b/src/blackgui/components/matchingstatisticscomponent.cpp @@ -0,0 +1,46 @@ +/* Copyright (C) 2017 + * 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 "matchingstatisticscomponent.h" +#include "ui_matchingstatisticscomponent.h" +#include "blackgui/guiapplication.h" +#include "blackcore/context/contextsimulator.h" + +using namespace BlackMisc::Simulation; +using namespace BlackCore::Context; +using namespace BlackGui::Views; + +namespace BlackGui +{ + namespace Components + { + CMatchingStatisticsComponent::CMatchingStatisticsComponent(QWidget *parent) : + QFrame(parent), + ui(new Ui::CMatchingStatisticsComponent) + { + ui->setupUi(this); + connect(ui->pb_Generate, &QPushButton::clicked, this, &CMatchingStatisticsComponent::onGenerateClicked); + connect(ui->tvp_MatchingStatistics, &CMatchingStatisticsView::requestNewBackendData, this, &CMatchingStatisticsComponent::onGenerateClicked); + connect(ui->tvp_MatchingStatistics, &CMatchingStatisticsView::requestUpdate, this, &CMatchingStatisticsComponent::onGenerateClicked); + } + + CMatchingStatisticsComponent::~CMatchingStatisticsComponent() + { } + + void CMatchingStatisticsComponent::onGenerateClicked() + { + Q_ASSERT_X(sGui, Q_FUNC_INFO, "Missing sGui"); + Q_ASSERT_X(sGui->getIContextSimulator(), Q_FUNC_INFO, "Missing context"); + + const bool missingOnly = ui->rb_MissingOnly->isChecked(); + const CMatchingStatistics stats = sGui->getIContextSimulator()->getCurrentMatchingStatistics(missingOnly); + ui->tvp_MatchingStatistics->updateContainerMaybeAsync(stats); + } + } // ns +} // ns diff --git a/src/blackgui/components/matchingstatisticscomponent.h b/src/blackgui/components/matchingstatisticscomponent.h new file mode 100644 index 000000000..204019024 --- /dev/null +++ b/src/blackgui/components/matchingstatisticscomponent.h @@ -0,0 +1,46 @@ +/* Copyright (C) 2017 + * 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_COMPONENTS_MATCHINGSTATISTICSCOMPONENT_H +#define BLACKGUI_COMPONENTS_MATCHINGSTATISTICSCOMPONENT_H + +#include +#include + +namespace Ui { class CMatchingStatisticsComponent; } +namespace BlackGui +{ + namespace Components + { + /*! + * Show statistics about matching results + */ + class CMatchingStatisticsComponent : public QFrame + { + Q_OBJECT + + public: + //! Constructor + explicit CMatchingStatisticsComponent(QWidget *parent = nullptr); + + //! Destructor + virtual ~CMatchingStatisticsComponent(); + + private: + //! Show statistics + void onGenerateClicked(); + + QScopedPointer ui; + }; + } // ns +} // ns + +#endif // guard diff --git a/src/blackgui/components/matchingstatisticscomponent.ui b/src/blackgui/components/matchingstatisticscomponent.ui new file mode 100644 index 000000000..6cd20f60a --- /dev/null +++ b/src/blackgui/components/matchingstatisticscomponent.ui @@ -0,0 +1,98 @@ + + + CMatchingStatisticsComponent + + + + 0 + 0 + 256 + 226 + + + + Matching statistics + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QAbstractItemView::NoSelection + + + false + + + false + + + + + + + + 3 + + + 3 + + + 3 + + + 3 + + + + + missing only + + + true + + + + + + + all + + + false + + + + + + + generate + + + + + + + + + + + BlackGui::Views::CMatchingStatisticsView + QTableView +
blackgui/views/matchingstatisticsview.h
+
+
+ + +