Ref T146, minor adjustments in keypad area

* removed keypadIdentifier()
* private slots -> private
This commit is contained in:
Klaus Basan
2017-09-02 18:57:01 +02:00
committed by Mathew Sutcliffe
parent 7ad666c346
commit b6ca59eda8
2 changed files with 42 additions and 52 deletions

View File

@@ -41,37 +41,37 @@ namespace BlackGui
// Info areas // Info areas
// pressed collides, as this toggles button again // pressed collides, as this toggles button again
// using toggle collides, as checking/unchecking toggles again -> infinite loop // using toggle collides, as checking/unchecking toggles again -> infinite loop
connect(ui->pb_MainAircrafts, &QPushButton::released, this, &CMainKeypadAreaComponent::ps_buttonSelected); connect(ui->pb_MainAircrafts, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected);
connect(ui->pb_MainAtc, &QPushButton::released, this, &CMainKeypadAreaComponent::ps_buttonSelected); connect(ui->pb_MainAtc, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected);
connect(ui->pb_MainCockpit, &QPushButton::released, this, &CMainKeypadAreaComponent::ps_buttonSelected); connect(ui->pb_MainCockpit, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected);
connect(ui->pb_MainFlightplan, &QPushButton::released, this, &CMainKeypadAreaComponent::ps_buttonSelected); connect(ui->pb_MainFlightplan, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected);
connect(ui->pb_MainLog, &QPushButton::released, this, &CMainKeypadAreaComponent::ps_buttonSelected); connect(ui->pb_MainLog, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected);
connect(ui->pb_MainMappings, &QPushButton::released, this, &CMainKeypadAreaComponent::ps_buttonSelected); connect(ui->pb_MainMappings, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected);
connect(ui->pb_MainSettings, &QPushButton::released, this, &CMainKeypadAreaComponent::ps_buttonSelected); connect(ui->pb_MainSettings, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected);
connect(ui->pb_MainSimulator, &QPushButton::released, this, &CMainKeypadAreaComponent::ps_buttonSelected); connect(ui->pb_MainSimulator, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected);
connect(ui->pb_MainTextMessages, &QPushButton::released, this, &CMainKeypadAreaComponent::ps_buttonSelected); connect(ui->pb_MainTextMessages, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected);
connect(ui->pb_MainUsers, &QPushButton::released, this, &CMainKeypadAreaComponent::ps_buttonSelected); connect(ui->pb_MainUsers, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected);
connect(ui->pb_MainWeather, &QPushButton::released, this, &CMainKeypadAreaComponent::ps_buttonSelected); connect(ui->pb_MainWeather, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected);
// non info areas // non info areas
connect(ui->pb_Connect, &QPushButton::pressed, this, &CMainKeypadAreaComponent::ps_buttonSelected); connect(ui->pb_Connect, &QPushButton::pressed, this, &CMainKeypadAreaComponent::buttonSelected);
connect(ui->pb_CockpitIdent, &QPushButton::released, this, &CMainKeypadAreaComponent::ps_buttonSelected); connect(ui->pb_CockpitIdent, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected);
connect(ui->pb_Opacity050, &QPushButton::pressed, this, &CMainKeypadAreaComponent::ps_buttonSelected); connect(ui->pb_Opacity050, &QPushButton::pressed, this, &CMainKeypadAreaComponent::buttonSelected);
connect(ui->pb_Opacity100, &QPushButton::pressed, this, &CMainKeypadAreaComponent::ps_buttonSelected); connect(ui->pb_Opacity100, &QPushButton::pressed, this, &CMainKeypadAreaComponent::buttonSelected);
connect(ui->pb_SoundMaxVolume, &QPushButton::pressed, this, &CMainKeypadAreaComponent::ps_buttonSelected); connect(ui->pb_SoundMaxVolume, &QPushButton::pressed, this, &CMainKeypadAreaComponent::buttonSelected);
connect(ui->pb_SoundMute, &QPushButton::released, this, &CMainKeypadAreaComponent::ps_buttonSelected); connect(ui->pb_SoundMute, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected);
connect(ui->pb_Audio, &QPushButton::released, this, &CMainKeypadAreaComponent::ps_buttonSelected); connect(ui->pb_Audio, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected);
// command line // command line
this->connect(ui->lep_CommandLineInput, &QLineEdit::returnPressed, this, &CMainKeypadAreaComponent::ps_commandEntered); this->connect(ui->lep_CommandLineInput, &QLineEdit::returnPressed, this, &CMainKeypadAreaComponent::onCommandEntered);
connect(sGui->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CMainKeypadAreaComponent::ps_connectionStatusChanged); connect(sGui->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CMainKeypadAreaComponent::connectionStatusChanged);
connect(sGui->getIContextOwnAircraft(), &IContextOwnAircraft::changedAircraftCockpit, this, &CMainKeypadAreaComponent::ps_ownAircraftCockpitChanged); connect(sGui->getIContextOwnAircraft(), &IContextOwnAircraft::changedAircraftCockpit, this, &CMainKeypadAreaComponent::ownAircraftCockpitChanged);
connect(sGui->getIContextAudio(), &IContextAudio::changedMute, this, &CMainKeypadAreaComponent::ps_muteChanged); connect(sGui->getIContextAudio(), &IContextAudio::changedMute, this, &CMainKeypadAreaComponent::muteChanged);
connect(this, &CMainKeypadAreaComponent::commandEntered, sGui->getCoreFacade(), &CCoreFacade::parseCommandLine); connect(this, &CMainKeypadAreaComponent::commandEntered, sGui->getCoreFacade(), &CCoreFacade::parseCommandLine);
this->ps_setCommandTooltip(); this->setCommandTooltip();
QTimer::singleShot(15000, this, &CMainKeypadAreaComponent::ps_setCommandTooltip); QTimer::singleShot(15000, this, &CMainKeypadAreaComponent::setCommandTooltip);
} }
CMainKeypadAreaComponent::~CMainKeypadAreaComponent() CMainKeypadAreaComponent::~CMainKeypadAreaComponent()
@@ -99,7 +99,7 @@ namespace BlackGui
Q_UNUSED(dockedIndexes); Q_UNUSED(dockedIndexes);
} }
void CMainKeypadAreaComponent::ps_buttonSelected() void CMainKeypadAreaComponent::buttonSelected()
{ {
QPushButton *senderButton = static_cast<QPushButton *>(QObject::sender()); QPushButton *senderButton = static_cast<QPushButton *>(QObject::sender());
Q_ASSERT(senderButton); Q_ASSERT(senderButton);
@@ -143,7 +143,7 @@ namespace BlackGui
} }
} }
void CMainKeypadAreaComponent::ps_connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to) void CMainKeypadAreaComponent::connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to)
{ {
Q_UNUSED(from); Q_UNUSED(from);
@@ -160,24 +160,24 @@ namespace BlackGui
} }
} }
void CMainKeypadAreaComponent::ps_commandEntered() void CMainKeypadAreaComponent::onCommandEntered()
{ {
QString c(ui->lep_CommandLineInput->getLastEnteredLineFormatted()); const QString c(ui->lep_CommandLineInput->getLastEnteredLineFormatted());
if (c.isEmpty()) { return; } if (c.isEmpty()) { return; }
if (c.toLower().trimmed().contains("help")) if (c.toLower().trimmed().contains("help"))
{ {
this->ps_setCommandTooltip(); this->setCommandTooltip();
return; return;
} }
emit this->commandEntered(c, keypadIdentifier()); emit this->commandEntered(c, m_identifier);
} }
void CMainKeypadAreaComponent::ps_setCommandTooltip() void CMainKeypadAreaComponent::setCommandTooltip()
{ {
ui->lep_CommandLineInput->setToolTip(sGui->getIContextApplication()->dotCommandsHtmlHelp()); ui->lep_CommandLineInput->setToolTip(sGui->getIContextApplication()->dotCommandsHtmlHelp());
} }
void CMainKeypadAreaComponent::ps_ownAircraftCockpitChanged(const CSimulatedAircraft &aircraft, const CIdentifier &originator) void CMainKeypadAreaComponent::ownAircraftCockpitChanged(const CSimulatedAircraft &aircraft, const CIdentifier &originator)
{ {
Q_UNUSED(originator); Q_UNUSED(originator);
bool ident = aircraft.getTransponder().getTransponderMode() == CTransponder::StateIdent; bool ident = aircraft.getTransponder().getTransponderMode() == CTransponder::StateIdent;
@@ -189,7 +189,7 @@ namespace BlackGui
} }
} }
void CMainKeypadAreaComponent::ps_muteChanged(bool muted) void CMainKeypadAreaComponent::muteChanged(bool muted)
{ {
//check state to avoid undelibarate signals //check state to avoid undelibarate signals
if (muted != ui->pb_SoundMute->isChecked()) if (muted != ui->pb_SoundMute->isChecked())
@@ -249,14 +249,8 @@ namespace BlackGui
ui->pb_MainWeather->setChecked(false); ui->pb_MainWeather->setChecked(false);
} }
CIdentifier CMainKeypadAreaComponent::keypadIdentifier() void CMainKeypadAreaComponent::disableButtonBriefly()
{ {
if (m_identifier.getName().isEmpty())
{
m_identifier = CIdentifier(QStringLiteral("KEYPADAREACOMPONENT"));
}
return m_identifier;
} }
} // namespace } // namespace
} // namespace } // namespace

View File

@@ -46,9 +46,6 @@ namespace BlackGui
//! Destructor //! Destructor
virtual ~CMainKeypadAreaComponent(); virtual ~CMainKeypadAreaComponent();
//! Identifier
BlackMisc::CIdentifier keypadIdentifier();
signals: signals:
//! Button to select main info area has been pressed //! Button to select main info area has been pressed
//! \sa CMainInfoAreaComponent //! \sa CMainInfoAreaComponent
@@ -73,26 +70,25 @@ namespace BlackGui
//! Main info area changed //! Main info area changed
void onMainInfoAreaChanged(int currentTabIndex, QList<int> dockedIndexes, QList<int> floatingIndexes); void onMainInfoAreaChanged(int currentTabIndex, QList<int> dockedIndexes, QList<int> floatingIndexes);
private slots: private:
//! Button was clicked //! Button was clicked
void ps_buttonSelected(); void buttonSelected();
//! Command line entered //! Command line entered
void ps_commandEntered(); void onCommandEntered();
//! Display help as HTML //! Display help as HTML
void ps_setCommandTooltip(); void setCommandTooltip();
//! \copydoc BlackCore::Context::IContextNetwork::connectionStatusChanged //! \copydoc BlackCore::Context::IContextNetwork::connectionStatusChanged
void ps_connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to); void connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to);
//! \copydoc BlackCore::Context::IContextOwnAircraft::changedAircraftCockpit //! \copydoc BlackCore::Context::IContextOwnAircraft::changedAircraftCockpit
void ps_ownAircraftCockpitChanged(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CIdentifier &originator); void ownAircraftCockpitChanged(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CIdentifier &originator);
//! \copydoc BlackCore::Context::IContextAudio::changedMute //! \copydoc BlackCore::Context::IContextAudio::changedMute
void ps_muteChanged(bool muted); void muteChanged(bool muted);
private:
//! If button is info area, identify it //! If button is info area, identify it
CMainInfoAreaComponent::InfoArea buttonToMainInfoArea(const QObject *button) const; CMainInfoAreaComponent::InfoArea buttonToMainInfoArea(const QObject *button) const;
@@ -103,7 +99,7 @@ namespace BlackGui
void unsetInfoAreaButtons(); void unsetInfoAreaButtons();
QScopedPointer<Ui::CMainKeypadAreaComponent> ui; QScopedPointer<Ui::CMainKeypadAreaComponent> ui;
BlackMisc::CIdentifier m_identifier; BlackMisc::CIdentifier m_identifier { QStringLiteral("KEYPADAREACOMPONENT") };
}; };
} // namespace } // namespace
} // namespace } // namespace