refactor:move currentScreen to View::Positioner

--rename also currentScreen to currentScreenName
for better semantic representation
pull/3/head
Michail Vourlakos 6 years ago
parent 186a641444
commit 642b524cc7

@ -185,7 +185,6 @@ void DockView::init()
connect(corona(), &Plasma::Corona::availableScreenRectChanged, this, &DockView::availableScreenRectChanged);
connect(m_positioner, &View::Positioner::currentScreenChanged, this, &DockView::currentScreenChanged);
connect(m_positioner, &View::Positioner::onHideWindowsForSlidingOut, this, &DockView::hideWindowsForSlidingOut);
connect(m_positioner, &View::Positioner::screenGeometryChanged, this, &DockView::screenGeometryChanged);
@ -324,11 +323,6 @@ QScreen *DockView::atScreens(QQmlListProperty<QScreen> *property, int index)
return qGuiApp->screens().at(index);
}
QString DockView::currentScreen() const
{
return m_positioner->currentScreenName();
}
bool DockView::settingsWindowIsShown()
{
auto configView = qobject_cast<DockConfigView *>(m_configView);

@ -84,8 +84,6 @@ class DockView : public PlasmaQuick::ContainmentView
Q_PROPERTY(int normalThickness READ normalThickness WRITE setNormalThickness NOTIFY normalThicknessChanged)
Q_PROPERTY(int offset READ offset WRITE setOffset NOTIFY offsetChanged)
Q_PROPERTY(QString currentScreen READ currentScreen NOTIFY currentScreenChanged)
Q_PROPERTY(float maxLength READ maxLength WRITE setMaxLength NOTIFY maxLengthChanged)
Q_PROPERTY(Latte::View::Effects *effects READ effects NOTIFY effectsChanged)
@ -153,8 +151,6 @@ public:
QRect absGeometry() const;
QRect screenGeometry() const;
QString currentScreen() const;
QRect localGeometry() const;
void setLocalGeometry(const QRect &geometry);
@ -223,7 +219,6 @@ signals:
void alignmentChanged();
void behaveAsPlasmaPanelChanged();
void contextMenuIsShownChanged();
void currentScreenChanged();
void dockLocationChanged();
void docksCountChanged();
void dockWinBehaviorChanged();

@ -586,7 +586,7 @@ void Positioner::initSignalingForLocationChangeSliding()
//! signals to handle the sliding-in/out during screen changes
connect(this, &Positioner::hideDockDuringScreenChangeStarted, this, &Positioner::onHideWindowsForSlidingOut);
connect(m_view, &DockView::currentScreenChanged, this, [&]() {
connect(this, &Positioner::currentScreenChanged, this, [&]() {
if (m_goToScreen) {
m_goToScreen = nullptr;
QTimer::singleShot(100, [this]() {

@ -42,6 +42,8 @@ class Positioner: public QObject
{
Q_OBJECT
Q_PROPERTY(QString currentScreenName READ currentScreenName NOTIFY currentScreenChanged)
public:
Positioner(DockView *parent);
virtual ~Positioner();

@ -800,7 +800,7 @@ void VisibilityManagerPrivate::updateAvailableScreenGeometry()
return;
}
int currentScrId = dockCorona->screenPool()->id(dockView->currentScreen());
int currentScrId = dockCorona->screenPool()->id(dockView->positioner()->currentScreenName());
QRect tempAvailableScreenGeometry = dockCorona->availableScreenRectWithCriteria(currentScrId, {Dock::AlwaysVisible}, {});
if (tempAvailableScreenGeometry != availableScreenGeometry) {

@ -26,6 +26,7 @@
#include "screenpool.h"
#include "universalsettings.h"
#include "dock/dockview.h"
#include "dock/positioner.h"
#include <QDir>
#include <QFile>
@ -1106,7 +1107,7 @@ void Layout::copyDock(Plasma::Containment *containment)
int copyScrId = -1;
if (dock) {
dockScrId = m_corona->screenPool()->id(dock->currentScreen());
dockScrId = m_corona->screenPool()->id(dock->positioner()->currentScreenName());
qDebug() << "COPY DOCK SCREEN ::: " << dockScrId;
if (dockScrId != -1 && screens.count() > 1) {
@ -1563,7 +1564,7 @@ void Layout::syncDockViewsToScreens()
//! remove views
foreach (auto view, m_dockViews) {
if (view->containment() && !futureShownViews.contains(view->containment()->id())) {
qDebug() << "syncDockViewsToScreens: view must be deleted... for containment:" << view->containment()->id() << " at screen:" << view->currentScreen();
qDebug() << "syncDockViewsToScreens: view must be deleted... for containment:" << view->containment()->id() << " at screen:" << view->positioner()->currentScreenName();
auto viewToDelete = m_dockViews.take(view->containment());
viewToDelete->disconnectSensitiveSignals();
viewToDelete->deleteLater();
@ -1782,7 +1783,7 @@ QList<Plasma::Types::Location> Layout::availableEdgesForView(QScreen *scr, DockV
foreach (auto view, m_dockViews) {
//! make sure that availabe edges takes into account only views that should be excluded,
//! this is why the forView should not be excluded
if (view && view != forView && view->currentScreen() == scr->name()) {
if (view && view != forView && view->positioner()->currentScreenName() == scr->name()) {
edges.removeOne(view->location());
}
}
@ -1801,7 +1802,7 @@ QList<Plasma::Types::Location> Layout::freeEdges(QScreen *scr) const
}
foreach (auto view, m_dockViews) {
if (view && view->currentScreen() == scr->name()) {
if (view && view->positioner()->currentScreenName() == scr->name()) {
edges.removeOne(view->location());
}
}
@ -1822,7 +1823,7 @@ QList<Plasma::Types::Location> Layout::freeEdges(int screen) const
QScreen *scr = m_corona->screenPool()->screenForId(screen);
foreach (auto view, m_dockViews) {
if (view && scr && view->currentScreen() == scr->name()) {
if (view && scr && view->positioner()->currentScreenName() == scr->name()) {
edges.removeOne(view->location());
}
}

@ -51,7 +51,7 @@ Window{
}
Text{
text: dock && dock.currentScreen ? dock.currentScreen : "___"
text: dock && dock.positioner ? dock.positioner.currentScreenName : "___"
}
Text{

@ -100,12 +100,12 @@ PlasmaComponents.Page {
//to has always a dock with tasks shown
var screenExists = false
for (var i = 0; i < dock.screens.length; i++) {
if (dock.screens[i].name === dock.currentScreen)
if (dock.screens[i].name === dock.positioner.currentScreenName)
screenExists = true;
}
if (!screenExists && !dock.onPrimary)
screens.push(rtlSpace + dock.currentScreen);
screens.push(rtlSpace + dock.positioner.currentScreenName);
for (var i = 0; i < dock.screens.length; i++) {
screens.push(rtlSpace + dock.screens[i].name)
@ -116,10 +116,10 @@ PlasmaComponents.Page {
if (dock.onPrimary) {
screenCmb.currentIndex = 0;
} else {
screenCmb.currentIndex = screenCmb.find(dock.currentScreen);
screenCmb.currentIndex = screenCmb.find(dock.positioner.currentScreenName);
}
console.log(dock.currentScreen);
console.log(dock.positioner.currentScreenName);
}
Connections{
@ -158,7 +158,7 @@ PlasmaComponents.Page {
dock.onPrimary = true;
acceptedIndex = true;
} else if (index>0 && (index !== find(dock.currentScreen) || dock.onPrimary)) {
} else if (index>0 && (index !== find(dock.positioner.currentScreenName) || dock.onPrimary)) {
console.log("current index changed!!! :"+ index);
console.log("screen must be changed...");

Loading…
Cancel
Save