Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2209 font sizes too small #2222

Merged
merged 6 commits into from
Aug 23, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed data/themes/default/controller_bg.png
Binary file not shown.
Binary file removed data/themes/default/timeline.png
Binary file not shown.
9 changes: 8 additions & 1 deletion include/ControllerRackView.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@

class QPushButton;
class QScrollArea;
class QVBoxLayout;

class ControllerView;
class Controller;


class ControllerRackView : public QWidget, public SerializingObject
Expand All @@ -56,21 +58,26 @@ class ControllerRackView : public QWidget, public SerializingObject

public slots:
void deleteController( ControllerView * _view );
void onControllerAdded( Controller * );
void onControllerRemoved( Controller * );

protected:
virtual void closeEvent( QCloseEvent * _ce );

private slots:
virtual void update();
void addController();


private:
QVector<ControllerView *> m_controllerViews;

QScrollArea * m_scrollArea;
QVBoxLayout * m_scrollAreaLayout;
QPushButton * m_addButton;

// Stores the index of where to insert the next ControllerView.
// Needed so that the StretchItem always stays at the last position.
int m_nextIndex;
} ;

#endif
7 changes: 3 additions & 4 deletions include/ControllerView.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#ifndef CONTROLLER_VIEW_H
#define CONTROLLER_VIEW_H

#include <QWidget>
#include <QFrame>

#include "AutomatableModel.h"
#include "Controller.h"
Expand All @@ -39,7 +39,7 @@ class QMdiSubWindow;
class LedCheckBox;


class ControllerView : public QWidget, public ModelView
class ControllerView : public QFrame, public ModelView
{
Q_OBJECT
public:
Expand Down Expand Up @@ -70,15 +70,14 @@ public slots:

protected:
virtual void contextMenuEvent( QContextMenuEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
virtual void modelChanged();
virtual void mouseDoubleClickEvent( QMouseEvent * event );


private:
QPixmap m_bg;
QMdiSubWindow * m_subWindow;
ControllerDialog * m_controllerDlg;
QLabel * m_nameLabel;
bool m_show;

} ;
Expand Down
4 changes: 4 additions & 0 deletions include/Song.h
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ private slots:
void saveControllerStates( QDomDocument & doc, QDomElement & element );
void restoreControllerStates( const QDomElement & element );

void removeAllControllers();


AutomationTrack * m_globalAutomationTrack;

Expand Down Expand Up @@ -376,6 +378,8 @@ private slots:
void lengthChanged( int tacts );
void tempoChanged( bpm_t newBPM );
void timeSignatureChanged( int oldTicksPerTact, int ticksPerTact );
void controllerAdded( Controller * );
void controllerRemoved( Controller * );

} ;

Expand Down
1 change: 0 additions & 1 deletion include/TimeLineWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ public slots:


private:
static QPixmap * s_timeLinePixmap;
static QPixmap * s_posMarkerPixmap;
static QPixmap * s_loopPointBeginPixmap;
static QPixmap * s_loopPointEndPixmap;
Expand Down
5 changes: 0 additions & 5 deletions src/core/Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,6 @@ Controller::~Controller()
s_controllers.remove( idx );
}

if( Engine::getSong() )
{
Engine::getSong()->removeController( this );
}

m_valueBuffer.clear();
// Remove connections by destroyed signal
}
Expand Down
38 changes: 24 additions & 14 deletions src/core/Song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -828,11 +828,7 @@ void Song::clearProject()
gui->getProjectNotes()->clear();
}

// Move to function
while( !m_controllers.empty() )
{
delete m_controllers.last();
}
removeAllControllers();

emit dataChanged();

Expand Down Expand Up @@ -1215,6 +1211,19 @@ void Song::restoreControllerStates( const QDomElement & element )
}



void Song::removeAllControllers()
{
for (int i = 0; i < m_controllers.size(); ++i)
{
delete m_controllers.at(i);
}

m_controllers.clear();
}



void Song::exportProjectTracks()
{
exportProject( true );
Expand Down Expand Up @@ -1383,12 +1392,14 @@ void Song::setModified()



void Song::addController( Controller * c )
void Song::addController( Controller * controller )
{
if( c != NULL && m_controllers.contains( c ) == false )
if( controller && !m_controllers.contains( controller ) )
{
m_controllers.append( c );
emit dataChanged();
m_controllers.append( controller );
emit controllerAdded( controller );

this->setModified();
}
}

Expand All @@ -1402,11 +1413,10 @@ void Song::removeController( Controller * controller )
{
m_controllers.remove( index );

if( Engine::getSong() )
{
Engine::getSong()->setModified();
}
emit dataChanged();
emit controllerRemoved( controller );
delete controller;

this->setModified();
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/gui/FileBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,6 @@ FileBrowserTreeWidget::FileBrowserTreeWidget(QWidget * parent ) :
headerItem()->setHidden( true );
setSortingEnabled( false );

setFont( pointSizeF( font(), 7.5f ) );

connect( this, SIGNAL( itemDoubleClicked( QTreeWidgetItem *, int ) ),
SLOT( activateListItem( QTreeWidgetItem *, int ) ) );
connect( this, SIGNAL( itemCollapsed( QTreeWidgetItem * ) ),
Expand Down
13 changes: 8 additions & 5 deletions src/gui/PluginBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ PluginBrowser::PluginBrowser( QWidget * _parent ) :
"Beat+Bassline Editor or into an "
"existing instrument track." ),
m_view );
hint->setFont( pointSize<8>( hint->font() ) );
hint->setWordWrap( true );

QScrollArea* scrollarea = new QScrollArea( m_view );
Expand Down Expand Up @@ -153,16 +152,20 @@ void PluginDescWidget::paintEvent( QPaintEvent * )
p.drawRect( 0, 0, rect().right(), rect().bottom() );
p.drawPixmap( 4, 4, logo );

QFont f = pointSize<8>( p.font() );
f.setBold( true );
QFont f = p.font();
if ( m_mouseOver )
{
f.setBold( true );
}

p.setFont( f );
p.drawText( 10 + logo_size.width(), 15,
m_pluginDescriptor.displayName );

if( height() > 24 || m_mouseOver )
{
f.setBold( false );
p.setFont( pointSize<8>( f ) );
p.setFont( f );
QRect br;
p.drawText( 10 + logo_size.width(), 20, width() - 58 - 5, 999,
Qt::TextWordWrap,
Expand Down Expand Up @@ -231,7 +234,7 @@ void PluginDescWidget::updateHeight()

if( !m_updateTimer.isActive() )
{
m_updateTimer.start( 15 );
m_updateTimer.start( 10 );
}
}

Expand Down
21 changes: 12 additions & 9 deletions src/gui/TimeLineWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
#endif


QPixmap * TimeLineWidget::s_timeLinePixmap = NULL;
QPixmap * TimeLineWidget::s_posMarkerPixmap = NULL;
QPixmap * TimeLineWidget::s_loopPointBeginPixmap = NULL;
QPixmap * TimeLineWidget::s_loopPointEndPixmap = NULL;
Expand All @@ -73,11 +72,6 @@ TimeLineWidget::TimeLineWidget( const int xoff, const int yoff, const float ppt,
m_loopPos[0] = 0;
m_loopPos[1] = DefaultTicksPerTact;

if( s_timeLinePixmap == NULL )
{
s_timeLinePixmap = new QPixmap( embed::getIconPixmap(
"timeline" ) );
}
if( s_posMarkerPixmap == NULL )
{
s_posMarkerPixmap = new QPixmap( embed::getIconPixmap(
Expand All @@ -96,7 +90,7 @@ TimeLineWidget::TimeLineWidget( const int xoff, const int yoff, const float ppt,

setAttribute( Qt::WA_OpaquePaintEvent, true );
move( 0, yoff );
setFixedHeight( s_timeLinePixmap->height() );
setFixedHeight( 18 );

m_xOffset -= s_posMarkerPixmap->width() / 2;

Expand Down Expand Up @@ -250,20 +244,29 @@ void TimeLineWidget::paintEvent( QPaintEvent * )
int x = m_xOffset + s_posMarkerPixmap->width() / 2 -
( ( static_cast<int>( m_begin * m_ppt ) / MidiTime::ticksPerTact() ) % static_cast<int>( m_ppt ) );

p.setPen( QColor( 192, 192, 192 ) );
QColor lineColor( 192, 192, 192 );
QColor tactColor( lineColor.darker( 120 ) );

// Set font to half of the widgets size (in pixels)
QFont font = p.font();
font.setPixelSize( this->height() * 0.5 );
p.setFont( font );

for( int i = 0; x + i * m_ppt < width(); ++i )
{
const int cx = x + qRound( i * m_ppt );
p.setPen( lineColor );
p.drawLine( cx, 5, cx, height() - 6 );
++tact_num;
if( ( tact_num - 1 ) %
qMax( 1, qRound( 1.0f / 3.0f *
MidiTime::ticksPerTact() / m_ppt ) ) == 0 )
{
const QString s = QString::number( tact_num );
p.setPen( tactColor );
p.drawText( cx + qRound( ( m_ppt - p.fontMetrics().
width( s ) ) / 2 ),
height() - p.fontMetrics().height() / 2, s );
height() - p.fontMetrics().ascent() / 2, s );
}
}

Expand Down
Loading