Commit 9fdbb069 authored by Clement CHAVANCE's avatar Clement CHAVANCE
Browse files

defaultSettings are now load at the first call of getInstance

parent e7919a53
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "VLMCSettingsDefault.h" #include "VLMCSettingsDefault.h"
#include "ProjectSettingsDefault.h" #include "ProjectSettingsDefault.h"
bool SettingsManager::m_defaultLoaded = false;
SettingsManager::SettingsManager( QObject* parent ) SettingsManager::SettingsManager( QObject* parent )
: QObject( parent ) : QObject( parent )
...@@ -160,6 +161,19 @@ void SettingsManager::addNewSettingsPart( const QString& name ) ...@@ -160,6 +161,19 @@ void SettingsManager::addNewSettingsPart( const QString& name )
void SettingsManager::loadDefaultsSettings() void SettingsManager::loadDefaultsSettings()
{ {
VLMCSettingsDefault::load( "default" ); VLMCSettingsDefault::load( "default" );
VLMCSettingsDefault::load( "VLMC" );
ProjectSettingsDefault::load( "default" ); ProjectSettingsDefault::load( "default" );
ProjectSettingsDefault::load( "project" );
}
SettingsManager* SettingsManager::getInstance()
{
SettingsManager* ret = QSingleton<SettingsManager>::getInstance();
if ( !SettingsManager::m_defaultLoaded )
{
SettingsManager::m_defaultLoaded = true;
SettingsManager::loadDefaultsSettings();
}
return ret;
} }
...@@ -60,6 +60,7 @@ class SettingsManager : public QObject, public QSingleton<SettingsManager> ...@@ -60,6 +60,7 @@ class SettingsManager : public QObject, public QSingleton<SettingsManager>
void loadSettings( const QString& part, const QDomElement& settings ); void loadSettings( const QString& part, const QDomElement& settings );
void addNewSettingsPart( const QString& name ); void addNewSettingsPart( const QString& name );
static void loadDefaultsSettings(); static void loadDefaultsSettings();
static SettingsManager* getInstance();
private: private:
SettingsManager( QObject* parent = 0 ); SettingsManager( QObject* parent = 0 );
...@@ -67,6 +68,7 @@ class SettingsManager : public QObject, public QSingleton<SettingsManager> ...@@ -67,6 +68,7 @@ class SettingsManager : public QObject, public QSingleton<SettingsManager>
QHash<QString, SettingsPart*> m_data; QHash<QString, SettingsPart*> m_data;
mutable QReadWriteLock m_globalLock; mutable QReadWriteLock m_globalLock;
static bool m_defaultLoaded;
signals: signals:
void settingsLoaded(); void settingsLoaded();
......
...@@ -64,7 +64,6 @@ MainWindow::MainWindow( QWidget *parent ) : ...@@ -64,7 +64,6 @@ MainWindow::MainWindow( QWidget *parent ) :
DockWidgetManager::instance( this )->setMainWindow( this ); DockWidgetManager::instance( this )->setMainWindow( this );
initializeDockWidgets(); initializeDockWidgets();
createStatusBar(); createStatusBar();
loadDefaults();
VLMCSettingsDefault::load( "default" ); VLMCSettingsDefault::load( "default" );
VLMCSettingsDefault::load( "VLMC" ); VLMCSettingsDefault::load( "VLMC" );
createGlobalPreferences(); createGlobalPreferences();
...@@ -341,13 +340,6 @@ void MainWindow::createProjectPreferences() ...@@ -341,13 +340,6 @@ void MainWindow::createProjectPreferences()
m_projectPreferences->build(); m_projectPreferences->build();
} }
void MainWindow::loadDefaults()
{
VLMCSettingsDefault::load( "default" );
VLMCSettingsDefault::load( "VLMC" );
ProjectSettingsDefault::load( "default" );
ProjectSettingsDefault::load( "project" );
}
//Private slots definition //Private slots definition
......
...@@ -66,7 +66,6 @@ private: ...@@ -66,7 +66,6 @@ private:
void createStatusBar(); void createStatusBar();
void createGlobalPreferences(); void createGlobalPreferences();
void createProjectPreferences(); void createProjectPreferences();
void loadDefaults();
Ui::MainWindow m_ui; Ui::MainWindow m_ui;
MetaDataManager* m_metaDataManager; MetaDataManager* m_metaDataManager;
......
...@@ -38,7 +38,6 @@ TracksRuler::TracksRuler( TracksView* tracksView, QWidget* parent ) ...@@ -38,7 +38,6 @@ TracksRuler::TracksRuler( TracksView* tracksView, QWidget* parent )
//TODO We should really get that from the //TODO We should really get that from the
// workflow and not directly from the settings. // workflow and not directly from the settings.
SettingsManager* settings = SettingsManager::getInstance(); SettingsManager* settings = SettingsManager::getInstance();
settings->loadDefaultsSettings();
m_fps = qRound( settings->getValue( "default", "VLMCPreviewFPS" ).toDouble() ); m_fps = qRound( settings->getValue( "default", "VLMCPreviewFPS" ).toDouble() );
m_factor = 1; m_factor = 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment