Skip to content

Commit

Permalink
fixup! refactor: move unique_ptr::get() to improve usability
Browse files Browse the repository at this point in the history
  • Loading branch information
Swiftb0y committed Nov 9, 2024
1 parent 2c78d23 commit b31a99d
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions src/widget/whotcuebutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "track/track.h"
#include "util/valuetransformer.h"
#include "widget/controlwidgetconnection.h"
#include "widget/wbasewidget.h"

namespace {
constexpr int kDefaultDimBrightThreshold = 127;
Expand Down Expand Up @@ -69,21 +70,21 @@ void WHotcueButton::setup(const QDomNode& node, const SkinContext& context) {
m_pCoType->connectValueChanged(this, &WHotcueButton::slotTypeChanged);
slotTypeChanged(m_pCoType->get());

addLeftConnection(std::make_unique<ControlParameterWidgetConnection>(
this,
getLeftClickConfigKey(), // "activate"
nullptr,
ControlParameterWidgetConnection::DIR_FROM_WIDGET,
ControlParameterWidgetConnection::EMIT_ON_PRESS_AND_RELEASE));

auto pDisplayConnection = std::make_unique<ControlParameterWidgetConnection>(
this,
createConfigKey(QStringLiteral("status")),
nullptr,
ControlParameterWidgetConnection::DIR_TO_WIDGET,
ControlParameterWidgetConnection::EMIT_NEVER);
setDisplayConnection(pDisplayConnection.get());
addConnection(std::move(pDisplayConnection));
addConnection(std::make_unique<ControlParameterWidgetConnection>(
this,
getLeftClickConfigKey(), // "activate"
nullptr,
ControlParameterWidgetConnection::DIR_FROM_WIDGET,
ControlParameterWidgetConnection::EMIT_ON_PRESS_AND_RELEASE),
WBaseWidget::ConnectionSide::Left);

setDisplayConnection(std::make_unique<ControlParameterWidgetConnection>(
this,
createConfigKey(QStringLiteral("status")),
nullptr,
ControlParameterWidgetConnection::DIR_TO_WIDGET,
ControlParameterWidgetConnection::EMIT_NEVER),
WBaseWidget::ConnectionSide::None);

QDomNode con = context.selectNode(node, QStringLiteral("Connection"));
if (!con.isNull()) {
Expand Down

0 comments on commit b31a99d

Please sign in to comment.