Commit c02b4329 authored by Cyril Rossi's avatar Cyril Rossi

Use SettingHighlighter to enabled highlight of non default settings in KCM KScreenLocker

parent e4af18d6
......@@ -2,10 +2,13 @@ import QtQuick 2.5
import QtQuick.Controls 2.5 as QQC2
import QtQuick.Layouts 1.1
import org.kde.kirigami 2.12 as Kirigami
import org.kde.kcm 1.5 as KCM
Kirigami.FormLayout {
property alias cfg_alwaysShowClock: alwaysClock.checked
property alias cfg_showMediaControls: showMediaControls.checked
property bool cfg_alwaysShowClockDefault: false
property bool cfg_showMediaControlsDefault: false
twinFormLayouts: parentLayout
......@@ -13,9 +16,17 @@ Kirigami.FormLayout {
id: alwaysClock
Kirigami.FormData.label: i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "verb, to show something", "Show:")
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Clock")
KCM.SettingHighlighter {
highlight: cfg_alwaysShowClockDefault != cfg_alwaysShowClock
}
}
QQC2.CheckBox {
id: showMediaControls
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Media Controls")
KCM.SettingHighlighter {
highlight: cfg_showMediaControlsDefault != cfg_showMediaControls
}
}
}
......@@ -32,7 +32,7 @@ KCM.GridDelegate {
id: wallpaperDelegate
property alias color: backgroundRect.color
readonly property bool selected: (view.currentIndex === index)
readonly property bool selected: (GridView.currentIndex === index)
opacity: model.pendingDeletion ? 0.5 : 1
text: model.display
......@@ -130,6 +130,6 @@ KCM.GridDelegate {
if (configDialog.currentWallpaper == "org.kde.image") {
cfg_Image = model.packageName || model.path;
}
view.currentIndex = index;
GridView.currentIndex = index;
}
}
......@@ -19,7 +19,7 @@
*/
import QtQuick 2.5
import QtQuick.Controls 2.3 as QtControls2
import QtQuick.Controls 2.5 as QtControls2
import QtQuick.Layouts 1.0
import QtQuick.Window 2.0 // for Screen
import org.kde.plasma.wallpapers.image 2.0 as Wallpaper
......@@ -27,19 +27,27 @@ import org.kde.kquickcontrols 2.0 as KQuickControls
import org.kde.kquickcontrolsaddons 2.0
import org.kde.newstuff 1.62 as NewStuff
import org.kde.draganddrop 2.0 as DragDrop
import org.kde.kcm 1.1 as KCM
import org.kde.kcm 1.5 as KCM
import org.kde.kirigami 2.12 as Kirigami
ColumnLayout {
id: root
property alias cfg_Color: colorButton.color
property color cfg_ColorDefault
property string cfg_Image
property string cfg_ImageDefault
property int cfg_FillMode
property int cfg_FillModeDefault
property int cfg_SlideshowMode
property int cfg_SlideshowModeDefault
property alias cfg_Blur: blurRadioButton.checked
property var cfg_SlidePaths: ""
property bool cfg_BlurDefault
property string cfg_SlidePaths: ""
property string cfg_SlidePathsDefault: ""
property int cfg_SlideInterval: 0
property int cfg_SlideIntervalDefault: 0
property var cfg_UncheckedSlides: []
property var cfg_UncheckedSlidesDefault: []
function saveConfig() {
imageWallpaper.commitDeletion();
......@@ -82,6 +90,10 @@ ColumnLayout {
property int minutesIntervalValue: Math.floor(cfg_SlideInterval % 3600) / 60
property int secondsIntervalValue: cfg_SlideInterval % 3600 % 60
property int hoursIntervalValueDefault: Math.floor(cfg_SlideIntervalDefault / 3600)
property int minutesIntervalValueDefault: Math.floor(cfg_SlideIntervalDefault % 3600) / 60
property int secondsIntervalValueDefault: cfg_SlideIntervalDefault % 3600 % 60
//Rectangle { color: "orange"; x: formAlignment; width: formAlignment; height: 20 }
Kirigami.FormLayout {
......@@ -116,6 +128,10 @@ ColumnLayout {
onCurrentIndexChanged: cfg_FillMode = model[currentIndex]["fillMode"]
Component.onCompleted: setMethod();
KCM.SettingHighlighter {
highlight: cfg_FillModeDefault != cfg_FillMode
}
function setMethod() {
for (var i = 0; i < model.length; i++) {
if (model[i]["fillMode"] === root.cfg_FillMode) {
......@@ -165,6 +181,10 @@ ColumnLayout {
}
}
}
KCM.SettingHighlighter {
highlight: cfg_SlideshowMode != cfg_SlideshowModeDefault
}
}
QtControls2.ButtonGroup { id: backgroundGroup }
......@@ -185,10 +205,18 @@ ColumnLayout {
text: i18nd("plasma_wallpaper_org.kde.image", "Solid color")
checked: !cfg_Blur
QtControls2.ButtonGroup.group: backgroundGroup
KCM.SettingHighlighter {
highlight: cfg_Blur != cfg_BlurDefault
}
}
KQuickControls.ColorButton {
id: colorButton
dialogTitle: i18nd("plasma_wallpaper_org.kde.image", "Select Background Color")
KCM.SettingHighlighter {
highlight: cfg_Color != cfg_ColorDefault
}
}
}
}
......@@ -221,6 +249,10 @@ ColumnLayout {
valueFromText: function(text, locale) {
return parseInt(text);
}
KCM.SettingHighlighter {
highlight: root.hoursIntervalValue != root.hoursIntervalValueDefault
}
}
QtControls2.SpinBox {
id: minutesInterval
......@@ -236,6 +268,10 @@ ColumnLayout {
valueFromText: function(text, locale) {
return parseInt(text);
}
KCM.SettingHighlighter {
highlight: root.minutesIntervalValue != root.minutesIntervalValueDefault
}
}
QtControls2.SpinBox {
id: secondsInterval
......@@ -251,6 +287,10 @@ ColumnLayout {
valueFromText: function(text, locale) {
return parseInt(text);
}
KCM.SettingHighlighter {
highlight: root.secondsIntervalValue != root.secondsIntervalValueDefault
}
}
}
}
......@@ -299,6 +339,7 @@ ColumnLayout {
QtControls2.ToolTip.delay: 1000
QtControls2.ToolTip.timeout: 5000
}
actions: [
Kirigami.Action {
iconName: "list-remove"
......@@ -346,33 +387,42 @@ ColumnLayout {
Component {
id: thumbnailsComponent
KCM.GridView {
id: wallpapersGrid
property var imageModel: (configDialog.currentWallpaper == "org.kde.image")? imageWallpaper.wallpaperModel : imageWallpaper.slideFilterModel
function resetCurrentIndex() {
//that min is needed as the module will be populated in an async way
//and only on demand so we can't ensure it already exists
view.currentIndex = Qt.binding(function() { return Math.min(imageModel.indexOf(cfg_Image), imageModel.count - 1) });
}
//kill the space for label under thumbnails
view.model: imageModel
Component.onCompleted: {
imageModel.usedInConfig = true;
resetCurrentIndex()
}
view.delegate: WallpaperDelegate {
color: cfg_Color
Item {
KCM.SettingHighlighter {
target: wallpapersGrid
highlight: configDialog.currentWallpaper === "org.kde.image" && cfg_Image != cfg_ImageDefault
}
Kirigami.PlaceholderMessage {
KCM.GridView {
id: wallpapersGrid
anchors.fill: parent
anchors.margins: Kirigami.Units.largeSpacing * 2
// FIXME: this is needed to vertically center it in the grid for some reason
anchors.topMargin: wallpapersGrid.height / 2
visible: wallpapersGrid.view.count === 0
text: i18nd("plasma_wallpaper_org.kde.image", "There are no wallpapers in this slideshow")
property var imageModel: (configDialog.currentWallpaper == "org.kde.image")? imageWallpaper.wallpaperModel : imageWallpaper.slideFilterModel
function resetCurrentIndex() {
//that min is needed as the module will be populated in an async way
//and only on demand so we can't ensure it already exists
view.currentIndex = Qt.binding(function() { return Math.min(imageModel.indexOf(cfg_Image), imageModel.count - 1) });
}
//kill the space for label under thumbnails
view.model: imageModel
Component.onCompleted: {
imageModel.usedInConfig = true;
resetCurrentIndex()
}
view.delegate: WallpaperDelegate {
color: cfg_Color
}
Kirigami.PlaceholderMessage {
anchors.fill: parent
anchors.margins: Kirigami.Units.largeSpacing * 2
// FIXME: this is needed to vertically center it in the grid for some reason
anchors.topMargin: wallpapersGrid.height / 2
visible: wallpapersGrid.view.count === 0
text: i18nd("plasma_wallpaper_org.kde.image", "There are no wallpapers in this slideshow")
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment