Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

Commit 924a49f4 authored by Frédéric Larue's avatar Frédéric Larue
Browse files

User settings defined as static in UIMainWindow.

parent a39979e3
......@@ -47,12 +47,14 @@ int UILaunch( int argc, char **argv )
QApplication app( argc, argv );
UIMainWindow *mainWin = new UIMainWindowT(); // Use default GUI main window.
mainWin->initializeUserSettings();
UILoadApplicationStyle( app, mainWin->getUserSettings() );
mainWin->onInitializingApp();
mainWin->init();
mainWin->show();
int appRetVal = app.exec();
mainWin->release();
......
......@@ -35,12 +35,16 @@
QSettings* UIMainWindow::m_UserSettings = NULL;
UIMainWindow::UIMainWindow(QWidget *parent) :
QMainWindow( parent ),
ui( new Ui::MainWindow ),
m_CurrentViewer( NULL ),
m_CurrentProject( NULL ),
m_UserSettings( NULL )
m_CurrentProject( NULL )
{
}
......@@ -181,15 +185,13 @@ void UIMainWindow::declareCustomMenuAction( const QString& menuName, QAction* ac
}
QSettings* UIMainWindow::getUserSettings() const
void UIMainWindow::initializeUserSettings()
{
if( !m_UserSettings )
{
QString compagnyName, applicationName, shortDescription;
applicationInfo( compagnyName, applicationName, shortDescription );
m_UserSettings = new QSettings( QSettings::IniFormat, QSettings::UserScope, compagnyName + "/" + applicationName, "Settings" );
}
return m_UserSettings;
assert( m_UserSettings == NULL );
QString compagnyName, applicationName, shortDescription;
applicationInfo( compagnyName, applicationName, shortDescription );
m_UserSettings = new QSettings( QSettings::IniFormat, QSettings::UserScope, compagnyName + "/" + applicationName, "Settings" );
}
......
......@@ -83,7 +83,7 @@ class GUIMAIN_API UIMainWindow : public QMainWindow
QList< WidgetStackItem > m_CentralWidgetStack;
mutable QSettings *m_UserSettings = NULL;
static QSettings *m_UserSettings;
public:
UIMainWindow( QWidget *parent = NULL );
......@@ -100,8 +100,10 @@ public:
virtual void applicationInfo( QString &compagnyName, QString &applicationName, QString &shortDescription ) const = 0;
virtual QString projectFileExtension() const = 0;
QSettings* getUserSettings() const;
inline QString getUserSettingsPath() const { return QFileInfo(getUserSettings()->fileName()).absolutePath(); }
void initializeUserSettings();
static inline QSettings*getUserSettings() { return m_UserSettings; }
static inline QString getUserSettingsPath() { return QFileInfo(getUserSettings()->fileName()).absolutePath(); }
virtual void onInitializingApp() {}
virtual void onReleasingApp() {}
......
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