Merge remote-tracking branch 'upstream/master' into refactor-samplebuffer
This commit is contained in:
@@ -1671,6 +1671,8 @@ void DataFile::upgrade_extendedNoteRange()
|
||||
{
|
||||
auto root = documentElement();
|
||||
UpgradeExtendedNoteRange upgradeExtendedNoteRange(root);
|
||||
|
||||
upgradeExtendedNoteRange.upgrade();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -193,6 +193,7 @@ static void fixTrack(QDomElement & track, std::set<unsigned int> & automatedBase
|
||||
for (int i = 0; i < subTracks.size(); ++i)
|
||||
{
|
||||
QDomElement subTrack = subTracks.item(i).toElement();
|
||||
assert (static_cast<Track::Type>(subTrack.attribute("type").toInt()) != Track::Type::Pattern);
|
||||
fixTrack(subTrack, automatedBaseNoteIds);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,16 +62,16 @@ void SideBarWidget::paintEvent( QPaintEvent * )
|
||||
|
||||
QFont f = p.font();
|
||||
f.setBold( true );
|
||||
f.setUnderline( true );
|
||||
f.setUnderline(false);
|
||||
f.setPointSize( f.pointSize() + 2 );
|
||||
p.setFont( f );
|
||||
|
||||
p.setPen( palette().highlightedText().color() );
|
||||
|
||||
const int tx = m_icon.width()+4;
|
||||
const int tx = m_icon.width() + 8;
|
||||
|
||||
QFontMetrics metrics( f );
|
||||
const int ty = metrics.ascent();
|
||||
const int ty = (metrics.ascent() + m_icon.height()) / 2;
|
||||
p.drawText( tx, ty, m_title );
|
||||
|
||||
p.drawPixmap( 2, 2, m_icon.transformed( QTransform().rotate( -90 ) ) );
|
||||
|
||||
@@ -63,7 +63,6 @@ InstrumentTrackView::InstrumentTrackView( InstrumentTrack * _it, TrackContainerV
|
||||
m_tlb = new TrackLabelButton( this, getTrackSettingsWidget() );
|
||||
m_tlb->setCheckable( true );
|
||||
m_tlb->setIcon( embed::getIconPixmap( "instrument_track" ) );
|
||||
m_tlb->move( 3, 1 );
|
||||
m_tlb->show();
|
||||
|
||||
connect( m_tlb, SIGNAL(toggled(bool)),
|
||||
@@ -75,24 +74,14 @@ InstrumentTrackView::InstrumentTrackView( InstrumentTrack * _it, TrackContainerV
|
||||
connect(ConfigManager::inst(), SIGNAL(valueChanged(QString,QString,QString)),
|
||||
this, SLOT(handleConfigChange(QString,QString,QString)));
|
||||
|
||||
// creation of widgets for track-settings-widget
|
||||
int widgetWidth;
|
||||
if( ConfigManager::inst()->value( "ui",
|
||||
"compacttrackbuttons" ).toInt() )
|
||||
{
|
||||
widgetWidth = DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT;
|
||||
}
|
||||
else
|
||||
{
|
||||
widgetWidth = DEFAULT_SETTINGS_WIDGET_WIDTH;
|
||||
}
|
||||
m_mixerChannelNumber = new MixerLineLcdSpinBox(2, getTrackSettingsWidget(), tr("Mixer channel"), this);
|
||||
m_mixerChannelNumber->show();
|
||||
|
||||
m_volumeKnob = new Knob( KnobType::Small17, getTrackSettingsWidget(),
|
||||
tr( "Volume" ) );
|
||||
m_volumeKnob->setVolumeKnob( true );
|
||||
m_volumeKnob->setModel( &_it->m_volumeModel );
|
||||
m_volumeKnob->setHintText( tr( "Volume:" ), "%" );
|
||||
m_volumeKnob->move( widgetWidth-2*24, 2 );
|
||||
m_volumeKnob->setLabel( tr( "VOL" ) );
|
||||
m_volumeKnob->show();
|
||||
|
||||
@@ -100,7 +89,6 @@ InstrumentTrackView::InstrumentTrackView( InstrumentTrack * _it, TrackContainerV
|
||||
tr( "Panning" ) );
|
||||
m_panningKnob->setModel( &_it->m_panningModel );
|
||||
m_panningKnob->setHintText(tr("Panning:"), "%");
|
||||
m_panningKnob->move( widgetWidth-24, 2 );
|
||||
m_panningKnob->setLabel( tr( "PAN" ) );
|
||||
m_panningKnob->show();
|
||||
|
||||
@@ -151,9 +139,18 @@ InstrumentTrackView::InstrumentTrackView( InstrumentTrack * _it, TrackContainerV
|
||||
QApplication::palette().color( QPalette::Active,
|
||||
QPalette::BrightText).darker(),
|
||||
getTrackSettingsWidget() );
|
||||
m_activityIndicator->setGeometry(
|
||||
widgetWidth-2*24-11, 2, 8, 28 );
|
||||
m_activityIndicator->setFixedSize(8, 28);
|
||||
m_activityIndicator->show();
|
||||
|
||||
auto layout = new QHBoxLayout(getTrackSettingsWidget());
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setSpacing(0);
|
||||
layout->addWidget(m_tlb);
|
||||
layout->addWidget(m_mixerChannelNumber);
|
||||
layout->addWidget(m_activityIndicator);
|
||||
layout->addWidget(m_volumeKnob);
|
||||
layout->addWidget(m_panningKnob);
|
||||
|
||||
connect( m_activityIndicator, SIGNAL(pressed()),
|
||||
this, SLOT(activityIndicatorPressed()));
|
||||
connect( m_activityIndicator, SIGNAL(released()),
|
||||
@@ -268,6 +265,13 @@ void InstrumentTrackView::handleConfigChange(QString cls, QString attr, QString
|
||||
}
|
||||
}
|
||||
|
||||
void InstrumentTrackView::modelChanged()
|
||||
{
|
||||
TrackView::modelChanged();
|
||||
auto st = castModel<InstrumentTrack>();
|
||||
m_mixerChannelNumber->setModel(&st->m_mixerChannelModel);
|
||||
}
|
||||
|
||||
void InstrumentTrackView::dragEnterEvent( QDragEnterEvent * _dee )
|
||||
{
|
||||
InstrumentTrackWindow::dragEnterEventGeneric( _dee );
|
||||
|
||||
@@ -56,20 +56,17 @@ SampleTrackView::SampleTrackView( SampleTrack * _t, TrackContainerView* tcv ) :
|
||||
connect(m_tlb, SIGNAL(clicked(bool)),
|
||||
this, SLOT(showEffects()));
|
||||
m_tlb->setIcon(embed::getIconPixmap("sample_track"));
|
||||
m_tlb->move(3, 1);
|
||||
m_tlb->show();
|
||||
|
||||
m_mixerChannelNumber = new MixerLineLcdSpinBox(2, getTrackSettingsWidget(), tr("Mixer channel"), this);
|
||||
m_mixerChannelNumber->show();
|
||||
|
||||
m_volumeKnob = new Knob( KnobType::Small17, getTrackSettingsWidget(),
|
||||
tr( "Track volume" ) );
|
||||
m_volumeKnob->setVolumeKnob( true );
|
||||
m_volumeKnob->setModel( &_t->m_volumeModel );
|
||||
m_volumeKnob->setHintText( tr( "Channel volume:" ), "%" );
|
||||
|
||||
int settingsWidgetWidth = ConfigManager::inst()->
|
||||
value( "ui", "compacttrackbuttons" ).toInt()
|
||||
? DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT
|
||||
: DEFAULT_SETTINGS_WIDGET_WIDTH;
|
||||
m_volumeKnob->move( settingsWidgetWidth - 2 * 24, 2 );
|
||||
m_volumeKnob->setLabel( tr( "VOL" ) );
|
||||
m_volumeKnob->show();
|
||||
|
||||
@@ -77,7 +74,6 @@ SampleTrackView::SampleTrackView( SampleTrack * _t, TrackContainerView* tcv ) :
|
||||
tr( "Panning" ) );
|
||||
m_panningKnob->setModel( &_t->m_panningModel );
|
||||
m_panningKnob->setHintText( tr( "Panning:" ), "%" );
|
||||
m_panningKnob->move( settingsWidgetWidth - 24, 2 );
|
||||
m_panningKnob->setLabel( tr( "PAN" ) );
|
||||
m_panningKnob->show();
|
||||
|
||||
@@ -87,8 +83,18 @@ SampleTrackView::SampleTrackView( SampleTrack * _t, TrackContainerView* tcv ) :
|
||||
QApplication::palette().color(QPalette::Active, QPalette::BrightText).darker(),
|
||||
getTrackSettingsWidget()
|
||||
);
|
||||
m_activityIndicator->setGeometry(settingsWidgetWidth - 2 * 24 - 11, 2, 8, 28);
|
||||
m_activityIndicator->setFixedSize(8, 28);
|
||||
m_activityIndicator->show();
|
||||
|
||||
auto layout = new QHBoxLayout(getTrackSettingsWidget());
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setSpacing(0);
|
||||
layout->addWidget(m_tlb);
|
||||
layout->addWidget(m_mixerChannelNumber);
|
||||
layout->addWidget(m_activityIndicator);
|
||||
layout->addWidget(m_volumeKnob);
|
||||
layout->addWidget(m_panningKnob);
|
||||
|
||||
connect(_t, SIGNAL(playingChanged()), this, SLOT(updateIndicator()));
|
||||
|
||||
setModel( _t );
|
||||
@@ -170,6 +176,7 @@ void SampleTrackView::modelChanged()
|
||||
{
|
||||
auto st = castModel<SampleTrack>();
|
||||
m_volumeKnob->setModel(&st->m_volumeModel);
|
||||
m_mixerChannelNumber->setModel(&st->m_mixerChannelModel);
|
||||
|
||||
TrackView::modelChanged();
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "Knob.h"
|
||||
|
||||
#include <memory>
|
||||
#include <QApplication>
|
||||
#include <QFontMetrics>
|
||||
@@ -34,7 +36,6 @@
|
||||
#endif
|
||||
|
||||
#include "lmms_math.h"
|
||||
#include "Knob.h"
|
||||
#include "CaptionMenu.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "ControllerConnection.h"
|
||||
@@ -48,7 +49,6 @@
|
||||
#include "SimpleTextFloat.h"
|
||||
#include "StringPairDrag.h"
|
||||
|
||||
|
||||
namespace lmms::gui
|
||||
{
|
||||
|
||||
@@ -484,6 +484,13 @@ void Knob::drawKnob( QPainter * _p )
|
||||
_p->drawImage( 0, 0, m_cache );
|
||||
}
|
||||
|
||||
void Knob::showTextFloat(int msecBeforeDisplay, int msecDisplayTime)
|
||||
{
|
||||
s_textFloat->setText(displayValue());
|
||||
s_textFloat->moveGlobal(this, QPoint(width() + 2, 0));
|
||||
s_textFloat->showWithDelay(msecBeforeDisplay, msecDisplayTime);
|
||||
}
|
||||
|
||||
float Knob::getValue( const QPoint & _p )
|
||||
{
|
||||
float value;
|
||||
@@ -580,10 +587,8 @@ void Knob::mousePressEvent( QMouseEvent * _me )
|
||||
|
||||
emit sliderPressed();
|
||||
|
||||
s_textFloat->setText( displayValue() );
|
||||
s_textFloat->moveGlobal( this,
|
||||
QPoint( width() + 2, 0 ) );
|
||||
s_textFloat->show();
|
||||
showTextFloat(0, 0);
|
||||
|
||||
m_buttonPressed = true;
|
||||
}
|
||||
else if( _me->button() == Qt::LeftButton &&
|
||||
@@ -613,6 +618,7 @@ void Knob::mouseMoveEvent( QMouseEvent * _me )
|
||||
m_lastMousePos = _me->pos();
|
||||
}
|
||||
s_textFloat->setText( displayValue() );
|
||||
s_textFloat->show();
|
||||
}
|
||||
|
||||
|
||||
@@ -638,7 +644,15 @@ void Knob::mouseReleaseEvent( QMouseEvent* event )
|
||||
s_textFloat->hide();
|
||||
}
|
||||
|
||||
void Knob::enterEvent(QEvent *event)
|
||||
{
|
||||
showTextFloat(700, 2000);
|
||||
}
|
||||
|
||||
void Knob::leaveEvent(QEvent *event)
|
||||
{
|
||||
s_textFloat->hide();
|
||||
}
|
||||
|
||||
|
||||
void Knob::focusOutEvent( QFocusEvent * _fe )
|
||||
|
||||
@@ -45,6 +45,14 @@ SimpleTextFloat::SimpleTextFloat() :
|
||||
|
||||
m_textLabel = new QLabel(this);
|
||||
layout->addWidget(m_textLabel);
|
||||
|
||||
m_showTimer = new QTimer();
|
||||
m_showTimer->setSingleShot(true);
|
||||
QObject::connect(m_showTimer, &QTimer::timeout, this, &SimpleTextFloat::show);
|
||||
|
||||
m_hideTimer = new QTimer();
|
||||
m_hideTimer->setSingleShot(true);
|
||||
QObject::connect(m_hideTimer, &QTimer::timeout, this, &SimpleTextFloat::hide);
|
||||
}
|
||||
|
||||
void SimpleTextFloat::setText(const QString & text)
|
||||
@@ -52,6 +60,29 @@ void SimpleTextFloat::setText(const QString & text)
|
||||
m_textLabel->setText(text);
|
||||
}
|
||||
|
||||
void SimpleTextFloat::showWithDelay(int msecBeforeDisplay, int msecDisplayTime)
|
||||
{
|
||||
if (msecBeforeDisplay != 0)
|
||||
{
|
||||
m_showTimer->start(msecBeforeDisplay);
|
||||
}
|
||||
else
|
||||
{
|
||||
show();
|
||||
}
|
||||
|
||||
if (msecDisplayTime != 0)
|
||||
{
|
||||
m_hideTimer->start(msecBeforeDisplay + msecDisplayTime);
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleTextFloat::hide()
|
||||
{
|
||||
m_showTimer->stop();
|
||||
m_hideTimer->stop();
|
||||
QWidget::hide();
|
||||
}
|
||||
|
||||
void SimpleTextFloat::setVisibilityTimeOut(int msecs)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user