mirror of
https://github.com/QuasarApp/QuasarAppLib.git
synced 2025-05-02 04:29:41 +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);
|
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();
|
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);
|
static bool initService(std::unique_ptr<ISettings> obj);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -78,12 +78,12 @@ public:
|
|||||||
* @see deinitService
|
* @see deinitService
|
||||||
* @see autoInstance
|
* @see autoInstance
|
||||||
*/
|
*/
|
||||||
static Base* initService() {
|
static inline std::unique_ptr<Base>& initService() {
|
||||||
auto& val = instancePrivat();
|
auto& val = instancePrivat();
|
||||||
if(!val) {
|
if(!val) {
|
||||||
val.reset(new Base());
|
val.reset(new Base());
|
||||||
}
|
}
|
||||||
return val._data;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,4 +65,8 @@ void Settings::setBoolOptions(const QSet<QString> &newBoolOptions)
|
|||||||
_boolOptions = newBoolOptions;
|
_boolOptions = newBoolOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Settings::initService() {
|
||||||
|
return ISettings::initService(std::make_unique<Settings>());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
void setBoolOptions(const QSet<QString> &newBoolOptions);
|
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:
|
protected:
|
||||||
|
|
||||||
void syncImplementation() override;
|
void syncImplementation() override;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user