/** Copyright 2013 by Sebastian KΓΌgler <sebas@kde.org>* Copyright 2014 by Martin GrΓ€Γlin <mgraesslin@kde.org>** 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 2.010-1301, USA.*/import QtQuick 2.0import QtQuick.Layouts 1.1import org.kde.plasma.core 2.0 as PlasmaCoreimport org.kde.plasma.components 2.0 as PlasmaComponentsimport org.kde.plasma.extras 2.0 as PlasmaExtrasimport org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddonsColumn {id: tooltipContentItemproperty Item toolTipproperty variant windowsproperty string mainTextproperty string subTextproperty variant iconproperty int preferredTextWidth: theme.mSize(theme.defaultFont).width * 30property int _s: units.largeSpacing / 2Layout.minimumWidth: widthLayout.minimumHeight: heightLayout.maximumWidth: widthLayout.maximumHeight: heightwidth: Math.max(windowRow.width, appLabelRow.width) + _sheight: childrenRect.heightspacing: _sRow {id: windowRowanchors.horizontalCenter: parent.horizontalCenterwidth: childrenRect.widthheight: childrenRect.heightspacing: units.largeSpacingRepeater {model: windowsPlasmaCore.WindowThumbnail {y: _swidth: units.gridUnit * 15height: units.gridUnit * 10winId: modelDataMouseArea {anchors.fill: parentacceptedButtons: Qt.LeftButtonhoverEnabled: trueonClicked: {tasks.activateWindow(modelData);toolTip.hideToolTip();}onContainsMouseChanged: {tasks.windowHovered(modelData, containsMouse);}Rectangle {id: closeButtonBackgroundanchors {top: parent.topright: parent.righttopMargin: units.smallSpacingrightMargin: units.smallSpacing}width: units.iconSizes.smallMediumheight: widthopacity: parent.containsMouse ? 0.4 : 0Behavior on opacity {NumberAnimation { duration: units.shortDuration * 2; }}color: theme.backgroundColorradius: units.smallSpacing}PlasmaComponents.ToolButton {id: closeButtonanchors {horizontalCenter: closeButtonBackground.horizontalCenterverticalCenter: closeButtonBackground.verticalCenter}opacity: parent.containsMouse ? 1.0 : 0Behavior on opacity {NumberAnimation { duration: units.shortDuration * 2; }}width: units.iconSizes.smallMediumheight: widthiconSource: "window-close"onClicked: {tasks.closeByWinId(modelData);toolTip.hideToolTip();}}}}}}Row {id: appLabelRowwidth: childrenRect.width + _sheight: childrenRect.height + units.largeSpacingspacing: units.largeSpacingItem {id: imageContainerwidth: tooltipIcon.widthheight: tooltipIcon.heighty: _sPlasmaCore.IconItem {id: tooltipIconx: _swidth: units.iconSizes.desktopheight: widthsource: icon}}Column {id: mainColumny: _s//This instance is purely for metricsPlasmaExtras.Heading {id: tooltipMaintextPlaceholdervisible: falselevel: 3text: mainTexttextFormat: Text.PlainText}PlasmaExtras.Heading {id: tooltipMaintextlevel: 3width: Math.min(tooltipMaintextPlaceholder.width, preferredTextWidth)//width: 400elide: Text.ElideRighttext: mainTexttextFormat: Text.PlainText}PlasmaComponents.Label {id: tooltipSubtextwidth: tooltipContentItem.preferredTextWidthwrapMode: Text.WordWraptext: subTexttextFormat: Text.PlainTextopacity: 0.5}}}}