refs #849, statistics UI in pilot client

This commit is contained in:
Klaus Basan
2017-01-05 02:36:25 +01:00
committed by Mathew Sutcliffe
parent cfca78ec2a
commit bac77e233d
5 changed files with 431 additions and 224 deletions

View File

@@ -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)

View File

@@ -27,253 +27,264 @@
<number>0</number>
</property>
<item>
<widget class="QTabWidget" name="tw_ListViews">
<property name="currentIndex">
<number>0</number>
<widget class="QSplitter" name="sp_MappingComponentSplitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QWidget" name="tb_CurrentMappings">
<attribute name="title">
<string>Rendered aircraft</string>
</attribute>
<layout class="QVBoxLayout" name="vl_CurrentMappings">
<widget class="QTabWidget" name="tw_ListViews">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tb_CurrentMappings">
<attribute name="title">
<string>Rendered aircraft</string>
</attribute>
<layout class="QVBoxLayout" name="vl_CurrentMappings">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="BlackGui::Views::CSimulatedAircraftView" name="tvp_RenderedAircraft">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tb_AircraftModels">
<attribute name="title">
<string>Aircraft models</string>
</attribute>
<layout class="QVBoxLayout" name="vl_AircraftModels">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="BlackGui::Views::CAircraftModelView" name="tvp_AircraftModels">
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tb_Statistics">
<attribute name="title">
<string>Statistics</string>
</attribute>
<layout class="QVBoxLayout" name="vl_Statistics">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="BlackGui::Components::CMatchingStatisticsComponent" name="comp_Statistics"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tb_MatchingLog">
<attribute name="title">
<string>Matching log</string>
</attribute>
<layout class="QVBoxLayout" name="vl_MatchingLog">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="BlackGui::Components::CModelMatcherLogComponent" name="comp_MatchingLog"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tb_AircraftPartsHistory">
<attribute name="title">
<string>Aircraft parts log</string>
</attribute>
<layout class="QVBoxLayout" name="vl_AircraftPartsHistory">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="BlackGui::Components::CAircraftPartsHistory" name="comp_AircraftPartsHistory"/>
</item>
</layout>
</widget>
</widget>
<widget class="QFrame" name="fr_AircraftModifications">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>80</height>
</size>
</property>
<layout class="QGridLayout" name="gl_AircraftModifications">
<property name="leftMargin">
<number>0</number>
<number>3</number>
</property>
<property name="topMargin">
<number>0</number>
<number>3</number>
</property>
<property name="rightMargin">
<number>0</number>
<number>3</number>
</property>
<property name="bottomMargin">
<number>0</number>
<number>3</number>
</property>
<item>
<widget class="BlackGui::Views::CSimulatedAircraftView" name="tvp_RenderedAircraft">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<item row="1" column="0">
<widget class="QLabel" name="lbl_Aircraft">
<property name="text">
<string>Aircraft</string>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="cb_AircraftEnabled">
<property name="toolTip">
<string>enabled / disable</string>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
<property name="text">
<string/>
</property>
<attribute name="verticalHeaderVisible">
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="cb_AircraftIconDisplayed">
<property name="toolTip">
<string>show / hide icon</string>
</property>
<property name="text">
<string/>
</property>
<property name="checked">
<bool>false</bool>
</attribute>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tb_AircraftModels">
<attribute name="title">
<string>Aircraft models</string>
</attribute>
<layout class="QVBoxLayout" name="vl_AircraftModels">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="BlackGui::Views::CAircraftModelView" name="tvp_AircraftModels">
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
<item row="0" column="2" colspan="2">
<widget class="QLabel" name="lbl_AircraftIconDisplayed">
<property name="text">
<string>icon will go here</string>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tb_MatchingLog">
<attribute name="title">
<string>Matching log</string>
</attribute>
<layout class="QVBoxLayout" name="vl_MatchingLog">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="BlackGui::Components::CModelMatcherLogComponent" name="comp_MatchingLog">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
<item row="0" column="0">
<widget class="QLabel" name="lbl_AircraftIcon">
<property name="text">
<string>Icon</string>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</widget>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="pb_LoadModels">
<property name="toolTip">
<string>load models</string>
</property>
<property name="text">
<string>load</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QPushButton" name="pb_ResetAircraft">
<property name="text">
<string>reset</string>
</property>
</widget>
</item>
<item row="1" column="2" colspan="3">
<widget class="QLineEdit" name="le_Callsign">
<property name="maxLength">
<number>15</number>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>callsign</string>
</property>
</widget>
</item>
<item row="1" column="5">
<widget class="QPushButton" name="pb_SaveAircraft">
<property name="text">
<string>save</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="6">
<widget class="BlackGui::Components::CAircraftModelStringCompleter" name="completer_ModelStrings">
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tb_AircraftPartsHistory">
<attribute name="title">
<string>Aircraft parts log</string>
</attribute>
<layout class="QVBoxLayout" name="vl_AircraftPartsHistory">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="BlackGui::Components::CAircraftPartsHistory" name="comp_AircraftPartsHistory">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QFrame" name="fr_AircraftModifications">
<property name="minimumSize">
<size>
<width>0</width>
<height>75</height>
</size>
</property>
<layout class="QGridLayout" name="gl_AircraftModifications">
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item row="0" column="1">
<widget class="QCheckBox" name="cb_AircraftIconDisplayed">
<property name="toolTip">
<string>show / hide icon</string>
</property>
<property name="text">
<string/>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lbl_Aircraft">
<property name="text">
<string>Aircraft</string>
</property>
</widget>
</item>
<item row="1" column="5">
<widget class="QPushButton" name="pb_SaveAircraft">
<property name="text">
<string>save</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QPushButton" name="pb_ResetAircraft">
<property name="text">
<string>reset</string>
</property>
</widget>
</item>
<item row="0" column="2" colspan="2">
<widget class="QLabel" name="lbl_AircraftIconDisplayed">
<property name="text">
<string>icon will go here</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="cb_AircraftEnabled">
<property name="toolTip">
<string>enabled / disable</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lbl_AircraftIcon">
<property name="text">
<string>Icon</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="6">
<widget class="BlackGui::Components::CAircraftModelStringCompleter" name="completer_ModelStrings">
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="pb_LoadModels">
<property name="toolTip">
<string>load models</string>
</property>
<property name="text">
<string>load</string>
</property>
</widget>
</item>
<item row="1" column="2" colspan="3">
<widget class="QLineEdit" name="le_Callsign">
<property name="maxLength">
<number>15</number>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>callsign</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
@@ -307,6 +318,12 @@
<header>blackgui/components/aircraftmodelstringcompleter.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>BlackGui::Components::CMatchingStatisticsComponent</class>
<extends>QFrame</extends>
<header>blackgui/components/matchingstatisticscomponent.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>

View File

@@ -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

View File

@@ -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 <QFrame>
#include <QScopedPointer>
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::CMatchingStatisticsComponent> ui;
};
} // ns
} // ns
#endif // guard

View File

@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CMatchingStatisticsComponent</class>
<widget class="QFrame" name="CMatchingStatisticsComponent">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>256</width>
<height>226</height>
</rect>
</property>
<property name="windowTitle">
<string>Matching statistics</string>
</property>
<layout class="QVBoxLayout" name="vl_MatchingStatistics">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="BlackGui::Views::CMatchingStatisticsView" name="tvp_MatchingStatistics">
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderHighlightSections">
<bool>false</bool>
</attribute>
</widget>
</item>
<item>
<widget class="QFrame" name="fr_Bottom">
<layout class="QHBoxLayout" name="hl_Bottom">
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<widget class="QRadioButton" name="rb_MissingOnly">
<property name="text">
<string>missing only</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rb_All">
<property name="text">
<string>all</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pb_Generate">
<property name="text">
<string>generate</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>BlackGui::Views::CMatchingStatisticsView</class>
<extends>QTableView</extends>
<header>blackgui/views/matchingstatisticsview.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>