Ref T438, allow to collapse "Message to" button area and disable icons

This commit is contained in:
Klaus Basan
2018-11-23 19:57:33 +01:00
parent 62860eb30b
commit 3edbd09732
5 changed files with 53 additions and 6 deletions

View File

@@ -75,7 +75,7 @@ namespace BlackGui
QPushButton *button = new QPushButton(this);
button->setText(station.getCallsignAsString());
button->setIcon(station.toPixmap());
if (m_withIcons) { button->setIcon(station.toPixmap()); }
QObject::connect(button, &QPushButton::released, this, &CAtcButtonComponent::onButtonClicked);
const CVariant atcv = CVariant::fromValue(station);
layout->addWidget(button, row, col++);

View File

@@ -39,6 +39,9 @@ namespace BlackGui
//! Max.number
void setMaxNumber(int number) { m_maxNumber = number; }
//! With icons
void setWithIcons(bool withIcons) { m_withIcons = withIcons; }
//! Max.number
int getMaxNumber() const { return m_maxNumber; }
@@ -66,6 +69,7 @@ namespace BlackGui
void onButtonClicked();
QScopedPointer<Ui::CAtcButtonComponent> ui;
bool m_withIcons = true;
bool m_ignoreNonAtc = true;
bool m_backgroundUpdates = true;
int m_maxNumber = 8;

View File

@@ -67,12 +67,16 @@ namespace BlackGui
ui->tw_TextMessages->setCurrentIndex(0);
ui->lep_textMessages->setVisible(false);
ui->tvp_TextMessagesAll->setResizeMode(CTextMessageView::ResizingAuto);
ui->comp_AtcStations->setWithIcons(false);
// lep_textMessages is the own line edit
bool c = connect(ui->lep_textMessages, &CLineEditHistory::returnPressed, this, &CTextMessageComponent::textMessageEntered);
Q_ASSERT_X(c, Q_FUNC_INFO, "Missing connect");
c = connect(ui->gb_Settings, &QGroupBox::toggled, this, &CTextMessageComponent::onSettingsChecked);
Q_ASSERT_X(c, Q_FUNC_INFO, "Missing connect");
c = connect(ui->gb_MessageTo, &QGroupBox::toggled, this, &CTextMessageComponent::onMessageToChecked);
Q_ASSERT_X(c, Q_FUNC_INFO, "Missing connect");
c = connect(ui->comp_AtcStations, &CAtcButtonComponent::requestAtcStation, this, &CTextMessageComponent::onAtcButtonClicked);
Q_ASSERT_X(c, Q_FUNC_INFO, "Missing connect");
@@ -237,6 +241,12 @@ namespace BlackGui
ui->gb_Settings->setFlat(!checked);
}
void CTextMessageComponent::onMessageToChecked(bool checked)
{
ui->comp_AtcStations->setVisible(checked);
ui->gb_MessageTo->setFlat(!checked);
}
void CTextMessageComponent::onSettingsChanged()
{
QList<CTextMessageTextEdit *> textEdits = this->findAllTextEdit();

View File

@@ -166,6 +166,9 @@ namespace BlackGui
//! Settings have been checked (group box visible/invisible)
void onSettingsChecked(bool checked);
//! Message group box has been checked (group box visible/invisible)
void onMessageToChecked(bool checked);
//! Settings have been changed
void onSettingsChanged();

View File

@@ -222,13 +222,43 @@
</widget>
</item>
<item>
<widget class="BlackGui::Components::CAtcButtonComponent" name="comp_AtcStations">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
<widget class="QGroupBox" name="gb_MessageTo">
<property name="title">
<string>Message to</string>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QHBoxLayout" name="hl_MessageTo">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<widget class="BlackGui::Components::CAtcButtonComponent" name="comp_AtcStations">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>