diff --git a/contents/ui/AppList.qml b/contents/ui/AppList.qml index 53a0b85..d096e21 100644 --- a/contents/ui/AppList.qml +++ b/contents/ui/AppList.qml @@ -48,6 +48,9 @@ ScrollView { property bool hasListener: false property bool isRight: true + property var scrollpositon: 0.0 + property var scrollheight: 0.0 + function updateModels() { item.pinnedModel = [globalFavorites, rootModel.modelForRow(0), rootModel.modelForRow(1)] item.allAppsModel = [rootModel.modelForRow(2)] @@ -71,8 +74,18 @@ ScrollView { currentStateIndex = plasmoid.configuration.defaultPage } } + onContentHeightChanged: { + ScrollBar.vertical.position = scrollpositon * scrollheight / scrollView.contentHeight + } Column { + id: column width: parent.width + onPositioningComplete: { + scrollView.contentHeight = height + if (height < backdrop.height) { + scrollView.contentHeight = backdrop.height + 1 + } + } Item { //Spacer width: 1 height: 20 * PlasmaCore.Units.devicePixelRatio @@ -85,7 +98,7 @@ ScrollView { PlasmaComponents.Label { x: parent.width + 10 * PlasmaCore.Units.devicePixelRatio anchors.verticalCenter: parent.verticalCenter - text: "Favorite Apps" + text: i18n("Favorite Apps") color: main.textColor font.family: main.textFont font.pixelSize: 12 * PlasmaCore.Units.devicePixelRatio @@ -101,7 +114,6 @@ ScrollView { width: 1 height: 10 * PlasmaCore.Units.devicePixelRatio } - Flow { //Favorites id: flow x: 0 @@ -114,7 +126,6 @@ ScrollView { } } } - Item { //Spacer width: 1 height: 24 * PlasmaCore.Units.devicePixelRatio @@ -127,72 +138,72 @@ ScrollView { states: [ State { name: "all"; - PropertyChanges { target: sortingLabel; text: 'All'} + PropertyChanges { target: sortingLabel; text: i18n("All")} PropertyChanges { target: sortingImage; source: 'icons/feather/file-text.svg'} }, State { name: "dev"; - PropertyChanges { target: sortingLabel; text: 'Developement'} + PropertyChanges { target: sortingLabel; text: i18n("Developement")} PropertyChanges { target: sortingImage; source: 'icons/feather/code.svg'} PropertyChanges { target: (currentStateIndex % 2 == 0 ? categoriesRepeater : categoriesRepeater2); model: rootModel.modelForRow(3)} }, State { name: "games"; - PropertyChanges { target: sortingLabel; text: 'Games'} + PropertyChanges { target: sortingLabel; text: i18n("Games")} PropertyChanges { target: sortingImage; source: 'icons/lucide/gamepad-2.svg'} PropertyChanges { target: (currentStateIndex % 2 == 0 ? categoriesRepeater : categoriesRepeater2); model: rootModel.modelForRow(4)} }, State { name: "graphics"; - PropertyChanges { target: sortingLabel; text: 'Graphics'} + PropertyChanges { target: sortingLabel; text: i18n("Graphics")} PropertyChanges { target: sortingImage; source: 'icons/feather/image.svg'} PropertyChanges { target: (currentStateIndex % 2 == 0 ? categoriesRepeater : categoriesRepeater2); model: rootModel.modelForRow(5)} }, State { name: "internet"; - PropertyChanges { target: sortingLabel; text: 'Internet'} + PropertyChanges { target: sortingLabel; text: i18n("Internet")} PropertyChanges { target: sortingImage; source: 'icons/feather/globe.svg'} PropertyChanges { target: (currentStateIndex % 2 == 0 ? categoriesRepeater : categoriesRepeater2); model: rootModel.modelForRow(6)} }, State { name: "multimedia"; - PropertyChanges { target: sortingLabel; text: 'Multimedia'} + PropertyChanges { target: sortingLabel; text: i18n("Multimedia")} PropertyChanges { target: sortingImage; source: 'icons/lucide/film.svg'} PropertyChanges { target: (currentStateIndex % 2 == 0 ? categoriesRepeater : categoriesRepeater2); model: rootModel.modelForRow(8)} }, State { name: "office"; - PropertyChanges { target: sortingLabel; text: 'Office'} + PropertyChanges { target: sortingLabel; text: i18n("Office")} PropertyChanges { target: sortingImage; source: 'icons/lucide/paperclip.svg'} PropertyChanges { target: (currentStateIndex % 2 == 0 ? categoriesRepeater : categoriesRepeater2); model: rootModel.modelForRow(9)} }, State { name: "science"; - PropertyChanges { target: sortingLabel; text: 'Science & Math'} + PropertyChanges { target: sortingLabel; text: i18n("Science & Math")} PropertyChanges { target: sortingImage; source: 'icons/lucide/flask-conical.svg'} PropertyChanges { target: (currentStateIndex % 2 == 0 ? categoriesRepeater : categoriesRepeater2); model: rootModel.modelForRow(10)} }, State { name: "settings"; - PropertyChanges { target: sortingLabel; text: 'Settings'} + PropertyChanges { target: sortingLabel; text: i18n("Settings")} PropertyChanges { target: sortingImage; source: 'icons/feather/settings.svg'} PropertyChanges { target: (currentStateIndex % 2 == 0 ? categoriesRepeater : categoriesRepeater2); model: rootModel.modelForRow(11)} }, State { name: "system"; - PropertyChanges { target: sortingLabel; text: 'System'} + PropertyChanges { target: sortingLabel; text: i18n("System")} PropertyChanges { target: sortingImage; source: 'icons/lucide/cpu.svg'} PropertyChanges { target: (currentStateIndex % 2 == 0 ? categoriesRepeater : categoriesRepeater2); model: rootModel.modelForRow(12)} }, State { name: "utilities"; - PropertyChanges { target: sortingLabel; text: 'Utilities'} + PropertyChanges { target: sortingLabel; text: i18n("Utilities")} PropertyChanges { target: sortingImage; source: 'icons/feather/tool.svg'} PropertyChanges { target: (currentStateIndex % 2 == 0 ? categoriesRepeater : categoriesRepeater2); model: rootModel.modelForRow(13)} }, State { name: "lost"; - PropertyChanges { target: sortingLabel; text: 'Lost & Found'} + PropertyChanges { target: sortingLabel; text: i18n("Lost & Found")} PropertyChanges { target: sortingImage; source: 'icons/feather/trash-2.svg'} PropertyChanges { target: (currentStateIndex % 2 == 0 ? categoriesRepeater : categoriesRepeater2); model: rootModel.modelForRow(7)} } @@ -201,7 +212,7 @@ ScrollView { id: sortingLabel x: parent.width + 10 * PlasmaCore.Units.devicePixelRatio anchors.verticalCenter: parent.verticalCenter - text: "All" + text: i18n("All") color: main.textColor font.family: main.textFont font.pixelSize: 12 * PlasmaCore.Units.devicePixelRatio @@ -245,12 +256,11 @@ ScrollView { height: 10 * PlasmaCore.Units.devicePixelRatio } - Grid { //All Apps // want to convert this to listview later to use verticallayoutdireciton + Grid { id: allAppsGrid x: - 10 * PlasmaCore.Units.devicePixelRatio columns: 1 width: scrollView.width - 10 * PlasmaCore.Units.devicePixelRatio - //verticalLayoutDirection: main.isTop ? ListView.BottomToTop : ListView.TopToBottom visible: opacity > 0 Repeater { id: allAppsRepeater @@ -266,12 +276,12 @@ ScrollView { } states: [ State { - name: "hidden"; when: (sortingLabel.text != 'All') + name: "hidden"; when: (sortingImage.state != 'all') PropertyChanges { target: allAppsGrid; opacity: 0.0 } PropertyChanges { target: allAppsGrid; x: (!isRight ? -20 * PlasmaCore.Units.devicePixelRatio : 0) } }, State { - name: "shown"; when: (sortingLabel.text == 'All') + name: "shown"; when: (sortingImage.state == 'all') PropertyChanges { target: allAppsGrid; opacity: 1.0 } PropertyChanges { target: allAppsGrid; x: -10 } }] @@ -287,13 +297,16 @@ ScrollView { NumberAnimation { properties: 'x'; from: (isRight ? -20 * PlasmaCore.Units.devicePixelRatio : 0); duration: 40; } } ] + onStateChanged: { + if (state == 'hidden') { + scrollpositon = scrollView.ScrollBar.vertical.position + scrollheight = scrollView.contentHeight + } + } } - - Grid { //Categories id: appCategories columns: 1 - //anchors.top: allAppsGrid.opacity != 1 ? allAppsGrid.top : NULL width: scrollView.width - 10 * PlasmaCore.Units.devicePixelRatio visible: opacity > 0 Repeater { @@ -327,6 +340,12 @@ ScrollView { NumberAnimation { properties: 'x'; from: (isRight ? -20 * PlasmaCore.Units.devicePixelRatio : 0); duration: 40; } } ] + onStateChanged: { + if (state == 'hidden') { + scrollpositon = scrollView.ScrollBar.vertical.position + scrollheight = scrollView.contentHeight + } + } } Grid { //Categories @@ -365,6 +384,12 @@ ScrollView { NumberAnimation { properties: 'x'; from: (isRight ? -20 * PlasmaCore.Units.devicePixelRatio : 0);duration: 40; } } ] + onStateChanged: { + if (state == 'hidden') { + scrollpositon = scrollView.ScrollBar.vertical.position + scrollheight = scrollView.contentHeight + } + } } Item { //Spacer diff --git a/contents/ui/ConfigGeneral.qml b/contents/ui/ConfigGeneral.qml index 4f9f877..e9518ad 100644 --- a/contents/ui/ConfigGeneral.qml +++ b/contents/ui/ConfigGeneral.qml @@ -23,6 +23,7 @@ import QtQuick 2.12 import QtQuick.Controls 2.5 import QtQuick.Dialogs 1.0 +import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons import org.kde.draganddrop 2.0 as DragDrop @@ -50,6 +51,8 @@ Kirigami.FormLayout { property alias cfg_customGreeting: customGreeting.text property alias cfg_floating: floating.checked property alias cfg_launcherPosition: launcherPosition.currentIndex + property alias cfg_offsetX: screenOffset.value + property alias cfg_offsetY: panelOffset.value Button { id: iconButton @@ -173,7 +176,7 @@ Kirigami.FormLayout { onPressed: colorDialog.visible ? colorDialog.close() : colorDialog.open() ColorDialog { id: colorDialog - title: "Please choose a color" + title: i18n("Please choose a color") onAccepted: { cfg_indicatorColor = colorDialog.color } @@ -196,7 +199,7 @@ Kirigami.FormLayout { TextField { id: customGreeting Kirigami.FormData.label: i18n("Custom Greeting Text:") - placeholderText: "No custom greeting set" + placeholderText: i18n("No custom greeting set") } Item { Kirigami.FormData.isSection: true @@ -219,8 +222,36 @@ Kirigami.FormLayout { } } CheckBox { - id: floating - text: i18n("Floating") + id: floating + text: i18n("Floating") + onCheckedChanged: { + screenOffset.visible = checked + panelOffset.visible = checked + } + } + Slider { + id: screenOffset + visible: plasmoid.configuration.floating + Kirigami.FormData.label: i18n("Offset Screen Edge (0 is Default):") + from: 0 + value: 0 + to: 100 + stepSize: 1 + PlasmaComponents.ToolTip { + text: screenOffset.value + } + } + Slider { + id: panelOffset + visible: plasmoid.configuration.floating + Kirigami.FormData.label: i18n("Offset Panel (0 is Default):") + from: 0 + value: 0 + to: 100 + stepSize: 1 + PlasmaComponents.ToolTip { + text: panelOffset.value + } } Item { Kirigami.FormData.isSection: true diff --git a/contents/ui/Header.qml b/contents/ui/Header.qml index b8ca9ee..73d0ce8 100644 --- a/contents/ui/Header.qml +++ b/contents/ui/Header.qml @@ -37,7 +37,7 @@ Item { anchors.left: parent.left PlasmaComponents.ToolTip { - text: "Settings" + text: i18n("Settings") } Item { id: visualParentSettings @@ -72,7 +72,7 @@ Item { anchors.right: parent.right PlasmaComponents.ToolTip { - text: "Power Off" + text: i18n("Power Off") } Image { id: powerImage diff --git a/contents/ui/MainView.qml b/contents/ui/MainView.qml index 2f68e20..94cb78e 100644 --- a/contents/ui/MainView.qml +++ b/contents/ui/MainView.qml @@ -48,6 +48,10 @@ Item { } } + function updateStartpage(){ + appList.currentStateIndex = plasmoid.configuration.defaultPage + } + function reload() { searchBar.clear() searchBar.focus = true @@ -165,7 +169,7 @@ Item { font.pixelSize: 13 * PlasmaCore.Units.devicePixelRatio Text { anchors.fill: parent - text: 'Search your computer' + text: i18n("Search your computer") color: plasmoid.configuration.theming == 0 ? "#686B71" : plasmoid.configuration.theming == 1 ? "#798591" : PlasmaCore.Theme.disabledTextColor visible: !parent.text } @@ -249,7 +253,7 @@ Item { id: runnerList model: runnerModel state: "hidden" - visible: opacity > 0//searching + visible: opacity > 0 anchors.top: backdrop.top anchors.bottom: backdrop.bottom width: main.width - 30 * PlasmaCore.Units.devicePixelRatio @@ -288,7 +292,7 @@ Item { radius: isTop ? backdrop.radius : 0 gradient: Gradient { GradientStop { position: 0.0; color: Qt.darker(backdrop.color, 1.5) } - GradientStop { position: 1.0; color: "transparent" }//"#0d0d0d" + GradientStop { position: 1.0; color: "transparent" } } states: [ State { diff --git a/contents/ui/MenuRepresentation.qml b/contents/ui/MenuRepresentation.qml index fff4da3..a17eadc 100644 --- a/contents/ui/MenuRepresentation.qml +++ b/contents/ui/MenuRepresentation.qml @@ -39,10 +39,10 @@ PlasmaCore.Dialog { if (!visible) { reset(); } else { + main.updateStartpage() var pos = popupPosition(width, height); x = pos.x; y = pos.y; - requestActivate(); } } @@ -75,7 +75,13 @@ PlasmaCore.Dialog { screenAvail.width, screenAvail.height);*/ - var offset = plasmoid.configuration.floating ? parent.height * 0.75 : 0; + var offset = 0 + + if (plasmoid.configuration.offsetX > 0 && plasmoid.configuration.floating) { + offset = plasmoid.configuration.offsetX + } else { + offset = plasmoid.configuration.floating ? parent.height * 0.75 : 0 + } // Fall back to bottom-left of screen area when the applet is on the desktop or floating. var x = offset; var y = screen.height - height - offset; @@ -101,18 +107,23 @@ PlasmaCore.Dialog { if (plasmoid.location == PlasmaCore.Types.TopEdge) { if (plasmoid.configuration.floating) { /*this is floatingAvatar.width*/ - offset = (125 * PlasmaCore.Units.devicePixelRatio) / 2 + parent.height * 0.125 + if (plasmoid.configuration.offsetY > 0) { + offset = (125 * PlasmaCore.Units.devicePixelRatio) / 2 + plasmoid.configuration.offsetY + } else { + offset = (125 * PlasmaCore.Units.devicePixelRatio) / 2 + parent.height * 0.125 + } } y = parent.height + panelSvg.margins.bottom + offset; } else { + if (plasmoid.configuration.offsetY > 0) { + offset = plasmoid.configuration.offsetY + } y = screen.height - parent.height - height - panelSvg.margins.top - offset; } } else { y = vertMidPoint - height / 2 } - - return Qt.point(x, y); }