<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/D9414" rel="noreferrer">View Revision</a></tr></table><br /><div><div><p>Cool.</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/D9414#inline-45608" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">daemon.cpp:188</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: rgba(151, 234, 151, .6);"><span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">self</span><span style="color: #aa2211">-></span><span class="n">deleteLater</span><span class="p">();</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">This makes me uneasy.</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/D9414#inline-45609" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">daemon.cpp:195</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: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">case</span> <span class="n">KScreen</span><span style="color: #aa2211">::</span><span class="n">OsdAction</span><span style="color: #aa2211">::</span><span style="color: #a0a000">SwitchToInternal</span><span class="p">:</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">qCDebug</span><span class="p">(</span><span class="n">KSCREEN_KDED</span><span class="p">)</span> <span style="color: #aa2211"><<</span> <span style="color: #766510">"OSD: swutch to internal"</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">doApplyConfig</span><span class="p">(</span><span class="n">Generator</span><span style="color: #aa2211">::</span><span class="n">self</span><span class="p">()</span><span style="color: #aa2211">-></span><span class="n">displaySwitch</span><span class="p">(</span><span class="n">Generator</span><span style="color: #aa2211">::</span><span class="n">TurnOffExternal</span><span class="p">));</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">switch</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/D9414#inline-45611" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">osd.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; "> <span class="n">m_osdObject</span><span style="color: #aa2211">-></span><span class="n">setSource</span><span class="p">(</span><span class="n">QUrl</span><span style="color: #aa2211">::</span><span class="n">fromLocalFile</span><span class="p">(</span><span class="n">osdPath</span><span class="p">));</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Can we change it to create the <tt style="background: #ebebeb; font-size: 13px;">QmlObject</tt> on demand the first time it's used?</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/D9414#inline-45610" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">osd.cpp:94</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: rgba(151, 234, 151, .6);"><span style="color: #aa4000">void</span> <span class="n">Osd</span><span style="color: #aa2211">::</span><span class="n">showActionSelector</span><span class="p">()</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">auto</span> <span style="color: #aa2211">*</span><span class="n">rootObject</span> <span style="color: #aa2211">=</span> <span class="n">m_osdObject</span><span style="color: #aa2211">-></span><span class="n">rootObject</span><span class="p">();</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Coding style, brace on next 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/D9414#inline-45612" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">osd.cpp:114-115</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: rgba(151, 234, 151, .6);"><span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">if</span> <span class="p">(</span><span class="n">m_output</span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">if</span> <span class="p">(</span><span style="color: #aa2211">!</span><span class="n">m_output</span><span style="color: #aa2211">-></span><span class="n">isConnected</span><span class="p">()</span> <span style="color: #aa2211">||</span> <span style="color: #aa2211">!</span><span class="n">m_output</span><span style="color: #aa2211">-></span><span class="n">isEnabled</span><span class="p">()</span> <span style="color: #aa2211">||</span> <span style="color: #aa2211">!</span><span class="n">m_output</span><span style="color: #aa2211">-></span><span class="n">currentMode</span><span class="p">())</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <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;">Can be simplified to</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);">if (!m_output || !m_output->isConnected() || ...)</pre></div></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/D9414#inline-45607" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">osdmanager.cpp:51</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: rgba(151, 234, 151, .6);"> <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="n">Action</span> <span class="n">action</span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">Q_EMIT</span> <span class="n">selected</span><span class="p">(</span><span style="color: #aa4000">this</span><span class="p">,</span> <span class="n">action</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="p">});</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Why do you pass <tt style="background: #ebebeb; font-size: 13px;">this</tt> in the signal?</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/D9414#inline-45613" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">osdmanager.cpp:60</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="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">qmlRegisterUncreatableType</span><span style="color: #aa2211"><</span><span class="n">OsdAction</span><span style="color: #aa2211">></span><span class="p">(</span><span style="color: #766510">"org.kde.KScreen"</span><span class="p">,</span> <span style="color: #601200">1</span><span class="p">,</span> <span style="color: #601200">0</span><span class="p">,</span> <span style="color: #766510">"OsdAction"</span><span class="p">,</span> <span style="color: #766510">"You cannot create OsdAction"</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Shouldn't it rather do that in the plugin's <tt style="background: #ebebeb; font-size: 13px;">registerTypes</tt>?</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/D9414#inline-45614" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">osdmanager.cpp:134</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">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: rgba(251, 175, 175, .7);"> <span style="color: #aa4000">if</span> <span class="p">(</span><span class="n">m_osds</span><span class="p">.<span class="bright"></span></span><span class="bright"></span><span class="n"><span class="bright">keys</span></span><span class="bright"></span><span class="p"><span class="bright">().</span></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: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">if</span> <span class="p">(</span><span class="n">m_osds</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; "> <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;">Can be simplified even further</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);">KScreen::Osd *osd = m_osds.value(output->name());
if (!osd) {
osd = new KScreen::Osd ...
...</pre></div></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/D9414#inline-45615" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">osdmanager.cpp:202</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: rgba(151, 234, 151, .6);"> <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: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">if</span> <span class="p">(</span><span class="n">m_osds</span><span class="p">.</span><span class="n">contains</span><span class="p">(</span><span class="n">osdOutput</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: rgba(151, 234, 151, .6);"> <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">osdOutput</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;">Simplify here too</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/D9414#inline-45616" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">OsdSelector.qml:42</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: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">height:</span> <span style="color: #004012">parent</span><span class="p">.</span><span style="color: #004012">height</span> <span style="color: #aa2211">-</span> <span style="color: #004012">label</span><span class="p">.</span><span style="color: #004012">height</span> <span style="color: #aa2211">-</span> <span class="p">((</span><span style="color: #004012">units</span><span class="p">.</span><span style="color: #004012">smallSpacing</span><span style="color: #aa2211">/</span><span style="color: #601200">2</span><span class="p">)</span> <span style="color: #aa2211">*</span> <span style="color: #601200">3</span><span class="p">)</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">width:</span> <span class="p">(</span><span style="color: #004012">actionRepeater</span><span class="p">.</span><span style="color: #004012">model</span><span class="p">.</span><span style="color: #004012">length</span> <span style="color: #aa2211">*</span> <span style="color: #004012">height</span><span class="p">)</span> <span style="color: #aa2211">+</span> <span class="p">((</span><span style="color: #004012">actionRepeater</span><span class="p">.</span><span style="color: #004012">model</span><span class="p">.</span><span style="color: #004012">length</span> <span style="color: #aa2211">-</span> <span style="color: #601200">1</span><span class="p">)</span> <span style="color: #aa2211">*</span> <span style="color: #004012">buttonRow</span><span class="p">.</span><span style="color: #004012">spacing</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;"><tt style="background: #ebebeb; font-size: 13px;">Repeater</tt> has a <tt style="background: #ebebeb; font-size: 13px;">count</tt> property, avoids copying that JS Array over just to get its length</p>
<p style="padding: 0; margin: 8px;">(also, urgh, I hoped <tt style="background: #ebebeb; font-size: 13px;">ButtonRow</tt> was smarter than that)</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/D9414#inline-45617" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">OsdSelector.qml:79</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: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">delegate:</span> <span style="color: #004012">PlasmaComponents</span><span class="p">.</span><span style="color: #004012">Button</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #004012">PlasmaCore</span><span class="p">.</span><span style="color: #004012">IconItem</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">source:</span> <span style="color: #004012">modelData</span><span class="p">.</span><span style="color: #004012">iconSource</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Why do you need an <tt style="background: #ebebeb; font-size: 13px;">IconItem</tt> inside? The <tt style="background: #ebebeb; font-size: 13px;">Button</tt> can have an icon of its own</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/D9414" rel="noreferrer">https://phabricator.kde.org/D9414</a></div></div><br /><div><strong>To: </strong>dvratil, sebas, davidedmundson, VDG<br /><strong>Cc: </strong>abetts, broulik, kamathraghavendra, graesslin, ngraham, plasma-devel, mlaurent, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, sebas, apol, mart<br /></div>