diff --git a/src/swiftgui_standard/mainwindow.cpp b/src/swiftgui_standard/mainwindow.cpp
index a95cc1cc7..05608b468 100644
--- a/src/swiftgui_standard/mainwindow.cpp
+++ b/src/swiftgui_standard/mainwindow.cpp
@@ -99,9 +99,6 @@ void MainWindow::gracefulShutdown()
this->getIContextNetwork()->disconnect(this); // avoid any status update signals, etc.
}
}
-
- if (this->getIContextSimulator())
- this->disconnect(this->getIContextSimulator(), &IContextSimulator::connectionChanged, this, &MainWindow::ps_onSimulatorConnectionChanged);
}
/*
@@ -138,69 +135,6 @@ void MainWindow::mousePressEvent(QMouseEvent *event)
QWidget::mousePressEvent(event);
}
-/*
- * Select correct main page
- */
-void MainWindow::ps_setMainPage(bool start)
-{
- if (start)
- {
- this->ui->sw_MainMiddle->setCurrentIndex(0);
- return;
- }
-
- QObject *sender = QObject::sender();
- if (sender == this->ui->pb_MainCockpit)
- {
- this->ui->sw_MainMiddle->setCurrentIndex(MainPageCockpit);
- }
- else
- {
- this->ui->sw_MainMiddle->setCurrentIndex(MainPageInfoArea);
-
- if (sender == this->ui->pb_MainAircrafts)
- {
- this->ui->comp_MainInfoArea->selectArea(CMainInfoAreaComponent::InfoAreaAircrafts);
- }
- if (sender == this->ui->pb_MainAtc)
- {
- this->ui->comp_MainInfoArea->selectArea(CMainInfoAreaComponent::InfoAreaAtc);
- }
- else if (sender == this->ui->pb_MainUsers)
- {
- this->ui->comp_MainInfoArea->selectArea(CMainInfoAreaComponent::InfoAreaUsers);
- }
- else if (sender == this->ui->pb_MainTextMessages)
- {
- this->ui->comp_MainInfoArea->selectArea(CMainInfoAreaComponent::InfoAreaTextMessages);
- }
- else if (sender == this->ui->pb_MainFlightplan)
- {
- this->ui->comp_MainInfoArea->selectArea(CMainInfoAreaComponent::InfoAreaFlightPlan);
- }
- else if (sender == this->ui->pb_MainSettings)
- {
- this->ui->comp_MainInfoArea->selectArea(CMainInfoAreaComponent::InfoAreaSettings);
- }
- else if (sender == this->ui->pb_MainSimulator)
- {
- this->ui->comp_MainInfoArea->selectArea(CMainInfoAreaComponent::InfoAreaSimulator);
- }
- else if (sender == this->ui->pb_MainWeather)
- {
- this->ui->comp_MainInfoArea->selectArea(CMainInfoAreaComponent::InfoAreaWeather);
- }
- else if (sender == this->ui->pb_MainLog)
- {
- this->ui->comp_MainInfoArea->selectArea(CMainInfoAreaComponent::InfoAreaLog);
- }
- else if (sender == this->ui->pb_MainMappings)
- {
- this->ui->comp_MainInfoArea->selectArea(CMainInfoAreaComponent::InfoAreaMappings);
- }
- }
-}
-
/*
* Set main page
*/
@@ -360,10 +294,6 @@ void MainWindow::ps_handleTimerBasedUpdates()
this->setContextAvailability();
this->updateGuiStatusInformation();
}
- else if (sender == this->m_timerSimulator)
- {
- this->updateSimulatorData();
- }
// own aircraft
this->ps_reloadOwnAircraft(); // regular updates
@@ -398,17 +328,6 @@ void MainWindow::updateGuiStatusInformation()
QString s = QString("network: %1").arg(network);
this->ui->comp_InfoBarStatus->setDBusTooltip(s);
- // Connected button
- if (this->m_contextNetworkAvailable && this->getIContextNetwork()->isConnected())
- {
- this->ui->pb_MainConnect->setText("Disconnect");
- this->ui->pb_MainConnect->setStyleSheet("background-color: green");
- }
- else
- {
- this->ui->pb_MainConnect->setText("Connect");
- this->ui->pb_MainConnect->setStyleSheet("background-color: ");
- }
}
/*
@@ -416,70 +335,13 @@ void MainWindow::updateGuiStatusInformation()
*/
void MainWindow::ps_changeWindowOpacity(int opacity)
{
- if (opacity < 0)
- {
- QObject *sender = QObject::sender();
- if (sender == this->ui->pb_MainKeypadOpacity050)
- opacity = 50;
- else if (sender == this->ui->pb_MainKeypadOpacity100)
- opacity = 100;
- else
- return;
- }
qreal o = opacity / 100.0;
o = o < 0.3 ? 0.3 : o;
+ o = o > 1.0 ? 1.0 : o;
QWidget::setWindowOpacity(o);
this->ui->comp_MainInfoArea->getSettingsComponent()->setGuiOpacity(o * 100.0);
}
-void MainWindow::updateSimulatorData()
-{
- CSimulatorComponent *simComp = this->ui->comp_MainInfoArea->getSimulatorComponent();
- Q_ASSERT(simComp);
-
- if (!simComp->isVisibleWidget()) return; // no updates on invisible widgets
- if (!this->getIContextSimulator()->isConnected())
- {
- simComp->clear();
- simComp->addOrUpdateByName("info", "sim not connected", CIcons::StandardIconWarning16);
- return;
- }
-
- // clear old warnings / information
- if (simComp->rowCount() < 5)
- {
- simComp->clear();
- }
-
- CAircraft ownAircraft = this->getIContextOwnAircraft()->getOwnAircraft();
- CAircraftSituation s = ownAircraft.getSituation();
- CComSystem c1 = ownAircraft.getCom1System();
- CComSystem c2 = ownAircraft.getCom2System();
-
- simComp->addOrUpdateByName("latitude", s.latitude().toFormattedQString(), s.latitude().toIcon());
- simComp->addOrUpdateByName("longitude", s.longitude().toFormattedQString(), s.longitude().toIcon());
- simComp->addOrUpdateByName("altitude", s.getAltitude().toFormattedQString(), s.getAltitude().toIcon());
- simComp->addOrUpdateByName("pitch", s.getPitch().toFormattedQString(), CIcons::AviationAttitudeIndicator);
- simComp->addOrUpdateByName("bank", s.getBank().toFormattedQString(), CIcons::AviationAttitudeIndicator);
- simComp->addOrUpdateByName("heading", s.getHeading().toFormattedQString(), s.getHeading().toIcon());
- simComp->addOrUpdateByName("ground speed", s.getGroundSpeed().toFormattedQString(), s.getGroundSpeed().toIcon());
-
- simComp->addOrUpdateByName("COM1 active", c1.getFrequencyActive().toFormattedQString(), c1.getFrequencyActive().toIcon());
- simComp->addOrUpdateByName("COM2 active", c2.getFrequencyActive().toFormattedQString(), c2.getFrequencyActive().toIcon());
- simComp->addOrUpdateByName("COM1 standby", c1.getFrequencyStandby().toFormattedQString(), c1.getFrequencyStandby().toIcon());
- simComp->addOrUpdateByName("COM2 standby", c2.getFrequencyStandby().toFormattedQString(), c2.getFrequencyStandby().toIcon());
- simComp->addOrUpdateByName("Transponder", ownAircraft.getTransponderCodeFormatted(), ownAircraft.getTransponder().toIcon());
-}
-
-void MainWindow::ps_onSimulatorConnectionChanged(bool isAvailable)
-{
- // Simulator timer, TODO remove later
- if (isAvailable)
- this->m_timerSimulator->start(500);
- else
- this->m_timerSimulator->stop();
-}
-
/*
* Stay on top
*/
diff --git a/src/swiftgui_standard/mainwindow.h b/src/swiftgui_standard/mainwindow.h
index f8b6ca14e..48951cbac 100644
--- a/src/swiftgui_standard/mainwindow.h
+++ b/src/swiftgui_standard/mainwindow.h
@@ -44,7 +44,9 @@
namespace Ui { class MainWindow; }
//! swift GUI
-class MainWindow : public QMainWindow, public BlackGui::Components::CEnableForRuntime
+class MainWindow :
+ public QMainWindow,
+ public BlackGui::Components::CEnableForRuntime
{
Q_OBJECT
@@ -98,7 +100,6 @@ private:
BlackMisc::Aviation::CAircraft m_ownAircraft; //!< own aircraft's state
QTimer *m_timerContextWatchdog = nullptr; //!< core available?
QTimer *m_timerStatusBar = nullptr; //!< cleaning up status bar
- QTimer *m_timerSimulator = nullptr; //!< update simulator data
// frameless window
QPoint m_dragPosition; /*!< position, if moving is handled with frameless window */
@@ -168,9 +169,6 @@ private:
//! Play notifcation sound
void playNotifcationSound(BlackSound::CNotificationSounds::Notification notification) const;
- //! Update simulator page with latest user aircraft data
- void updateSimulatorData();
-
//! Originator for aircraft context
static const QString &swiftGuiStandardOriginator()
{
@@ -201,23 +199,14 @@ private slots:
*/
void ps_onConnectionStatusChanged(uint from, uint to, const QString &message);
- //! Simulator available
- void ps_onSimulatorConnectionChanged(bool isAvailable);
-
//
// GUI related slots
//
- /*!
- * \brief Set the main page
- * \param start Startup phase
- */
- void ps_setMainPage(bool start = false);
+ //! Set \sa MainPageInfoArea
+ void ps_setMainPage() { this->ps_setMainPage(MainPageInfoArea); }
- /*!
- * \brief setMainPage
- * \param mainPage
- */
+ //! Set one of the main pages
void ps_setMainPage(MainPageIndex mainPage);
//! Connect to network
@@ -232,9 +221,6 @@ private slots:
//! Update timer
void ps_handleTimerBasedUpdates();
- //! Audio volume handling and mute
- void ps_setAudioVolumes();
-
/*!
* \brief changeOpacity
* \param opacity 0-100
diff --git a/src/swiftgui_standard/mainwindow.ui b/src/swiftgui_standard/mainwindow.ui
index e79108d67..fbe6c1ef3 100644
--- a/src/swiftgui_standard/mainwindow.ui
+++ b/src/swiftgui_standard/mainwindow.ui
@@ -103,360 +103,6 @@
0
- -
-
-
-
- 0
- 0
-
-
-
-
- QLayout::SetDefaultConstraint
-
-
- 2
-
-
- 6
-
-
- 2
-
-
- 0
-
-
- 2
-
-
-
-
-
-
- 0
- 0
-
-
-
- <commands go here>
-
-
-
- -
-
-
-
- 16777215
- 22
-
-
-
- Mute
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 62
- 22
-
-
-
-
- 16777215
- 22
-
-
-
- 50%
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 22
-
-
-
- Connect
-
-
-
- -
-
-
-
- 16777215
- 22
-
-
-
- Maximum volume
-
-
- Max.vol.
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 62
- 22
-
-
-
-
- 16777215
- 22
-
-
-
- 100%
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 22
-
-
-
- &Aircrafts
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 22
-
-
-
- A&TC
-
-
- Ctrl+K
-
-
-
- -
-
-
- Users
-
-
- Ctrl+I, U
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 22
-
-
-
- Cockpit
-
-
- Ctrl+I, C
-
-
-
- -
-
-
- Ident
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 22
-
-
-
- Text/Chat
-
-
- Ctrl+I, T
-
-
-
- -
-
-
- Simulator
-
-
- Ctrl+I, S
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 22
-
-
-
- Weather
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 22
-
-
-
- Flightplan
-
-
- Ctrl+I, F
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 22
-
-
-
- Mappings
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 22
-
-
-
- Qt::LeftToRight
-
-
- Settings
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 22
-
-
-
- Log
-
-
-
-
-
-
-
@@ -479,7 +125,7 @@
QFrame::NoFrame
- 0
+ 1
@@ -527,6 +173,22 @@
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 0
+
+
+
+
@@ -716,15 +378,13 @@
blackgui/components/infobarstatuscomponent.h
1
+
+ BlackGui::Components::CMainKeypadAreaComponent
+ QFrame
+ blackgui/components/mainkeypadareacomponent.h
+ 1
+
-
- le_CommandLineInput
- pb_MainConnect
- pb_MainKeypadOpacity100
- pb_MainKeypadOpacity050
- pb_SoundMute
- pb_SoundMaxVolume
-
diff --git a/src/swiftgui_standard/mainwindow_init.cpp b/src/swiftgui_standard/mainwindow_init.cpp
index e6e24c67e..df28d9f79 100644
--- a/src/swiftgui_standard/mainwindow_init.cpp
+++ b/src/swiftgui_standard/mainwindow_init.cpp
@@ -1,20 +1,11 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "blackcore/dbus_server.h"
-#include "blackcore/context_network_impl.h"
-#include "blackcore/context_network_proxy.h"
-#include "blackcore/context_simulator_impl.h"
-#include "blackcore/context_simulator_proxy.h"
-#include "blackcore/context_application_impl.h"
-#include "blackcore/context_application_proxy.h"
-#include "blackcore/context_settings_impl.h"
-#include "blackcore/context_settings_proxy.h"
-#include "blackcore/context_audio_impl.h"
-#include "blackcore/context_audio_proxy.h"
-#include "blackcore/context_runtime.h"
+#include "blackcore/context_all_interfaces.h"
#include "blackgui/stylesheetutility.h"
#include "blackgui/guiutility.h"
#include "blackgui/components/textmessagecomponent.h"
+#include "blackgui/components/cockpitcomponent.h"
#include "blackgui/models/atcstationlistmodel.h"
#include "blackgui/models/keyboardkeylistmodel.h"
#include "blackmisc/icons.h"
@@ -71,7 +62,6 @@ void MainWindow::init(const CRuntimeConfig &runtimeConfig)
// timers
if (this->m_timerContextWatchdog == nullptr) this->m_timerContextWatchdog = new QTimer(this);
- if (this->m_timerSimulator == nullptr) this->m_timerSimulator = new QTimer(this);
// context
this->createRuntime(runtimeConfig, this);
@@ -100,9 +90,7 @@ void MainWindow::init(const CRuntimeConfig &runtimeConfig)
this->connect(this->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &MainWindow::ps_onConnectionStatusChanged);
connect = this->connect(this->getIContextNetwork(), SIGNAL(textMessagesReceived(BlackMisc::Network::CTextMessageList)), this->ui->comp_MainInfoArea->getTextMessageComponent(), SLOT(appendTextMessagesToGui(BlackMisc::Network::CTextMessageList)));
Q_ASSERT(connect);
- this->connect(this->getIContextSimulator(), &IContextSimulator::connectionChanged, this, &MainWindow::ps_onSimulatorConnectionChanged);
this->connect(this->m_timerContextWatchdog, &QTimer::timeout, this, &MainWindow::ps_handleTimerBasedUpdates);
- this->connect(this->m_timerSimulator, &QTimer::timeout, this, &MainWindow::ps_handleTimerBasedUpdates);
this->connect(this->getIContextSettings(), &IContextSettings::changedSettings, this, &MainWindow::ps_onChangedSetttings);
// sliders
@@ -122,22 +110,19 @@ void MainWindow::init(const CRuntimeConfig &runtimeConfig)
// init availability
this->setContextAvailability();
- // cockpit external buttons
- this->ui->comp_Cockpit->setExternalIdentButton(this->ui->pb_CockpitIdent);
+ // key pad area
+ QObject::connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::selectedMainInfoAreaDockWidget, this->ui->comp_MainInfoArea, &CMainInfoAreaComponent::selectArea);
// data
this->initialDataReads();
// start screen and complete menu
- this->ps_setMainPage(true);
+ this->ps_setMainPage();
this->initDynamicMenus();
// starting
this->getIContextApplication()->notifyAboutComponentChange(IContextApplication::ApplicationGui, IContextApplication::ApplicationStarts);
- // We don't receive signals from the past. So ask for it simulate an initial signal
- ps_onSimulatorConnectionChanged(this->getIContextSimulator()->isConnected());
-
// info
this->ui->comp_MainInfoArea->getLogComponent()->appendPlainTextToConsole(CProject::systemNameAndVersion());
this->ui->comp_MainInfoArea->getLogComponent()->appendPlainTextToConsole(CProject::compiledInfo());
@@ -158,47 +143,14 @@ void MainWindow::init(const CRuntimeConfig &runtimeConfig)
//
void MainWindow::initGuiSignals()
{
- bool connected;
-
// Remark: With new style, only methods of same signature can be connected
// This is why we still have some "old" SIGNAL/SLOT connections here
- // MAIN buttons
- connected = this->connect(this->ui->pb_MainAircrafts, SIGNAL(released()), this, SLOT(ps_setMainPage()));
- Q_ASSERT(connected);
- connected = this->connect(this->ui->pb_MainAtc, SIGNAL(released()), this, SLOT(ps_setMainPage()));
- Q_ASSERT(connected);
- connected = this->connect(this->ui->pb_MainCockpit, SIGNAL(released()), this, SLOT(ps_setMainPage()));
- Q_ASSERT(connected);
- connected = this->connect(this->ui->pb_MainConnect, SIGNAL(released()), this, SLOT(ps_setMainPage()));
- Q_ASSERT(connected);
- connected = this->connect(this->ui->pb_MainConnect, SIGNAL(released()), this, SLOT(ps_toggleNetworkConnection()));
- Q_ASSERT(connected);
- connected = this->connect(this->ui->pb_MainFlightplan, SIGNAL(released()), this, SLOT(ps_setMainPage()));
- Q_ASSERT(connected);
- connected = this->connect(this->ui->pb_MainSettings, SIGNAL(released()), this, SLOT(ps_setMainPage()));
- Q_ASSERT(connected);
- connected = this->connect(this->ui->pb_MainSimulator, SIGNAL(released()), this, SLOT(ps_setMainPage()));
- Q_ASSERT(connected);
- connected = this->connect(this->ui->pb_MainUsers, SIGNAL(released()), this, SLOT(ps_setMainPage()));
- Q_ASSERT(connected);
- connected = this->connect(this->ui->pb_MainTextMessages, SIGNAL(released()), this, SLOT(ps_setMainPage()));
- Q_ASSERT(connected);
- connected = this->connect(this->ui->pb_MainWeather, SIGNAL(released()), this, SLOT(ps_setMainPage()));
- Q_ASSERT(connected);
- connected = this->connect(this->ui->pb_MainMappings, SIGNAL(released()), this, SLOT(ps_setMainPage()));
- Q_ASSERT(connected);
- connected = this->connect(this->ui->pb_MainLog, SIGNAL(released()), this, SLOT(ps_setMainPage()));
- Q_ASSERT(connected);
- connected = this->connect(this->ui->pb_MainKeypadOpacity050, SIGNAL(clicked()), this, SLOT(ps_changeWindowOpacity()));
- Q_ASSERT(connected);
- connected = this->connect(this->ui->pb_MainKeypadOpacity100, SIGNAL(clicked()), this, SLOT(ps_changeWindowOpacity()));
- Q_ASSERT(connected);
-
- // Sound buttons
- this->connect(this->ui->pb_SoundMute, &QPushButton::clicked, this, &MainWindow::ps_setAudioVolumes);
- this->connect(this->ui->pb_SoundMaxVolume, &QPushButton::clicked, this, &MainWindow::ps_setAudioVolumes);
- this->connect(this->ui->comp_Cockpit, &CCockpitV1Component::audioVolumeChanged, this, &MainWindow::ps_setAudioVolumes);
+ // Main buttons
+ this->connect(this->ui->comp_MainKeypadArea, SIGNAL(selectedMainInfoAreaDockWidget(CMainInfoAreaComponent::InfoArea)), this, SLOT(ps_setMainPage()));
+ this->connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::connectPressed, this, &MainWindow::ps_toggleNetworkConnection);
+ this->connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::changedOpacity, this , &MainWindow::ps_changeWindowOpacity);
+ this->connect(this->ui->comp_MainKeypadArea, &CMainKeypadAreaComponent::identPressed, this->ui->comp_MainInfoArea->getCockpitComponent(), &CCockpitComponent::setSelectedTransponderModeStateIdent);
// menu
this->connect(this->ui->menu_ReloadSettings, &QAction::triggered, this, &MainWindow::ps_onMenuClicked);
@@ -213,17 +165,12 @@ void MainWindow::initGuiSignals()
this->connect(this->ui->menu_FileFont, &QAction::triggered, this, &MainWindow::ps_onMenuClicked);
// command line / text messages
- connected = this->connect(this->ui->le_CommandLineInput, SIGNAL(returnPressed()), this->ui->comp_MainInfoArea->getTextMessageComponent(), SLOT(commandEntered()));
- Q_ASSERT(connected);
this->connect(this->ui->comp_MainInfoArea->getTextMessageComponent(), &CTextMessageComponent::displayInInfoWindow, this->m_compInfoWindow, &CInfoWindowComponent::display);
this->ui->comp_MainInfoArea->getTextMessageComponent()->setSelcalCallback(std::bind(&CCockpitV1Component::getSelcalCode, this->ui->comp_Cockpit));
// settings (GUI component), styles
this->connect(this->ui->comp_MainInfoArea->getSettingsComponent(), &CSettingsComponent::changedWindowsOpacity, this, &MainWindow::ps_changeWindowOpacity);
this->connect(&CStyleSheetUtility::instance(), &CStyleSheetUtility::styleSheetsChanged, this, &MainWindow::ps_onStyleSheetsChanged);
-
- // no warnings in release build
- Q_UNUSED(connected);
}
/*
@@ -271,10 +218,8 @@ void MainWindow::stopAllTimers(bool disconnect)
{
this->m_timerStatusBar->stop();
this->m_timerContextWatchdog->stop();
- this->m_timerSimulator->stop();
this->stopUpdateTimersWhenDisconnected();
if (!disconnect) return;
this->disconnect(this->m_timerStatusBar);
this->disconnect(this->m_timerContextWatchdog);
- this->disconnect(this->m_timerSimulator);
}
diff --git a/src/swiftgui_standard/mainwindow_menus.cpp b/src/swiftgui_standard/mainwindow_menus.cpp
index b643bd09d..fc5451227 100644
--- a/src/swiftgui_standard/mainwindow_menus.cpp
+++ b/src/swiftgui_standard/mainwindow_menus.cpp
@@ -48,7 +48,7 @@ void MainWindow::ps_onMenuClicked()
}
else if (sender == this->ui->menu_FileFont)
{
- this->ps_setMainPage(MainPageInfoArea);
+ this->ps_setMainPage();
this->ui->comp_MainInfoArea->selectSettingsTab(BlackGui::Components::CSettingsComponent::SettingTabGui);
}
else if (sender == this->ui->menu_FileClose)
diff --git a/src/swiftgui_standard/mainwindow_voice.cpp b/src/swiftgui_standard/mainwindow_voice.cpp
index a331ad9fb..2768f293c 100644
--- a/src/swiftgui_standard/mainwindow_voice.cpp
+++ b/src/swiftgui_standard/mainwindow_voice.cpp
@@ -19,73 +19,6 @@ using namespace BlackMisc::Geo;
using namespace BlackMisc::Settings;
using namespace BlackMisc::Math;
-/*
- * Select audio device
- */
-void MainWindow::ps_setAudioVolumes()
-{
- if (!this->m_contextAudioAvailable)
- {
- this->ui->pb_SoundMute->setEnabled(false);
- this->ui->pb_SoundMaxVolume->setEnabled(false);
- return;
- }
-
- // enable the buttons, as we have a voice context
- this->ui->pb_SoundMute->setEnabled(true);
- this->ui->pb_SoundMaxVolume->setEnabled(true);
- QObject *sender = QObject::sender();
-
- CComSystem com1 = this->m_ownAircraft.getCom1System();
- CComSystem com2 = this->m_ownAircraft.getCom2System();
- bool muted;
-
- if (sender == this->ui->pb_SoundMute)
- {
- if (this->getIContextAudio()->isMuted())
- {
- // muted right now, now unmute
- muted = false;
- }
- else
- {
- // unmuted right now, now mute
- muted = true;
- }
- }
- else if (sender == this->ui->pb_SoundMaxVolume)
- {
- muted = false;
- com1.setVolumeOutput(100);
- com2.setVolumeOutput(100);
- this->ui->comp_Cockpit->setCom1Volume(100);
- this->ui->comp_Cockpit->setCom2Volume(100);
- }
- else if (this->ui->comp_Cockpit->isCockpitVolumeWidget(sender))
- {
- muted = false;
- com1.setVolumeOutput(this->ui->comp_Cockpit->getCom1Volume());
- com2.setVolumeOutput(this->ui->comp_Cockpit->getCom2Volume());
- }
- else
- {
- return;
- }
-
- // mute / unmute
- com1.setEnabled(!muted);
- com2.setEnabled(!muted);
- this->ui->pb_SoundMute->setText(muted ? "Unmute" : "Mute");
- this->ui->comp_Cockpit->setCockpitVoiceStatusPixmap(muted ? CIcons::volumeMuted16() : CIcons::volumeHigh16());
- this->ui->pb_SoundMute->setStyleSheet(muted ? "background-color: red;" : "");
- if (muted) this->m_compInfoWindow->displayStringMessage("Sound is muted!");
-
- // update own aircraft, also set volume/mute in voice
- this->m_ownAircraft.setCom1System(com1);
- this->m_ownAircraft.setCom2System(com2);
- this->getIContextAudio()->setVolumes(this->m_ownAircraft.getCom1System(), this->m_ownAircraft.getCom2System());
-}
-
/*
* Notification
*/