From 2b0798d78cb68c2be6f01da366090e8434f55db8 Mon Sep 17 00:00:00 2001 From: Jeremy Bullock Date: Aug 09 2017 02:56:51 +0000 Subject: Merge pull request #1366 from shun-iwasawa/preferences_template Enable to use template settings for preferences --- diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cpp index a2f92a7..6fbbcbf 100644 --- a/toonz/sources/toonzlib/preferences.cpp +++ b/toonz/sources/toonzlib/preferences.cpp @@ -325,8 +325,11 @@ Preferences::Preferences() TFilePath layoutDir = ToonzFolder::getMyModuleDir(); TFilePath savePath = layoutDir + TFilePath("preferences.ini"); + // If no personal settings found, then try to load template settings + TFilePath loadPath = ToonzFolder::getModuleFile(TFilePath("preferences.ini")); + m_settings.reset(new QSettings( - QString::fromStdWString(savePath.getWideString()), QSettings::IniFormat)); + QString::fromStdWString(loadPath.getWideString()), QSettings::IniFormat)); getValue(*m_settings, "autoExposeEnabled", m_autoExposeEnabled); getValue(*m_settings, "autoCreateEnabled", m_autoCreateEnabled); @@ -598,6 +601,16 @@ Preferences::Preferences() m_inputCellsWithoutDoubleClickingEnabled); getValue(*m_settings, "importPolicy", m_importPolicy); getValue(*m_settings, "watchFileSystemEnabled", m_watchFileSystem); + + // in case there is no personal settings + if (savePath != loadPath) { + // copy the template settins to the personal one + if (TFileStatus(loadPath).doesExist()) + TSystem::copyFile(savePath, loadPath); + m_settings.reset( + new QSettings(QString::fromStdWString(savePath.getWideString()), + QSettings::IniFormat)); + } } //-----------------------------------------------------------------