Remove recording button
Remove the recording button that was added to the sample clip view with
commit 48c4dce96f.
This commit simply reverts the aforementioned one.
This commit is contained in:
@@ -25,8 +25,6 @@
|
||||
#include "SampleClipView.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QMenu>
|
||||
#include <QPainter>
|
||||
|
||||
@@ -36,7 +34,6 @@
|
||||
#include "embed.h"
|
||||
#include "gui_templates.h"
|
||||
#include "PathUtil.h"
|
||||
#include "PixmapButton.h"
|
||||
#include "SampleClip.h"
|
||||
#include "SampleLoader.h"
|
||||
#include "SampleWaveform.h"
|
||||
@@ -61,12 +58,6 @@ SampleClipView::SampleClipView( SampleClip * _clip, TrackView * _tv ) :
|
||||
connect(m_clip, SIGNAL(wasReversed()), this, SLOT(update()));
|
||||
|
||||
setStyle( QApplication::style() );
|
||||
|
||||
// To simplify the code we always create the widget but we do not always show it
|
||||
m_recordWidget = buildRecordWidget(_clip->recordModel());
|
||||
m_recordWidget->setVisible(recordingCapabilitiesAvailable());
|
||||
|
||||
adjustRecordWidget();
|
||||
}
|
||||
|
||||
void SampleClipView::updateSample()
|
||||
@@ -318,6 +309,36 @@ void SampleClipView::paintEvent( QPaintEvent * pe )
|
||||
{
|
||||
p.drawLine(m_markerPos, rect().bottom(), m_markerPos, rect().top());
|
||||
}
|
||||
// recording sample tracks is not possible at the moment
|
||||
|
||||
if (m_clip->isRecord())
|
||||
{
|
||||
p.setFont(adjustedToPixelSize(p.font(), 10));
|
||||
|
||||
const auto fontHeight = p.fontMetrics().height();
|
||||
|
||||
const auto baseLine = height() - 3;
|
||||
|
||||
const int recordSymbolRadius = 3;
|
||||
const int recordSymbolCenterX = recordSymbolRadius + 4;
|
||||
const int recordSymbolCenterY = baseLine - fontHeight / 2 + 1;
|
||||
|
||||
const int textStartX = recordSymbolCenterX + recordSymbolRadius + 4;
|
||||
|
||||
auto textPos = QPoint(textStartX, baseLine);
|
||||
|
||||
const auto rec = tr("Rec");
|
||||
|
||||
p.setPen(textShadowColor());
|
||||
p.drawText(textPos + QPoint(1, 1), rec);
|
||||
|
||||
p.setPen(textColor());
|
||||
p.drawText(textPos, rec);
|
||||
|
||||
p.setBrush(QBrush(textColor()));
|
||||
|
||||
p.drawEllipse(QPoint(recordSymbolCenterX, recordSymbolCenterY), recordSymbolRadius, recordSymbolRadius);
|
||||
}
|
||||
|
||||
p.end();
|
||||
|
||||
@@ -325,11 +346,6 @@ void SampleClipView::paintEvent( QPaintEvent * pe )
|
||||
}
|
||||
|
||||
|
||||
void SampleClipView::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
adjustRecordWidget();
|
||||
ClipView::resizeEvent(event);
|
||||
}
|
||||
|
||||
|
||||
void SampleClipView::reverseSample()
|
||||
@@ -380,34 +396,6 @@ bool SampleClipView::splitClip( const TimePos pos )
|
||||
else { return false; }
|
||||
}
|
||||
|
||||
QWidget* SampleClipView::buildRecordWidget(BoolModel& recordModel)
|
||||
{
|
||||
auto recordWidget = new QWidget(this);
|
||||
|
||||
auto recordButton = new PixmapButton(recordWidget);
|
||||
recordButton->setActiveGraphic(embed::getIconPixmap("led_red"));
|
||||
recordButton->setToolTip(tr("Enable/disable recording"));
|
||||
recordButton->setCheckable(true);
|
||||
recordButton->setModel(&recordModel);
|
||||
|
||||
auto recordLabel = new QLabel(tr("Rec"), recordWidget);
|
||||
recordLabel->setFont(adjustedToPixelSize(recordLabel->font(), 10));
|
||||
|
||||
// Now layout everything
|
||||
QHBoxLayout* recordLayout = new QHBoxLayout(recordWidget);
|
||||
recordLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
recordLayout->addWidget(recordButton);
|
||||
recordLayout->addWidget(recordLabel);
|
||||
|
||||
return recordWidget;
|
||||
}
|
||||
|
||||
void SampleClipView::adjustRecordWidget()
|
||||
{
|
||||
m_recordWidget->move(1, height() - m_recordWidget->height() - 1);
|
||||
}
|
||||
|
||||
bool SampleClipView::recordingCapabilitiesAvailable() const
|
||||
{
|
||||
return Engine::audioEngine()->captureDeviceAvailable();
|
||||
|
||||
Reference in New Issue
Block a user