Merge branch 'master'

Conflicts:
	app/nowdockcorona.cpp
	app/visibilitymanager.cpp
	app/visibilitymanager.h
	app/xwindowinterface.cpp
v0.6
audoban 8 years ago
commit f029d2e281

@ -17,6 +17,7 @@ set(lattedock-app_SRCS
windowinfowrap.cpp windowinfowrap.cpp
abstractwindowinterface.cpp abstractwindowinterface.cpp
xwindowinterface.cpp xwindowinterface.cpp
windowinfowrap.cpp
visibilitymanager.cpp visibilitymanager.cpp
nowdockconfigview.cpp nowdockconfigview.cpp
nowdockview.cpp nowdockview.cpp

@ -19,6 +19,7 @@
#include "nowdockconfigview.h" #include "nowdockconfigview.h"
#include "nowdockview.h" #include "nowdockview.h"
#include "nowdockcorona.h"
#include <QQuickItem> #include <QQuickItem>
#include <QQmlContext> #include <QQmlContext>
@ -54,6 +55,13 @@ NowDockConfigView::NowDockConfigView(Plasma::Containment *containment, NowDockVi
}); });
connect(containment, &Plasma::Containment::immutabilityChanged, this, &NowDockConfigView::immutabilityChanged); connect(containment, &Plasma::Containment::immutabilityChanged, this, &NowDockConfigView::immutabilityChanged);
NowDockCorona *corona = dynamic_cast<NowDockCorona *>(m_containment->corona());
if (corona) {
connect(corona, &NowDockCorona::configurationShown, this, &NowDockConfigView::configurationShown);
}
/* connect(containment, &Plasma::Containment::immutabilityChanged /* connect(containment, &Plasma::Containment::immutabilityChanged
, [&](Plasma::Types::ImmutabilityType type) { , [&](Plasma::Types::ImmutabilityType type) {
if (type != Plasma::Types::Mutable && this && isVisible()) if (type != Plasma::Types::Mutable && this && isVisible())
@ -179,7 +187,16 @@ void NowDockConfigView::showEvent(QShowEvent *ev)
// m_dockView->visibility()->showImmediately(); // m_dockView->visibility()->showImmediately();
m_screenSyncTimer.start(); m_screenSyncTimer.start();
m_deleterTimer.stop(); m_deleterTimer.stop();
ConfigView::showEvent(ev); ConfigView::showEvent(ev);
//trigger showing configuration window through corona
//in order to hide all alternative configuration windows
NowDockCorona *corona = dynamic_cast<NowDockCorona *>(m_containment->corona());
if (corona) {
emit corona->configurationShown(this);
}
} }
void NowDockConfigView::hideEvent(QHideEvent *ev) void NowDockConfigView::hideEvent(QHideEvent *ev)
@ -209,6 +226,13 @@ void NowDockConfigView::focusOutEvent(QFocusEvent *ev)
// hide(); // hide();
} }
void NowDockConfigView::configurationShown(PlasmaQuick::ConfigView *configView)
{
if ((configView != this) && isVisible()) {
hide();
}
}
void NowDockConfigView::immutabilityChanged(Plasma::Types::ImmutabilityType type) void NowDockConfigView::immutabilityChanged(Plasma::Types::ImmutabilityType type)
{ {
if (type != Plasma::Types::Mutable && isVisible()) { if (type != Plasma::Types::Mutable && isVisible()) {

@ -58,6 +58,7 @@ protected:
private Q_SLOTS: private Q_SLOTS:
void immutabilityChanged(Plasma::Types::ImmutabilityType type); void immutabilityChanged(Plasma::Types::ImmutabilityType type);
void configurationShown(PlasmaQuick::ConfigView *configView);
private: private:
Plasma::Containment *m_containment{nullptr}; Plasma::Containment *m_containment{nullptr};

@ -121,14 +121,35 @@ QRect NowDockCorona::availableScreenRect(int id) const
return qGuiApp->primaryScreen()->availableGeometry(); return qGuiApp->primaryScreen()->availableGeometry();
} }
int NowDockCorona::primaryScreenId() const
{
const auto screens = qGuiApp->screens();
int id = -1;
for (int i = 0; i < screens.size(); ++i) {
auto *scr = screens.at(i);
if (scr == qGuiApp->primaryScreen()) {
id = i;
break;
}
}
return id;
}
QList<Plasma::Types::Location> NowDockCorona::freeEdges(int screen) const QList<Plasma::Types::Location> NowDockCorona::freeEdges(int screen) const
{ {
using Plasma::Types; using Plasma::Types;
QList<Types::Location> edges{Types::TopEdge, Types::BottomEdge QList<Types::Location> edges{Types::BottomEdge, Types::LeftEdge,
, Types::LeftEdge, Types::RightEdge}; Types::TopEdge, Types::RightEdge};
//when screen=-1 is passed then the primaryScreenid is used
int fixedScreen = (screen == -1) ? primaryScreenId() : screen;
for (const NowDockView *cont : m_containments) { for (const NowDockView *cont : m_containments) {
if (cont && cont->containment()->screen() == screen) if (cont && cont->containment()->screen() == fixedScreen)
edges.removeOne(cont->location()); edges.removeOne(cont->location());
} }
@ -137,16 +158,10 @@ QList<Plasma::Types::Location> NowDockCorona::freeEdges(int screen) const
int NowDockCorona::screenForContainment(const Plasma::Containment *containment) const int NowDockCorona::screenForContainment(const Plasma::Containment *containment) const
{ {
return 0;
while (const auto *parentCont = qobject_cast<const Plasma::Applet *>(containment->parent())) {
if (parentCont->isContainment())
containment = qobject_cast<const Plasma::Containment *>(parentCont);
}
for (auto *view : m_containments) { for (auto *view : m_containments) {
if (view && view->containment() == containment) if (view && view->containment() && view->containment()->id() == containment->id())
return containment->screen(); if (view->screen())
return qGuiApp->screens().indexOf(view->screen());
} }
return -1; return -1;
@ -162,8 +177,8 @@ void NowDockCorona::addDock(Plasma::Containment *containment)
// the system tray is a containment that behaves as an applet // the system tray is a containment that behaves as an applet
// so a dockview shouldnt be created for it // so a dockview shouldnt be created for it
KPluginMetaData metadata = containment->kPackage().metadata(); KPluginMetaData metadata = containment->kPackage().metadata();
if (metadata.pluginId() == "org.kde.plasma.systemtray") { if (metadata.pluginId() == "org.kde.plasma.private.systemtray") {
return; return;
} }
@ -204,29 +219,15 @@ void NowDockCorona::loadDefaultLayout()
auto config = defaultContainment->config(); auto config = defaultContainment->config();
defaultContainment->restore(config); defaultContainment->restore(config);
switch (containments().size()) { QList<Plasma::Types::Location> edges = freeEdges(defaultContainment->screen());
case 1:
defaultContainment->setLocation(Plasma::Types::LeftEdge); if (edges.count() > 0) {
break; defaultContainment->setLocation(edges.at(0));
} else {
case 2: defaultContainment->setLocation(Plasma::Types::BottomEdge);
defaultContainment->setLocation(Plasma::Types::RightEdge);
break;
case 3:
defaultContainment->setLocation(Plasma::Types::TopEdge);
break;
default:
defaultContainment->setLocation(Plasma::Types::BottomEdge);
break;
} }
//config.writeEntry("dock", "initial");
//config.writeEntry("alignment", (int)Dock::Center);
//config.deleteEntry("wallpaperplugin");
defaultContainment->updateConstraints(Plasma::Types::StartupCompletedConstraint); defaultContainment->updateConstraints(Plasma::Types::StartupCompletedConstraint);
defaultContainment->save(config); defaultContainment->save(config);
requestConfigSync(); requestConfigSync();

@ -55,9 +55,13 @@ public:
public slots: public slots:
void loadDefaultLayout() override; void loadDefaultLayout() override;
signals:
void configurationShown(PlasmaQuick::ConfigView *configView);
private: private:
void qmlRegisterTypes() const; void qmlRegisterTypes() const;
int primaryScreenId() const;
std::vector<NowDockView *> m_containments; std::vector<NowDockView *> m_containments;
}; };

@ -72,6 +72,10 @@ NowDockView::NowDockView(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, &NowDockView::containmentChanged connect(this, &NowDockView::containmentChanged
, this, [&]() { , this, [&]() {
@ -286,6 +290,23 @@ void NowDockView::resizeWindow()
} }
} }
void NowDockView::setLocalDockGeometry(QRect geometry)
{
if (geometry == m_localDockGeometry) {
return;
}
m_localDockGeometry = geometry;
emit localDockGeometryChanged();
}
void NowDockView::updateAbsDockGeometry()
{
QRect absoluteGeometry = {x() + m_localDockGeometry.x(), y() + m_localDockGeometry.y(), m_localDockGeometry.width(), m_localDockGeometry.height()};
m_visibility->updateDockGeometry(absoluteGeometry);
}
inline void NowDockView::updateDockPosition() inline void NowDockView::updateDockPosition()
{ {
if (!containment()) if (!containment())
@ -475,19 +496,7 @@ VisibilityManager *NowDockView::visibility()
bool NowDockView::event(QEvent *e) bool NowDockView::event(QEvent *e)
{ {
emit eventTriggered(e);
/* if (ev->type() == QEvent::Enter) {
m_visibility->show();
emit entered();
} else if (ev->type() == QEvent::Leave) {
m_visibility->restore();
emit exited();
} */
//return QQuickWindow::event(e);
if (m_visibility) {
m_visibility->event(e);
}
return ContainmentView::event(e); return ContainmentView::event(e);
} }
@ -526,7 +535,18 @@ QPointF NowDockView::positionAdjustedForContainment(const QPointF &point) const
qBound(containmentRect.top() + 2, point.y(), containmentRect.bottom() - 2)); qBound(containmentRect.top() + 2, point.y(), containmentRect.bottom() - 2));
} }
QList<int> NowDockView::freeEdges() const
{
QList<Plasma::Types::Location> edges = m_corona->freeEdges(containment()->screen());
QList<int> edgesInt;
foreach (Plasma::Types::Location edge, edges) {
edgesInt.append((int)edge);
}
return edgesInt;
}
void NowDockView::saveConfig() void NowDockView::saveConfig()
{ {

@ -105,8 +105,11 @@ public:
public slots: public slots:
Q_INVOKABLE void addNewDock(); Q_INVOKABLE void addNewDock();
//used from the configuration window
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);
void resizeWindow(); void resizeWindow();
void restoreConfig(); void restoreConfig();
void saveConfig(); void saveConfig();
@ -121,19 +124,24 @@ protected:
signals: signals:
// void visibilityChanged(); // void visibilityChanged();
void addInternalViewSplitter();
void eventTriggered(QEvent *ev);
void alignmentChanged(); void alignmentChanged();
void compositingChanged(); void compositingChanged();
void heightChanged(); void heightChanged();
void lengthChanged(); void lengthChanged();
void localDockGeometryChanged();
void maskAreaChanged(); void maskAreaChanged();
void maxLengthChanged(); void maxLengthChanged();
void maxThicknessChanged(); void maxThicknessChanged();
void offsetChanged(); void offsetChanged();
void removeInternalViewSplitter();
void visibilityChanged(); void visibilityChanged();
void widthChanged(); void widthChanged();
public Q_SLOTS: public Q_SLOTS:
void updateDockPositionSlot(); void updateDockPositionSlot();
void updateAbsDockGeometry();
private: private:
bool m_secondInitPass; bool m_secondInitPass;
@ -143,7 +151,7 @@ private:
int m_length{0}; int m_length{0};
int m_maxLength{INT_MAX}; int m_maxLength{INT_MAX};
QRect m_dockGeometry; QRect m_localDockGeometry;
QRect m_maskArea; QRect m_maskArea;
QPointer<PlasmaQuick::ConfigView> m_configView; QPointer<PlasmaQuick::ConfigView> m_configView;

@ -4,12 +4,20 @@
#include "../liblattedock/extras.h" #include "../liblattedock/extras.h"
#include "nowdockview.h"
namespace Latte { namespace Latte {
//! BEGIN: VisiblityManagerPrivate implementation //! BEGIN: VisiblityManagerPrivate implementation
VisibilityManagerPrivate::VisibilityManagerPrivate(PlasmaQuick::ContainmentView *view, VisibilityManager *q) VisibilityManagerPrivate::VisibilityManagerPrivate(PlasmaQuick::ContainmentView *view, VisibilityManager *q)
: QObject(view), q(q), view(view), wm(AbstractWindowInterface::getInstance(view, nullptr)) : QObject(view), q(q), view(view), wm(AbstractWindowInterface::getInstance(view, nullptr))
{ {
NowDockView *dockView = dynamic_cast<NowDockView *>(view);
if (dockView) {
connect(dockView, &NowDockView::eventTriggered, q, &VisibilityManager::eventReceived);
}
timerCheckWindows.setInterval(350); timerCheckWindows.setInterval(350);
timerCheckWindows.setSingleShot(true); timerCheckWindows.setSingleShot(true);
@ -34,11 +42,11 @@ inline void VisibilityManagerPrivate::setMode(Dock::Visibility mode)
{ {
if (this->mode == mode) if (this->mode == mode)
return; return;
// clear mode // clear mode
if (this->mode == Dock::AlwaysVisible) if (this->mode == Dock::AlwaysVisible)
wm->removeDockStruts(); wm->removeDockStruts();
for (auto &c : connections) { for (auto &c : connections) {
disconnect(c); disconnect(c);
} }
@ -55,36 +63,36 @@ inline void VisibilityManagerPrivate::setMode(Dock::Visibility mode)
raiseDock(true); raiseDock(true);
} }
break; break;
case Dock::AutoHide: { case Dock::AutoHide: {
raiseDock(true); raiseDock(true);
} }
break; break;
case Dock::DodgeActive: { case Dock::DodgeActive: {
connections[0] = connect(wm.get(), &AbstractWindowInterface::activeWindowChanged connections[0] = connect(wm.get(), &AbstractWindowInterface::activeWindowChanged
, this, &VisibilityManagerPrivate::dodgeActive); , this, &VisibilityManagerPrivate::dodgeActive);
connections[1] = connect(wm.get(), &AbstractWindowInterface::windowChanged connections[1] = connect(wm.get(), &AbstractWindowInterface::windowChanged
, this, &VisibilityManagerPrivate::dodgeActive); , this, &VisibilityManagerPrivate::dodgeActive);
dodgeActive(wm->activeWindow()); dodgeActive(wm->activeWindow());
} }
break; break;
case Dock::DodgeMaximized: { case Dock::DodgeMaximized: {
connections[0] = connect(wm.get(), &AbstractWindowInterface::windowChanged connections[0] = connect(wm.get(), &AbstractWindowInterface::windowChanged
, this, &VisibilityManagerPrivate::dodgeMaximized); , this, &VisibilityManagerPrivate::dodgeMaximized);
} }
break; break;
case Dock::DodgeAllWindows: { case Dock::DodgeAllWindows: {
for (const auto &wid : wm->windows()) { for (const auto &wid : wm->windows()) {
windows.insert({wid, wm->requestInfo(wid)}); windows.insert({wid, wm->requestInfo(wid)});
} }
connections[0] = connect(wm.get(), &AbstractWindowInterface::windowChanged connections[0] = connect(wm.get(), &AbstractWindowInterface::windowChanged
, this, &VisibilityManagerPrivate::dodgeWindows); , this, &VisibilityManagerPrivate::dodgeWindows);
connections[1] = connect(wm.get(), &AbstractWindowInterface::windowRemoved connections[1] = connect(wm.get(), &AbstractWindowInterface::windowRemoved
, this, [&](WId wid) { , this, [&](WId wid) {
windows.erase(wid); windows.erase(wid);
@ -99,7 +107,7 @@ inline void VisibilityManagerPrivate::setMode(Dock::Visibility mode)
} }
saveConfig(); saveConfig();
emit q->modeChanged(); emit q->modeChanged();
} }
@ -107,7 +115,7 @@ inline void VisibilityManagerPrivate::setIsHidden(bool isHidden)
{ {
if (this->isHidden == isHidden) if (this->isHidden == isHidden)
return; return;
this->isHidden = isHidden; this->isHidden = isHidden;
emit q->isHiddenChanged(); emit q->isHiddenChanged();
} }
@ -132,16 +140,17 @@ inline void VisibilityManagerPrivate::raiseDock(bool raise)
/* if (!isHidden == raise) { /* if (!isHidden == raise) {
return; return;
} */ } */
if (raise) { if (raise) {
timerHide.stop(); timerHide.stop();
if (!timerShow.isActive()) if (!timerShow.isActive()) {
timerShow.start(); timerShow.start();
}
} else { } else {
timerShow.stop(); timerShow.stop();
if (!timerHide.isActive()) if (!timerHide.isActive() && view->containment()->immutability() != Plasma::Types::Mutable)
timerHide.start(); timerHide.start();
} }
} }
@ -150,37 +159,39 @@ inline void VisibilityManagerPrivate::setDockRect(const QRect &dockRect)
{ {
if (!view->containment() || this->dockRect == dockRect) if (!view->containment() || this->dockRect == dockRect)
return; return;
this->dockRect = dockRect; this->dockRect = dockRect;
if (mode == Dock::AlwaysVisible) { if (mode == Dock::AlwaysVisible) {
wm->setDockStruts(this->dockRect, view->containment()->location()); wm->setDockStruts(this->dockRect, view->containment()->location());
} }
raiseDock(raise);
} }
void VisibilityManagerPrivate::dodgeActive(WId wid) void VisibilityManagerPrivate::dodgeActive(WId wid)
{ {
if (wid != wm->activeWindow()) if (wid != wm->activeWindow())
return; return;
auto winfo = wm->requestInfo(wid); auto winfo = wm->requestInfo(wid);
if (!winfo.isValid() || !winfo.isOnCurrentDesktop() || winfo.isMinimized()) if (!winfo.isValid() || !winfo.isOnCurrentDesktop() || winfo.isMinimized())
return; return;
raiseDock(intersects(winfo)); raiseDock(!intersects(winfo));
} }
void VisibilityManagerPrivate::dodgeMaximized(WId wid) void VisibilityManagerPrivate::dodgeMaximized(WId wid)
{ {
if (wid != wm->activeWindow()) if (wid != wm->activeWindow())
return; return;
auto winfo = wm->requestInfo(wid); auto winfo = wm->requestInfo(wid);
if (!winfo.isValid() || !winfo.isOnCurrentDesktop() || winfo.isMinimized()) if (!winfo.isValid() || !winfo.isOnCurrentDesktop() || winfo.isMinimized())
return; return;
raiseDock(winfo.isMaximized()); raiseDock(winfo.isMaximized());
} }
@ -190,7 +201,7 @@ void VisibilityManagerPrivate::dodgeWindows(WId wid)
if (!winfo.isValid() || !winfo.isOnCurrentDesktop() || winfo.isMinimized()) if (!winfo.isValid() || !winfo.isOnCurrentDesktop() || winfo.isMinimized())
return; return;
if (intersects(winfo)) if (intersects(winfo))
raiseDock(false); raiseDock(false);
else else
@ -205,7 +216,7 @@ void VisibilityManagerPrivate::checkAllWindows()
//! std::pair<WId, WindowInfoWrap> //! std::pair<WId, WindowInfoWrap>
if (!std::get<1>(winfo).isValid() || !std::get<1>(winfo).isOnCurrentDesktop()) if (!std::get<1>(winfo).isValid() || !std::get<1>(winfo).isOnCurrentDesktop())
continue; continue;
if (std::get<1>(winfo).isFullscreen()) { if (std::get<1>(winfo).isFullscreen()) {
raise = false; raise = false;
break; break;
@ -231,7 +242,7 @@ inline void VisibilityManagerPrivate::saveConfig()
{ {
if (!view->containment()) if (!view->containment())
return; return;
auto config = view->containment()->config(); auto config = view->containment()->config();
config.writeEntry("visibility", static_cast<int>(mode)); config.writeEntry("visibility", static_cast<int>(mode));
@ -245,14 +256,12 @@ inline void VisibilityManagerPrivate::restoreConfig()
{ {
if (!view->containment()) if (!view->containment())
return; return;
auto config = view->containment()->config(); auto config = view->containment()->config();
auto mode = static_cast<Dock::Visibility>(config.readEntry("visibility", static_cast<int>(Dock::DodgeActive))); mode = static_cast<Dock::Visibility>(config.readEntry("visibility", static_cast<int>(Dock::DodgeActive)));
timerShow.setInterval(config.readEntry("timerShow", 0)); timerShow.setInterval(config.readEntry("timerShow", 0));
timerHide.setInterval(config.readEntry("timerHide", 0)); timerHide.setInterval(config.readEntry("timerHide", 0));
setMode(mode);
} }
bool VisibilityManagerPrivate::event(QEvent *ev) bool VisibilityManagerPrivate::event(QEvent *ev)
@ -261,16 +270,13 @@ bool VisibilityManagerPrivate::event(QEvent *ev)
containsMouse = true; containsMouse = true;
emit q->containsMouseChanged(); emit q->containsMouseChanged();
if (mode == Dock::AutoHide) raiseDock(true);
raiseDock(true);
} 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);
} else if (ev->type() == QEvent::Show) { } else if (ev->type() == QEvent::Show) {
wm->setDockDefaultFlags(); wm->setDockDefaultFlags();
} }
@ -342,13 +348,13 @@ void VisibilityManager::updateDockGeometry(const QRect &geometry)
d->setDockRect(geometry); d->setDockRect(geometry);
} }
void VisibilityManager::eventReceived(QEvent *ev)
{
d->event(ev);
}
//! END: VisibilityManager implementation //! END: VisibilityManager implementation
} }
#include "abstractwindowinterface.h" #include "abstractwindowinterface.h"
#include "xwindowinterface.h" #include "xwindowinterface.h"
#include "plasmaquick/containmentview.h" #include "plasmaquick/containmentview.h"

@ -44,7 +44,10 @@ public:
* @brief updateDockGeometry, the window geometry in absolute coordinates. * @brief updateDockGeometry, the window geometry in absolute coordinates.
*/ */
void updateDockGeometry(const QRect &geometry); void updateDockGeometry(const QRect &geometry);
public Q_SLOTS:
void eventReceived(QEvent *);
signals: signals:
void mustBeShown(); void mustBeShown();
void mustBeHide(); void mustBeHide();

@ -122,7 +122,7 @@ WindowInfoWrap XWindowInterface::requestInfoActive()
WindowInfoWrap XWindowInterface::requestInfo(WId wid) WindowInfoWrap XWindowInterface::requestInfo(WId wid)
{ {
const KWindowInfo winfo{wid, NET::WMDesktop | NET::WMFrameExtents | NET::WMWindowType | NET::WMState}; const KWindowInfo winfo{wid, NET::WMDesktop | NET::WMFrameExtents | NET::WMWindowType | NET::WMGeometry | NET::WMState};
WindowInfoWrap winfoWrap; WindowInfoWrap winfoWrap;
@ -172,4 +172,3 @@ void XWindowInterface::windowChangedProxy(WId wid, NET::Properties prop1, NET::P
} }
} }

@ -151,6 +151,7 @@ function insertBefore(item1, item2) {
for (var j = removed.length - 1; j >= 0; --j) { for (var j = removed.length - 1; j >= 0; --j) {
removed[j].parent = layout; removed[j].parent = layout;
} }
return i; return i;
} }
@ -188,6 +189,7 @@ function insertAfter(item1, item2) {
for (var j = removed.length - 1; j >= 0; --j) { for (var j = removed.length - 1; j >= 0; --j) {
removed[j].parent = layout; removed[j].parent = layout;
} }
return i; return i;
} }
@ -254,18 +256,26 @@ function insertAtCoordinates(item, x, y) {
} }
} }
} }
//already in position //already in position
if (child === item) { if (child === item) {
return; return;
} }
if (!child) { if (!child) {
child = layout.children[0]; // check if dragging takes place after the end of the layout
if ( ((root.isVertical && y > layout.height)||(root.Horizontal && x > layout.width))
&& layout.children.length>0 ){
child = layout.children[layout.children.length-1];
} else {
child = layout.children[0];
}
} else {
item.parent = root;
} }
item.parent = root;
//PlasmaCore.Types.Vertical = 3 if ((root.isVertical && y < child.y + child.height/2) ||
if ((plasmoid.formFactor === 3 && y < child.y + child.height/2) || (root.isHorizontal && x < child.x + child.width/2)) {
(plasmoid.formFactor !== 3 && x < child.x + child.width/2)) {
return insertBefore(child, item); return insertBefore(child, item);
} else { } else {
return insertAfter(child, item); return insertAfter(child, item);

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

@ -665,10 +665,13 @@ Item {
zoomScale = zoomScale + step; zoomScale = zoomScale + step;
} }
else{ else{
if(layoutsContainer.hoveredIndex<container.index) if(layoutsContainer.hoveredIndex<container.index){
nowDock.updateScale(0, nScale, step); nowDock.updateScale(0, nScale, step);
else if(layoutsContainer.hoveredIndex>=container.index) nowDock.updateScale(1, 1, 0);
} else if(layoutsContainer.hoveredIndex>=container.index) {
nowDock.updateScale(root.tasksCount-1, nScale, step); nowDock.updateScale(root.tasksCount-1, nScale, step);
nowDock.updateScale(root.tasksCount-2, 1, 0);
}
} }
} ///if the applet is hidden must forward its scale events to its neighbours } ///if the applet is hidden must forward its scale events to its neighbours
else if ((applet && (applet.status === PlasmaCore.Types.HiddenStatus)) else if ((applet && (applet.status === PlasmaCore.Types.HiddenStatus))
@ -758,30 +761,31 @@ Item {
} }
onPositionChanged: { onPositionChanged: {
if(!pressed){ // if(!pressed){
if (root.isHorizontal){ if (root.isHorizontal){
var step = Math.abs(layoutsContainer.currentSpot-mouse.x); var step = Math.abs(layoutsContainer.currentSpot-mouse.x);
if (step >= container.animationStep){ if (step >= container.animationStep){
layoutsContainer.hoveredIndex = index; layoutsContainer.hoveredIndex = index;
layoutsContainer.currentSpot = mouse.x; layoutsContainer.currentSpot = mouse.x;
wrapper.calculateScales(mouse.x); wrapper.calculateScales(mouse.x);
}
} }
else{ }
var step = Math.abs(layoutsContainer.currentSpot-mouse.y); else{
if (step >= container.animationStep){ var step = Math.abs(layoutsContainer.currentSpot-mouse.y);
layoutsContainer.hoveredIndex = index; if (step >= container.animationStep){
layoutsContainer.currentSpot = mouse.y; layoutsContainer.hoveredIndex = index;
layoutsContainer.currentSpot = mouse.y;
wrapper.calculateScales(mouse.y); wrapper.calculateScales(mouse.y);
}
} }
} }
// }
mouse.accepted = false; mouse.accepted = false;
} }
onPressed: pressed = true; onPressed: pressed = true;
onReleased: pressed = false;
} }
//BEGIN states //BEGIN states

@ -0,0 +1,10 @@
import QtQuick 2.1
Image{
anchors.fill: parent
fillMode: Image.Tile
horizontalAlignment: Image.AlignLeft
verticalAlignment: Image.AlignTop
source: "../icons/blueprint.jpg"
opacity: 0.5
}

@ -36,15 +36,6 @@ Item{
property int thicknessNormalOriginalValue: statesLineSizeOriginal + plasmoid.configuration.iconSize + iconMarginOriginal + 1 property int thicknessNormalOriginalValue: statesLineSizeOriginal + plasmoid.configuration.iconSize + iconMarginOriginal + 1
property int thicknessZoomOriginal: statesLineSizeOriginal + ((plasmoid.configuration.iconSize+iconMarginOriginal) * root.zoomFactor) + 2 property int thicknessZoomOriginal: statesLineSizeOriginal + ((plasmoid.configuration.iconSize+iconMarginOriginal) * root.zoomFactor) + 2
Binding{
//this is way to avoid warnings for null during initialization phase
target: dock ? dock.visibility : manager
property:"panelVisibility"
when: dock && dock.visibility
value: plasmoid.configuration.panelVisibility
}
Binding{ Binding{
target: dock ? dock : manager target: dock ? dock : manager
property:"maxThickness" property:"maxThickness"
@ -71,22 +62,22 @@ Item{
onThicknessZoomOriginalChanged: updateMaskArea(); onThicknessZoomOriginalChanged: updateMaskArea();
function slotDisableHidingChanged() { function slotDisableHidingChanged() {
if (!dock.visibility.disableHiding) { /*if (!dock.visibility.disableHiding) {
checkListHovered.restart(); checkListHovered.restart();
} }*/
} }
function slotIsHoveredChanged() { function slotContainsMouseChanged() {
if(dock.visibility.isHovered) { if(dock.visibility.containsMouse) {
//stop parent window timer for auto hiding //stop parent window timer for auto hiding
if ((dock.visibility.panelVisibility === Latte.Dock.AutoHide)|| dock.visibility.isDockWindowType) { /* if (dock.visibility.mode === Latte.Dock.AutoHide) {
if(hideMagicWindowInAutoHide.forcedDisableHiding) { if(hideMagicWindowInAutoHide.forcedDisableHiding) {
hideMagicWindowInAutoHide.forcedDisableHiding = false; hideMagicWindowInAutoHide.forcedDisableHiding = false;
dock.visibility.disableHiding = false; dock.visibility.disableHiding = false;
} }
hideMagicWindowInAutoHide.stop(); hideMagicWindowInAutoHide.stop();
} }*/
if (delayerTimer.running) { if (delayerTimer.running) {
delayerTimer.stop(); delayerTimer.stop();
@ -99,29 +90,23 @@ Item{
} }
} }
function slotMustBeRaised() { function slotMustBeShown() {
if ((dock.visibility.panelVisibility === Latte.Dock.AutoHide) || dock.visibility.isDockWindowType) { console.log("show...");
slidingAnimationAutoHiddenIn.init(); slidingAnimationAutoHiddenIn.init();
} else {
slidingAnimation.init(true,false);
}
} }
function slotMustBeRaisedImmediately() { function slotMustBeRaisedImmediately() {
slidingAnimation.init(true,true); slidingAnimation.init(true,true);
} }
function slotMustBeLowered() { function slotMustBeHide() {
if ((dock.visibility.panelVisibility === Latte.Dock.AutoHide) || dock.visibility.isDockWindowType ) { console.log("hide....");
slidingAnimationAutoHiddenOut.init(); slidingAnimationAutoHiddenOut.init();
} else {
slidingAnimation.init(false,false);
}
} }
function slotPanelVisibilityChanged() { function slotModeChanged() {
if (dock.visibility.panelVisibility !== Latte.Dock.AutoHide) { if (dock.visibility.mode !== Latte.Dock.AutoHide) {
dock.visibility.isAutoHidden = false; dock.visibility.isHidden = false;
} }
} }
@ -164,7 +149,7 @@ Item{
tempThickness = thicknessMidOriginal; tempThickness = thicknessMidOriginal;
} }
if (dock.visibility.isAutoHidden && ((dock.visibility.panelVisibility === Latte.Dock.AutoHide) || dock.visibility.isDockWindowType)) { if (dock.visibility.isHidden && (dock.visibility.mode === Latte.Dock.AutoHide)) {
tempThickness = thicknessAutoHidden; tempThickness = thicknessAutoHidden;
} }
@ -256,6 +241,10 @@ Item{
} }
dock.maskArea = newMaskArea; dock.maskArea = newMaskArea;
if(normalState && !dock.visibility.isHidden){
dock.setLocalDockGeometry(newMaskArea);
}
} }
} }
@ -358,7 +347,7 @@ Item{
} }
onStopped: { onStopped: {
dock.visibility.isAutoHidden = true; dock.visibility.isHidden = true;
updateMaskArea(); updateMaskArea();
} }
@ -385,7 +374,7 @@ Item{
} }
function init() { function init() {
dock.visibility.isAutoHidden = false; dock.visibility.isHidden = false;
updateMaskArea(); updateMaskArea();
start(); start();
} }
@ -396,12 +385,12 @@ Item{
onCurrentActivityChanged: { onCurrentActivityChanged: {
dock.visibility.disableHiding = true; dock.visibility.disableHiding = true;
if (dock.visibility.isAutoHidden) { if (dock.visibility.isHidden) {
dock.visibility.mustBeRaised(); dock.visibility.mustBeShown();
} }
hideMagicWindowInAutoHide.forcedDisableHiding = true; // hideMagicWindowInAutoHide.forcedDisableHiding = true;
hideMagicWindowInAutoHide.start(); // hideMagicWindowInAutoHide.start();
} }
} }
@ -424,9 +413,9 @@ Item{
interval: manager.inStartup ? 1000 : 500 interval: manager.inStartup ? 1000 : 500
onTriggered: { onTriggered: {
layoutsContainer.opacity = 1; layoutsContainer.opacity = 1;
if ((dock.visibility.panelVisibility !== Latte.Dock.AutoHide) && !dock.visibility.isDockWindowType) { if (dock.visibility.mode !== Latte.Dock.AutoHide) {
slidingAnimation.init(true,false); /*slidingAnimation.init(true,false);
} else { } else {*/
slidingAnimationAutoHiddenIn.init(); slidingAnimationAutoHiddenIn.init();
} }
} }

@ -40,7 +40,7 @@ DragDrop.DropArea {
//// ////
////BEGIN properties ////BEGIN properties
property bool debugMode: true property bool debugMode: false
property bool automaticSize: plasmoid.configuration.automaticIconSize property bool automaticSize: plasmoid.configuration.automaticIconSize
property bool immutable: plasmoid.immutable property bool immutable: plasmoid.immutable
@ -73,13 +73,13 @@ DragDrop.DropArea {
property int realPanelSize property int realPanelSize
property int themePanelSize: plasmoid.configuration.panelSize property int themePanelSize: plasmoid.configuration.panelSize
///FIXME: <delete> I can't remember why this is needed, maybe for the anchorings!!! In order for the Double Layout to not mess the anchorings... ///FIXME: <delete both> I can't remember why this is needed, maybe for the anchorings!!! In order for the Double Layout to not mess the anchorings...
property int mainLayoutPosition: !plasmoid.immutable ? Latte.Dock.Center : (root.isVertical ? Latte.Dock.Top : Latte.Dock.Left) //property int mainLayoutPosition: !plasmoid.immutable ? Latte.Dock.Center : (root.isVertical ? Latte.Dock.Top : Latte.Dock.Left)
///FIXME: <delete>
//property int panelAlignment: plasmoid.configuration.panelPosition !== Latte.Dock.Double ? plasmoid.configuration.panelPosition : mainLayoutPosition //property int panelAlignment: plasmoid.configuration.panelPosition !== Latte.Dock.Double ? plasmoid.configuration.panelPosition : mainLayoutPosition
property int panelAlignment: plasmoid.immutable ? plasmoid.configuration.panelPosition : Latte.Dock.Center property int panelAlignment: plasmoid.immutable ? plasmoid.configuration.panelPosition :
// property int panelAlignment: plasmoid.configuration.panelPosition ( plasmoid.configuration.panelPosition === Latte.Dock.Double ?
Latte.Dock.Center :plasmoid.configuration.panelPosition )
property real zoomFactor: windowSystem.compositingActive ? ( 1 + (plasmoid.configuration.zoomLevel / 20) ) : 1 property real zoomFactor: windowSystem.compositingActive ? ( 1 + (plasmoid.configuration.zoomLevel / 20) ) : 1
@ -107,7 +107,7 @@ DragDrop.DropArea {
property int tasksCount: nowDock ? nowDock.tasksCount : 0 property int tasksCount: nowDock ? nowDock.tasksCount : 0
///END properties from nowDock ///END properties from nowDock
/* Layout.preferredWidth: plasmoid.immutable ? /* Layout.preferredWidth: plasmoid.immutable ?
(plasmoid.configuration.panelPosition === Latte.Dock.Double ? (plasmoid.configuration.panelPosition === Latte.Dock.Double ?
layoutsContainer.width + 0.5*iconMargin : mainLayout.width + iconMargin) : layoutsContainer.width + 0.5*iconMargin : mainLayout.width + iconMargin) :
Screen.width //on unlocked state use the maximum Screen.width //on unlocked state use the maximum
@ -390,12 +390,23 @@ DragDrop.DropArea {
onDockChanged: { onDockChanged: {
if (dock) { if (dock) {
dock.visibility.onDisableHidingChanged.connect(visibilityManager.slotDisableHidingChanged); dock.onAddInternalViewSplitter.connect(addInternalViewSplitter);
dock.visibility.onIsHoveredChanged.connect(visibilityManager.slotIsHoveredChanged); dock.onRemoveInternalViewSplitter.connect(removeInternalViewSplitter);
dock.visibility.onMustBeLowered.connect(visibilityManager.slotMustBeLowered);
dock.visibility.onMustBeRaised.connect(visibilityManager.slotMustBeRaised); dock.onXChanged.connect(visibilityManager.updateMaskArea);
dock.visibility.onMustBeRaisedImmediately.connect(visibilityManager.slotMustBeRaisedImmediately); dock.onYChanged.connect(visibilityManager.updateMaskArea);
dock.visibility.onPanelVisibilityChanged.connect(visibilityManager.slotPanelVisibilityChanged); dock.onWidthChanged.connect(visibilityManager.updateMaskArea);
dock.onHeightChanged.connect(visibilityManager.updateMaskArea);
dock.visibility.timerShow = 300;
dock.visibility.timerHide = 1000;
//dock.visibility.onDisableHidingChanged.connect(visibilityManager.slotDisableHidingChanged);
dock.visibility.onContainsMouseChanged.connect(visibilityManager.slotContainsMouseChanged);
dock.visibility.onMustBeHide.connect(visibilityManager.slotMustBeHide);
dock.visibility.onMustBeShown.connect(visibilityManager.slotMustBeShown);
//dock.visibility.onMustBeRaisedImmediately.connect(visibilityManager.slotMustBeRaisedImmediately);
dock.visibility.onModeChanged.connect(visibilityManager.slotModeChanged);
} }
} }
@ -431,9 +442,9 @@ DragDrop.DropArea {
} }
onIsHoveredChanged: { onIsHoveredChanged: {
if (isHovered){ /*if (isHovered){
dock.visibility.showOnTopCheck(); dock.visibility.showOnTopCheck();
} }*/
} }
onHeightChanged: { onHeightChanged: {
@ -510,7 +521,7 @@ DragDrop.DropArea {
} }
LayoutManager.save(); LayoutManager.save();
// magicWin.removeAppletItem(applet); // magicWin.removeAppletItem(applet);
} }
Plasmoid.onUserConfiguringChanged: { Plasmoid.onUserConfiguringChanged: {
@ -563,10 +574,10 @@ DragDrop.DropArea {
if (plasmoid.immutable) { if (plasmoid.immutable) {
if(root.isHorizontal) { if(root.isHorizontal) {
root.Layout.preferredWidth = (plasmoid.configuration.panelPosition === Latte.Dock.Double ? root.Layout.preferredWidth = (plasmoid.configuration.panelPosition === Latte.Dock.Double ?
layoutsContainer.width + 0.5*iconMargin : mainLayout.width + iconMargin); layoutsContainer.width + 0.5*iconMargin : mainLayout.width + iconMargin);
} else { } else {
root.Layout.preferredHeight = (plasmoid.configuration.panelPosition === Latte.Dock.Double ? root.Layout.preferredHeight = (plasmoid.configuration.panelPosition === Latte.Dock.Double ?
layoutsContainer.height + 0.5*iconMargin : mainLayout.height + iconMargin); layoutsContainer.height + 0.5*iconMargin : mainLayout.height + iconMargin);
} }
} else { } else {
if (root.isHorizontal) { if (root.isHorizontal) {
@ -576,22 +587,22 @@ DragDrop.DropArea {
} }
} }
if (plasmoid.immutable) { /* if (plasmoid.immutable) {
if (windowSystem.compositingActive) { if (windowSystem.compositingActive) {
// magicWin.initialize(); magicWin.initialize();
} }
dock.visibility.disableHiding = false; dock.visibility.disableHiding = false;
} else { } else {
dock.visibility.disableHiding = true; dock.visibility.disableHiding = true;
dock.visibility.mustBeRaised(); dock.visibility.mustBeRaised();
} }*/
visibilityManager.updateMaskArea(); visibilityManager.updateMaskArea();
// console.log(magicWin.visible + " - "+magicWin.x+" - " + magicWin.y+" - "+magicWin.width+" - "+magicWin.height); // console.log(magicWin.visible + " - "+magicWin.x+" - " + magicWin.y+" - "+magicWin.width+" - "+magicWin.height);
/* if (magicWin) { /* if (magicWin) {
if (plasmoid.immutable) { if (plasmoid.immutable) {
if (windowSystem.compositingActive) { if (windowSystem.compositingActive) {
magicWin.initialize(); magicWin.initialize();
@ -629,7 +640,7 @@ DragDrop.DropArea {
// adding the AppletQuickItem to the Now Dock in order to be // adding the AppletQuickItem to the Now Dock in order to be
// used for right clicking events // used for right clicking events
// magicWin.addAppletItem(applet); // magicWin.addAppletItem(applet);
} }
function addContainerInLayout(container, applet, x, y){ function addContainerInLayout(container, applet, x, y){
@ -741,7 +752,7 @@ DragDrop.DropArea {
animatedLengthTimer.start(); animatedLengthTimer.start();
} }
if (!dock.visibility.isHovered && (root.animationsNeedBothAxis === 0) if (!dock.visibility.containsMouse && (root.animationsNeedBothAxis === 0)
&& (root.animationsNeedLength===0) && (root.appletsAnimations === 0)) { && (root.animationsNeedLength===0) && (root.appletsAnimations === 0)) {
mainLayout.animatedLength = true; mainLayout.animatedLength = true;
} else { } else {
@ -753,9 +764,9 @@ DragDrop.DropArea {
function clearZoom(){ function clearZoom(){
//console.log("Panel clear...."); //console.log("Panel clear....");
if (dock.visibility.disableHiding) { /* if (dock.visibility.disableHiding) {
return; return;
} } */
layoutsContainer.currentSpot = -1000; layoutsContainer.currentSpot = -1000;
layoutsContainer.hoveredIndex = -1; layoutsContainer.hoveredIndex = -1;
@ -863,7 +874,7 @@ DragDrop.DropArea {
} }
function slotDisableHiding(value) { function slotDisableHiding(value) {
dock.visibility.disableHiding = value; // dock.visibility.disableHiding = value;
} }
function updateAutomaticIconSize() { function updateAutomaticIconSize() {
@ -975,6 +986,16 @@ DragDrop.DropArea {
///////////////END components ///////////////END components
///////////////BEGIN UI elements ///////////////BEGIN UI elements
Loader{
anchors.fill: parent
active: !plasmoid.immutable
sourceComponent: EditModeVisual{
}
}
Item { Item {
id: lastSpacer id: lastSpacer
parent: mainLayout parent: mainLayout
@ -993,7 +1014,7 @@ DragDrop.DropArea {
Item { Item {
id: dndSpacer id: dndSpacer
property int normalSize: root.statesLineSizeOriginal + plasmoid.configuration.iconSize + root.iconMarginOriginal - 1 property int normalSize: visibilityManager.statesLineSizeOriginal + plasmoid.configuration.iconSize + visibilityManager.iconMarginOriginal - 1
width: normalSize width: normalSize
height: normalSize height: normalSize
@ -1018,7 +1039,7 @@ DragDrop.DropArea {
} }
} }
/* MouseArea{ /* MouseArea{
id: wholeArea id: wholeArea
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
@ -1050,14 +1071,14 @@ DragDrop.DropArea {
VisibilityManager{ VisibilityManager{
id: visibilityManager id: visibilityManager
// window: dock // window: dock
} }
Item{ Item{
id: layoutsContainer id: layoutsContainer
signal updateScale(int delegateIndex, real newScale, real step) signal updateScale(int delegateIndex, real newScale, real step)
// property bool parentMagicWinFlag: plasmoid.immutable && magicWin && !root.inStartup && windowSystem.compositingActive // property bool parentMagicWinFlag: plasmoid.immutable && magicWin && !root.inStartup && windowSystem.compositingActive
//&& !(root.inStartup && magicWin.panelVisibility === Latte.Dock.AutoHide) //&& !(root.inStartup && magicWin.panelVisibility === Latte.Dock.AutoHide)
property int allCount: root.nowDock ? mainLayout.count-1+nowDock.tasksCount : mainLayout.count property int allCount: root.nowDock ? mainLayout.count-1+nowDock.tasksCount : mainLayout.count
@ -1066,14 +1087,14 @@ DragDrop.DropArea {
x: (plasmoid.configuration.panelPosition === Latte.Dock.Double) && root.isHorizontal x: (plasmoid.configuration.panelPosition === Latte.Dock.Double) && root.isHorizontal
&& plasmoid.immutable && windowSystem.compositingActive ? && plasmoid.immutable && windowSystem.compositingActive ?
(dock.width/2) - (dock.visibility.maxLength/2): 0 (dock.width/2) - (dock.maxLength/2): 0
y: (plasmoid.configuration.panelPosition === Latte.Dock.Double) && root.isVertical y: (plasmoid.configuration.panelPosition === Latte.Dock.Double) && root.isVertical
&& plasmoid.immutable && windowSystem.compositingActive ? && plasmoid.immutable && windowSystem.compositingActive ?
(dock.height/2) - (dock.visibility.maxLength/2): 0 (dock.height/2) - (dock.maxLength/2): 0
width: (plasmoid.configuration.panelPosition === Latte.Dock.Double) && root.isHorizontal && plasmoid.immutable ? width: (plasmoid.configuration.panelPosition === Latte.Dock.Double) && root.isHorizontal && plasmoid.immutable ?
dock.visibility.maxLength : parent.width dock.maxLength : parent.width
height: (plasmoid.configuration.panelPosition === Latte.Dock.Double) && root.isVertical && plasmoid.immutable ? height: (plasmoid.configuration.panelPosition === Latte.Dock.Double) && root.isVertical && plasmoid.immutable ?
dock.visibility.maxLength : parent.height dock.maxLength : parent.height
Component.onCompleted: { Component.onCompleted: {
if(plasmoid.immutable) { if(plasmoid.immutable) {
@ -1083,7 +1104,7 @@ DragDrop.DropArea {
} }
} }
/* onParentChanged: { /* onParentChanged: {
if (magicWin && magicWin.contentItem && (parent === magicWin.contentItem)) { if (magicWin && magicWin.contentItem && (parent === magicWin.contentItem)) {
magicWin.updateMaskArea(); magicWin.updateMaskArea();
} }
@ -1233,17 +1254,17 @@ DragDrop.DropArea {
property bool forcedDisableHiding: false property bool forcedDisableHiding: false
onTriggered: { onTriggered: {
if (forcedDisableHiding) { /* if (forcedDisableHiding) {
forcedDisableHiding = false; forcedDisableHiding = false;
dock.visibility.disableHiding = false; dock.visibility.disableHiding = false;
} }
var visibility = dock.visibility; var visibility = dock.visibility;
if (plasmoid.immutable && !visibility.isHovered //&& !wholeArea.containsMouse if (plasmoid.immutable && !visibility.containsMouse //&& !wholeArea.containsMouse
&& ((visibility.panelVisibility === Latte.Dock.AutoHide) || visibility.isDockWindowType) ) { && (visibility.movde === Latte.Dock.AutoHide) ) {
visibility.mustBeLowered(); visibility.mustBeHide();
} }*/
} }
} }
@ -1252,8 +1273,8 @@ DragDrop.DropArea {
id: animatedLengthTimer id: animatedLengthTimer
interval: 150 interval: 150
onTriggered: { onTriggered: {
// if (!magicWin.isHovered && (appletsAnimations === 0) // if (!magicWin.isHovered && (appletsAnimations === 0)
// && (root.animationsNeedLength === 0) && (root.animationsNeedBothAxis === 0)) { // && (root.animationsNeedLength === 0) && (root.animationsNeedBothAxis === 0)) {
if ((appletsAnimations === 0) && (root.animationsNeedLength === 0) && (root.animationsNeedBothAxis === 0)) { if ((appletsAnimations === 0) && (root.animationsNeedLength === 0) && (root.animationsNeedBothAxis === 0)) {
mainLayout.animatedLength = false; mainLayout.animatedLength = false;
visibilityManager.updateMaskArea(); visibilityManager.updateMaskArea();

@ -14,19 +14,22 @@ PlasmaCore.FrameSvgItem {
imagePath: "dialogs/background" imagePath: "dialogs/background"
width: Math.max(420,noneShadow.width + lockedAppletsShadow.width + allAppletsShadow.width) width: Math.max(420,noneShadow.width + lockedAppletsShadow.width + allAppletsShadow.width)
height: mainColumn.height+10 height: mainColumn.height+2*windowSpace
property bool panelIsVertical: plasmoid.formFactor === PlasmaCore.Types.Vertical property bool panelIsVertical: plasmoid.formFactor === PlasmaCore.Types.Vertical
property int windowSpace:8
signal updateThickness(); signal updateThickness();
signal removeInternalViewSplitter();
signal addInternalViewSplitter();
Column{ Column{
id:mainColumn id:mainColumn
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
spacing: 1.5*theme.defaultFont.pointSize spacing: 1.5*theme.defaultFont.pointSize
width: parent.width - 10 width: parent.width - 2*windowSpace
//////////// Location ////////////////
Column{ Column{
width:parent.width width:parent.width
@ -35,7 +38,7 @@ PlasmaCore.FrameSvgItem {
RowLayout{ RowLayout{
width: parent.width width: parent.width
PlasmaComponents.Label{ PlasmaComponents.Label{
text: i18n("Applets Alignment") text: i18n("Location")
font.pointSize: 1.5 * theme.defaultFont.pointSize font.pointSize: 1.5 * theme.defaultFont.pointSize
Layout.alignment: Qt.AlignLeft Layout.alignment: Qt.AlignLeft
} }
@ -47,12 +50,147 @@ PlasmaCore.FrameSvgItem {
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
// width: parent.width
text: i18n("ver: ") +"@VERSION@" text: i18n("ver: ") +"@VERSION@"
}
}
Flow{
width: parent.width
spacing: 2
property bool inStartup: true
property int dockLocation: dock.location
onDockLocationChanged: updateDockLocationVisual();
Component.onCompleted: {
lockReservedEdges();
updateDockLocationVisual();
inStartup = false;
}
function lockReservedEdges() {
var edges = dock.freeEdges();
firstLocation.enabled = false;
secondLocation.enabled = false;
thirdLocation.enabled = false;
fourthLocation.enabled = false;
for (var i=0; i<edges.length; ++i){
if (edges[i] === PlasmaCore.Types.BottomEdge){
firstLocation.enabled = true;
} else if (edges[i] === PlasmaCore.Types.LeftEdge){
secondLocation.enabled = true;
} else if (edges[i] === PlasmaCore.Types.TopEdge){
thirdLocation.enabled = true;
} else if (edges[i] === PlasmaCore.Types.RightEdge){
fourthLocation.enabled = true;
}
}
}
function updateDockLocationVisual(){
if(dockLocation === PlasmaCore.Types.BottomEdge){
firstLocation.enabled = true;
firstLocation.checked = true;
secondLocation.checked = false;
thirdLocation.checked = false;
fourthLocation.checked = false;
}
else if(dockLocation === PlasmaCore.Types.LeftEdge){
firstLocation.checked = false;
secondLocation.enabled = true;
secondLocation.checked = true;
thirdLocation.checked = false;
fourthLocation.checked = false;
}
else if(dockLocation === PlasmaCore.Types.TopEdge){
firstLocation.checked = false;
secondLocation.checked = false;
thirdLocation.enabled = true;
thirdLocation.checked = true;
fourthLocation.checked = false;
}
else if(dockLocation === PlasmaCore.Types.RightEdge){
firstLocation.checked = false;
secondLocation.checked = false;
thirdLocation.checked = false;
fourthLocation.enabled = true;
fourthLocation.checked = true;
}
}
PlasmaComponents.Button{
id: firstLocation
checkable: true
text: i18n("Bottom")
width: (parent.width / 4) - 2
onCheckedChanged: {
if(checked && !parent.inStartup){
dock.location = PlasmaCore.Types.BottomEdge
}
}
onClicked: checked=true;
}
PlasmaComponents.Button{
id: secondLocation
checkable: true
text: i18n("Left")
width: (parent.width / 4) - 2
onCheckedChanged: {
if(checked && !parent.inStartup){
dock.location = PlasmaCore.Types.LeftEdge
}
}
onClicked: checked=true;
}
PlasmaComponents.Button{
id: thirdLocation
checkable: true
text: i18n("Top")
width: (parent.width / 4) - 2
onCheckedChanged: {
if(checked && !parent.inStartup){
dock.location = PlasmaCore.Types.TopEdge
}
}
onClicked: checked=true;
}
PlasmaComponents.Button{
id: fourthLocation
checkable: true
text: i18n("Right")
width: (parent.width/4) - 1
onCheckedChanged: {
if(checked && !parent.inStartup){
dock.location = PlasmaCore.Types.RightEdge
}
}
onClicked: checked=true;
} }
} }
}
/////////// Applets Alignment //////////////////
Column{
width:parent.width
spacing: 0.8*theme.defaultFont.pointSize
PlasmaComponents.Label{
text: i18n("Applets Alignment")
font.pointSize: 1.5 * theme.defaultFont.pointSize
Layout.alignment: Qt.AlignLeft
}
//user set Panel Positions //user set Panel Positions
// 0-Center, 1-Left, 2-Right, 3-Top, 4-Bottom // 0-Center, 1-Left, 2-Right, 3-Top, 4-Bottom
@ -70,21 +208,21 @@ PlasmaCore.FrameSvgItem {
centerPosition.checked = false; centerPosition.checked = false;
lastPosition.checked = false; lastPosition.checked = false;
splitTwoPosition.checked = false; splitTwoPosition.checked = false;
removeInternalViewSplitter(); dock.removeInternalViewSplitter();
} }
else if(panelPosition == Latte.Dock.Center){ else if(panelPosition == Latte.Dock.Center){
firstPosition.checked = false; firstPosition.checked = false;
centerPosition.checked = true; centerPosition.checked = true;
lastPosition.checked = false; lastPosition.checked = false;
splitTwoPosition.checked = false; splitTwoPosition.checked = false;
removeInternalViewSplitter(); dock.removeInternalViewSplitter();
} }
else if((panelPosition == Latte.Dock.Right)||(panelPosition == Latte.Dock.Bottom)){ else if((panelPosition == Latte.Dock.Right)||(panelPosition == Latte.Dock.Bottom)){
firstPosition.checked = false; firstPosition.checked = false;
centerPosition.checked = false; centerPosition.checked = false;
lastPosition.checked = true; lastPosition.checked = true;
splitTwoPosition.checked = false; splitTwoPosition.checked = false;
removeInternalViewSplitter(); dock.removeInternalViewSplitter();
} }
else if (panelPosition == Latte.Dock.Double){ else if (panelPosition == Latte.Dock.Double){
firstPosition.checked = false; firstPosition.checked = false;
@ -92,7 +230,7 @@ PlasmaCore.FrameSvgItem {
lastPosition.checked = false; lastPosition.checked = false;
splitTwoPosition.checked = true; splitTwoPosition.checked = true;
//add the splitter visual //add the splitter visual
addInternalViewSplitter(-1); dock.addInternalViewSplitter();
} }
} }
@ -216,7 +354,7 @@ PlasmaCore.FrameSvgItem {
else else
fifthState.checked = false; fifthState.checked = false;
/* if (panelVisibility === 5) /* if (panelVisibility === 5)
sixthState.checked = true; sixthState.checked = true;
else else
sixthState.checked = false;*/ sixthState.checked = false;*/
@ -237,6 +375,7 @@ PlasmaCore.FrameSvgItem {
onCheckedChanged: { onCheckedChanged: {
if(checked && !parent.inStartup){ if(checked && !parent.inStartup){
dock.visibility.mode = Latte.Dock.AlwaysVisible
plasmoid.configuration.panelVisibility = 0 plasmoid.configuration.panelVisibility = 0
} }
} }
@ -250,6 +389,7 @@ PlasmaCore.FrameSvgItem {
onCheckedChanged: { onCheckedChanged: {
if(checked && !parent.inStartup){ if(checked && !parent.inStartup){
dock.visibility.mode = Latte.Dock.AutoHide
plasmoid.configuration.panelVisibility = 1 plasmoid.configuration.panelVisibility = 1
} }
} }
@ -263,6 +403,7 @@ PlasmaCore.FrameSvgItem {
onCheckedChanged: { onCheckedChanged: {
if(checked && !parent.inStartup){ if(checked && !parent.inStartup){
dock.visibility.mode = Latte.Dock.DodgeActive
plasmoid.configuration.panelVisibility = 2 plasmoid.configuration.panelVisibility = 2
} }
} }
@ -277,6 +418,7 @@ PlasmaCore.FrameSvgItem {
onCheckedChanged: { onCheckedChanged: {
if(checked && !parent.inStartup){ if(checked && !parent.inStartup){
dock.visibility.mode = Latte.Dock.DodgeMaximized
plasmoid.configuration.panelVisibility = 3 plasmoid.configuration.panelVisibility = 3
} }
} }
@ -291,12 +433,13 @@ PlasmaCore.FrameSvgItem {
onCheckedChanged: { onCheckedChanged: {
if(checked && !parent.inStartup){ if(checked && !parent.inStartup){
dock.visibility.mode = Latte.Dock.DodgeWindows
plasmoid.configuration.panelVisibility = 4 plasmoid.configuration.panelVisibility = 4
} }
} }
onClicked: checked=true; onClicked: checked=true;
} }
/* PlasmaComponents.Button{ /* PlasmaComponents.Button{
id: sixthState id: sixthState
checkable: true checkable: true
text: i18n("Always Visible") text: i18n("Always Visible")
@ -304,6 +447,7 @@ PlasmaCore.FrameSvgItem {
onCheckedChanged: { onCheckedChanged: {
if(checked && !parent.inStartup){ if(checked && !parent.inStartup){
dock.visibility.mode = Latte.Dock.AlwaysVisible
plasmoid.configuration.panelVisibility = 5 plasmoid.configuration.panelVisibility = 5
} }
} }
@ -598,6 +742,13 @@ PlasmaCore.FrameSvgItem {
text: i18n("Add New Dock") text: i18n("Add New Dock")
onClicked: dock.addNewDock(); onClicked: dock.addNewDock();
Component.onCompleted: {
var edges = dock.freeEdges();
if (edges.length === 0) {
enabled = false;
}
}
} }
PlasmaComponents.Button{ PlasmaComponents.Button{
enabled: true enabled: true

Loading…
Cancel
Save