mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
Ref T731, removed unused UI components
This commit is contained in:
committed by
Mat Sutcliffe
parent
b207c9c944
commit
197854e7de
@@ -1,28 +0,0 @@
|
||||
/* 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. 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 "blackgui/components/audiocomponent.h"
|
||||
#include "ui_audiocomponent.h"
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
|
||||
CAudioComponent::CAudioComponent(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
ui(new Ui::CAudioComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
CAudioComponent::~CAudioComponent()
|
||||
{ }
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
@@ -1,44 +0,0 @@
|
||||
/* 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. 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_AUDIOCOMPONENT_H
|
||||
#define BLACKGUI_AUDIOCOMPONENT_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
|
||||
#include <QFrame>
|
||||
#include <QObject>
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui { class CAudioComponent; }
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
//! Audio component, volume, ...
|
||||
class BLACKGUI_EXPORT CAudioComponent : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CAudioComponent(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CAudioComponent() override;
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CAudioComponent> ui;
|
||||
};
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
|
||||
#endif // guard
|
||||
@@ -1,109 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CAudioComponent</class>
|
||||
<widget class="QFrame" name="CAudioComponent">
|
||||
<property name="windowTitle">
|
||||
<string>Audio</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_AudioComponent">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<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>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="sa_AudioComponent">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="sa_AudioComponentInner">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>68</width>
|
||||
<height>68</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_ScrollAreaInner">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<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>
|
||||
<item>
|
||||
<widget class="QFrame" name="fr_AudioComponentInner">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_AudioComponentInner">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<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>
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CAudioVolumeComponent" name="comp_AudioVolume"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CAudioSetupComponent" name="comp_AudioSetup"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CAudioSetupComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/audiosetupcomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CAudioVolumeComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/audiovolumecomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -1,296 +0,0 @@
|
||||
/* 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. 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/contextaudio.h"
|
||||
#include "blackgui/components/audiosetupcomponent.h"
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackmisc/audio/audiodeviceinfo.h"
|
||||
#include "blackmisc/audio/notificationsounds.h"
|
||||
#include "blackmisc/audio/audiosettings.h"
|
||||
#include "blackmisc/sequence.h"
|
||||
#include "ui_audiosetupcomponent.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QToolButton>
|
||||
#include <QtGlobal>
|
||||
#include <QPointer>
|
||||
#include <QFileDialog>
|
||||
|
||||
using namespace BlackCore;
|
||||
using namespace BlackCore::Context;
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Audio;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
CAudioSetupComponent::CAudioSetupComponent(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
ui(new Ui::CAudioSetupComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// deferred init, because in a distributed swift system
|
||||
// it takes a moment until the settings are sychronized
|
||||
// this is leading to undesired "save settings" messages and played sounds
|
||||
QPointer<CAudioSetupComponent> myself(this);
|
||||
QTimer::singleShot(2500, this, [ = ]
|
||||
{
|
||||
if (!myself || !sGui || sGui->isShuttingDown()) { return; }
|
||||
this->init();
|
||||
});
|
||||
}
|
||||
|
||||
void CAudioSetupComponent::init()
|
||||
{
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextAudio()) { return; }
|
||||
|
||||
// audio is optional
|
||||
const bool audio = this->hasAudio();
|
||||
this->setEnabled(audio);
|
||||
this->reloadSettings();
|
||||
|
||||
bool c = connect(ui->cb_SetupAudioLoopback, &QCheckBox::toggled, this, &CAudioSetupComponent::onLoopbackToggled);
|
||||
Q_ASSERT(c);
|
||||
|
||||
if (audio)
|
||||
{
|
||||
ui->le_ExtraInfo->setText(audio ? sGui->getIContextAudio()->audioRunsWhereInfo() : "No audio, cannot change.");
|
||||
|
||||
this->initAudioDeviceLists();
|
||||
|
||||
// default
|
||||
ui->cb_SetupAudioLoopback->setChecked(sGui->getIContextAudio()->isAudioLoopbackEnabled());
|
||||
|
||||
// the connects depend on initAudioDeviceLists
|
||||
c = connect(ui->cb_SetupAudioInputDevice, qOverload<int>(&QComboBox::currentIndexChanged), this, &CAudioSetupComponent::onAudioDeviceSelected);
|
||||
Q_ASSERT(c);
|
||||
c = connect(ui->cb_SetupAudioOutputDevice, qOverload<int>(&QComboBox::currentIndexChanged), this, &CAudioSetupComponent::onAudioDeviceSelected);
|
||||
Q_ASSERT(c);
|
||||
|
||||
// context
|
||||
c = connect(sGui->getIContextAudio(), &IContextAudio::changedAudioDevices, this, &CAudioSetupComponent::onAudioDevicesChanged, Qt::QueuedConnection);
|
||||
Q_ASSERT(c);
|
||||
c = connect(sGui->getIContextAudio(), &IContextAudio::changedSelectedAudioDevices, this, &CAudioSetupComponent::onCurrentAudioDevicesChanged, Qt::QueuedConnection);
|
||||
Q_ASSERT(c);
|
||||
|
||||
// checkboxes for notifications
|
||||
c = connect(ui->cb_SetupAudioPTTClickDown, &QCheckBox::toggled, this, &CAudioSetupComponent::onNotificationsToggled, Qt::QueuedConnection);
|
||||
Q_ASSERT(c);
|
||||
c = connect(ui->cb_SetupAudioPTTClickUp, &QCheckBox::toggled, this, &CAudioSetupComponent::onNotificationsToggled, Qt::QueuedConnection);
|
||||
Q_ASSERT(c);
|
||||
c = connect(ui->cb_SetupAudioNotificationVoiceRoomLeft, &QCheckBox::toggled, this, &CAudioSetupComponent::onNotificationsToggled, Qt::QueuedConnection);
|
||||
Q_ASSERT(c);
|
||||
c = connect(ui->cb_SetupAudioNotificationVoiceRoomJoined, &QCheckBox::toggled, this, &CAudioSetupComponent::onNotificationsToggled, Qt::QueuedConnection);
|
||||
Q_ASSERT(c);
|
||||
c = connect(ui->cb_SetupAudioNotificationTextMessagePrivate, &QCheckBox::toggled, this, &CAudioSetupComponent::onNotificationsToggled, Qt::QueuedConnection);
|
||||
Q_ASSERT(c);
|
||||
c = connect(ui->cb_SetupAudioNotificationTextMessageSupervisor, &QCheckBox::toggled, this, &CAudioSetupComponent::onNotificationsToggled, Qt::QueuedConnection);
|
||||
Q_ASSERT(c);
|
||||
c = connect(ui->cb_SetupAudioNotificationTextCallsignMentioned, &QCheckBox::toggled, this, &CAudioSetupComponent::onNotificationsToggled, Qt::QueuedConnection);
|
||||
Q_ASSERT(c);
|
||||
c = connect(ui->cb_SetupAudioNoTransmission, &QCheckBox::toggled, this, &CAudioSetupComponent::onNotificationsToggled, Qt::QueuedConnection);
|
||||
Q_ASSERT(c);
|
||||
c = connect(ui->pb_SoundReset, &QPushButton::released, this, &CAudioSetupComponent::resetNotificationSoundsDir, Qt::QueuedConnection);
|
||||
Q_ASSERT(c);
|
||||
c = connect(ui->pb_SoundDir, &QPushButton::released, this, &CAudioSetupComponent::selectNotificationSoundsDir, Qt::QueuedConnection);
|
||||
Q_ASSERT(c);
|
||||
|
||||
// volumes
|
||||
c = connect(ui->sb_NotificationValueVolume, qOverload<int>(&QSpinBox::valueChanged), this, &CAudioSetupComponent::onNotificationVolumeChanged);
|
||||
Q_ASSERT(c);
|
||||
}
|
||||
Q_UNUSED(c)
|
||||
}
|
||||
|
||||
CAudioSetupComponent::~CAudioSetupComponent()
|
||||
{ }
|
||||
|
||||
bool CAudioSetupComponent::playNotificationSounds() const
|
||||
{
|
||||
if (!this->hasAudio()) { return false; }
|
||||
return ui->cb_SetupAudioPTTClickDown->isChecked() || ui->cb_SetupAudioPTTClickUp->isChecked() ||
|
||||
ui->cb_SetupAudioNotificationTextMessagePrivate->isChecked() || ui->cb_SetupAudioNotificationTextMessageSupervisor->isChecked() ||
|
||||
ui->cb_SetupAudioNotificationVoiceRoomLeft->isChecked() || ui->cb_SetupAudioNotificationVoiceRoomJoined->isChecked() ||
|
||||
ui->cb_SetupAudioNotificationTextCallsignMentioned->isChecked() || ui->cb_SetupAudioNoTransmission->isChecked();
|
||||
}
|
||||
|
||||
void CAudioSetupComponent::reloadSettings()
|
||||
{
|
||||
const CSettings as(m_audioSettings.getThreadLocal());
|
||||
|
||||
ui->cb_SetupAudioPTTClickDown->setChecked(as.isNotificationFlagSet(CNotificationSounds::PTTClickKeyDown));
|
||||
ui->cb_SetupAudioPTTClickUp->setChecked(as.isNotificationFlagSet(CNotificationSounds::PTTClickKeyUp));
|
||||
|
||||
ui->cb_SetupAudioNotificationVoiceRoomLeft->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationVoiceRoomLeft));
|
||||
ui->cb_SetupAudioNotificationVoiceRoomJoined->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationVoiceRoomJoined));
|
||||
ui->cb_SetupAudioNotificationTextMessagePrivate->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationTextMessagePrivate));
|
||||
ui->cb_SetupAudioNotificationTextMessageSupervisor->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationTextMessageSupervisor));
|
||||
ui->cb_SetupAudioNotificationTextCallsignMentioned->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationTextCallsignMentioned));
|
||||
ui->cb_SetupAudioNoTransmission->setChecked(as.isNotificationFlagSet(CNotificationSounds::NotificationNoAudioTransmission));
|
||||
|
||||
ui->le_SoundDir->setText(as.getNotificationSoundDirectory());
|
||||
ui->sb_NotificationValueVolume->setValue(as.getNotificationVolume());
|
||||
}
|
||||
|
||||
void CAudioSetupComponent::initAudioDeviceLists()
|
||||
{
|
||||
if (!this->hasAudio()) { return; }
|
||||
this->onAudioDevicesChanged(sGui->getIContextAudio()->getAudioDevices());
|
||||
this->onCurrentAudioDevicesChanged(sGui->getIContextAudio()->getCurrentAudioDevices());
|
||||
}
|
||||
|
||||
bool CAudioSetupComponent::hasAudio() const
|
||||
{
|
||||
return sGui && sGui->getIContextAudio() && !sGui->getIContextAudio()->isEmptyObject();
|
||||
}
|
||||
|
||||
void CAudioSetupComponent::onNotificationVolumeChanged(int volume)
|
||||
{
|
||||
volume = qMax(25, qMin(100, volume));
|
||||
CSettings as(m_audioSettings.getThreadLocal());
|
||||
if (as.getNotificationVolume() == volume) { return; }
|
||||
as.setNotificationVolume(volume);
|
||||
m_audioSettings.set(as);
|
||||
}
|
||||
|
||||
CNotificationSounds::NotificationFlag CAudioSetupComponent::checkBoxToFlag(const QCheckBox *cb) const
|
||||
{
|
||||
if (!cb) { return CNotificationSounds::NoNotifications; }
|
||||
|
||||
if (cb == ui->cb_SetupAudioPTTClickDown) { return CNotificationSounds::PTTClickKeyDown; }
|
||||
if (cb == ui->cb_SetupAudioPTTClickUp) { return CNotificationSounds::PTTClickKeyUp; }
|
||||
|
||||
if (cb == ui->cb_SetupAudioNotificationVoiceRoomJoined) { return CNotificationSounds::NotificationVoiceRoomJoined; }
|
||||
if (cb == ui->cb_SetupAudioNotificationVoiceRoomLeft) { return CNotificationSounds::NotificationVoiceRoomLeft; }
|
||||
if (cb == ui->cb_SetupAudioNotificationTextCallsignMentioned) { return CNotificationSounds::NotificationTextCallsignMentioned; }
|
||||
if (cb == ui->cb_SetupAudioNotificationTextMessagePrivate) { return CNotificationSounds::NotificationTextMessagePrivate; }
|
||||
if (cb == ui->cb_SetupAudioNotificationTextMessageSupervisor) { return CNotificationSounds::NotificationTextMessageSupervisor; }
|
||||
if (cb == ui->cb_SetupAudioNoTransmission) { return CNotificationSounds::NotificationNoAudioTransmission; }
|
||||
return CNotificationSounds::NoNotifications;
|
||||
}
|
||||
|
||||
void CAudioSetupComponent::onAudioDeviceSelected(int index)
|
||||
{
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextAudio()) { return; }
|
||||
if (index < 0) { return; }
|
||||
|
||||
CAudioDeviceInfoList devices = sGui->getIContextAudio()->getAudioDevices();
|
||||
if (devices.isEmpty()) { return; }
|
||||
CAudioDeviceInfo selectedDevice;
|
||||
const QObject *sender = QObject::sender();
|
||||
if (sender == ui->cb_SetupAudioInputDevice)
|
||||
{
|
||||
const CAudioDeviceInfoList inputDevices = devices.getInputDevices();
|
||||
if (index >= inputDevices.size()) { return; }
|
||||
selectedDevice = inputDevices[index];
|
||||
// sGui->getIContextAudio()->setCurrentAudioDevices(selectedDevice);
|
||||
}
|
||||
else if (sender == ui->cb_SetupAudioOutputDevice)
|
||||
{
|
||||
const CAudioDeviceInfoList outputDevices = devices.getOutputDevices();
|
||||
if (index >= outputDevices.size()) { return; }
|
||||
selectedDevice = outputDevices[index];
|
||||
// sGui->getIContextAudio()->setCurrentAudioDevices(selectedDevice);
|
||||
}
|
||||
}
|
||||
|
||||
void CAudioSetupComponent::onCurrentAudioDevicesChanged(const CAudioDeviceInfoList &devices)
|
||||
{
|
||||
for (auto &device : devices)
|
||||
{
|
||||
if (device.getType() == CAudioDeviceInfo::InputDevice)
|
||||
{
|
||||
ui->cb_SetupAudioInputDevice->setCurrentText(device.toQString(true));
|
||||
}
|
||||
else if (device.getType() == CAudioDeviceInfo::OutputDevice)
|
||||
{
|
||||
ui->cb_SetupAudioOutputDevice->setCurrentText(device.toQString(true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CAudioSetupComponent::onAudioDevicesChanged(const CAudioDeviceInfoList &devices)
|
||||
{
|
||||
ui->cb_SetupAudioOutputDevice->clear();
|
||||
ui->cb_SetupAudioInputDevice->clear();
|
||||
|
||||
for (const CAudioDeviceInfo &device : devices)
|
||||
{
|
||||
if (device.getType() == CAudioDeviceInfo::InputDevice)
|
||||
{
|
||||
ui->cb_SetupAudioInputDevice->addItem(device.toQString(true));
|
||||
}
|
||||
else if (device.getType() == CAudioDeviceInfo::OutputDevice)
|
||||
{
|
||||
ui->cb_SetupAudioOutputDevice->addItem(device.toQString(true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CAudioSetupComponent::onLoopbackToggled(bool loopback)
|
||||
{
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextAudio()) { return; }
|
||||
if (sGui->getIContextAudio()->isAudioLoopbackEnabled() == loopback) { return; }
|
||||
sGui->getIContextAudio()->enableAudioLoopback(loopback);
|
||||
}
|
||||
|
||||
void CAudioSetupComponent::onNotificationsToggled(bool checked)
|
||||
{
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextAudio()) { return; }
|
||||
CSettings as(m_audioSettings.getThreadLocal());
|
||||
|
||||
as.setNotificationFlag(CNotificationSounds::PTTClickKeyDown, ui->cb_SetupAudioPTTClickDown->isChecked());
|
||||
as.setNotificationFlag(CNotificationSounds::PTTClickKeyUp, ui->cb_SetupAudioPTTClickUp->isChecked());
|
||||
|
||||
as.setNotificationFlag(CNotificationSounds::NotificationVoiceRoomLeft, ui->cb_SetupAudioNotificationVoiceRoomLeft->isChecked());
|
||||
as.setNotificationFlag(CNotificationSounds::NotificationVoiceRoomJoined, ui->cb_SetupAudioNotificationVoiceRoomJoined->isChecked());
|
||||
as.setNotificationFlag(CNotificationSounds::NotificationTextMessagePrivate, ui->cb_SetupAudioNotificationTextMessagePrivate->isChecked());
|
||||
as.setNotificationFlag(CNotificationSounds::NotificationTextMessageSupervisor, ui->cb_SetupAudioNotificationTextMessageSupervisor->isChecked());
|
||||
as.setNotificationFlag(CNotificationSounds::NotificationTextCallsignMentioned, ui->cb_SetupAudioNotificationTextCallsignMentioned->isChecked());
|
||||
as.setNotificationFlag(CNotificationSounds::NotificationNoAudioTransmission, ui->cb_SetupAudioNoTransmission->isChecked());
|
||||
|
||||
const CStatusMessage msg = m_audioSettings.set(as);
|
||||
CLogMessage(this).preformatted(msg);
|
||||
|
||||
const QCheckBox *sender = qobject_cast<const QCheckBox *>(QObject::sender());
|
||||
if (checked && this->hasAudio() && sender)
|
||||
{
|
||||
const CNotificationSounds::NotificationFlag f = this->checkBoxToFlag(sender);
|
||||
sGui->getIContextAudio()->playNotification(f, false, as.getNotificationVolume());
|
||||
}
|
||||
}
|
||||
|
||||
void CAudioSetupComponent::selectNotificationSoundsDir()
|
||||
{
|
||||
CSettings s = m_audioSettings.get();
|
||||
const QString dir = QFileDialog::getExistingDirectory(this, QStringLiteral("Open directory"), s.getNotificationSoundDirectory(), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||
const QDir d(dir);
|
||||
if (d.exists())
|
||||
{
|
||||
s.setNotificationSoundDirectory(dir);
|
||||
ui->le_SoundDir->setText(s.getNotificationSoundDirectory());
|
||||
const CStatusMessage m = m_audioSettings.setAndSave(s);
|
||||
CLogMessage::preformatted(m);
|
||||
}
|
||||
}
|
||||
|
||||
void CAudioSetupComponent::resetNotificationSoundsDir()
|
||||
{
|
||||
CSettings s = m_audioSettings.get();
|
||||
s.setNotificationSoundDirectory("");
|
||||
const CStatusMessage m = m_audioSettings.setAndSave(s);
|
||||
CLogMessage::preformatted(m);
|
||||
ui->le_SoundDir->clear();
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
@@ -1,91 +0,0 @@
|
||||
/* 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. 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_AUDIOSETUPCOMPONENT_H
|
||||
#define BLACKGUI_AUDIOSETUPCOMPONENT_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/audio/audiosettings.h"
|
||||
#include "blackmisc/audio/audiodeviceinfolist.h"
|
||||
#include "blackmisc/settingscache.h"
|
||||
|
||||
#include <QFrame>
|
||||
#include <QCheckBox>
|
||||
#include <QObject>
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui { class CAudioSetupComponent; }
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
//! Audio setup such as input / output devices
|
||||
class BLACKGUI_EXPORT CAudioSetupComponent : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CAudioSetupComponent(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CAudioSetupComponent() override;
|
||||
|
||||
//! Play any sounds?
|
||||
bool playNotificationSounds() const;
|
||||
|
||||
private:
|
||||
//! Init
|
||||
void init();
|
||||
|
||||
//! Reload settings
|
||||
void reloadSettings();
|
||||
|
||||
//! Audio device selected
|
||||
//! \param index audio device index (COM1, COM2)
|
||||
void onAudioDeviceSelected(int index);
|
||||
|
||||
//! Current audio devices changed
|
||||
void onCurrentAudioDevicesChanged(const BlackMisc::Audio::CAudioDeviceInfoList &devices);
|
||||
|
||||
//! Audio devices changed
|
||||
void onAudioDevicesChanged(const BlackMisc::Audio::CAudioDeviceInfoList &devices);
|
||||
|
||||
//! Loopback toggled
|
||||
void onLoopbackToggled(bool loopback);
|
||||
|
||||
//! Notification flags toggled
|
||||
void onNotificationsToggled(bool checked);
|
||||
|
||||
//! Notification sounds dir
|
||||
void selectNotificationSoundsDir();
|
||||
|
||||
//! Notification sounds dir
|
||||
void resetNotificationSoundsDir();
|
||||
|
||||
//! Audio device lists from settings
|
||||
void initAudioDeviceLists();
|
||||
|
||||
//! Audio is optional, check if available
|
||||
bool hasAudio() const;
|
||||
|
||||
//! Volume has been changed
|
||||
void onNotificationVolumeChanged(int volume);
|
||||
|
||||
//! CheckBox to flag
|
||||
BlackMisc::Audio::CNotificationSounds::NotificationFlag checkBoxToFlag(const QCheckBox *cb) const;
|
||||
|
||||
QScopedPointer<Ui::CAudioSetupComponent> ui;
|
||||
BlackMisc::CSetting<BlackMisc::Audio::TSettings> m_audioSettings { this, &CAudioSetupComponent::reloadSettings };
|
||||
};
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
#endif // guard
|
||||
@@ -1,274 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CAudioSetupComponent</class>
|
||||
<widget class="QFrame" name="CAudioSetupComponent">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>277</width>
|
||||
<height>464</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Audio setup</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_AudioSetup">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="fl_SetupAudio">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_Info">
|
||||
<property name="text">
|
||||
<string>Info</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="le_ExtraInfo">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>extra info goes here</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_SetupAudioInputDevice">
|
||||
<property name="text">
|
||||
<string>In</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="cb_SetupAudioInputDevice">
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToMinimumContentsLength</enum>
|
||||
</property>
|
||||
<property name="frame">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbl_SetupAudioOutputDevice">
|
||||
<property name="text">
|
||||
<string>Out</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="cb_SetupAudioOutputDevice">
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToMinimumContentsLength</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lbl_SetupAudioLoopback">
|
||||
<property name="text">
|
||||
<string>Test</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioLoopback">
|
||||
<property name="text">
|
||||
<string>Loopback, test sound in- to output</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lbl_SoundDirectory">
|
||||
<property name="text">
|
||||
<string>Dir.:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QWidget" name="wi_SoundDir" native="true">
|
||||
<layout class="QHBoxLayout" name="hl_SoundDir" stretch="0,0,0">
|
||||
<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>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="le_SoundDir">
|
||||
<property name="placeholderText">
|
||||
<string>your private sound directory</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_SoundReset">
|
||||
<property name="text">
|
||||
<string>reset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignRight">
|
||||
<widget class="QPushButton" name="pb_SoundDir">
|
||||
<property name="text">
|
||||
<string>[...]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="lbl_Notifications">
|
||||
<property name="toolTip">
|
||||
<string>Notifications</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Not.:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QSpinBox" name="sb_NotificationValueVolume">
|
||||
<property name="suffix">
|
||||
<string> volume 25-100 (notifications)</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>25</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>90</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioNotificationTextMessagePrivate">
|
||||
<property name="text">
|
||||
<string>notification for private text messages</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioNotificationTextMessageSupervisor">
|
||||
<property name="text">
|
||||
<string>supervisor messages</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioNotificationTextCallsignMentioned">
|
||||
<property name="text">
|
||||
<string>notfication for text msg. with my callsign</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioNotificationVoiceRoomJoined">
|
||||
<property name="text">
|
||||
<string>notification joining a voice room</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioNotificationVoiceRoomLeft">
|
||||
<property name="text">
|
||||
<string>notification leaving a voice room</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioNoTransmission">
|
||||
<property name="text">
|
||||
<string>No audio transmission warning</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioPTTClickDown">
|
||||
<property name="text">
|
||||
<string>PTT click (key down)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<widget class="QCheckBox" name="cb_SetupAudioPTTClickUp">
|
||||
<property name="text">
|
||||
<string>PTT click (key up)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="vs_AudioSetup">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>143</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>le_ExtraInfo</tabstop>
|
||||
<tabstop>cb_SetupAudioInputDevice</tabstop>
|
||||
<tabstop>cb_SetupAudioOutputDevice</tabstop>
|
||||
<tabstop>cb_SetupAudioLoopback</tabstop>
|
||||
<tabstop>le_SoundDir</tabstop>
|
||||
<tabstop>pb_SoundReset</tabstop>
|
||||
<tabstop>pb_SoundDir</tabstop>
|
||||
<tabstop>cb_SetupAudioNotificationTextMessageSupervisor</tabstop>
|
||||
<tabstop>cb_SetupAudioNotificationTextCallsignMentioned</tabstop>
|
||||
<tabstop>cb_SetupAudioNotificationVoiceRoomJoined</tabstop>
|
||||
<tabstop>cb_SetupAudioNotificationVoiceRoomLeft</tabstop>
|
||||
<tabstop>cb_SetupAudioNoTransmission</tabstop>
|
||||
<tabstop>cb_SetupAudioPTTClickDown</tabstop>
|
||||
<tabstop>cb_SetupAudioPTTClickUp</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -1,151 +0,0 @@
|
||||
/* 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. 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 "ui_voiceroomscomponent.h"
|
||||
#include "blackgui/components/voiceroomscomponent.h"
|
||||
#include "blackgui/views/userview.h"
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackgui/guiutility.h"
|
||||
#include "blackcore/context/contextaudio.h"
|
||||
#include "blackcore/context/contextownaircraft.h"
|
||||
#include "blackmisc/audio/notificationsounds.h"
|
||||
#include "blackmisc/audio/voiceroom.h"
|
||||
#include "blackmisc/aviation/comsystem.h"
|
||||
#include "blackmisc/sequence.h"
|
||||
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QLineEdit>
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
|
||||
using namespace BlackCore;
|
||||
using namespace BlackCore::Context;
|
||||
using namespace BlackMisc::Audio;
|
||||
using namespace BlackMisc::Aviation;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
CVoiceRoomsComponent::CVoiceRoomsComponent(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
ui(new Ui::CVoiceRoomsComponent)
|
||||
{
|
||||
Q_ASSERT_X(sGui, Q_FUNC_INFO, "Need sGui");
|
||||
ui->setupUi(this);
|
||||
this->setVoiceRoomUrlFieldsReadOnlyState();
|
||||
connect(ui->cb_CockpitVoiceRoom1Override, &QCheckBox::toggled, this, &CVoiceRoomsComponent::onVoiceRoomOverrideChanged);
|
||||
connect(ui->cb_CockpitVoiceRoom2Override, &QCheckBox::toggled, this, &CVoiceRoomsComponent::onVoiceRoomOverrideChanged);
|
||||
connect(ui->le_CockpitVoiceRoomCom1, &QLineEdit::returnPressed, this, &CVoiceRoomsComponent::onVoiceRoomUrlsReturnPressed);
|
||||
connect(ui->le_CockpitVoiceRoomCom2, &QLineEdit::returnPressed, this, &CVoiceRoomsComponent::onVoiceRoomUrlsReturnPressed);
|
||||
// connect(sGui->getIContextAudio(), &IContextAudio::changedVoiceRooms, this, &CVoiceRoomsComponent::updateAudioVoiceRoomsFromContext, Qt::QueuedConnection);
|
||||
// connect(sGui->getIContextAudio(), &IContextAudio::changedVoiceRoomMembers, this, &CVoiceRoomsComponent::updateVoiceRoomMembers, Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
CVoiceRoomsComponent::~CVoiceRoomsComponent()
|
||||
{ }
|
||||
|
||||
void CVoiceRoomsComponent::onVoiceRoomOverrideChanged(bool checked)
|
||||
{
|
||||
Q_UNUSED(checked);
|
||||
this->setVoiceRoomUrlFieldsReadOnlyState();
|
||||
this->onVoiceRoomUrlsReturnPressed(); // use this function to update voicerooms
|
||||
}
|
||||
|
||||
void CVoiceRoomsComponent::onVoiceRoomUrlsReturnPressed()
|
||||
{
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextOwnAircraft()) { return; }
|
||||
QString url1;
|
||||
QString url2;
|
||||
if (ui->cb_CockpitVoiceRoom1Override->isChecked()) { url1 = ui->le_CockpitVoiceRoomCom1->text().trimmed(); }
|
||||
if (ui->cb_CockpitVoiceRoom2Override->isChecked()) { url2 = ui->le_CockpitVoiceRoomCom2->text().trimmed(); }
|
||||
sGui->getIContextOwnAircraft()->setAudioVoiceRoomOverrideUrls(url1, url2);
|
||||
}
|
||||
|
||||
void CVoiceRoomsComponent::setVoiceRoomUrlFieldsReadOnlyState()
|
||||
{
|
||||
const bool c1 = ui->cb_CockpitVoiceRoom1Override->isChecked();
|
||||
const bool c2 = ui->cb_CockpitVoiceRoom2Override->isChecked();
|
||||
ui->le_CockpitVoiceRoomCom1->setReadOnly(!c1);
|
||||
ui->le_CockpitVoiceRoomCom2->setReadOnly(!c2);
|
||||
CGuiUtility::forceStyleSheetUpdate(this);
|
||||
}
|
||||
|
||||
void CVoiceRoomsComponent::updateAudioVoiceRoomsFromContext(const CVoiceRoomList &selectedVoiceRooms, bool connected)
|
||||
{
|
||||
if (!sGui || sGui->isShuttingDown()) { return; }
|
||||
|
||||
Q_ASSERT(selectedVoiceRooms.size() == 2);
|
||||
const CVoiceRoom room1 = selectedVoiceRooms[0];
|
||||
const CVoiceRoom room2 = selectedVoiceRooms[1];
|
||||
|
||||
// remark:
|
||||
// isAudioPlaying() is not set, as this is only a temporary value when really "something is playing"
|
||||
|
||||
const bool changedUrl1 = (room1.getVoiceRoomUrl() != ui->le_CockpitVoiceRoomCom1->text());
|
||||
ui->le_CockpitVoiceRoomCom1->setText(room1.getVoiceRoomUrl());
|
||||
if (room1.isConnected())
|
||||
{
|
||||
ui->le_CockpitVoiceRoomCom1->setStyleSheet("background: green");
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->le_CockpitVoiceRoomCom1->setStyleSheet("");
|
||||
ui->tvp_CockpitVoiceRoom1->clear();
|
||||
}
|
||||
|
||||
const bool changedUrl2 = (room2.getVoiceRoomUrl() != ui->le_CockpitVoiceRoomCom2->text());
|
||||
ui->le_CockpitVoiceRoomCom2->setText(room2.getVoiceRoomUrl());
|
||||
if (room2.isConnected())
|
||||
{
|
||||
ui->le_CockpitVoiceRoomCom2->setStyleSheet("background: green");
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->le_CockpitVoiceRoomCom2->setStyleSheet("");
|
||||
ui->tvp_CockpitVoiceRoom2->clear();
|
||||
}
|
||||
|
||||
// for unconnected we already
|
||||
if (connected) { this->updateVoiceRoomMembers(); }
|
||||
|
||||
if (changedUrl1 || changedUrl2)
|
||||
{
|
||||
// notify
|
||||
if (sGui->getIContextAudio())
|
||||
{
|
||||
const CNotificationSounds::NotificationFlag sound = connected ? CNotificationSounds::NotificationVoiceRoomJoined : CNotificationSounds::NotificationVoiceRoomLeft;
|
||||
sGui->getIContextAudio()->playNotification(sound, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CVoiceRoomsComponent::updateVoiceRoomMembers()
|
||||
{
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextAudio()) { return; }
|
||||
if (!ui->le_CockpitVoiceRoomCom1->text().trimmed().isEmpty())
|
||||
{
|
||||
// ui->tvp_CockpitVoiceRoom1->updateContainer(sGui->getIContextAudio()->getRoomUsers(CComSystem::Com1));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->tvp_CockpitVoiceRoom1->clear();
|
||||
}
|
||||
|
||||
if (!ui->le_CockpitVoiceRoomCom2->text().trimmed().isEmpty())
|
||||
{
|
||||
// ui->tvp_CockpitVoiceRoom2->updateContainer(sGui->getIContextAudio()->getRoomUsers(CComSystem::Com2));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->tvp_CockpitVoiceRoom2->clear();
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
@@ -1,60 +0,0 @@
|
||||
/* 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. 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_VOICEROOMSCOMPONENT_H
|
||||
#define BLACKGUI_VOICEROOMSCOMPONENT_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/audio/voiceroomlist.h"
|
||||
|
||||
#include <QFrame>
|
||||
#include <QObject>
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui { class CVoiceRoomsComponent; }
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
//! Displays the voice rooms
|
||||
class BLACKGUI_EXPORT CVoiceRoomsComponent : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CVoiceRoomsComponent(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CVoiceRoomsComponent();
|
||||
|
||||
private:
|
||||
//! Override for voice was changed
|
||||
void onVoiceRoomOverrideChanged(bool checked);
|
||||
|
||||
//! Return pressed
|
||||
void onVoiceRoomUrlsReturnPressed();
|
||||
|
||||
//! Set the voice room url fields (checkboxes, line edits)
|
||||
void updateAudioVoiceRoomsFromContext(const BlackMisc::Audio::CVoiceRoomList &selectedVoiceRooms, bool connected);
|
||||
|
||||
//! Update voice room views
|
||||
void updateVoiceRoomMembers();
|
||||
|
||||
//! Set the URL fields
|
||||
void setVoiceRoomUrlFieldsReadOnlyState();
|
||||
|
||||
QScopedPointer<Ui::CVoiceRoomsComponent> ui;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
#endif // guard
|
||||
@@ -1,217 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CVoiceRoomsComponent</class>
|
||||
<widget class="QFrame" name="CVoiceRoomsComponent">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>522</width>
|
||||
<height>226</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Voice rooms</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_VoiceRoomsComponent">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<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>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="ql_CockpitVoiceRooms">
|
||||
<item row="0" column="1">
|
||||
<widget class="QWidget" name="qi_CockpitViewRoom2" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="hl_CockpitRoom1">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="le_CockpitVoiceRoomCom2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<italic>false</italic>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>voice room</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignRight">
|
||||
<widget class="QCheckBox" name="cb_CockpitVoiceRoom2Override">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>override voice room</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ovr.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QWidget" name="qi_CockpitViewRoom1" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="hl_CockpitViewRoom1">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="le_CockpitVoiceRoomCom1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<italic>false</italic>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>voice room</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignRight">
|
||||
<widget class="QCheckBox" name="cb_CockpitVoiceRoom1Override">
|
||||
<property name="toolTip">
|
||||
<string>override voice room</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ovr.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="BlackGui::Views::CUserView" name="tvp_CockpitVoiceRoom1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="BlackGui::Views::CUserView" name="tvp_CockpitVoiceRoom2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::Views::CUserView</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>blackgui/views/userview.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user