mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 00:25:35 +08:00
Removed settings context
* removed old settings related classes * moved notifications to BlackMisc::Audio * added audio settings where needed refs #464 refs #337
This commit is contained in:
committed by
Mathew Sutcliffe
parent
821e0417ae
commit
ac61a3458d
@@ -9,9 +9,7 @@
|
||||
|
||||
#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"
|
||||
|
||||
using namespace BlackCore;
|
||||
@@ -19,8 +17,8 @@ using namespace BlackMisc;
|
||||
using namespace BlackGui;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Audio;
|
||||
using namespace BlackMisc::Audio::Settings;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Settings;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
@@ -44,9 +42,6 @@ namespace BlackGui
|
||||
|
||||
void CAudioSetupComponent::runtimeHasBeenSet()
|
||||
{
|
||||
Q_ASSERT_X(this->getIContextSettings(), Q_FUNC_INFO, "missing settings");
|
||||
this->connect(this->getIContextSettings(), &IContextSettings::changedSettings, this, &CAudioSetupComponent::ps_changedSettings);
|
||||
|
||||
// based on audio context
|
||||
Q_ASSERT_X(this->getIContextAudio(), Q_FUNC_INFO, "missing audio");
|
||||
if (this->getIContextAudio())
|
||||
@@ -67,26 +62,16 @@ namespace BlackGui
|
||||
this->connect(this->getIContextAudio(), &IContextAudio::changedAudioDevices, this, &CAudioSetupComponent::ps_onAudioDevicesChanged);
|
||||
this->connect(this->getIContextAudio(), &IContextAudio::changedSelectedAudioDevices, this, &CAudioSetupComponent::ps_onCurrentAudioDevicesChanged);
|
||||
}
|
||||
this->reloadSettings();
|
||||
this->ps_reloadSettings();
|
||||
this->ui->tb_ExpandNotificationSounds->setChecked(false); // collapse
|
||||
}
|
||||
|
||||
void CAudioSetupComponent::ps_changedSettings(uint typeValue)
|
||||
void CAudioSetupComponent::ps_reloadSettings()
|
||||
{
|
||||
IContextSettings::SettingsType type = static_cast<IContextSettings::SettingsType>(typeValue);
|
||||
this->reloadSettings();
|
||||
Q_UNUSED(type);
|
||||
}
|
||||
|
||||
void CAudioSetupComponent::reloadSettings()
|
||||
{
|
||||
// local copy
|
||||
CSettingsAudio as = this->getIContextSettings()->getAudioSettings();
|
||||
|
||||
// fake setting for sound notifications
|
||||
CSettingsAudio as(m_audioSettings.get());
|
||||
this->ui->cb_SetupAudioPlayNotificationSounds->setChecked(true);
|
||||
this->ui->cb_SetupAudioNotificationTextMessage->setChecked(as.getNotificationFlag(BlackSound::CNotificationSounds::NotificationTextMessagePrivate));
|
||||
this->ui->cb_SetupAudioNotificationVoiceRoom->setChecked(as.getNotificationFlag(BlackSound::CNotificationSounds::NotificationVoiceRoomJoined));
|
||||
this->ui->cb_SetupAudioNotificationTextMessage->setChecked(as.getNotificationFlag(CNotificationSounds::NotificationTextMessagePrivate));
|
||||
this->ui->cb_SetupAudioNotificationVoiceRoom->setChecked(as.getNotificationFlag(CNotificationSounds::NotificationVoiceRoomJoined));
|
||||
}
|
||||
|
||||
void CAudioSetupComponent::ps_onToggleNotificationSoundsVisibility(bool checked)
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
#define BLACKGUI_AUDIOSETUPCOMPONENT_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "enableforruntime.h"
|
||||
#include "blackgui/components/enableforruntime.h"
|
||||
#include "blackcore/settings/audio.h"
|
||||
#include "blackmisc/audio/audiodeviceinfolist.h"
|
||||
#include <QFrame>
|
||||
#include <QScopedPointer>
|
||||
@@ -41,18 +42,13 @@ namespace BlackGui
|
||||
//! Play notification sounds (at all)
|
||||
bool playNotificationSounds() const;
|
||||
|
||||
public slots:
|
||||
//! Reload settings
|
||||
void reloadSettings();
|
||||
|
||||
protected:
|
||||
//! \copydoc CRuntimeBasedComponent::runtimeHasBeenSet
|
||||
virtual void runtimeHasBeenSet() override;
|
||||
|
||||
private slots:
|
||||
|
||||
//! Settings have been changed
|
||||
void ps_changedSettings(uint typeValue);
|
||||
//! Reload settings
|
||||
void ps_reloadSettings();
|
||||
|
||||
/*!
|
||||
* \brief Audio device selected
|
||||
@@ -77,6 +73,8 @@ namespace BlackGui
|
||||
void initAudioDeviceLists();
|
||||
|
||||
QScopedPointer<Ui::CAudioSetupComponent> ui;
|
||||
BlackCore::CSetting<BlackCore::Settings::Audio::AudioSettings> m_audioSettings { this, &CAudioSetupComponent::ps_reloadSettings };
|
||||
|
||||
};
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include "blackcore/context_all_interfaces.h"
|
||||
#include <QWidget>
|
||||
|
||||
using namespace BlackMisc::Audio;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
@@ -91,18 +93,6 @@ namespace BlackGui
|
||||
return this->m_runtime->getIContextOwnAircraft();
|
||||
}
|
||||
|
||||
BlackCore::IContextSettings *CEnableForRuntime::getIContextSettings()
|
||||
{
|
||||
if (!this->m_runtime) return nullptr;
|
||||
return this->m_runtime->getIContextSettings();
|
||||
}
|
||||
|
||||
const BlackCore::IContextSettings *CEnableForRuntime::getIContextSettings() const
|
||||
{
|
||||
if (!this->m_runtime) return nullptr;
|
||||
return this->m_runtime->getIContextSettings();
|
||||
}
|
||||
|
||||
const BlackCore::IContextSimulator *CEnableForRuntime::getIContextSimulator() const
|
||||
{
|
||||
if (!this->m_runtime) return nullptr;
|
||||
@@ -115,7 +105,7 @@ namespace BlackGui
|
||||
return this->m_runtime->getIContextSimulator();
|
||||
}
|
||||
|
||||
void CEnableForRuntime::playNotifcationSound(BlackSound::CNotificationSounds::Notification notification) const
|
||||
void CEnableForRuntime::playNotifcationSound(CNotificationSounds::Notification notification) const
|
||||
{
|
||||
if (!this->getIContextAudio()) return;
|
||||
this->getIContextAudio()->playNotification(notification, true);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackcore/context_runtime.h"
|
||||
#include "blackmisc/notificationsounds.h"
|
||||
#include "blackmisc/audio/notificationsounds.h"
|
||||
#include <QTimer>
|
||||
|
||||
namespace BlackCore
|
||||
@@ -95,12 +95,6 @@ namespace BlackGui
|
||||
//! Context for own aircraft
|
||||
BlackCore::IContextOwnAircraft *getIContextOwnAircraft();
|
||||
|
||||
//! Context for settings
|
||||
BlackCore::IContextSettings *getIContextSettings();
|
||||
|
||||
//! Context for settings
|
||||
const BlackCore::IContextSettings *getIContextSettings() const;
|
||||
|
||||
//! Context for simulator
|
||||
const BlackCore::IContextSimulator *getIContextSimulator() const;
|
||||
|
||||
@@ -118,7 +112,7 @@ namespace BlackGui
|
||||
bool hasRemoteApplicationContext() const { return this->m_runtime->hasRemoteApplicationContext(); }
|
||||
|
||||
//! Play a given notification sound
|
||||
void playNotifcationSound(BlackSound::CNotificationSounds::Notification notification) const;
|
||||
void playNotifcationSound(BlackMisc::Audio::CNotificationSounds::Notification notification) const;
|
||||
|
||||
private:
|
||||
BlackCore::CRuntime *m_runtime;
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "logincomponent.h"
|
||||
#include "ui_logincomponent.h"
|
||||
#include "blackcore/context_network.h"
|
||||
#include "blackcore/context_settings.h"
|
||||
#include "blackcore/context_ownaircraft.h"
|
||||
#include "blackcore/context_audio.h"
|
||||
#include "blackcore/context_simulator.h"
|
||||
@@ -134,15 +133,13 @@ namespace BlackGui
|
||||
void CLoginComponent::runtimeHasBeenSet()
|
||||
{
|
||||
Q_ASSERT(getIContextNetwork());
|
||||
Q_ASSERT(getIContextSettings());
|
||||
connect(getIContextNetwork(), &IContextNetwork::webServiceDataRead, this, &CLoginComponent::ps_onWebServiceDataRead);
|
||||
connect(getIContextSettings(), &IContextSettings::changedSettings, this, &CLoginComponent::ps_onSettingsChanged);
|
||||
|
||||
// inital setup, if data already available
|
||||
ps_validateAircraftValues();
|
||||
ps_validateVatsimValues();
|
||||
ps_onWebServiceDataRead(CEntityFlags::VatsimDataFile, CEntityFlags::ReadFinished, -1);
|
||||
CServerList otherServers = this->m_trafficNetworkServers.get();
|
||||
CServerList otherServers(this->m_trafficNetworkServers.get());
|
||||
|
||||
// add a testserver when no servers can be loaded
|
||||
if (otherServers.isEmpty() && CProject::isRunningInBetaOrDeveloperEnvironment())
|
||||
@@ -454,10 +451,9 @@ namespace BlackGui
|
||||
return validVatsimId && validHomeAirport && validVatsimPassword && validRealUserName;
|
||||
}
|
||||
|
||||
void CLoginComponent::ps_onSettingsChanged(uint settingsType)
|
||||
void CLoginComponent::ps_reloadSettings()
|
||||
{
|
||||
if (settingsType != static_cast<uint>(IContextSettings::SettingsNetwork)) { return; }
|
||||
CServerList otherServers = this->m_trafficNetworkServers.get();
|
||||
CServerList otherServers(this->m_trafficNetworkServers.get());
|
||||
this->ui->cbp_OtherServers->setServers(otherServers);
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace BlackGui
|
||||
bool ps_validateVatsimValues();
|
||||
|
||||
//! Settings have been changed
|
||||
void ps_onSettingsChanged(uint settingsType);
|
||||
void ps_reloadSettings();
|
||||
|
||||
//! Logoff countdown
|
||||
void ps_logoffCountdown();
|
||||
@@ -85,7 +85,6 @@ namespace BlackGui
|
||||
void ps_reverseLookupModel();
|
||||
|
||||
private:
|
||||
|
||||
//! GUI aircraft values, formatted
|
||||
struct CGuiAircraftValues
|
||||
{
|
||||
@@ -148,7 +147,7 @@ namespace BlackGui
|
||||
QScopedPointer<Ui::CLoginComponent> ui;
|
||||
const int LogoffIntervalSeconds = 10;
|
||||
QTimer *m_logoffCountdownTimer { nullptr };
|
||||
BlackCore::CSetting<BlackCore::Settings::Network::TrafficServers> m_trafficNetworkServers { this };
|
||||
BlackCore::CSetting<BlackCore::Settings::Network::TrafficServers> m_trafficNetworkServers { this, &CLoginComponent::ps_reloadSettings };
|
||||
BlackCore::CData<BlackCore::Data::GlobalSetup> m_setup {this}; //!< setup cache
|
||||
};
|
||||
|
||||
|
||||
@@ -13,11 +13,9 @@
|
||||
#include "blackgui/stylesheetutility.h"
|
||||
#include "blackcore/dbus_server.h"
|
||||
#include "blackcore/context_network.h"
|
||||
#include "blackcore/context_settings.h"
|
||||
#include "blackcore/context_audio.h"
|
||||
#include "blackmisc/input/keyboardkeylist.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/settingsblackmiscclasses.h"
|
||||
#include <QColorDialog>
|
||||
|
||||
using namespace BlackCore;
|
||||
@@ -28,7 +26,6 @@ using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Audio;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Geo;
|
||||
using namespace BlackMisc::Settings;
|
||||
using namespace BlackMisc::Input;
|
||||
|
||||
namespace BlackGui
|
||||
@@ -71,17 +68,6 @@ namespace BlackGui
|
||||
return this->ui->hs_SettingsGuiUserRefreshTime->value();
|
||||
}
|
||||
|
||||
/*
|
||||
* Reload settings
|
||||
*/
|
||||
void CSettingsComponent::reloadSettings()
|
||||
{
|
||||
// reload components
|
||||
//! \todo Settings are loaded twice, this here is for init but each component also consumes the signal changed slot
|
||||
this->ui->comp_AudioSetup->reloadSettings();
|
||||
this->ui->comp_SettingsServersComponent->reloadSettings();
|
||||
}
|
||||
|
||||
/*
|
||||
* Set tab
|
||||
*/
|
||||
@@ -95,9 +81,6 @@ namespace BlackGui
|
||||
*/
|
||||
void CSettingsComponent::runtimeHasBeenSet()
|
||||
{
|
||||
Q_ASSERT_X(this->getIContextSettings(), Q_FUNC_INFO, "Missing settings");
|
||||
this->connect(this->getIContextSettings(), &IContextSettings::changedSettings, this, &CSettingsComponent::ps_changedSettings);
|
||||
|
||||
// Opacity, intervals
|
||||
this->connect(this->ui->hs_SettingsGuiOpacity, &QSlider::valueChanged, this, &CSettingsComponent::changedWindowsOpacity);
|
||||
this->connect(this->ui->hs_SettingsGuiAircraftRefreshTime, &QSlider::valueChanged, this, &CSettingsComponent::changedAircraftUpdateInterval);
|
||||
@@ -121,16 +104,6 @@ namespace BlackGui
|
||||
Q_UNUSED(connected);
|
||||
}
|
||||
|
||||
/*
|
||||
* Settings did change
|
||||
*/
|
||||
void CSettingsComponent::ps_changedSettings(uint typeValue)
|
||||
{
|
||||
IContextSettings::SettingsType type = static_cast<IContextSettings::SettingsType>(typeValue);
|
||||
this->reloadSettings();
|
||||
Q_UNUSED(type);
|
||||
}
|
||||
|
||||
/*
|
||||
* Font has been changed
|
||||
*/
|
||||
|
||||
@@ -26,7 +26,6 @@ namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
|
||||
//! Settings component
|
||||
class BLACKGUI_EXPORT CSettingsComponent :
|
||||
public QTabWidget,
|
||||
@@ -82,9 +81,6 @@ namespace BlackGui
|
||||
void changedUsersUpdateInterval(int seconds);
|
||||
|
||||
public slots:
|
||||
//! Reload settings
|
||||
void reloadSettings();
|
||||
|
||||
//! Set the tab
|
||||
void setSettingsTab(SettingTab tab);
|
||||
|
||||
@@ -93,10 +89,6 @@ namespace BlackGui
|
||||
virtual void runtimeHasBeenSet() override;
|
||||
|
||||
private slots:
|
||||
|
||||
//! Settings have been changed
|
||||
void ps_changedSettings(uint typeValue);
|
||||
|
||||
//! Font has been changed
|
||||
void ps_fontChanged();
|
||||
|
||||
|
||||
@@ -10,11 +10,9 @@
|
||||
#include "settingsnetworkserverscomponent.h"
|
||||
#include "ui_settingsnetworkserverscomponent.h"
|
||||
#include "blackcore/context_network.h"
|
||||
#include "blackcore/context_settings.h"
|
||||
#include "blackcore/setupreader.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackmisc/settingsblackmiscclasses.h"
|
||||
#include <QModelIndex>
|
||||
|
||||
using namespace BlackCore;
|
||||
@@ -24,7 +22,6 @@ using namespace BlackMisc;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Audio;
|
||||
using namespace BlackMisc::Settings;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
@@ -46,7 +43,7 @@ namespace BlackGui
|
||||
CSettingsNetworkServersComponent::~CSettingsNetworkServersComponent()
|
||||
{ }
|
||||
|
||||
void CSettingsNetworkServersComponent::reloadSettings()
|
||||
void CSettingsNetworkServersComponent::ps_reloadSettings()
|
||||
{
|
||||
CServerList serverList(m_trafficNetworkServers.get());
|
||||
|
||||
|
||||
@@ -39,11 +39,10 @@ namespace BlackGui
|
||||
//! Destructor
|
||||
~CSettingsNetworkServersComponent();
|
||||
|
||||
public slots:
|
||||
//! Reload settings
|
||||
void reloadSettings();
|
||||
|
||||
private slots:
|
||||
//! Reload settings
|
||||
void ps_reloadSettings();
|
||||
|
||||
//! Network server selected
|
||||
void ps_networkServerSelected(const QModelIndex &index);
|
||||
|
||||
@@ -52,7 +51,7 @@ namespace BlackGui
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CSettingsNetworkServersComponent> ui;
|
||||
BlackCore::CSetting<BlackCore::Settings::Network::TrafficServers> m_trafficNetworkServers { this };
|
||||
BlackCore::CSetting<BlackCore::Settings::Network::TrafficServers> m_trafficNetworkServers { this, &CSettingsNetworkServersComponent::ps_reloadSettings };
|
||||
BlackCore::CData<BlackCore::Data::GlobalSetup> m_setup {this}; //!< setup cache
|
||||
};
|
||||
} // ns
|
||||
|
||||
@@ -7,11 +7,9 @@
|
||||
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/variant.h"
|
||||
|
||||
#include <QComboBox>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Settings;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackMisc::Aviation;
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#include "simulatorcomponent.h"
|
||||
#include "ui_simulatorcomponent.h"
|
||||
#include "blackcore/context_settings.h"
|
||||
#include "blackcore/context_simulator.h"
|
||||
#include "blackcore/context_ownaircraft.h"
|
||||
#include "blackcore/simulator.h"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "ui_textmessagecomponent.h"
|
||||
#include "blackcore/context_audio.h"
|
||||
#include "blackmisc/network/user.h"
|
||||
#include "blackmisc/notificationsounds.h"
|
||||
#include "blackmisc/audio/notificationsounds.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/simplecommandparser.h"
|
||||
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
||||
@@ -24,9 +24,9 @@ using namespace BlackMisc;
|
||||
using namespace BlackGui;
|
||||
using namespace BlackGui::Views;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Audio;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Settings;
|
||||
using namespace BlackMisc::Simulation;
|
||||
|
||||
namespace BlackGui
|
||||
@@ -272,7 +272,7 @@ namespace BlackGui
|
||||
// sound
|
||||
if (this->getIContextAudio())
|
||||
{
|
||||
this->getIContextAudio()->playNotification(BlackSound::CNotificationSounds::NotificationTextMessagePrivate, true);
|
||||
this->getIContextAudio()->playNotification(CNotificationSounds::NotificationTextMessagePrivate, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,10 +11,9 @@
|
||||
#include "ui_voiceroomscomponent.h"
|
||||
#include "blackcore/context_audio.h"
|
||||
#include "blackcore/context_ownaircraft.h"
|
||||
#include "blackmisc/notificationsounds.h"
|
||||
#include "blackmisc/audio/notificationsounds.h"
|
||||
|
||||
using namespace BlackCore;
|
||||
using namespace BlackSound;
|
||||
using namespace BlackMisc::Audio;
|
||||
|
||||
namespace BlackGui
|
||||
|
||||
Reference in New Issue
Block a user