Skip to content

Commit

Permalink
Merge pull request #1908 from curlymorphic/pathDialog
Browse files Browse the repository at this point in the history
Re organizing of the user LMMS directory
  • Loading branch information
tresf committed Apr 13, 2015
2 parents df0e6d6 + 54ddfd3 commit d516c74
Show file tree
Hide file tree
Showing 7 changed files with 235 additions and 60 deletions.
Binary file added data/themes/default/add_folder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions include/ConfigManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ const QString PROJECTS_PATH = "projects/";
const QString TEMPLATE_PATH = "templates/";
const QString PRESETS_PATH = "presets/";
const QString SAMPLES_PATH = "samples/";
const QString GIG_PATH = "samples/gig/";
const QString SF2_PATH = "samples/sf2/";
const QString LADSPA_PATH ="plugins/ladspa/";
const QString DEFAULT_THEME_PATH = "themes/default/";
const QString TRACK_ICON_PATH = "track_icons/";
const QString LOCALE_PATH = "locale/";
Expand Down Expand Up @@ -92,6 +95,26 @@ class EXPORT ConfigManager
return workingDir() + SAMPLES_PATH;
}

QString userGigDir() const
{
return workingDir() + GIG_PATH;
}

QString userSf2Dir() const
{
return workingDir() + SF2_PATH;
}

QString userLadspaDir() const
{
return workingDir() + LADSPA_PATH;
}

QString userVstDir() const
{
return m_vstDir;
}

QString factoryProjectsDir() const
{
return dataDir() + PROJECTS_PATH;
Expand Down Expand Up @@ -132,6 +155,16 @@ class EXPORT ConfigManager
return m_dataDir + LOCALE_PATH;
}

const QString & gigDir() const
{
return m_gigDir;
}

const QString & sf2Dir() const
{
return m_sf2Dir;
}

const QString & pluginDir() const
{
return m_pluginDir;
Expand Down Expand Up @@ -206,6 +239,8 @@ class EXPORT ConfigManager
void setSTKDir( const QString & _fd );
void setDefaultSoundfont( const QString & _sf );
void setBackgroundArtwork( const QString & _ba );
void setGIGDir( const QString & gd );
void setSF2Dir( const QString & sfd );


private:
Expand All @@ -226,6 +261,8 @@ class EXPORT ConfigManager
QString m_vstDir;
QString m_flDir;
QString m_ladDir;
QString m_gigDir;
QString m_sf2Dir;
QString m_version;
#ifdef LMMS_HAVE_STK
QString m_stkDir;
Expand Down
9 changes: 9 additions & 0 deletions include/SetupDialog.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

/*
* SetupDialog.h - dialog for setting up LMMS
*
Expand Down Expand Up @@ -71,6 +72,8 @@ private slots:
// path settings widget
void setWorkingDir( const QString & _wd );
void setVSTDir( const QString & _vd );
void setGIGDir( const QString & _gd );
void setSF2Dir( const QString & _sfd );
void setArtworkDir( const QString & _ad );
void setFLDir( const QString & _fd );
void setLADSPADir( const QString & _ld );
Expand All @@ -96,6 +99,8 @@ private slots:

void openWorkingDir();
void openVSTDir();
void openGIGDir();
void openSF2Dir();
void openArtworkDir();
void openFLDir();
void openLADSPADir();
Expand Down Expand Up @@ -138,6 +143,8 @@ private slots:
QLineEdit * m_adLineEdit;
QLineEdit * m_fdLineEdit;
QLineEdit * m_ladLineEdit;
QLineEdit * m_gigLineEdit;
QLineEdit * m_sf2LineEdit;
#ifdef LMMS_HAVE_FLUIDSYNTH
QLineEdit * m_sfLineEdit;
#endif
Expand All @@ -151,6 +158,8 @@ private slots:
QString m_artworkDir;
QString m_flDir;
QString m_ladDir;
QString m_gigDir;
QString m_sf2Dir;
#ifdef LMMS_HAVE_FLUIDSYNTH
QString m_defaultSoundfont;
#endif
Expand Down
4 changes: 2 additions & 2 deletions plugins/GigPlayer/GigPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ void GigInstrumentView::showFileDialog()

if( QFileInfo( f ).isRelative() )
{
f = ConfigManager::inst()->userSamplesDir() + f;
f = ConfigManager::inst()->gigDir() + f;

if( QFileInfo( f ).exists() == false )
{
Expand All @@ -1082,7 +1082,7 @@ void GigInstrumentView::showFileDialog()
}
else
{
ofd.setDirectory( ConfigManager::inst()->userSamplesDir() );
ofd.setDirectory( ConfigManager::inst()->gigDir() );
}

m_fileDialogButton->setEnabled( false );
Expand Down
4 changes: 2 additions & 2 deletions plugins/sf2_player/sf2_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,7 @@ void sf2InstrumentView::showFileDialog()
QString f = k->m_filename;
if( QFileInfo( f ).isRelative() )
{
f = ConfigManager::inst()->userSamplesDir() + f;
f = ConfigManager::inst()->sf2Dir() + f;
if( QFileInfo( f ).exists() == false )
{
f = ConfigManager::inst()->factorySamplesDir() + k->m_filename;
Expand All @@ -1078,7 +1078,7 @@ void sf2InstrumentView::showFileDialog()
}
else
{
ofd.setDirectory( ConfigManager::inst()->userSamplesDir() );
ofd.setDirectory( ConfigManager::inst()->sf2Dir() );
}

m_fileDialogButton->setEnabled( false );
Expand Down
25 changes: 24 additions & 1 deletion src/core/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ ConfigManager::ConfigManager() :
#endif
m_vstDir( m_workingDir + "vst" + QDir::separator() ),
m_flDir( QDir::home().absolutePath() ),
m_gigDir( m_workingDir + GIG_PATH ),
m_sf2Dir( m_workingDir + SF2_PATH ),
m_version( defaultVersion() )
{
}
Expand Down Expand Up @@ -179,6 +181,16 @@ void ConfigManager::setBackgroundArtwork( const QString & _ba )
#endif
}

void ConfigManager::setGIGDir(const QString &gd)
{
m_gigDir = gd;
}

void ConfigManager::setSF2Dir(const QString &sfd)
{
m_sf2Dir = sfd;
}




Expand Down Expand Up @@ -339,6 +351,9 @@ void ConfigManager::loadConfigFile()
}
}
setWorkingDir( value( "paths", "workingdir" ) );

setGIGDir( value( "paths", "gigdir" ) == "" ? gigDir() : value( "paths", "gigdir" ) );
setSF2Dir( value( "paths", "sf2dir" ) == "" ? sf2Dir() : value( "paths", "sf2dir" ) );
setVSTDir( value( "paths", "vstdir" ) );
setFLDir( value( "paths", "fldir" ) );
setLADSPADir( value( "paths", "laddir" ) );
Expand Down Expand Up @@ -369,7 +384,7 @@ void ConfigManager::loadConfigFile()
m_vstDir = windowsConfigPath( CSIDL_PROGRAM_FILES ) +
QDir::separator() + "VstPlugins";
#else
m_vstDir = ensureTrailingSlash( QDir::home().absolutePath() );
m_vstDir = m_workingDir + "plugins/vst" + QDir::separator();
#endif
}

Expand All @@ -388,6 +403,7 @@ void ConfigManager::loadConfigFile()
#else
m_ladDir = qApp->applicationDirPath() + '/' + LIB_DIR + "/ladspa/";
#endif
m_ladDir += ","+userLadspaDir();
}

#ifdef LMMS_HAVE_STK
Expand Down Expand Up @@ -426,6 +442,11 @@ void ConfigManager::loadConfigFile()
QDir().mkpath( userTemplateDir() );
QDir().mkpath( userSamplesDir() );
QDir().mkpath( userPresetsDir() );
QDir().mkpath( userGigDir() );
QDir().mkpath( userSf2Dir() );
QDir().mkpath( userVstDir() );
QDir().mkpath( userLadspaDir() );

}

upgrade();
Expand All @@ -440,6 +461,8 @@ void ConfigManager::saveConfigFile()
setValue( "paths", "workingdir", m_workingDir );
setValue( "paths", "vstdir", m_vstDir );
setValue( "paths", "fldir", m_flDir );
setValue( "paths", "gigdir", m_gigDir );
setValue( "paths", "sf2dir", m_sf2Dir );
setValue( "paths", "laddir", m_ladDir );
#ifdef LMMS_HAVE_STK
setValue( "paths", "stkdir", m_stkDir );
Expand Down
Loading

0 comments on commit d516c74

Please sign in to comment.