ScreenPlayUtil Namespace

Namespace for ScreenPlayUtil. More...

Header: #include <ScreenPlayUtil>

Functions

QString executableEnding()
QJsonArray fillArray(const QVector<QString> &items)
QString generateRandomString(quint32 length = 32)
QStringList getAvailableFillModes()
QStringList getAvailableTypes()
QStringList getAvailableWallpaper()
QStringList getAvailableWidgets()
std::optional<ScreenPlay::InstalledType::InstalledType> getInstalledTypeFromString(const QString &type)
ScreenPlay::SearchType::SearchType getSearchTypeFromInstalledType(const ScreenPlay::InstalledType::InstalledType type)
std::optional<QVersionNumber> getVersionNumberFromString(const QString &str)
bool isWallpaper(const ScreenPlay::InstalledType::InstalledType type)
bool isWidget(const ScreenPlay::InstalledType::InstalledType type)
std::optional<QJsonObject> openJsonFileToObject(const QString &path)
std::optional<QString> openJsonFileToString(const QString &path)
std::optional<QJsonObject> parseQByteArrayToQJsonObject(const QByteArray &byteArray)
std::optional<QVector<int>> parseStringToIntegerList(const QString string)
QString toLocal(const QString &url)
QString toString(const QStringList &list)
bool writeJsonObjectToFile(const QString &absoluteFilePath, const QJsonObject &object, bool truncate = true)

Detailed Description

Function Documentation

QString ScreenPlayUtil::executableEnding()

Return .exe in windows otherwise empty string.

QJsonArray ScreenPlayUtil::fillArray(const QVector<QString> &items)

Util function that converts a QVector of Strings into a QJsonArray.

QString ScreenPlayUtil::generateRandomString(quint32 length = 32)

Generates a (non secure) random string with the default length of 32. Can contain:

QStringList ScreenPlayUtil::getAvailableFillModes()

See https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit

QStringList ScreenPlayUtil::getAvailableTypes()

.

QStringList ScreenPlayUtil::getAvailableWallpaper()

.

QStringList ScreenPlayUtil::getAvailableWidgets()

.

std::optional<ScreenPlay::InstalledType::InstalledType> ScreenPlayUtil::getInstalledTypeFromString(const QString &type)

Maps the installed type from a QString to an enum. Used for parsing the project.json.

ScreenPlay::SearchType::SearchType ScreenPlayUtil::getSearchTypeFromInstalledType(const ScreenPlay::InstalledType::InstalledType type)

Maps the Search type to an installed type. Used for filtering the installed content.

std::optional<QVersionNumber> ScreenPlayUtil::getVersionNumberFromString(const QString &str)

Parses a version from a given QString. The QString must be looke like this: 1.0.0 - Major.Minor.Patch. A fixed position is used for parsing (at 0,2,4). Return std::nullopt when not successful.

bool ScreenPlayUtil::isWallpaper(const ScreenPlay::InstalledType::InstalledType type)

.

bool ScreenPlayUtil::isWidget(const ScreenPlay::InstalledType::InstalledType type)

.

std::optional<QJsonObject> ScreenPlayUtil::openJsonFileToObject(const QString &path)

Opens a json file (absolute path) and tries to convert it to a QJsonObject. Returns std::nullopt when not successful.

std::optional<QString> ScreenPlayUtil::openJsonFileToString(const QString &path)

Opens a json file (absolute path) and tries to convert it to a QString. Returns std::nullopt when not successful.

std::optional<QJsonObject> ScreenPlayUtil::parseQByteArrayToQJsonObject(const QByteArray &byteArray)

Parses a QByteArray to a QJsonObject. If returns and std::nullopt on failure.

std::optional<QVector<int>> ScreenPlayUtil::parseStringToIntegerList(const QString string)

parseIntList parses a list of string separated with a comma "1,2,3". IMPORTANT: No trailing comma!

QString ScreenPlayUtil::toLocal(const QString &url)

Converts the given url string to a local file path.

QString ScreenPlayUtil::toString(const QStringList &list)

Helper function to append a QStringList into a QString with a space between the items.

bool ScreenPlayUtil::writeJsonObjectToFile(const QString &absoluteFilePath, const QJsonObject &object, bool truncate = true)

.