mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-06 02:16:04 +08:00
refs #894, display dot commands HTML help as tooltip (in command line)
This commit is contained in:
committed by
Mathew Sutcliffe
parent
38ea336cbb
commit
a737b27ce8
@@ -7,6 +7,7 @@
|
|||||||
* contained in the LICENSE file.
|
* contained in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "blackcore/context/contextapplication.h"
|
||||||
#include "blackcore/context/contextaudio.h"
|
#include "blackcore/context/contextaudio.h"
|
||||||
#include "blackcore/context/contextnetwork.h"
|
#include "blackcore/context/contextnetwork.h"
|
||||||
#include "blackcore/context/contextownaircraft.h"
|
#include "blackcore/context/contextownaircraft.h"
|
||||||
@@ -67,6 +68,9 @@ namespace BlackGui
|
|||||||
connect(sGui->getIContextOwnAircraft(), &IContextOwnAircraft::changedAircraftCockpit, this, &CMainKeypadAreaComponent::ps_ownAircraftCockpitChanged);
|
connect(sGui->getIContextOwnAircraft(), &IContextOwnAircraft::changedAircraftCockpit, this, &CMainKeypadAreaComponent::ps_ownAircraftCockpitChanged);
|
||||||
connect(sGui->getIContextAudio(), &IContextAudio::changedMute, this, &CMainKeypadAreaComponent::ps_muteChanged);
|
connect(sGui->getIContextAudio(), &IContextAudio::changedMute, this, &CMainKeypadAreaComponent::ps_muteChanged);
|
||||||
connect(this, &CMainKeypadAreaComponent::commandEntered, sGui->getCoreFacade(), &CCoreFacade::parseCommandLine);
|
connect(this, &CMainKeypadAreaComponent::commandEntered, sGui->getCoreFacade(), &CCoreFacade::parseCommandLine);
|
||||||
|
|
||||||
|
this->ps_setCommandTooltip();
|
||||||
|
QTimer::singleShot(15000, this, &CMainKeypadAreaComponent::ps_setCommandTooltip);
|
||||||
}
|
}
|
||||||
|
|
||||||
CMainKeypadAreaComponent::~CMainKeypadAreaComponent()
|
CMainKeypadAreaComponent::~CMainKeypadAreaComponent()
|
||||||
@@ -88,7 +92,7 @@ namespace BlackGui
|
|||||||
foreach (int floatingIndex, floatingIndexes)
|
foreach (int floatingIndex, floatingIndexes)
|
||||||
{
|
{
|
||||||
QPushButton *pb = this->mainInfoAreaToButton(static_cast<CMainInfoAreaComponent::InfoArea>(floatingIndex));
|
QPushButton *pb = this->mainInfoAreaToButton(static_cast<CMainInfoAreaComponent::InfoArea>(floatingIndex));
|
||||||
if (pb) {pb->setChecked(true); }
|
if (pb) { pb->setChecked(true); }
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_UNUSED(dockedIndexes);
|
Q_UNUSED(dockedIndexes);
|
||||||
@@ -99,7 +103,7 @@ namespace BlackGui
|
|||||||
QPushButton *senderButton = static_cast<QPushButton *>(QObject::sender());
|
QPushButton *senderButton = static_cast<QPushButton *>(QObject::sender());
|
||||||
Q_ASSERT(senderButton);
|
Q_ASSERT(senderButton);
|
||||||
if (!senderButton) { return; }
|
if (!senderButton) { return; }
|
||||||
CMainInfoAreaComponent::InfoArea ia = buttonToMainInfoArea(senderButton);
|
const CMainInfoAreaComponent::InfoArea ia = buttonToMainInfoArea(senderButton);
|
||||||
if (ia != CMainInfoAreaComponent::InfoAreaNone)
|
if (ia != CMainInfoAreaComponent::InfoAreaNone)
|
||||||
{
|
{
|
||||||
Q_ASSERT(senderButton->isCheckable());
|
Q_ASSERT(senderButton->isCheckable());
|
||||||
@@ -155,9 +159,19 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
QString c(ui->lep_CommandLineInput->getLastEnteredLineFormatted());
|
QString c(ui->lep_CommandLineInput->getLastEnteredLineFormatted());
|
||||||
if (c.isEmpty()) { return; }
|
if (c.isEmpty()) { return; }
|
||||||
|
if (c.toLower().trimmed().contains("help"))
|
||||||
|
{
|
||||||
|
this->ps_setCommandTooltip();
|
||||||
|
return;
|
||||||
|
}
|
||||||
emit this->commandEntered(c, keypadIdentifier());
|
emit this->commandEntered(c, keypadIdentifier());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMainKeypadAreaComponent::ps_setCommandTooltip()
|
||||||
|
{
|
||||||
|
ui->lep_CommandLineInput->setToolTip(sGui->getIContextApplication()->dotCommandsHtmlHelp());
|
||||||
|
}
|
||||||
|
|
||||||
void CMainKeypadAreaComponent::ps_ownAircraftCockpitChanged(const CSimulatedAircraft &aircraft, const CIdentifier &originator)
|
void CMainKeypadAreaComponent::ps_ownAircraftCockpitChanged(const CSimulatedAircraft &aircraft, const CIdentifier &originator)
|
||||||
{
|
{
|
||||||
Q_UNUSED(originator);
|
Q_UNUSED(originator);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace BlackGui
|
|||||||
explicit CMainKeypadAreaComponent(QWidget *parent = nullptr);
|
explicit CMainKeypadAreaComponent(QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
~CMainKeypadAreaComponent();
|
virtual ~CMainKeypadAreaComponent();
|
||||||
|
|
||||||
//! Identifier
|
//! Identifier
|
||||||
BlackMisc::CIdentifier keypadIdentifier();
|
BlackMisc::CIdentifier keypadIdentifier();
|
||||||
@@ -75,12 +75,15 @@ namespace BlackGui
|
|||||||
//! Button was clicked
|
//! Button was clicked
|
||||||
void ps_buttonSelected();
|
void ps_buttonSelected();
|
||||||
|
|
||||||
//! \copydoc BlackCore::Context::IContextNetwork::connectionStatusChanged
|
|
||||||
void ps_connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to);
|
|
||||||
|
|
||||||
//! Command line entered
|
//! Command line entered
|
||||||
void ps_commandEntered();
|
void ps_commandEntered();
|
||||||
|
|
||||||
|
//! Display help as HTML
|
||||||
|
void ps_setCommandTooltip();
|
||||||
|
|
||||||
|
//! \copydoc BlackCore::Context::IContextNetwork::connectionStatusChanged
|
||||||
|
void ps_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 ps_ownAircraftCockpitChanged(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CIdentifier &originator);
|
||||||
|
|
||||||
@@ -100,7 +103,6 @@ namespace BlackGui
|
|||||||
QScopedPointer<Ui::CMainKeypadAreaComponent> ui;
|
QScopedPointer<Ui::CMainKeypadAreaComponent> ui;
|
||||||
BlackMisc::CIdentifier m_identifier;
|
BlackMisc::CIdentifier m_identifier;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user