mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
wallpaper and applets config as a sidepanel
This commit is contained in:
parent
e5b479b3f9
commit
2ed4578a55
2 changed files with 213 additions and 163 deletions
|
|
@ -30,7 +30,7 @@ Rectangle {
|
||||||
Layout.minimumHeight: units.gridUnit * 20
|
Layout.minimumHeight: units.gridUnit * 20
|
||||||
|
|
||||||
//BEGIN properties
|
//BEGIN properties
|
||||||
color: syspal.window
|
color: Qt.rgba(0, 0, 0, 1 - panel.x/width)
|
||||||
width: units.gridUnit * 40
|
width: units.gridUnit * 40
|
||||||
height: units.gridUnit * 30
|
height: units.gridUnit * 30
|
||||||
|
|
||||||
|
|
@ -109,14 +109,44 @@ Rectangle {
|
||||||
main.sourceFile = globalConfigModel.get(0).source
|
main.sourceFile = globalConfigModel.get(0).source
|
||||||
main.title = globalConfigModel.get(0).name
|
main.title = globalConfigModel.get(0).name
|
||||||
}
|
}
|
||||||
// root.width = mainColumn.implicitWidth
|
|
||||||
// root.height = mainColumn.implicitHeight
|
|
||||||
}
|
}
|
||||||
//END connections
|
//END connections
|
||||||
|
|
||||||
//BEGIN UI components
|
//BEGIN UI components
|
||||||
SystemPalette {id: syspal}
|
SystemPalette {id: syspal}
|
||||||
|
|
||||||
|
NumberAnimation {
|
||||||
|
id: openAnim
|
||||||
|
running: true
|
||||||
|
target: panel
|
||||||
|
properties: "x"
|
||||||
|
duration: units.longDuration
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
to: root.width/6
|
||||||
|
}
|
||||||
|
SequentialAnimation {
|
||||||
|
id: closeAnim
|
||||||
|
NumberAnimation {
|
||||||
|
target: panel
|
||||||
|
properties: "x"
|
||||||
|
duration: units.longDuration
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
to: root.width
|
||||||
|
}
|
||||||
|
ScriptAction {
|
||||||
|
script: cancelAction.trigger();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
running: true
|
||||||
|
interval: 250
|
||||||
|
onTriggered: {
|
||||||
|
openAnim.running = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onWidthChanged: panel.x = root.width/6
|
||||||
|
|
||||||
MessageDialog {
|
MessageDialog {
|
||||||
id: messageDialog
|
id: messageDialog
|
||||||
icon: StandardIcon.Warning
|
icon: StandardIcon.Warning
|
||||||
|
|
@ -133,189 +163,205 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
MouseArea {
|
||||||
id: mainColumn
|
anchors.fill: parent
|
||||||
anchors {
|
drag.filterChildren: true
|
||||||
fill: parent
|
drag.target: panel
|
||||||
margins: mainColumn.spacing //margins are hardcoded in QStyle we should match that here
|
drag.axis: Drag.XAxis
|
||||||
|
drag.maximumX: width
|
||||||
|
drag.minimumX: width/6
|
||||||
|
onReleased: {
|
||||||
|
if (panel.x > root.width/2) {
|
||||||
|
closeAnim.running = true;
|
||||||
|
} else {
|
||||||
|
openAnim.running = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
property int implicitWidth: Math.max(contentRow.implicitWidth, buttonsRow.implicitWidth) + 8
|
onClicked: {
|
||||||
property int implicitHeight: contentRow.implicitHeight + buttonsRow.implicitHeight + 8
|
if (mouse.x < width / 6) {
|
||||||
|
closeAnim.running = true;
|
||||||
RowLayout {
|
|
||||||
id: contentRow
|
|
||||||
anchors {
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
}
|
}
|
||||||
spacing: units.largeSpacing
|
}
|
||||||
Layout.fillHeight: true
|
Rectangle {
|
||||||
Layout.preferredHeight: parent.height - buttonsRow.height
|
id: panel
|
||||||
|
width: root.width - root.width/6
|
||||||
QtControls.ScrollView {
|
x: root.width
|
||||||
id: categoriesScroll
|
height: root.height
|
||||||
frameVisible: true
|
color: syspal.window
|
||||||
Layout.fillHeight: true
|
ColumnLayout {
|
||||||
visible: (configDialog.configModel ? configDialog.configModel.count : 0) + globalConfigModel.count > 1
|
id: mainColumn
|
||||||
width: visible ? units.gridUnit * 7 : 0
|
anchors {
|
||||||
implicitWidth: width
|
fill: parent
|
||||||
flickableItem.interactive: false
|
margins: mainColumn.spacing //margins are hardcoded in QStyle we should match that here
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
width: categoriesScroll.viewport.width
|
|
||||||
height: Math.max(categoriesScroll.viewport.height, categories.height)
|
|
||||||
color: syspal.base
|
|
||||||
|
|
||||||
Column {
|
|
||||||
id: categories
|
|
||||||
width: parent.width
|
|
||||||
height: childrenRect.height
|
|
||||||
|
|
||||||
property Item currentItem: children[1]
|
|
||||||
|
|
||||||
Repeater {
|
|
||||||
model: root.isContainment ? globalConfigModel : undefined
|
|
||||||
delegate: ConfigCategoryDelegate {}
|
|
||||||
}
|
|
||||||
Repeater {
|
|
||||||
model: configDialog.configModel
|
|
||||||
delegate: ConfigCategoryDelegate {}
|
|
||||||
}
|
|
||||||
Repeater {
|
|
||||||
model: !root.isContainment ? globalConfigModel : undefined
|
|
||||||
delegate: ConfigCategoryDelegate {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
property int implicitWidth: Math.max(contentRow.implicitWidth, buttonsRow.implicitWidth) + 8
|
||||||
QtControls.ScrollView {
|
property int implicitHeight: contentRow.implicitHeight + buttonsRow.implicitHeight + 8
|
||||||
id: scroll
|
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Column {
|
|
||||||
spacing: units.largeSpacing / 2
|
|
||||||
|
|
||||||
QtControls.Label {
|
RowLayout {
|
||||||
id: pageTitle
|
id: contentRow
|
||||||
width: scroll.viewport.width
|
anchors {
|
||||||
font.pointSize: theme.defaultFont.pointSize*2
|
left: parent.left
|
||||||
font.weight: Font.Light
|
right: parent.right
|
||||||
text: main.title
|
|
||||||
}
|
}
|
||||||
|
spacing: units.largeSpacing
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.preferredHeight: parent.height - buttonsRow.height
|
||||||
|
|
||||||
QtControls.StackView {
|
QtControls.ScrollView {
|
||||||
id: main
|
id: categoriesScroll
|
||||||
property string title: ""
|
frameVisible: true
|
||||||
property bool invertAnimations: false
|
Layout.fillHeight: true
|
||||||
|
visible: (configDialog.configModel ? configDialog.configModel.count : 0) + globalConfigModel.count > 1
|
||||||
|
width: visible ? units.gridUnit * 7 : 0
|
||||||
|
implicitWidth: width
|
||||||
|
flickableItem.interactive: false
|
||||||
|
|
||||||
height: Math.max((scroll.viewport.height - pageTitle.height - parent.spacing), (main.currentItem ? (main.currentItem.implicitHeight ? main.currentItem.implicitHeight : main.currentItem.childrenRect.height) : 0))
|
Rectangle {
|
||||||
width: scroll.viewport.width
|
width: categoriesScroll.viewport.width
|
||||||
|
height: Math.max(categoriesScroll.viewport.height, categories.height)
|
||||||
|
color: syspal.base
|
||||||
|
|
||||||
property string sourceFile
|
Column {
|
||||||
|
id: categories
|
||||||
|
width: parent.width
|
||||||
|
height: childrenRect.height
|
||||||
|
|
||||||
onSourceFileChanged: {
|
property Item currentItem: children[1]
|
||||||
// print("Source file changed in flickable" + sourceFile);
|
|
||||||
replace(Qt.resolvedUrl(sourceFile));
|
Repeater {
|
||||||
root.restoreConfig()
|
model: root.isContainment ? globalConfigModel : undefined
|
||||||
for (var prop in currentItem) {
|
delegate: ConfigCategoryDelegate {}
|
||||||
if (prop.indexOf("cfg_") === 0 && prop.indexOf("Changed") > 0 ) {
|
}
|
||||||
currentItem[prop].connect(root.settingValueChanged)
|
Repeater {
|
||||||
|
model: configDialog.configModel
|
||||||
|
delegate: ConfigCategoryDelegate {}
|
||||||
|
}
|
||||||
|
Repeater {
|
||||||
|
model: !root.isContainment ? globalConfigModel : undefined
|
||||||
|
delegate: ConfigCategoryDelegate {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (currentItem["configurationChanged"]) {
|
|
||||||
currentItem["configurationChanged"].connect(root.settingValueChanged)
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* This is not needed on a desktop shell that has ok/apply/cancel buttons, i'll leave it here only for future reference until we have a prototype for the active shell.
|
|
||||||
* root.pageChanged will start a timer, that in turn will call saveConfig() when triggered
|
|
||||||
|
|
||||||
for (var prop in currentItem) {
|
|
||||||
if (prop.indexOf("cfg_") === 0) {
|
|
||||||
currentItem[prop+"Changed"].connect(root.pageChanged)
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
QtControls.ScrollView {
|
||||||
|
id: scroll
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Column {
|
||||||
|
spacing: units.largeSpacing / 2
|
||||||
|
|
||||||
delegate: QtControls.StackViewDelegate {
|
QtControls.Label {
|
||||||
function transitionFinished(properties)
|
id: pageTitle
|
||||||
{
|
width: scroll.viewport.width
|
||||||
properties.exitItem.opacity = 1
|
font.pointSize: theme.defaultFont.pointSize*2
|
||||||
|
font.weight: Font.Light
|
||||||
|
text: main.title
|
||||||
}
|
}
|
||||||
|
|
||||||
pushTransition: QtControls.StackViewTransition {
|
QtControls.StackView {
|
||||||
PropertyAnimation {
|
id: main
|
||||||
target: enterItem
|
property string title: ""
|
||||||
property: "opacity"
|
property bool invertAnimations: false
|
||||||
from: 0
|
|
||||||
to: 1
|
height: Math.max((scroll.viewport.height - pageTitle.height - parent.spacing), (main.currentItem ? (main.currentItem.implicitHeight ? main.currentItem.implicitHeight : main.currentItem.childrenRect.height) : 0))
|
||||||
duration: units.longDuration
|
width: scroll.viewport.width
|
||||||
easing.type: Easing.InOutQuad
|
|
||||||
|
property string sourceFile
|
||||||
|
|
||||||
|
onSourceFileChanged: {
|
||||||
|
// print("Source file changed in flickable" + sourceFile);
|
||||||
|
replace(Qt.resolvedUrl(sourceFile));
|
||||||
|
root.restoreConfig()
|
||||||
|
for (var prop in currentItem) {
|
||||||
|
if (prop.indexOf("cfg_") === 0 && prop.indexOf("Changed") > 0 ) {
|
||||||
|
currentItem[prop].connect(root.settingValueChanged)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentItem["configurationChanged"]) {
|
||||||
|
currentItem["configurationChanged"].connect(root.settingValueChanged)
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* This is not needed on a desktop shell that has ok/apply/cancel buttons, i'll leave it here only for future reference until we have a prototype for the active shell.
|
||||||
|
* root.pageChanged will start a timer, that in turn will call saveConfig() when triggered
|
||||||
|
|
||||||
|
for (var prop in currentItem) {
|
||||||
|
if (prop.indexOf("cfg_") === 0) {
|
||||||
|
currentItem[prop+"Changed"].connect(root.pageChanged)
|
||||||
|
}
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
PropertyAnimation {
|
|
||||||
target: enterItem
|
delegate: QtControls.StackViewDelegate {
|
||||||
property: "x"
|
function transitionFinished(properties)
|
||||||
from: main.invertAnimations ? -target.width/3: target.width/3
|
{
|
||||||
to: 0
|
properties.exitItem.opacity = 1
|
||||||
duration: units.longDuration
|
}
|
||||||
easing.type: Easing.InOutQuad
|
|
||||||
}
|
pushTransition: QtControls.StackViewTransition {
|
||||||
PropertyAnimation {
|
PropertyAnimation {
|
||||||
target: exitItem
|
target: enterItem
|
||||||
property: "opacity"
|
property: "opacity"
|
||||||
from: 1
|
from: 0
|
||||||
to: 0
|
to: 1
|
||||||
duration: units.longDuration
|
duration: units.longDuration
|
||||||
easing.type: Easing.InOutQuad
|
easing.type: Easing.InOutQuad
|
||||||
}
|
}
|
||||||
PropertyAnimation {
|
PropertyAnimation {
|
||||||
target: exitItem
|
target: enterItem
|
||||||
property: "x"
|
property: "x"
|
||||||
from: 0
|
from: main.invertAnimations ? -target.width/3: target.width/3
|
||||||
to: main.invertAnimations ? target.width/3 : -target.width/3
|
to: 0
|
||||||
duration: units.longDuration
|
duration: units.longDuration
|
||||||
easing.type: Easing.InOutQuad
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
PropertyAnimation {
|
||||||
|
target: exitItem
|
||||||
|
property: "opacity"
|
||||||
|
from: 1
|
||||||
|
to: 0
|
||||||
|
duration: units.longDuration
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
PropertyAnimation {
|
||||||
|
target: exitItem
|
||||||
|
property: "x"
|
||||||
|
from: 0
|
||||||
|
to: main.invertAnimations ? target.width/3 : -target.width/3
|
||||||
|
duration: units.longDuration
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QtControls.Action {
|
QtControls.Action {
|
||||||
id: acceptAction
|
id: acceptAction
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
applyAction.trigger();
|
applyAction.trigger();
|
||||||
configDialog.close();
|
configDialog.close();
|
||||||
}
|
}
|
||||||
shortcut: "Return"
|
shortcut: "Return"
|
||||||
}
|
|
||||||
|
|
||||||
QtControls.Action {
|
|
||||||
id: applyAction
|
|
||||||
onTriggered: {
|
|
||||||
if (main.currentItem.saveConfig !== undefined) {
|
|
||||||
main.currentItem.saveConfig();
|
|
||||||
} else {
|
|
||||||
root.saveConfig();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QtControls.Action {
|
QtControls.Action {
|
||||||
id: cancelAction
|
id: applyAction
|
||||||
onTriggered: configDialog.close();
|
onTriggered: {
|
||||||
shortcut: "Escape"
|
if (main.currentItem.saveConfig !== undefined) {
|
||||||
}
|
main.currentItem.saveConfig();
|
||||||
|
} else {
|
||||||
|
root.saveConfig();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout {
|
QtControls.Action {
|
||||||
id: buttonsRow
|
id: cancelAction
|
||||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
|
onTriggered: configDialog.close();
|
||||||
|
shortcut: "Escape"
|
||||||
QtControls.Button {
|
}
|
||||||
iconName: "window-close"
|
|
||||||
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Close")
|
|
||||||
onClicked: cancelAction.trigger()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ import org.kde.plasma.private.shell 2.0
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
color: Qt.rgba(0, 0, 0, main.opacity * 0.8)
|
color: Qt.rgba(0, 0, 0, (1 - Math.abs(main.x / (main.width/2))) * 0.8)
|
||||||
signal closed()
|
signal closed()
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|
@ -50,6 +50,11 @@ Rectangle {
|
||||||
openAnim.running = true;
|
openAnim.running = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onClicked: {
|
||||||
|
if (mouse.x > main.width) {
|
||||||
|
removeAnim.running = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
id: openAnim
|
id: openAnim
|
||||||
|
|
@ -81,7 +86,6 @@ Rectangle {
|
||||||
height: parent.height
|
height: parent.height
|
||||||
color: theme.backgroundColor
|
color: theme.backgroundColor
|
||||||
|
|
||||||
opacity: 1 - Math.abs(x / (width/2))
|
|
||||||
property alias containment: widgetExplorer.containment
|
property alias containment: widgetExplorer.containment
|
||||||
|
|
||||||
//external drop events can cause a raise event causing us to lose focus and
|
//external drop events can cause a raise event causing us to lose focus and
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue