// qsettings.sip generated by MetaSIP on Thu Sep 11 18:50:31 2014
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2014 Riverbank Computing Limited <info@riverbankcomputing.com>
// 
// This file is part of PyQt.
// 
// This file may be used under the terms of the GNU General Public
// License versions 2.0 or 3.0 as published by the Free Software
// Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
// included in the packaging of this file.  Alternatively you may (at
// your option) use any later version of the GNU General Public
// License if such license has been publicly approved by Riverbank
// Computing Limited (or its successors, if any) and the KDE Free Qt
// Foundation. In addition, as a special exception, Riverbank gives you
// certain additional rights. These rights are described in the Riverbank
// GPL Exception version 1.1, which can be found in the file
// GPL_EXCEPTION.txt in this package.
// 
// If you are unsure which license is appropriate for your use, please
// contact the sales department at sales@riverbankcomputing.com.
// 
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.


class QSettings : QObject
{
%TypeHeaderCode
#include <qsettings.h>
%End

public:
    enum Status
    {
        NoError,
        AccessError,
        FormatError,
    };

    enum Format
    {
        NativeFormat,
        IniFormat,
        InvalidFormat,
    };

    enum Scope
    {
        UserScope,
        SystemScope,
    };

    QSettings(const QString &organization, const QString &application /DocValue="Py_v3:''"/ = QString(), QObject *parent /TransferThis/ = 0);
    QSettings(QSettings::Scope scope, const QString &organization, const QString &application /DocValue="Py_v3:''"/ = QString(), QObject *parent /TransferThis/ = 0);
    QSettings(QSettings::Format format, QSettings::Scope scope, const QString &organization, const QString &application /DocValue="Py_v3:''"/ = QString(), QObject *parent /TransferThis/ = 0);
    QSettings(const QString &fileName, QSettings::Format format, QObject *parent /TransferThis/ = 0);
    explicit QSettings(QObject *parent /TransferThis/ = 0);
    virtual ~QSettings();
    void clear();
    void sync();
    QSettings::Status status() const;
    void beginGroup(const QString &prefix);
    void endGroup();
    QString group() const;
    int beginReadArray(const QString &prefix);
    void beginWriteArray(const QString &prefix, int size = -1);
    void endArray();
    void setArrayIndex(int i);
    QStringList allKeys() const;
    QStringList childKeys() const;
    QStringList childGroups() const;
    bool isWritable() const;
    void setValue(const QString &key, const QVariant &value);
    SIP_PYOBJECT value(const QString &key, const QVariant &defaultValue /DocValue="Py_v3:None"/ = QVariant(), SIP_PYOBJECT type /DocValue="None"/ = 0) const /ReleaseGIL/;
%MethodCode
        QVariant value;
        
        // QSettings has an internal mutex so release the GIL to avoid the possibility
        // of deadlocks.
        Py_BEGIN_ALLOW_THREADS
        value = sipCpp->value(*a0, *a1);
        Py_END_ALLOW_THREADS
        
        sipRes = qpycore_qvariant_value(value, a2);
        
        sipIsErr = !sipRes;
%End

    void remove(const QString &key);
    bool contains(const QString &key) const;
    void setFallbacksEnabled(bool b);
    bool fallbacksEnabled() const;
    QString fileName() const;
    static void setSystemIniPath(const QString &dir);
    static void setUserIniPath(const QString &dir);
    static void setPath(QSettings::Format format, QSettings::Scope scope, const QString &path);
%If (Qt_4_4_0 -)
    QSettings::Format format() const;
%End
%If (Qt_4_4_0 -)
    QSettings::Scope scope() const;
%End
%If (Qt_4_4_0 -)
    QString organizationName() const;
%End
%If (Qt_4_4_0 -)
    QString applicationName() const;
%End
%If (Qt_4_4_0 -)
    static void setDefaultFormat(QSettings::Format format);
%End
%If (Qt_4_4_0 -)
    static QSettings::Format defaultFormat();
%End
%If (Qt_4_5_0 -)
    void setIniCodec(QTextCodec *codec /KeepReference/);
%End
%If (Qt_4_5_0 -)
    void setIniCodec(const char *codecName);
%End
%If (Qt_4_5_0 -)
    QTextCodec *iniCodec() const;
%End

protected:
    virtual bool event(QEvent *event);

private:
    QSettings(const QSettings &);
};
