<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/D29395">View Revision</a></tr></table><br /><div><div><p>Generally +1<br />
Nice idea with this <tt style="background: #ebebeb; font-size: 13px;">Media</tt> singleton</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/D29395#inline-168341">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ExpandedRepresentation.qml:65</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: #004012">Media</span><span class="p">.</span><span style="color: #004012">lockPositionUpdate</span><span style="color: #aa2211">=</span> <span style="color: #000a65">false</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;">Coding style, space</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/D29395#inline-168342">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ExpandedRepresentation.qml: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; ">                <span style="color: #004012">seekSlider</span><span class="p">.</span><span style="color: #004012">value</span> <span style="color: #aa2211">=</span> <span style="color: #304a96">Math</span><span class="p">.</span><span style="color: #004012">max</span><span class="p">(</span><span style="color: #601200">0</span><span class="p">,</span> <span style="color: #004012">seekSlider</span><span class="p">.</span><span style="color: #004012">value</span> <span style="color: #aa2211">-</span> <span style="color: #601200">5000000</span><span class="p">)</span> <span style="color: #74777d">// microseconds</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">                <span style="color: #004012">seekSlider</span><span class="p">.</span><span style="color: #004012">moved</span><span class="p">()<span class="bright">;</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">                <span style="color: #004012">seekSlider</span><span class="p">.</span><span style="color: #004012">moved</span><span class="p">()</span>
</div><div style="padding: 0 8px; margin: 0 4px; ">            <span class="p">}</span> <span style="color: #aa4000">else</span> <span style="color: #aa4000">if</span> <span class="p">(</span><span style="color: #004012">event</span><span class="p">.</span><span style="color: #004012">key</span> <span style="color: #aa2211">===</span> <span style="color: #004012">Qt</span><span class="p">.</span><span style="color: #004012">Key_Right</span> <span style="color: #aa2211">||</span> <span style="color: #004012">event</span><span class="p">.</span><span style="color: #004012">key</span> <span style="color: #aa2211">===</span> <span style="color: #004012">Qt</span><span class="p">.</span><span style="color: #004012">Key_L</span><span class="p">)</span> <span class="p">{</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Unrelated cleanup</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/D29395#inline-168332">View Inline</a><span style="color: #4b4d51; font-weight: bold;">Media.qml:6</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: #004012">Item</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">id: media</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Make this a <tt style="background: #ebebeb; font-size: 13px;">QtObject</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/D29395#inline-168333">View Inline</a><span style="color: #4b4d51; font-weight: bold;">Media.qml:87</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: #004012">readonly</span> <span style="color: #004012">property</span> <span style="color: #304a96">int</span> <span style="color: #aa4000">play:</span> <span style="color: #601200">0</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #004012">readonly</span> <span style="color: #004012">property</span> <span style="color: #304a96">int</span> <span style="color: #aa4000">pause:</span> <span style="color: #601200">1</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Just pass the action string through, since all we do below is map the number back to a string</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/D29395#inline-168334">View Inline</a><span style="color: #4b4d51; font-weight: bold;">Media.qml:141</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: #004012">sources</span><span class="p">.</span><span style="color: #004012">filter</span><span class="p">(</span><span style="color: #004012">source</span> <span style="color: #aa2211">=></span> <span style="color: #004012">source</span> <span style="color: #aa2211">!==</span> <span style="color: #004012">mpris2Source</span><span class="p">.</span><span style="color: #004012">multiplexSource</span><span class="p">)</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">               <span class="p">.</span><span style="color: #004012">forEach</span><span class="p">(</span><span style="color: #004012">source</span> <span style="color: #aa2211">=></span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">                   <span style="color: #004012">model</span><span class="p">.</span><span style="color: #004012">push</span><span class="p">({</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">or <tt style="background: #ebebeb; font-size: 13px;">map()</tt> and then <tt style="background: #ebebeb; font-size: 13px;">unshift</tt> the multiplexer :p</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/D29395#inline-168335">View Inline</a><span style="color: #4b4d51; font-weight: bold;">Media.qml:187</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">function</span> <span style="color: #004012">togglePlaying</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: #004012">print</span><span class="p">(</span><span style="color: #004012">Media</span><span class="p">.</span><span style="color: #004012">state</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: #004012">Media</span><span class="p">.</span><span style="color: #004012">state</span> <span style="color: #aa2211">===</span> <span style="color: #766510">"playing"</span> <span style="color: #aa2211">&&</span> <span style="color: #004012">Media</span><span class="p">.</span><span style="color: #004012">canPause</span><span class="p">)</span> <span class="p">{</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Remove debug prints</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/D29395#inline-168336">View Inline</a><span style="color: #4b4d51; font-weight: bold;">Media.qml:197</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">states:</span> <span class="p">[</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span style="color: #004012">State</span> <span class="p">{</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Turn this into a property with an <tt style="background: #ebebeb; font-size: 13px;">if</tt> when this is no longer an <tt style="background: #ebebeb; font-size: 13px;">Item</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/D29395#inline-168338">View Inline</a><span style="color: #4b4d51; font-weight: bold;">main.qml:155</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 style="color: #aa4000">name:</span> <span style="color: #766510">"playing"</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">            <span style="color: #aa4000">when:</span> <span class="bright"></span><span style="color: #aa2211"><span class="bright">!</span></span><span class="bright"></span><span style="color: #004012"><span class="bright">root</span></span><span class="bright"></span><span class="p"><span class="bright">.</span></span><span class="bright"></span><span style="color: #004012"><span class="bright">noPlayer</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">&&</span></span><span class="bright"> </span><span style="color: #004012"><span class="bright">mpris2Source</span></span><span class="bright"></span><span class="p"><span class="bright">.</span></span><span class="bright"></span><span style="color: #004012"><span class="bright">currentData</span></span><span class="bright"></span><span class="p"><span class="bright">.</span></span><span class="bright"></span><span style="color: #004012"><span class="bright">PlaybackStatus</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">===</span></span><span class="bright"> </span><span style="color: #766510"><span class="bright">"P</span>laying"</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">            <span style="color: #aa4000">when:</span> <span class="bright"></span><span style="color: #004012"><span class="bright">Media</span></span><span class="bright"></span><span class="p"><span class="bright">.</span></span><span class="bright"></span><span style="color: #004012"><span class="bright">state</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">==</span></span><span class="bright"> </span><span style="color: #766510"><span class="bright">"p</span>laying"</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">You can just set <tt style="background: #ebebeb; font-size: 13px;">state: Media.state</tt> rather than <tt style="background: #ebebeb; font-size: 13px;">when</tt> on every state</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/D29395#inline-168339">View Inline</a><span style="color: #4b4d51; font-weight: bold;">main.qml:159</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 style="color: #aa4000">target:</span> <span style="color: #004012">plasmoid</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">                <span style="color: #aa4000">icon:</span> <span style="color: #004012">albumArt</span> <span style="color: #aa2211">?</span> <span style="color: #aa4000">albumArt :</span> <span style="color: #766510">"media-playback-playing"</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">                <span style="color: #aa4000">toolTipMainText:</span> <span class="bright"></span><span style="color: #004012"><span class="bright">t</span>rack</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">                <span style="color: #aa4000">icon:</span> <span class="bright"></span><span style="color: #004012"><span class="bright">Media</span></span><span class="bright"></span><span class="p"><span class="bright">.</span></span><span style="color: #004012">albumArt</span> <span style="color: #aa2211">?</span> <span class="bright"></span><span style="color: #aa4000"><span class="bright">Media.</span>albumArt :</span> <span style="color: #766510">"media-playback-playing"</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">                <span style="color: #aa4000">toolTipMainText:</span> <span class="bright"></span><span style="color: #004012"><span class="bright">Media</span></span><span class="bright"></span><span class="p"><span class="bright">.</span></span><span class="bright"></span><span style="color: #004012"><span class="bright">currentT</span>rack</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">We don't set album art on the icon anymore, cf <a href="https://phabricator.kde.org/D28917" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: line-through;">D28917</a></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/D29395#inline-168337">View Inline</a><span style="color: #4b4d51; font-weight: bold;">main.qml: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; background: rgba(251, 175, 175, .7);">    <span style="color: #aa4000">function</span> <span style="color: #004012">action_open</span><span class="p">()</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">        <span style="color: #004012">serviceOp</span><span class="p">(</span><span style="color: #004012">mpris2Source</span><span class="p">.</span><span style="color: #004012">current</span><span class="p">,</span> <span style="color: #766510">"Raise"</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">You can't remove these, they are wired up to the <tt style="background: #ebebeb; font-size: 13px;">plasmoid.setAction</tt> calls above. (Yes, I'd like to have an API to pass a JS callback :p but this is how it works right now)</p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R120 Plasma Workspace</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D29395">https://phabricator.kde.org/D29395</a></div></div><br /><div><strong>To: </strong>cblack, Plasma<br /><strong>Cc: </strong>broulik, trmdi, ngraham, plasma-devel, Orage, LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, ragreen, ZrenBot, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, ahiemstra, mart<br /></div>