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

introduce new PlasmaTabStyle indicator

--this indicator is used only internally from Latte
in order to draw default plasma applets tab style
indicators when the user has chosen to not draw
latte specific indicators. A good example of its
usage is when the plasma theme contains tabbar
indicator which is used in applets and the Latte
overlayed icon applets need to use the same visual
with the regular plasma applets.
This commit is contained in:
Michail Vourlakos 2020-01-12 16:43:52 +02:00
parent 4809703e9f
commit b7e1f6b142
9 changed files with 179 additions and 34 deletions

View File

@ -144,7 +144,8 @@ void Factory::reload(const QString &indicatorPath)
}
if ((metadata.pluginId() != "org.kde.latte.default")
&& (metadata.pluginId() != "org.kde.latte.plasma")) {
&& (metadata.pluginId() != "org.kde.latte.plasma")
&& (metadata.pluginId() != "org.kde.latte.plasmatabstyle")) {
if (!m_customPluginIds.contains(metadata.pluginId())) {
m_customPluginIds << metadata.pluginId();
@ -221,7 +222,7 @@ void Factory::removeIndicatorRecords(const QString &path)
bool Factory::isCustomType(const QString &id) const
{
return ((id != "org.kde.latte.default") && (id != "org.kde.latte.plasma"));
return ((id != "org.kde.latte.default") && (id != "org.kde.latte.plasma") && (id != "org.kde.latte.plasmatabstyle"));
}
bool Factory::metadataAreValid(KPluginMetaData &metadata)

View File

@ -288,7 +288,7 @@ void Indicator::loadPlasmaComponent()
{
auto prevComponent = m_plasmaComponent;
KPluginMetaData metadata = m_corona->indicatorFactory()->metadata("org.kde.latte.plasma");
KPluginMetaData metadata = m_corona->indicatorFactory()->metadata("org.kde.latte.plasmatabstyle");
QString uiPath = metadata.value("X-Latte-MainScript");
if (!uiPath.isEmpty()) {

View File

@ -1,2 +1,3 @@
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.plasmatabstyle DESTINATION ${CMAKE_INSTALL_PREFIX}/share/latte/indicators)

View File

@ -1,4 +1,5 @@
#! /usr/bin/env bash
$XGETTEXT `find default -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/latte_indicator_org.kde.latte.default.pot
$XGETTEXT `find org.kde.latte.plasma -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/latte_indicator_org.kde.latte.plasma.pot
$XGETTEXT `find org.kde.latte.plasma -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/latte_indicator_org.kde.latte.plasma.pot
$XGETTEXT `find org.kde.latte.plasmatabstyle -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/latte_indicator_org.kde.latte.plasmatabstyle.pot

View File

@ -27,38 +27,12 @@ PlasmaCore.FrameSvgItem {
id: frame
property string basePrefix: "normal"
imagePath: root.usePlasmaTabsStyle ? "widgets/tabbar" : "widgets/tasks"
imagePath: "widgets/tasks"
rotation: root.reversedEnabled ? 180 : 0
opacity: 1 //state === "hovered" ? 0.9 : 1
opacity: 1
prefix: {
if (root.usePlasmaTabsStyle) {
if (!indicator.isActive) {
return "";
}
if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
return "west-active-tab";
}
if (plasmoid.location === PlasmaCore.Types.TopEdge) {
return "north-active-tab";
}
if (plasmoid.location === PlasmaCore.Types.RightEdge) {
return "east-active-tab";
}
if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
return "south-active-tab";
}
return "south-active-tab";
} else {
return root.taskPrefix(basePrefix);
}
}
prefix: root.taskPrefix(basePrefix)
states: [
State {

View File

@ -48,7 +48,6 @@ LatteComponents.IndicatorItem {
&& indicator.configuration.reversed
readonly property bool usePlasmaTabsStyle: false
readonly property bool configurationIsReady: indicator && indicator.configuration
//! Background Layer

View File

@ -0,0 +1,20 @@
[Desktop Entry]
Name=Plasma Tab Style
Comment=Plasma Tab style indicator for Latte
Encoding=UTF-8
Type=Service
Icon=latte-dock
X-Plasma-API=declarativeappletscript
X-KDE-ServiceTypes=Latte/Indicator
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.plasmatabstyle
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

@ -0,0 +1,105 @@
/*
* Copyright 2020 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 org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.latte 0.2 as Latte
PlasmaCore.FrameSvgItem { id: frame
property string basePrefix: "normal"
imagePath: "widgets/tabbar"
rotation: 0
opacity: 1
prefix: {
if (!indicator.isActive) {
return "";
}
if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
return "west-active-tab";
}
if (plasmoid.location === PlasmaCore.Types.TopEdge) {
return "north-active-tab";
}
if (plasmoid.location === PlasmaCore.Types.RightEdge) {
return "east-active-tab";
}
if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
return "south-active-tab";
}
return "south-active-tab";
}
states: [
State {
name: "launcher"
when: indicator.isLauncher || (indicator.isApplet && !indicator.isActive)
PropertyChanges {
target: frame
basePrefix: ""
}
},
State {
name: "hovered"
when: indicator.isHovered && frame.hasElementPrefix("hover")
PropertyChanges {
target: frame
basePrefix: "hover"
}
},
State {
name: "attention"
when: indicator.inAttention
PropertyChanges {
target: frame
basePrefix: "attention"
}
},
State {
name: "minimized"
when: indicator.isMinimized
PropertyChanges {
target: frame
basePrefix: "minimized"
}
},
State {
name: "active"
when: indicator.isActive
PropertyChanges {
target: frame
basePrefix: "focus"
}
}
]
}

View File

@ -0,0 +1,44 @@
/*
* Copyright 2020 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 org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.latte 0.2 as Latte
import org.kde.latte.components 1.0 as LatteComponents
LatteComponents.IndicatorItem {
id: root
lengthPadding: 0.08
//! Background Layer
Loader{
id: backLayer
anchors.fill: parent
anchors.topMargin: plasmoid.location === PlasmaCore.Types.TopEdge ? indicator.screenEdgeMargin : 0
anchors.bottomMargin: plasmoid.location === PlasmaCore.Types.BottomEdge ? indicator.screenEdgeMargin : 0
anchors.leftMargin: plasmoid.location === PlasmaCore.Types.LeftEdge ? indicator.screenEdgeMargin : 0
anchors.rightMargin: plasmoid.location === PlasmaCore.Types.RightEdge ? indicator.screenEdgeMargin : 0
active: level.isBackground && !indicator.isEmptySpace
sourceComponent: BackLayer{}
}
}