mirror of
https://github.com/KDE/latte-dock.git
synced 2025-01-24 18:03:53 +03:00
support new LatteSetings object for Communicator
--in order to improve extenability we pass now a single QtObject for applets to use in order to communicate with Latte
This commit is contained in:
parent
096358f46a
commit
0f1b090e19
@ -43,70 +43,21 @@ Item{
|
||||
// the main element for which you must place the Latte options is the CompactRepresentation.
|
||||
property bool appletContainsIsInLatte: appletRootItem && appletRootItem.hasOwnProperty("isInLatte") ? true : false
|
||||
|
||||
// NAME: latteInEditMode
|
||||
// USAGE: property bool latteInEditMode: false
|
||||
// EXPLANATION: Latte sets it to true when this applet is in a Latte containment and Latte
|
||||
// is also in EditMode, that means when the user is altering applets and Latte dock settings
|
||||
property bool appletContainsLatteInEditMode: appletRootItem && appletRootItem.hasOwnProperty("latteInEditMode") ? true : false
|
||||
|
||||
// NAME: lattePalette
|
||||
// USAGE: property QtObject lattePalette: null
|
||||
// EXPLANATION: Latte updates it to its coloring palette in order for the applet
|
||||
// to take resposibility of its coloring.
|
||||
// NAME: latteSettings
|
||||
// USAGE: property QtObject latteSettings: null
|
||||
// EXPLANATION: The main shared object that Latte is using to communicate with the applet
|
||||
// USE CASE: when Latte is transparent and applets colors need to be adjusted in order
|
||||
// to look consistent with the underlying desktop background
|
||||
property bool appletContainsLattePalette: appletRootItem && appletRootItem.hasOwnProperty("lattePalette") ? true : false
|
||||
|
||||
// NAME: applyLattePalette
|
||||
// USAGE: property bool applyLattePalette: false
|
||||
// EXPLANATION: Latte updates it to TRUE when the applet must use the provided
|
||||
// Latte palette through "lattePalette" and FALSE otherwise
|
||||
// USE CASE: when Latte is transparent and applets colors need to be adjusted in order
|
||||
// to look consistent with the underlying desktop background
|
||||
property bool appletContainsApplyLattePalette: appletRootItem && appletRootItem.hasOwnProperty("applyLattePalette") ? true : false
|
||||
|
||||
// -------------------------------------
|
||||
// OUTGOING FROM APPLET TO LATTE
|
||||
// -------------------------------------
|
||||
|
||||
// NAME: disableLatteParabolicIcon
|
||||
// USE: property bool disableLatteParabolicIcon : false
|
||||
// DEPRECATED FROM: disableLatteIconOverlay
|
||||
// EXPLANATION: when is TRUE, Latte is not overlaying any icons above
|
||||
// the applet or alters the applet visual in any sense.
|
||||
// That means that the applet is responsible to provide a conherent
|
||||
// parabolic effect experience.
|
||||
property bool disableLatteParabolicIconHeuristics: appletRootItem && appletRootItem.disableLatteParabolicIcon !== undefined ?
|
||||
appletRootItem.disableLatteParabolicIcon : false
|
||||
|
||||
// NAME: disableLatteSideColoring
|
||||
// USE: property bool disableLatteSideColoring : false
|
||||
// EXPLANATION: when is TRUE, Latte is not painting/colorizing this applet
|
||||
// in any case. In such case the applet can use lattePalette property
|
||||
// in order to access to color palette used at all cases from Latte
|
||||
// USE CASE: when Latte is transparent and applets colors need to be adjusted in order
|
||||
// to look consistent with the underlying desktop background OR the applet
|
||||
// is not using monochromatic icons but rather colorful ones.
|
||||
property bool disableLatteSideColoring: appletRootItem && appletRootItem.disableLatteSideColoring !== undefined ?
|
||||
appletRootItem.disableLatteSideColoring : false
|
||||
|
||||
// NAME: disableLatteIconOverlay
|
||||
// USE: property bool disableLatteIconOverlay : false
|
||||
// EXPLANATION: when is TRUE, Latte is not overlaying any icons above
|
||||
// the applet or alters the applet visual in any sense.
|
||||
// That means that the applet is responsible to provide a conherent
|
||||
// parabolic effect experience.
|
||||
property bool disableLatteIconOverlay: appletRootItem && appletRootItem.disableLatteIconOverlay !== undefined ?
|
||||
appletRootItem.disableLatteIconOverlay : false
|
||||
property bool appletContainsLatteSettings: appletRootItem && appletRootItem.hasOwnProperty("latteSettings") ? true : false
|
||||
//! END OF INTERNAL APPLET PROPERTIES
|
||||
|
||||
// -------------------------------------
|
||||
|
||||
//! BEGIN OF PROPERTIES
|
||||
//this is used for folderView and icon widgets to fake their visual icons
|
||||
readonly property bool appletCanUseLattePalette: appletContainsApplyLattePalette && appletContainsLattePalette
|
||||
readonly property bool canShowOverlaiedLatteIcon: appletRootItem && communicator.appletIconItem //(applet.pluginName === "org.kde.plasma.folder" || applet.pluginName === "org.kde.plasma.icon")
|
||||
readonly property bool canShowOverlaiedLatteIcon: appletRootItem && communicator.appletIconItem
|
||||
readonly property bool overlayLatteIconIsActive: canShowOverlaiedLatteIcon
|
||||
&& !(disableLatteParabolicIconHeuristics || disableLatteIconOverlay)
|
||||
&& settingsLoader.active
|
||||
&& !settingsLoader.item.disableLatteIconOverlay
|
||||
|
||||
property Item appletRootItem: appletDiscoveredRootItem ? appletDiscoveredRootItem : appletDefaultRootItem
|
||||
property Item appletDiscoveredRootItem: null
|
||||
@ -161,27 +112,18 @@ Item{
|
||||
//! BEGIN OF BINDINGS
|
||||
Binding{
|
||||
target: appletRootItem
|
||||
property: "applyLattePalette"
|
||||
when: disableLatteSideColoring && appletCanUseLattePalette
|
||||
value: colorizerManager.mustBeShown
|
||||
}
|
||||
|
||||
Binding{
|
||||
target: appletRootItem
|
||||
property: "latteInEditMode"
|
||||
when: appletContainsLatteInEditMode
|
||||
value: root.editMode
|
||||
}
|
||||
|
||||
Binding{
|
||||
target: appletRootItem
|
||||
property: "lattePalette"
|
||||
when: disableLatteSideColoring && appletCanUseLattePalette
|
||||
value: colorizerManager
|
||||
//value: dock && dock.visibility ? dock.visibility.touchingWindowScheme : null
|
||||
property: "latteSettings"
|
||||
when: settingsLoader.active
|
||||
value: settingsLoader.item
|
||||
}
|
||||
//! END OF BINDINGS
|
||||
|
||||
Loader{
|
||||
id:settingsLoader
|
||||
active: appletContainsIsInLatte && appletContainsLatteSettings
|
||||
sourceComponent: LatteSettings{}
|
||||
}
|
||||
|
||||
//! BEGIN OF TIMERS
|
||||
//a timer that is used in order to init some Communicator values
|
||||
Timer {
|
||||
|
74
containment/package/contents/ui/applet/LatteSettings.qml
Normal file
74
containment/package/contents/ui/applet/LatteSettings.qml
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright 2018 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.7
|
||||
|
||||
Item{
|
||||
id: settings
|
||||
|
||||
// NAME: version
|
||||
// USAGE: read-only
|
||||
// EXPLANATION: Latte communication version in order for the applet to use only properties
|
||||
// and parameters that are valid
|
||||
// @since: 0.9
|
||||
readonly property int version: 9
|
||||
|
||||
// NAME: inEditMode
|
||||
// USAGE: read-only
|
||||
// EXPLANATION: Latte sets it to true when this applet is in a Latte containment and Latte
|
||||
// is also in EditMode, that means when the user is altering applets and Latte dock settings
|
||||
// @since: 0.9
|
||||
readonly property bool inEditMode: root.editMode
|
||||
|
||||
// NAME: palette
|
||||
// USAGE: read-only
|
||||
// EXPLANATION: Latte updates it to its coloring palette in order for the applet
|
||||
// to take resposibility of its coloring.
|
||||
// USE CASE: when Latte is transparent and applets colors need to be adjusted in order
|
||||
// to look consistent with the underlying desktop background
|
||||
// @since: 0.9
|
||||
readonly property QtObject palette: disableLatteSideColoring ? colorizerManager : null
|
||||
|
||||
// NAME: applyPalette
|
||||
// USAGE: read-only
|
||||
// EXPLANATION: Latte updates it to TRUE when the applet must use the provided
|
||||
// Latte "palette" and FALSE otherwise
|
||||
// USE CASE: when Latte is transparent and applets colors need to be adjusted in order
|
||||
// to look consistent with the underlying desktop background
|
||||
readonly property bool applyPalette: disableLatteSideColoring ? colorizerManager.mustBeShown : false
|
||||
|
||||
|
||||
// NAME: disableLatteSideColoring
|
||||
// USAGE: writable
|
||||
// EXPLANATION: when is TRUE, Latte is not painting/colorizing this applet
|
||||
// in any case. In such case the applet can use 'palette'
|
||||
// in order to access the color palette used at all cases from Latte
|
||||
// USE CASE: when Latte is transparent and applets colors need to be adjusted in order
|
||||
// to look consistent with the underlying desktop background OR the applet
|
||||
// is not using monochromatic icons but rather colorful ones.
|
||||
property bool disableLatteSideColoring: false
|
||||
|
||||
// NAME: disableLatteIconOverlay
|
||||
// USAGE: writable
|
||||
// EXPLANATION: when is TRUE, Latte is not overlaying any icons above
|
||||
// the applet or alters the applet visual in any sense.
|
||||
// That means that the applet is responsible to provide a conherent
|
||||
// parabolic effect experience.
|
||||
property bool disableLatteIconOverlay: false
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user