From 642aa971984755d5c5bc1982c959e7f94f2a43a5 Mon Sep 17 00:00:00 2001 From: Paul Giblock Date: Mon, 15 Dec 2008 22:55:06 +0000 Subject: [PATCH 1/7] Attempt to fix caching bug in track backgrounds git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1933 0778d3d1-df1d-0410-868b-ea421aaaa00d Conflicts: ChangeLog.old src/core/track.cpp --- ChangeLog.old | 6 ++++ src/core/track.cpp | 70 ++++++++++++++++++++++++---------------------- 2 files changed, 42 insertions(+), 34 deletions(-) diff --git a/ChangeLog.old b/ChangeLog.old index dc103749c..9e33959c4 100644 --- a/ChangeLog.old +++ b/ChangeLog.old @@ -247,6 +247,12 @@ * src/tracks/pattern.cpp: backport: added support for panning editing of notes +2008-12-15 Paul Giblock + + * src/core/track.cpp: + * include/track.h: + Cache background per-object instead of per-class. + 2008-12-14 Tobias Doerffel * CMakeLists.txt: diff --git a/src/core/track.cpp b/src/core/track.cpp index 8f47dee16..82694aaf5 100644 --- a/src/core/track.cpp +++ b/src/core/track.cpp @@ -895,46 +895,46 @@ void trackContentWidget::updateBackground() // Assume even-pixels-per-tact. Makes sense, should be like this anyways int ppt = static_cast( tcv->pixelsPerTact() ); - int w = ppt * tactsPerBar; - int h = height(); - m_background = QPixmap( w * 2, height() ); - QPainter pmp( &m_background ); + int w = ppt * tactsPerBar; + int h = height(); + m_background = QPixmap( w * 2, height() ); + QPainter pmp( &m_background ); - QLinearGradient grad( 0, 1, 0, h-2 ); - pmp.fillRect( 0, 0, 1, h, QColor( 96, 96, 96 ) ); - pmp.fillRect( 1, 0, w+1, h, QColor( 128, 128, 128 ) ); - grad.setColorAt( 0.0, QColor( 64, 64, 64 ) ); - grad.setColorAt( 0.3, QColor( 128, 128, 128 ) ); - grad.setColorAt( 0.5, QColor( 128, 128, 128 ) ); - grad.setColorAt( 0.95, QColor( 160, 160, 160 ) ); - pmp.fillRect( 0, 1, w, h-2, grad ); + QLinearGradient grad( 0, 1, 0, h-2 ); + pmp.fillRect( 0, 0, 1, h, QColor( 96, 96, 96 ) ); + pmp.fillRect( 1, 0, w+1, h, QColor( 128, 128, 128 ) ); + grad.setColorAt( 0.0, QColor( 64, 64, 64 ) ); + grad.setColorAt( 0.3, QColor( 128, 128, 128 ) ); + grad.setColorAt( 0.5, QColor( 128, 128, 128 ) ); + grad.setColorAt( 0.95, QColor( 160, 160, 160 ) ); + pmp.fillRect( 0, 1, w, h-2, grad ); - QLinearGradient grad2( 0,1, 0, h-2 ); - pmp.fillRect( w+1, 0, w , h, QColor( 96, 96, 96 ) ); - grad2.setColorAt( 0.0, QColor( 48, 48, 48 ) ); - grad2.setColorAt( 0.3, QColor( 96, 96, 96 ) ); - grad2.setColorAt( 0.5, QColor( 96, 96, 96 ) ); - grad2.setColorAt( 0.95, QColor( 120, 120, 120 ) ); - pmp.fillRect( w, 1, w , h-2, grad2 ); + QLinearGradient grad2( 0,1, 0, h-2 ); + pmp.fillRect( w+1, 0, w , h, QColor( 96, 96, 96 ) ); + grad2.setColorAt( 0.0, QColor( 48, 48, 48 ) ); + grad2.setColorAt( 0.3, QColor( 96, 96, 96 ) ); + grad2.setColorAt( 0.5, QColor( 96, 96, 96 ) ); + grad2.setColorAt( 0.95, QColor( 120, 120, 120 ) ); + pmp.fillRect( w, 1, w , h-2, grad2 ); - // draw vertical lines - pmp.setPen( QPen( QColor( 0, 0, 0, 112 ), 1 ) ); - for( float x = 0.5; x < w * 2; x += ppt ) - { - pmp.drawLine( QLineF( x, 1.0, x, h-2.0 ) ); - } - pmp.drawLine( 0, 1, w*2, 1 ); + // draw vertical lines + pmp.setPen( QPen( QColor( 0, 0, 0, 112 ), 1 ) ); + for( float x = 0.5; x < w * 2; x += ppt ) + { + pmp.drawLine( QLineF( x, 1.0, x, h-2.0 ) ); + } + pmp.drawLine( 0, 1, w*2, 1 ); - pmp.setPen( QPen( QColor( 255, 255, 255, 32 ), 1 ) ); - for( float x = 1.5; x < w * 2; x += ppt ) - { - pmp.drawLine( QLineF( x, 1.0, x, h-2.0 ) ); - } - pmp.drawLine( 0, h-2, w*2, h-2 ); + pmp.setPen( QPen( QColor( 255, 255, 255, 32 ), 1 ) ); + for( float x = 1.5; x < w * 2; x += ppt ) + { + pmp.drawLine( QLineF( x, 1.0, x, h-2.0 ) ); + } + pmp.drawLine( 0, h-2, w*2, h-2 ); - pmp.end(); + pmp.end(); - // Force redraw + // Force redraw update(); } @@ -1206,7 +1206,9 @@ void trackContentWidget::paintEvent( QPaintEvent * _pe ) */ void trackContentWidget::resizeEvent( QResizeEvent * resizeEvent ) { + // Update backgroud updateBackground(); + // Force redraw QWidget::resizeEvent( resizeEvent ); } From 487335a4ecc9bdcc73411439addc1588b93a500e Mon Sep 17 00:00:00 2001 From: Paul Giblock Date: Sat, 3 Jan 2009 20:34:18 +0000 Subject: [PATCH 2/7] Fix drag-drop for buttonGroups Previously a boolean model would be dragged when Ctrl-Dragging on a button belonging to a button group. This fix causes the integer-model of the group to be dragged instead. The original behavior would allow the user to toggle multiple values simultaneously by using several automation tracks. Plus, I would think this new behavior is more convenient. git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1968 0778d3d1-df1d-0410-868b-ea421aaaa00d Conflicts: ChangeLog.old src/gui/widgets/automatable_button.cpp --- ChangeLog.old | 5 +++++ src/gui/widgets/automatable_button.cpp | 22 +++++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/ChangeLog.old b/ChangeLog.old index 9e33959c4..f9ed32886 100644 --- a/ChangeLog.old +++ b/ChangeLog.old @@ -158,6 +158,11 @@ * plugins/flp_import/unrtf/convert.c: Avoid compile warnings +2009-01-03 Paul Giblock + + * src/gui/widgets/automatable_button.cpp: + fix drag support for button groups + 2008-12-22 Tobias Doerffel * CMakeLists.txt: diff --git a/src/gui/widgets/automatable_button.cpp b/src/gui/widgets/automatable_button.cpp index 776c0fc4f..d0687a0a6 100644 --- a/src/gui/widgets/automatable_button.cpp +++ b/src/gui/widgets/automatable_button.cpp @@ -32,7 +32,7 @@ #include "engine.h" #include "embed.h" #include "MainWindow.h" - +#include "string_pair_drag.h" @@ -115,6 +115,7 @@ void automatableButton::mousePressEvent( QMouseEvent * _me ) if( _me->button() == Qt::LeftButton && ! ( _me->modifiers() & Qt::ControlModifier ) ) { + // User simply clicked, toggle if needed if( isCheckable() ) { toggle(); @@ -123,8 +124,23 @@ void automatableButton::mousePressEvent( QMouseEvent * _me ) } else { - AutomatableModelView::mousePressEvent( _me ); - QPushButton::mousePressEvent( _me ); + // Ctrl-clicked, need to prepare drag-drop + if( m_group ) + { + // A group, we must get process it instead + AutomatableModelView* groupView = (AutomatableModelView*)m_group; + new stringPairDrag( "automatable_model", + QString::number( groupView->modelUntyped()->id() ), + QPixmap(), widget() ); + // TODO: ^^ Maybe use a predefined icon instead of the button they happened to select + _me->accept(); + } + else + { + // Otherwise, drag the standalone button + AutomatableModelView::mousePressEvent( _me ); + QPushButton::mousePressEvent( _me ); + } } } From 750b01500b984ba501ac08e4e86fd757cdddd830 Mon Sep 17 00:00:00 2001 From: Paul Giblock Date: Tue, 18 Dec 2012 21:57:40 -0500 Subject: [PATCH 3/7] Add .gitignore and .gitattributes --- .gitattributes | 2 ++ .gitignore | 3 ++ plugins/zynaddsubfx/fltk/fltk-config | 42 ++++++++++++++-------------- 3 files changed, 26 insertions(+), 21 deletions(-) create mode 100644 .gitattributes create mode 100644 .gitignore diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..596615322 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +.gitattributes export-ignore +.gitignore export-ignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..d8669fa1d --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/build +.*.sw? +*~ diff --git a/plugins/zynaddsubfx/fltk/fltk-config b/plugins/zynaddsubfx/fltk/fltk-config index 10330bf6f..97ed9a514 100755 --- a/plugins/zynaddsubfx/fltk/fltk-config +++ b/plugins/zynaddsubfx/fltk/fltk-config @@ -1,7 +1,7 @@ #!/bin/sh # # "$Id: fltk-config.in 6614 2009-01-01 16:11:32Z matt $" -# +# # FLTK configuration utility. # # Copyright 2000-2009 by Bill Spitzak and others. @@ -31,31 +31,31 @@ MAJOR_VERSION=1 MINOR_VERSION=3 PATCH_VERSION=0 -VERSION="$MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION" -APIVERSION="$MAJOR_VERSION.$MINOR_VERSION" +VERSION=1.3.0 +APIVERSION=1.3 ### BEGIN fltk-config selfdir=`dirname "$0"` -prefix=/usr -exec_prefix=${prefix} +prefix=/usr/local +exec_prefix= exec_prefix_set=no -bindir=${exec_prefix}/bin -includedir=${prefix}/include -libdir=${exec_prefix}/lib +bindir=/usr/local/bin +includedir= +libdir=/usr/local/lib srcdir=. # compiler names CC="gcc" -CXX="g++" +CXX="c++" # flags for C++ compiler: ARCHFLAGS="" -CFLAGS=" -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D_REENTRANT" -CXXFLAGS="-I/usr/include/freetype2 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D_REENTRANT" -LDFLAGS=" " -LDLIBS="-lXext -lXft -lfontconfig -lXinerama -lpthread -ldl -lm -lX11 " -OPTIM=" -Os -Wall -Wunused -Wno-format-y2k -fno-exceptions -fno-strict-aliasing" +CFLAGS="-DUSE_X11 -D_THREAD_SAFE -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE" +CXXFLAGS="-DUSE_X11 -D_THREAD_SAFE -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE" +LDFLAGS="" +LDLIBS="-lX11 -lpthread -lXinerama -lXft -lXext" +OPTIM="" CAIROFLAGS="" # Check for local invocation, and update paths accordingly... @@ -91,11 +91,11 @@ if test -f "$libdir/libfltk_cairo.a"; then fi # libraries to link with: -LIBNAME="../lib/libfltk.a" +LIBNAME="" DSONAME="" DSOLINK="" -IMAGELIBS="-lpng -lz -ljpeg " -STATICIMAGELIBS="-lpng -lz -ljpeg " +IMAGELIBS="" +STATICIMAGELIBS="" CAIROLIBS="" SHAREDSUFFIX="" @@ -143,10 +143,10 @@ post= debug= # Parse command line options -while test $# -gt 0 +while test $# -gt 0 do case "$1" in - -*=*) + -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) @@ -239,8 +239,8 @@ if test x$use_forms = xyes; then LDSTATIC="$libdir/libfltk_forms.a $LDSTATIC" fi if test x$use_gl = xyes; then - LDLIBS="-lfltk_gl$SHAREDSUFFIX -lGLU -lGL $LDLIBS" - LDSTATIC="$libdir/libfltk_gl.a -lGLU -lGL $LDSTATIC" + LDLIBS="-lfltk_gl$SHAREDSUFFIX $LDLIBS" + LDSTATIC="$libdir/libfltk_gl.a $LDSTATIC" fi if test x$use_images = xyes; then LDLIBS="-lfltk_images$SHAREDSUFFIX $IMAGELIBS $LDLIBS" From e5b3975b12420ec7f403dfcceeca3351e00b8e55 Mon Sep 17 00:00:00 2001 From: Paul Giblock Date: Fri, 23 Mar 2012 13:21:26 -0400 Subject: [PATCH 4/7] Initialize line-drawer in AutomationEditor Possible endless loop if these two state variables are not intialized. Now a line will have the origin of (0,0) if drawn (shift-click) without previously clicking on a starting spot. Perhaps not the best fix, but it works. And I think allowing this first line (instead of blocking it) is better for the enabling the user to accidently discover the feature. Conflicts: src/gui/AutomationEditor.cpp --- src/gui/AutomationEditor.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/AutomationEditor.cpp b/src/gui/AutomationEditor.cpp index d87b7bf09..7e249bf1b 100644 --- a/src/gui/AutomationEditor.cpp +++ b/src/gui/AutomationEditor.cpp @@ -3,6 +3,7 @@ * actual setting of dynamic values * * Copyright (c) 2008-2013 Tobias Doerffel + * Copyright (c) 2008-2013 Paul Giblock * Copyright (c) 2006-2008 Javier Serrano Polo * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net @@ -89,6 +90,8 @@ AutomationEditor::AutomationEditor() : m_action( NONE ), m_moveStartLevel( 0 ), m_moveStartTick( 0 ), + m_drawLastLevel( 0.0f ), + m_drawLastTick( 0 ), m_ppt( DEFAULT_PPT ), m_y_delta( DEFAULT_Y_DELTA ), m_y_auto( TRUE ), From b2dc6375b982a08c3855d83c796820b632fc1ef5 Mon Sep 17 00:00:00 2001 From: Paul Giblock Date: Wed, 27 Feb 2013 13:41:08 -0500 Subject: [PATCH 5/7] Update copyright date to 2013 in usage Conflicts: src/core/main.cpp --- src/core/main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/main.cpp b/src/core/main.cpp index 090f032ef..64d0f7324 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -1,8 +1,8 @@ /* * main.cpp - just main.cpp which is starting up app... * - * Copyright (c) 2004-2011 Tobias Doerffel - * + * Copyright (c) 2004-2013 Tobias Doerffel + * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * * This program is free software; you can redistribute it and/or @@ -130,7 +130,7 @@ int main( int argc, char * * argv ) QString( argv[i] ) == "-v" ) { printf( "\nLinux MultiMedia Studio %s\n\n" - "Copyright (c) 2004-2008 LMMS developers.\n\n" + "Copyright (c) 2004-2013 LMMS developers.\n\n" "This program is free software; you can redistribute it and/or\n" "modify it under the terms of the GNU General Public\n" "License as published by the Free Software Foundation; either\n" @@ -143,7 +143,7 @@ int main( int argc, char * * argv ) QString( argv[i] ) == "-h" ) ) { printf( "\nLinux MultiMedia Studio %s\n" - "Copyright (c) 2004-2008 LMMS developers.\n\n" + "Copyright (c) 2004-2013 LMMS developers.\n\n" "usage: lmms [ -r ] [ options ]\n" " [ -u ]\n" " [ -d ]\n" From 8bbbdacfcba8da3ef8c527d2bbfb1be412b3f5ca Mon Sep 17 00:00:00 2001 From: Paul Giblock Date: Mon, 28 May 2012 00:57:18 -0400 Subject: [PATCH 6/7] Add support for upgrading presets This is in addition to songs. Simply use multimediaProject. Don't screw around with Song(). Also, needed to move creation of xml preamble (processing instruction) due to duplicate entry when doing a load/save. Conflicts: src/core/main.cpp --- src/core/main.cpp | 53 ++++++++++++++++++++++------------------------- src/core/mmp.cpp | 4 +++- 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/src/core/main.cpp b/src/core/main.cpp index 64d0f7324..c94898b15 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -2,6 +2,7 @@ * main.cpp - just main.cpp which is starting up app... * * Copyright (c) 2004-2013 Tobias Doerffel + * Copyright (c) 2012-2013 Paul Giblock

* * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -61,6 +62,7 @@ #include "ImportFilter.h" #include "MainWindow.h" #include "ProjectRenderer.h" +#include "mmp.h" #include "song.h" #warning TODO: move somewhere else @@ -176,9 +178,12 @@ int main( int argc, char * * argv ) else if( argc > i+1 && ( QString( argv[i] ) == "--upgrade" || QString( argv[i] ) == "-u" ) ) { - file_to_load = argv[i + 1]; - file_to_save = argv[i + 2]; - i += 2; + multimediaProject mmp( QString( argv[i + 1] ) ); + if (argc > i+1) + { + mmp.writeFile(argv[i + 2]); + } + return( EXIT_SUCCESS ); } else if( argc > i && ( QString( argv[i] ) == "--dump" || QString( argv[i] ) == "-d" ) ) @@ -187,7 +192,7 @@ int main( int argc, char * * argv ) f.open( QIODevice::ReadOnly ); QString d = qUncompress( f.readAll() ); printf( "%s\n", d.toUtf8().constData() ); - return( 0 ); + return( EXIT_SUCCESS ); } else if( argc > i && ( QString( argv[i] ) == "--render" || QString( argv[i] ) == "-r" ) ) @@ -371,7 +376,7 @@ int main( int argc, char * * argv ) configManager::inst()->loadConfigFile(); - if( render_out.isEmpty() && file_to_save.isEmpty() ) + if( render_out.isEmpty() ) { // init style and palette QApplication::setStyle( new lmmsStyle() ); @@ -479,31 +484,23 @@ int main( int argc, char * * argv ) engine::getSong()->loadProject( file_to_load ); printf( "done\n" ); - if( !render_out.isEmpty() ) - { - // create renderer - ProjectRenderer * r = new ProjectRenderer( qs, os, eff, - render_out + - QString( ( eff == - ProjectRenderer::WaveFile ) ? - "wav" : "ogg" ) ); - QCoreApplication::instance()->connect( r, - SIGNAL( finished() ), SLOT( quit() ) ); + // create renderer + ProjectRenderer * r = new ProjectRenderer( qs, os, eff, + render_out + + QString( ( eff == + ProjectRenderer::WaveFile ) ? + "wav" : "ogg" ) ); + QCoreApplication::instance()->connect( r, + SIGNAL( finished() ), SLOT( quit() ) ); - // timer for progress-updates - QTimer * t = new QTimer( r ); - r->connect( t, SIGNAL( timeout() ), - SLOT( updateConsoleProgress() ) ); - t->start( 200 ); + // timer for progress-updates + QTimer * t = new QTimer( r ); + r->connect( t, SIGNAL( timeout() ), + SLOT( updateConsoleProgress() ) ); + t->start( 200 ); - // start now! - r->startProcessing(); - } - else - { - engine::getSong()->saveProjectFile( file_to_save ); - return( 0 ); - } + // start now! + r->startProcessing(); } const int ret = app->exec(); diff --git a/src/core/mmp.cpp b/src/core/mmp.cpp index 8200aeb50..cd71651f7 100644 --- a/src/core/mmp.cpp +++ b/src/core/mmp.cpp @@ -2,6 +2,7 @@ * mmp.cpp - implementation of class multimediaProject * * Copyright (c) 2004-2009 Tobias Doerffel + * Copyright (c) 2012-2013 Paul Giblock

* * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -66,6 +67,7 @@ multimediaProject::multimediaProject( ProjectTypes _project_type ) : m_head(), m_type( _project_type ) { + appendChild( createProcessingInstruction("xml", "version=\"1.0\"")); QDomElement root = createElement( "multimedia-project" ); root.setAttribute( "version", MMP_VERSION_STRING ); root.setAttribute( "type", typeName( _project_type ) ); @@ -189,7 +191,7 @@ bool multimediaProject::writeFile( const QString & _fn ) ).arg( fn ) ); return false; } - QString xml = "\n" + toString( 2 ); + QString xml = toString( 2 ); if( fn.section( '.', -1 ) == "mmpz" ) { outfile.write( qCompress( xml.toUtf8() ) ); From 867b13691d5e550db03b3268d67c7acf27688372 Mon Sep 17 00:00:00 2001 From: Paul Giblock Date: Mon, 28 May 2012 02:37:29 -0400 Subject: [PATCH 7/7] Add support for upgrading to standard output Useful for me to initially import LMMS presets for use in lmms-lv2. --- include/mmp.h | 3 +++ src/core/main.cpp | 13 ++++++++++--- src/core/mmp.cpp | 17 ++++++++++++++--- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/include/mmp.h b/include/mmp.h index 55f289427..403f90f5e 100644 --- a/include/mmp.h +++ b/include/mmp.h @@ -2,6 +2,7 @@ * mmp.h - class for reading and writing multimedia-project-files * * Copyright (c) 2004-2009 Tobias Doerffel + * Copyright (c) 2012-2013 Paul Giblock

* * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -27,6 +28,7 @@ #define _MMP_H #include +#include #include "export.h" #include "lmms_basics.h" @@ -59,6 +61,7 @@ public: QString nameWithExtension( const QString & _fn ) const; + void write( QTextStream & _strm ); bool writeFile( const QString & _fn ); inline QDomElement & content() diff --git a/src/core/main.cpp b/src/core/main.cpp index c94898b15..55490628d 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -168,7 +168,8 @@ int main( int argc, char * * argv ) "-x, --oversampling specify oversampling\n" " possible values: 1, 2, 4, 8\n" " default: 2\n" - "-u, --upgrade upgrade file and save as \n" + "-u, --upgrade [out] upgrade file and save as \n" + " standard out is used if no output file is specifed\n" "-d, --dump dump XML of compressed file \n" "-v, --version show version information and exit.\n" "-h, --help show this usage information and exit.\n\n", @@ -179,9 +180,15 @@ int main( int argc, char * * argv ) QString( argv[i] ) == "-u" ) ) { multimediaProject mmp( QString( argv[i + 1] ) ); - if (argc > i+1) + if (argc > i+2) { - mmp.writeFile(argv[i + 2]); + mmp.writeFile( argv[i + 2] ); + } + else + { + QTextStream ts( stdout ); + mmp.write( ts ); + fflush( stdout ); } return( EXIT_SUCCESS ); } diff --git a/src/core/mmp.cpp b/src/core/mmp.cpp index cd71651f7..adc438fdf 100644 --- a/src/core/mmp.cpp +++ b/src/core/mmp.cpp @@ -165,7 +165,7 @@ QString multimediaProject::nameWithExtension( const QString & _fn ) const -bool multimediaProject::writeFile( const QString & _fn ) +void multimediaProject::write( QTextStream & _strm ) { if( type() == SongProject || type() == SongProjectTemplate || type() == InstrumentTrackSettings ) @@ -173,7 +173,14 @@ bool multimediaProject::writeFile( const QString & _fn ) cleanMetaNodes( documentElement() ); } + save(_strm, 2); +} + + + +bool multimediaProject::writeFile( const QString & _fn ) +{ QString fn = nameWithExtension( _fn ); QFile outfile( fn ); if( !outfile.open( QIODevice::WriteOnly | QIODevice::Truncate ) ) @@ -191,14 +198,18 @@ bool multimediaProject::writeFile( const QString & _fn ) ).arg( fn ) ); return false; } - QString xml = toString( 2 ); + if( fn.section( '.', -1 ) == "mmpz" ) { + QString xml; + QTextStream ts( &xml ); + write( ts ); outfile.write( qCompress( xml.toUtf8() ) ); } else { - QTextStream( &outfile ) << xml; + QTextStream ts( &outfile ); + write( ts ); } outfile.close();