chore: initial commit

This commit is contained in:
Alexandre Cavalheiro S. Tiago Da Silva 2021-04-05 10:48:05 -03:00
commit 67c7ccd66b
No known key found for this signature in database
GPG key ID: 03C18A5682B3E189
11102 changed files with 455009 additions and 0 deletions

View file

@ -0,0 +1,91 @@
/*
* Copyright 2016 David Edmundson <davidedmundson@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 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 org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
Item {
id: root
property alias text: label.text
property alias iconSource: icon.source
property alias containsMouse: mouseArea.containsMouse
property alias font: label.font
signal clicked
activeFocusOnTab: true
property int iconSize: units.gridUnit * 2.5
implicitWidth: Math.max(iconSize + units.largeSpacing * 2, label.contentWidth)
implicitHeight: iconSize + units.smallSpacing + label.implicitHeight
opacity: activeFocus || containsMouse ? 1.5 : 0.97
Behavior on opacity {
PropertyAnimation { // OpacityAnimator makes it turn black at random intervals
duration: units.longDuration * 2
easing.type: Easing.InOutQuad
}
}
PlasmaCore.IconItem {
id: icon
anchors {
top: parent.top
horizontalCenter: parent.horizontalCenter
}
width: iconSize
height: iconSize
colorGroup: PlasmaCore.ColorScope.colorGroup
active: mouseArea.containsMouse || root.activeFocus
}
PlasmaComponents.Label {
id: label
anchors {
top: icon.bottom
topMargin: units.smallSpacing
left: parent.left
right: parent.right
}
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignTop
wrapMode: Text.WordWrap
font.underline: root.activeFocus
font.pointSize: config.fontSize
font.family: config.font
color:activeFocus || containsMouse ? config.highlight_color : config.color
}
MouseArea {
id: mouseArea
hoverEnabled: true
onClicked: root.clicked()
anchors.fill: parent
}
Keys.onEnterPressed: clicked()
Keys.onReturnPressed: clicked()
Keys.onSpacePressed: clicked()
Accessible.onPressAction: clicked()
Accessible.role: Accessible.Button
Accessible.name: label.text
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2016 Kai Uwe Broulik <kde@privat.broulik.de>
*
* 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 org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.workspace.components 2.0 as PW
Row {
spacing: units.smallSpacing
visible: pmSource.data["Battery"]["Has Cumulative"]
PlasmaCore.DataSource {
id: pmSource
engine: "powermanagement"
connectedSources: ["Battery", "AC Adapter"]
}
PW.BatteryIcon {
id: battery
hasBattery: pmSource.data["Battery"]["Has Battery"] || false
percent: pmSource.data["Battery"]["Percent"] || 0
pluggedIn: pmSource.data["AC Adapter"] ? pmSource.data["AC Adapter"]["Plugged in"] : false
height: batteryLabel.height
width: height
}
PlasmaComponents.Label {
id: batteryLabel
height: undefined
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","%1%", battery.percent)
Accessible.name: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Battery at %1%", battery.percent)
}
}

View file

@ -0,0 +1,55 @@
/*
* Copyright 2016 David Edmundson <davidedmundson@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 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.8
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.5
import org.kde.plasma.core 2.0
RowLayout {
readonly property bool softwareRendering: GraphicsInfo.api === GraphicsInfo.Software
Label {
text: Qt.formatDate(timeSource.data["Local"]["DateTime"], Qt.DefaultLocaleLongDate)
color: config.color
style: softwareRendering ? Text.Outline : Text.Normal
styleColor: softwareRendering ? ColorScope.backgroundColor : "transparent" //no outline, doesn't matter
font.pointSize: 11
Layout.alignment: Qt.AlignHCenter
font.family: config.font
}
Label {
text: Qt.formatTime(timeSource.data["Local"]["DateTime"])
color: config.color
style: softwareRendering ? Text.Outline : Text.Normal
styleColor: softwareRendering ? ColorScope.backgroundColor : "transparent" //no outline, doesn't matter
font.pointSize: 11
Layout.alignment: Qt.AlignHCenter
font.family: config.font
}
DataSource {
id: timeSource
engine: "time"
connectedSources: ["Local"]
interval: 1000
}
}

View file

@ -0,0 +1,19 @@
import QtQuick 2.2
import QtQuick.Layouts 1.2
import QtQuick.Controls 2.4
import QtQuick.Controls.Styles 1.4
TextField {
placeholderTextColor: config.color
palette.text: config.color
font.pointSize: config.fontSize
font.family: config.font
background: Rectangle {
color: "#3B3D48"
radius: parent.width / 2
height: 30
width: parent.width
opacity: 0.7
anchors.centerIn: parent
}
}

View file

@ -0,0 +1,48 @@
/***************************************************************************
* Copyright (C) 2014 by Daniel Vrátil <dvratil@redhat.com> *
* *
* This program 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. *
* *
* 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 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.1
import QtQuick.Controls 1.1 as QQC
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.workspace.keyboardlayout 1.0
PlasmaComponents.ToolButton {
id: kbLayoutButton
iconName: "input-keyboard"
implicitWidth: minimumWidth
text: layout.currentLayoutDisplayName
Accessible.name: i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "Button to change keyboard layout", "Switch layout")
visible: layout.layouts.length > 1
onClicked: layout.nextLayout()
KeyboardLayout {
id: layout
function nextLayout() {
var layouts = layout.layouts;
var index = (layouts.indexOf(layout.currentLayout)+1) % layouts.length;
layout.currentLayout = layouts[index];
}
}
}

View file

@ -0,0 +1,119 @@
/*
* Copyright 2016 David Edmundson <davidedmundson@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 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 QtQuick.Layouts 1.1
import QtQuick.Controls 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
Item {
id: root
/*
* Any message to be displayed to the user, visible above the text fields
*/
property alias notificationMessage: notificationsLabel.text
/*
* A list of Items (typically ActionButtons) to be shown in a Row beneath the prompts
*/
property alias actionItems: actionItemsLayout.children
/*
* A model with a list of users to show in the view
* The following roles should exist:
* - name
* - iconSource
*
* The following are also handled:
* - vtNumber
* - displayNumber
* - session
* - isTty
*/
property alias userListModel: userListView.model
/*
* Self explanatory
*/
property alias userListCurrentIndex: userListView.currentIndex
property var userListCurrentModelData: userListView.currentItem === null ? [] : userListView.currentItem.m
property bool showUserList: true
property alias userList: userListView
default property alias _children: innerLayout.children
UserList {
id: userListView
visible: showUserList && y > 0
anchors {
bottom: parent.verticalCenter
left: parent.left
right: parent.right
}
}
//goal is to show the prompts, in ~16 grid units high, then the action buttons
//but collapse the space between the prompts and actions if there's no room
//ui is constrained to 16 grid units wide, or the screen
ColumnLayout {
id: prompts
anchors.top: parent.verticalCenter
anchors.topMargin: units.gridUnit * 0.5
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
PlasmaComponents.Label {
id: notificationsLabel
Layout.maximumWidth: units.gridUnit * 16
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
font.italic: true
}
ColumnLayout {
Layout.minimumHeight: implicitHeight
Layout.maximumHeight: units.gridUnit * 10
Layout.maximumWidth: units.gridUnit * 16
Layout.alignment: Qt.AlignHCenter
ColumnLayout {
id: innerLayout
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
}
Item {
Layout.fillHeight: true
}
}
Row { //deliberately not rowlayout as I'm not trying to resize child items
id: actionItemsLayout
spacing: units.smallSpacing
Layout.alignment: Qt.AlignHCenter
}
Item {
Layout.fillHeight: true
}
}
}

View file

@ -0,0 +1,190 @@
/*
* Copyright 2014 David Edmundson <davidedmundson@kde.org>
* Copyright 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.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 02110-1301, USA.
*/
import QtQuick 2.8
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
Item {
id: wrapper
// If we're using software rendering, draw outlines instead of shadows
// See https://bugs.kde.org/show_bug.cgi?id=398317
readonly property bool softwareRendering: GraphicsInfo.api === GraphicsInfo.Software
property bool isCurrent: true
readonly property var m: model
property string name
property string userName
property string avatarPath
property string iconSource
property bool constrainText: true
property alias nameFontSize: usernameDelegate.font.pointSize
property int fontSize: config.fontSize - 1
signal clicked()
property real faceSize: Math.min(width, height - usernameDelegate.height - units.smallSpacing)
opacity: isCurrent ? 1.0 : 0.5
Behavior on opacity {
OpacityAnimator {
duration: units.longDuration
}
}
// Draw a translucent background circle under the user picture
Rectangle {
anchors.centerIn: imageSource
width: imageSource.width + 2 // Subtract to prevent fringing
height: width
radius: width / 2
color: "#232831"
}
Item {
id: imageSource
anchors {
bottom: usernameDelegate.top
bottomMargin: units.largeSpacing
horizontalCenter: parent.horizontalCenter
}
Behavior on width {
PropertyAnimation {
from: faceSize
duration: units.longDuration * 2;
}
}
width: isCurrent ? faceSize : faceSize - units.largeSpacing
height: width
//Image takes priority, taking a full path to a file, if that doesn't exist we show an icon
Image {
id: face
source: wrapper.avatarPath
sourceSize: Qt.size(faceSize, faceSize)
fillMode: Image.PreserveAspectCrop
anchors.fill: parent
}
PlasmaCore.IconItem {
id: faceIcon
source: iconSource
visible: (face.status == Image.Error || face.status == Image.Null)
anchors.fill: parent
anchors.margins: units.gridUnit * 0.5 // because mockup says so...
colorGroup: PlasmaCore.ColorScope.colorGroup
}
}
ShaderEffect {
anchors {
bottom: usernameDelegate.top
bottomMargin: units.largeSpacing
horizontalCenter: parent.horizontalCenter
}
width: imageSource.width
height: imageSource.height
supportsAtlasTextures: true
property var source: ShaderEffectSource {
sourceItem: imageSource
// software rendering is just a fallback so we can accept not having a rounded avatar here
hideSource: wrapper.GraphicsInfo.api !== GraphicsInfo.Software
live: true // otherwise the user in focus will show a blurred avatar
}
property var colorBorder: "#00000000"
//draw a circle with an antialised border
//innerRadius = size of the inner circle with contents
//outerRadius = size of the border
//blend = area to blend between two colours
//all sizes are normalised so 0.5 == half the width of the texture
//if copying into another project don't forget to connect themeChanged to update()
//but in SDDM that's a bit pointless
fragmentShader: "
varying highp vec2 qt_TexCoord0;
uniform highp float qt_Opacity;
uniform lowp sampler2D source;
uniform lowp vec4 colorBorder;
highp float blend = 0.01;
highp float innerRadius = 0.47;
highp float outerRadius = 0.49;
lowp vec4 colorEmpty = vec4(0.0, 0.0, 0.0, 0.0);
void main() {
lowp vec4 colorSource = texture2D(source, qt_TexCoord0.st);
highp vec2 m = qt_TexCoord0 - vec2(0.5, 0.5);
highp float dist = sqrt(m.x * m.x + m.y * m.y);
if (dist < innerRadius)
gl_FragColor = colorSource;
else if (dist < innerRadius + blend)
gl_FragColor = mix(colorSource, colorBorder, ((dist - innerRadius) / blend));
else if (dist < outerRadius)
gl_FragColor = colorBorder;
else if (dist < outerRadius + blend)
gl_FragColor = mix(colorBorder, colorEmpty, ((dist - outerRadius) / blend));
else
gl_FragColor = colorEmpty ;
gl_FragColor = gl_FragColor * qt_Opacity;
}
"
}
PlasmaComponents.Label {
id: usernameDelegate
font.pointSize: Math.max(fontSize + 2,theme.defaultFont.pointSize + 2)
anchors {
bottom: parent.bottom
horizontalCenter: parent.horizontalCenter
}
height: implicitHeight // work around stupid bug in Plasma Components that sets the height
width: constrainText ? parent.width : implicitWidth
text: wrapper.name
style: softwareRendering ? Text.Outline : Text.Normal
styleColor: softwareRendering ? PlasmaCore.ColorScope.backgroundColor : "transparent" //no outline, doesn't matter
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
color: config.color
//make an indication that this has active focus, this only happens when reached with keyboard navigation
font.underline: wrapper.activeFocus
font.family: config.font
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
onClicked: wrapper.clicked();
}
Accessible.name: name
Accessible.role: Accessible.Button
function accessiblePressAction() { wrapper.clicked() }
}

View file

@ -0,0 +1,93 @@
/*
* Copyright 2014 David Edmundson <davidedmundson@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 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
ListView {
id: view
readonly property string selectedUser: currentItem ? currentItem.userName : ""
readonly property int userItemWidth: units.gridUnit * 8
readonly property int userItemHeight: units.gridUnit * 8
implicitHeight: userItemHeight
activeFocusOnTab : true
/*
* Signals that a user was explicitly selected
*/
signal userSelected;
orientation: ListView.Horizontal
highlightRangeMode: ListView.StrictlyEnforceRange
//centre align selected item (which implicitly centre aligns the rest
preferredHighlightBegin: width/2 - userItemWidth/2
preferredHighlightEnd: preferredHighlightBegin
delegate: UserDelegate {
avatarPath: model.icon || ""
iconSource: model.iconName || "user-identity"
name: {
var displayName = model.realName || model.name
if (model.vtNumber === undefined || model.vtNumber < 0) {
return displayName
}
if (!model.session) {
return i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "Nobody logged in on that session", "Unused")
}
var location = ""
if (model.isTty) {
location = i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "User logged in on console number", "TTY %1", model.vtNumber)
} else if (model.displayNumber) {
location = i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "User logged in on console (X display number)", "on TTY %1 (Display %2)", model.vtNumber, model.displayNumber)
}
if (location) {
return i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "Username (location)", "%1 (%2)", displayName, location)
}
return displayName
}
userName: model.name
width: userItemWidth
height: userItemHeight
//if we only have one delegate, we don't need to clip the text as it won't be overlapping with anything
constrainText: ListView.view.count > 1
isCurrent: ListView.isCurrentItem
onClicked: {
ListView.view.currentIndex = index;
ListView.view.userSelected();
}
}
Keys.onEscapePressed: view.userSelected()
Keys.onEnterPressed: view.userSelected()
Keys.onReturnPressed: view.userSelected()
}

View file

@ -0,0 +1,29 @@
/********************************************************************
This file is part of the KDE project.
Copyright (C) 2017 Martin Gräßlin <mgraesslin@kde.org>
This program 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.
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 General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
import QtQuick 2.5
import QtQuick.VirtualKeyboard 2.1
InputPanel {
id: inputPanel
property bool activated: false
active: activated && Qt.inputMethod.visible
visible: active
width: parent.width
}