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
abstractwindowinterface.cpp
xwindowinterface.cpp
windowinfowrap.cpp
visibilitymanager.cpp
nowdockconfigview.cpp
nowdockview.cpp

@ -19,6 +19,7 @@
#include "nowdockconfigview.h"
#include "nowdockview.h"
#include "nowdockcorona.h"
#include <QQuickItem>
#include <QQmlContext>
@ -54,6 +55,13 @@ NowDockConfigView::NowDockConfigView(Plasma::Containment *containment, NowDockVi
});
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
, [&](Plasma::Types::ImmutabilityType type) {
if (type != Plasma::Types::Mutable && this && isVisible())
@ -179,7 +187,16 @@ void NowDockConfigView::showEvent(QShowEvent *ev)
// m_dockView->visibility()->showImmediately();
m_screenSyncTimer.start();
m_deleterTimer.stop();
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)
@ -209,6 +226,13 @@ void NowDockConfigView::focusOutEvent(QFocusEvent *ev)
// hide();
}
void NowDockConfigView::configurationShown(PlasmaQuick::ConfigView *configView)
{
if ((configView != this) && isVisible()) {
hide();
}
}
void NowDockConfigView::immutabilityChanged(Plasma::Types::ImmutabilityType type)
{
if (type != Plasma::Types::Mutable && isVisible()) {

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

@ -121,14 +121,35 @@ QRect NowDockCorona::availableScreenRect(int id) const
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
{
using Plasma::Types;
QList<Types::Location> edges{Types::TopEdge, Types::BottomEdge
, Types::LeftEdge, Types::RightEdge};
QList<Types::Location> edges{Types::BottomEdge, Types::LeftEdge,
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) {
if (cont && cont->containment()->screen() == screen)
if (cont && cont->containment()->screen() == fixedScreen)
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
{
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) {
if (view && view->containment() == containment)
return containment->screen();
if (view && view->containment() && view->containment()->id() == containment->id())
if (view->screen())
return qGuiApp->screens().indexOf(view->screen());
}
return -1;
@ -162,8 +177,8 @@ void NowDockCorona::addDock(Plasma::Containment *containment)
// the system tray is a containment that behaves as an applet
// so a dockview shouldnt be created for it
KPluginMetaData metadata = containment->kPackage().metadata();
if (metadata.pluginId() == "org.kde.plasma.systemtray") {
if (metadata.pluginId() == "org.kde.plasma.private.systemtray") {
return;
}
@ -204,29 +219,15 @@ void NowDockCorona::loadDefaultLayout()
auto config = defaultContainment->config();
defaultContainment->restore(config);
switch (containments().size()) {
case 1:
defaultContainment->setLocation(Plasma::Types::LeftEdge);
break;
case 2:
defaultContainment->setLocation(Plasma::Types::RightEdge);
break;
case 3:
defaultContainment->setLocation(Plasma::Types::TopEdge);
break;
default:
defaultContainment->setLocation(Plasma::Types::BottomEdge);
break;
QList<Plasma::Types::Location> edges = freeEdges(defaultContainment->screen());
if (edges.count() > 0) {
defaultContainment->setLocation(edges.at(0));
} else {
defaultContainment->setLocation(Plasma::Types::BottomEdge);
}
//config.writeEntry("dock", "initial");
//config.writeEntry("alignment", (int)Dock::Center);
//config.deleteEntry("wallpaperplugin");
defaultContainment->updateConstraints(Plasma::Types::StartupCompletedConstraint);
defaultContainment->save(config);
requestConfigSync();

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

@ -72,6 +72,10 @@ NowDockView::NowDockView(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, &NowDockView::containmentChanged
, 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()
{
if (!containment())
@ -475,19 +496,7 @@ VisibilityManager *NowDockView::visibility()
bool NowDockView::event(QEvent *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);
}
emit eventTriggered(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));
}
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()
{

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

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

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

@ -122,7 +122,7 @@ WindowInfoWrap XWindowInterface::requestInfoActive()
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;
@ -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) {
removed[j].parent = layout;
}
return i;
}
@ -188,6 +189,7 @@ function insertAfter(item1, item2) {
for (var j = removed.length - 1; j >= 0; --j) {
removed[j].parent = layout;
}
return i;
}
@ -254,18 +256,26 @@ function insertAtCoordinates(item, x, y) {
}
}
}
//already in position
if (child === item) {
return;
}
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 ((plasmoid.formFactor === 3 && y < child.y + child.height/2) ||
(plasmoid.formFactor !== 3 && x < child.x + child.width/2)) {
if ((root.isVertical && y < child.y + child.height/2) ||
(root.isHorizontal && x < child.x + child.width/2)) {
return insertBefore(child, item);
} else {
return insertAfter(child, item);

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

@ -665,10 +665,13 @@ Item {
zoomScale = zoomScale + step;
}
else{
if(layoutsContainer.hoveredIndex<container.index)
if(layoutsContainer.hoveredIndex<container.index){
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-2, 1, 0);
}
}
} ///if the applet is hidden must forward its scale events to its neighbours
else if ((applet && (applet.status === PlasmaCore.Types.HiddenStatus))
@ -758,30 +761,31 @@ Item {
}
onPositionChanged: {
if(!pressed){
if (root.isHorizontal){
var step = Math.abs(layoutsContainer.currentSpot-mouse.x);
if (step >= container.animationStep){
layoutsContainer.hoveredIndex = index;
layoutsContainer.currentSpot = mouse.x;
wrapper.calculateScales(mouse.x);
}
// if(!pressed){
if (root.isHorizontal){
var step = Math.abs(layoutsContainer.currentSpot-mouse.x);
if (step >= container.animationStep){
layoutsContainer.hoveredIndex = index;
layoutsContainer.currentSpot = mouse.x;
wrapper.calculateScales(mouse.x);
}
else{
var step = Math.abs(layoutsContainer.currentSpot-mouse.y);
if (step >= container.animationStep){
layoutsContainer.hoveredIndex = index;
layoutsContainer.currentSpot = mouse.y;
}
else{
var step = Math.abs(layoutsContainer.currentSpot-mouse.y);
if (step >= container.animationStep){
layoutsContainer.hoveredIndex = index;
layoutsContainer.currentSpot = mouse.y;
wrapper.calculateScales(mouse.y);
}
wrapper.calculateScales(mouse.y);
}
}
// }
mouse.accepted = false;
}
onPressed: pressed = true;
onReleased: pressed = false;
}
//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 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{
target: dock ? dock : manager
property:"maxThickness"
@ -71,22 +62,22 @@ Item{
onThicknessZoomOriginalChanged: updateMaskArea();
function slotDisableHidingChanged() {
if (!dock.visibility.disableHiding) {
/*if (!dock.visibility.disableHiding) {
checkListHovered.restart();
}
}*/
}
function slotIsHoveredChanged() {
if(dock.visibility.isHovered) {
function slotContainsMouseChanged() {
if(dock.visibility.containsMouse) {
//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) {
hideMagicWindowInAutoHide.forcedDisableHiding = false;
dock.visibility.disableHiding = false;
}
hideMagicWindowInAutoHide.stop();
}
}*/
if (delayerTimer.running) {
delayerTimer.stop();
@ -99,29 +90,23 @@ Item{
}
}
function slotMustBeRaised() {
if ((dock.visibility.panelVisibility === Latte.Dock.AutoHide) || dock.visibility.isDockWindowType) {
slidingAnimationAutoHiddenIn.init();
} else {
slidingAnimation.init(true,false);
}
function slotMustBeShown() {
console.log("show...");
slidingAnimationAutoHiddenIn.init();
}
function slotMustBeRaisedImmediately() {
slidingAnimation.init(true,true);
}
function slotMustBeLowered() {
if ((dock.visibility.panelVisibility === Latte.Dock.AutoHide) || dock.visibility.isDockWindowType ) {
slidingAnimationAutoHiddenOut.init();
} else {
slidingAnimation.init(false,false);
}
function slotMustBeHide() {
console.log("hide....");
slidingAnimationAutoHiddenOut.init();
}
function slotPanelVisibilityChanged() {
if (dock.visibility.panelVisibility !== Latte.Dock.AutoHide) {
dock.visibility.isAutoHidden = false;
function slotModeChanged() {
if (dock.visibility.mode !== Latte.Dock.AutoHide) {
dock.visibility.isHidden = false;
}
}
@ -164,7 +149,7 @@ Item{
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;
}
@ -256,6 +241,10 @@ Item{
}
dock.maskArea = newMaskArea;
if(normalState && !dock.visibility.isHidden){
dock.setLocalDockGeometry(newMaskArea);
}
}
}
@ -358,7 +347,7 @@ Item{
}
onStopped: {
dock.visibility.isAutoHidden = true;
dock.visibility.isHidden = true;
updateMaskArea();
}
@ -385,7 +374,7 @@ Item{
}
function init() {
dock.visibility.isAutoHidden = false;
dock.visibility.isHidden = false;
updateMaskArea();
start();
}
@ -396,12 +385,12 @@ Item{
onCurrentActivityChanged: {
dock.visibility.disableHiding = true;
if (dock.visibility.isAutoHidden) {
dock.visibility.mustBeRaised();
if (dock.visibility.isHidden) {
dock.visibility.mustBeShown();
}
hideMagicWindowInAutoHide.forcedDisableHiding = true;
hideMagicWindowInAutoHide.start();
// hideMagicWindowInAutoHide.forcedDisableHiding = true;
// hideMagicWindowInAutoHide.start();
}
}
@ -424,9 +413,9 @@ Item{
interval: manager.inStartup ? 1000 : 500
onTriggered: {
layoutsContainer.opacity = 1;
if ((dock.visibility.panelVisibility !== Latte.Dock.AutoHide) && !dock.visibility.isDockWindowType) {
slidingAnimation.init(true,false);
} else {
if (dock.visibility.mode !== Latte.Dock.AutoHide) {
/*slidingAnimation.init(true,false);
} else {*/
slidingAnimationAutoHiddenIn.init();
}
}

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

@ -14,19 +14,22 @@ PlasmaCore.FrameSvgItem {
imagePath: "dialogs/background"
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 int windowSpace:8
signal updateThickness();
signal removeInternalViewSplitter();
signal addInternalViewSplitter();
Column{
id:mainColumn
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
spacing: 1.5*theme.defaultFont.pointSize
width: parent.width - 10
width: parent.width - 2*windowSpace
//////////// Location ////////////////
Column{
width:parent.width
@ -35,7 +38,7 @@ PlasmaCore.FrameSvgItem {
RowLayout{
width: parent.width
PlasmaComponents.Label{
text: i18n("Applets Alignment")
text: i18n("Location")
font.pointSize: 1.5 * theme.defaultFont.pointSize
Layout.alignment: Qt.AlignLeft
}
@ -47,12 +50,147 @@ PlasmaCore.FrameSvgItem {
Layout.alignment: Qt.AlignRight
horizontalAlignment: Text.AlignRight
// width: parent.width
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
// 0-Center, 1-Left, 2-Right, 3-Top, 4-Bottom
@ -70,21 +208,21 @@ PlasmaCore.FrameSvgItem {
centerPosition.checked = false;
lastPosition.checked = false;
splitTwoPosition.checked = false;
removeInternalViewSplitter();
dock.removeInternalViewSplitter();
}
else if(panelPosition == Latte.Dock.Center){
firstPosition.checked = false;
centerPosition.checked = true;
lastPosition.checked = false;
splitTwoPosition.checked = false;
removeInternalViewSplitter();
dock.removeInternalViewSplitter();
}
else if((panelPosition == Latte.Dock.Right)||(panelPosition == Latte.Dock.Bottom)){
firstPosition.checked = false;
centerPosition.checked = false;
lastPosition.checked = true;
splitTwoPosition.checked = false;
removeInternalViewSplitter();
dock.removeInternalViewSplitter();
}
else if (panelPosition == Latte.Dock.Double){
firstPosition.checked = false;
@ -92,7 +230,7 @@ PlasmaCore.FrameSvgItem {
lastPosition.checked = false;
splitTwoPosition.checked = true;
//add the splitter visual
addInternalViewSplitter(-1);
dock.addInternalViewSplitter();
}
}
@ -216,7 +354,7 @@ PlasmaCore.FrameSvgItem {
else
fifthState.checked = false;
/* if (panelVisibility === 5)
/* if (panelVisibility === 5)
sixthState.checked = true;
else
sixthState.checked = false;*/
@ -237,6 +375,7 @@ PlasmaCore.FrameSvgItem {
onCheckedChanged: {
if(checked && !parent.inStartup){
dock.visibility.mode = Latte.Dock.AlwaysVisible
plasmoid.configuration.panelVisibility = 0
}
}
@ -250,6 +389,7 @@ PlasmaCore.FrameSvgItem {
onCheckedChanged: {
if(checked && !parent.inStartup){
dock.visibility.mode = Latte.Dock.AutoHide
plasmoid.configuration.panelVisibility = 1
}
}
@ -263,6 +403,7 @@ PlasmaCore.FrameSvgItem {
onCheckedChanged: {
if(checked && !parent.inStartup){
dock.visibility.mode = Latte.Dock.DodgeActive
plasmoid.configuration.panelVisibility = 2
}
}
@ -277,6 +418,7 @@ PlasmaCore.FrameSvgItem {
onCheckedChanged: {
if(checked && !parent.inStartup){
dock.visibility.mode = Latte.Dock.DodgeMaximized
plasmoid.configuration.panelVisibility = 3
}
}
@ -291,12 +433,13 @@ PlasmaCore.FrameSvgItem {
onCheckedChanged: {
if(checked && !parent.inStartup){
dock.visibility.mode = Latte.Dock.DodgeWindows
plasmoid.configuration.panelVisibility = 4
}
}
onClicked: checked=true;
}
/* PlasmaComponents.Button{
/* PlasmaComponents.Button{
id: sixthState
checkable: true
text: i18n("Always Visible")
@ -304,6 +447,7 @@ PlasmaCore.FrameSvgItem {
onCheckedChanged: {
if(checked && !parent.inStartup){
dock.visibility.mode = Latte.Dock.AlwaysVisible
plasmoid.configuration.panelVisibility = 5
}
}
@ -598,6 +742,13 @@ PlasmaCore.FrameSvgItem {
text: i18n("Add New Dock")
onClicked: dock.addNewDock();
Component.onCompleted: {
var edges = dock.freeEdges();
if (edges.length === 0) {
enabled = false;
}
}
}
PlasmaComponents.Button{
enabled: true

Loading…
Cancel
Save