mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 02:45:33 +08:00
[AFV] Ref T739, cmd.line args for "no audio"
This commit is contained in:
committed by
Mat Sutcliffe
parent
0fa9bcb520
commit
5150fb4e86
@@ -11,6 +11,7 @@
|
|||||||
#include "blackcore/db/networkwatchdog.h"
|
#include "blackcore/db/networkwatchdog.h"
|
||||||
#include "blackcore/context/contextnetwork.h"
|
#include "blackcore/context/contextnetwork.h"
|
||||||
#include "blackcore/context/contextsimulatorimpl.h"
|
#include "blackcore/context/contextsimulatorimpl.h"
|
||||||
|
#include "blackcore/context/contextaudio.h"
|
||||||
#include "blackcore/context/contextapplication.h"
|
#include "blackcore/context/contextapplication.h"
|
||||||
#include "blackcore/cookiemanager.h"
|
#include "blackcore/cookiemanager.h"
|
||||||
#include "blackcore/corefacade.h"
|
#include "blackcore/corefacade.h"
|
||||||
@@ -1312,7 +1313,12 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CApplication::addVatlibOptions()
|
void CApplication::addVatlibOptions()
|
||||||
{
|
{
|
||||||
this->addParserOptions(BlackCore::Context::IContextNetwork::getCmdLineOptions());
|
this->addParserOptions(IContextNetwork::getCmdLineOptions());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CApplication::addAudioOptions()
|
||||||
|
{
|
||||||
|
this->addParserOptions(CContextAudioBase::getCmdLineOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CApplication::getCmdDBusAddressValue() const
|
QString CApplication::getCmdDBusAddressValue() const
|
||||||
|
|||||||
@@ -264,18 +264,21 @@ namespace BlackCore
|
|||||||
//! Add the VATLIB options
|
//! Add the VATLIB options
|
||||||
void addVatlibOptions();
|
void addVatlibOptions();
|
||||||
|
|
||||||
|
//! Add the audio options
|
||||||
|
void addAudioOptions();
|
||||||
|
|
||||||
//! Private resource dir for developer's own resource files
|
//! Private resource dir for developer's own resource files
|
||||||
QString getCmdSwiftPrivateSharedDir() const;
|
QString getCmdSwiftPrivateSharedDir() const;
|
||||||
|
|
||||||
//! Delegates to QCommandLineParser::isSet
|
|
||||||
bool isParserOptionSet(const QString &option) const;
|
|
||||||
|
|
||||||
//! Called by installer?
|
//! Called by installer?
|
||||||
bool isInstallerOptionSet() const;
|
bool isInstallerOptionSet() const;
|
||||||
|
|
||||||
//! Skip the single application check
|
//! Skip the single application check
|
||||||
bool skipSingleApplicationCheck() const;
|
bool skipSingleApplicationCheck() const;
|
||||||
|
|
||||||
|
//! Delegates to QCommandLineParser::isSet
|
||||||
|
bool isParserOptionSet(const QString &option) const;
|
||||||
|
|
||||||
//! Delegates to QCommandLineParser::isSet
|
//! Delegates to QCommandLineParser::isSet
|
||||||
bool isParserOptionSet(const QCommandLineOption &option) const;
|
bool isParserOptionSet(const QCommandLineOption &option) const;
|
||||||
|
|
||||||
|
|||||||
@@ -108,10 +108,17 @@ namespace BlackCore
|
|||||||
|
|
||||||
CContextAudioBase::CContextAudioBase(CCoreFacadeConfig::ContextMode mode, CCoreFacade *runtime) :
|
CContextAudioBase::CContextAudioBase(CCoreFacadeConfig::ContextMode mode, CCoreFacade *runtime) :
|
||||||
IContextAudio(mode, runtime),
|
IContextAudio(mode, runtime),
|
||||||
CIdentifiable(this),
|
CIdentifiable(this)
|
||||||
m_voiceClient(new CAfvClient(CVoiceSetup().getAfvVoiceServerUrl(), this))
|
|
||||||
{
|
{
|
||||||
this->initVoiceClient();
|
if (CContextAudioBase::isNoAudioSet())
|
||||||
|
{
|
||||||
|
CLogMessage(this).info(u"Voice client disabled");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->initVoiceClient();
|
||||||
|
}
|
||||||
|
|
||||||
const CSettings as = m_audioSettings.getThreadLocal();
|
const CSettings as = m_audioSettings.getThreadLocal();
|
||||||
this->setVoiceOutputVolume(as.getOutVolume());
|
this->setVoiceOutputVolume(as.getOutVolume());
|
||||||
m_selcalPlayer = new CSelcalPlayer(CAudioDeviceInfo::getDefaultOutputDevice(), this);
|
m_selcalPlayer = new CSelcalPlayer(CAudioDeviceInfo::getDefaultOutputDevice(), this);
|
||||||
@@ -132,10 +139,8 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CContextAudioBase::initVoiceClient()
|
void CContextAudioBase::initVoiceClient()
|
||||||
{
|
{
|
||||||
if (!m_voiceClient)
|
if (!m_voiceClient) { return; }
|
||||||
{
|
m_voiceClient = new CAfvClient(CVoiceSetup().getAfvVoiceServerUrl(), this);
|
||||||
m_voiceClient = new CAfvClient(CVoiceSetup().getAfvVoiceServerUrl(), this);
|
|
||||||
}
|
|
||||||
|
|
||||||
const CVoiceSetup vs = m_voiceSettings.getThreadLocal();
|
const CVoiceSetup vs = m_voiceSettings.getThreadLocal();
|
||||||
m_voiceClient->updateVoiceServerUrl(vs.getAfvVoiceServerUrl());
|
m_voiceClient->updateVoiceServerUrl(vs.getAfvVoiceServerUrl());
|
||||||
@@ -159,7 +164,7 @@ namespace BlackCore
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
Q_ASSERT_X(CThreadUtils::isApplicationThread(m_voiceClient->thread()), Q_FUNC_INFO, "Should be in main thread");
|
Q_ASSERT_X(CThreadUtils::isApplicationThread(m_voiceClient->thread()), Q_FUNC_INFO, "Should be in main thread");
|
||||||
m_voiceClient->start();
|
m_voiceClient->start(); // thread
|
||||||
Q_ASSERT_X(m_voiceClient->owner() == this, Q_FUNC_INFO, "Wrong owner");
|
Q_ASSERT_X(m_voiceClient->owner() == this, Q_FUNC_INFO, "Wrong owner");
|
||||||
Q_ASSERT_X(!CThreadUtils::isApplicationThread(m_voiceClient->thread()), Q_FUNC_INFO, "Must NOT be in main thread");
|
Q_ASSERT_X(!CThreadUtils::isApplicationThread(m_voiceClient->thread()), Q_FUNC_INFO, "Must NOT be in main thread");
|
||||||
|
|
||||||
@@ -199,7 +204,8 @@ namespace BlackCore
|
|||||||
void CContextAudioBase::enableVoiceClientAndStart()
|
void CContextAudioBase::enableVoiceClientAndStart()
|
||||||
{
|
{
|
||||||
this->initVoiceClient();
|
this->initVoiceClient();
|
||||||
if (m_voiceClient) {
|
if (m_voiceClient)
|
||||||
|
{
|
||||||
m_voiceClient->startAudio();
|
m_voiceClient->startAudio();
|
||||||
this->connectAudioWithNetworkCredentials();
|
this->connectAudioWithNetworkCredentials();
|
||||||
}
|
}
|
||||||
@@ -255,6 +261,21 @@ namespace BlackCore
|
|||||||
return m_voiceClient && m_voiceClient->isStarted();
|
return m_voiceClient && m_voiceClient->isStarted();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QList<QCommandLineOption> &CContextAudioBase::getCmdLineOptions()
|
||||||
|
{
|
||||||
|
static const QList<QCommandLineOption> opts
|
||||||
|
{
|
||||||
|
QCommandLineOption({{"n", "noaudio"}, QCoreApplication::translate("CContextAudioBase", "No audio for GUI or core.", "noaudio")})
|
||||||
|
};
|
||||||
|
return opts;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CContextAudioBase::isNoAudioSet()
|
||||||
|
{
|
||||||
|
if (!sApp) { return false; }
|
||||||
|
return sApp->isParserOptionSet("noaudio");
|
||||||
|
}
|
||||||
|
|
||||||
QString CContextAudioBase::audioRunsWhereInfo() const
|
QString CContextAudioBase::audioRunsWhereInfo() const
|
||||||
{
|
{
|
||||||
const QString s = QStringLiteral("[%1] Audio on '%2', '%3'.").arg(boolToEnabledDisabled(this->isAudioStarted()), audioRunsWhere().getMachineName(), audioRunsWhere().getProcessName());
|
const QString s = QStringLiteral("[%1] Audio on '%2', '%3'.").arg(boolToEnabledDisabled(this->isAudioStarted()), audioRunsWhere().getMachineName(), audioRunsWhere().getProcessName());
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QCommandLineOption>
|
||||||
|
|
||||||
// clazy:excludeall=const-signal-or-slot
|
// clazy:excludeall=const-signal-or-slot
|
||||||
|
|
||||||
@@ -198,6 +199,12 @@ namespace BlackCore
|
|||||||
//! \todo WORKAROUND to hide the "local signals"
|
//! \todo WORKAROUND to hide the "local signals"
|
||||||
Afv::Clients::CAfvClient *afvClient() const { return m_voiceClient; }
|
Afv::Clients::CAfvClient *afvClient() const { return m_voiceClient; }
|
||||||
|
|
||||||
|
//! Cmd.line arguments
|
||||||
|
static const QList<QCommandLineOption> &getCmdLineOptions();
|
||||||
|
|
||||||
|
//! No audio?
|
||||||
|
static bool isNoAudioSet();
|
||||||
|
|
||||||
// -------- parts which can run in core and GUI, referring to local voice client ------------
|
// -------- parts which can run in core and GUI, referring to local voice client ------------
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ int main(int argc, char *argv[])
|
|||||||
a.addWindowStateOption();
|
a.addWindowStateOption();
|
||||||
a.addDBusAddressOption();
|
a.addDBusAddressOption();
|
||||||
a.addVatlibOptions();
|
a.addVatlibOptions();
|
||||||
|
a.addAudioOptions();
|
||||||
if (!a.parseAndSynchronizeSetup()) { return EXIT_FAILURE; }
|
if (!a.parseAndSynchronizeSetup()) { return EXIT_FAILURE; }
|
||||||
|
|
||||||
const QString dBusAdress(a.getCmdDBusAddressValue());
|
const QString dBusAdress(a.getCmdDBusAddressValue());
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ CSwiftGuiStdApplication::CSwiftGuiStdApplication() :
|
|||||||
this->addParserOption(m_cmdFacadeMode);
|
this->addParserOption(m_cmdFacadeMode);
|
||||||
this->addDBusAddressOption();
|
this->addDBusAddressOption();
|
||||||
this->addVatlibOptions();
|
this->addVatlibOptions();
|
||||||
|
this->addAudioOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
CStatusMessageList CSwiftGuiStdApplication::startHookIn()
|
CStatusMessageList CSwiftGuiStdApplication::startHookIn()
|
||||||
|
|||||||
Reference in New Issue
Block a user