forked from openkylin/ukui-panel
Merge tag 'refs/tags/upstream/4.10.1.3' into openkylin/nile
4.10.1.3-release
This commit is contained in:
commit
fa7ae3ca29
|
@ -41,12 +41,18 @@ WidgetContainerItem {
|
|||
screen: containerItem.WidgetContainer.screen
|
||||
position: Types.Bottom
|
||||
flags: Qt.Window | Qt.WindowDoesNotAcceptFocus | Qt.FramelessWindowHint
|
||||
windowType: WindowType.SystemWindow
|
||||
|
||||
property bool hideIndicator: false
|
||||
property bool isHorizontal: (position === Types.BottomCenter || position === Types.TopCenter)
|
||||
property int newPanelPos: Types.Center
|
||||
|
||||
enableBlurEffect: !hideIndicator
|
||||
|
||||
StyleBackground {
|
||||
radius: containerItem.WidgetContainer.radius
|
||||
paletteRole: Theme.BrightText
|
||||
opacity: panelPosIndicator.hideIndicator ? 0 : 1
|
||||
width: {
|
||||
if (panelPosIndicator.isHorizontal) {
|
||||
return containerItem.WidgetContainer.screen.availableGeometry.width - 6;
|
||||
|
@ -214,8 +220,11 @@ WidgetContainerItem {
|
|||
}
|
||||
|
||||
if (panelPosIndicator.newPanelPos === containerItem.WidgetContainer.position) {
|
||||
panelPosIndicator.hide();
|
||||
// TODO: wlcom环境调用hide会导致mouseArea的pressed变为false
|
||||
// panelPosIndicator.hide();
|
||||
panelPosIndicator.hideIndicator = true;
|
||||
} else {
|
||||
panelPosIndicator.hideIndicator = false;
|
||||
panelPosIndicator.show();
|
||||
panelPosIndicator.position = pos;
|
||||
}
|
||||
|
|
|
@ -23,11 +23,20 @@ import QtQuick 2.12
|
|||
import QtQuick.Layouts 1.12
|
||||
import org.ukui.quick.items 1.0 as UkuiItems
|
||||
import org.ukui.quick.platform 1.0 as Platform
|
||||
import org.ukui.panel.taskManager 1.0 as UkuiTaskManager
|
||||
|
||||
Item {
|
||||
property alias appIcon: icon
|
||||
property alias appBackgroud: backgroud
|
||||
|
||||
function updateIconGeometry() {
|
||||
if (taskItemData.CurrentWinIdList) {
|
||||
if (taskItemData.CurrentWinIdList.length > 0) {
|
||||
UkuiTaskManager.WindowManager.setMinimizedGeometry(taskItemData.CurrentWinIdList, backgroud);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UkuiItems.StyleBackground {
|
||||
id: backgroud
|
||||
anchors.fill: parent
|
||||
|
|
|
@ -24,6 +24,7 @@ import QtQml.Models 2.15
|
|||
import QtQuick.Layouts 1.12
|
||||
import org.ukui.quick.items 1.0 as UkuiItems
|
||||
import org.ukui.quick.platform 1.0 as Platform
|
||||
import org.ukui.panel.taskManager 1.0 as UkuiTaskManager
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
@ -46,6 +47,15 @@ Item {
|
|||
return idx;
|
||||
}
|
||||
|
||||
function updateIconGeometry() {
|
||||
for (var i = 0; i < normalView.count; i++) {
|
||||
let item = normalView.itemAtIndex(i);
|
||||
if (item) {
|
||||
UkuiTaskManager.WindowManager.setMinimizedGeometry(model[i], item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DelegateModel {
|
||||
id: visualModel
|
||||
delegate: Package {
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
import QtQml 2.15
|
||||
import QtQuick 2.15
|
||||
import QtQml.Models 2.15
|
||||
|
||||
|
@ -51,7 +52,6 @@ DropArea {
|
|||
|
||||
DelegateModel {
|
||||
id: taskItemDelegateModel
|
||||
property bool isMergeStatus: (Widget.globalConfig.mergeIcons === 0)
|
||||
property var dragedObject: null
|
||||
|
||||
/**
|
||||
|
@ -99,7 +99,7 @@ DropArea {
|
|||
property int dragStartIndex: -1
|
||||
property var icon: model.Icon
|
||||
property bool isDragStatus: false
|
||||
property bool useSingleItem: taskItemDelegateModel.isMergeStatus || (CurrentWinIdList ? CurrentWinIdList.length < 1 : true)
|
||||
property bool useSingleItem: taskItemView.isMergeStatus || (CurrentWinIdList ? CurrentWinIdList.length < 1 : true)
|
||||
//非合并状态下激活预览图时 对应的winId
|
||||
property var singleWinId: []
|
||||
|
||||
|
@ -157,8 +157,9 @@ DropArea {
|
|||
delegateModel.items.addGroups(itemsIndex, 1, [delegateModel.persistedItems.name]);
|
||||
|
||||
taskItemRoot.isDragStatus = true;
|
||||
const modelIndex = delegateModel.dragedObject.model.index;
|
||||
Drag.mimeData = {
|
||||
"text/plain": '{"dragStartIndex":' + dragStartIndex + "}"
|
||||
"text/plain": '{"dragStartIndex":' + dragStartIndex + ',"modelIndex":' + modelIndex + '}'
|
||||
};
|
||||
Drag.active = true;
|
||||
// 不同的Action鼠标光标不同
|
||||
|
@ -216,7 +217,7 @@ DropArea {
|
|||
}
|
||||
|
||||
let index = -1;
|
||||
if (taskItemDelegateModel.isMergeStatus) {
|
||||
if (taskItemView.isMergeStatus) {
|
||||
// 轮转
|
||||
if (currentWid !== "") {
|
||||
index = CurrentWinIdList.indexOf(currentWid);
|
||||
|
@ -244,8 +245,8 @@ DropArea {
|
|||
|
||||
onEntered: {
|
||||
// 设置预览图窗口信息
|
||||
if (CurrentWinIdList.length > 0) {
|
||||
if (taskItemDelegateModel.isMergeStatus) {
|
||||
if (CurrentWinIdList !== undefined && CurrentWinIdList.length > 0) {
|
||||
if (taskItemView.isMergeStatus) {
|
||||
taskItemData.currentTaskItem = taskItemRoot;
|
||||
taskItemListRoot.requestThumbnailView(true, taskItemData);
|
||||
}
|
||||
|
@ -258,7 +259,7 @@ DropArea {
|
|||
|
||||
TaskItemData {
|
||||
id: taskItemData
|
||||
windowIdList: taskItemDelegateModel.isMergeStatus ? model.CurrentWinIdList : singleWinId
|
||||
windowIdList: taskItemView.isMergeStatus ? model.CurrentWinIdList : singleWinId
|
||||
windowIcons: model.WindowIcons
|
||||
windowTitles: model.WindowTitles
|
||||
}
|
||||
|
@ -354,6 +355,42 @@ DropArea {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* iconGeometry功能
|
||||
*/
|
||||
property var currentWinIdList: model.CurrentWinIdList
|
||||
property int itemIndex: DelegateModel.itemsIndex
|
||||
property Component iconGeometryTimer: Component {
|
||||
Timer {
|
||||
id: timer
|
||||
interval: 500
|
||||
running: true
|
||||
onTriggered: {
|
||||
taskItemRoot.updateIconGeometry();
|
||||
timer.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
function updateIconGeometry() {
|
||||
if (taskItemLoader.item && !taskItemRoot.DelegateModel.inTempItems) {
|
||||
taskItemLoader.item.updateIconGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (model.CurrentWinIdList) {
|
||||
if (model.CurrentWinIdList.length > 0) {
|
||||
iconGeometryTimer.createObject(taskItemRoot);
|
||||
}
|
||||
}
|
||||
}
|
||||
onItemIndexChanged: {
|
||||
updateIconGeometryTimer.restart();
|
||||
}
|
||||
onCurrentWinIdListChanged: {
|
||||
updateIconGeometry();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -363,6 +400,7 @@ DropArea {
|
|||
// contentWidth: childrenRect.width
|
||||
// width: childrenRect.width
|
||||
// height: parent.height
|
||||
property bool isMergeStatus: (Widget.globalConfig.mergeIcons === 0)
|
||||
property bool isHorizontal: orientation === ListView.Horizontal
|
||||
property real taskItemSize: isHorizontal ? taskItemView.height : taskItemView.width
|
||||
clip: true
|
||||
|
@ -373,13 +411,32 @@ DropArea {
|
|||
model: taskItemDelegateModel
|
||||
|
||||
onCountChanged: {
|
||||
positionViewAtBeginning()
|
||||
positionViewAtBeginning();
|
||||
}
|
||||
onOrientationChanged: {
|
||||
positionViewAtBeginning()
|
||||
positionViewAtBeginning();
|
||||
updateIconGeometryTimer.restart();
|
||||
}
|
||||
onTaskItemSizeChanged: {
|
||||
positionViewAtBeginning()
|
||||
positionViewAtBeginning();
|
||||
updateIconGeometryTimer.restart();
|
||||
}
|
||||
onIsMergeStatusChanged: {
|
||||
positionViewAtBeginning();
|
||||
updateIconGeometryTimer.restart();
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: updateIconGeometryTimer
|
||||
interval: 500
|
||||
onTriggered: {
|
||||
for (var i = 0; i < taskItemView.count; ++i) {
|
||||
let item = taskItemView.itemAtIndex(i);
|
||||
if (item) {
|
||||
item.updateIconGeometry();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
displaced: Transition {
|
||||
|
@ -497,6 +554,12 @@ DropArea {
|
|||
}
|
||||
|
||||
// 5.创建临时Item,并将他放到tempItems组中,后续可通过该组删除它
|
||||
if (insertIndex < 0) {
|
||||
insertIndex = 0;
|
||||
} else if (insertIndex > taskItemDelegateModel.items.count) {
|
||||
insertIndex = taskItemDelegateModel.items.count;
|
||||
}
|
||||
|
||||
taskItemDelegateModel.items.insert(
|
||||
insertIndex,
|
||||
{
|
||||
|
@ -575,7 +638,7 @@ DropArea {
|
|||
|
||||
const obj = JSON.parse(dragEvent.text);
|
||||
if (obj !== null) {
|
||||
taskItemProxyModel.setOrder(taskItemDelegateModel.model.index(obj.dragStartIndex, 0), droppedIndex);
|
||||
taskItemProxyModel.setOrder(taskItemDelegateModel.model.index(obj.modelIndex, 0), droppedIndex);
|
||||
}
|
||||
} else {
|
||||
// 外部事件,执行外部操作
|
||||
|
|
|
@ -104,6 +104,7 @@ TaskManager {
|
|||
id: thumbnailView
|
||||
mainItem: viewContent
|
||||
type: Platform.WindowType.SystemWindow
|
||||
flags: Qt.WindowDoesNotAcceptFocus | Qt.FramelessWindowHint
|
||||
visualParent: viewContent.thumbnailData ? viewContent.thumbnailData.currentTaskItem : null
|
||||
function updatePosition() {
|
||||
switch (Widget.container.position) {
|
||||
|
@ -129,6 +130,15 @@ TaskManager {
|
|||
id: blurRegions
|
||||
window: thumbnailView
|
||||
enable: true
|
||||
// 整个窗口的毛玻璃区域(为list模式时)
|
||||
Items.RectRegion {
|
||||
id: windowRegion
|
||||
x: 0
|
||||
y: 0
|
||||
width: 240
|
||||
height: 368
|
||||
radius: Platform.Theme.windowRadius
|
||||
}
|
||||
}
|
||||
|
||||
ThumbnailWindow {
|
||||
|
@ -154,12 +164,17 @@ TaskManager {
|
|||
id: updateBlurRegionTimer
|
||||
interval: 50
|
||||
onTriggered: {
|
||||
blurRegions.clearRectRegion();
|
||||
for (var i = 0; i < thumbnailModel.count; i ++) {
|
||||
let item = viewContent.thumbnailLayout.itemAtIndex(i);
|
||||
if (item) {
|
||||
blurRegions.addRectRegion(item.itemRegion);
|
||||
if (!viewContent.isList) {
|
||||
blurRegions.clearRectRegion();
|
||||
for (var i = 0; i < thumbnailModel.count; i ++) {
|
||||
let item = viewContent.thumbnailLayout.itemAt(i);
|
||||
if (item) {
|
||||
blurRegions.addRectRegion(item.itemRegion);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
blurRegions.clearRectRegion();
|
||||
blurRegions.addRectRegion(windowRegion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,10 @@ StyleBackground {
|
|||
paletteRole: (isList && containsMouse) ? Theme.BrightText : Theme.Base
|
||||
alpha: !isList ? 0.75 : containsPress ? 0.10 : containsMouse ? 0.05 : 0
|
||||
useStyleTransparency: false
|
||||
radius: isList ? 4 : 12
|
||||
radius: isList ? 4 : Theme.windowRadius
|
||||
borderColor: Theme.Text
|
||||
borderAlpha: 0.15
|
||||
border.width: isList ? 0 : 1
|
||||
|
||||
Loader {
|
||||
id: layoutLoader
|
||||
|
@ -131,8 +134,8 @@ StyleBackground {
|
|||
Layout.preferredWidth: width
|
||||
Layout.preferredHeight: height
|
||||
|
||||
height: isWidthBased ? itemHeight : listView.preChildrenSize - 48
|
||||
width: isWidthBased ? listView.preChildrenSize - 16 : itemWidth
|
||||
height: isWidthBased ? itemHeight : viewLoader.preChildrenSize - 48
|
||||
width: isWidthBased ? viewLoader.preChildrenSize - 16 : itemWidth
|
||||
property real itemHeight
|
||||
property real itemWidth
|
||||
|
||||
|
@ -144,9 +147,9 @@ StyleBackground {
|
|||
}
|
||||
var itemGeometry = UkuiTaskManager.WindowManager.geometry(modelData);
|
||||
if (!isWidthBased) {
|
||||
itemWidth = itemGeometry.width * ((listView.preChildrenSize - 48) / itemGeometry.height);
|
||||
itemWidth = itemGeometry.width * ((viewLoader.preChildrenSize - 48) / itemGeometry.height);
|
||||
} else {
|
||||
itemHeight = itemGeometry.height * ((listView.preChildrenSize - 16) / itemGeometry.width);
|
||||
itemHeight = itemGeometry.height * ((viewLoader.preChildrenSize - 16) / itemGeometry.width);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,12 +32,16 @@ import org.ukui.panel.taskManager 1.0 as UkuiTaskManager
|
|||
MouseArea {
|
||||
id: baseMouseArea
|
||||
|
||||
property alias thumbnailLayout: listView
|
||||
property bool isList
|
||||
property var thumbnailLayout: viewLoader.item.viewRepeater
|
||||
hoverEnabled: true
|
||||
|
||||
property bool menuVisible: false
|
||||
property int layoutSpacing: 8
|
||||
property int thumbnailImplicitHeight: 192
|
||||
// 设置初始高度,规避初次显示时出现鼠标悬浮退出事件,影响预览图显示
|
||||
width: 272
|
||||
height: 192
|
||||
|
||||
function menuAboutToHide() {
|
||||
baseMouseArea.menuVisible = false;
|
||||
|
@ -54,24 +58,20 @@ MouseArea {
|
|||
if (isHorizontal) {
|
||||
var listPreHeight = listViewBase.determineHeight(currentWinIdList).height;
|
||||
if (listPreHeight < 124) {
|
||||
listView.state = "list";
|
||||
listView.isList = true;
|
||||
baseMouseArea.isList = true;
|
||||
return;
|
||||
} else {
|
||||
listView.preChildrenSize = listPreHeight;
|
||||
listView.state = "thumbnail";
|
||||
listView.isList = false;
|
||||
viewLoader.preChildrenSize = listPreHeight;
|
||||
baseMouseArea.isList = false;
|
||||
}
|
||||
} else {
|
||||
var listPreWidth = listViewBase.determineWidth(currentWinIdList).width;
|
||||
if (listPreWidth < 124) {
|
||||
listView.state = "list";
|
||||
listView.isList = true;
|
||||
baseMouseArea.isList = true;
|
||||
return;
|
||||
} else {
|
||||
listView.preChildrenSize = listPreWidth;
|
||||
listView.state = "thumbnail";
|
||||
listView.isList = false;
|
||||
viewLoader.preChildrenSize = listPreWidth;
|
||||
baseMouseArea.isList = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -81,17 +81,22 @@ MouseArea {
|
|||
paletteRole: Platform.Theme.Base
|
||||
useStyleTransparency: false
|
||||
|
||||
width: listView.width
|
||||
height: listView.height
|
||||
alpha: 0
|
||||
width: viewLoader.width
|
||||
height: viewLoader.height
|
||||
alpha: isList ? 0.75 : 0
|
||||
borderColor: Platform.Theme.Text
|
||||
borderAlpha: 0.15
|
||||
border.width: isList ? 1 : 0
|
||||
radius: Platform.Theme.windowRadius
|
||||
|
||||
// 窗口尺寸不能为0
|
||||
onWidthChanged: {
|
||||
baseMouseArea.width = Math.max(listViewBase.width, 1);
|
||||
baseMouseArea.height = Math.max(listViewBase.height, 1);
|
||||
baseMouseArea.width = Math.max(Math.ceil(listViewBase.width), 1);
|
||||
baseMouseArea.height = Math.max(Math.ceil(listViewBase.height), 1);
|
||||
}
|
||||
onHeightChanged: {
|
||||
baseMouseArea.width = Math.max(listViewBase.width, 1);
|
||||
baseMouseArea.height = Math.max(listViewBase.height, 1);
|
||||
baseMouseArea.width = Math.max(Math.ceil(listViewBase.width), 1);
|
||||
baseMouseArea.height = Math.max(Math.ceil(listViewBase.height), 1);
|
||||
}
|
||||
|
||||
function determineHeight(winIdList) {
|
||||
|
@ -108,7 +113,7 @@ MouseArea {
|
|||
|
||||
var otherAreaSize;
|
||||
// 其余区域的大小,包括间距和预览图的margin
|
||||
otherAreaSize = layoutSpacing * 2 * listView.count + 6 * (listView.count - 1);
|
||||
otherAreaSize = layoutSpacing * 2 * viewLoader.count + 6 * (viewLoader.count - 1);
|
||||
if ((Screen.width - 16 - otherAreaSize) < totalWidth) {
|
||||
thumbnailHeight = thumbnailHeight * (Screen.width - 16 - otherAreaSize) / totalWidth;
|
||||
}
|
||||
|
@ -132,7 +137,7 @@ MouseArea {
|
|||
|
||||
var otherAreaSize;
|
||||
// 其余区域的大小,包括间距和预览图的margin,以及纵向布局时的title高度(24)
|
||||
otherAreaSize = (layoutSpacing * 3 + 24) * listView.count + 6 * (listView.count - 1);
|
||||
otherAreaSize = (layoutSpacing * 3 + 24) * viewLoader.count + 6 * (viewLoader.count - 1);
|
||||
|
||||
if ((Screen.height - 16 - otherAreaSize) < totalHeight) {
|
||||
thumbnailWidth = thumbnailWidth * (Screen.height - 16 - otherAreaSize) / totalHeight;
|
||||
|
@ -143,139 +148,138 @@ MouseArea {
|
|||
return Qt.rect(0, 0, listPreWidth, listPreHeight);
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: listView
|
||||
property bool isList
|
||||
Loader {
|
||||
id: viewLoader
|
||||
property int preChildrenSize
|
||||
state: ""
|
||||
ScrollBar.vertical: scrollBarControl
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
anchors.left: parent.left
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "list"
|
||||
PropertyChanges {
|
||||
target: listView
|
||||
width: 220
|
||||
height: 360
|
||||
interactive: true
|
||||
orientation: ListView.Vertical
|
||||
spacing: 0
|
||||
anchors.margins: 4
|
||||
}
|
||||
PropertyChanges {
|
||||
target: listViewBase
|
||||
//列表模式下,有4margins的间距
|
||||
width: childrenRect.width + 4
|
||||
height: listView.height + 8
|
||||
alpha: 0.75
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "thumbnail"
|
||||
PropertyChanges {
|
||||
target: listView
|
||||
width: contentItem.childrenRect.width
|
||||
height: contentItem.childrenRect.height
|
||||
interactive: false
|
||||
orientation: isHorizontal ? ListView.Horizontal : ListView.Vertical
|
||||
spacing: 6
|
||||
anchors.margins: 0
|
||||
}
|
||||
PropertyChanges {
|
||||
target: listViewBase
|
||||
width: listView.width
|
||||
height: listView.height
|
||||
alpha: 0
|
||||
}
|
||||
}
|
||||
]
|
||||
property int count: currentWinIdList.length
|
||||
onCountChanged: {
|
||||
baseMouseArea.determineListViewSize()
|
||||
}
|
||||
sourceComponent: baseMouseArea.isList ? listMode : thumbnailMode
|
||||
}
|
||||
|
||||
model: thumbnailModel
|
||||
delegate: MouseArea {
|
||||
id: itemMouseArea
|
||||
Component {
|
||||
id: thumbnailMode
|
||||
Item {
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
hoverEnabled: true
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
property alias itemRegion: blurRegion
|
||||
property var viewRepeater: repeater
|
||||
|
||||
RectRegion {
|
||||
id: blurRegion
|
||||
x: itemMouseArea.x
|
||||
y: itemMouseArea.y
|
||||
width: itemMouseArea.width
|
||||
height: itemMouseArea.height
|
||||
radius: thumbnailLoader.item.radius
|
||||
Column {
|
||||
id: columnLayout
|
||||
spacing: 6
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: activeTimer
|
||||
property var activeWinIds: []
|
||||
onTriggered: {
|
||||
UkuiTaskManager.TaskManager.activateWindowView(activeTimer.activeWinIds)
|
||||
}
|
||||
Row {
|
||||
id: rowLayout
|
||||
spacing: 6
|
||||
}
|
||||
|
||||
function activateWindowView() {
|
||||
var winIds = [model.winId];
|
||||
if (baseMouseArea.menuVisible || containsMouse) {
|
||||
activeTimer.interval = 500;
|
||||
activeTimer.activeWinIds = winIds;
|
||||
activeTimer.start();
|
||||
} else {
|
||||
activeTimer.stop();
|
||||
UkuiTaskManager.TaskManager.activateWindowView("");
|
||||
}
|
||||
}
|
||||
|
||||
onContainsMouseChanged: activateWindowView()
|
||||
|
||||
onClicked: {
|
||||
if (mouse.button === Qt.RightButton) {
|
||||
var actions = UkuiTaskManager.TaskManager.windowActions(model.winId);
|
||||
baseMouseArea.menuVisible = taskManager.viewModel.openMenu(true, actions, listView);
|
||||
} else {
|
||||
UkuiTaskManager.TaskManager.activateWindow(model.winId);
|
||||
}
|
||||
}
|
||||
Loader {
|
||||
id: thumbnailLoader
|
||||
WindowThumbnailMprisModel {
|
||||
id: mprisModel
|
||||
winID: model.winId
|
||||
}
|
||||
property string modelData: model.winId
|
||||
property var title: windowTitles ? windowTitles[model.winId] : ""
|
||||
property var icon: windowIcons ? windowIcons[model.winId] : ""
|
||||
property var windowThumbnailMprisModel: mprisModel
|
||||
property bool mouseAreaContainsMouse: itemMouseArea.containsMouse
|
||||
property bool mouseAreaContainsPress: itemMouseArea.containsPress
|
||||
property bool isListViewHorizontal: isHorizontal
|
||||
|
||||
// mprisModel.count > 0为mpris音视频预览图
|
||||
sourceComponent: (mprisModel.count > 0) ? mprisPlayerComponent : thumbnailComponent
|
||||
Repeater {
|
||||
id: repeater
|
||||
parent: isHorizontal ? rowLayout : columnLayout
|
||||
model: thumbnailModel
|
||||
delegate: thumbnailDelegate
|
||||
}
|
||||
}
|
||||
}
|
||||
ScrollBar {
|
||||
id: scrollBarControl
|
||||
height: parent.height
|
||||
width: (size < 1 && size > 0) ? 16 : 0
|
||||
padding: 5
|
||||
anchors.left: listView.right
|
||||
anchors.top: parent.top
|
||||
visible: listView.state === "list"
|
||||
contentItem: StyleBackground {
|
||||
radius: width / 2
|
||||
useStyleTransparency: false
|
||||
paletteRole: Platform.Theme.Text
|
||||
alpha: 0.3
|
||||
|
||||
Component {
|
||||
id: listMode
|
||||
Row {
|
||||
padding: 4
|
||||
spacing: 0
|
||||
|
||||
ListView {
|
||||
width: 220
|
||||
height: 360
|
||||
interactive: true
|
||||
spacing: 0
|
||||
orientation: ListView.Vertical
|
||||
ScrollBar.vertical: scrollBarControl
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
model: thumbnailModel
|
||||
delegate: thumbnailDelegate
|
||||
}
|
||||
ScrollBar {
|
||||
id: scrollBarControl
|
||||
height: 360
|
||||
width: (size < 1 && size > 0) ? 12 : 0
|
||||
padding: 4
|
||||
contentItem: StyleBackground {
|
||||
radius: width / 2
|
||||
useStyleTransparency: false
|
||||
paletteRole: Platform.Theme.Text
|
||||
alpha: 0.3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: thumbnailDelegate
|
||||
MouseArea {
|
||||
id: itemMouseArea
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
hoverEnabled: true
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
property alias itemRegion: blurRegion
|
||||
|
||||
RectRegion {
|
||||
id: blurRegion
|
||||
x: itemMouseArea.x
|
||||
y: itemMouseArea.y
|
||||
width: itemMouseArea.width
|
||||
height: itemMouseArea.height
|
||||
radius: thumbnailLoader.item.radius
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: activeTimer
|
||||
property var activeWinIds: []
|
||||
onTriggered: {
|
||||
UkuiTaskManager.TaskManager.activateWindowView(activeTimer.activeWinIds)
|
||||
}
|
||||
}
|
||||
|
||||
function activateWindowView() {
|
||||
var winIds = [model.winId];
|
||||
if (baseMouseArea.menuVisible || containsMouse) {
|
||||
activeTimer.interval = 500;
|
||||
activeTimer.activeWinIds = winIds;
|
||||
activeTimer.start();
|
||||
} else {
|
||||
activeTimer.stop();
|
||||
UkuiTaskManager.TaskManager.activateWindowView("");
|
||||
}
|
||||
}
|
||||
|
||||
onContainsMouseChanged: activateWindowView()
|
||||
|
||||
onClicked: {
|
||||
if (mouse.button === Qt.RightButton) {
|
||||
var actions = UkuiTaskManager.TaskManager.windowActions(model.winId);
|
||||
baseMouseArea.menuVisible = taskManager.viewModel.openMenu(true, actions, viewLoader);
|
||||
} else {
|
||||
UkuiTaskManager.TaskManager.activateWindow(model.winId);
|
||||
}
|
||||
}
|
||||
Loader {
|
||||
id: thumbnailLoader
|
||||
WindowThumbnailMprisModel {
|
||||
id: mprisModel
|
||||
winID: model.winId
|
||||
}
|
||||
property string modelData: model.winId
|
||||
property var title: windowTitles ? windowTitles[model.winId] : ""
|
||||
property var icon: windowIcons ? windowIcons[model.winId] : ""
|
||||
property var windowThumbnailMprisModel: mprisModel
|
||||
property bool mouseAreaContainsMouse: itemMouseArea.containsMouse
|
||||
property bool mouseAreaContainsPress: itemMouseArea.containsPress
|
||||
property bool isListViewHorizontal: isHorizontal
|
||||
|
||||
// mprisModel.count > 0为mpris音视频预览图
|
||||
sourceComponent: (mprisModel.count > 0) ? mprisPlayerComponent : thumbnailComponent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -283,8 +287,8 @@ MouseArea {
|
|||
Component {
|
||||
id: thumbnailComponent
|
||||
ThumbnailContainer {
|
||||
width: listView.isList ? 220 : (isListViewHorizontal ? contentWidth : listView.preChildrenSize)
|
||||
height: listView.isList ? 36 : (isListViewHorizontal ? listView.preChildrenSize : contentHeight)
|
||||
width: baseMouseArea.isList ? 220 : (isListViewHorizontal ? contentWidth : viewLoader.preChildrenSize)
|
||||
height: baseMouseArea.isList ? 36 : (isListViewHorizontal ? viewLoader.preChildrenSize : contentHeight)
|
||||
|
||||
property int maximumHeight: 312
|
||||
property int minimumHeight: 120
|
||||
|
@ -293,7 +297,7 @@ MouseArea {
|
|||
property real contentHeight: childrenRect.height
|
||||
property real contentWidth: childrenRect.width
|
||||
|
||||
isList: listView.isList
|
||||
isList: baseMouseArea.isList
|
||||
spacing: layoutSpacing
|
||||
containerIcon: icon
|
||||
containerTitle: title === undefined ? "" : title
|
||||
|
|
|
@ -71,7 +71,7 @@ public:
|
|||
void loadSettings();
|
||||
void save() const;
|
||||
void loadWindows();
|
||||
void newItem(const QString &wid);
|
||||
void newItem(const QString &wid, const QString &desktopFile);
|
||||
void onNotificationServiceChanged(const QString &service, const QString &oldOwner, const QString &newOwner);
|
||||
void connectToNotificationServer();
|
||||
QModelIndex indexOf(const QString &desktopFile);
|
||||
|
@ -155,18 +155,19 @@ void UkuiTaskManager::Private::windowAdded(const QString &windowId)
|
|||
if (windowGroup.isEmpty()) {
|
||||
windowGroup = QString::number(++m_groupID);
|
||||
}
|
||||
QString desktopFile = Utils::desktopFileFromWid(windowId);
|
||||
for (auto item : m_items) {
|
||||
//避免重复添加
|
||||
if(item->winIDs().contains(windowId)) {
|
||||
return;
|
||||
}
|
||||
//组已经存在,增加一个窗口
|
||||
if (item->group() == windowGroup) {
|
||||
if (item->group() == windowGroup || item->ID() == desktopFile) {
|
||||
item->addWinID(windowId);
|
||||
return;
|
||||
}
|
||||
}
|
||||
newItem(windowId);
|
||||
newItem(windowId, desktopFile);
|
||||
}
|
||||
|
||||
void UkuiTaskManager::Private::windowRemoved(const QString &windowId)
|
||||
|
@ -211,7 +212,7 @@ void UkuiTaskManager::Private::skipTaskbarChanged(const QString &windowId)
|
|||
}
|
||||
if(!handled) {
|
||||
if(!skipTaskBar) {
|
||||
newItem(windowId);
|
||||
newItem(windowId, Utils::desktopFileFromWid(windowId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -239,10 +240,8 @@ void UkuiTaskManager::Private::loadWindows()
|
|||
}
|
||||
}
|
||||
|
||||
void UkuiTaskManager::Private::newItem(const QString &wid)
|
||||
void UkuiTaskManager::Private::newItem(const QString &wid, const QString &desktopFile)
|
||||
{
|
||||
//获取desktop文件全路径
|
||||
QString desktopFile = Utils::desktopFileFromWid(wid);
|
||||
//查看是否存在快速启动按钮
|
||||
if (m_quickLaunchersOrder.contains(desktopFile)) {
|
||||
m_items.at(indexOf(desktopFile).row())->addWinID(wid);
|
||||
|
@ -546,9 +545,22 @@ void UkuiTaskManager::setOrder(const QModelIndex &index, int order)
|
|||
--launcherOrder;
|
||||
}
|
||||
}
|
||||
|
||||
if (launcherOrder < 0) {
|
||||
launcherOrder = 0;
|
||||
}
|
||||
}
|
||||
addQuickLauncher(item->ID(), launcherOrder);
|
||||
}
|
||||
|
||||
if (oldOrder < order) {
|
||||
beginMoveRows(index.parent(), oldOrder, oldOrder, index.parent(), order + 1);
|
||||
} else {
|
||||
beginMoveRows(index.parent(), oldOrder, oldOrder, index.parent(), order);
|
||||
}
|
||||
|
||||
d->m_items.insert(order, d->m_items.takeAt(oldOrder));
|
||||
endMoveRows();
|
||||
}
|
||||
|
||||
void UkuiTaskManager::activateWindowView(const QStringList &winIds)
|
||||
|
|
|
@ -190,3 +190,10 @@ void WindowManager::unsetMinimizedGeometry(const QString &wid, QQuickItem *item)
|
|||
{
|
||||
WindowManagerPrivate::interface()->unsetMinimizedGeometry(wid, item);
|
||||
}
|
||||
|
||||
void WindowManager::setMinimizedGeometry(const QStringList &widList, QQuickItem *item)
|
||||
{
|
||||
for (const auto &wid : widList) {
|
||||
WindowManagerPrivate::interface()->setMinimizedGeometry(wid, item);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@ public:
|
|||
Q_INVOKABLE static QRect geometry(const QString& wid);
|
||||
Q_INVOKABLE void setStartupGeometry(const QString& wid, QQuickItem *item);
|
||||
Q_INVOKABLE void setMinimizedGeometry(const QString& wid, QQuickItem *item);
|
||||
Q_INVOKABLE void setMinimizedGeometry(const QStringList& winds, QQuickItem *item);
|
||||
Q_INVOKABLE void unsetMinimizedGeometry(const QString& wid, QQuickItem *item);
|
||||
|
||||
Q_SIGNALS:
|
||||
|
|
Loading…
Reference in New Issue