Create User project template folder and default project template.

During the creation of the user directories, added the creation of
the projects/templates directory.

When creating a new song, if there is no default template create one.
This commit is contained in:
Dave French
2015-02-26 23:23:05 +00:00
parent de9f879dde
commit 7335b98fdb
3 changed files with 11 additions and 0 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/";

View File

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

View File

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