mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-02 07:05:38 +08:00
Ref T573, allow different color in XPDR mode component from stylesheet
* changed signal to trigger reload of stylesheet (only way to update dynamic properties) * made infobar left aligned (and not spacer aligned), better scaling * adjusted qss
This commit is contained in:
committed by
Mat Sutcliffe
parent
22d67d31a4
commit
e463689490
@@ -7,6 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "blackgui/components/infobarstatuscomponent.h"
|
#include "blackgui/components/infobarstatuscomponent.h"
|
||||||
|
#include "blackgui/components/transpondermodecomponent.h"
|
||||||
#include "blackgui/guiapplication.h"
|
#include "blackgui/guiapplication.h"
|
||||||
#include "blackgui/led.h"
|
#include "blackgui/led.h"
|
||||||
#include "blackgui/guiutility.h"
|
#include "blackgui/guiutility.h"
|
||||||
@@ -49,7 +50,8 @@ namespace BlackGui
|
|||||||
this->adjustTextSize();
|
this->adjustTextSize();
|
||||||
|
|
||||||
ui->lbl_Audio->setContextMenuPolicy(Qt::CustomContextMenu);
|
ui->lbl_Audio->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(ui->lbl_Audio, &QLabel::customContextMenuRequested, this, &CInfoBarStatusComponent::onCustomAudioContextMenuRequested);
|
connect(ui->lbl_Audio, &QLabel::customContextMenuRequested, this, &CInfoBarStatusComponent::onCustomAudioContextMenuRequested);
|
||||||
|
connect(ui->comp_XpdrMode, &CTransponderModeComponent::changed, this, &CInfoBarStatusComponent::transponderModeChanged);
|
||||||
|
|
||||||
Q_ASSERT_X(sGui, Q_FUNC_INFO, "Need sGui");
|
Q_ASSERT_X(sGui, Q_FUNC_INFO, "Need sGui");
|
||||||
if (sGui->getIContextSimulator())
|
if (sGui->getIContextSimulator())
|
||||||
|
|||||||
@@ -48,14 +48,18 @@ namespace BlackGui
|
|||||||
//! Set the spacing
|
//! Set the spacing
|
||||||
void setSpacing(int spacing);
|
void setSpacing(int spacing);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
//! Mode changed
|
||||||
|
void transponderModeChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! \copydoc QWidget::resizeEvent
|
//! \copydoc QWidget::resizeEvent
|
||||||
virtual void resizeEvent(QResizeEvent *event) override;
|
virtual void resizeEvent(QResizeEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::CInfoBarStatusComponent> ui;
|
QScopedPointer<Ui::CInfoBarStatusComponent> ui;
|
||||||
BlackCore::CActionBind m_actionPtt { "/Voice/Activate push-to-talk", BlackMisc::CIcons::radio16(), this, &CInfoBarStatusComponent::onPttChanged };
|
BlackCore::CActionBind m_actionPtt { "/Voice/Activate push-to-talk", BlackMisc::CIcons::radio16(), this, &CInfoBarStatusComponent::onPttChanged };
|
||||||
BlackMisc::CDigestSignal m_dsResize { this, &CInfoBarStatusComponent::adjustTextSize, 1000, 25 };
|
BlackMisc::CDigestSignal m_dsResize { this, &CInfoBarStatusComponent::adjustTextSize, 1000, 50 };
|
||||||
|
|
||||||
//! Init the LEDs
|
//! Init the LEDs
|
||||||
void initLeds();
|
void initLeds();
|
||||||
|
|||||||
@@ -2,6 +2,14 @@
|
|||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>CInfoBarStatusComponent</class>
|
<class>CInfoBarStatusComponent</class>
|
||||||
<widget class="QFrame" name="CInfoBarStatusComponent">
|
<widget class="QFrame" name="CInfoBarStatusComponent">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>201</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
@@ -153,19 +161,6 @@
|
|||||||
<item alignment="Qt::AlignLeft">
|
<item alignment="Qt::AlignLeft">
|
||||||
<widget class="BlackGui::CLedWidget" name="led_Audio" native="true"/>
|
<widget class="BlackGui::CLedWidget" name="led_Audio" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<spacer name="hs_StatusComponent">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ namespace BlackGui
|
|||||||
|
|
||||||
this->setProperty("xpdrmode", m_transponder.getTransponderMode());
|
this->setProperty("xpdrmode", m_transponder.getTransponderMode());
|
||||||
this->setProperty("xpdrmodeshort", m_transponder.getModeAsShortString());
|
this->setProperty("xpdrmodeshort", m_transponder.getModeAsShortString());
|
||||||
|
ui->tb_TransponderMode->setProperty("xpdrmode", m_transponder.getTransponderMode());
|
||||||
|
ui->tb_TransponderMode->setProperty("xpdrmodeshort", m_transponder.getModeAsShortString());
|
||||||
|
|
||||||
this->setToolTip(m_transponder.toQString());
|
this->setToolTip(m_transponder.toQString());
|
||||||
}
|
}
|
||||||
@@ -75,6 +77,7 @@ namespace BlackGui
|
|||||||
if (m_transponder == aircraft.getTransponder()) { return; }
|
if (m_transponder == aircraft.getTransponder()) { return; }
|
||||||
m_transponder = aircraft.getTransponder();
|
m_transponder = aircraft.getTransponder();
|
||||||
this->init();
|
this->init();
|
||||||
|
emit this->changed();
|
||||||
}
|
}
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -36,6 +36,10 @@ namespace BlackGui
|
|||||||
//! Dtor
|
//! Dtor
|
||||||
virtual ~CTransponderModeComponent() override;
|
virtual ~CTransponderModeComponent() override;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
//! value has been changed
|
||||||
|
void changed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::CTransponderModeComponent> ui;
|
QScopedPointer<Ui::CTransponderModeComponent> ui;
|
||||||
BlackMisc::Aviation::CTransponder m_transponder;
|
BlackMisc::Aviation::CTransponder m_transponder;
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ namespace BlackGui
|
|||||||
//! Constructor
|
//! Constructor
|
||||||
explicit CDockWidgetInfoBar(QWidget *parent = nullptr);
|
explicit CDockWidgetInfoBar(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
//! Force an reload
|
||||||
|
void reloadStyleSheet() { this->onStyleSheetsChanged(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! Contribute to menu
|
//! Contribute to menu
|
||||||
virtual void addToContextMenu(QMenu *contextMenu) const override;
|
virtual void addToContextMenu(QMenu *contextMenu) const override;
|
||||||
|
|||||||
@@ -18,6 +18,21 @@ BlackGui--Components--CTransponderModeComponent {
|
|||||||
min-height: 2em;
|
min-height: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QToolButton[xpdrmodeshort="I"] {
|
||||||
|
background-color: yellow;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
QToolButton[xpdrmodeshort="C"] {
|
||||||
|
background-color: green;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
QToolButton[xpdrmodeshort="S"] {
|
||||||
|
background-color: blue;
|
||||||
|
color: yellow;
|
||||||
|
}
|
||||||
|
|
||||||
BlackGui--Components--CInfoBarStatusComponent {
|
BlackGui--Components--CInfoBarStatusComponent {
|
||||||
padding-left: 1.0em;
|
padding-left: 1.0em;
|
||||||
padding-right: 1.0em;
|
padding-right: 1.0em;
|
||||||
|
|||||||
@@ -328,7 +328,7 @@
|
|||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item alignment="Qt::AlignTop">
|
<item alignment="Qt::AlignLeft|Qt::AlignTop">
|
||||||
<widget class="BlackGui::Components::CInfoBarStatusComponent" name="comp_InfoBarStatus" native="true">
|
<widget class="BlackGui::Components::CInfoBarStatusComponent" name="comp_InfoBarStatus" native="true">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ void SwiftGuiStd::init()
|
|||||||
// info
|
// info
|
||||||
ui->comp_MainInfoArea->getLogComponent()->appendPlainTextToConsole(sGui->swiftVersionString());
|
ui->comp_MainInfoArea->getLogComponent()->appendPlainTextToConsole(sGui->swiftVersionString());
|
||||||
ui->comp_MainInfoArea->getLogComponent()->appendPlainTextToConsole(CBuildConfig::compiledWithInfo());
|
ui->comp_MainInfoArea->getLogComponent()->appendPlainTextToConsole(CBuildConfig::compiledWithInfo());
|
||||||
|
connect(ui->comp_InfoBarStatus, &CInfoBarStatusComponent::transponderModeChanged, ui->dw_InfoBarStatus, &CDockWidgetInfoBar::reloadStyleSheet, Qt::QueuedConnection);
|
||||||
|
|
||||||
// Show kill button
|
// Show kill button
|
||||||
ui->fr_CentralFrameInside->showKillButton(true);
|
ui->fr_CentralFrameInside->showKillButton(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user