-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
712 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/***************************************************************************** | ||
* Copyright (C) 2013-2014 by Eike Hein <[email protected]> * | ||
* Copyright (C) 2021 by Prateek SU <[email protected]> * | ||
* Copyright (C) 2022 by Friedrich Schriewer <[email protected]> * | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
* This program is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
* GNU General Public License for more details. * | ||
* * | ||
* You should have received a copy of the GNU General Public License * | ||
* along with this program; if not, write to the * | ||
* Free Software Foundation, Inc., * | ||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * | ||
****************************************************************************/ | ||
|
||
import QtQuick 2.12 | ||
import QtQuick.Layouts 1.12 | ||
|
||
import org.kde.plasma.plasmoid 2.0 | ||
import org.kde.plasma.core 2.0 as PlasmaCore | ||
|
||
Item { | ||
id: root | ||
|
||
property QtObject dashWindow: null | ||
readonly property bool useCustomButtonImage: (plasmoid.configuration.useCustomButtonImage && plasmoid.configuration.customButtonImage.length != 0) | ||
|
||
PlasmaCore.IconItem { | ||
id: buttonIcon | ||
|
||
width: plasmoid.configuration.activationIndicator ? parent.width * 0.65 : parent.width | ||
height: plasmoid.configuration.activationIndicator ? parent.height * 0.65 : parent.height | ||
anchors.centerIn: parent | ||
//anchors.fill: parent | ||
|
||
/*readonly property double aspectRatio: (vertical ? implicitHeight / implicitWidth | ||
: implicitWidth / implicitHeight)*/ | ||
|
||
source: useCustomButtonImage ? plasmoid.configuration.customButtonImage : plasmoid.configuration.icon | ||
|
||
active: mouseArea.containsMouse | ||
|
||
smooth: true | ||
|
||
Rectangle { | ||
id: indicator | ||
width: 0 | ||
anchors.horizontalCenter: parent.horizontalCenter | ||
height: 3 | ||
radius: 10 | ||
y: parent.height + height | ||
color: plasmoid.configuration.indicatorColor | ||
visible: plasmoid.configuration.activationIndicator | ||
|
||
states: [ | ||
State { name: "inactive" | ||
when: !dashWindow.visible | ||
PropertyChanges { | ||
target: indicator | ||
width: 0 | ||
|
||
} | ||
}, | ||
State { name: "active" | ||
when: dashWindow.visible | ||
PropertyChanges { | ||
target: indicator | ||
width: parent.width * 0.65 | ||
} | ||
} | ||
] | ||
transitions: [ | ||
Transition { | ||
NumberAnimation { properties: 'width'; duration: 60} | ||
} | ||
] | ||
} | ||
} | ||
|
||
MouseArea | ||
{ | ||
id: mouseArea | ||
|
||
anchors.fill: parent | ||
|
||
hoverEnabled: true | ||
|
||
onClicked: { | ||
dashWindow.visible = !dashWindow.visible; | ||
} | ||
} | ||
|
||
Component.onCompleted: { | ||
dashWindow = Qt.createQmlObject("MenuRepresentation {}", root); | ||
plasmoid.activated.connect(function() { | ||
dashWindow.visible = !dashWindow.visible; | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,256 @@ | ||
/***************************************************************************** | ||
* Copyright (C) 2013-2014 by Eike Hein <[email protected]> * | ||
* Copyright (C) 2021 by Prateek SU <[email protected]> * | ||
* Copyright (C) 2022 by Friedrich Schriewer <[email protected]> * | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
* This program is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
* GNU General Public License for more details. * | ||
* * | ||
* You should have received a copy of the GNU General Public License * | ||
* along with this program; if not, write to the * | ||
* Free Software Foundation, Inc., * | ||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * | ||
****************************************************************************/ | ||
|
||
import QtQuick 2.12 | ||
import QtQuick.Controls 2.5 | ||
import QtQuick.Dialogs 1.0 | ||
|
||
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 | ||
import org.kde.kirigami 2.3 as Kirigami | ||
|
||
import org.kde.plasma.private.kicker 0.1 as Kicker | ||
|
||
Kirigami.FormLayout { | ||
id: configGeneral | ||
|
||
anchors.left: parent.left | ||
anchors.right: parent.right | ||
|
||
property bool isDash: (plasmoid.pluginName === "org.kde.plasma.kickerdash") | ||
|
||
property string cfg_icon: plasmoid.configuration.icon | ||
property bool cfg_useCustomButtonImage: plasmoid.configuration.useCustomButtonImage | ||
property string cfg_customButtonImage: plasmoid.configuration.customButtonImage | ||
property bool cfg_activationIndicator: plasmoid.configuration.activationIndicator | ||
property color cfg_indicatorColor: plasmoid.configuration.indicatorColor | ||
property bool cfg_enableGreeting: plasmoid.configuration.indicatorColor | ||
property string cfg_defaultState: plasmoid.configuration.defaultState | ||
property string cfg_defaultStateIcon: plasmoid.configuration.defaultStateIcon | ||
property bool cfg_isCentered: plasmoid.configuration.isCentered | ||
property alias cfg_defaultPage: defaultPage.currentIndex | ||
property alias cfg_theming: theming.currentIndex | ||
property alias cfg_useExtraRunners: useExtraRunners.checked | ||
property alias cfg_customGreeting: customGreeting.text | ||
|
||
Button { | ||
id: iconButton | ||
|
||
Kirigami.FormData.label: i18n("Icon:") | ||
|
||
implicitWidth: previewFrame.width + units.smallSpacing * 2 | ||
implicitHeight: previewFrame.height + units.smallSpacing * 2 | ||
|
||
// Just to provide some visual feedback when dragging; | ||
// cannot have checked without checkable enabled | ||
checkable: true | ||
checked: dropArea.containsAcceptableDrag | ||
|
||
onPressed: iconMenu.opened ? iconMenu.close() : iconMenu.open() | ||
|
||
DragDrop.DropArea { | ||
id: dropArea | ||
|
||
property bool containsAcceptableDrag: false | ||
|
||
anchors.fill: parent | ||
|
||
onDragEnter: { | ||
// Cannot use string operations (e.g. indexOf()) on "url" basic type. | ||
var urlString = event.mimeData.url.toString(); | ||
|
||
// This list is also hardcoded in KIconDialog. | ||
var extensions = [".png", ".xpm", ".svg", ".svgz"]; | ||
containsAcceptableDrag = urlString.indexOf("file:///") === 0 && extensions.some(function (extension) { | ||
return urlString.indexOf(extension) === urlString.length - extension.length; // "endsWith" | ||
}); | ||
|
||
if (!containsAcceptableDrag) { | ||
event.ignore(); | ||
} | ||
} | ||
onDragLeave: containsAcceptableDrag = false | ||
|
||
onDrop: { | ||
if (containsAcceptableDrag) { | ||
// Strip file:// prefix, we already verified in onDragEnter that we have only local URLs. | ||
iconDialog.setCustomButtonImage(event.mimeData.url.toString().substr("file://".length)); | ||
} | ||
containsAcceptableDrag = false; | ||
} | ||
} | ||
|
||
KQuickAddons.IconDialog { | ||
id: iconDialog | ||
|
||
function setCustomButtonImage(image) { | ||
cfg_customButtonImage = image || cfg_icon || "start-here-kde" | ||
cfg_useCustomButtonImage = true; | ||
} | ||
|
||
onIconNameChanged: setCustomButtonImage(iconName); | ||
} | ||
|
||
PlasmaCore.FrameSvgItem { | ||
id: previewFrame | ||
anchors.centerIn: parent | ||
imagePath: plasmoid.location === PlasmaCore.Types.Vertical || plasmoid.location === PlasmaCore.Types.Horizontal | ||
? "widgets/panel-background" : "widgets/background" | ||
width: units.iconSizes.large + fixedMargins.left + fixedMargins.right | ||
height: units.iconSizes.large + fixedMargins.top + fixedMargins.bottom | ||
|
||
PlasmaCore.IconItem { | ||
anchors.centerIn: parent | ||
width: units.iconSizes.large | ||
height: width | ||
source: cfg_useCustomButtonImage ? cfg_customButtonImage : cfg_icon | ||
} | ||
} | ||
|
||
Menu { | ||
id: iconMenu | ||
|
||
// Appear below the button | ||
y: +parent.height | ||
|
||
onClosed: iconButton.checked = false; | ||
|
||
MenuItem { | ||
text: i18nc("@item:inmenu Open icon chooser dialog", "Choose...") | ||
icon.name: "document-open-folder" | ||
onClicked: iconDialog.open() | ||
} | ||
MenuItem { | ||
text: i18nc("@item:inmenu Reset icon to default", "Clear Icon") | ||
icon.name: "edit-clear" | ||
onClicked: { | ||
cfg_icon = "start-here-kde" | ||
cfg_useCustomButtonImage = false | ||
} | ||
} | ||
} | ||
} | ||
CheckBox { | ||
id: activationIndicatorCheck | ||
Kirigami.FormData.label: i18n("Indicator:") | ||
text: i18n("Enabled") | ||
checked: plasmoid.configuration.activationIndicator | ||
onCheckedChanged: { | ||
plasmoid.configuration.activationIndicator = checked | ||
cfg_activationIndicator = checked | ||
} | ||
} | ||
Button { | ||
id: colorButton | ||
width: units.iconSizes.small | ||
height: width | ||
Kirigami.FormData.label: i18n("Indicator Color:") | ||
|
||
Rectangle { | ||
anchors.centerIn: parent | ||
anchors.fill: parent | ||
radius: 10 | ||
color: cfg_indicatorColor | ||
} | ||
onPressed: colorDialog.visible ? colorDialog.close() : colorDialog.open() | ||
ColorDialog { | ||
id: colorDialog | ||
title: "Please choose a color" | ||
onAccepted: { | ||
cfg_indicatorColor = colorDialog.color | ||
} | ||
} | ||
} | ||
Item { | ||
Kirigami.FormData.isSection: true | ||
} | ||
CheckBox { | ||
id: enableGreetingCheck | ||
Kirigami.FormData.label: i18n("Greeting:") | ||
text: i18n("Enabled") | ||
checked: plasmoid.configuration.enableGreeting | ||
onCheckedChanged: { | ||
plasmoid.configuration.enableGreeting = checked | ||
cfg_enableGreeting = checked | ||
} | ||
} | ||
TextField { | ||
id: customGreeting | ||
Kirigami.FormData.label: i18n("Custom Greeting Text:") | ||
placeholderText: "No custom greeting set" | ||
} | ||
Item { | ||
Kirigami.FormData.isSection: true | ||
} | ||
CheckBox { | ||
Kirigami.FormData.label: i18n("In Center:") | ||
text: i18n("Enabled") | ||
checked: plasmoid.configuration.isCentered | ||
onCheckedChanged: { | ||
plasmoid.configuration.isCentered = checked | ||
cfg_isCentered = checked | ||
} | ||
} | ||
Item { | ||
Kirigami.FormData.isSection: true | ||
} | ||
ComboBox { | ||
id: defaultPage | ||
Kirigami.FormData.label: i18n("Default Page:") | ||
model: [ | ||
i18n("All Applications (Default)"), | ||
i18n("Developement"), | ||
i18n("Games"), | ||
i18n("Graphics"), | ||
i18n("Internet"), | ||
i18n("Multimedia"), | ||
i18n("Office"), | ||
i18n("Science & Math"), | ||
i18n("Settings"), | ||
i18n("System"), | ||
i18n("Utilities"), | ||
i18n("Lost & Found"), | ||
] | ||
} | ||
Item { | ||
Kirigami.FormData.isSection: true | ||
} | ||
CheckBox { | ||
id: useExtraRunners | ||
|
||
Kirigami.FormData.label: i18n("Search:") | ||
|
||
text: i18n("Expand search to bookmarks, files and emails") | ||
} | ||
Item { | ||
Kirigami.FormData.isSection: true | ||
} | ||
ComboBox { | ||
id: theming | ||
Kirigami.FormData.label: i18n("Theming:") | ||
model: [ | ||
i18n("Dark (Default)"), | ||
i18n("Light"), | ||
i18n("Matching"), | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.