[Companion] Refactoring - fixes the X9E=>X7 conversion segfault
This commit is contained in:
@@ -35,15 +35,13 @@ class RadioKnobWidget : public RadioWidget
|
||||
|
||||
public:
|
||||
|
||||
using potType_t = GeneralSettings::PotConfig;
|
||||
|
||||
explicit RadioKnobWidget(potType_t type = potType_t::POT_WITH_DETENT, QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags()) :
|
||||
explicit RadioKnobWidget(PotConfig type = POT_WITH_DETENT, QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags()) :
|
||||
RadioWidget(parent, f),
|
||||
m_potType(type)
|
||||
{
|
||||
init();
|
||||
}
|
||||
explicit RadioKnobWidget(potType_t type, const QString &labelText, int value = 0, QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags()) :
|
||||
explicit RadioKnobWidget(PotConfig type, const QString &labelText, int value = 0, QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags()) :
|
||||
RadioWidget(labelText, value, parent, f),
|
||||
m_potType(type)
|
||||
{
|
||||
@@ -65,20 +63,19 @@ class RadioKnobWidget : public RadioWidget
|
||||
|
||||
private:
|
||||
|
||||
potType_t m_potType;
|
||||
PotConfig m_potType;
|
||||
|
||||
|
||||
class KnobWidget : public QDial
|
||||
{
|
||||
friend class RadioKnobWidget;
|
||||
using potType_t = RadioKnobWidget::potType_t;
|
||||
|
||||
public:
|
||||
|
||||
explicit KnobWidget(potType_t type, QWidget * parent = 0):
|
||||
explicit KnobWidget(PotConfig type, QWidget * parent = 0):
|
||||
QDial(parent),
|
||||
m_type(type),
|
||||
m_positions(type == potType_t::POT_MULTIPOS_SWITCH ? 5 : 0)
|
||||
m_positions(type == POT_MULTIPOS_SWITCH ? 5 : 0)
|
||||
{
|
||||
setToolTip(tr("Right-double-click to reset to center."));
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
@@ -117,7 +114,7 @@ class RadioKnobWidget : public RadioWidget
|
||||
QDial::mousePressEvent(event);
|
||||
}
|
||||
|
||||
potType_t m_type;
|
||||
PotConfig m_type;
|
||||
quint8 m_positions;
|
||||
};
|
||||
|
||||
|
||||
@@ -32,17 +32,16 @@ class RadioSwitchWidget : public RadioWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
typedef GeneralSettings::SwitchConfig swType_t;
|
||||
|
||||
explicit RadioSwitchWidget(swType_t type = swType_t::SWITCH_3POS, QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags()) :
|
||||
explicit RadioSwitchWidget(SwitchConfig type = SWITCH_3POS, QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags()) :
|
||||
RadioWidget(parent, f),
|
||||
swType(type)
|
||||
switchConfig(type)
|
||||
{
|
||||
init();
|
||||
}
|
||||
explicit RadioSwitchWidget(swType_t type, const QString &labelText, int value = 0, QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags()) :
|
||||
explicit RadioSwitchWidget(SwitchConfig type, const QString &labelText, int value = 0, QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags()) :
|
||||
RadioWidget(labelText, value, parent, f),
|
||||
swType(type)
|
||||
switchConfig(type)
|
||||
{
|
||||
init();
|
||||
}
|
||||
@@ -59,7 +58,7 @@ class RadioSwitchWidget : public RadioWidget
|
||||
sl->setInvertedControls(true);
|
||||
sl->setTickPosition(QSlider::TicksBothSides);
|
||||
sl->setPageStep(1);
|
||||
sl->setMinimum((swType == swType_t::SWITCH_3POS ? -1 : 0));
|
||||
sl->setMinimum((switchConfig == SWITCH_3POS ? -1 : 0));
|
||||
sl->setMaximum(1);
|
||||
sl->setTickInterval(1);
|
||||
sl->setValue(m_value);
|
||||
@@ -71,7 +70,7 @@ class RadioSwitchWidget : public RadioWidget
|
||||
}
|
||||
|
||||
private:
|
||||
swType_t swType;
|
||||
SwitchConfig switchConfig;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user