1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-26 23:21:37 +03:00

support touching horizontal view and isbusy

--trying to increase smartness for horizontal
and vertical views. In multiple layouts environment
a view can exist in cases that one or more of
the sided views that is touching it is NOT
transparent, it would be nice for those
cases the top or bottom  view to LOSE also
its transparency in order to not look
inconsistent.
This commit is contained in:
Michail Vourlakos 2019-08-01 18:18:40 +03:00
parent 45456a5ab8
commit cad13372d6
3 changed files with 75 additions and 0 deletions

View File

@ -655,6 +655,37 @@ void View::setLatteTasksArePresent(bool present)
emit latteTasksArePresentChanged();
}
bool View::touchingBottomViewAndIsBusy() const
{
return m_touchingBottomViewAndIsBusy;
}
void View::setTouchingBottomViewAndIsBusy(bool touchAndBusy)
{
if (m_touchingBottomViewAndIsBusy == touchAndBusy) {
return;
}
m_touchingBottomViewAndIsBusy = touchAndBusy;
emit touchingBottomViewAndIsBusyChanged();
}
bool View::touchingTopViewAndIsBusy() const
{
return m_touchingTopViewAndIsBusy;
}
void View::setTouchingTopViewAndIsBusy(bool touchAndBusy)
{
if (m_touchingTopViewAndIsBusy == touchAndBusy) {
return;
}
m_touchingTopViewAndIsBusy = touchAndBusy;
emit touchingTopViewAndIsBusyChanged();
}
void View::preferredViewForShortcutsChangedSlot(Latte::View *view)
{
if (view != this) {

View File

@ -86,6 +86,10 @@ class View : public PlasmaQuick::ContainmentView
Q_PROPERTY(bool latteTasksArePresent READ latteTasksArePresent WRITE setLatteTasksArePresent NOTIFY latteTasksArePresentChanged)
Q_PROPERTY(bool onPrimary READ onPrimary WRITE setOnPrimary NOTIFY onPrimaryChanged)
//! values to be used from Smart surrounding Views
Q_PROPERTY(bool touchingBottomViewAndIsBusy READ touchingBottomViewAndIsBusy WRITE setTouchingBottomViewAndIsBusy NOTIFY touchingBottomViewAndIsBusyChanged)
Q_PROPERTY(bool touchingTopViewAndIsBusy READ touchingTopViewAndIsBusy WRITE setTouchingTopViewAndIsBusy NOTIFY touchingTopViewAndIsBusyChanged)
Q_PROPERTY(int alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged)
Q_PROPERTY(int fontPixelSize READ fontPixelSize WRITE setFontPixelSize NOTIFY fontPixelSizeChanged)
Q_PROPERTY(int x READ x NOTIFY xChanged)
@ -149,6 +153,12 @@ public:
bool latteTasksArePresent() const;
void setLatteTasksArePresent(bool present);
bool touchingBottomViewAndIsBusy() const;
void setTouchingBottomViewAndIsBusy(bool touchAndBusy);
bool touchingTopViewAndIsBusy() const;
void setTouchingTopViewAndIsBusy(bool touchAndBusy);
float maxLength() const;
void setMaxLength(float length);
@ -264,6 +274,8 @@ signals:
void onPrimaryChanged();
void positionerChanged();
void screenGeometryChanged();
void touchingBottomViewAndIsBusyChanged();
void touchingTopViewAndIsBusyChanged();
void typeChanged();
void visibilityChanged();
void windowsTrackerChanged();
@ -309,6 +321,9 @@ private:
bool m_latteTasksArePresent{false};
bool m_onPrimary{true};
bool m_touchingBottomViewAndIsBusy{false};
bool m_touchingTopViewAndIsBusy{false};
int m_fontPixelSize{ -1};
int m_editThickness{24};
int m_maxThickness{24};

View File

@ -180,6 +180,34 @@ Item{
value: root.panelAlignment
}
Binding{
target: latteView
property: "touchingTopViewAndIsBusy"
when: latteView
value: {
var isTouchingTopScreenEdge = (latteView.y === latteView.screenGeometry.y);
var hasTopBorder = ((latteView.effects && (latteView.effects.enabledBorders & PlasmaCore.FrameSvg.TopBorder)) > 0);
return root.isVertical && !isTouchingTopScreenEdge && !hasTopBorder && root.forcePanelForBusyBackground;
}
}
Binding{
target: latteView
property: "touchingBottomViewAndIsBusy"
when: latteView
value: {
var latteBottom = latteView.y + latteView.height;
var screenBottom = latteView.screenGeometry.y + latteView.screenGeometry.height;
var isTouchingBottomScreenEdge = (latteBottom === screenBottom);
var hasBottomBorder = ((latteView.effects && (latteView.effects.enabledBorders & PlasmaCore.FrameSvg.BottomBorder)) > 0);
return root.isVertical && !isTouchingBottomScreenEdge && !hasBottomBorder && root.forcePanelForBusyBackground;
}
}
//! View::Effects bindings
Binding{
target: latteView && latteView.effects ? latteView.effects : null
property: "backgroundOpacity"
@ -240,6 +268,7 @@ Item{
}
}
//! View::WindowsTracker bindings
Binding{
target: latteView && latteView.windowsTracker ? latteView.windowsTracker : null
property: "enabled"