Multiple improvements

pull/3/head
cutefishd 5 years ago
parent 9cc0da9531
commit 4a75b81acb

@ -1,81 +0,0 @@
/*
* Copyright 2021 Rui Wang <wangrui@jingos.com>
*
* This program 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) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* This program 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 <https://www.gnu.org/licenses/>.
*/
import QtQuick 2.12
import QtGraphicalEffects 1.0
Item {
id: blurBackground
property QtObject sourceItem: null
property real blurRadius: 0
property real radius: 0
property color backgroundColor
property int startX: 0
property int startY: 0
ShaderEffectSource {
id:eff
anchors.fill: parent
sourceItem: blurBackground.sourceItem
sourceRect: Qt.rect(blurBackground.startX,blurBackground.startY,blurBackground.width,blurBackground.height)
visible: false
}
onStartXChanged: {
var jx = eff.mapToItem(blurBackground.sourceItem, blurBackground.x, blurBackground.y)
blurBackground.startX = jx.x
blurBackground.startY = jx.y
eff.sourceRect = Qt.rect(blurBackground.startX,blurBackground.startY,blurBackground.width,blurBackground.height)
}
FastBlur {
id:fastBlur
anchors.fill: parent
source: eff
radius: blurBackground.blurRadius
cached: true
visible: true
}
Rectangle {
id: maskRect
anchors.fill: parent
color: blurBackground.backgroundColor
radius: blurBackground.radius
visible: false
}
OpacityMask {
id:mask
anchors.fill: maskRect
source: fastBlur
maskSource: maskRect
}
Rectangle {
anchors.fill: parent
color: blurBackground.backgroundColor
radius: blurBackground.radius
}
}

@ -1,64 +0,0 @@
import QtQuick 2.12
import QtQuick.Controls 2.12 as QQC2
import QtGraphicalEffects 1.0
import MeuiKit 1.0 as Meui
QQC2.Menu {
id: control
property real blurRadius: 100
// property alias blurRadius: bkground.blurRadius
property alias backgroundOpacity: _menubg.backgroundOpacity
property real backgroundRadius: Meui.Theme.smallRadius
background: Meui.RoundedRect {
id: _menubg
backgroundOpacity: 0.7
radius: control.backgroundRadius
blurEnabled: true
sourceItem: control.parent
layer.enabled: true
layer.effect: DropShadow {
transparentBorder: true
radius: 32
samples: 32
horizontalOffset: 0
verticalOffset: 0
color: Qt.rgba(0, 0, 0, 0.11)
}
}
// background: Meui.BlurBackground {
// id: bkground
// sourceItem: control.parent
// backgroundColor: "transparent"
// startX: control.x
// startY: control.y
// blurRadius: 144
// radius: control.backgroundRadius
// Meui.RoundedRect {
// id: roundedRect
// anchors.fill: parent
// backgroundOpacity: 0.7
// radius: control.backgroundRadius
// }
// layer.enabled: true
// layer.effect: DropShadow {
// transparentBorder: true
// radius: 32
// samples: 32
// horizontalOffset: 0
// verticalOffset: 0
// color: Qt.rgba(0, 0, 0, 0.11)
// }
// }
// onVisibleChanged: {
// var jx = contentItem.mapToItem(control.parent, control.x, control.y)
// bkground.startX = jx.x
// bkground.startY = jx.y
// }
}

@ -6,6 +6,8 @@ import MeuiKit.Core 1.0 as MeuiKitCore
QtObject {
id: theme
property real devicePixelRatio: MeuiKitCore.ThemeManager.devicePixelRatio
property bool darkMode: MeuiKitCore.ThemeManager.darkMode
property color blueColor: MeuiKitCore.ThemeManager.blueColor
@ -33,6 +35,7 @@ QtObject {
property color visitedLinkBackgroundColor: "#2196F3"
property real smallRadius: 8.0
property real mediumRadius: 10.0
property real bigRadius: 12.0
property font defaultFont: fontMetrics.font

@ -87,6 +87,27 @@ Window {
}
}
// Top edge
MouseArea {
height: edgeSize / 2
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.leftMargin: edgeSize * 2
anchors.rightMargin: edgeSize * 2
visible: !isMaximized && !isFullScreen
cursorShape: Qt.SizeVerCursor
z: 999
onPressed: mouse.accepted = false
DragHandler {
grabPermissions: TapHandler.CanTakeOverFromAnything
target: null
onActiveChanged: if (active) { windowHelper.startSystemResize(root, Qt.TopEdge) }
}
}
// Bottom edge
MouseArea {
height: edgeSize / 2

@ -79,14 +79,14 @@
<g
id="g6"
transform="matrix(0.0065117,0,0,0.00651172,2.3017515,291.36422)"
style="fill:#CACBCE;fill-opacity:1">
style="fill:#FFFFFF;fill-opacity:1">
<g
id="g4"
style="fill:#CACBCE;fill-opacity:1">
style="fill:#FFFFFF;fill-opacity:1">
<path
d="M 284.286,256.002 506.143,34.144 c 7.811,-7.811 7.811,-20.475 0,-28.285 -7.811,-7.81 -20.475,-7.811 -28.285,0 L 256,227.717 34.143,5.859 c -7.811,-7.811 -20.475,-7.811 -28.285,0 -7.81,7.811 -7.811,20.475 0,28.285 L 227.715,256.001 5.858,477.859 c -7.811,7.811 -7.811,20.475 0,28.285 3.905,3.905 9.024,5.857 14.143,5.857 5.119,0 10.237,-1.952 14.143,-5.857 L 256,284.287 477.857,506.144 c 3.905,3.905 9.024,5.857 14.143,5.857 5.119,0 10.237,-1.952 14.143,-5.857 7.811,-7.811 7.811,-20.475 0,-28.285 z"
id="path2-3"
style="fill:#CACBCE;fill-opacity:1" />
style="fill:#FFFFFF;fill-opacity:1" />
</g>
</g>
</g>

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

@ -87,7 +87,7 @@
y="294.87387"
ry="4.4795979e-06" />
<rect
style="opacity:0.9;fill:none;stroke:#CACBCE;stroke-width:0.26458333;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
style="opacity:0.9;fill:none;stroke:#FFFFFF;stroke-width:0.26458333;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect837"
width="3.2839999"
height="2.6270001"

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

@ -69,10 +69,10 @@
inkscape:label="#g3842"
id="4-7" />
<polygon
fill="#CACBCE"
fill="#ffffff"
points="25,20 25,19 24.529,19 15.471,19 15,19 15,20 15.471,20 24.529,20 "
id="polygon2"
transform="matrix(0.36896569,0,0,0.26458333,-3.4105638,287.87186)"
style="fill:#CACBCE;fill-opacity:1" />
style="fill:#ffffff;fill-opacity:1" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

@ -72,19 +72,15 @@
transform="matrix(0.26458333,0,0,0.26458333,8.6603107,0.81148024)"
inkscape:label="#g3842"
id="4-75" />
<g
id="g886"
transform="translate(1.4056297,-1.99609)">
<path
d="m 1.4879664,293.99198 c -0.2647268,0 -0.4778461,0.23088 -0.4778461,0.51767 v 1.553 c 0,0.28679 0.2131193,0.51767 0.4778461,0.51767 H 3.160428 c 0.2647268,0 0.4778461,-0.23088 0.4778461,-0.51767 v -1.553 c 0,-0.28679 -0.2131193,-0.51767 -0.4778461,-0.51767 z m 0,0.51767 H 3.160428 c 0.1323634,0 0.2389231,0.11544 0.2389231,0.25883 v 1.29417 c 0,0.14339 -0.1065597,0.25883 -0.2389231,0.25883 H 1.4879664 c -0.1323634,0 -0.2389231,-0.11544 -0.2389231,-0.25883 v -1.29417 c 0,-0.14339 0.1065597,-0.25883 0.2389231,-0.25883 z"
fill="#CACBCE"
id="path2"
style="fill:#CACBCE;fill-opacity:1;stroke-width:0.248679" />
<path
d="m 1.9658126,293.47432 c -0.1770587,0 -0.3294749,0.10462 -0.4120468,0.25883 h 1.8455853 c 0.2647267,0 0.4778461,0.23088 0.4778461,0.51767 v 1.29416 0.44639 c 0.1423504,-0.0894 0.2389231,-0.25458 0.2389231,-0.44639 v -1.29416 c 0,-0.43018 -0.3196791,-0.7765 -0.7167692,-0.7765 z"
fill="#CACBCE"
id="path4-3"
style="fill:#CACBCE;fill-opacity:1;stroke-width:0.248679" />
</g>
<path
d="m 2.8935961,291.99589 c -0.2647268,0 -0.4778461,0.23088 -0.4778461,0.51767 v 1.553 c 0,0.28679 0.2131193,0.51767 0.4778461,0.51767 h 1.6724616 c 0.2647268,0 0.4778461,-0.23088 0.4778461,-0.51767 v -1.553 c 0,-0.28679 -0.2131193,-0.51767 -0.4778461,-0.51767 z m 0,0.51767 h 1.6724616 c 0.1323634,0 0.2389231,0.11544 0.2389231,0.25883 v 1.29417 c 0,0.14339 -0.1065597,0.25883 -0.2389231,0.25883 H 2.8935961 c -0.1323634,0 -0.2389231,-0.11544 -0.2389231,-0.25883 v -1.29417 c 0,-0.14339 0.1065597,-0.25883 0.2389231,-0.25883 z"
fill="#ffffff"
id="path2"
style="fill:#ffffff;fill-opacity:1;stroke-width:0.248679" />
<path
d="m 3.3714423,291.47823 c -0.1770587,0 -0.3294749,0.10462 -0.4120468,0.25883 h 1.8455853 c 0.2647267,0 0.4778461,0.23088 0.4778461,0.51767 v 1.29416 0.44639 C 5.4251773,293.90588 5.52175,293.7407 5.52175,293.54889 v -1.29416 c 0,-0.43018 -0.3196791,-0.7765 -0.7167692,-0.7765 z"
fill="#ffffff"
id="path4-3"
style="fill:#ffffff;fill-opacity:1;stroke-width:0.248679" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

@ -6,7 +6,7 @@ import QtQuick.Controls.impl 2.4
T.Button
{
id: control
implicitWidth: Math.max(background.implicitWidth + Meui.Units.extendBorderWidth,
implicitWidth: Math.max(background.implicitWidth + Meui.Units.extendBorderWidth + Meui.Theme.mediumRadius / 2,
contentItem.implicitWidth + Meui.Units.largeSpacing + Meui.Units.extendBorderWidth)
implicitHeight: background.implicitHeight + Meui.Units.extendBorderWidth
hoverEnabled: true
@ -48,9 +48,9 @@ T.Button
color: "transparent"
border.color: control.activeFocus ? Qt.rgba(Meui.Theme.highlightColor.r,
Meui.Theme.highlightColor.g,
Meui.Theme.highlightColor.b, 0.3) : "transparent"
Meui.Theme.highlightColor.b, 0.2) : "transparent"
border.width: Meui.Units.extendBorderWidth
radius: Meui.Theme.smallRadius + Meui.Units.extendBorderWidth
radius: Meui.Theme.mediumRadius + Meui.Units.extendBorderWidth
Behavior on border.color {
ColorAnimation {
@ -62,7 +62,7 @@ T.Button
Rectangle {
anchors.fill: parent
anchors.margins: Meui.Units.extendBorderWidth
radius: Meui.Theme.smallRadius
radius: Meui.Theme.mediumRadius
border.color: control.activeFocus || control.pressed ? Meui.Theme.highlightColor :
Qt.tint(Meui.Theme.textColor, Qt.rgba(Meui.Theme.backgroundColor.r, Meui.Theme.backgroundColor.g, Meui.Theme.backgroundColor.b, 0.7))
border.width: 1

@ -111,7 +111,7 @@ T.ComboBox {
color: "transparent"
border.color: control.activeFocus ? Qt.rgba(Meui.Theme.highlightColor.r,
Meui.Theme.highlightColor.g,
Meui.Theme.highlightColor.b, 0.3) : "transparent"
Meui.Theme.highlightColor.b, 0.2) : "transparent"
border.width: Meui.Units.extendBorderWidth
radius: Meui.Theme.smallRadius + Meui.Units.extendBorderWidth

@ -76,7 +76,8 @@ T.TextField {
background: Rectangle {
implicitWidth: (Meui.Units.iconSizes.medium * 3) + Meui.Units.smallSpacing + Meui.Units.extendBorderWidth
implicitHeight: Meui.Units.iconSizes.medium + Meui.Units.smallSpacing + Meui.Units.extendBorderWidth
color: control.activeFocus ? Qt.lighter(Meui.Theme.backgroundColor, 1.4) : Meui.Theme.backgroundColor
// color: control.activeFocus ? Qt.lighter(Meui.Theme.backgroundColor, 1.4) : Meui.Theme.backgroundColor
color: "transparent"
radius: Meui.Theme.smallRadius
Rectangle {
@ -85,7 +86,7 @@ T.TextField {
color: "transparent"
border.color: control.activeFocus ? Qt.rgba(Meui.Theme.highlightColor.r,
Meui.Theme.highlightColor.g,
Meui.Theme.highlightColor.b, 0.3) : "transparent"
Meui.Theme.highlightColor.b, 0.2) : "transparent"
border.width: Meui.Units.extendBorderWidth
radius: Meui.Theme.smallRadius + Meui.Units.extendBorderWidth

@ -56,10 +56,8 @@ void MeuiKit::registerTypes(const char *uri)
qmlRegisterSingletonType(componentUrl(QStringLiteral("Theme.qml")), uri, 1, 0, "Theme");
qmlRegisterSingletonType(componentUrl(QStringLiteral("Units.qml")), uri, 1, 0, "Units");
qmlRegisterType(componentUrl(QStringLiteral("BlurBackground.qml")), uri, 1, 0, "BlurBackground");
qmlRegisterType(componentUrl(QStringLiteral("BusyIndicator.qml")), uri, 1, 0, "BusyIndicator");
qmlRegisterType(componentUrl(QStringLiteral("Icon.qml")), uri, 1, 0, "Icon");
qmlRegisterType(componentUrl(QStringLiteral("Menu.qml")), uri, 1, 0, "Menu");
qmlRegisterType(componentUrl(QStringLiteral("MouseHover.qml")), uri, 1, 0, "MouseHover");
qmlRegisterType(componentUrl(QStringLiteral("PopupTips.qml")), uri, 1, 0, "PopupTips");
qmlRegisterType(componentUrl(QStringLiteral("RoundedRect.qml")), uri, 1, 0, "RoundedRect");

@ -1,9 +1,7 @@
<RCC>
<qresource prefix="/meui/kit">
<file alias="BlurBackground.qml">controls/BlurBackground.qml</file>
<file alias="BusyIndicator.qml">controls/BusyIndicator.qml</file>
<file alias="Icon.qml">controls/Icon.qml</file>
<file alias="Menu.qml">controls/Menu.qml</file>
<file alias="MouseHover.qml">controls/MouseHover.qml</file>
<file alias="PopupTips.qml">controls/PopupTips.qml</file>
<file alias="RoundedRect.qml">controls/RoundedRect.qml</file>

@ -19,6 +19,8 @@
#include "thememanager.h"
#include <QApplication>
#include <QDBusConnection>
#include <QDBusServiceWatcher>
#include <QDBusInterface>
@ -44,6 +46,11 @@ ThemeManager::ThemeManager(QObject *parent)
initData();
}
qreal ThemeManager::devicePixelRatio() const
{
return qApp->devicePixelRatio();
}
void ThemeManager::initData()
{
QDBusInterface iface(Service, ObjectPath, Interface, QDBusConnection::sessionBus(), this);

@ -42,10 +42,13 @@ class ThemeManager : public QObject
Q_PROPERTY(QColor purpleColor READ purpleColor CONSTANT)
Q_PROPERTY(QColor pinkColor READ pinkColor CONSTANT)
Q_PROPERTY(QColor orangeColor READ orangeColor CONSTANT)
Q_PROPERTY(qreal devicePixelRatio READ devicePixelRatio CONSTANT)
public:
explicit ThemeManager(QObject *parent = nullptr);
qreal devicePixelRatio() const;
bool darkMode() { return m_darkMode; }
QColor accentColor() { return m_accentColor; }

Loading…
Cancel
Save