mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
finish the new layouting prototype
This commit is contained in:
parent
b9503b8a2f
commit
3275b8b698
3 changed files with 63 additions and 48 deletions
|
|
@ -38,6 +38,7 @@ PlasmaCore.ColorScope {
|
||||||
property Item toolBox
|
property Item toolBox
|
||||||
property int buttonHeight: width/4
|
property int buttonHeight: width/4
|
||||||
property bool reorderingApps: false
|
property bool reorderingApps: false
|
||||||
|
property QtObject expandedApplet
|
||||||
|
|
||||||
Containment.onAppletAdded: {
|
Containment.onAppletAdded: {
|
||||||
addApplet(applet, x, y);
|
addApplet(applet, x, y);
|
||||||
|
|
@ -54,7 +55,8 @@ PlasmaCore.ColorScope {
|
||||||
applet.parent = container;
|
applet.parent = container;
|
||||||
container.applet = applet;
|
container.applet = applet;
|
||||||
//applet.anchors.fill = container;
|
//applet.anchors.fill = container;
|
||||||
applet.width = units.iconSizes.medium
|
applet.anchors.left = container.left;
|
||||||
|
applet.anchors.right = container.right;
|
||||||
applet.height = units.iconSizes.medium
|
applet.height = units.iconSizes.medium
|
||||||
applet.visible = true;
|
applet.visible = true;
|
||||||
container.visible = true;
|
container.visible = true;
|
||||||
|
|
@ -66,7 +68,6 @@ PlasmaCore.ColorScope {
|
||||||
// Fall through to determining an appropriate insert position.
|
// Fall through to determining an appropriate insert position.
|
||||||
} else {
|
} else {
|
||||||
var before = null;
|
var before = null;
|
||||||
container.animationsEnabled = false;
|
|
||||||
|
|
||||||
if (lastSpacer.parent === layout) {
|
if (lastSpacer.parent === layout) {
|
||||||
before = lastSpacer;
|
before = lastSpacer;
|
||||||
|
|
@ -105,21 +106,30 @@ PlasmaCore.ColorScope {
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: appletContainerComponent
|
id: appletContainerComponent
|
||||||
Rectangle {
|
Item {
|
||||||
color: "grey"
|
|
||||||
//not used yet
|
|
||||||
property bool animationsEnabled: false
|
|
||||||
property Item applet
|
property Item applet
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
// Layout.fillHeight: true
|
clip: true
|
||||||
Layout.minimumHeight: applet && applet.expanded ? units.gridUnit * 20 : units.iconSizes.medium
|
anchors {
|
||||||
Layout.maximumHeight: Layout.minimumHeight
|
left: parent.left
|
||||||
Behavior on height {
|
right: parent.right
|
||||||
NumberAnimation {
|
}
|
||||||
duration: units.shortDuration
|
height: applet && applet.expanded ? Math.max(applet.fullRepresentationItem.Layout.minimumHeight, units.iconSizes.medium) : units.iconSizes.medium
|
||||||
easing.type: Easing.InOutQuad
|
Behavior on height {
|
||||||
}
|
NumberAnimation {
|
||||||
}
|
duration: units.shortDuration
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Connections {
|
||||||
|
target: applet
|
||||||
|
onExpandedChanged: {
|
||||||
|
if (root.expandedApplet) {
|
||||||
|
root.expandedApplet.expanded = false;
|
||||||
|
}
|
||||||
|
root.expandedApplet = applet;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -282,15 +292,17 @@ PlasmaCore.ColorScope {
|
||||||
contents: Item {
|
contents: Item {
|
||||||
id: panelContents
|
id: panelContents
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
clip: true
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: lastSpacer
|
id: lastSpacer
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
}
|
}
|
||||||
ColumnLayout {
|
Column {
|
||||||
id: layout
|
id: layout
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
spacing: units.smallSpacing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ PlasmaCore.ToolTipArea {
|
||||||
if (!fullRepresentation) {
|
if (!fullRepresentation) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//if the fullRepresentation size was restored to a stored size, or if is dragged from the desktop, restore popup size
|
/* //if the fullRepresentation size was restored to a stored size, or if is dragged from the desktop, restore popup size
|
||||||
if (fullRepresentation.width > 0) {
|
if (fullRepresentation.width > 0) {
|
||||||
appletParent.width = fullRepresentation.width;
|
appletParent.width = fullRepresentation.width;
|
||||||
} else if (fullRepresentation.Layout && fullRepresentation.Layout.preferredWidth > 0) {
|
} else if (fullRepresentation.Layout && fullRepresentation.Layout.preferredWidth > 0) {
|
||||||
|
|
@ -70,40 +70,19 @@ PlasmaCore.ToolTipArea {
|
||||||
appletParent.height = fullRepresentation.implicitHeight
|
appletParent.height = fullRepresentation.implicitHeight
|
||||||
} else {
|
} else {
|
||||||
appletParent.height = theme.mSize(theme.defaultFont).height * 25
|
appletParent.height = theme.mSize(theme.defaultFont).height * 25
|
||||||
}
|
}*/
|
||||||
|
|
||||||
fullRepresentation.parent = appletParent;
|
fullRepresentation.parent = appletParent;
|
||||||
fullRepresentation.anchors.fill = fullRepresentation.parent;
|
fullRepresentation.anchors.fill = fullRepresentation.parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlasmaCore.FrameSvgItem {
|
Rectangle {
|
||||||
id: expandedItem
|
id: expandedItem
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
imagePath: "widgets/tabbar"
|
color: PlasmaCore.ColorScope.highlightColor
|
||||||
visible: fromCurrentTheme
|
opacity: plasmoid.expanded ? 0.3 : 0
|
||||||
prefix: {
|
|
||||||
var prefix;
|
|
||||||
switch (plasmoid.location) {
|
|
||||||
case PlasmaCore.Types.LeftEdge:
|
|
||||||
prefix = "west-active-tab";
|
|
||||||
break;
|
|
||||||
case PlasmaCore.Types.TopEdge:
|
|
||||||
prefix = "north-active-tab";
|
|
||||||
break;
|
|
||||||
case PlasmaCore.Types.RightEdge:
|
|
||||||
prefix = "east-active-tab";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
prefix = "south-active-tab";
|
|
||||||
}
|
|
||||||
if (!hasElementPrefix(prefix)) {
|
|
||||||
prefix = "active-tab";
|
|
||||||
}
|
|
||||||
return prefix;
|
|
||||||
}
|
|
||||||
opacity: plasmoid.expanded ? 1 : 0
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
NumberAnimation {
|
OpacityAnimator {
|
||||||
duration: units.shortDuration
|
duration: units.shortDuration
|
||||||
easing.type: Easing.InOutQuad
|
easing.type: Easing.InOutQuad
|
||||||
}
|
}
|
||||||
|
|
@ -116,7 +95,7 @@ PlasmaCore.ToolTipArea {
|
||||||
onTriggered: plasmoid.expanded = popupWindow.visible;
|
onTriggered: plasmoid.expanded = popupWindow.visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseEventListener {
|
Item {
|
||||||
id: appletParent
|
id: appletParent
|
||||||
opacity: plasmoid.expanded ? 1 : 0
|
opacity: plasmoid.expanded ? 1 : 0
|
||||||
anchors.top: parent.bottom
|
anchors.top: parent.bottom
|
||||||
|
|
@ -124,6 +103,8 @@ PlasmaCore.ToolTipArea {
|
||||||
Layout.minimumHeight: (fullRepresentation && fullRepresentation.Layout) ? fullRepresentation.Layout.minimumHeight: 0
|
Layout.minimumHeight: (fullRepresentation && fullRepresentation.Layout) ? fullRepresentation.Layout.minimumHeight: 0
|
||||||
Layout.maximumWidth: (fullRepresentation && fullRepresentation.Layout) ? fullRepresentation.Layout.maximumWidth : Infinity
|
Layout.maximumWidth: (fullRepresentation && fullRepresentation.Layout) ? fullRepresentation.Layout.maximumWidth : Infinity
|
||||||
Layout.maximumHeight: (fullRepresentation && fullRepresentation.Layout) ? fullRepresentation.Layout.maximumHeight: Infinity
|
Layout.maximumHeight: (fullRepresentation && fullRepresentation.Layout) ? fullRepresentation.Layout.maximumHeight: Infinity
|
||||||
|
width: Math.max(parent.width, Layout.minimumWidth)
|
||||||
|
height: Layout.minimumHeight
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
OpacityAnimator {
|
OpacityAnimator {
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,11 @@
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
|
|
||||||
PlasmaCore.IconItem {
|
Row {
|
||||||
id: icon
|
id: main
|
||||||
|
spacing: units.largeSpacing
|
||||||
|
|
||||||
Layout.minimumWidth: {
|
Layout.minimumWidth: {
|
||||||
switch (plasmoid.formFactor) {
|
switch (plasmoid.formFactor) {
|
||||||
|
|
@ -45,8 +47,28 @@ PlasmaCore.IconItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
source: plasmoid.icon ? plasmoid.icon : "plasma"
|
PlasmaCore.IconItem {
|
||||||
active: mouseArea.containsMouse
|
id: icon
|
||||||
|
source: plasmoid.icon ? plasmoid.icon : "plasma"
|
||||||
|
active: mouseArea.containsMouse
|
||||||
|
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
PlasmaCore.SvgItem {
|
||||||
|
svg: PlasmaCore.Svg {
|
||||||
|
id: arrowSvg
|
||||||
|
imagePath: "widgets/arrows"
|
||||||
|
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
||||||
|
}
|
||||||
|
width: units.iconSizes.smallMedium
|
||||||
|
height: width
|
||||||
|
elementId: plasmoid.expanded ? "up-arrow" : "down-arrow"
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
PlasmaComponents.Label {
|
||||||
|
text: plasmoid.title
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: mouseArea
|
id: mouseArea
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue