Ref T421, UI for the interpolation log.messages

This commit is contained in:
Klaus Basan
2018-10-31 15:31:55 +01:00
parent 03691b4700
commit 699684bce0
4 changed files with 81 additions and 6 deletions

View File

@@ -10,6 +10,14 @@
#include "interpolationcomponent.h" #include "interpolationcomponent.h"
#include "ui_interpolationcomponent.h" #include "ui_interpolationcomponent.h"
#include "blackgui/guiapplication.h"
#include "blackgui/views/statusmessageview.h"
#include "blackcore/context/contextsimulator.h"
using namespace BlackMisc;
using namespace BlackMisc::Aviation;
using namespace BlackGui::Views;
namespace BlackGui namespace BlackGui
{ {
namespace Components namespace Components
@@ -22,9 +30,21 @@ namespace BlackGui
ui->tw_InterpolationSetup->setCurrentIndex(0); ui->tw_InterpolationSetup->setCurrentIndex(0);
connect(ui->comp_InterpolationSetup, &CInterpolationSetupComponent::requestRenderingRestrictionsWidget, this, &CInterpolationComponent::requestRenderingRestrictionsWidget); connect(ui->comp_InterpolationSetup, &CInterpolationSetupComponent::requestRenderingRestrictionsWidget, this, &CInterpolationComponent::requestRenderingRestrictionsWidget);
connect(ui->comp_CallsignCompleter, &CCallsignCompleter::validCallsignEntered, this, &CInterpolationComponent::displayInterpolationMessages);
connect(ui->pb_ReloadInterpolationMessages, &QPushButton::released, this, &CInterpolationComponent::displayInterpolationMessages);
} }
CInterpolationComponent::~CInterpolationComponent() CInterpolationComponent::~CInterpolationComponent()
{ } { }
void CInterpolationComponent::displayInterpolationMessages()
{
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextSimulator()) { return; }
const CCallsign cs = ui->comp_CallsignCompleter->getCallsign();
if (!cs.isValid()) { return; }
const CStatusMessageList messages = sGui->getIContextSimulator()->getInterpolationMessages(cs);
ui->tvp_InterpolationMessages->updateContainerMaybeAsync(messages);
}
} // ns } // ns
} // ns } // ns

View File

@@ -12,6 +12,7 @@
#ifndef BLACKGUI_COMPONENTS_INTERPOLATIONCOMPONENT_H #ifndef BLACKGUI_COMPONENTS_INTERPOLATIONCOMPONENT_H
#define BLACKGUI_COMPONENTS_INTERPOLATIONCOMPONENT_H #define BLACKGUI_COMPONENTS_INTERPOLATIONCOMPONENT_H
#include "blackmisc/aviation/callsign.h"
#include <QFrame> #include <QFrame>
#include <QScopedPointer> #include <QScopedPointer>
#include "blackgui/blackguiexport.h" #include "blackgui/blackguiexport.h"
@@ -39,6 +40,9 @@ namespace BlackGui
private: private:
QScopedPointer<Ui::CInterpolationComponent> ui; QScopedPointer<Ui::CInterpolationComponent> ui;
//! Display log messages
void displayInterpolationMessages();
}; };
} // ns } // ns
} // ns } // ns

View File

@@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Frame</string> <string>Interpolation component</string>
</property> </property>
<layout class="QVBoxLayout" name="vl_InterpolationComponent"> <layout class="QVBoxLayout" name="vl_InterpolationComponent">
<property name="leftMargin"> <property name="leftMargin">
@@ -71,7 +71,50 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="BlackGui::Components::CAircraftPartsHistory" name="PartsHistory"/> <widget class="BlackGui::Components::CAircraftPartsHistory" name="comp_PartsHistory"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tb_InterpolationLog">
<attribute name="title">
<string>Interpolation log.</string>
</attribute>
<layout class="QVBoxLayout" name="vl_InterpolationLog">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
<widget class="BlackGui::Components::CCallsignCompleter" name="comp_CallsignCompleter">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
<item>
<widget class="BlackGui::Views::CStatusMessageView" name="tvp_InterpolationMessages">
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
<item alignment="Qt::AlignRight">
<widget class="QPushButton" name="pb_ReloadInterpolationMessages">
<property name="text">
<string>reload</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@@ -92,6 +135,17 @@
<header>blackgui/components/interpolationsetupcomponent.h</header> <header>blackgui/components/interpolationsetupcomponent.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>BlackGui::Components::CCallsignCompleter</class>
<extends>QFrame</extends>
<header>blackgui/components/callsigncompleter.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>BlackGui::Views::CStatusMessageView</class>
<extends>QTableView</extends>
<header>blackgui/views/statusmessageview.h</header>
</customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>
<connections/> <connections/>

View File

@@ -20,16 +20,13 @@
#include <QObject> #include <QObject>
class QWidget;
namespace BlackGui namespace BlackGui
{ {
namespace Filters { class CStatusMessageFilterDialog; } namespace Filters { class CStatusMessageFilterDialog; }
namespace Views namespace Views
{ {
//! Status message view //! Status message view
class BLACKGUI_EXPORT CStatusMessageView : class BLACKGUI_EXPORT CStatusMessageView : public CViewBase<Models::CStatusMessageListModel, BlackMisc::CStatusMessageList, BlackMisc::CStatusMessage>
public CViewBase<Models::CStatusMessageListModel, BlackMisc::CStatusMessageList, BlackMisc::CStatusMessage>
{ {
Q_OBJECT Q_OBJECT