refs #335, indicator for valid SELCAL code

This commit is contained in:
Klaus Basan
2014-11-07 19:24:47 +01:00
committed by Roland Winklmeier
parent ae79af5300
commit f4e8b40bf9
3 changed files with 53 additions and 4 deletions

View File

@@ -10,7 +10,9 @@
#include "selcalcodeselector.h"
#include "ui_selcalcodeselector.h"
#include "blackmisc/avselcal.h"
#include "blackmisc/icons.h"
using namespace BlackMisc;
using namespace BlackMisc::Aviation;
namespace BlackGui
@@ -20,12 +22,14 @@ namespace BlackGui
{
this->ui->setupUi(this);
this->resetSelcalCodes(true);
this->setValidityHint();
bool c;
c = connect(this->ui->cb_SelcalPairs1, SIGNAL(currentIndexChanged(int)), this, SIGNAL(valueChanged()));
c = connect(this->ui->cb_SelcalPairs1, SIGNAL(currentIndexChanged(int)), this, SLOT(ps_selcalIndexChanged()));
Q_ASSERT(c);
c = connect(this->ui->cb_SelcalPairs2, SIGNAL(currentIndexChanged(int)), this, SIGNAL(valueChanged()));
c = connect(this->ui->cb_SelcalPairs2, SIGNAL(currentIndexChanged(int)), this, SLOT(ps_selcalIndexChanged()));
Q_ASSERT(c);
Q_UNUSED(c);
}
CSelcalCodeSelector::~CSelcalCodeSelector()
@@ -90,4 +94,24 @@ namespace BlackGui
this->ui->cb_SelcalPairs1->setCurrentIndex(0);
this->ui->cb_SelcalPairs2->setCurrentIndex(0);
}
}
void CSelcalCodeSelector::ps_selcalIndexChanged()
{
this->setValidityHint();
emit valueChanged();
}
void CSelcalCodeSelector::setValidityHint()
{
if (this->hasValidCode())
{
this->ui->lbl_ValidCodeIcon->setPixmap(CIcons::tick16());
this->ui->lbl_ValidCodeIcon->setToolTip("valid SELCAL");
}
else
{
this->ui->lbl_ValidCodeIcon->setPixmap(CIcons::cross16());
this->ui->lbl_ValidCodeIcon->setToolTip("invalid SELCAL");
}
}
} // namespace

View File

@@ -57,8 +57,15 @@ namespace BlackGui
//! Value has been changed
void valueChanged();
private slots:
//! SELCAL changed
void ps_selcalIndexChanged();
private:
QScopedPointer<Ui::CSelcalCodeSelector> ui;
//! Set valid/invalid icon
void setValidityHint();
};
}

View File

@@ -41,8 +41,26 @@
<item>
<widget class="QComboBox" name="cb_SelcalPairs2"/>
</item>
<item>
<widget class="QLabel" name="lbl_ValidCodeIcon">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../blackmisc/blackmisc.qrc">:/diagona/icons/diagona/icons/tick-button.png</pixmap>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<resources>
<include location="../blackmisc/blackmisc.qrc"/>
</resources>
<connections/>
</ui>