mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-04 10:44:46 +00:00
port away from mobilecomponents
This commit is contained in:
parent
9ae7d849a8
commit
5aa20872d5
4 changed files with 139 additions and 126 deletions
|
|
@ -21,7 +21,6 @@ import QtQuick 2.0
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
import QtQuick.Window 2.2
|
import QtQuick.Window 2.2
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
import org.kde.plasma.mobilecomponents 0.2
|
|
||||||
import org.kde.plasma.private.mobileshell 2.0
|
import org.kde.plasma.private.mobileshell 2.0
|
||||||
|
|
||||||
FullScreenPanel {
|
FullScreenPanel {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ import QtQuick.Window 2.2
|
||||||
import org.kde.taskmanager 0.1 as TaskManager
|
import org.kde.taskmanager 0.1 as TaskManager
|
||||||
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
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
import org.kde.plasma.mobilecomponents 0.2
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: delegate
|
id: delegate
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ import QtQuick.Window 2.2
|
||||||
import org.kde.taskmanager 0.1 as TaskManager
|
import org.kde.taskmanager 0.1 as TaskManager
|
||||||
import org.kde.plasma.core 2.1 as PlasmaCore
|
import org.kde.plasma.core 2.1 as PlasmaCore
|
||||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
import org.kde.plasma.mobilecomponents 0.2
|
|
||||||
import org.kde.plasma.private.mobileshell 2.0
|
import org.kde.plasma.private.mobileshell 2.0
|
||||||
|
|
||||||
FullScreenPanel {
|
FullScreenPanel {
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||||
import org.kde.kquickcontrolsaddons 2.0
|
import org.kde.kquickcontrolsaddons 2.0
|
||||||
import org.kde.plasma.mobilecomponents 0.2 as MobileComponents
|
import org.kde.plasma.mobilecomponents 0.2 as MobileComponents
|
||||||
|
import org.kde.kirigami 2.2 as Kirigami
|
||||||
|
|
||||||
import QtQuick.Window 2.1
|
import QtQuick.Window 2.1
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
|
|
@ -38,6 +39,8 @@ Rectangle {
|
||||||
signal closed()
|
signal closed()
|
||||||
property alias containment: widgetExplorer.containment
|
property alias containment: widgetExplorer.containment
|
||||||
|
|
||||||
|
Component.onCompleted: splitDrawer.contentX = typeSelector.width
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
drag.filterChildren: true
|
drag.filterChildren: true
|
||||||
|
|
@ -135,152 +138,165 @@ Rectangle {
|
||||||
//view: desktop
|
//view: desktop
|
||||||
onShouldClose: removeAnim.running = true;
|
onShouldClose: removeAnim.running = true;
|
||||||
}
|
}
|
||||||
MobileComponents.SplitDrawer {
|
Flickable {
|
||||||
id: splitDrawer
|
id: splitDrawer
|
||||||
visible: true
|
visible: true
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
contentItem: PlasmaExtras.ScrollArea {
|
clip: true
|
||||||
|
contentWidth: mainRow.width
|
||||||
ListView {
|
contentHeight: height
|
||||||
model: widgetExplorer.filterModel
|
Row {
|
||||||
delegate: PlasmaComponents.ListItem {
|
id: mainRow
|
||||||
enabled: true
|
height: splitDrawer.height
|
||||||
visible: !model.separator
|
|
||||||
height: model.separator ? 0 : implicitHeight
|
|
||||||
PlasmaComponents.Label {
|
|
||||||
text: model.display
|
|
||||||
}
|
|
||||||
onClicked: {
|
|
||||||
list.contentX = 0
|
|
||||||
list.contentY = 0
|
|
||||||
heading.text = model.display
|
|
||||||
widgetExplorer.widgetsModel.filterQuery = model.filterData
|
|
||||||
widgetExplorer.widgetsModel.filterType = model.filterType
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
anchors {
|
|
||||||
fill: parent
|
|
||||||
margins: units.smallSpacing
|
|
||||||
}
|
|
||||||
spacing: units.smallSpacing
|
|
||||||
|
|
||||||
PlasmaExtras.Title {
|
|
||||||
id: heading
|
|
||||||
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Widgets")
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
PlasmaComponents.ToolButton {
|
|
||||||
id: closeButton
|
|
||||||
anchors {
|
|
||||||
right: parent.right
|
|
||||||
verticalCenter: heading.verticalCenter
|
|
||||||
}
|
|
||||||
iconSource: "window-close"
|
|
||||||
onClicked: removeAnim.running = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PlasmaComponents.TextField {
|
|
||||||
id: searchInput
|
|
||||||
clearButtonShown: true
|
|
||||||
placeholderText: i18nd("plasma_shell_org.kde.plasma.desktop", "Search...")
|
|
||||||
onTextChanged: {
|
|
||||||
list.positionViewAtBeginning()
|
|
||||||
list.currentIndex = -1
|
|
||||||
widgetExplorer.widgetsModel.searchTerm = text
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: forceActiveFocus()
|
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PlasmaExtras.ScrollArea {
|
PlasmaExtras.ScrollArea {
|
||||||
Layout.fillHeight: true
|
id: typeSelector
|
||||||
Layout.fillWidth: true
|
anchors {
|
||||||
GridView {
|
top: parent.top
|
||||||
id: list
|
bottom: parent.bottom
|
||||||
|
}
|
||||||
model: widgetExplorer.widgetsModel
|
width: units.gridUnit * 10
|
||||||
activeFocusOnTab: true
|
ListView {
|
||||||
currentIndex: -1
|
model: widgetExplorer.filterModel
|
||||||
keyNavigationWraps: true
|
delegate: PlasmaComponents.ListItem {
|
||||||
cellWidth: units.iconSizes.huge + units.smallSpacing * 2
|
enabled: true
|
||||||
cellHeight: cellWidth + units.gridUnit * 4 + units.smallSpacing * 2
|
visible: !model.separator
|
||||||
|
height: model.separator ? 0 : implicitHeight
|
||||||
|
PlasmaComponents.Label {
|
||||||
delegate: AppletDelegate {}
|
text: model.display
|
||||||
|
|
||||||
//slide in to view from the left
|
|
||||||
add: Transition {
|
|
||||||
NumberAnimation {
|
|
||||||
properties: "x"
|
|
||||||
from: -list.width
|
|
||||||
to: 0
|
|
||||||
duration: units.shortDuration * 3
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
onClicked: {
|
||||||
|
list.contentX = 0
|
||||||
//slide out of view to the right
|
list.contentY = 0
|
||||||
remove: Transition {
|
heading.text = model.display
|
||||||
NumberAnimation {
|
widgetExplorer.widgetsModel.filterQuery = model.filterData
|
||||||
properties: "x"
|
widgetExplorer.widgetsModel.filterType = model.filterType
|
||||||
to: list.width
|
|
||||||
duration: units.shortDuration * 3
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//if we are adding other items into the view use the same animation as normal adding
|
|
||||||
//this makes everything slide in together
|
|
||||||
//if we make it move everything ends up weird
|
|
||||||
addDisplaced: list.add
|
|
||||||
|
|
||||||
//moved due to filtering
|
|
||||||
displaced: Transition {
|
|
||||||
NumberAnimation {
|
|
||||||
properties: "y"
|
|
||||||
duration: units.shortDuration * 3
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
ColumnLayout {
|
||||||
id: bottomBar
|
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left
|
top: parent.top
|
||||||
right: parent.right
|
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
leftMargin: units.smallSpacing
|
|
||||||
rightMargin: units.smallSpacing
|
|
||||||
bottomMargin: units.smallSpacing
|
|
||||||
}
|
}
|
||||||
|
width: splitDrawer.width
|
||||||
|
|
||||||
spacing: units.smallSpacing
|
spacing: units.smallSpacing
|
||||||
|
|
||||||
Repeater {
|
PlasmaExtras.Title {
|
||||||
model: widgetExplorer.extraActions.length
|
id: heading
|
||||||
PlasmaComponents.Button {
|
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Widgets")
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
PlasmaComponents.ToolButton {
|
||||||
|
id: closeButton
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
right: parent.right
|
||||||
|
verticalCenter: heading.verticalCenter
|
||||||
}
|
}
|
||||||
iconSource: widgetExplorer.extraActions[modelData].icon
|
iconSource: "window-close"
|
||||||
text: widgetExplorer.extraActions[modelData].text
|
onClicked: removeAnim.running = true;
|
||||||
onClicked: {
|
}
|
||||||
widgetExplorer.extraActions[modelData].trigger()
|
}
|
||||||
|
|
||||||
|
PlasmaComponents.TextField {
|
||||||
|
id: searchInput
|
||||||
|
clearButtonShown: true
|
||||||
|
placeholderText: i18nd("plasma_shell_org.kde.plasma.desktop", "Search...")
|
||||||
|
onTextChanged: {
|
||||||
|
list.positionViewAtBeginning()
|
||||||
|
list.currentIndex = -1
|
||||||
|
widgetExplorer.widgetsModel.searchTerm = text
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: forceActiveFocus()
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PlasmaExtras.ScrollArea {
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.fillWidth: true
|
||||||
|
GridView {
|
||||||
|
id: list
|
||||||
|
|
||||||
|
model: widgetExplorer.widgetsModel
|
||||||
|
activeFocusOnTab: true
|
||||||
|
currentIndex: -1
|
||||||
|
keyNavigationWraps: true
|
||||||
|
cellWidth: units.iconSizes.huge + units.smallSpacing * 2
|
||||||
|
cellHeight: cellWidth + units.gridUnit * 4 + units.smallSpacing * 2
|
||||||
|
|
||||||
|
|
||||||
|
delegate: AppletDelegate {}
|
||||||
|
|
||||||
|
//slide in to view from the left
|
||||||
|
add: Transition {
|
||||||
|
NumberAnimation {
|
||||||
|
properties: "x"
|
||||||
|
from: -list.width
|
||||||
|
to: 0
|
||||||
|
duration: units.shortDuration * 3
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//slide out of view to the right
|
||||||
|
remove: Transition {
|
||||||
|
NumberAnimation {
|
||||||
|
properties: "x"
|
||||||
|
to: list.width
|
||||||
|
duration: units.shortDuration * 3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//if we are adding other items into the view use the same animation as normal adding
|
||||||
|
//this makes everything slide in together
|
||||||
|
//if we make it move everything ends up weird
|
||||||
|
addDisplaced: list.add
|
||||||
|
|
||||||
|
//moved due to filtering
|
||||||
|
displaced: Transition {
|
||||||
|
NumberAnimation {
|
||||||
|
properties: "y"
|
||||||
|
duration: units.shortDuration * 3
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: bottomBar
|
||||||
|
anchors {
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
bottom: parent.bottom
|
||||||
|
leftMargin: units.smallSpacing
|
||||||
|
rightMargin: units.smallSpacing
|
||||||
|
bottomMargin: units.smallSpacing
|
||||||
|
}
|
||||||
|
|
||||||
|
spacing: units.smallSpacing
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: widgetExplorer.extraActions.length
|
||||||
|
PlasmaComponents.Button {
|
||||||
|
anchors {
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
iconSource: widgetExplorer.extraActions[modelData].icon
|
||||||
|
text: widgetExplorer.extraActions[modelData].text
|
||||||
|
onClicked: {
|
||||||
|
widgetExplorer.extraActions[modelData].trigger()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
main.getWidgetsButton = getWidgetsButton
|
main.getWidgetsButton = getWidgetsButton
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue