refactor:move viewsCount to Layout

pull/3/head
Michail Vourlakos 6 years ago
parent bf097f3f62
commit 323ffbe3af

@ -121,7 +121,6 @@ DockView::DockView(Plasma::Corona *corona, QScreen *targetScreen, bool dockWindo
auto *dockCorona = qobject_cast<DockCorona *>(this->corona());
if (dockCorona) {
connect(dockCorona, &DockCorona::docksCountChanged, this, &DockView::docksCountChanged);
connect(dockCorona, &DockCorona::dockLocationChanged, this, &DockView::dockLocationChanged);
}
}
@ -166,8 +165,6 @@ DockView::~DockView()
void DockView::init()
{
connect(this, &QQuickWindow::screenChanged, this, &DockView::docksCountChanged);
connect(this, &QQuickWindow::xChanged, this, &DockView::xChanged);
connect(this, &QQuickWindow::xChanged, this, &DockView::updateAbsDockGeometry);
connect(this, &QQuickWindow::yChanged, this, &DockView::yChanged);
@ -474,15 +471,6 @@ void DockView::setNormalThickness(int thickness)
emit normalThicknessChanged();
}
int DockView::docksCount() const
{
if (!m_managedLayout) {
return 0;
}
return m_managedLayout->docksCount(screen());
}
int DockView::docksWithTasks()
{
if (!m_managedLayout)

@ -72,7 +72,6 @@ class DockView : public PlasmaQuick::ContainmentView
Q_PROPERTY(bool onPrimary READ onPrimary WRITE setOnPrimary NOTIFY onPrimaryChanged)
Q_PROPERTY(int alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged)
Q_PROPERTY(int docksCount READ docksCount NOTIFY docksCountChanged)
Q_PROPERTY(int fontPixelSize READ fontPixelSize WRITE setFontPixelSize NOTIFY fontPixelSizeChanged)
Q_PROPERTY(int x READ x NOTIFY xChanged)
Q_PROPERTY(int y READ y NOTIFY yChanged)
@ -109,8 +108,6 @@ public:
int currentThickness() const;
int docksCount() const;
bool behaveAsPlasmaPanel() const;
void setBehaveAsPlasmaPanel(bool behavior);
@ -209,7 +206,6 @@ signals:
void behaveAsPlasmaPanelChanged();
void contextMenuIsShownChanged();
void dockLocationChanged();
void docksCountChanged();
void dockWinBehaviorChanged();
void effectsChanged();
void fontPixelSizeChanged();

@ -281,8 +281,6 @@ void Positioner::reconsiderScreen()
syncGeometry();
qDebug() << "reconsiderScreen() ended...";
emit m_view->docksCountChanged();
}
void Positioner::screenChanged(QScreen *scr)

@ -123,7 +123,6 @@ public slots:
signals:
void configurationShown(PlasmaQuick::ConfigView *configView);
void docksCountChanged();
void dockLocationChanged();
void raiseDocksTemporaryChanged();

@ -817,7 +817,6 @@ void Layout::destroyedChanged(bool destroyed)
m_dockViews[sender] = m_waitingDockViews.take(static_cast<Plasma::Containment *>(sender));
}
//emit m_corona->docksCountChanged();
emit viewsCountChanged();
emit m_corona->availableScreenRectChanged();
emit m_corona->availableScreenRegionChanged();
@ -850,7 +849,6 @@ void Layout::containmentDestroyed(QObject *cont)
view->deleteLater();
//emit m_corona->docksCountChanged();
emit viewsCountChanged();
emit m_corona->availableScreenRectChanged();
emit m_corona->availableScreenRegionChanged();
@ -1009,7 +1007,6 @@ void Layout::addDock(Plasma::Containment *containment, bool forceOnPrimary, int
m_dockViews[containment] = dockView;
emit viewColorizerChanged();
//emit m_corona->docksCountChanged();
emit viewsCountChanged();
}
@ -1716,7 +1713,6 @@ void Layout::assignToLayout(DockView *dockView, QList<Plasma::Containment *> con
dockView->setManagedLayout(this);
//emit m_corona->docksCountChanged();
emit viewsCountChanged();
emit m_corona->availableScreenRectChanged();
emit m_corona->availableScreenRegionChanged();

@ -186,7 +186,16 @@ PlasmaComponents.Page {
Connections{
target: dock
onDockLocationChanged: locationLayout.lockReservedEdges();
onDocksCountChanged: locationLayout.lockReservedEdges();
}
Connections{
target: dock.managedLayout
onViewsCountChanged: locationLayout.lockReservedEdges();
}
Connections{
target: dock.positioner
onCurrentScreenChanged: locationLayout.lockReservedEdges();
}
Component.onCompleted: lockReservedEdges()

@ -485,14 +485,14 @@ FocusScope {
spacing: units.largeSpacing
Connections{
target: dock
onDocksCountChanged: actionButtons.updateEnabled();
target: dock.managedLayout
onViewsCountChanged: actionButtons.updateEnabled();
}
function updateEnabled() {
var screenFreeEdges = dock.managedLayout.qmlFreeEdges(dock.positioner.currentScreenId);
addDock.enabled = dock.docksCount < 4 && screenFreeEdges.length > 0
removeDock.enabled = dock.docksCount>1 && !(dock.docksWithTasks()===1 && dock.tasksPresent())
addDock.enabled = dock.managedLayout.viewsCount<4 && screenFreeEdges.length > 0
removeDock.enabled = dock.managedLayout.viewsCount>1 && !(dock.docksWithTasks()===1 && dock.tasksPresent())
}
PlasmaComponents.Button {

Loading…
Cancel
Save