2020-12-28 20:29:13 +08:00
|
|
|
#ifndef GLOBALSETTINGS_H
|
|
|
|
#define GLOBALSETTINGS_H
|
|
|
|
|
|
|
|
#include <QObject>
|
2021-01-03 16:58:26 +08:00
|
|
|
#include <QSettings>
|
|
|
|
#include <QMutex>
|
|
|
|
#include <QVector>
|
2021-01-04 14:21:45 +08:00
|
|
|
//#include <QGSettings>
|
|
|
|
//If use pkg_config, it wont build succes,why?????????
|
|
|
|
//My demo can build access yet.
|
|
|
|
//MouseZhangZh
|
|
|
|
#include <QGSettings/QGSettings>
|
|
|
|
#include "libsearch_global.h"
|
2020-12-28 20:29:13 +08:00
|
|
|
|
2021-01-04 14:21:45 +08:00
|
|
|
#define CONTROL_CENTER_PERSONALISE_GSETTINGS_ID "org.ukui.control-center.personalise"
|
|
|
|
#define TRANSPARENCY_KEY "transparency"
|
2021-01-04 18:55:18 +08:00
|
|
|
#define INDEX_DATABASE_STATE "index_database_state"
|
|
|
|
#define CONTENT_INDEX_DATABASE_STATE "content_index_database_state"
|
|
|
|
#define INDEX_GENERATOR_NORMAL_EXIT "index_generator_normal_exit"
|
2021-01-04 14:21:45 +08:00
|
|
|
|
|
|
|
class LIBSEARCH_EXPORT GlobalSettings : public QObject
|
2020-12-28 20:29:13 +08:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2021-01-03 16:58:26 +08:00
|
|
|
static GlobalSettings *getInstance();
|
|
|
|
const QVariant getValue(const QString&);
|
|
|
|
bool isExist(const QString&);
|
2020-12-28 20:29:13 +08:00
|
|
|
|
|
|
|
Q_SIGNALS:
|
2021-01-03 16:58:26 +08:00
|
|
|
void valueChanged (const QString&);
|
2021-01-04 14:21:45 +08:00
|
|
|
void transparencyChanged (const double&);
|
2021-01-03 16:58:26 +08:00
|
|
|
|
|
|
|
public Q_SLOTS:
|
|
|
|
void setValue(const QString&, const QVariant&);
|
|
|
|
void reset(const QString&);
|
|
|
|
void resetAll();
|
2021-01-08 19:08:24 +08:00
|
|
|
/**
|
|
|
|
* @brief setBlockDirs
|
|
|
|
* set path for blacklist,return true if success,otherwise return false.
|
|
|
|
* @param path path to be blocked
|
|
|
|
* @param returnMessage this message will be set when return false.
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
bool setBlockDirs(const QString& path, QString &returnMessage);
|
|
|
|
QStringList getBlockDirs();
|
2021-01-03 16:58:26 +08:00
|
|
|
|
|
|
|
void forceSync(const QString& = nullptr);
|
|
|
|
|
|
|
|
private:
|
|
|
|
explicit GlobalSettings(QObject *parent = nullptr);
|
|
|
|
~GlobalSettings();
|
|
|
|
|
|
|
|
QSettings* m_settings;
|
2021-01-04 14:21:45 +08:00
|
|
|
QGSettings* m_gsettings;
|
2021-01-08 19:08:24 +08:00
|
|
|
QSettings *m_block_dirs_settings;
|
2021-01-03 16:58:26 +08:00
|
|
|
QMap<QString, QVariant> m_cache;
|
|
|
|
|
|
|
|
QMutex m_mutex;
|
|
|
|
|
|
|
|
|
2020-12-28 20:29:13 +08:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // GLOBALSETTINGS_H
|