Files
pilotclient/src/blackgui/components/audioadvanceddistributedcomponent.cpp
Lars Toenning b6867445fa refactor: Remove secondary way to start/stop AFV client
To reduce complexity, there should only be a single way to start the AFV
client (done on connectionStatusChange of IContextNetwork)
2024-10-13 08:52:34 +02:00

42 lines
1.6 KiB
C++

// SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
#include "audioadvanceddistributedcomponent.h"
#include "ui_audioadvanceddistributedcomponent.h"
#include "blackgui/guiapplication.h"
#include "blackcore/context/contextaudio.h"
#include "blackcore/context/contextnetwork.h"
#include "blackcore/afv/clients/afvclient.h"
using namespace BlackMisc::Audio;
using namespace BlackCore::Context;
namespace BlackGui::Components
{
CAudioAdvancedDistributedComponent::CAudioAdvancedDistributedComponent(QWidget *parent) : QFrame(parent),
ui(new Ui::CAudioAdvancedDistributedComponent)
{
ui->setupUi(this);
connect(ui->pb_ReloadRegistered, &QPushButton::pressed, this, &CAudioAdvancedDistributedComponent::reloadRegisteredDevices, Qt::QueuedConnection);
}
CAudioAdvancedDistributedComponent::~CAudioAdvancedDistributedComponent()
{}
void CAudioAdvancedDistributedComponent::reloadRegisteredDevices()
{
if (!hasContexts()) { return; }
const CAudioDeviceInfoList registeredDevices = sGui->getIContextAudio()->getRegisteredDevices();
ui->tvp_RegisteredDevices->updateContainerMaybeAsync(registeredDevices);
}
bool CAudioAdvancedDistributedComponent::hasContexts()
{
if (!sGui || sGui->isShuttingDown() || !sGui->getCContextAudioBase()) { return false; }
if (!sGui->getIContextNetwork()) { return false; }
return true;
}
}