indicators can now offset a bit icons

--through level.requested options each indicator
instance can request specific repositioning for
each icon. Very good example for this is the
Win7 style indicator
pull/8/head
Michail Vourlakos 6 years ago
parent a885eaa163
commit 768a6b4b2a

@ -134,6 +134,10 @@ Item {
property int spacersMaxSize: Math.max(0,Math.ceil(0.55 * root.iconSize) - root.lengthMargins) property int spacersMaxSize: Math.max(0,Math.ceil(0.55 * root.iconSize) - root.lengthMargins)
property int status: applet ? applet.status : -1 property int status: applet ? applet.status : -1
//! are set by the indicator
property int iconOffsetX: 0
property int iconOffsetY: 0
property real computeWidth: root.isVertical ? wrapper.width : property real computeWidth: root.isVertical ? wrapper.width :
hiddenSpacerLeft.width+wrapper.width+hiddenSpacerRight.width hiddenSpacerLeft.width+wrapper.width+hiddenSpacerRight.width
@ -660,8 +664,21 @@ Item {
Indicator.Loader{ Indicator.Loader{
id: indicatorBackLayer id: indicatorBackLayer
level: Indicator.LevelOptions { level: Indicator.LevelOptions {
id: backLevelOptions
isBackground: true isBackground: true
bridge: indicatorBridge bridge: indicatorBridge
Binding {
target: appletItem
property: "iconOffsetX"
value: backLevelOptions.requested.iconOffsetX
}
Binding {
target: appletItem
property: "iconOffsetY"
value: backLevelOptions.requested.iconOffsetY
}
} }
} }

@ -30,6 +30,11 @@ Item {
property bool isBackground: true property bool isBackground: true
property bool isForeground: false property bool isForeground: false
readonly property Item requested: Item{
property int iconOffsetX: 0
property int iconOffsetY: 0
}
property Item bridge property Item bridge
onIsBackgroundChanged: { onIsBackgroundChanged: {

@ -49,7 +49,6 @@ Item {
//! e.g 0.06 -> 6% //! e.g 0.06 -> 6%
property real minLengthPadding: 0 property real minLengthPadding: 0
//! svg image paths either from plasma theme or local files relevant to indicator "ui" directory //! svg image paths either from plasma theme or local files relevant to indicator "ui" directory
//! in order to reduce resources usage //! in order to reduce resources usage
property var svgImagePaths: [] property var svgImagePaths: []

@ -138,6 +138,10 @@ MouseArea{
property int windowsCount: subWindows.windowsCount property int windowsCount: subWindows.windowsCount
property int windowsMinimizedCount: subWindows.windowsMinimized property int windowsMinimizedCount: subWindows.windowsMinimized
//! are set by the indicator
property int iconOffsetX: 0
property int iconOffsetY: 0
property string activity: tasksModel.activity property string activity: tasksModel.activity
readonly property var m: model readonly property var m: model
@ -441,8 +445,21 @@ MouseArea{
Indicator.Loader{ Indicator.Loader{
id: indicatorBackLayer id: indicatorBackLayer
level: Indicator.LevelOptions { level: Indicator.LevelOptions {
id: backLevelOptions
isBackground: true isBackground: true
bridge: indicatorBridge bridge: indicatorBridge
Binding {
target: taskItem
property: "iconOffsetX"
value: backLevelOptions.requested.iconOffsetX
}
Binding {
target: taskItem
property: "iconOffsetY"
value: backLevelOptions.requested.iconOffsetY
}
} }
} }

@ -143,6 +143,9 @@ Item{
anchors.horizontalCenter: !root.vertical ? parent.horizontalCenter : undefined anchors.horizontalCenter: !root.vertical ? parent.horizontalCenter : undefined
anchors.verticalCenter: root.vertical ? parent.verticalCenter : undefined anchors.verticalCenter: root.vertical ? parent.verticalCenter : undefined
anchors.horizontalCenterOffset: taskItem.iconOffsetX
anchors.verticalCenterOffset: taskItem.iconOffsetY
width: wrapper.width width: wrapper.width
height:wrapper.height height:wrapper.height
} }

@ -30,6 +30,11 @@ Item {
property bool isBackground: true property bool isBackground: true
property bool isForeground: false property bool isForeground: false
readonly property Item requested: Item{
property int iconOffsetX: 0
property int iconOffsetY: 0
}
property Item bridge property Item bridge
onIsBackgroundChanged: { onIsBackgroundChanged: {

Loading…
Cancel
Save