Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only filter out <>:"/\|?* while exporting tracks. #5282

Merged
merged 1 commit into from
Dec 23, 2019
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions include/Track.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ const int DEFAULT_TRACK_HEIGHT = 32;

const int TCO_BORDER_WIDTH = 2;

char const *const FILENAME_FILTER = "[\\0000-\x1f\"*/:<>?\\\\|\x7f]";


class TrackContentObject : public Model, public JournallingObject
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/RenderManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ QString RenderManager::pathForTrack(const Track *track, int num)
{
QString extension = ProjectRenderer::getFileExtensionFromFormat( m_format );
QString name = track->name();
name = name.remove(QRegExp("[^a-zA-Z]"));
name = name.remove(QRegExp(FILENAME_FILTER));
name = QString( "%1_%2%3" ).arg( num ).arg( name ).arg( extension );
return QDir(m_outputPath).filePath(name);
}
Expand Down
2 changes: 1 addition & 1 deletion src/tracks/InstrumentTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1615,7 +1615,7 @@ void InstrumentTrackWindow::saveSettingsBtnClicked()
sfd.setDirectory( presetRoot + m_track->instrumentName() );
sfd.setFileMode( FileDialog::AnyFile );
QString fname = m_track->name();
sfd.selectFile( fname.remove(QRegExp("[^a-zA-Z0-9_\\-\\d\\s]")) );
sfd.selectFile(fname.remove(QRegExp(FILENAME_FILTER)));
sfd.setDefaultSuffix( "xpf");

if( sfd.exec() == QDialog::Accepted &&
Expand Down