refs #335, adjusted main window

* removed keypad, now component
* removed simulator logic, now in component
* shifted audio logic to cockpit component
This commit is contained in:
Klaus Basan
2014-10-25 00:28:57 +02:00
committed by Roland Winklmeier
parent 3c223b2416
commit 5edc55222d
6 changed files with 41 additions and 655 deletions

View File

@@ -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
*/

View File

@@ -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

View File

@@ -103,360 +103,6 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item row="1" column="0">
<widget class="QWidget" name="wi_MainKeypadArea" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QGridLayout" name="gl_MainKeypadArea">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>2</number>
</property>
<item row="0" column="0" colspan="5">
<widget class="QLineEdit" name="le_CommandLineInput">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;commands go here&gt;</string>
</property>
</widget>
</item>
<item row="3" column="4">
<widget class="QPushButton" name="pb_SoundMute">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>Mute</string>
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="QPushButton" name="pb_MainKeypadOpacity050">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>62</width>
<height>22</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>50%</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="pb_MainConnect">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>Connect</string>
</property>
</widget>
</item>
<item row="4" column="4">
<widget class="QPushButton" name="pb_SoundMaxVolume">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="statusTip">
<string>Maximum volume</string>
</property>
<property name="text">
<string>Max.vol.</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QPushButton" name="pb_MainKeypadOpacity100">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>62</width>
<height>22</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>100%</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="pb_MainAircrafts">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>&amp;Aircrafts</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="pb_MainAtc">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>A&amp;TC</string>
</property>
<property name="shortcut">
<string>Ctrl+K</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="pb_MainUsers">
<property name="text">
<string>Users</string>
</property>
<property name="shortcut">
<string>Ctrl+I, U</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="pb_MainCockpit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>Cockpit</string>
</property>
<property name="shortcut">
<string>Ctrl+I, C</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="pb_CockpitIdent">
<property name="text">
<string>Ident</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pb_MainTextMessages">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>Text/Chat</string>
</property>
<property name="shortcut">
<string>Ctrl+I, T</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="pb_MainSimulator">
<property name="text">
<string>Simulator</string>
</property>
<property name="shortcut">
<string>Ctrl+I, S</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="pb_MainWeather">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>Weather</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="pb_MainFlightplan">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>Flightplan</string>
</property>
<property name="shortcut">
<string>Ctrl+I, F</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pb_MainMappings">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>Mappings</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pb_MainSettings">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Settings</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pb_MainLog">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>Log</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0">
<widget class="QStackedWidget" name="sw_MainMiddle">
<property name="sizePolicy">
@@ -479,7 +125,7 @@
<enum>QFrame::NoFrame</enum>
</property>
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="pg_Cockpit">
<layout class="QVBoxLayout" name="vl_CockpitPage">
@@ -527,6 +173,22 @@
</widget>
</widget>
</item>
<item row="1" column="0">
<widget class="BlackGui::Components::CMainKeypadAreaComponent" name="comp_MainKeypadArea">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@@ -716,15 +378,13 @@
<header>blackgui/components/infobarstatuscomponent.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>BlackGui::Components::CMainKeypadAreaComponent</class>
<extends>QFrame</extends>
<header>blackgui/components/mainkeypadareacomponent.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>le_CommandLineInput</tabstop>
<tabstop>pb_MainConnect</tabstop>
<tabstop>pb_MainKeypadOpacity100</tabstop>
<tabstop>pb_MainKeypadOpacity050</tabstop>
<tabstop>pb_SoundMute</tabstop>
<tabstop>pb_SoundMaxVolume</tabstop>
</tabstops>
<resources/>
<connections/>
<slots>

View File

@@ -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);
}

View File

@@ -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)

View File

@@ -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
*/