<table><tr><td style="">Zren created this revision.<br />Herald added a project: Frameworks.<br />Herald added a subscriber: kde-frameworks-devel.<br />Zren requested review of this revision.
</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/D24524">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>I'm submitting this to start discussion on creating a common config control library.</p>
<p>I've started with a more common use case, an Icon control, to start us off.</p>
<ul class="remarkup-list">
<li class="remarkup-list-item">This is based on the kickoff icon control. <a href="https://github.com/KDE/plasma-desktop/blob/master/applets/kickoff/package/contents/ui/ConfigGeneral.qml" class="remarkup-link" target="_blank" rel="noreferrer">https://github.com/KDE/plasma-desktop/blob/master/applets/kickoff/package/contents/ui/ConfigGeneral.qml</a></li>
<li class="remarkup-list-item">I added:<ul class="remarkup-list">
<li class="remarkup-list-item">The preview size and padding can be changed</li>
<li class="remarkup-list-item">The default icon that used when "cleared" can be changed.</li>
<li class="remarkup-list-item">A TextField (Would be easier for power users, but I understand not adding it)</li>
<li class="remarkup-list-item">A dedicated browse button (I'm not against removing)</li>
<li class="remarkup-list-item">Preset values in the dropdown (I don't really need it)</li>
</ul></li>
<li class="remarkup-list-item">No idea if creating a new module is best. Nor if the name is okay. "configuration" is already in use.</li>
<li class="remarkup-list-item"><tt style="background: #ebebeb; font-size: 13px;">contents/config/config.qml</tt> has <tt style="background: #ebebeb; font-size: 13px;">ConfigModel</tt> and <tt style="background: #ebebeb; font-size: 13px;">ConfigCategory</tt> under a <tt style="background: #ebebeb; font-size: 13px;">org.kde.plasma.configuration</tt> module, however it is declared using C++ classes. <a href="https://github.com/KDE/plasma-framework/blob/acdaefa221cc3e4b60542b4805e53ed966ea23b7/autotests/configmodeltest.cpp#L40" class="remarkup-link" target="_blank" rel="noreferrer">https://github.com/KDE/plasma-framework/blob/acdaefa221cc3e4b60542b4805e53ed966ea23b7/autotests/configmodeltest.cpp#L40</a></li>
<li class="remarkup-list-item">I'm not sure why <tt style="background: #ebebeb; font-size: 13px;">MenuSeparator { visible: false }</tt> leaves leftover whitespace.</li>
</ul>
<p>I currently <a href="https://github.com/Zren/plasma-applet-tiledmenu/tree/master/package/contents/ui/lib" class="remarkup-link" target="_blank" rel="noreferrer">have a QQC1 library</a> that assigns directly to <tt style="background: #ebebeb; font-size: 13px;">plasmoid.configuration[configKey]</tt> without the user needing to click "Apply" (Like on Gnome). I'm not expecting "auto-serialize" to get merged to KDE however, which is unfortunate. <tt style="background: #ebebeb; font-size: 13px;">ConfigIcon { configKey: 'icon' }</tt> is very nice and compact, and clicking Apply feels pointless.</p>
<h2 class="remarkup-header">Screenshots</h2>
<p><a href="https://phabricator.kde.org/F7558454" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;">F7558454: 2019-10-09___12-45-11.png</a><br />
<a href="https://phabricator.kde.org/F7558455" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;">F7558455: 2019-10-09___14-41-15.png</a></p>
<h2 class="remarkup-header">Use Cases</h2>
<ul class="remarkup-list">
<li class="remarkup-list-item">Kicker, Kickoff</li>
<li class="remarkup-list-item">Present Windows <a href="https://phabricator.kde.org/T11776" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;">T11776</a></li>
<li class="remarkup-list-item">I use a modified version of this in Tiled Menu. I make the <tt style="background: #ebebeb; font-size: 13px;">ColumnLayout</tt> the default property so I can optionally add a checkbox below the <tt style="background: #ebebeb; font-size: 13px;">TextField</tt>. There's no need for this feature if we remove the TextField though. <a href="https://github.com/Zren/plasma-applet-tiledmenu/blob/master/package/contents/ui/lib/ConfigIcon.qml" class="remarkup-link" target="_blank" rel="noreferrer">https://github.com/Zren/plasma-applet-tiledmenu/blob/master/package/contents/ui/lib/ConfigIcon.qml</a> <a href="https://github.com/Zren/plasma-applet-tiledmenu/blob/master/package/contents/ui/config/ConfigGeneral.qml#L73-L81" class="remarkup-link" target="_blank" rel="noreferrer">https://github.com/Zren/plasma-applet-tiledmenu/blob/master/package/contents/ui/config/ConfigGeneral.qml#L73-L81</a></li>
</ul>
<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);">RowLayout
IconPreview
ColumnLayout
RowLayout
TextField
Button
CheckBox</pre></div></div></div><br /><div><strong>TEST PLAN</strong><div><p>Not yet tested via <tt style="background: #ebebeb; font-size: 13px;">cmake</tt> and importing, but the QML is tested in a widget.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R242 Plasma Framework (Library)</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D24524">https://phabricator.kde.org/D24524</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/declarativeimports/CMakeLists.txt<br />
src/declarativeimports/plasmaconfig/ConfigIcon.qml<br />
src/declarativeimports/plasmaconfig/qmldir</div></div></div><br /><div><strong>To: </strong>Zren<br /><strong>Cc: </strong>kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns<br /></div>