mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
refs #749, SELCAL and cockpit finetuning
* SELCAL combobox was too long * Use tool instead of push buttons
This commit is contained in:
@@ -64,11 +64,11 @@ namespace BlackGui
|
||||
|
||||
// SELCAL pairs in cockpit
|
||||
this->ui->frp_ComPanelSelcalBottom->clear();
|
||||
connect(this->ui->pb_ComPanelSelcalTest, &QPushButton::clicked, this, &CCockpitComComponent::ps_testSelcal);
|
||||
connect(this->ui->tb_ComPanelSelcalTest, &QPushButton::clicked, this, &CCockpitComComponent::ps_testSelcal);
|
||||
|
||||
// COM GUI events
|
||||
connect(this->ui->pb_ComPanelCom1Toggle, &QPushButton::clicked, this, &CCockpitComComponent::ps_guiChangedCockpitValues);
|
||||
connect(this->ui->pb_ComPanelCom2Toggle, &QPushButton::clicked, this, &CCockpitComComponent::ps_guiChangedCockpitValues);
|
||||
connect(this->ui->tb_ComPanelCom1Toggle, &QPushButton::clicked, this, &CCockpitComComponent::ps_guiChangedCockpitValues);
|
||||
connect(this->ui->tb_ComPanelCom2Toggle, &QPushButton::clicked, this, &CCockpitComComponent::ps_guiChangedCockpitValues);
|
||||
connect(this->ui->ds_ComPanelCom1Active, &QDoubleSpinBox::editingFinished, this, &CCockpitComComponent::ps_guiChangedCockpitValues);
|
||||
connect(this->ui->ds_ComPanelCom2Active, &QDoubleSpinBox::editingFinished, this, &CCockpitComComponent::ps_guiChangedCockpitValues);
|
||||
connect(this->ui->ds_ComPanelCom1Standby, &QDoubleSpinBox::editingFinished, this, &CCockpitComComponent::ps_guiChangedCockpitValues);
|
||||
@@ -102,14 +102,14 @@ namespace BlackGui
|
||||
void CCockpitComComponent::ps_guiChangedCockpitValues()
|
||||
{
|
||||
QObject *sender = QObject::sender();
|
||||
if (sender == this->ui->pb_ComPanelCom1Toggle)
|
||||
if (sender == this->ui->tb_ComPanelCom1Toggle)
|
||||
{
|
||||
if (this->ui->ds_ComPanelCom1Standby->value() == this->ui->ds_ComPanelCom1Active->value()) return;
|
||||
double f = this->ui->ds_ComPanelCom1Active->value();
|
||||
this->ui->ds_ComPanelCom1Active->setValue(this->ui->ds_ComPanelCom1Standby->value());
|
||||
this->ui->ds_ComPanelCom1Standby->setValue(f);
|
||||
}
|
||||
else if (sender == this->ui->pb_ComPanelCom2Toggle)
|
||||
else if (sender == this->ui->tb_ComPanelCom2Toggle)
|
||||
{
|
||||
if (this->ui->ds_ComPanelCom2Standby->value() == this->ui->ds_ComPanelCom2Active->value()) return;
|
||||
double f = this->ui->ds_ComPanelCom2Active->value();
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>292</width>
|
||||
<height>96</height>
|
||||
<height>95</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -159,8 +159,8 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" alignment="Qt::AlignHCenter">
|
||||
<widget class="QPushButton" name="pb_ComPanelCom1Toggle">
|
||||
<item row="0" column="1">
|
||||
<widget class="QToolButton" name="tb_ComPanelCom1Toggle">
|
||||
<property name="toolTip">
|
||||
<string>Toggle COM 1 standby/active</string>
|
||||
</property>
|
||||
@@ -266,20 +266,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" alignment="Qt::AlignHCenter">
|
||||
<widget class="QPushButton" name="pb_ComPanelCom2Toggle">
|
||||
<property name="toolTip">
|
||||
<string>Toggle COM 2 standby/active</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../blackmisc/blackmisc.qrc">
|
||||
<normaloff>:/diagona/icons/diagona/icons/arrow-circle-double-135.png</normaloff>:/diagona/icons/diagona/icons/arrow-circle-double-135.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QDoubleSpinBox" name="ds_ComPanelCom2Standby">
|
||||
<property name="decimals">
|
||||
@@ -299,6 +285,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QToolButton" name="tb_ComPanelCom2Toggle">
|
||||
<property name="toolTip">
|
||||
<string>Toggle COM 2 standby/active</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../blackmisc/blackmisc.qrc">
|
||||
<normaloff>:/diagona/icons/diagona/icons/arrow-circle-double-135.png</normaloff>:/diagona/icons/diagona/icons/arrow-circle-double-135.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -355,14 +355,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="BlackGui::Components::CCockpitTransponderModeLedsComponent" name="comp_TransponderLeds">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="BlackGui::Components::CCockpitTransponderModeLedsComponent" name="comp_TransponderLeds"/>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QFrame" name="fr_ComPanelTransponder">
|
||||
@@ -435,23 +428,10 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="BlackGui::Components::CSelcalCodeSelector" name="frp_ComPanelSelcalBottom">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="BlackGui::Components::CSelcalCodeSelector" name="frp_ComPanelSelcalBottom"/>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<item row="0" column="0" colspan="2" alignment="Qt::AlignLeft">
|
||||
<widget class="QFrame" name="fr_ComPanelSelcalTop">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="hl_ComPanelSelcalTop">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
@@ -481,25 +461,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignRight">
|
||||
<widget class="QPushButton" name="pb_ComPanelSelcalTest">
|
||||
<item>
|
||||
<widget class="QToolButton" name="tb_ComPanelSelcalTest">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>test SELCAL</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>test SELCAL</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../blackmisc/blackmisc.qrc">
|
||||
@@ -555,9 +529,9 @@
|
||||
<tabstop>cbp_ComPanelTransponderMode</tabstop>
|
||||
<tabstop>ds_ComPanelCom1Standby</tabstop>
|
||||
<tabstop>ds_ComPanelCom2Standby</tabstop>
|
||||
<tabstop>pb_ComPanelCom1Toggle</tabstop>
|
||||
<tabstop>pb_ComPanelCom2Toggle</tabstop>
|
||||
<tabstop>pb_ComPanelSelcalTest</tabstop>
|
||||
<tabstop>tb_ComPanelCom1Toggle</tabstop>
|
||||
<tabstop>tb_ComPanelCom2Toggle</tabstop>
|
||||
<tabstop>tb_ComPanelSelcalTest</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../../blackmisc/blackmisc.qrc"/>
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace BlackGui
|
||||
ui(new Ui::CCockpitComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->m_minHeightInfoArea = this->ui->comp_CockpitInfoArea->minimumHeight();
|
||||
this->m_minHeightInfoArea = ui->comp_CockpitInfoArea->minimumHeight();
|
||||
connect(ui->wip_CockpitComPanelShowHideBar, &BlackGui::CShowHideBar::toggleShowHide, this, &CCockpitComponent::ps_onToggleShowHideDetails);
|
||||
}
|
||||
|
||||
@@ -48,12 +48,12 @@ namespace BlackGui
|
||||
|
||||
bool CCockpitComponent::isInfoAreaShown() const
|
||||
{
|
||||
return this->ui->wip_CockpitComPanelShowHideBar->isShown();
|
||||
return ui->wip_CockpitComPanelShowHideBar->isShown();
|
||||
}
|
||||
|
||||
void CCockpitComponent::setSelectedTransponderModeStateIdent()
|
||||
{
|
||||
this->ui->comp_CockpitComComponent->setSelectedTransponderModeStateIdent();
|
||||
ui->comp_CockpitComComponent->setSelectedTransponderModeStateIdent();
|
||||
}
|
||||
|
||||
void CCockpitComponent::ps_onToggleShowHideDetails(bool show)
|
||||
@@ -76,12 +76,12 @@ namespace BlackGui
|
||||
QSize manuallySetSize = this->window()->size();
|
||||
|
||||
// hide area
|
||||
this->ui->comp_CockpitInfoArea->setVisible(show);
|
||||
ui->comp_CockpitInfoArea->setVisible(show);
|
||||
|
||||
// adjust size
|
||||
if (show)
|
||||
{
|
||||
this->ui->comp_CockpitInfoArea->setMinimumHeight(m_minHeightInfoArea);
|
||||
ui->comp_CockpitInfoArea->setMinimumHeight(m_minHeightInfoArea);
|
||||
if (this->m_sizeFloatingShown.isValid())
|
||||
{
|
||||
this->window()->resize(m_sizeFloatingShown);
|
||||
@@ -96,7 +96,7 @@ namespace BlackGui
|
||||
}
|
||||
else
|
||||
{
|
||||
this->ui->comp_CockpitInfoArea->setMinimumHeight(0);
|
||||
ui->comp_CockpitInfoArea->setMinimumHeight(0);
|
||||
this->window()->setMinimumSize(defaultSizeHidden);
|
||||
if (this->m_sizeFloatingHidden.isValid())
|
||||
{
|
||||
@@ -114,7 +114,7 @@ namespace BlackGui
|
||||
|
||||
void CCockpitComponent::ps_onToggleFloating(bool floating)
|
||||
{
|
||||
this->ui->wip_CockpitComPanelShowHideBar->setVisible(floating);
|
||||
ui->wip_CockpitComPanelShowHideBar->setVisible(floating);
|
||||
if (floating)
|
||||
{
|
||||
// use the toggle method to set the sizes
|
||||
@@ -123,10 +123,9 @@ namespace BlackGui
|
||||
else
|
||||
{
|
||||
const QSize sizeMinimum(200, 100); // set when docked, must fit into parent info area
|
||||
this->ui->comp_CockpitInfoArea->setVisible(true);
|
||||
ui->comp_CockpitInfoArea->setVisible(true);
|
||||
this->window()->setMinimumSize(sizeMinimum);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -26,15 +26,18 @@ namespace BlackGui
|
||||
CSelcalCodeSelector::CSelcalCodeSelector(QWidget *parent) :
|
||||
QFrame(parent), ui(new Ui::CSelcalCodeSelector)
|
||||
{
|
||||
this->ui->setupUi(this);
|
||||
ui->setupUi(this);
|
||||
this->resetSelcalCodes(true);
|
||||
this->setValidityHint();
|
||||
this->ui->lblp_ValidCodeIcon->setToolTips("valid SELCAL", "invalid SELCAL");
|
||||
ui->lblp_ValidCodeIcon->setToolTips("valid SELCAL", "invalid SELCAL");
|
||||
|
||||
bool c;
|
||||
c = connect(this->ui->cb_SelcalPairs1, SIGNAL(currentIndexChanged(int)), this, SLOT(ps_selcalIndexChanged()));
|
||||
// limit number of elements: https://forum.qt.io/topic/11315/limit-the-number-of-visible-items-on-qcombobox/6
|
||||
ui->cb_SelcalPairs1->setStyleSheet("combobox-popup: 0;");
|
||||
ui->cb_SelcalPairs2->setStyleSheet("combobox-popup: 0;");
|
||||
|
||||
bool c = connect(ui->cb_SelcalPairs1, SIGNAL(currentIndexChanged(int)), this, SLOT(ps_selcalIndexChanged()));
|
||||
Q_ASSERT(c);
|
||||
c = connect(this->ui->cb_SelcalPairs2, SIGNAL(currentIndexChanged(int)), this, SLOT(ps_selcalIndexChanged()));
|
||||
c = connect(ui->cb_SelcalPairs2, SIGNAL(currentIndexChanged(int)), this, SLOT(ps_selcalIndexChanged()));
|
||||
Q_ASSERT(c);
|
||||
Q_UNUSED(c);
|
||||
}
|
||||
@@ -44,8 +47,8 @@ namespace BlackGui
|
||||
|
||||
QString CSelcalCodeSelector::getSelcalCode() const
|
||||
{
|
||||
QString selcal = this->ui->cb_SelcalPairs1->currentText();
|
||||
selcal.append(this->ui->cb_SelcalPairs2->currentText());
|
||||
QString selcal = ui->cb_SelcalPairs1->currentText();
|
||||
selcal.append(ui->cb_SelcalPairs2->currentText());
|
||||
return selcal;
|
||||
}
|
||||
|
||||
@@ -57,12 +60,12 @@ namespace BlackGui
|
||||
|
||||
void CSelcalCodeSelector::resetSelcalCodes(bool allowEmptyValue)
|
||||
{
|
||||
this->ui->cb_SelcalPairs1->clear();
|
||||
if (allowEmptyValue) this->ui->cb_SelcalPairs1->addItem(" ");
|
||||
this->ui->cb_SelcalPairs1->addItems(BlackMisc::Aviation::CSelcal::codePairs());
|
||||
this->ui->cb_SelcalPairs2->clear();
|
||||
if (allowEmptyValue) this->ui->cb_SelcalPairs2->addItem(" ");
|
||||
this->ui->cb_SelcalPairs2->addItems(BlackMisc::Aviation::CSelcal::codePairs());
|
||||
ui->cb_SelcalPairs1->clear();
|
||||
if (allowEmptyValue) ui->cb_SelcalPairs1->addItem(" ");
|
||||
ui->cb_SelcalPairs1->addItems(BlackMisc::Aviation::CSelcal::codePairs());
|
||||
ui->cb_SelcalPairs2->clear();
|
||||
if (allowEmptyValue) ui->cb_SelcalPairs2->addItem(" ");
|
||||
ui->cb_SelcalPairs2->addItems(BlackMisc::Aviation::CSelcal::codePairs());
|
||||
}
|
||||
|
||||
void CSelcalCodeSelector::setSelcalCode(const QString &selcal)
|
||||
@@ -75,11 +78,11 @@ namespace BlackGui
|
||||
QString s2 = s.right(2);
|
||||
if (BlackMisc::Aviation::CSelcal::codePairs().contains(s1))
|
||||
{
|
||||
this->ui->cb_SelcalPairs1->setCurrentText(s1);
|
||||
ui->cb_SelcalPairs1->setCurrentText(s1);
|
||||
}
|
||||
if (BlackMisc::Aviation::CSelcal::codePairs().contains(s2))
|
||||
{
|
||||
this->ui->cb_SelcalPairs2->setCurrentText(s2);
|
||||
ui->cb_SelcalPairs2->setCurrentText(s2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,9 +100,9 @@ namespace BlackGui
|
||||
|
||||
void CSelcalCodeSelector::clear()
|
||||
{
|
||||
if (this->ui->cb_SelcalPairs1->count() < 1) { this->resetSelcalCodes(true); }
|
||||
this->ui->cb_SelcalPairs1->setCurrentIndex(0);
|
||||
this->ui->cb_SelcalPairs2->setCurrentIndex(0);
|
||||
if (ui->cb_SelcalPairs1->count() < 1) { this->resetSelcalCodes(true); }
|
||||
ui->cb_SelcalPairs1->setCurrentIndex(0);
|
||||
ui->cb_SelcalPairs2->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void CSelcalCodeSelector::ps_selcalIndexChanged()
|
||||
@@ -110,7 +113,7 @@ namespace BlackGui
|
||||
|
||||
void CSelcalCodeSelector::setValidityHint()
|
||||
{
|
||||
this->ui->lblp_ValidCodeIcon->setTicked(this->hasValidCode());
|
||||
ui->lblp_ValidCodeIcon->setTicked(this->hasValidCode());
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -2,22 +2,8 @@
|
||||
<ui version="4.0">
|
||||
<class>CSelcalCodeSelector</class>
|
||||
<widget class="QFrame" name="CSelcalCodeSelector">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>151</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
<string>SELCAL selector</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="hl_SelcalCodeSelector">
|
||||
<property name="spacing">
|
||||
@@ -53,7 +39,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../blackmisc/blackmisc.qrc">:/diagona/icons/diagona/icons/tick-button.png</pixmap>
|
||||
<pixmap resource="../../blackmisc/blackmisc.qrc">:/diagona/icons/diagona/icons/tick-button.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -67,7 +53,7 @@
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../blackmisc/blackmisc.qrc"/>
|
||||
<include location="../../blackmisc/blackmisc.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user