Feature: Pattern import/export (#5891)

* Init

* Suggested changes by @IanCaio, thanks!

* Selecting one file to import is enough.

* Explicit use of TimePos in favour of int where expected, as suggested.

* Make pattern import/export future proof with using DataFile instead of custom code to read/write the pattern file.

* Remove unused/duplicate imports

* Make import/export dialogs file-ext filter consistent.

Co-authored-by: CYBERDEViL <cyberdevil@notabug.org>
This commit is contained in:
cyber-bridge
2021-03-21 15:40:12 +01:00
committed by GitHub
parent 5ad034ade3
commit 4a99904ff6
4 changed files with 122 additions and 2 deletions

View File

@@ -83,7 +83,8 @@ DataFile::typeDescStruct
{ DataFile::DragNDropData, "dnddata" },
{ DataFile::ClipboardData, "clipboard-data" },
{ DataFile::JournalData, "journaldata" },
{ DataFile::EffectSettings, "effectsettings" }
{ DataFile::EffectSettings, "effectsettings" },
{ DataFile::NotePattern, "pattern" }
} ;
@@ -185,6 +186,12 @@ bool DataFile::validate( QString extension )
return true;
}
break;
case Type::NotePattern:
if (extension == "xpt" || extension == "xptz")
{
return true;
}
break;
case Type::UnknownType:
if (! ( extension == "mmp" || extension == "mpt" || extension == "mmpz" ||
extension == "xpf" || extension == "xml" ||
@@ -286,7 +293,8 @@ bool DataFile::writeFile( const QString& filename )
return false;
}
if( fullName.section( '.', -1 ) == "mmpz" )
const QString extension = fullName.section('.', -1);
if (extension == "mmpz" || extension == "xptz")
{
QString xml;
QTextStream ts( &xml );