Skip to content

Commit

Permalink
Added ability to modify grid size
Browse files Browse the repository at this point in the history
  • Loading branch information
HimDek committed Sep 18, 2022
1 parent dd8a098 commit aeda61e
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 150 deletions.
12 changes: 10 additions & 2 deletions contents/config/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,16 @@
<label>List of system action favorites.</label>
<default>suspend,hibernate,reboot,shutdown</default>
</entry>
<entry name="gridColumns" type="Int">
<label>Number of cloumns in the grid</label>
<default>4</default>
</entry>
<entry name="gridRows" type="Int">
<label>Number of rows in the grid</label>
<default>4</default>
</entry>
<entry name="primaryActions" type="Int">
<label>Which actions should be displayed in the footer: 0 = Power, 1 = Session, 2 = Custom, 3 = Power and session</label>
<label>Which actions should be displayed in the header: 0 = Power, 1 = Session, 2 = Custom, 3 = Power and session</label>
<default>0</default>
</entry>
<entry name="favoritesPortedToKAstats" type="Bool">
Expand All @@ -39,7 +47,7 @@
</entry>
<entry name="alphaSort" type="Bool">
<label>Whether to sort menu contents alphabetically or use manual/system sort order.</label>
<default>false</default>
<default>true</default>
</entry>
<entry name="pin" type="Bool">
<label>Whether the popup should remain open when another window is activated</label>
Expand Down
8 changes: 4 additions & 4 deletions contents/ui/ApplicationsPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ BasePage {
mainContentView: true
focus: true
model: plasmoid.rootItem.rootModel.favoritesModel
preferredHeight: sideBar.implicitHeight
preferredHeight: root.implicitHeight
}
}

Expand All @@ -56,7 +56,7 @@ BasePage {
objectName: "favoritesGridView"
focus: true
model: plasmoid.rootItem.rootModel.favoritesModel
preferredHeight: sideBar.implicitHeight
preferredHeight: root.implicitHeight
}
}

Expand All @@ -69,7 +69,7 @@ BasePage {
model: stackView.appsModel
section.property: model && model.description == "KICKER_ALL_MODEL" ? "display" : ""
section.criteria: ViewSection.FirstCharacter
preferredHeight: sideBar.implicitHeight
preferredHeight: root.implicitHeight
}
}

Expand All @@ -79,7 +79,7 @@ BasePage {
id: applicationsGridView
objectName: "applicationsGridView"
model: stackView.appsModel
preferredHeight: sideBar.implicitHeight
preferredHeight: root.implicitHeight
}
}

Expand Down
2 changes: 1 addition & 1 deletion contents/ui/BasePage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ FocusScope {
property alias implicitSideBarHeight: sideBarLoader.implicitHeight

implicitWidth: root.preferredSideBarWidth + contentAreaLoader.implicitWidth
implicitHeight: root.preferredSideBarHeight
implicitHeight: Math.max(root.preferredSideBarHeight, KickoffSingleton.gridCellSize * plasmoid.configuration.gridRows)

Kicker.TriangleMouseFilter {
id: sideBarFilter
Expand Down
39 changes: 38 additions & 1 deletion contents/ui/ConfigGeneral.qml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import QtQuick 2.15
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.5

import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons
import org.kde.kirigami 2.5 as Kirigami
Expand All @@ -22,6 +21,8 @@ ColumnLayout {
property alias cfg_alphaSort: alphaSort.checked
property var cfg_systemFavorites: String(plasmoid.configuration.systemFavorites)
property int cfg_primaryActions: plasmoid.configuration.primaryActions
property alias cfg_gridColumns: gridColumns.value
property alias cfg_gridRows: gridRows.value

Kirigami.FormLayout {
Button {
Expand Down Expand Up @@ -93,6 +94,42 @@ ColumnLayout {
Kirigami.FormData.isSection: true
}

SpinBox {
id: gridColumns
Layout.minimumWidth: Kirigami.Units.gridUnit * 1
Kirigami.FormData.label: i18n("Colums in grid:")
from: 4
to: 8
stepSize: 1
editable: false
textFromValue: function(value) {
return value;
}
valueFromText: function(text) {
return parseInt(text);
}
}

SpinBox {
id: gridRows
Layout.minimumWidth: Kirigami.Units.gridUnit * 1
Kirigami.FormData.label: i18n("Minimum rows in grid:")
from: 4
to: 8
stepSize: 1
editable: false
textFromValue: function(value) {
return value;
}
valueFromText: function(text) {
return parseInt(text);
}
}

Item {
Kirigami.FormData.isSection: true
}

RadioButton {
id: showFavoritesInGrid
Kirigami.FormData.label: i18n("Show favorites:")
Expand Down
8 changes: 4 additions & 4 deletions contents/ui/Kickoff.qml
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ Item {
//BEGIN Metrics
readonly property PlasmaCore.FrameSvgItem backgroundMetrics: PlasmaCore.FrameSvgItem {
// Inset defaults to a negative value when not set by margin hints
readonly property real leftPadding: margins.left - Math.max(inset.left, 0)
readonly property real rightPadding: margins.right - Math.max(inset.right, 0)
readonly property real topPadding: margins.top - Math.max(inset.top, 0)
readonly property real bottomPadding: margins.bottom - Math.max(inset.bottom, 0)
readonly property real leftPadding: margins.left - inset.left
readonly property real rightPadding: margins.right - inset.right
readonly property real topPadding: margins.top - inset.top
readonly property real bottomPadding: margins.bottom - inset.bottom
readonly property real spacing: leftPadding
visible: false
imagePath: plasmoid.formFactor === PlasmaCore.Types.Planar ? "widgets/background" : "dialogs/background"
Expand Down
2 changes: 1 addition & 1 deletion contents/ui/KickoffGridView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ EmptyPage {

Accessible.description: i18n("Grid with %1 rows, %2 columns", rows, columns) // can't use i18np here

implicitWidth: verticalScrollBar.visible ? (view.cellWidth * 4 + verticalScrollBar.width) : view.cellWidth * 4
implicitWidth: verticalScrollBar.visible ? (view.cellWidth * plasmoid.configuration.gridColumns + verticalScrollBar.width) : view.cellWidth * plasmoid.configuration.gridColumns
implicitHeight: preferredHeight

cellHeight: KickoffSingleton.gridCellSize
Expand Down
2 changes: 1 addition & 1 deletion contents/ui/KickoffListView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ EmptyPage {

Accessible.role: Accessible.List

implicitWidth: mainContentView ? KickoffSingleton.gridCellSize * 4 : (preferredWidth ? preferredWidth : contentWidth)
implicitWidth: mainContentView ? KickoffSingleton.gridCellSize * plasmoid.configuration.gridColumns : (preferredWidth ? preferredWidth : contentWidth)
implicitHeight: mainContentView ? preferredHeight : contentHeight

currentIndex: count > 0 ? 0 : -1
Expand Down
2 changes: 1 addition & 1 deletion metadata.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ X-Plasma-RequiredExtensions=LaunchApp

X-KDE-PluginInfo-Author=various
X-KDE-PluginInfo-Name=org.kde.plasma.simplekickoff
X-KDE-PluginInfo-Version=2.3
X-KDE-PluginInfo-Version=2.4
X-KDE-PluginInfo-Category=Application Launchers
X-KDE-PluginInfo-License=GPL-2.0+
X-KDE-PluginInfo-EnabledByDefault=true
135 changes: 0 additions & 135 deletions metadata.json

This file was deleted.

0 comments on commit aeda61e

Please sign in to comment.