1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-10 21:18:19 +03:00

move Unity indicator out of codepage

This commit is contained in:
Michail Vourlakos 2019-03-28 17:56:53 +02:00
parent c65b520c1e
commit fbce535e85
5 changed files with 0 additions and 467 deletions

View File

@ -1,3 +1,2 @@
install(DIRECTORY default DESTINATION ${CMAKE_INSTALL_PREFIX}/share/latte/indicators)
install(DIRECTORY org.kde.latte.plasma DESTINATION ${CMAKE_INSTALL_PREFIX}/share/latte/indicators)
install(DIRECTORY org.kde.latte.unity DESTINATION ${CMAKE_INSTALL_PREFIX}/share/latte/indicators)

View File

@ -1,29 +0,0 @@
[Desktop Entry]
Name=Unity
Name[ca]=Unity
Name[ca@valencia]=Unity
Name[gl]=Unity
Name[nl]=Unity
Name[uk]=Unity
Name[x-test]=xxUnityxx
Comment=Latte Unity style indicator
Comment[ca]=Indicador a l'estil Unity del Latte
Comment[ca@valencia]=Indicador a l'estil Unity del Latte
Comment[gl]=Indicador de estilo Unity de Latte
Comment[nl]=Unity stijlindicator van Latte
Comment[uk]=Індикатор стилю Unity Латте
Comment[x-test]=xxLatte Unity style indicatorxx
Type=Service
Icon=latte-dock
X-Plasma-API=declarativeappletscript
X-Latte-MainScript=ui/main.qml
X-KDE-PluginInfo-Author=Michail Vourlakos
X-KDE-PluginInfo-Email=mvourlakos@gmail.com
X-KDE-PluginInfo-Name=org.kde.latte.unity
X-KDE-PluginInfo-Version=0.1
X-KDE-PluginInfo-Category=Latte Indicator
X-KDE-PluginInfo-License=GPL v2+
X-KDE-PluginInfo-EnabledByDefault=true

View File

@ -1,160 +0,0 @@
/*
* Copyright 2019 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock 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.
*
* Latte-Dock 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, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0
import QtGraphicalEffects 1.0
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
Item{
Item{
id: rectangleItem
width: indicator.isTask ? Math.min(parent.width, parent.height) : parent.width
height: indicator.isTask ? width : parent.height
anchors.centerIn: parent
property bool isActive: indicator.isActive || (indicator.isWindow && indicator.hasActive)
readonly property int size: Math.min(parent.width, parent.height)
Rectangle {
id: unityRect
anchors.fill: parent
visible: indicator.isActive || (indicator.isWindow && indicator.hasShown)
radius: indicator.currentIconSize / 12
color: indicator.backgroundColor
clip: true
}
RadialGradient{
id: glowGradient
anchors.verticalCenter: parent.top
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - unityRect.anchors.margins * 2 - 1
height: (width * 0.85) - unityRect.anchors.margins * 2 - 1
visible: false
gradient: Gradient {
GradientStop { position: 0.0;
color: {
if (indicator.isMinimized) {
return "#aafcfcfc";
}
return indicator.glowColor;
}
}
GradientStop { position: 0.6; color: "transparent" }
}
//! States
states: [
State {
name: "top"
when: !indicator.shared.reversed
AnchorChanges {
target: glowGradient
anchors{horizontalCenter:parent.horizontalCenter; verticalCenter:parent.top}
}
},
State {
name: "bottom"
when: indicator.shared.reversed
AnchorChanges {
target: glowGradient
anchors{horizontalCenter:parent.horizontalCenter; verticalCenter:parent.bottom}
}
}
]
}
Item {
id: gradientMask
anchors.fill: glowGradient
Rectangle {
id: glowMaskRect
width: glowGradient.width
height: glowGradient.height / 2
radius: unityRect.radius
//! States
states: [
State {
name: "top"
when: !indicator.shared.reversed
AnchorChanges {
target: glowMaskRect
anchors{bottom: undefined; top: parent.verticalCenter;}
}
PropertyChanges{
target: gradientMask
anchors{bottomMargin: undefined; topMargin: unityRect.anchors.margins}
}
},
State {
name: "bottom"
when: indicator.shared.reversed
AnchorChanges {
target: glowMaskRect
anchors{bottom: parent.verticalCenter; top: undefined;}
}
PropertyChanges{
target: gradientMask
anchors{bottomMargin: unityRect.anchors.margins; topMargin: undefined}
}
}
]
}
visible: false
}
OpacityMask {
anchors.fill: glowGradient
source: glowGradient
maskSource: gradientMask
visible: unityRect.visible || borderRectangle.visible
}
Rectangle {
id: borderRectangle
anchors.fill: parent
visible: (indicator.isTask && indicator.isWindow) || (indicator.isApplet && indicator.isActive)
color: "transparent"
border.width: 1
border.color: "#303030"
radius: unityRect.radius
clip: true
Rectangle {
anchors.fill: parent
anchors.margins: parent.border.width
radius: unityRect.radius
color: "transparent"
border.width: 1
border.color: "#25dedede"
}
}
}
}

View File

@ -1,206 +0,0 @@
/*
* Copyright 2019 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock 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.
*
* Latte-Dock 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, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0
import QtGraphicalEffects 1.0
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
Item {
anchors.fill: parent
Row {
id: upperIndicators
spacing: 2
readonly property bool alwaysActive: true
readonly property bool reversed: true
Repeater {
model: indicator.isTask && (indicator.isActive || indicator.hasActive) ? 1 : 0
delegate: triangleComponent
}
}
Grid {
id: lowerIndicators
rows: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? 1 : Math.min(3, indicator.windowsCount)
columns: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? Math.min(3, indicator.windowsCount) : 1
rowSpacing: 2
columnSpacing: 2
readonly property bool alwaysActive: false
readonly property bool reversed: false
Repeater {
model: Math.min(3, indicator.windowsCount)
delegate: triangleComponent
}
}
//! Triangle Indicator Component
Component {
id: triangleComponent
Canvas {
id: canvas
width: indicator.currentIconSize / 6
height: width
rotation: {
if (!parent.reversed) {
if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
return 0;
} else if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
return 90;
} else if (plasmoid.location === PlasmaCore.Types.TopEdge) {
return 180;
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
return 270;
}
} else {
if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
return 180;
} else if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
return 270;
} else if (plasmoid.location === PlasmaCore.Types.TopEdge) {
return 0;
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
return 90;
}
}
return 0;
}
property bool fillTriangle: {
if (!parent.alwaysActive && indicator.windowsMinimizedCount!==0
&& ((index < maxDrawnMinimizedWindows)
|| (indicator.windowsCount === indicator.windowsMinimizedCount))) {
return false;
}
return true;
}
readonly property int lineWidth: 2
onFillTriangleChanged: requestPaint();
Connections {
target: root
onActiveColorChanged: canvas.requestPaint();
onBackgroundColorChanged: canvas.requestPaint();
onOutlineColorChanged: canvas.requestPaint();
}
onPaint: {
var ctx = getContext('2d');
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.strokeStyle = root.outlineColor;
ctx.lineWidth = lineWidth;
ctx.beginPath();
ctx.moveTo(0, canvas.height);
ctx.lineTo(canvas.width/2, 0);
ctx.lineTo(canvas.width, canvas.height);
ctx.lineTo(0, canvas.height);
ctx.closePath();
ctx.stroke();
ctx.strokeStyle = root.activeColor;
ctx.fillStyle = fillTriangle ? root.activeColor : root.backgroundColor;
ctx.beginPath();
ctx.moveTo(lineWidth, canvas.height - lineWidth);
ctx.lineTo(canvas.width/2, lineWidth);
ctx.lineTo(canvas.width - lineWidth, canvas.height - lineWidth);
ctx.lineTo(lineWidth, canvas.height - lineWidth);
ctx.closePath();
ctx.stroke();
ctx.fill();
}
}
}
//! States
states: [
State {
name: "bottom"
when: (plasmoid.location === PlasmaCore.Types.BottomEdge)
AnchorChanges {
target: lowerIndicators
anchors{ top:undefined; bottom:parent.bottom; left:undefined; right:undefined;
horizontalCenter:parent.horizontalCenter; verticalCenter:undefined}
}
AnchorChanges {
target: upperIndicators
anchors{ top:parent.top; bottom:undefined; left:undefined; right:undefined;
horizontalCenter:parent.horizontalCenter; verticalCenter:undefined}
}
},
State {
name: "top"
when: (plasmoid.location === PlasmaCore.Types.TopEdge)
AnchorChanges {
target: lowerIndicators
anchors{ top:parent.top; bottom:undefined; left:undefined; right:undefined;
horizontalCenter:parent.horizontalCenter; verticalCenter:undefined}
}
AnchorChanges {
target: upperIndicators
anchors{ top:undefined; bottom:parent.bottom; left:undefined; right:undefined;
horizontalCenter:parent.horizontalCenter; verticalCenter:undefined}
}
},
State {
name: "left"
when: (plasmoid.location === PlasmaCore.Types.LeftEdge)
AnchorChanges {
target: lowerIndicators
anchors{ top:undefined; bottom:undefined; left:parent.left; right:undefined;
horizontalCenter:undefined; verticalCenter:parent.verticalCenter}
}
AnchorChanges {
target: upperIndicators
anchors{ top:undefined; bottom:undefined; left:undefined; right:parent.right;
horizontalCenter:undefined; verticalCenter:parent.verticalCenter}
}
},
State {
name: "right"
when: (plasmoid.location === PlasmaCore.Types.RightEdge)
AnchorChanges {
target: lowerIndicators
anchors{ top:undefined; bottom:undefined; left:undefined; right:parent.right;
horizontalCenter:undefined; verticalCenter:parent.verticalCenter}
}
AnchorChanges {
target: upperIndicators
anchors{ top:undefined; bottom:undefined; left:parent.left; right:undefined;
horizontalCenter:undefined; verticalCenter:parent.verticalCenter}
}
}
]
}

View File

@ -1,71 +0,0 @@
/*
* Copyright 2019 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock 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.
*
* Latte-Dock 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, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0
import QtGraphicalEffects 1.0
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.latte.components 1.0 as LatteComponents
LatteComponents.IndicatorItem {
id: root
readonly property bool needsIconColors: true
readonly property bool providesFrontLayer: true
readonly property int thickness: plasmoid.formFactor === PlasmaCore.Types.Vertical ? width : height
readonly property int shownWindows: indicator.windowsCount - indicator.windowsMinimizedCount
readonly property int maxDrawnMinimizedWindows: shownWindows > 0 ? Math.min(indicator.windowsMinimizedCount,2) : 3
readonly property real backColorBrightness: colorBrightness(indicator.palette.backgroundColor)
readonly property color activeColor: indicator.palette.buttonFocusColor
readonly property color outlineColor: backColorBrightness < 127 ? indicator.palette.backgroundColor : indicator.palette.textColor
readonly property color backgroundColor: indicator.palette.backgroundColor
function colorBrightness(color) {
return colorBrightnessFromRGB(color.r * 255, color.g * 255, color.b * 255);
}
// formula for brightness according to:
// https://www.w3.org/TR/AERT/#color-contrast
function colorBrightnessFromRGB(r, g, b) {
return (r * 299 + g * 587 + b * 114) / 1000
}
//! Background Layer
Loader{
id: backLayer
anchors.fill: parent
active: level.isBackground
sourceComponent: BackLayer{}
}
//! Foreground Layer to draw Triangles
Loader{
id: frontLayer
anchors.fill: parent
active: level.isForeground
sourceComponent:FrontLayer{}
}
}