Use std::optional for colour interfaces and storage (#6991)
This commit is contained in:
@@ -25,6 +25,8 @@
|
||||
#ifndef LMMS_CLIP_H
|
||||
#define LMMS_CLIP_H
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include <QColor>
|
||||
|
||||
#include "AutomatableModel.h"
|
||||
@@ -109,24 +111,8 @@ public:
|
||||
return m_autoResize;
|
||||
}
|
||||
|
||||
QColor color() const
|
||||
{
|
||||
return m_color;
|
||||
}
|
||||
|
||||
void setColor( const QColor & c )
|
||||
{
|
||||
m_color = c;
|
||||
}
|
||||
|
||||
bool hasColor();
|
||||
|
||||
void useCustomClipColor( bool b );
|
||||
|
||||
bool usesCustomClipColor()
|
||||
{
|
||||
return m_useCustomClipColor;
|
||||
}
|
||||
auto color() const -> const std::optional<QColor>& { return m_color; }
|
||||
void setColor(const std::optional<QColor>& color);
|
||||
|
||||
virtual void movePosition( const TimePos & pos );
|
||||
virtual void changeLength( const TimePos & length );
|
||||
@@ -177,8 +163,7 @@ private:
|
||||
|
||||
bool m_selectViewOnCreate;
|
||||
|
||||
QColor m_color;
|
||||
bool m_useCustomClipColor;
|
||||
std::optional<QColor> m_color;
|
||||
|
||||
friend class ClipView;
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#ifndef LMMS_GUI_CLIP_VIEW_H
|
||||
#define LMMS_GUI_CLIP_VIEW_H
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include <QVector>
|
||||
|
||||
@@ -184,6 +185,7 @@ protected:
|
||||
|
||||
virtual void paintTextLabel(QString const & text, QPainter & painter);
|
||||
|
||||
auto hasCustomColor() const -> bool;
|
||||
|
||||
protected slots:
|
||||
void updateLength();
|
||||
@@ -241,7 +243,7 @@ private:
|
||||
bool mouseMovedDistance( QMouseEvent * me, int distance );
|
||||
TimePos draggedClipPos( QMouseEvent * me );
|
||||
int knifeMarkerPos( QMouseEvent * me );
|
||||
void setColor(const QColor* color);
|
||||
void setColor(const std::optional<QColor>& color);
|
||||
//! Return true iff the clip could be split. Currently only implemented for samples
|
||||
virtual bool splitClip( const TimePos pos ){ return false; };
|
||||
void updateCursor(QMouseEvent * me);
|
||||
|
||||
@@ -76,12 +76,8 @@ class MixerChannel : public ThreadableJob
|
||||
bool requiresProcessing() const override { return true; }
|
||||
void unmuteForSolo();
|
||||
|
||||
void setColor (QColor newColor)
|
||||
{
|
||||
m_color = newColor;
|
||||
}
|
||||
|
||||
std::optional<QColor> m_color;
|
||||
auto color() const -> const std::optional<QColor>& { return m_color; }
|
||||
void setColor(const std::optional<QColor>& color) { m_color = color; }
|
||||
|
||||
std::atomic_int m_dependenciesMet;
|
||||
void incrementDeps();
|
||||
@@ -89,8 +85,9 @@ class MixerChannel : public ThreadableJob
|
||||
|
||||
private:
|
||||
void doProcessing() override;
|
||||
};
|
||||
|
||||
std::optional<QColor> m_color;
|
||||
};
|
||||
|
||||
class MixerRoute : public QObject
|
||||
{
|
||||
|
||||
@@ -189,15 +189,9 @@ public:
|
||||
{
|
||||
return m_processingLock.tryLock();
|
||||
}
|
||||
|
||||
QColor color()
|
||||
{
|
||||
return m_color.value();
|
||||
}
|
||||
bool useColor()
|
||||
{
|
||||
return m_color.has_value();
|
||||
}
|
||||
|
||||
auto color() const -> const std::optional<QColor>& { return m_color; }
|
||||
void setColor(const std::optional<QColor>& color);
|
||||
|
||||
bool isMutedBeforeSolo() const
|
||||
{
|
||||
@@ -220,9 +214,6 @@ public slots:
|
||||
|
||||
void toggleSolo();
|
||||
|
||||
void setColor(const QColor& c);
|
||||
void resetColor();
|
||||
|
||||
private:
|
||||
TrackContainer* m_trackContainer;
|
||||
Type m_type;
|
||||
|
||||
Reference in New Issue
Block a user