Ref T731, use CLevelMeter in CAudioDeviceVolumeSetupComponent

This commit is contained in:
Klaus Basan
2019-09-27 02:21:38 +02:00
committed by Mat Sutcliffe
parent b5ad603e55
commit a06205efbd
4 changed files with 142 additions and 145 deletions

View File

@@ -72,9 +72,6 @@ namespace BlackGui
this->init(); this->init();
}); });
ui->pb_LevelIn->setValue(ui->pb_LevelIn->minimum());
ui->pb_LevelOut->setValue(ui->pb_LevelOut->minimum());
// all tx/rec checkboxes // all tx/rec checkboxes
CGuiUtility::checkBoxesReadOnly(ui->fr_TxRec, true); CGuiUtility::checkBoxesReadOnly(ui->fr_TxRec, true);
} }
@@ -161,22 +158,18 @@ namespace BlackGui
ui->hs_VolumeOut->setValue(qRound(value / tr * r)); ui->hs_VolumeOut->setValue(qRound(value / tr * r));
} }
void CAudioDeviceVolumeSetupComponent::setInLevel(int value, int from, int to) void CAudioDeviceVolumeSetupComponent::setInLevel(double value)
{ {
if (value > to) { value = to; } if (value > 1.0) { value = 1.0; }
if (value < from) { value = from; } if (value < 0.0) { value = 0.0; }
const double r = ui->pb_LevelIn->maximum() - ui->pb_LevelIn->minimum(); ui->wip_InLevelMeter->levelChanged(value);
const double tr = to - from;
ui->pb_LevelIn->setValue(qRound(value / tr * r));
} }
void CAudioDeviceVolumeSetupComponent::setOutLevel(int value, int from, int to) void CAudioDeviceVolumeSetupComponent::setOutLevel(double value)
{ {
if (value > to) { value = to; } if (value > 1.0) { value = 1.0; }
if (value < from) { value = from; } if (value < 0.0) { value = 0.0; }
const double r = ui->pb_LevelOut->maximum() - ui->pb_LevelOut->minimum(); ui->wip_OutLevelMeter->levelChanged(value);
const double tr = to - from;
ui->pb_LevelOut->setValue(qRound(value / tr * r));
} }
void CAudioDeviceVolumeSetupComponent::setInfo(const QString &info) void CAudioDeviceVolumeSetupComponent::setInfo(const QString &info)
@@ -249,12 +242,12 @@ namespace BlackGui
void CAudioDeviceVolumeSetupComponent::onOutputVU(double vu) void CAudioDeviceVolumeSetupComponent::onOutputVU(double vu)
{ {
this->setOutLevel(qRound(vu * 100.0), 0, 100); this->setOutLevel(vu);
} }
void CAudioDeviceVolumeSetupComponent::onInputVU(double vu) void CAudioDeviceVolumeSetupComponent::onInputVU(double vu)
{ {
this->setInLevel(qRound(vu * 100.0), 0, 100); this->setInLevel(vu);
} }
void CAudioDeviceVolumeSetupComponent::onReloadDevices() void CAudioDeviceVolumeSetupComponent::onReloadDevices()

View File

@@ -51,9 +51,9 @@ namespace BlackGui
void setOutValue(int value, int from = BlackMisc::Audio::CSettings::OutMin, int to = BlackMisc::Audio::CSettings::OutMax); void setOutValue(int value, int from = BlackMisc::Audio::CSettings::OutMin, int to = BlackMisc::Audio::CSettings::OutMax);
//! @} //! @}
//! Set input and output level values @{ //! Set input and output level values 0..1 @{
void setInLevel(int value, int from, int to); void setInLevel(double value);
void setOutLevel(int value, int from, int to); void setOutLevel(double value);
//! @} //! @}
//! Info string //! Info string

View File

@@ -6,41 +6,35 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>227</width> <width>200</width>
<height>254</height> <height>267</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Audio setup</string> <string>Audio setup</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="11" column="1"> <item row="9" column="0">
<widget class="QProgressBar" name="pb_LevelOut"> <widget class="QToolButton" name="tb_ResetInVolume">
<property name="value"> <property name="text">
<number>24</number> <string>...</string>
</property>
<property name="format">
<string>%v</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="10" column="1"> <item row="8" column="0">
<widget class="QSlider" name="hs_VolumeOut"> <widget class="QLabel" name="lbl_VolumeIn">
<property name="value">
<number>50</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lbl_SetupAudioInputDevice">
<property name="text"> <property name="text">
<string>In</string> <string>In</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0">
<widget class="QLabel" name="lbl_Info">
<property name="text">
<string>Info</string>
</property>
</widget>
</item>
<item row="8" column="1"> <item row="8" column="1">
<widget class="QSlider" name="hs_VolumeIn"> <widget class="QSlider" name="hs_VolumeIn">
<property name="value"> <property name="value">
@@ -58,9 +52,26 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1"> <item row="5" column="1">
<widget class="QWidget" name="wi_TestAudio" native="true"> <widget class="QCheckBox" name="cb_DisableAudioEffects">
<layout class="QHBoxLayout" name="hl_TestAudio"> <property name="text">
<string>Disable realistic audio simulation</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="le_Info">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>extra info goes here</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QWidget" name="wi_OutDevice" native="true">
<layout class="QHBoxLayout" name="hl_OutDevice">
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
@@ -74,9 +85,16 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QCheckBox" name="cb_SetupAudioLoopback"> <widget class="QComboBox" name="cb_SetupAudioOutputDevice"/>
</item>
<item>
<widget class="QToolButton" name="tb_RefreshOutDevice">
<property name="text"> <property name="text">
<string>Loopback, test sound in- to output</string> <string>...</string>
</property>
<property name="icon">
<iconset>
<normaloff>:/diagona/icons/diagona/icons/arrow-circle-135.png</normaloff>:/diagona/icons/diagona/icons/arrow-circle-135.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@@ -90,13 +108,54 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="12" column="0">
<widget class="QLabel" name="lbl_Info"> <widget class="QToolButton" name="tb_ResetOutVolume">
<property name="text"> <property name="text">
<string>Info</string> <string>...</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="11" column="0">
<widget class="QLabel" name="lbl_VolumeOut">
<property name="text">
<string>Out</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QFrame" name="fr_TxRec">
<layout class="QHBoxLayout" name="hl_TxRec">
<item>
<widget class="QCheckBox" name="cb_1Tx">
<property name="text">
<string>Tx1</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cb_1Rec">
<property name="text">
<string>Rec1</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cb_2Tx">
<property name="text">
<string>Tx2</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cb_2Rec">
<property name="text">
<string>Rec2</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QWidget" name="wi_InDevice" native="true"> <widget class="QWidget" name="wi_InDevice" native="true">
<layout class="QHBoxLayout" name="hl_InDevice"> <layout class="QHBoxLayout" name="hl_InDevice">
@@ -133,26 +192,9 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="9" column="1"> <item row="7" column="1">
<widget class="QProgressBar" name="pb_LevelIn"> <widget class="QWidget" name="wi_TestAudio" native="true">
<property name="value"> <layout class="QHBoxLayout" name="hl_TestAudio">
<number>50</number>
</property>
<property name="format">
<string>%v</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="lbl_VolumeIn">
<property name="text">
<string>In</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QWidget" name="wi_OutDevice" native="true">
<layout class="QHBoxLayout" name="hl_OutDevice">
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
@@ -166,96 +208,62 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QComboBox" name="cb_SetupAudioOutputDevice"/> <widget class="QCheckBox" name="cb_SetupAudioLoopback">
</item>
<item>
<widget class="QToolButton" name="tb_RefreshOutDevice">
<property name="text"> <property name="text">
<string>...</string> <string>Loopback, test sound in- to output</string>
</property>
<property name="icon">
<iconset>
<normaloff>:/diagona/icons/diagona/icons/arrow-circle-135.png</normaloff>:/diagona/icons/diagona/icons/arrow-circle-135.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="2" column="0">
<widget class="QCheckBox" name="cb_DisableAudioEffects"> <widget class="QLabel" name="lbl_SetupAudioInputDevice">
<property name="text"> <property name="text">
<string>Disable realistic audio simulation</string> <string>In</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="11" column="1">
<widget class="QLineEdit" name="le_Info"> <widget class="QSlider" name="hs_VolumeOut">
<property name="readOnly"> <property name="value">
<bool>true</bool> <number>50</number>
</property> </property>
<property name="placeholderText"> <property name="orientation">
<string>extra info goes here</string> <enum>Qt::Horizontal</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item row="10" column="0"> <item row="12" column="1">
<widget class="QLabel" name="lbl_VolumeOut"> <widget class="BlackGui::CLevelMeter" name="wip_OutLevelMeter">
<property name="text"> <property name="sizePolicy">
<string>Out</string> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="0"> <item row="9" column="1">
<widget class="QToolButton" name="tb_ResetInVolume"> <widget class="BlackGui::CLevelMeter" name="wip_InLevelMeter">
<property name="text"> <property name="sizePolicy">
<string>...</string> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
</widget> </widget>
</item> </item>
<item row="11" column="0">
<widget class="QToolButton" name="tb_ResetOutVolume">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QFrame" name="fr_TxRec">
<layout class="QHBoxLayout" name="hl_TxRec">
<item>
<widget class="QCheckBox" name="cb_1Tx">
<property name="text">
<string>Tx1</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cb_1Rec">
<property name="text">
<string>Rec1</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cb_2Tx">
<property name="text">
<string>Tx2</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cb_2Rec">
<property name="text">
<string>Rec2</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>BlackGui::CLevelMeter</class>
<extends>QFrame</extends>
<header>blackgui/levelmeter.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops> <tabstops>
<tabstop>le_Info</tabstop> <tabstop>le_Info</tabstop>
<tabstop>cb_1Tx</tabstop> <tabstop>cb_1Tx</tabstop>
@@ -269,7 +277,9 @@
<tabstop>cb_DisableAudioEffects</tabstop> <tabstop>cb_DisableAudioEffects</tabstop>
<tabstop>cb_SetupAudioLoopback</tabstop> <tabstop>cb_SetupAudioLoopback</tabstop>
<tabstop>hs_VolumeIn</tabstop> <tabstop>hs_VolumeIn</tabstop>
<tabstop>tb_ResetInVolume</tabstop>
<tabstop>hs_VolumeOut</tabstop> <tabstop>hs_VolumeOut</tabstop>
<tabstop>tb_ResetOutVolume</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
<connections/> <connections/>

View File

@@ -716,18 +716,12 @@ QToolTip {
border: 1px solid white; border: 1px solid white;
} }
BlackGui--Components--CAudioDeviceVolumeSetupComponent BlackGui--CLevelMeter {
QProgressBar { qproperty-lowColor: lightgray;
border: 1px solid grey; border: 1px solid grey;
border-radius: 5px; border-radius: 5px;
padding: 1px;
height: 1em; height: 1em;
/** background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 white, stop: 0.4 gray, stop:1 green); **/
}
BlackGui--Components--CAudioDeviceVolumeSetupComponent
QProgressBar::chunk {
width: 20px;
margin: 0.0px;
} }
/** T506 supervisor messages **/ /** T506 supervisor messages **/