-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed MIDI Autodetect always On (#1813) #7564
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed your PR, please make the following changes
(DID NOT TEST)
@@ -125,8 +125,7 @@ public slots: | |||
namespace gui | |||
{ | |||
|
|||
ControllerConnectionDialog::ControllerConnectionDialog( QWidget * _parent, | |||
const AutomatableModel * _target_model ) : | |||
ControllerConnectionDialog::ControllerConnectionDialog( QWidget * _parent, const AutomatableModel * _target_model ) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ControllerConnectionDialog::ControllerConnectionDialog( QWidget * _parent, const AutomatableModel * _target_model ) : | |
ControllerConnectionDialog::ControllerConnectionDialog(QWidget* _parent, const AutomatableModel* _target_model) : |
Make sure you follow the style guidelines!
m_midiGroupBox = new GroupBox( tr( "MIDI CONTROLLER" ), this ); | ||
m_midiGroupBox->setGeometry( 8, 10, 240, 80 ); | ||
connect( m_midiGroupBox->model(), SIGNAL(dataChanged()), | ||
this, SLOT(midiToggled())); | ||
|
||
m_midiChannelSpinBox = new LcdSpinBox( 2, m_midiGroupBox, | ||
tr( "Input channel" ) ); | ||
m_midiChannelSpinBox = new LcdSpinBox( 2, m_midiGroupBox, tr( "Input channel" ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m_midiChannelSpinBox = new LcdSpinBox( 2, m_midiGroupBox, tr( "Input channel" ) ); | |
m_midiChannelSpinBox = new LcdSpinBox(2, m_midiGroupBox, tr("Input channel")); |
m_midiChannelSpinBox->addTextForValue( 0, "--" ); | ||
m_midiChannelSpinBox->setLabel( tr( "CHANNEL" ) ); | ||
m_midiChannelSpinBox->move( 8, 24 ); | ||
|
||
m_midiControllerSpinBox = new LcdSpinBox( 3, m_midiGroupBox, | ||
tr( "Input controller" ) ); | ||
m_midiControllerSpinBox = new LcdSpinBox( 3, m_midiGroupBox, tr( "Input controller" ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m_midiControllerSpinBox = new LcdSpinBox( 3, m_midiGroupBox, tr( "Input controller" ) ); | |
m_midiControllerSpinBox = new LcdSpinBox(3, m_midiGroupBox, tr("Input controller")); |
m_midiAutoDetectCheckBox = | ||
new LedCheckBox( tr("Auto Detect"), | ||
m_midiGroupBox, tr("Auto Detect") ); | ||
m_midiAutoDetectCheckBox = new LedCheckBox( tr("Auto Detect"), m_midiGroupBox, tr("Auto Detect") ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m_midiAutoDetectCheckBox = new LedCheckBox( tr("Auto Detect"), m_midiGroupBox, tr("Auto Detect") ); | |
m_midiAutoDetectCheckBox = new LedCheckBox(tr("Auto Detect"), m_midiGroupBox, tr("Auto Detect")); |
rp_btn->setGeometry( 160, 24, 32, 32 ); | ||
rp_btn->setMenu( m_readablePorts ); | ||
rp_btn->setPopupMode( QToolButton::InstantPopup ); | ||
rp_btn->setText( tr( "MIDI-devices to receive MIDI-events from" ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove unnecessary white spaces here.
@@ -200,7 +199,7 @@ ControllerConnectionDialog::ControllerConnectionDialog( QWidget * _parent, | |||
this, SLOT(userSelected())); | |||
|
|||
|
|||
// Mapping functions | |||
// MAPPING FUNCTION Section |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// MAPPING FUNCTION Section | |
// Mapping function section |
// TODO: This should be reworked into some sort of "shadow" state rather than turning it off... | ||
// since it makes for switching between the USER mode and CONTROLLER mode a bit awkward | ||
// If you toggle the autodetect then move from MIDI to USER then back to MIDI it resets, which is not ideal. | ||
m_midiAutoDetect.setValue( enabled && (!m_targetModel->controllerConnection()) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m_midiAutoDetect.setValue( enabled && (!m_targetModel->controllerConnection()) ); | |
m_midiAutoDetect.setValue(enabled && (!m_targetModel->controllerConnection())); |
Usual white space issue
@@ -420,6 +424,7 @@ void ControllerConnectionDialog::midiValueChanged() | |||
if( m_midiAutoDetect.value() ) | |||
{ | |||
m_midiController->useDetected(); | |||
m_midiAutoDetect.setValue( false ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m_midiAutoDetect.setValue( false ); | |
m_midiAutoDetect.setValue(false); |
@@ -382,7 +385,7 @@ void ControllerConnectionDialog::midiToggled() | |||
|
|||
|
|||
|
|||
|
|||
// USER CONTROLLER Section logic (Doubles as a Radio-button kinda logic together with MIDI CONTROLLER Section, apparently) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put this inside the header please
|
||
|
||
// Comments from someone trying to get their head around Qt! | ||
// MIDI CONTROLLER Section logic (Doubles as a Radio-button kinda logic together with USER CONTROLLER Section, apaprently) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add these comments inside the header like this:
//! MIDI controller section logic (Doubles as a Radio-button kinda logic together with user controller section, apparently?)
Hey, thanks for the feedback, @szeli1, I have revised the entire file to correct code style issues in general. Additionally, I have a also fixed similar issues that were present in the header file. I hope it now adheres better to the ideal structure! Please let me know if there’s anything else you’d like me to adjust! |
Usually the only lines that are formatted are the lines that were changed. I'm sorry I didn't mention this before and I'm not sure what should you do with this knowledge. If I were you I would undo these formatting changes for all lines that were not changed. (edit: you can mark my review as closed once you implemented the changes I requested) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a style review.
It is difficult to see what was changed because lots of lines are only formatted so it is hard to spot the differences.
{ | ||
cc = m_targetModel->controllerConnection(); | ||
|
||
if( cc && cc->getController()->type() != Controller::ControllerType::Dummy && Engine::getSong() ) | ||
if(cc && cc->getController()->type() != Controller::ControllerType::Dummy && Engine::getSong()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(cc && cc->getController()->type() != Controller::ControllerType::Dummy && Engine::getSong()) | |
if (cc && cc->getController()->type() != Controller::ControllerType::Dummy && Engine::getSong()) |
"if" or "for" and "(" should have a space between.
{ | ||
m_midiGroupBox->model()->setValue( true ); | ||
} | ||
if(!cc) { m_midiGroupBox->model()->setValue(true); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(!cc) { m_midiGroupBox->model()->setValue(true); } | |
if (!cc) { m_midiGroupBox->model()->setValue(true); } |
{ | ||
m_midiController->useDetected(); | ||
if( m_readablePorts ) | ||
m_midiAutoDetect.setValue(false); | ||
if(m_readablePorts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(m_readablePorts) | |
if (m_readablePorts) |
void ControllerConnectionDialog::midiValueChanged() | ||
{ | ||
if( m_midiAutoDetect.value() ) | ||
if(m_midiAutoDetect.value()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(m_midiAutoDetect.value()) | |
if (m_midiAutoDetect.value()) |
The Autodetect checkbox for MIDI Controller Connections is now only enabled if there’s no existing connection between a controller and a parameter. Additionally, the Autodetect feature will disengage automatically when a MIDI CC signal is recognized. This prevents accidental reassignment of connections and ensures clear visibility of active controls