Warning, /plasma/latte-dock/shell/package/contents/configuration/pages/EffectsConfig.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2018 Michail Vourlakos <mvourlakos@gmail.com> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 import QtQuick 2.7 0007 import QtQuick.Controls 1.4 0008 import QtQuick.Layouts 1.3 0009 import QtGraphicalEffects 1.0 0010 import QtQuick.Dialogs 1.2 0011 import QtQuick.Controls 2.12 as QtQuickControls212 0012 0013 import org.kde.plasma.core 2.0 as PlasmaCore 0014 import org.kde.plasma.components 2.0 as PlasmaComponents 0015 import org.kde.plasma.components 3.0 as PlasmaComponents3 0016 import org.kde.plasma.extras 2.0 as PlasmaExtras 0017 0018 import org.kde.latte.core 0.2 as LatteCore 0019 import org.kde.latte.components 1.0 as LatteComponents 0020 import org.kde.latte.private.containment 0.1 as LatteContainment 0021 0022 import "../../controls" as LatteExtraControls 0023 0024 PlasmaComponents.Page { 0025 id: page 0026 width: content.width + content.Layout.leftMargin * 2 0027 height: content.height + units.smallSpacing 0028 0029 ColumnLayout { 0030 id: content 0031 anchors.horizontalCenter: parent.horizontalCenter 0032 Layout.leftMargin: units.smallSpacing * 2 0033 width: (dialog.appliedWidth - units.smallSpacing * 2) - Layout.leftMargin * 2 0034 spacing: dialog.subGroupSpacing 0035 0036 //! BEGIN: Shadows 0037 ColumnLayout { 0038 Layout.fillWidth: true 0039 Layout.topMargin: units.smallSpacing 0040 0041 spacing: units.smallSpacing 0042 0043 LatteComponents.HeaderSwitch { 0044 id: showAppletShadow 0045 Layout.fillWidth: true 0046 Layout.minimumHeight: implicitHeight 0047 Layout.topMargin: units.smallSpacing 0048 0049 checked: plasmoid.configuration.appletShadowsEnabled 0050 text: i18n("Shadows") 0051 tooltip: i18n("Enable/disable applet shadows") 0052 0053 onPressed: plasmoid.configuration.appletShadowsEnabled = !plasmoid.configuration.appletShadowsEnabled; 0054 } 0055 0056 ColumnLayout { 0057 Layout.leftMargin: units.smallSpacing * 2 0058 Layout.rightMargin: units.smallSpacing * 2 0059 spacing: 0 0060 0061 RowLayout{ 0062 enabled: showAppletShadow.checked 0063 0064 PlasmaComponents.Label { 0065 enabled: showAppletShadow.checked 0066 text: i18n("Size") 0067 horizontalAlignment: Text.AlignLeft 0068 } 0069 0070 LatteComponents.Slider { 0071 id: shadowSizeSlider 0072 Layout.fillWidth: true 0073 enabled: showAppletShadow.checked 0074 0075 value: plasmoid.configuration.shadowSize 0076 from: 0 0077 to: 100 0078 stepSize: 5 0079 wheelEnabled: false 0080 0081 function updateShadowSize() { 0082 if (!pressed) 0083 plasmoid.configuration.shadowSize = value; 0084 } 0085 0086 onPressedChanged: { 0087 updateShadowSize(); 0088 } 0089 0090 Component.onCompleted: { 0091 valueChanged.connect(updateShadowSize); 0092 } 0093 0094 Component.onDestruction: { 0095 valueChanged.disconnect(updateShadowSize); 0096 } 0097 } 0098 0099 PlasmaComponents.Label { 0100 enabled: showAppletShadow.checked 0101 text: i18nc("number in percentage, e.g. 85 %","%1 %", shadowSizeSlider.value) 0102 horizontalAlignment: Text.AlignRight 0103 Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4 0104 Layout.maximumWidth: theme.mSize(theme.defaultFont).width * 4 0105 } 0106 } 0107 0108 0109 RowLayout{ 0110 enabled: showAppletShadow.checked 0111 0112 PlasmaComponents.Label { 0113 enabled: showAppletShadow.checked 0114 text: i18n("Opacity") 0115 horizontalAlignment: Text.AlignLeft 0116 } 0117 0118 LatteComponents.Slider { 0119 id: shadowOpacitySlider 0120 Layout.fillWidth: true 0121 0122 value: plasmoid.configuration.shadowOpacity 0123 from: 0 0124 to: 100 0125 stepSize: 5 0126 wheelEnabled: false 0127 0128 function updateShadowOpacity() { 0129 if (!pressed) 0130 plasmoid.configuration.shadowOpacity = value; 0131 } 0132 0133 onPressedChanged: { 0134 updateShadowOpacity(); 0135 } 0136 0137 Component.onCompleted: { 0138 valueChanged.connect(updateShadowOpacity); 0139 } 0140 0141 Component.onDestruction: { 0142 valueChanged.disconnect(updateShadowOpacity); 0143 } 0144 } 0145 0146 PlasmaComponents.Label { 0147 id: shadowOpacityLbl 0148 enabled: showAppletShadow.checked 0149 text: i18nc("number in percentage, e.g. 85 %","%1 %", shadowOpacitySlider.value) 0150 horizontalAlignment: Text.AlignRight 0151 Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4 0152 Layout.maximumWidth: theme.mSize(theme.defaultFont).width * 4 0153 } 0154 } 0155 0156 RowLayout { 0157 id: shadowColorRow 0158 Layout.fillWidth: true 0159 Layout.topMargin: units.smallSpacing 0160 spacing: 2 0161 enabled: showAppletShadow.checked 0162 0163 readonly property string defaultShadow: "080808" 0164 readonly property string themeShadow: { 0165 var strC = String(theme.textColor); 0166 0167 return strC.indexOf("#") === 0 ? strC.substr(1) : strC; 0168 } 0169 0170 ExclusiveGroup { 0171 id: shadowColorGroup 0172 } 0173 0174 PlasmaComponents.Button { 0175 id: defaultShadowBtn 0176 Layout.fillWidth: true 0177 0178 text: i18nc("default shadow", "Default Color") 0179 checked: plasmoid.configuration.shadowColorType === type 0180 checkable: false 0181 exclusiveGroup: shadowColorGroup 0182 tooltip: i18n("Default shadow for applets") 0183 0184 readonly property int type: LatteContainment.Types.DefaultColorShadow 0185 0186 onPressedChanged: { 0187 if (pressed) { 0188 plasmoid.configuration.shadowColorType = type; 0189 } 0190 } 0191 } 0192 0193 PlasmaComponents.Button { 0194 id: themeShadowBtn 0195 Layout.fillWidth: true 0196 0197 text: i18nc("theme shadow", "Theme Color") 0198 checked: plasmoid.configuration.shadowColorType === type 0199 checkable: false 0200 exclusiveGroup: shadowColorGroup 0201 tooltip: i18n("Shadow from theme color palette") 0202 0203 readonly property int type: LatteContainment.Types.ThemeColorShadow 0204 0205 onPressedChanged: { 0206 if (pressed) { 0207 plasmoid.configuration.shadowColorType = type; 0208 } 0209 } 0210 } 0211 0212 //overlayed button 0213 PlasmaComponents.Button { 0214 id: userShadowBtn 0215 Layout.fillWidth: true 0216 Layout.minimumWidth: shadowOpacityLbl.width 0217 height: parent.height 0218 text: " " 0219 0220 checkable: false 0221 checked: plasmoid.configuration.shadowColorType === type 0222 tooltip: i18n("Use set shadow color") 0223 exclusiveGroup: shadowColorGroup 0224 0225 readonly property int type: LatteContainment.Types.UserColorShadow 0226 0227 onPressedChanged: { 0228 if (pressed) { 0229 plasmoid.configuration.shadowColorType = type; 0230 } 0231 } 0232 0233 Rectangle{ 0234 anchors.fill: parent 0235 anchors.margins: 1.5*units.smallSpacing 0236 0237 color: "#" + plasmoid.configuration.shadowColor; 0238 0239 opacity: shadowColorRow.enabled ? 1 : 0.6 0240 0241 Rectangle{ 0242 anchors.fill: parent 0243 color: "transparent" 0244 border.width: 1 0245 border.color: theme.textColor 0246 opacity: parent.opacity - 0.4 0247 } 0248 0249 MouseArea{ 0250 anchors.fill: parent 0251 onClicked: { 0252 shadowColorGroup.current = userShadowBtn; 0253 viewConfig.setSticker(true); 0254 colorDialogLoader.showDialog = true; 0255 } 0256 } 0257 } 0258 0259 Loader{ 0260 id:colorDialogLoader 0261 property bool showDialog: false 0262 active: showDialog 0263 0264 sourceComponent: ColorDialog { 0265 title: i18n("Please choose shadow color") 0266 showAlphaChannel: false 0267 0268 onAccepted: { 0269 //console.log("You chose: " + String(color)); 0270 var strC = String(color); 0271 if (strC.indexOf("#") === 0) { 0272 plasmoid.configuration.shadowColor = strC.substr(1); 0273 } 0274 0275 colorDialogLoader.showDialog = false; 0276 viewConfig.setSticker(false); 0277 } 0278 onRejected: { 0279 colorDialogLoader.showDialog = false; 0280 viewConfig.setSticker(false); 0281 } 0282 Component.onCompleted: { 0283 color = String("#" + plasmoid.configuration.shadowColor); 0284 visible = true; 0285 } 0286 } 0287 } 0288 } 0289 } 0290 } 0291 } 0292 //! END: Shadows 0293 0294 //! BEGIN: Animations 0295 ColumnLayout { 0296 Layout.fillWidth: true 0297 Layout.topMargin: units.smallSpacing 0298 spacing: units.smallSpacing 0299 0300 LatteComponents.HeaderSwitch { 0301 id: animationsHeader 0302 Layout.fillWidth: true 0303 Layout.minimumHeight: implicitHeight 0304 Layout.topMargin: units.smallSpacing 0305 0306 checked: plasmoid.configuration.animationsEnabled 0307 text: i18n("Animations") 0308 tooltip: i18n("Enable/disable all animations") 0309 0310 onPressed: { 0311 plasmoid.configuration.animationsEnabled = !plasmoid.configuration.animationsEnabled; 0312 } 0313 } 0314 0315 ColumnLayout { 0316 Layout.leftMargin: units.smallSpacing * 2 0317 Layout.rightMargin: units.smallSpacing * 2 0318 spacing: 0 0319 enabled: plasmoid.configuration.animationsEnabled 0320 0321 ColumnLayout { 0322 Layout.fillWidth: true 0323 spacing: 0 0324 0325 RowLayout { 0326 Layout.fillWidth: true 0327 spacing: 2 0328 0329 property int duration: plasmoid.configuration.durationTime 0330 0331 ExclusiveGroup { 0332 id: animationsGroup 0333 } 0334 0335 PlasmaComponents.Button { 0336 Layout.fillWidth: true 0337 text: i18n("x1") 0338 checked: parent.duration === duration 0339 checkable: false 0340 exclusiveGroup: animationsGroup 0341 0342 readonly property int duration: 3 0343 0344 onPressedChanged: { 0345 if (pressed) { 0346 plasmoid.configuration.durationTime = duration; 0347 } 0348 } 0349 } 0350 PlasmaComponents.Button { 0351 Layout.fillWidth: true 0352 text: i18n("x2") 0353 checked: parent.duration === duration 0354 checkable: false 0355 exclusiveGroup: animationsGroup 0356 0357 readonly property int duration: 2 0358 0359 onPressedChanged: { 0360 if (pressed) { 0361 plasmoid.configuration.durationTime = duration; 0362 } 0363 } 0364 } 0365 PlasmaComponents.Button { 0366 Layout.fillWidth: true 0367 text: i18n("x3") 0368 checked: parent.duration === duration 0369 checkable: false 0370 exclusiveGroup: animationsGroup 0371 0372 readonly property int duration: 1 0373 0374 onPressedChanged: { 0375 if (pressed) { 0376 plasmoid.configuration.durationTime = duration; 0377 } 0378 } 0379 } 0380 } 0381 } 0382 } 0383 } 0384 //! END: Animations 0385 0386 //! BEGIN: Active Indicator General Settings 0387 ColumnLayout{ 0388 spacing: units.smallSpacing 0389 0390 LatteComponents.HeaderSwitch { 0391 id: indicatorsSwitch 0392 Layout.fillWidth: true 0393 Layout.minimumHeight: implicitHeight 0394 0395 checked: latteView.indicator.enabled 0396 text: i18n("Indicators") 0397 tooltip: i18n("Enable/disable indicators") 0398 0399 onPressed: { 0400 latteView.indicator.enabled = !latteView.indicator.enabled; 0401 } 0402 } 0403 0404 ColumnLayout { 0405 Layout.leftMargin: units.smallSpacing * 2 0406 Layout.rightMargin: units.smallSpacing * 2 0407 spacing: units.smallSpacing 0408 enabled: indicatorsSwitch.checked 0409 0410 /* LatteComponents.SubHeader { 0411 text: i18n("Style") 0412 }*/ 0413 0414 Item { 0415 Layout.fillWidth: true 0416 Layout.minimumHeight: tabBar.height 0417 0418 PlasmaComponents.TabBar { 0419 id: tabBar 0420 width: parent.width 0421 0422 property string type: latteView.indicator.type 0423 0424 PlasmaComponents.TabButton { 0425 id: latteBtn 0426 text: i18nc("latte indicator style", "Latte") 0427 readonly property string type: "org.kde.latte.default" 0428 0429 onCheckedChanged: { 0430 if (checked) { 0431 latteView.indicator.type = type; 0432 } 0433 } 0434 } 0435 PlasmaComponents.TabButton { 0436 id: plasmaBtn 0437 text: i18nc("plasma indicator style", "Plasma") 0438 readonly property string type: "org.kde.latte.plasma" 0439 0440 onCheckedChanged: { 0441 if (checked) { 0442 latteView.indicator.type = type; 0443 } 0444 } 0445 } 0446 0447 PlasmaComponents.TabButton { 0448 id: customBtn 0449 0450 onCheckedChanged: { 0451 if (checked) { 0452 customIndicator.onButtonIsPressed(); 0453 } 0454 } 0455 0456 LatteExtraControls.CustomIndicatorButton { 0457 id: customIndicator 0458 anchors.fill: parent 0459 implicitWidth: latteBtn.implicitWidth 0460 implicitHeight: latteBtn.implicitHeight 0461 0462 checked: parent.checked 0463 comboBoxMinimumPopUpWidth: 1.5 * customIndicator.width 0464 0465 onTypeChanged: { 0466 if (tabBar.type === type) { 0467 tabBar.selectTab(type); 0468 } 0469 } 0470 } 0471 } 0472 0473 function selectTab(type) { 0474 if (type === latteBtn.type) { 0475 tabBar.currentTab = latteBtn; 0476 } else if (type === plasmaBtn.type) { 0477 tabBar.currentTab = plasmaBtn; 0478 } else if (type === customIndicator.type) { 0479 tabBar.currentTab = customBtn; 0480 } 0481 } 0482 0483 Connections { 0484 target: indicatorsStackView 0485 onCurrentItemChanged: { 0486 if (!indicatorsStackView.currentItem || !viewConfig.isReady) { 0487 return; 0488 } 0489 0490 tabBar.selectTab(indicatorsStackView.currentItem.type); 0491 } 0492 } 0493 } 0494 0495 Rectangle { 0496 anchors.bottom: tabBar.bottom 0497 anchors.left: tabBar.left 0498 anchors.leftMargin: 2 0499 width: tabBar.width - 2*2 0500 height: 2 0501 color: theme.textColor 0502 opacity: 0.25 0503 } 0504 } 0505 0506 //! BEGIN: Indicator specific sub-options 0507 QtQuickControls212.StackView { 0508 id: indicatorsStackView 0509 Layout.fillWidth: true 0510 Layout.maximumHeight: Layout.minimumHeight 0511 enabled: latteView.indicator.enabled 0512 0513 property bool forwardSliding: true 0514 0515 readonly property int optionsWidth: dialog.optionsWidth 0516 readonly property bool deprecatedOptionsAreHidden: true // @since 0.10.0 0517 0518 replaceEnter: Transition { 0519 ParallelAnimation { 0520 PropertyAnimation { 0521 property: "x" 0522 from: indicatorsStackView.forwardSliding ? -indicatorsStackView.width : indicatorsStackView.width 0523 to: 0 0524 duration: 350 0525 } 0526 0527 PropertyAnimation { 0528 property: "opacity" 0529 from: 0 0530 to: 1 0531 duration: 350 0532 } 0533 } 0534 } 0535 0536 replaceExit: Transition { 0537 ParallelAnimation { 0538 PropertyAnimation { 0539 property: "x" 0540 from: 0 0541 to: indicatorsStackView.forwardSliding ? indicatorsStackView.width : -indicatorsStackView.width 0542 duration: 350 0543 } 0544 0545 PropertyAnimation { 0546 property: "opacity" 0547 from: 1 0548 to: 0 0549 duration: 350 0550 } 0551 } 0552 } 0553 } //! END: Indicator specific sub-options 0554 } //! END: Active Indicator General Settings 0555 } 0556 } //! END of Dynamic content 0557 0558 0559 //! Manager / Handler of loading/showing/hiding indicator config uis 0560 LatteExtraControls.IndicatorConfigUiManager { 0561 id: indicatorUiManager 0562 visible: false 0563 stackView: indicatorsStackView 0564 } 0565 0566 }