1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-27 15:21:40 +03:00

project has been cleaned

This commit is contained in:
Johan Smith Agudelo Rodriguez 2016-12-30 19:26:48 -05:00
parent 0b81244df6
commit f49ab516a4
5 changed files with 47 additions and 42 deletions

View File

@ -20,8 +20,8 @@
*/
#include "dockview.h"
#include "dockcorona.h"
#include "dockconfigview.h"
#include "dockcorona.h"
#include "visibilitymanager.h"
#include "../liblattedock/windowsystem.h"
@ -39,8 +39,7 @@
namespace Latte {
DockView::DockView(Plasma::Corona *corona, QScreen *targetScreen)
: PlasmaQuick::ContainmentView(corona),
m_corona(corona)
: PlasmaQuick::ContainmentView(corona)
{
setVisible(false);
setTitle(corona->kPackage().metadata().name());
@ -60,6 +59,10 @@ DockView::DockView(Plasma::Corona *corona, QScreen *targetScreen)
m_lockGeometry.setSingleShot(true);
m_lockGeometry.setInterval(700);
connect(this, SIGNAL(localDockGeometryChanged()), this, SLOT(updateAbsDockGeometry()));
connect(this, SIGNAL(xChanged(int)), this, SLOT(updateAbsDockGeometry()));
connect(this, SIGNAL(yChanged(int)), this, SLOT(updateAbsDockGeometry()));
connect(this, &DockView::containmentChanged
, this, [&]() {
if (!containment())
@ -107,7 +110,6 @@ void DockView::init()
rootContext()->setContextProperty(QStringLiteral("dock"), this);
engine()->rootContext()->setContextObject(new KLocalizedContext(this));
// FIXME: We need find a better solution
// engine()->rootContext()->setContextProperty(QStringLiteral("dock"), this);
setSource(corona()->kPackage().filePath("lattedockui"));
@ -120,7 +122,7 @@ void DockView::init()
qDebug() << "SOURCE:" << source();
//initialize();
initialize();
}
@ -164,6 +166,9 @@ void DockView::adaptToScreen(QScreen *screen)
else
m_maxLength = screen->size().width();
// KWindowSystem::setOnAllDesktops(winId(), true);
// KWindowSystem::setType(winId(), NET::Dock);
if (containment())
containment()->reactToScreenChange();
@ -172,7 +177,7 @@ void DockView::adaptToScreen(QScreen *screen)
void DockView::addNewDock()
{
DockCorona *corona = dynamic_cast<DockCorona *>(m_corona);
DockCorona *corona = qobject_cast<DockCorona *>(this->corona());
if (corona) {
corona->loadDefaultLayout();
@ -181,7 +186,7 @@ void DockView::addNewDock()
void DockView::removeDock()
{
DockCorona *corona = dynamic_cast<DockCorona *>(m_corona);
DockCorona *corona = qobject_cast<DockCorona *>(this->corona());
if (corona->containments().count() > 1) {
QAction *removeAct = containment()->actions()->action(QStringLiteral("remove"));
@ -270,6 +275,23 @@ void DockView::resizeWindow()
}
}
void DockView::setLocalDockGeometry(const QRect &geometry)
{
if (geometry == m_localDockGeometry) {
return;
}
m_localDockGeometry = geometry;
emit localDockGeometryChanged();
}
void DockView::updateAbsDockGeometry()
{
QRect absoluteGeometry {x() + m_localDockGeometry.x(), y() + m_localDockGeometry.y(), m_localDockGeometry.width(), m_localDockGeometry.height()};
m_visibility->updateDockGeometry(absoluteGeometry);
}
inline void DockView::updateDockPosition()
{
if (!containment())
@ -335,7 +357,7 @@ bool DockView::compositing() const
return WindowSystem::self().compositingActive();
}
/*Candil::VisibilityManager *NowDockView::visibility()
/*Candil::VisibilityManager *DockView::visibility()
{
return m_visibility.data();
}*/
@ -408,16 +430,14 @@ void DockView::setMaskArea(QRect area)
emit maskAreaChanged();
}
/*Dock::Alignment NowDockView::alignment() const
/*Dock::Alignment DockView::alignment() const
{
return m_alignment;
}
void NowDockView::setAlignment(Dock::Alignment align)
void DockView::setAlignment(Dock::Alignment align)
{
if (m_alignment == align)
return;
m_alignment = align;
emit alignmentChanged();
}
@ -464,11 +484,10 @@ bool DockView::event(QEvent *e)
return ContainmentView::event(e);
}
/*void NowDockView::showEvent(QShowEvent *ev)
/*void DockView::showEvent(QShowEvent *ev)
{
KWindowSystem::setType(winId(), NET::Dock);
KWindowSystem::setOnAllDesktops(winId(), true);
//QQuickWindow::showEvent(ev);
ContainmentView::showEvent(ev);
}*/
@ -500,12 +519,12 @@ QPointF DockView::positionAdjustedForContainment(const QPointF &point) const
QList<int> DockView::freeEdges() const
{
QList<Plasma::Types::Location> edges = m_corona->freeEdges(containment()->screen());
QList<Plasma::Types::Location> edges = corona()->freeEdges(containment()->screen());
QList<int> edgesInt;
foreach (Plasma::Types::Location edge, edges) {
edgesInt.append((int)edge);
edgesInt.append(static_cast<int>(edge));
}
return edgesInt;
@ -549,8 +568,5 @@ void DockView::restoreConfig()
}
}
//!END SLOTS
//!END namespace

View File

@ -107,7 +107,7 @@ public slots:
Q_INVOKABLE QList<int> freeEdges() const;
Q_INVOKABLE void initialize();
Q_INVOKABLE void removeDock();
Q_INVOKABLE void setLocalDockGeometry(QRect geometry);
Q_INVOKABLE void setLocalDockGeometry(const QRect &geometry);
void resizeWindow();
void restoreConfig();
void saveConfig();
@ -156,7 +156,6 @@ private:
QTimer m_timerGeometry;
QTimer m_lockGeometry;
Plasma::Theme *theme{nullptr};
Plasma::Corona *m_corona;
QPointer<VisibilityManager> m_visibility;

View File

@ -1,11 +1,10 @@
#include "visibilitymanager.h"
#include "visibilitymanager_p.h"
#include "plasmaquick/containmentview.h"
#include "abstractwindowinterface.h"
#include "windowinfowrap.h"
#include "dockview.h"
#include "../liblattedock/extras.h"
namespace Latte {
//! BEGIN: VisiblityManagerPrivate implementation
@ -63,7 +62,7 @@ inline void VisibilityManagerPrivate::setMode(Dock::Visibility mode)
raiseDock(true);
}
break;
case Dock::AutoHide: {
raiseDock(!containsMouse);
}
@ -176,7 +175,7 @@ void VisibilityManagerPrivate::dodgeActive(WId wid)
if (!winfo.isValid() || !winfo.isOnCurrentDesktop() || winfo.isMinimized())
return;
raiseDock(!intersects(winfo));
}
@ -189,7 +188,7 @@ void VisibilityManagerPrivate::dodgeMaximized(WId wid)
if (!winfo.isValid() || !winfo.isOnCurrentDesktop() || winfo.isMinimized())
return;
raiseDock(!winfo.isMaximized());
}
@ -271,25 +270,16 @@ bool VisibilityManagerPrivate::event(QEvent *ev)
containsMouse = true;
emit q->containsMouseChanged();
<<< <<< < HEAD
raiseDock(true);
== == == =
if (mode == Dock::AutoHide)
raiseDock(true);
>>> >>> > code formatted
if (mode == Dock::AutoHide)
raiseDock(true);
} else if (ev->type() == QEvent::Leave && containsMouse) {
containsMouse = false;
emit q->containsMouseChanged();
if (mode == Dock::AutoHide)
raiseDock(false);
<<< <<< <HEAD
== == == =
>>>>>>> code formatted
} else if (ev->type() == QEvent::Show) {
wm->setDockDefaultFlags();
}

View File

@ -8,7 +8,7 @@ WindowSystem::WindowSystem(QObject *parent) :
QObject(parent)
{
if (KWindowSystem::isPlatformWayland()) {
} else {
compositingChangedProxy(KWindowSystem::self()->compositingActive());
connect(KWindowSystem::self(), SIGNAL(compositingChanged(bool)), this, SLOT(compositingChanged(bool)));
@ -35,7 +35,7 @@ void WindowSystem::compositingChangedProxy(bool enable)
{
if (m_compositing == enable)
return;
m_compositing = enable;
emit compositingChanged();
}

View File

@ -14,7 +14,7 @@ public:
explicit WindowSystem(QObject *parent = Q_NULLPTR);
~WindowSystem();
static WindowSystem &self();
static WindowSystem &self();
bool compositingActive() const;