support for compressed project files

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@418 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2006-09-28 13:49:38 +00:00
parent 94ed6d08a7
commit 361235447e
7 changed files with 100 additions and 18 deletions

View File

@@ -1,5 +1,13 @@
2006-09-28 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* include/setup_dialog.h:
* src/core/main_window.cpp:
* src/core/setup_dialog.cpp:
* src/lib/mmp.cpp:
added support for compressed project ("mmpz"-extension), files are
compressed if extension given to multimediaProject::writeFile() is
mmpz or (if none given) user enabled compression as default
* data/locale/de.ts:
updated German translation (still incomplete (mainly for
mallets-plugin))

Binary file not shown.

View File

@@ -2181,7 +2181,7 @@ Double clicking any of the plugins will bring up information on the ports.</sour
</message>
<message>
<source>MultiMedia Project (*.mmp *.xml)</source>
<translation>MultiMedia-Projekt (*.mmp *.xml)</translation>
<translation type="obsolete">MultiMedia-Projekt (*.mmp *.xml)</translation>
</message>
<message>
<source>Save project</source>
@@ -2189,7 +2189,7 @@ Double clicking any of the plugins will bring up information on the ports.</sour
</message>
<message>
<source>MultiMedia Project (*.mmp);;MultiMedia Project Template (*.mpt)</source>
<translation>MultiMedia-Projekt (*.mmp);;MultiMedia-Projekt-Vorlage (*.mpt)</translation>
<translation type="obsolete">MultiMedia-Projekt (*.mmp);;MultiMedia-Projekt-Vorlage (*.mpt)</translation>
</message>
<message>
<source>Help not available</source>
@@ -2237,6 +2237,14 @@ Bitte besuchen Sie http://wiki.mindrules.net für Dokumentationen über LMMS.</t
<source>LADSPA Plugins...</source>
<translation>LADSPA-Plugins...</translation>
</message>
<message>
<source>MultiMedia Project (*.mmp *.mmpz *.xml)</source>
<translation>MultiMedia Projekt (*.mmp *.mmpz *.xml)</translation>
</message>
<message>
<source>MultiMedia Project (*.mmp *.mmpz);;MultiMedia Project Template (*.mpt)</source>
<translation>MultiMedia Projekt (*.mmp *.mmpz);;MultiMedia Projekt-Vorlage (*.mpt)</translation>
</message>
</context>
<context>
<name>mallets</name>
@@ -3410,6 +3418,10 @@ Please note that in some cases parallelizing won&apos;t work with small buffer-s
<translation>Wenn Sie einen Computer mit mehr als einem Prozessor besitzen (z.B. Dual-Core-Systeme), sollten Sie einen Parallelisierungs-Level größer 1 wählen. Das bedeutet, dass LMMS versuchen wird, die Sound-Verarbeitung in mehrere Threads aufzuteilen, welche dann vom Betriebsystem auf unterschiedlichen Kernen ausgeführt werden sollten.
Bitte beachten Sie, dass in einigen Fällen Parallelisierung nicht mit kleinen Puffergrößen funktionieren wird. Wenn Probleme auftreten (z.B. viele XRuns), versuchen Sie die Puffergröße zu erhöhen.</translation>
</message>
<message>
<source>Do not compress project files per default</source>
<translation>Projektdateien nicht standardmäßig komprimieren</translation>
</message>
</context>
<context>
<name>setupWidget</name>

View File

@@ -101,6 +101,7 @@ private slots:
void toggleNoWizard( bool _enabled );
void toggleNoMsgAfterSetup( bool _enabled );
void toggleDisplaydBV( bool _enabled );
void toggleNoMMPZ( bool _enabled );
void openWorkingDir( void );
void openVSTDir( void );
@@ -127,6 +128,7 @@ private:
bool m_noWizard;
bool m_noMsgAfterSetup;
bool m_displaydBV;
bool m_noMMPZ;
QLineEdit * m_wdLineEdit;

View File

@@ -132,7 +132,7 @@ mainWindow::mainWindow( engine * _engine ) :
side_bar->appendTab( new fileBrowser(
configManager::inst()->factoryProjectsDir() + "*" +
configManager::inst()->userProjectsDir(),
"*.mmp *.xml *.mid *.flp",
"*.mmp *.mmpz *.xml *.mid *.flp",
tr( "My projects" ),
embed::getIconPixmap( "project_file" ),
splitter, eng() ),
@@ -710,10 +710,10 @@ void mainWindow::openProject( void )
{
#ifdef QT4
QFileDialog ofd( this, tr( "Open project" ), "",
tr( "MultiMedia Project (*.mmp *.xml)" ) );
tr( "MultiMedia Project (*.mmp *.mmpz *.xml)" ) );
#else
QFileDialog ofd( QString::null,
tr( "MultiMedia Project (*.mmp *.xml)" ),
tr( "MultiMedia Project (*.mmp *.mmpz *.xml)" ),
this, "", TRUE );
ofd.setWindowTitle( tr( "Open project" ) );
#endif
@@ -751,11 +751,11 @@ bool mainWindow::saveProjectAs( void )
{
#ifdef QT4
QFileDialog sfd( this, tr( "Save project" ), "",
tr( "MultiMedia Project (*.mmp);;"
tr( "MultiMedia Project (*.mmp *.mmpz);;"
"MultiMedia Project Template (*.mpt)" ) );
#else
QFileDialog sfd( QString::null,
tr( "MultiMedia Project (*.mmp);;"
tr( "MultiMedia Project (*.mmp *.mmpz);;"
"MultiMedia Project Template (*.mpt)" ),
this, "", TRUE );
sfd.setWindowTitle( tr( "Save project" ) );

View File

@@ -113,6 +113,8 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) :
"nomsgaftersetup" ).toInt() ),
m_displaydBV( configManager::inst()->value( "app",
"displaydbv" ).toInt() ),
m_noMMPZ( configManager::inst()->value( "app",
"nommpz" ).toInt() ),
m_workingDir( configManager::inst()->workingDir() ),
m_vstDir( configManager::inst()->vstDir() ),
m_artworkDir( configManager::inst()->artworkDir() ),
@@ -198,7 +200,7 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) :
tabWidget * misc_tw = new tabWidget( tr( "MISC" ), general );
misc_tw->setFixedHeight( 128 );
misc_tw->setFixedHeight( 150 );
ledCheckBox * disable_tooltips = new ledCheckBox(
tr( "Disable tooltips (no spurious "
@@ -257,6 +259,16 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) :
connect( dbv, SIGNAL( toggled( bool ) ),
this, SLOT( toggleDisplaydBV( bool ) ) );
ledCheckBox * no_mmpz = new ledCheckBox(
tr( "Do not compress project files per default" ),
misc_tw, NULL, eng(), NULL );
no_mmpz->move( 10, 126 );
no_mmpz->setChecked( m_noMMPZ );
connect( no_mmpz, SIGNAL( toggled( bool ) ),
this, SLOT( toggleNoMMPZ( bool ) ) );
gen_layout->addWidget( bufsize_tw );
gen_layout->addSpacing( 10 );
gen_layout->addWidget( misc_tw );
@@ -741,6 +753,8 @@ void setupDialog::accept( void )
QString::number( m_noMsgAfterSetup ) );
configManager::inst()->setValue( "app", "displaydbv",
QString::number( m_displaydBV ) );
configManager::inst()->setValue( "app", "nommpz",
QString::number( m_noMMPZ ) );
configManager::inst()->setValue( "ui",
"disablechannelactivityindicators",
QString::number( m_disableChActInd ) );
@@ -888,6 +902,14 @@ void setupDialog::toggleDisplaydBV( bool _enabled )
void setupDialog::toggleNoMMPZ( bool _enabled )
{
m_noMMPZ = _enabled;
}
void setupDialog::toggleDisableChActInd( bool _disabled )
{
m_disableChActInd = _disabled;

View File

@@ -41,12 +41,12 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#endif
#include "mmp.h"
#include "song_editor.h"
#include "config_mgr.h"
multimediaProject::typeDescStruct
@@ -126,7 +126,18 @@ multimediaProject::multimediaProject( const QString & _in_file_name,
int col;
if( _is_filename == TRUE )
{
if( !setContent( &in_file, &error_msg, &line, &col ) )
bool error = FALSE;
if( _in_file_name.section( '.', -1 ) == "mmpz" )
{
QString data = qUncompress( in_file.readAll() );
error = !setContent( data, &error_msg, &line, &col );
}
else
{
error = !setContent( &in_file, &error_msg, &line,
&col );
}
if( error )
{
QMessageBox::critical( NULL, songEditor::tr( "Error in "
"multimedia-project" ),
@@ -188,6 +199,7 @@ bool multimediaProject::writeFile( const QString & _fn, bool _overwrite_check )
{
bool clean_meta_nodes = FALSE;
QString fn = _fn;
bool compress = FALSE;
if( type() == INSTRUMENT_TRACK_SETTINGS )
{
if( fn.section( '.', -2, -1 ) != "cs.xml" )
@@ -199,9 +211,23 @@ bool multimediaProject::writeFile( const QString & _fn, bool _overwrite_check )
else if( type() == SONG_PROJECT )
{
if( fn.section( '.', -1 ) != "mmp" &&
fn.section( '.', -1 ) != "mpt" )
fn.section( '.', -1 ) != "mpt" &&
fn.section( '.', -1 ) != "mmpz" )
{
fn += ".mmp";
compress = configManager::inst()->value( "app",
"nommpz" ).toInt() == 0;
if( compress )
{
fn += ".mmpz";
}
else
{
fn += ".mmp";
}
}
else
{
compress = ( fn.section( '.', -1 ) == "mmpz" );
}
clean_meta_nodes = TRUE;
}
@@ -263,15 +289,27 @@ bool multimediaProject::writeFile( const QString & _fn, bool _overwrite_check )
}
QString xml = "<?xml version=\"1.0\"?>\n" + toString(
#if QT_VERSION >= 0x030100
0
1
#endif
);
#ifdef QT4
outfile.write( xml.toUtf8().constData(), xml.length() );
if( compress )
{
#ifndef QT3
outfile.write( qCompress( xml.toAscii() ) );
#else
QCString xml_utf8 = xml.utf8();
outfile.writeBlock( xml_utf8.data(), xml_utf8.length() );
outfile.writeBlock( qCompress(
(const uchar *) xml.ascii(), xml.length() ) );
#endif
}
else
{
#ifdef QT4
outfile.write( xml.toUtf8().constData(), xml.length() );
#else
QCString xml_utf8 = xml.utf8();
outfile.writeBlock( xml_utf8.data(), xml_utf8.length() );
#endif
}
outfile.close();
return( TRUE );