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

Re organizing of the user LMMS directory #1908

Merged
merged 6 commits into from
Apr 13, 2015
Merged
Show file tree
Hide file tree
Changes from 5 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
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.
32 changes: 32 additions & 0 deletions include/ConfigManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ class Engine;
const QString PROJECTS_PATH = "projects/";
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 @@ -86,6 +89,21 @@ 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 factoryProjectsDir() const
{
return dataDir() + PROJECTS_PATH;
Expand Down Expand Up @@ -126,6 +144,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 @@ -200,6 +228,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 @@ -220,6 +250,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 @@ -1068,7 +1068,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 @@ -1079,7 +1079,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 @@ -425,6 +441,11 @@ void ConfigManager::loadConfigFile()
QDir().mkpath( userProjectsDir() );
QDir().mkpath( userSamplesDir() );
QDir().mkpath( userPresetsDir() );
QDir().mkpath( userGigDir() );
QDir().mkpath( userSf2Dir() );
QDir().mkpath( vstDir() );
Copy link
Member

Choose a reason for hiding this comment

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

Noticed the naming convention of this vstDir() vs. usersVstDir()... also many Windows users historically have the vstDir() set to a restricted area (such as Program Files/Steinberg/). Does mkpath(...) fail silently if the area can't be written to?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The directories are only created once, so there will be a user Lmms/plugin/vst folder created when the the user lmms folder in initially created.

If/ when the user sets it to another location ie Program Files/Steinberg/ no attempt is made to create or write to that location.

Copy link
Member

Choose a reason for hiding this comment

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

If/ when the user sets it to another location ie Program Files/Steinberg/ no attempt is made to create or write to that location.

Ok. :)

QDir().mkpath( userLadspaDir() );

}

upgrade();
Expand All @@ -439,6 +460,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