Commit a64d847c authored by pontaoski's avatar pontaoski 🌈
Browse files

Revise the add widgets sidebar to be more Plasma-ish

- All controls are moved to a header (more in line with other applets)
- Sidebar is wider to accomodate the rearranged layout
- Delete and running count are only shown on hover (more in line with the presentation used in KCMs)
parent 0c77dd47
......@@ -119,7 +119,7 @@ Item {
width: runningBadge.width + Math.round(units.smallSpacing * 1.5)
height: width
radius: height
visible: running
visible: running && ListView.isCurrentItem
}
}
......@@ -129,7 +129,7 @@ Item {
height: Math.round(theme.mSize(countLabel.font).height * 1.3)
radius: height
color: theme.highlightColor
visible: running
visible: running && list.currentIndex == index
onVisibleChanged: maskShaderSource.scheduleUpdate()
PlasmaComponents.Label {
......@@ -179,7 +179,7 @@ Item {
tooltip: delegate.pendingUninstall ? i18nd("plasma_shell_org.kde.plasma.desktop", "Undo uninstall")
: i18nd("plasma_shell_org.kde.plasma.desktop", "Uninstall widget")
flat: false
visible: model.local
visible: model.local && list.currentIndex == index
onHoveredChanged: {
if (hovered) {
// hovering the uninstall button triggers onExited of the main mousearea
......
......@@ -34,7 +34,7 @@ import org.kde.plasma.private.shell 2.0
Item {
id: main
width: Math.max(heading.paintedWidth, units.iconSizes.enormous * 2 + units.smallSpacing * 4 + units.gridUnit * 2)
width: Math.max(heading.paintedWidth, units.iconSizes.enormous * 3 + units.smallSpacing * 4 + units.gridUnit * 2)
height: 800//Screen.height
opacity: draggingWidget ? 0.3 : 1
......@@ -139,7 +139,7 @@ Item {
onClicked: {
list.contentX = 0
list.contentY = 0
categoryButton.text = (model.filterData ? model.display : "")
categoryButton.text = (model.filterData ? model.display : i18nd("plasma_shell_org.kde.plasma.desktop", "All Widgets"))
widgetExplorer.widgetsModel.filterQuery = model.filterData
widgetExplorer.widgetsModel.filterType = model.filterType
}
......@@ -196,68 +196,77 @@ Item {
*/
RowLayout {
id: topBar
PlasmaExtras.PlasmoidHeading {
id: topArea
implicitWidth: header.implicitWidth
implicitHeight: header.implicitHeight
anchors {
top: parent.top
left: parent.left
right: parent.right
}
ColumnLayout {
id: header
anchors.fill: parent
RowLayout {
PlasmaExtras.Heading {
id: heading
level: 1
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Widgets")
elide: Text.ElideRight
Item {
id: header
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
PlasmaExtras.Heading {
id: heading
anchors.verticalCenter: parent.verticalCenter
level: 1
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Widgets")
width: parent.width
elide: Text.ElideRight
Layout.fillWidth: true
}
PlasmaComponents.ToolButton {
id: getWidgetsButton
iconSource: "get-hot-new-stuff"
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Get New Widgets...")
onClicked: {
getWidgetsDialog.model = widgetExplorer.widgetsMenuActions
getWidgetsDialog.openRelative()
}
}
PlasmaComponents.ToolButton {
id: closeButton
iconSource: "window-close"
onClicked: main.closed()
}
}
}
PlasmaComponents.ToolButton {
id: categoryButton
tooltip: i18nd("plasma_shell_org.kde.plasma.desktop", "Categories")
iconSource: "view-filter"
onClicked: {
categoriesDialog.model = widgetExplorer.filterModel
categoriesDialog.open(0, categoryButton.height)
RowLayout {
PlasmaComponents.TextField {
id: searchInput
Layout.fillWidth: true
clearButtonShown: true
placeholderText: i18nd("plasma_shell_org.kde.plasma.desktop", "Search...")
onTextChanged: {
list.positionViewAtBeginning()
list.currentIndex = -1
widgetExplorer.widgetsModel.searchTerm = text
}
Component.onCompleted: forceActiveFocus()
}
PlasmaComponents.ToolButton {
id: categoryButton
tooltip: i18nd("plasma_shell_org.kde.plasma.desktop", "Categories")
text: i18nd("plasma_shell_org.kde.plasma.desktop", "All Widgets")
iconSource: "view-filter"
onClicked: {
categoriesDialog.model = widgetExplorer.filterModel
categoriesDialog.open(0, categoryButton.height)
}
}
}
}
PlasmaComponents.ToolButton {
id: closeButton
iconSource: "window-close"
onClicked: main.closed()
Item {
height: units.smallSpacing
}
}
}
RowLayout {
id: newSearchRow
anchors.top: topBar.bottom
anchors.topMargin: units.smallSpacing
width: topBar.width
PlasmaComponents.TextField {
id: searchInput
Layout.fillWidth: true
clearButtonShown: true
placeholderText: i18nd("plasma_shell_org.kde.plasma.desktop", "Search...")
onTextChanged: {
list.positionViewAtBeginning()
list.currentIndex = -1
widgetExplorer.widgetsModel.searchTerm = text
}
Component.onCompleted: forceActiveFocus()
}
}
Timer {
id: setModelTimer
interval: 20
......@@ -267,12 +276,10 @@ Item {
PlasmaExtras.ScrollArea {
anchors {
top: newSearchRow.bottom
top: topArea.bottom
left: parent.left
right: parent.right
bottom: bottomBar.top
bottomMargin: units.smallSpacing
topMargin: units.smallSpacing
bottom: parent.bottom
}
verticalScrollBarPolicy: Qt.ScrollBarAlwaysOn
......@@ -293,7 +300,7 @@ Item {
activeFocusOnTab: true
keyNavigationWraps: true
cellWidth: Math.floor((width - units.smallSpacing) / 2)
cellWidth: Math.floor((width - units.smallSpacing) / 3)
cellHeight: cellWidth + units.gridUnit * 4 + units.smallSpacing * 2
delegate: AppletDelegate {}
......@@ -345,29 +352,4 @@ Item {
}
}
}
Column {
id: bottomBar
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
}
spacing: units.smallSpacing
PlasmaComponents.Button {
id: getWidgetsButton
anchors {
left: parent.left
right: parent.right
}
iconSource: "get-hot-new-stuff"
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Get New Widgets...")
onClicked: {
getWidgetsDialog.model = widgetExplorer.widgetsMenuActions
getWidgetsDialog.openRelative()
}
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment