Merge branch 'stable-1.1'
Skipped the chinese translation files because of merge conflict, those should be re-submitted for master Conflicts: data/locale/zh.qm data/locale/zh.ts
This commit is contained in:
@@ -61,6 +61,38 @@ DataFile::typeDescStruct
|
||||
|
||||
|
||||
|
||||
DataFile::LocaleHelper::LocaleHelper( Mode mode )
|
||||
{
|
||||
switch( mode )
|
||||
{
|
||||
case ModeLoad:
|
||||
// set a locale for which QString::fromFloat() returns valid values if
|
||||
// floating point separator is a comma - otherwise we would fail to load
|
||||
// older projects made by people from various countries due to their
|
||||
// locale settings
|
||||
QLocale::setDefault( QLocale::German );
|
||||
break;
|
||||
|
||||
case ModeSave:
|
||||
// set default locale to C so that floating point decimals are rendered to
|
||||
// strings with periods as decimal point instead of commas in some countries
|
||||
QLocale::setDefault( QLocale::C );
|
||||
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
DataFile::LocaleHelper::~LocaleHelper()
|
||||
{
|
||||
// revert to original locale
|
||||
QLocale::setDefault( QLocale::system() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
DataFile::DataFile( Type type ) :
|
||||
QDomDocument( "lmms-project" ),
|
||||
m_content(),
|
||||
@@ -683,16 +715,25 @@ void DataFile::upgrade()
|
||||
|
||||
}
|
||||
|
||||
// Time-signature
|
||||
if ( !m_head.hasAttribute( "timesig_numerator" ) )
|
||||
{
|
||||
m_head.setAttribute( "timesig_numerator", 4 );
|
||||
m_head.setAttribute( "timesig_denominator", 4 );
|
||||
}
|
||||
// update document meta data
|
||||
documentElement().setAttribute( "version", LDF_VERSION_STRING );
|
||||
documentElement().setAttribute( "type", typeName( type() ) );
|
||||
documentElement().setAttribute( "creator", "LMMS" );
|
||||
documentElement().setAttribute( "creatorversion", LMMS_VERSION );
|
||||
|
||||
if( !m_head.hasAttribute( "mastervol" ) )
|
||||
if( type() == SongProject || type() == SongProjectTemplate )
|
||||
{
|
||||
m_head.setAttribute( "mastervol", 100 );
|
||||
// Time-signature
|
||||
if ( !m_head.hasAttribute( "timesig_numerator" ) )
|
||||
{
|
||||
m_head.setAttribute( "timesig_numerator", 4 );
|
||||
m_head.setAttribute( "timesig_denominator", 4 );
|
||||
}
|
||||
|
||||
if( !m_head.hasAttribute( "mastervol" ) )
|
||||
{
|
||||
m_head.setAttribute( "mastervol", 100 );
|
||||
}
|
||||
}
|
||||
//printf("%s\n", toString( 2 ).toUtf8().constData());
|
||||
}
|
||||
|
||||
@@ -898,6 +898,8 @@ void song::loadProject( const QString & _file_name )
|
||||
return;
|
||||
}
|
||||
|
||||
DataFile::LocaleHelper localeHelper( DataFile::LocaleHelper::ModeLoad );
|
||||
|
||||
engine::mixer()->lock();
|
||||
|
||||
// get the header information from the DOM
|
||||
@@ -1006,6 +1008,8 @@ void song::loadProject( const QString & _file_name )
|
||||
// only save current song as _filename and do nothing else
|
||||
bool song::saveProjectFile( const QString & _filename )
|
||||
{
|
||||
DataFile::LocaleHelper localeHelper( DataFile::LocaleHelper::ModeSave );
|
||||
|
||||
DataFile dataFile( DataFile::SongProject );
|
||||
|
||||
m_tempoModel.saveSettings( dataFile, dataFile.head(), "bpm" );
|
||||
|
||||
@@ -1244,11 +1244,10 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :
|
||||
|
||||
connect( saveSettingsBtn, SIGNAL( clicked() ), this, SLOT( saveSettingsBtnClicked() ) );
|
||||
|
||||
toolTip::add( saveSettingsBtn, tr( "Save current channel settings in a preset-file" ) );
|
||||
toolTip::add( saveSettingsBtn, tr( "Save current instrument track settings in a preset file" ) );
|
||||
saveSettingsBtn->setWhatsThis(
|
||||
tr( "Click here, if you want to save current channel settings "
|
||||
"in a preset-file. Later you can load this preset by "
|
||||
"double-clicking it in the preset-browser." ) );
|
||||
tr( "Click here, if you want to save current instrument track settings in a preset file. "
|
||||
"Later you can load this preset by double-clicking it in the preset-browser." ) );
|
||||
|
||||
basicControlsLayout->addWidget( saveSettingsBtn );
|
||||
|
||||
@@ -1408,6 +1407,8 @@ void InstrumentTrackWindow::saveSettingsBtnClicked()
|
||||
!sfd.selectedFiles().isEmpty() &&
|
||||
!sfd.selectedFiles().first().isEmpty() )
|
||||
{
|
||||
DataFile::LocaleHelper localeHelper( DataFile::LocaleHelper::ModeSave );
|
||||
|
||||
DataFile dataFile( DataFile::InstrumentTrackSettings );
|
||||
m_track->setSimpleSerializing();
|
||||
m_track->saveSettings( dataFile, dataFile.content() );
|
||||
|
||||
Reference in New Issue
Block a user