mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +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.
|
||||
*/
|
||||
|
||||
#include "blackcore/context/contextapplication.h"
|
||||
#include "blackcore/context/contextaudio.h"
|
||||
#include "blackcore/context/contextnetwork.h"
|
||||
#include "blackcore/context/contextownaircraft.h"
|
||||
@@ -67,6 +68,9 @@ namespace BlackGui
|
||||
connect(sGui->getIContextOwnAircraft(), &IContextOwnAircraft::changedAircraftCockpit, this, &CMainKeypadAreaComponent::ps_ownAircraftCockpitChanged);
|
||||
connect(sGui->getIContextAudio(), &IContextAudio::changedMute, this, &CMainKeypadAreaComponent::ps_muteChanged);
|
||||
connect(this, &CMainKeypadAreaComponent::commandEntered, sGui->getCoreFacade(), &CCoreFacade::parseCommandLine);
|
||||
|
||||
this->ps_setCommandTooltip();
|
||||
QTimer::singleShot(15000, this, &CMainKeypadAreaComponent::ps_setCommandTooltip);
|
||||
}
|
||||
|
||||
CMainKeypadAreaComponent::~CMainKeypadAreaComponent()
|
||||
@@ -88,7 +92,7 @@ namespace BlackGui
|
||||
foreach (int floatingIndex, floatingIndexes)
|
||||
{
|
||||
QPushButton *pb = this->mainInfoAreaToButton(static_cast<CMainInfoAreaComponent::InfoArea>(floatingIndex));
|
||||
if (pb) {pb->setChecked(true); }
|
||||
if (pb) { pb->setChecked(true); }
|
||||
}
|
||||
|
||||
Q_UNUSED(dockedIndexes);
|
||||
@@ -99,7 +103,7 @@ namespace BlackGui
|
||||
QPushButton *senderButton = static_cast<QPushButton *>(QObject::sender());
|
||||
Q_ASSERT(senderButton);
|
||||
if (!senderButton) { return; }
|
||||
CMainInfoAreaComponent::InfoArea ia = buttonToMainInfoArea(senderButton);
|
||||
const CMainInfoAreaComponent::InfoArea ia = buttonToMainInfoArea(senderButton);
|
||||
if (ia != CMainInfoAreaComponent::InfoAreaNone)
|
||||
{
|
||||
Q_ASSERT(senderButton->isCheckable());
|
||||
@@ -155,9 +159,19 @@ namespace BlackGui
|
||||
{
|
||||
QString c(ui->lep_CommandLineInput->getLastEnteredLineFormatted());
|
||||
if (c.isEmpty()) { return; }
|
||||
if (c.toLower().trimmed().contains("help"))
|
||||
{
|
||||
this->ps_setCommandTooltip();
|
||||
return;
|
||||
}
|
||||
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)
|
||||
{
|
||||
Q_UNUSED(originator);
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace BlackGui
|
||||
explicit CMainKeypadAreaComponent(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CMainKeypadAreaComponent();
|
||||
virtual ~CMainKeypadAreaComponent();
|
||||
|
||||
//! Identifier
|
||||
BlackMisc::CIdentifier keypadIdentifier();
|
||||
@@ -75,12 +75,15 @@ namespace BlackGui
|
||||
//! Button was clicked
|
||||
void ps_buttonSelected();
|
||||
|
||||
//! \copydoc BlackCore::Context::IContextNetwork::connectionStatusChanged
|
||||
void ps_connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to);
|
||||
|
||||
//! Command line entered
|
||||
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
|
||||
void ps_ownAircraftCockpitChanged(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CIdentifier &originator);
|
||||
|
||||
@@ -100,7 +103,6 @@ namespace BlackGui
|
||||
QScopedPointer<Ui::CMainKeypadAreaComponent> ui;
|
||||
BlackMisc::CIdentifier m_identifier;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
|
||||
Reference in New Issue
Block a user