fix #963,disable wheel for sliders

--fork the PlasmaComponents Slider in order to
update to newer Qt version and support the
wheelEnabled property. After that just disable
wheel for all sliders in Appearance page.
pull/2/head
Michail Vourlakos 7 years ago
parent de35075eac
commit 1c8c728927

@ -31,6 +31,8 @@ import org.kde.plasma.plasmoid 2.0
import org.kde.latte 0.1 as Latte
import "../controls" as LatteExtraControls
PlasmaComponents.Page {
Layout.maximumWidth: content.width + content.Layout.leftMargin * 2
Layout.maximumHeight: content.height + units.smallSpacing * 2
@ -156,7 +158,7 @@ PlasmaComponents.Page {
horizontalAlignment: Text.AlignLeft
}
PlasmaComponents.Slider {
LatteExtraControls.Slider {
id: appletsSizeSlider
Layout.fillWidth: true
value: plasmoid.configuration.iconSize
@ -164,6 +166,7 @@ PlasmaComponents.Page {
stepSize: (!plasmoid.configuration.autoDecreaseIconSize
&& (plasmoid.configuration.advanced || (plasmoid.configuration.iconSize % 8 !== 0)))
|| dialog.dockIsPanel ? 1 : 8
wheelEnabled: false
function updateIconSize() {
if (!pressed) {
@ -210,7 +213,7 @@ PlasmaComponents.Page {
horizontalAlignment: Text.AlignLeft
}
PlasmaComponents.Slider {
LatteExtraControls.Slider {
Layout.fillWidth: true
id: zoomSlider
@ -221,6 +224,7 @@ PlasmaComponents.Page {
minimumValue: 1
maximumValue: 2
stepSize: 0.05
wheelEnabled: false
function updateZoomLevel() {
if (!pressed) {
@ -262,13 +266,14 @@ PlasmaComponents.Page {
enabled: proportionSizeSlider.value >= proportionSizeSlider.realMinimum
}
PlasmaComponents.Slider {
LatteExtraControls.Slider {
id: proportionSizeSlider
Layout.fillWidth: true
value: plasmoid.configuration.proportionIconSize
minimumValue: 1.0
maximumValue: 10
stepSize: 0.5
wheelEnabled: false
property real realMinimum: minimumValue + 0.5
function updateProportionIconSize() {
@ -316,13 +321,14 @@ PlasmaComponents.Page {
enabled: iconMarginSlider.value > 0
}
PlasmaComponents.Slider {
LatteExtraControls.Slider {
id: iconMarginSlider
Layout.fillWidth: true
value: plasmoid.configuration.iconMargin
minimumValue: 0
maximumValue: 100
stepSize: 5
wheelEnabled: false
onPressedChanged: {
if (!pressed) {
@ -378,7 +384,7 @@ PlasmaComponents.Page {
horizontalAlignment: Text.AlignLeft
}
PlasmaComponents.Slider {
LatteExtraControls.Slider {
id: panelSizeSlider
Layout.fillWidth: true
enabled: showBackground.checked
@ -387,6 +393,7 @@ PlasmaComponents.Page {
minimumValue: 0
maximumValue: 100
stepSize: 5
wheelEnabled: false
function updatePanelSize() {
if (!pressed)
@ -426,7 +433,7 @@ PlasmaComponents.Page {
enabled: transparencySlider.enabled
}
PlasmaComponents.Slider {
LatteExtraControls.Slider {
id: transparencySlider
Layout.fillWidth: true
//! transparency can be set when the user doesnt want solidness all the time
@ -437,6 +444,7 @@ PlasmaComponents.Page {
minimumValue: 0
maximumValue: 100
stepSize: 5
wheelEnabled: false
property bool blockOpacityAdjustment: (plasmoid.configuration.solidBackgroundForMaximized && plasmoid.configuration.backgroundOnlyOnMaximized)
|| (solidBackground.checked
@ -781,7 +789,7 @@ PlasmaComponents.Page {
horizontalAlignment: Text.AlignLeft
}
PlasmaComponents.Slider {
LatteExtraControls.Slider {
id: glowOpacitySlider
Layout.fillWidth: true
enabled: showGlowChk.checked
@ -790,6 +798,7 @@ PlasmaComponents.Page {
minimumValue: 0
maximumValue: 100
stepSize: 5
wheelEnabled: false
function updateGlowOpacity() {
if (!pressed)
@ -1009,7 +1018,7 @@ PlasmaComponents.Page {
horizontalAlignment: Text.AlignLeft
}
PlasmaComponents.Slider {
LatteExtraControls.Slider {
id: shadowOpacitySlider
Layout.fillWidth: true
enabled: showAppletShadow.checked
@ -1018,6 +1027,7 @@ PlasmaComponents.Page {
minimumValue: 0
maximumValue: 100
stepSize: 5
wheelEnabled: false
function updateShadowOpacity() {
if (!pressed)
@ -1058,7 +1068,7 @@ PlasmaComponents.Page {
horizontalAlignment: Text.AlignLeft
}
PlasmaComponents.Slider {
LatteExtraControls.Slider {
id: shadowSizeSlider
Layout.fillWidth: true
enabled: showAppletShadow.checked
@ -1067,6 +1077,7 @@ PlasmaComponents.Page {
minimumValue: 0
maximumValue: 100
stepSize: 5
wheelEnabled: false
function updateShadowSize() {
if (!pressed)
@ -1119,7 +1130,7 @@ PlasmaComponents.Page {
horizontalAlignment: Text.AlignLeft
}
PlasmaComponents.Slider {
LatteExtraControls.Slider {
Layout.fillWidth: true
id: maxLengthSlider
@ -1130,6 +1141,7 @@ PlasmaComponents.Page {
minimumValue: 30
maximumValue: 100
stepSize: 2
wheelEnabled: false
function updateMaxLength() {
if (!pressed) {
@ -1194,7 +1206,7 @@ PlasmaComponents.Page {
horizontalAlignment: Text.AlignLeft
}
PlasmaComponents.Slider {
LatteExtraControls.Slider {
Layout.fillWidth: true
id: offsetSlider
@ -1207,6 +1219,7 @@ PlasmaComponents.Page {
maximumValue: ((plasmoid.configuration.panelPosition === Latte.Dock.Center)
|| (plasmoid.configuration.panelPosition === Latte.Dock.Justify)) ? 20 : 40
stepSize: 2
wheelEnabled: false
function updateOffset() {
if (!pressed) {

@ -29,7 +29,8 @@ import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.plasmoid 2.0
import org.kde.latte 0.1 as Latte
import "../controls" as ExtraControls
import "../controls" as LatteExtraControls
PlasmaComponents.Page {
Layout.maximumWidth: content.width + content.Layout.leftMargin * 2
@ -467,7 +468,7 @@ PlasmaComponents.Page {
horizontalAlignment: Text.AlignRight
text: i18n("Show:")
}
LatteTextField {
LatteExtraControls.TextField {
Layout.preferredWidth: width
text: dock.visibility.timerShow
@ -482,7 +483,7 @@ PlasmaComponents.Page {
horizontalAlignment: Text.AlignRight
text: i18n("Hide:")
}
LatteTextField{
LatteExtraControls.TextField{
Layout.preferredWidth: width
text: dock.visibility.timerHide

@ -0,0 +1,92 @@
/*
* Copyright (C) 2011 by Daker Fernandes Pinheiro <dakerfp@gmail.com>
* Copyright (C) 2014 by Marco Martin <mart@kde.org>
* Copyright (C) 2018 by Michail Vourlakos <mvourlakos@gmail.com>
*
* 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 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.7
import org.kde.plasma.core 2.0 as PlasmaCore
import QtQuick.Controls 1.6 as QtControls
import QtQuick.Controls.Styles.Plasma 2.0 as Styles
/**
* An interactive slider component with Plasma look and feel.
*
* @inherit QtQuick.Controls.Slider
*/
QtControls.Slider {
id: slider
/**
* This property holds if a value indicator element will be shown while is
* dragged or not.
*
* @warning The value indicator is not implemented in the Plasma Slider.
*
* The default value is false.
*/
property bool valueIndicatorVisible: false
/**
* This property holds the text being displayed in the value indicator.
*
* @warning The value indicator is not implemented in the Plasma Slider.
*/
property string valueIndicatorText: value
/**
* type:bool
* This property holds if the slider visualizations has an inverted
* direction.
*
* @warning: deprecated and not supported, here for retrocompatibility
*/
property bool inverted: false
width: slider.isVertical ? theme.mSize(theme.defaultFont).height*1.6 : 200
height: slider.isVertical ? 200 : theme.mSize(theme.defaultFont).height*1.6
// TODO: needs to define if there will be specific graphics for
// disabled sliders
opacity: enabled ? 1.0 : 0.5
activeFocusOnTab: true
//FIXME: remove those 2 functions once we can depend from 5.4*/
function accessibleIncreaseAction() { increase() }
function accessibleDecreaseAction() { decrease() }
function increase() {
if (!enabled)
return;
if (inverted)
value += stepSize;
else
value -= stepSize;
}
function decrease() {
if (!enabled)
return;
if (inverted)
value -= stepSize;
else
value += stepSize;
}
style: Styles.SliderStyle {}
}
Loading…
Cancel
Save