diff --git a/src/blackgui/components/audiocomponent.ui b/src/blackgui/components/audiocomponent.ui index 789fd0d3f..367daf470 100644 --- a/src/blackgui/components/audiocomponent.ui +++ b/src/blackgui/components/audiocomponent.ui @@ -99,52 +99,10 @@ 0 - - - - - - 0 - 0 - - - - Sound: - - - - - - - Volume COM1: - - - - - - - Qt::Horizontal - - - - - - - Volume COM2: - - - - - - - Qt::Horizontal - - - - + - + QFrame::StyledPanel @@ -164,9 +122,15 @@ - BlackGui::Components::CAudioSetup + BlackGui::Components::CAudioSetupComponent QFrame -
blackgui/components/audiosetup.h
+
blackgui/components/audiosetupcomponent.h
+ 1 +
+ + BlackGui::Components::CAudioVolumeComponent + QFrame +
blackgui/components/audiovolumecomponent.h
1
diff --git a/src/blackgui/components/audiosetup.cpp b/src/blackgui/components/audiosetupcomponent.cpp similarity index 88% rename from src/blackgui/components/audiosetup.cpp rename to src/blackgui/components/audiosetupcomponent.cpp index 9f602bb7b..46d9b26d6 100644 --- a/src/blackgui/components/audiosetup.cpp +++ b/src/blackgui/components/audiosetupcomponent.cpp @@ -7,8 +7,10 @@ * contained in the LICENSE file. */ -#include "audiosetup.h" -#include "ui_audiosetup.h" +#include "audiosetupcomponent.h" +#include "ui_audiosetupcomponent.h" +#include "blackcore/context_settings.h" +#include "blackcore/context_audio.h" #include "blackmisc/setaudio.h" #include "blackmisc/logmessage.h" @@ -24,27 +26,27 @@ namespace BlackGui { namespace Components { - CAudioSetup::CAudioSetup(QWidget *parent) : + CAudioSetupComponent::CAudioSetupComponent(QWidget *parent) : QFrame(parent), CEnableForRuntime(nullptr, false), - ui(new Ui::CAudioSetup) + ui(new Ui::CAudioSetupComponent) { ui->setupUi(this); this->ui->prb_SetupAudioTestProgress->hide(); this->m_timerAudioTests = new QTimer(this); } - CAudioSetup::~CAudioSetup() + CAudioSetupComponent::~CAudioSetupComponent() { } /* * Runtime set */ - void CAudioSetup::runtimeHasBeenSet() + void CAudioSetupComponent::runtimeHasBeenSet() { if (!this->getIContextSettings()) qFatal("Settings missing"); - this->connect(this->getIContextSettings(), &IContextSettings::changedSettings, this, &CAudioSetup::ps_changedSettings); - this->connect(this->m_timerAudioTests, &QTimer::timeout, this, &CAudioSetup::ps_audioTestUpdate); + this->connect(this->getIContextSettings(), &IContextSettings::changedSettings, this, &CAudioSetupComponent::ps_changedSettings); + this->connect(this->m_timerAudioTests, &QTimer::timeout, this, &CAudioSetupComponent::ps_audioTestUpdate); // based on audio context Q_ASSERT(this->getIContextAudio()); @@ -52,19 +54,19 @@ namespace BlackGui if (this->getIContextAudio()) { this->initAudioDeviceLists(); - connected = this->connect(this->getIContextAudio(), &IContextAudio::audioTestCompleted, this, &CAudioSetup::ps_audioTestUpdate); + connected = this->connect(this->getIContextAudio(), &IContextAudio::audioTestCompleted, this, &CAudioSetupComponent::ps_audioTestUpdate); Q_ASSERT(connected); connected = this->connect(this->ui->cb_SetupAudioInputDevice, SIGNAL(currentIndexChanged(int)), this, SLOT(ps_audioDeviceSelected(int))); Q_ASSERT(connected); connected = this->connect(this->ui->cb_SetupAudioOutputDevice, SIGNAL(currentIndexChanged(int)), this, SLOT(ps_audioDeviceSelected(int))); Q_ASSERT(connected); - this->connect(this->ui->pb_SetupAudioMicrophoneTest, &QPushButton::clicked, this, &CAudioSetup::ps_startAudioTest); - this->connect(this->ui->pb_SetupAudioSquelchTest, &QPushButton::clicked, this, &CAudioSetup::ps_startAudioTest); + this->connect(this->ui->pb_SetupAudioMicrophoneTest, &QPushButton::clicked, this, &CAudioSetupComponent::ps_startAudioTest); + this->connect(this->ui->pb_SetupAudioSquelchTest, &QPushButton::clicked, this, &CAudioSetupComponent::ps_startAudioTest); } this->reloadSettings(); } - void CAudioSetup::ps_changedSettings(uint typeValue) + void CAudioSetupComponent::ps_changedSettings(uint typeValue) { IContextSettings::SettingsType type = static_cast(typeValue); this->reloadSettings(); @@ -74,7 +76,7 @@ namespace BlackGui /* * Reload settings */ - void CAudioSetup::reloadSettings() + void CAudioSetupComponent::reloadSettings() { // local copy CSettingsAudio as = this->getIContextSettings()->getAudioSettings(); @@ -88,7 +90,7 @@ namespace BlackGui /* * Set audio device lists */ - void CAudioSetup::initAudioDeviceLists() + void CAudioSetupComponent::initAudioDeviceLists() { if (!this->getIContextAudio()) return; this->ui->cb_SetupAudioOutputDevice->clear(); @@ -122,7 +124,7 @@ namespace BlackGui /* * Notification sounds */ - bool CAudioSetup::playNotificationSounds() const + bool CAudioSetupComponent::playNotificationSounds() const { return this->ui->cb_SetupAudioPlayNotificationSounds->isChecked(); } @@ -130,7 +132,7 @@ namespace BlackGui /* * Start the voice tests */ - void CAudioSetup::ps_startAudioTest() + void CAudioSetupComponent::ps_startAudioTest() { if (!this->getIContextAudio()) { @@ -167,7 +169,7 @@ namespace BlackGui /* * Start the voice tests */ - void CAudioSetup::ps_audioTestUpdate() + void CAudioSetupComponent::ps_audioTestUpdate() { Q_ASSERT(this->getIContextAudio()); if (!this->getIContextAudio()) return; @@ -209,7 +211,7 @@ namespace BlackGui /* * Select audio device */ - void CAudioSetup::ps_audioDeviceSelected(int index) + void CAudioSetupComponent::ps_audioDeviceSelected(int index) { if (!this->getIContextAudio()) return; if (index < 0)return; diff --git a/src/blackgui/components/audiosetup.h b/src/blackgui/components/audiosetupcomponent.h similarity index 85% rename from src/blackgui/components/audiosetup.h rename to src/blackgui/components/audiosetupcomponent.h index f34388e00..6d49ed1b8 100644 --- a/src/blackgui/components/audiosetup.h +++ b/src/blackgui/components/audiosetupcomponent.h @@ -9,21 +9,22 @@ //! \file -#ifndef BLACKGUI_AUDIOSETUP_H -#define BLACKGUI_AUDIOSETUP_H +#ifndef BLACKGUI_AUDIOSETUPCOMPONENT_H +#define BLACKGUI_AUDIOSETUPCOMPONENT_H #include "enableforruntime.h" +#include "blackmisc/audiodevicelist.h" #include #include -namespace Ui { class CAudioSetup; } +namespace Ui { class CAudioSetupComponent; } namespace BlackGui { namespace Components { //! Audio setup such as input / output devices - class CAudioSetup : + class CAudioSetupComponent : public QFrame, public CEnableForRuntime { @@ -31,10 +32,10 @@ namespace BlackGui public: //! Constructor - explicit CAudioSetup(QWidget *parent = nullptr); + explicit CAudioSetupComponent(QWidget *parent = nullptr); //! Destructor - ~CAudioSetup(); + ~CAudioSetupComponent(); //! Play notification sounds (at all) bool playNotificationSounds() const; @@ -76,7 +77,7 @@ namespace BlackGui //! Audio device lists from settings void initAudioDeviceLists(); - QScopedPointer ui; + QScopedPointer ui; QTimer *m_timerAudioTests; //!< audio tests: progress bar, disable/enable buttons AudioTest m_audioTestRunning = NoAudioTest; }; diff --git a/src/blackgui/components/audiosetup.ui b/src/blackgui/components/audiosetupcomponent.ui similarity index 97% rename from src/blackgui/components/audiosetup.ui rename to src/blackgui/components/audiosetupcomponent.ui index 3b57da89c..e23c7d570 100644 --- a/src/blackgui/components/audiosetup.ui +++ b/src/blackgui/components/audiosetupcomponent.ui @@ -1,7 +1,7 @@ - CAudioSetup - + CAudioSetupComponent + 0 @@ -40,6 +40,9 @@ QFormLayout::AllNonFixedFieldsGrow + + 10 + 2 diff --git a/src/blackgui/components/audiovolumecomponent.cpp b/src/blackgui/components/audiovolumecomponent.cpp new file mode 100644 index 000000000..5cece150c --- /dev/null +++ b/src/blackgui/components/audiovolumecomponent.cpp @@ -0,0 +1,61 @@ +/* Copyright (C) 2013 + * swift project Community / Contributors + * + * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level + * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, + * including this file, may be copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE file. + */ + +#include "blackcore/context_audio.h" +#include "audiovolumecomponent.h" +#include "ui_audiovolumecomponent.h" + +using namespace BlackCore; + +namespace BlackGui +{ + namespace Components + { + + CAudioVolumeComponent::CAudioVolumeComponent(QWidget *parent) : + QFrame(parent), + ui(new Ui::CAudioVolumeComponent) + { + ui->setupUi(this); + bool c = connect(this->ui->pb_ShowWinMixer, &QPushButton::pressed, this, &CAudioVolumeComponent::ps_onWindowsMixer); + Q_ASSERT(c); + } + + CAudioVolumeComponent::~CAudioVolumeComponent() + { } + + void CAudioVolumeComponent::runtimeHasBeenSet() + { + bool c = connect(this->getIContextAudio(), &IContextAudio::changedMute, this, &CAudioVolumeComponent::ps_onMuteChanged); + Q_ASSERT(c); + c = connect(this->ui->pb_Mute, &QPushButton::toggled, this->getIContextAudio(), &IContextAudio::setMute); + Q_ASSERT(c); + } + + void CAudioVolumeComponent::ps_onMuteChanged(bool muted) + { + if (muted == this->ui->pb_Mute->isChecked()) { return; } // avoid roundtrips + this->ui->pb_Mute->setChecked(muted); + } + + void CAudioVolumeComponent::ps_onVolumeChanged(QList volumes) + { + Q_ASSERT(volumes.length() == 2); + if (volumes.length() != 2) return; + this->ui->hs_VolumeCom1->setValue(volumes.at(0)); + this->ui->hs_VolumeCom2->setValue(volumes.at(1)); + } + + void CAudioVolumeComponent::ps_onWindowsMixer() + { + BlackMisc::Audio::startWindowsMixer(); + } + + } // namespace +} // namespace diff --git a/src/blackgui/components/audiovolumecomponent.h b/src/blackgui/components/audiovolumecomponent.h new file mode 100644 index 000000000..7e64e7fe6 --- /dev/null +++ b/src/blackgui/components/audiovolumecomponent.h @@ -0,0 +1,61 @@ +/* Copyright (C) 2013 + * swift project Community / Contributors + * + * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level + * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, + * including this file, may be copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE file. + */ + +//! \file + +#ifndef BLACKGUI_AUDIOVOLUME_H +#define BLACKGUI_AUDIOVOLUME_H + +#include +#include +#include "enableforruntime.h" + +namespace Ui { class CAudioVolumeComponent; } +namespace BlackGui +{ + namespace Components + { + + //! Audio volume, mixer + class CAudioVolumeComponent : + public QFrame, + public CEnableForRuntime + { + Q_OBJECT + + public: + //! Constructor + explicit CAudioVolumeComponent(QWidget *parent = nullptr); + + //! Destructor + ~CAudioVolumeComponent(); + + protected: + //! \copydoc CEnableForRuntime::runtimeHasBeenSet + void runtimeHasBeenSet() override; + + private slots: + //! Mute toggle + void ps_onMuteChanged(bool muted); + + //! Volumes changed + void ps_onVolumeChanged(QList volumes); + + //! Requested windows mixer + void ps_onWindowsMixer(); + + private: + QScopedPointer ui; + + }; + + } // namespace +} // namespace + +#endif // guard diff --git a/src/blackgui/components/audiovolumecomponent.ui b/src/blackgui/components/audiovolumecomponent.ui new file mode 100644 index 000000000..f04a907bf --- /dev/null +++ b/src/blackgui/components/audiovolumecomponent.ui @@ -0,0 +1,200 @@ + + + CAudioVolumeComponent + + + + 0 + 0 + 400 + 300 + + + + Frame + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QFormLayout::AllNonFixedFieldsGrow + + + 10 + + + + + + 0 + 0 + + + + Sound: + + + + + + + Volume COM1 + + + + + + + 100 + + + 5 + + + 50 + + + Qt::Horizontal + + + + + + + Volume COM2 + + + + + + + 100 + + + 5 + + + 50 + + + Qt::Horizontal + + + + + + + + 0 + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + Toggle mute + + + + + + + :/diagona/icons/diagona/icons/speaker-volume.png + :/diagona/icons/diagona/icons/speaker-volume-control-mute.png:/diagona/icons/diagona/icons/speaker-volume.png + + + true + + + false + + + + + + + + 0 + 0 + + + + Windows sound mixer + + + + + + + :/diagona/icons/diagona/icons/speaker--pencil.png:/diagona/icons/diagona/icons/speaker--pencil.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + diff --git a/src/blackgui/components/mainkeypadareacomponent.cpp b/src/blackgui/components/mainkeypadareacomponent.cpp new file mode 100644 index 000000000..fbfcc196d --- /dev/null +++ b/src/blackgui/components/mainkeypadareacomponent.cpp @@ -0,0 +1,73 @@ +/* Copyright (C) 2013 + * swift project Community / Contributors + * + * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level + * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, + * including this file, may be copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE file. + */ + +#include "mainkeypadareacomponent.h" +#include "ui_mainkeypadareacomponent.h" + +namespace BlackGui +{ + namespace Components + { + + CMainKeypadAreaComponent::CMainKeypadAreaComponent(QWidget *parent) : + QFrame(parent), + ui(new Ui::CMainKeypadAreaComponent) + { + ui->setupUi(this); + + // Info areas + connect(this->ui->pb_MainAircrafts, &QPushButton::pressed, this, &CMainKeypadAreaComponent::ps_buttonPressed); + connect(this->ui->pb_MainAtc, &QPushButton::pressed, this, &CMainKeypadAreaComponent::ps_buttonPressed); + connect(this->ui->pb_MainCockpit, &QPushButton::pressed, this, &CMainKeypadAreaComponent::ps_buttonPressed); + connect(this->ui->pb_MainFlightplan, &QPushButton::pressed, this, &CMainKeypadAreaComponent::ps_buttonPressed); + connect(this->ui->pb_MainLog, &QPushButton::pressed, this, &CMainKeypadAreaComponent::ps_buttonPressed); + connect(this->ui->pb_MainMappings, &QPushButton::pressed, this, &CMainKeypadAreaComponent::ps_buttonPressed); + connect(this->ui->pb_MainSettings, &QPushButton::pressed, this, &CMainKeypadAreaComponent::ps_buttonPressed); + connect(this->ui->pb_MainSimulator, &QPushButton::pressed, this, &CMainKeypadAreaComponent::ps_buttonPressed); + connect(this->ui->pb_MainTextMessages, &QPushButton::pressed, this, &CMainKeypadAreaComponent::ps_buttonPressed); + connect(this->ui->pb_MainUsers, &QPushButton::pressed, this, &CMainKeypadAreaComponent::ps_buttonPressed); + connect(this->ui->pb_MainWeather, &QPushButton::pressed, this, &CMainKeypadAreaComponent::ps_buttonPressed); + } + + CMainKeypadAreaComponent::~CMainKeypadAreaComponent() + { } + + void CMainKeypadAreaComponent::ps_buttonPressed() + { + const QObject *sender = QObject::sender(); + CMainInfoAreaComponent::InfoArea ia = buttonToMainInfoArea(sender); + if (ia != CMainInfoAreaComponent::InfoAreaNone) + { + emit selectMainInfoAreaDockWidget(ia); + } + } + + void CMainKeypadAreaComponent::ps_buttonDoubleClicked() + { + + } + + CMainInfoAreaComponent::InfoArea CMainKeypadAreaComponent::buttonToMainInfoArea(const QObject *button) const + { + if (button == ui->pb_MainAircrafts) return CMainInfoAreaComponent::InfoAreaAircrafts; + if (button == ui->pb_MainAtc) return CMainInfoAreaComponent::InfoAreaAtc; + if (button == ui->pb_MainCockpit) return CMainInfoAreaComponent::InfoAreaCockpit; + if (button == ui->pb_MainFlightplan) return CMainInfoAreaComponent::InfoAreaFlightPlan; + if (button == ui->pb_MainLog) return CMainInfoAreaComponent::InfoAreaLog; + if (button == ui->pb_MainMappings) return CMainInfoAreaComponent::InfoAreaMappings; + if (button == ui->pb_MainSettings) return CMainInfoAreaComponent::InfoAreaSettings; + if (button == ui->pb_MainSimulator) return CMainInfoAreaComponent::InfoAreaSimulator; + if (button == ui->pb_MainTextMessages) return CMainInfoAreaComponent::InfoAreaTextMessages; + if (button == ui->pb_MainUsers) return CMainInfoAreaComponent::InfoAreaUsers; + if (button == ui->pb_MainWeather) return CMainInfoAreaComponent::InfoAreaWeather; + return CMainInfoAreaComponent::InfoAreaNone; + } + + } // namespace +} // namespace diff --git a/src/blackgui/components/mainkeypadareacomponent.h b/src/blackgui/components/mainkeypadareacomponent.h new file mode 100644 index 000000000..d0bd125b6 --- /dev/null +++ b/src/blackgui/components/mainkeypadareacomponent.h @@ -0,0 +1,60 @@ +/* Copyright (C) 2013 + * swift project Community / Contributors + * + * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level + * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, + * including this file, may be copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE file. + */ + +//! \file + +#ifndef BLACKGUI_MAINKEYPADAREACOMPONENT_H +#define BLACKGUI_MAINKEYPADAREACOMPONENT_H + +#include +#include +#include "maininfoareacomponent.h" + +namespace Ui { class CMainKeypadAreaComponent; } +namespace BlackGui +{ + namespace Components + { + + //! Main keypad area as used with main info area + //! \sa CMainInfoAreaComponent + class CMainKeypadAreaComponent : public QFrame + { + Q_OBJECT + + public: + //! Constructor + explicit CMainKeypadAreaComponent(QWidget *parent = nullptr); + + //! Destructor + ~CMainKeypadAreaComponent(); + + signals: + //! Button to select main info area has been pressed + //! \sa CMainInfoAreaComponent + void selectMainInfoAreaDockWidget(CMainInfoAreaComponent::InfoArea infoArea); + + private slots: + //! Button was clicked + void ps_buttonPressed(); + + //! Button was double clicked + void ps_buttonDoubleClicked(); + + private: + // if button is info area, identify it + CMainInfoAreaComponent::InfoArea buttonToMainInfoArea(const QObject *button) const; + + QScopedPointer ui; + }; + + } // namespace +} // namespace + +#endif // guard diff --git a/src/blackgui/components/mainkeypadareacomponent.ui b/src/blackgui/components/mainkeypadareacomponent.ui new file mode 100644 index 000000000..8449ff3ba --- /dev/null +++ b/src/blackgui/components/mainkeypadareacomponent.ui @@ -0,0 +1,378 @@ + + + CMainKeypadAreaComponent + + + + 0 + 0 + 407 + 144 + + + + Frame + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + 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 + + + + ATC + + + + + + + Users + + + + + + + + 0 + 0 + + + + + 16777215 + 22 + + + + Cockpit + + + + + + + Ident + + + + + + + + 0 + 0 + + + + + 16777215 + 22 + + + + Text/Chat + + + + + + + Simulator + + + + + + + + 0 + 0 + + + + + 16777215 + 22 + + + + Weather + + + + + + + + 0 + 0 + + + + + 16777215 + 22 + + + + Flightplan + + + + + + + + 0 + 0 + + + + + 16777215 + 22 + + + + Mappings + + + + + + + + 0 + 0 + + + + + 16777215 + 22 + + + + Qt::LeftToRight + + + Settings + + + + + + + + 0 + 0 + + + + + 16777215 + 22 + + + + Log + + + + + + + + + + +