support most of CanvasConfigView functionality

--move the relevant qml files from containment into
shell configuration files
pull/18/head
Michail Vourlakos 5 years ago
parent fec2f447d5
commit a51eb8578e

@ -48,7 +48,7 @@ void Package::initPackage(KPackage::Package *package)
//Configuration
package->addFileDefinition("lattedockconfigurationui", QStringLiteral("configuration/LatteDockConfiguration.qml"), i18n("Dock configuration UI"));
package->addFileDefinition("lattedocksecondaryconfigurationui", QStringLiteral("configuration/LatteDockSecondaryConfiguration.qml"), i18n("Dock secondary configuration UI"));
package->addFileDefinition("canvasconfigurationui", QStringLiteral("configuration/Canvas.qml"), i18n("Dock canvas configuration UI"));
package->addFileDefinition("canvasconfigurationui", QStringLiteral("configuration/CanvasConfiguration.qml"), i18n("Dock canvas configuration UI"));
package->addFileDefinition("configmodel", QStringLiteral("configuration/config.qml"), i18n("Config model"));
package->addFileDefinition("splitter", QStringLiteral("images/splitter.svgz"), i18n("Splitter"));
package->addFileDefinition("trademark", QStringLiteral("images/trademark.svgz"), i18n("Latte Trademark"));

@ -87,6 +87,10 @@ PrimaryConfigView::PrimaryConfigView(Latte::View *view)
PrimaryConfigView::~PrimaryConfigView()
{
if (m_canvasConfigView) {
delete m_canvasConfigView;
}
if (m_secConfigView) {
delete m_secConfigView;
}

@ -24,6 +24,7 @@
#include "../view.h"
#include "../../lattecorona.h"
#include "../../layouts/manager.h"
#include "../../plasma/extended/theme.h"
#include "../../settings/universalsettings.h"
#include "../../shortcuts/globalshortcuts.h"
#include "../../shortcuts/shortcutstracker.h"
@ -122,6 +123,7 @@ void SubConfigView::init()
if (m_corona) {
rootContext()->setContextProperty(QStringLiteral("universalSettings"), m_corona->universalSettings());
rootContext()->setContextProperty(QStringLiteral("layoutsManager"), m_corona->layoutsManager());
rootContext()->setContextProperty(QStringLiteral("themeExtended"), m_corona->themeExtended());
}
KDeclarative::KDeclarative kdeclarative;

@ -1,25 +0,0 @@
/*
* 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
Rectangle {
color: "red"
opacity: 0.5
}

@ -0,0 +1,168 @@
/*
* 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.8
import QtGraphicalEffects 1.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.latte.core 0.2 as LatteCore
import org.kde.latte.private.containment 0.1 as LatteContainment
import "canvas" as CanvasComponent
Item{
id: root
readonly property bool isVertical: plasmoid.formFactor === PlasmaCore.Types.Vertical
readonly property bool isHorizontal: !isVertical
property int offset: {
if (latteView.behaveAsPlasmaPanel) {
return 0;
}
if (root.isHorizontal) {
return width * (plasmoid.configuration.offset/100);
} else {
height * (plasmoid.configuration.offset/100)
}
}
property int animationSpeed: LatteCore.WindowSystem.compositingActive ? 500 : 0
property int panelAlignment: plasmoid.configuration.alignment
readonly property real appliedOpacity: imageTiler.opacity
readonly property real maxOpacity: plasmoid.configuration.inConfigureAppletsMode || !LatteCore.WindowSystem.compositingActive ?
1 : plasmoid.configuration.editBackgroundOpacity
property string appChosenShadowColor: {
if (plasmoid.configuration.shadowColorType === LatteContainment.Types.ThemeColorShadow) {
var strC = String(theme.textColor);
return strC.indexOf("#") === 0 ? strC.substr(1) : strC;
} else if (plasmoid.configuration.shadowColorType === LatteContainment.Types.UserColorShadow) {
return plasmoid.configuration.shadowColor;
}
// default shadow color
return "080808";
}
property string appShadowColorSolid: "#" + appChosenShadowColor
//// BEGIN OF Behaviors
Behavior on offset {
NumberAnimation {
id: offsetAnimation
duration: animationSpeed
easing.type: Easing.OutCubic
}
}
//// END OF Behaviors
Item {
id: graphicsSystem
readonly property bool isAccelerated: (GraphicsInfo.api !== GraphicsInfo.Software)
&& (GraphicsInfo.api !== GraphicsInfo.Unknown)
}
Image{
id: imageTiler
anchors.fill: parent
opacity: root.maxOpacity
fillMode: Image.Tile
source: {
if (hasBackground) {
return latteView.layout.background;
}
return latteView.layout ? "../images/canvas/"+latteView.layout.background+"print.jpg" : "../images/canvas/blueprint.jpg"
}
readonly property bool hasBackground: (latteView.layout && latteView.layout.background.startsWith("/")) ? true : false
Behavior on opacity {
NumberAnimation {
duration: 0.8 * root.animationSpeed
easing.type: Easing.OutCubic
}
}
}
MouseArea {
id: editBackMouseArea
anchors.fill: imageTiler
visible: !plasmoid.configuration.inConfigureAppletsMode
hoverEnabled: true
property bool wheelIsBlocked: false;
readonly property double opacityStep: 0.1
readonly property string tooltip: i18nc("opacity for background under edit mode, %0% is opacity percentage",
"You can use mouse wheel to change background opacity of %0%").arg(Math.round(plasmoid.configuration.editBackgroundOpacity * 100))
onWheel: {
processWheel(wheel);
}
function processWheel(wheel) {
if (wheelIsBlocked) {
return;
}
wheelIsBlocked = true;
scrollDelayer.start();
var angle = wheel.angleDelta.y / 8;
if (angle > 10) {
plasmoid.configuration.editBackgroundOpacity = Math.min(100, plasmoid.configuration.editBackgroundOpacity + opacityStep)
} else if (angle < -10) {
plasmoid.configuration.editBackgroundOpacity = Math.max(0, plasmoid.configuration.editBackgroundOpacity - opacityStep)
}
}
//! A timer is needed in order to handle also touchpads that probably
//! send too many signals very fast. This way the signals per sec are limited.
//! The user needs to have a steady normal scroll in order to not
//! notice a annoying delay
Timer{
id: scrollDelayer
interval: 80
onTriggered: editBackMouseArea.wheelIsBlocked = false;
}
}
PlasmaComponents.Button {
anchors.fill: editBackMouseArea
opacity: 0
tooltip: editBackMouseArea.tooltip
}
//! Settings Overlay
CanvasComponent.SettingsOverlay {
id: settingsOverlay
anchors.fill: parent
}
}

@ -20,7 +20,6 @@
import QtQuick 2.7
import QtQuick.Layouts 1.1
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
@ -58,7 +57,7 @@ Item {
}
if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
return visibilityManager.thicknessNormalOriginalValue + ruler.thickness + headMargin * 2 - width/2 + height/2;
return latteView.normalHighestThickness + ruler.thickness + headMargin * 2 - width/2 + height/2;
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
return headMargin - width/2 + height/2;
}
@ -123,7 +122,7 @@ Item {
text: i18n("Rearrange and configure your widgets")
tooltip: i18n("Feel free to move around your widgets and configure them from their tooltips")
checked: root.inConfigureAppletsMode
checked: plasmoid.configuration.inConfigureAppletsMode
iconPositionReversed: plasmoid.location === PlasmaCore.Types.RightEdge
icon: SettingsControls.RearrangeIcon{}

@ -21,14 +21,13 @@ import QtQuick 2.7
import QtGraphicalEffects 1.0
import QtQuick.Layouts 1.1
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import "controls" as SettingsControls
import "maxlength" as MaximumLength
import "../../code/ColorizerTools.js" as ColorizerTools
//import "../../code/ColorizerTools.js" as ColorizerTools
Item{
id: settingsRoot
@ -47,12 +46,12 @@ Item{
property string tooltip: ""
readonly property real textColorBrightness: ColorizerTools.colorBrightness(textColor)
readonly property real textColorBrightness: 150// ColorizerTools.colorBrightness(textColor)
readonly property bool textColorIsDark: textColorBrightness < 127.5
readonly property color bestContrastedTextColor: {
if (imageTiler.opacity <= 0.4 && !root.inConfigureAppletsMode && themeExtended) {
return colorizerManager.currentBackgroundBrightness > 127.5 ?
if (imageTiler.opacity <= 0.4 && !plasmoid.configuration.inConfigureAppletsMode && themeExtended) {
return latteView.colorizer.currentBackgroundBrightness > 127.5 ?
themeExtended.lightTheme.textColor :
themeExtended.darkTheme.textColor;
}

@ -20,7 +20,6 @@
import QtQuick 2.7
import QtQuick.Layouts 1.1
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
@ -43,19 +42,19 @@ Item{
readonly property color appliedTextColor: checked ? checkedTextColor : textColor
readonly property color appliedBackgroundColor: checked ? checkedBackgroundColor : backgroundColor
readonly property color textColor: containsMouse ? colorizerManager.buttonTextColor : settingsRoot.textColor
readonly property color textColor: containsMouse ? latteView.colorizer.buttonTextColor : settingsRoot.textColor
readonly property color backgroundColor: containsMouse ? hoveredBackground : normalBackground// "transparent"
readonly property color checkedTextColor: colorizerManager.buttonTextColor
readonly property color checkedBackgroundColor: colorizerManager.buttonFocusColor
readonly property color checkedTextColor: latteView.colorizer.buttonTextColor
readonly property color checkedBackgroundColor: latteView.colorizer.buttonFocusColor
readonly property color normalBackground: Qt.rgba(colorizerManager.buttonHoverColor.r,
colorizerManager.buttonHoverColor.g,
colorizerManager.buttonHoverColor.b,
readonly property color normalBackground: Qt.rgba(latteView.colorizer.buttonHoverColor.r,
latteView.colorizer.buttonHoverColor.g,
latteView.colorizer.buttonHoverColor.b,
0.3)
readonly property color hoveredBackground: Qt.rgba(colorizerManager.buttonHoverColor.r,
colorizerManager.buttonHoverColor.g,
colorizerManager.buttonHoverColor.b,
readonly property color hoveredBackground: Qt.rgba(latteView.colorizer.buttonHoverColor.r,
latteView.colorizer.buttonHoverColor.g,
latteView.colorizer.buttonHoverColor.b,
0.7)
property Component icon

@ -19,7 +19,6 @@
import QtQuick 2.7
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
GraphicIcon{

@ -21,7 +21,6 @@ import QtQuick 2.7
import QtQuick.Layouts 1.0
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
@ -33,9 +32,7 @@ Item{
width: root.isHorizontal ? userMaxLength : thickness
height: root.isVertical ? userMaxLength : thickness
opacity: root.editMode ? 1 : 0
property int rulerAnimationTime: 0.8 * animations.duration.proposed
property int rulerAnimationTime: root.animationSpeed
property int thicknessMargin: 0
readonly property bool containsMouse: rulerMouseArea.containsMouse

@ -27,8 +27,7 @@ import org.kde.latte.core 0.2 as LatteCore
MouseArea{
id: rulerMouseArea
visible: root.editMode
hoverEnabled: root.editMode
hoverEnabled: true
cursorShape: root.isHorizontal ? Qt.SizeHorCursor : Qt.SizeVerCursor
onVisibleChanged: {

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Loading…
Cancel
Save