Merge pull request #1791 from curlymorphic/i1702

Extend the creation of default lmms folder, and default template.
This commit is contained in:
Tres Finocchiaro
2015-03-27 14:27:48 +00:00
4 changed files with 19 additions and 2 deletions

View File

@@ -41,6 +41,7 @@ class Engine;
const QString PROJECTS_PATH = "projects/";
const QString TEMPLATE_PATH = "templates/";
const QString PRESETS_PATH = "presets/";
const QString SAMPLES_PATH = "samples/";
const QString DEFAULT_THEME_PATH = "themes/default/";
@@ -76,6 +77,11 @@ public:
return workingDir() + PROJECTS_PATH;
}
QString userTemplateDir() const
{
return workingDir() + TEMPLATE_PATH;
}
QString userPresetsDir() const
{
return workingDir() + PRESETS_PATH;

View File

@@ -423,6 +423,7 @@ void ConfigManager::loadConfigFile()
if( QDir( m_workingDir ).exists() )
{
QDir().mkpath( userProjectsDir() );
QDir().mkpath( userTemplateDir() );
QDir().mkpath( userSamplesDir() );
QDir().mkpath( userPresetsDir() );
}

View File

@@ -847,8 +847,10 @@ void Song::clearProject()
// create new file
void Song::createNewProject()
{
QString defaultTemplate = ConfigManager::inst()->userProjectsDir()
+ "templates/default.mpt";
QString defaultTemplate = ConfigManager::inst()->userTemplateDir()
+ "default.mpt";
if( QFile::exists( defaultTemplate ) )
{

View File

@@ -738,6 +738,14 @@ void MainWindow::createNewProject()
{
Engine::getSong()->createNewProject();
}
QString default_template = ConfigManager::inst()->userTemplateDir()
+ "default.mpt";
//if we dont have a user default template, make one
if( !QFile::exists( default_template ) )
{
Engine::getSong()->saveProjectFile( default_template );
}
}