TrackViews: added compact mode

Added an option to shrink the track buttons horizontally, mainly by
moving the track name into a tooltip.

Closes #3459241.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
This commit is contained in:
Raine M. Ekman
2012-01-29 23:48:13 +01:00
committed by Tobias Doerffel
parent 6899c8378c
commit 14f41fe7b3
9 changed files with 138 additions and 27 deletions

View File

@@ -106,6 +106,7 @@ private slots:
void toggleManualChPiano( bool _enabled );
void toggleSmoothScroll( bool _enabled );
void toggleOneInstrumentTrackWindow( bool _enabled );
void toggleCompactTrackButtons( bool _enabled );
private:
@@ -152,6 +153,7 @@ private:
bool m_manualChPiano;
bool m_smoothScroll;
bool m_oneInstrumentTrackWindow;
bool m_compactTrackButtons;
typedef QMap<QString, AudioDevice::setupWidget *> AswMap;
typedef QMap<QString, MidiClient::setupWidget *> MswMap;

View File

@@ -52,10 +52,14 @@ class trackView;
typedef QWidget trackSettingsWidget;
const int DEFAULT_SETTINGS_WIDGET_WIDTH = 224;
const int TRACK_OP_WIDTH = 78;
// This shaves 150-ish pixels off track buttons,
// ruled from config: ui.compacttrackbuttons
const int DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT = 96;
const int TRACK_OP_WIDTH_COMPACT = 60;
const int TCO_BORDER_WIDTH = 1;

View File

@@ -52,6 +52,7 @@
#include "bb_editor.h"
#include "bb_track.h"
#include "bb_track_container.h"
#include "config_mgr.h"
#include "Clipboard.h"
#include "embed.h"
#include "engine.h"
@@ -1372,15 +1373,28 @@ trackOperationsWidget::trackOperationsWidget( trackView * _parent ) :
m_muteBtn->setActiveGraphic( embed::getIconPixmap( "led_off" ) );
m_muteBtn->setInactiveGraphic( embed::getIconPixmap( "led_green" ) );
m_muteBtn->setCheckable( true );
m_muteBtn->move( 46, 8 );
m_muteBtn->show();
toolTip::add( m_muteBtn, tr( "Mute this track" ) );
m_soloBtn = new pixmapButton( this, tr( "Solo" ) );
m_soloBtn->setActiveGraphic( embed::getIconPixmap( "led_red" ) );
m_soloBtn->setInactiveGraphic( embed::getIconPixmap( "led_off" ) );
m_soloBtn->setCheckable( true );
m_soloBtn->move( 62, 8 );
if( configManager::inst()->value( "ui",
"compacttrackbuttons" ).toInt() )
{
m_muteBtn->move( 46, 0 );
m_soloBtn->move( 46, 16 );
}
else
{
m_muteBtn->move( 46, 8 );
m_soloBtn->move( 62, 8 );
}
m_muteBtn->show();
toolTip::add( m_muteBtn, tr( "Mute this track" ) );
m_soloBtn->show();
toolTip::add( m_soloBtn, tr( "Solo" ) );
connect( this, SIGNAL( trackRemovalScheduled( trackView * ) ),
@@ -2156,9 +2170,17 @@ trackView::~trackView()
*/
void trackView::resizeEvent( QResizeEvent * _re )
{
m_trackOperationsWidget.setFixedSize( TRACK_OP_WIDTH, height() - 1 );
m_trackSettingsWidget.setFixedSize( DEFAULT_SETTINGS_WIDGET_WIDTH,
height() - 1 );
if( configManager::inst()->value( "ui",
"compacttrackbuttons" ).toInt() )
{
m_trackOperationsWidget.setFixedSize( TRACK_OP_WIDTH_COMPACT, height() - 1 );
m_trackSettingsWidget.setFixedSize( DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT, height() - 1 );
}
else
{
m_trackOperationsWidget.setFixedSize( TRACK_OP_WIDTH, height() - 1 );
m_trackSettingsWidget.setFixedSize( DEFAULT_SETTINGS_WIDGET_WIDTH, height() - 1 );
}
m_trackContentWidget.setFixedHeight( height() );
}

View File

@@ -34,6 +34,7 @@
#include "MainWindow.h"
#include "song.h"
#include "tool_button.h"
#include "config_mgr.h"
@@ -60,8 +61,17 @@ bbEditor::bbEditor( bbTrackContainer * _tc ) :
setWindowIcon( embed::getIconPixmap( "bb_track" ) );
setWindowTitle( tr( "Beat+Bassline Editor" ) );
// TODO: Use style sheet
setMinimumWidth( TRACK_OP_WIDTH + DEFAULT_SETTINGS_WIDGET_WIDTH
+ 2 * TCO_BORDER_WIDTH + 192 );
if( configManager::inst()->value( "ui",
"compacttrackbuttons" ).toInt() )
{
setMinimumWidth( TRACK_OP_WIDTH_COMPACT + DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT
+ 2 * TCO_BORDER_WIDTH + 192 );
}
else
{
setMinimumWidth( TRACK_OP_WIDTH + DEFAULT_SETTINGS_WIDGET_WIDTH
+ 2 * TCO_BORDER_WIDTH + 192 );
}
m_playButton = new toolButton( embed::getIconPixmap( "play" ),

View File

@@ -114,7 +114,9 @@ setupDialog::setupDialog( ConfigTabs _tab_to_open ) :
"manualchannelpiano" ).toInt() ),
m_smoothScroll( configManager::inst()->value( "ui", "smoothscroll" ).toInt() ),
m_oneInstrumentTrackWindow( configManager::inst()->value( "ui",
"oneinstrumenttrackwindow" ).toInt() )
"oneinstrumenttrackwindow" ).toInt() ),
m_compactTrackButtons( configManager::inst()->value( "ui",
"compacttrackbuttons" ).toInt() )
{
setWindowIcon( embed::getIconPixmap( "setup_general" ) );
setWindowTitle( tr( "Setup LMMS" ) );
@@ -183,7 +185,7 @@ setupDialog::setupDialog( ConfigTabs _tab_to_open ) :
tabWidget * misc_tw = new tabWidget( tr( "MISC" ), general );
misc_tw->setFixedHeight( 138 );
misc_tw->setFixedHeight( 156 );
ledCheckBox * enable_tooltips = new ledCheckBox(
tr( "Enable tooltips" ),
@@ -235,6 +237,14 @@ setupDialog::setupDialog( ConfigTabs _tab_to_open ) :
connect( hqaudio, SIGNAL( toggled( bool ) ),
this, SLOT( toggleHQAudioDev( bool ) ) );
ledCheckBox * compacttracks = new ledCheckBox(
tr( "Compact track buttons" ),
misc_tw );
compacttracks->move( 10, 126 );
compacttracks->setChecked( m_compactTrackButtons );
connect( compacttracks, SIGNAL( toggled( bool ) ),
this, SLOT( toggleCompactTrackButtons( bool ) ) );
gen_layout->addWidget( bufsize_tw );
@@ -751,6 +761,8 @@ void setupDialog::accept()
QString::number( m_smoothScroll ) );
configManager::inst()->setValue( "ui", "oneinstrumenttrackwindow",
QString::number( m_oneInstrumentTrackWindow ) );
configManager::inst()->setValue( "ui", "compacttrackbuttons",
QString::number( m_compactTrackButtons ) );
configManager::inst()->setWorkingDir( m_workingDir );
configManager::inst()->setVSTDir( m_vstDir );
@@ -916,6 +928,15 @@ void setupDialog::toggleSmoothScroll( bool _enabled )
void setupDialog::toggleCompactTrackButtons( bool _enabled )
{
m_compactTrackButtons = _enabled;
}
void setupDialog::toggleOneInstrumentTrackWindow( bool _enabled )
{
m_oneInstrumentTrackWindow = _enabled;

View File

@@ -52,6 +52,7 @@
#include "visualization_widget.h"
#include "AudioDevice.h"
#include "piano_roll.h"
#include "config_mgr.h"
@@ -89,8 +90,11 @@ songEditor::songEditor( song * _song, songEditor * & _engine_ptr ) :
setFocus();
// create time-line
m_timeLine = new timeLine( TRACK_OP_WIDTH +
DEFAULT_SETTINGS_WIDGET_WIDTH, 32,
int widgetTotal = configManager::inst()->value( "ui",
"compacttrackbuttons" ).toInt()==1 ?
DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT + TRACK_OP_WIDTH_COMPACT :
DEFAULT_SETTINGS_WIDGET_WIDTH + TRACK_OP_WIDTH;
m_timeLine = new timeLine( widgetTotal, 32,
pixelsPerTact(),
m_s->m_playPos[song::Mode_PlaySong],
m_currentPosition, this );
@@ -683,12 +687,24 @@ static inline void animateScroll( QScrollBar *scrollBar, int newVal, bool smooth
void songEditor::updatePosition( const midiTime & _t )
{
int widgetWidth, trackOpWidth;
if( configManager::inst()->value( "ui", "compacttrackbuttons" ).toInt() )
{
widgetWidth = DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT;
trackOpWidth = TRACK_OP_WIDTH_COMPACT;
}
else
{
widgetWidth = DEFAULT_SETTINGS_WIDGET_WIDTH;
trackOpWidth = TRACK_OP_WIDTH;
}
if( ( m_s->isPlaying() && m_s->m_playMode == song::Mode_PlaySong
&& m_timeLine->autoScroll() == timeLine::AutoScrollEnabled) ||
m_scrollBack == true )
{
const int w = width() - DEFAULT_SETTINGS_WIDGET_WIDTH
- TRACK_OP_WIDTH
const int w = width() - widgetWidth
- trackOpWidth
- 32; // rough estimation for width of right scrollbar
if( _t > m_currentPosition + w * midiTime::ticksPerTact() /
pixelsPerTact() )
@@ -708,7 +724,7 @@ void songEditor::updatePosition( const midiTime & _t )
const int x = m_s->m_playPos[song::Mode_PlaySong].m_timeLine->
markerX( _t ) + 8;
if( x >= TRACK_OP_WIDTH + DEFAULT_SETTINGS_WIDGET_WIDTH-1 )
if( x >= trackOpWidth + widgetWidth -1 )
{
m_positionLine->show();
m_positionLine->move( x, 50 );

View File

@@ -47,7 +47,17 @@ trackLabelButton::trackLabelButton( trackView * _tv, QWidget * _parent ) :
setAcceptDrops( true );
setCursor( QCursor( embed::getIconPixmap( "hand" ), 0, 0 ) );
setToolButtonStyle( Qt::ToolButtonTextBesideIcon );
setFixedSize( 160, 29 );
if( configManager::inst()->value( "ui",
"compacttrackbuttons" ).toInt() )
{
setFixedSize( 32, 29 );
}
else
{
setFixedSize( 160, 29 );
}
setIconSize( QSize( 32, 32 ) );
setText( " " );
@@ -138,8 +148,16 @@ void trackLabelButton::paintEvent( QPaintEvent * _pe )
}
}
}
setText( m_trackView->getTrack()->displayName() );
if( configManager::inst()->value( "ui",
"compacttrackbuttons" ).toInt() )
{
setText("");
setToolTip( m_trackView->getTrack()->displayName() );
}
else
{
setText( m_trackView->getTrack()->displayName() );
}
QToolButton::paintEvent( _pe );
}

View File

@@ -894,12 +894,23 @@ InstrumentTrackView::InstrumentTrackView( InstrumentTrack * _it,
m_tlb, SLOT( update() ) );
// creation of widgets for track-settings-widget
int widgetWidth;
if( configManager::inst()->value( "ui",
"compacttrackbuttons" ).toInt() )
{
widgetWidth = DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT;
}
else
{
widgetWidth = DEFAULT_SETTINGS_WIDGET_WIDTH;
}
m_volumeKnob = new knob( knobSmall_17, getTrackSettingsWidget(),
tr( "Volume" ) );
m_volumeKnob->setVolumeKnob( true );
m_volumeKnob->setModel( &_it->m_volumeModel );
m_volumeKnob->setHintText( tr( "Volume:" ) + " ", "%" );
m_volumeKnob->move( DEFAULT_SETTINGS_WIDGET_WIDTH-24*2, 4 );
m_volumeKnob->move( widgetWidth-2*24, 4 );
m_volumeKnob->setLabel( tr( "VOL" ) );
m_volumeKnob->show();
m_volumeKnob->setWhatsThis( tr( volume_help ) );
@@ -908,11 +919,10 @@ InstrumentTrackView::InstrumentTrackView( InstrumentTrack * _it,
tr( "Panning" ) );
m_panningKnob->setModel( &_it->m_panningModel );
m_panningKnob->setHintText( tr( "Panning:" ) + " ", "%" );
m_panningKnob->move( DEFAULT_SETTINGS_WIDGET_WIDTH-24, 4 );
m_panningKnob->move( widgetWidth-24, 4 );
m_panningKnob->setLabel( tr( "PAN" ) );
m_panningKnob->show();
m_midiMenu = new QMenu( tr( "MIDI" ), this );
// sequenced MIDI?
@@ -952,7 +962,7 @@ InstrumentTrackView::InstrumentTrackView( InstrumentTrack * _it,
QColor( 64, 255, 16 ),
getTrackSettingsWidget() );
m_activityIndicator->setGeometry(
DEFAULT_SETTINGS_WIDGET_WIDTH-2*24-11, 2, 8, 28 );
widgetWidth-2*24-11, 2, 8, 28 );
m_activityIndicator->show();
connect( m_activityIndicator, SIGNAL( pressed() ),
this, SLOT( activityIndicatorPressed() ) );

View File

@@ -46,7 +46,7 @@
#include "MainWindow.h"
#include "EffectRackView.h"
#include "track_label_button.h"
#include "config_mgr.h"
sampleTCO::sampleTCO( track * _track ) :
@@ -523,7 +523,15 @@ sampleTrackView::sampleTrackView( sampleTrack * _t, trackContainerView * _tcv )
m_volumeKnob->setVolumeKnob( true );
m_volumeKnob->setModel( &_t->m_volumeModel );
m_volumeKnob->setHintText( tr( "Channel volume:" ) + " ", "%" );
m_volumeKnob->move( DEFAULT_SETTINGS_WIDGET_WIDTH-2*24, 4 );
if( configManager::inst()->value( "ui",
"compacttrackbuttons" ).toInt() )
{
m_volumeKnob->move( DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT-2*24, 4 );
}
else
{
m_volumeKnob->move( DEFAULT_SETTINGS_WIDGET_WIDTH-2*24, 4 );
}
m_volumeKnob->setLabel( tr( "VOL" ) );
m_volumeKnob->show();