<table><tr><td style="">broulik added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D3598" rel="noreferrer">View Revision</a></tr></table><br /><div><div><p>A bunch of nitpicks below. Haven't tried it yet, though :)</p>
<p>Is there a chance we could serve the novice user usecase of Meta+P and then *click* / choose the desired setup? As far as I can tell we only show "You now use $setup" but not "You can choose: [Clone, Left of, Internal only, External only, Right of]" (doesn't neccessarily have to be part of this patchset, obviously, just food for thought, and you know how obsessed I am with the Meta+P menu ;)</p></div></div><br /><div><strong>INLINE COMMENTS</strong><div><div style="margin: 6px 0 12px 0;"><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D3598#inline-14196" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">daemon.cpp:242-243</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; "> <span class="n">QDBusConnection</span><span style="color: #aa2211">::</span><span class="n">sessionBus</span><span class="p">().</span><span class="n">asyncCall</span><span class="p">(</span><span class="n">msg</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;">
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;">
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"><span class="p">}</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Superfluous lines</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D3598#inline-14197" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">daemon.cpp:283</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="n">QHash</span><span style="color: #aa2211"><</span><span class="n">Generator</span><span style="color: #aa2211">::</span><span class="n">DisplaySwitchAction</span><span class="p">,</span> <span class="n">QString</span><span style="color: #aa2211">></span> <span class="n">actionMessages</span><span class="p">({</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="p">{</span><span class="n">Generator</span><span style="color: #aa2211">::</span><span class="n">DisplaySwitchAction</span><span style="color: #aa2211">::</span><span class="n">None</span><span class="p">,</span> <span class="n">i18nc</span><span class="p">(</span><span style="color: #766510">"osd when displaybutton is pressed"</span><span class="p">,</span> <span style="color: #766510">"No Action"</span><span class="p">)},</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">static?</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D3598#inline-14198" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">daemon.cpp:287</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="p">{</span><span class="n">Generator</span><span style="color: #aa2211">::</span><span class="n">DisplaySwitchAction</span><span style="color: #aa2211">::</span><span class="n">ExtendToLeft</span><span class="p">,</span> <span class="n">i18nc</span><span class="p">(</span><span style="color: #766510">"osd when displaybutton is pressed"</span><span class="p">,</span> <span style="color: #766510">"Extend Left"</span><span class="p">)},</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="p">{</span><span class="n">Generator</span><span style="color: #aa2211">::</span><span class="n">DisplaySwitchAction</span><span style="color: #aa2211">::</span><span class="n">TurnOffEmbedded</span><span class="p">,</span> <span class="n">i18nc</span><span class="p">(</span><span style="color: #766510">"osd when displaybutton is pressed"</span><span class="p">,</span> <span style="color: #766510">"Embedded Off"</span><span class="p">)},</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="p">{</span><span class="n">Generator</span><span style="color: #aa2211">::</span><span class="n">DisplaySwitchAction</span><span style="color: #aa2211">::</span><span class="n">TurnOffExternal</span><span class="p">,</span> <span class="n">i18nc</span><span class="p">(</span><span style="color: #766510">"osd when displaybutton is pressed"</span><span class="p">,</span> <span style="color: #766510">"External Off"</span><span class="p">)},</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Not sure about "Embedded", perhaps "Internal"? Dunno.</p>
<p style="padding: 0; margin: 8px;">Also I'd rather turn the wording around, rather than "internal off" and "external off", say "external only" and "internal only"?</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D3598#inline-14199" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">daemon.cpp:291</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="p">});</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="n">QString</span> <span class="n">message</span> <span style="color: #aa2211">=</span> <span class="n">actionMessages</span><span class="p">.</span><span class="n">value</span><span class="p">(</span><span class="n">m_iteration</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">const &</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D3598#inline-14207" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">osd.cpp:32</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"><span style="color: #aa4000">namespace</span> <span class="n">KScreen</span> <span class="p">{</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">using namespace</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D3598#inline-14201" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">osd.cpp:37</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="p">,</span> <span class="n">m_output</span><span class="p">(</span><span class="n">output</span><span class="p">)</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="p">,</span> <span class="n">m_osdPath</span><span class="p">(</span><span class="n">QStandardPaths</span><span style="color: #aa2211">::</span><span class="n">locate</span><span class="p">(</span><span class="n">QStandardPaths</span><span style="color: #aa2211">::</span><span class="n">QStandardPaths</span><span style="color: #aa2211">::</span><span class="n">GenericDataLocation</span><span class="p">,</span> <span class="n">QStringLiteral</span><span class="p">(</span><span style="color: #766510">"kded_kscreen/qml/Osd.qml"</span><span class="p">)))</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="p">,</span> <span class="n">m_osdObject</span><span class="p">(</span><span style="color: #aa4000">new</span> <span class="n">KDeclarative</span><span style="color: #aa2211">::</span><span class="n">QmlObject</span><span class="p">(</span><span style="color: #aa4000">this</span><span class="p">))</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">You're only using it in the constructor, no need for it to be a member variable that stays around</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D3598#inline-14204" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">osd.cpp:38</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="p">,</span> <span class="n">m_osdPath</span><span class="p">(</span><span class="n">QStandardPaths</span><span style="color: #aa2211">::</span><span class="n">locate</span><span class="p">(</span><span class="n">QStandardPaths</span><span style="color: #aa2211">::</span><span class="n">QStandardPaths</span><span style="color: #aa2211">::</span><span class="n">GenericDataLocation</span><span class="p">,</span> <span class="n">QStringLiteral</span><span class="p">(</span><span style="color: #766510">"kded_kscreen/qml/Osd.qml"</span><span class="p">)))</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="p">,</span> <span class="n">m_osdObject</span><span class="p">(</span><span style="color: #aa4000">new</span> <span class="n">KDeclarative</span><span style="color: #aa2211">::</span><span class="n">QmlObject</span><span class="p">(</span><span style="color: #aa4000">this</span><span class="p">))</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"><span class="p">{</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Can we lazy-load this first time it is used? It's not like you often change screen setup</p>
<p style="padding: 0; margin: 8px;">Edit: nvm, saw later that you actually create the entire thing on demand</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D3598#inline-14202" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">osd.cpp:53</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span style="color: #aa4000">if</span> <span class="p">(</span><span style="color: #aa2211">!</span><span class="n">m_osdTimer</span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="n">m_osdTimer</span> <span style="color: #aa2211">=</span> <span style="color: #aa4000">new</span> <span class="n">QTimer</span><span class="p">(</span><span style="color: #aa4000">this</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Is always null here</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D3598#inline-14205" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">osd.cpp:85</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="p">}</span> <span style="color: #aa4000">else</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="n">realSize</span> <span style="color: #aa2211">=</span> <span class="n">QSize</span><span class="p">(</span><span class="n">mode</span><span style="color: #aa2211">-></span><span class="n">size</span><span class="p">().</span><span class="n">height</span><span class="p">(),</span> <span class="n">mode</span><span style="color: #aa2211">-></span><span class="n">size</span><span class="p">().</span><span class="n">width</span><span class="p">());</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="p">}</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">QSize has a transpose() method "Swaps the width and height values."</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D3598#inline-14206" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">osd.cpp:120</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span style="color: #74777d">// pukes loads of warnings into our logs</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span style="color: #aa4000">if</span> <span class="p">(</span><span class="n">qGuiApp</span><span style="color: #aa2211">-></span><span class="n">platformName</span><span class="p">()</span> <span style="color: #aa2211">==</span> <span class="n">QStringLiteral</span><span class="p">(</span><span style="color: #766510">"xcb"</span><span class="p">))</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="n">rootObject</span><span style="color: #aa2211">-></span><span class="n">setProperty</span><span class="p">(</span><span style="color: #766510">"animateOpacity"</span><span class="p">,</span> <span style="color: #304a96">false</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Compare with QL1S - in case you have KWindowSystem you can ask it</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D3598#inline-14200" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">osd.h:47</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span style="color: #aa4000">void</span> <span style="color: #004012">showOutputIdentifier</span><span class="p">(</span><span style="color: #aa4000">const</span> <span class="n">KScreen</span><span style="color: #aa2211">::</span><span class="n">OutputPtr</span> <span class="n">output</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Superfluous line</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D3598#inline-14208" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">osd.h:49</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"><span class="n">private</span> <span style="color: #a0a000">Q_SLOTS</span><span class="p">:</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span style="color: #aa4000">void</span> <span class="n">hideOsd</span><span class="p">();</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Doesn't have to be a slot with new connect syntax</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D3598#inline-14215" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">osdmanager.cpp:21</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"><span style="color: #304a96">#include</span> <span class="cpf">"osd.h"</span><span style="color: #304a96"></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"><span style="color: #304a96">#include</span> <span class="cpf">"debug.h"</span><span style="color: #304a96"></span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Unused?</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D3598#inline-14209" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">osdmanager.cpp:31</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"><span class="n">OsdManager</span><span style="color: #aa2211">*</span> <span class="n">OsdManager</span><span style="color: #aa2211">::</span><span class="n">m_instance</span> <span style="color: #aa2211">=</span> <span style="color: #601200">0</span><span class="p">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">nullptr, also s_ prefix since it's static</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D3598#inline-14210" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">osdmanager.cpp:41</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="n">connect</span><span class="p">(</span><span class="n">m_cleanupTimer</span><span class="p">,</span> <span style="color: #aa2211">&</span><span class="n">QTimer</span><span style="color: #aa2211">::</span><span class="n">timeout</span><span class="p">,</span> <span style="color: #aa4000">this</span><span class="p">,</span> <span class="p">[</span><span style="color: #aa4000">this</span><span class="p">]()</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="n">qDeleteAll</span><span class="p">(</span><span class="n">m_osds</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="n">m_osds</span><span class="p">.</span><span class="n">end</span><span class="p">());</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="n">m_osds</span><span class="p">.</span><span class="n">clear</span><span class="p">();</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">There's a a qDeleteAll(m_osds) that does begin() and end() for you</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D3598#inline-14214" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">osdmanager.cpp:44</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="p">});</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="n">QDBusConnection</span><span style="color: #aa2211">::</span><span class="n">sessionBus</span><span class="p">().</span><span class="n">registerObject</span><span class="p">(</span><span class="n">QStringLiteral</span><span class="p">(</span><span style="color: #766510">"/org/kde/kscreen/osdService"</span><span class="p">),</span> <span style="color: #aa4000">this</span><span class="p">,</span> <span class="n">QDBusConnection</span><span style="color: #aa2211">::</span><span class="n">ExportAllSlots</span> <span style="color: #aa2211">|</span> <span class="n">QDBusConnection</span><span style="color: #aa2211">::</span><span class="n">ExportAllSignals</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"><span class="p">}</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">There are no signals in this class</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D3598#inline-14212" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">osdmanager.cpp:78</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="n">KScreen</span><span style="color: #aa2211">::</span><span class="n">Osd</span><span style="color: #aa2211">*</span> <span class="n">osd</span> <span style="color: #aa2211">=</span> <span style="color: #aa4000">nullptr</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span style="color: #aa4000">if</span> <span class="p">(</span><span class="n">m_osds</span><span class="p">.</span><span class="n">keys</span><span class="p">().</span><span class="n">contains</span><span class="p">(</span><span class="n">output</span><span style="color: #aa2211">-></span><span class="n">name</span><span class="p">()))</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="n">osd</span> <span style="color: #aa2211">=</span> <span class="n">m_osds</span><span class="p">.</span><span class="n">value</span><span class="p">(</span><span class="n">output</span><span style="color: #aa2211">-></span><span class="n">name</span><span class="p">());</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">QMap::contains(key), no need for keys()</p>
<p style="padding: 0; margin: 8px;">Also, better use (const)Find to avoid double loop-up (once for contains and once for value)</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D3598#inline-14216" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">osdmanager.cpp:99</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span style="color: #aa4000">const</span> <span class="n">KScreen</span><span style="color: #aa2211">::</span><span class="n">ConfigPtr</span> <span class="n">config</span> <span style="color: #aa2211">=</span> <span class="n">qobject_cast</span><span style="color: #aa2211"><</span><span class="n">KScreen</span><span style="color: #aa2211">::</span><span class="n">GetConfigOperation</span><span style="color: #aa2211">*></span><span class="p">(</span><span class="n">op</span><span class="p">)</span><span style="color: #aa2211">-></span><span class="n">config</span><span class="p">();</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Can you perhaps put that stuff into a separate function to avoid code duplication - the loops are almost identical</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D3598#inline-14217" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">Osd.qml:57</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span style="color: #aa4000">if</span> <span class="p">(</span><span style="color: #004012">item</span> <span style="color: #aa2211">!=</span> <span style="color: #000a65">undefined</span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span style="color: #004012">item</span><span class="p">.</span><span style="color: #004012">rootItem</span> <span style="color: #aa2211">=</span> <span style="color: #004012">root</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="p">}</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Not really happy with this "rootItem" property but then David told us that randomly accessing properties outside a file is bad, too ;)</p>
<p style="padding: 0; margin: 8px;">Perhaps try</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">Loader setSource(source, {rootItem: root})</pre></div>
<p style="padding: 0; margin: 8px;">so the item is already created with that property set, avoids warnings and/or <tt style="background: #ebebeb; font-size: 13px;">foo ? foo.bar : null</tt> dance and re-evaluations</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D3598#inline-14218" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">OsdItem.qml:55</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span class="p">}</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"> <span style="color: #aa4000">Component.onCompleted:</span> <span style="color: #004012">print</span><span class="p">(</span><span style="color: #766510">"osditem loaded..."</span> <span style="color: #aa2211">+</span> <span style="color: #004012">root</span><span class="p">.</span><span style="color: #004012">infoText</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">;)</p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R104 KScreen</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D3598" rel="noreferrer">https://phabricator.kde.org/D3598</a></div></div><br /><div><strong>EMAIL PREFERENCES</strong><div><a href="https://phabricator.kde.org/settings/panel/emailpreferences/" rel="noreferrer">https://phabricator.kde.org/settings/panel/emailpreferences/</a></div></div><br /><div><strong>To: </strong>sebas, Plasma<br /><strong>Cc: </strong>broulik, plasma-devel, davidedmundson, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas<br /></div>