Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/samplerbank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,24 @@ void SamplerBank::slotSaveSamplerBank(double v) {
if (v == 0.0 || m_pPlayerManager == NULL) {
return;
}

QString filefilter = tr("Mixxx Sampler Banks (*.xml)");
QString samplerBankPath = QFileDialog::getSaveFileName(
NULL, tr("Save Sampler Bank"),
QString(),
tr("Mixxx Sampler Banks (*.xml)"));
if (samplerBankPath.isEmpty()) {
tr("Mixxx Sampler Banks (*.xml)"),
&filefilter);
if (samplerBankPath.isNull() || samplerBankPath.isEmpty()) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is enough to check for isEmpty with a string.

return;
}
// Manually add extension due to bug in QFileDialog
// via https://bugreports.qt-project.org/browse/QTBUG-27186
// Can be removed after switch to Qt5
QFileInfo fileName(samplerBankPath);
if (fileName.suffix().isEmpty()) {
QString ext = filefilter.section(".",1,1);
ext.chop(1);
samplerBankPath.append(".").append(ext);
}

// The user has picked a new directory via a file dialog. This means the
// system sandboxer (if we are sandboxed) has granted us permission to this
Expand Down