mirror of
https://github.com/QuasarApp/QuasarAppLib.git
synced 2025-04-26 09:44:38 +00:00
fix qaservice (autoInstance method)
This commit is contained in:
parent
53a67709ff
commit
d4a3e7dff2
15
isettings.h
15
isettings.h
@ -104,7 +104,22 @@ public:
|
||||
*/
|
||||
void setMode(const SettingsSaveMode &mode);
|
||||
|
||||
/**
|
||||
* @brief instance This method returns pointer to current settings object.
|
||||
* @return pointer to current settings object.
|
||||
* @see Service::instance
|
||||
*/
|
||||
static ISettings* instance();
|
||||
|
||||
/**
|
||||
* @brief initService This method initialize the global settings object.
|
||||
* @param obj This is prepared settings object. You should create a your object monyaly, and add to initialization
|
||||
* @code{cpp}
|
||||
* bool result = initService(std::make_unique<MySettings>());
|
||||
* @endcode
|
||||
* @return true if initialization finished successful else false.
|
||||
* @see Service::initService
|
||||
*/
|
||||
static bool initService(std::unique_ptr<ISettings> obj);
|
||||
|
||||
public slots:
|
||||
|
@ -78,12 +78,12 @@ public:
|
||||
* @see deinitService
|
||||
* @see autoInstance
|
||||
*/
|
||||
static Base* initService() {
|
||||
static inline std::unique_ptr<Base>& initService() {
|
||||
auto& val = instancePrivat();
|
||||
if(!val) {
|
||||
val.reset(new Base());
|
||||
}
|
||||
return val._data;
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -65,4 +65,8 @@ void Settings::setBoolOptions(const QSet<QString> &newBoolOptions)
|
||||
_boolOptions = newBoolOptions;
|
||||
}
|
||||
|
||||
bool Settings::initService() {
|
||||
return ISettings::initService(std::make_unique<Settings>());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -61,6 +61,13 @@ public:
|
||||
*/
|
||||
void setBoolOptions(const QSet<QString> &newBoolOptions);
|
||||
|
||||
/**
|
||||
* @brief initService This method initialize default object of the QuasarAppUtils::Settings type.
|
||||
* @return true if initialization finished successfull else false.
|
||||
* @see ISettings::initService
|
||||
*/
|
||||
static bool initService();
|
||||
|
||||
protected:
|
||||
|
||||
void syncImplementation() override;
|
||||
|
Loading…
x
Reference in New Issue
Block a user