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() void CMappingComponent::ps_onModelsUpdateRequested()
{ {
const CAircraftModelList ml(sGui->getIContextSimulator()->getModelSet()); 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) void CMappingComponent::ps_onRemoteAircraftModelChanged(const CSimulatedAircraft &aircraft, const CIdentifier &originator)

View File

@@ -27,6 +27,10 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QSplitter" name="sp_MappingComponentSplitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QTabWidget" name="tw_ListViews"> <widget class="QTabWidget" name="tw_ListViews">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>0</number>
@@ -101,6 +105,28 @@
</item> </item>
</layout> </layout>
</widget> </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"> <widget class="QWidget" name="tb_MatchingLog">
<attribute name="title"> <attribute name="title">
<string>Matching log</string> <string>Matching log</string>
@@ -119,14 +145,7 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="BlackGui::Components::CModelMatcherLogComponent" name="comp_MatchingLog"> <widget class="BlackGui::Components::CModelMatcherLogComponent" name="comp_MatchingLog"/>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@@ -148,25 +167,16 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="BlackGui::Components::CAircraftPartsHistory" name="comp_AircraftPartsHistory"> <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> </item>
</layout> </layout>
</widget> </widget>
</widget> </widget>
</item>
<item>
<widget class="QFrame" name="fr_AircraftModifications"> <widget class="QFrame" name="fr_AircraftModifications">
<property name="minimumSize"> <property name="maximumSize">
<size> <size>
<width>0</width> <width>16777215</width>
<height>75</height> <height>80</height>
</size> </size>
</property> </property>
<layout class="QGridLayout" name="gl_AircraftModifications"> <layout class="QGridLayout" name="gl_AircraftModifications">
@@ -182,19 +192,6 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>3</number> <number>3</number>
</property> </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"> <item row="1" column="0">
<widget class="QLabel" name="lbl_Aircraft"> <widget class="QLabel" name="lbl_Aircraft">
<property name="text"> <property name="text">
@@ -202,27 +199,6 @@
</property> </property>
</widget> </widget>
</item> </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"> <item row="1" column="1">
<widget class="QCheckBox" name="cb_AircraftEnabled"> <widget class="QCheckBox" name="cb_AircraftEnabled">
<property name="toolTip"> <property name="toolTip">
@@ -233,6 +209,26 @@
</property> </property>
</widget> </widget>
</item> </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>
</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="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="lbl_AircraftIcon"> <widget class="QLabel" name="lbl_AircraftIcon">
<property name="text"> <property name="text">
@@ -240,16 +236,6 @@
</property> </property>
</widget> </widget>
</item> </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"> <item row="0" column="4">
<widget class="QPushButton" name="pb_LoadModels"> <widget class="QPushButton" name="pb_LoadModels">
<property name="toolTip"> <property name="toolTip">
@@ -260,6 +246,13 @@
</property> </property>
</widget> </widget>
</item> </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"> <item row="1" column="2" colspan="3">
<widget class="QLineEdit" name="le_Callsign"> <widget class="QLineEdit" name="le_Callsign">
<property name="maxLength"> <property name="maxLength">
@@ -273,8 +266,26 @@
</property> </property>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@@ -307,6 +318,12 @@
<header>blackgui/components/aircraftmodelstringcompleter.h</header> <header>blackgui/components/aircraftmodelstringcompleter.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>BlackGui::Components::CMatchingStatisticsComponent</class>
<extends>QFrame</extends>
<header>blackgui/components/matchingstatisticscomponent.h</header>
<container>1</container>
</customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>
<connections/> <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>