From 44c95f82e963057b5d163305141ede5c9d98f22b Mon Sep 17 00:00:00 2001 From: Ross maxx Date: Sun, 24 Mar 2024 11:24:15 +0530 Subject: [PATCH 01/10] remove the gui_templates header where functions not used --- src/core/audio/AudioJack.cpp | 1 - src/core/audio/AudioOss.cpp | 1 - src/core/audio/AudioPortAudio.cpp | 1 - src/core/audio/AudioPulseAudio.cpp | 1 - src/core/audio/AudioSdl.cpp | 1 - src/core/audio/AudioSndio.cpp | 1 - src/core/audio/AudioSoundIo.cpp | 1 - src/gui/AudioAlsaSetupWidget.cpp | 1 - src/gui/MidiSetupWidget.cpp | 1 - src/gui/SampleTrackWindow.cpp | 1 - src/gui/menus/MidiPortMenu.cpp | 1 - src/gui/modals/SetupDialog.cpp | 1 - src/gui/tracks/TrackOperationsWidget.cpp | 1 - 13 files changed, 13 deletions(-) diff --git a/src/core/audio/AudioJack.cpp b/src/core/audio/AudioJack.cpp index 61d7814ed78..64819cbebba 100644 --- a/src/core/audio/AudioJack.cpp +++ b/src/core/audio/AudioJack.cpp @@ -37,7 +37,6 @@ #include "LcdSpinBox.h" #include "MainWindow.h" #include "MidiJack.h" -#include "gui_templates.h" namespace lmms { diff --git a/src/core/audio/AudioOss.cpp b/src/core/audio/AudioOss.cpp index bd6d46c955f..1653e93fae9 100644 --- a/src/core/audio/AudioOss.cpp +++ b/src/core/audio/AudioOss.cpp @@ -34,7 +34,6 @@ #include "LcdSpinBox.h" #include "AudioEngine.h" #include "Engine.h" -#include "gui_templates.h" #ifdef LMMS_HAVE_UNISTD_H #include diff --git a/src/core/audio/AudioPortAudio.cpp b/src/core/audio/AudioPortAudio.cpp index f303545d2ff..2fbdb04b532 100644 --- a/src/core/audio/AudioPortAudio.cpp +++ b/src/core/audio/AudioPortAudio.cpp @@ -53,7 +53,6 @@ void AudioPortAudioSetupUtil::updateChannels() #include "Engine.h" #include "ConfigManager.h" -#include "gui_templates.h" #include "ComboBox.h" #include "AudioEngine.h" diff --git a/src/core/audio/AudioPulseAudio.cpp b/src/core/audio/AudioPulseAudio.cpp index a0c5ccaf9e1..63b81a9e98e 100644 --- a/src/core/audio/AudioPulseAudio.cpp +++ b/src/core/audio/AudioPulseAudio.cpp @@ -32,7 +32,6 @@ #include "ConfigManager.h" #include "LcdSpinBox.h" #include "AudioEngine.h" -#include "gui_templates.h" #include "Engine.h" namespace lmms diff --git a/src/core/audio/AudioSdl.cpp b/src/core/audio/AudioSdl.cpp index 679912c50f5..da81886acbd 100644 --- a/src/core/audio/AudioSdl.cpp +++ b/src/core/audio/AudioSdl.cpp @@ -32,7 +32,6 @@ #include "AudioEngine.h" #include "ConfigManager.h" -#include "gui_templates.h" namespace lmms { diff --git a/src/core/audio/AudioSndio.cpp b/src/core/audio/AudioSndio.cpp index d934dfb9c8d..7d8e7fa8c09 100644 --- a/src/core/audio/AudioSndio.cpp +++ b/src/core/audio/AudioSndio.cpp @@ -35,7 +35,6 @@ #include "LcdSpinBox.h" #include "AudioEngine.h" #include "Engine.h" -#include "gui_templates.h" #include "ConfigManager.h" diff --git a/src/core/audio/AudioSoundIo.cpp b/src/core/audio/AudioSoundIo.cpp index 6e8a03e384f..a3d72e36b50 100644 --- a/src/core/audio/AudioSoundIo.cpp +++ b/src/core/audio/AudioSoundIo.cpp @@ -32,7 +32,6 @@ #include "Engine.h" #include "debug.h" #include "ConfigManager.h" -#include "gui_templates.h" #include "ComboBox.h" #include "AudioEngine.h" diff --git a/src/gui/AudioAlsaSetupWidget.cpp b/src/gui/AudioAlsaSetupWidget.cpp index 7db822b4be8..bc0ecde8e9f 100644 --- a/src/gui/AudioAlsaSetupWidget.cpp +++ b/src/gui/AudioAlsaSetupWidget.cpp @@ -31,7 +31,6 @@ #include "ConfigManager.h" #include "LcdSpinBox.h" -#include "gui_templates.h" namespace lmms::gui { diff --git a/src/gui/MidiSetupWidget.cpp b/src/gui/MidiSetupWidget.cpp index 2385def02dd..0e6678727ce 100644 --- a/src/gui/MidiSetupWidget.cpp +++ b/src/gui/MidiSetupWidget.cpp @@ -28,7 +28,6 @@ #include #include "ConfigManager.h" -#include "gui_templates.h" namespace lmms::gui diff --git a/src/gui/SampleTrackWindow.cpp b/src/gui/SampleTrackWindow.cpp index c0dd8e04e6a..630119253aa 100644 --- a/src/gui/SampleTrackWindow.cpp +++ b/src/gui/SampleTrackWindow.cpp @@ -33,7 +33,6 @@ #include "EffectRackView.h" #include "embed.h" -#include "gui_templates.h" #include "GuiApplication.h" #include "Knob.h" #include "MainWindow.h" diff --git a/src/gui/menus/MidiPortMenu.cpp b/src/gui/menus/MidiPortMenu.cpp index b99c3a0b72f..6c573fdf5c3 100644 --- a/src/gui/menus/MidiPortMenu.cpp +++ b/src/gui/menus/MidiPortMenu.cpp @@ -24,7 +24,6 @@ */ #include "MidiPortMenu.h" -#include "gui_templates.h" namespace lmms::gui { diff --git a/src/gui/modals/SetupDialog.cpp b/src/gui/modals/SetupDialog.cpp index fffa94c82ba..63560e33dff 100644 --- a/src/gui/modals/SetupDialog.cpp +++ b/src/gui/modals/SetupDialog.cpp @@ -37,7 +37,6 @@ #include "embed.h" #include "Engine.h" #include "FileDialog.h" -#include "gui_templates.h" #include "MainWindow.h" #include "MidiSetupWidget.h" #include "ProjectJournal.h" diff --git a/src/gui/tracks/TrackOperationsWidget.cpp b/src/gui/tracks/TrackOperationsWidget.cpp index e846370e69c..de119c64f64 100644 --- a/src/gui/tracks/TrackOperationsWidget.cpp +++ b/src/gui/tracks/TrackOperationsWidget.cpp @@ -38,7 +38,6 @@ #include "DataFile.h" #include "embed.h" #include "Engine.h" -#include "gui_templates.h" #include "InstrumentTrackView.h" #include "PixmapButton.h" #include "Song.h" From 63799ccc29a4f8d078eb120161cc1805d4b29de6 Mon Sep 17 00:00:00 2001 From: Ross maxx Date: Sun, 24 Mar 2024 12:14:22 +0530 Subject: [PATCH 02/10] refactor and replace template with function argument --- include/gui_templates.h | 30 ++++++++----------- .../AudioFileProcessorView.cpp | 4 +-- .../AudioFileProcessorWaveView.cpp | 2 +- plugins/CarlaBase/Carla.cpp | 4 +-- .../DualFilter/DualFilterControlDialog.cpp | 4 +-- plugins/LadspaBrowser/LadspaBrowser.cpp | 2 +- plugins/Monstro/Monstro.cpp | 10 +++---- plugins/Patman/Patman.cpp | 4 +-- plugins/Stk/Mallets/Mallets.cpp | 2 +- plugins/Vestige/Vestige.cpp | 8 ++--- plugins/VstEffect/VstEffectControlDialog.cpp | 2 +- plugins/ZynAddSubFx/ZynAddSubFx.cpp | 2 +- src/gui/EffectView.cpp | 2 +- src/gui/Lv2ViewBase.cpp | 3 +- src/gui/editors/AutomationEditor.cpp | 4 +-- src/gui/editors/PianoRoll.cpp | 4 +-- src/gui/instrument/EnvelopeAndLfoView.cpp | 2 +- .../instrument/InstrumentFunctionViews.cpp | 8 ++--- src/gui/instrument/InstrumentMidiIOView.cpp | 2 +- .../instrument/InstrumentSoundShapingView.cpp | 4 +-- src/gui/instrument/InstrumentTrackWindow.cpp | 2 +- src/gui/instrument/InstrumentTuningView.cpp | 2 +- src/gui/instrument/PianoView.cpp | 2 +- src/gui/widgets/ComboBox.cpp | 2 +- src/gui/widgets/GroupBox.cpp | 2 +- src/gui/widgets/LedCheckBox.cpp | 4 +-- src/gui/widgets/MeterDialog.cpp | 4 +-- src/gui/widgets/Oscilloscope.cpp | 2 +- src/gui/widgets/TabBar.cpp | 2 +- src/gui/widgets/TabWidget.cpp | 8 ++--- 30 files changed, 63 insertions(+), 70 deletions(-) diff --git a/include/gui_templates.h b/include/gui_templates.h index c0afbdfc0bb..5f85062f71f 100644 --- a/include/gui_templates.h +++ b/include/gui_templates.h @@ -31,37 +31,31 @@ #include #include +// TODO: cleanup for qt6 +#if (QT_VERSION < QT_VERSION_CHECK(6,0,0)) + #include +#else + #include +#endif + namespace lmms { // return DPI-independent font-size - font with returned font-size has always // the same size in pixels -template -inline QFont pointSize( QFont _f ) +inline QFont pointSize(QFont _f, int SIZE) { - static const float DPI = 96; -#ifdef LMMS_BUILD_WIN32 - _f.setPointSizeF( ((float) SIZE+0.5f) * DPI / - QApplication::desktop()->logicalDpiY() ); -#else - _f.setPointSizeF( (float) SIZE * DPI / - QApplication::desktop()->logicalDpiY() ); -#endif + _f.setPointSizeF((int)(((float)SIZE + 0.5f) * 96 / + QGuiApplication::primaryScreen()->logicalDotsPerInchY())); return( _f ); } inline QFont pointSizeF( QFont _f, float SIZE ) { - static const float DPI = 96; -#ifdef LMMS_BUILD_WIN32 - _f.setPointSizeF( (SIZE+0.5f) * DPI / - QApplication::desktop()->logicalDpiY() ); -#else - _f.setPointSizeF( SIZE * DPI / - QApplication::desktop()->logicalDpiY() ); -#endif + _f.setPointSizeF((SIZE+0.5f) * 96 / + QGuiApplication::primaryScreen()->logicalDotsPerInchY()); return( _f ); } diff --git a/plugins/AudioFileProcessor/AudioFileProcessorView.cpp b/plugins/AudioFileProcessor/AudioFileProcessorView.cpp index d16b1d019a1..94f0da4fb67 100644 --- a/plugins/AudioFileProcessor/AudioFileProcessorView.cpp +++ b/plugins/AudioFileProcessor/AudioFileProcessorView.cpp @@ -134,7 +134,7 @@ AudioFileProcessorView::AudioFileProcessorView(Instrument* instrument, // interpolation selector m_interpBox = new ComboBox(this); m_interpBox->setGeometry(142, 62, 82, ComboBox::DEFAULT_HEIGHT); - m_interpBox->setFont(pointSize<8>(m_interpBox->font())); + m_interpBox->setFont(pointSize(m_interpBox->font(), 8)); // wavegraph m_waveView = 0; @@ -228,7 +228,7 @@ void AudioFileProcessorView::paintEvent(QPaintEvent*) int idx = a->sample().sampleFile().length(); - p.setFont(pointSize<8>(font())); + p.setFont(pointSize(font(), 8)); QFontMetrics fm(p.font()); diff --git a/plugins/AudioFileProcessor/AudioFileProcessorWaveView.cpp b/plugins/AudioFileProcessor/AudioFileProcessorWaveView.cpp index 507c4e7c0ee..818fb14cb6c 100644 --- a/plugins/AudioFileProcessor/AudioFileProcessorWaveView.cpp +++ b/plugins/AudioFileProcessor/AudioFileProcessorWaveView.cpp @@ -273,7 +273,7 @@ void AudioFileProcessorWaveView::paintEvent(QPaintEvent * pe) p.fillRect(s_padding, s_padding, m_graph.width(), 14, g); p.setPen(QColor(255, 255, 255)); - p.setFont(pointSize<8>(font())); + p.setFont(pointSize(font(), 8)); QString length_text; const int length = m_sample->sampleDuration().count(); diff --git a/plugins/CarlaBase/Carla.cpp b/plugins/CarlaBase/Carla.cpp index 819736e928b..e58cb14af79 100644 --- a/plugins/CarlaBase/Carla.cpp +++ b/plugins/CarlaBase/Carla.cpp @@ -632,7 +632,7 @@ CarlaInstrumentView::CarlaInstrumentView(CarlaInstrument* const instrument, QWid m_toggleUIButton->setCheckable( true ); m_toggleUIButton->setChecked( false ); m_toggleUIButton->setIcon( embed::getIconPixmap( "zoom" ) ); - m_toggleUIButton->setFont( pointSize<8>( m_toggleUIButton->font() ) ); + m_toggleUIButton->setFont(pointSize(m_toggleUIButton->font(), 8)); connect( m_toggleUIButton, SIGNAL( clicked(bool) ), this, SLOT( toggleUI( bool ) ) ); m_toggleUIButton->setToolTip( @@ -642,7 +642,7 @@ CarlaInstrumentView::CarlaInstrumentView(CarlaInstrument* const instrument, QWid m_toggleParamsWindowButton = new QPushButton(tr("Params"), this); m_toggleParamsWindowButton->setIcon(embed::getIconPixmap("controller")); m_toggleParamsWindowButton->setCheckable(true); - m_toggleParamsWindowButton->setFont(pointSize<8>(m_toggleParamsWindowButton->font())); + m_toggleParamsWindowButton->setFont(pointSize(m_toggleParamsWindowButton->font(), 8)); #if CARLA_VERSION_HEX < CARLA_MIN_PARAM_VERSION m_toggleParamsWindowButton->setEnabled(false); m_toggleParamsWindowButton->setToolTip(tr("Available from Carla version 2.1 and up.")); diff --git a/plugins/DualFilter/DualFilterControlDialog.cpp b/plugins/DualFilter/DualFilterControlDialog.cpp index d316e337213..5a912ac8551 100644 --- a/plugins/DualFilter/DualFilterControlDialog.cpp +++ b/plugins/DualFilter/DualFilterControlDialog.cpp @@ -76,12 +76,12 @@ DualFilterControlDialog::DualFilterControlDialog( DualFilterControls* controls ) auto m_filter1ComboBox = new ComboBox(this); m_filter1ComboBox->setGeometry( 19, 70, 137, ComboBox::DEFAULT_HEIGHT ); - m_filter1ComboBox->setFont( pointSize<8>( m_filter1ComboBox->font() ) ); + m_filter1ComboBox->setFont(pointSize(m_filter1ComboBox->font(), 8)); m_filter1ComboBox->setModel( &controls->m_filter1Model ); auto m_filter2ComboBox = new ComboBox(this); m_filter2ComboBox->setGeometry( 217, 70, 137, ComboBox::DEFAULT_HEIGHT ); - m_filter2ComboBox->setFont( pointSize<8>( m_filter2ComboBox->font() ) ); + m_filter2ComboBox->setFont(pointSize(m_filter2ComboBox->font(), 8)); m_filter2ComboBox->setModel( &controls->m_filter2Model ); } diff --git a/plugins/LadspaBrowser/LadspaBrowser.cpp b/plugins/LadspaBrowser/LadspaBrowser.cpp index 31be6405649..54d019aad32 100644 --- a/plugins/LadspaBrowser/LadspaBrowser.cpp +++ b/plugins/LadspaBrowser/LadspaBrowser.cpp @@ -172,7 +172,7 @@ QWidget * LadspaBrowserView::createTab( QWidget * _parent, const QString & _txt, auto title = new QLabel(type + _txt, tab); QFont f = title->font(); f.setBold( true ); - title->setFont( pointSize<12>( f ) ); + title->setFont(pointSize(f, 12)); layout->addSpacing( 5 ); layout->addWidget( title ); diff --git a/plugins/Monstro/Monstro.cpp b/plugins/Monstro/Monstro.cpp index 9563f756d3c..76ab6e47790 100644 --- a/plugins/Monstro/Monstro.cpp +++ b/plugins/Monstro/Monstro.cpp @@ -1694,7 +1694,7 @@ QWidget * MonstroView::setupOperatorsView( QWidget * _parent ) m_osc2WaveBox = new ComboBox( view ); m_osc2WaveBox -> setGeometry( 204, O2ROW + 7, 42, ComboBox::DEFAULT_HEIGHT ); - m_osc2WaveBox->setFont( pointSize<8>( m_osc2WaveBox->font() ) ); + m_osc2WaveBox->setFont(pointSize(m_osc2WaveBox->font(), 8)); maketinyled( m_osc2SyncHButton, 212, O2ROW - 3, tr( "Hard sync oscillator 2" ) ) maketinyled( m_osc2SyncRButton, 191, O2ROW - 3, tr( "Reverse sync oscillator 2" ) ) @@ -1709,18 +1709,18 @@ QWidget * MonstroView::setupOperatorsView( QWidget * _parent ) m_osc3Wave1Box = new ComboBox( view ); m_osc3Wave1Box -> setGeometry( 160, O3ROW + 7, 42, ComboBox::DEFAULT_HEIGHT ); - m_osc3Wave1Box->setFont( pointSize<8>( m_osc3Wave1Box->font() ) ); + m_osc3Wave1Box->setFont(pointSize(m_osc3Wave1Box->font(), 8)); m_osc3Wave2Box = new ComboBox( view ); m_osc3Wave2Box -> setGeometry( 204, O3ROW + 7, 42, ComboBox::DEFAULT_HEIGHT ); - m_osc3Wave2Box->setFont( pointSize<8>( m_osc3Wave2Box->font() ) ); + m_osc3Wave2Box->setFont(pointSize(m_osc3Wave2Box->font(), 8)); maketinyled( m_osc3SyncHButton, 212, O3ROW - 3, tr( "Hard sync oscillator 3" ) ) maketinyled( m_osc3SyncRButton, 191, O3ROW - 3, tr( "Reverse sync oscillator 3" ) ) m_lfo1WaveBox = new ComboBox( view ); m_lfo1WaveBox -> setGeometry( 2, LFOROW + 7, 42, ComboBox::DEFAULT_HEIGHT ); - m_lfo1WaveBox->setFont( pointSize<8>( m_lfo1WaveBox->font() ) ); + m_lfo1WaveBox->setFont(pointSize(m_lfo1WaveBox->font(), 8)); maketsknob( m_lfo1AttKnob, LFOCOL1, LFOROW, tr( "Attack" ), " ms", "lfoKnob" ) maketsknob( m_lfo1RateKnob, LFOCOL2, LFOROW, tr( "Rate" ), " ms", "lfoKnob" ) @@ -1728,7 +1728,7 @@ QWidget * MonstroView::setupOperatorsView( QWidget * _parent ) m_lfo2WaveBox = new ComboBox( view ); m_lfo2WaveBox -> setGeometry( 127, LFOROW + 7, 42, ComboBox::DEFAULT_HEIGHT ); - m_lfo2WaveBox->setFont( pointSize<8>( m_lfo2WaveBox->font() ) ); + m_lfo2WaveBox->setFont(pointSize(m_lfo2WaveBox->font(), 8)); maketsknob(m_lfo2AttKnob, LFOCOL4, LFOROW, tr("Attack"), " ms", "lfoKnob") maketsknob(m_lfo2RateKnob, LFOCOL5, LFOROW, tr("Rate"), " ms", "lfoKnob") diff --git a/plugins/Patman/Patman.cpp b/plugins/Patman/Patman.cpp index e525498a5ee..25664ae0dd6 100644 --- a/plugins/Patman/Patman.cpp +++ b/plugins/Patman/Patman.cpp @@ -548,7 +548,7 @@ void PatmanView::updateFilename() m_displayFilename = ""; int idx = m_pi->m_patchFile.length(); - QFontMetrics fm( pointSize<8>( font() ) ); + QFontMetrics fm(pointSize(font(), 8)); // simple algorithm for creating a text from the filename that // matches in the white rectangle @@ -618,7 +618,7 @@ void PatmanView::paintEvent( QPaintEvent * ) { QPainter p( this ); - p.setFont( pointSize<8>( font() ) ); + p.setFont(pointSize(font() ,8)); p.drawText( 8, 116, 235, 16, Qt::AlignLeft | Qt::TextSingleLine | Qt::AlignVCenter, m_displayFilename ); diff --git a/plugins/Stk/Mallets/Mallets.cpp b/plugins/Stk/Mallets/Mallets.cpp index c67814b5f32..1d7cbd86bad 100644 --- a/plugins/Stk/Mallets/Mallets.cpp +++ b/plugins/Stk/Mallets/Mallets.cpp @@ -450,7 +450,7 @@ MalletsInstrumentView::MalletsInstrumentView( MalletsInstrument * _instrument, m_presetsCombo = new ComboBox( this, tr( "Instrument" ) ); m_presetsCombo->setGeometry( 140, 50, 99, ComboBox::DEFAULT_HEIGHT ); - m_presetsCombo->setFont( pointSize<8>( m_presetsCombo->font() ) ); + m_presetsCombo->setFont(pointSize(m_presetsCombo->font(), 8)); connect( &_instrument->m_presetsModel, SIGNAL( dataChanged() ), this, SLOT( changePreset() ) ); diff --git a/plugins/Vestige/Vestige.cpp b/plugins/Vestige/Vestige.cpp index 583075c0cd3..a3ec267e5cc 100644 --- a/plugins/Vestige/Vestige.cpp +++ b/plugins/Vestige/Vestige.cpp @@ -587,7 +587,7 @@ VestigeInstrumentView::VestigeInstrumentView( Instrument * _instrument, m_toggleGUIButton = new QPushButton( tr( "Show/hide GUI" ), this ); m_toggleGUIButton->setGeometry( 20, 130, 200, 24 ); m_toggleGUIButton->setIcon( embed::getIconPixmap( "zoom" ) ); - m_toggleGUIButton->setFont( pointSize<8>( m_toggleGUIButton->font() ) ); + m_toggleGUIButton->setFont(pointSize(m_toggleGUIButton->font(), 8)); connect( m_toggleGUIButton, SIGNAL( clicked() ), this, SLOT( toggleGUI() ) ); @@ -596,7 +596,7 @@ VestigeInstrumentView::VestigeInstrumentView( Instrument * _instrument, this); note_off_all_btn->setGeometry( 20, 160, 200, 24 ); note_off_all_btn->setIcon( embed::getIconPixmap( "stop" ) ); - note_off_all_btn->setFont( pointSize<8>( note_off_all_btn->font() ) ); + note_off_all_btn->setFont(pointSize(note_off_all_btn->font(), 8)); connect( note_off_all_btn, SIGNAL( clicked() ), this, SLOT( noteOffAll() ) ); @@ -881,7 +881,7 @@ void VestigeInstrumentView::paintEvent( QPaintEvent * ) tr( "No VST plugin loaded" ); QFont f = p.font(); f.setBold( true ); - p.setFont( pointSize<10>( f ) ); + p.setFont(pointSize(f, 10)); p.setPen( QColor( 255, 255, 255 ) ); p.drawText( 10, 100, plugin_name ); @@ -893,7 +893,7 @@ void VestigeInstrumentView::paintEvent( QPaintEvent * ) { p.setPen( QColor( 0, 0, 0 ) ); f.setBold( false ); - p.setFont( pointSize<8>( f ) ); + p.setFont(pointSize(f, 8)); p.drawText( 10, 114, tr( "by " ) + m_vi->m_plugin->vendorString() ); p.setPen( QColor( 255, 255, 255 ) ); diff --git a/plugins/VstEffect/VstEffectControlDialog.cpp b/plugins/VstEffect/VstEffectControlDialog.cpp index 5bee94155d9..671eef56191 100644 --- a/plugins/VstEffect/VstEffectControlDialog.cpp +++ b/plugins/VstEffect/VstEffectControlDialog.cpp @@ -246,7 +246,7 @@ VstEffectControlDialog::VstEffectControlDialog( VstEffectControls * _ctl ) : tb->addWidget(space1); tbLabel = new QLabel( tr( "Effect by: " ), this ); - tbLabel->setFont( pointSize<7>( f ) ); + tbLabel->setFont(pointSize(f, 7)); tbLabel->setTextFormat(Qt::RichText); tbLabel->setAlignment( Qt::AlignTop | Qt::AlignLeft ); tb->addWidget( tbLabel ); diff --git a/plugins/ZynAddSubFx/ZynAddSubFx.cpp b/plugins/ZynAddSubFx/ZynAddSubFx.cpp index 01fa6400b79..4988e1b8bde 100644 --- a/plugins/ZynAddSubFx/ZynAddSubFx.cpp +++ b/plugins/ZynAddSubFx/ZynAddSubFx.cpp @@ -541,7 +541,7 @@ ZynAddSubFxView::ZynAddSubFxView( Instrument * _instrument, QWidget * _parent ) m_toggleUIButton->setCheckable( true ); m_toggleUIButton->setChecked( false ); m_toggleUIButton->setIcon( embed::getIconPixmap( "zoom" ) ); - m_toggleUIButton->setFont( pointSize<8>( m_toggleUIButton->font() ) ); + m_toggleUIButton->setFont(pointSize(m_toggleUIButton->font(), 8)); connect( m_toggleUIButton, SIGNAL( toggled( bool ) ), this, SLOT( toggleUI() ) ); diff --git a/src/gui/EffectView.cpp b/src/gui/EffectView.cpp index 7f7f9ee9df5..1a5efac0658 100644 --- a/src/gui/EffectView.cpp +++ b/src/gui/EffectView.cpp @@ -90,7 +90,7 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) : { auto ctls_btn = new QPushButton(tr("Controls"), this); QFont f = ctls_btn->font(); - ctls_btn->setFont( pointSize<8>( f ) ); + ctls_btn->setFont(pointSize(f, 8)); ctls_btn->setGeometry( 150, 14, 50, 20 ); connect( ctls_btn, SIGNAL(clicked()), this, SLOT(editControls())); diff --git a/src/gui/Lv2ViewBase.cpp b/src/gui/Lv2ViewBase.cpp index 77268bb9b75..6de47f450b9 100644 --- a/src/gui/Lv2ViewBase.cpp +++ b/src/gui/Lv2ViewBase.cpp @@ -157,8 +157,7 @@ Lv2ViewBase::Lv2ViewBase(QWidget* meAsWidget, Lv2ControlBase *ctrlBase) : m_toggleUIButton->setCheckable(true); m_toggleUIButton->setChecked(false); m_toggleUIButton->setIcon(embed::getIconPixmap("zoom")); - m_toggleUIButton->setFont( - pointSize<8>(m_toggleUIButton->font())); + m_toggleUIButton->setFont(pointSize(m_toggleUIButton->font(), 8)); btnBox->addWidget(m_toggleUIButton, 0); } btnBox->addStretch(1); diff --git a/src/gui/editors/AutomationEditor.cpp b/src/gui/editors/AutomationEditor.cpp index 8fd892597df..737ce227c27 100644 --- a/src/gui/editors/AutomationEditor.cpp +++ b/src/gui/editors/AutomationEditor.cpp @@ -1065,7 +1065,7 @@ void AutomationEditor::paintEvent(QPaintEvent * pe ) p.fillRect( 0, 0, width(), height(), bgColor ); // set font-size to 8 - p.setFont( pointSize<8>( p.font() ) ); + p.setFont(pointSize(p.font(), 8)); int grid_height = height() - TOP_MARGIN - SCROLLBAR_SIZE; @@ -1423,7 +1423,7 @@ void AutomationEditor::paintEvent(QPaintEvent * pe ) { QFont f = p.font(); f.setBold( true ); - p.setFont( pointSize<14>( f ) ); + p.setFont(pointSize( f, 14)); p.setPen( QApplication::palette().color( QPalette::Active, QPalette::BrightText ) ); p.drawText( VALUES_WIDTH + 20, TOP_MARGIN + 40, diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index ff88323253a..47e658f1148 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -3338,7 +3338,7 @@ void PianoRoll::paintEvent(QPaintEvent * pe ) // display note editing info //QFont f = p.font(); f.setBold( false ); - p.setFont( pointSize<10>( f ) ); + p.setFont(pointSize(f, 10)); p.setPen(m_noteModeColor); p.drawText( QRect( 0, keyAreaBottom(), m_whiteKeyWidth, noteEditBottom() - keyAreaBottom()), @@ -3601,7 +3601,7 @@ void PianoRoll::paintEvent(QPaintEvent * pe ) { QFont f = p.font(); f.setBold( true ); - p.setFont( pointSize<14>( f ) ); + p.setFont(pointSize(f, 14)); p.setPen( QApplication::palette().color( QPalette::Active, QPalette::BrightText ) ); p.drawText(m_whiteKeyWidth + 20, PR_TOP_MARGIN + 40, diff --git a/src/gui/instrument/EnvelopeAndLfoView.cpp b/src/gui/instrument/EnvelopeAndLfoView.cpp index c3bf53b39a4..2f81a4b1126 100644 --- a/src/gui/instrument/EnvelopeAndLfoView.cpp +++ b/src/gui/instrument/EnvelopeAndLfoView.cpp @@ -340,7 +340,7 @@ void EnvelopeAndLfoView::paintEvent( QPaintEvent * ) // draw LFO-graph p.drawPixmap(LFO_GRAPH_X, LFO_GRAPH_Y, m_lfoGraph); - p.setFont( pointSize<8>( p.font() ) ); + p.setFont(pointSize(p.font(), 8)); const float gray_amount = 1.0f - fabsf( m_amountKnob->value() ); diff --git a/src/gui/instrument/InstrumentFunctionViews.cpp b/src/gui/instrument/InstrumentFunctionViews.cpp index c9aa04272da..ea16486004c 100644 --- a/src/gui/instrument/InstrumentFunctionViews.cpp +++ b/src/gui/instrument/InstrumentFunctionViews.cpp @@ -57,7 +57,7 @@ InstrumentFunctionNoteStackingView::InstrumentFunctionNoteStackingView( Instrume mainLayout->setVerticalSpacing( 1 ); auto chordLabel = new QLabel(tr("Chord:")); - chordLabel->setFont( pointSize<8>( chordLabel->font() ) ); + chordLabel->setFont(pointSize(chordLabel->font(), 8)); m_chordRangeKnob->setLabel( tr( "RANGE" ) ); m_chordRangeKnob->setHintText( tr( "Chord range:" ), " " + tr( "octave(s)" ) ); @@ -146,13 +146,13 @@ InstrumentFunctionArpeggioView::InstrumentFunctionArpeggioView( InstrumentFuncti m_arpGateKnob->setHintText( tr( "Arpeggio gate:" ), tr( "%" ) ); auto arpChordLabel = new QLabel(tr("Chord:")); - arpChordLabel->setFont( pointSize<8>( arpChordLabel->font() ) ); + arpChordLabel->setFont(pointSize(arpChordLabel->font(), 8)); auto arpDirectionLabel = new QLabel(tr("Direction:")); - arpDirectionLabel->setFont( pointSize<8>( arpDirectionLabel->font() ) ); + arpDirectionLabel->setFont(pointSize(arpDirectionLabel->font(), 8)); auto arpModeLabel = new QLabel(tr("Mode:")); - arpModeLabel->setFont( pointSize<8>( arpModeLabel->font() ) ); + arpModeLabel->setFont(pointSize(arpModeLabel->font(), 8)); mainLayout->addWidget( arpChordLabel, 0, 0 ); mainLayout->addWidget( m_arpComboBox, 1, 0 ); diff --git a/src/gui/instrument/InstrumentMidiIOView.cpp b/src/gui/instrument/InstrumentMidiIOView.cpp index e321d061e98..1e95751ead0 100644 --- a/src/gui/instrument/InstrumentMidiIOView.cpp +++ b/src/gui/instrument/InstrumentMidiIOView.cpp @@ -155,7 +155,7 @@ InstrumentMidiIOView::InstrumentMidiIOView( QWidget* parent ) : auto baseVelocityHelp = new QLabel(tr("Specify the velocity normalization base for MIDI-based instruments at 100% note velocity.")); baseVelocityHelp->setWordWrap( true ); - baseVelocityHelp->setFont( pointSize<8>( baseVelocityHelp->font() ) ); + baseVelocityHelp->setFont(pointSize(baseVelocityHelp->font(), 8)); baseVelocityLayout->addWidget( baseVelocityHelp ); diff --git a/src/gui/instrument/InstrumentSoundShapingView.cpp b/src/gui/instrument/InstrumentSoundShapingView.cpp index 1bfc166b342..59df3097cb2 100644 --- a/src/gui/instrument/InstrumentSoundShapingView.cpp +++ b/src/gui/instrument/InstrumentSoundShapingView.cpp @@ -77,7 +77,7 @@ InstrumentSoundShapingView::InstrumentSoundShapingView( QWidget * _parent ) : m_filterComboBox = new ComboBox( m_filterGroupBox ); m_filterComboBox->setGeometry( 14, 22, 120, ComboBox::DEFAULT_HEIGHT ); - m_filterComboBox->setFont( pointSize<8>( m_filterComboBox->font() ) ); + m_filterComboBox->setFont(pointSize(m_filterComboBox->font(), 8)); m_filterCutKnob = new Knob( KnobType::Bright26, m_filterGroupBox ); @@ -94,7 +94,7 @@ InstrumentSoundShapingView::InstrumentSoundShapingView( QWidget * _parent ) : m_singleStreamInfoLabel = new QLabel( tr( "Envelopes, LFOs and filters are not supported by the current instrument." ), this ); m_singleStreamInfoLabel->setWordWrap( true ); - m_singleStreamInfoLabel->setFont( pointSize<8>( m_singleStreamInfoLabel->font() ) ); + m_singleStreamInfoLabel->setFont(pointSize(m_singleStreamInfoLabel->font(), 8)); m_singleStreamInfoLabel->setGeometry( TARGETS_TABWIDGET_X, TARGETS_TABWIDGET_Y, diff --git a/src/gui/instrument/InstrumentTrackWindow.cpp b/src/gui/instrument/InstrumentTrackWindow.cpp index a726dd5b989..b6a51624b26 100644 --- a/src/gui/instrument/InstrumentTrackWindow.cpp +++ b/src/gui/instrument/InstrumentTrackWindow.cpp @@ -107,7 +107,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : // setup line edit for changing instrument track name m_nameLineEdit = new QLineEdit; - m_nameLineEdit->setFont( pointSize<9>( m_nameLineEdit->font() ) ); + m_nameLineEdit->setFont(pointSize(m_nameLineEdit->font(), 9)); connect( m_nameLineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( textChanged( const QString& ) ) ); diff --git a/src/gui/instrument/InstrumentTuningView.cpp b/src/gui/instrument/InstrumentTuningView.cpp index 355d7d18c73..41c18213b5f 100644 --- a/src/gui/instrument/InstrumentTuningView.cpp +++ b/src/gui/instrument/InstrumentTuningView.cpp @@ -60,7 +60,7 @@ InstrumentTuningView::InstrumentTuningView(InstrumentTrack *it, QWidget *parent) auto tlabel = new QLabel(tr("Enables the use of global transposition")); tlabel->setWordWrap(true); - tlabel->setFont(pointSize<8>(tlabel->font())); + tlabel->setFont(pointSize(tlabel->font(), 8)); masterPitchLayout->addWidget(tlabel); // Microtuner settings diff --git a/src/gui/instrument/PianoView.cpp b/src/gui/instrument/PianoView.cpp index c8882898bc2..87ee6af9bed 100644 --- a/src/gui/instrument/PianoView.cpp +++ b/src/gui/instrument/PianoView.cpp @@ -807,7 +807,7 @@ void PianoView::paintEvent( QPaintEvent * ) QPainter p( this ); // set smaller font for printing number of every octave - p.setFont( pointSize( p.font() ) ); + p.setFont(pointSize(p.font(), LABEL_TEXT_SIZE)); // draw bar above the keyboard (there will be the labels diff --git a/src/gui/widgets/ComboBox.cpp b/src/gui/widgets/ComboBox.cpp index ccc0c675b0d..b11990b273b 100644 --- a/src/gui/widgets/ComboBox.cpp +++ b/src/gui/widgets/ComboBox.cpp @@ -49,7 +49,7 @@ ComboBox::ComboBox( QWidget * _parent, const QString & _name ) : { setFixedHeight( ComboBox::DEFAULT_HEIGHT ); - setFont( pointSize<9>( font() ) ); + setFont(pointSize(font(), 9)); connect( &m_menu, SIGNAL(triggered(QAction*)), this, SLOT(setItem(QAction*))); diff --git a/src/gui/widgets/GroupBox.cpp b/src/gui/widgets/GroupBox.cpp index e3e71a8124e..229ab13cd45 100644 --- a/src/gui/widgets/GroupBox.cpp +++ b/src/gui/widgets/GroupBox.cpp @@ -111,7 +111,7 @@ void GroupBox::paintEvent( QPaintEvent * pe ) // draw text p.setPen( palette().color( QPalette::Active, QPalette::Text ) ); - p.setFont( pointSize<8>( font() ) ); + p.setFont(pointSize(font(), 8)); int const captionX = ledButtonShown() ? 22 : 6; p.drawText(captionX, m_titleBarHeight, m_caption); diff --git a/src/gui/widgets/LedCheckBox.cpp b/src/gui/widgets/LedCheckBox.cpp index 1dbf650ed6e..7e4acd7fdbc 100644 --- a/src/gui/widgets/LedCheckBox.cpp +++ b/src/gui/widgets/LedCheckBox.cpp @@ -94,7 +94,7 @@ void LedCheckBox::initUi( LedColor _color ) if (m_legacyMode) { - setFont( pointSize<7>( font() ) ); + setFont(pointSize(font(), 7)); } setText( m_text ); @@ -116,7 +116,7 @@ void LedCheckBox::onTextUpdated() void LedCheckBox::paintLegacy(QPaintEvent * pe) { QPainter p( this ); - p.setFont( pointSize<7>( font() ) ); + p.setFont(pointSize(font(), 7)); p.drawPixmap(0, 0, model()->value() ? m_ledOnPixmap : m_ledOffPixmap); diff --git a/src/gui/widgets/MeterDialog.cpp b/src/gui/widgets/MeterDialog.cpp index ced08382ef1..eb8e5435376 100644 --- a/src/gui/widgets/MeterDialog.cpp +++ b/src/gui/widgets/MeterDialog.cpp @@ -60,7 +60,7 @@ MeterDialog::MeterDialog( QWidget * _parent, bool _simple ) : { auto num_label = new QLabel(tr("Meter Numerator"), num); QFont f = num_label->font(); - num_label->setFont( pointSize<7>( f ) ); + num_label->setFont(pointSize(f, 7)); num_layout->addSpacing( 5 ); num_layout->addWidget( num_label ); } @@ -84,7 +84,7 @@ MeterDialog::MeterDialog( QWidget * _parent, bool _simple ) : { auto den_label = new QLabel(tr("Meter Denominator"), den); QFont f = den_label->font(); - den_label->setFont( pointSize<7>( f ) ); + den_label->setFont(pointSize(f, 7)); den_layout->addSpacing( 5 ); den_layout->addWidget( den_label ); } diff --git a/src/gui/widgets/Oscilloscope.cpp b/src/gui/widgets/Oscilloscope.cpp index a689f53f367..9e0d32a2918 100644 --- a/src/gui/widgets/Oscilloscope.cpp +++ b/src/gui/widgets/Oscilloscope.cpp @@ -177,7 +177,7 @@ void Oscilloscope::paintEvent( QPaintEvent * ) else { p.setPen( QColor( 192, 192, 192 ) ); - p.setFont( pointSize<7>( p.font() ) ); + p.setFont(pointSize(p.font(), 7)); p.drawText( 6, height()-5, tr( "Click to enable" ) ); } } diff --git a/src/gui/widgets/TabBar.cpp b/src/gui/widgets/TabBar.cpp index e2949455138..ce706d5f80b 100644 --- a/src/gui/widgets/TabBar.cpp +++ b/src/gui/widgets/TabBar.cpp @@ -90,7 +90,7 @@ TabButton * TabBar::addTab( QWidget * _w, const QString & _text, int _id, _w->setFixedSize( _w->parentWidget()->size() ); } - b->setFont( pointSize<8>( b->font() ) ); + b->setFont(pointSize(b->font(), 8)); return( b ); } diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 27671933eea..2c93dba3e22 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -58,7 +58,7 @@ TabWidget::TabWidget(const QString& caption, QWidget* parent, bool usePixmap, m_tabheight = caption.isEmpty() ? m_tabbarHeight - 3 : m_tabbarHeight - 4; - setFont(pointSize<8>(font())); + setFont(pointSize(font(), 8)); setAutoFillBackground(true); QColor bg_color = QApplication::palette().color(QPalette::Active, QPalette::Window).darker(132); @@ -70,7 +70,7 @@ TabWidget::TabWidget(const QString& caption, QWidget* parent, bool usePixmap, void TabWidget::addTab(QWidget* w, const QString& name, const char* pixmap, int idx) { - setFont(pointSize<8>(font())); + setFont(pointSize(font(), 8)); // Append tab when position is not given if (idx < 0/* || m_widgets.contains(idx) == true*/) @@ -216,7 +216,7 @@ void TabWidget::resizeEvent(QResizeEvent*) void TabWidget::paintEvent(QPaintEvent* pe) { QPainter p(this); - p.setFont(pointSize<7>(font())); + p.setFont(pointSize(font(), 7)); // Draw background QBrush bg_color = p.background(); @@ -232,7 +232,7 @@ void TabWidget::paintEvent(QPaintEvent* pe) // Draw title, if any if (!m_caption.isEmpty()) { - p.setFont(pointSize<8>(p.font())); + p.setFont(pointSize(p.font(), 8)); p.setPen(tabTitleText()); p.drawText(5, 11, m_caption); } From 2945a6c220cb680b1800dcf1725d339e294d9b51 Mon Sep 17 00:00:00 2001 From: Ross maxx Date: Sun, 24 Mar 2024 12:48:42 +0530 Subject: [PATCH 03/10] refactor: merge pointSizeF function with pointSize --- include/gui_templates.h | 16 ++++++---------- .../AudioFileProcessorView.cpp | 4 ++-- .../AudioFileProcessorWaveView.cpp | 2 +- plugins/CarlaBase/Carla.cpp | 2 +- plugins/DualFilter/DualFilterControlDialog.cpp | 4 ++-- plugins/LadspaBrowser/LadspaBrowser.cpp | 2 +- plugins/Monstro/Monstro.cpp | 10 +++++----- plugins/Patman/Patman.cpp | 4 ++-- plugins/Stk/Mallets/Mallets.cpp | 2 +- plugins/Vestige/Vestige.cpp | 8 ++++---- plugins/VstEffect/VstEffectControlDialog.cpp | 2 +- plugins/ZynAddSubFx/ZynAddSubFx.cpp | 2 +- src/gui/EffectView.cpp | 4 ++-- src/gui/Lv2ViewBase.cpp | 2 +- src/gui/MixerChannelView.cpp | 2 +- src/gui/editors/AutomationEditor.cpp | 4 ++-- src/gui/editors/PianoRoll.cpp | 4 ++-- src/gui/instrument/EnvelopeAndLfoView.cpp | 4 ++-- src/gui/instrument/InstrumentFunctionViews.cpp | 8 ++++---- src/gui/instrument/InstrumentMidiIOView.cpp | 2 +- .../instrument/InstrumentSoundShapingView.cpp | 4 ++-- src/gui/instrument/InstrumentTrackWindow.cpp | 2 +- src/gui/instrument/InstrumentTuningView.cpp | 2 +- src/gui/instrument/PianoView.cpp | 2 +- src/gui/widgets/ComboBox.cpp | 2 +- src/gui/widgets/GroupBox.cpp | 2 +- src/gui/widgets/Knob.cpp | 6 +++--- src/gui/widgets/LcdFloatSpinBox.cpp | 2 +- src/gui/widgets/LcdWidget.cpp | 4 ++-- src/gui/widgets/LedCheckBox.cpp | 2 +- src/gui/widgets/MeterDialog.cpp | 2 +- src/gui/widgets/Oscilloscope.cpp | 2 +- src/gui/widgets/TabBar.cpp | 2 +- src/gui/widgets/TabWidget.cpp | 2 +- 34 files changed, 60 insertions(+), 64 deletions(-) diff --git a/include/gui_templates.h b/include/gui_templates.h index 5f85062f71f..131fe9a3585 100644 --- a/include/gui_templates.h +++ b/include/gui_templates.h @@ -44,18 +44,14 @@ namespace lmms // return DPI-independent font-size - font with returned font-size has always // the same size in pixels -inline QFont pointSize(QFont _f, int SIZE) +template +inline QFont pointSize(QFont _f, T SIZE) { - _f.setPointSizeF((int)(((float)SIZE + 0.5f) * 96 / - QGuiApplication::primaryScreen()->logicalDotsPerInchY())); - return( _f ); -} + // to calculate DPI of a screen to make it HiDPI ready + qreal devicePixelRatio = QGuiApplication::primaryScreen()->devicePixelRatio(); + qreal scaleFactor = devicePixelRatio > 1.0 ? devicePixelRatio : 1.0; // Ensure scaleFactor is at least 1.0 - -inline QFont pointSizeF( QFont _f, float SIZE ) -{ - _f.setPointSizeF((SIZE+0.5f) * 96 / - QGuiApplication::primaryScreen()->logicalDotsPerInchY()); + _f.setPointSizeF((float)SIZE * scaleFactor); return( _f ); } diff --git a/plugins/AudioFileProcessor/AudioFileProcessorView.cpp b/plugins/AudioFileProcessor/AudioFileProcessorView.cpp index 94f0da4fb67..40501999e8c 100644 --- a/plugins/AudioFileProcessor/AudioFileProcessorView.cpp +++ b/plugins/AudioFileProcessor/AudioFileProcessorView.cpp @@ -134,7 +134,7 @@ AudioFileProcessorView::AudioFileProcessorView(Instrument* instrument, // interpolation selector m_interpBox = new ComboBox(this); m_interpBox->setGeometry(142, 62, 82, ComboBox::DEFAULT_HEIGHT); - m_interpBox->setFont(pointSize(m_interpBox->font(), 8)); + m_interpBox->setFont(pointSize(m_interpBox->font(), 8)); // wavegraph m_waveView = 0; @@ -228,7 +228,7 @@ void AudioFileProcessorView::paintEvent(QPaintEvent*) int idx = a->sample().sampleFile().length(); - p.setFont(pointSize(font(), 8)); + p.setFont(pointSize(font(), 8)); QFontMetrics fm(p.font()); diff --git a/plugins/AudioFileProcessor/AudioFileProcessorWaveView.cpp b/plugins/AudioFileProcessor/AudioFileProcessorWaveView.cpp index 818fb14cb6c..67234d0ff02 100644 --- a/plugins/AudioFileProcessor/AudioFileProcessorWaveView.cpp +++ b/plugins/AudioFileProcessor/AudioFileProcessorWaveView.cpp @@ -273,7 +273,7 @@ void AudioFileProcessorWaveView::paintEvent(QPaintEvent * pe) p.fillRect(s_padding, s_padding, m_graph.width(), 14, g); p.setPen(QColor(255, 255, 255)); - p.setFont(pointSize(font(), 8)); + p.setFont(pointSize(font(), 8)); QString length_text; const int length = m_sample->sampleDuration().count(); diff --git a/plugins/CarlaBase/Carla.cpp b/plugins/CarlaBase/Carla.cpp index e58cb14af79..da603e5cb5f 100644 --- a/plugins/CarlaBase/Carla.cpp +++ b/plugins/CarlaBase/Carla.cpp @@ -632,7 +632,7 @@ CarlaInstrumentView::CarlaInstrumentView(CarlaInstrument* const instrument, QWid m_toggleUIButton->setCheckable( true ); m_toggleUIButton->setChecked( false ); m_toggleUIButton->setIcon( embed::getIconPixmap( "zoom" ) ); - m_toggleUIButton->setFont(pointSize(m_toggleUIButton->font(), 8)); + m_toggleUIButton->setFont(pointSize(m_toggleUIButton->font(), 8)); connect( m_toggleUIButton, SIGNAL( clicked(bool) ), this, SLOT( toggleUI( bool ) ) ); m_toggleUIButton->setToolTip( diff --git a/plugins/DualFilter/DualFilterControlDialog.cpp b/plugins/DualFilter/DualFilterControlDialog.cpp index 5a912ac8551..a92874597af 100644 --- a/plugins/DualFilter/DualFilterControlDialog.cpp +++ b/plugins/DualFilter/DualFilterControlDialog.cpp @@ -76,12 +76,12 @@ DualFilterControlDialog::DualFilterControlDialog( DualFilterControls* controls ) auto m_filter1ComboBox = new ComboBox(this); m_filter1ComboBox->setGeometry( 19, 70, 137, ComboBox::DEFAULT_HEIGHT ); - m_filter1ComboBox->setFont(pointSize(m_filter1ComboBox->font(), 8)); + m_filter1ComboBox->setFont(pointSize(m_filter1ComboBox->font(), 8)); m_filter1ComboBox->setModel( &controls->m_filter1Model ); auto m_filter2ComboBox = new ComboBox(this); m_filter2ComboBox->setGeometry( 217, 70, 137, ComboBox::DEFAULT_HEIGHT ); - m_filter2ComboBox->setFont(pointSize(m_filter2ComboBox->font(), 8)); + m_filter2ComboBox->setFont(pointSize(m_filter2ComboBox->font(), 8)); m_filter2ComboBox->setModel( &controls->m_filter2Model ); } diff --git a/plugins/LadspaBrowser/LadspaBrowser.cpp b/plugins/LadspaBrowser/LadspaBrowser.cpp index 54d019aad32..e50bf49539b 100644 --- a/plugins/LadspaBrowser/LadspaBrowser.cpp +++ b/plugins/LadspaBrowser/LadspaBrowser.cpp @@ -172,7 +172,7 @@ QWidget * LadspaBrowserView::createTab( QWidget * _parent, const QString & _txt, auto title = new QLabel(type + _txt, tab); QFont f = title->font(); f.setBold( true ); - title->setFont(pointSize(f, 12)); + title->setFont(pointSize(f, 12)); layout->addSpacing( 5 ); layout->addWidget( title ); diff --git a/plugins/Monstro/Monstro.cpp b/plugins/Monstro/Monstro.cpp index 76ab6e47790..3c4c12a6bf9 100644 --- a/plugins/Monstro/Monstro.cpp +++ b/plugins/Monstro/Monstro.cpp @@ -1694,7 +1694,7 @@ QWidget * MonstroView::setupOperatorsView( QWidget * _parent ) m_osc2WaveBox = new ComboBox( view ); m_osc2WaveBox -> setGeometry( 204, O2ROW + 7, 42, ComboBox::DEFAULT_HEIGHT ); - m_osc2WaveBox->setFont(pointSize(m_osc2WaveBox->font(), 8)); + m_osc2WaveBox->setFont(pointSize(m_osc2WaveBox->font(), 8)); maketinyled( m_osc2SyncHButton, 212, O2ROW - 3, tr( "Hard sync oscillator 2" ) ) maketinyled( m_osc2SyncRButton, 191, O2ROW - 3, tr( "Reverse sync oscillator 2" ) ) @@ -1709,18 +1709,18 @@ QWidget * MonstroView::setupOperatorsView( QWidget * _parent ) m_osc3Wave1Box = new ComboBox( view ); m_osc3Wave1Box -> setGeometry( 160, O3ROW + 7, 42, ComboBox::DEFAULT_HEIGHT ); - m_osc3Wave1Box->setFont(pointSize(m_osc3Wave1Box->font(), 8)); + m_osc3Wave1Box->setFont(pointSize(m_osc3Wave1Box->font(), 8)); m_osc3Wave2Box = new ComboBox( view ); m_osc3Wave2Box -> setGeometry( 204, O3ROW + 7, 42, ComboBox::DEFAULT_HEIGHT ); - m_osc3Wave2Box->setFont(pointSize(m_osc3Wave2Box->font(), 8)); + m_osc3Wave2Box->setFont(pointSize(m_osc3Wave2Box->font(), 8)); maketinyled( m_osc3SyncHButton, 212, O3ROW - 3, tr( "Hard sync oscillator 3" ) ) maketinyled( m_osc3SyncRButton, 191, O3ROW - 3, tr( "Reverse sync oscillator 3" ) ) m_lfo1WaveBox = new ComboBox( view ); m_lfo1WaveBox -> setGeometry( 2, LFOROW + 7, 42, ComboBox::DEFAULT_HEIGHT ); - m_lfo1WaveBox->setFont(pointSize(m_lfo1WaveBox->font(), 8)); + m_lfo1WaveBox->setFont(pointSize(m_lfo1WaveBox->font(), 8)); maketsknob( m_lfo1AttKnob, LFOCOL1, LFOROW, tr( "Attack" ), " ms", "lfoKnob" ) maketsknob( m_lfo1RateKnob, LFOCOL2, LFOROW, tr( "Rate" ), " ms", "lfoKnob" ) @@ -1728,7 +1728,7 @@ QWidget * MonstroView::setupOperatorsView( QWidget * _parent ) m_lfo2WaveBox = new ComboBox( view ); m_lfo2WaveBox -> setGeometry( 127, LFOROW + 7, 42, ComboBox::DEFAULT_HEIGHT ); - m_lfo2WaveBox->setFont(pointSize(m_lfo2WaveBox->font(), 8)); + m_lfo2WaveBox->setFont(pointSize(m_lfo2WaveBox->font(), 8)); maketsknob(m_lfo2AttKnob, LFOCOL4, LFOROW, tr("Attack"), " ms", "lfoKnob") maketsknob(m_lfo2RateKnob, LFOCOL5, LFOROW, tr("Rate"), " ms", "lfoKnob") diff --git a/plugins/Patman/Patman.cpp b/plugins/Patman/Patman.cpp index 25664ae0dd6..ffaad9bc1e0 100644 --- a/plugins/Patman/Patman.cpp +++ b/plugins/Patman/Patman.cpp @@ -548,7 +548,7 @@ void PatmanView::updateFilename() m_displayFilename = ""; int idx = m_pi->m_patchFile.length(); - QFontMetrics fm(pointSize(font(), 8)); + QFontMetrics fm(pointSize(font(), 8)); // simple algorithm for creating a text from the filename that // matches in the white rectangle @@ -618,7 +618,7 @@ void PatmanView::paintEvent( QPaintEvent * ) { QPainter p( this ); - p.setFont(pointSize(font() ,8)); + p.setFont(pointSize(font() ,8)); p.drawText( 8, 116, 235, 16, Qt::AlignLeft | Qt::TextSingleLine | Qt::AlignVCenter, m_displayFilename ); diff --git a/plugins/Stk/Mallets/Mallets.cpp b/plugins/Stk/Mallets/Mallets.cpp index 1d7cbd86bad..efde64f9962 100644 --- a/plugins/Stk/Mallets/Mallets.cpp +++ b/plugins/Stk/Mallets/Mallets.cpp @@ -450,7 +450,7 @@ MalletsInstrumentView::MalletsInstrumentView( MalletsInstrument * _instrument, m_presetsCombo = new ComboBox( this, tr( "Instrument" ) ); m_presetsCombo->setGeometry( 140, 50, 99, ComboBox::DEFAULT_HEIGHT ); - m_presetsCombo->setFont(pointSize(m_presetsCombo->font(), 8)); + m_presetsCombo->setFont(pointSize(m_presetsCombo->font(), 8)); connect( &_instrument->m_presetsModel, SIGNAL( dataChanged() ), this, SLOT( changePreset() ) ); diff --git a/plugins/Vestige/Vestige.cpp b/plugins/Vestige/Vestige.cpp index a3ec267e5cc..a8765e9f4c0 100644 --- a/plugins/Vestige/Vestige.cpp +++ b/plugins/Vestige/Vestige.cpp @@ -587,7 +587,7 @@ VestigeInstrumentView::VestigeInstrumentView( Instrument * _instrument, m_toggleGUIButton = new QPushButton( tr( "Show/hide GUI" ), this ); m_toggleGUIButton->setGeometry( 20, 130, 200, 24 ); m_toggleGUIButton->setIcon( embed::getIconPixmap( "zoom" ) ); - m_toggleGUIButton->setFont(pointSize(m_toggleGUIButton->font(), 8)); + m_toggleGUIButton->setFont(pointSize(m_toggleGUIButton->font(), 8)); connect( m_toggleGUIButton, SIGNAL( clicked() ), this, SLOT( toggleGUI() ) ); @@ -596,7 +596,7 @@ VestigeInstrumentView::VestigeInstrumentView( Instrument * _instrument, this); note_off_all_btn->setGeometry( 20, 160, 200, 24 ); note_off_all_btn->setIcon( embed::getIconPixmap( "stop" ) ); - note_off_all_btn->setFont(pointSize(note_off_all_btn->font(), 8)); + note_off_all_btn->setFont(pointSize(note_off_all_btn->font(), 8)); connect( note_off_all_btn, SIGNAL( clicked() ), this, SLOT( noteOffAll() ) ); @@ -881,7 +881,7 @@ void VestigeInstrumentView::paintEvent( QPaintEvent * ) tr( "No VST plugin loaded" ); QFont f = p.font(); f.setBold( true ); - p.setFont(pointSize(f, 10)); + p.setFont(pointSize(f, 10)); p.setPen( QColor( 255, 255, 255 ) ); p.drawText( 10, 100, plugin_name ); @@ -893,7 +893,7 @@ void VestigeInstrumentView::paintEvent( QPaintEvent * ) { p.setPen( QColor( 0, 0, 0 ) ); f.setBold( false ); - p.setFont(pointSize(f, 8)); + p.setFont(pointSize(f, 8)); p.drawText( 10, 114, tr( "by " ) + m_vi->m_plugin->vendorString() ); p.setPen( QColor( 255, 255, 255 ) ); diff --git a/plugins/VstEffect/VstEffectControlDialog.cpp b/plugins/VstEffect/VstEffectControlDialog.cpp index 671eef56191..091b50715b6 100644 --- a/plugins/VstEffect/VstEffectControlDialog.cpp +++ b/plugins/VstEffect/VstEffectControlDialog.cpp @@ -246,7 +246,7 @@ VstEffectControlDialog::VstEffectControlDialog( VstEffectControls * _ctl ) : tb->addWidget(space1); tbLabel = new QLabel( tr( "Effect by: " ), this ); - tbLabel->setFont(pointSize(f, 7)); + tbLabel->setFont(pointSize(f, 7)); tbLabel->setTextFormat(Qt::RichText); tbLabel->setAlignment( Qt::AlignTop | Qt::AlignLeft ); tb->addWidget( tbLabel ); diff --git a/plugins/ZynAddSubFx/ZynAddSubFx.cpp b/plugins/ZynAddSubFx/ZynAddSubFx.cpp index 4988e1b8bde..60d136c4cd5 100644 --- a/plugins/ZynAddSubFx/ZynAddSubFx.cpp +++ b/plugins/ZynAddSubFx/ZynAddSubFx.cpp @@ -541,7 +541,7 @@ ZynAddSubFxView::ZynAddSubFxView( Instrument * _instrument, QWidget * _parent ) m_toggleUIButton->setCheckable( true ); m_toggleUIButton->setChecked( false ); m_toggleUIButton->setIcon( embed::getIconPixmap( "zoom" ) ); - m_toggleUIButton->setFont(pointSize(m_toggleUIButton->font(), 8)); + m_toggleUIButton->setFont(pointSize(m_toggleUIButton->font(), 8)); connect( m_toggleUIButton, SIGNAL( toggled( bool ) ), this, SLOT( toggleUI() ) ); diff --git a/src/gui/EffectView.cpp b/src/gui/EffectView.cpp index 1a5efac0658..1fce74f1ffd 100644 --- a/src/gui/EffectView.cpp +++ b/src/gui/EffectView.cpp @@ -90,7 +90,7 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) : { auto ctls_btn = new QPushButton(tr("Controls"), this); QFont f = ctls_btn->font(); - ctls_btn->setFont(pointSize(f, 8)); + ctls_btn->setFont(pointSize(f, 8)); ctls_btn->setGeometry( 150, 14, 50, 20 ); connect( ctls_btn, SIGNAL(clicked()), this, SLOT(editControls())); @@ -257,7 +257,7 @@ void EffectView::paintEvent( QPaintEvent * ) QPainter p( this ); p.drawPixmap( 0, 0, m_bg ); - QFont f = pointSizeF( font(), 7.5f ); + QFont f = pointSize(font(), 7.5f); f.setBold( true ); p.setFont( f ); diff --git a/src/gui/Lv2ViewBase.cpp b/src/gui/Lv2ViewBase.cpp index 6de47f450b9..3efa2b9366f 100644 --- a/src/gui/Lv2ViewBase.cpp +++ b/src/gui/Lv2ViewBase.cpp @@ -157,7 +157,7 @@ Lv2ViewBase::Lv2ViewBase(QWidget* meAsWidget, Lv2ControlBase *ctrlBase) : m_toggleUIButton->setCheckable(true); m_toggleUIButton->setChecked(false); m_toggleUIButton->setIcon(embed::getIconPixmap("zoom")); - m_toggleUIButton->setFont(pointSize(m_toggleUIButton->font(), 8)); + m_toggleUIButton->setFont(pointSize(m_toggleUIButton->font(), 8)); btnBox->addWidget(m_toggleUIButton, 0); } btnBox->addStretch(1); diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index 928255806ce..cfa9ba32989 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -73,7 +73,7 @@ namespace lmms::gui m_renameLineEdit = new QLineEdit{mixerName, nullptr}; m_renameLineEdit->setFixedWidth(65); - m_renameLineEdit->setFont(pointSizeF(font(), 7.5f)); + m_renameLineEdit->setFont(pointSize(font(), 7.5f)); m_renameLineEdit->setReadOnly(true); m_renameLineEdit->installEventFilter(this); diff --git a/src/gui/editors/AutomationEditor.cpp b/src/gui/editors/AutomationEditor.cpp index 737ce227c27..a9634070059 100644 --- a/src/gui/editors/AutomationEditor.cpp +++ b/src/gui/editors/AutomationEditor.cpp @@ -1065,7 +1065,7 @@ void AutomationEditor::paintEvent(QPaintEvent * pe ) p.fillRect( 0, 0, width(), height(), bgColor ); // set font-size to 8 - p.setFont(pointSize(p.font(), 8)); + p.setFont(pointSize(p.font(), 8)); int grid_height = height() - TOP_MARGIN - SCROLLBAR_SIZE; @@ -1423,7 +1423,7 @@ void AutomationEditor::paintEvent(QPaintEvent * pe ) { QFont f = p.font(); f.setBold( true ); - p.setFont(pointSize( f, 14)); + p.setFont(pointSize(f, 14)); p.setPen( QApplication::palette().color( QPalette::Active, QPalette::BrightText ) ); p.drawText( VALUES_WIDTH + 20, TOP_MARGIN + 40, diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 47e658f1148..571cde0ecad 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -3338,7 +3338,7 @@ void PianoRoll::paintEvent(QPaintEvent * pe ) // display note editing info //QFont f = p.font(); f.setBold( false ); - p.setFont(pointSize(f, 10)); + p.setFont(pointSize(f, 10)); p.setPen(m_noteModeColor); p.drawText( QRect( 0, keyAreaBottom(), m_whiteKeyWidth, noteEditBottom() - keyAreaBottom()), @@ -3601,7 +3601,7 @@ void PianoRoll::paintEvent(QPaintEvent * pe ) { QFont f = p.font(); f.setBold( true ); - p.setFont(pointSize(f, 14)); + p.setFont(pointSize(f, 14)); p.setPen( QApplication::palette().color( QPalette::Active, QPalette::BrightText ) ); p.drawText(m_whiteKeyWidth + 20, PR_TOP_MARGIN + 40, diff --git a/src/gui/instrument/EnvelopeAndLfoView.cpp b/src/gui/instrument/EnvelopeAndLfoView.cpp index 2f81a4b1126..040ebf58601 100644 --- a/src/gui/instrument/EnvelopeAndLfoView.cpp +++ b/src/gui/instrument/EnvelopeAndLfoView.cpp @@ -207,7 +207,7 @@ EnvelopeAndLfoView::EnvelopeAndLfoView( QWidget * _parent ) : m_lfoWaveBtnGrp->addButton( random_lfo_btn ); m_x100Cb = new LedCheckBox( tr( "FREQ x 100" ), this ); - m_x100Cb->setFont( pointSizeF( m_x100Cb->font(), 6.5 ) ); + m_x100Cb->setFont(pointSize(m_x100Cb->font(), 6.5)); m_x100Cb->move( LFO_PREDELAY_KNOB_X, LFO_GRAPH_Y + 36 ); m_x100Cb->setToolTip(tr("Multiply LFO frequency by 100")); @@ -215,7 +215,7 @@ EnvelopeAndLfoView::EnvelopeAndLfoView( QWidget * _parent ) : m_controlEnvAmountCb = new LedCheckBox( tr( "MODULATE ENV AMOUNT" ), this ); m_controlEnvAmountCb->move( LFO_PREDELAY_KNOB_X, LFO_GRAPH_Y + 54 ); - m_controlEnvAmountCb->setFont( pointSizeF( m_controlEnvAmountCb->font(), 6.5 ) ); + m_controlEnvAmountCb->setFont(pointSize(m_controlEnvAmountCb->font(), 6.5)); m_controlEnvAmountCb->setToolTip( tr( "Control envelope amount by this LFO" ) ); diff --git a/src/gui/instrument/InstrumentFunctionViews.cpp b/src/gui/instrument/InstrumentFunctionViews.cpp index ea16486004c..5b02693fce6 100644 --- a/src/gui/instrument/InstrumentFunctionViews.cpp +++ b/src/gui/instrument/InstrumentFunctionViews.cpp @@ -57,7 +57,7 @@ InstrumentFunctionNoteStackingView::InstrumentFunctionNoteStackingView( Instrume mainLayout->setVerticalSpacing( 1 ); auto chordLabel = new QLabel(tr("Chord:")); - chordLabel->setFont(pointSize(chordLabel->font(), 8)); + chordLabel->setFont(pointSize(chordLabel->font(), 8)); m_chordRangeKnob->setLabel( tr( "RANGE" ) ); m_chordRangeKnob->setHintText( tr( "Chord range:" ), " " + tr( "octave(s)" ) ); @@ -146,13 +146,13 @@ InstrumentFunctionArpeggioView::InstrumentFunctionArpeggioView( InstrumentFuncti m_arpGateKnob->setHintText( tr( "Arpeggio gate:" ), tr( "%" ) ); auto arpChordLabel = new QLabel(tr("Chord:")); - arpChordLabel->setFont(pointSize(arpChordLabel->font(), 8)); + arpChordLabel->setFont(pointSize(arpChordLabel->font(), 8)); auto arpDirectionLabel = new QLabel(tr("Direction:")); - arpDirectionLabel->setFont(pointSize(arpDirectionLabel->font(), 8)); + arpDirectionLabel->setFont(pointSize(arpDirectionLabel->font(), 8)); auto arpModeLabel = new QLabel(tr("Mode:")); - arpModeLabel->setFont(pointSize(arpModeLabel->font(), 8)); + arpModeLabel->setFont(pointSize(arpModeLabel->font(), 8)); mainLayout->addWidget( arpChordLabel, 0, 0 ); mainLayout->addWidget( m_arpComboBox, 1, 0 ); diff --git a/src/gui/instrument/InstrumentMidiIOView.cpp b/src/gui/instrument/InstrumentMidiIOView.cpp index 1e95751ead0..e8aacce2583 100644 --- a/src/gui/instrument/InstrumentMidiIOView.cpp +++ b/src/gui/instrument/InstrumentMidiIOView.cpp @@ -155,7 +155,7 @@ InstrumentMidiIOView::InstrumentMidiIOView( QWidget* parent ) : auto baseVelocityHelp = new QLabel(tr("Specify the velocity normalization base for MIDI-based instruments at 100% note velocity.")); baseVelocityHelp->setWordWrap( true ); - baseVelocityHelp->setFont(pointSize(baseVelocityHelp->font(), 8)); + baseVelocityHelp->setFont(pointSize(baseVelocityHelp->font(), 8)); baseVelocityLayout->addWidget( baseVelocityHelp ); diff --git a/src/gui/instrument/InstrumentSoundShapingView.cpp b/src/gui/instrument/InstrumentSoundShapingView.cpp index 59df3097cb2..21e9bc699c6 100644 --- a/src/gui/instrument/InstrumentSoundShapingView.cpp +++ b/src/gui/instrument/InstrumentSoundShapingView.cpp @@ -77,7 +77,7 @@ InstrumentSoundShapingView::InstrumentSoundShapingView( QWidget * _parent ) : m_filterComboBox = new ComboBox( m_filterGroupBox ); m_filterComboBox->setGeometry( 14, 22, 120, ComboBox::DEFAULT_HEIGHT ); - m_filterComboBox->setFont(pointSize(m_filterComboBox->font(), 8)); + m_filterComboBox->setFont(pointSize(m_filterComboBox->font(), 8)); m_filterCutKnob = new Knob( KnobType::Bright26, m_filterGroupBox ); @@ -94,7 +94,7 @@ InstrumentSoundShapingView::InstrumentSoundShapingView( QWidget * _parent ) : m_singleStreamInfoLabel = new QLabel( tr( "Envelopes, LFOs and filters are not supported by the current instrument." ), this ); m_singleStreamInfoLabel->setWordWrap( true ); - m_singleStreamInfoLabel->setFont(pointSize(m_singleStreamInfoLabel->font(), 8)); + m_singleStreamInfoLabel->setFont(pointSize(m_singleStreamInfoLabel->font(), 8)); m_singleStreamInfoLabel->setGeometry( TARGETS_TABWIDGET_X, TARGETS_TABWIDGET_Y, diff --git a/src/gui/instrument/InstrumentTrackWindow.cpp b/src/gui/instrument/InstrumentTrackWindow.cpp index b6a51624b26..641bb36584a 100644 --- a/src/gui/instrument/InstrumentTrackWindow.cpp +++ b/src/gui/instrument/InstrumentTrackWindow.cpp @@ -107,7 +107,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : // setup line edit for changing instrument track name m_nameLineEdit = new QLineEdit; - m_nameLineEdit->setFont(pointSize(m_nameLineEdit->font(), 9)); + m_nameLineEdit->setFont(pointSize(m_nameLineEdit->font(), 9)); connect( m_nameLineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( textChanged( const QString& ) ) ); diff --git a/src/gui/instrument/InstrumentTuningView.cpp b/src/gui/instrument/InstrumentTuningView.cpp index 41c18213b5f..f6b08b38a52 100644 --- a/src/gui/instrument/InstrumentTuningView.cpp +++ b/src/gui/instrument/InstrumentTuningView.cpp @@ -60,7 +60,7 @@ InstrumentTuningView::InstrumentTuningView(InstrumentTrack *it, QWidget *parent) auto tlabel = new QLabel(tr("Enables the use of global transposition")); tlabel->setWordWrap(true); - tlabel->setFont(pointSize(tlabel->font(), 8)); + tlabel->setFont(pointSize(tlabel->font(), 8)); masterPitchLayout->addWidget(tlabel); // Microtuner settings diff --git a/src/gui/instrument/PianoView.cpp b/src/gui/instrument/PianoView.cpp index 87ee6af9bed..3c9dd309635 100644 --- a/src/gui/instrument/PianoView.cpp +++ b/src/gui/instrument/PianoView.cpp @@ -807,7 +807,7 @@ void PianoView::paintEvent( QPaintEvent * ) QPainter p( this ); // set smaller font for printing number of every octave - p.setFont(pointSize(p.font(), LABEL_TEXT_SIZE)); + p.setFont(pointSize(p.font(), LABEL_TEXT_SIZE)); // draw bar above the keyboard (there will be the labels diff --git a/src/gui/widgets/ComboBox.cpp b/src/gui/widgets/ComboBox.cpp index b11990b273b..26bb218c499 100644 --- a/src/gui/widgets/ComboBox.cpp +++ b/src/gui/widgets/ComboBox.cpp @@ -49,7 +49,7 @@ ComboBox::ComboBox( QWidget * _parent, const QString & _name ) : { setFixedHeight( ComboBox::DEFAULT_HEIGHT ); - setFont(pointSize(font(), 9)); + setFont(pointSize(font(), 9)); connect( &m_menu, SIGNAL(triggered(QAction*)), this, SLOT(setItem(QAction*))); diff --git a/src/gui/widgets/GroupBox.cpp b/src/gui/widgets/GroupBox.cpp index 229ab13cd45..0c771fe08b1 100644 --- a/src/gui/widgets/GroupBox.cpp +++ b/src/gui/widgets/GroupBox.cpp @@ -111,7 +111,7 @@ void GroupBox::paintEvent( QPaintEvent * pe ) // draw text p.setPen( palette().color( QPalette::Active, QPalette::Text ) ); - p.setFont(pointSize(font(), 8)); + p.setFont(pointSize(font(), 8)); int const captionX = ledButtonShown() ? 22 : 6; p.drawText(captionX, m_titleBarHeight, m_caption); diff --git a/src/gui/widgets/Knob.cpp b/src/gui/widgets/Knob.cpp index 00a9363c87f..c8446a6b877 100644 --- a/src/gui/widgets/Knob.cpp +++ b/src/gui/widgets/Knob.cpp @@ -139,7 +139,7 @@ void Knob::setLabel( const QString & txt ) if( m_knobPixmap ) { setFixedSize(qMax( m_knobPixmap->width(), - horizontalAdvance(QFontMetrics(pointSizeF(font(), 6.5)), m_label)), + horizontalAdvance(QFontMetrics(pointSize(font(), 6.5)), m_label)), m_knobPixmap->height() + 10); } @@ -459,7 +459,7 @@ void Knob::paintEvent( QPaintEvent * _me ) { if (!m_isHtmlLabel) { - p.setFont(pointSizeF(p.font(), 6.5)); + p.setFont(pointSize(p.font(), 6.5f)); p.setPen(textColor()); p.drawText(width() / 2 - horizontalAdvance(p.fontMetrics(), m_label) / 2, @@ -467,7 +467,7 @@ void Knob::paintEvent( QPaintEvent * _me ) } else { - m_tdRenderer->setDefaultFont(pointSizeF(p.font(), 6.5)); + m_tdRenderer->setDefaultFont(pointSize(p.font(), 6.5f)); p.translate((width() - m_tdRenderer->idealWidth()) / 2, (height() - m_tdRenderer->pageSize().height()) / 2); m_tdRenderer->drawContents(&p); } diff --git a/src/gui/widgets/LcdFloatSpinBox.cpp b/src/gui/widgets/LcdFloatSpinBox.cpp index c7e20467a5b..10e791e17d5 100644 --- a/src/gui/widgets/LcdFloatSpinBox.cpp +++ b/src/gui/widgets/LcdFloatSpinBox.cpp @@ -245,7 +245,7 @@ void LcdFloatSpinBox::paintEvent(QPaintEvent*) // Label if (!m_label.isEmpty()) { - p.setFont(pointSizeF(p.font(), 6.5)); + p.setFont(pointSize(p.font(), 6.5f)); p.setPen(m_wholeDisplay.textShadowColor()); p.drawText(width() / 2 - p.fontMetrics().boundingRect(m_label).width() / 2 + 1, height(), m_label); p.setPen(m_wholeDisplay.textColor()); diff --git a/src/gui/widgets/LcdWidget.cpp b/src/gui/widgets/LcdWidget.cpp index a409fee8bf6..cf26dd70b9f 100644 --- a/src/gui/widgets/LcdWidget.cpp +++ b/src/gui/widgets/LcdWidget.cpp @@ -203,7 +203,7 @@ void LcdWidget::paintEvent( QPaintEvent* ) // Label if( !m_label.isEmpty() ) { - p.setFont( pointSizeF( p.font(), 6.5 ) ); + p.setFont(pointSize(p.font(), 6.5f)); p.setPen( textShadowColor() ); p.drawText(width() / 2 - horizontalAdvance(p.fontMetrics(), m_label) / 2 + 1, @@ -255,7 +255,7 @@ void LcdWidget::updateSize() setFixedSize( qMax( m_cellWidth * m_numDigits + marginX1 + marginX2, - horizontalAdvance(QFontMetrics(pointSizeF(font(), 6.5)), m_label) + horizontalAdvance(QFontMetrics(pointSize(font(), 6.5f)), m_label) ), m_cellHeight + (2 * marginY) + 9 ); diff --git a/src/gui/widgets/LedCheckBox.cpp b/src/gui/widgets/LedCheckBox.cpp index 7e4acd7fdbc..11ac950bad8 100644 --- a/src/gui/widgets/LedCheckBox.cpp +++ b/src/gui/widgets/LedCheckBox.cpp @@ -94,7 +94,7 @@ void LedCheckBox::initUi( LedColor _color ) if (m_legacyMode) { - setFont(pointSize(font(), 7)); + setFont(pointSize(font(), 7)); } setText( m_text ); diff --git a/src/gui/widgets/MeterDialog.cpp b/src/gui/widgets/MeterDialog.cpp index eb8e5435376..2f3a501486f 100644 --- a/src/gui/widgets/MeterDialog.cpp +++ b/src/gui/widgets/MeterDialog.cpp @@ -60,7 +60,7 @@ MeterDialog::MeterDialog( QWidget * _parent, bool _simple ) : { auto num_label = new QLabel(tr("Meter Numerator"), num); QFont f = num_label->font(); - num_label->setFont(pointSize(f, 7)); + num_label->setFont(pointSize(f, 7)); num_layout->addSpacing( 5 ); num_layout->addWidget( num_label ); } diff --git a/src/gui/widgets/Oscilloscope.cpp b/src/gui/widgets/Oscilloscope.cpp index 9e0d32a2918..b4de4d710c9 100644 --- a/src/gui/widgets/Oscilloscope.cpp +++ b/src/gui/widgets/Oscilloscope.cpp @@ -177,7 +177,7 @@ void Oscilloscope::paintEvent( QPaintEvent * ) else { p.setPen( QColor( 192, 192, 192 ) ); - p.setFont(pointSize(p.font(), 7)); + p.setFont(pointSize(p.font(), 7)); p.drawText( 6, height()-5, tr( "Click to enable" ) ); } } diff --git a/src/gui/widgets/TabBar.cpp b/src/gui/widgets/TabBar.cpp index ce706d5f80b..747a7e47908 100644 --- a/src/gui/widgets/TabBar.cpp +++ b/src/gui/widgets/TabBar.cpp @@ -90,7 +90,7 @@ TabButton * TabBar::addTab( QWidget * _w, const QString & _text, int _id, _w->setFixedSize( _w->parentWidget()->size() ); } - b->setFont(pointSize(b->font(), 8)); + b->setFont(pointSize(b->font(), 8)); return( b ); } diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 2c93dba3e22..43fa101474c 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -58,7 +58,7 @@ TabWidget::TabWidget(const QString& caption, QWidget* parent, bool usePixmap, m_tabheight = caption.isEmpty() ? m_tabbarHeight - 3 : m_tabbarHeight - 4; - setFont(pointSize(font(), 8)); + setFont(pointSize(font(), 8)); setAutoFillBackground(true); QColor bg_color = QApplication::palette().color(QPalette::Active, QPalette::Window).darker(132); From 832cf78a83422cc20235c28b5778fd6b7daf914b Mon Sep 17 00:00:00 2001 From: Ross maxx Date: Sun, 24 Mar 2024 13:18:06 +0530 Subject: [PATCH 04/10] missed these --- plugins/CarlaBase/Carla.cpp | 2 +- src/gui/instrument/EnvelopeAndLfoView.cpp | 2 +- src/gui/widgets/LedCheckBox.cpp | 2 +- src/gui/widgets/MeterDialog.cpp | 2 +- src/gui/widgets/TabWidget.cpp | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/CarlaBase/Carla.cpp b/plugins/CarlaBase/Carla.cpp index da603e5cb5f..ffdbe4a37e8 100644 --- a/plugins/CarlaBase/Carla.cpp +++ b/plugins/CarlaBase/Carla.cpp @@ -642,7 +642,7 @@ CarlaInstrumentView::CarlaInstrumentView(CarlaInstrument* const instrument, QWid m_toggleParamsWindowButton = new QPushButton(tr("Params"), this); m_toggleParamsWindowButton->setIcon(embed::getIconPixmap("controller")); m_toggleParamsWindowButton->setCheckable(true); - m_toggleParamsWindowButton->setFont(pointSize(m_toggleParamsWindowButton->font(), 8)); + m_toggleParamsWindowButton->setFont(pointSize(m_toggleParamsWindowButton->font(), 8)); #if CARLA_VERSION_HEX < CARLA_MIN_PARAM_VERSION m_toggleParamsWindowButton->setEnabled(false); m_toggleParamsWindowButton->setToolTip(tr("Available from Carla version 2.1 and up.")); diff --git a/src/gui/instrument/EnvelopeAndLfoView.cpp b/src/gui/instrument/EnvelopeAndLfoView.cpp index 040ebf58601..0c3367f4e10 100644 --- a/src/gui/instrument/EnvelopeAndLfoView.cpp +++ b/src/gui/instrument/EnvelopeAndLfoView.cpp @@ -340,7 +340,7 @@ void EnvelopeAndLfoView::paintEvent( QPaintEvent * ) // draw LFO-graph p.drawPixmap(LFO_GRAPH_X, LFO_GRAPH_Y, m_lfoGraph); - p.setFont(pointSize(p.font(), 8)); + p.setFont(pointSize(p.font(), 8)); const float gray_amount = 1.0f - fabsf( m_amountKnob->value() ); diff --git a/src/gui/widgets/LedCheckBox.cpp b/src/gui/widgets/LedCheckBox.cpp index 11ac950bad8..e2078177043 100644 --- a/src/gui/widgets/LedCheckBox.cpp +++ b/src/gui/widgets/LedCheckBox.cpp @@ -116,7 +116,7 @@ void LedCheckBox::onTextUpdated() void LedCheckBox::paintLegacy(QPaintEvent * pe) { QPainter p( this ); - p.setFont(pointSize(font(), 7)); + p.setFont(pointSize(font(), 7)); p.drawPixmap(0, 0, model()->value() ? m_ledOnPixmap : m_ledOffPixmap); diff --git a/src/gui/widgets/MeterDialog.cpp b/src/gui/widgets/MeterDialog.cpp index 2f3a501486f..6b57dfaf1e3 100644 --- a/src/gui/widgets/MeterDialog.cpp +++ b/src/gui/widgets/MeterDialog.cpp @@ -84,7 +84,7 @@ MeterDialog::MeterDialog( QWidget * _parent, bool _simple ) : { auto den_label = new QLabel(tr("Meter Denominator"), den); QFont f = den_label->font(); - den_label->setFont(pointSize(f, 7)); + den_label->setFont(pointSize(f, 7)); den_layout->addSpacing( 5 ); den_layout->addWidget( den_label ); } diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 43fa101474c..275d757aa75 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -70,7 +70,7 @@ TabWidget::TabWidget(const QString& caption, QWidget* parent, bool usePixmap, void TabWidget::addTab(QWidget* w, const QString& name, const char* pixmap, int idx) { - setFont(pointSize(font(), 8)); + setFont(pointSize(font(), 8)); // Append tab when position is not given if (idx < 0/* || m_widgets.contains(idx) == true*/) @@ -216,7 +216,7 @@ void TabWidget::resizeEvent(QResizeEvent*) void TabWidget::paintEvent(QPaintEvent* pe) { QPainter p(this); - p.setFont(pointSize(font(), 7)); + p.setFont(pointSize(font(), 7)); // Draw background QBrush bg_color = p.background(); @@ -232,7 +232,7 @@ void TabWidget::paintEvent(QPaintEvent* pe) // Draw title, if any if (!m_caption.isEmpty()) { - p.setFont(pointSize(p.font(), 8)); + p.setFont(pointSize(p.font(), 8)); p.setPen(tabTitleText()); p.drawText(5, 11, m_caption); } From 137b5d5fb240c83c45014d289509dbbbba1de259 Mon Sep 17 00:00:00 2001 From: Ross maxx Date: Sun, 24 Mar 2024 14:29:35 +0530 Subject: [PATCH 05/10] removed template per michael's review --- include/gui_templates.h | 5 ++--- plugins/AudioFileProcessor/AudioFileProcessorView.cpp | 4 ++-- .../AudioFileProcessor/AudioFileProcessorWaveView.cpp | 2 +- plugins/CarlaBase/Carla.cpp | 4 ++-- plugins/DualFilter/DualFilterControlDialog.cpp | 4 ++-- plugins/LadspaBrowser/LadspaBrowser.cpp | 2 +- plugins/Monstro/Monstro.cpp | 10 +++++----- plugins/Patman/Patman.cpp | 4 ++-- plugins/Stk/Mallets/Mallets.cpp | 2 +- plugins/Vestige/Vestige.cpp | 8 ++++---- plugins/VstEffect/VstEffectControlDialog.cpp | 2 +- plugins/ZynAddSubFx/ZynAddSubFx.cpp | 2 +- src/gui/EffectView.cpp | 4 ++-- src/gui/Lv2ViewBase.cpp | 2 +- src/gui/MixerChannelView.cpp | 2 +- src/gui/editors/AutomationEditor.cpp | 4 ++-- src/gui/editors/PianoRoll.cpp | 4 ++-- src/gui/instrument/EnvelopeAndLfoView.cpp | 6 +++--- src/gui/instrument/InstrumentFunctionViews.cpp | 8 ++++---- src/gui/instrument/InstrumentMidiIOView.cpp | 2 +- src/gui/instrument/InstrumentSoundShapingView.cpp | 4 ++-- src/gui/instrument/InstrumentTrackWindow.cpp | 2 +- src/gui/instrument/InstrumentTuningView.cpp | 2 +- src/gui/instrument/PianoView.cpp | 2 +- src/gui/widgets/ComboBox.cpp | 2 +- src/gui/widgets/GroupBox.cpp | 2 +- src/gui/widgets/Knob.cpp | 6 +++--- src/gui/widgets/LcdFloatSpinBox.cpp | 2 +- src/gui/widgets/LcdWidget.cpp | 4 ++-- src/gui/widgets/LedCheckBox.cpp | 7 ++----- src/gui/widgets/MeterDialog.cpp | 4 ++-- src/gui/widgets/Oscilloscope.cpp | 2 +- src/gui/widgets/TabBar.cpp | 2 +- src/gui/widgets/TabWidget.cpp | 8 ++++---- 34 files changed, 63 insertions(+), 67 deletions(-) diff --git a/include/gui_templates.h b/include/gui_templates.h index 131fe9a3585..39971bd6d63 100644 --- a/include/gui_templates.h +++ b/include/gui_templates.h @@ -44,14 +44,13 @@ namespace lmms // return DPI-independent font-size - font with returned font-size has always // the same size in pixels -template -inline QFont pointSize(QFont _f, T SIZE) +inline QFont pointSize(QFont _f, float SIZE) { // to calculate DPI of a screen to make it HiDPI ready qreal devicePixelRatio = QGuiApplication::primaryScreen()->devicePixelRatio(); qreal scaleFactor = devicePixelRatio > 1.0 ? devicePixelRatio : 1.0; // Ensure scaleFactor is at least 1.0 - _f.setPointSizeF((float)SIZE * scaleFactor); + _f.setPointSizeF(SIZE * scaleFactor); return( _f ); } diff --git a/plugins/AudioFileProcessor/AudioFileProcessorView.cpp b/plugins/AudioFileProcessor/AudioFileProcessorView.cpp index 40501999e8c..94f0da4fb67 100644 --- a/plugins/AudioFileProcessor/AudioFileProcessorView.cpp +++ b/plugins/AudioFileProcessor/AudioFileProcessorView.cpp @@ -134,7 +134,7 @@ AudioFileProcessorView::AudioFileProcessorView(Instrument* instrument, // interpolation selector m_interpBox = new ComboBox(this); m_interpBox->setGeometry(142, 62, 82, ComboBox::DEFAULT_HEIGHT); - m_interpBox->setFont(pointSize(m_interpBox->font(), 8)); + m_interpBox->setFont(pointSize(m_interpBox->font(), 8)); // wavegraph m_waveView = 0; @@ -228,7 +228,7 @@ void AudioFileProcessorView::paintEvent(QPaintEvent*) int idx = a->sample().sampleFile().length(); - p.setFont(pointSize(font(), 8)); + p.setFont(pointSize(font(), 8)); QFontMetrics fm(p.font()); diff --git a/plugins/AudioFileProcessor/AudioFileProcessorWaveView.cpp b/plugins/AudioFileProcessor/AudioFileProcessorWaveView.cpp index 67234d0ff02..818fb14cb6c 100644 --- a/plugins/AudioFileProcessor/AudioFileProcessorWaveView.cpp +++ b/plugins/AudioFileProcessor/AudioFileProcessorWaveView.cpp @@ -273,7 +273,7 @@ void AudioFileProcessorWaveView::paintEvent(QPaintEvent * pe) p.fillRect(s_padding, s_padding, m_graph.width(), 14, g); p.setPen(QColor(255, 255, 255)); - p.setFont(pointSize(font(), 8)); + p.setFont(pointSize(font(), 8)); QString length_text; const int length = m_sample->sampleDuration().count(); diff --git a/plugins/CarlaBase/Carla.cpp b/plugins/CarlaBase/Carla.cpp index ffdbe4a37e8..e58cb14af79 100644 --- a/plugins/CarlaBase/Carla.cpp +++ b/plugins/CarlaBase/Carla.cpp @@ -632,7 +632,7 @@ CarlaInstrumentView::CarlaInstrumentView(CarlaInstrument* const instrument, QWid m_toggleUIButton->setCheckable( true ); m_toggleUIButton->setChecked( false ); m_toggleUIButton->setIcon( embed::getIconPixmap( "zoom" ) ); - m_toggleUIButton->setFont(pointSize(m_toggleUIButton->font(), 8)); + m_toggleUIButton->setFont(pointSize(m_toggleUIButton->font(), 8)); connect( m_toggleUIButton, SIGNAL( clicked(bool) ), this, SLOT( toggleUI( bool ) ) ); m_toggleUIButton->setToolTip( @@ -642,7 +642,7 @@ CarlaInstrumentView::CarlaInstrumentView(CarlaInstrument* const instrument, QWid m_toggleParamsWindowButton = new QPushButton(tr("Params"), this); m_toggleParamsWindowButton->setIcon(embed::getIconPixmap("controller")); m_toggleParamsWindowButton->setCheckable(true); - m_toggleParamsWindowButton->setFont(pointSize(m_toggleParamsWindowButton->font(), 8)); + m_toggleParamsWindowButton->setFont(pointSize(m_toggleParamsWindowButton->font(), 8)); #if CARLA_VERSION_HEX < CARLA_MIN_PARAM_VERSION m_toggleParamsWindowButton->setEnabled(false); m_toggleParamsWindowButton->setToolTip(tr("Available from Carla version 2.1 and up.")); diff --git a/plugins/DualFilter/DualFilterControlDialog.cpp b/plugins/DualFilter/DualFilterControlDialog.cpp index a92874597af..5a912ac8551 100644 --- a/plugins/DualFilter/DualFilterControlDialog.cpp +++ b/plugins/DualFilter/DualFilterControlDialog.cpp @@ -76,12 +76,12 @@ DualFilterControlDialog::DualFilterControlDialog( DualFilterControls* controls ) auto m_filter1ComboBox = new ComboBox(this); m_filter1ComboBox->setGeometry( 19, 70, 137, ComboBox::DEFAULT_HEIGHT ); - m_filter1ComboBox->setFont(pointSize(m_filter1ComboBox->font(), 8)); + m_filter1ComboBox->setFont(pointSize(m_filter1ComboBox->font(), 8)); m_filter1ComboBox->setModel( &controls->m_filter1Model ); auto m_filter2ComboBox = new ComboBox(this); m_filter2ComboBox->setGeometry( 217, 70, 137, ComboBox::DEFAULT_HEIGHT ); - m_filter2ComboBox->setFont(pointSize(m_filter2ComboBox->font(), 8)); + m_filter2ComboBox->setFont(pointSize(m_filter2ComboBox->font(), 8)); m_filter2ComboBox->setModel( &controls->m_filter2Model ); } diff --git a/plugins/LadspaBrowser/LadspaBrowser.cpp b/plugins/LadspaBrowser/LadspaBrowser.cpp index e50bf49539b..54d019aad32 100644 --- a/plugins/LadspaBrowser/LadspaBrowser.cpp +++ b/plugins/LadspaBrowser/LadspaBrowser.cpp @@ -172,7 +172,7 @@ QWidget * LadspaBrowserView::createTab( QWidget * _parent, const QString & _txt, auto title = new QLabel(type + _txt, tab); QFont f = title->font(); f.setBold( true ); - title->setFont(pointSize(f, 12)); + title->setFont(pointSize(f, 12)); layout->addSpacing( 5 ); layout->addWidget( title ); diff --git a/plugins/Monstro/Monstro.cpp b/plugins/Monstro/Monstro.cpp index 3c4c12a6bf9..76ab6e47790 100644 --- a/plugins/Monstro/Monstro.cpp +++ b/plugins/Monstro/Monstro.cpp @@ -1694,7 +1694,7 @@ QWidget * MonstroView::setupOperatorsView( QWidget * _parent ) m_osc2WaveBox = new ComboBox( view ); m_osc2WaveBox -> setGeometry( 204, O2ROW + 7, 42, ComboBox::DEFAULT_HEIGHT ); - m_osc2WaveBox->setFont(pointSize(m_osc2WaveBox->font(), 8)); + m_osc2WaveBox->setFont(pointSize(m_osc2WaveBox->font(), 8)); maketinyled( m_osc2SyncHButton, 212, O2ROW - 3, tr( "Hard sync oscillator 2" ) ) maketinyled( m_osc2SyncRButton, 191, O2ROW - 3, tr( "Reverse sync oscillator 2" ) ) @@ -1709,18 +1709,18 @@ QWidget * MonstroView::setupOperatorsView( QWidget * _parent ) m_osc3Wave1Box = new ComboBox( view ); m_osc3Wave1Box -> setGeometry( 160, O3ROW + 7, 42, ComboBox::DEFAULT_HEIGHT ); - m_osc3Wave1Box->setFont(pointSize(m_osc3Wave1Box->font(), 8)); + m_osc3Wave1Box->setFont(pointSize(m_osc3Wave1Box->font(), 8)); m_osc3Wave2Box = new ComboBox( view ); m_osc3Wave2Box -> setGeometry( 204, O3ROW + 7, 42, ComboBox::DEFAULT_HEIGHT ); - m_osc3Wave2Box->setFont(pointSize(m_osc3Wave2Box->font(), 8)); + m_osc3Wave2Box->setFont(pointSize(m_osc3Wave2Box->font(), 8)); maketinyled( m_osc3SyncHButton, 212, O3ROW - 3, tr( "Hard sync oscillator 3" ) ) maketinyled( m_osc3SyncRButton, 191, O3ROW - 3, tr( "Reverse sync oscillator 3" ) ) m_lfo1WaveBox = new ComboBox( view ); m_lfo1WaveBox -> setGeometry( 2, LFOROW + 7, 42, ComboBox::DEFAULT_HEIGHT ); - m_lfo1WaveBox->setFont(pointSize(m_lfo1WaveBox->font(), 8)); + m_lfo1WaveBox->setFont(pointSize(m_lfo1WaveBox->font(), 8)); maketsknob( m_lfo1AttKnob, LFOCOL1, LFOROW, tr( "Attack" ), " ms", "lfoKnob" ) maketsknob( m_lfo1RateKnob, LFOCOL2, LFOROW, tr( "Rate" ), " ms", "lfoKnob" ) @@ -1728,7 +1728,7 @@ QWidget * MonstroView::setupOperatorsView( QWidget * _parent ) m_lfo2WaveBox = new ComboBox( view ); m_lfo2WaveBox -> setGeometry( 127, LFOROW + 7, 42, ComboBox::DEFAULT_HEIGHT ); - m_lfo2WaveBox->setFont(pointSize(m_lfo2WaveBox->font(), 8)); + m_lfo2WaveBox->setFont(pointSize(m_lfo2WaveBox->font(), 8)); maketsknob(m_lfo2AttKnob, LFOCOL4, LFOROW, tr("Attack"), " ms", "lfoKnob") maketsknob(m_lfo2RateKnob, LFOCOL5, LFOROW, tr("Rate"), " ms", "lfoKnob") diff --git a/plugins/Patman/Patman.cpp b/plugins/Patman/Patman.cpp index ffaad9bc1e0..25664ae0dd6 100644 --- a/plugins/Patman/Patman.cpp +++ b/plugins/Patman/Patman.cpp @@ -548,7 +548,7 @@ void PatmanView::updateFilename() m_displayFilename = ""; int idx = m_pi->m_patchFile.length(); - QFontMetrics fm(pointSize(font(), 8)); + QFontMetrics fm(pointSize(font(), 8)); // simple algorithm for creating a text from the filename that // matches in the white rectangle @@ -618,7 +618,7 @@ void PatmanView::paintEvent( QPaintEvent * ) { QPainter p( this ); - p.setFont(pointSize(font() ,8)); + p.setFont(pointSize(font() ,8)); p.drawText( 8, 116, 235, 16, Qt::AlignLeft | Qt::TextSingleLine | Qt::AlignVCenter, m_displayFilename ); diff --git a/plugins/Stk/Mallets/Mallets.cpp b/plugins/Stk/Mallets/Mallets.cpp index efde64f9962..1d7cbd86bad 100644 --- a/plugins/Stk/Mallets/Mallets.cpp +++ b/plugins/Stk/Mallets/Mallets.cpp @@ -450,7 +450,7 @@ MalletsInstrumentView::MalletsInstrumentView( MalletsInstrument * _instrument, m_presetsCombo = new ComboBox( this, tr( "Instrument" ) ); m_presetsCombo->setGeometry( 140, 50, 99, ComboBox::DEFAULT_HEIGHT ); - m_presetsCombo->setFont(pointSize(m_presetsCombo->font(), 8)); + m_presetsCombo->setFont(pointSize(m_presetsCombo->font(), 8)); connect( &_instrument->m_presetsModel, SIGNAL( dataChanged() ), this, SLOT( changePreset() ) ); diff --git a/plugins/Vestige/Vestige.cpp b/plugins/Vestige/Vestige.cpp index a8765e9f4c0..a3ec267e5cc 100644 --- a/plugins/Vestige/Vestige.cpp +++ b/plugins/Vestige/Vestige.cpp @@ -587,7 +587,7 @@ VestigeInstrumentView::VestigeInstrumentView( Instrument * _instrument, m_toggleGUIButton = new QPushButton( tr( "Show/hide GUI" ), this ); m_toggleGUIButton->setGeometry( 20, 130, 200, 24 ); m_toggleGUIButton->setIcon( embed::getIconPixmap( "zoom" ) ); - m_toggleGUIButton->setFont(pointSize(m_toggleGUIButton->font(), 8)); + m_toggleGUIButton->setFont(pointSize(m_toggleGUIButton->font(), 8)); connect( m_toggleGUIButton, SIGNAL( clicked() ), this, SLOT( toggleGUI() ) ); @@ -596,7 +596,7 @@ VestigeInstrumentView::VestigeInstrumentView( Instrument * _instrument, this); note_off_all_btn->setGeometry( 20, 160, 200, 24 ); note_off_all_btn->setIcon( embed::getIconPixmap( "stop" ) ); - note_off_all_btn->setFont(pointSize(note_off_all_btn->font(), 8)); + note_off_all_btn->setFont(pointSize(note_off_all_btn->font(), 8)); connect( note_off_all_btn, SIGNAL( clicked() ), this, SLOT( noteOffAll() ) ); @@ -881,7 +881,7 @@ void VestigeInstrumentView::paintEvent( QPaintEvent * ) tr( "No VST plugin loaded" ); QFont f = p.font(); f.setBold( true ); - p.setFont(pointSize(f, 10)); + p.setFont(pointSize(f, 10)); p.setPen( QColor( 255, 255, 255 ) ); p.drawText( 10, 100, plugin_name ); @@ -893,7 +893,7 @@ void VestigeInstrumentView::paintEvent( QPaintEvent * ) { p.setPen( QColor( 0, 0, 0 ) ); f.setBold( false ); - p.setFont(pointSize(f, 8)); + p.setFont(pointSize(f, 8)); p.drawText( 10, 114, tr( "by " ) + m_vi->m_plugin->vendorString() ); p.setPen( QColor( 255, 255, 255 ) ); diff --git a/plugins/VstEffect/VstEffectControlDialog.cpp b/plugins/VstEffect/VstEffectControlDialog.cpp index 091b50715b6..671eef56191 100644 --- a/plugins/VstEffect/VstEffectControlDialog.cpp +++ b/plugins/VstEffect/VstEffectControlDialog.cpp @@ -246,7 +246,7 @@ VstEffectControlDialog::VstEffectControlDialog( VstEffectControls * _ctl ) : tb->addWidget(space1); tbLabel = new QLabel( tr( "Effect by: " ), this ); - tbLabel->setFont(pointSize(f, 7)); + tbLabel->setFont(pointSize(f, 7)); tbLabel->setTextFormat(Qt::RichText); tbLabel->setAlignment( Qt::AlignTop | Qt::AlignLeft ); tb->addWidget( tbLabel ); diff --git a/plugins/ZynAddSubFx/ZynAddSubFx.cpp b/plugins/ZynAddSubFx/ZynAddSubFx.cpp index 60d136c4cd5..4988e1b8bde 100644 --- a/plugins/ZynAddSubFx/ZynAddSubFx.cpp +++ b/plugins/ZynAddSubFx/ZynAddSubFx.cpp @@ -541,7 +541,7 @@ ZynAddSubFxView::ZynAddSubFxView( Instrument * _instrument, QWidget * _parent ) m_toggleUIButton->setCheckable( true ); m_toggleUIButton->setChecked( false ); m_toggleUIButton->setIcon( embed::getIconPixmap( "zoom" ) ); - m_toggleUIButton->setFont(pointSize(m_toggleUIButton->font(), 8)); + m_toggleUIButton->setFont(pointSize(m_toggleUIButton->font(), 8)); connect( m_toggleUIButton, SIGNAL( toggled( bool ) ), this, SLOT( toggleUI() ) ); diff --git a/src/gui/EffectView.cpp b/src/gui/EffectView.cpp index 1fce74f1ffd..cbe2e4e95ed 100644 --- a/src/gui/EffectView.cpp +++ b/src/gui/EffectView.cpp @@ -90,7 +90,7 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) : { auto ctls_btn = new QPushButton(tr("Controls"), this); QFont f = ctls_btn->font(); - ctls_btn->setFont(pointSize(f, 8)); + ctls_btn->setFont(pointSize(f, 8)); ctls_btn->setGeometry( 150, 14, 50, 20 ); connect( ctls_btn, SIGNAL(clicked()), this, SLOT(editControls())); @@ -257,7 +257,7 @@ void EffectView::paintEvent( QPaintEvent * ) QPainter p( this ); p.drawPixmap( 0, 0, m_bg ); - QFont f = pointSize(font(), 7.5f); + QFont f = pointSize(font(), 7.5f); f.setBold( true ); p.setFont( f ); diff --git a/src/gui/Lv2ViewBase.cpp b/src/gui/Lv2ViewBase.cpp index 3efa2b9366f..6de47f450b9 100644 --- a/src/gui/Lv2ViewBase.cpp +++ b/src/gui/Lv2ViewBase.cpp @@ -157,7 +157,7 @@ Lv2ViewBase::Lv2ViewBase(QWidget* meAsWidget, Lv2ControlBase *ctrlBase) : m_toggleUIButton->setCheckable(true); m_toggleUIButton->setChecked(false); m_toggleUIButton->setIcon(embed::getIconPixmap("zoom")); - m_toggleUIButton->setFont(pointSize(m_toggleUIButton->font(), 8)); + m_toggleUIButton->setFont(pointSize(m_toggleUIButton->font(), 8)); btnBox->addWidget(m_toggleUIButton, 0); } btnBox->addStretch(1); diff --git a/src/gui/MixerChannelView.cpp b/src/gui/MixerChannelView.cpp index cfa9ba32989..150daa29f73 100644 --- a/src/gui/MixerChannelView.cpp +++ b/src/gui/MixerChannelView.cpp @@ -73,7 +73,7 @@ namespace lmms::gui m_renameLineEdit = new QLineEdit{mixerName, nullptr}; m_renameLineEdit->setFixedWidth(65); - m_renameLineEdit->setFont(pointSize(font(), 7.5f)); + m_renameLineEdit->setFont(pointSize(font(), 7.5f)); m_renameLineEdit->setReadOnly(true); m_renameLineEdit->installEventFilter(this); diff --git a/src/gui/editors/AutomationEditor.cpp b/src/gui/editors/AutomationEditor.cpp index a9634070059..ae026fff3e2 100644 --- a/src/gui/editors/AutomationEditor.cpp +++ b/src/gui/editors/AutomationEditor.cpp @@ -1065,7 +1065,7 @@ void AutomationEditor::paintEvent(QPaintEvent * pe ) p.fillRect( 0, 0, width(), height(), bgColor ); // set font-size to 8 - p.setFont(pointSize(p.font(), 8)); + p.setFont(pointSize(p.font(), 8)); int grid_height = height() - TOP_MARGIN - SCROLLBAR_SIZE; @@ -1423,7 +1423,7 @@ void AutomationEditor::paintEvent(QPaintEvent * pe ) { QFont f = p.font(); f.setBold( true ); - p.setFont(pointSize(f, 14)); + p.setFont(pointSize(f, 14)); p.setPen( QApplication::palette().color( QPalette::Active, QPalette::BrightText ) ); p.drawText( VALUES_WIDTH + 20, TOP_MARGIN + 40, diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 571cde0ecad..47e658f1148 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -3338,7 +3338,7 @@ void PianoRoll::paintEvent(QPaintEvent * pe ) // display note editing info //QFont f = p.font(); f.setBold( false ); - p.setFont(pointSize(f, 10)); + p.setFont(pointSize(f, 10)); p.setPen(m_noteModeColor); p.drawText( QRect( 0, keyAreaBottom(), m_whiteKeyWidth, noteEditBottom() - keyAreaBottom()), @@ -3601,7 +3601,7 @@ void PianoRoll::paintEvent(QPaintEvent * pe ) { QFont f = p.font(); f.setBold( true ); - p.setFont(pointSize(f, 14)); + p.setFont(pointSize(f, 14)); p.setPen( QApplication::palette().color( QPalette::Active, QPalette::BrightText ) ); p.drawText(m_whiteKeyWidth + 20, PR_TOP_MARGIN + 40, diff --git a/src/gui/instrument/EnvelopeAndLfoView.cpp b/src/gui/instrument/EnvelopeAndLfoView.cpp index 0c3367f4e10..4043ea2295b 100644 --- a/src/gui/instrument/EnvelopeAndLfoView.cpp +++ b/src/gui/instrument/EnvelopeAndLfoView.cpp @@ -207,7 +207,7 @@ EnvelopeAndLfoView::EnvelopeAndLfoView( QWidget * _parent ) : m_lfoWaveBtnGrp->addButton( random_lfo_btn ); m_x100Cb = new LedCheckBox( tr( "FREQ x 100" ), this ); - m_x100Cb->setFont(pointSize(m_x100Cb->font(), 6.5)); + m_x100Cb->setFont(pointSize(m_x100Cb->font(), 6.5)); m_x100Cb->move( LFO_PREDELAY_KNOB_X, LFO_GRAPH_Y + 36 ); m_x100Cb->setToolTip(tr("Multiply LFO frequency by 100")); @@ -215,7 +215,7 @@ EnvelopeAndLfoView::EnvelopeAndLfoView( QWidget * _parent ) : m_controlEnvAmountCb = new LedCheckBox( tr( "MODULATE ENV AMOUNT" ), this ); m_controlEnvAmountCb->move( LFO_PREDELAY_KNOB_X, LFO_GRAPH_Y + 54 ); - m_controlEnvAmountCb->setFont(pointSize(m_controlEnvAmountCb->font(), 6.5)); + m_controlEnvAmountCb->setFont(pointSize(m_controlEnvAmountCb->font(), 6.5)); m_controlEnvAmountCb->setToolTip( tr( "Control envelope amount by this LFO" ) ); @@ -340,7 +340,7 @@ void EnvelopeAndLfoView::paintEvent( QPaintEvent * ) // draw LFO-graph p.drawPixmap(LFO_GRAPH_X, LFO_GRAPH_Y, m_lfoGraph); - p.setFont(pointSize(p.font(), 8)); + p.setFont(pointSize(p.font(), 8)); const float gray_amount = 1.0f - fabsf( m_amountKnob->value() ); diff --git a/src/gui/instrument/InstrumentFunctionViews.cpp b/src/gui/instrument/InstrumentFunctionViews.cpp index 5b02693fce6..ea16486004c 100644 --- a/src/gui/instrument/InstrumentFunctionViews.cpp +++ b/src/gui/instrument/InstrumentFunctionViews.cpp @@ -57,7 +57,7 @@ InstrumentFunctionNoteStackingView::InstrumentFunctionNoteStackingView( Instrume mainLayout->setVerticalSpacing( 1 ); auto chordLabel = new QLabel(tr("Chord:")); - chordLabel->setFont(pointSize(chordLabel->font(), 8)); + chordLabel->setFont(pointSize(chordLabel->font(), 8)); m_chordRangeKnob->setLabel( tr( "RANGE" ) ); m_chordRangeKnob->setHintText( tr( "Chord range:" ), " " + tr( "octave(s)" ) ); @@ -146,13 +146,13 @@ InstrumentFunctionArpeggioView::InstrumentFunctionArpeggioView( InstrumentFuncti m_arpGateKnob->setHintText( tr( "Arpeggio gate:" ), tr( "%" ) ); auto arpChordLabel = new QLabel(tr("Chord:")); - arpChordLabel->setFont(pointSize(arpChordLabel->font(), 8)); + arpChordLabel->setFont(pointSize(arpChordLabel->font(), 8)); auto arpDirectionLabel = new QLabel(tr("Direction:")); - arpDirectionLabel->setFont(pointSize(arpDirectionLabel->font(), 8)); + arpDirectionLabel->setFont(pointSize(arpDirectionLabel->font(), 8)); auto arpModeLabel = new QLabel(tr("Mode:")); - arpModeLabel->setFont(pointSize(arpModeLabel->font(), 8)); + arpModeLabel->setFont(pointSize(arpModeLabel->font(), 8)); mainLayout->addWidget( arpChordLabel, 0, 0 ); mainLayout->addWidget( m_arpComboBox, 1, 0 ); diff --git a/src/gui/instrument/InstrumentMidiIOView.cpp b/src/gui/instrument/InstrumentMidiIOView.cpp index e8aacce2583..1e95751ead0 100644 --- a/src/gui/instrument/InstrumentMidiIOView.cpp +++ b/src/gui/instrument/InstrumentMidiIOView.cpp @@ -155,7 +155,7 @@ InstrumentMidiIOView::InstrumentMidiIOView( QWidget* parent ) : auto baseVelocityHelp = new QLabel(tr("Specify the velocity normalization base for MIDI-based instruments at 100% note velocity.")); baseVelocityHelp->setWordWrap( true ); - baseVelocityHelp->setFont(pointSize(baseVelocityHelp->font(), 8)); + baseVelocityHelp->setFont(pointSize(baseVelocityHelp->font(), 8)); baseVelocityLayout->addWidget( baseVelocityHelp ); diff --git a/src/gui/instrument/InstrumentSoundShapingView.cpp b/src/gui/instrument/InstrumentSoundShapingView.cpp index 21e9bc699c6..59df3097cb2 100644 --- a/src/gui/instrument/InstrumentSoundShapingView.cpp +++ b/src/gui/instrument/InstrumentSoundShapingView.cpp @@ -77,7 +77,7 @@ InstrumentSoundShapingView::InstrumentSoundShapingView( QWidget * _parent ) : m_filterComboBox = new ComboBox( m_filterGroupBox ); m_filterComboBox->setGeometry( 14, 22, 120, ComboBox::DEFAULT_HEIGHT ); - m_filterComboBox->setFont(pointSize(m_filterComboBox->font(), 8)); + m_filterComboBox->setFont(pointSize(m_filterComboBox->font(), 8)); m_filterCutKnob = new Knob( KnobType::Bright26, m_filterGroupBox ); @@ -94,7 +94,7 @@ InstrumentSoundShapingView::InstrumentSoundShapingView( QWidget * _parent ) : m_singleStreamInfoLabel = new QLabel( tr( "Envelopes, LFOs and filters are not supported by the current instrument." ), this ); m_singleStreamInfoLabel->setWordWrap( true ); - m_singleStreamInfoLabel->setFont(pointSize(m_singleStreamInfoLabel->font(), 8)); + m_singleStreamInfoLabel->setFont(pointSize(m_singleStreamInfoLabel->font(), 8)); m_singleStreamInfoLabel->setGeometry( TARGETS_TABWIDGET_X, TARGETS_TABWIDGET_Y, diff --git a/src/gui/instrument/InstrumentTrackWindow.cpp b/src/gui/instrument/InstrumentTrackWindow.cpp index 641bb36584a..b6a51624b26 100644 --- a/src/gui/instrument/InstrumentTrackWindow.cpp +++ b/src/gui/instrument/InstrumentTrackWindow.cpp @@ -107,7 +107,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : // setup line edit for changing instrument track name m_nameLineEdit = new QLineEdit; - m_nameLineEdit->setFont(pointSize(m_nameLineEdit->font(), 9)); + m_nameLineEdit->setFont(pointSize(m_nameLineEdit->font(), 9)); connect( m_nameLineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( textChanged( const QString& ) ) ); diff --git a/src/gui/instrument/InstrumentTuningView.cpp b/src/gui/instrument/InstrumentTuningView.cpp index f6b08b38a52..41c18213b5f 100644 --- a/src/gui/instrument/InstrumentTuningView.cpp +++ b/src/gui/instrument/InstrumentTuningView.cpp @@ -60,7 +60,7 @@ InstrumentTuningView::InstrumentTuningView(InstrumentTrack *it, QWidget *parent) auto tlabel = new QLabel(tr("Enables the use of global transposition")); tlabel->setWordWrap(true); - tlabel->setFont(pointSize(tlabel->font(), 8)); + tlabel->setFont(pointSize(tlabel->font(), 8)); masterPitchLayout->addWidget(tlabel); // Microtuner settings diff --git a/src/gui/instrument/PianoView.cpp b/src/gui/instrument/PianoView.cpp index 3c9dd309635..87ee6af9bed 100644 --- a/src/gui/instrument/PianoView.cpp +++ b/src/gui/instrument/PianoView.cpp @@ -807,7 +807,7 @@ void PianoView::paintEvent( QPaintEvent * ) QPainter p( this ); // set smaller font for printing number of every octave - p.setFont(pointSize(p.font(), LABEL_TEXT_SIZE)); + p.setFont(pointSize(p.font(), LABEL_TEXT_SIZE)); // draw bar above the keyboard (there will be the labels diff --git a/src/gui/widgets/ComboBox.cpp b/src/gui/widgets/ComboBox.cpp index 26bb218c499..b11990b273b 100644 --- a/src/gui/widgets/ComboBox.cpp +++ b/src/gui/widgets/ComboBox.cpp @@ -49,7 +49,7 @@ ComboBox::ComboBox( QWidget * _parent, const QString & _name ) : { setFixedHeight( ComboBox::DEFAULT_HEIGHT ); - setFont(pointSize(font(), 9)); + setFont(pointSize(font(), 9)); connect( &m_menu, SIGNAL(triggered(QAction*)), this, SLOT(setItem(QAction*))); diff --git a/src/gui/widgets/GroupBox.cpp b/src/gui/widgets/GroupBox.cpp index 0c771fe08b1..229ab13cd45 100644 --- a/src/gui/widgets/GroupBox.cpp +++ b/src/gui/widgets/GroupBox.cpp @@ -111,7 +111,7 @@ void GroupBox::paintEvent( QPaintEvent * pe ) // draw text p.setPen( palette().color( QPalette::Active, QPalette::Text ) ); - p.setFont(pointSize(font(), 8)); + p.setFont(pointSize(font(), 8)); int const captionX = ledButtonShown() ? 22 : 6; p.drawText(captionX, m_titleBarHeight, m_caption); diff --git a/src/gui/widgets/Knob.cpp b/src/gui/widgets/Knob.cpp index c8446a6b877..a6411d6cf07 100644 --- a/src/gui/widgets/Knob.cpp +++ b/src/gui/widgets/Knob.cpp @@ -139,7 +139,7 @@ void Knob::setLabel( const QString & txt ) if( m_knobPixmap ) { setFixedSize(qMax( m_knobPixmap->width(), - horizontalAdvance(QFontMetrics(pointSize(font(), 6.5)), m_label)), + horizontalAdvance(QFontMetrics(pointSize(font(), 6.5)), m_label)), m_knobPixmap->height() + 10); } @@ -459,7 +459,7 @@ void Knob::paintEvent( QPaintEvent * _me ) { if (!m_isHtmlLabel) { - p.setFont(pointSize(p.font(), 6.5f)); + p.setFont(pointSize(p.font(), 6.5f)); p.setPen(textColor()); p.drawText(width() / 2 - horizontalAdvance(p.fontMetrics(), m_label) / 2, @@ -467,7 +467,7 @@ void Knob::paintEvent( QPaintEvent * _me ) } else { - m_tdRenderer->setDefaultFont(pointSize(p.font(), 6.5f)); + m_tdRenderer->setDefaultFont(pointSize(p.font(), 6.5f)); p.translate((width() - m_tdRenderer->idealWidth()) / 2, (height() - m_tdRenderer->pageSize().height()) / 2); m_tdRenderer->drawContents(&p); } diff --git a/src/gui/widgets/LcdFloatSpinBox.cpp b/src/gui/widgets/LcdFloatSpinBox.cpp index 10e791e17d5..667a034815b 100644 --- a/src/gui/widgets/LcdFloatSpinBox.cpp +++ b/src/gui/widgets/LcdFloatSpinBox.cpp @@ -245,7 +245,7 @@ void LcdFloatSpinBox::paintEvent(QPaintEvent*) // Label if (!m_label.isEmpty()) { - p.setFont(pointSize(p.font(), 6.5f)); + p.setFont(pointSize(p.font(), 6.5f)); p.setPen(m_wholeDisplay.textShadowColor()); p.drawText(width() / 2 - p.fontMetrics().boundingRect(m_label).width() / 2 + 1, height(), m_label); p.setPen(m_wholeDisplay.textColor()); diff --git a/src/gui/widgets/LcdWidget.cpp b/src/gui/widgets/LcdWidget.cpp index cf26dd70b9f..fa7dea1da07 100644 --- a/src/gui/widgets/LcdWidget.cpp +++ b/src/gui/widgets/LcdWidget.cpp @@ -203,7 +203,7 @@ void LcdWidget::paintEvent( QPaintEvent* ) // Label if( !m_label.isEmpty() ) { - p.setFont(pointSize(p.font(), 6.5f)); + p.setFont(pointSize(p.font(), 6.5f)); p.setPen( textShadowColor() ); p.drawText(width() / 2 - horizontalAdvance(p.fontMetrics(), m_label) / 2 + 1, @@ -255,7 +255,7 @@ void LcdWidget::updateSize() setFixedSize( qMax( m_cellWidth * m_numDigits + marginX1 + marginX2, - horizontalAdvance(QFontMetrics(pointSize(font(), 6.5f)), m_label) + horizontalAdvance(QFontMetrics(pointSize(font(), 6.5f)), m_label) ), m_cellHeight + (2 * marginY) + 9 ); diff --git a/src/gui/widgets/LedCheckBox.cpp b/src/gui/widgets/LedCheckBox.cpp index e2078177043..3cb85deff08 100644 --- a/src/gui/widgets/LedCheckBox.cpp +++ b/src/gui/widgets/LedCheckBox.cpp @@ -92,10 +92,7 @@ void LedCheckBox::initUi( LedColor _color ) m_ledOnPixmap = embed::getIconPixmap(names[static_cast(_color)].toUtf8().constData()); m_ledOffPixmap = embed::getIconPixmap("led_off"); - if (m_legacyMode) - { - setFont(pointSize(font(), 7)); - } + if (m_legacyMode){ setFont(pointSize(font(), 7)); } setText( m_text ); } @@ -116,7 +113,7 @@ void LedCheckBox::onTextUpdated() void LedCheckBox::paintLegacy(QPaintEvent * pe) { QPainter p( this ); - p.setFont(pointSize(font(), 7)); + p.setFont(pointSize(font(), 7)); p.drawPixmap(0, 0, model()->value() ? m_ledOnPixmap : m_ledOffPixmap); diff --git a/src/gui/widgets/MeterDialog.cpp b/src/gui/widgets/MeterDialog.cpp index 6b57dfaf1e3..eb8e5435376 100644 --- a/src/gui/widgets/MeterDialog.cpp +++ b/src/gui/widgets/MeterDialog.cpp @@ -60,7 +60,7 @@ MeterDialog::MeterDialog( QWidget * _parent, bool _simple ) : { auto num_label = new QLabel(tr("Meter Numerator"), num); QFont f = num_label->font(); - num_label->setFont(pointSize(f, 7)); + num_label->setFont(pointSize(f, 7)); num_layout->addSpacing( 5 ); num_layout->addWidget( num_label ); } @@ -84,7 +84,7 @@ MeterDialog::MeterDialog( QWidget * _parent, bool _simple ) : { auto den_label = new QLabel(tr("Meter Denominator"), den); QFont f = den_label->font(); - den_label->setFont(pointSize(f, 7)); + den_label->setFont(pointSize(f, 7)); den_layout->addSpacing( 5 ); den_layout->addWidget( den_label ); } diff --git a/src/gui/widgets/Oscilloscope.cpp b/src/gui/widgets/Oscilloscope.cpp index b4de4d710c9..9e0d32a2918 100644 --- a/src/gui/widgets/Oscilloscope.cpp +++ b/src/gui/widgets/Oscilloscope.cpp @@ -177,7 +177,7 @@ void Oscilloscope::paintEvent( QPaintEvent * ) else { p.setPen( QColor( 192, 192, 192 ) ); - p.setFont(pointSize(p.font(), 7)); + p.setFont(pointSize(p.font(), 7)); p.drawText( 6, height()-5, tr( "Click to enable" ) ); } } diff --git a/src/gui/widgets/TabBar.cpp b/src/gui/widgets/TabBar.cpp index 747a7e47908..ce706d5f80b 100644 --- a/src/gui/widgets/TabBar.cpp +++ b/src/gui/widgets/TabBar.cpp @@ -90,7 +90,7 @@ TabButton * TabBar::addTab( QWidget * _w, const QString & _text, int _id, _w->setFixedSize( _w->parentWidget()->size() ); } - b->setFont(pointSize(b->font(), 8)); + b->setFont(pointSize(b->font(), 8)); return( b ); } diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 275d757aa75..2c93dba3e22 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -58,7 +58,7 @@ TabWidget::TabWidget(const QString& caption, QWidget* parent, bool usePixmap, m_tabheight = caption.isEmpty() ? m_tabbarHeight - 3 : m_tabbarHeight - 4; - setFont(pointSize(font(), 8)); + setFont(pointSize(font(), 8)); setAutoFillBackground(true); QColor bg_color = QApplication::palette().color(QPalette::Active, QPalette::Window).darker(132); @@ -70,7 +70,7 @@ TabWidget::TabWidget(const QString& caption, QWidget* parent, bool usePixmap, void TabWidget::addTab(QWidget* w, const QString& name, const char* pixmap, int idx) { - setFont(pointSize(font(), 8)); + setFont(pointSize(font(), 8)); // Append tab when position is not given if (idx < 0/* || m_widgets.contains(idx) == true*/) @@ -216,7 +216,7 @@ void TabWidget::resizeEvent(QResizeEvent*) void TabWidget::paintEvent(QPaintEvent* pe) { QPainter p(this); - p.setFont(pointSize(font(), 7)); + p.setFont(pointSize(font(), 7)); // Draw background QBrush bg_color = p.background(); @@ -232,7 +232,7 @@ void TabWidget::paintEvent(QPaintEvent* pe) // Draw title, if any if (!m_caption.isEmpty()) { - p.setFont(pointSize(p.font(), 8)); + p.setFont(pointSize(p.font(), 8)); p.setPen(tabTitleText()); p.drawText(5, 11, m_caption); } From 296583e8d3cd676b171b86ea7135663d11acf0a7 Mon Sep 17 00:00:00 2001 From: Ross maxx Date: Sun, 24 Mar 2024 16:40:24 +0530 Subject: [PATCH 06/10] use std::max for more readability --- include/gui_templates.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/gui_templates.h b/include/gui_templates.h index 39971bd6d63..1152880911f 100644 --- a/include/gui_templates.h +++ b/include/gui_templates.h @@ -48,10 +48,10 @@ inline QFont pointSize(QFont _f, float SIZE) { // to calculate DPI of a screen to make it HiDPI ready qreal devicePixelRatio = QGuiApplication::primaryScreen()->devicePixelRatio(); - qreal scaleFactor = devicePixelRatio > 1.0 ? devicePixelRatio : 1.0; // Ensure scaleFactor is at least 1.0 + qreal scaleFactor = std::max(devicePixelRatio, 1.0); // Ensure scaleFactor is at least 1.0 _f.setPointSizeF(SIZE * scaleFactor); - return( _f ); + return (_f); } From 76cf4a7e52bc78230e16f7573138b8ec44b3f15a Mon Sep 17 00:00:00 2001 From: Ross maxx Date: Sun, 24 Mar 2024 16:45:05 +0530 Subject: [PATCH 07/10] remove the QDesktopWidget header --- include/gui_templates.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/gui_templates.h b/include/gui_templates.h index 1152880911f..ee39b8383b7 100644 --- a/include/gui_templates.h +++ b/include/gui_templates.h @@ -29,7 +29,6 @@ #include #include -#include // TODO: cleanup for qt6 #if (QT_VERSION < QT_VERSION_CHECK(6,0,0)) From 95133337bdabe05137d2c20b8fd4c5ee0fb3f0b5 Mon Sep 17 00:00:00 2001 From: Ross maxx Date: Sun, 24 Mar 2024 16:47:37 +0530 Subject: [PATCH 08/10] headers --- include/gui_templates.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/gui_templates.h b/include/gui_templates.h index ee39b8383b7..6d3664dfc0c 100644 --- a/include/gui_templates.h +++ b/include/gui_templates.h @@ -27,14 +27,14 @@ #include "lmmsconfig.h" +#include #include #include +#include -// TODO: cleanup for qt6 +// TODO: remove once qt5 support is dropped #if (QT_VERSION < QT_VERSION_CHECK(6,0,0)) #include -#else - #include #endif namespace lmms From 1f2cba04b43c5ec91dd5b8db8607d8a25014d30c Mon Sep 17 00:00:00 2001 From: Ross maxx Date: Wed, 27 Mar 2024 16:58:59 +0530 Subject: [PATCH 09/10] cleanup arguments and remove parantheses from return --- include/gui_templates.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/gui_templates.h b/include/gui_templates.h index 6d3664dfc0c..38d51252d68 100644 --- a/include/gui_templates.h +++ b/include/gui_templates.h @@ -43,14 +43,14 @@ namespace lmms // return DPI-independent font-size - font with returned font-size has always // the same size in pixels -inline QFont pointSize(QFont _f, float SIZE) +inline QFont pointSize(QFont fontPointer, float fontSize) { // to calculate DPI of a screen to make it HiDPI ready qreal devicePixelRatio = QGuiApplication::primaryScreen()->devicePixelRatio(); qreal scaleFactor = std::max(devicePixelRatio, 1.0); // Ensure scaleFactor is at least 1.0 - _f.setPointSizeF(SIZE * scaleFactor); - return (_f); + fontPointer.setPointSizeF(fontSize * scaleFactor); + return fontPointer; } From 9ce2993f53d974560bc3178b9c4cb1fcdfe942ee Mon Sep 17 00:00:00 2001 From: Ross maxx Date: Wed, 27 Mar 2024 17:07:59 +0530 Subject: [PATCH 10/10] namespace gui --- include/gui_templates.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/gui_templates.h b/include/gui_templates.h index 38d51252d68..4833c6cdf1a 100644 --- a/include/gui_templates.h +++ b/include/gui_templates.h @@ -37,7 +37,7 @@ #include #endif -namespace lmms +namespace lmms::gui { @@ -54,6 +54,6 @@ inline QFont pointSize(QFont fontPointer, float fontSize) } -} // namespace lmms +} // namespace lmms::gui #endif // LMMS_GUI_TEMPLATES_H