TCOView: Make patternviews foreground elements stylable with qproperties
This commit is contained in:
@@ -484,16 +484,22 @@ TrackContainerView QLabel
|
||||
/* instrument pattern */
|
||||
patternView {
|
||||
color: rgb( 119, 199, 216 );
|
||||
qproperty-fgColor: rgb( 187, 227, 236 );
|
||||
qproperty-textColor: rgb( 255, 255, 255 );
|
||||
}
|
||||
|
||||
/* sample track pattern */
|
||||
SampleTCOView {
|
||||
color: rgb( 74, 253, 133 );
|
||||
qproperty-fgColor: rgb( 187, 227, 236 );
|
||||
qproperty-textColor: rgb( 255, 60, 60 );
|
||||
}
|
||||
|
||||
/* automation pattern */
|
||||
AutomationPatternView {
|
||||
color: #99afff;
|
||||
qproperty-fgColor: rgb( 204, 215, 255 );
|
||||
qproperty-textColor: rgb( 255, 255, 255 );
|
||||
}
|
||||
|
||||
/* Plugins */
|
||||
|
||||
@@ -33,11 +33,15 @@ class AutomationPattern;
|
||||
class AutomationPatternView : public trackContentObjectView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
// theming qproperties
|
||||
Q_PROPERTY( QColor fgColor READ fgColor WRITE setFgColor )
|
||||
Q_PROPERTY( QColor textColor READ textColor WRITE setTextColor )
|
||||
|
||||
public:
|
||||
AutomationPatternView( AutomationPattern * _pat, trackView * _parent );
|
||||
virtual ~AutomationPatternView();
|
||||
|
||||
|
||||
public slots:
|
||||
virtual void update();
|
||||
|
||||
@@ -67,7 +71,6 @@ private:
|
||||
bool m_needsUpdate;
|
||||
|
||||
void scaleTimemapToFit( float oldMin, float oldMax );
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -88,6 +88,11 @@ signals:
|
||||
class SampleTCOView : public trackContentObjectView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
// theming qproperties
|
||||
Q_PROPERTY( QColor fgColor READ fgColor WRITE setFgColor )
|
||||
Q_PROPERTY( QColor textColor READ textColor WRITE setTextColor )
|
||||
|
||||
public:
|
||||
SampleTCOView( SampleTCO * _tco, trackView * _tv );
|
||||
virtual ~SampleTCOView();
|
||||
@@ -108,7 +113,6 @@ protected:
|
||||
|
||||
private:
|
||||
SampleTCO * m_tco;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -147,6 +147,10 @@ private:
|
||||
class patternView : public trackContentObjectView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
// theming qproperties
|
||||
Q_PROPERTY( QColor fgColor READ fgColor WRITE setFgColor )
|
||||
Q_PROPERTY( QColor textColor READ textColor WRITE setTextColor )
|
||||
public:
|
||||
patternView( pattern * _pattern, trackView * _parent );
|
||||
virtual ~patternView();
|
||||
@@ -185,7 +189,6 @@ private:
|
||||
pattern * m_pat;
|
||||
QPixmap m_paintPixmap;
|
||||
bool m_needsUpdate;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -163,6 +163,11 @@ private:
|
||||
class trackContentObjectView : public selectableObject, public ModelView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
// theming qproperties
|
||||
Q_PROPERTY( QColor fgColor READ fgColor WRITE setFgColor )
|
||||
Q_PROPERTY( QColor textColor READ textColor WRITE setTextColor )
|
||||
|
||||
public:
|
||||
trackContentObjectView( trackContentObject * _tco, trackView * _tv );
|
||||
virtual ~trackContentObjectView();
|
||||
@@ -173,7 +178,11 @@ public:
|
||||
{
|
||||
return m_tco;
|
||||
}
|
||||
|
||||
// qproperty access func
|
||||
QColor fgColor() const;
|
||||
QColor textColor() const;
|
||||
void setFgColor( const QColor & _c );
|
||||
void setTextColor( const QColor & _c );
|
||||
|
||||
public slots:
|
||||
virtual bool close();
|
||||
@@ -228,6 +237,9 @@ private:
|
||||
|
||||
MidiTime m_oldTime;// used for undo/redo while mouse-button is pressed
|
||||
|
||||
// qproperty fields
|
||||
QColor * m_fgColor;
|
||||
QColor * m_textColor;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -249,7 +249,9 @@ trackContentObjectView::trackContentObjectView( trackContentObject * _tco,
|
||||
m_action( NoAction ),
|
||||
m_autoResize( false ),
|
||||
m_initialMouseX( 0 ),
|
||||
m_hint( NULL )
|
||||
m_hint( NULL ),
|
||||
m_fgColor( NULL ),
|
||||
m_textColor( NULL )
|
||||
{
|
||||
if( s_textFloat == NULL )
|
||||
{
|
||||
@@ -275,6 +277,9 @@ trackContentObjectView::trackContentObjectView( trackContentObject * _tco,
|
||||
connect( m_tco, SIGNAL( destroyedTCO() ), this, SLOT( close() ) );
|
||||
setModel( m_tco );
|
||||
|
||||
setFgColor( QColor( 0,0,0 ) );
|
||||
setTextColor( QColor( 0,0,0 ) );
|
||||
|
||||
m_trackView->getTrackContentWidget()->addTCOView( this );
|
||||
}
|
||||
|
||||
@@ -314,6 +319,23 @@ bool trackContentObjectView::fixedTCOs()
|
||||
|
||||
|
||||
|
||||
// qproperty access functions, to be inherited & used by TCOviews
|
||||
//! \brief CSS theming qproperty access method
|
||||
QColor trackContentObjectView::fgColor() const
|
||||
{ if( m_fgColor ) return *m_fgColor; else return QColor( 0,0,0 ); }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
QColor trackContentObjectView::textColor() const
|
||||
{ if( m_textColor ) return *m_textColor; else return QColor( 0,0,0 ); }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
void trackContentObjectView::setFgColor( const QColor & _c )
|
||||
{ if( m_fgColor ) *m_fgColor = _c; else m_fgColor = new QColor( 0,0,0 ); }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
void trackContentObjectView::setTextColor( const QColor & _c )
|
||||
{ if( m_textColor ) *m_textColor = _c; else m_textColor = new QColor( 0,0,0 ); }
|
||||
|
||||
|
||||
/*! \brief Close a trackContentObjectView
|
||||
*
|
||||
@@ -1213,46 +1235,59 @@ MidiTime trackContentWidget::endPosition( const MidiTime & _pos_start )
|
||||
|
||||
|
||||
// qproperty access methods
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
QColor trackContentWidget::darkerColor1() const
|
||||
{ if( m_darkerColor1 ) return *m_darkerColor1; else return QColor( 0, 0, 0 ); }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
QColor trackContentWidget::darkerColor2() const
|
||||
{ if( m_darkerColor2 ) return *m_darkerColor2; else return QColor( 0, 0, 0 ); }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
QColor trackContentWidget::darkerColor3() const
|
||||
{ if( m_darkerColor3 ) return *m_darkerColor3; else return QColor( 0, 0, 0 ); }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
QColor trackContentWidget::lighterColor1() const
|
||||
{ if( m_lighterColor1 ) return *m_lighterColor1; else return QColor( 0, 0, 0 ); }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
QColor trackContentWidget::lighterColor2() const
|
||||
{ if( m_lighterColor2 ) return *m_lighterColor2; else return QColor( 0, 0, 0 ); }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
QColor trackContentWidget::lighterColor3() const
|
||||
{ if( m_lighterColor3 ) return *m_lighterColor3; else return QColor( 0, 0, 0 ); }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
void trackContentWidget::setDarkerColor1( const QColor & _c )
|
||||
{ if( m_darkerColor1 ) *m_darkerColor1 = _c; else m_darkerColor1 = new QColor( _c ); }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
void trackContentWidget::setDarkerColor2( const QColor & _c )
|
||||
{ if( m_darkerColor2 ) *m_darkerColor2 = _c; else m_darkerColor2 = new QColor( _c ); }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
void trackContentWidget::setDarkerColor3( const QColor & _c )
|
||||
{ if( m_darkerColor3 ) *m_darkerColor3 = _c; else m_darkerColor3 = new QColor( _c ); }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
void trackContentWidget::setLighterColor1( const QColor & _c )
|
||||
{ if( m_lighterColor1 ) *m_lighterColor1 = _c; else m_lighterColor1 = new QColor( _c ); }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
void trackContentWidget::setLighterColor2( const QColor & _c )
|
||||
{ if( m_lighterColor2 ) *m_lighterColor2 = _c; else m_lighterColor2 = new QColor( _c ); }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
void trackContentWidget::setLighterColor3( const QColor & _c )
|
||||
{ if( m_lighterColor3 ) *m_lighterColor3 = _c; else m_lighterColor3 = new QColor( _c ); }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
float trackContentWidget::gradMidPoint() const
|
||||
{ return m_gradMidPoint; }
|
||||
|
||||
//! \brief CSS theming qproperty access method
|
||||
void trackContentWidget::setGradMidPoint( float _g )
|
||||
{ m_gradMidPoint = _g; }
|
||||
|
||||
|
||||
@@ -273,8 +273,9 @@ void AutomationPatternView::paintEvent( QPaintEvent * )
|
||||
|
||||
QLinearGradient lin2grad( 0, min, 0, max );
|
||||
|
||||
lin2grad.setColorAt( 1, c.lighter( 200 ) );
|
||||
lin2grad.setColorAt( 0, c );
|
||||
lin2grad.setColorAt( 1, fgColor().lighter( 150 ) );
|
||||
lin2grad.setColorAt( 0.5, fgColor() );
|
||||
lin2grad.setColorAt( 0, fgColor().darker( 150 ) );
|
||||
|
||||
for( AutomationPattern::timeMap::const_iterator it =
|
||||
m_pat->getTimeMap().begin();
|
||||
@@ -313,7 +314,7 @@ void AutomationPatternView::paintEvent( QPaintEvent * )
|
||||
|
||||
QColor text_color = ( m_pat->isMuted() || m_pat->getTrack()->isMuted() )
|
||||
? QColor( 30, 30, 30 )
|
||||
: QColor( 255, 255, 255 );
|
||||
: textColor();
|
||||
|
||||
p.setPen( QColor( 0, 0, 0 ) );
|
||||
p.drawText( 4, p.fontMetrics().height()+1, m_pat->name() );
|
||||
|
||||
@@ -358,7 +358,7 @@ void SampleTCOView::paintEvent( QPaintEvent * _pe )
|
||||
}
|
||||
else
|
||||
{
|
||||
p.setPen( c.lighter( 200 ) );
|
||||
p.setPen( fgColor() );
|
||||
}
|
||||
QRect r = QRect( 1, 1,
|
||||
qMax( static_cast<int>( m_tco->sampleLength() *
|
||||
@@ -383,10 +383,10 @@ void SampleTCOView::paintEvent( QPaintEvent * _pe )
|
||||
|
||||
p.setPen( QColor( 0, 0, 0 ) );
|
||||
p.drawText( 10, p.fontMetrics().height()+1, "Rec" );
|
||||
p.setPen( QColor( 255, 60, 60 ) );
|
||||
p.setPen( textColor() );
|
||||
p.drawText( 9, p.fontMetrics().height(), "Rec" );
|
||||
|
||||
p.setBrush( QBrush( QColor( 255, 60, 60 ) ) );
|
||||
p.setBrush( QBrush( textColor() ) );
|
||||
p.drawEllipse( 4, 5, 4, 4 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1019,7 +1019,7 @@ void patternView::paintEvent( QPaintEvent * )
|
||||
}
|
||||
else
|
||||
{
|
||||
p.setPen( QColor( 255, 255, 255 ) ); /// \todo make this a qproperty
|
||||
p.setPen( fgColor() );
|
||||
}
|
||||
|
||||
// scan through all the notes and draw them on the pattern
|
||||
@@ -1133,7 +1133,7 @@ void patternView::paintEvent( QPaintEvent * )
|
||||
|
||||
QColor text_color = ( m_pat->isMuted() || m_pat->getTrack()->isMuted() )
|
||||
? QColor( 30, 30, 30 )
|
||||
: QColor( 255, 255, 255 );
|
||||
: textColor();
|
||||
|
||||
if( m_pat->name() != m_pat->instrumentTrack()->name() )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user