* song/songEditor: added meterModel and meterDialog (which actually is just a widget) as preparation for time-signature-support - it doesn't actually work yet!
* style.css: improved appearence of menu in general * splitted source-files for meterModel and meterDialog and added "simple"-mode for meterDialog git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1014 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
73
src/core/meter_model.cpp
Normal file
73
src/core/meter_model.cpp
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* meter_model.cpp - model for meter specification
|
||||
*
|
||||
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "meter_model.h"
|
||||
|
||||
|
||||
meterModel::meterModel( ::model * _parent, track * _track ) :
|
||||
model( _parent ),
|
||||
m_numeratorModel( 4, 1, 32, 1, this ),
|
||||
m_denominatorModel( 4, 1, 32, 1, this )
|
||||
{
|
||||
m_numeratorModel.setTrack( _track );
|
||||
m_denominatorModel.setTrack( _track );
|
||||
|
||||
connect( &m_numeratorModel, SIGNAL( dataChanged() ),
|
||||
this, SIGNAL( numeratorChanged() ) );
|
||||
connect( &m_denominatorModel, SIGNAL( dataChanged() ),
|
||||
this, SIGNAL( denominatorChanged() ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
meterModel::~meterModel()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void meterModel::saveSettings( QDomDocument & _doc, QDomElement & _this,
|
||||
const QString & _name )
|
||||
{
|
||||
m_numeratorModel.saveSettings( _doc, _this, _name + "_numerator" );
|
||||
m_denominatorModel.saveSettings( _doc, _this, _name + "_denominator" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void meterModel::loadSettings( const QDomElement & _this,
|
||||
const QString & _name )
|
||||
{
|
||||
m_numeratorModel.loadSettings( _this, _name + "_numerator" );
|
||||
m_denominatorModel.loadSettings( _this, _name + "_denominator" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include "meter_model.moc"
|
||||
|
||||
@@ -77,6 +77,7 @@ song::song( void ) :
|
||||
m_automationTrack( track::create( track::AutomationTrack, this ) ),
|
||||
m_tempoModel( DEFAULT_BPM, MIN_BPM, MAX_BPM, intModel::defaultRelStep(),
|
||||
this ),
|
||||
m_timeSigModel( this, m_automationTrack ),
|
||||
m_masterVolumeModel( 100, 0, 200, 1, this ),
|
||||
m_masterPitchModel( 0, -12, 12, 1, this ),
|
||||
m_fileName(),
|
||||
@@ -96,6 +97,8 @@ song::song( void ) :
|
||||
this, SLOT( setTempo() ) );
|
||||
connect( &m_tempoModel, SIGNAL( dataUnchanged() ),
|
||||
this, SLOT( setTempo() ) );
|
||||
connect( &m_timeSigModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( setTimeSignature() ) );
|
||||
|
||||
|
||||
connect( engine::getMixer(), SIGNAL( sampleRateChanged() ), this,
|
||||
@@ -155,6 +158,15 @@ void song::setTempo( void )
|
||||
|
||||
|
||||
|
||||
void song::setTimeSignature( void )
|
||||
{
|
||||
emit timeSignatureChanged( m_timeSigModel.getNumerator(),
|
||||
m_timeSigModel.getDenominator() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void song::doActions( void )
|
||||
{
|
||||
while( !m_actions.empty() )
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
#include "instrument_track.h"
|
||||
#include "lcd_spinbox.h"
|
||||
#include "main_window.h"
|
||||
#include "meter_dialog.h"
|
||||
#include "midi_client.h"
|
||||
#include "mmp.h"
|
||||
#include "note_play_handle.h"
|
||||
@@ -140,6 +141,12 @@ songEditor::songEditor( song * _song, songEditor * & _engine_ptr ) :
|
||||
engine::getMainWindow()->addSpacingToToolBar( 10 );
|
||||
|
||||
|
||||
m_timeSigDisplay = new meterDialog( this, TRUE );
|
||||
m_timeSigDisplay->setModel( &m_s->m_timeSigModel );
|
||||
engine::getMainWindow()->addWidgetToToolBar( m_timeSigDisplay );
|
||||
|
||||
engine::getMainWindow()->addSpacingToToolBar( 10 );
|
||||
|
||||
|
||||
QLabel * master_vol_lbl = new QLabel( tb );
|
||||
master_vol_lbl->setPixmap( embed::getIconPixmap( "master_volume" ) );
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#ifndef SINGLE_SOURCE_COMPILE
|
||||
|
||||
/*
|
||||
* meter_dialog.cpp - dialog for entering meter settings
|
||||
*
|
||||
@@ -29,63 +27,18 @@
|
||||
#include <QtGui/QLabel>
|
||||
|
||||
#include "meter_dialog.h"
|
||||
#include "meter_model.h"
|
||||
#include "embed.h"
|
||||
#include "gui_templates.h"
|
||||
|
||||
|
||||
meterModel::meterModel( ::model * _parent, track * _track ) :
|
||||
model( _parent ),
|
||||
m_numeratorModel( 4, 1, 32, 1, this ),
|
||||
m_denominatorModel( 4, 1, 32, 1, this )
|
||||
{
|
||||
m_numeratorModel.setTrack( _track );
|
||||
m_denominatorModel.setTrack( _track );
|
||||
|
||||
connect( &m_numeratorModel, SIGNAL( dataChanged() ),
|
||||
this, SIGNAL( numeratorChanged() ) );
|
||||
connect( &m_denominatorModel, SIGNAL( dataChanged() ),
|
||||
this, SIGNAL( denominatorChanged() ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
meterModel::~meterModel()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void meterModel::saveSettings( QDomDocument & _doc, QDomElement & _this,
|
||||
const QString & _name )
|
||||
{
|
||||
m_numeratorModel.saveSettings( _doc, _this, _name + "_numerator" );
|
||||
m_denominatorModel.saveSettings( _doc, _this, _name + "_denominator" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void meterModel::loadSettings( const QDomElement & _this,
|
||||
const QString & _name )
|
||||
{
|
||||
m_numeratorModel.loadSettings( _this, _name + "_numerator" );
|
||||
m_denominatorModel.loadSettings( _this, _name + "_denominator" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
meterDialog::meterDialog( QWidget * _parent ) :
|
||||
meterDialog::meterDialog( QWidget * _parent, bool _simple ) :
|
||||
QWidget( _parent ),
|
||||
modelView( NULL )
|
||||
{
|
||||
QVBoxLayout * vlayout = new QVBoxLayout( this );
|
||||
vlayout->setSpacing( 5 );
|
||||
vlayout->setMargin( 5 );
|
||||
|
||||
vlayout->setSpacing( 0 );
|
||||
vlayout->setMargin( 0 );
|
||||
|
||||
QWidget * num = new QWidget( this );
|
||||
QHBoxLayout * num_layout = new QHBoxLayout( num );
|
||||
@@ -97,11 +50,15 @@ meterDialog::meterDialog( QWidget * _parent ) :
|
||||
|
||||
num_layout->addWidget( m_numerator );
|
||||
|
||||
QLabel * num_label = new QLabel( num );
|
||||
num_label->setText( tr( "Meter Numerator" ) );
|
||||
QFont f = num_label->font();
|
||||
num_label->setFont( pointSize<7>( f ) );
|
||||
num_layout->addWidget( num_label );
|
||||
if( !_simple )
|
||||
{
|
||||
QLabel * num_label = new QLabel( tr( "Meter Numerator" ), num );
|
||||
QFont f = num_label->font();
|
||||
num_label->setFont( pointSize<7>( f ) );
|
||||
num_layout->addSpacing( 5 );
|
||||
num_layout->addWidget( num_label );
|
||||
}
|
||||
num_layout->addStretch();
|
||||
|
||||
|
||||
QWidget * den = new QWidget( this );
|
||||
@@ -110,20 +67,30 @@ meterDialog::meterDialog( QWidget * _parent ) :
|
||||
den_layout->setMargin( 0 );
|
||||
|
||||
m_denominator = new lcdSpinBox( 2, den, tr( "Meter Denominator" ) );
|
||||
if( _simple )
|
||||
{
|
||||
m_denominator->setLabel( tr( "TIME SIG" ) );
|
||||
}
|
||||
|
||||
den_layout->addWidget( m_denominator );
|
||||
|
||||
QLabel * den_label = new QLabel( den );
|
||||
f = den_label->font();
|
||||
den_label->setFont( pointSize<7>( f ) );
|
||||
den_label->setText( tr( "Meter Denominator" ) );
|
||||
den_layout->addWidget( den_label );
|
||||
|
||||
if( !_simple )
|
||||
{
|
||||
QLabel * den_label = new QLabel( tr( "Meter Denominator" ),
|
||||
den );
|
||||
QFont f = den_label->font();
|
||||
den_label->setFont( pointSize<7>( f ) );
|
||||
den_layout->addSpacing( 5 );
|
||||
den_layout->addWidget( den_label );
|
||||
}
|
||||
den_layout->addStretch();
|
||||
|
||||
|
||||
vlayout->addSpacing( _simple ? 1 : 3 );
|
||||
vlayout->addWidget( num );
|
||||
vlayout->addSpacing( 2 );
|
||||
vlayout->addWidget( den );
|
||||
|
||||
resize( den_label->width() + m_denominator->width() + 10,
|
||||
m_numerator->height() + m_denominator->height() + 15 );
|
||||
vlayout->addStretch();
|
||||
}
|
||||
|
||||
|
||||
@@ -144,6 +111,3 @@ void meterDialog::modelChanged( void )
|
||||
}
|
||||
|
||||
|
||||
#include "meter_dialog.moc"
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user