From 96160c6740b3221d756b1863977006cdc039ae12 Mon Sep 17 00:00:00 2001 From: CYBERDEViL Date: Thu, 21 Jan 2021 16:51:04 +0100 Subject: [PATCH 1/7] Init --- include/PianoRoll.h | 5 + src/gui/editors/PianoRoll.cpp | 174 ++++++++++++++++++++++++++++++++++ 2 files changed, 179 insertions(+) diff --git a/include/PianoRoll.h b/include/PianoRoll.h index 5e0ea0762c9..ff8a03db671 100644 --- a/include/PianoRoll.h +++ b/include/PianoRoll.h @@ -47,6 +47,7 @@ class QPixmap; class QScrollBar; class QString; class QMenu; +class QToolButton; class ComboBox; class NotePlayHandle; @@ -497,15 +498,19 @@ class PianoRollWindow : public Editor, SerializingObject private slots: void updateAfterPatternChange(); void ghostPatternSet( bool state ); + void exportPattern(); + void importPattern(); private: void patternRenamed(); void focusInEvent(QFocusEvent * event) override; void stopStepRecording(); void updateStepRecordingIcon(); + int savePatternXML(QString filepath, bool compress = true); PianoRoll* m_editor; + QToolButton * m_fileToolsButton; ComboBox * m_zoomingComboBox; ComboBox * m_zoomingYComboBox; ComboBox * m_quantizeComboBox; diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index cee6870b7a3..69285b141e3 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -38,6 +39,8 @@ #include #include #include +#include +#include #ifndef __USE_XOPEN #define __USE_XOPEN @@ -66,6 +69,7 @@ #include "StepRecorderWidget.h" #include "TextFloat.h" #include "TimeLineWidget.h" +#include "FileDialog.h" using std::move; @@ -4403,6 +4407,29 @@ PianoRollWindow::PianoRollWindow() : notesActionsToolBar->addSeparator(); notesActionsToolBar->addAction( quantizeAction ); + // -- File actions + DropToolBar *fileActionsToolBar = addDropToolBarToTop( tr( "File actions" ) ); + + // -- File ToolButton + m_fileToolsButton = new QToolButton(m_toolBar); + m_fileToolsButton->setIcon(embed::getIconPixmap("file")); + m_fileToolsButton->setPopupMode(QToolButton::InstantPopup); + + // Import / export + QAction * importAction = new QAction(embed::getIconPixmap("project_import"), + tr("Import pattern"), m_fileToolsButton); + + QAction * exportAction = new QAction(embed::getIconPixmap("project_export"), + tr("Export pattern"), m_fileToolsButton); + + m_fileToolsButton->addAction(importAction); + m_fileToolsButton->addAction(exportAction); + fileActionsToolBar->addWidget(m_fileToolsButton); + + connect(importAction, SIGNAL(triggered()), this, SLOT(importPattern())); + connect(exportAction, SIGNAL(triggered()), this, SLOT(exportPattern())); + // -- End File actions + // Copy + paste actions DropToolBar *copyPasteActionsToolBar = addDropToolBarToTop( tr( "Copy paste controls" ) ); @@ -4614,12 +4641,14 @@ void PianoRollWindow::setCurrentPattern( Pattern* pattern ) if ( pattern ) { setWindowTitle( tr( "Piano-Roll - %1" ).arg( pattern->name() ) ); + m_fileToolsButton->setEnabled(true); connect( pattern->instrumentTrack(), SIGNAL( nameChanged() ), this, SLOT( updateAfterPatternChange()) ); connect( pattern, SIGNAL( dataChanged() ), this, SLOT( updateAfterPatternChange() ) ); } else { setWindowTitle( tr( "Piano-Roll - no pattern" ) ); + m_fileToolsButton->setEnabled(false); } } @@ -4785,10 +4814,12 @@ void PianoRollWindow::patternRenamed() if ( currentPattern() ) { setWindowTitle( tr( "Piano-Roll - %1" ).arg( currentPattern()->name() ) ); + m_fileToolsButton->setEnabled(true); } else { setWindowTitle( tr( "Piano-Roll - no pattern" ) ); + m_fileToolsButton->setEnabled(false); } } @@ -4803,6 +4834,116 @@ void PianoRollWindow::ghostPatternSet( bool state ) +void PianoRollWindow::exportPattern() +{ + QString extFilter("XML Pattern (*.xpt *.xptz)"); + FileDialog exportDialog(this, tr("Export pattern"), "", extFilter); + + exportDialog.setAcceptMode(FileDialog::AcceptSave); + + if (exportDialog.exec() == QDialog::Accepted && + !exportDialog.selectedFiles().isEmpty() && + !exportDialog.selectedFiles().first().isEmpty()) + { + QString suffix = ConfigManager::inst()->value( "app", + "nommpz" ).toInt() == 0 + ? "xptz" + : "xpt" ; + exportDialog.setDefaultSuffix(suffix); + + QString fullPath = exportDialog.selectedFiles()[0]; + QString chosenSuffix = fullPath.section( '.', -1 ); + + bool compress = (chosenSuffix == "xpt") ? false : true; + + if (savePatternXML(fullPath, compress) != 0) + { + TextFloat::displayMessage(tr("Export pattern failed"), + tr("No permission to write to %1").arg(fullPath), + embed::getIconPixmap("error"), 4000); + return; + } + TextFloat::displayMessage(tr("Export pattern success"), + tr("Pattern saved to %1").arg(fullPath), + embed::getIconPixmap("project_export"), 4000); + } +} + + + + +void PianoRollWindow::importPattern() +{ + // Overwrite confirmation. + if (!m_editor->m_pattern->empty() && QMessageBox::warning(NULL, + tr("Import pattern."), + tr("You are about to import a pattern, this will " + "overwrite your current pattern. Do you want to " + "continue?"), + QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) + != QMessageBox::Yes) + { + return; + } + + FileDialog importDialog(this, tr("Open Pattern"), "", + tr("XML pattern file (*.xpt *.xptz)")); + importDialog.setFileMode(FileDialog::ExistingFiles); + + if (importDialog.exec () == QDialog::Accepted && + !importDialog.selectedFiles().isEmpty()) + { + QString fullPath = importDialog.selectedFiles()[0]; + QString suffix = fullPath.section( '.', -1 ); + bool compression = (suffix == "xpt") ? false : true; + + QDomDocument doc("xml"); + QFile f(fullPath); + + if (!f.open(QIODevice::ReadOnly)) + { // Check if we may read the file. + TextFloat::displayMessage(tr("Import pattern failed"), + tr("No permission to read file %1").arg(fullPath), + embed::getIconPixmap("error"), 4000); + f.close(); + return; + } + + bool contentSet = false; + if (compression) + { + contentSet = doc.setContent(qUncompress(f.readAll())); + } + else + { + contentSet = doc.setContent(&f); + } + + // Check if valid xml. + if (!contentSet) + { + TextFloat::displayMessage(tr("Import pattern failed"), + tr("Pattern file corrupt %1").arg(fullPath), + embed::getIconPixmap("error"), 4000); + f.close(); + return; + } + f.close(); + + int pos = m_editor->m_pattern->startPosition(); // Backup position in timeline. + + m_editor->m_pattern->loadSettings(doc.documentElement()); + m_editor->m_pattern->movePosition(pos); + + TextFloat::displayMessage(tr("Import pattern success"), + tr("Imported pattern %1!").arg(fullPath), + embed::getIconPixmap("project_import"), 4000); + } +} + + + + void PianoRollWindow::focusInEvent( QFocusEvent * event ) { // when the window is given focus, also give focus to the actual piano roll @@ -4829,3 +4970,36 @@ void PianoRollWindow::updateStepRecordingIcon() m_toggleStepRecordingAction->setIcon(embed::getIconPixmap("record_step_off")); } } + + + + +int PianoRollWindow::savePatternXML(QString filepath, bool compress) +{ + QDomDocument doc("xml"); + QDomElement rootElement = doc.createElement( "pattern" ); + m_editor->m_pattern->saveSettings( doc, rootElement ); + + doc.appendChild(rootElement); + + // Write file + QFile f(filepath); + if (!f.open(QFile::WriteOnly | QFile::Text)) + { + f.close(); + return 1; + } + + if (compress) + { + f.write(qCompress(doc.toString().toUtf8())); + } + else + { + QTextStream ts(&f); + ts << doc.toString(); + } + f.close(); + + return 0; +} From c6a30d90e7f2adc75b0370f7274f8d3772672d6a Mon Sep 17 00:00:00 2001 From: CYBERDEViL Date: Wed, 27 Jan 2021 20:00:14 +0100 Subject: [PATCH 2/7] Suggested changes by @IanCaio, thanks! --- include/PianoRoll.h | 4 +-- src/gui/editors/PianoRoll.cpp | 56 ++++++++++++++++++----------------- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/include/PianoRoll.h b/include/PianoRoll.h index ff8a03db671..5a103cf883f 100644 --- a/include/PianoRoll.h +++ b/include/PianoRoll.h @@ -506,11 +506,11 @@ private slots: void focusInEvent(QFocusEvent * event) override; void stopStepRecording(); void updateStepRecordingIcon(); - int savePatternXML(QString filepath, bool compress = true); + bool savePatternXML(QString filepath, bool compress = true); PianoRoll* m_editor; - QToolButton * m_fileToolsButton; + QToolButton* m_fileToolsButton; ComboBox * m_zoomingComboBox; ComboBox * m_zoomingYComboBox; ComboBox * m_quantizeComboBox; diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 69285b141e3..0a226bf948e 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -4408,7 +4408,7 @@ PianoRollWindow::PianoRollWindow() : notesActionsToolBar->addAction( quantizeAction ); // -- File actions - DropToolBar *fileActionsToolBar = addDropToolBarToTop( tr( "File actions" ) ); + DropToolBar* fileActionsToolBar = addDropToolBarToTop(tr("File actions")); // -- File ToolButton m_fileToolsButton = new QToolButton(m_toolBar); @@ -4416,11 +4416,11 @@ PianoRollWindow::PianoRollWindow() : m_fileToolsButton->setPopupMode(QToolButton::InstantPopup); // Import / export - QAction * importAction = new QAction(embed::getIconPixmap("project_import"), - tr("Import pattern"), m_fileToolsButton); + QAction* importAction = new QAction(embed::getIconPixmap("project_import"), + tr("Import pattern"), m_fileToolsButton); - QAction * exportAction = new QAction(embed::getIconPixmap("project_export"), - tr("Export pattern"), m_fileToolsButton); + QAction* exportAction = new QAction(embed::getIconPixmap("project_export"), + tr("Export pattern"), m_fileToolsButton); m_fileToolsButton->addAction(importAction); m_fileToolsButton->addAction(exportAction); @@ -4845,10 +4845,10 @@ void PianoRollWindow::exportPattern() !exportDialog.selectedFiles().isEmpty() && !exportDialog.selectedFiles().first().isEmpty()) { - QString suffix = ConfigManager::inst()->value( "app", - "nommpz" ).toInt() == 0 - ? "xptz" - : "xpt" ; + QString suffix = + ConfigManager::inst()->value("app", "nommpz").toInt() == 0 + ? "xptz" + : "xpt"; exportDialog.setDefaultSuffix(suffix); QString fullPath = exportDialog.selectedFiles()[0]; @@ -4856,7 +4856,7 @@ void PianoRollWindow::exportPattern() bool compress = (chosenSuffix == "xpt") ? false : true; - if (savePatternXML(fullPath, compress) != 0) + if (!savePatternXML(fullPath, compress)) { TextFloat::displayMessage(tr("Export pattern failed"), tr("No permission to write to %1").arg(fullPath), @@ -4875,26 +4875,28 @@ void PianoRollWindow::exportPattern() void PianoRollWindow::importPattern() { // Overwrite confirmation. - if (!m_editor->m_pattern->empty() && QMessageBox::warning(NULL, - tr("Import pattern."), - tr("You are about to import a pattern, this will " - "overwrite your current pattern. Do you want to " - "continue?"), - QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) - != QMessageBox::Yes) + if (!m_editor->m_pattern->empty() && + QMessageBox::warning( + NULL, + tr("Import pattern."), + tr("You are about to import a pattern, this will " + "overwrite your current pattern. Do you want to " + "continue?"), + QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes + ) != QMessageBox::Yes) { return; } FileDialog importDialog(this, tr("Open Pattern"), "", - tr("XML pattern file (*.xpt *.xptz)")); + tr("XML pattern file (*.xpt *.xptz)")); importDialog.setFileMode(FileDialog::ExistingFiles); - if (importDialog.exec () == QDialog::Accepted && + if (importDialog.exec() == QDialog::Accepted && !importDialog.selectedFiles().isEmpty()) { QString fullPath = importDialog.selectedFiles()[0]; - QString suffix = fullPath.section( '.', -1 ); + QString suffix = fullPath.section('.', -1); bool compression = (suffix == "xpt") ? false : true; QDomDocument doc("xml"); @@ -4936,8 +4938,8 @@ void PianoRollWindow::importPattern() m_editor->m_pattern->movePosition(pos); TextFloat::displayMessage(tr("Import pattern success"), - tr("Imported pattern %1!").arg(fullPath), - embed::getIconPixmap("project_import"), 4000); + tr("Imported pattern %1!").arg(fullPath), + embed::getIconPixmap("project_import"), 4000); } } @@ -4974,11 +4976,11 @@ void PianoRollWindow::updateStepRecordingIcon() -int PianoRollWindow::savePatternXML(QString filepath, bool compress) +bool PianoRollWindow::savePatternXML(QString filepath, bool compress) { QDomDocument doc("xml"); - QDomElement rootElement = doc.createElement( "pattern" ); - m_editor->m_pattern->saveSettings( doc, rootElement ); + QDomElement rootElement = doc.createElement("pattern"); + m_editor->m_pattern->saveSettings(doc, rootElement); doc.appendChild(rootElement); @@ -4987,7 +4989,7 @@ int PianoRollWindow::savePatternXML(QString filepath, bool compress) if (!f.open(QFile::WriteOnly | QFile::Text)) { f.close(); - return 1; + return false; } if (compress) @@ -5001,5 +5003,5 @@ int PianoRollWindow::savePatternXML(QString filepath, bool compress) } f.close(); - return 0; + return true; } From 7d480203a6761fea6aa73e84fef68650f3509289 Mon Sep 17 00:00:00 2001 From: CYBERDEViL Date: Wed, 27 Jan 2021 20:04:17 +0100 Subject: [PATCH 3/7] Selecting one file to import is enough. --- src/gui/editors/PianoRoll.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 0a226bf948e..771660e65ef 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -4890,7 +4890,7 @@ void PianoRollWindow::importPattern() FileDialog importDialog(this, tr("Open Pattern"), "", tr("XML pattern file (*.xpt *.xptz)")); - importDialog.setFileMode(FileDialog::ExistingFiles); + importDialog.setFileMode(FileDialog::ExistingFile); if (importDialog.exec() == QDialog::Accepted && !importDialog.selectedFiles().isEmpty()) From f2de28a5713ab790bdf582bbe33733d22eaf06ca Mon Sep 17 00:00:00 2001 From: CYBERDEViL Date: Wed, 27 Jan 2021 23:18:58 +0100 Subject: [PATCH 4/7] Explicit use of TimePos in favour of int where expected, as suggested. --- src/gui/editors/PianoRoll.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 771660e65ef..646c4e60f88 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -4932,7 +4932,7 @@ void PianoRollWindow::importPattern() } f.close(); - int pos = m_editor->m_pattern->startPosition(); // Backup position in timeline. + TimePos pos = m_editor->m_pattern->startPosition(); // Backup position in timeline. m_editor->m_pattern->loadSettings(doc.documentElement()); m_editor->m_pattern->movePosition(pos); From 756044ae34149676107610f9de8257d2c5641f13 Mon Sep 17 00:00:00 2001 From: CYBERDEViL Date: Thu, 28 Jan 2021 20:59:39 +0100 Subject: [PATCH 5/7] Make pattern import/export future proof with using DataFile instead of custom code to read/write the pattern file. --- include/DataFile.h | 1 + include/PianoRoll.h | 1 - src/core/DataFile.cpp | 12 ++++- src/gui/editors/PianoRoll.cpp | 89 +++++------------------------------ 4 files changed, 22 insertions(+), 81 deletions(-) diff --git a/include/DataFile.h b/include/DataFile.h index 5d6ead5adb3..f7e5e612a9b 100644 --- a/include/DataFile.h +++ b/include/DataFile.h @@ -52,6 +52,7 @@ class LMMS_EXPORT DataFile : public QDomDocument ClipboardData, JournalData, EffectSettings, + NotePattern, TypeCount } ; typedef Types Type; diff --git a/include/PianoRoll.h b/include/PianoRoll.h index 5a103cf883f..0ec57f35ffe 100644 --- a/include/PianoRoll.h +++ b/include/PianoRoll.h @@ -506,7 +506,6 @@ private slots: void focusInEvent(QFocusEvent * event) override; void stopStepRecording(); void updateStepRecordingIcon(); - bool savePatternXML(QString filepath, bool compress = true); PianoRoll* m_editor; diff --git a/src/core/DataFile.cpp b/src/core/DataFile.cpp index 9dc413566d7..ab83cd7934c 100644 --- a/src/core/DataFile.cpp +++ b/src/core/DataFile.cpp @@ -82,7 +82,8 @@ DataFile::typeDescStruct { DataFile::DragNDropData, "dnddata" }, { DataFile::ClipboardData, "clipboard-data" }, { DataFile::JournalData, "journaldata" }, - { DataFile::EffectSettings, "effectsettings" } + { DataFile::EffectSettings, "effectsettings" }, + { DataFile::NotePattern, "pattern" } } ; @@ -184,6 +185,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" || @@ -285,7 +292,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 ); diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 646c4e60f88..df0de65db46 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -4851,21 +4851,16 @@ void PianoRollWindow::exportPattern() : "xpt"; exportDialog.setDefaultSuffix(suffix); - QString fullPath = exportDialog.selectedFiles()[0]; - QString chosenSuffix = fullPath.section( '.', -1 ); + const QString fullPath = exportDialog.selectedFiles()[0]; + DataFile dataFile(DataFile::NotePattern); + m_editor->m_pattern->saveSettings(dataFile, dataFile.content()); - bool compress = (chosenSuffix == "xpt") ? false : true; - - if (!savePatternXML(fullPath, compress)) + if (dataFile.writeFile(fullPath)) { - TextFloat::displayMessage(tr("Export pattern failed"), - tr("No permission to write to %1").arg(fullPath), - embed::getIconPixmap("error"), 4000); - return; + TextFloat::displayMessage(tr("Export pattern success"), + tr("Pattern saved to %1").arg(fullPath), + embed::getIconPixmap("project_export"), 4000); } - TextFloat::displayMessage(tr("Export pattern success"), - tr("Pattern saved to %1").arg(fullPath), - embed::getIconPixmap("project_export"), 4000); } } @@ -4895,46 +4890,17 @@ void PianoRollWindow::importPattern() if (importDialog.exec() == QDialog::Accepted && !importDialog.selectedFiles().isEmpty()) { - QString fullPath = importDialog.selectedFiles()[0]; - QString suffix = fullPath.section('.', -1); - bool compression = (suffix == "xpt") ? false : true; - - QDomDocument doc("xml"); - QFile f(fullPath); - - if (!f.open(QIODevice::ReadOnly)) - { // Check if we may read the file. - TextFloat::displayMessage(tr("Import pattern failed"), - tr("No permission to read file %1").arg(fullPath), - embed::getIconPixmap("error"), 4000); - f.close(); - return; - } + const QString fullPath = importDialog.selectedFiles()[0]; + DataFile dataFile(fullPath); - bool contentSet = false; - if (compression) + if (dataFile.head().isNull()) { - contentSet = doc.setContent(qUncompress(f.readAll())); - } - else - { - contentSet = doc.setContent(&f); - } - - // Check if valid xml. - if (!contentSet) - { - TextFloat::displayMessage(tr("Import pattern failed"), - tr("Pattern file corrupt %1").arg(fullPath), - embed::getIconPixmap("error"), 4000); - f.close(); return; } - f.close(); TimePos pos = m_editor->m_pattern->startPosition(); // Backup position in timeline. - m_editor->m_pattern->loadSettings(doc.documentElement()); + m_editor->m_pattern->loadSettings(dataFile.content()); m_editor->m_pattern->movePosition(pos); TextFloat::displayMessage(tr("Import pattern success"), @@ -4972,36 +4938,3 @@ void PianoRollWindow::updateStepRecordingIcon() m_toggleStepRecordingAction->setIcon(embed::getIconPixmap("record_step_off")); } } - - - - -bool PianoRollWindow::savePatternXML(QString filepath, bool compress) -{ - QDomDocument doc("xml"); - QDomElement rootElement = doc.createElement("pattern"); - m_editor->m_pattern->saveSettings(doc, rootElement); - - doc.appendChild(rootElement); - - // Write file - QFile f(filepath); - if (!f.open(QFile::WriteOnly | QFile::Text)) - { - f.close(); - return false; - } - - if (compress) - { - f.write(qCompress(doc.toString().toUtf8())); - } - else - { - QTextStream ts(&f); - ts << doc.toString(); - } - f.close(); - - return true; -} From 2794d9ecfcaf4bdbb8c8d8ecf2ee20db4963998c Mon Sep 17 00:00:00 2001 From: CYBERDEViL Date: Thu, 28 Jan 2021 21:19:35 +0100 Subject: [PATCH 6/7] Remove unused/duplicate imports --- src/gui/editors/PianoRoll.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index df0de65db46..292020626b8 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -39,8 +39,6 @@ #include #include #include -#include -#include #ifndef __USE_XOPEN #define __USE_XOPEN From 16852a8084f290e1b8bb9ec8191d6cab527a6b6f Mon Sep 17 00:00:00 2001 From: CYBERDEViL Date: Thu, 25 Feb 2021 19:55:44 +0100 Subject: [PATCH 7/7] Make import/export dialogs file-ext filter consistent. --- src/gui/editors/PianoRoll.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 292020626b8..97307f1628e 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -4834,8 +4834,8 @@ void PianoRollWindow::ghostPatternSet( bool state ) void PianoRollWindow::exportPattern() { - QString extFilter("XML Pattern (*.xpt *.xptz)"); - FileDialog exportDialog(this, tr("Export pattern"), "", extFilter); + FileDialog exportDialog(this, tr("Export pattern"), "", + tr("XML pattern file (*.xpt *.xptz)")); exportDialog.setAcceptMode(FileDialog::AcceptSave); @@ -4881,7 +4881,7 @@ void PianoRollWindow::importPattern() return; } - FileDialog importDialog(this, tr("Open Pattern"), "", + FileDialog importDialog(this, tr("Open pattern"), "", tr("XML pattern file (*.xpt *.xptz)")); importDialog.setFileMode(FileDialog::ExistingFile);