/*
 * Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see <http://www.gnu.org/licenses/>.
 *
**/
#ifndef CONFIGURATION_H
#define CONFIGURATION_H

#ifndef QT_NO_KEYWORDS
#define QT_NO_KEYWORDS
#endif

//#include "gsettings.h"

#include <QObject>
#include "screensavermode.h"

class QGSettings;

class Configuration : public QObject
{
	Q_OBJECT
private:
	explicit Configuration(QObject *parent = nullptr);

public:
    ScreenSaver *getScreensaver();
    static Configuration *instance(QObject *parent = nullptr);
    QString getBackground();
    QString getDefaultBackgroundName();
    bool lockWhenXScreensaverActivated();
    int idlelock();
    int idledelay();
    int locktimeout();
    double getFontSize();
    double getPtToPx();

public Q_SLOTS:
	void onConfigurationChanged(QString key);

private:
    QString getXScreensaverPath(const QString &theme);

private:
    QGSettings *gsettings;
    QGSettings *bgGsettings;
    QGSettings *fsGsettings;
    QString mode;
    double curFontSize;
    double m_pxToPt = 1.0;
    QList<QString> themes;
    QString background;
    bool idleActivationEnabled;
    bool lockEnabled;
    int idleDelay = -1;
    int idleLock = -1;
    int imageTSEffect;
    int imageSwitchInterval;  
    static Configuration    *instance_;
    int m_nLockTimeout = -1;
};

#endif // CONFIGURATION_H
