mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
Ref T298, buttons for re-matching
This commit is contained in:
@@ -96,6 +96,7 @@ namespace BlackGui
|
||||
connect(ui->pb_SaveAircraft, &QPushButton::clicked, this, &CMappingComponent::onSaveAircraft);
|
||||
connect(ui->pb_ResetAircraft, &QPushButton::clicked, this, &CMappingComponent::onResetAircraft);
|
||||
connect(ui->pb_LoadModels, &QPushButton::clicked, this, &CMappingComponent::onModelsUpdateRequested);
|
||||
connect(ui->pb_DoMatchingAgain, &QPushButton::clicked, this, &CMappingComponent::doMatchingsAgain);
|
||||
|
||||
m_currentMappingsViewDelegate = new CCheckBoxDelegate(":/diagona/icons/diagona/icons/tick.png", ":/diagona/icons/diagona/icons/cross.png", this);
|
||||
ui->tvp_RenderedAircraft->setItemDelegateForColumn(0, m_currentMappingsViewDelegate);
|
||||
@@ -294,6 +295,13 @@ namespace BlackGui
|
||||
ui->comp_SimulatorSelector->setToConnectedSimulator(50);
|
||||
}
|
||||
|
||||
void CMappingComponent::doMatchingsAgain()
|
||||
{
|
||||
if (!sGui || !sGui->getISimulator() || !sGui->getISimulator()->isConnected()) { return; }
|
||||
const int reMatchedNo = sGui->getIContextSimulator()->doMatchingsAgain();
|
||||
CLogMessage(this).info("Triggered re-apping of %1 aircraft") << reMatchedNo;
|
||||
}
|
||||
|
||||
void CMappingComponent::onSaveAircraft()
|
||||
{
|
||||
if (!sGui->getIContextSimulator()->isSimulatorSimulating()) { return; }
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <QString>
|
||||
#include <Qt>
|
||||
|
||||
class QCompleter;
|
||||
class QModelIndex;
|
||||
|
||||
namespace BlackMisc
|
||||
@@ -168,13 +167,16 @@ namespace BlackGui
|
||||
//! Plugin info has been changed
|
||||
void onSimulatorPluginChanged(const BlackMisc::Simulation::CSimulatorPluginInfo &pluginInfo);
|
||||
|
||||
//! Do re-matching
|
||||
void doMatchingsAgain();
|
||||
|
||||
static constexpr int OverlayMessageMs = 5000;
|
||||
QScopedPointer<Ui::CMappingComponent> ui;
|
||||
bool m_missedRenderedAircraftUpdate = true; //! Rendered aircraft need update
|
||||
QTimer m_updateTimer;
|
||||
BlackMisc::CTokenBucket m_bucket { 3, BlackMisc::PhysicalQuantities::CTime(5.0, BlackMisc::PhysicalQuantities::CTimeUnit::s()), 1};
|
||||
Views::CCheckBoxDelegate *m_currentMappingsViewDelegate = nullptr; //! checkbox in view
|
||||
BlackMisc::CSettingReadOnly<BlackGui::Settings::TViewUpdateSettings> m_settings { this, &CMappingComponent::settingsChanged }; //!< settings changed
|
||||
Views::CCheckBoxDelegate *m_currentMappingsViewDelegate = nullptr; //! checkbox in view
|
||||
};
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>319</width>
|
||||
<height>303</height>
|
||||
<width>376</width>
|
||||
<height>293</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -170,27 +170,20 @@
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="2" column="0" colspan="5">
|
||||
<widget class="BlackGui::Components::CAircraftModelStringCompleter" name="completer_ModelStrings">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
<item row="1" column="5">
|
||||
<widget class="QPushButton" name="pb_SaveAircraft">
|
||||
<property name="toolTip">
|
||||
<string>save selected model</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_Aircraft">
|
||||
<property name="text">
|
||||
<string>Aircraft</string>
|
||||
<string>save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="cb_AircraftEnabled">
|
||||
<property name="toolTip">
|
||||
<string>enabled / disable</string>
|
||||
<string>aircraft enabled/disable</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
@@ -210,13 +203,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QPushButton" name="pb_SaveAircraft">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_Aircraft">
|
||||
<property name="toolTip">
|
||||
<string>save selected model</string>
|
||||
<string>aircraft enabled</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>save</string>
|
||||
<string>Enbl.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -227,13 +220,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="pb_ResetAircraft">
|
||||
<item row="0" column="5">
|
||||
<widget class="QPushButton" name="pb_LoadModels">
|
||||
<property name="toolTip">
|
||||
<string>reset model by callsign</string>
|
||||
<string>load model set</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>reset</string>
|
||||
<string>load set</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -256,17 +249,27 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QPushButton" name="pb_LoadModels">
|
||||
<property name="toolTip">
|
||||
<string>load model set</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>load set</string>
|
||||
<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="2" colspan="2">
|
||||
<item row="1" column="4">
|
||||
<widget class="QPushButton" name="pb_DoMatchingAgain">
|
||||
<property name="toolTip">
|
||||
<string>do all matchings again</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>re-match</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" colspan="3">
|
||||
<widget class="BlackGui::Components::CSimulatorSelector" name="comp_SimulatorSelector">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
@@ -276,6 +279,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="pb_ResetAircraft">
|
||||
<property name="toolTip">
|
||||
<string>reset model by callsign</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>reset</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../blackmisc/blackmisc.qrc">
|
||||
<normaloff>:/pastel/icons/pastel/16/arrow-refresh.png</normaloff>:/pastel/icons/pastel/16/arrow-refresh.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
@@ -318,6 +335,20 @@
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<tabstops>
|
||||
<tabstop>tw_SpecializedViews</tabstop>
|
||||
<tabstop>tvp_RenderedAircraft</tabstop>
|
||||
<tabstop>cb_AircraftIconDisplayed</tabstop>
|
||||
<tabstop>pb_LoadModels</tabstop>
|
||||
<tabstop>cb_AircraftEnabled</tabstop>
|
||||
<tabstop>le_Callsign</tabstop>
|
||||
<tabstop>pb_ResetAircraft</tabstop>
|
||||
<tabstop>pb_DoMatchingAgain</tabstop>
|
||||
<tabstop>pb_SaveAircraft</tabstop>
|
||||
<tabstop>tvp_AircraftModels</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../../blackmisc/blackmisc.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -12,8 +12,10 @@
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackcore/context/contextsimulator.h"
|
||||
#include "blackmisc/simulation/aircraftmatchersetup.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include <QPointer>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackCore::Context;
|
||||
|
||||
@@ -28,6 +30,7 @@ namespace BlackGui
|
||||
ui->setupUi(this);
|
||||
connect(ui->pb_Save, &QPushButton::released, this, &CSettingsMatchingComponent::onSavePressed);
|
||||
connect(ui->pb_Reload, &QPushButton::released, this, &CSettingsMatchingComponent::onReloadPressed);
|
||||
connect(ui->pb_MatchingAgain, &QPushButton::released, this, &CSettingsMatchingComponent::onMatchingsAgainPressed);
|
||||
|
||||
IContextSimulator *simContext = simulatorContext();
|
||||
if (simContext)
|
||||
@@ -53,6 +56,13 @@ namespace BlackGui
|
||||
this->deferredReload(0);
|
||||
}
|
||||
|
||||
void CSettingsMatchingComponent::onMatchingsAgainPressed()
|
||||
{
|
||||
if (!sGui || !sGui->getISimulator() || !sGui->getISimulator()->isConnected()) { return; }
|
||||
const int reMatchedNo = sGui->getIContextSimulator()->doMatchingsAgain();
|
||||
CLogMessage(this).info("Triggered re-apping of %1 aircraft") << reMatchedNo;
|
||||
}
|
||||
|
||||
void CSettingsMatchingComponent::onSetupChanged()
|
||||
{
|
||||
const IContextSimulator *simContext = simulatorContext();
|
||||
|
||||
@@ -42,6 +42,9 @@ namespace BlackGui
|
||||
//! Reload pressed
|
||||
void onReloadPressed();
|
||||
|
||||
//! Do re-matching
|
||||
void onMatchingsAgainPressed();
|
||||
|
||||
//! Setup has been changed
|
||||
void onSetupChanged();
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>230</width>
|
||||
<height>197</height>
|
||||
<width>315</width>
|
||||
<height>309</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -36,7 +36,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>211</width>
|
||||
<width>296</width>
|
||||
<height>375</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -83,6 +83,16 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_MatchingAgain">
|
||||
<property name="toolTip">
|
||||
<string>do matching for all models again</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>re-matching</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_Reload">
|
||||
<property name="text">
|
||||
|
||||
Reference in New Issue
Block a user