1// qsettings.sip generated by MetaSIP
2//
3// This file is part of the QtCore Python extension module.
4//
5// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
6//
7// This file is part of PyQt5.
8//
9// This file may be used under the terms of the GNU General Public License
10// version 3.0 as published by the Free Software Foundation and appearing in
11// the file LICENSE included in the packaging of this file.  Please review the
12// following information to ensure the GNU General Public License version 3.0
13// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
14//
15// If you do not wish to use this file under the terms of the GPL version 3.0
16// then you may purchase a commercial license.  For more information contact
17// info@riverbankcomputing.com.
18//
19// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21
22
23class QSettings : QObject
24{
25%TypeHeaderCode
26#include <qsettings.h>
27%End
28
29public:
30    enum Status
31    {
32        NoError,
33        AccessError,
34        FormatError,
35    };
36
37    enum Format
38    {
39        NativeFormat,
40        IniFormat,
41        InvalidFormat,
42    };
43
44    enum Scope
45    {
46        UserScope,
47        SystemScope,
48    };
49
50    QSettings(const QString &organization, const QString &application = QString(), QObject *parent /TransferThis/ = 0) /ReleaseGIL/;
51    QSettings(QSettings::Scope scope, const QString &organization, const QString &application = QString(), QObject *parent /TransferThis/ = 0) /ReleaseGIL/;
52    QSettings(QSettings::Format format, QSettings::Scope scope, const QString &organization, const QString &application = QString(), QObject *parent /TransferThis/ = 0) /ReleaseGIL/;
53    QSettings(const QString &fileName, QSettings::Format format, QObject *parent /TransferThis/ = 0) /ReleaseGIL/;
54%If (Qt_5_13_0 -)
55    QSettings(QSettings::Scope scope, QObject *parent /TransferThis/ = 0) /ReleaseGIL/;
56%End
57    explicit QSettings(QObject *parent /TransferThis/ = 0) /ReleaseGIL/;
58    virtual ~QSettings() /ReleaseGIL/;
59    void clear() /ReleaseGIL/;
60    void sync() /ReleaseGIL/;
61    QSettings::Status status() const;
62    void beginGroup(const QString &prefix);
63    void endGroup();
64    QString group() const;
65    int beginReadArray(const QString &prefix);
66    void beginWriteArray(const QString &prefix, int size = -1);
67    void endArray();
68    void setArrayIndex(int i);
69    QStringList allKeys() const /ReleaseGIL/;
70    QStringList childKeys() const /ReleaseGIL/;
71    QStringList childGroups() const /ReleaseGIL/;
72    bool isWritable() const;
73    void setValue(const QString &key, const QVariant &value) /ReleaseGIL/;
74    SIP_PYOBJECT value(const QString &key, const QVariant &defaultValue = QVariant(), SIP_PYOBJECT type /TypeHint="type", TypeHintValue="None"/ = 0) const /ReleaseGIL/;
75%MethodCode
76        QVariant value;
77
78        // QSettings has an internal mutex so release the GIL to avoid the possibility
79        // of deadlocks.
80        Py_BEGIN_ALLOW_THREADS
81        value = sipCpp->value(*a0, *a1);
82        Py_END_ALLOW_THREADS
83
84        sipRes = pyqt5_from_qvariant_by_type(value, a2);
85
86        sipIsErr = !sipRes;
87%End
88
89    void remove(const QString &key) /ReleaseGIL/;
90    bool contains(const QString &key) const /ReleaseGIL/;
91    void setFallbacksEnabled(bool b);
92    bool fallbacksEnabled() const;
93    QString fileName() const;
94    static void setPath(QSettings::Format format, QSettings::Scope scope, const QString &path) /ReleaseGIL/;
95    QSettings::Format format() const;
96    QSettings::Scope scope() const;
97    QString organizationName() const;
98    QString applicationName() const;
99    static void setDefaultFormat(QSettings::Format format);
100    static QSettings::Format defaultFormat();
101    void setIniCodec(QTextCodec *codec /KeepReference/);
102    void setIniCodec(const char *codecName);
103    QTextCodec *iniCodec() const;
104%If (Qt_5_10_0 -)
105    bool isAtomicSyncRequired() const;
106%End
107%If (Qt_5_10_0 -)
108    void setAtomicSyncRequired(bool enable);
109%End
110
111protected:
112    virtual bool event(QEvent *event);
113};
114