<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<!-- util.cpp -->
  <title>Util Class | ScreenPlay</title>
<link rel="stylesheet" type="text/css" href="../css/style.css"/> <link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css"/>
</head>
<body>
<div class="container-fullwidth nav sticky-top"><div class="container navWrapper"><a href="../index.html"><span class="logo">ScreenPlay Generated Docs </span></a><span class="navHome"><a href="../index.html">Home</a></span></div></div> <div id= mainWrapper class="wrapper container ">
<li>Util</li>
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#public-slots">Public Slots</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Util Class</h1>
<span class="small-subtitle">class <a href="screenplay-module.html">ScreenPlay</a>::Util</span>
<!-- $$$Util-brief -->
<p>Easy to use global object to use when certain functionality is not available in QML. <a href="#details">More...</a></p>
<!-- @@@Util -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include &lt;Util&gt;</span>
</td></tr></table></div><ul>
<li><a href="screenplay-util-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="screenplay-util.html#Util">Util</a></b>(QNetworkAccessManager *<i>networkAccessManager</i>, QObject *<i>parent</i> = nullptr)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="screenplay-util.html#debugMessages-prop">debugMessages</a></b>() const</td></tr>
</table></div>
<a name="public-slots"></a>
<h2 id="public-slots">Public Slots</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="screenplay-util.html#copyPreviewThumbnail">copyPreviewThumbnail</a></b>(QJsonObject &amp;<i>obj</i>, const QString &amp;<i>previewThumbnail</i>, const QString &amp;<i>destination</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="screenplay-util.html#copyToClipboard">copyToClipboard</a></b>(const QString &amp;<i>text</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="screenplay-util.html#logToGui">logToGui</a></b>(QtMsgType <i>type</i>, const QMessageLogContext &amp;<i>context</i>, const QString &amp;<i>msg</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="screenplay-util.html#openFolderInExplorer">openFolderInExplorer</a></b>(const QString &amp;<i>url</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="screenplay-util.html#requestAllLicenses">requestAllLicenses</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="screenplay-util.html#requestDataProtection">requestDataProtection</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="screenplay-util.html#writeFile">writeFile</a></b>(const QString &amp;<i>text</i>, const QString &amp;<i>absolutePath</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="screenplay-util.html#writeFileFromQrc">writeFileFromQrc</a></b>(const QString &amp;<i>qrcPath</i>, const QString &amp;<i>absolutePath</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="screenplay-util.html#writeJsonObjectToFile">writeJsonObjectToFile</a></b>(const QString &amp;<i>absoluteFilePath</i>, const QJsonObject &amp;<i>object</i>, bool <i>truncate</i> = true)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="screenplay-util.html#writeSettings">writeSettings</a></b>(const QJsonObject &amp;<i>obj</i>, const QString &amp;<i>absolutePath</i>)</td></tr>
</table></div>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="screenplay-util.html#debugMessages-prop">debugMessagesChanged</a></b>(QString <i>debugMessages</i>)</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$Util-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
</div>
<!-- @@@Util -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$Util[overload1]$$$UtilQNetworkAccessManager*QObject* -->
<h3 class="fn" id="Util"><a name="Util"></a>Util::<span class="name">Util</span>(<span class="type">QNetworkAccessManager</span> *<i>networkAccessManager</i>, <span class="type">QObject</span> *<i>parent</i> = nullptr)</h3>
<p>Constructor.</p>
<!-- @@@Util -->
<!-- $$$copyPreviewThumbnail[overload1]$$$copyPreviewThumbnailQJsonObject&constQString&constQString& -->
<h3 class="fn" id="copyPreviewThumbnail"><a name="copyPreviewThumbnail"></a><code>[static slot] </code><span class="type">bool</span> Util::<span class="name">copyPreviewThumbnail</span>(<span class="type">QJsonObject</span> &amp;<i>obj</i>, const <span class="type">QString</span> &amp;<i>previewThumbnail</i>, const <span class="type">QString</span> &amp;<i>destination</i>)</h3>
<p>Takes reference to <i>obj</i>. If the copy of the thumbnail is successful, it adds the corresponding settings entry to the json object reference.</p>
<!-- @@@copyPreviewThumbnail -->
<!-- $$$copyToClipboard[overload1]$$$copyToClipboardconstQString& -->
<h3 class="fn" id="copyToClipboard"><a name="copyToClipboard"></a><code>[slot] </code><span class="type">void</span> Util::<span class="name">copyToClipboard</span>(const <span class="type">QString</span> &amp;<i>text</i>) const</h3>
<p>Copies the given string to the clipboard.</p>
<!-- @@@copyToClipboard -->
<!-- $$$logToGui[overload1]$$$logToGuiQtMsgTypeconstQMessageLogContext&constQString& -->
<h3 class="fn" id="logToGui"><a name="logToGui"></a><code>[static slot] </code><span class="type">void</span> Util::<span class="name">logToGui</span>(<span class="type">QtMsgType</span> <i>type</i>, const <span class="type">QMessageLogContext</span> &amp;<i>context</i>, const <span class="type">QString</span> &amp;<i>msg</i>)</h3>
<p>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.</p>
<!-- @@@logToGui -->
<!-- $$$openFolderInExplorer[overload1]$$$openFolderInExplorerconstQString& -->
<h3 class="fn" id="openFolderInExplorer"><a name="openFolderInExplorer"></a><code>[slot] </code><span class="type">void</span> Util::<span class="name">openFolderInExplorer</span>(const <span class="type">QString</span> &amp;<i>url</i>) const</h3>
<p>Opens a native folder window on the given path. Windows and Mac only for now!</p>
<!-- @@@openFolderInExplorer -->
<!-- $$$requestAllLicenses[overload1]$$$requestAllLicenses -->
<h3 class="fn" id="requestAllLicenses"><a name="requestAllLicenses"></a><code>[slot] </code><span class="type">void</span> Util::<span class="name">requestAllLicenses</span>()</h3>
<p>Loads all content of the legal folder in the qrc into a property string of this class. allLicenseLoaded is emited when loading is finished.</p>
<!-- @@@requestAllLicenses -->
<!-- $$$requestDataProtection[overload1]$$$requestDataProtection -->
<h3 class="fn" id="requestDataProtection"><a name="requestDataProtection"></a><code>[slot] </code><span class="type">void</span> Util::<span class="name">requestDataProtection</span>()</h3>
<p>Loads all dataprotection of the legal folder in the qrc into a property string of this class. allDataProtectionLoaded is emited when loading is finished.</p>
<!-- @@@requestDataProtection -->
<!-- $$$writeFile[overload1]$$$writeFileconstQString&constQString& -->
<h3 class="fn" id="writeFile"><a name="writeFile"></a><code>[static slot] </code><span class="type">bool</span> Util::<span class="name">writeFile</span>(const <span class="type">QString</span> &amp;<i>text</i>, const <span class="type">QString</span> &amp;<i>absolutePath</i>)</h3>
<p>Tries to save into a text file with absolute path.</p>
<!-- @@@writeFile -->
<!-- $$$writeFileFromQrc[overload1]$$$writeFileFromQrcconstQString&constQString& -->
<h3 class="fn" id="writeFileFromQrc"><a name="writeFileFromQrc"></a><code>[static slot] </code><span class="type">bool</span> Util::<span class="name">writeFileFromQrc</span>(const <span class="type">QString</span> &amp;<i>qrcPath</i>, const <span class="type">QString</span> &amp;<i>absolutePath</i>)</h3>
<p>Tries to save into a text file with absolute path.</p>
<!-- @@@writeFileFromQrc -->
<!-- $$$writeJsonObjectToFile[overload1]$$$writeJsonObjectToFileconstQString&constQJsonObject&bool -->
<h3 class="fn" id="writeJsonObjectToFile"><a name="writeJsonObjectToFile"></a><code>[static slot] </code><span class="type">bool</span> Util::<span class="name">writeJsonObjectToFile</span>(const <span class="type">QString</span> &amp;<i>absoluteFilePath</i>, const <span class="type">QJsonObject</span> &amp;<i>object</i>, <span class="type">bool</span> <i>truncate</i> = true)</h3>
<p>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.</p>
<!-- @@@writeJsonObjectToFile -->
<!-- $$$writeSettings[overload1]$$$writeSettingsconstQJsonObject&constQString& -->
<h3 class="fn" id="writeSettings"><a name="writeSettings"></a><code>[static slot] </code><span class="type">bool</span> Util::<span class="name">writeSettings</span>(const <span class="type">QJsonObject</span> &amp;<i>obj</i>, const <span class="type">QString</span> &amp;<i>absolutePath</i>)</h3>
<p>Takes ownership of <i>obj</i> and <i>name</i>. Tries to save into a text file with of name.</p>
<!-- @@@writeSettings -->
</div>
<div id= license  class="footer center"><p>This documentation is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.</p></div> <script src="../js/bootstrap.bundle.min.js"></script> <script src="../js/mermaid.min.js"></script> <script>var config = {startOnLoad:true,flowchart:{useMaxWidth:true,htmlLabels:true}};mermaid.initialize(config);</script></body>
</html>
