summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoudhayan Gupta <[email protected]>2016-10-11 20:00:47 +0530
committerBoudhayan Gupta <[email protected]>2016-10-11 20:03:42 +0530
commitaafa20f19c87898a1ff06996ba0fffebdc236ba5 (patch)
tree04a3ee5f0a7cead34e81e901461757ae071cf757
parentc05f2fc2171e5c6eabb6dc52f9cf4aa6a5628bbb (diff)
sddm-theme: support configurable solid colour and image backgrounds
This patch reworks the Background component in the SDDM theme to support distinct "image" and "color" modes, with a background image being displayed in the former mode and a solid colour in the latter. It further adds the background colour and the background type to the configuration file. Fixes D2983
-rw-r--r--sddm-theme/Background.qml88
-rw-r--r--sddm-theme/Main.qml7
-rw-r--r--sddm-theme/theme.conf2
3 files changed, 60 insertions, 37 deletions
diff --git a/sddm-theme/Background.qml b/sddm-theme/Background.qml
index 9a15c94..bddbf5d 100644
--- a/sddm-theme/Background.qml
+++ b/sddm-theme/Background.qml
@@ -1,47 +1,67 @@
-/***************************************************************************
-* Copyright (c) 2013 Abdurrahman AVCI <[email protected]>
-*
-* Permission is hereby granted, free of charge, to any person
-* obtaining a copy of this software and associated documentation
-* files (the "Software"), to deal in the Software without restriction,
-* including without limitation the rights to use, copy, modify, merge,
-* publish, distribute, sublicense, and/or sell copies of the Software,
-* and to permit persons to whom the Software is furnished to do so,
-* subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
-* OR OTHER DEALINGS IN THE SOFTWARE.
-*
-***************************************************************************/
+/*
+ * Copyright 2016 Boudhayan Gupta <[email protected]>
+ *
+ * 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 02110-1301, USA.
+ */
import QtQuick 2.2
-import QtGraphicalEffects 1.0
-
FocusScope {
- property alias source: image.source
- property alias fillMode: image.fillMode
- property alias status: image.status
+ id: sceneBackground
+
+ property var sceneBackgroundType
+ property alias sceneBackgroundColor: sceneColorBackground.color
+ property alias sceneBackgroundImage: sceneImageBackground.source
Rectangle {
+ id: sceneColorBackground
anchors.fill: parent
- color: "#1d99f3"
}
Image {
- id: image
+ id: sceneImageBackground
anchors.fill: parent
-
- clip: true
- focus: true
- smooth: true
+ fillMode: Image.PreserveAspectCrop
+ smooth: true;
}
+
+ states: [
+ State {
+ name: "imageBackground"
+ when: sceneBackgroundType == "image"
+ PropertyChanges {
+ target: sceneColorBackground
+ visible: false
+ }
+ PropertyChanges {
+ target: sceneImageBackground
+ visible: true
+ }
+ },
+ State {
+ name: "colorBackground"
+ when: sceneBackgroundType != "image"
+ PropertyChanges {
+ target: sceneColorBackground
+ visible: true
+ }
+ PropertyChanges {
+ target: sceneImageBackground
+ visible: false
+ }
+ }
+ ]
}
diff --git a/sddm-theme/Main.qml b/sddm-theme/Main.qml
index 4230cbe..dd42c28 100644
--- a/sddm-theme/Main.qml
+++ b/sddm-theme/Main.qml
@@ -50,9 +50,10 @@ PlasmaCore.ColorScope {
model: screenModel
Background {
- x: geometry.x; y: geometry.y; width: geometry.width; height:geometry.height
- source: config.background
- fillMode: Image.PreserveAspectCrop
+ x: geometry.x; y: geometry.y; width: geometry.width; height: geometry.height
+ sceneBackgroundType: config.type
+ sceneBackgroundColor: config.color
+ sceneBackgroundImage: config.background
}
}
diff --git a/sddm-theme/theme.conf b/sddm-theme/theme.conf
index 5dae68f..c293b25 100644
--- a/sddm-theme/theme.conf
+++ b/sddm-theme/theme.conf
@@ -1,2 +1,4 @@
[General]
+type=color
+color=#1d99f3
background=