clang-tidy: Apply modernize-use-auto everywhere (#6480)

Note: clang-tidy was run with `--format-style=file`.
This commit is contained in:
saker
2022-09-14 17:27:53 +00:00
committed by GitHub
parent 550c7bf82e
commit 0b27497be2
170 changed files with 1112 additions and 1341 deletions

View File

@@ -52,15 +52,15 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor)
m_processor(processor)
{
// Top level placement of sections is handled by QSplitter widget.
QHBoxLayout *master_layout = new QHBoxLayout;
QSplitter *display_splitter = new QSplitter(Qt::Vertical);
auto master_layout = new QHBoxLayout;
auto display_splitter = new QSplitter(Qt::Vertical);
master_layout->addWidget(display_splitter);
master_layout->setContentsMargins(2, 6, 2, 8);
setLayout(master_layout);
// Display splitter top: controls section
QWidget *controls_widget = new QWidget;
QHBoxLayout *controls_layout = new QHBoxLayout;
auto controls_widget = new QWidget;
auto controls_layout = new QHBoxLayout;
controls_layout->setContentsMargins(0, 0, 0, 0);
controls_widget->setLayout(controls_layout);
controls_widget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
@@ -69,8 +69,8 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor)
// Basic configuration
QWidget *config_widget = new QWidget;
QGridLayout *config_layout = new QGridLayout;
auto config_widget = new QWidget;
auto config_layout = new QGridLayout;
config_widget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
config_widget->setMaximumHeight(m_configHeight);
config_widget->setLayout(config_layout);
@@ -87,10 +87,12 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor)
// pause and freeze buttons
PixmapButton *pauseButton = new PixmapButton(this, tr("Pause"));
auto pauseButton = new PixmapButton(this, tr("Pause"));
pauseButton->setToolTip(tr("Pause data acquisition"));
QPixmap *pauseOnPixmap = new QPixmap(PLUGIN_NAME::getIconPixmap("play").scaled(buttonSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
QPixmap *pauseOffPixmap = new QPixmap(PLUGIN_NAME::getIconPixmap("pause").scaled(buttonSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
auto pauseOnPixmap = new QPixmap(
PLUGIN_NAME::getIconPixmap("play").scaled(buttonSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
auto pauseOffPixmap = new QPixmap(
PLUGIN_NAME::getIconPixmap("pause").scaled(buttonSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
pauseOnPixmap->setDevicePixelRatio(devicePixelRatio());
pauseOffPixmap->setDevicePixelRatio(devicePixelRatio());
pauseButton->setActiveGraphic(*pauseOnPixmap);
@@ -99,10 +101,12 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor)
pauseButton->setModel(&controls->m_pauseModel);
config_layout->addWidget(pauseButton, 0, 0, 2, 1, Qt::AlignHCenter);
PixmapButton *refFreezeButton = new PixmapButton(this, tr("Reference freeze"));
auto refFreezeButton = new PixmapButton(this, tr("Reference freeze"));
refFreezeButton->setToolTip(tr("Freeze current input as a reference / disable falloff in peak-hold mode."));
QPixmap *freezeOnPixmap = new QPixmap(PLUGIN_NAME::getIconPixmap("freeze").scaled(buttonSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
QPixmap *freezeOffPixmap = new QPixmap(PLUGIN_NAME::getIconPixmap("freeze_off").scaled(buttonSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
auto freezeOnPixmap = new QPixmap(
PLUGIN_NAME::getIconPixmap("freeze").scaled(buttonSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
auto freezeOffPixmap = new QPixmap(
PLUGIN_NAME::getIconPixmap("freeze_off").scaled(buttonSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
freezeOnPixmap->setDevicePixelRatio(devicePixelRatio());
freezeOffPixmap->setDevicePixelRatio(devicePixelRatio());
refFreezeButton->setActiveGraphic(*freezeOnPixmap);
@@ -112,28 +116,28 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor)
config_layout->addWidget(refFreezeButton, 2, 0, 2, 1, Qt::AlignHCenter);
// misc configuration switches
LedCheckBox *waterfallButton = new LedCheckBox(tr("Waterfall"), this);
auto waterfallButton = new LedCheckBox(tr("Waterfall"), this);
waterfallButton->setToolTip(tr("Display real-time spectrogram"));
waterfallButton->setCheckable(true);
waterfallButton->setMinimumSize(70, 12);
waterfallButton->setModel(&controls->m_waterfallModel);
config_layout->addWidget(waterfallButton, 0, 1);
LedCheckBox *smoothButton = new LedCheckBox(tr("Averaging"), this);
auto smoothButton = new LedCheckBox(tr("Averaging"), this);
smoothButton->setToolTip(tr("Enable exponential moving average"));
smoothButton->setCheckable(true);
smoothButton->setMinimumSize(70, 12);
smoothButton->setModel(&controls->m_smoothModel);
config_layout->addWidget(smoothButton, 1, 1);
LedCheckBox *stereoButton = new LedCheckBox(tr("Stereo"), this);
auto stereoButton = new LedCheckBox(tr("Stereo"), this);
stereoButton->setToolTip(tr("Display stereo channels separately"));
stereoButton->setCheckable(true);
stereoButton->setMinimumSize(70, 12);
stereoButton->setModel(&controls->m_stereoModel);
config_layout->addWidget(stereoButton, 2, 1);
LedCheckBox *peakHoldButton = new LedCheckBox(tr("Peak hold"), this);
auto peakHoldButton = new LedCheckBox(tr("Peak hold"), this);
peakHoldButton->setToolTip(tr("Display envelope of peak values"));
peakHoldButton->setCheckable(true);
peakHoldButton->setMinimumSize(70, 12);
@@ -141,10 +145,12 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor)
config_layout->addWidget(peakHoldButton, 3, 1);
// frequency: linear / log. switch and range selector
PixmapButton *logXButton = new PixmapButton(this, tr("Logarithmic frequency"));
auto logXButton = new PixmapButton(this, tr("Logarithmic frequency"));
logXButton->setToolTip(tr("Switch between logarithmic and linear frequency scale"));
QPixmap *logXOnPixmap = new QPixmap(PLUGIN_NAME::getIconPixmap("x_log").scaled(iconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
QPixmap *logXOffPixmap = new QPixmap(PLUGIN_NAME::getIconPixmap("x_linear").scaled(iconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
auto logXOnPixmap = new QPixmap(
PLUGIN_NAME::getIconPixmap("x_log").scaled(iconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
auto logXOffPixmap = new QPixmap(
PLUGIN_NAME::getIconPixmap("x_linear").scaled(iconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
logXOnPixmap->setDevicePixelRatio(devicePixelRatio());
logXOffPixmap->setDevicePixelRatio(devicePixelRatio());
logXButton->setActiveGraphic(*logXOnPixmap);
@@ -153,7 +159,7 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor)
logXButton->setModel(&controls->m_logXModel);
config_layout->addWidget(logXButton, 0, 2, 2, 1, Qt::AlignRight);
ComboBox *freqRangeCombo = new ComboBox(this, tr("Frequency range"));
auto freqRangeCombo = new ComboBox(this, tr("Frequency range"));
freqRangeCombo->setToolTip(tr("Frequency range"));
freqRangeCombo->setMinimumSize(100, ComboBox::DEFAULT_HEIGHT);
freqRangeCombo->setMaximumSize(200, ComboBox::DEFAULT_HEIGHT);
@@ -161,10 +167,12 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor)
config_layout->addWidget(freqRangeCombo, 0, 3, 2, 1);
// amplitude: linear / log switch and range selector
PixmapButton *logYButton = new PixmapButton(this, tr("Logarithmic amplitude"));
auto logYButton = new PixmapButton(this, tr("Logarithmic amplitude"));
logYButton->setToolTip(tr("Switch between logarithmic and linear amplitude scale"));
QPixmap *logYOnPixmap = new QPixmap(PLUGIN_NAME::getIconPixmap("y_log").scaled(iconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
QPixmap *logYOffPixmap = new QPixmap(PLUGIN_NAME::getIconPixmap("y_linear").scaled(iconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
auto logYOnPixmap = new QPixmap(
PLUGIN_NAME::getIconPixmap("y_log").scaled(iconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
auto logYOffPixmap = new QPixmap(
PLUGIN_NAME::getIconPixmap("y_linear").scaled(iconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
logYOnPixmap->setDevicePixelRatio(devicePixelRatio());
logYOffPixmap->setDevicePixelRatio(devicePixelRatio());
logYButton->setActiveGraphic(*logYOnPixmap);
@@ -173,7 +181,7 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor)
logYButton->setModel(&controls->m_logYModel);
config_layout->addWidget(logYButton, 2, 2, 2, 1, Qt::AlignRight);
ComboBox *ampRangeCombo = new ComboBox(this, tr("Amplitude range"));
auto ampRangeCombo = new ComboBox(this, tr("Amplitude range"));
ampRangeCombo->setToolTip(tr("Amplitude range"));
ampRangeCombo->setMinimumSize(100, ComboBox::DEFAULT_HEIGHT);
ampRangeCombo->setMaximumSize(200, ComboBox::DEFAULT_HEIGHT);
@@ -181,13 +189,13 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor)
config_layout->addWidget(ampRangeCombo, 2, 3, 2, 1);
// FFT: block size: icon and selector
QLabel *blockSizeLabel = new QLabel("", this);
QPixmap *blockSizeIcon = new QPixmap(PLUGIN_NAME::getIconPixmap("block_size"));
auto blockSizeLabel = new QLabel("", this);
auto blockSizeIcon = new QPixmap(PLUGIN_NAME::getIconPixmap("block_size"));
blockSizeIcon->setDevicePixelRatio(devicePixelRatio());
blockSizeLabel->setPixmap(blockSizeIcon->scaled(iconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
config_layout->addWidget(blockSizeLabel, 0, 4, 2, 1, Qt::AlignRight);
ComboBox *blockSizeCombo = new ComboBox(this, tr("FFT block size"));
auto blockSizeCombo = new ComboBox(this, tr("FFT block size"));
blockSizeCombo->setToolTip(tr("FFT block size"));
blockSizeCombo->setMinimumSize(100, 22);
blockSizeCombo->setMaximumSize(200, 22);
@@ -197,13 +205,13 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor)
connect(&controls->m_blockSizeModel, &ComboBoxModel::dataChanged, [=] {processor->reallocateBuffers();});
// FFT: window type: icon and selector
QLabel *windowLabel = new QLabel("", this);
QPixmap *windowIcon = new QPixmap(PLUGIN_NAME::getIconPixmap("window"));
auto windowLabel = new QLabel("", this);
auto windowIcon = new QPixmap(PLUGIN_NAME::getIconPixmap("window"));
windowIcon->setDevicePixelRatio(devicePixelRatio());
windowLabel->setPixmap(windowIcon->scaled(iconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
config_layout->addWidget(windowLabel, 2, 4, 2, 1, Qt::AlignRight);
ComboBox *windowCombo = new ComboBox(this, tr("FFT window type"));
auto windowCombo = new ComboBox(this, tr("FFT window type"));
windowCombo->setToolTip(tr("FFT window type"));
windowCombo->setMinimumSize(100, ComboBox::DEFAULT_HEIGHT);
windowCombo->setMaximumSize(200, ComboBox::DEFAULT_HEIGHT);
@@ -218,8 +226,8 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor)
// Advanced configuration
QWidget *advanced_widget = new QWidget;
QGridLayout *advanced_layout = new QGridLayout;
auto advanced_widget = new QWidget;
auto advanced_layout = new QGridLayout;
advanced_widget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
advanced_widget->setMaximumHeight(m_configHeight);
advanced_widget->setLayout(advanced_layout);
@@ -228,7 +236,7 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor)
controls_layout->setStretchFactor(advanced_widget, 10);
// Peak envelope resolution
Knob *envelopeResolutionKnob = new Knob(knobSmall_17, this);
auto envelopeResolutionKnob = new Knob(knobSmall_17, this);
envelopeResolutionKnob->setModel(&controls->m_envelopeResolutionModel);
envelopeResolutionKnob->setLabel(tr("Envelope res."));
envelopeResolutionKnob->setToolTip(tr("Increase envelope resolution for better details, decrease for better GUI performance."));
@@ -236,7 +244,7 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor)
advanced_layout->addWidget(envelopeResolutionKnob, 0, 0, 1, 1, Qt::AlignCenter);
// Spectrum graph resolution
Knob *spectrumResolutionKnob = new Knob(knobSmall_17, this);
auto spectrumResolutionKnob = new Knob(knobSmall_17, this);
spectrumResolutionKnob->setModel(&controls->m_spectrumResolutionModel);
spectrumResolutionKnob->setLabel(tr("Spectrum res."));
spectrumResolutionKnob->setToolTip(tr("Increase spectrum resolution for better details, decrease for better GUI performance."));
@@ -244,7 +252,7 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor)
advanced_layout->addWidget(spectrumResolutionKnob, 1, 0, 1, 1, Qt::AlignCenter);
// Peak falloff speed
Knob *peakDecayFactorKnob = new Knob(knobSmall_17, this);
auto peakDecayFactorKnob = new Knob(knobSmall_17, this);
peakDecayFactorKnob->setModel(&controls->m_peakDecayFactorModel);
peakDecayFactorKnob->setLabel(tr("Falloff factor"));
peakDecayFactorKnob->setToolTip(tr("Decrease to make peaks fall faster."));
@@ -252,7 +260,7 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor)
advanced_layout->addWidget(peakDecayFactorKnob, 0, 1, 1, 1, Qt::AlignCenter);
// Averaging weight
Knob *averagingWeightKnob = new Knob(knobSmall_17, this);
auto averagingWeightKnob = new Knob(knobSmall_17, this);
averagingWeightKnob->setModel(&controls->m_averagingWeightModel);
averagingWeightKnob->setLabel(tr("Averaging weight"));
averagingWeightKnob->setToolTip(tr("Decrease to make averaging slower and smoother."));
@@ -260,7 +268,7 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor)
advanced_layout->addWidget(averagingWeightKnob, 1, 1, 1, 1, Qt::AlignCenter);
// Waterfall history size
Knob *waterfallHeightKnob = new Knob(knobSmall_17, this);
auto waterfallHeightKnob = new Knob(knobSmall_17, this);
waterfallHeightKnob->setModel(&controls->m_waterfallHeightModel);
waterfallHeightKnob->setLabel(tr("Waterfall height"));
waterfallHeightKnob->setToolTip(tr("Increase to get slower scrolling, decrease to see fast transitions better. Warning: medium CPU usage."));
@@ -270,7 +278,7 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor)
connect(&controls->m_waterfallHeightModel, &FloatModel::dataChanged, [=] {processor->reallocateBuffers();});
// Waterfall gamma correction
Knob *waterfallGammaKnob = new Knob(knobSmall_17, this);
auto waterfallGammaKnob = new Knob(knobSmall_17, this);
waterfallGammaKnob->setModel(&controls->m_waterfallGammaModel);
waterfallGammaKnob->setLabel(tr("Waterfall gamma"));
waterfallGammaKnob->setToolTip(tr("Decrease to see very weak signals, increase to get better contrast."));
@@ -278,7 +286,7 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor)
advanced_layout->addWidget(waterfallGammaKnob, 1, 2, 1, 1, Qt::AlignCenter);
// FFT window overlap
Knob *windowOverlapKnob = new Knob(knobSmall_17, this);
auto windowOverlapKnob = new Knob(knobSmall_17, this);
windowOverlapKnob->setModel(&controls->m_windowOverlapModel);
windowOverlapKnob->setLabel(tr("Window overlap"));
windowOverlapKnob->setToolTip(tr("Increase to prevent missing fast transitions arriving near FFT window edges. Warning: high CPU usage."));
@@ -286,7 +294,7 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor)
advanced_layout->addWidget(windowOverlapKnob, 0, 3, 1, 1, Qt::AlignCenter);
// FFT zero padding
Knob *zeroPaddingKnob = new Knob(knobSmall_17, this);
auto zeroPaddingKnob = new Knob(knobSmall_17, this);
zeroPaddingKnob->setModel(&controls->m_zeroPaddingModel);
zeroPaddingKnob->setLabel(tr("Zero padding"));
zeroPaddingKnob->setToolTip(tr("Increase to get smoother-looking spectrum. Warning: high CPU usage."));
@@ -297,10 +305,12 @@ SaControlsDialog::SaControlsDialog(SaControls *controls, SaProcessor *processor)
// Advanced settings button
PixmapButton *advancedButton = new PixmapButton(this, tr("Advanced settings"));
auto advancedButton = new PixmapButton(this, tr("Advanced settings"));
advancedButton->setToolTip(tr("Access advanced settings"));
QPixmap *advancedOnPixmap = new QPixmap(PLUGIN_NAME::getIconPixmap("advanced_on").scaled(advButtonSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
QPixmap *advancedOffPixmap = new QPixmap(PLUGIN_NAME::getIconPixmap("advanced_off").scaled(advButtonSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
auto advancedOnPixmap = new QPixmap(PLUGIN_NAME::getIconPixmap("advanced_on")
.scaled(advButtonSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
auto advancedOffPixmap = new QPixmap(PLUGIN_NAME::getIconPixmap("advanced_off")
.scaled(advButtonSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
advancedOnPixmap->setDevicePixelRatio(devicePixelRatio());
advancedOffPixmap->setDevicePixelRatio(devicePixelRatio());
advancedButton->setActiveGraphic(*advancedOnPixmap);