Merge pull request #1791 from curlymorphic/i1702
Extend the creation of default lmms folder, and default template.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -423,6 +423,7 @@ void ConfigManager::loadConfigFile()
|
||||
if( QDir( m_workingDir ).exists() )
|
||||
{
|
||||
QDir().mkpath( userProjectsDir() );
|
||||
QDir().mkpath( userTemplateDir() );
|
||||
QDir().mkpath( userSamplesDir() );
|
||||
QDir().mkpath( userPresetsDir() );
|
||||
}
|
||||
|
||||
@@ -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 ) )
|
||||
{
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user