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 @@
#include "VLMCSettingsDefault.h"
#include "ProjectSettingsDefault.h"
bool SettingsManager::m_defaultLoaded = false;
SettingsManager::SettingsManager( QObject* parent )
: QObject( parent )
......@@ -160,6 +161,19 @@ void SettingsManager::addNewSettingsPart( const QString& name )
void SettingsManager::loadDefaultsSettings()
{
VLMCSettingsDefault::load( "default" );
VLMCSettingsDefault::load( "VLMC" );
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,13 +60,15 @@ class SettingsManager : public QObject, public QSingleton<SettingsManager>
void loadSettings( const QString& part, const QDomElement& settings );
void addNewSettingsPart( const QString& name );
static void loadDefaultsSettings();
static SettingsManager* getInstance();
private:
SettingsManager( QObject* parent = 0 );
~SettingsManager();
QHash<QString, SettingsPart*> m_data;
QHash<QString, SettingsPart*> m_data;
mutable QReadWriteLock m_globalLock;
static bool m_defaultLoaded;
signals:
void settingsLoaded();
......
......@@ -64,7 +64,6 @@ MainWindow::MainWindow( QWidget *parent ) :
DockWidgetManager::instance( this )->setMainWindow( this );
initializeDockWidgets();
createStatusBar();
loadDefaults();
VLMCSettingsDefault::load( "default" );
VLMCSettingsDefault::load( "VLMC" );
createGlobalPreferences();
......@@ -341,13 +340,6 @@ void MainWindow::createProjectPreferences()
m_projectPreferences->build();
}
void MainWindow::loadDefaults()
{
VLMCSettingsDefault::load( "default" );
VLMCSettingsDefault::load( "VLMC" );
ProjectSettingsDefault::load( "default" );
ProjectSettingsDefault::load( "project" );
}
//Private slots definition
......
......@@ -66,7 +66,6 @@ private:
void createStatusBar();
void createGlobalPreferences();
void createProjectPreferences();
void loadDefaults();
Ui::MainWindow m_ui;
MetaDataManager* m_metaDataManager;
......
......@@ -38,7 +38,6 @@ TracksRuler::TracksRuler( TracksView* tracksView, QWidget* parent )
//TODO We should really get that from the
// workflow and not directly from the settings.
SettingsManager* settings = SettingsManager::getInstance();
settings->loadDefaultsSettings();
m_fps = qRound( settings->getValue( "default", "VLMCPreviewFPS" ).toDouble() );
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