mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-03 18:24:46 +00:00
resume launch feedback window
This commit is contained in:
parent
9a8f90681b
commit
b31b6289dd
6 changed files with 286 additions and 10 deletions
|
|
@ -67,6 +67,7 @@ QHash<int, QByteArray> ApplicationListModel::roleNames() const
|
||||||
roleNames[ApplicationStorageIdRole] = "ApplicationStorageIdRole";
|
roleNames[ApplicationStorageIdRole] = "ApplicationStorageIdRole";
|
||||||
roleNames[ApplicationEntryPathRole] = "ApplicationEntryPathRole";
|
roleNames[ApplicationEntryPathRole] = "ApplicationEntryPathRole";
|
||||||
roleNames[ApplicationOriginalRowRole] = "ApplicationOriginalRowRole";
|
roleNames[ApplicationOriginalRowRole] = "ApplicationOriginalRowRole";
|
||||||
|
roleNames[ApplicationStartupNotifyRole] = "ApplicationStartupNotifyRole";
|
||||||
roleNames[ApplicationLocationRole] = "ApplicationLocationRole";
|
roleNames[ApplicationLocationRole] = "ApplicationLocationRole";
|
||||||
|
|
||||||
return roleNames;
|
return roleNames;
|
||||||
|
|
@ -148,6 +149,7 @@ void ApplicationListModel::loadApplications()
|
||||||
data.icon = service->icon();
|
data.icon = service->icon();
|
||||||
data.storageId = service->storageId();
|
data.storageId = service->storageId();
|
||||||
data.entryPath = service->exec();
|
data.entryPath = service->exec();
|
||||||
|
data.startupNotify = service->property("StartupNotify").toBool();
|
||||||
|
|
||||||
if (m_favorites.contains(data.storageId)) {
|
if (m_favorites.contains(data.storageId)) {
|
||||||
data.location = Favorites;
|
data.location = Favorites;
|
||||||
|
|
@ -198,6 +200,8 @@ QVariant ApplicationListModel::data(const QModelIndex &index, int role) const
|
||||||
return m_applicationList.at(index.row()).entryPath;
|
return m_applicationList.at(index.row()).entryPath;
|
||||||
case ApplicationOriginalRowRole:
|
case ApplicationOriginalRowRole:
|
||||||
return index.row();
|
return index.row();
|
||||||
|
case ApplicationStartupNotifyRole:
|
||||||
|
return m_applicationList.at(index.row()).startupNotify;
|
||||||
case ApplicationLocationRole:
|
case ApplicationLocationRole:
|
||||||
return m_applicationList.at(index.row()).location;
|
return m_applicationList.at(index.row()).location;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ struct ApplicationData {
|
||||||
QString storageId;
|
QString storageId;
|
||||||
QString entryPath;
|
QString entryPath;
|
||||||
int location = 0; //FIXME
|
int location = 0; //FIXME
|
||||||
|
bool startupNotify = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ApplicationListModel : public QAbstractListModel {
|
class ApplicationListModel : public QAbstractListModel {
|
||||||
|
|
@ -59,6 +60,7 @@ public:
|
||||||
ApplicationStorageIdRole,
|
ApplicationStorageIdRole,
|
||||||
ApplicationEntryPathRole,
|
ApplicationEntryPathRole,
|
||||||
ApplicationOriginalRowRole,
|
ApplicationOriginalRowRole,
|
||||||
|
ApplicationStartupNotifyRole,
|
||||||
ApplicationLocationRole
|
ApplicationLocationRole
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
118
containments/homescreen2/package/contents/ui/FeedbackWindow.qml
Normal file
118
containments/homescreen2/package/contents/ui/FeedbackWindow.qml
Normal file
|
|
@ -0,0 +1,118 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2015 Marco Martin <notmart@gmail.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Library General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2, 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 Library General Public License for more details
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library 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.0
|
||||||
|
import QtQuick.Layouts 1.1
|
||||||
|
import QtQuick.Window 2.2
|
||||||
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
|
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||||
|
|
||||||
|
Window {
|
||||||
|
id: window
|
||||||
|
|
||||||
|
property alias state: background.state
|
||||||
|
property alias icon: icon.source
|
||||||
|
width: Screen.width
|
||||||
|
height: Screen.height
|
||||||
|
color: "transparent"
|
||||||
|
onVisibleChanged: {
|
||||||
|
if (!visible) {
|
||||||
|
background.state = "closed";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onActiveChanged: {
|
||||||
|
if (!active) {
|
||||||
|
background.state = "closed";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PlasmaCore.ColorScope {
|
||||||
|
id: background
|
||||||
|
anchors.fill: parent
|
||||||
|
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
||||||
|
width: window.width
|
||||||
|
height: window.height
|
||||||
|
state: "closed"
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: background.backgroundColor
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
PlasmaCore.IconItem {
|
||||||
|
id: icon
|
||||||
|
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
||||||
|
Layout.preferredWidth: units.iconSizes.enormous
|
||||||
|
Layout.preferredHeight: Layout.preferredWidth
|
||||||
|
Layout.alignment: Qt.AlignCenter
|
||||||
|
}
|
||||||
|
PlasmaExtras.Heading {
|
||||||
|
text: window.title
|
||||||
|
Layout.alignment: Qt.AlignCenter
|
||||||
|
}
|
||||||
|
PlasmaComponents.BusyIndicator {
|
||||||
|
Layout.alignment: Qt.AlignCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
states: [
|
||||||
|
State {
|
||||||
|
name: "closed"
|
||||||
|
PropertyChanges {
|
||||||
|
target: background
|
||||||
|
scale: 0
|
||||||
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: window
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State {
|
||||||
|
name: "open"
|
||||||
|
PropertyChanges {
|
||||||
|
target: background
|
||||||
|
scale: 1
|
||||||
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: window
|
||||||
|
visible: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
transitions: [
|
||||||
|
Transition {
|
||||||
|
from: "closed"
|
||||||
|
SequentialAnimation {
|
||||||
|
ScriptAction {
|
||||||
|
script: window.visible = true;
|
||||||
|
}
|
||||||
|
PropertyAnimation {
|
||||||
|
target: background
|
||||||
|
duration: units.longDuration
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
properties: "scale"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
124
containments/homescreen2/package/contents/ui/KRunner.qml
Normal file
124
containments/homescreen2/package/contents/ui/KRunner.qml
Normal file
|
|
@ -0,0 +1,124 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015 Vishesh Handa <vhanda@kde.org>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) version 3, or any
|
||||||
|
* later version accepted by the membership of KDE e.V. (or its
|
||||||
|
* successor approved by the membership of KDE e.V.), which shall
|
||||||
|
* act as a proxy defined in Section 6 of version 3 of the license.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import QtQuick 2.0
|
||||||
|
import QtQuick.Layouts 1.1
|
||||||
|
import QtQuick.Window 2.1
|
||||||
|
|
||||||
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
|
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||||
|
|
||||||
|
import org.kde.milou 0.1 as Milou
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: krunner
|
||||||
|
anchors.fill: parent
|
||||||
|
height: childrenRect.height
|
||||||
|
color: listView.visible ? Qt.rgba(0, 0, 0, 0.8) : "transparent"
|
||||||
|
property alias showingResults: listView.visible
|
||||||
|
property int inputHeight: queryField.height + background.fixedMargins.top/2 + background.fixedMargins.bottom
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
enabled: listView.visible
|
||||||
|
anchors.fill: parent
|
||||||
|
preventStealing: true
|
||||||
|
onClicked: queryField.text = "";
|
||||||
|
}
|
||||||
|
PlasmaCore.FrameSvgItem {
|
||||||
|
id: background
|
||||||
|
anchors {
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
top: parent.top
|
||||||
|
}
|
||||||
|
clip: true
|
||||||
|
imagePath: "widgets/background"
|
||||||
|
enabledBorders: PlasmaCore.FrameSvg.BottomBorder
|
||||||
|
height: childrenRect.height + fixedMargins.top/2 + fixedMargins.bottom
|
||||||
|
Behavior on height {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: units.longDuration
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
}
|
||||||
|
transform: Translate {
|
||||||
|
y: root.locked || editOverlay.visible ? -background.height : 0
|
||||||
|
Behavior on y {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: units.longDuration
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
height: Qt.inputMethod.keyboardRectangle.height > 0 ? (Math.min(implicitHeight, Qt.inputMethod.keyboardRectangle.y - plasmoid.availableScreenRect.y)) : implicitHeight
|
||||||
|
anchors {
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
top: parent.top
|
||||||
|
topMargin: background.fixedMargins.top / 2
|
||||||
|
leftMargin: background.fixedMargins.left / 2
|
||||||
|
rightMargin: background.fixedMargins.right / 2
|
||||||
|
}
|
||||||
|
PlasmaComponents.TextField {
|
||||||
|
id: queryField
|
||||||
|
clearButtonShown: true
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|
||||||
|
Keys.onEscapePressed: runnerWindow.visible = false
|
||||||
|
placeholderText: "Search..."
|
||||||
|
}
|
||||||
|
|
||||||
|
PlasmaExtras.ScrollArea {
|
||||||
|
visible: listView.count > 0
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.preferredHeight: listView.contentHeight
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|
||||||
|
Milou.ResultsListView {
|
||||||
|
id: listView
|
||||||
|
queryString: queryField.text
|
||||||
|
highlight: null
|
||||||
|
|
||||||
|
onActivated: queryField.text = ""
|
||||||
|
onUpdateQueryString: {
|
||||||
|
queryField.text = text
|
||||||
|
queryField.cursorPosition = cursorPosition
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Keys.onReturnPressed: {
|
||||||
|
if (queryField.texr.length == 0)
|
||||||
|
runnerWindow.visible = false;
|
||||||
|
}
|
||||||
|
Keys.onEnterPressed: {
|
||||||
|
if (queryField.texr.length == 0)
|
||||||
|
runnerWindow.visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -37,8 +37,8 @@ ContainmentLayoutManager.ItemContainer {
|
||||||
|
|
||||||
property var modelData: typeof model !== "undefined" ? model : null
|
property var modelData: typeof model !== "undefined" ? model : null
|
||||||
|
|
||||||
Layout.minimumWidth: availableCellWidth + units.gridUnit
|
Layout.minimumWidth: availableCellWidth
|
||||||
Layout.minimumHeight: availableCellHeight + units.gridUnit
|
Layout.minimumHeight: availableCellHeight
|
||||||
|
|
||||||
leftPadding: units.smallSpacing * 2
|
leftPadding: units.smallSpacing * 2
|
||||||
topPadding: units.smallSpacing * 2
|
topPadding: units.smallSpacing * 2
|
||||||
|
|
@ -72,6 +72,9 @@ ContainmentLayoutManager.ItemContainer {
|
||||||
dragCenterY = dragCenter.y;
|
dragCenterY = dragCenter.y;
|
||||||
launcherDragManager.dragItem(delegate, dragCenter.x, dragCenter.y);
|
launcherDragManager.dragItem(delegate, dragCenter.x, dragCenter.y);
|
||||||
|
|
||||||
|
delegate.height = availableCellHeight;
|
||||||
|
delegate.width = availableCellWidth;
|
||||||
|
|
||||||
var pos = plasmoid.fullRepresentationItem.mapFromItem(delegate, dragCenter.x, dragCenter.y);
|
var pos = plasmoid.fullRepresentationItem.mapFromItem(delegate, dragCenter.x, dragCenter.y);
|
||||||
//SCROLL UP
|
//SCROLL UP
|
||||||
if (pos.y < plasmoid.fullRepresentationItem.height / 4) {
|
if (pos.y < plasmoid.fullRepresentationItem.height / 4) {
|
||||||
|
|
@ -87,12 +90,12 @@ ContainmentLayoutManager.ItemContainer {
|
||||||
|
|
||||||
contentItem: MouseArea {
|
contentItem: MouseArea {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (modelData.ApplicationStartupNotifyRole) {
|
clickFedbackAnimation.target = delegate;
|
||||||
clickFedbackAnimation.target = delegate;
|
clickFedbackAnimation.running = true;
|
||||||
clickFedbackAnimation.running = true;
|
feedbackWindow.title = modelData.ApplicationNameRole;
|
||||||
feedbackWindow.title = modelData.ApplicationNameRole;
|
feedbackWindow.icon = modelData.ApplicationIconRole;
|
||||||
feedbackWindow.state = "open";
|
feedbackWindow.state = "open";
|
||||||
}
|
|
||||||
plasmoid.nativeInterface.applicationListModel.runApplication(modelData.ApplicationStorageIdRole);
|
plasmoid.nativeInterface.applicationListModel.runApplication(modelData.ApplicationStorageIdRole);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -129,9 +132,9 @@ ContainmentLayoutManager.ItemContainer {
|
||||||
maximumLineCount: 2
|
maximumLineCount: 2
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
|
|
||||||
text: modelData ? modelData.ApplicationNameRole : ""
|
text: model.ApplicationNameRole + " "+model.ApplicationLocationRole
|
||||||
font.pixelSize: theme.defaultFont.pixelSize
|
font.pixelSize: theme.defaultFont.pixelSize
|
||||||
color: model.ApplicationLocationRole == ApplicationListModel.Desktop ? "white" : PlasmaCore.Theme.textColor
|
color: model.ApplicationLocationRole == ApplicationListModel.Desktop ? "white" : "black"//PlasmaCore.Theme.textColor
|
||||||
|
|
||||||
layer.enabled: model.ApplicationLocationRole == ApplicationListModel.Desktop
|
layer.enabled: model.ApplicationLocationRole == ApplicationListModel.Desktop
|
||||||
layer.effect: DropShadow {
|
layer.effect: DropShadow {
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,31 @@ Text {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FeedbackWindow {
|
||||||
|
id: feedbackWindow
|
||||||
|
}
|
||||||
|
SequentialAnimation {
|
||||||
|
id: clickFedbackAnimation
|
||||||
|
property Item target
|
||||||
|
NumberAnimation {
|
||||||
|
target: clickFedbackAnimation.target
|
||||||
|
properties: "scale"
|
||||||
|
to: 2
|
||||||
|
duration: units.longDuration
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
PauseAnimation {
|
||||||
|
duration: units.shortDuration
|
||||||
|
}
|
||||||
|
NumberAnimation {
|
||||||
|
target: clickFedbackAnimation.target
|
||||||
|
properties: "scale"
|
||||||
|
to: 1
|
||||||
|
duration: units.longDuration
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Launcher.LauncherDragManager {
|
Launcher.LauncherDragManager {
|
||||||
id: launcherDragManager
|
id: launcherDragManager
|
||||||
appletsLayout: appletsLayout
|
appletsLayout: appletsLayout
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue