Improved desktop margins

This commit is contained in:
reionwong 2021-09-11 14:41:22 +08:00
parent a2764dc2e9
commit d003a8dc1f
6 changed files with 20 additions and 4 deletions

View file

@ -37,6 +37,7 @@ Desktop::Desktop(QObject *parent)
updateMargins();
connect(&m_dockInterface, SIGNAL(primaryGeometryChanged()), this, SLOT(updateMargins()));
connect(&m_dockInterface, SIGNAL(directionChanged()), this, SLOT(updateMargins()));
connect(&m_dockInterface, SIGNAL(visibilityChanged()), this, SLOT(updateMargins()));
} else {
QDBusServiceWatcher *watcher = new QDBusServiceWatcher("org.cutefish.Dock",
QDBusConnection::sessionBus(),
@ -46,6 +47,7 @@ Desktop::Desktop(QObject *parent)
updateMargins();
connect(&m_dockInterface, SIGNAL(primaryGeometryChanged()), this, SLOT(updateMargins()));
connect(&m_dockInterface, SIGNAL(directionChanged()), this, SLOT(updateMargins()));
connect(&m_dockInterface, SIGNAL(visibilityChanged()), this, SLOT(updateMargins()));
});
}
@ -96,11 +98,18 @@ void Desktop::updateMargins()
{
QRect dockGeometry = m_dockInterface.property("primaryGeometry").toRect();
int dockDirection = m_dockInterface.property("direction").toInt();
int visibility = m_dockInterface.property("visibility").toInt();
m_leftMargin = 0;
m_rightMargin = 0;
m_bottomMargin = 0;
// AlwaysHide
if (visibility == 1) {
emit marginsChanged();
return;
}
if (dockDirection == 0) {
m_leftMargin = dockGeometry.width();
} else if (dockDirection == 1) {

View file

@ -30,6 +30,9 @@ import "../"
Item {
id: rootItem
LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
LayoutMirroring.childrenInherit: true
GlobalSettings {
id: globalSettings
}

View file

@ -79,8 +79,8 @@ Item {
id: _iconItem
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: FishUI.Units.largeSpacing
anchors.bottomMargin: FishUI.Units.largeSpacing
anchors.topMargin: FishUI.Units.smallSpacing
anchors.bottomMargin: FishUI.Units.smallSpacing
z: 2
width: parent.width - FishUI.Units.largeSpacing * 2
@ -189,7 +189,7 @@ Item {
anchors.top: _iconItem.bottom
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: FishUI.Units.smallSpacing
maximumLineCount: 2
maximumLineCount: control.selected ? 3 : 2
horizontalAlignment: Text.AlignHCenter
width: parent.width - FishUI.Units.largeSpacing * 2 - FishUI.Units.smallSpacing
textFormat: Text.PlainText

View file

@ -221,7 +221,7 @@ GridView {
}
cellHeight: {
var iconHeight = iconSize + (FishUI.Units.fontMetrics.height * 2) + FishUI.Units.largeSpacing * 2
var iconHeight = iconSize + (FishUI.Units.fontMetrics.height * 3) + FishUI.Units.largeSpacing
if (isDesktopView) {
var extraHeight = calcExtraSpacing(iconHeight, control.height - topMargin - bottomMargin)
return iconHeight + extraHeight

View file

@ -107,6 +107,7 @@ Item {
Rectangle {
id: _background
anchors.fill: parent
anchors.rightMargin: 1
radius: FishUI.Theme.smallRadius
color: FishUI.Theme.secondBackgroundColor

View file

@ -37,6 +37,9 @@ FishUI.Window {
header.height: 36 + FishUI.Units.largeSpacing
background.opacity: root.compositing ? 0.9 : 1.0
LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
LayoutMirroring.childrenInherit: true
FishUI.WindowBlur {
view: root
geometry: Qt.rect(root.x, root.y, root.width, root.height)