<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<!-- util.cpp -->
  <title>ScreenPlayUtil Namespace | 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 ">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#functions">Functions</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">ScreenPlayUtil Namespace</h1>
<!-- $$$ScreenPlayUtil-brief -->
<p>Namespace for ScreenPlayUtil. <a href="#details">More...</a></p>
<!-- @@@ScreenPlayUtil -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include &lt;ScreenPlayUtil&gt;</span>
</td></tr></table></div><ul>
</ul>
<a name="functions"></a>
<h2 id="functions">Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="screenplayutil.html#executableEnding">executableEnding</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QJsonArray </td><td class="memItemRight bottomAlign"><b><a href="screenplayutil.html#fillArray">fillArray</a></b>(const QVector&lt;QString&gt; &amp;<i>items</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="screenplayutil.html#generateRandomString">generateRandomString</a></b>(quint32 <i>length</i> = 32)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="screenplayutil.html#getAvailableFillModes">getAvailableFillModes</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="screenplayutil.html#getAvailableTypes">getAvailableTypes</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="screenplayutil.html#getAvailableWallpaper">getAvailableWallpaper</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="screenplayutil.html#getAvailableWidgets">getAvailableWidgets</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> std::optional&lt;ScreenPlay::InstalledType::InstalledType&gt; </td><td class="memItemRight bottomAlign"><b><a href="screenplayutil.html#getInstalledTypeFromString">getInstalledTypeFromString</a></b>(const QString &amp;<i>type</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> ScreenPlay::SearchType::SearchType </td><td class="memItemRight bottomAlign"><b><a href="screenplayutil.html#getSearchTypeFromInstalledType">getSearchTypeFromInstalledType</a></b>(const ScreenPlay::InstalledType::InstalledType <i>type</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> std::optional&lt;QVersionNumber&gt; </td><td class="memItemRight bottomAlign"><b><a href="screenplayutil.html#getVersionNumberFromString">getVersionNumberFromString</a></b>(const QString &amp;<i>str</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="screenplayutil.html#isWallpaper">isWallpaper</a></b>(const ScreenPlay::InstalledType::InstalledType <i>type</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="screenplayutil.html#isWidget">isWidget</a></b>(const ScreenPlay::InstalledType::InstalledType <i>type</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> std::optional&lt;QJsonObject&gt; </td><td class="memItemRight bottomAlign"><b><a href="screenplayutil.html#openJsonFileToObject">openJsonFileToObject</a></b>(const QString &amp;<i>path</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> std::optional&lt;QString&gt; </td><td class="memItemRight bottomAlign"><b><a href="screenplayutil.html#openJsonFileToString">openJsonFileToString</a></b>(const QString &amp;<i>path</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> std::optional&lt;QJsonObject&gt; </td><td class="memItemRight bottomAlign"><b><a href="screenplayutil.html#parseQByteArrayToQJsonObject">parseQByteArrayToQJsonObject</a></b>(const QByteArray &amp;<i>byteArray</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> std::optional&lt;QVector&lt;int&gt;&gt; </td><td class="memItemRight bottomAlign"><b><a href="screenplayutil.html#parseStringToIntegerList">parseStringToIntegerList</a></b>(const QString <i>string</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="screenplayutil.html#toLocal">toLocal</a></b>(const QString &amp;<i>url</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="screenplayutil.html#toString">toString</a></b>(const QStringList &amp;<i>list</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="screenplayutil.html#writeJsonObjectToFile">writeJsonObjectToFile</a></b>(const QString &amp;<i>absoluteFilePath</i>, const QJsonObject &amp;<i>object</i>, bool <i>truncate</i> = true)</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$ScreenPlayUtil-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
</div>
<!-- @@@ScreenPlayUtil -->
<div class="func">
<h2>Function Documentation</h2>
<!-- $$$executableEnding[overload1]$$$executableEnding -->
<h3 class="fn" id="executableEnding"><a name="executableEnding"></a><span class="type">QString</span> ScreenPlayUtil::<span class="name">executableEnding</span>()</h3>
<p>Return .exe in windows otherwise empty string.</p>
<!-- @@@executableEnding -->
<!-- $$$fillArray[overload1]$$$fillArrayconstQVector<QString>& -->
<h3 class="fn" id="fillArray"><a name="fillArray"></a><span class="type">QJsonArray</span> ScreenPlayUtil::<span class="name">fillArray</span>(const <span class="type">QVector</span>&lt;<span class="type">QString</span>&gt; &amp;<i>items</i>)</h3>
<p>Util function that converts a QVector of Strings into a QJsonArray.</p>
<!-- @@@fillArray -->
<!-- $$$generateRandomString[overload1]$$$generateRandomStringquint32 -->
<h3 class="fn" id="generateRandomString"><a name="generateRandomString"></a><span class="type">QString</span> ScreenPlayUtil::<span class="name">generateRandomString</span>(<span class="type">quint32</span> <i>length</i> = 32)</h3>
<p>Generates a (non secure) random string with the default length of 32. Can contain:</p>
<ul>
<li>A-Z</li>
<li>a-z</li>
<li>0-9</li>
</ul>
<!-- @@@generateRandomString -->
<!-- $$$getAvailableFillModes[overload1]$$$getAvailableFillModes -->
<h3 class="fn" id="getAvailableFillModes"><a name="getAvailableFillModes"></a><span class="type">QStringList</span> ScreenPlayUtil::<span class="name">getAvailableFillModes</span>()</h3>
<p>See https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit</p>
<!-- @@@getAvailableFillModes -->
<!-- $$$getAvailableTypes[overload1]$$$getAvailableTypes -->
<h3 class="fn" id="getAvailableTypes"><a name="getAvailableTypes"></a><span class="type">QStringList</span> ScreenPlayUtil::<span class="name">getAvailableTypes</span>()</h3>
<p>.</p>
<!-- @@@getAvailableTypes -->
<!-- $$$getAvailableWallpaper[overload1]$$$getAvailableWallpaper -->
<h3 class="fn" id="getAvailableWallpaper"><a name="getAvailableWallpaper"></a><span class="type">QStringList</span> ScreenPlayUtil::<span class="name">getAvailableWallpaper</span>()</h3>
<p>.</p>
<!-- @@@getAvailableWallpaper -->
<!-- $$$getAvailableWidgets[overload1]$$$getAvailableWidgets -->
<h3 class="fn" id="getAvailableWidgets"><a name="getAvailableWidgets"></a><span class="type">QStringList</span> ScreenPlayUtil::<span class="name">getAvailableWidgets</span>()</h3>
<p>.</p>
<!-- @@@getAvailableWidgets -->
<!-- $$$getInstalledTypeFromString[overload1]$$$getInstalledTypeFromStringconstQString& -->
<h3 class="fn" id="getInstalledTypeFromString"><a name="getInstalledTypeFromString"></a><span class="type">std::optional</span>&lt;<span class="type">ScreenPlay::InstalledType::InstalledType</span>&gt; ScreenPlayUtil::<span class="name">getInstalledTypeFromString</span>(const <span class="type">QString</span> &amp;<i>type</i>)</h3>
<p>Maps the installed type from a QString to an enum. Used for parsing the project.json.</p>
<!-- @@@getInstalledTypeFromString -->
<!-- $$$getSearchTypeFromInstalledType[overload1]$$$getSearchTypeFromInstalledTypeconstScreenPlay::InstalledType::InstalledType -->
<h3 class="fn" id="getSearchTypeFromInstalledType"><a name="getSearchTypeFromInstalledType"></a><span class="type">ScreenPlay::SearchType::SearchType</span> ScreenPlayUtil::<span class="name">getSearchTypeFromInstalledType</span>(const <span class="type">ScreenPlay::InstalledType::InstalledType</span> <i>type</i>)</h3>
<p>Maps the Search type to an installed type. Used for filtering the installed content.</p>
<!-- @@@getSearchTypeFromInstalledType -->
<!-- $$$getVersionNumberFromString[overload1]$$$getVersionNumberFromStringconstQString& -->
<h3 class="fn" id="getVersionNumberFromString"><a name="getVersionNumberFromString"></a><span class="type">std::optional</span>&lt;<span class="type">QVersionNumber</span>&gt; ScreenPlayUtil::<span class="name">getVersionNumberFromString</span>(const <span class="type">QString</span> &amp;<i>str</i>)</h3>
<p>Parses a version from a given QString. The QString must be looke like this: 1.0&#x2e;0 - Major.Minor.Patch. A fixed position is used for parsing (at 0,2,4). Return std::nullopt when not successful.</p>
<!-- @@@getVersionNumberFromString -->
<!-- $$$isWallpaper[overload1]$$$isWallpaperconstScreenPlay::InstalledType::InstalledType -->
<h3 class="fn" id="isWallpaper"><a name="isWallpaper"></a><span class="type">bool</span> ScreenPlayUtil::<span class="name">isWallpaper</span>(const <span class="type">ScreenPlay::InstalledType::InstalledType</span> <i>type</i>)</h3>
<p>.</p>
<!-- @@@isWallpaper -->
<!-- $$$isWidget[overload1]$$$isWidgetconstScreenPlay::InstalledType::InstalledType -->
<h3 class="fn" id="isWidget"><a name="isWidget"></a><span class="type">bool</span> ScreenPlayUtil::<span class="name">isWidget</span>(const <span class="type">ScreenPlay::InstalledType::InstalledType</span> <i>type</i>)</h3>
<p>.</p>
<!-- @@@isWidget -->
<!-- $$$openJsonFileToObject[overload1]$$$openJsonFileToObjectconstQString& -->
<h3 class="fn" id="openJsonFileToObject"><a name="openJsonFileToObject"></a><span class="type">std::optional</span>&lt;<span class="type">QJsonObject</span>&gt; ScreenPlayUtil::<span class="name">openJsonFileToObject</span>(const <span class="type">QString</span> &amp;<i>path</i>)</h3>
<p>Opens a json file (absolute path) and tries to convert it to a QJsonObject. Returns std::nullopt when not successful.</p>
<!-- @@@openJsonFileToObject -->
<!-- $$$openJsonFileToString[overload1]$$$openJsonFileToStringconstQString& -->
<h3 class="fn" id="openJsonFileToString"><a name="openJsonFileToString"></a><span class="type">std::optional</span>&lt;<span class="type">QString</span>&gt; ScreenPlayUtil::<span class="name">openJsonFileToString</span>(const <span class="type">QString</span> &amp;<i>path</i>)</h3>
<p>Opens a json file (absolute path) and tries to convert it to a QString. Returns std::nullopt when not successful.</p>
<!-- @@@openJsonFileToString -->
<!-- $$$parseQByteArrayToQJsonObject[overload1]$$$parseQByteArrayToQJsonObjectconstQByteArray& -->
<h3 class="fn" id="parseQByteArrayToQJsonObject"><a name="parseQByteArrayToQJsonObject"></a><span class="type">std::optional</span>&lt;<span class="type">QJsonObject</span>&gt; ScreenPlayUtil::<span class="name">parseQByteArrayToQJsonObject</span>(const <span class="type">QByteArray</span> &amp;<i>byteArray</i>)</h3>
<p>Parses a QByteArray to a QJsonObject. If returns and std::nullopt on failure.</p>
<!-- @@@parseQByteArrayToQJsonObject -->
<!-- $$$parseStringToIntegerList[overload1]$$$parseStringToIntegerListconstQString -->
<h3 class="fn" id="parseStringToIntegerList"><a name="parseStringToIntegerList"></a><span class="type">std::optional</span>&lt;<span class="type">QVector</span>&lt;<span class="type">int</span>&gt;&gt; ScreenPlayUtil::<span class="name">parseStringToIntegerList</span>(const <span class="type">QString</span> <i>string</i>)</h3>
<p>parseIntList parses a list of string separated with a comma &quot;1,2,3&quot;. IMPORTANT: No trailing comma!</p>
<!-- @@@parseStringToIntegerList -->
<!-- $$$toLocal[overload1]$$$toLocalconstQString& -->
<h3 class="fn" id="toLocal"><a name="toLocal"></a><span class="type">QString</span> ScreenPlayUtil::<span class="name">toLocal</span>(const <span class="type">QString</span> &amp;<i>url</i>)</h3>
<p>Converts the given <i>url</i> string to a local file path.</p>
<!-- @@@toLocal -->
<!-- $$$toString[overload1]$$$toStringconstQStringList& -->
<h3 class="fn" id="toString"><a name="toString"></a><span class="type">QString</span> ScreenPlayUtil::<span class="name">toString</span>(const <span class="type">QStringList</span> &amp;<i>list</i>)</h3>
<p>Helper function to append a QStringList into a QString with a space between the items.</p>
<!-- @@@toString -->
<!-- $$$writeJsonObjectToFile[overload1]$$$writeJsonObjectToFileconstQString&constQJsonObject&bool -->
<h3 class="fn" id="writeJsonObjectToFile"><a name="writeJsonObjectToFile"></a><span class="type">bool</span> ScreenPlayUtil::<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>.</p>
<!-- @@@writeJsonObjectToFile -->
</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>
