diff --git a/sddm-theme/Background.qml b/sddm-theme/Background.qml --- a/sddm-theme/Background.qml +++ b/sddm-theme/Background.qml @@ -1,47 +1,67 @@ -/*************************************************************************** -* Copyright (c) 2013 Abdurrahman AVCI -* -* 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 + * + * 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 == "color" + PropertyChanges { + target: sceneColorBackground + visible: true + } + PropertyChanges { + target: sceneImageBackground + visible: false + } + } + ] } diff --git a/sddm-theme/Main.qml b/sddm-theme/Main.qml --- a/sddm-theme/Main.qml +++ b/sddm-theme/Main.qml @@ -44,9 +44,10 @@ 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 --- a/sddm-theme/theme.conf +++ b/sddm-theme/theme.conf @@ -1,2 +1,4 @@ [General] +type=color +color=#1d99f3 background=