mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-08-07 01:55:53 +08:00
refactor: Read AFV URLs from bootstrap.json
This also removes the possibility to change the URL on the fly via the UI. Fixes #257
This commit is contained in:
@@ -66,5 +66,11 @@
|
||||
},
|
||||
"ssrEquipmentHelpUrl": {
|
||||
"url": "https://en.wikipedia.org/wiki/Equipment_codes#Surveillance_equipment_codes"
|
||||
},
|
||||
"afvApiServerUrl": {
|
||||
"url": "https://voice1.vatsim.net/"
|
||||
},
|
||||
"afvMapUrl": {
|
||||
"url": "https://afv-map.vatsim.net/"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,8 @@ namespace BlackCore::Afv::Model
|
||||
QEventLoop loop(sApp);
|
||||
connect(sApp->getNetworkAccessManager(), &QNetworkAccessManager::finished, &loop, &QEventLoop::quit);
|
||||
connect(sApp, &CApplication::aboutToShutdown, &loop, &QEventLoop::quit);
|
||||
QNetworkReply *reply = sApp->getNetworkAccessManager()->get(QNetworkRequest(QUrl("https://voice1.vatsim.net/api/v1/network/online/callsigns")));
|
||||
const QUrl url = sApp->getGlobalSetup().getAfvApiServerUrl().withAppendedPath("/api/v1/network/online/callsigns");
|
||||
QNetworkReply *reply = sApp->getNetworkAccessManager()->get(QNetworkRequest(url));
|
||||
while (reply && !reply->isFinished() && sApp && !sApp->isShuttingDown())
|
||||
{
|
||||
loop.exec();
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
|
||||
using namespace BlackConfig;
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Audio;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Geo;
|
||||
using namespace BlackMisc::Simulation;
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace BlackCore::Context
|
||||
|
||||
void CContextAudioBase::initVoiceClient()
|
||||
{
|
||||
if (m_voiceClient) { return; }
|
||||
if (m_voiceClient || !sApp) { return; }
|
||||
|
||||
const CAudioDeviceInfoList devices = CAudioDeviceInfoList::allDevices();
|
||||
if (devices != m_activeLocalDevices)
|
||||
@@ -179,9 +179,7 @@ namespace BlackCore::Context
|
||||
}
|
||||
#endif
|
||||
|
||||
m_voiceClient = new CAfvClient(CVoiceSetup().getAfvVoiceServerUrl(), this);
|
||||
const CVoiceSetup vs = m_voiceSettings.getThreadLocal();
|
||||
m_voiceClient->updateVoiceServerUrl(vs.getAfvVoiceServerUrl());
|
||||
m_voiceClient = new CAfvClient(sApp->getGlobalSetup().getAfvApiServerUrl().toQString(), this);
|
||||
|
||||
Q_ASSERT_X(m_voiceClient->thread() == qApp->thread(), Q_FUNC_INFO, "Should be in main thread");
|
||||
m_voiceClient->start(); // thread
|
||||
@@ -288,9 +286,6 @@ namespace BlackCore::Context
|
||||
return false;
|
||||
}
|
||||
|
||||
const CVoiceSetup vs = m_voiceSettings.getThreadLocal();
|
||||
m_voiceClient->updateVoiceServerUrl(vs.getAfvVoiceServerUrl());
|
||||
|
||||
const CUser connectedUser = this->getIContextNetwork()->getConnectedServer().getUser();
|
||||
const QString client = "swift " % BlackConfig::CBuildConfig::getShortVersionString();
|
||||
CCallsign cs = connectedUser.getCallsign();
|
||||
@@ -540,17 +535,6 @@ namespace BlackCore::Context
|
||||
return m_voiceClient->isLoopback();
|
||||
}
|
||||
|
||||
void CContextAudioBase::setVoiceSetup(const CVoiceSetup &setup)
|
||||
{
|
||||
// could be recycled for some AFV setup
|
||||
Q_UNUSED(setup)
|
||||
}
|
||||
|
||||
CVoiceSetup CContextAudioBase::getVoiceSetup() const
|
||||
{
|
||||
return CVoiceSetup();
|
||||
}
|
||||
|
||||
void CContextAudioBase::setVoiceTransmission(bool enable, PTTCOM com)
|
||||
{
|
||||
if (!m_voiceClient) { return; }
|
||||
@@ -582,12 +566,6 @@ namespace BlackCore::Context
|
||||
this->setComOutputVolume(CComSystem::Com2, s.getOutVolumeCom2());
|
||||
}
|
||||
|
||||
void CContextAudioBase::onChangedVoiceSettings()
|
||||
{
|
||||
const CVoiceSetup vs = m_voiceSettings.getThreadLocal();
|
||||
m_voiceClient->updateVoiceServerUrl(vs.getAfvVoiceServerUrl());
|
||||
}
|
||||
|
||||
void CContextAudioBase::audioIncreaseVolume(bool enabled)
|
||||
{
|
||||
if (!enabled) { return; }
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "blackmisc/audio/audiodeviceinfolist.h"
|
||||
#include "blackmisc/audio/notificationsounds.h"
|
||||
#include "blackmisc/audio/audiosettings.h"
|
||||
#include "blackmisc/audio/voicesetup.h"
|
||||
#include "blackmisc/audio/ptt.h"
|
||||
#include "blackmisc/aviation/callsignset.h"
|
||||
#include "blackmisc/aviation/comsystem.h"
|
||||
@@ -196,12 +195,6 @@ namespace BlackCore
|
||||
bool isAudioLoopbackEnabled() const;
|
||||
//! @}
|
||||
|
||||
//! @{
|
||||
//! Voice setup
|
||||
BlackMisc::Audio::CVoiceSetup getVoiceSetup() const;
|
||||
void setVoiceSetup(const BlackMisc::Audio::CVoiceSetup &setup);
|
||||
//! @}
|
||||
|
||||
//! Info string about audio
|
||||
QString audioRunsWhereInfo() const;
|
||||
|
||||
@@ -328,9 +321,6 @@ namespace BlackCore
|
||||
//! Changed audio settings
|
||||
void onChangedAudioSettings();
|
||||
|
||||
//! Changed voice settings
|
||||
void onChangedVoiceSettings();
|
||||
|
||||
//! @{
|
||||
//! Audio increase/decrease volume
|
||||
void audioIncreaseVolume(bool enabled);
|
||||
@@ -366,7 +356,6 @@ namespace BlackCore
|
||||
|
||||
// settings
|
||||
BlackMisc::CSetting<BlackMisc::Audio::TSettings> m_audioSettings { this, &CContextAudioBase::onChangedAudioSettings };
|
||||
BlackMisc::CSetting<BlackMisc::Audio::TVoiceSetup> m_voiceSettings { this, &CContextAudioBase::onChangedVoiceSettings };
|
||||
|
||||
BlackMisc::CSetting<Audio::TInputDevice> m_inputDeviceSetting { this, &CContextAudioBase::changeDeviceSettings };
|
||||
BlackMisc::CSetting<Audio::TOutputDevice> m_outputDeviceSetting { this, &CContextAudioBase::changeDeviceSettings };
|
||||
|
||||
@@ -42,7 +42,6 @@ using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Geo;
|
||||
using namespace BlackMisc::Audio;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackMisc::Weather;
|
||||
using namespace BlackCore::Fsd;
|
||||
|
||||
@@ -16,7 +16,6 @@ using namespace BlackMisc;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Audio;
|
||||
using namespace BlackMisc::Weather;
|
||||
using namespace BlackMisc::Simulation;
|
||||
|
||||
|
||||
@@ -192,6 +192,10 @@ namespace BlackCore::Data
|
||||
|
||||
% u"Predefined servers: " % getPredefinedServers().toQString(i18n) % separator
|
||||
|
||||
% u"AFV voice server URL: " % getAfvApiServerUrl().toQString(i18n) % separator
|
||||
|
||||
% u"AFV map URL: " % getAfvMapUrl().toQString(i18n) % separator
|
||||
|
||||
% u"Crash report server: " % getCrashReportServerUrl().toQString(i18n);
|
||||
|
||||
return s;
|
||||
@@ -220,6 +224,8 @@ namespace BlackCore::Data
|
||||
case IndexCrashReportServerUrl: return QVariant::fromValue(m_crashReportServerUrl);
|
||||
case IndexMappingMinimumVersion: return QVariant::fromValue(m_mappingMinimumVersion);
|
||||
case IndexPredefinedServers: return QVariant::fromValue(m_predefinedServers);
|
||||
case IndexAfvApiServerUrl: return QVariant::fromValue(m_afvApiServerUrl);
|
||||
case IndexAfvMapUrl: return QVariant::fromValue(m_afvMapUrl);
|
||||
default: return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
@@ -249,6 +255,8 @@ namespace BlackCore::Data
|
||||
case IndexCrashReportServerUrl: m_crashReportServerUrl = variant.value<CUrl>(); break;
|
||||
case IndexMappingMinimumVersion: m_mappingMinimumVersion = variant.toString(); break;
|
||||
case IndexPredefinedServers: m_predefinedServers = variant.value<CServerList>(); break;
|
||||
case IndexAfvApiServerUrl: m_afvApiServerUrl = variant.value<CUrl>(); break;
|
||||
case IndexAfvMapUrl: m_afvMapUrl = variant.value<CUrl>(); break;
|
||||
default: CValueObject::setPropertyByIndex(index, variant); break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,9 @@ namespace BlackCore::Data
|
||||
IndexCrashReportServerUrl,
|
||||
IndexSharedUrls,
|
||||
IndexMappingMinimumVersion,
|
||||
IndexPredefinedServers
|
||||
IndexPredefinedServers,
|
||||
IndexAfvApiServerUrl,
|
||||
IndexAfvMapUrl
|
||||
};
|
||||
|
||||
//! Add info when pinging
|
||||
@@ -179,6 +181,12 @@ namespace BlackCore::Data
|
||||
//! SSR equipment code help URL
|
||||
BlackMisc::Network::CUrl getSsrEquipmentHelpUrl() const { return m_ssrEquipmentHelpUrl; }
|
||||
|
||||
//! AFV voice server URL
|
||||
BlackMisc::Network::CUrl getAfvApiServerUrl() const { return m_afvApiServerUrl; }
|
||||
|
||||
//! AFV map URL
|
||||
BlackMisc::Network::CUrl getAfvMapUrl() const { return m_afvMapUrl; }
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
@@ -216,6 +224,8 @@ namespace BlackCore::Data
|
||||
BlackMisc::Network::CUrl m_ncepGlobalForecastSystemUrl25; //!< NCEP GFS url 0.25 degree resolution
|
||||
BlackMisc::Network::CUrl m_comNavEquipmentHelpUrl; //!< Help URL for COM/NAV equipment codes
|
||||
BlackMisc::Network::CUrl m_ssrEquipmentHelpUrl; //!< Help URL for SSR equipment codes
|
||||
BlackMisc::Network::CUrl m_afvApiServerUrl; //!< AFV API server URL
|
||||
BlackMisc::Network::CUrl m_afvMapUrl; //!< AFV map URL
|
||||
bool m_dbDebugFlag = false; //!< can trigger DEBUG on the server, so you need to know what you are doing. Only works with CBuildConfig::isLocalDeveloperDebugBuild
|
||||
|
||||
BLACK_METACLASS(
|
||||
@@ -238,7 +248,9 @@ namespace BlackCore::Data
|
||||
BLACK_METAMEMBER(ncepGlobalForecastSystemUrl25, 0, RequiredForJson),
|
||||
BLACK_METAMEMBER(comNavEquipmentHelpUrl, 0, RequiredForJson),
|
||||
BLACK_METAMEMBER(ssrEquipmentHelpUrl, 0, RequiredForJson),
|
||||
BLACK_METAMEMBER(dbDebugFlag, 0, RequiredForJson)
|
||||
BLACK_METAMEMBER(dbDebugFlag, 0, RequiredForJson),
|
||||
BLACK_METAMEMBER(afvApiServerUrl, 0, RequiredForJson),
|
||||
BLACK_METAMEMBER(afvMapUrl, 0, RequiredForJson)
|
||||
);
|
||||
};
|
||||
} // ns
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Audio;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Geo;
|
||||
using namespace BlackMisc::Simulation;
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Audio;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Geo;
|
||||
using namespace BlackMisc::Simulation;
|
||||
@@ -142,7 +141,7 @@ namespace BlackCore::Vatsim
|
||||
{
|
||||
return CServer(server["name"].toString(), server["location"].toString(),
|
||||
server["hostname_or_ip"].toString(), 6809, CUser("id", "real name", "email", "password"),
|
||||
CFsdSetup::vatsimStandard(), CVoiceSetup::vatsimStandard(), CEcosystem::VATSIM,
|
||||
CFsdSetup::vatsimStandard(), CEcosystem::VATSIM,
|
||||
CServer::FSDServerVatsim, server["clients_connection_allowed"].toInt());
|
||||
}
|
||||
|
||||
|
||||
@@ -227,7 +227,6 @@ add_library(gui SHARED
|
||||
editors/liveryform.h
|
||||
editors/situationform.h
|
||||
editors/aircraftmodelform.h
|
||||
editors/voicesetupform.h
|
||||
editors/fsdsetupform.ui
|
||||
editors/aircraftpartsform.cpp
|
||||
editors/ownmodelsetform.h
|
||||
@@ -254,7 +253,6 @@ add_library(gui SHARED
|
||||
editors/modelmappingform.cpp
|
||||
editors/distributorform.ui
|
||||
editors/aircrafticaoform.h
|
||||
editors/voicesetupform.ui
|
||||
editors/aircraftpartsform.ui
|
||||
editors/serverform.cpp
|
||||
editors/modelmappingmodifyform.ui
|
||||
@@ -279,7 +277,6 @@ add_library(gui SHARED
|
||||
editors/interpolationsetupform.cpp
|
||||
editors/aircrafticaoform.ui
|
||||
editors/pbhsform.h
|
||||
editors/voicesetupform.cpp
|
||||
editors/aircrafticaoform.cpp
|
||||
editors/cockpitcomform.h
|
||||
blackguiexport.h
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace BlackGui::Components
|
||||
this->setForceSmall(true);
|
||||
this->showKillButton(false);
|
||||
|
||||
// override details/voice
|
||||
// override details
|
||||
ui->comp_NetworkDetails->setAlwaysAllowOverride(true);
|
||||
|
||||
// Stored data
|
||||
@@ -164,12 +164,6 @@ namespace BlackGui::Components
|
||||
currentServer.setFsdSetup(fsd);
|
||||
}
|
||||
|
||||
if (ui->comp_NetworkDetails->isVoiceSetupOverrideEnabled())
|
||||
{
|
||||
const CVoiceSetup voice = ui->comp_NetworkDetails->getVoiceSetup();
|
||||
currentServer.setVoiceSetup(voice);
|
||||
}
|
||||
|
||||
// update for own aircraft context
|
||||
sGui->getIContextOwnAircraft()->updateOwnAircraftPilot(currentServer.getUser());
|
||||
|
||||
@@ -196,11 +190,6 @@ namespace BlackGui::Components
|
||||
}
|
||||
|
||||
// Login
|
||||
if (sGui && sGui->getCContextAudioBase())
|
||||
{
|
||||
sGui->getCContextAudioBase()->setVoiceSetup(currentServer.getVoiceSetup());
|
||||
}
|
||||
|
||||
msg = sGui->getIContextNetwork()->connectToNetwork(currentServer, values.ownLiverySend, values.useLivery, values.ownAircraftModelStringSend, values.useModelString, partnerCs, mode);
|
||||
if (msg.isSuccess())
|
||||
{
|
||||
|
||||
@@ -95,10 +95,6 @@ namespace BlackGui::Components
|
||||
ui->form_FsdDetails->setFsdSetupEnabled(false);
|
||||
ui->form_FsdDetails->setAlwaysAllowOverride(true);
|
||||
|
||||
ui->form_Voice->showEnableInfo(true);
|
||||
ui->form_Voice->setVoiceSetupEnabled(false);
|
||||
ui->form_Voice->setAlwaysAllowOverride(true);
|
||||
|
||||
ui->lblp_AircraftCombinedType->setToolTips("ok", "wrong");
|
||||
ui->lblp_AirlineIcao->setToolTips("ok", "wrong");
|
||||
ui->lblp_AircraftIcao->setToolTips("ok", "wrong");
|
||||
@@ -273,12 +269,6 @@ namespace BlackGui::Components
|
||||
currentServer.setFsdSetup(fsd);
|
||||
}
|
||||
|
||||
if (ui->form_Voice->isVoiceSetupEnabled())
|
||||
{
|
||||
const CVoiceSetup voice = ui->form_Voice->getValue();
|
||||
currentServer.setVoiceSetup(voice);
|
||||
}
|
||||
|
||||
ui->frp_CurrentServer->setServer(currentServer);
|
||||
sGui->getIContextOwnAircraft()->updateOwnAircraftPilot(currentServer.getUser());
|
||||
|
||||
@@ -286,11 +276,6 @@ namespace BlackGui::Components
|
||||
ownAircraft = sGui->getIContextOwnAircraft()->getOwnAircraft();
|
||||
|
||||
// Login
|
||||
if (sGui->getCContextAudioBase())
|
||||
{
|
||||
sGui->getCContextAudioBase()->setVoiceSetup(currentServer.getVoiceSetup());
|
||||
}
|
||||
|
||||
msg = sGui->getIContextNetwork()->connectToNetwork(currentServer, {}, true, {}, true, {}, mode);
|
||||
if (msg.isSuccess())
|
||||
{
|
||||
@@ -460,7 +445,6 @@ namespace BlackGui::Components
|
||||
|
||||
// only override if not yet enabled
|
||||
if (!ui->form_FsdDetails->isFsdSetupEnabled()) { ui->form_FsdDetails->setValue(server.getFsdSetup()); }
|
||||
if (!ui->form_Voice->isVoiceSetupEnabled()) { ui->form_Voice->setValue(server.getVoiceSetup()); }
|
||||
|
||||
ui->tw_Network->setVisible(showNetwork);
|
||||
ui->tw_Details->setMinimumHeight(showNetwork ? 0 : 125);
|
||||
|
||||
@@ -314,35 +314,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tb_Voice">
|
||||
<attribute name="title">
|
||||
<string>Voice</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="vl_Voice">
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item alignment="Qt::AlignTop">
|
||||
<widget class="BlackGui::Editors::CVoiceSetupForm" name="form_Voice">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tb_MatchingLog">
|
||||
<attribute name="title">
|
||||
<string>Matching log</string>
|
||||
@@ -883,12 +854,6 @@
|
||||
<header>blackgui/editors/fsdsetupform.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Editors::CVoiceSetupForm</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/editors/voicesetupform.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CServerListSelector</class>
|
||||
<extends>QComboBox</extends>
|
||||
|
||||
@@ -46,9 +46,6 @@ namespace BlackGui::Components
|
||||
ui->form_FsdDetails->showEnableInfo(true);
|
||||
ui->form_FsdDetails->setFsdSetupEnabled(false);
|
||||
ui->form_FsdDetails->setReadOnly(false);
|
||||
ui->form_Voice->showEnableInfo(true);
|
||||
ui->form_Voice->setVoiceSetupEnabled(false);
|
||||
ui->form_Voice->setReadOnly(false);
|
||||
|
||||
constexpr int MaxLength = 10;
|
||||
constexpr int MinLength = 0;
|
||||
@@ -94,16 +91,6 @@ namespace BlackGui::Components
|
||||
return ui->tw_Details->currentWidget() == ui->tb_OtherServers;
|
||||
}
|
||||
|
||||
CVoiceSetup CNetworkDetailsComponent::getVoiceSetup() const
|
||||
{
|
||||
return ui->form_Voice->getValue();
|
||||
}
|
||||
|
||||
bool CNetworkDetailsComponent::isVoiceSetupOverrideEnabled() const
|
||||
{
|
||||
return ui->form_Voice->isVoiceSetupEnabled();
|
||||
}
|
||||
|
||||
CFsdSetup CNetworkDetailsComponent::getFsdSetup() const
|
||||
{
|
||||
return ui->form_FsdDetails->getValue();
|
||||
@@ -112,7 +99,6 @@ namespace BlackGui::Components
|
||||
void CNetworkDetailsComponent::setAlwaysAllowOverride(bool allow)
|
||||
{
|
||||
ui->form_FsdDetails->setAlwaysAllowOverride(allow);
|
||||
ui->form_Voice->setAlwaysAllowOverride(allow);
|
||||
}
|
||||
|
||||
bool CNetworkDetailsComponent::isFsdSetupOverrideEnabled() const
|
||||
@@ -139,7 +125,6 @@ namespace BlackGui::Components
|
||||
|
||||
// only override if not yet enabled
|
||||
if (!ui->form_FsdDetails->isFsdSetupEnabled()) { ui->form_FsdDetails->setValue(server.getFsdSetup()); }
|
||||
if (!ui->form_Voice->isVoiceSetupEnabled()) { ui->form_Voice->setValue(server.getVoiceSetup()); }
|
||||
}
|
||||
|
||||
void CNetworkDetailsComponent::onOverrideCredentialsToPilot()
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "blackmisc/network/data/lastserver.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
#include "blackmisc/network/fsdsetup.h"
|
||||
#include "blackmisc/audio/voicesetup.h"
|
||||
#include "blackmisc/settingscache.h"
|
||||
#include "blackmisc/datacache.h"
|
||||
#include "blackmisc/network/connectionstatus.h"
|
||||
@@ -49,7 +48,6 @@ namespace BlackGui::Components
|
||||
enum Details
|
||||
{
|
||||
DetailsServer,
|
||||
DetailsVoice,
|
||||
DetailsBack
|
||||
};
|
||||
|
||||
@@ -68,12 +66,6 @@ namespace BlackGui::Components
|
||||
//! Specific setup enabled?
|
||||
bool isFsdSetupOverrideEnabled() const;
|
||||
|
||||
//! Voice setup
|
||||
BlackMisc::Audio::CVoiceSetup getVoiceSetup() const;
|
||||
|
||||
//! Specific setup enabled?
|
||||
bool isVoiceSetupOverrideEnabled() const;
|
||||
|
||||
//! Login mode
|
||||
BlackMisc::Network::CLoginMode getLoginMode() const;
|
||||
|
||||
|
||||
@@ -333,35 +333,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tb_Voice">
|
||||
<attribute name="title">
|
||||
<string>Voice</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="vl_Voice">
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item alignment="Qt::AlignLeft|Qt::AlignTop">
|
||||
<widget class="BlackGui::Editors::CVoiceSetupForm" name="form_Voice">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tb_BackToServer">
|
||||
<attribute name="icon">
|
||||
<iconset resource="../../blackmisc/blackmisc.qrc">
|
||||
@@ -395,12 +366,6 @@
|
||||
<header>blackgui/editors/fsdsetupform.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Editors::CVoiceSetupForm</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/editors/voicesetupform.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CServerListSelector</class>
|
||||
<extends>QComboBox</extends>
|
||||
|
||||
@@ -44,7 +44,6 @@ namespace BlackGui::Editors
|
||||
ui->le_Address->setText(server.getAddress());
|
||||
ui->le_Port->setText(QString::number(server.getPort()));
|
||||
ui->form_ServerFsd->setValue(server.getFsdSetup());
|
||||
ui->form_Voice->setValue(server.getVoiceSetup());
|
||||
}
|
||||
|
||||
CServer CServerForm::getServer() const
|
||||
@@ -55,14 +54,13 @@ namespace BlackGui::Editors
|
||||
QString(),
|
||||
ui->le_Password->text().trimmed());
|
||||
const CFsdSetup fsdSetup(ui->form_ServerFsd->getValue());
|
||||
const CVoiceSetup voiceSetup(ui->form_Voice->getValue());
|
||||
const CServer server(
|
||||
ui->le_Name->text().trimmed().simplified(),
|
||||
ui->le_Description->text().trimmed().simplified(),
|
||||
ui->le_Address->text().trimmed(),
|
||||
ui->le_Port->text().trimmed().toInt(),
|
||||
user,
|
||||
fsdSetup, voiceSetup,
|
||||
fsdSetup,
|
||||
ui->cbp_Ecosystem->getSelectedEcosystem(),
|
||||
this->getServerType(),
|
||||
true);
|
||||
@@ -82,7 +80,6 @@ namespace BlackGui::Editors
|
||||
void CServerForm::setReadOnly(bool readOnly)
|
||||
{
|
||||
ui->form_ServerFsd->setReadOnly(readOnly);
|
||||
ui->form_Voice->setReadOnly(readOnly);
|
||||
|
||||
ui->le_NetworkId->setReadOnly(readOnly);
|
||||
ui->le_RealName->setReadOnly(readOnly);
|
||||
|
||||
@@ -318,23 +318,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tb_ServerVoicce">
|
||||
<attribute name="title">
|
||||
<string>Voice</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="vl_VoiceSetup">
|
||||
<item alignment="Qt::AlignTop">
|
||||
<widget class="BlackGui::Editors::CVoiceSetupForm" name="form_Voice">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -346,12 +329,6 @@
|
||||
<header>blackgui/editors/fsdsetupform.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Editors::CVoiceSetupForm</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/editors/voicesetupform.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::CEcosystemComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright (C) 2018 swift Project Community / Contributors
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||
|
||||
#include "voicesetupform.h"
|
||||
#include "ui_voicesetupform.h"
|
||||
#include <QIntValidator>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Audio;
|
||||
using namespace BlackMisc::Network;
|
||||
|
||||
namespace BlackGui::Editors
|
||||
{
|
||||
CVoiceSetupForm::CVoiceSetupForm(QWidget *parent) : CForm(parent),
|
||||
ui(new Ui::CVoiceSetupForm)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->cb_Override->setChecked(true);
|
||||
this->resetToDefaultValues();
|
||||
connect(ui->cb_Override, &QCheckBox::toggled, this, &CVoiceSetupForm::enabledToggled, Qt::QueuedConnection);
|
||||
connect(ui->pb_SetDefaults, &QPushButton::clicked, this, &CVoiceSetupForm::resetToDefaultValues);
|
||||
}
|
||||
|
||||
CVoiceSetupForm::~CVoiceSetupForm()
|
||||
{}
|
||||
|
||||
CVoiceSetup CVoiceSetupForm::getValue() const
|
||||
{
|
||||
const CVoiceSetup s(ui->le_AfvVoiceServerUrl->text(), ui->le_AfvMapUrl->text());
|
||||
return s;
|
||||
}
|
||||
|
||||
const CVoiceSetup &CVoiceSetupForm::getDisabledValue() const
|
||||
{
|
||||
static const CVoiceSetup s;
|
||||
return s;
|
||||
}
|
||||
|
||||
void CVoiceSetupForm::setValue(const CVoiceSetup &setup)
|
||||
{
|
||||
ui->le_AfvVoiceServerUrl->setText(setup.getAfvVoiceServerUrl());
|
||||
ui->le_AfvMapUrl->setText(setup.getAfvMapUrl());
|
||||
}
|
||||
|
||||
bool CVoiceSetupForm::isVoiceSetupEnabled() const
|
||||
{
|
||||
return ui->cb_Override->isChecked();
|
||||
}
|
||||
|
||||
void CVoiceSetupForm::setVoiceSetupEnabled(bool enabled)
|
||||
{
|
||||
ui->cb_Override->setChecked(enabled);
|
||||
}
|
||||
|
||||
void CVoiceSetupForm::setAlwaysAllowOverride(bool allow)
|
||||
{
|
||||
m_alwaysAllowOverride = allow;
|
||||
if (allow)
|
||||
{
|
||||
ui->cb_Override->setEnabled(true);
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_Override, false);
|
||||
}
|
||||
}
|
||||
|
||||
void CVoiceSetupForm::showEnableInfo(bool visible)
|
||||
{
|
||||
m_visibleEnableInfo = visible;
|
||||
this->visibleEnableInfo(visible);
|
||||
}
|
||||
|
||||
void CVoiceSetupForm::setReadOnly(bool readonly)
|
||||
{
|
||||
ui->pb_SetDefaults->setEnabled(!readonly);
|
||||
ui->le_AfvVoiceServerUrl->setReadOnly(readonly);
|
||||
ui->le_AfvMapUrl->setReadOnly(readonly);
|
||||
CGuiUtility::checkBoxesReadOnly(this, readonly);
|
||||
if (m_alwaysAllowOverride)
|
||||
{
|
||||
ui->cb_Override->setEnabled(true);
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_Override, false);
|
||||
}
|
||||
|
||||
/**
|
||||
if (readonly && ui->cb_Override->isChecked())
|
||||
{
|
||||
// this is no value which will be stored
|
||||
ui->cb_Override->setChecked(false);
|
||||
}
|
||||
**/
|
||||
|
||||
this->forceStyleSheetUpdate();
|
||||
}
|
||||
|
||||
CStatusMessageList CVoiceSetupForm::validate(bool nested) const
|
||||
{
|
||||
Q_UNUSED(nested)
|
||||
const CVoiceSetup val(this->getValue());
|
||||
CStatusMessageList msgs(val.validate());
|
||||
if (this->isReadOnly())
|
||||
{
|
||||
// in readonly I cannot change the data anyway, so skip warnings
|
||||
msgs.removeWarningsAndBelow();
|
||||
}
|
||||
return msgs;
|
||||
}
|
||||
|
||||
void CVoiceSetupForm::enabledToggled(bool enabled)
|
||||
{
|
||||
Q_UNUSED(enabled)
|
||||
this->setReadOnly(!enabled);
|
||||
}
|
||||
|
||||
void CVoiceSetupForm::visibleEnableInfo(bool visible)
|
||||
{
|
||||
ui->cb_Override->setVisible(visible);
|
||||
ui->lbl_VoiceSetup->setVisible(visible);
|
||||
ui->pb_SetDefaults->setVisible(visible);
|
||||
}
|
||||
|
||||
void CVoiceSetupForm::resetToDefaultValues()
|
||||
{
|
||||
CVoiceSetup s;
|
||||
this->setValue(s);
|
||||
}
|
||||
} // ns
|
||||
@@ -1,76 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright (C) 2018 swift Project Community / Contributors
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKGUI_COMPONENTS_VOICESETUPFORM_H
|
||||
#define BLACKGUI_COMPONENTS_VOICESETUPFORM_H
|
||||
|
||||
#include "blackmisc/audio/voicesetup.h"
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
#include "blackgui/editors/form.h"
|
||||
#include <QFrame>
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class CVoiceSetupForm;
|
||||
}
|
||||
namespace BlackGui::Editors
|
||||
{
|
||||
//! Voice form
|
||||
class CVoiceSetupForm : public CForm
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Ctor
|
||||
explicit CVoiceSetupForm(QWidget *parent = nullptr);
|
||||
|
||||
//! Dtor
|
||||
virtual ~CVoiceSetupForm() override;
|
||||
|
||||
//! Voice setup from GUI
|
||||
BlackMisc::Audio::CVoiceSetup getValue() const;
|
||||
|
||||
//! Voice setup when disabled
|
||||
const BlackMisc::Audio::CVoiceSetup &getDisabledValue() const;
|
||||
|
||||
//! Set to GUI
|
||||
void setValue(const BlackMisc::Audio::CVoiceSetup &setup);
|
||||
|
||||
//! Enabled?
|
||||
bool isVoiceSetupEnabled() const;
|
||||
|
||||
//! Set enabled / disabled
|
||||
void setVoiceSetupEnabled(bool enabled);
|
||||
|
||||
//! Allow override even in read only mode
|
||||
void setAlwaysAllowOverride(bool allow);
|
||||
|
||||
//! Show the enable info
|
||||
void showEnableInfo(bool visible);
|
||||
|
||||
//! Set default values
|
||||
void resetToDefaultValues();
|
||||
|
||||
//! \name Form class implementations
|
||||
//! @{
|
||||
virtual void setReadOnly(bool readonly) override;
|
||||
virtual BlackMisc::CStatusMessageList validate(bool nested = false) const override;
|
||||
//! @}
|
||||
|
||||
private:
|
||||
//! Enable / disable
|
||||
void enabledToggled(bool enabled);
|
||||
|
||||
//! Show / hide visible "enable" info
|
||||
void visibleEnableInfo(bool visible);
|
||||
|
||||
QScopedPointer<Ui::CVoiceSetupForm> ui;
|
||||
bool m_alwaysAllowOverride = false;
|
||||
bool m_visibleEnableInfo = true;
|
||||
};
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
@@ -1,75 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CVoiceSetupForm</class>
|
||||
<widget class="QFrame" name="CVoiceSetupForm">
|
||||
<property name="windowTitle">
|
||||
<string>AfV voice setup</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gl_VoiceSetup" columnstretch="1,1,1">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pb_SetDefaults">
|
||||
<property name="text">
|
||||
<string>set defaults</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="cb_Override">
|
||||
<property name="text">
|
||||
<string>override</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbl_AfvVoiceServerUrl">
|
||||
<property name="text">
|
||||
<string>AfV voice server URL</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="le_AfvVoiceServerUrl"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_VoiceSetup">
|
||||
<property name="text">
|
||||
<string>Voice setup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lbl_AfvMapUrl">
|
||||
<property name="text">
|
||||
<string>AfV map URL</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="le_AfvMapUrl"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>cb_Override</tabstop>
|
||||
<tabstop>pb_SetDefaults</tabstop>
|
||||
<tabstop>le_AfvVoiceServerUrl</tabstop>
|
||||
<tabstop>le_AfvMapUrl</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -18,8 +18,6 @@ add_library(misc SHARED
|
||||
audio/ptt.h
|
||||
audio/registermetadataaudio.cpp
|
||||
audio/registermetadataaudio.h
|
||||
audio/voicesetup.cpp
|
||||
audio/voicesetup.h
|
||||
|
||||
# Aviation
|
||||
aviation/aircraftcategory.cpp
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "blackmisc/audio/audiodeviceinfo.h"
|
||||
#include "blackmisc/audio/audiodeviceinfolist.h"
|
||||
#include "blackmisc/audio/audiosettings.h"
|
||||
#include "blackmisc/audio/voicesetup.h"
|
||||
|
||||
#include "blackmisc/audio/ptt.h"
|
||||
#include <QDBusMetaType>
|
||||
@@ -22,7 +21,6 @@ namespace BlackMisc
|
||||
CAudioDeviceInfo::registerMetadata();
|
||||
CAudioDeviceInfoList::registerMetadata();
|
||||
CSettings::registerMetadata();
|
||||
CVoiceSetup::registerMetadata();
|
||||
|
||||
// ENUMs
|
||||
qDBusRegisterMetaType<PTTCOM>();
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright (C) 2018 swift Project Community / Contributors
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||
|
||||
#include "blackmisc/audio/voicesetup.h"
|
||||
#include "blackmisc/logcategories.h"
|
||||
#include "blackmisc/stringutils.h"
|
||||
#include "blackmisc/verify.h"
|
||||
|
||||
#include <Qt>
|
||||
#include <QtGlobal>
|
||||
|
||||
BLACK_DEFINE_VALUEOBJECT_MIXINS(BlackMisc::Audio, CVoiceSetup)
|
||||
|
||||
namespace BlackMisc::Audio
|
||||
{
|
||||
QString CVoiceSetup::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n)
|
||||
return QStringLiteral("Port: %1").arg(getAfvVoiceServerUrl());
|
||||
}
|
||||
|
||||
CStatusMessageList CVoiceSetup::validate() const
|
||||
{
|
||||
static const CLogCategoryList cats(CLogCategoryList(this).withValidation());
|
||||
CStatusMessageList msgs;
|
||||
if (this->getAfvVoiceServerUrl().isEmpty()) { msgs.push_back(CStatusMessage(CStatusMessage::SeverityError, u"Invalid voice server url")); }
|
||||
if (this->getAfvMapUrl().isEmpty()) { msgs.push_back(CStatusMessage(CStatusMessage::SeverityError, u"Invalid voice server url")); }
|
||||
msgs.addCategories(cats);
|
||||
return msgs;
|
||||
}
|
||||
|
||||
const CVoiceSetup &CVoiceSetup::vatsimStandard()
|
||||
{
|
||||
static const CVoiceSetup s;
|
||||
return s;
|
||||
}
|
||||
|
||||
CVoiceSetup::CVoiceSetup(const QString &afvVoiceServerUrl, const QString &afvMapUrl) : m_afvVoiceServerUrl(afvVoiceServerUrl), m_afvMapUrl(afvMapUrl)
|
||||
{}
|
||||
|
||||
QVariant CVoiceSetup::propertyByIndex(BlackMisc::CPropertyIndexRef index) const
|
||||
{
|
||||
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexAfvVoiceServerUrl: return QVariant::fromValue(m_afvVoiceServerUrl);
|
||||
case IndexAfvMapUrl: return QVariant::fromValue(m_afvMapUrl);
|
||||
default: return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
void CVoiceSetup::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
|
||||
{
|
||||
if (index.isMyself())
|
||||
{
|
||||
(*this) = variant.value<CVoiceSetup>();
|
||||
return;
|
||||
}
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexAfvVoiceServerUrl: m_afvVoiceServerUrl = variant.toString(); break;
|
||||
case IndexAfvMapUrl: m_afvMapUrl = variant.toString(); break;
|
||||
default:
|
||||
CValueObject::setPropertyByIndex(index, variant);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int CVoiceSetup::comparePropertyByIndex(CPropertyIndexRef index, const CVoiceSetup &compareValue) const
|
||||
{
|
||||
if (index.isMyself()) { return this->convertToQString(true).compare(compareValue.convertToQString()); }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexAfvVoiceServerUrl: return m_afvVoiceServerUrl.compare(compareValue.m_afvVoiceServerUrl, Qt::CaseInsensitive);
|
||||
case IndexAfvMapUrl: return m_afvMapUrl.compare(compareValue.m_afvMapUrl, Qt::CaseInsensitive);
|
||||
default: break;
|
||||
}
|
||||
BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable("No comparison for index " + index.toQString()));
|
||||
return 0;
|
||||
}
|
||||
} // namespace
|
||||
@@ -1,103 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright (C) 2018 swift Project Community / Contributors
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_AUDIO_VOICESETUP_H
|
||||
#define BLACKMISC_AUDIO_VOICESETUP_H
|
||||
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
#include "blackmisc/settingscache.h"
|
||||
#include "blackmisc/valueobject.h"
|
||||
#include "blackmisc/metaclass.h"
|
||||
#include "blackmisc/propertyindexref.h"
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
|
||||
#include <QMetaType>
|
||||
#include <QString>
|
||||
|
||||
BLACK_DECLARE_VALUEOBJECT_MIXINS(BlackMisc::Audio, CVoiceSetup)
|
||||
|
||||
namespace BlackMisc::Audio
|
||||
{
|
||||
//! Value object for a voice setup
|
||||
//! \deprecated
|
||||
class BLACKMISC_EXPORT CVoiceSetup : public CValueObject<CVoiceSetup>
|
||||
{
|
||||
public:
|
||||
//! Properties by index
|
||||
enum ColumnIndex
|
||||
{
|
||||
IndexAfvVoiceServerUrl = CPropertyIndexRef::GlobalIndexCVoiceSetup,
|
||||
IndexAfvMapUrl
|
||||
};
|
||||
|
||||
//! Default constructor.
|
||||
CVoiceSetup() = default;
|
||||
|
||||
//! Setup with values
|
||||
CVoiceSetup(const QString &afvVoiceServerUrl, const QString &afvMapUrl);
|
||||
|
||||
//! AFV voice server URL
|
||||
void setAfvVoiceServerUrl(const QString &serverUrl) { m_afvVoiceServerUrl = serverUrl; }
|
||||
|
||||
//! AFV voice server URL
|
||||
const QString &getAfvVoiceServerUrl() const { return m_afvVoiceServerUrl; }
|
||||
|
||||
//! AFV map URL
|
||||
void setAfvMapUrl(const QString &mapUrl) { m_afvMapUrl = mapUrl; }
|
||||
|
||||
//! AFV map URL
|
||||
const QString &getAfvMapUrl() const { return m_afvMapUrl; }
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
QVariant propertyByIndex(CPropertyIndexRef index) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex
|
||||
int comparePropertyByIndex(CPropertyIndexRef index, const CVoiceSetup &compareValue) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString()
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
//! Validate
|
||||
CStatusMessageList validate() const;
|
||||
|
||||
//! Standard FSD setup for official VATSIM servers
|
||||
static const CVoiceSetup &vatsimStandard();
|
||||
|
||||
private:
|
||||
QString m_afvVoiceServerUrl = "https://voice1.vatsim.net";
|
||||
QString m_afvMapUrl = "https://afv-map.vatsim.net/";
|
||||
|
||||
BLACK_METACLASS(
|
||||
CVoiceSetup,
|
||||
BLACK_METAMEMBER(afvVoiceServerUrl),
|
||||
BLACK_METAMEMBER(afvMapUrl)
|
||||
);
|
||||
};
|
||||
|
||||
//! Voice settings
|
||||
//! \deprecated Voice VATLIB specifics
|
||||
struct TVoiceSetup : public TSettingTrait<CVoiceSetup>
|
||||
{
|
||||
//! \copydoc BlackMisc::TSettingTrait::key
|
||||
static const char *key() { return "audio/%Application%/currentvoicesetup"; }
|
||||
|
||||
//! \copydoc BlackMisc::TSettingTrait::humanReadable
|
||||
static const QString &humanReadable()
|
||||
{
|
||||
static const QString name("Voice setup");
|
||||
return name;
|
||||
}
|
||||
|
||||
//! \copydoc BlackMisc::TSettingTrait::isValid
|
||||
static bool isValid(const CVoiceSetup &setup, QString &) { return setup.validate().isSuccess(); }
|
||||
};
|
||||
} // namespace
|
||||
|
||||
Q_DECLARE_METATYPE(BlackMisc::Audio::CVoiceSetup)
|
||||
|
||||
#endif // guard
|
||||
@@ -14,8 +14,6 @@
|
||||
#include <Qt>
|
||||
#include <QtGlobal>
|
||||
|
||||
using namespace BlackMisc::Audio;
|
||||
|
||||
BLACK_DEFINE_VALUEOBJECT_MIXINS(BlackMisc::Network, CServer)
|
||||
|
||||
namespace BlackMisc::Network
|
||||
@@ -27,11 +25,11 @@ namespace BlackMisc::Network
|
||||
}
|
||||
|
||||
CServer::CServer(const QString &name, const QString &description, const QString &address, int port, const CUser &user,
|
||||
const CFsdSetup &fsdSetup, const CVoiceSetup &voiceSetup, const CEcosystem &ecosytem, ServerType serverType, bool isAcceptingConnections)
|
||||
const CFsdSetup &fsdSetup, const CEcosystem &ecosytem, ServerType serverType, bool isAcceptingConnections)
|
||||
: m_name(CObfuscation::decode(name)), m_description(CObfuscation::decode(description)), m_address(CObfuscation::decode(address)), m_port(port), m_user(user),
|
||||
m_ecosystem(ecosytem),
|
||||
m_serverType(serverType), m_isAcceptingConnections(isAcceptingConnections),
|
||||
m_fsdSetup(fsdSetup), m_voiceSetup(voiceSetup)
|
||||
m_fsdSetup(fsdSetup)
|
||||
{}
|
||||
|
||||
CServer::CServer(
|
||||
@@ -59,7 +57,7 @@ namespace BlackMisc::Network
|
||||
static const CServer fsc = [] {
|
||||
CServer s = CServer("FSC", "FSC e.V.", "OBF:AwJIKfgkQDJEIRnno29DJlB+UK0=", 6809,
|
||||
CUser(),
|
||||
CFsdSetup(), CVoiceSetup(), CEcosystem(CEcosystem::privateFsd()), CServer::FSDServer);
|
||||
CFsdSetup(), CEcosystem(CEcosystem::privateFsd()), CServer::FSDServer);
|
||||
s.removeSendReceiveDetails(CFsdSetup::AllInterimPositions);
|
||||
return s;
|
||||
}();
|
||||
@@ -70,7 +68,7 @@ namespace BlackMisc::Network
|
||||
{
|
||||
static const CServer s = CServer("ES Tower", "Euroscope Tower view", "localhost", 6809,
|
||||
CUser(),
|
||||
CFsdSetup::vatsimStandard(), CVoiceSetup::vatsimStandard(), CEcosystem(CEcosystem::vatsim()), CServer::VoiceServerVatsim);
|
||||
CFsdSetup::vatsimStandard(), CEcosystem(CEcosystem::vatsim()), CServer::VoiceServerVatsim);
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -157,7 +155,6 @@ namespace BlackMisc::Network
|
||||
if (this->getPort() < 1 || this->getPort() > 65535) { msgs.push_back(CStatusMessage(CStatusMessage::SeverityError, u"Wrong port")); }
|
||||
msgs.push_back(this->getUser().validate());
|
||||
msgs.push_back(this->getFsdSetup().validate());
|
||||
msgs.push_back(this->getVoiceSetup().validate());
|
||||
msgs.addCategories(cats);
|
||||
msgs.sortBySeverity();
|
||||
return msgs;
|
||||
@@ -185,7 +182,6 @@ namespace BlackMisc::Network
|
||||
case IndexPort: return QVariant::fromValue(m_port);
|
||||
case IndexUser: return m_user.propertyByIndex(index.copyFrontRemoved());
|
||||
case IndexFsdSetup: return m_fsdSetup.propertyByIndex(index.copyFrontRemoved());
|
||||
case IndexVoiceSetup: return m_voiceSetup.propertyByIndex(index.copyFrontRemoved());
|
||||
case IndexEcosystem: return m_ecosystem.propertyByIndex(index.copyFrontRemoved());
|
||||
case IndexIsAcceptingConnections: return QVariant::fromValue(m_isAcceptingConnections);
|
||||
case IndexServerType: return QVariant::fromValue(m_serverType);
|
||||
@@ -216,7 +212,6 @@ namespace BlackMisc::Network
|
||||
case IndexName: this->setName(variant.value<QString>()); break;
|
||||
case IndexUser: m_user.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||
case IndexFsdSetup: m_fsdSetup.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||
case IndexVoiceSetup: m_voiceSetup.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||
case IndexEcosystem: m_ecosystem.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||
case IndexServerType: this->setServerType(static_cast<ServerType>(variant.toInt())); break;
|
||||
case IndexIsAcceptingConnections: this->setIsAcceptingConnections(variant.value<bool>()); break;
|
||||
@@ -234,7 +229,6 @@ namespace BlackMisc::Network
|
||||
case IndexAddress: return this->getAddress().compare(compareValue.getAddress(), Qt::CaseInsensitive);
|
||||
case IndexDescription: return this->getDescription().compare(compareValue.getDescription(), Qt::CaseInsensitive);
|
||||
case IndexFsdSetup: return m_fsdSetup.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getFsdSetup());
|
||||
case IndexVoiceSetup: return m_voiceSetup.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getVoiceSetup());
|
||||
case IndexName: return this->getName().compare(compareValue.getName(), Qt::CaseInsensitive);
|
||||
case IndexPort: return Compare::compare(this->getPort(), compareValue.getPort());
|
||||
case IndexUser: return this->getUser().comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getUser());
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "blackmisc/network/user.h"
|
||||
#include "blackmisc/network/fsdsetup.h"
|
||||
#include "blackmisc/network/ecosystem.h"
|
||||
#include "blackmisc/audio/voicesetup.h"
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "blackmisc/metaclass.h"
|
||||
#include "blackmisc/propertyindexref.h"
|
||||
@@ -39,7 +38,6 @@ namespace BlackMisc::Network
|
||||
IndexPort,
|
||||
IndexUser,
|
||||
IndexFsdSetup,
|
||||
IndexVoiceSetup,
|
||||
IndexEcosystem,
|
||||
IndexIsAcceptingConnections,
|
||||
IndexServerType,
|
||||
@@ -69,7 +67,7 @@ namespace BlackMisc::Network
|
||||
//! Constructor.
|
||||
CServer(const QString &name, const QString &description, const QString &address, int port,
|
||||
const CUser &user,
|
||||
const CFsdSetup &fsdSetup, const Audio::CVoiceSetup &voiceSetup,
|
||||
const CFsdSetup &fsdSetup,
|
||||
const CEcosystem &ecosytem, ServerType serverType,
|
||||
bool isAcceptingConnections = true);
|
||||
|
||||
@@ -163,12 +161,6 @@ namespace BlackMisc::Network
|
||||
//! Get server type
|
||||
ServerType getServerType() const { return static_cast<ServerType>(m_serverType); }
|
||||
|
||||
//! Get voice setup
|
||||
const Audio::CVoiceSetup &getVoiceSetup() const { return m_voiceSetup; }
|
||||
|
||||
//! Set voice setup
|
||||
void setVoiceSetup(const Audio::CVoiceSetup &setup) { m_voiceSetup = setup; }
|
||||
|
||||
//! Unspecified?
|
||||
bool hasUnspecifiedServerType() const;
|
||||
|
||||
@@ -224,7 +216,6 @@ namespace BlackMisc::Network
|
||||
int m_serverType = static_cast<int>(Unspecified);
|
||||
bool m_isAcceptingConnections = true; //!< disable server for connections
|
||||
CFsdSetup m_fsdSetup;
|
||||
Audio::CVoiceSetup m_voiceSetup;
|
||||
|
||||
BLACK_METACLASS(
|
||||
CServer,
|
||||
@@ -234,7 +225,6 @@ namespace BlackMisc::Network
|
||||
BLACK_METAMEMBER(port),
|
||||
BLACK_METAMEMBER(user),
|
||||
BLACK_METAMEMBER(fsdSetup),
|
||||
BLACK_METAMEMBER(voiceSetup),
|
||||
BLACK_METAMEMBER(ecosystem),
|
||||
BLACK_METAMEMBER(serverType),
|
||||
BLACK_METAMEMBER(isAcceptingConnections),
|
||||
|
||||
@@ -73,7 +73,6 @@ namespace BlackMisc
|
||||
GlobalIndexCRole = 6300,
|
||||
GlobalIndexCServer = 6400,
|
||||
GlobalIndexCFsdSetup = 6500,
|
||||
GlobalIndexCVoiceSetup = 6600,
|
||||
GlobalIndexCUrl = 6800,
|
||||
GlobalIndexCUrlLog = 6900,
|
||||
GlobalIndexCRemoteFile = 7000,
|
||||
|
||||
@@ -17,7 +17,6 @@ using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Geo;
|
||||
using namespace BlackMisc::Math;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Audio;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Simulation;
|
||||
|
||||
@@ -33,7 +32,7 @@ namespace BlackMisc::Test
|
||||
{
|
||||
static const CServer trafficServer("fooserver", "a foo server", "localhost", 1234,
|
||||
CUser("112233", "Some real name", "email@xyz.com", "secret"),
|
||||
CFsdSetup(), CVoiceSetup(), CEcosystem(CEcosystem::VATSIM), CServer::FSDServerVatsim);
|
||||
CFsdSetup(), CEcosystem(CEcosystem::VATSIM), CServer::FSDServerVatsim);
|
||||
return trafficServer;
|
||||
}
|
||||
|
||||
|
||||
@@ -671,7 +671,7 @@ bool SwiftGuiStd::startAFVMap()
|
||||
//! \todo KB 2019-11 AFV map workaround
|
||||
if (sGui && !sGui->isShuttingDown())
|
||||
{
|
||||
sGui->openUrl("https://afv-map.vatsim.net/");
|
||||
sGui->openUrl(sGui->getGlobalSetup().getAfvMapUrl());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Audio;
|
||||
using namespace BlackMisc::Geo;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Network;
|
||||
@@ -118,7 +117,7 @@ namespace BlackFsdTest
|
||||
{
|
||||
static const CServer dvp("Testserver", "Client project testserver", "localhost", 6809,
|
||||
CUser("1234567", "Test User", "", "123456"),
|
||||
CFsdSetup(), CVoiceSetup(), CEcosystem(CEcosystem::swiftTest()), CServer::FSDServerVatsim);
|
||||
CFsdSetup(), CEcosystem(CEcosystem::swiftTest()), CServer::FSDServerVatsim);
|
||||
return dvp;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include <QTest>
|
||||
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Audio;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Geo;
|
||||
@@ -315,7 +314,7 @@ namespace BlackMiscTest
|
||||
|
||||
const CServer server1 = CServer("Testserver", "Client project testserver", "localhost", 6809,
|
||||
CUser("111111", "My Name", "", "123"),
|
||||
CFsdSetup(), CVoiceSetup(), CEcosystem(CEcosystem::swiftTest()), CServer::FSDServerVatsim);
|
||||
CFsdSetup(), CEcosystem(CEcosystem::swiftTest()), CServer::FSDServerVatsim);
|
||||
const CServer server2(server1);
|
||||
QVERIFY2(server1 == server2, "server shall be equal");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user