Merge pull request #1908 from curlymorphic/pathDialog

Re organizing of the user LMMS directory
This commit is contained in:
Tres Finocchiaro
2015-04-13 21:21:05 +00:00
7 changed files with 234 additions and 59 deletions

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 818 B

View File

@@ -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/";
@@ -92,6 +95,26 @@ public:
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;
@@ -132,6 +155,16 @@ public:
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;
@@ -206,6 +239,8 @@ public:
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:
@@ -226,6 +261,8 @@ private:
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;

View File

@@ -1,3 +1,4 @@
/*
* SetupDialog.h - dialog for setting up LMMS
*
@@ -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 );
@@ -96,6 +99,8 @@ private slots:
void openWorkingDir();
void openVSTDir();
void openGIGDir();
void openSF2Dir();
void openArtworkDir();
void openFLDir();
void openLADSPADir();
@@ -138,6 +143,8 @@ private:
QLineEdit * m_adLineEdit;
QLineEdit * m_fdLineEdit;
QLineEdit * m_ladLineEdit;
QLineEdit * m_gigLineEdit;
QLineEdit * m_sf2LineEdit;
#ifdef LMMS_HAVE_FLUIDSYNTH
QLineEdit * m_sfLineEdit;
#endif
@@ -151,6 +158,8 @@ private:
QString m_artworkDir;
QString m_flDir;
QString m_ladDir;
QString m_gigDir;
QString m_sf2Dir;
#ifdef LMMS_HAVE_FLUIDSYNTH
QString m_defaultSoundfont;
#endif

View File

@@ -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 )
{
@@ -1082,7 +1082,7 @@ void GigInstrumentView::showFileDialog()
}
else
{
ofd.setDirectory( ConfigManager::inst()->userSamplesDir() );
ofd.setDirectory( ConfigManager::inst()->gigDir() );
}
m_fileDialogButton->setEnabled( false );

View File

@@ -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;
@@ -1078,7 +1078,7 @@ void sf2InstrumentView::showFileDialog()
}
else
{
ofd.setDirectory( ConfigManager::inst()->userSamplesDir() );
ofd.setDirectory( ConfigManager::inst()->sf2Dir() );
}
m_fileDialogButton->setEnabled( false );

View File

@@ -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() )
{
}
@@ -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;
}
@@ -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" ) );
@@ -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
}
@@ -388,6 +403,7 @@ void ConfigManager::loadConfigFile()
#else
m_ladDir = qApp->applicationDirPath() + '/' + LIB_DIR + "/ladspa/";
#endif
m_ladDir += ","+userLadspaDir();
}
#ifdef LMMS_HAVE_STK
@@ -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();
@@ -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 );

View File

@@ -30,6 +30,7 @@
#include <QMessageBox>
#include <QSlider>
#include <QWhatsThis>
#include <QScrollArea>
#include "SetupDialog.h"
#include "TabBar.h"
@@ -105,6 +106,8 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
m_artworkDir( QDir::toNativeSeparators( ConfigManager::inst()->artworkDir() ) ),
m_flDir( QDir::toNativeSeparators( ConfigManager::inst()->flDir() ) ),
m_ladDir( QDir::toNativeSeparators( ConfigManager::inst()->ladspaDir() ) ),
m_gigDir( QDir::toNativeSeparators( ConfigManager::inst()->gigDir() ) ),
m_sf2Dir( QDir::toNativeSeparators( ConfigManager::inst()->sf2Dir() ) ),
#ifdef LMMS_HAVE_FLUIDSYNTH
m_defaultSoundfont( QDir::toNativeSeparators( ConfigManager::inst()->defaultSoundfont() ) ),
#endif
@@ -378,15 +381,34 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
dir_layout->setSpacing( 0 );
dir_layout->setMargin( 0 );
labelWidget( paths, tr( "Paths" ) );
QLabel * title = new QLabel( tr( "Directories" ), paths );
QFont f = title->font();
f.setBold( true );
title->setFont( pointSize<12>( f ) );
QScrollArea *pathScroll = new QScrollArea( paths );
QWidget *pathSelectors = new QWidget( ws );
QVBoxLayout *pathSelectorLayout = new QVBoxLayout;
pathScroll->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
pathScroll->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
pathScroll->resize( 362, pathsHeight - 50 );
pathScroll->move( 0, 30 );
pathSelectors->resize( 360, pathsHeight - 50 );
const int txtLength = 285;
const int btnStart = 305;
// working-dir
TabWidget * lmms_wd_tw = new TabWidget( tr(
"LMMS working directory" ).toUpper(),
paths );
pathSelectors );
lmms_wd_tw->setFixedHeight( 48 );
m_wdLineEdit = new QLineEdit( m_workingDir, lmms_wd_tw );
m_wdLineEdit->setGeometry( 10, 20, 300, 16 );
m_wdLineEdit->setGeometry( 10, 20, txtLength, 16 );
connect( m_wdLineEdit, SIGNAL( textChanged( const QString & ) ), this,
SLOT( setWorkingDir( const QString & ) ) );
@@ -394,37 +416,19 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
embed::getIconPixmap( "project_open", 16, 16 ),
"", lmms_wd_tw );
workingdir_select_btn->setFixedSize( 24, 24 );
workingdir_select_btn->move( 320, 16 );
workingdir_select_btn->move( btnStart, 16 );
connect( workingdir_select_btn, SIGNAL( clicked() ), this,
SLOT( openWorkingDir() ) );
// vst-dir
TabWidget * vst_tw = new TabWidget( tr(
"VST-plugin directory" ).toUpper(),
paths );
vst_tw->setFixedHeight( 48 );
m_vdLineEdit = new QLineEdit( m_vstDir, vst_tw );
m_vdLineEdit->setGeometry( 10, 20, 300, 16 );
connect( m_vdLineEdit, SIGNAL( textChanged( const QString & ) ), this,
SLOT( setVSTDir( const QString & ) ) );
QPushButton * vstdir_select_btn = new QPushButton(
embed::getIconPixmap( "project_open", 16, 16 ),
"", vst_tw );
vstdir_select_btn->setFixedSize( 24, 24 );
vstdir_select_btn->move( 320, 16 );
connect( vstdir_select_btn, SIGNAL( clicked() ), this,
SLOT( openVSTDir() ) );
// artwork-dir
TabWidget * artwork_tw = new TabWidget( tr(
"Artwork directory" ).toUpper(),
paths );
"Themes directory" ).toUpper(),
pathSelectors );
artwork_tw->setFixedHeight( 48 );
m_adLineEdit = new QLineEdit( m_artworkDir, artwork_tw );
m_adLineEdit->setGeometry( 10, 20, 300, 16 );
m_adLineEdit->setGeometry( 10, 20, txtLength, 16 );
connect( m_adLineEdit, SIGNAL( textChanged( const QString & ) ), this,
SLOT( setArtworkDir( const QString & ) ) );
@@ -432,7 +436,7 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
embed::getIconPixmap( "project_open", 16, 16 ),
"", artwork_tw );
artworkdir_select_btn->setFixedSize( 24, 24 );
artworkdir_select_btn->move( 320, 16 );
artworkdir_select_btn->move( btnStart, 16 );
connect( artworkdir_select_btn, SIGNAL( clicked() ), this,
SLOT( openArtworkDir() ) );
@@ -445,7 +449,7 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
m_baLineEdit = new QLineEdit( m_backgroundArtwork,
backgroundArtwork_tw );
m_baLineEdit->setGeometry( 10, 20, 300, 16 );
m_baLineEdit->setGeometry( 10, 20, txtLength, 16 );
connect( m_baLineEdit, SIGNAL( textChanged( const QString & ) ), this,
SLOT( setBackgroundArtwork( const QString & ) ) );
@@ -453,7 +457,7 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
embed::getIconPixmap( "project_open", 16, 16 ),
"", backgroundArtwork_tw );
backgroundartworkdir_select_btn->setFixedSize( 24, 24 );
backgroundartworkdir_select_btn->move( 320, 16 );
backgroundartworkdir_select_btn->move( btnStart, 16 );
connect( backgroundartworkdir_select_btn, SIGNAL( clicked() ), this,
SLOT( openBackgroundArtwork() ) );
@@ -468,7 +472,7 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
fl_tw->setFixedHeight( 48 );
m_fdLineEdit = new QLineEdit( m_flDir, fl_tw );
m_fdLineEdit->setGeometry( 10, 20, 300, 16 );
m_fdLineEdit->setGeometry( 10, 20, txtLength, 16 );
connect( m_fdLineEdit, SIGNAL( textChanged( const QString & ) ), this,
SLOT( setFLDir( const QString & ) ) );
@@ -476,28 +480,89 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
embed::getIconPixmap( "project_open", 16, 16 ),
"", fl_tw );
fldir_select_btn->setFixedSize( 24, 24 );
fldir_select_btn->move( 320, 16 );
fldir_select_btn->move( btnStart, 16 );
connect( fldir_select_btn, SIGNAL( clicked() ), this,
SLOT( openFLDir() ) );
// vst-dir
TabWidget * vst_tw = new TabWidget( tr(
"VST-plugin directory" ).toUpper(),
pathSelectors );
vst_tw->setFixedHeight( 48 );
m_vdLineEdit = new QLineEdit( m_vstDir, vst_tw );
m_vdLineEdit->setGeometry( 10, 20, txtLength, 16 );
connect( m_vdLineEdit, SIGNAL( textChanged( const QString & ) ), this,
SLOT( setVSTDir( const QString & ) ) );
QPushButton * vstdir_select_btn = new QPushButton(
embed::getIconPixmap( "project_open", 16, 16 ),
"", vst_tw );
vstdir_select_btn->setFixedSize( 24, 24 );
vstdir_select_btn->move( btnStart, 16 );
connect( vstdir_select_btn, SIGNAL( clicked() ), this,
SLOT( openVSTDir() ) );
// gig-dir
TabWidget * gig_tw = new TabWidget( tr(
"GIG directory" ).toUpper(),
pathSelectors );
gig_tw->setFixedHeight( 48 );
m_gigLineEdit = new QLineEdit( m_gigDir, gig_tw );
m_gigLineEdit->setGeometry( 10, 20, txtLength, 16 );
connect( m_gigLineEdit, SIGNAL( textChanged( const QString & ) ), this,
SLOT( setGIGDir( const QString & ) ) );
QPushButton * gigdir_select_btn = new QPushButton(
embed::getIconPixmap( "project_open", 16, 16 ),
"", gig_tw );
gigdir_select_btn->setFixedSize( 24, 24 );
gigdir_select_btn->move( btnStart, 16 );
connect( gigdir_select_btn, SIGNAL( clicked() ), this,
SLOT( openGIGDir() ) );
// sf2-dir
TabWidget * sf2_tw = new TabWidget( tr(
"SF2 directory" ).toUpper(),
pathSelectors );
sf2_tw->setFixedHeight( 48 );
m_sf2LineEdit = new QLineEdit( m_sf2Dir, sf2_tw );
m_sf2LineEdit->setGeometry( 10, 20, txtLength, 16 );
connect( m_sf2LineEdit, SIGNAL( textChanged( const QString & ) ), this,
SLOT( setSF2Dir( const QString & ) ) );
QPushButton * sf2dir_select_btn = new QPushButton(
embed::getIconPixmap( "project_open", 16, 16 ),
"", sf2_tw );
sf2dir_select_btn->setFixedSize( 24, 24 );
sf2dir_select_btn->move( btnStart, 16 );
connect( sf2dir_select_btn, SIGNAL( clicked() ), this,
SLOT( openSF2Dir() ) );
// LADSPA-dir
TabWidget * lad_tw = new TabWidget( tr(
"LADSPA plugin paths" ).toUpper(),
"LADSPA plugin directories" ).toUpper(),
paths );
lad_tw->setFixedHeight( 48 );
m_ladLineEdit = new QLineEdit( m_ladDir, lad_tw );
m_ladLineEdit->setGeometry( 10, 20, 300, 16 );
m_ladLineEdit->setGeometry( 10, 20, txtLength, 16 );
connect( m_ladLineEdit, SIGNAL( textChanged( const QString & ) ), this,
SLOT( setLADSPADir( const QString & ) ) );
QPushButton * laddir_select_btn = new QPushButton(
embed::getIconPixmap( "project_open", 16, 16 ),
embed::getIconPixmap( "add_folder", 16, 16 ),
"", lad_tw );
laddir_select_btn->setFixedSize( 24, 24 );
laddir_select_btn->move( 320, 16 );
laddir_select_btn->move( btnStart, 16 );
connect( laddir_select_btn, SIGNAL( clicked() ), this,
SLOT( openLADSPADir() ) );
#ifdef LMMS_HAVE_STK
// STK-dir
TabWidget * stk_tw = new TabWidget( tr(
@@ -506,7 +571,7 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
stk_tw->setFixedHeight( 48 );
m_stkLineEdit = new QLineEdit( m_stkDir, stk_tw );
m_stkLineEdit->setGeometry( 10, 20, 300, 16 );
m_stkLineEdit->setGeometry( 10, 20, txtLength, 16 );
connect( m_stkLineEdit, SIGNAL( textChanged( const QString & ) ), this,
SLOT( setSTKDir( const QString & ) ) );
@@ -514,7 +579,7 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
embed::getIconPixmap( "project_open", 16, 16 ),
"", stk_tw );
stkdir_select_btn->setFixedSize( 24, 24 );
stkdir_select_btn->move( 320, 16 );
stkdir_select_btn->move( btnStart, 16 );
connect( stkdir_select_btn, SIGNAL( clicked() ), this,
SLOT( openSTKDir() ) );
#endif
@@ -526,7 +591,7 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
sf_tw->setFixedHeight( 48 );
m_sfLineEdit = new QLineEdit( m_defaultSoundfont, sf_tw );
m_sfLineEdit->setGeometry( 10, 20, 300, 16 );
m_sfLineEdit->setGeometry( 10, 20, txtLength, 16 );
connect( m_sfLineEdit, SIGNAL( textChanged( const QString & ) ), this,
SLOT( setDefaultSoundfont( const QString & ) ) );
@@ -534,34 +599,42 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
embed::getIconPixmap( "project_open", 16, 16 ),
"", sf_tw );
sf_select_btn->setFixedSize( 24, 24 );
sf_select_btn->move( 320, 16 );
sf_select_btn->move( btnStart, 16 );
connect( sf_select_btn, SIGNAL( clicked() ), this,
SLOT( openDefaultSoundfont() ) );
#endif
pathSelectors->setLayout( pathSelectorLayout );
dir_layout->addWidget( lmms_wd_tw );
dir_layout->addSpacing( 10 );
dir_layout->addWidget( vst_tw );
dir_layout->addSpacing( 10 );
dir_layout->addWidget( artwork_tw );
dir_layout->addSpacing( 10 );
dir_layout->addWidget( backgroundArtwork_tw );
dir_layout->addSpacing( 10 );
dir_layout->addWidget( fl_tw );
dir_layout->addSpacing( 10 );
dir_layout->addWidget( lad_tw );
pathSelectorLayout->addWidget( lmms_wd_tw );
pathSelectorLayout->addSpacing( 10 );
pathSelectorLayout->addWidget( gig_tw );
pathSelectorLayout->addSpacing( 10 );
pathSelectorLayout->addWidget( sf2_tw );
pathSelectorLayout->addSpacing( 10 );
pathSelectorLayout->addWidget( vst_tw );
pathSelectorLayout->addSpacing( 10 );
pathSelectorLayout->addWidget( lad_tw );
#ifdef LMMS_HAVE_STK
dir_layout->addSpacing( 10 );
dir_layout->addWidget( stk_tw );
pathSelectorLayout->addSpacing( 10 );
pathSelectorLayout->addWidget( stk_tw );
#endif
#ifdef LMMS_HAVE_FLUIDSYNTH
dir_layout->addSpacing( 10 );
dir_layout->addWidget( sf_tw );
pathSelectorLayout->addSpacing( 10 );
pathSelectorLayout->addWidget( sf_tw );
#endif
dir_layout->addStretch();
pathSelectorLayout->addWidget( fl_tw );
pathSelectorLayout->addSpacing( 10 );
pathSelectorLayout->addWidget( artwork_tw );
pathSelectorLayout->addSpacing( 10 );
pathSelectorLayout->addStretch();
pathSelectorLayout->addWidget( backgroundArtwork_tw );
pathSelectorLayout->addSpacing( 10 );
dir_layout->addWidget( pathSelectors );
pathScroll->setWidget( pathSelectors );
pathScroll->setWidgetResizable( true );
@@ -905,6 +978,8 @@ void SetupDialog::accept()
ConfigManager::inst()->setWorkingDir( m_workingDir );
ConfigManager::inst()->setVSTDir( m_vstDir );
ConfigManager::inst()->setGIGDir( m_gigDir );
ConfigManager::inst()->setSF2Dir( m_sf2Dir );
ConfigManager::inst()->setArtworkDir( m_artworkDir );
ConfigManager::inst()->setFLDir( m_flDir );
ConfigManager::inst()->setLADSPADir( m_ladDir );
@@ -1128,6 +1203,28 @@ void SetupDialog::openWorkingDir()
}
}
void SetupDialog::openGIGDir()
{
QString new_dir = FileDialog::getExistingDirectory( this,
tr( "Choose your GIG directory" ),
m_gigDir );
if( new_dir != QString::null )
{
m_gigLineEdit->setText( new_dir );
}
}
void SetupDialog::openSF2Dir()
{
QString new_dir = FileDialog::getExistingDirectory( this,
tr( "Choose your SF2 directory" ),
m_sf2Dir );
if( new_dir != QString::null )
{
m_sf2LineEdit->setText( new_dir );
}
}
@@ -1158,6 +1255,16 @@ void SetupDialog::setVSTDir( const QString & _vd )
m_vstDir = _vd;
}
void SetupDialog::setGIGDir(const QString &_gd)
{
m_gigDir = _gd;
}
void SetupDialog::setSF2Dir(const QString &_sfd)
{
m_sf2Dir = _sfd;
}
@@ -1218,7 +1325,6 @@ void SetupDialog::openLADSPADir()
void SetupDialog::openSTKDir()
{
#ifdef LMMS_HAVE_STK