mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 13:36:48 +08:00
Ref T166, use command input in main keypad area
This commit is contained in:
@@ -64,15 +64,13 @@ namespace BlackGui
|
||||
connect(ui->pb_Audio, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected);
|
||||
|
||||
// command line
|
||||
this->connect(ui->lep_CommandLineInput, &QLineEdit::returnPressed, this, &CMainKeypadAreaComponent::onCommandEntered);
|
||||
ui->lep_CommandLineInput->setIdentifier(m_identifier);
|
||||
this->connect(ui->lep_CommandLineInput, &CCommandInput::commandEntered, this, &CMainKeypadAreaComponent::commandEntered);
|
||||
|
||||
connect(sGui->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CMainKeypadAreaComponent::connectionStatusChanged);
|
||||
connect(sGui->getIContextOwnAircraft(), &IContextOwnAircraft::changedAircraftCockpit, this, &CMainKeypadAreaComponent::ownAircraftCockpitChanged);
|
||||
connect(sGui->getIContextAudio(), &IContextAudio::changedMute, this, &CMainKeypadAreaComponent::muteChanged);
|
||||
connect(this, &CMainKeypadAreaComponent::commandEntered, sGui->getCoreFacade(), &CCoreFacade::parseCommandLine);
|
||||
|
||||
this->setCommandTooltip();
|
||||
QTimer::singleShot(15000, this, &CMainKeypadAreaComponent::setCommandTooltip);
|
||||
}
|
||||
|
||||
CMainKeypadAreaComponent::~CMainKeypadAreaComponent()
|
||||
@@ -161,23 +159,6 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void CMainKeypadAreaComponent::onCommandEntered()
|
||||
{
|
||||
const QString c(ui->lep_CommandLineInput->getLastEnteredLineFormatted());
|
||||
if (c.isEmpty()) { return; }
|
||||
if (c.toLower().trimmed().contains("help"))
|
||||
{
|
||||
this->setCommandTooltip();
|
||||
return;
|
||||
}
|
||||
emit this->commandEntered(c, m_identifier);
|
||||
}
|
||||
|
||||
void CMainKeypadAreaComponent::setCommandTooltip()
|
||||
{
|
||||
ui->lep_CommandLineInput->setToolTip(sGui->getIContextApplication()->dotCommandsHtmlHelp());
|
||||
}
|
||||
|
||||
void CMainKeypadAreaComponent::ownAircraftCockpitChanged(const CSimulatedAircraft &aircraft, const CIdentifier &originator)
|
||||
{
|
||||
Q_UNUSED(originator);
|
||||
|
||||
@@ -74,12 +74,6 @@ namespace BlackGui
|
||||
//! Button was clicked
|
||||
void buttonSelected();
|
||||
|
||||
//! Command line entered
|
||||
void onCommandEntered();
|
||||
|
||||
//! Display help as HTML
|
||||
void setCommandTooltip();
|
||||
|
||||
//! \copydoc BlackCore::Context::IContextNetwork::connectionStatusChanged
|
||||
void connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to);
|
||||
|
||||
|
||||
@@ -443,7 +443,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="5">
|
||||
<widget class="BlackGui::CLineEditHistory" name="lep_CommandLineInput">
|
||||
<widget class="BlackGui::Components::CCommandInput" name="lep_CommandLineInput">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@@ -465,9 +465,10 @@
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::CLineEditHistory</class>
|
||||
<class>BlackGui::Components::CCommandInput</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>blackgui/lineedithistory.h</header>
|
||||
<header>blackgui/components/commandinput.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
|
||||
Reference in New Issue
Block a user