diff --git a/containment/package/contents/ui/abilities/Metrics.qml b/containment/package/contents/ui/abilities/Metrics.qml index 4a475272..4e2b0b0c 100644 --- a/containment/package/contents/ui/abilities/Metrics.qml +++ b/containment/package/contents/ui/abilities/Metrics.qml @@ -1,63 +1,61 @@ /* * Copyright 2020 Michail Vourlakos * * 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 . */ import QtQuick 2.7 import org.kde.plasma.plasmoid 2.0 import org.kde.latte.abilities.containers 0.1 as ContainerAbility ContainerAbility.Metrics { id: mets property Item animations: null property Item autosize: null //! Signals signal iconSizeAnimationEnded(); //! Public Properties - iconSize: autosizeEnabled && autosize.iconSize > 0 ? - Math.min(autosize.iconSize, maxIconSize) : - maxIconSize + iconSize: autosizeEnabled && autosize.iconSize > 0 ? Math.min(autosize.iconSize, maxIconSize) : maxIconSize maxIconSize: proportionIconSize!==-1 ? proportionIconSize : plasmoid.configuration.iconSize //! Private Properties readonly property int proportionIconSize: { //icon size based on screen height if ((plasmoid.configuration.proportionIconSize===-1) || !latteView) return -1; return Math.max(16,Math.round(latteView.screenGeometry.height * plasmoid.configuration.proportionIconSize/100/8)*8); } readonly property bool autosizeEnabled: autosize !== undefined && autosize.isActive //! Behaviors Behavior on iconSize { enabled: !(root.editMode && root.behaveAsPlasmaPanel) NumberAnimation { duration: 0.8 * animations.duration.proposed onRunningChanged: { if (!running) { mets.iconSizeAnimationEnded(); } } } } } diff --git a/declarativeimports/abilities/applets/Metrics.qml b/declarativeimports/abilities/applets/Metrics.qml index dcc85b75..24b2af6a 100644 --- a/declarativeimports/abilities/applets/Metrics.qml +++ b/declarativeimports/abilities/applets/Metrics.qml @@ -1,37 +1,42 @@ /* * Copyright 2020 Michail Vourlakos * * 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 . */ import QtQuick 2.0 import org.kde.latte.abilities.definitions 0.1 as AbilityDefinition AbilityDefinition.Metrics { id: apis property Item bridge: null Item { id: refs readonly property Item metrics: bridge ? bridge.metrics : local } iconSize: refs.metrics.iconSize maxIconSize: refs.metrics.maxIconSize + margin: refs.metrics.margin + padding: refs.metrics.padding + fraction: refs.metrics.fraction + totals: refs.metrics.totals + readonly property AbilityDefinition.Metrics local: AbilityDefinition.Metrics {} } diff --git a/declarativeimports/abilities/containers/Metrics.qml b/declarativeimports/abilities/containers/Metrics.qml index 0c1ce070..cd0ed4cc 100644 --- a/declarativeimports/abilities/containers/Metrics.qml +++ b/declarativeimports/abilities/containers/Metrics.qml @@ -1,31 +1,36 @@ /* * Copyright 2020 Michail Vourlakos * * 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 . */ import QtQuick 2.0 import org.kde.latte.abilities.definitions 0.1 as AbilityDefinition AbilityDefinition.Metrics { id: apis readonly property Item publicApi: Item { readonly property alias iconSize: apis.iconSize readonly property alias maxIconSize: apis.maxIconSize + + readonly property alias margin: apis.margin + readonly property alias padding: apis.padding + readonly property alias fraction: apis.fraction + readonly property alias totals: apis.totals } } diff --git a/declarativeimports/abilities/definitions/Metrics.qml b/declarativeimports/abilities/definitions/Metrics.qml index 73375c29..708bccd7 100644 --- a/declarativeimports/abilities/definitions/Metrics.qml +++ b/declarativeimports/abilities/definitions/Metrics.qml @@ -1,25 +1,32 @@ /* * Copyright 2020 Michail Vourlakos * * 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 . */ import QtQuick 2.0 +import "./metrics" as MetricsTypes + Item { property int iconSize: 48 property int maxIconSize: 48 + + property MetricsTypes.Margin margin: MetricsTypes.Margin{} + property MetricsTypes.Padding padding: MetricsTypes.Padding{} + property MetricsTypes.Fraction fraction: MetricsTypes.Fraction{} + property MetricsTypes.Totals totals: MetricsTypes.Totals{} } diff --git a/declarativeimports/abilities/definitions/Metrics.qml b/declarativeimports/abilities/definitions/metrics/Fraction.qml similarity index 80% copy from declarativeimports/abilities/definitions/Metrics.qml copy to declarativeimports/abilities/definitions/metrics/Fraction.qml index 73375c29..bd2261ea 100644 --- a/declarativeimports/abilities/definitions/Metrics.qml +++ b/declarativeimports/abilities/definitions/metrics/Fraction.qml @@ -1,25 +1,26 @@ /* -* Copyright 2020 Michail Vourlakos +* Copyright 2020 Michail Vourlakos * * 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 . */ import QtQuick 2.0 Item { - property int iconSize: 48 - property int maxIconSize: 48 + property real thicknessMargin: 0.06 + property real lengthMargin: 0.06 + property real lengthPadding: 8 } diff --git a/declarativeimports/abilities/definitions/Metrics.qml b/declarativeimports/abilities/definitions/metrics/Margin.qml similarity index 79% copy from declarativeimports/abilities/definitions/Metrics.qml copy to declarativeimports/abilities/definitions/metrics/Margin.qml index 73375c29..f81fe4f8 100644 --- a/declarativeimports/abilities/definitions/Metrics.qml +++ b/declarativeimports/abilities/definitions/metrics/Margin.qml @@ -1,25 +1,27 @@ /* -* Copyright 2020 Michail Vourlakos +* Copyright 2020 Michail Vourlakos * * 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 . */ import QtQuick 2.0 Item { - property int iconSize: 48 - property int maxIconSize: 48 + property int thickness: 4 + property int maxThickness: 4 + property int length: 4 + property int screenEdge: 0 } diff --git a/declarativeimports/abilities/definitions/Metrics.qml b/declarativeimports/abilities/definitions/metrics/Padding.qml similarity index 85% copy from declarativeimports/abilities/definitions/Metrics.qml copy to declarativeimports/abilities/definitions/metrics/Padding.qml index 73375c29..114edf32 100644 --- a/declarativeimports/abilities/definitions/Metrics.qml +++ b/declarativeimports/abilities/definitions/metrics/Padding.qml @@ -1,25 +1,24 @@ /* -* Copyright 2020 Michail Vourlakos +* Copyright 2020 Michail Vourlakos * * 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 . */ import QtQuick 2.0 Item { - property int iconSize: 48 - property int maxIconSize: 48 + property int length: 4 } diff --git a/declarativeimports/abilities/definitions/Metrics.qml b/declarativeimports/abilities/definitions/metrics/Totals.qml similarity index 73% copy from declarativeimports/abilities/definitions/Metrics.qml copy to declarativeimports/abilities/definitions/metrics/Totals.qml index 73375c29..34b0a6d5 100644 --- a/declarativeimports/abilities/definitions/Metrics.qml +++ b/declarativeimports/abilities/definitions/metrics/Totals.qml @@ -1,25 +1,26 @@ /* -* Copyright 2020 Michail Vourlakos +* Copyright 2020 Michail Vourlakos * * 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 . */ import QtQuick 2.0 Item { - property int iconSize: 48 - property int maxIconSize: 48 + property int lengthSingleMargin: margin.length + padding.length + property int lengthBilateralMargins: 2 * lengthSingleMargin + property int thicknessBilateralMargins: 2 * margin.thickness }