mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 11:25:33 +08:00
Mapping component, hide splitter when model details are not needed (based on selected tab)
This commit is contained in:
@@ -72,7 +72,7 @@ namespace BlackGui
|
|||||||
Q_ASSERT_X(sGui->getIContextNetwork(), Q_FUNC_INFO, "need network context");
|
Q_ASSERT_X(sGui->getIContextNetwork(), Q_FUNC_INFO, "need network context");
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->tw_ListViews->setCurrentIndex(0);
|
ui->tw_SpecializedViews->setCurrentIndex(0);
|
||||||
|
|
||||||
ui->tvp_AircraftModels->setAircraftModelMode(CAircraftModelListModel::OwnAircraftModelClient);
|
ui->tvp_AircraftModels->setAircraftModelMode(CAircraftModelListModel::OwnAircraftModelClient);
|
||||||
ui->tvp_AircraftModels->setResizeMode(CAircraftModelView::ResizingOff);
|
ui->tvp_AircraftModels->setResizeMode(CAircraftModelView::ResizingOff);
|
||||||
@@ -139,6 +139,8 @@ namespace BlackGui
|
|||||||
connect(sGui->getIContextNetwork(), &IContextNetwork::removedAircraft, this, &CMappingComponent::tokenBucketUpdate);
|
connect(sGui->getIContextNetwork(), &IContextNetwork::removedAircraft, this, &CMappingComponent::tokenBucketUpdate);
|
||||||
connect(sGui->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CMappingComponent::onConnectionStatusChanged);
|
connect(sGui->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CMappingComponent::onConnectionStatusChanged);
|
||||||
|
|
||||||
|
connect(ui->tw_SpecializedViews, &QTabWidget::currentChanged, this, &CMappingComponent::onTabWidgetChanged);
|
||||||
|
|
||||||
// requires simulator context
|
// requires simulator context
|
||||||
connect(ui->tvp_RenderedAircraft, &CAircraftModelView::objectChanged, this, &CMappingComponent::onChangedSimulatedAircraftInView);
|
connect(ui->tvp_RenderedAircraft, &CAircraftModelView::objectChanged, this, &CMappingComponent::onChangedSimulatedAircraftInView);
|
||||||
|
|
||||||
@@ -188,15 +190,15 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
Q_UNUSED(count);
|
Q_UNUSED(count);
|
||||||
Q_UNUSED(withFilter);
|
Q_UNUSED(withFilter);
|
||||||
const int am = ui->tw_ListViews->indexOf(ui->tb_AircraftModels);
|
const int am = ui->tw_SpecializedViews->indexOf(ui->tb_AircraftModels);
|
||||||
const int cm = ui->tw_ListViews->indexOf(ui->tb_CurrentMappings);
|
const int cm = ui->tw_SpecializedViews->indexOf(ui->tb_CurrentMappings);
|
||||||
const QString amf = ui->tvp_AircraftModels->derivedModel()->hasFilter() ? "F" : "";
|
const QString amf = ui->tvp_AircraftModels->derivedModel()->hasFilter() ? "F" : "";
|
||||||
QString a = ui->tw_ListViews->tabBar()->tabText(am);
|
QString a = ui->tw_SpecializedViews->tabBar()->tabText(am);
|
||||||
QString c = ui->tw_ListViews->tabBar()->tabText(cm);
|
QString c = ui->tw_SpecializedViews->tabBar()->tabText(cm);
|
||||||
a = CGuiUtility::replaceTabCountValue(a, this->countAircraftModels()) + amf;
|
a = CGuiUtility::replaceTabCountValue(a, this->countAircraftModels()) + amf;
|
||||||
c = CGuiUtility::replaceTabCountValue(c, this->countCurrentMappings());
|
c = CGuiUtility::replaceTabCountValue(c, this->countCurrentMappings());
|
||||||
ui->tw_ListViews->tabBar()->setTabText(am, a);
|
ui->tw_SpecializedViews->tabBar()->setTabText(am, a);
|
||||||
ui->tw_ListViews->tabBar()->setTabText(cm, c);
|
ui->tw_SpecializedViews->tabBar()->setTabText(cm, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::onChangedSimulatedAircraftInView(const CVariant &object, const CPropertyIndex &index)
|
void CMappingComponent::onChangedSimulatedAircraftInView(const CVariant &object, const CPropertyIndex &index)
|
||||||
@@ -426,6 +428,25 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMappingComponent::showAircraftModelDetails(bool show)
|
||||||
|
{
|
||||||
|
QList<int> sizes = ui->sp_MappingComponentSplitter->sizes();
|
||||||
|
Q_ASSERT_X(sizes.size() == 2, Q_FUNC_INFO, "Wrong splitter sizes");
|
||||||
|
const int total = sizes[0] + sizes[1];
|
||||||
|
QList<int> newSizes({0, 0});
|
||||||
|
if (show)
|
||||||
|
{
|
||||||
|
newSizes[0] = total * 0.8;
|
||||||
|
newSizes[1] = total * 0.2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newSizes[0] = total;
|
||||||
|
newSizes[1] = 0;
|
||||||
|
}
|
||||||
|
ui->sp_MappingComponentSplitter->setSizes(newSizes);
|
||||||
|
}
|
||||||
|
|
||||||
void CMappingComponent::addingRemoteAircraftFailed(const CSimulatedAircraft &aircraft, const CStatusMessage &message)
|
void CMappingComponent::addingRemoteAircraftFailed(const CSimulatedAircraft &aircraft, const CStatusMessage &message)
|
||||||
{
|
{
|
||||||
this->tokenBucketUpdate();
|
this->tokenBucketUpdate();
|
||||||
@@ -441,6 +462,14 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMappingComponent::onTabWidgetChanged(int index)
|
||||||
|
{
|
||||||
|
Q_UNUSED(index);
|
||||||
|
const TabWidget w = static_cast<TabWidget>(index);
|
||||||
|
const bool show = (w == TabAircraftModels) || (w == TabRenderedAircraft);
|
||||||
|
this->showAircraftModelDetails(show);
|
||||||
|
}
|
||||||
|
|
||||||
void CMappingComponent::updateRenderedAircraftView(bool forceUpdate)
|
void CMappingComponent::updateRenderedAircraftView(bool forceUpdate)
|
||||||
{
|
{
|
||||||
m_updateTimer.start(); // restart
|
m_updateTimer.start(); // restart
|
||||||
|
|||||||
@@ -55,6 +55,16 @@ namespace BlackGui
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
//! Tab widget
|
||||||
|
enum TabWidget {
|
||||||
|
TabRenderedAircraft = 0,
|
||||||
|
TabAircraftModels,
|
||||||
|
TabInterpolatorSetup,
|
||||||
|
TabStatistics,
|
||||||
|
TabMatchingLog,
|
||||||
|
TabPartsLog
|
||||||
|
};
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
explicit CMappingComponent(QWidget *parent = nullptr);
|
explicit CMappingComponent(QWidget *parent = nullptr);
|
||||||
|
|
||||||
@@ -118,9 +128,15 @@ namespace BlackGui
|
|||||||
//! Enable / disable aircraft
|
//! Enable / disable aircraft
|
||||||
void onMenuToggleEnableAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
void onMenuToggleEnableAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
||||||
|
|
||||||
|
//! Widget changed
|
||||||
|
void onTabWidgetChanged(int index);
|
||||||
|
|
||||||
//! Highlight in simulator
|
//! Highlight in simulator
|
||||||
void onMenuHighlightInSimulator(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
void onMenuHighlightInSimulator(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
||||||
|
|
||||||
|
//! Show / hide model details
|
||||||
|
void showAircraftModelDetails(bool show);
|
||||||
|
|
||||||
//! Adding a remote aircraft failed
|
//! Adding a remote aircraft failed
|
||||||
void addingRemoteAircraftFailed(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CStatusMessage &message);
|
void addingRemoteAircraftFailed(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CStatusMessage &message);
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QTabWidget" name="tw_ListViews">
|
<widget class="QTabWidget" name="tw_SpecializedViews">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
@@ -149,28 +149,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</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>
|
||||||
<widget class="QFrame" name="fr_AircraftModifications">
|
<widget class="QFrame" name="fr_AircraftModifications">
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
@@ -327,12 +305,6 @@
|
|||||||
<header>blackgui/components/modelmatcherlogcomponent.h</header>
|
<header>blackgui/components/modelmatcherlogcomponent.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
|
||||||
<class>BlackGui::Components::CAircraftPartsHistory</class>
|
|
||||||
<extends>QFrame</extends>
|
|
||||||
<header>blackgui/components/aircraftpartshistory.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>BlackGui::Components::CAircraftModelStringCompleter</class>
|
<class>BlackGui::Components::CAircraftModelStringCompleter</class>
|
||||||
<extends>QFrame</extends>
|
<extends>QFrame</extends>
|
||||||
|
|||||||
Reference in New Issue
Block a user