mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
Allow to select COM frequencies from ATC view (context menu)
* added functions in component to select COM frequencies * changed views to contain ObjectType in template * function to obtain selected objects in view base class
This commit is contained in:
@@ -14,12 +14,14 @@
|
||||
#include "blackmisc/avinformationmessage.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackcore/context_network.h"
|
||||
#include "blackcore/context_ownaircraft.h"
|
||||
|
||||
using namespace BlackGui;
|
||||
using namespace BlackGui::Models;
|
||||
using namespace BlackGui::Views;
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackCore;
|
||||
|
||||
namespace BlackGui
|
||||
@@ -57,6 +59,7 @@ namespace BlackGui
|
||||
connect(this->ui->tvp_AtcStationsOnline, &CAtcStationView::requestUpdate, this, &CAtcStationComponent::ps_requestOnlineStationsUpdate);
|
||||
connect(this->ui->tvp_AtcStationsOnline, &CAtcStationView::countChanged, this, &CAtcStationComponent::ps_countChanged);
|
||||
connect(this->ui->tvp_AtcStationsOnline, &CAtcStationView::countChanged, this, &CAtcStationComponent::ps_countChanged);
|
||||
connect(this->ui->tvp_AtcStationsOnline, &CAtcStationView::requestComFrequency, this, &CAtcStationComponent::ps_setComFrequency);
|
||||
|
||||
connect(this->ui->tvp_AtcStationsBooked, &CAtcStationView::requestUpdate, this, &CAtcStationComponent::ps_reloadAtcStationsBooked);
|
||||
connect(this->ui->tvp_AtcStationsBooked, &CAtcStationView::countChanged, this, &CAtcStationComponent::ps_countChanged);
|
||||
@@ -241,6 +244,13 @@ namespace BlackGui
|
||||
this->tabBar()->setTabText(ib, b);
|
||||
}
|
||||
|
||||
void CAtcStationComponent::ps_setComFrequency(const PhysicalQuantities::CFrequency &frequency, CComSystem::ComUnit unit)
|
||||
{
|
||||
if (unit != CComSystem::Com1 && unit != CComSystem::Com2) { return; }
|
||||
if (!CComSystem::isValidComFrequency(frequency)) { return; }
|
||||
this->getIContextOwnAircraft()->updateComFrequency(frequency, static_cast<int>(unit), originator());
|
||||
}
|
||||
|
||||
void CAtcStationComponent::ps_onlineAtcStationSelected(QModelIndex index)
|
||||
{
|
||||
this->ui->te_AtcStationsOnlineInfo->setText(""); // reset
|
||||
|
||||
@@ -15,9 +15,7 @@
|
||||
#include "blackgui/components/enableforruntime.h"
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/components/updatetimer.h"
|
||||
|
||||
#include "blackmisc/avatcstation.h"
|
||||
|
||||
#include <QTabWidget>
|
||||
#include <QModelIndex>
|
||||
#include <QScopedPointer>
|
||||
@@ -111,6 +109,9 @@ namespace BlackGui
|
||||
//! Count has been changed
|
||||
void ps_countChanged(int count);
|
||||
|
||||
//! Set COM frequency
|
||||
void ps_setComFrequency(const BlackMisc::PhysicalQuantities::CFrequency &frequency, BlackMisc::Aviation::CComSystem::ComUnit unit);
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CAtcStationComponent> ui;
|
||||
CUpdateTimer *m_updateTimer = nullptr;
|
||||
@@ -118,7 +119,16 @@ namespace BlackGui
|
||||
QDateTime m_timestampOnlineStationsChanged = CUpdateTimer::epoch(); //!< stations marked as changed
|
||||
QDateTime m_timestampLastReadBookedStations = CUpdateTimer::epoch(); //!< stations read
|
||||
QDateTime m_timestampBookedStationsChanged = CUpdateTimer::epoch(); //!< stations marked as changed
|
||||
|
||||
const QString &originator()
|
||||
{
|
||||
// string is generated once, the timestamp allows to use multiple
|
||||
// components (as long as they are not generated at the same ms)
|
||||
static const QString o = QString("ATCSTATIOCOMPONENT:").append(QString::number(QDateTime::currentMSecsSinceEpoch()));
|
||||
return o;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
#endif // guard
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace BlackGui
|
||||
|
||||
CAircraftComponent *CMainInfoAreaComponent::getAircraftComponent()
|
||||
{
|
||||
return this->ui->comp_Aircrafts;
|
||||
return this->ui->comp_Aircraft;
|
||||
}
|
||||
|
||||
CUserComponent *CMainInfoAreaComponent::getUserComponent()
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="BlackGui::CDockWidgetInfoArea" name="dwp_Aircrafts">
|
||||
<widget class="BlackGui::CDockWidgetInfoArea" name="dwp_Aircraft">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>127</width>
|
||||
@@ -97,7 +97,7 @@
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>4</number>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="qw_AircraftsInner">
|
||||
<widget class="QWidget" name="qw_AircraftInner">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@@ -121,7 +121,7 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CAircraftComponent" name="comp_Aircrafts">
|
||||
<widget class="BlackGui::Components::CAircraftComponent" name="comp_Aircraft">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
|
||||
@@ -141,7 +141,7 @@ namespace BlackGui
|
||||
*/
|
||||
void CSettingsComponent::ps_networkServerSelected(QModelIndex index)
|
||||
{
|
||||
const CServer clickedServer = this->ui->tvp_SettingsTnServers->at<CServer>(index);
|
||||
const CServer clickedServer = this->ui->tvp_SettingsTnServers->at(index);
|
||||
this->ui->frp_ServerForm->setServer(clickedServer);
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ namespace BlackGui
|
||||
{
|
||||
QModelIndex i = this->ui->tvp_SettingsMiscHotkeys->currentIndex();
|
||||
if (i.row() < 0 || i.row() >= this->ui->tvp_SettingsMiscHotkeys->rowCount()) return;
|
||||
CSettingKeyboardHotkey hotkey = this->ui->tvp_SettingsMiscHotkeys->at<CSettingKeyboardHotkey>(i);
|
||||
CSettingKeyboardHotkey hotkey = this->ui->tvp_SettingsMiscHotkeys->at(i);
|
||||
CSettingKeyboardHotkey defaultHotkey;
|
||||
defaultHotkey.setFunction(hotkey.getFunction());
|
||||
this->ui->tvp_SettingsMiscHotkeys->derivedModel()->update(i, defaultHotkey);
|
||||
|
||||
Reference in New Issue
Block a user