Skip to content

Commit

Permalink
change dB suffix with "Ok" or "Apply"
Browse files Browse the repository at this point in the history
Signed-off-by: Martin <Ho-Ro@users.noreply.github.com>
  • Loading branch information
Ho-Ro committed Mar 11, 2023
1 parent b717e52 commit dfe0aaa
Show file tree
Hide file tree
Showing 12 changed files with 152 additions and 142 deletions.
11 changes: 8 additions & 3 deletions openhantek/src/configdialog/DsoConfigAnalysisPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ DsoConfigAnalysisPage::DsoConfigAnalysisPage( DsoSettings *settings, QWidget *pa
referenceLevelLayout->addWidget( referenceLevelSpinBox );
referenceLevelLayout->addWidget( referenceLevelUnitLabel );

dBsuffixIndex = settings->scope.analysis.dBsuffixIndex;
referenceLevelButtonLayout = new QGridLayout();
dBVButton = new QPushButton( tr( "0 dBV" ) );
dBVLabel = new QLabel( tr( "<p>= 1 Vrms</p>" ) );
Expand All @@ -81,17 +82,20 @@ DsoConfigAnalysisPage::DsoConfigAnalysisPage( DsoSettings *settings, QWidget *pa
connect( dBVButton, &QPushButton::clicked, referenceLevelSpinBox, [ this ]() {
referenceLevelSpinBox->setValue( 0.0 ); // set 0 dBV = 0 dBV
dummyLoadSpinBox->setValue( 50 ); // set RF load 50 Ohm
minimumMagnitudeUnitLabel->setText( tr( "dB" ) + this->settings->scope.analysis.dBsuffix( 0 ) );
dBsuffixIndex = 0;
minimumMagnitudeUnitLabel->setText( tr( "dB" ) + this->settings->scope.analysis.dBsuffix( dBsuffixIndex ) );
} );
connect( dBuButton, &QPushButton::clicked, referenceLevelSpinBox, [ this ]() {
referenceLevelSpinBox->setValue( -2.2 ); // set 0 dBu = -2.2 dBV
dummyLoadSpinBox->setValue( 600 ); // set telco load 600 Ohm
minimumMagnitudeUnitLabel->setText( tr( "dB" ) + this->settings->scope.analysis.dBsuffix( 1 ) );
dBsuffixIndex = 1;
minimumMagnitudeUnitLabel->setText( tr( "dB" ) + this->settings->scope.analysis.dBsuffix( dBsuffixIndex ) );
} );
connect( dBmButton, &QPushButton::clicked, referenceLevelSpinBox, [ this ]() {
referenceLevelSpinBox->setValue( -13.0 ); // set 0 dBm = -13 dBV
dummyLoadSpinBox->setValue( 50 ); // set RF load 50 Ohm
minimumMagnitudeUnitLabel->setText( tr( "dB" ) + this->settings->scope.analysis.dBsuffix( 2 ) );
dBsuffixIndex = 2;
minimumMagnitudeUnitLabel->setText( tr( "dB" ) + this->settings->scope.analysis.dBsuffix( dBsuffixIndex ) );
} );

referenceLayout = new QGridLayout();
Expand Down Expand Up @@ -142,6 +146,7 @@ DsoConfigAnalysisPage::DsoConfigAnalysisPage( DsoSettings *settings, QWidget *pa

/// \brief Saves the new settings.
void DsoConfigAnalysisPage::saveSettings() {
settings->scope.analysis.dBsuffixIndex = dBsuffixIndex;
settings->scope.analysis.spectrumReference = referenceLevelSpinBox->value();
settings->analysis.spectrumWindow = Dso::WindowFunction( windowFunctionComboBox->currentIndex() );
settings->analysis.spectrumLimit = minimumMagnitudeSpinBox->value();
Expand Down
1 change: 1 addition & 0 deletions openhantek/src/configdialog/DsoConfigAnalysisPage.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class DsoConfigAnalysisPage : public QWidget {
QLabel *dBVLabel;
QLabel *dBuLabel;
QLabel *dBmLabel;
int dBsuffixIndex = 0;
QGridLayout *referenceLevelButtonLayout;
QDoubleSpinBox *referenceLevelSpinBox;
QLabel *referenceLevelUnitLabel;
Expand Down
12 changes: 8 additions & 4 deletions openhantek/src/scopesettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,16 @@ struct DsoSettingsScopeAnalysis {
QString dBsuffixStrings[ 3 ] = { QCoreApplication::translate( "DsoSettingsScopeAnalysis", "V" ),
QCoreApplication::translate( "DsoSettingsScopeAnalysis", "u" ),
QCoreApplication::translate( "DsoSettingsScopeAnalysis", "m" ) };
int dBsuffixIndex = 0; // dBV is default
QString dBsuffix( int index = -1 ) { // default is invalid -> keep old index
if ( index >= 0 && index < 3 ) // valid suffix index
dBsuffixIndex = index; // set new index
int dBsuffixIndex = 0; // dBV is default
QString dBsuffix() { // use current index
return dBsuffixStrings[ dBsuffixIndex ];
};
QString dBsuffix( int index ) {
if ( index >= 0 && index < 3 ) // valid suffix index
return dBsuffixStrings[ index ]; // show this value
else
return QString();
};
bool calculateTHD = false;
bool showNoteValue = false;
};
Expand Down
30 changes: 15 additions & 15 deletions openhantek/translations/openhantek_de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@
<translation type="vanished">Blackman-Nuttall</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="118"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="122"/>
<source>Show note values for audio frequencies</source>
<translation>Zeige Notenwerte für Audio-Frequenzen</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="128"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="132"/>
<source>Analysis</source>
<translation>Analyse</translation>
</message>
Expand Down Expand Up @@ -143,12 +143,12 @@
<translation type="vanished">Berechne Leistung für Lastwiderstand&lt;br/&gt;0 = aus</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="115"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="119"/>
<source>Calculate total harmonic distortion (THD)</source>
<translation>Berechne die harmonische Gesamtverzerrung (THD)</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="104"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="108"/>
<source>Calculate power dissipation for load resistance</source>
<translation>Berechne Leistung für Lastwiderstand</translation>
</message>
Expand All @@ -173,17 +173,17 @@
<translation>Cursor</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="68"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="69"/>
<source>0 dBV</source>
<translation></translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="69"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="70"/>
<source>&lt;p&gt;= 1 Vrms&lt;/p&gt;</source>
<translation>&lt;p&gt;= 1 Vrms&lt;/p&gt;</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="70"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="71"/>
<source>0 dBu</source>
<translation></translation>
</message>
Expand All @@ -196,35 +196,35 @@
<translation type="vanished">Setze 0 dBu</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="71"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="72"/>
<source>&lt;p&gt;= -2.2 dBV (1 mW @ 600 &amp;Omega;)&lt;/p&gt;</source>
<translation></translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="72"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="73"/>
<source>0 dBm</source>
<translation></translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="73"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="74"/>
<source>&lt;p&gt;= -13 dBV (1 mW @ 50 &amp;Omega;)&lt;/p&gt;</source>
<translation></translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="25"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="84"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="89"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="94"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="86"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="92"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="98"/>
<source>dB</source>
<translation></translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="100"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="104"/>
<source>Set Reference Level</source>
<translation>Setze Referenzpegel</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="110"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="114"/>
<source>&lt;p&gt;&amp;Omega;&lt;/p&gt;</source>
<translation></translation>
</message>
Expand Down
30 changes: 15 additions & 15 deletions openhantek/translations/openhantek_es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
<translation type="vanished">Coseno</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="118"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="122"/>
<source>Show note values for audio frequencies</source>
<translation>Mostrar los valores de las notas para las frecuencias de audio</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="128"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="132"/>
<source>Analysis</source>
<translation>Análisis</translation>
</message>
Expand Down Expand Up @@ -87,12 +87,12 @@
<translation type="vanished">Calcular la disipación de energía para la resistencia&lt;br/&gt;0 = off</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="115"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="119"/>
<source>Calculate total harmonic distortion (THD)</source>
<translation>Calcular la distorsión armónica total (THD)</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="104"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="108"/>
<source>Calculate power dissipation for load resistance</source>
<translation>Calcular la disipación de energía para la resistencia</translation>
</message>
Expand All @@ -117,50 +117,50 @@
<translation>Cursores</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="68"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="69"/>
<source>0 dBV</source>
<translation>0 dBV</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="69"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="70"/>
<source>&lt;p&gt;= 1 Vrms&lt;/p&gt;</source>
<translation>&lt;p&gt;= 1 Vrms&lt;/p&gt;</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="70"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="71"/>
<source>0 dBu</source>
<translation>0 dBu</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="71"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="72"/>
<source>&lt;p&gt;= -2.2 dBV (1 mW @ 600 &amp;Omega;)&lt;/p&gt;</source>
<translation>&lt;p&gt;= -2.2 dBV (1 mW @ 600 &amp;Omega;)&lt;/p&gt;</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="72"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="73"/>
<source>0 dBm</source>
<translation>0 dBm</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="73"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="74"/>
<source>&lt;p&gt;= -13 dBV (1 mW @ 50 &amp;Omega;)&lt;/p&gt;</source>
<translation>&lt;p&gt;= -13 dBV (1 mW @ 50 &amp;Omega;)&lt;/p&gt;</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="25"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="84"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="89"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="94"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="86"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="92"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="98"/>
<source>dB</source>
<translation></translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="100"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="104"/>
<source>Set Reference Level</source>
<translation>Establecer nivel de referencia</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="110"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="114"/>
<source>&lt;p&gt;&amp;Omega;&lt;/p&gt;</source>
<translation>&lt;p&gt;&amp;Omega;&lt;/p&gt;</translation>
</message>
Expand Down
30 changes: 15 additions & 15 deletions openhantek/translations/openhantek_fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@
<translation type="vanished">Blackman-Nuttall</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="118"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="122"/>
<source>Show note values for audio frequencies</source>
<translation>Montrer les valeurs des notes pour les fréquences audio</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="128"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="132"/>
<source>Analysis</source>
<translation>Analyser</translation>
</message>
Expand Down Expand Up @@ -139,12 +139,12 @@
<translation type="vanished">Calculer la puissance dissipée pour la résistance à la charge&lt;br/&gt;0 = off</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="115"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="119"/>
<source>Calculate total harmonic distortion (THD)</source>
<translation>Calculer la distorsion harmonique totale (THD)</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="104"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="108"/>
<source>Calculate power dissipation for load resistance</source>
<translation>Calculer la puissance dissipée pour la résistance à la charge</translation>
</message>
Expand All @@ -169,50 +169,50 @@
<translation>Curseurs</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="68"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="69"/>
<source>0 dBV</source>
<translation></translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="69"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="70"/>
<source>&lt;p&gt;= 1 Vrms&lt;/p&gt;</source>
<translation></translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="70"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="71"/>
<source>0 dBu</source>
<translation></translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="71"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="72"/>
<source>&lt;p&gt;= -2.2 dBV (1 mW @ 600 &amp;Omega;)&lt;/p&gt;</source>
<translation></translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="72"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="73"/>
<source>0 dBm</source>
<translation></translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="73"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="74"/>
<source>&lt;p&gt;= -13 dBV (1 mW @ 50 &amp;Omega;)&lt;/p&gt;</source>
<translation></translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="25"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="84"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="89"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="94"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="86"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="92"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="98"/>
<source>dB</source>
<translation></translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="100"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="104"/>
<source>Set Reference Level</source>
<translation>Fixer le niveau de référence</translation>
</message>
<message>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="110"/>
<location filename="../src/configdialog/DsoConfigAnalysisPage.cpp" line="114"/>
<source>&lt;p&gt;&amp;Omega;&lt;/p&gt;</source>
<translation></translation>
</message>
Expand Down
Loading

0 comments on commit dfe0aaa

Please sign in to comment.