More prominent recording option

Make the option to record samples more prominent by providing a pixmap
button that is always shown and that can be used to turn recording on or
off. The corresponding widget which constitutes of the button and a label
is always positioned at the bottom left of the sample clip.

Technical details
------------------
The recording widget is built in the private method `buildRecordWidget`.
The method `adjustRecordWidget` is used to move the recording widget to
the correct position relative to the sample view. It is called after
construction and whenever the sample clip is resized (see `resizeEvent`).

Add the method `SampleClip::getRecordModel` so that the pixmap button can
be configured to act on it.
This commit is contained in:
Michael Gregorius
2024-06-02 12:34:59 +02:00
parent f9ea9705b8
commit 48c4dce96f
3 changed files with 52 additions and 30 deletions

View File

@@ -81,6 +81,8 @@ public:
void setIsPlaying(bool isPlaying);
void setSampleBuffer(std::shared_ptr<const SampleBuffer> sb);
BoolModel& getRecordModel() { return m_recordModel; }
public slots:
void setSampleFile(const QString& sf);
void updateLength();

View File

@@ -27,10 +27,13 @@
#include "ClipView.h"
class QWidget;
namespace lmms
{
class SampleClip;
class BoolModel;
namespace gui
{
@@ -59,12 +62,18 @@ protected:
void dropEvent( QDropEvent * _de ) override;
void mouseDoubleClickEvent( QMouseEvent * ) override;
void paintEvent( QPaintEvent * ) override;
void resizeEvent(QResizeEvent *event) override;
private:
QWidget* buildRecordWidget(BoolModel& recordModel);
void adjustRecordWidget();
private:
SampleClip * m_clip;
QPixmap m_paintPixmap;
bool splitClip( const TimePos pos ) override;
QWidget* m_recordWidget;
} ;