18#include <emscripten.h>
19#include <emscripten/val.h>
50 val m_localStorage = val::global(
"window")[
"localStorage"];
75 m_keyPrefix = prefix + escapedOrganization + separator + escapedApplication + separator;
88 m_localStorage.call<
void>(
"setItem",
keyString, valueString);
106 const int length = m_localStorage[
"length"].as<
int>();
114 if (!
key.startsWith(prefix))
126 const int length = m_localStorage[
"length"].as<
int>();
127 std::vector<std::string>
keys;
130 std::string
key = (m_localStorage.call<
val>(
"key",
i).as<std::string>());
131 keys.push_back(std::move(
key));
139 m_localStorage.call<
val>(
"removeItem",
key);
157QString QWasmLocalStorageSettingsPrivate::prependStoragePrefix(
const QString &
key)
const
159 return m_keyPrefix +
key;
165 if (!
key.startsWith(m_keyPrefix))
182 std::optional<QVariant>
get(
const QString &
key)
const override;
184 void clear()
override;
185 void sync()
override;
186 void flush()
override;
252 databaseName = organization;
255 emscripten_idb_async_exists(
"/home/web_user",
257 reinterpret_cast<void*
>(
this),
269 if (QWasmIDBSettingsPrivate::liveSettings.
contains(userData))
296 emscripten_idb_async_delete(
"/home/web_user",
298 reinterpret_cast<void*
>(
this),
311 emscripten_idb_async_store(
"/home/web_user",
313 reinterpret_cast<void *
>(dataPointer.
data()),
315 reinterpret_cast<void*
>(
this),
339 emscripten_idb_async_store(
"/home/web_user",
341 reinterpret_cast<void *
>(
data.data()),
343 reinterpret_cast<void*
>(
this),
352 emscripten_idb_async_load(
"/home/web_user",
354 reinterpret_cast<void*
>(
this),
377 const bool cookiesEnabled = val::global(
"navigator")[
"cookieEnabled"].as<
bool>();
379 (
"QSettings::%1 requires cookies, falling back to IniFormat with temporary file");
380 if (
format == WebLocalStorageFormat && !cookiesEnabled) {
381 qWarning() << cookiesWarningMessage.arg(
"WebLocalStorageFormat");
383 }
else if (
format == WebIdbFormat && !cookiesEnabled) {
384 qWarning() << cookiesWarningMessage.arg(
"WebIdbFormat");
389 if (
format == WebLocalStorageFormat) {
391 }
else if (
format == WebIdbFormat) {
char * data()
\macro QT_NO_CAST_FROM_BYTEARRAY
qsizetype length() const noexcept
Same as size().
virtual void initAccess()
bool isWritable() const override
QString fileName() const override
std::optional< QVariant > get(const QString &key) const override
void close() override
Calls QFileDevice::flush() and closes the file.
\inmodule QtCore \reentrant
QString path() const
Returns the file's path.
bool open(OpenMode flags) override
Opens the file using OpenMode mode, returning true if successful; otherwise false.
QByteArray readAll()
Reads all remaining data from the device, and returns it as a byte array.
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
constexpr qsizetype length() const noexcept
void push_back(parameter_type t)
qsizetype removeAll(const AT &t)
static QSettingsPrivate * create(QSettings::Format format, QSettings::Scope scope, const QString &organization, const QString &application)
void setStatus(QSettings::Status status) const
static QVariant stringToVariant(const QString &s)
static QString variantToString(const QVariant &v)
static void processChild(QStringView key, ChildSpec spec, QStringList &result)
Format
This enum type specifies the storage format used by QSettings.
Scope
This enum specifies whether settings are user-specific or shared by all users of the same system.
QString fileName() const
Returns the path where settings written using this QSettings object are stored.
constexpr bool isEmpty() const noexcept
Returns whether this string view is empty - that is, whether {size() == 0}.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString & replace(qsizetype i, qsizetype len, QChar after)
void reserve(qsizetype size)
Ensures the string has space for at least size characters.
static QString fromStdString(const std::string &s)
std::string toStdString() const
Returns a std::string object with the data contained in this QString.
QByteArray toLocal8Bit() const &
qsizetype length() const
Returns the number of characters in this string.
void initAccess() override
bool isWritable() const override
void loadLocal(const QByteArray &filename)
void syncToLocal(const char *data, int size)
~QWasmIDBSettingsPrivate()
static QWasmIDBSettingsPrivate * get(void *userData)
QWasmIDBSettingsPrivate(QSettings::Scope scope, const QString &organization, const QString &application)
std::optional< QVariant > get(const QString &key) const final
bool isWritable() const final
QWasmLocalStorageSettingsPrivate(QSettings::Scope scope, const QString &organization, const QString &application)
void remove(const QString &key) final
void set(const QString &key, const QVariant &value) final
QString fileName() const final
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
static bool contains(const QJsonArray &haystack, unsigned needle)
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLenum GLsizei length
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLsizei GLsizei GLenum format
static QString keyString(int sym, QChar::Category category)
static void QWasmIDBSettingsPrivate_onError(void *userData)
static void QWasmIDBSettingsPrivate_onLoad(void *userData, void *dataPtr, int size)
static void QWasmIDBSettingsPrivate_onCheck(void *userData, int exists)
static void QWasmIDBSettingsPrivate_onStore(void *userData)
static char * toLocal8Bit(char *out, QStringView in, QStringConverter::State *state)
QFuture< QSet< QChar > > set
[10]
QSettings settings("MySoft", "Star Runner")
[0]