mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-28 03:21:38 +03:00
project has been cleaned
This commit is contained in:
parent
0b81244df6
commit
f49ab516a4
@ -20,8 +20,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dockview.h"
|
#include "dockview.h"
|
||||||
#include "dockcorona.h"
|
|
||||||
#include "dockconfigview.h"
|
#include "dockconfigview.h"
|
||||||
|
#include "dockcorona.h"
|
||||||
#include "visibilitymanager.h"
|
#include "visibilitymanager.h"
|
||||||
#include "../liblattedock/windowsystem.h"
|
#include "../liblattedock/windowsystem.h"
|
||||||
|
|
||||||
@ -39,8 +39,7 @@
|
|||||||
namespace Latte {
|
namespace Latte {
|
||||||
|
|
||||||
DockView::DockView(Plasma::Corona *corona, QScreen *targetScreen)
|
DockView::DockView(Plasma::Corona *corona, QScreen *targetScreen)
|
||||||
: PlasmaQuick::ContainmentView(corona),
|
: PlasmaQuick::ContainmentView(corona)
|
||||||
m_corona(corona)
|
|
||||||
{
|
{
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
setTitle(corona->kPackage().metadata().name());
|
setTitle(corona->kPackage().metadata().name());
|
||||||
@ -60,6 +59,10 @@ DockView::DockView(Plasma::Corona *corona, QScreen *targetScreen)
|
|||||||
m_lockGeometry.setSingleShot(true);
|
m_lockGeometry.setSingleShot(true);
|
||||||
m_lockGeometry.setInterval(700);
|
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
|
connect(this, &DockView::containmentChanged
|
||||||
, this, [&]() {
|
, this, [&]() {
|
||||||
if (!containment())
|
if (!containment())
|
||||||
@ -107,7 +110,6 @@ void DockView::init()
|
|||||||
rootContext()->setContextProperty(QStringLiteral("dock"), this);
|
rootContext()->setContextProperty(QStringLiteral("dock"), this);
|
||||||
engine()->rootContext()->setContextObject(new KLocalizedContext(this));
|
engine()->rootContext()->setContextObject(new KLocalizedContext(this));
|
||||||
|
|
||||||
// FIXME: We need find a better solution
|
|
||||||
// engine()->rootContext()->setContextProperty(QStringLiteral("dock"), this);
|
// engine()->rootContext()->setContextProperty(QStringLiteral("dock"), this);
|
||||||
setSource(corona()->kPackage().filePath("lattedockui"));
|
setSource(corona()->kPackage().filePath("lattedockui"));
|
||||||
|
|
||||||
@ -120,7 +122,7 @@ void DockView::init()
|
|||||||
|
|
||||||
qDebug() << "SOURCE:" << source();
|
qDebug() << "SOURCE:" << source();
|
||||||
|
|
||||||
//initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -164,6 +166,9 @@ void DockView::adaptToScreen(QScreen *screen)
|
|||||||
else
|
else
|
||||||
m_maxLength = screen->size().width();
|
m_maxLength = screen->size().width();
|
||||||
|
|
||||||
|
// KWindowSystem::setOnAllDesktops(winId(), true);
|
||||||
|
// KWindowSystem::setType(winId(), NET::Dock);
|
||||||
|
|
||||||
if (containment())
|
if (containment())
|
||||||
containment()->reactToScreenChange();
|
containment()->reactToScreenChange();
|
||||||
|
|
||||||
@ -172,7 +177,7 @@ void DockView::adaptToScreen(QScreen *screen)
|
|||||||
|
|
||||||
void DockView::addNewDock()
|
void DockView::addNewDock()
|
||||||
{
|
{
|
||||||
DockCorona *corona = dynamic_cast<DockCorona *>(m_corona);
|
DockCorona *corona = qobject_cast<DockCorona *>(this->corona());
|
||||||
|
|
||||||
if (corona) {
|
if (corona) {
|
||||||
corona->loadDefaultLayout();
|
corona->loadDefaultLayout();
|
||||||
@ -181,7 +186,7 @@ void DockView::addNewDock()
|
|||||||
|
|
||||||
void DockView::removeDock()
|
void DockView::removeDock()
|
||||||
{
|
{
|
||||||
DockCorona *corona = dynamic_cast<DockCorona *>(m_corona);
|
DockCorona *corona = qobject_cast<DockCorona *>(this->corona());
|
||||||
|
|
||||||
if (corona->containments().count() > 1) {
|
if (corona->containments().count() > 1) {
|
||||||
QAction *removeAct = containment()->actions()->action(QStringLiteral("remove"));
|
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()
|
inline void DockView::updateDockPosition()
|
||||||
{
|
{
|
||||||
if (!containment())
|
if (!containment())
|
||||||
@ -335,7 +357,7 @@ bool DockView::compositing() const
|
|||||||
return WindowSystem::self().compositingActive();
|
return WindowSystem::self().compositingActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Candil::VisibilityManager *NowDockView::visibility()
|
/*Candil::VisibilityManager *DockView::visibility()
|
||||||
{
|
{
|
||||||
return m_visibility.data();
|
return m_visibility.data();
|
||||||
}*/
|
}*/
|
||||||
@ -408,16 +430,14 @@ void DockView::setMaskArea(QRect area)
|
|||||||
emit maskAreaChanged();
|
emit maskAreaChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Dock::Alignment NowDockView::alignment() const
|
/*Dock::Alignment DockView::alignment() const
|
||||||
{
|
{
|
||||||
return m_alignment;
|
return m_alignment;
|
||||||
}
|
}
|
||||||
|
void DockView::setAlignment(Dock::Alignment align)
|
||||||
void NowDockView::setAlignment(Dock::Alignment align)
|
|
||||||
{
|
{
|
||||||
if (m_alignment == align)
|
if (m_alignment == align)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_alignment = align;
|
m_alignment = align;
|
||||||
emit alignmentChanged();
|
emit alignmentChanged();
|
||||||
}
|
}
|
||||||
@ -464,11 +484,10 @@ bool DockView::event(QEvent *e)
|
|||||||
return ContainmentView::event(e);
|
return ContainmentView::event(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*void NowDockView::showEvent(QShowEvent *ev)
|
/*void DockView::showEvent(QShowEvent *ev)
|
||||||
{
|
{
|
||||||
KWindowSystem::setType(winId(), NET::Dock);
|
KWindowSystem::setType(winId(), NET::Dock);
|
||||||
KWindowSystem::setOnAllDesktops(winId(), true);
|
KWindowSystem::setOnAllDesktops(winId(), true);
|
||||||
|
|
||||||
//QQuickWindow::showEvent(ev);
|
//QQuickWindow::showEvent(ev);
|
||||||
ContainmentView::showEvent(ev);
|
ContainmentView::showEvent(ev);
|
||||||
}*/
|
}*/
|
||||||
@ -500,12 +519,12 @@ QPointF DockView::positionAdjustedForContainment(const QPointF &point) const
|
|||||||
|
|
||||||
QList<int> DockView::freeEdges() 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;
|
QList<int> edgesInt;
|
||||||
|
|
||||||
foreach (Plasma::Types::Location edge, edges) {
|
foreach (Plasma::Types::Location edge, edges) {
|
||||||
edgesInt.append((int)edge);
|
edgesInt.append(static_cast<int>(edge));
|
||||||
}
|
}
|
||||||
|
|
||||||
return edgesInt;
|
return edgesInt;
|
||||||
@ -549,8 +568,5 @@ void DockView::restoreConfig()
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//!END SLOTS
|
//!END SLOTS
|
||||||
|
|
||||||
|
|
||||||
//!END namespace
|
//!END namespace
|
||||||
|
@ -107,7 +107,7 @@ public slots:
|
|||||||
Q_INVOKABLE QList<int> freeEdges() const;
|
Q_INVOKABLE QList<int> freeEdges() const;
|
||||||
Q_INVOKABLE void initialize();
|
Q_INVOKABLE void initialize();
|
||||||
Q_INVOKABLE void removeDock();
|
Q_INVOKABLE void removeDock();
|
||||||
Q_INVOKABLE void setLocalDockGeometry(QRect geometry);
|
Q_INVOKABLE void setLocalDockGeometry(const QRect &geometry);
|
||||||
void resizeWindow();
|
void resizeWindow();
|
||||||
void restoreConfig();
|
void restoreConfig();
|
||||||
void saveConfig();
|
void saveConfig();
|
||||||
@ -156,7 +156,6 @@ private:
|
|||||||
QTimer m_timerGeometry;
|
QTimer m_timerGeometry;
|
||||||
QTimer m_lockGeometry;
|
QTimer m_lockGeometry;
|
||||||
Plasma::Theme *theme{nullptr};
|
Plasma::Theme *theme{nullptr};
|
||||||
Plasma::Corona *m_corona;
|
|
||||||
|
|
||||||
QPointer<VisibilityManager> m_visibility;
|
QPointer<VisibilityManager> m_visibility;
|
||||||
|
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
#include "visibilitymanager.h"
|
#include "visibilitymanager.h"
|
||||||
#include "visibilitymanager_p.h"
|
#include "visibilitymanager_p.h"
|
||||||
#include "plasmaquick/containmentview.h"
|
|
||||||
#include "abstractwindowinterface.h"
|
|
||||||
#include "windowinfowrap.h"
|
#include "windowinfowrap.h"
|
||||||
#include "dockview.h"
|
#include "dockview.h"
|
||||||
#include "../liblattedock/extras.h"
|
#include "../liblattedock/extras.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Latte {
|
namespace Latte {
|
||||||
|
|
||||||
//! BEGIN: VisiblityManagerPrivate implementation
|
//! BEGIN: VisiblityManagerPrivate implementation
|
||||||
@ -63,7 +62,7 @@ inline void VisibilityManagerPrivate::setMode(Dock::Visibility mode)
|
|||||||
raiseDock(true);
|
raiseDock(true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Dock::AutoHide: {
|
case Dock::AutoHide: {
|
||||||
raiseDock(!containsMouse);
|
raiseDock(!containsMouse);
|
||||||
}
|
}
|
||||||
@ -176,7 +175,7 @@ void VisibilityManagerPrivate::dodgeActive(WId wid)
|
|||||||
|
|
||||||
if (!winfo.isValid() || !winfo.isOnCurrentDesktop() || winfo.isMinimized())
|
if (!winfo.isValid() || !winfo.isOnCurrentDesktop() || winfo.isMinimized())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
raiseDock(!intersects(winfo));
|
raiseDock(!intersects(winfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +188,7 @@ void VisibilityManagerPrivate::dodgeMaximized(WId wid)
|
|||||||
|
|
||||||
if (!winfo.isValid() || !winfo.isOnCurrentDesktop() || winfo.isMinimized())
|
if (!winfo.isValid() || !winfo.isOnCurrentDesktop() || winfo.isMinimized())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
raiseDock(!winfo.isMaximized());
|
raiseDock(!winfo.isMaximized());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,25 +270,16 @@ bool VisibilityManagerPrivate::event(QEvent *ev)
|
|||||||
containsMouse = true;
|
containsMouse = true;
|
||||||
emit q->containsMouseChanged();
|
emit q->containsMouseChanged();
|
||||||
|
|
||||||
<<< <<< < HEAD
|
if (mode == Dock::AutoHide)
|
||||||
raiseDock(true);
|
raiseDock(true);
|
||||||
== == == =
|
|
||||||
|
|
||||||
if (mode == Dock::AutoHide)
|
|
||||||
raiseDock(true);
|
|
||||||
|
|
||||||
>>> >>> > code formatted
|
|
||||||
} else if (ev->type() == QEvent::Leave && containsMouse) {
|
} else if (ev->type() == QEvent::Leave && containsMouse) {
|
||||||
containsMouse = false;
|
containsMouse = false;
|
||||||
emit q->containsMouseChanged();
|
emit q->containsMouseChanged();
|
||||||
|
|
||||||
if (mode == Dock::AutoHide)
|
if (mode == Dock::AutoHide)
|
||||||
raiseDock(false);
|
raiseDock(false);
|
||||||
|
|
||||||
<<< <<< <HEAD
|
|
||||||
== == == =
|
|
||||||
|
|
||||||
>>>>>>> code formatted
|
|
||||||
} else if (ev->type() == QEvent::Show) {
|
} else if (ev->type() == QEvent::Show) {
|
||||||
wm->setDockDefaultFlags();
|
wm->setDockDefaultFlags();
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ WindowSystem::WindowSystem(QObject *parent) :
|
|||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
if (KWindowSystem::isPlatformWayland()) {
|
if (KWindowSystem::isPlatformWayland()) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
compositingChangedProxy(KWindowSystem::self()->compositingActive());
|
compositingChangedProxy(KWindowSystem::self()->compositingActive());
|
||||||
connect(KWindowSystem::self(), SIGNAL(compositingChanged(bool)), this, SLOT(compositingChanged(bool)));
|
connect(KWindowSystem::self(), SIGNAL(compositingChanged(bool)), this, SLOT(compositingChanged(bool)));
|
||||||
@ -35,7 +35,7 @@ void WindowSystem::compositingChangedProxy(bool enable)
|
|||||||
{
|
{
|
||||||
if (m_compositing == enable)
|
if (m_compositing == enable)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_compositing = enable;
|
m_compositing = enable;
|
||||||
emit compositingChanged();
|
emit compositingChanged();
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ public:
|
|||||||
explicit WindowSystem(QObject *parent = Q_NULLPTR);
|
explicit WindowSystem(QObject *parent = Q_NULLPTR);
|
||||||
~WindowSystem();
|
~WindowSystem();
|
||||||
|
|
||||||
static WindowSystem &self();
|
static WindowSystem &self();
|
||||||
|
|
||||||
bool compositingActive() const;
|
bool compositingActive() const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user