Merge pull request #98 from Lukas-W/stable-0.4-iss90

Update file open/save dialogs
This commit is contained in:
Tobias Doerffel
2014-01-24 14:56:23 -08:00
14 changed files with 369 additions and 82 deletions

42
include/FileDialog.h Normal file
View File

@@ -0,0 +1,42 @@
/*
* FileDialog.h - declaration of class FileDialog
*
* Copyright (c) 2014 Lukas W <lukaswhl/at/gmail.com>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef FILEDIALOG_H
#define FILEDIALOG_H
#include <QtGui/QFileDialog>
class FileDialog : public QFileDialog
{
Q_OBJECT
public:
explicit FileDialog( QWidget *parent = 0, const QString &caption = QString(),
const QString &directory = QString(),
const QString &filter = QString() );
void clearSelection();
};
#endif // FILEDIALOG_HPP

View File

@@ -102,6 +102,7 @@ public slots:
void openProject( void );
bool saveProject( void );
bool saveProjectAs( void );
bool saveProjectAsNewVersion( void );
void showSettingsDialog( void );
void aboutLMMS( void );
void help( void );

View File

@@ -0,0 +1,53 @@
/*
* VersionedSaveDialog.h - declaration of class VersionedSaveDialog, a file save
* dialog that provides buttons to increment or decrement a version which is
* appended to the file name. (e.g. "MyProject-01.mmpz")
*
* Copyright (c) 2014 Lukas W <lukaswhl/at/gmail.com>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef VERSIONEDSAVEDIALOG_H
#define VERSIONEDSAVEDIALOG_H
#include "FileDialog.h"
class QLineEdit;
class VersionedSaveDialog : public FileDialog
{
Q_OBJECT
public:
explicit VersionedSaveDialog( QWidget *parent = 0,
const QString &caption = QString(),
const QString &directory = QString(),
const QString &filter = QString() );
// Returns true if file name was changed, returns false if it wasn't
static bool changeFileNameVersion( QString &fileName, bool increment );
public slots:
void incrementVersion();
void decrementVersion();
};
#endif // VERSIONEDSAVEDIALOG_H

View File

@@ -25,7 +25,6 @@
#include "patman.h"
#include <QtGui/QFileDialog>
#include <QtGui/QDragEnterEvent>
#include <QtGui/QPainter>
#include <QtXml/QDomElement>
@@ -39,6 +38,7 @@
#include "song.h"
#include "string_pair_drag.h"
#include "tooltip.h"
#include "FileDialog.h"
#include "embed.cpp"
@@ -508,11 +508,8 @@ PatmanView::~PatmanView()
void PatmanView::openFile( void )
{
QFileDialog ofd( NULL, tr( "Open patch file" ) );
#if QT_VERSION >= 0x040806
ofd.setOption( QFileDialog::DontUseCustomDirectoryIcons );
#endif
ofd.setFileMode( QFileDialog::ExistingFiles );
FileDialog ofd( NULL, tr( "Open patch file" ) );
ofd.setFileMode( FileDialog::ExistingFiles );
QStringList types;
types << tr( "Patch-Files (*.pat)" );

View File

@@ -27,9 +27,9 @@
#include <QtCore/QTextStream>
#include <QtGui/QLayout>
#include <QtGui/QLabel>
#include <QtGui/QFileDialog>
#include <QtXml/QDomDocument>
#include "FileDialog.h"
#include "sf2_player.h"
#include "engine.h"
#include "InstrumentTrack.h"
@@ -1044,11 +1044,8 @@ void sf2InstrumentView::showFileDialog()
{
sf2Instrument * k = castModel<sf2Instrument>();
QFileDialog ofd( NULL, tr( "Open SoundFont file" ) );
#if QT_VERSION >= 0x040806
ofd.setOption( QFileDialog::DontUseCustomDirectoryIcons );
#endif
ofd.setFileMode( QFileDialog::ExistingFiles );
FileDialog ofd( NULL, tr( "Open SoundFont file" ) );
ofd.setFileMode( FileDialog::ExistingFiles );
QStringList types;
types << tr( "SoundFont2 Files (*.sf2)" );

View File

@@ -25,7 +25,6 @@
#include "vestige.h"
#include <QtGui/QDropEvent>
#include <QtGui/QFileDialog>
#include <QtGui/QMessageBox>
#include <QtGui/QPainter>
#include <QtGui/QPushButton>
@@ -43,6 +42,7 @@
#include "string_pair_drag.h"
#include "text_float.h"
#include "tooltip.h"
#include "FileDialog.h"
#include "embed.cpp"
@@ -613,10 +613,7 @@ void VestigeInstrumentView::modelChanged()
void VestigeInstrumentView::openPlugin()
{
QFileDialog ofd( NULL, tr( "Open VST-plugin" ) );
#if QT_VERSION >= 0x040806
ofd.setOption( QFileDialog::DontUseCustomDirectoryIcons );
#endif
FileDialog ofd( NULL, tr( "Open VST-plugin" ) );
QString dir;
if( m_vi->m_pluginDLL != "" )
@@ -629,7 +626,7 @@ void VestigeInstrumentView::openPlugin()
}
// change dir to position of previously opened file
ofd.setDirectory( dir );
ofd.setFileMode( QFileDialog::ExistingFiles );
ofd.setFileMode( FileDialog::ExistingFiles );
// set filters
QStringList types;

View File

@@ -24,7 +24,6 @@
#include "VstPlugin.h"
#include <QtGui/QFileDialog>
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
#include <QtCore/QLocale>
@@ -49,6 +48,7 @@
#include "MainWindow.h"
#include "song.h"
#include "templates.h"
#include "FileDialog.h"
#include <QtGui/QLayout>
@@ -510,12 +510,9 @@ bool VstPlugin::processMessage( const message & _m )
void VstPlugin::openPreset( )
{
QFileDialog ofd( NULL, tr( "Open Preset" ), "",
FileDialog ofd( NULL, tr( "Open Preset" ), "",
tr( "Vst Plugin Preset (*.fxp *.fxb)" ) );
#if QT_VERSION >= 0x040806
ofd.setOption( QFileDialog::DontUseCustomDirectoryIcons );
#endif
ofd.setFileMode( QFileDialog::ExistingFiles );
ofd.setFileMode( FileDialog::ExistingFiles );
if( ofd.exec () == QDialog::Accepted &&
!ofd.selectedFiles().isEmpty() )
{
@@ -571,19 +568,16 @@ void VstPlugin::savePreset( )
QString presName = currentProgramName().isEmpty() ? tr(": default") : currentProgramName();
presName.replace(tr("\""), tr("'")); // QFileDialog unable to handle double quotes properly
QFileDialog sfd( NULL, tr( "Save Preset" ), presName.section(": ", 1, 1) + tr(".fxp"),
FileDialog sfd( NULL, tr( "Save Preset" ), presName.section(": ", 1, 1) + tr(".fxp"),
tr( "Vst Plugin Preset (*.fxp *.fxb)" ) );
#if QT_VERSION >= 0x040806
sfd.setOption( QFileDialog::DontUseCustomDirectoryIcons );
#endif
if( p_name != "" ) // remember last directory
{
sfd.setDirectory( QFileInfo( p_name ).absolutePath() );
}
sfd.setAcceptMode( QFileDialog::AcceptSave );
sfd.setFileMode( QFileDialog::AnyFile );
sfd.setAcceptMode( FileDialog::AcceptSave );
sfd.setFileMode( FileDialog::AnyFile );
if( sfd.exec () == QDialog::Accepted &&
!sfd.selectedFiles().isEmpty() && sfd.selectedFiles()[0] != "" )
{

View File

@@ -30,7 +30,6 @@
#include <QtCore/QBuffer>
#include <QtCore/QFile>
#include <QtCore/QFileInfo>
#include <QtGui/QFileDialog>
#include <QtGui/QMessageBox>
#include <QtGui/QPainter>
@@ -61,6 +60,8 @@
#include "interpolation.h"
#include "templates.h"
#include "FileDialog.h"
SampleBuffer::SampleBuffer( const QString & _audio_file,
bool _is_base64_data ) :
@@ -829,10 +830,7 @@ void SampleBuffer::visualize( QPainter & _p, const QRect & _dr,
QString SampleBuffer::openAudioFile() const
{
QFileDialog ofd( NULL, tr( "Open audio file" ) );
#if QT_VERSION >= 0x040806
ofd.setOption( QFileDialog::DontUseCustomDirectoryIcons );
#endif
FileDialog ofd( NULL, tr( "Open audio file" ) );
QString dir;
if( !m_audioFile.isEmpty() )
@@ -855,7 +853,7 @@ QString SampleBuffer::openAudioFile() const
}
// change dir to position of previously opened file
ofd.setDirectory( dir );
ofd.setFileMode( QFileDialog::ExistingFiles );
ofd.setFileMode( FileDialog::ExistingFiles );
// set filters
QStringList types;

View File

@@ -25,7 +25,6 @@
#include <QtCore/QCoreApplication>
#include <QtCore/QFile>
#include <QtCore/QFileInfo>
#include <QtGui/QFileDialog>
#include <QtGui/QMessageBox>
#include <math.h>
@@ -47,6 +46,7 @@
#include "ImportFilter.h"
#include "InstrumentTrack.h"
#include "MainWindow.h"
#include "FileDialog.h"
#include "MidiClient.h"
#include "mmp.h"
#include "note_play_handle.h"
@@ -1310,7 +1310,7 @@ bool song::guiSaveProjectAs( const QString & _file_name )
void song::importProject()
{
QFileDialog ofd( NULL, tr( "Import file" ),
FileDialog ofd( NULL, tr( "Import file" ),
configManager::inst()->userProjectsDir(),
tr("MIDI sequences") +
" (*.mid *.midi *.rmi);;" +
@@ -1320,11 +1320,8 @@ void song::importProject()
" (*.h2song);;" +
tr("All file types") +
" (*.*)");
#if QT_VERSION >= 0x040806
ofd.setOption( QFileDialog::DontUseCustomDirectoryIcons );
#endif
ofd.setFileMode( QFileDialog::ExistingFiles );
ofd.setFileMode( FileDialog::ExistingFiles );
if( ofd.exec () == QDialog::Accepted && !ofd.selectedFiles().isEmpty() )
{
ImportFilter::import( ofd.selectedFiles()[0], this );
@@ -1377,13 +1374,10 @@ void song::exportProject(bool multiExport)
return;
}
QFileDialog efd( engine::mainWindow() );
#if QT_VERSION >= 0x040806
efd.setOption( QFileDialog::DontUseCustomDirectoryIcons );
#endif
FileDialog efd( engine::mainWindow() );
if (multiExport)
{
efd.setFileMode( QFileDialog::Directory);
efd.setFileMode( FileDialog::Directory);
efd.setWindowTitle( tr( "Select directory for writing exported tracks..." ) );
if( !m_fileName.isEmpty() )
{
@@ -1392,7 +1386,7 @@ void song::exportProject(bool multiExport)
}
else
{
efd.setFileMode( QFileDialog::AnyFile );
efd.setFileMode( FileDialog::AnyFile );
int idx = 0;
QStringList types;
while( __fileEncodeDevices[idx].m_fileFormat !=
@@ -1417,7 +1411,7 @@ void song::exportProject(bool multiExport)
efd.setWindowTitle( tr( "Select file for project-export..." ) );
}
efd.setAcceptMode( QFileDialog::AcceptSave );
efd.setAcceptMode( FileDialog::AcceptSave );
if( efd.exec() == QDialog::Accepted &&

View File

@@ -28,7 +28,6 @@
#include <QtGui/QApplication>
#include <QtGui/QCloseEvent>
#include <QtGui/QDesktopServices>
#include <QtGui/QFileDialog>
#include <QtGui/QMdiArea>
#include <QtGui/QMdiSubWindow>
#include <QtGui/QMenuBar>
@@ -62,6 +61,8 @@
#include "ProjectJournal.h"
#include "AutomationEditor.h"
#include "templates.h"
#include "FileDialog.h"
#include "VersionedSaveDialog.h"
@@ -242,6 +243,10 @@ void MainWindow::finalize( void )
this, SLOT( saveProject() ),
Qt::CTRL + Qt::Key_S );
project_menu->addAction( embed::getIconPixmap( "project_save" ),
tr( "Save as new &version" ),
this, SLOT( saveProjectAsNewVersion() ),
Qt::CTRL + Qt::ALT + Qt::Key_S );
project_menu->addAction( embed::getIconPixmap( "project_saveas" ),
tr( "Save &As..." ),
this, SLOT( saveProjectAs() ),
@@ -681,18 +686,15 @@ void MainWindow::createNewProjectFromTemplate( QAction * _idx )
void MainWindow::openProject( void )
{
if( mayChangeProject() )
{
QFileDialog ofd( this, tr( "Open project" ), "",
FileDialog ofd( this, tr( "Open project" ), "",
tr( "MultiMedia Project (*.mmp *.mmpz *.xml)" ) );
#if QT_VERSION >= 0x040806
ofd.setOption( QFileDialog::DontUseCustomDirectoryIcons );
#endif
ofd.setDirectory( configManager::inst()->userProjectsDir() );
ofd.setFileMode( QFileDialog::ExistingFiles );
ofd.setFileMode( FileDialog::ExistingFiles );
if( ofd.exec () == QDialog::Accepted &&
!ofd.selectedFiles().isEmpty() )
{
@@ -751,14 +753,9 @@ bool MainWindow::saveProject( void )
bool MainWindow::saveProjectAs( void )
{
QFileDialog sfd( this, tr( "Save project" ), "",
VersionedSaveDialog sfd( this, tr( "Save project" ), "",
tr( "MultiMedia Project (*.mmp *.mmpz);;"
"MultiMedia Project Template (*.mpt)" ) );
#if QT_VERSION >= 0x040806
sfd.setOption( QFileDialog::DontUseCustomDirectoryIcons );
#endif
sfd.setAcceptMode( QFileDialog::AcceptSave );
sfd.setFileMode( QFileDialog::AnyFile );
QString f = engine::getSong()->projectFileName();
if( f != "" )
{
@@ -770,7 +767,7 @@ bool MainWindow::saveProjectAs( void )
sfd.setDirectory( configManager::inst()->userProjectsDir() );
}
if( sfd.exec () == QFileDialog::Accepted &&
if( sfd.exec () == FileDialog::Accepted &&
!sfd.selectedFiles().isEmpty() && sfd.selectedFiles()[0] != "" )
{
engine::getSong()->guiSaveProjectAs(
@@ -783,6 +780,24 @@ bool MainWindow::saveProjectAs( void )
bool MainWindow::saveProjectAsNewVersion( void )
{
QString fileName = engine::getSong()->projectFileName();
if( fileName == "" )
{
return saveProjectAs();
}
else
{
VersionedSaveDialog::changeFileNameVersion( fileName, true );
engine::getSong()->guiSaveProjectAs( fileName );
return true;
}
}
void MainWindow::showSettingsDialog( void )
{
setupDialog sd;

View File

@@ -0,0 +1,65 @@
/*
* FileDialog.cpp - implementation of class FileDialog
*
* Copyright (c) 2014 Lukas W <lukaswhl/at/gmail.com>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#include <QtCore/QList>
#include <QtCore/QUrl>
#include <QtGui/QDesktopServices>
#include <QtGui/QListView>
#include "FileDialog.h"
FileDialog::FileDialog( QWidget *parent, const QString &caption,
const QString &directory, const QString &filter ) :
QFileDialog( parent, caption, directory, filter )
{
#if QT_VERSION >= 0x040806
setOption( QFileDialog::DontUseCustomDirectoryIcons );
#endif
// Add additional locations to the sidebar
QList<QUrl> urls = sidebarUrls();
urls << QUrl::fromLocalFile( QDesktopServices::storageLocation( QDesktopServices::DesktopLocation ) );
// Find downloads directory
QDir downloadDir( QDir::homePath() + "/Downloads" );
if ( ! downloadDir.exists() )
downloadDir = QDesktopServices::storageLocation( QDesktopServices::DocumentsLocation ) + "/Downloads";
if ( downloadDir.exists() )
urls << QUrl::fromLocalFile( downloadDir.absolutePath() );
setSidebarUrls(urls);
}
void FileDialog::clearSelection()
{
static QListView *view = findChild<QListView*>();
Q_ASSERT( view );
view->clearSelection();
}
#include "moc_FileDialog.cxx"

View File

@@ -0,0 +1,139 @@
/*
* VersionedSaveDialog.cpp - implementation of class VersionedSaveDialog
*
* Copyright (c) 2014 Lukas W <lukaswhl/at/gmail.com>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#include <QtGui/QLayout>
#include <QtGui/QPushButton>
#include <QtGui/QFontMetrics>
#include <QtGui/QLineEdit>
#include "VersionedSaveDialog.h"
VersionedSaveDialog::VersionedSaveDialog( QWidget *parent,
const QString &caption,
const QString &directory,
const QString &filter ) :
FileDialog(parent, caption, directory, filter)
{
setAcceptMode( QFileDialog::AcceptSave );
setFileMode( QFileDialog::AnyFile );
// Create + and - buttons
QPushButton *plusButton( new QPushButton( "+", this) );
plusButton->setToolTip( tr( "Increment version number" ) );
QPushButton *minusButton( new QPushButton( "-", this ) );
minusButton->setToolTip( tr( "Decrement version number" ) );
plusButton->setFixedWidth( plusButton->fontMetrics().width( "+" ) + 30 );
minusButton->setFixedWidth( minusButton->fontMetrics().width( "+" ) + 30 );
// Add buttons to grid layout. For doing this, remove the lineEdit and
// replace it with a HBox containing lineEdit and the buttons.
QGridLayout *layout = dynamic_cast<QGridLayout*>( this->layout() );
QWidget *lineEdit = findChild<QLineEdit*>();
layout->removeWidget( lineEdit );
QHBoxLayout* hLayout( new QHBoxLayout() );
hLayout->addWidget( lineEdit );
hLayout->addWidget( plusButton );
hLayout->addWidget( minusButton );
layout->addLayout( hLayout, 2, 1 );
// Connect + and - buttons
connect( plusButton, SIGNAL( clicked() ), this, SLOT( incrementVersion() ));
connect( minusButton, SIGNAL( clicked() ), this, SLOT( decrementVersion() ));
}
bool VersionedSaveDialog::changeFileNameVersion(QString &fileName, bool increment )
{
static QRegExp regexp( "-\\d+(\\.\\w+)?$" );
int idx = regexp.indexIn( fileName );
// For file names without extension (no ".mmpz")
int insertIndex = fileName.lastIndexOf( '.' );
if ( insertIndex < idx+1 )
insertIndex = fileName.size();
if ( idx == -1 )
{
// Can't decrement if there is no version number
if ( increment == false )
return false;
else
fileName.insert( insertIndex, "-01" );
}
else
{
// Find current version number
QString number = fileName.mid( idx+1, insertIndex - idx - 1 );
bool ok;
ushort version = number.toUShort( &ok );
Q_ASSERT( ok );
// Can't decrement 0
if ( !increment and version == 0 )
return false;
// Replace version number
version = increment ? version + 1 : version - 1;
QString newnumber = QString( "%1" ).arg( version, 2, 10, QChar( '0' ) );
fileName.replace( idx+1, number.length(), newnumber );
}
return true;
}
void VersionedSaveDialog::incrementVersion()
{
const QStringList& selected = selectedFiles();
if ( selected.size() != 1 )
return;
QString file = selected[0];
changeFileNameVersion( file, true );
clearSelection();
selectFile( file );
}
void VersionedSaveDialog::decrementVersion()
{
const QStringList& selected = selectedFiles();
if ( selected.size() != 1 )
return;
QString file = selected[0];
changeFileNameVersion( file, false );
clearSelection();
selectFile( file );
}
#include "moc_VersionedSaveDialog.cxx"

View File

@@ -23,7 +23,6 @@
*/
#include <QtGui/QComboBox>
#include <QtGui/QFileDialog>
#include <QtGui/QImageReader>
#include <QtGui/QLabel>
#include <QtGui/QLayout>
@@ -46,6 +45,7 @@
#include "tooltip.h"
#include "led_checkbox.h"
#include "lcd_spinbox.h"
#include "FileDialog.h"
// platform-specific audio-interface-classes
@@ -1056,13 +1056,8 @@ void setupDialog::toggleOneInstrumentTrackWindow( bool _enabled )
void setupDialog::openWorkingDir()
{
QString new_dir = QFileDialog::getExistingDirectory( this,
tr( "Choose LMMS working directory" ),
m_workingDir
#if QT_VERSION >= 0x040806
, QFileDialog::DontUseCustomDirectoryIcons
#endif
);
QString new_dir = FileDialog::getExistingDirectory( this,
tr( "Choose LMMS working directory" ), m_workingDir );
if( new_dir != QString::null )
{
m_wdLineEdit->setText( new_dir );
@@ -1082,7 +1077,7 @@ void setupDialog::setWorkingDir( const QString & _wd )
void setupDialog::openVSTDir()
{
QString new_dir = QFileDialog::getExistingDirectory( this,
QString new_dir = FileDialog::getExistingDirectory( this,
tr( "Choose your VST-plugin directory" ),
m_vstDir );
if( new_dir != QString::null )
@@ -1104,7 +1099,7 @@ void setupDialog::setVSTDir( const QString & _vd )
void setupDialog::openArtworkDir()
{
QString new_dir = QFileDialog::getExistingDirectory( this,
QString new_dir = FileDialog::getExistingDirectory( this,
tr( "Choose artwork-theme directory" ),
m_artworkDir );
if( new_dir != QString::null )
@@ -1126,7 +1121,7 @@ void setupDialog::setArtworkDir( const QString & _ad )
void setupDialog::openFLDir()
{
QString new_dir = QFileDialog::getExistingDirectory( this,
QString new_dir = FileDialog::getExistingDirectory( this,
tr( "Choose FL Studio installation directory" ),
m_flDir );
if( new_dir != QString::null )
@@ -1140,7 +1135,7 @@ void setupDialog::openFLDir()
void setupDialog::openLADSPADir()
{
QString new_dir = QFileDialog::getExistingDirectory( this,
QString new_dir = FileDialog::getExistingDirectory( this,
tr( "Choose LADSPA plugin directory" ),
m_ladDir );
if( new_dir != QString::null )
@@ -1163,7 +1158,7 @@ void setupDialog::openLADSPADir()
void setupDialog::openSTKDir()
{
#ifdef LMMS_HAVE_STK
QString new_dir = QFileDialog::getExistingDirectory( this,
QString new_dir = FileDialog::getExistingDirectory( this,
tr( "Choose STK rawwave directory" ),
m_stkDir );
if( new_dir != QString::null )
@@ -1179,7 +1174,7 @@ void setupDialog::openSTKDir()
void setupDialog::openDefaultSoundfont()
{
#ifdef LMMS_HAVE_FLUIDSYNTH
QString new_file = QFileDialog::getOpenFileName( this,
QString new_file = FileDialog::getOpenFileName( this,
tr( "Choose default SoundFont" ), m_defaultSoundfont,
"SoundFont2 Files (*.sf2)" );
@@ -1212,7 +1207,7 @@ void setupDialog::openBackgroundArtwork()
QString dir = ( m_backgroundArtwork.isEmpty() ) ?
m_artworkDir :
m_backgroundArtwork;
QString new_file = QFileDialog::getOpenFileName( this,
QString new_file = FileDialog::getOpenFileName( this,
tr( "Choose background artwork" ), dir,
"Image Files (" + fileTypes + ")" );

View File

@@ -28,7 +28,6 @@
#include <QtCore/QQueue>
#include <QtGui/QApplication>
#include <QtGui/QCloseEvent>
#include <QtGui/QFileDialog>
#include <QtGui/QLabel>
#include <QtGui/QLayout>
#include <QtGui/QLineEdit>
@@ -38,6 +37,7 @@
#include <QtGui/QMdiSubWindow>
#include <QtGui/QPainter>
#include "FileDialog.h"
#include "InstrumentTrack.h"
#include "AudioPort.h"
#include "AutomationPattern.h"
@@ -1463,7 +1463,7 @@ void InstrumentTrackWindow::modelChanged()
void InstrumentTrackWindow::saveSettingsBtnClicked()
{
QFileDialog sfd( this, tr( "Save preset" ), "",
FileDialog sfd( this, tr( "Save preset" ), "",
tr( "XML preset file (*.xpf)" ) );
QString preset_root = configManager::inst()->userPresetsDir();
@@ -1476,9 +1476,9 @@ void InstrumentTrackWindow::saveSettingsBtnClicked()
QDir( preset_root ).mkdir( m_track->instrumentName() );
}
sfd.setAcceptMode( QFileDialog::AcceptSave );
sfd.setAcceptMode( FileDialog::AcceptSave );
sfd.setDirectory( preset_root + m_track->instrumentName() );
sfd.setFileMode( QFileDialog::AnyFile );
sfd.setFileMode( FileDialog::AnyFile );
if( sfd.exec () == QDialog::Accepted &&
!sfd.selectedFiles().isEmpty() && sfd.selectedFiles()[0] != ""
)