Skip to content

Commit

Permalink
Code review changes
Browse files Browse the repository at this point in the history
Parameter whitespaces in the builder methods of `Knob`.

Use `adjustedToPixelSize` in `InstrumentTrackView` and `SampleTrackView`.
  • Loading branch information
michaelgregorius committed Sep 30, 2024
1 parent d31c90e commit 39e1e9f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions include/Knob.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ class LMMS_EXPORT Knob : public FloatModelEditorBase
Knob( QWidget * _parent = nullptr, const QString & _name = QString() ); //!< default ctor
Knob( const Knob& other ) = delete;

static Knob* buildLegacyKnob(KnobType knob_num, const QString& label, QWidget* parent, const QString & _name = QString());
static Knob* buildKnobWithSmallPixelFont(KnobType knob_num, const QString& label, QWidget* parent, const QString & _name = QString());
static Knob* buildLegacyKnob(KnobType knob_num, const QString& label, QWidget* parent, const QString& name = QString());
static Knob* buildKnobWithSmallPixelFont(KnobType knob_num, const QString& label, QWidget* parent, const QString& name = QString());

void setLabel(const QString & txt);
void setHtmlLabel( const QString &htmltxt );
Expand Down
5 changes: 3 additions & 2 deletions src/gui/tracks/InstrumentTrackView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "ConfigManager.h"
#include "Engine.h"
#include "FadeButton.h"
#include "FontHelper.h"
#include "Knob.h"
#include "MidiCCRackView.h"
#include "Mixer.h"
Expand Down Expand Up @@ -77,8 +78,8 @@ InstrumentTrackView::InstrumentTrackView( InstrumentTrack * _it, TrackContainerV
m_mixerChannelNumber = new MixerChannelLcdSpinBox(2, getTrackSettingsWidget(), tr("Mixer channel"), this);
m_mixerChannelNumber->show();

auto f = font();
f.setPixelSize(9);
const auto f = adjustedToPixelSize(font(), 9);

m_volumeKnob = new Knob(KnobType::Small17, getTrackSettingsWidget(), tr("Volume"));
m_volumeKnob->setFont(f);
m_volumeKnob->setLabel(tr("VOL"));
Expand Down
5 changes: 3 additions & 2 deletions src/gui/tracks/SampleTrackView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "embed.h"
#include "Engine.h"
#include "FadeButton.h"
#include "FontHelper.h"
#include "Mixer.h"
#include "MixerView.h"
#include "GuiApplication.h"
Expand Down Expand Up @@ -61,8 +62,8 @@ SampleTrackView::SampleTrackView( SampleTrack * _t, TrackContainerView* tcv ) :
m_mixerChannelNumber = new MixerChannelLcdSpinBox(2, getTrackSettingsWidget(), tr("Mixer channel"), this);
m_mixerChannelNumber->show();

auto f = font();
f.setPixelSize(9);
const auto f = adjustedToPixelSize(font(), 9);

m_volumeKnob = new Knob(KnobType::Small17, getTrackSettingsWidget(), tr("Track volume"));
m_volumeKnob->setFont(f);
m_volumeKnob->setLabel(tr("VOL"));
Expand Down
4 changes: 2 additions & 2 deletions src/gui/widgets/Knob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Knob::Knob( QWidget * _parent, const QString & _name ) :
{
}

Knob* Knob::buildLegacyKnob(KnobType knob_num, const QString& label, QWidget * parent, const QString & name)
Knob* Knob::buildLegacyKnob(KnobType knob_num, const QString& label, QWidget* parent, const QString& name)
{
auto result = new Knob(knob_num, parent, name);
result->setLegacyMode(true);
Expand All @@ -67,7 +67,7 @@ Knob* Knob::buildLegacyKnob(KnobType knob_num, const QString& label, QWidget * p
return result;
}

Knob* Knob::buildKnobWithSmallPixelFont(KnobType knob_num, const QString& label, QWidget * parent, const QString & name)
Knob* Knob::buildKnobWithSmallPixelFont(KnobType knob_num, const QString& label, QWidget* parent, const QString& name)
{
auto result = new Knob(knob_num, parent, name);
result->setFont(adjustedToPixelSize(result->font(), SMALL_FONT_SIZE));
Expand Down

0 comments on commit 39e1e9f

Please sign in to comment.