1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-24 17:33:50 +03:00

code formatted

This commit is contained in:
Johan Smith Agudelo Rodriguez 2016-12-30 02:24:04 -05:00 committed by Michail Vourlakos
parent 402583865b
commit 530c489ef9
3 changed files with 78 additions and 79 deletions

View File

@ -16,10 +16,10 @@ AbstractWindowInterface::AbstractWindowInterface(QQuickWindow *const view, QObje
AbstractWindowInterface::~AbstractWindowInterface()
{
}
AbstractWindowInterface *AbstractWindowInterface::getInstance(QQuickWindow * const view, QObject *parent)
AbstractWindowInterface *AbstractWindowInterface::getInstance(QQuickWindow *const view, QObject *parent)
{
if (KWindowSystem::isPlatformWayland()) {
//! TODO: WaylandWindowInterface

View File

@ -32,7 +32,7 @@ inline void VisibilityManagerPrivate::setMode(Dock::Visibility mode)
{
if (this->mode == mode)
return;
// clear mode
if (this->mode == Dock::AlwaysVisible)
wm->removeDockStruts();
@ -48,53 +48,52 @@ inline void VisibilityManagerPrivate::setMode(Dock::Visibility mode)
this->mode = mode;
switch (this->mode) {
case Dock::AlwaysVisible:
{
wm->setDockStruts(dockRect, view->location());
raiseDock(true);
}
break;
case Dock::AutoHide:
{
raiseDock(true);
}
break;
case Dock::DodgeActive:
{
connections[0] = connect(wm.get(), &AbstractWindowInterface::activeWindowChanged
, this, &VisibilityManagerPrivate::dodgeActive);
connections[1] = connect(wm.get(), &AbstractWindowInterface::windowChanged
, this, &VisibilityManagerPrivate::dodgeActive);
dodgeActive(wm->activeWindow());
}
break;
case Dock::DodgeMaximized:
{
connections[0] = connect(wm.get(), &AbstractWindowInterface::windowChanged
, this, &VisibilityManagerPrivate::dodgeMaximized);
}
break;
case Dock::DodgeAllWindows:
{
for(const auto & wid : wm->windows()) {
windows.insert({wid, wm->requestInfo(wid)});
case Dock::AlwaysVisible: {
wm->setDockStruts(dockRect, view->location());
raiseDock(true);
}
break;
connections[0] = connect(wm.get(), &AbstractWindowInterface::windowChanged
, this, &VisibilityManagerPrivate::dodgeWindows);
case Dock::AutoHide: {
raiseDock(true);
}
break;
connections[1] = connect(wm.get(), &AbstractWindowInterface::windowRemoved
, this, [&](WId wid) {
case Dock::DodgeActive: {
connections[0] = connect(wm.get(), &AbstractWindowInterface::activeWindowChanged
, this, &VisibilityManagerPrivate::dodgeActive);
connections[1] = connect(wm.get(), &AbstractWindowInterface::windowChanged
, this, &VisibilityManagerPrivate::dodgeActive);
dodgeActive(wm->activeWindow());
}
break;
case Dock::DodgeMaximized: {
connections[0] = connect(wm.get(), &AbstractWindowInterface::windowChanged
, this, &VisibilityManagerPrivate::dodgeMaximized);
}
break;
case Dock::DodgeAllWindows: {
for (const auto &wid : wm->windows()) {
windows.insert({wid, wm->requestInfo(wid)});
}
connections[0] = connect(wm.get(), &AbstractWindowInterface::windowChanged
, this, &VisibilityManagerPrivate::dodgeWindows);
connections[1] = connect(wm.get(), &AbstractWindowInterface::windowRemoved
, this, [&](WId wid) {
windows.erase(wid);
timerCheckWindows.start();
});
connections[2] = connect(wm.get(), &AbstractWindowInterface::windowAdded
, this, [&](WId wid) {
});
connections[2] = connect(wm.get(), &AbstractWindowInterface::windowAdded
, this, [&](WId wid) {
windows.insert({wid, wm->requestInfo(wid)});
timerCheckWindows.start();
});
}
});
}
}
saveConfig();
@ -104,7 +103,7 @@ inline void VisibilityManagerPrivate::setIsHidden(bool isHidden)
{
if (this->isHidden == isHidden)
return;
this->isHidden = isHidden;
emit q->isHiddenChanged();
}
@ -145,7 +144,7 @@ inline void VisibilityManagerPrivate::raiseDock(bool raise)
inline void VisibilityManagerPrivate::setDockRect(const QRect &dockRect)
{
if (!view->containment() || this->dockRect == dockRect)
if (!view->containment() || this->dockRect == dockRect)
return;
this->dockRect = dockRect;
@ -159,12 +158,12 @@ void VisibilityManagerPrivate::dodgeActive(WId wid)
{
if (wid != wm->activeWindow())
return;
auto winfo = wm->requestInfo(wid);
if (!winfo.isValid() || !winfo.isOnCurrentDesktop() || winfo.isMinimized())
return;
raiseDock(intersects(winfo));
}
@ -174,7 +173,7 @@ void VisibilityManagerPrivate::dodgeMaximized(WId wid)
if (!winfo.isValid() || !winfo.isOnCurrentDesktop() || winfo.isMinimized())
return;
if (winfo.isMaximized())
raiseDock(false);
else
@ -187,7 +186,7 @@ void VisibilityManagerPrivate::dodgeWindows(WId wid)
if (!winfo.isValid() || !winfo.isOnCurrentDesktop() || winfo.isMinimized())
return;
if (intersects(winfo))
raiseDock(false);
else
@ -209,11 +208,11 @@ void VisibilityManagerPrivate::checkAllWindows()
} else if (std::get<1>(winfo).isMinimized()) {
continue;
} else if (mode == Dock::DodgeMaximized) {
if (std::get<1>(winfo).isMaximized())
raise = false;
raise = false;
continue;
} else if (intersects(std::get<1>(winfo))) {
raise = false;
@ -246,13 +245,13 @@ inline void VisibilityManagerPrivate::saveConfig()
inline void VisibilityManagerPrivate::restoreConfig()
{
if (!view->containment())
return;
auto config = view->containment()->config();
mode = static_cast<Dock::Visibility>(config.readEntry("visibility", static_cast<int>(Dock::DodgeActive)));
timerShow.setInterval(config.readEntry("timerShow", 0));
timerHide.setInterval(config.readEntry("timerHide", 0));
return;
auto config = view->containment()->config();
mode = static_cast<Dock::Visibility>(config.readEntry("visibility", static_cast<int>(Dock::DodgeActive)));
timerShow.setInterval(config.readEntry("timerShow", 0));
timerHide.setInterval(config.readEntry("timerHide", 0));
}
bool VisibilityManagerPrivate::event(QEvent *ev)

View File

@ -1,6 +1,6 @@
#include "windowinfowrap.h"
namespace Latte {
namespace Latte {
WindowInfoWrap::WindowInfoWrap()
: m_isValid(false)
@ -33,97 +33,97 @@ WindowInfoWrap &WindowInfoWrap::operator=(const WindowInfoWrap &rhs)
return *this;
}
bool WindowInfoWrap::operator==(const WindowInfoWrap &rhs) const
bool WindowInfoWrap::operator==(const WindowInfoWrap &rhs) const
{
return m_wid == rhs.m_wid;
}
bool WindowInfoWrap::operator<(const WindowInfoWrap &rhs) const
bool WindowInfoWrap::operator<(const WindowInfoWrap &rhs) const
{
return m_wid < rhs.m_wid;
}
bool WindowInfoWrap::operator>(const WindowInfoWrap &rhs) const
bool WindowInfoWrap::operator>(const WindowInfoWrap &rhs) const
{
return m_wid > rhs.m_wid;
}
bool WindowInfoWrap::isValid() const
bool WindowInfoWrap::isValid() const
{
return m_isValid;
}
void WindowInfoWrap::setIsValid(bool isValid)
void WindowInfoWrap::setIsValid(bool isValid)
{
m_isValid = isValid;
}
bool WindowInfoWrap::isActive() const
bool WindowInfoWrap::isActive() const
{
return m_isActive;
}
void WindowInfoWrap::setIsActive(bool isActive)
void WindowInfoWrap::setIsActive(bool isActive)
{
m_isActive = isActive;
}
bool WindowInfoWrap::isMinimized() const
bool WindowInfoWrap::isMinimized() const
{
return m_isMinimized;
}
void WindowInfoWrap::setIsMinimized(bool isMinimized)
void WindowInfoWrap::setIsMinimized(bool isMinimized)
{
m_isMinimized = isMinimized;
}
bool WindowInfoWrap::isMaximized() const
bool WindowInfoWrap::isMaximized() const
{
return m_isMaximized;
}
void WindowInfoWrap::setIsMaximized(bool isMaximized)
void WindowInfoWrap::setIsMaximized(bool isMaximized)
{
m_isMaximized = isMaximized;
}
bool WindowInfoWrap::isFullscreen() const
bool WindowInfoWrap::isFullscreen() const
{
return m_isFullscreen;
}
void WindowInfoWrap::setIsFullscreen(bool isFullscreen)
void WindowInfoWrap::setIsFullscreen(bool isFullscreen)
{
m_isFullscreen = isFullscreen;
}
bool WindowInfoWrap::isOnCurrentDesktop() const
bool WindowInfoWrap::isOnCurrentDesktop() const
{
return m_isOnCurrentDesktop;
}
void WindowInfoWrap::setIsOnCurrentDesktop(bool isOnCurrentDesktop)
void WindowInfoWrap::setIsOnCurrentDesktop(bool isOnCurrentDesktop)
{
m_isOnCurrentDesktop = isOnCurrentDesktop;
}
QRect WindowInfoWrap::geometry() const
QRect WindowInfoWrap::geometry() const
{
return m_geometry;
}
void WindowInfoWrap::setGeometry(const QRect &geometry)
void WindowInfoWrap::setGeometry(const QRect &geometry)
{
m_geometry = geometry;
}
WId WindowInfoWrap::wid() const
WId WindowInfoWrap::wid() const
{
return m_wid;
}
void WindowInfoWrap::setWid(WId wid)
void WindowInfoWrap::setWid(WId wid)
{
m_wid = wid;
}