add QSettings for config parsing
This commit is contained in:
parent
f9af4c662a
commit
893a2990af
5 changed files with 71 additions and 31 deletions
|
|
@ -20,18 +20,22 @@ class EnergySaver : public QObject
|
|||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
explicit EnergySaver(QObject *parent = nullptr) : QObject(parent) {};
|
||||
explicit EnergySaver(QObject *parent = nullptr) : QObject(parent) {}
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Create instance if necessary and set timeout interval.
|
||||
* @brief Create instance if necessary, configure it and start timer.
|
||||
* @param interval Timer interval in seconds
|
||||
* @param shutdownScript Path to shutdown script file
|
||||
* @see EnergySaver::instance
|
||||
*
|
||||
* Instance is initialized with timeout interval and shutdown script
|
||||
* and started if the provided script exists.
|
||||
*/
|
||||
static void init(int interval);
|
||||
static void init(int interval, const QString& shutdownScript);
|
||||
/**
|
||||
* @brief Implements the singleton pattern.
|
||||
* @return Instance
|
||||
* @return Instance of EnergySaver
|
||||
*
|
||||
* If no instance has been created yet, create new instance.
|
||||
*/
|
||||
|
|
@ -49,7 +53,9 @@ private:
|
|||
* @param interval Timeout interval in millisecond.
|
||||
*/
|
||||
void initTimer(int interval);
|
||||
void setShutdownScript(const QString& shutdownScript);
|
||||
QTimer mTimer;
|
||||
QString mShutdownScript;
|
||||
|
||||
private slots:
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue