• Util
  • Util Class

    class ScreenPlay::Util

    Easy to use global object to use when certain functionality is not available in QML. More...

    Header: #include <Util>

    Public Functions

    Util(QNetworkAccessManager *networkAccessManager, QObject *parent = nullptr)
    QString debugMessages() const

    Public Slots

    bool copyPreviewThumbnail(QJsonObject &obj, const QString &previewThumbnail, const QString &destination)
    void copyToClipboard(const QString &text) const
    void logToGui(QtMsgType type, const QMessageLogContext &context, const QString &msg)
    void openFolderInExplorer(const QString &url) const
    void requestAllLicenses()
    void requestDataProtection()
    bool writeFile(const QString &text, const QString &absolutePath)
    bool writeFileFromQrc(const QString &qrcPath, const QString &absolutePath)
    bool writeJsonObjectToFile(const QString &absoluteFilePath, const QJsonObject &object, bool truncate = true)
    bool writeSettings(const QJsonObject &obj, const QString &absolutePath)

    Signals

    void debugMessagesChanged(QString debugMessages)

    Detailed Description

    Member Function Documentation

    Util::Util(QNetworkAccessManager *networkAccessManager, QObject *parent = nullptr)

    Constructor.

    [static slot] bool Util::copyPreviewThumbnail(QJsonObject &obj, const QString &previewThumbnail, const QString &destination)

    Takes reference to obj. If the copy of the thumbnail is successful, it adds the corresponding settings entry to the json object reference.

    [slot] void Util::copyToClipboard(const QString &text) const

    Copies the given string to the clipboard.

    [static slot] void Util::logToGui(QtMsgType type, const QMessageLogContext &context, const QString &msg)

    Basic logging to the GUI. No logging is done to a log file for now. This string can be copied in the settings tab in the UI.

    [slot] void Util::openFolderInExplorer(const QString &url) const

    Opens a native folder window on the given path. Windows and Mac only for now!

    [slot] void Util::requestAllLicenses()

    Loads all content of the legal folder in the qrc into a property string of this class. allLicenseLoaded is emited when loading is finished.

    [slot] void Util::requestDataProtection()

    Loads all dataprotection of the legal folder in the qrc into a property string of this class. allDataProtectionLoaded is emited when loading is finished.

    [static slot] bool Util::writeFile(const QString &text, const QString &absolutePath)

    Tries to save into a text file with absolute path.

    [static slot] bool Util::writeFileFromQrc(const QString &qrcPath, const QString &absolutePath)

    Tries to save into a text file with absolute path.

    [static slot] bool Util::writeJsonObjectToFile(const QString &absoluteFilePath, const QJsonObject &object, bool truncate = true)

    Writes a given QJsonObject to a file. The path must be absolute. When truncate is set to true the exsisting json file will be overriten.

    [static slot] bool Util::writeSettings(const QJsonObject &obj, const QString &absolutePath)

    Takes ownership of obj and name. Tries to save into a text file with of name.