1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-24 17:33:50 +03:00

abilities:introduce UserRequests

This commit is contained in:
Michail Vourlakos 2020-07-18 17:39:34 +03:00
parent f5cc1f8f81
commit e4437b7f66
12 changed files with 157 additions and 0 deletions

View File

@ -336,6 +336,7 @@ signals:
void indicatorPluginChanged(const QString &indicatorId);
void indicatorPluginRemoved(const QString &indicatorId);
void userRequestedViewType(const int &type);
//! are used to trigger the Corona relevant signals and in that
//! way we can disable any such signaling all together, e.g. through disconnectSensitiveSignals()

View File

@ -0,0 +1,35 @@
/*
* 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.latte.core 0.2 as LatteCore
import org.kde.latte.abilities.definitions 0.1 as AbilityDefinition
AbilityDefinition.UserRequests {
id: containerUserRequests
property QtObject view: null
Connections {
target: view
onUserRequestedViewType: {
containerUserRequests.sglViewType(type);
}
}
}

View File

@ -287,6 +287,7 @@ Item {
property Item metrics: null
property Item parabolic: null
property Item shortcuts: null
property Item userRequests: null
property bool containsMouse: appletMouseArea.containsMouse || (isLattePlasmoid && latteApplet.containsMouse)
property bool pressed: viewSignalsConnector.pressed || clickedAnimation.running

View File

@ -118,6 +118,7 @@ Item{
readonly property Item actions: Actions{}
readonly property Item applet: mainCommunicator.requires
readonly property Item metrics: appletItem.metrics.publicApi
readonly property Item userRequests: appletItem.userRequests
readonly property AbilityBridge.Animations animations: AbilityBridge.Animations {
host: appletItem.animations.publicApi

View File

@ -381,6 +381,7 @@ Item {
readonly property alias layouter: _layouter
readonly property alias metrics: _metrics
readonly property alias parabolic: _parabolic
readonly property alias userRequests: _userRequests
readonly property alias maskManager: visibilityManager
readonly property alias layoutsContainerItem: layoutsContainer
@ -1282,6 +1283,7 @@ Item {
metrics: _metrics
parabolic: _parabolic
shortcuts: _shortcuts
userRequests: _userRequests
}
}
@ -1527,6 +1529,11 @@ Item {
layouts: layoutsContainer
}
Ability.UserRequests {
id: _userRequests
view: latteView
}
LatteApp.Interfaces {
id: _interfaces
plasmoidInterface: plasmoid

View File

@ -0,0 +1,38 @@
/*
* 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.latte.abilities.definitions 0.1 as AbilityDefinition
AbilityDefinition.UserRequests {
id: _userRequests
property Item bridge: null
readonly property bool isActive: bridge !== null
function updateSignals() {
if (isActive) {
bridge.userRequests.sglViewType.connect(_userRequests.sglViewType);
}
}
onIsActiveChanged: updateSignals()
Component.onCompleted: updateSignals()
Component.onDestruction: updateSignals()
}

View File

@ -6,3 +6,4 @@ Metrics 0.1 Metrics.qml
ParabolicEffect 0.1 ParabolicEffect.qml
PositionShortcuts 0.1 PositionShortcuts.qml
Requirements 0.1 Requirements.qml
UserRequests 0.1 UserRequests.qml

View File

@ -0,0 +1,24 @@
/*
* 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
Item {
signal sglViewType(int viewType);
}

View File

@ -6,4 +6,5 @@ Indexer 0.1 Indexer.qml
Metrics 0.1 Metrics.qml
ParabolicEffect 0.1 ParabolicEffect.qml
PositionShortcuts 0.1 PositionShortcuts.qml
UserRequests 0.1 UserRequests.qml

View File

@ -0,0 +1,39 @@
/*
* 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.7
import org.kde.plasma.plasmoid 2.0
import org.kde.latte.core 0.2 as LatteCore
import org.kde.latte.abilities.applets 0.1 as AppletAbility
AppletAbility.UserRequests {
onSglViewType: {
if (viewType === LatteCore.Types.DockView) {
plasmoid.configuration.animationLauncherBouncing = true;
plasmoid.configuration.animationWindowInAttention = true;
plasmoid.configuration.animationWindowAddedInGroup = true;
} else if (viewType === LatteCore.Types.PanelView) {
plasmoid.configuration.animationLauncherBouncing = false;
plasmoid.configuration.animationWindowInAttention = false;
plasmoid.configuration.animationWindowAddedInGroup = false;
}
}
}

View File

@ -989,6 +989,11 @@ Item {
screenEdgeMarginSupported: true
}
Ability.UserRequests {
id: _userRequests
bridge: latteBridge
}
Component{
id: attentionTimerComponent
Timer{

View File

@ -71,6 +71,8 @@ Grid {
onPressedChanged: {
if (pressed && !checked) {
latteView.userRequestedViewType(LatteCore.Types.DockView);
latteView.visibility.mode = LatteCore.Types.DodgeActive;
plasmoid.configuration.alignment = LatteCore.Types.Center;
plasmoid.configuration.useThemePanel = true;
@ -112,6 +114,8 @@ Grid {
onPressedChanged: {
if (pressed && !checked) {
latteView.userRequestedViewType(LatteCore.Types.PanelView);
latteView.visibility.mode = LatteCore.Types.AlwaysVisible;
plasmoid.configuration.alignment = LatteCore.Types.Justify;
plasmoid.configuration.useThemePanel = true;