11 #include "ui_mainkeypadareacomponent.h"
23 using namespace swift::misc::aviation;
24 using namespace swift::misc::network;
25 using namespace swift::misc::simulation;
27 using namespace swift::core::context;
31 CMainKeypadAreaComponent::CMainKeypadAreaComponent(QWidget *parent)
39 connect(ui->pb_MainAircrafts, &QPushButton::released,
this, &CMainKeypadAreaComponent::buttonSelected);
40 connect(ui->pb_MainAtc, &QPushButton::released,
this, &CMainKeypadAreaComponent::buttonSelected);
41 connect(ui->pb_MainCockpit, &QPushButton::released,
this, &CMainKeypadAreaComponent::buttonSelected);
42 connect(ui->pb_MainFlightplan, &QPushButton::released,
this, &CMainKeypadAreaComponent::buttonSelected);
43 connect(ui->pb_MainLog, &QPushButton::released,
this, &CMainKeypadAreaComponent::buttonSelected);
44 connect(ui->pb_MainMappings, &QPushButton::released,
this, &CMainKeypadAreaComponent::buttonSelected);
45 connect(ui->pb_MainInterpolation, &QPushButton::released,
this, &CMainKeypadAreaComponent::buttonSelected);
46 connect(ui->pb_MainRadar, &QPushButton::released,
this, &CMainKeypadAreaComponent::buttonSelected);
47 connect(ui->pb_MainSettings, &QPushButton::released,
this, &CMainKeypadAreaComponent::buttonSelected);
48 connect(ui->pb_MainSimulator, &QPushButton::released,
this, &CMainKeypadAreaComponent::buttonSelected);
49 connect(ui->pb_MainTextMessages, &QPushButton::released,
this, &CMainKeypadAreaComponent::buttonSelected);
50 connect(ui->pb_MainUsers, &QPushButton::released,
this, &CMainKeypadAreaComponent::buttonSelected);
53 connect(ui->pb_Connect, &QPushButton::released,
this, &CMainKeypadAreaComponent::buttonSelected);
54 connect(ui->pb_Opacity050, &QPushButton::pressed,
this, &CMainKeypadAreaComponent::buttonSelected);
55 connect(ui->pb_Opacity100, &QPushButton::pressed,
this, &CMainKeypadAreaComponent::buttonSelected);
56 connect(ui->pb_SoundMaxVolume, &QPushButton::pressed,
this, &CMainKeypadAreaComponent::buttonSelected);
57 connect(ui->pb_CockpitIdent, &QPushButton::released,
this, &CMainKeypadAreaComponent::buttonSelected);
58 connect(ui->pb_SoundMute, &QPushButton::released,
this, &CMainKeypadAreaComponent::buttonSelected);
59 connect(ui->pb_Audio, &QPushButton::released,
this, &CMainKeypadAreaComponent::buttonSelected);
62 ui->lep_CommandLineInput->setIdentifier(m_identifier);
68 &CMainKeypadAreaComponent::connectionStatusChanged);
70 &CMainKeypadAreaComponent::ownAircraftCockpitChanged);
72 &CMainKeypadAreaComponent::outputMuteChanged);
75 QPointer<CMainKeypadAreaComponent> myself(
this);
77 if (!myself || !
sGui) {
return; }
85 const QList<int> &floatingIndexes)
87 this->unsetInfoAreaButtons();
88 if (currentTabIndex >= 0)
94 Q_ASSERT(pb->isCheckable());
100 for (
int floatingIndex : floatingIndexes)
103 if (pb) { pb->setChecked(
true); }
106 this->updateConnectionStatus();
108 Q_UNUSED(dockedIndexes)
113 void CMainKeypadAreaComponent::buttonSelected()
116 QPushButton *senderButton =
static_cast<QPushButton *
>(QObject::sender());
117 Q_ASSERT_X(senderButton, Q_FUNC_INFO,
"No sender button");
118 if (!senderButton) {
return; }
120 if (infoArea != CMainInfoAreaComponent::InfoAreaNone)
122 Q_ASSERT(senderButton->isCheckable());
124 senderButton->setChecked(
true);
128 else if (senderButton == ui->pb_Opacity050) { emit this->
changedOpacity(50); }
129 else if (senderButton == ui->pb_Opacity100) { emit this->
changedOpacity(100); }
139 else if (senderButton == ui->pb_Connect)
142 this->updateConnectionStatus();
144 else if (senderButton == ui->pb_Audio) { emit this->
audioPressed(); }
154 ui->pb_Connect->setText(
"Connected");
155 ui->pb_Connect->setChecked(
true);
160 ui->pb_Connect->setText(
"Connect");
161 ui->pb_Connect->setChecked(
false);
166 void CMainKeypadAreaComponent::ownAircraftCockpitChanged(
const CSimulatedAircraft &aircraft,
173 if (ident != ui->pb_CockpitIdent->isChecked()) { ui->pb_CockpitIdent->setChecked(ident); }
176 void CMainKeypadAreaComponent::outputMuteChanged(
bool muted)
179 if (muted != ui->pb_SoundMute->isChecked()) { ui->pb_SoundMute->setChecked(muted); }
184 if (button == ui->pb_MainAircrafts)
return CMainInfoAreaComponent::InfoAreaAircraft;
185 if (button == ui->pb_MainAtc)
return CMainInfoAreaComponent::InfoAreaAtc;
186 if (button == ui->pb_MainCockpit)
return CMainInfoAreaComponent::InfoAreaCockpit;
187 if (button == ui->pb_MainFlightplan)
return CMainInfoAreaComponent::InfoAreaFlightPlan;
188 if (button == ui->pb_MainLog)
return CMainInfoAreaComponent::InfoAreaLog;
190 if (button == ui->pb_MainInterpolation)
return CMainInfoAreaComponent::InfoAreaInterpolation;
191 if (button == ui->pb_MainRadar)
return CMainInfoAreaComponent::InfoAreaRadar;
192 if (button == ui->pb_MainSettings)
return CMainInfoAreaComponent::InfoAreaSettings;
193 if (button == ui->pb_MainSimulator)
return CMainInfoAreaComponent::InfoAreaSimulator;
194 if (button == ui->pb_MainTextMessages)
return CMainInfoAreaComponent::InfoAreaTextMessages;
195 if (button == ui->pb_MainUsers)
return CMainInfoAreaComponent::InfoAreaUsers;
196 return CMainInfoAreaComponent::InfoAreaNone;
203 case CMainInfoAreaComponent::InfoAreaAircraft:
return ui->pb_MainAircrafts;
204 case CMainInfoAreaComponent::InfoAreaAtc:
return ui->pb_MainAtc;
205 case CMainInfoAreaComponent::InfoAreaCockpit:
return ui->pb_MainCockpit;
206 case CMainInfoAreaComponent::InfoAreaFlightPlan:
return ui->pb_MainFlightplan;
207 case CMainInfoAreaComponent::InfoAreaLog:
return ui->pb_MainLog;
209 case CMainInfoAreaComponent::InfoAreaInterpolation:
return ui->pb_MainInterpolation;
210 case CMainInfoAreaComponent::InfoAreaRadar:
return ui->pb_MainRadar;
211 case CMainInfoAreaComponent::InfoAreaSettings:
return ui->pb_MainSettings;
212 case CMainInfoAreaComponent::InfoAreaSimulator:
return ui->pb_MainSimulator;
213 case CMainInfoAreaComponent::InfoAreaTextMessages:
return ui->pb_MainTextMessages;
214 case CMainInfoAreaComponent::InfoAreaUsers:
return ui->pb_MainUsers;
220 void CMainKeypadAreaComponent::unsetInfoAreaButtons()
222 ui->pb_MainAircrafts->setChecked(
false);
223 ui->pb_MainAtc->setChecked(
false);
224 ui->pb_MainCockpit->setChecked(
false);
225 ui->pb_MainFlightplan->setChecked(
false);
226 ui->pb_MainLog->setChecked(
false);
227 ui->pb_MainMappings->setChecked(
false);
228 ui->pb_MainInterpolation->setChecked(
false);
229 ui->pb_MainRadar->setChecked(
false);
230 ui->pb_MainSettings->setChecked(
false);
231 ui->pb_MainSimulator->setChecked(
false);
232 ui->pb_MainTextMessages->setChecked(
false);
233 ui->pb_MainUsers->setChecked(
false);
235 this->updateConnectionStatus();
238 void CMainKeypadAreaComponent::update()
242 this->updateConnectionStatus();
245 void CMainKeypadAreaComponent::updateConnectionStatus()
249 this->connectionStatusChanged(CConnectionStatus::Connected, CConnectionStatus::Connected);
251 else { this->connectionStatusChanged(CConnectionStatus::Disconnected, CConnectionStatus::Disconnected); }
const context::IContextAudio * getIContextAudio() const
Direct access to contexts if a CCoreFacade has been initialized.
const context::IContextOwnAircraft * getIContextOwnAircraft() const
Direct access to contexts if a CCoreFacade has been initialized.
CCoreFacade * getCoreFacade()
Get the facade.
const context::IContextNetwork * getIContextNetwork() const
Direct access to contexts if a CCoreFacade has been initialized.
bool isShuttingDown() const
Is application shutting down?
const context::CContextAudioBase * getCContextAudioBase() const
Direct access to contexts if a CCoreFacade has been initialized.
bool supportsContexts(bool ignoreShutdownTest=false) const
Supports contexts.
bool isOutputMuted() const
Volume.
void setMasterOutputVolume(int volume)
Volume.
void setOutputMute(bool muted)
Volume.
virtual bool isConnected() const =0
Network connected?
@ InfoAreaMapping
aka rendering, models
Main keypad area as used with main info area.
void connectPressed()
Connect was pressed.
void commandEntered(const QString &commandLine, const swift::misc::CIdentifier &originator)
Command was entered.
virtual ~CMainKeypadAreaComponent()
Destructor.
void identPressed()
Ident pressed.
void focusInEntryField()
Focus in entry fields.
void onMainInfoAreaChanged(int currentTabIndex, const QList< int > &dockedIndexes, const QList< int > &floatingIndexes)
Main info area changed.
void textEntered(const QString &commandLine, const swift::misc::CIdentifier &originator)
Command was entered.
void selectedMainInfoAreaDockWidget(CMainInfoAreaComponent::InfoArea infoArea)
Button to select main info area has been pressed.
void audioPressed()
Request audio.
void changedOpacity(int opacity)
Change opacity 0..30.
Value object encapsulating information identifying a component of a modular distributed swift process...
TransponderMode getTransponderMode() const
Transponder mode.
Value object encapsulating information about a connection status.
bool isConnected() const
Query status.
Comprehensive information of an aircraft.
const aviation::CTransponder & getTransponder() const
Get transponder.
SWIFT_GUI_EXPORT swift::gui::CGuiApplication * sGui
Single instance of GUI application object.
Backend services of the swift project, like dealing with the network or the simulators.
High level reusable GUI components.
Free functions in swift::misc.
auto singleShot(int msec, QObject *target, F &&task)
Starts a single-shot timer which will call a task in the thread of the given object when it times out...