improve Shadows settings in Effects page

pull/4/head
Michail Vourlakos 6 years ago
parent 37aa752527
commit 7db0886a3c

@ -119,7 +119,7 @@
<default>0</default>
</entry>
<entry name="glow3D" type="Bool">
<default>false</default>
<default>true</default>
</entry>
<entry name="glowOpacity" type="Int">
<default>30</default>
@ -131,7 +131,8 @@
<choice name="Internal"/>
<choice name="All"/>
</choices>
<default>1</default>
<default>0</default>
<label>Internal will become deprecated, Latte applets active indicator will be just active or not </label>
</entry>
<entry name="activeIndicatorType" type="Enum">
<label>Active indicator style</label>

@ -38,6 +38,7 @@ import org.kde.latte 0.2 as Latte
import "pages" as Pages
import "../controls" as LatteExtraControls
import "../controls/private" as LatteExtraControlsPrivate
FocusScope {
id: dialog
@ -348,9 +349,7 @@ FocusScope {
}
}
style: Styles.SwitchStyle {
property bool checked: dialog.highLevel
}
style: LatteExtraControlsPrivate.SwitchStyle {}
}
}
}

@ -82,7 +82,7 @@ PlasmaComponents.Page {
Layout.fillWidth: true
Layout.leftMargin: units.smallSpacing * 2
Layout.rightMargin: units.smallSpacing * 2
spacing: 1
spacing: 2
visible: true
function updateScreens() {
@ -182,7 +182,7 @@ PlasmaComponents.Page {
Layout.leftMargin: units.smallSpacing * 2
Layout.rightMargin: units.smallSpacing * 2
LayoutMirroring.enabled: false
spacing: 1
spacing: 2
Connections{
target: latteView
@ -292,7 +292,7 @@ PlasmaComponents.Page {
Layout.leftMargin: units.smallSpacing * 2
Layout.rightMargin: units.smallSpacing * 2
LayoutMirroring.enabled: false
spacing: 1
spacing: 2
property int panelPosition: plasmoid.configuration.panelPosition
@ -374,8 +374,8 @@ PlasmaComponents.Page {
GridLayout {
width: parent.width
rowSpacing: 1
columnSpacing: 1
rowSpacing: 2
columnSpacing: 2
Layout.leftMargin: units.smallSpacing * 2
Layout.rightMargin: units.smallSpacing * 2

@ -1,4 +1,4 @@
/*
/*
* Copyright 2018 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
@ -28,6 +28,8 @@ import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.plasmoid 2.0
import QtQuick.Controls.Styles.Plasma 2.0 as Styles
import org.kde.latte 0.2 as Latte
import "../../controls" as LatteExtraControls
@ -47,259 +49,248 @@ PlasmaComponents.Page {
//! BEGIN: Shadows
ColumnLayout {
Layout.fillWidth: true
Layout.topMargin: units.smallSpacing
spacing: units.smallSpacing
LatteExtraControls.Header {
text: i18n("Applets")
LatteExtraControls.HeaderSwitch {
id: showAppletShadow
Layout.fillWidth: true
Layout.minimumHeight: implicitHeight
Layout.rightMargin: units.smallSpacing * 2
checked: plasmoid.configuration.shadows>0
text: i18n("Shadows")
tooltip: i18n("Enable/disable applet shadows")
onPressed: {
if(plasmoid.configuration.shadows !== 2){
plasmoid.configuration.shadows = 2;
} else {
plasmoid.configuration.shadows = 0;
}
}
}
RowLayout {
Layout.fillWidth: true
ColumnLayout {
Layout.leftMargin: units.smallSpacing * 2
Layout.rightMargin: units.smallSpacing * 2
spacing: 2
ColumnLayout{
PlasmaComponents.CheckBox {
id: showAppletShadow
text: i18nc("show applet shadow","Shadow")
checked: plasmoid.configuration.shadows>0
RowLayout{
enabled: showAppletShadow.checked
onClicked: {
if (checked)
plasmoid.configuration.shadows = 2;
else
plasmoid.configuration.shadows = 0;
}
PlasmaComponents.Label {
enabled: showAppletShadow.checked
text: i18n("Size")
horizontalAlignment: Text.AlignLeft
}
PlasmaComponents.Button{
id: backColorBtn
Layout.alignment: Qt.AlignLeft
LatteExtraControls.Slider {
id: shadowSizeSlider
Layout.fillWidth: true
Layout.maximumWidth: showAppletShadow.width
text:" "
enabled: showAppletShadow.checked
visible: dialog.highLevel
PlasmaComponents3.ComboBox {
id: restoreCmb
anchors.fill: parent
enabled: backColorBtn.enabled
function addModel() {
var actions = [];
actions.push(i18nc("Use theme shadow","Theme"));
actions.push(i18nc("Clear applet shadow settings","Clear"));
restoreCmb.model = actions;
restoreCmb.currentIndex = -1;
}
function emptyModel() {
var actions = []
actions.push(" ");
restoreCmb.model = actions;
restoreCmb.currentIndex = -1;
}
value: plasmoid.configuration.shadowSize
from: 0
to: 100
stepSize: 5
wheelEnabled: false
Component.onCompleted:{
addModel();
}
function updateShadowSize() {
if (!pressed)
plasmoid.configuration.shadowSize = value;
}
onActivated: {
if (index===0) {
var strC = String(theme.textColor);
if (strC.indexOf("#") === 0)
plasmoid.configuration.shadowColor = strC.substr(1);
}else if (index===1){
plasmoid.configuration.shadowColor = "080808";
}
if (index===0 || index===1) {
plasmoid.configuration.shadowSize = 20;
plasmoid.configuration.shadowOpacity = 100;
}
restoreCmb.currentIndex = -1;
}
onPressedChanged: {
updateShadowSize();
}
onCurrentIndexChanged: {
if (currentIndex === 0)
currentIndex = -1;
}
Component.onCompleted: {
valueChanged.connect(updateShadowSize);
}
onEnabledChanged: {
if (enabled)
addModel();
else
emptyModel();
}
Component.onDestruction: {
valueChanged.disconnect(updateShadowSize);
}
}
PlasmaComponents.Label {
enabled: showAppletShadow.checked
text: shadowSizeSlider.value + " %"
horizontalAlignment: Text.AlignRight
Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4
Layout.maximumWidth: theme.mSize(theme.defaultFont).width * 4
}
}
//overlayed button
PlasmaComponents.Button {
id: colorBtn
width: parent.width - units.iconSizes.medium + 2*units.smallSpacing
height: parent.height
text: " "
enabled: showAppletShadow.checked
visible: dialog.highLevel
onClicked: {
viewConfig.setSticker(true);
colorDialogLoader.showDialog = true;
}
RowLayout{
enabled: showAppletShadow.checked
Rectangle{
anchors.fill: parent
anchors.margins: 1.5*units.smallSpacing
PlasmaComponents.Label {
enabled: showAppletShadow.checked
text: i18n("Opacity")
horizontalAlignment: Text.AlignLeft
}
color: "#" + plasmoid.configuration.shadowColor;
opacity: colorBtn.enabled ? 1 : 0.4
LatteExtraControls.Slider {
id: shadowOpacitySlider
Layout.fillWidth: true
Rectangle{
anchors.fill: parent
color: "transparent"
border.width: 1
border.color: theme.textColor
opacity: 0.7
}
}
value: plasmoid.configuration.shadowOpacity
from: 0
to: 100
stepSize: 5
wheelEnabled: false
Loader{
id:colorDialogLoader
property bool showDialog: false
active: showDialog
sourceComponent: ColorDialog {
title: i18n("Please choose shadow color")
showAlphaChannel: false
onAccepted: {
//console.log("You chose: " + String(color));
var strC = String(color);
if (strC.indexOf("#") === 0)
plasmoid.configuration.shadowColor = strC.substr(1);
colorDialogLoader.showDialog = false;
viewConfig.setSticker(false);
}
onRejected: {
colorDialogLoader.showDialog = false;
viewConfig.setSticker(false);
}
Component.onCompleted: {
color = String("#" + plasmoid.configuration.shadowColor);
visible = true;
}
}
}
function updateShadowOpacity() {
if (!pressed)
plasmoid.configuration.shadowOpacity = value;
}
}
}
ColumnLayout {
RowLayout{
PlasmaComponents.Label {
text: " | "
horizontalAlignment: Text.AlignLeft
opacity: 0.35
onPressedChanged: {
updateShadowOpacity();
}
PlasmaComponents.Label {
enabled: showAppletShadow.checked
text: i18n("Opacity")
horizontalAlignment: Text.AlignLeft
Component.onCompleted: {
valueChanged.connect(updateShadowOpacity);
}
LatteExtraControls.Slider {
id: shadowOpacitySlider
Layout.fillWidth: true
enabled: showAppletShadow.checked
Component.onDestruction: {
valueChanged.disconnect(updateShadowOpacity);
}
}
value: plasmoid.configuration.shadowOpacity
from: 0
to: 100
stepSize: 5
wheelEnabled: false
PlasmaComponents.Label {
enabled: showAppletShadow.checked
text: shadowOpacitySlider.value + " %"
horizontalAlignment: Text.AlignRight
Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4
Layout.maximumWidth: theme.mSize(theme.defaultFont).width * 4
}
}
}
function updateShadowOpacity() {
if (!pressed)
plasmoid.configuration.shadowOpacity = value;
}
RowLayout {
id: shadowColorRow
Layout.fillWidth: true
Layout.leftMargin: units.smallSpacing * 2
Layout.rightMargin: units.smallSpacing * 2
spacing: 2
enabled: showAppletShadow.checked
onPressedChanged: {
updateShadowOpacity();
}
PlasmaComponents.Label {
text: i18n("Color")
Component.onCompleted: {
valueChanged.connect(updateShadowOpacity);
}
Layout.rightMargin: units.smallSpacing
}
Component.onDestruction: {
valueChanged.disconnect(updateShadowOpacity);
}
readonly property string defaultShadow: "080808"
readonly property string themeShadow: {
var strC = String(theme.textColor);
return strC.indexOf("#") === 0 ? strC.substr(1) : strC;
}
ExclusiveGroup {
id: shadowColorGroup
property bool inStartup: true
onCurrentChanged: {
if (inStartup) {
return;
}
PlasmaComponents.Label {
enabled: showAppletShadow.checked
text: shadowOpacitySlider.value + " %"
horizontalAlignment: Text.AlignRight
Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4
Layout.maximumWidth: theme.mSize(theme.defaultFont).width * 4
if (current === defaultShadowBtn) {
plasmoid.configuration.shadowColor = shadowColorRow.defaultShadow;
} else if (current === themeShadowBtn) {
plasmoid.configuration.shadowColor = shadowColorRow.themeShadow;
} else if (current === userShadowBtn) {
viewConfig.setSticker(true);
colorDialogLoader.showDialog = true;
}
}
RowLayout{
visible: dialog.highLevel
PlasmaComponents.Label {
text: " | "
horizontalAlignment: Text.AlignLeft
opacity: 0.35
}
Component.onCompleted: inStartup = false;
}
PlasmaComponents.Label {
enabled: showAppletShadow.checked
text: i18n("Size")
horizontalAlignment: Text.AlignLeft
}
PlasmaComponents.Button {
id: defaultShadowBtn
Layout.fillWidth: true
LatteExtraControls.Slider {
id: shadowSizeSlider
Layout.fillWidth: true
enabled: showAppletShadow.checked
text: i18nc("default shadow", "Default")
checked: plasmoid.configuration.shadowColor === shadowColorRow.defaultShadow
checkable: true
exclusiveGroup: shadowColorGroup
tooltip: i18n("Default shadow for applets")
}
value: plasmoid.configuration.shadowSize
from: 0
to: 100
stepSize: 5
wheelEnabled: false
PlasmaComponents.Button {
id: themeShadowBtn
Layout.fillWidth: true
function updateShadowSize() {
if (!pressed)
plasmoid.configuration.shadowSize = value;
}
text: i18nc("theme shadow", "Theme")
checked: plasmoid.configuration.shadowColor === shadowColorRow.themeShadow
checkable: true
exclusiveGroup: shadowColorGroup
tooltip: i18n("Shadow from theme color pallete")
}
onPressedChanged: {
updateShadowSize();
}
//overlayed button
PlasmaComponents.Button {
id: userShadowBtn
Layout.fillWidth: true
height: parent.height
text: " "
Component.onCompleted: {
valueChanged.connect(updateShadowSize);
}
checkable: true
checked: plasmoid.configuration.shadowColor !== shadowColorRow.defaultShadow
&& plasmoid.configuration.shadowColor !== shadowColorRow.themeShadow
tooltip: i18n("Use set shadow color")
exclusiveGroup: shadowColorGroup
Component.onDestruction: {
valueChanged.disconnect(updateShadowSize);
}
Rectangle{
anchors.fill: parent
anchors.margins: 1.5*units.smallSpacing
color: "#" + plasmoid.configuration.shadowColor;
opacity: userShadowBtn.checked ? 1 : 0.4
Rectangle{
anchors.fill: parent
color: "transparent"
border.width: 1
border.color: theme.textColor
opacity: 0.7
}
}
PlasmaComponents.Label {
enabled: showAppletShadow.checked
text: shadowSizeSlider.value + " %"
horizontalAlignment: Text.AlignRight
Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4
Layout.maximumWidth: theme.mSize(theme.defaultFont).width * 4
Loader{
id:colorDialogLoader
property bool showDialog: false
active: showDialog
sourceComponent: ColorDialog {
title: i18n("Please choose shadow color")
showAlphaChannel: false
onAccepted: {
//console.log("You chose: " + String(color));
var strC = String(color);
if (strC.indexOf("#") === 0)
plasmoid.configuration.shadowColor = strC.substr(1);
colorDialogLoader.showDialog = false;
viewConfig.setSticker(false);
}
onRejected: {
colorDialogLoader.showDialog = false;
viewConfig.setSticker(false);
}
Component.onCompleted: {
color = String("#" + plasmoid.configuration.shadowColor);
visible = true;
}
}
}
}
@ -320,7 +311,7 @@ PlasmaComponents.Page {
Layout.fillWidth: true
Layout.leftMargin: units.smallSpacing * 2
rowSpacing: units.smallSpacing * 2
columnSpacing: 1
columnSpacing: 2
columns: 5
@ -393,7 +384,8 @@ PlasmaComponents.Page {
PlasmaComponents.Label {
text: i18n("Applets") + " "
horizontalAlignment: Text.AlignLeft
visible: dialog.expertLevel
//visible: dialog.expertLevel
visible: false
}
PlasmaComponents.Button {
@ -403,7 +395,9 @@ PlasmaComponents.Page {
checked: parent.activeIndicator === activeIndicator
checkable: true
exclusiveGroup: activeIndicatorGroup
visible: dialog.expertLevel
//visible: dialog.expertLevel
visible: false
tooltip: i18n("Latte will not show any active applet indicator on its own except those the plasma theme provides")
readonly property int activeIndicator: Latte.Types.NoneIndicator
@ -416,7 +410,9 @@ PlasmaComponents.Page {
checked: parent.activeIndicator === activeIndicator
checkable: true
exclusiveGroup: activeIndicatorGroup
visible: dialog.expertLevel
//visible: dialog.expertLevel
visible: false
tooltip: i18n("Latte will show active applet indicators only for applets that have been adjusted by it for hovering capabilities e.g. folderview")
readonly property int activeIndicator: Latte.Types.InternalsIndicator
@ -429,7 +425,9 @@ PlasmaComponents.Page {
checked: parent.activeIndicator === activeIndicator
checkable: true
exclusiveGroup: activeIndicatorGroup
visible: dialog.expertLevel
//visible: dialog.expertLevel
visible: false
tooltip: i18n("Latte will show active applet indicators for all applets")
readonly property int activeIndicator: Latte.Types.AllIndicator
@ -536,6 +534,7 @@ PlasmaComponents.Page {
id: showGlow3D
text: i18n("Use a 3D style glow")
checked: plasmoid.configuration.glow3D
visible: false
onClicked: {
plasmoid.configuration.glow3D = checked;

@ -0,0 +1,82 @@
/*
* Copyright 2019 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.7
import QtGraphicalEffects 1.0
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.3
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.plasmoid 2.0
import org.kde.latte 0.2 as Latte
import "." as LatteExtraControls
import "private" as Private
Item {
id: item
property bool checked: false
readonly property int implicitWidth: headerText.width + headerSwitch.width
readonly property int implicitHeight: Math.max(headerText.height, headerSwitch.height)
property string text:""
property string tooltip:""
signal pressed();
RowLayout {
id: row
anchors.fill: parent
LatteExtraControls.Header {
id: headerText
Layout.fillWidth: true
text: item.text
enabled: item.checked
}
Switch {
id: headerSwitch
checked: item.checked
style: Private.SwitchStyle {}
}
}
MouseArea {
id: itemMouseArea
anchors.fill: row
hoverEnabled: true
onClicked: item.pressed();
}
ToolTip{
parent: headerSwitch
text: item.tooltip
visible: itemMouseArea.containsMouse && text !==""
delay: 7 * units.longDuration
}
}

@ -0,0 +1,60 @@
/*
* Copyright 2014 Marco Martin <mart@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
*/
import QtQuick 2.2
import QtQuick.Controls.Styles 1.2 as QtQuickControlStyle
import QtQuick.Controls 1.2
import org.kde.plasma.core 2.0 as PlasmaCore
QtQuickControlStyle.SwitchStyle {
id: styleRoot
handle: PlasmaCore.FrameSvgItem {
opacity: control.enabled ? 1.0 : 0.6
width: height
imagePath: "widgets/button"
prefix: "shadow"
PlasmaCore.FrameSvgItem {
id: button
imagePath: "widgets/button"
prefix: "normal"
anchors.fill: parent
}
}
groove: PlasmaCore.FrameSvgItem {
imagePath: "widgets/slider"
prefix: "groove"
implicitHeight: theme.mSize(theme.defaultFont).height
implicitWidth: height * 2
PlasmaCore.FrameSvgItem {
id: highlight
imagePath: "widgets/slider"
prefix: "groove-highlight"
anchors.fill: parent
opacity: control.checked ? 1 : 0
Behavior on opacity {
PropertyAnimation { duration: units.shortDuration * 2 }
}
}
}
}
Loading…
Cancel
Save