Introduction and implementation of the SidebarAutohide

as discussed in #19.
pull/19/head
Martijn Vogelaar 5 years ago committed by Michail Vourlakos
parent 8b6ae2439a
commit 2e4f7da4c2

@ -926,7 +926,7 @@ void GenericLayout::toggleHiddenState(QString screenName, Plasma::Types::Locatio
if (viewsOnEdge >= 1) {
for(const auto view : latteViews()) {
if (view->positioner()->currentScreenName() == validScreenName && view->location() == edge) {
if (viewsOnEdge == 1 || (viewsOnEdge >1 && view->visibility() && view->visibility()->mode() == Latte::Types::SideBar)) {
if (viewsOnEdge == 1 || (viewsOnEdge >1 && view->visibility() && view->visibility()->isSidebar())) {
view->visibility()->toggleHiddenState();
return;
}

@ -69,7 +69,8 @@ private:
QList<Latte::Types::Visibility> m_ignoreModes{
Latte::Types::AutoHide,
Latte::Types::SideBar
Latte::Types::SideBar,
Latte::Types::SidebarAutoHide
};
QStringList m_lastScreenNames;

@ -562,7 +562,7 @@ void GlobalShortcuts::hideViewsTimerSlot()
latteView->visibility()->removeBlockHidingEvent(SHORTCUTBLOCKHIDINGTYPE);
latteView->extendedInterface()->hideShortcutBadges();
if (latteView->visibility()->mode() == Latte::Types::SideBar && !latteView->visibility()->isHidden()) {
if (latteView->visibility()->isSidebar() && !latteView->visibility()->isHidden()) {
latteView->visibility()->toggleHiddenState();
}
}

@ -464,7 +464,8 @@ void Positioner::immediateSyncGeometry()
int fixedScreen = m_view->onPrimary() ? latteCorona->screenPool()->primaryScreenId() : m_view->containment()->screen();
QList<Types::Visibility> ignoreModes({Latte::Types::AutoHide,
Latte::Types::SideBar});
Latte::Types::SideBar,
Latte::Types::SidebarAutoHide});
QList<Plasma::Types::Location> ignoreEdges({Plasma::Types::LeftEdge,
Plasma::Types::RightEdge});

@ -304,10 +304,11 @@ void PrimaryConfigView::instantUpdateAvailableScreenGeometry()
int currentScrId = m_latteView->positioner()->currentScreenId();
QList<Latte::Types::Visibility> ignoreModes{Latte::Types::SideBar};
QList<Latte::Types::Visibility> ignoreModes{Latte::Types::SideBar,Latte::Types::SidebarAutoHide};
if (m_latteView->visibility() && m_latteView->visibility()->mode() == Latte::Types::SideBar) {
if (m_latteView->visibility() && m_latteView->visibility()->isSidebar()) {
ignoreModes.removeAll(Latte::Types::SideBar);
ignoreModes.removeAll(Latte::Types::SidebarAutoHide);
}
m_availableScreenGeometry = m_corona->availableScreenRectWithCriteria(currentScrId, m_latteView->layout()->name(), ignoreModes, {}, false, true);

@ -44,6 +44,7 @@
//! view to be show. For example !compositing+kwin_edges+hide inteval<50ms
const int HIDEMINIMUMINTERVAL = 50;
namespace Latte {
namespace ViewPart {
@ -328,7 +329,23 @@ void VisibilityManager::setMode(Latte::Types::Visibility mode)
});
toggleHiddenState();
break;
case Types::SidebarAutoHide:
m_connections[base] = connect(this, &VisibilityManager::containsMouseChanged, this, [&]() {
if(!isHidden()){
raiseView(m_containsMouse);
}
});
m_connections[base] = connect(m_latteView, &Latte::View::inEditModeChanged, this, [&]() {
if (!m_latteView->inEditMode()) {
toggleHiddenState();
}
});
toggleHiddenState();
break;
default:
break;
}
@ -592,6 +609,11 @@ void VisibilityManager::setTimerHide(int msec)
emit timerHideChanged();
}
bool VisibilityManager::isSidebar() const
{
return m_mode == Latte::Types::SideBar || m_mode == Latte::Types::SidebarAutoHide;
}
bool VisibilityManager::supportsKWinEdges() const
{
return (m_edgeGhostWindow != nullptr);
@ -693,13 +715,17 @@ bool VisibilityManager::isValidMode() const
void VisibilityManager::toggleHiddenState()
{
if (!m_latteView->inEditMode()) {
if (m_mode == Latte::Types::SideBar) {
if (isSidebar()) {
if (m_blockHidingEvents.contains(Q_FUNC_INFO)) {
removeBlockHidingEvent(Q_FUNC_INFO);
}
if (m_isHidden) {
emit mustBeShown();
if(m_mode == Latte::Types::SidebarAutoHide) {
m_timerHide.start();
}
} else {
emit mustBeHide();
}
@ -907,7 +933,7 @@ void VisibilityManager::viewEventManager(QEvent *ev)
case QEvent::DragEnter:
m_dragEnter = true;
if (m_isHidden && m_mode != Latte::Types::SideBar) {
if (m_isHidden && !isSidebar()) {
emit mustBeShown();
}

@ -99,6 +99,8 @@ public:
int timerHide() const;
void setTimerHide(int msec);
bool isSidebar() const;
//! KWin Edges Support functions
bool enableKWinEdges() const;
void setEnableKWinEdges(bool enable);

@ -189,7 +189,8 @@ private:
Latte::Types::WindowsGoBelow,
Latte::Types::WindowsCanCover,
Latte::Types::WindowsAlwaysCover,
Latte::Types::SideBar
Latte::Types::SideBar,
Latte::Types::SidebarAutoHide
};
QMap<WindowId, WindowInfoWrap> m_windows;

@ -32,7 +32,9 @@ Item {
readonly property bool isActive: plasmoid.configuration.autoSizeEnabled
&& !root.containsOnlyPlasmaTasks
&& layouter.fillApplets<=0
&& latteView && latteView.visibility.mode !== LatteCore.Types.SideBar
&& latteView
&& latteView.visibility.mode !== LatteCore.Types.SideBar
&& latteView.visibility.mode !== LatteCore.Types.SidebarAutoHide
property int iconSize: -1 //it is not set, this is the default
readonly property bool inCalculatedIconSize: ((metrics.iconSize === sizer.iconSize) || (metrics.iconSize === metrics.maxIconSize))

@ -380,6 +380,9 @@ Window{
case LatteCore.Types.SideBar:
return "OnDemand SideBar";
break;
case LatteCore.Types.SidebarAutoHide:
return "AutoHide Sidebar";
break;
case LatteCore.Types.NormalWindow:
return "Normal Window";
break;

@ -54,6 +54,7 @@ public:
WindowsCanCover,
WindowsAlwaysCover,
SideBar,
SidebarAutoHide,
NormalWindow = 20
};
Q_ENUM(Visibility);

@ -90,7 +90,7 @@ PlasmaComponents.Page {
Layout.fillWidth: true
value: plasmoid.configuration.iconSize
from: 16
to: latteView.visibility.mode === LatteCore.Types.SideBar ? 512 : 256
to: (latteView.visibility.mode === LatteCore.Types.SideBar || latteView.visibility.mode === LatteCore.Types.SidebarAutoHide) ? 512 : 256
stepSize: dialog.advancedLevel || (plasmoid.configuration.iconSize % 8 !== 0) || dialog.viewIsPanel ? 1 : 8
wheelEnabled: false
@ -139,7 +139,7 @@ PlasmaComponents.Page {
Layout.fillWidth: true
value: plasmoid.configuration.proportionIconSize
from: 1.0
to: latteView.visibility.mode === LatteCore.Types.SideBar ? 25 : 12
to: (latteView.visibility.mode === LatteCore.Types.SideBar || latteView.visibility.mode === LatteCore.Types.SidebarAutoHide) ? 25 : 12
stepSize: 0.5
wheelEnabled: false

@ -478,6 +478,7 @@ PlasmaComponents.Page {
RowLayout{
id: showTimerRow
anchors.horizontalCenter: parent.horizontalCenter
enabled: latteView.visibility.mode !== LatteCore.Types.SidebarAutoHide
PlasmaComponents.Label {
Layout.leftMargin: Qt.application.layoutDirection === Qt.RightToLeft ? units.smallSpacing : 0
Layout.rightMargin: Qt.application.layoutDirection === Qt.RightToLeft ? 0 : units.smallSpacing

@ -140,10 +140,16 @@ LatteComponents.ComboBoxButton{
name: i18n("On Demand SideBar")
}
var sidebarAutoHide = {
pluginId: '9',
name: i18n("Auto Hide Sidebar")
}
actionsModel.append(windowsGoBelow);
actionsModel.append(windowsCanCover);
actionsModel.append(windowsAlwaysCover);
actionsModel.append(sideBar);
actionsModel.append(sidebarAutoHide);
}
}

Loading…
Cancel
Save