Ref T536, text message component

* register tab enum
* select tab by frequency
This commit is contained in:
Klaus Basan
2019-02-11 04:03:55 +01:00
committed by Mat Sutcliffe
parent 22ae03bd3b
commit 045f79d0bd
4 changed files with 22 additions and 2 deletions

View File

@@ -8,6 +8,9 @@
*/ */
#include "registermetadatacomponents.h" #include "registermetadatacomponents.h"
#include "textmessagecomponenttab.h"
#include <QMetaType>
namespace BlackGui namespace BlackGui
{ {
@@ -15,7 +18,7 @@ namespace BlackGui
{ {
void registerMetadata() void registerMetadata()
{ {
qRegisterMetaType<TextMessageTab>();
} }
} // ns } // ns
} // ns } // ns

View File

@@ -361,7 +361,6 @@ namespace BlackGui
void CTextMessageComponent::showCurrentFrequenciesFromCockpit() void CTextMessageComponent::showCurrentFrequenciesFromCockpit()
{ {
const CSimulatedAircraft ownAircraft = this->getOwnAircraft(); const CSimulatedAircraft ownAircraft = this->getOwnAircraft();
const CFrequency freq1 = ownAircraft.getCom1System().getFrequencyActive(); const CFrequency freq1 = ownAircraft.getCom1System().getFrequencyActive();
const CFrequency freq2 = ownAircraft.getCom2System().getFrequencyActive(); const CFrequency freq2 = ownAircraft.getCom2System().getFrequencyActive();
@@ -687,6 +686,16 @@ namespace BlackGui
if (!m_usedAsOverlayWidget) { this->displayMyself(); } if (!m_usedAsOverlayWidget) { this->displayMyself(); }
} }
void CTextMessageComponent::showCorrespondingTabForFrequency(const CFrequency &frequency)
{
const CSimulatedAircraft ownAircraft = this->getOwnAircraft();
const CFrequency freq1 = ownAircraft.getCom1System().getFrequencyActive();
const CFrequency freq2 = ownAircraft.getCom2System().getFrequencyActive();
if (freq1 == frequency) { this->setTab(TextMessagesCom1); return; }
if (freq2 == frequency) { this->setTab(TextMessagesCom2); return; }
this->setTab(TextMessagesAll);
}
void CTextMessageComponent::fontSizeMinus() void CTextMessageComponent::fontSizeMinus()
{ {
ui->comp_SettingsStyle->fontSizeMinus(); ui->comp_SettingsStyle->fontSizeMinus();

View File

@@ -59,6 +59,9 @@ namespace BlackGui
//! Display the tab for given callsign //! Display the tab for given callsign
void showCorrespondingTab(const BlackMisc::Aviation::CCallsign &callsign); void showCorrespondingTab(const BlackMisc::Aviation::CCallsign &callsign);
//! Display the tab for given frequency
void showCorrespondingTabForFrequency(const BlackMisc::PhysicalQuantities::CFrequency &frequency);
//! Font size @{ //! Font size @{
void fontSizeMinus(); void fontSizeMinus();
void fontSizePlus(); void fontSizePlus();

View File

@@ -12,6 +12,8 @@
#ifndef BLACKGUI_COMPONENTS_TEXTMESSAGECOMPONENT_TAB_H #ifndef BLACKGUI_COMPONENTS_TEXTMESSAGECOMPONENT_TAB_H
#define BLACKGUI_COMPONENTS_TEXTMESSAGECOMPONENT_TAB_H #define BLACKGUI_COMPONENTS_TEXTMESSAGECOMPONENT_TAB_H
#include <QMetaType>
namespace BlackGui namespace BlackGui
{ {
namespace Components namespace Components
@@ -26,4 +28,7 @@ namespace BlackGui
}; };
} // ns } // ns
} // ns } // ns
Q_DECLARE_METATYPE(BlackGui::Components::TextMessageTab)
#endif // guard #endif // guard