enable/disable colorizing from user

--when the user has enabled the monochrome colorizing
in that case in applet options there is now a new option
in order for the user to choose if wants or not that
applet to be colorized. Such an example are colorful
applets that lose their proper appearance through
monochrome option.
pull/4/head
Michail Vourlakos 6 years ago
parent 5c28b2194a
commit 582b59dae2

@ -1375,9 +1375,12 @@ QString Layout::newUniqueIdsLayoutFromFile(QString file)
//! update applet ids in their containment order and in MultipleLayouts update also the layoutId
foreach (auto cId, investigate_conts.groupList()) {
//! Update (appletOrder) and (lockedZoomApplets)
for (int i = 1; i <= 2; ++i) {
QString settingStr = (i == 1) ? "appletOrder" : "lockedZoomApplets";
//! Update options that contain applet ids
//! (appletOrder) and (lockedZoomApplets) and (userBlocksColorizingApplets)
QStringList options;
options << "appletOrder" << "lockedZoomApplets" << "userBlocksColorizingApplets";
foreach (auto settingStr, options) {
QString order1 = investigate_conts.group(cId).group("General").readEntry(settingStr, QString());
if (!order1.isEmpty()) {

@ -88,7 +88,7 @@ function restore() {
//rewrite, so if in the orders there were now invalid ids or if some were missing creates a correct list instead
save();
restoreLocks();
restoreOptions();
inRestore = false;
@ -96,8 +96,20 @@ function restore() {
root.updateLayouts();
}
function restoreLocks() {
var configString = String(plasmoid.configuration.lockedZoomApplets)
function restoreOptions() {
restoreOption("lockedZoomApplets");
restoreOption("userBlocksColorizingApplets");
}
function restoreOption(option) {
var configString;
if (option === "lockedZoomApplets") {
configString = String(plasmoid.configuration.lockedZoomApplets);
} else if (option === "userBlocksColorizingApplets") {
configString = String(plasmoid.configuration.userBlocksColorizingApplets);
}
//array, a cell for encoded item order
var itemsArray = configString.split(";");
@ -106,7 +118,11 @@ function restoreLocks() {
var child = layout.children[j];
if (child.applet && (child.applet.id == itemsArray[i])) {
child.lockZoom = true;
if (option === "lockedZoomApplets") {
child.lockZoom = true;
} else if (option === "userBlocksColorizingApplets") {
child.userBlocksColorizing = true;
}
}
}
}
@ -170,18 +186,29 @@ function save() {
plasmoid.configuration.appletOrder = ids.join(';');
}
function saveLocks() {
function saveOptions() {
saveOption("lockedZoomApplets");
saveOption("userBlocksColorizingApplets");
}
function saveOption(option) {
var ids = new Array();
for (var i = 0; i < layout.children.length; ++i) {
var child = layout.children[i];
if (child.applet && child.lockZoom) {
if (child.applet
&& (option === "lockedZoomApplets" && child.lockZoom)
|| (option === "userBlocksColorizingApplets" && child.userBlocksColorizing)) {
ids.push(child.applet.id);
}
}
plasmoid.configuration.lockedZoomApplets = ids.join(';');
}
if (option === "lockedZoomApplets") {
plasmoid.configuration.lockedZoomApplets = ids.join(';');
} else if (option === "userBlocksColorizingApplets") {
plasmoid.configuration.userBlocksColorizingApplets = ids.join(';');
}
}
function removeApplet (applet) {
for (var i = layout.children.length - 1; i >= 0; --i) {

@ -12,6 +12,9 @@
<entry name="lockedZoomApplets" type="String">
<label>applets that lock the zoom effect</label>
</entry>
<entry name="userBlocksColorizingApplets" type="String">
<label>applets that do not want to be colorized in any case</label>
</entry>
<entry name="panelPosition" type="Enum">
<choices>
<choice name="Center"/>

@ -151,6 +151,7 @@ MouseArea {
handle.height = currentApplet.height;
lockButton.checked = currentApplet.lockZoom;
colorizingButton.checked = !currentApplet.userBlocksColorizing;
repositionHandler.restart();
}
@ -411,6 +412,7 @@ MouseArea {
lockButton.visible = !currentApplet.isInternalViewSplitter && (currentApplet.applet.pluginName !== "org.kde.plasma.systemtray")
&& (currentApplet.applet.pluginName !== root.plasmoidName)
&& !currentApplet.isSeparator
colorizingButton.visible = root.forceColorizer && !currentApplet.appletBlocksColorizing;
label.text = currentApplet.isInternalViewSplitter ? i18n("Justify Splitter") : currentApplet.applet.title;
} else {
@ -418,6 +420,7 @@ MouseArea {
configureButton.visible = false;
closeButton.visible = false;
lockButton.visible = false;
colorizingButton.visible = false;
label.text = ruler.tooltip;
tooltip.visible = true;
@ -478,7 +481,18 @@ MouseArea {
when: currentApplet === ruler
value: ruler.tooltip
}
}
PlasmaComponents.ToolButton{
id: colorizingButton
checkable: true
iconSource: "color-picker"
tooltip: i18n("Enable/Disable painting for this applet")
onCheckedChanged: {
currentApplet.userBlocksColorizing = !checked;
root.layoutManagerSaveOptions();
}
}
PlasmaComponents.ToolButton{
@ -489,7 +503,7 @@ MouseArea {
onCheckedChanged: {
currentApplet.lockZoom = checked;
root.layoutManagerSaveLocks();
root.layoutManagerSaveOptions();
}
}

@ -57,6 +57,9 @@ Item {
else
return false;
}
property bool userBlocksColorizing: false
property bool appletBlocksColorizing: communicator.disableLatteSideColoring
property bool showZoomed: false
property bool lockZoom: false
property bool isExpanded: applet && applet.status >= PlasmaCore.Types.NeedsAttentionStatus
@ -567,7 +570,8 @@ Item {
opacity: mustBeShown ? 1 : 0
readonly property bool mustBeShown: colorizerManager.mustBeShown
&& !communicator.disableLatteSideColoring
&& !container.userBlocksColorizing
&& !container.appletBlocksColorizing
Behavior on opacity {
NumberAnimation {

@ -1110,8 +1110,8 @@ DragDrop.DropArea {
LayoutManager.save();
}
function layoutManagerSaveLocks() {
LayoutManager.saveLocks();
function layoutManagerSaveOptions() {
LayoutManager.saveOptions();
}
function mouseInCanBeHoveredApplet(){

Loading…
Cancel
Save