Merge branch 'stable-1.2'

# Conflicts:
#	src/gui/widgets/EffectView.cpp
This commit is contained in:
Lukas W
2018-06-17 11:51:50 +02:00
19 changed files with 342 additions and 205 deletions

View File

@@ -107,7 +107,8 @@ void AutomatableModel::saveSettings( QDomDocument& doc, QDomElement& element, co
element.setAttribute( name, m_value );
}
if( m_controllerConnection )
if( m_controllerConnection && m_controllerConnection->getController()->type()
!= Controller::DummyController )
{
QDomElement controllerElement;

View File

@@ -162,6 +162,11 @@ void ControllerConnection::finalizeConnections()
c->setController( Engine::getSong()->
controllers().at( c->m_controllerId ) );
}
else if (c->getController()->type() == Controller::DummyController)
{
delete c;
--i;
}
}
}
@@ -199,7 +204,7 @@ void ControllerConnection::loadSettings( const QDomElement & _this )
}
else
{
if( _this.attribute( "id" ).toInt() >= 0 )
if( _this.attribute( "id", "-1" ).toInt() >= 0 )
{
m_controllerId = _this.attribute( "id" ).toInt();
}

View File

@@ -802,7 +802,7 @@ AutomationPattern * Song::tempoAutomationPattern()
AutomatedValueMap Song::automatedValuesAt(MidiTime time, int tcoNum) const
{
return TrackContainer::automatedValuesFromTracks(TrackList(tracks()) << m_globalAutomationTrack, time, tcoNum);
return TrackContainer::automatedValuesFromTracks(TrackList{m_globalAutomationTrack} << tracks(), time, tcoNum);
}
@@ -1101,6 +1101,11 @@ void Song::loadProject( const QString & fileName )
// now that everything is loaded
ControllerConnection::finalizeConnections();
// Remove dummy controllers that was added for correct connections
m_controllers.erase(std::remove_if(m_controllers.begin(), m_controllers.end(),
[](Controller* c){return c->type() == Controller::DummyController;}),
m_controllers.end());
// resolve all IDs so that autoModels are automated
AutomationPattern::resolveAllIDs();
@@ -1235,9 +1240,13 @@ void Song::restoreControllerStates( const QDomElement & element )
while( !node.isNull() && !isCancelled() )
{
Controller * c = Controller::create( node.toElement(), this );
Q_ASSERT( c != NULL );
addController( c );
if (c) {addController(c);}
else
{
// Fix indices to ensure correct connections
m_controllers.append(Controller::create(
Controller::DummyController, this));
}
node = node.nextSibling();
}

View File

@@ -1881,6 +1881,7 @@ void TrackOperationsWidget::cloneTrack()
void TrackOperationsWidget::clearTrack()
{
Track * t = m_trackView->getTrack();
t->addJournalCheckPoint();
t->lock();
t->deleteTCOs();
t->unlock();

View File

@@ -123,8 +123,11 @@ void SubWindow::paintEvent( QPaintEvent * )
p.drawLine( width() - 1, m_titleBarHeight, width() - 1, height() - 1 );
// window icon
QPixmap winicon( widget()->windowIcon().pixmap( m_buttonSize ) );
p.drawPixmap( 3, 3, m_buttonSize.width(), m_buttonSize.height(), winicon );
if( widget() )
{
QPixmap winicon( widget()->windowIcon().pixmap( m_buttonSize ) );
p.drawPixmap( 3, 3, m_buttonSize.width(), m_buttonSize.height(), winicon );
}
}
@@ -324,25 +327,31 @@ void SubWindow::adjustTitleBar()
// we're keeping the restore button around if we open projects
// from older versions that have saved minimized windows
m_restoreBtn->setVisible( isMaximized() || isMinimized() );
// title QLabel adjustments
m_windowTitle->setAlignment( Qt::AlignHCenter );
m_windowTitle->setFixedWidth( widget()->width() - ( menuButtonSpace + buttonBarWidth ) );
m_windowTitle->move( menuButtonSpace,
( m_titleBarHeight / 2 ) - ( m_windowTitle->sizeHint().height() / 2 ) - 1 );
// if minimized we can't use widget()->width(). We have to hard code the width,
// as the width of all minimized windows is the same.
if( isMinimized() )
{
m_restoreBtn->move( m_maximizeBtn->isHidden() ? middleButtonPos : leftButtonPos );
m_windowTitle->setFixedWidth( 120 );
}
// truncate the label string if the window is to small. Adds "..."
elideText( m_windowTitle, widget()->windowTitle() );
m_windowTitle->setTextInteractionFlags( Qt::NoTextInteraction );
m_windowTitle->adjustSize();
if( widget() )
{
// title QLabel adjustments
m_windowTitle->setAlignment( Qt::AlignHCenter );
m_windowTitle->setFixedWidth( widget()->width() - ( menuButtonSpace + buttonBarWidth ) );
m_windowTitle->move( menuButtonSpace,
( m_titleBarHeight / 2 ) - ( m_windowTitle->sizeHint().height() / 2 ) - 1 );
// if minimized we can't use widget()->width(). We have to hard code the width,
// as the width of all minimized windows is the same.
if( isMinimized() )
{
m_windowTitle->setFixedWidth( 120 );
}
// truncate the label string if the window is to small. Adds "..."
elideText( m_windowTitle, widget()->windowTitle() );
m_windowTitle->setTextInteractionFlags( Qt::NoTextInteraction );
m_windowTitle->adjustSize();
}
}

View File

@@ -178,6 +178,7 @@ PianoRoll::PianoRoll() :
m_startKey( INITIAL_START_KEY ),
m_lastKey( 0 ),
m_editMode( ModeDraw ),
m_ctrlMode( ModeDraw ),
m_mouseDownRight( false ),
m_scrollBack( false ),
m_barLineColor( 0, 0, 0 ),
@@ -951,6 +952,8 @@ void PianoRoll::clearSelectedNotes()
void PianoRoll::shiftSemiTone( int amount ) // shift notes by amount semitones
{
if (!hasValidPattern()) {return;}
bool useAllNotes = ! isSelection();
for( Note *note : m_pattern->notes() )
{
@@ -975,6 +978,8 @@ void PianoRoll::shiftSemiTone( int amount ) // shift notes by amount semitones
void PianoRoll::shiftPos( int amount ) //shift notes pos by amount
{
if (!hasValidPattern()) {return;}
bool useAllNotes = ! isSelection();
bool first = true;
@@ -1065,12 +1070,18 @@ void PianoRoll::keyPressEvent(QKeyEvent* ke )
{
// shift selection up an octave
// if nothing selected, shift _everything_
shiftSemiTone( 12 * direction );
if (hasValidPattern())
{
shiftSemiTone( 12 * direction );
}
}
else if((ke->modifiers() & Qt::ShiftModifier) && m_action == ActionNone)
{
// Move selected notes up by one semitone
shiftSemiTone( 1 * direction );
if (hasValidPattern())
{
shiftSemiTone( 1 * direction );
}
}
else
{
@@ -1100,22 +1111,32 @@ void PianoRoll::keyPressEvent(QKeyEvent* ke )
if( ke->modifiers() & Qt::ControlModifier && m_action == ActionNone )
{
// Move selected notes by one bar to the left
shiftPos( direction * MidiTime::ticksPerTact() );
if (hasValidPattern())
{
shiftPos( direction * MidiTime::ticksPerTact() );
}
}
else if( ke->modifiers() & Qt::ShiftModifier && m_action == ActionNone)
{
// move notes
bool quantized = ! ( ke->modifiers() & Qt::AltModifier );
int amt = quantized ? quantization() : 1;
shiftPos( direction * amt );
if (hasValidPattern())
{
bool quantized = ! ( ke->modifiers() & Qt::AltModifier );
int amt = quantized ? quantization() : 1;
shiftPos( direction * amt );
}
}
else if( ke->modifiers() & Qt::AltModifier)
{
// switch to editing a pattern adjacent to this one in the song editor
Pattern * p = direction > 0 ? m_pattern->nextPattern() : m_pattern->previousPattern();
if(p != NULL)
if (hasValidPattern())
{
setCurrentPattern(p);
Pattern * p = direction > 0 ? m_pattern->nextPattern()
: m_pattern->previousPattern();
if(p != NULL)
{
setCurrentPattern(p);
}
}
}
else
@@ -3190,6 +3211,7 @@ void PianoRoll::wheelEvent(QWheelEvent * we )
if( we->x() > noteEditLeft() && we->x() < noteEditRight()
&& we->y() > noteEditTop() && we->y() < noteEditBottom() )
{
if (!hasValidPattern()) {return;}
// get values for going through notes
int pixel_range = 8;
int x = we->x() - WHITE_KEY_WIDTH;
@@ -3332,8 +3354,9 @@ void PianoRoll::focusOutEvent( QFocusEvent * )
m_pattern->instrumentTrack()->pianoModel()->midiEventProcessor()->processInEvent( MidiEvent( MidiNoteOff, -1, i, 0 ) );
m_pattern->instrumentTrack()->pianoModel()->setKeyState( i, false );
}
update();
}
m_editMode = m_ctrlMode;
update();
}
@@ -3541,7 +3564,7 @@ void PianoRoll::verScrolled( int new_pos )
void PianoRoll::setEditMode(int mode)
{
m_editMode = (EditModes) mode;
m_ctrlMode = m_editMode = (EditModes) mode;
}

View File

@@ -28,6 +28,7 @@
#include <QMdiArea>
#include <QMdiSubWindow>
#include <QPainter>
#include <QLayout>
#include "EffectView.h"
#include "DummyEffect.h"
@@ -49,13 +50,13 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) :
m_controlView( NULL )
{
setFixedSize( 210, 60 );
// Disable effects that are of type "DummyEffect"
bool isEnabled = !dynamic_cast<DummyEffect *>( effect() );
m_bypass = new LedCheckBox( this, "", isEnabled ? LedCheckBox::Green : LedCheckBox::Red );
m_bypass->move( 3, 3 );
m_bypass->setEnabled( isEnabled );
ToolTip::add( m_bypass, tr( "On/Off" ) );
@@ -97,7 +98,9 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) :
{
m_subWindow = gui->mainWindow()->addWindowedWidget( m_controlView );
m_subWindow->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
m_subWindow->setFixedSize( m_subWindow->size() );
if (m_subWindow->layout()) {
m_subWindow->layout()->setSizeConstraint(QLayout::SetFixedSize);
}
Qt::WindowFlags flags = m_subWindow->windowFlags();
flags &= ~Qt::WindowMaximizeButtonHint;
@@ -120,18 +123,7 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) :
EffectView::~EffectView()
{
#ifdef LMMS_BUILD_LINUX
delete m_subWindow;
#else
if( m_subWindow )
{
// otherwise on win32 build VST GUI can get lost
m_subWindow->hide();
}
#endif
}

View File

@@ -264,6 +264,7 @@ void FxLine::renameChannel()
void FxLine::renameFinished()
{
m_inRename = false;
m_renameLineEdit->deselect();
m_renameLineEdit->setReadOnly( true );
m_renameLineEdit->setFixedWidth( 65 );
m_lcd->show();