Skip to content

Commit

Permalink
Merge pull request LMMS#1791 from curlymorphic/i1702
Browse files Browse the repository at this point in the history
Extend the creation of default lmms folder, and default template.
  • Loading branch information
tresf committed Mar 27, 2015
2 parents de9f879 + 345e058 commit c1a2fde
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
6 changes: 6 additions & 0 deletions include/ConfigManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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/";
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/core/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ void ConfigManager::loadConfigFile()
if( QDir( m_workingDir ).exists() )
{
QDir().mkpath( userProjectsDir() );
QDir().mkpath( userTemplateDir() );
QDir().mkpath( userSamplesDir() );
QDir().mkpath( userPresetsDir() );
}
Expand Down
6 changes: 4 additions & 2 deletions src/core/Song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) )
{
Expand Down
8 changes: 8 additions & 0 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
}


Expand Down

0 comments on commit c1a2fde

Please sign in to comment.