Skip to content

Commit

Permalink
Merge pull request LMMS#2442 from tresf/grid
Browse files Browse the repository at this point in the history
Remove hard-coded grid from SongEditor
  • Loading branch information
tresf committed Nov 14, 2015
2 parents 34821f9 + aaa798c commit 3e03e71
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
2 changes: 2 additions & 0 deletions data/themes/default/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ TrackContentWidget {
stop:0 rgb( 50, 50, 50 ), stop:0.33 rgb( 20, 20, 20 ), stop:1 rgb( 15, 15, 15 ) );
qproperty-lighterColor: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 rgb( 50, 50, 50 ), stop:0.33 rgb( 40, 40, 40 ), stop:1 rgb( 30, 30, 30 ) );
qproperty-gridColor: rgba( 0, 0, 0, 160 );
qproperty-embossColor: rgba( 140, 140, 140, 64 );
}


Expand Down
8 changes: 8 additions & 0 deletions include/Track.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ class TrackContentWidget : public QWidget, public JournallingObject
// qproperties for track background gradients
Q_PROPERTY( QBrush darkerColor READ darkerColor WRITE setDarkerColor )
Q_PROPERTY( QBrush lighterColor READ lighterColor WRITE setLighterColor )
Q_PROPERTY( QBrush gridColor READ gridColor WRITE setGridColor )
Q_PROPERTY( QBrush embossColor READ embossColor WRITE setEmbossColor )

public:
TrackContentWidget( TrackView * parent );
Expand Down Expand Up @@ -318,9 +320,13 @@ class TrackContentWidget : public QWidget, public JournallingObject

QBrush darkerColor() const;
QBrush lighterColor() const;
QBrush gridColor() const;
QBrush embossColor() const;

void setDarkerColor( const QBrush & c );
void setLighterColor( const QBrush & c );
void setGridColor( const QBrush & c );
void setEmbossColor( const QBrush & c);

public slots:
void update();
Expand Down Expand Up @@ -365,6 +371,8 @@ public slots:
// qproperty fields
QBrush m_darkerColor;
QBrush m_lighterColor;
QBrush m_gridColor;
QBrush m_embossColor;
} ;


Expand Down
23 changes: 20 additions & 3 deletions src/core/Track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,9 @@ TrackContentWidget::TrackContentWidget( TrackView * parent ) :
QWidget( parent ),
m_trackView( parent ),
m_darkerColor( Qt::SolidPattern ),
m_lighterColor( Qt::SolidPattern )
m_lighterColor( Qt::SolidPattern ),
m_gridColor( Qt::SolidPattern ),
m_embossColor( Qt::SolidPattern )
{
setAcceptDrops( true );

Expand Down Expand Up @@ -1030,7 +1032,7 @@ void TrackContentWidget::updateBackground()
pmp.fillRect( w, 0, w , h, lighterColor() );

// draw lines
pmp.setPen( QPen( QColor( 0, 0, 0, 160 ), 1 ) );
pmp.setPen( QPen( gridColor(), 1 ) );
// horizontal line
pmp.drawLine( 0, h-1, w*2, h-1 );

Expand All @@ -1040,7 +1042,7 @@ void TrackContentWidget::updateBackground()
pmp.drawLine( QLineF( x, 0.0, x, h ) );
}

pmp.setPen( QPen( QColor( 140, 140, 140, 64 ), 1 ) );
pmp.setPen( QPen( embossColor(), 1 ) );
for( float x = 1.0; x < w * 2; x += ppt )
{
pmp.drawLine( QLineF( x, 0.0, x, h ) );
Expand Down Expand Up @@ -1518,6 +1520,14 @@ QBrush TrackContentWidget::darkerColor() const
QBrush TrackContentWidget::lighterColor() const
{ return m_lighterColor; }

//! \brief CSS theming qproperty access method
QBrush TrackContentWidget::gridColor() const
{ return m_gridColor; }

//! \brief CSS theming qproperty access method
QBrush TrackContentWidget::embossColor() const
{ return m_embossColor; }

//! \brief CSS theming qproperty access method
void TrackContentWidget::setDarkerColor( const QBrush & c )
{ m_darkerColor = c; }
Expand All @@ -1526,6 +1536,13 @@ void TrackContentWidget::setDarkerColor( const QBrush & c )
void TrackContentWidget::setLighterColor( const QBrush & c )
{ m_lighterColor = c; }

//! \brief CSS theming qproperty access method
void TrackContentWidget::setGridColor( const QBrush & c )
{ m_gridColor = c; }

//! \brief CSS theming qproperty access method
void TrackContentWidget::setEmbossColor( const QBrush & c )
{ m_embossColor = c; }


// ===========================================================================
Expand Down

0 comments on commit 3e03e71

Please sign in to comment.