Ref T166, use command input in main keypad area

This commit is contained in:
Klaus Basan
2017-09-28 04:37:18 +02:00
parent 706a1b7b3d
commit f815f7734d
3 changed files with 6 additions and 30 deletions

View File

@@ -64,15 +64,13 @@ namespace BlackGui
connect(ui->pb_Audio, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected); connect(ui->pb_Audio, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected);
// command line // 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->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CMainKeypadAreaComponent::connectionStatusChanged);
connect(sGui->getIContextOwnAircraft(), &IContextOwnAircraft::changedAircraftCockpit, this, &CMainKeypadAreaComponent::ownAircraftCockpitChanged); connect(sGui->getIContextOwnAircraft(), &IContextOwnAircraft::changedAircraftCockpit, this, &CMainKeypadAreaComponent::ownAircraftCockpitChanged);
connect(sGui->getIContextAudio(), &IContextAudio::changedMute, this, &CMainKeypadAreaComponent::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->setCommandTooltip();
QTimer::singleShot(15000, this, &CMainKeypadAreaComponent::setCommandTooltip);
} }
CMainKeypadAreaComponent::~CMainKeypadAreaComponent() 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) void CMainKeypadAreaComponent::ownAircraftCockpitChanged(const CSimulatedAircraft &aircraft, const CIdentifier &originator)
{ {
Q_UNUSED(originator); Q_UNUSED(originator);

View File

@@ -74,12 +74,6 @@ namespace BlackGui
//! Button was clicked //! Button was clicked
void buttonSelected(); void buttonSelected();
//! Command line entered
void onCommandEntered();
//! Display help as HTML
void setCommandTooltip();
//! \copydoc BlackCore::Context::IContextNetwork::connectionStatusChanged //! \copydoc BlackCore::Context::IContextNetwork::connectionStatusChanged
void connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to); void connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to);

View File

@@ -443,7 +443,7 @@
</widget> </widget>
</item> </item>
<item row="0" column="0" colspan="5"> <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"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
@@ -465,9 +465,10 @@
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
<class>BlackGui::CLineEditHistory</class> <class>BlackGui::Components::CCommandInput</class>
<extends>QLineEdit</extends> <extends>QLineEdit</extends>
<header>blackgui/lineedithistory.h</header> <header>blackgui/components/commandinput.h</header>
<container>1</container>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<tabstops> <tabstops>