mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 16:56:53 +08:00
Minor Ui adjustments ATC component
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include <QModelIndex>
|
||||
#include <QPushButton>
|
||||
#include <QStandardItemModel>
|
||||
#include <QStringBuilder>
|
||||
#include <QTabBar>
|
||||
#include <QTableView>
|
||||
#include <QTextEdit>
|
||||
@@ -66,10 +67,10 @@ namespace BlackGui
|
||||
ui->le_AtcStationsOnlineMetar->setValidator(ucv);
|
||||
|
||||
// some icons
|
||||
ui->pb_AtcStationsAtisReload->setIcon(CIcons::atis());
|
||||
ui->pb_AtcStationsAtisReload->setText("");
|
||||
ui->pb_AtcStationsLoadMetar->setIcon(CIcons::metar());
|
||||
ui->pb_AtcStationsLoadMetar->setText("");
|
||||
ui->tb_AtcStationsAtisReload->setIcon(CIcons::atis());
|
||||
ui->tb_AtcStationsAtisReload->setText("");
|
||||
ui->tb_AtcStationsLoadMetar->setIcon(CIcons::metar());
|
||||
ui->tb_AtcStationsLoadMetar->setText("");
|
||||
|
||||
// set station mode
|
||||
ui->tvp_AtcStationsOnline->setStationMode(CAtcStationListModel::StationsOnline);
|
||||
@@ -80,7 +81,7 @@ namespace BlackGui
|
||||
|
||||
// Signal / Slots
|
||||
connect(ui->le_AtcStationsOnlineMetar, &QLineEdit::returnPressed, this, &CAtcStationComponent::getMetarAsEntered);
|
||||
connect(ui->pb_AtcStationsLoadMetar, &QPushButton::clicked, this, &CAtcStationComponent::getMetarAsEntered);
|
||||
connect(ui->tb_AtcStationsLoadMetar, &QPushButton::clicked, this, &CAtcStationComponent::getMetarAsEntered);
|
||||
connect(this, &QTabWidget::currentChanged, this, &CAtcStationComponent::atcStationsTabChanged); // "local" tab changed (booked, online)
|
||||
connect(ui->tvp_AtcStationsOnline, &QTableView::clicked, this, &CAtcStationComponent::onlineAtcStationSelected);
|
||||
connect(ui->tvp_AtcStationsOnline, &CAtcStationView::testRequestDummyAtcOnlineStations, this, &CAtcStationComponent::testCreateDummyOnlineAtcStations);
|
||||
@@ -94,7 +95,7 @@ namespace BlackGui
|
||||
connect(ui->tvp_AtcStationsBooked, &CAtcStationView::requestNewBackendData, this, &CAtcStationComponent::reloadAtcStationsBooked);
|
||||
connect(ui->tvp_AtcStationsBooked, &CAtcStationView::modelDataChangedDigest, this, &CAtcStationComponent::onCountChanged);
|
||||
|
||||
connect(ui->pb_AtcStationsAtisReload, &QPushButton::clicked, this, &CAtcStationComponent::requestAtis);
|
||||
connect(ui->tb_AtcStationsAtisReload, &QPushButton::clicked, this, &CAtcStationComponent::requestAtis);
|
||||
connect(&m_updateTimer, &QTimer::timeout, this, &CAtcStationComponent::update);
|
||||
|
||||
// runtime based connects
|
||||
@@ -199,28 +200,27 @@ namespace BlackGui
|
||||
|
||||
void CAtcStationComponent::getMetar(const QString &airportIcaoCode)
|
||||
{
|
||||
const QString icao(airportIcaoCode.isEmpty() ? ui->le_AtcStationsOnlineMetar->text().trimmed().toUpper() : airportIcaoCode.trimmed().toUpper());
|
||||
ui->le_AtcStationsOnlineMetar->setText(icao);
|
||||
if (icao.length() != 4) { return; }
|
||||
CMetar metar(sGui->getIContextNetwork()->getMetarForAirport(icao));
|
||||
if (metar == CMetar())
|
||||
const CAirportIcaoCode icao(airportIcaoCode.isEmpty() ? ui->le_AtcStationsOnlineMetar->text().trimmed().toUpper() : airportIcaoCode.trimmed().toUpper());
|
||||
ui->le_AtcStationsOnlineMetar->setText(icao.asString());
|
||||
if (!icao.hasValidIcaoCode()) { return; }
|
||||
const CMetar metar(sGui->getIContextNetwork()->getMetarForAirport(icao));
|
||||
if (metar.hasMessage())
|
||||
{
|
||||
ui->te_AtcStationsOnlineInfo->clear();
|
||||
const QString metarText = metar.getMessage() %
|
||||
QStringLiteral("\n\n") % metar.getMetarText();
|
||||
ui->te_AtcStationsOnlineInfo->setText(metarText);
|
||||
}
|
||||
else
|
||||
{
|
||||
QString metarText = metar.getMessage();
|
||||
metarText += "\n\n";
|
||||
metarText += metar.getMetarText();
|
||||
ui->te_AtcStationsOnlineInfo->setText(metarText);
|
||||
ui->te_AtcStationsOnlineInfo->clear();
|
||||
}
|
||||
ui->le_AtcStationsOnlineMetar->clear();
|
||||
// ui->le_AtcStationsOnlineMetar->clear();
|
||||
}
|
||||
|
||||
void CAtcStationComponent::reloadAtcStationsBooked()
|
||||
{
|
||||
Q_ASSERT(ui->tvp_AtcStationsBooked);
|
||||
Q_ASSERT(sGui->getIContextNetwork());
|
||||
Q_ASSERT(sGui && sGui->getIContextNetwork());
|
||||
|
||||
QObject *sender = QObject::sender();
|
||||
if (sender == ui->tvp_AtcStationsBooked && sGui->getIContextNetwork())
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<attribute name="title">
|
||||
<string>Online</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="vl_AtcStationsOnline">
|
||||
<layout class="QVBoxLayout" name="vl_AtcStationsOnline" stretch="4,0,1">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
@@ -61,16 +61,6 @@
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CSettingsAtcStationsInlineComponent" name="comp_AtcStationsSettings">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="fr_AtcStationsOnlineBottom">
|
||||
<property name="sizePolicy">
|
||||
@@ -79,89 +69,60 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>75</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gl_AtcStationsInfoAtis">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gl_Buttons">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="1" column="3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLineEdit" name="le_AtcStationsOnlineMetar">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string extracomment="METAR: Airport ICAO code">METAR: Airport ICAO code</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>EDDF</string>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="frame">
|
||||
<bool>true</bool>
|
||||
<property name="placeholderText">
|
||||
<string>e.g. KLAX</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QPushButton" name="pb_AtcStationsLoadMetar">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<item row="0" column="5">
|
||||
<widget class="BlackGui::Components::CSettingsAtcStationsInlineComponent" name="comp_AtcStationsSettings">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Load METAR</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>METAR</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QPushButton" name="pb_AtcStationsAtisReload">
|
||||
<item row="0" column="4">
|
||||
<spacer name="hs_buttons">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QToolButton" name="tb_AtcStationsAtisReload">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -174,39 +135,52 @@
|
||||
<property name="text">
|
||||
<string>ATIS</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" rowspan="4" colspan="2">
|
||||
<widget class="QTextEdit" name="te_AtcStationsOnlineInfo">
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="tb_AtcStationsLoadMetar">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
<property name="toolTip">
|
||||
<string>Load METAR</string>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
<property name="text">
|
||||
<string>METAR</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="te_AtcStationsOnlineInfo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tb_AtcStationsOnlineTree">
|
||||
@@ -311,6 +285,16 @@
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>tvp_AtcStationsOnline</tabstop>
|
||||
<tabstop>le_AtcStationsOnlineMetar</tabstop>
|
||||
<tabstop>tb_AtcStationsLoadMetar</tabstop>
|
||||
<tabstop>tb_AtcStationsAtisReload</tabstop>
|
||||
<tabstop>comp_AtcStationsSettings</tabstop>
|
||||
<tabstop>te_AtcStationsOnlineInfo</tabstop>
|
||||
<tabstop>tvp_AtcStationsBooked</tabstop>
|
||||
<tabstop>tvp_AtcStationsOnlineTree</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user