mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-23 01:33:50 +03:00
RENAME TopLayout to SharedLayout
--Shared is a better term to describe these layouts that can be Shared and be OnTop of other layouts in Multiple Mode
This commit is contained in:
parent
1c6ddcad10
commit
e2ccad62d9
@ -30,7 +30,7 @@
|
||||
#include "indicator/factory.h"
|
||||
#include "layout/activelayout.h"
|
||||
#include "layout/genericlayout.h"
|
||||
#include "layout/toplayout.h"
|
||||
#include "layout/sharedlayout.h"
|
||||
#include "shortcuts/globalshortcuts.h"
|
||||
#include "package/lattepackage.h"
|
||||
#include "plasma/extended/screenpool.h"
|
||||
@ -477,13 +477,12 @@ QRegion Corona::availableScreenRegionWithCriteria(int id, QString forLayout) con
|
||||
Layout::GenericLayout *generic = m_layoutManager->activeLayout(forLayout);
|
||||
|
||||
if (!generic) {
|
||||
//! identify best active layout to be used for metrics
|
||||
//! active layouts are always considering their top layouts
|
||||
//! for their metrics
|
||||
TopLayout *topLayout = m_layoutManager->topLayout(forLayout);
|
||||
//! Identify best active layout to be used for metrics calculations.
|
||||
//! Active layouts are always take into account their shared layouts for their metrics
|
||||
SharedLayout *sharedLayout = m_layoutManager->sharedLayout(forLayout);
|
||||
|
||||
if (topLayout) {
|
||||
generic = topLayout->currentActiveLayout();
|
||||
if (sharedLayout) {
|
||||
generic = sharedLayout->currentActiveLayout();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@ set(lattedock-app_SRCS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/abstractlayout.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/activelayout.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/genericlayout.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sharedlayout.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/storage.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/toplayout.cpp
|
||||
PARENT_SCOPE
|
||||
)
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "activelayout.h"
|
||||
|
||||
// local
|
||||
#include "toplayout.h"
|
||||
#include "sharedlayout.h"
|
||||
#include "../lattecorona.h"
|
||||
#include "../layoutmanager.h"
|
||||
#include "../screenpool.h"
|
||||
@ -58,9 +58,9 @@ void ActiveLayout::unloadContainments()
|
||||
{
|
||||
Layout::GenericLayout::unloadContainments();
|
||||
|
||||
if (m_topLayout) {
|
||||
disconnect(m_topLayout, &Layout::GenericLayout::viewsCountChanged, this, &Layout::GenericLayout::viewsCountChanged);
|
||||
m_topLayout->removeActiveLayout(this);
|
||||
if (m_sharedLayout) {
|
||||
disconnect(m_sharedLayout, &Layout::GenericLayout::viewsCountChanged, this, &Layout::GenericLayout::viewsCountChanged);
|
||||
m_sharedLayout->removeActiveLayout(this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,8 +68,8 @@ void ActiveLayout::init()
|
||||
{
|
||||
connect(this, &ActiveLayout::activitiesChanged, this, &ActiveLayout::saveConfig);
|
||||
connect(this, &ActiveLayout::disableBordersForMaximizedWindowsChanged, this, &ActiveLayout::saveConfig);
|
||||
connect(this, &ActiveLayout::sharedLayoutNameChanged, this, &ActiveLayout::saveConfig);
|
||||
connect(this, &ActiveLayout::showInMenuChanged, this, &ActiveLayout::saveConfig);
|
||||
connect(this, &ActiveLayout::topLayoutNameChanged, this, &ActiveLayout::saveConfig);
|
||||
}
|
||||
|
||||
void ActiveLayout::initToCorona(Latte::Corona *corona)
|
||||
@ -95,10 +95,10 @@ void ActiveLayout::initToCorona(Latte::Corona *corona)
|
||||
});
|
||||
}
|
||||
|
||||
//! Request the TopLayout in case there is one and Latte is functioning in MultipleLayouts mode
|
||||
if (m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts && !m_topLayoutName.isEmpty()) {
|
||||
if (m_corona->layoutManager()->assignActiveToTopLayout(this, m_topLayoutName)) {
|
||||
setTopLayout(m_corona->layoutManager()->topLayout(m_topLayoutName));
|
||||
//! Request the SharedLayout in case there is one and Latte is functioning in MultipleLayouts mode
|
||||
if (m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts && !m_sharedLayoutName.isEmpty()) {
|
||||
if (m_corona->layoutManager()->assignActiveToSharedLayout(this, m_sharedLayoutName)) {
|
||||
setSharedLayout(m_corona->layoutManager()->sharedLayout(m_sharedLayoutName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -186,31 +186,31 @@ void ActiveLayout::setActivities(QStringList activities)
|
||||
emit activitiesChanged();
|
||||
}
|
||||
|
||||
QString ActiveLayout::topLayoutName() const
|
||||
QString ActiveLayout::sharedLayoutName() const
|
||||
{
|
||||
return m_topLayoutName;
|
||||
return m_sharedLayoutName;
|
||||
}
|
||||
|
||||
void ActiveLayout::setTopLayoutName(QString name)
|
||||
void ActiveLayout::setSharedLayoutName(QString name)
|
||||
{
|
||||
if (m_topLayoutName == name) {
|
||||
if (m_sharedLayoutName == name) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_topLayoutName = name;
|
||||
emit topLayoutNameChanged();
|
||||
m_sharedLayoutName = name;
|
||||
emit sharedLayoutNameChanged();
|
||||
}
|
||||
|
||||
void ActiveLayout::setTopLayout(TopLayout *layout)
|
||||
void ActiveLayout::setSharedLayout(SharedLayout *layout)
|
||||
{
|
||||
if (m_topLayout == layout) {
|
||||
if (m_sharedLayout == layout) {
|
||||
return;
|
||||
}
|
||||
disconnect(m_topLayout, &Layout::GenericLayout::viewsCountChanged, this, &Layout::GenericLayout::viewsCountChanged);
|
||||
disconnect(m_sharedLayout, &Layout::GenericLayout::viewsCountChanged, this, &Layout::GenericLayout::viewsCountChanged);
|
||||
|
||||
m_topLayout = layout;
|
||||
m_sharedLayout = layout;
|
||||
|
||||
connect(m_topLayout, &Layout::GenericLayout::viewsCountChanged, this, &Layout::GenericLayout::viewsCountChanged);
|
||||
connect(m_sharedLayout, &Layout::GenericLayout::viewsCountChanged, this, &Layout::GenericLayout::viewsCountChanged);
|
||||
emit viewsCountChanged();
|
||||
}
|
||||
|
||||
@ -238,7 +238,7 @@ void ActiveLayout::loadConfig()
|
||||
{
|
||||
m_disableBordersForMaximizedWindows = m_layoutGroup.readEntry("disableBordersForMaximizedWindows", false);
|
||||
m_showInMenu = m_layoutGroup.readEntry("showInMenu", false);
|
||||
m_topLayoutName = m_layoutGroup.readEntry("topLayoutName", QString());
|
||||
m_sharedLayoutName = m_layoutGroup.readEntry("sharedLayout", QString());
|
||||
m_activities = m_layoutGroup.readEntry("activities", QStringList());
|
||||
|
||||
emit activitiesChanged();
|
||||
@ -249,7 +249,7 @@ void ActiveLayout::saveConfig()
|
||||
qDebug() << "active layout is saving... for layout:" << m_layoutName;
|
||||
m_layoutGroup.writeEntry("showInMenu", m_showInMenu);
|
||||
m_layoutGroup.writeEntry("disableBordersForMaximizedWindows", m_disableBordersForMaximizedWindows);
|
||||
m_layoutGroup.writeEntry("topLayoutName", m_topLayoutName);
|
||||
m_layoutGroup.writeEntry("sharedLayout", m_sharedLayoutName);
|
||||
m_layoutGroup.writeEntry("activities", m_activities);
|
||||
|
||||
m_layoutGroup.sync();
|
||||
@ -259,9 +259,9 @@ void ActiveLayout::saveConfig()
|
||||
|
||||
void ActiveLayout::addView(Plasma::Containment *containment, bool forceOnPrimary, int explicitScreen, Layout::ViewsMap *occupied)
|
||||
{
|
||||
if (m_topLayout) {
|
||||
//! consider already occupied edges from TopLayout
|
||||
Layout::ViewsMap ocMap = m_topLayout->validViewsMap();
|
||||
if (m_sharedLayout) {
|
||||
//! consider already occupied edges from SharedLayout
|
||||
Layout::ViewsMap ocMap = m_sharedLayout->validViewsMap();
|
||||
Layout::GenericLayout::addView(containment, forceOnPrimary, explicitScreen, &ocMap);
|
||||
} else {
|
||||
Layout::GenericLayout::addView(containment, forceOnPrimary, explicitScreen, occupied);
|
||||
@ -289,9 +289,9 @@ const QStringList ActiveLayout::appliedActivities()
|
||||
|
||||
QList<Latte::View *> ActiveLayout::latteViews()
|
||||
{
|
||||
if (m_topLayout) {
|
||||
if (m_sharedLayout) {
|
||||
QList<Latte::View *> views = Layout::GenericLayout::latteViews();
|
||||
views << m_topLayout->latteViews();
|
||||
views << m_sharedLayout->latteViews();
|
||||
|
||||
return views;
|
||||
}
|
||||
@ -307,10 +307,10 @@ int ActiveLayout::viewsCount(int screen) const
|
||||
|
||||
int views = Layout::GenericLayout::viewsCount(screen);
|
||||
|
||||
if (m_topLayout) {
|
||||
if (m_sharedLayout) {
|
||||
QScreen *scr = m_corona->screenPool()->screenForId(screen);
|
||||
|
||||
for (const auto view : m_topLayout->latteViews()) {
|
||||
for (const auto view : m_sharedLayout->latteViews()) {
|
||||
if (view && view->screen() == scr && !view->containment()->destroyed()) {
|
||||
++views;
|
||||
}
|
||||
@ -328,8 +328,8 @@ int ActiveLayout::viewsCount(QScreen *screen) const
|
||||
|
||||
int views = Layout::GenericLayout::viewsCount(screen);
|
||||
|
||||
if (m_topLayout) {
|
||||
for (const auto view : m_topLayout->latteViews()) {
|
||||
if (m_sharedLayout) {
|
||||
for (const auto view : m_sharedLayout->latteViews()) {
|
||||
if (view && view->screen() == screen && !view->containment()->destroyed()) {
|
||||
++views;
|
||||
}
|
||||
@ -347,8 +347,8 @@ int ActiveLayout::viewsCount() const
|
||||
|
||||
int views = Layout::GenericLayout::viewsCount();
|
||||
|
||||
if (m_topLayout) {
|
||||
for (const auto view : m_topLayout->latteViews()) {
|
||||
if (m_sharedLayout) {
|
||||
for (const auto view : m_sharedLayout->latteViews()) {
|
||||
if (view && view->containment() && !view->containment()->destroyed()) {
|
||||
++views;
|
||||
}
|
||||
@ -370,8 +370,8 @@ QList<Plasma::Types::Location> ActiveLayout::availableEdgesForView(QScreen *scr,
|
||||
|
||||
edges = Layout::GenericLayout::availableEdgesForView(scr, forView);
|
||||
|
||||
if (m_topLayout) {
|
||||
for (const auto view : m_topLayout->latteViews()) {
|
||||
if (m_sharedLayout) {
|
||||
for (const auto view : m_sharedLayout->latteViews()) {
|
||||
//! 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->positioner()->currentScreenName() == scr->name()) {
|
||||
@ -395,8 +395,8 @@ QList<Plasma::Types::Location> ActiveLayout::freeEdges(QScreen *scr) const
|
||||
|
||||
edges = Layout::GenericLayout::freeEdges(scr);
|
||||
|
||||
if (m_topLayout) {
|
||||
for (const auto view : m_topLayout->latteViews()) {
|
||||
if (m_sharedLayout) {
|
||||
for (const auto view : m_sharedLayout->latteViews()) {
|
||||
if (view && view->positioner()->currentScreenName() == scr->name()) {
|
||||
edges.removeOne(view->location());
|
||||
}
|
||||
@ -419,8 +419,8 @@ QList<Plasma::Types::Location> ActiveLayout::freeEdges(int screen) const
|
||||
edges = Layout::GenericLayout::freeEdges(screen);
|
||||
QScreen *scr = m_corona->screenPool()->screenForId(screen);
|
||||
|
||||
if (m_topLayout) {
|
||||
for (const auto view : m_topLayout->latteViews()) {
|
||||
if (m_sharedLayout) {
|
||||
for (const auto view : m_sharedLayout->latteViews()) {
|
||||
if (view && scr && view->positioner()->currentScreenName() == scr->name()) {
|
||||
edges.removeOne(view->location());
|
||||
}
|
||||
@ -441,8 +441,8 @@ QList<Latte::View *> ActiveLayout::viewsWithPlasmaShortcuts()
|
||||
{
|
||||
QList<Latte::View *> combined = Layout::GenericLayout::viewsWithPlasmaShortcuts();
|
||||
|
||||
if (m_topLayout) {
|
||||
combined << m_topLayout->viewsWithPlasmaShortcuts();
|
||||
if (m_sharedLayout) {
|
||||
combined << m_sharedLayout->viewsWithPlasmaShortcuts();
|
||||
}
|
||||
|
||||
return combined;
|
||||
@ -450,8 +450,8 @@ QList<Latte::View *> ActiveLayout::viewsWithPlasmaShortcuts()
|
||||
|
||||
void ActiveLayout::syncLatteViewsToScreens(Layout::ViewsMap *occupiedMap)
|
||||
{
|
||||
if (m_topLayout) {
|
||||
Layout::ViewsMap map = m_topLayout->validViewsMap();
|
||||
if (m_sharedLayout) {
|
||||
Layout::ViewsMap map = m_sharedLayout->validViewsMap();
|
||||
Layout::GenericLayout::syncLatteViewsToScreens(&map);
|
||||
} else {
|
||||
Layout::GenericLayout::syncLatteViewsToScreens();
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
namespace Latte {
|
||||
class Corona;
|
||||
class TopLayout;
|
||||
class SharedLayout;
|
||||
}
|
||||
|
||||
namespace Latte {
|
||||
@ -58,8 +58,8 @@ public:
|
||||
//!it is original layout compared to pseudo-layouts that are combinations of multiple-original layouts
|
||||
bool isOriginalLayout() const;
|
||||
|
||||
QString topLayoutName() const;
|
||||
void setTopLayoutName(QString name);
|
||||
QString sharedLayoutName() const;
|
||||
void setSharedLayoutName(QString name);
|
||||
|
||||
QStringList activities() const;
|
||||
void setActivities(QStringList activities);
|
||||
@ -88,13 +88,13 @@ signals:
|
||||
void activitiesChanged();
|
||||
void disableBordersForMaximizedWindowsChanged();
|
||||
void showInMenuChanged();
|
||||
void topLayoutNameChanged();
|
||||
void sharedLayoutNameChanged();
|
||||
|
||||
private slots:
|
||||
void loadConfig();
|
||||
void saveConfig();
|
||||
|
||||
void setTopLayout(TopLayout *layout);
|
||||
void setSharedLayout(SharedLayout *layout);
|
||||
|
||||
private:
|
||||
void init();
|
||||
@ -106,10 +106,10 @@ private:
|
||||
private:
|
||||
bool m_disableBordersForMaximizedWindows{false};
|
||||
bool m_showInMenu{false};
|
||||
QString m_topLayoutName;
|
||||
QString m_sharedLayoutName;
|
||||
QStringList m_activities;
|
||||
|
||||
QPointer<TopLayout> m_topLayout;
|
||||
QPointer<SharedLayout> m_sharedLayout;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "toplayout.h"
|
||||
#include "sharedlayout.h"
|
||||
|
||||
// local
|
||||
#include "activelayout.h"
|
||||
@ -28,23 +28,23 @@
|
||||
|
||||
namespace Latte {
|
||||
|
||||
TopLayout::TopLayout(ActiveLayout *assigned, QObject *parent, QString layoutFile, QString layoutName)
|
||||
SharedLayout::SharedLayout(ActiveLayout *assigned, QObject *parent, QString layoutFile, QString layoutName)
|
||||
: Layout::GenericLayout (parent, layoutFile, layoutName)
|
||||
{
|
||||
initToCorona(assigned->corona());
|
||||
|
||||
connect(m_corona->layoutManager(), &LayoutManager::currentLayoutNameChanged, this, &TopLayout::updateLastUsedActiveLayout);
|
||||
connect(m_corona->layoutManager(), &LayoutManager::currentLayoutNameChanged, this, &SharedLayout::updateLastUsedActiveLayout);
|
||||
|
||||
addActiveLayout(assigned);
|
||||
updateLastUsedActiveLayout();
|
||||
}
|
||||
|
||||
|
||||
TopLayout::~TopLayout()
|
||||
SharedLayout::~SharedLayout()
|
||||
{
|
||||
}
|
||||
|
||||
bool TopLayout::isCurrent() const
|
||||
bool SharedLayout::isCurrent() const
|
||||
{
|
||||
for (const auto &layout : m_activeLayouts) {
|
||||
if (layout->isCurrent()) {
|
||||
@ -55,7 +55,7 @@ bool TopLayout::isCurrent() const
|
||||
return false;
|
||||
}
|
||||
|
||||
const QStringList TopLayout::appliedActivities()
|
||||
const QStringList SharedLayout::appliedActivities()
|
||||
{
|
||||
if (!m_corona) {
|
||||
return {};
|
||||
@ -70,7 +70,7 @@ const QStringList TopLayout::appliedActivities()
|
||||
return activities;
|
||||
}
|
||||
|
||||
void TopLayout::updateLastUsedActiveLayout()
|
||||
void SharedLayout::updateLastUsedActiveLayout()
|
||||
{
|
||||
for (const auto &layout : m_activeLayouts) {
|
||||
if (layout->isCurrent()) {
|
||||
@ -80,7 +80,7 @@ void TopLayout::updateLastUsedActiveLayout()
|
||||
}
|
||||
}
|
||||
|
||||
ActiveLayout *TopLayout::currentActiveLayout() const
|
||||
ActiveLayout *SharedLayout::currentActiveLayout() const
|
||||
{
|
||||
//! first the current active one
|
||||
for (const auto &layout : m_activeLayouts) {
|
||||
@ -99,7 +99,7 @@ ActiveLayout *TopLayout::currentActiveLayout() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void TopLayout::addActiveLayout(ActiveLayout *layout)
|
||||
void SharedLayout::addActiveLayout(ActiveLayout *layout)
|
||||
{
|
||||
if (layout != nullptr && !m_activeLayouts.contains(layout)) {
|
||||
m_activeLayouts.append(layout);
|
||||
@ -112,10 +112,10 @@ void TopLayout::addActiveLayout(ActiveLayout *layout)
|
||||
}
|
||||
}
|
||||
|
||||
void TopLayout::removeActiveLayout(ActiveLayout *layout)
|
||||
void SharedLayout::removeActiveLayout(ActiveLayout *layout)
|
||||
{
|
||||
if (m_activeLayouts.contains(layout)) {
|
||||
qDebug() << "TOPLAYOUT <" << name() << "> : Removing active layout, " << layout->name();
|
||||
qDebug() << "SHAREDLAYOUT <" << name() << "> : Removing active layout, " << layout->name();
|
||||
|
||||
m_activeLayouts.removeAll(layout);
|
||||
|
||||
@ -129,7 +129,7 @@ void TopLayout::removeActiveLayout(ActiveLayout *layout)
|
||||
}
|
||||
|
||||
//! OVERRIDE
|
||||
int TopLayout::viewsCount(int screen) const
|
||||
int SharedLayout::viewsCount(int screen) const
|
||||
{
|
||||
if (!m_corona) {
|
||||
return 0;
|
||||
@ -144,7 +144,7 @@ int TopLayout::viewsCount(int screen) const
|
||||
return Layout::GenericLayout::viewsCount(screen);
|
||||
}
|
||||
|
||||
int TopLayout::viewsCount(QScreen *screen) const
|
||||
int SharedLayout::viewsCount(QScreen *screen) const
|
||||
{
|
||||
if (!m_corona) {
|
||||
return 0;
|
||||
@ -159,7 +159,7 @@ int TopLayout::viewsCount(QScreen *screen) const
|
||||
return Layout::GenericLayout::viewsCount(screen);;
|
||||
}
|
||||
|
||||
int TopLayout::viewsCount() const
|
||||
int SharedLayout::viewsCount() const
|
||||
{
|
||||
if (!m_corona) {
|
||||
return 0;
|
||||
@ -174,7 +174,7 @@ int TopLayout::viewsCount() const
|
||||
return Layout::GenericLayout::viewsCount();
|
||||
}
|
||||
|
||||
QList<Plasma::Types::Location> TopLayout::availableEdgesForView(QScreen *scr, Latte::View *forView) const
|
||||
QList<Plasma::Types::Location> SharedLayout::availableEdgesForView(QScreen *scr, Latte::View *forView) const
|
||||
{
|
||||
using Plasma::Types;
|
||||
QList<Types::Location> edges{Types::BottomEdge, Types::LeftEdge,
|
||||
@ -187,7 +187,7 @@ QList<Plasma::Types::Location> TopLayout::availableEdgesForView(QScreen *scr, La
|
||||
return Layout::GenericLayout::availableEdgesForView(scr, forView);
|
||||
}
|
||||
|
||||
QList<Plasma::Types::Location> TopLayout::freeEdges(QScreen *scr) const
|
||||
QList<Plasma::Types::Location> SharedLayout::freeEdges(QScreen *scr) const
|
||||
{
|
||||
using Plasma::Types;
|
||||
QList<Types::Location> edges{Types::BottomEdge, Types::LeftEdge,
|
||||
@ -206,7 +206,7 @@ QList<Plasma::Types::Location> TopLayout::freeEdges(QScreen *scr) const
|
||||
return Layout::GenericLayout::freeEdges(scr);
|
||||
}
|
||||
|
||||
QList<Plasma::Types::Location> TopLayout::freeEdges(int screen) const
|
||||
QList<Plasma::Types::Location> SharedLayout::freeEdges(int screen) const
|
||||
{
|
||||
using Plasma::Types;
|
||||
QList<Types::Location> edges{Types::BottomEdge, Types::LeftEdge,
|
||||
@ -225,7 +225,7 @@ QList<Plasma::Types::Location> TopLayout::freeEdges(int screen) const
|
||||
return Layout::GenericLayout::freeEdges(screen);
|
||||
}
|
||||
|
||||
QList<Latte::View *> TopLayout::sortedLatteViews(QList<Latte::View *> views)
|
||||
QList<Latte::View *> SharedLayout::sortedLatteViews(QList<Latte::View *> views)
|
||||
{
|
||||
ActiveLayout *current = currentActiveLayout();
|
||||
|
@ -17,8 +17,8 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TOPLAYOUT_H
|
||||
#define TOPLAYOUT_H
|
||||
#ifndef SHAREDLAYOUT_H
|
||||
#define SHAREDLAYOUT_H
|
||||
|
||||
// local
|
||||
#include "genericlayout.h"
|
||||
@ -33,18 +33,18 @@ class ActiveLayout;
|
||||
|
||||
namespace Latte {
|
||||
|
||||
//! TopLayout is a layout that exists only as long as it belongs to one or
|
||||
//! SharedLayout is a layout that exists only as long as it belongs to one or
|
||||
//! more ActiveLayout(s). It is a layer above an active or more layouts and can
|
||||
//! be used from ActiveLayouts to share Latte:View(s) . Much of its functionality
|
||||
//! is provided by the ActiveLayouts it belongs to. For example the activities
|
||||
//! that its views should be shown is identified only from the active layouts
|
||||
//! it belongs to
|
||||
|
||||
class TopLayout : public Layout::GenericLayout
|
||||
class SharedLayout : public Layout::GenericLayout
|
||||
{
|
||||
public:
|
||||
TopLayout(ActiveLayout *assigned, QObject *parent, QString layoutFile, QString layoutName = QString());
|
||||
~TopLayout() override;
|
||||
SharedLayout(ActiveLayout *assigned, QObject *parent, QString layoutFile, QString layoutName = QString());
|
||||
~SharedLayout() override;
|
||||
|
||||
const QStringList appliedActivities();
|
||||
ActiveLayout *currentActiveLayout() const;
|
||||
@ -80,4 +80,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif //TOPLAYOUT_H
|
||||
#endif //SHAREDLAYOUT_H
|
@ -28,7 +28,7 @@
|
||||
#include "layout/abstractlayout.h"
|
||||
#include "layout/activelayout.h"
|
||||
#include "layout/genericlayout.h"
|
||||
#include "layout/toplayout.h"
|
||||
#include "layout/sharedlayout.h"
|
||||
#include "settings/settingsdialog.h"
|
||||
#include "settings/universalsettings.h"
|
||||
#include "view/view.h"
|
||||
@ -144,10 +144,10 @@ void LayoutManager::unload()
|
||||
delete layout;
|
||||
}
|
||||
|
||||
//! Unload all TopLayouts
|
||||
while (!m_topLayouts.isEmpty()) {
|
||||
TopLayout *layout = m_topLayouts.at(0);
|
||||
m_topLayouts.removeFirst();
|
||||
//! Unload all SharedLayouts
|
||||
while (!m_sharedLayouts.isEmpty()) {
|
||||
SharedLayout *layout = m_sharedLayouts.at(0);
|
||||
m_sharedLayouts.removeFirst();
|
||||
|
||||
if (multipleMode) {
|
||||
layout->syncToLayoutFile(true);
|
||||
@ -345,7 +345,7 @@ Layout::GenericLayout *LayoutManager::layout(QString id) const
|
||||
Layout::GenericLayout *l = activeLayout(id);
|
||||
|
||||
if (!l) {
|
||||
l = topLayout(id);
|
||||
l = sharedLayout(id);
|
||||
}
|
||||
|
||||
return l;
|
||||
@ -380,10 +380,10 @@ int LayoutManager::activeLayoutPos(QString id) const
|
||||
return -1;
|
||||
}
|
||||
|
||||
TopLayout *LayoutManager::topLayout(QString id) const
|
||||
SharedLayout *LayoutManager::sharedLayout(QString id) const
|
||||
{
|
||||
for (int i = 0; i < m_topLayouts.size(); ++i) {
|
||||
TopLayout *layout = m_topLayouts.at(i);
|
||||
for (int i = 0; i < m_sharedLayouts.size(); ++i) {
|
||||
SharedLayout *layout = m_sharedLayouts.at(i);
|
||||
|
||||
if (layout->name() == id) {
|
||||
return layout;
|
||||
@ -393,14 +393,14 @@ TopLayout *LayoutManager::topLayout(QString id) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool LayoutManager::assignActiveToTopLayout(ActiveLayout *active, QString id)
|
||||
bool LayoutManager::assignActiveToSharedLayout(ActiveLayout *active, QString id)
|
||||
{
|
||||
if (memoryUsage() == Types::SingleLayout) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_topLayouts.size(); ++i) {
|
||||
TopLayout *layout = m_topLayouts.at(i);
|
||||
for (int i = 0; i < m_sharedLayouts.size(); ++i) {
|
||||
SharedLayout *layout = m_sharedLayouts.at(i);
|
||||
|
||||
if (layout->name() == id) {
|
||||
layout->addActiveLayout(active);
|
||||
@ -409,9 +409,9 @@ bool LayoutManager::assignActiveToTopLayout(ActiveLayout *active, QString id)
|
||||
}
|
||||
}
|
||||
|
||||
//! If TopLayout was not found, we must create it
|
||||
TopLayout *top = new TopLayout(active, this, Importer::layoutFilePath(id));
|
||||
m_topLayouts.append(top);
|
||||
//! If SharedLayout was not found, we must create it
|
||||
SharedLayout *top = new SharedLayout(active, this, Importer::layoutFilePath(id));
|
||||
m_sharedLayouts.append(top);
|
||||
top->importToCorona();
|
||||
// syncLatteViewsToScreens();
|
||||
|
||||
@ -723,7 +723,7 @@ bool LayoutManager::switchToLayout(QString layoutName, int previousMemoryUsage)
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto layout : m_topLayouts) {
|
||||
for (const auto layout : m_sharedLayouts) {
|
||||
emit currentLayoutIsSwitching(layout->name());
|
||||
}
|
||||
}
|
||||
@ -1012,7 +1012,7 @@ void LayoutManager::clearUnloadedContainmentsFromLinkedFile(QStringList containm
|
||||
|
||||
void LayoutManager::syncLatteViewsToScreens()
|
||||
{
|
||||
for (const auto layout : m_topLayouts) {
|
||||
for (const auto layout : m_sharedLayouts) {
|
||||
layout->syncLatteViewsToScreens();
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ class Corona;
|
||||
class Importer;
|
||||
class ActiveLayout;
|
||||
class LaunchersSignals;
|
||||
class TopLayout;
|
||||
class SharedLayout;
|
||||
class View;
|
||||
namespace Layout {
|
||||
class GenericLayout;
|
||||
@ -103,8 +103,8 @@ public:
|
||||
//! layout cant be found
|
||||
ActiveLayout *activeLayout(QString id) const;
|
||||
int activeLayoutPos(QString id) const;
|
||||
TopLayout *topLayout(QString id) const;
|
||||
//! return an active or top layout with #id (name), it returns null if such
|
||||
SharedLayout *sharedLayout(QString id) const;
|
||||
//! return an active or shared layout with #id (name), it returns null if such
|
||||
//! loaded layout was not found
|
||||
Layout::GenericLayout *layout(QString id) const;
|
||||
|
||||
@ -119,7 +119,7 @@ public:
|
||||
void importDefaultLayout(bool newInstanceIfPresent = false);
|
||||
void importPresets(bool includeDefault = false);
|
||||
|
||||
bool assignActiveToTopLayout(ActiveLayout *active, QString id);
|
||||
bool assignActiveToSharedLayout(ActiveLayout *active, QString id);
|
||||
|
||||
public slots:
|
||||
void showAboutDialog();
|
||||
@ -197,7 +197,7 @@ private:
|
||||
LaunchersSignals *m_launchersSignals{nullptr};
|
||||
|
||||
QList<ActiveLayout *> m_activeLayouts;
|
||||
QList<TopLayout *> m_topLayouts;
|
||||
QList<SharedLayout *> m_sharedLayouts;
|
||||
|
||||
KActivities::Controller *m_activitiesController;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user