diff --git a/include/ConfigManager.h b/include/ConfigManager.h index 36fbdebb546..a6fabd00e7f 100644 --- a/include/ConfigManager.h +++ b/include/ConfigManager.h @@ -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 @@ class EXPORT ConfigManager return workingDir() + PROJECTS_PATH; } + QString userTemplateDir() const + { + return workingDir() + TEMPLATE_PATH; + } + QString userPresetsDir() const { return workingDir() + PRESETS_PATH; diff --git a/src/core/ConfigManager.cpp b/src/core/ConfigManager.cpp index 1254977f06c..81b7d052788 100644 --- a/src/core/ConfigManager.cpp +++ b/src/core/ConfigManager.cpp @@ -423,6 +423,7 @@ void ConfigManager::loadConfigFile() if( QDir( m_workingDir ).exists() ) { QDir().mkpath( userProjectsDir() ); + QDir().mkpath( userTemplateDir() ); QDir().mkpath( userSamplesDir() ); QDir().mkpath( userPresetsDir() ); } diff --git a/src/core/Song.cpp b/src/core/Song.cpp index 0f688a1b101..c97c577a498 100644 --- a/src/core/Song.cpp +++ b/src/core/Song.cpp @@ -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 ) ) { diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 9a0afbe3817..78df3798bd7 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -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 ); + } }