refs #749, SELCAL and cockpit finetuning

* SELCAL combobox was too long
* Use tool instead of push buttons
This commit is contained in:
Klaus Basan
2016-08-29 00:27:52 +02:00
parent 1d1815de43
commit bfd94ea6a8
5 changed files with 64 additions and 102 deletions

View File

@@ -64,11 +64,11 @@ namespace BlackGui
// SELCAL pairs in cockpit // SELCAL pairs in cockpit
this->ui->frp_ComPanelSelcalBottom->clear(); 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 // COM GUI events
connect(this->ui->pb_ComPanelCom1Toggle, &QPushButton::clicked, this, &CCockpitComComponent::ps_guiChangedCockpitValues); connect(this->ui->tb_ComPanelCom1Toggle, &QPushButton::clicked, this, &CCockpitComComponent::ps_guiChangedCockpitValues);
connect(this->ui->pb_ComPanelCom2Toggle, &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_ComPanelCom1Active, &QDoubleSpinBox::editingFinished, this, &CCockpitComComponent::ps_guiChangedCockpitValues);
connect(this->ui->ds_ComPanelCom2Active, &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); connect(this->ui->ds_ComPanelCom1Standby, &QDoubleSpinBox::editingFinished, this, &CCockpitComComponent::ps_guiChangedCockpitValues);
@@ -102,14 +102,14 @@ namespace BlackGui
void CCockpitComComponent::ps_guiChangedCockpitValues() void CCockpitComComponent::ps_guiChangedCockpitValues()
{ {
QObject *sender = QObject::sender(); 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; if (this->ui->ds_ComPanelCom1Standby->value() == this->ui->ds_ComPanelCom1Active->value()) return;
double f = this->ui->ds_ComPanelCom1Active->value(); double f = this->ui->ds_ComPanelCom1Active->value();
this->ui->ds_ComPanelCom1Active->setValue(this->ui->ds_ComPanelCom1Standby->value()); this->ui->ds_ComPanelCom1Active->setValue(this->ui->ds_ComPanelCom1Standby->value());
this->ui->ds_ComPanelCom1Standby->setValue(f); 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; if (this->ui->ds_ComPanelCom2Standby->value() == this->ui->ds_ComPanelCom2Active->value()) return;
double f = this->ui->ds_ComPanelCom2Active->value(); double f = this->ui->ds_ComPanelCom2Active->value();

View File

@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>292</width> <width>292</width>
<height>96</height> <height>95</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -159,8 +159,8 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1" alignment="Qt::AlignHCenter"> <item row="0" column="1">
<widget class="QPushButton" name="pb_ComPanelCom1Toggle"> <widget class="QToolButton" name="tb_ComPanelCom1Toggle">
<property name="toolTip"> <property name="toolTip">
<string>Toggle COM 1 standby/active</string> <string>Toggle COM 1 standby/active</string>
</property> </property>
@@ -266,20 +266,6 @@
</property> </property>
</widget> </widget>
</item> </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"> <item row="1" column="0" colspan="2">
<widget class="QDoubleSpinBox" name="ds_ComPanelCom2Standby"> <widget class="QDoubleSpinBox" name="ds_ComPanelCom2Standby">
<property name="decimals"> <property name="decimals">
@@ -299,6 +285,20 @@
</property> </property>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
</item> </item>
@@ -355,14 +355,7 @@
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="BlackGui::Components::CCockpitTransponderModeLedsComponent" name="comp_TransponderLeds"> <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>
</item> </item>
<item row="1" column="0" colspan="2"> <item row="1" column="0" colspan="2">
<widget class="QFrame" name="fr_ComPanelTransponder"> <widget class="QFrame" name="fr_ComPanelTransponder">
@@ -435,23 +428,10 @@
<number>0</number> <number>0</number>
</property> </property>
<item row="1" column="0" colspan="2"> <item row="1" column="0" colspan="2">
<widget class="BlackGui::Components::CSelcalCodeSelector" name="frp_ComPanelSelcalBottom"> <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>
</item> </item>
<item row="0" column="0" colspan="2"> <item row="0" column="0" colspan="2" alignment="Qt::AlignLeft">
<widget class="QFrame" name="fr_ComPanelSelcalTop"> <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"> <layout class="QHBoxLayout" name="hl_ComPanelSelcalTop">
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
@@ -481,25 +461,19 @@
</property> </property>
</widget> </widget>
</item> </item>
<item alignment="Qt::AlignRight"> <item>
<widget class="QPushButton" name="pb_ComPanelSelcalTest"> <widget class="QToolButton" name="tb_ComPanelSelcalTest">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum"> <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="maximumSize">
<size>
<width>16</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip"> <property name="toolTip">
<string>test SELCAL</string> <string>test SELCAL</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string>test SELCAL</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../../blackmisc/blackmisc.qrc"> <iconset resource="../../blackmisc/blackmisc.qrc">
@@ -555,9 +529,9 @@
<tabstop>cbp_ComPanelTransponderMode</tabstop> <tabstop>cbp_ComPanelTransponderMode</tabstop>
<tabstop>ds_ComPanelCom1Standby</tabstop> <tabstop>ds_ComPanelCom1Standby</tabstop>
<tabstop>ds_ComPanelCom2Standby</tabstop> <tabstop>ds_ComPanelCom2Standby</tabstop>
<tabstop>pb_ComPanelCom1Toggle</tabstop> <tabstop>tb_ComPanelCom1Toggle</tabstop>
<tabstop>pb_ComPanelCom2Toggle</tabstop> <tabstop>tb_ComPanelCom2Toggle</tabstop>
<tabstop>pb_ComPanelSelcalTest</tabstop> <tabstop>tb_ComPanelSelcalTest</tabstop>
</tabstops> </tabstops>
<resources> <resources>
<include location="../../blackmisc/blackmisc.qrc"/> <include location="../../blackmisc/blackmisc.qrc"/>

View File

@@ -28,7 +28,7 @@ namespace BlackGui
ui(new Ui::CCockpitComponent) ui(new Ui::CCockpitComponent)
{ {
ui->setupUi(this); 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); connect(ui->wip_CockpitComPanelShowHideBar, &BlackGui::CShowHideBar::toggleShowHide, this, &CCockpitComponent::ps_onToggleShowHideDetails);
} }
@@ -48,12 +48,12 @@ namespace BlackGui
bool CCockpitComponent::isInfoAreaShown() const bool CCockpitComponent::isInfoAreaShown() const
{ {
return this->ui->wip_CockpitComPanelShowHideBar->isShown(); return ui->wip_CockpitComPanelShowHideBar->isShown();
} }
void CCockpitComponent::setSelectedTransponderModeStateIdent() void CCockpitComponent::setSelectedTransponderModeStateIdent()
{ {
this->ui->comp_CockpitComComponent->setSelectedTransponderModeStateIdent(); ui->comp_CockpitComComponent->setSelectedTransponderModeStateIdent();
} }
void CCockpitComponent::ps_onToggleShowHideDetails(bool show) void CCockpitComponent::ps_onToggleShowHideDetails(bool show)
@@ -76,12 +76,12 @@ namespace BlackGui
QSize manuallySetSize = this->window()->size(); QSize manuallySetSize = this->window()->size();
// hide area // hide area
this->ui->comp_CockpitInfoArea->setVisible(show); ui->comp_CockpitInfoArea->setVisible(show);
// adjust size // adjust size
if (show) if (show)
{ {
this->ui->comp_CockpitInfoArea->setMinimumHeight(m_minHeightInfoArea); ui->comp_CockpitInfoArea->setMinimumHeight(m_minHeightInfoArea);
if (this->m_sizeFloatingShown.isValid()) if (this->m_sizeFloatingShown.isValid())
{ {
this->window()->resize(m_sizeFloatingShown); this->window()->resize(m_sizeFloatingShown);
@@ -96,7 +96,7 @@ namespace BlackGui
} }
else else
{ {
this->ui->comp_CockpitInfoArea->setMinimumHeight(0); ui->comp_CockpitInfoArea->setMinimumHeight(0);
this->window()->setMinimumSize(defaultSizeHidden); this->window()->setMinimumSize(defaultSizeHidden);
if (this->m_sizeFloatingHidden.isValid()) if (this->m_sizeFloatingHidden.isValid())
{ {
@@ -114,7 +114,7 @@ namespace BlackGui
void CCockpitComponent::ps_onToggleFloating(bool floating) void CCockpitComponent::ps_onToggleFloating(bool floating)
{ {
this->ui->wip_CockpitComPanelShowHideBar->setVisible(floating); ui->wip_CockpitComPanelShowHideBar->setVisible(floating);
if (floating) if (floating)
{ {
// use the toggle method to set the sizes // use the toggle method to set the sizes
@@ -123,10 +123,9 @@ namespace BlackGui
else else
{ {
const QSize sizeMinimum(200, 100); // set when docked, must fit into parent info area 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); this->window()->setMinimumSize(sizeMinimum);
} }
} }
} // namespace } // namespace
} // namespace } // namespace

View File

@@ -26,15 +26,18 @@ namespace BlackGui
CSelcalCodeSelector::CSelcalCodeSelector(QWidget *parent) : CSelcalCodeSelector::CSelcalCodeSelector(QWidget *parent) :
QFrame(parent), ui(new Ui::CSelcalCodeSelector) QFrame(parent), ui(new Ui::CSelcalCodeSelector)
{ {
this->ui->setupUi(this); ui->setupUi(this);
this->resetSelcalCodes(true); this->resetSelcalCodes(true);
this->setValidityHint(); this->setValidityHint();
this->ui->lblp_ValidCodeIcon->setToolTips("valid SELCAL", "invalid SELCAL"); ui->lblp_ValidCodeIcon->setToolTips("valid SELCAL", "invalid SELCAL");
bool c; // limit number of elements: https://forum.qt.io/topic/11315/limit-the-number-of-visible-items-on-qcombobox/6
c = connect(this->ui->cb_SelcalPairs1, SIGNAL(currentIndexChanged(int)), this, SLOT(ps_selcalIndexChanged())); 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); 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_ASSERT(c);
Q_UNUSED(c); Q_UNUSED(c);
} }
@@ -44,8 +47,8 @@ namespace BlackGui
QString CSelcalCodeSelector::getSelcalCode() const QString CSelcalCodeSelector::getSelcalCode() const
{ {
QString selcal = this->ui->cb_SelcalPairs1->currentText(); QString selcal = ui->cb_SelcalPairs1->currentText();
selcal.append(this->ui->cb_SelcalPairs2->currentText()); selcal.append(ui->cb_SelcalPairs2->currentText());
return selcal; return selcal;
} }
@@ -57,12 +60,12 @@ namespace BlackGui
void CSelcalCodeSelector::resetSelcalCodes(bool allowEmptyValue) void CSelcalCodeSelector::resetSelcalCodes(bool allowEmptyValue)
{ {
this->ui->cb_SelcalPairs1->clear(); ui->cb_SelcalPairs1->clear();
if (allowEmptyValue) this->ui->cb_SelcalPairs1->addItem(" "); if (allowEmptyValue) ui->cb_SelcalPairs1->addItem(" ");
this->ui->cb_SelcalPairs1->addItems(BlackMisc::Aviation::CSelcal::codePairs()); ui->cb_SelcalPairs1->addItems(BlackMisc::Aviation::CSelcal::codePairs());
this->ui->cb_SelcalPairs2->clear(); ui->cb_SelcalPairs2->clear();
if (allowEmptyValue) this->ui->cb_SelcalPairs2->addItem(" "); if (allowEmptyValue) ui->cb_SelcalPairs2->addItem(" ");
this->ui->cb_SelcalPairs2->addItems(BlackMisc::Aviation::CSelcal::codePairs()); ui->cb_SelcalPairs2->addItems(BlackMisc::Aviation::CSelcal::codePairs());
} }
void CSelcalCodeSelector::setSelcalCode(const QString &selcal) void CSelcalCodeSelector::setSelcalCode(const QString &selcal)
@@ -75,11 +78,11 @@ namespace BlackGui
QString s2 = s.right(2); QString s2 = s.right(2);
if (BlackMisc::Aviation::CSelcal::codePairs().contains(s1)) 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)) 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() void CSelcalCodeSelector::clear()
{ {
if (this->ui->cb_SelcalPairs1->count() < 1) { this->resetSelcalCodes(true); } if (ui->cb_SelcalPairs1->count() < 1) { this->resetSelcalCodes(true); }
this->ui->cb_SelcalPairs1->setCurrentIndex(0); ui->cb_SelcalPairs1->setCurrentIndex(0);
this->ui->cb_SelcalPairs2->setCurrentIndex(0); ui->cb_SelcalPairs2->setCurrentIndex(0);
} }
void CSelcalCodeSelector::ps_selcalIndexChanged() void CSelcalCodeSelector::ps_selcalIndexChanged()
@@ -110,7 +113,7 @@ namespace BlackGui
void CSelcalCodeSelector::setValidityHint() void CSelcalCodeSelector::setValidityHint()
{ {
this->ui->lblp_ValidCodeIcon->setTicked(this->hasValidCode()); ui->lblp_ValidCodeIcon->setTicked(this->hasValidCode());
} }
} // ns } // ns
} // ns } // ns

View File

@@ -2,22 +2,8 @@
<ui version="4.0"> <ui version="4.0">
<class>CSelcalCodeSelector</class> <class>CSelcalCodeSelector</class>
<widget class="QFrame" name="CSelcalCodeSelector"> <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"> <property name="windowTitle">
<string>Frame</string> <string>SELCAL selector</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property> </property>
<layout class="QHBoxLayout" name="hl_SelcalCodeSelector"> <layout class="QHBoxLayout" name="hl_SelcalCodeSelector">
<property name="spacing"> <property name="spacing">
@@ -53,7 +39,7 @@
<string/> <string/>
</property> </property>
<property name="pixmap"> <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> </property>
</widget> </widget>
</item> </item>
@@ -67,7 +53,7 @@
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../blackmisc/blackmisc.qrc"/> <include location="../../blackmisc/blackmisc.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>