mirror of
https://github.com/KDE/latte-dock.git
synced 2025-01-09 17:18:11 +03:00
REFACTOR:Update LayoutManager to Layouts::Manager
--create "layouts" own directory in order to host all LAYOUTS management/control code and classes
This commit is contained in:
parent
29157f4636
commit
a27ff3ec48
@ -6,7 +6,6 @@ set(lattedock-app_SRCS
|
||||
infoview.cpp
|
||||
lattecorona.cpp
|
||||
launcherssignals.cpp
|
||||
layoutmanager.cpp
|
||||
schemecolors.cpp
|
||||
screenpool.cpp
|
||||
main.cpp
|
||||
@ -14,6 +13,7 @@ set(lattedock-app_SRCS
|
||||
|
||||
add_subdirectory(indicator)
|
||||
add_subdirectory(layout)
|
||||
add_subdirectory(layouts)
|
||||
add_subdirectory(package)
|
||||
add_subdirectory(plasma/extended)
|
||||
add_subdirectory(settings)
|
||||
|
@ -22,9 +22,9 @@
|
||||
|
||||
// local
|
||||
#include "lattecorona.h"
|
||||
#include "layoutmanager.h"
|
||||
#include "screenpool.h"
|
||||
#include "layout/abstractlayout.h"
|
||||
#include "layouts/manager.h"
|
||||
#include "settings/universalsettings.h"
|
||||
#include "../liblatte2/types.h"
|
||||
|
||||
@ -45,7 +45,7 @@ namespace Latte {
|
||||
Importer::Importer(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
m_manager = qobject_cast<LayoutManager *>(parent);
|
||||
m_manager = qobject_cast<Layouts::Manager *>(parent);
|
||||
}
|
||||
|
||||
Importer::~Importer()
|
||||
|
@ -25,7 +25,9 @@
|
||||
#include <QObject>
|
||||
|
||||
namespace Latte {
|
||||
class LayoutManager;
|
||||
namespace Layouts {
|
||||
class Manager;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Latte {
|
||||
@ -101,7 +103,7 @@ private:
|
||||
//! the new layout path and an empty string if it cant
|
||||
QString layoutCanBeImported(QString oldAppletsPath, QString newName, QString exportDirectory = QString());
|
||||
|
||||
LayoutManager *m_manager;
|
||||
Layouts::Manager *m_manager;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -25,12 +25,12 @@
|
||||
#include "importer.h"
|
||||
#include "lattedockadaptor.h"
|
||||
#include "launcherssignals.h"
|
||||
#include "layoutmanager.h"
|
||||
#include "screenpool.h"
|
||||
#include "indicator/factory.h"
|
||||
#include "layout/centrallayout.h"
|
||||
#include "layout/genericlayout.h"
|
||||
#include "layout/sharedlayout.h"
|
||||
#include "layouts/manager.h"
|
||||
#include "shortcuts/globalshortcuts.h"
|
||||
#include "package/lattepackage.h"
|
||||
#include "plasma/extended/screenpool.h"
|
||||
@ -88,7 +88,7 @@ Corona::Corona(bool defaultLayoutOnStartup, QString layoutNameOnStartUp, int use
|
||||
m_globalShortcuts(new GlobalShortcuts(this)),
|
||||
m_plasmaScreenPool(new PlasmaExtended::ScreenPool(this)),
|
||||
m_themeExtended(new PlasmaExtended::Theme(KSharedConfig::openConfig(), this)),
|
||||
m_layoutManager(new LayoutManager(this))
|
||||
m_layoutsManager(new Layouts::Manager(this))
|
||||
{
|
||||
//! create the window manager
|
||||
|
||||
@ -148,7 +148,7 @@ Corona::Corona(bool defaultLayoutOnStartup, QString layoutNameOnStartUp, int use
|
||||
Corona::~Corona()
|
||||
{
|
||||
//! BEGIN: Give the time to slide-out views when closing
|
||||
m_layoutManager->hideAllViews();
|
||||
m_layoutsManager->hideAllViews();
|
||||
|
||||
//! Don't delay the destruction under wayland in any case
|
||||
//! because it creates a crash with kwin effects
|
||||
@ -167,17 +167,17 @@ Corona::~Corona()
|
||||
|
||||
m_viewsScreenSyncTimer.stop();
|
||||
|
||||
if (m_layoutManager->memoryUsage() == Types::SingleLayout) {
|
||||
if (m_layoutsManager->memoryUsage() == Types::SingleLayout) {
|
||||
cleanConfig();
|
||||
}
|
||||
|
||||
qDebug() << "Latte Corona - unload: containments ...";
|
||||
|
||||
m_layoutManager->unload();
|
||||
m_layoutsManager->unload();
|
||||
|
||||
m_wm->deleteLater();
|
||||
m_globalShortcuts->deleteLater();
|
||||
m_layoutManager->deleteLater();
|
||||
m_layoutsManager->deleteLater();
|
||||
m_screenPool->deleteLater();
|
||||
m_universalSettings->deleteLater();
|
||||
m_plasmaScreenPool->deleteLater();
|
||||
@ -195,7 +195,7 @@ void Corona::load()
|
||||
{
|
||||
if (m_activityConsumer && (m_activityConsumer->serviceStatus() == KActivities::Consumer::Running) && m_activitiesStarting) {
|
||||
disconnect(m_activityConsumer, &KActivities::Consumer::serviceStatusChanged, this, &Corona::load);
|
||||
m_layoutManager->load();
|
||||
m_layoutsManager->load();
|
||||
|
||||
m_activitiesStarting = false;
|
||||
|
||||
@ -207,7 +207,7 @@ void Corona::load()
|
||||
|
||||
connect(m_screenPool, &ScreenPool::primaryPoolChanged, this, &Corona::screenCountChanged);
|
||||
|
||||
QString assignedLayout = m_layoutManager->shouldSwitchToLayout(m_activityConsumer->currentActivity());
|
||||
QString assignedLayout = m_layoutsManager->shouldSwitchToLayout(m_activityConsumer->currentActivity());
|
||||
|
||||
QString loadLayoutName = "";
|
||||
|
||||
@ -218,13 +218,13 @@ void Corona::load()
|
||||
loadLayoutName = m_universalSettings->currentLayoutName();
|
||||
}
|
||||
|
||||
if (!m_layoutManager->layoutExists(loadLayoutName)) {
|
||||
loadLayoutName = m_layoutManager->defaultLayoutName();
|
||||
m_layoutManager->importDefaultLayout(false);
|
||||
if (!m_layoutsManager->layoutExists(loadLayoutName)) {
|
||||
loadLayoutName = m_layoutsManager->defaultLayoutName();
|
||||
m_layoutsManager->importDefaultLayout(false);
|
||||
}
|
||||
} else if (m_defaultLayoutOnStartup) {
|
||||
loadLayoutName = m_layoutManager->importer()->uniqueLayoutName(m_layoutManager->defaultLayoutName());
|
||||
m_layoutManager->importDefaultLayout(true);
|
||||
loadLayoutName = m_layoutsManager->importer()->uniqueLayoutName(m_layoutsManager->defaultLayoutName());
|
||||
m_layoutsManager->importDefaultLayout(true);
|
||||
} else {
|
||||
loadLayoutName = m_layoutNameOnStartUp;
|
||||
}
|
||||
@ -239,7 +239,7 @@ void Corona::load()
|
||||
m_universalSettings->setLayoutsMemoryUsage(Types::SingleLayout);
|
||||
}
|
||||
|
||||
m_layoutManager->loadLayoutOnStartup(loadLayoutName);
|
||||
m_layoutsManager->loadLayoutOnStartup(loadLayoutName);
|
||||
|
||||
|
||||
//! load screens signals such screenGeometryChanged in order to support
|
||||
@ -396,11 +396,6 @@ UniversalSettings *Corona::universalSettings() const
|
||||
return m_universalSettings;
|
||||
}
|
||||
|
||||
LayoutManager *Corona::layoutManager() const
|
||||
{
|
||||
return m_layoutManager;
|
||||
}
|
||||
|
||||
AbstractWindowInterface *Corona::wm() const
|
||||
{
|
||||
return m_wm;
|
||||
@ -411,6 +406,11 @@ Indicator::Factory *Corona::indicatorFactory() const
|
||||
return m_indicatorFactory;
|
||||
}
|
||||
|
||||
Layouts::Manager *Corona::layoutsManager() const
|
||||
{
|
||||
return m_layoutsManager;
|
||||
}
|
||||
|
||||
PlasmaExtended::ScreenPool *Corona::plasmaScreenPool() const
|
||||
{
|
||||
return m_plasmaScreenPool;
|
||||
@ -476,15 +476,15 @@ QRegion Corona::availableScreenRegionWithCriteria(int id, QString forLayout) con
|
||||
QList<Latte::View *> views;
|
||||
|
||||
if (forLayout.isEmpty()) {
|
||||
Latte::CentralLayout *currentLayout = m_layoutManager->currentLayout();
|
||||
Latte::CentralLayout *currentLayout = m_layoutsManager->currentLayout();
|
||||
views = currentLayout->latteViews();
|
||||
} else {
|
||||
Layout::GenericLayout *generic = m_layoutManager->centralLayout(forLayout);
|
||||
Layout::GenericLayout *generic = m_layoutsManager->centralLayout(forLayout);
|
||||
|
||||
if (!generic) {
|
||||
//! 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);
|
||||
SharedLayout *sharedLayout = m_layoutsManager->sharedLayout(forLayout);
|
||||
|
||||
if (sharedLayout) {
|
||||
generic = sharedLayout->currentCentralLayout();
|
||||
@ -492,7 +492,7 @@ QRegion Corona::availableScreenRegionWithCriteria(int id, QString forLayout) con
|
||||
}
|
||||
|
||||
if (!generic) {
|
||||
generic = m_layoutManager->currentLayout();
|
||||
generic = m_layoutsManager->currentLayout();
|
||||
}
|
||||
|
||||
views = generic->latteViews();
|
||||
@ -619,7 +619,7 @@ QRect Corona::availableScreenRectWithCriteria(int id, QList<Types::Visibility> m
|
||||
|
||||
auto available = screen->geometry();
|
||||
|
||||
Latte::CentralLayout *currentLayout = m_layoutManager->currentLayout();
|
||||
Latte::CentralLayout *currentLayout = m_layoutsManager->currentLayout();
|
||||
QList<Latte::View *> views;
|
||||
|
||||
if (currentLayout) {
|
||||
@ -706,7 +706,7 @@ void Corona::screenCountChanged()
|
||||
//! concerning screen changed (for multi-screen setups mainly)
|
||||
void Corona::syncLatteViewsToScreens()
|
||||
{
|
||||
m_layoutManager->syncLatteViewsToScreens();
|
||||
m_layoutsManager->syncLatteViewsToScreens();
|
||||
}
|
||||
|
||||
int Corona::primaryScreenId() const
|
||||
@ -719,8 +719,8 @@ void Corona::closeApplication()
|
||||
//! this code must be called asynchronously because it is called
|
||||
//! also from qml (Settings window).
|
||||
QTimer::singleShot(5, [this]() {
|
||||
m_layoutManager->hideLatteSettingsDialog();
|
||||
m_layoutManager->hideAllViews();
|
||||
m_layoutsManager->hideLatteSettingsDialog();
|
||||
m_layoutsManager->hideAllViews();
|
||||
});
|
||||
|
||||
//! give the time for the views to hide themselves
|
||||
@ -767,7 +767,7 @@ int Corona::screenForContainment(const Plasma::Containment *containment) const
|
||||
}
|
||||
}
|
||||
|
||||
Latte::CentralLayout *currentLayout = m_layoutManager->currentLayout();
|
||||
Latte::CentralLayout *currentLayout = m_layoutsManager->currentLayout();
|
||||
Latte::View *view = currentLayout->viewForContainment(containment);
|
||||
|
||||
if (view && view->screen()) {
|
||||
@ -801,7 +801,7 @@ void Corona::showAlternativesForApplet(Plasma::Applet *applet)
|
||||
return;
|
||||
}
|
||||
|
||||
Latte::CentralLayout *currentLayout = m_layoutManager->currentLayout();
|
||||
Latte::CentralLayout *currentLayout = m_layoutsManager->currentLayout();
|
||||
Latte::View *latteView = currentLayout->viewForContainment(applet->containment());
|
||||
|
||||
KDeclarative::QmlObjectSharedEngine *qmlObj{nullptr};
|
||||
@ -890,7 +890,7 @@ void Corona::addViewForLayout(QString layoutName)
|
||||
QList<Types::Location> edges{Types::BottomEdge, Types::LeftEdge,
|
||||
Types::TopEdge, Types::RightEdge};
|
||||
|
||||
Layout::GenericLayout *currentLayout = m_layoutManager->layout(layoutName);
|
||||
Layout::GenericLayout *currentLayout = m_layoutsManager->layout(layoutName);
|
||||
|
||||
if (currentLayout) {
|
||||
edges = currentLayout->freeEdges(defaultContainment->screen());
|
||||
@ -902,7 +902,7 @@ void Corona::addViewForLayout(QString layoutName)
|
||||
defaultContainment->setLocation(Plasma::Types::BottomEdge);
|
||||
}
|
||||
|
||||
if (m_layoutManager->memoryUsage() == Latte::Types::MultipleLayouts) {
|
||||
if (m_layoutsManager->memoryUsage() == Latte::Types::MultipleLayouts) {
|
||||
config.writeEntry("layoutId", layoutName);
|
||||
}
|
||||
|
||||
@ -921,7 +921,7 @@ void Corona::addViewForLayout(QString layoutName)
|
||||
|
||||
void Corona::loadDefaultLayout()
|
||||
{
|
||||
addViewForLayout(m_layoutManager->currentLayoutName());
|
||||
addViewForLayout(m_layoutsManager->currentLayoutName());
|
||||
}
|
||||
|
||||
QStringList Corona::containmentsIds()
|
||||
@ -981,7 +981,7 @@ void Corona::updateDockItemBadge(QString identifier, QString value)
|
||||
|
||||
void Corona::switchToLayout(QString layout)
|
||||
{
|
||||
m_layoutManager->switchToLayout(layout);
|
||||
m_layoutsManager->switchToLayout(layout);
|
||||
}
|
||||
|
||||
void Corona::showSettingsWindow(int page)
|
||||
@ -992,7 +992,7 @@ void Corona::showSettingsWindow(int page)
|
||||
p = static_cast<Types::LatteConfigPage>(page);
|
||||
}
|
||||
|
||||
m_layoutManager->showLatteSettingsDialog(p);
|
||||
m_layoutsManager->showLatteSettingsDialog(p);
|
||||
}
|
||||
|
||||
void Corona::setContextMenuView(int id)
|
||||
@ -1006,18 +1006,18 @@ QStringList Corona::contextMenuData()
|
||||
QStringList data;
|
||||
Types::ViewType viewType{Types::DockView};
|
||||
|
||||
Latte::CentralLayout *currentLayout = m_layoutManager->currentLayout();
|
||||
Latte::CentralLayout *currentLayout = m_layoutsManager->currentLayout();
|
||||
|
||||
if (currentLayout) {
|
||||
viewType = currentLayout->latteViewType(m_contextMenuViewId);
|
||||
}
|
||||
|
||||
data << QString::number((int)m_layoutManager->memoryUsage());
|
||||
data << m_layoutManager->currentLayoutName();
|
||||
data << QString::number((int)m_layoutsManager->memoryUsage());
|
||||
data << m_layoutsManager->currentLayoutName();
|
||||
data << QString::number((int)viewType);
|
||||
|
||||
for(const auto &layoutName : m_layoutManager->menuLayouts()) {
|
||||
if (m_layoutManager->centralLayout(layoutName)) {
|
||||
for(const auto &layoutName : m_layoutsManager->menuLayouts()) {
|
||||
if (m_layoutsManager->centralLayout(layoutName)) {
|
||||
data << QString("1," + layoutName);
|
||||
} else {
|
||||
data << QString("0," + layoutName);
|
||||
|
@ -65,7 +65,6 @@ class AbstractWindowInterface;
|
||||
class ScreenPool;
|
||||
class GlobalShortcuts;
|
||||
class UniversalSettings;
|
||||
class LayoutManager;
|
||||
class LaunchersSignals;
|
||||
class View;
|
||||
namespace Indicator{
|
||||
@ -75,6 +74,9 @@ namespace Layout{
|
||||
class GenericLayout;
|
||||
class Storage;
|
||||
}
|
||||
namespace Layouts{
|
||||
class Manager;
|
||||
}
|
||||
namespace PlasmaExtended{
|
||||
class ScreenPool;
|
||||
class Theme;
|
||||
@ -121,7 +123,7 @@ public:
|
||||
GlobalShortcuts *globalShortcuts() const;
|
||||
ScreenPool *screenPool() const;
|
||||
UniversalSettings *universalSettings() const;
|
||||
LayoutManager *layoutManager() const;
|
||||
Layouts::Manager *layoutsManager() const;
|
||||
|
||||
Indicator::Factory *indicatorFactory() const;
|
||||
|
||||
@ -202,9 +204,9 @@ private:
|
||||
ScreenPool *m_screenPool{nullptr};
|
||||
UniversalSettings *m_universalSettings{nullptr};
|
||||
GlobalShortcuts *m_globalShortcuts{nullptr};
|
||||
LayoutManager *m_layoutManager{nullptr};
|
||||
|
||||
Indicator::Factory *m_indicatorFactory{nullptr};
|
||||
Layouts::Manager *m_layoutsManager{nullptr};
|
||||
|
||||
PlasmaExtended::ScreenPool *m_plasmaScreenPool{nullptr};
|
||||
PlasmaExtended::Theme *m_themeExtended{nullptr};
|
||||
@ -212,9 +214,9 @@ private:
|
||||
KWayland::Client::PlasmaShell *m_waylandCorona{nullptr};
|
||||
|
||||
friend class GlobalShortcuts;
|
||||
friend class LayoutManager;
|
||||
friend class LaunchersSignals;
|
||||
friend class Layout::Storage;
|
||||
friend class Layouts::Manager;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -22,8 +22,8 @@
|
||||
|
||||
// local
|
||||
#include "lattecorona.h"
|
||||
#include "layoutmanager.h"
|
||||
#include "layout/centrallayout.h"
|
||||
#include "layouts/manager.h"
|
||||
|
||||
// Qt
|
||||
#include <QQuickItem>
|
||||
@ -37,7 +37,7 @@ namespace Latte {
|
||||
LaunchersSignals::LaunchersSignals(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
m_manager = qobject_cast<LayoutManager *>(parent);
|
||||
m_manager = qobject_cast<Layouts::Manager *>(parent);
|
||||
}
|
||||
|
||||
LaunchersSignals::~LaunchersSignals()
|
||||
|
@ -32,7 +32,9 @@ class Applet;
|
||||
}
|
||||
|
||||
namespace Latte {
|
||||
class LayoutManager;
|
||||
namespace Layouts {
|
||||
class Manager;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Latte {
|
||||
@ -65,7 +67,7 @@ private:
|
||||
QList<Plasma::Applet *> lattePlasmoids(QString layoutName);
|
||||
|
||||
private:
|
||||
LayoutManager *m_manager{nullptr};
|
||||
Layouts::Manager *m_manager{nullptr};
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -24,8 +24,8 @@
|
||||
#include "sharedlayout.h"
|
||||
#include "importer.h"
|
||||
#include "../lattecorona.h"
|
||||
#include "../layoutmanager.h"
|
||||
#include "../screenpool.h"
|
||||
#include "../layouts/manager.h"
|
||||
#include "../settings/universalsettings.h"
|
||||
#include "../view/view.h"
|
||||
#include "../../liblatte2/types.h"
|
||||
@ -85,21 +85,21 @@ void CentralLayout::initToCorona(Latte::Corona *corona)
|
||||
});
|
||||
|
||||
|
||||
if (m_corona->layoutManager()->memoryUsage() == Types::SingleLayout && m_corona->universalSettings()->canDisableBorders()) {
|
||||
if (m_corona->layoutsManager()->memoryUsage() == Types::SingleLayout && m_corona->universalSettings()->canDisableBorders()) {
|
||||
kwin_setDisabledMaximizedBorders(disableBordersForMaximizedWindows());
|
||||
} else if (m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
connect(m_corona->layoutManager(), &LayoutManager::currentLayoutNameChanged, this, [&]() {
|
||||
} else if (m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
connect(m_corona->layoutsManager(), &Layouts::Manager::currentLayoutNameChanged, this, [&]() {
|
||||
if (m_corona->universalSettings()->canDisableBorders()
|
||||
&& m_corona->layoutManager()->currentLayoutName() == name()) {
|
||||
&& m_corona->layoutsManager()->currentLayoutName() == name()) {
|
||||
kwin_setDisabledMaximizedBorders(disableBordersForMaximizedWindows());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//! 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()->registerAtSharedLayout(this, m_sharedLayoutName)) {
|
||||
setSharedLayout(m_corona->layoutManager()->sharedLayout(m_sharedLayoutName));
|
||||
if (m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts && !m_sharedLayoutName.isEmpty()) {
|
||||
if (m_corona->layoutsManager()->registerAtSharedLayout(this, m_sharedLayoutName)) {
|
||||
setSharedLayout(m_corona->layoutsManager()->sharedLayout(m_sharedLayoutName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -292,11 +292,11 @@ const QStringList CentralLayout::appliedActivities()
|
||||
return {};
|
||||
}
|
||||
|
||||
if (m_corona->layoutManager()->memoryUsage() == Types::SingleLayout) {
|
||||
if (m_corona->layoutsManager()->memoryUsage() == Types::SingleLayout) {
|
||||
return {"0"};
|
||||
} else if (m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
} else if (m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
if (m_activities.isEmpty()) {
|
||||
return m_corona->layoutManager()->orphanedActivities();
|
||||
return m_corona->layoutsManager()->orphanedActivities();
|
||||
} else {
|
||||
return m_activities;
|
||||
}
|
||||
|
@ -24,8 +24,8 @@
|
||||
#include "storage.h"
|
||||
#include "../importer.h"
|
||||
#include "../lattecorona.h"
|
||||
#include "../layoutmanager.h"
|
||||
#include "../screenpool.h"
|
||||
#include "../layouts/manager.h"
|
||||
#include "../shortcuts/shortcutstracker.h"
|
||||
#include "../view/view.h"
|
||||
#include "../view/positioner.h"
|
||||
@ -144,7 +144,7 @@ bool GenericLayout::isActive() const
|
||||
return false;
|
||||
}
|
||||
|
||||
GenericLayout *generic = m_corona->layoutManager()->layout(m_layoutName);
|
||||
GenericLayout *generic = m_corona->layoutsManager()->layout(m_layoutName);
|
||||
|
||||
if (generic) {
|
||||
return true;
|
||||
@ -159,7 +159,7 @@ bool GenericLayout::isCurrent() const
|
||||
return false;
|
||||
}
|
||||
|
||||
return name() == m_corona->layoutManager()->currentLayoutName();
|
||||
return name() == m_corona->layoutsManager()->currentLayoutName();
|
||||
}
|
||||
|
||||
int GenericLayout::viewsCount(int screen) const
|
||||
@ -493,10 +493,10 @@ void GenericLayout::addContainment(Plasma::Containment *containment)
|
||||
|
||||
bool containmentInLayout{false};
|
||||
|
||||
if (m_corona->layoutManager()->memoryUsage() == Types::SingleLayout) {
|
||||
if (m_corona->layoutsManager()->memoryUsage() == Types::SingleLayout) {
|
||||
m_containments.append(containment);
|
||||
containmentInLayout = true;
|
||||
} else if (m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
} else if (m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
QString layoutId = containment->config().readEntry("layoutId", QString());
|
||||
|
||||
if (!layoutId.isEmpty() && (layoutId == m_layoutName)) {
|
||||
@ -593,7 +593,7 @@ void GenericLayout::destroyedChanged(bool destroyed)
|
||||
|
||||
void GenericLayout::renameLayout(QString newName)
|
||||
{
|
||||
if (!m_corona || m_corona->layoutManager()->memoryUsage() != Types::MultipleLayouts) {
|
||||
if (!m_corona || m_corona->layoutsManager()->memoryUsage() != Types::MultipleLayouts) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -750,7 +750,7 @@ void GenericLayout::addView(Plasma::Containment *containment, bool forceOnPrimar
|
||||
connect(containment, &Plasma::Containment::appletAlternativesRequested
|
||||
, m_corona, &Latte::Corona::showAlternativesForApplet, Qt::QueuedConnection);
|
||||
|
||||
if (m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
if (m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
connect(containment, &Plasma::Containment::appletCreated, this, &GenericLayout::appletCreated);
|
||||
}
|
||||
|
||||
@ -776,9 +776,9 @@ bool GenericLayout::initToCorona(Latte::Corona *corona)
|
||||
m_corona = corona;
|
||||
|
||||
for (const auto containment : m_corona->containments()) {
|
||||
if (m_corona->layoutManager()->memoryUsage() == Types::SingleLayout) {
|
||||
if (m_corona->layoutsManager()->memoryUsage() == Types::SingleLayout) {
|
||||
addContainment(containment);
|
||||
} else if (m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
} else if (m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
QString layoutId = containment->config().readEntry("layoutId", QString());
|
||||
|
||||
if (!layoutId.isEmpty() && (layoutId == m_layoutName)) {
|
||||
@ -812,7 +812,7 @@ void GenericLayout::updateLastUsedActivity()
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_lastUsedActivity.isEmpty() && !m_corona->layoutManager()->activities().contains(m_lastUsedActivity)) {
|
||||
if (!m_lastUsedActivity.isEmpty() && !m_corona->layoutsManager()->activities().contains(m_lastUsedActivity)) {
|
||||
clearLastUsedActivity();
|
||||
}
|
||||
|
||||
@ -822,7 +822,7 @@ void GenericLayout::updateLastUsedActivity()
|
||||
|
||||
if (m_lastUsedActivity != currentId
|
||||
&& (appliedActivitiesIds.contains(currentId)
|
||||
|| m_corona->layoutManager()->memoryUsage() == Types::SingleLayout)) {
|
||||
|| m_corona->layoutsManager()->memoryUsage() == Types::SingleLayout)) {
|
||||
m_lastUsedActivity = currentId;
|
||||
|
||||
emit lastUsedActivityChanged();
|
||||
@ -853,7 +853,7 @@ void GenericLayout::assignToLayout(Latte::View *latteView, QList<Plasma::Contain
|
||||
}
|
||||
|
||||
//! sync the original layout file for integrity
|
||||
if (m_corona && m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
if (m_corona && m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
m_storage->syncToLayoutFile(false);
|
||||
}
|
||||
}
|
||||
@ -889,7 +889,7 @@ QList<Plasma::Containment *> GenericLayout::unassignFromLayout(Latte::View *latt
|
||||
}
|
||||
|
||||
//! sync the original layout file for integrity
|
||||
if (m_corona && m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
if (m_corona && m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
m_storage->syncToLayoutFile(false);
|
||||
}
|
||||
|
||||
|
@ -22,8 +22,8 @@
|
||||
// local
|
||||
#include "centrallayout.h"
|
||||
#include "../lattecorona.h"
|
||||
#include "../layoutmanager.h"
|
||||
#include "../screenpool.h"
|
||||
#include "../layouts/manager.h"
|
||||
#include "../view/view.h"
|
||||
|
||||
namespace Latte {
|
||||
@ -33,7 +33,7 @@ SharedLayout::SharedLayout(CentralLayout *assigned, QObject *parent, QString lay
|
||||
{
|
||||
initToCorona(assigned->corona());
|
||||
|
||||
connect(m_corona->layoutManager(), &LayoutManager::currentLayoutNameChanged, this, &SharedLayout::updateLastUsedCentralLayout);
|
||||
connect(m_corona->layoutsManager(), &Layouts::Manager::currentLayoutNameChanged, this, &SharedLayout::updateLastUsedCentralLayout);
|
||||
|
||||
addCentralLayout(assigned);
|
||||
updateLastUsedCentralLayout();
|
||||
|
@ -22,8 +22,8 @@
|
||||
// local
|
||||
#include "../importer.h"
|
||||
#include "../lattecorona.h"
|
||||
#include "../layoutmanager.h"
|
||||
#include "../screenpool.h"
|
||||
#include "../layouts/manager.h"
|
||||
#include "../view/view.h"
|
||||
// Qt
|
||||
#include <QDir>
|
||||
@ -495,7 +495,7 @@ QString Storage::newUniqueIdsLayoutFromFile(QString file)
|
||||
}
|
||||
}
|
||||
|
||||
if (m_layout->corona()->layoutManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
if (m_layout->corona()->layoutsManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
investigate_conts.group(cId).writeEntry("layoutId", m_layout->name());
|
||||
}
|
||||
}
|
||||
@ -614,7 +614,7 @@ bool Storage::layoutIsBroken() const
|
||||
if (!m_layout->corona()) {
|
||||
qDebug() << " --- storaged file : " << m_layout->file();
|
||||
} else {
|
||||
if (m_layout->corona()->layoutManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
if (m_layout->corona()->layoutsManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
qDebug() << " --- in multiple layouts hidden file : " << Importer::layoutFilePath(AbstractLayout::MultipleLayoutsName);
|
||||
} else {
|
||||
qDebug() << " --- in active layout file : " << m_layout->file();
|
||||
|
5
app/layouts/CMakeLists.txt
Normal file
5
app/layouts/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
set(lattedock-app_SRCS
|
||||
${lattedock-app_SRCS}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/manager.cpp
|
||||
PARENT_SCOPE
|
||||
)
|
@ -2,6 +2,8 @@
|
||||
* Copyright 2017 Smith AR <audoban@openmailbox.org>
|
||||
* Michail Vourlakos <mvourlakos@gmail.com>
|
||||
*
|
||||
* 2019 Michail Vourlakos <mvourlakos@gmail.com>
|
||||
*
|
||||
* This file is part of Latte-Dock
|
||||
*
|
||||
* Latte-Dock is free software; you can redistribute it and/or
|
||||
@ -18,20 +20,20 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "layoutmanager.h"
|
||||
#include "manager.h"
|
||||
|
||||
// local
|
||||
#include "importer.h"
|
||||
#include "infoview.h"
|
||||
#include "launcherssignals.h"
|
||||
#include "screenpool.h"
|
||||
#include "layout/abstractlayout.h"
|
||||
#include "layout/centrallayout.h"
|
||||
#include "layout/genericlayout.h"
|
||||
#include "layout/sharedlayout.h"
|
||||
#include "settings/settingsdialog.h"
|
||||
#include "settings/universalsettings.h"
|
||||
#include "view/view.h"
|
||||
#include "../importer.h"
|
||||
#include "../infoview.h"
|
||||
#include "../launcherssignals.h"
|
||||
#include "../screenpool.h"
|
||||
#include "../layout/abstractlayout.h"
|
||||
#include "../layout/centrallayout.h"
|
||||
#include "../layout/genericlayout.h"
|
||||
#include "../layout/sharedlayout.h"
|
||||
#include "../settings/settingsdialog.h"
|
||||
#include "../settings/universalsettings.h"
|
||||
#include "../view/view.h"
|
||||
|
||||
// Qt
|
||||
#include <QDir>
|
||||
@ -47,10 +49,11 @@
|
||||
#include <KNotification>
|
||||
|
||||
namespace Latte {
|
||||
namespace Layouts {
|
||||
|
||||
const int MultipleLayoutsPresetId = 10;
|
||||
|
||||
LayoutManager::LayoutManager(QObject *parent)
|
||||
Manager::Manager(QObject *parent)
|
||||
: QObject(parent),
|
||||
m_importer(new Importer(this)),
|
||||
m_launchersSignals(new LaunchersSignals(this)),
|
||||
@ -59,16 +62,16 @@ LayoutManager::LayoutManager(QObject *parent)
|
||||
m_corona = qobject_cast<Latte::Corona *>(parent);
|
||||
|
||||
if (m_corona) {
|
||||
connect(m_corona->universalSettings(), &UniversalSettings::currentLayoutNameChanged, this, &LayoutManager::currentLayoutNameChanged);
|
||||
connect(m_corona->universalSettings(), &UniversalSettings::showInfoWindowChanged, this, &LayoutManager::showInfoWindowChanged);
|
||||
connect(m_corona->universalSettings(), &UniversalSettings::currentLayoutNameChanged, this, &Manager::currentLayoutNameChanged);
|
||||
connect(m_corona->universalSettings(), &UniversalSettings::showInfoWindowChanged, this, &Manager::showInfoWindowChanged);
|
||||
|
||||
m_dynamicSwitchTimer.setSingleShot(true);
|
||||
showInfoWindowChanged();
|
||||
connect(&m_dynamicSwitchTimer, &QTimer::timeout, this, &LayoutManager::confirmDynamicSwitch);
|
||||
connect(&m_dynamicSwitchTimer, &QTimer::timeout, this, &Manager::confirmDynamicSwitch);
|
||||
}
|
||||
}
|
||||
|
||||
LayoutManager::~LayoutManager()
|
||||
Manager::~Manager()
|
||||
{
|
||||
m_importer->deleteLater();
|
||||
m_launchersSignals->deleteLater();
|
||||
@ -78,7 +81,7 @@ LayoutManager::~LayoutManager()
|
||||
m_activitiesController->deleteLater();
|
||||
}
|
||||
|
||||
void LayoutManager::load()
|
||||
void Manager::load()
|
||||
{
|
||||
int configVer = m_corona->universalSettings()->version();
|
||||
qDebug() << "Universal Settings version : " << configVer;
|
||||
@ -109,7 +112,7 @@ void LayoutManager::load()
|
||||
qDebug() << "Latte is loading its layouts...";
|
||||
|
||||
connect(m_corona->m_activityConsumer, &KActivities::Consumer::currentActivityChanged,
|
||||
this, &LayoutManager::currentActivityChanged);
|
||||
this, &Manager::currentActivityChanged);
|
||||
|
||||
connect(m_corona->m_activityConsumer, &KActivities::Consumer::runningActivitiesChanged,
|
||||
this, [&]() {
|
||||
@ -121,7 +124,7 @@ void LayoutManager::load()
|
||||
loadLayouts();
|
||||
}
|
||||
|
||||
void LayoutManager::unload()
|
||||
void Manager::unload()
|
||||
{
|
||||
//! Unload all CentralLayouts
|
||||
while (!m_centralLayouts.isEmpty()) {
|
||||
@ -145,7 +148,7 @@ void LayoutManager::unload()
|
||||
file2.remove();
|
||||
}
|
||||
|
||||
void LayoutManager::unloadCentralLayout(CentralLayout *layout)
|
||||
void Manager::unloadCentralLayout(CentralLayout *layout)
|
||||
{
|
||||
int pos = m_centralLayouts.indexOf(layout);
|
||||
|
||||
@ -167,10 +170,10 @@ void LayoutManager::unloadCentralLayout(CentralLayout *layout)
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutManager::unloadSharedLayout(SharedLayout *layout)
|
||||
void Manager::unloadSharedLayout(SharedLayout *layout)
|
||||
{
|
||||
if (m_sharedLayouts.contains(layout)) {
|
||||
disconnect(layout, &SharedLayout::layoutDestroyed, this, &LayoutManager::unloadSharedLayout);
|
||||
disconnect(layout, &SharedLayout::layoutDestroyed, this, &Manager::unloadSharedLayout);
|
||||
int pos = m_sharedLayouts.indexOf(layout);
|
||||
SharedLayout *shared = m_sharedLayouts.takeAt(pos);
|
||||
shared->syncToLayoutFile(true);
|
||||
@ -183,22 +186,22 @@ void LayoutManager::unloadSharedLayout(SharedLayout *layout)
|
||||
}
|
||||
|
||||
|
||||
Latte::Corona *LayoutManager::corona()
|
||||
Latte::Corona *Manager::corona()
|
||||
{
|
||||
return m_corona;
|
||||
}
|
||||
|
||||
Importer *LayoutManager::importer()
|
||||
Importer *Manager::importer()
|
||||
{
|
||||
return m_importer;
|
||||
}
|
||||
|
||||
LaunchersSignals *LayoutManager::launchersSignals()
|
||||
LaunchersSignals *Manager::launchersSignals()
|
||||
{
|
||||
return m_launchersSignals;
|
||||
}
|
||||
|
||||
QString LayoutManager::currentLayoutName() const
|
||||
QString Manager::currentLayoutName() const
|
||||
{
|
||||
if (memoryUsage() == Types::SingleLayout) {
|
||||
return m_corona->universalSettings()->currentLayoutName();
|
||||
@ -209,7 +212,7 @@ QString LayoutManager::currentLayoutName() const
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString LayoutManager::defaultLayoutName() const
|
||||
QString Manager::defaultLayoutName() const
|
||||
{
|
||||
QByteArray presetNameOrig = QString("preset" + QString::number(1)).toUtf8();
|
||||
QString presetPath = m_corona->kPackage().filePath(presetNameOrig);
|
||||
@ -220,17 +223,17 @@ QString LayoutManager::defaultLayoutName() const
|
||||
return presetName;
|
||||
}
|
||||
|
||||
bool LayoutManager::layoutExists(QString layoutName) const
|
||||
bool Manager::layoutExists(QString layoutName) const
|
||||
{
|
||||
return m_layouts.contains(layoutName);
|
||||
}
|
||||
|
||||
QStringList LayoutManager::layouts() const
|
||||
QStringList Manager::layouts() const
|
||||
{
|
||||
return m_layouts;
|
||||
}
|
||||
|
||||
QStringList LayoutManager::menuLayouts() const
|
||||
QStringList Manager::menuLayouts() const
|
||||
{
|
||||
QStringList fixedMenuLayouts = m_menuLayouts;
|
||||
|
||||
@ -249,7 +252,7 @@ QStringList LayoutManager::menuLayouts() const
|
||||
return fixedMenuLayouts;
|
||||
}
|
||||
|
||||
void LayoutManager::setMenuLayouts(QStringList layouts)
|
||||
void Manager::setMenuLayouts(QStringList layouts)
|
||||
{
|
||||
if (m_menuLayouts == layouts) {
|
||||
return;
|
||||
@ -259,17 +262,17 @@ void LayoutManager::setMenuLayouts(QStringList layouts)
|
||||
emit menuLayoutsChanged();
|
||||
}
|
||||
|
||||
QStringList LayoutManager::activities()
|
||||
QStringList Manager::activities()
|
||||
{
|
||||
return m_corona->m_activityConsumer->activities();
|
||||
}
|
||||
|
||||
QStringList LayoutManager::runningActivities()
|
||||
QStringList Manager::runningActivities()
|
||||
{
|
||||
return m_corona->m_activityConsumer->runningActivities();
|
||||
}
|
||||
|
||||
QStringList LayoutManager::orphanedActivities()
|
||||
QStringList Manager::orphanedActivities()
|
||||
{
|
||||
QStringList orphans;
|
||||
|
||||
@ -282,12 +285,12 @@ QStringList LayoutManager::orphanedActivities()
|
||||
return orphans;
|
||||
}
|
||||
|
||||
QStringList LayoutManager::presetsPaths() const
|
||||
QStringList Manager::presetsPaths() const
|
||||
{
|
||||
return m_presetsPaths;
|
||||
}
|
||||
|
||||
QString LayoutManager::layoutPath(QString layoutName)
|
||||
QString Manager::layoutPath(QString layoutName)
|
||||
{
|
||||
QString path = QDir::homePath() + "/.config/latte/" + layoutName + ".layout.latte";
|
||||
|
||||
@ -298,22 +301,22 @@ QString LayoutManager::layoutPath(QString layoutName)
|
||||
return path;
|
||||
}
|
||||
|
||||
Types::LayoutsMemoryUsage LayoutManager::memoryUsage() const
|
||||
Types::LayoutsMemoryUsage Manager::memoryUsage() const
|
||||
{
|
||||
return m_corona->universalSettings()->layoutsMemoryUsage();
|
||||
}
|
||||
|
||||
int LayoutManager::layoutsMemoryUsage()
|
||||
int Manager::layoutsMemoryUsage()
|
||||
{
|
||||
return (int)m_corona->universalSettings()->layoutsMemoryUsage();
|
||||
}
|
||||
|
||||
void LayoutManager::setMemoryUsage(Types::LayoutsMemoryUsage memoryUsage)
|
||||
void Manager::setMemoryUsage(Types::LayoutsMemoryUsage memoryUsage)
|
||||
{
|
||||
m_corona->universalSettings()->setLayoutsMemoryUsage(memoryUsage);
|
||||
}
|
||||
|
||||
bool LayoutManager::latteViewExists(Latte::View *view) const
|
||||
bool Manager::latteViewExists(Latte::View *view) const
|
||||
{
|
||||
for (const auto layout : m_centralLayouts) {
|
||||
for (const auto &v : layout->latteViews()) {
|
||||
@ -326,7 +329,7 @@ bool LayoutManager::latteViewExists(Latte::View *view) const
|
||||
return false;
|
||||
}
|
||||
|
||||
QStringList LayoutManager::centralLayoutsNames()
|
||||
QStringList Manager::centralLayoutsNames()
|
||||
{
|
||||
QStringList names;
|
||||
|
||||
@ -343,7 +346,7 @@ QStringList LayoutManager::centralLayoutsNames()
|
||||
|
||||
}
|
||||
|
||||
QStringList LayoutManager::sharedLayoutsNames()
|
||||
QStringList Manager::sharedLayoutsNames()
|
||||
{
|
||||
QStringList names;
|
||||
|
||||
@ -355,12 +358,12 @@ QStringList LayoutManager::sharedLayoutsNames()
|
||||
return names;
|
||||
}
|
||||
|
||||
QStringList LayoutManager::storedSharedLayouts() const
|
||||
QStringList Manager::storedSharedLayouts() const
|
||||
{
|
||||
return m_sharedLayoutIds;
|
||||
}
|
||||
|
||||
Layout::GenericLayout *LayoutManager::layout(QString id) const
|
||||
Layout::GenericLayout *Manager::layout(QString id) const
|
||||
{
|
||||
Layout::GenericLayout *l = centralLayout(id);
|
||||
|
||||
@ -372,7 +375,7 @@ Layout::GenericLayout *LayoutManager::layout(QString id) const
|
||||
}
|
||||
|
||||
|
||||
CentralLayout *LayoutManager::centralLayout(QString id) const
|
||||
CentralLayout *Manager::centralLayout(QString id) const
|
||||
{
|
||||
for (int i = 0; i < m_centralLayouts.size(); ++i) {
|
||||
CentralLayout *layout = m_centralLayouts.at(i);
|
||||
@ -386,7 +389,7 @@ CentralLayout *LayoutManager::centralLayout(QString id) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int LayoutManager::centralLayoutPos(QString id) const
|
||||
int Manager::centralLayoutPos(QString id) const
|
||||
{
|
||||
for (int i = 0; i < m_centralLayouts.size(); ++i) {
|
||||
CentralLayout *layout = m_centralLayouts.at(i);
|
||||
@ -400,7 +403,7 @@ int LayoutManager::centralLayoutPos(QString id) const
|
||||
return -1;
|
||||
}
|
||||
|
||||
SharedLayout *LayoutManager::sharedLayout(QString id) const
|
||||
SharedLayout *Manager::sharedLayout(QString id) const
|
||||
{
|
||||
for (int i = 0; i < m_sharedLayouts.size(); ++i) {
|
||||
SharedLayout *layout = m_sharedLayouts.at(i);
|
||||
@ -413,7 +416,7 @@ SharedLayout *LayoutManager::sharedLayout(QString id) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool LayoutManager::registerAtSharedLayout(CentralLayout *central, QString id)
|
||||
bool Manager::registerAtSharedLayout(CentralLayout *central, QString id)
|
||||
{
|
||||
if (memoryUsage() == Types::SingleLayout || centralLayout(id)) {
|
||||
//! if memory is functioning to SINGLE mode OR shared layout has already
|
||||
@ -435,12 +438,12 @@ bool LayoutManager::registerAtSharedLayout(CentralLayout *central, QString id)
|
||||
m_sharedLayouts.append(top);
|
||||
top->importToCorona();
|
||||
|
||||
connect(top, &SharedLayout::layoutDestroyed, this, &LayoutManager::unloadSharedLayout);
|
||||
connect(top, &SharedLayout::layoutDestroyed, this, &Manager::unloadSharedLayout);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CentralLayout *LayoutManager::currentLayout() const
|
||||
CentralLayout *Manager::currentLayout() const
|
||||
{
|
||||
if (memoryUsage() == Types::SingleLayout) {
|
||||
return m_centralLayouts.at(0);
|
||||
@ -461,7 +464,7 @@ CentralLayout *LayoutManager::currentLayout() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void LayoutManager::updateCurrentLayoutNameInMultiEnvironment()
|
||||
void Manager::updateCurrentLayoutNameInMultiEnvironment()
|
||||
{
|
||||
for (const auto layout : m_centralLayouts) {
|
||||
if (layout->activities().contains(m_corona->activitiesConsumer()->currentActivity())) {
|
||||
@ -480,7 +483,7 @@ void LayoutManager::updateCurrentLayoutNameInMultiEnvironment()
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutManager::currentActivityChanged(const QString &id)
|
||||
void Manager::currentActivityChanged(const QString &id)
|
||||
{
|
||||
if (memoryUsage() == Types::SingleLayout) {
|
||||
qDebug() << "activity changed :: " << id;
|
||||
@ -493,7 +496,7 @@ void LayoutManager::currentActivityChanged(const QString &id)
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutManager::showInfoWindowChanged()
|
||||
void Manager::showInfoWindowChanged()
|
||||
{
|
||||
if (m_corona->universalSettings()->showInfoWindow()) {
|
||||
m_dynamicSwitchTimer.setInterval(1800);
|
||||
@ -502,7 +505,7 @@ void LayoutManager::showInfoWindowChanged()
|
||||
}
|
||||
}
|
||||
|
||||
QString LayoutManager::shouldSwitchToLayout(QString activityId)
|
||||
QString Manager::shouldSwitchToLayout(QString activityId)
|
||||
{
|
||||
if (m_assignedLayouts.contains(activityId) && m_assignedLayouts[activityId] != currentLayoutName()) {
|
||||
return m_assignedLayouts[activityId];
|
||||
@ -514,7 +517,7 @@ QString LayoutManager::shouldSwitchToLayout(QString activityId)
|
||||
return QString();
|
||||
}
|
||||
|
||||
void LayoutManager::confirmDynamicSwitch()
|
||||
void Manager::confirmDynamicSwitch()
|
||||
{
|
||||
QString tempShouldSwitch = shouldSwitchToLayout(m_corona->m_activityConsumer->currentActivity());
|
||||
|
||||
@ -540,7 +543,7 @@ void LayoutManager::confirmDynamicSwitch()
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutManager::loadLayouts()
|
||||
void Manager::loadLayouts()
|
||||
{
|
||||
m_layouts.clear();
|
||||
m_menuLayouts.clear();
|
||||
@ -593,7 +596,7 @@ void LayoutManager::loadLayouts()
|
||||
emit menuLayoutsChanged();
|
||||
}
|
||||
|
||||
void LayoutManager::clearSharedLayoutsFromCentralLists()
|
||||
void Manager::clearSharedLayoutsFromCentralLists()
|
||||
{
|
||||
QStringList unassign;
|
||||
|
||||
@ -620,7 +623,7 @@ void LayoutManager::clearSharedLayoutsFromCentralLists()
|
||||
|
||||
}
|
||||
|
||||
void LayoutManager::loadLayoutOnStartup(QString layoutName)
|
||||
void Manager::loadLayoutOnStartup(QString layoutName)
|
||||
{
|
||||
// if (memoryUsage() == Types::MultipleLayouts) {
|
||||
QStringList layouts = m_importer->checkRepairMultipleLayoutsLinkedFile();
|
||||
@ -642,7 +645,7 @@ void LayoutManager::loadLayoutOnStartup(QString layoutName)
|
||||
switchToLayout(layoutName);
|
||||
}
|
||||
|
||||
void LayoutManager::loadLatteLayout(QString layoutPath)
|
||||
void Manager::loadLatteLayout(QString layoutPath)
|
||||
{
|
||||
qDebug() << " -------------------------------------------------------------------- ";
|
||||
qDebug() << " -------------------------------------------------------------------- ";
|
||||
@ -658,7 +661,7 @@ void LayoutManager::loadLatteLayout(QString layoutPath)
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutManager::cleanupOnStartup(QString path)
|
||||
void Manager::cleanupOnStartup(QString path)
|
||||
{
|
||||
KSharedConfigPtr filePtr = KSharedConfig::openConfig(path);
|
||||
|
||||
@ -701,24 +704,24 @@ void LayoutManager::cleanupOnStartup(QString path)
|
||||
}
|
||||
|
||||
|
||||
void LayoutManager::showAboutDialog()
|
||||
void Manager::showAboutDialog()
|
||||
{
|
||||
m_corona->aboutApplication();
|
||||
}
|
||||
|
||||
void LayoutManager::importLatteLayout(QString layoutPath)
|
||||
void Manager::importLatteLayout(QString layoutPath)
|
||||
{
|
||||
//! This might not be needed as it is Layout responsibility
|
||||
}
|
||||
|
||||
void LayoutManager::hideAllViews()
|
||||
void Manager::hideAllViews()
|
||||
{
|
||||
for (const auto layout : m_centralLayouts) {
|
||||
emit currentLayoutIsSwitching(layout->name());
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutManager::addLayout(CentralLayout *layout)
|
||||
void Manager::addLayout(CentralLayout *layout)
|
||||
{
|
||||
if (!m_centralLayouts.contains(layout)) {
|
||||
m_centralLayouts.append(layout);
|
||||
@ -726,7 +729,7 @@ void LayoutManager::addLayout(CentralLayout *layout)
|
||||
}
|
||||
}
|
||||
|
||||
bool LayoutManager::switchToLayout(QString layoutName, int previousMemoryUsage)
|
||||
bool Manager::switchToLayout(QString layoutName, int previousMemoryUsage)
|
||||
{
|
||||
if (m_centralLayouts.size() > 0 && currentLayoutName() == layoutName && previousMemoryUsage == -1) {
|
||||
return false;
|
||||
@ -906,7 +909,7 @@ bool LayoutManager::switchToLayout(QString layoutName, int previousMemoryUsage)
|
||||
return true;
|
||||
}
|
||||
|
||||
void LayoutManager::syncMultipleLayoutsToActivities(QString layoutForOrphans)
|
||||
void Manager::syncMultipleLayoutsToActivities(QString layoutForOrphans)
|
||||
{
|
||||
qDebug() << " ---- --------- ------ syncMultipleLayoutsToActivities ------- ";
|
||||
qDebug() << " ---- --------- ------ ------------------------------- ------- ";
|
||||
@ -996,7 +999,7 @@ void LayoutManager::syncMultipleLayoutsToActivities(QString layoutForOrphans)
|
||||
emit centralLayoutsChanged();
|
||||
}
|
||||
|
||||
void LayoutManager::pauseLayout(QString layoutName)
|
||||
void Manager::pauseLayout(QString layoutName)
|
||||
{
|
||||
if (memoryUsage() == Types::MultipleLayouts) {
|
||||
CentralLayout *layout = centralLayout(layoutName);
|
||||
@ -1017,7 +1020,7 @@ void LayoutManager::pauseLayout(QString layoutName)
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutManager::syncActiveLayoutsToOriginalFiles()
|
||||
void Manager::syncActiveLayoutsToOriginalFiles()
|
||||
{
|
||||
if (memoryUsage() == Types::MultipleLayouts) {
|
||||
for (const auto layout : m_centralLayouts) {
|
||||
@ -1030,7 +1033,7 @@ void LayoutManager::syncActiveLayoutsToOriginalFiles()
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutManager::clearUnloadedContainmentsFromLinkedFile(QStringList containmentsIds, bool bypassChecks)
|
||||
void Manager::clearUnloadedContainmentsFromLinkedFile(QStringList containmentsIds, bool bypassChecks)
|
||||
{
|
||||
if (!m_corona || (memoryUsage() == Types::SingleLayout && !bypassChecks)) {
|
||||
return;
|
||||
@ -1048,7 +1051,7 @@ void LayoutManager::clearUnloadedContainmentsFromLinkedFile(QStringList containm
|
||||
}
|
||||
|
||||
|
||||
void LayoutManager::syncLatteViewsToScreens()
|
||||
void Manager::syncLatteViewsToScreens()
|
||||
{
|
||||
for (const auto layout : m_sharedLayouts) {
|
||||
layout->syncLatteViewsToScreens();
|
||||
@ -1059,7 +1062,7 @@ void LayoutManager::syncLatteViewsToScreens()
|
||||
}
|
||||
}
|
||||
|
||||
QString LayoutManager::newLayout(QString layoutName, QString preset)
|
||||
QString Manager::newLayout(QString layoutName, QString preset)
|
||||
{
|
||||
QDir layoutDir(QDir::homePath() + "/.config/latte");
|
||||
QStringList filter;
|
||||
@ -1085,7 +1088,7 @@ QString LayoutManager::newLayout(QString layoutName, QString preset)
|
||||
return newLayoutPath;
|
||||
}
|
||||
|
||||
void LayoutManager::importDefaultLayout(bool newInstanceIfPresent)
|
||||
void Manager::importDefaultLayout(bool newInstanceIfPresent)
|
||||
{
|
||||
importPreset(1, newInstanceIfPresent);
|
||||
|
||||
@ -1094,7 +1097,7 @@ void LayoutManager::importDefaultLayout(bool newInstanceIfPresent)
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutManager::importPresets(bool includeDefault)
|
||||
void Manager::importPresets(bool includeDefault)
|
||||
{
|
||||
int start = 1;
|
||||
|
||||
@ -1107,7 +1110,7 @@ void LayoutManager::importPresets(bool includeDefault)
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutManager::importPreset(int presetNo, bool newInstanceIfPresent)
|
||||
void Manager::importPreset(int presetNo, bool newInstanceIfPresent)
|
||||
{
|
||||
QDir configDir(QDir::homePath() + "/.config");
|
||||
|
||||
@ -1142,7 +1145,7 @@ void LayoutManager::importPreset(int presetNo, bool newInstanceIfPresent)
|
||||
}
|
||||
}
|
||||
|
||||
QStringList LayoutManager::validActivities(QStringList currentList)
|
||||
QStringList Manager::validActivities(QStringList currentList)
|
||||
{
|
||||
QStringList validIds;
|
||||
|
||||
@ -1155,7 +1158,7 @@ QStringList LayoutManager::validActivities(QStringList currentList)
|
||||
return validIds;
|
||||
}
|
||||
|
||||
bool LayoutManager::layoutIsAssigned(QString layoutName)
|
||||
bool Manager::layoutIsAssigned(QString layoutName)
|
||||
{
|
||||
QHashIterator<const QString, QString> i(m_assignedLayouts);
|
||||
|
||||
@ -1170,7 +1173,7 @@ bool LayoutManager::layoutIsAssigned(QString layoutName)
|
||||
return false;
|
||||
}
|
||||
|
||||
void LayoutManager::showLatteSettingsDialog(int page)
|
||||
void Manager::showLatteSettingsDialog(int page)
|
||||
{
|
||||
if (!m_latteSettingsDialog) {
|
||||
m_latteSettingsDialog = new SettingsDialog(nullptr, m_corona);
|
||||
@ -1188,7 +1191,7 @@ void LayoutManager::showLatteSettingsDialog(int page)
|
||||
m_latteSettingsDialog->activateWindow();
|
||||
}
|
||||
|
||||
void LayoutManager::hideLatteSettingsDialog()
|
||||
void Manager::hideLatteSettingsDialog()
|
||||
{
|
||||
if (m_latteSettingsDialog) {
|
||||
m_latteSettingsDialog->deleteLater();
|
||||
@ -1196,7 +1199,7 @@ void LayoutManager::hideLatteSettingsDialog()
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutManager::showInfoWindow(QString info, int duration, QStringList activities)
|
||||
void Manager::showInfoWindow(QString info, int duration, QStringList activities)
|
||||
{
|
||||
for (const auto screen : qGuiApp->screens()) {
|
||||
InfoView *infoView = new InfoView(m_corona, info, screen);
|
||||
@ -1211,7 +1214,7 @@ void LayoutManager::showInfoWindow(QString info, int duration, QStringList activ
|
||||
}
|
||||
|
||||
//! it is used just in order to provide translations for the presets
|
||||
void LayoutManager::ghostForTranslatedPresets()
|
||||
void Manager::ghostForTranslatedPresets()
|
||||
{
|
||||
QString preset1 = i18n("Default");
|
||||
QString preset2 = i18n("Plasma");
|
||||
@ -1220,3 +1223,4 @@ void LayoutManager::ghostForTranslatedPresets()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -18,8 +18,8 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LAYOUTMANAGER_H
|
||||
#define LAYOUTMANAGER_H
|
||||
#ifndef LAYOUTSMANAGER_H
|
||||
#define LAYOUTSMANAGER_H
|
||||
|
||||
// local
|
||||
#include "launcherssignals.h"
|
||||
@ -55,10 +55,11 @@ class GenericLayout;
|
||||
}
|
||||
|
||||
namespace Latte {
|
||||
namespace Layouts {
|
||||
|
||||
//! This class is responsible to manipulate all layouts.
|
||||
//! add,remove,rename, update configurations etc.
|
||||
class LayoutManager : public QObject
|
||||
class Manager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -70,8 +71,8 @@ class LayoutManager : public QObject
|
||||
Q_PROPERTY(LaunchersSignals *launchersSignals READ launchersSignals NOTIFY launchersSignalsChanged)
|
||||
|
||||
public:
|
||||
LayoutManager(QObject *parent = nullptr);
|
||||
~LayoutManager() override;
|
||||
Manager(QObject *parent = nullptr);
|
||||
~Manager() override;
|
||||
|
||||
Latte::Corona *corona();
|
||||
Importer *importer();
|
||||
@ -207,10 +208,10 @@ private:
|
||||
|
||||
KActivities::Controller *m_activitiesController;
|
||||
|
||||
|
||||
friend class SettingsDialog;
|
||||
friend class Latte::SettingsDialog;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // LAYOUTMANAGER_H
|
||||
#endif // LAYOUTSMANAGER_H
|
@ -28,7 +28,6 @@ class QWidget;
|
||||
class QVariant;
|
||||
|
||||
namespace Latte {
|
||||
class LayoutManager;
|
||||
class SettingsDialog;
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,6 @@ class QWidget;
|
||||
class QVariant;
|
||||
|
||||
namespace Latte {
|
||||
class LayoutManager;
|
||||
class SettingsDialog;
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "settingsdialog.h"
|
||||
|
||||
// local
|
||||
#include "layoutmanager.h"
|
||||
#include "importer.h"
|
||||
#include "universalsettings.h"
|
||||
#include "ui_settingsdialog.h"
|
||||
@ -30,6 +29,7 @@
|
||||
#include "../layout/genericlayout.h"
|
||||
#include "../layout/centrallayout.h"
|
||||
#include "../layout/sharedlayout.h"
|
||||
#include "../layouts/manager.h"
|
||||
#include "../liblatte2/types.h"
|
||||
#include "../plasma/extended/theme.h"
|
||||
#include "delegates/activitiesdelegate.h"
|
||||
@ -94,14 +94,14 @@ SettingsDialog::SettingsDialog(QWidget *parent, Latte::Corona *corona)
|
||||
connect(ui->buttonBox->button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked
|
||||
, this, &SettingsDialog::restoreDefaults);
|
||||
|
||||
m_model = new QStandardItemModel(m_corona->layoutManager()->layouts().count(), 6, this);
|
||||
m_model = new QStandardItemModel(m_corona->layoutsManager()->layouts().count(), 6, this);
|
||||
|
||||
ui->layoutsView->setModel(m_model);
|
||||
ui->layoutsView->horizontalHeader()->setStretchLastSection(true);
|
||||
ui->layoutsView->verticalHeader()->setVisible(false);
|
||||
|
||||
connect(m_corona->layoutManager(), &LayoutManager::currentLayoutNameChanged, this, &SettingsDialog::layoutsChanged);
|
||||
connect(m_corona->layoutManager(), &LayoutManager::centralLayoutsChanged, this, &SettingsDialog::layoutsChanged);
|
||||
connect(m_corona->layoutsManager(), &Layouts::Manager::currentLayoutNameChanged, this, &SettingsDialog::layoutsChanged);
|
||||
connect(m_corona->layoutsManager(), &Layouts::Manager::centralLayoutsChanged, this, &SettingsDialog::layoutsChanged);
|
||||
|
||||
QString iconsPath(m_corona->kPackage().path() + "../../plasmoids/org.kde.latte.containment/contents/icons/");
|
||||
|
||||
@ -295,7 +295,7 @@ void SettingsDialog::blockDeleteOnActivityStopped()
|
||||
|
||||
QStringList SettingsDialog::activities()
|
||||
{
|
||||
return m_corona->layoutManager()->activities();
|
||||
return m_corona->layoutsManager()->activities();
|
||||
}
|
||||
|
||||
QStringList SettingsDialog::availableActivities()
|
||||
@ -342,7 +342,7 @@ void SettingsDialog::on_newButton_clicked()
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
//! find Default preset path
|
||||
for (const auto &preset : m_corona->layoutManager()->presetsPaths()) {
|
||||
for (const auto &preset : m_corona->layoutsManager()->presetsPaths()) {
|
||||
QString presetName = CentralLayout::layoutName(preset);
|
||||
|
||||
if (presetName == "Default") {
|
||||
@ -367,10 +367,10 @@ void SettingsDialog::on_copyButton_clicked()
|
||||
}
|
||||
|
||||
//! Update original layout before copying if this layout is active
|
||||
if (m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
if (m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
QString lName = (m_model->data(m_model->index(row, NAMECOLUMN), Qt::DisplayRole)).toString();
|
||||
|
||||
Layout::GenericLayout *generic = m_corona->layoutManager()->layout(lName);
|
||||
Layout::GenericLayout *generic = m_corona->layoutsManager()->layout(lName);
|
||||
if (generic) {
|
||||
generic->syncToLayoutFile();
|
||||
}
|
||||
@ -445,7 +445,7 @@ void SettingsDialog::on_removeButton_clicked()
|
||||
|
||||
QString layoutName = m_model->data(m_model->index(row, NAMECOLUMN), Qt::DisplayRole).toString();
|
||||
|
||||
if (m_corona->layoutManager()->centralLayout(layoutName)) {
|
||||
if (m_corona->layoutsManager()->centralLayout(layoutName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -496,7 +496,7 @@ void SettingsDialog::on_sharedButton_clicked()
|
||||
|
||||
for (const auto &id : availableShares) {
|
||||
QString name = nameForId(id);
|
||||
if (m_corona->layoutManager()->layout(name)) {
|
||||
if (m_corona->layoutsManager()->layout(name)) {
|
||||
assignedList << id;
|
||||
m_model->setData(m_model->index(row, SHAREDCOLUMN), assignedList, Qt::UserRole);
|
||||
assigned = true;
|
||||
@ -624,13 +624,13 @@ bool SettingsDialog::importLayoutsFromV1ConfigFile(QString file)
|
||||
QString applets(tempDir.absolutePath() + "/" + "lattedock-appletsrc");
|
||||
|
||||
if (QFile(applets).exists()) {
|
||||
if (m_corona->layoutManager()->importer()->importOldLayout(applets, name, false, tempDir.absolutePath())) {
|
||||
if (m_corona->layoutsManager()->importer()->importOldLayout(applets, name, false, tempDir.absolutePath())) {
|
||||
addLayoutForFile(tempDir.absolutePath() + "/" + name + ".layout.latte", name, false);
|
||||
}
|
||||
|
||||
QString alternativeName = name + "-" + i18nc("layout", "Alternative");
|
||||
|
||||
if (m_corona->layoutManager()->importer()->importOldLayout(applets, alternativeName, false, tempDir.absolutePath())) {
|
||||
if (m_corona->layoutsManager()->importer()->importOldLayout(applets, alternativeName, false, tempDir.absolutePath())) {
|
||||
addLayoutForFile(tempDir.absolutePath() + "/" + alternativeName + ".layout.latte", alternativeName, false);
|
||||
}
|
||||
}
|
||||
@ -656,7 +656,7 @@ void SettingsDialog::on_exportButton_clicked()
|
||||
//! this is needed because the export method can export also the full configuration
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
m_corona->layoutManager()->syncActiveLayoutsToOriginalFiles();
|
||||
m_corona->layoutsManager()->syncActiveLayoutsToOriginalFiles();
|
||||
|
||||
QFileDialog *fileDialog = new QFileDialog(this, i18nc("export layout/configuration", "Export Layout/Configuration")
|
||||
, QDir::homePath(), QStringLiteral("layout.latte"));
|
||||
@ -724,7 +724,7 @@ void SettingsDialog::on_exportButton_clicked()
|
||||
notification->sendEvent();
|
||||
};
|
||||
|
||||
if (m_corona->layoutManager()->importer()->exportFullConfiguration(file)) {
|
||||
if (m_corona->layoutsManager()->importer()->exportFullConfiguration(file)) {
|
||||
|
||||
auto notification = new KNotification("export-done", KNotification::CloseOnTimeout);
|
||||
notification->setActions({i18nc("import/export config", "Open location")});
|
||||
@ -820,7 +820,7 @@ void SettingsDialog::restoreDefaults()
|
||||
|
||||
if (ui->tabWidget->currentIndex() == 0) {
|
||||
//! Default layouts missing from layouts list
|
||||
for (const auto &preset : m_corona->layoutManager()->presetsPaths()) {
|
||||
for (const auto &preset : m_corona->layoutsManager()->presetsPaths()) {
|
||||
QString presetName = CentralLayout::layoutName(preset);
|
||||
QByteArray presetNameChars = presetName.toUtf8();
|
||||
const char *prset_str = presetNameChars.data();
|
||||
@ -910,11 +910,11 @@ void SettingsDialog::loadSettings()
|
||||
int i = 0;
|
||||
QStringList brokenLayouts;
|
||||
|
||||
if (m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
m_corona->layoutManager()->syncActiveLayoutsToOriginalFiles();
|
||||
if (m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
m_corona->layoutsManager()->syncActiveLayoutsToOriginalFiles();
|
||||
}
|
||||
|
||||
for (const auto layout : m_corona->layoutManager()->layouts()) {
|
||||
for (const auto layout : m_corona->layoutsManager()->layouts()) {
|
||||
QString layoutPath = QDir::homePath() + "/.config/latte/" + layout + ".layout.latte";
|
||||
m_initLayoutPaths.append(layoutPath);
|
||||
|
||||
@ -944,11 +944,11 @@ void SettingsDialog::loadSettings()
|
||||
|
||||
i++;
|
||||
|
||||
if (central->name() == m_corona->layoutManager()->currentLayoutName()) {
|
||||
if (central->name() == m_corona->layoutsManager()->currentLayoutName()) {
|
||||
ui->layoutsView->selectRow(i - 1);
|
||||
}
|
||||
|
||||
Layout::GenericLayout *generic = m_corona->layoutManager()->layout(central->name());
|
||||
Layout::GenericLayout *generic = m_corona->layoutsManager()->layout(central->name());
|
||||
|
||||
if ((generic && generic->layoutIsBroken()) || (!generic && central->layoutIsBroken())) {
|
||||
brokenLayouts.append(central->name());
|
||||
@ -1017,9 +1017,9 @@ void SettingsDialog::loadSettings()
|
||||
}
|
||||
}
|
||||
|
||||
if (m_corona->layoutManager()->memoryUsage() == Types::SingleLayout) {
|
||||
if (m_corona->layoutsManager()->memoryUsage() == Types::SingleLayout) {
|
||||
ui->singleToolBtn->setChecked(true);
|
||||
} else if (m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
} else if (m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
ui->multipleToolBtn->setChecked(true);
|
||||
}
|
||||
|
||||
@ -1160,7 +1160,7 @@ void SettingsDialog::insertLayoutInfoAtRow(int row, QString path, QString color,
|
||||
|
||||
QFont font;
|
||||
|
||||
if (m_corona->layoutManager()->layout(name)) {
|
||||
if (m_corona->layoutsManager()->layout(name)) {
|
||||
font.setBold(true);
|
||||
} else {
|
||||
font.setBold(false);
|
||||
@ -1198,13 +1198,13 @@ void SettingsDialog::on_switchButton_clicked()
|
||||
if (!lName.isEmpty() && !lActivities.isEmpty()) {
|
||||
//! an activities-assigned layout is chosen and at the same time we are moving
|
||||
//! to multiple layouts state
|
||||
m_corona->layoutManager()->switchToLayout(lName);
|
||||
m_corona->layoutsManager()->switchToLayout(lName);
|
||||
}
|
||||
} else {
|
||||
QVariant value = m_model->data(m_model->index(ui->layoutsView->currentIndex().row(), NAMECOLUMN), Qt::DisplayRole);
|
||||
|
||||
if (value.isValid()) {
|
||||
m_corona->layoutManager()->switchToLayout(value.toString());
|
||||
m_corona->layoutsManager()->switchToLayout(value.toString());
|
||||
} else {
|
||||
qDebug() << "not valid layout";
|
||||
}
|
||||
@ -1221,7 +1221,7 @@ void SettingsDialog::on_pauseButton_clicked()
|
||||
CentralLayout *layout = m_layouts[id];
|
||||
|
||||
if (layout) {
|
||||
m_corona->layoutManager()->pauseLayout(layout->name());
|
||||
m_corona->layoutsManager()->pauseLayout(layout->name());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1235,13 +1235,13 @@ void SettingsDialog::layoutsChanged()
|
||||
QString name = value.toString();
|
||||
QFont font;
|
||||
|
||||
if (m_corona->layoutManager()->currentLayoutName() == name) {
|
||||
if (m_corona->layoutsManager()->currentLayoutName() == name) {
|
||||
font.setBold(true);
|
||||
// ui->layoutsView->selectRow(i);
|
||||
} else {
|
||||
Layout::GenericLayout *layout = m_corona->layoutManager()->layout(name);
|
||||
Layout::GenericLayout *layout = m_corona->layoutsManager()->layout(name);
|
||||
|
||||
if (layout && (m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts)) {
|
||||
if (layout && (m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts)) {
|
||||
font.setBold(true);
|
||||
} else {
|
||||
font.setBold(false);
|
||||
@ -1267,7 +1267,7 @@ void SettingsDialog::itemChanged(QStandardItem *item)
|
||||
QString name = m_model->data(m_model->index(currentRow, NAMECOLUMN), Qt::DisplayRole).toString();
|
||||
QFont font = qvariant_cast<QFont>(m_model->data(m_model->index(currentRow, NAMECOLUMN), Qt::FontRole));
|
||||
|
||||
if (m_corona->layoutManager()->layout(m_layouts[id]->name())) {
|
||||
if (m_corona->layoutsManager()->layout(m_layouts[id]->name())) {
|
||||
font.setBold(true);
|
||||
} else {
|
||||
font.setBold(false);
|
||||
@ -1312,7 +1312,7 @@ void SettingsDialog::updateApplyButtonsState()
|
||||
|
||||
bool layoutMissing{false};
|
||||
|
||||
for (const auto &preset : m_corona->layoutManager()->presetsPaths()) {
|
||||
for (const auto &preset : m_corona->layoutsManager()->presetsPaths()) {
|
||||
QString presetName = CentralLayout::layoutName(preset);
|
||||
QByteArray presetNameChars = presetName.toUtf8();
|
||||
const char *prset_str = presetNameChars.data();
|
||||
@ -1365,16 +1365,16 @@ void SettingsDialog::updatePerLayoutButtonsState()
|
||||
}
|
||||
|
||||
//! Pause Button
|
||||
if (m_corona->layoutManager()->memoryUsage() == Types::SingleLayout) {
|
||||
if (m_corona->layoutsManager()->memoryUsage() == Types::SingleLayout) {
|
||||
ui->pauseButton->setVisible(false);
|
||||
} else if (m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
} else if (m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
ui->pauseButton->setVisible(true);
|
||||
|
||||
QStringList lActivities = m_model->data(m_model->index(currentRow, ACTIVITYCOLUMN), Qt::UserRole).toStringList();
|
||||
|
||||
Latte::CentralLayout *layout = m_layouts[id];
|
||||
|
||||
if (!lActivities.isEmpty() && layout && m_corona->layoutManager()->centralLayout(layout->name())) {
|
||||
if (!lActivities.isEmpty() && layout && m_corona->layoutsManager()->centralLayout(layout->name())) {
|
||||
ui->pauseButton->setEnabled(true);
|
||||
} else {
|
||||
ui->pauseButton->setEnabled(false);
|
||||
@ -1383,8 +1383,8 @@ void SettingsDialog::updatePerLayoutButtonsState()
|
||||
|
||||
//! Remove Layout Button
|
||||
if (originalName != nameInModel
|
||||
|| (originalName == m_corona->layoutManager()->currentLayoutName())
|
||||
|| (m_corona->layoutManager()->centralLayout(originalName))
|
||||
|| (originalName == m_corona->layoutsManager()->currentLayoutName())
|
||||
|| (m_corona->layoutsManager()->centralLayout(originalName))
|
||||
|| lockedInModel) {
|
||||
ui->removeButton->setEnabled(false);
|
||||
} else {
|
||||
@ -1459,7 +1459,7 @@ void SettingsDialog::updateSharedLayoutsUiElements()
|
||||
|
||||
void SettingsDialog::recalculateAvailableActivities()
|
||||
{
|
||||
QStringList tempActivities = m_corona->layoutManager()->activities();
|
||||
QStringList tempActivities = m_corona->layoutsManager()->activities();
|
||||
|
||||
for (int i = 0; i < m_model->rowCount(); ++i) {
|
||||
QStringList assigned = m_model->data(m_model->index(i, ACTIVITYCOLUMN), Qt::UserRole).toStringList();
|
||||
@ -1582,7 +1582,7 @@ bool SettingsDialog::saveAllChanges()
|
||||
|
||||
//qDebug() << i << ". " << id << " - " << color << " - " << name << " - " << menu << " - " << lActivities;
|
||||
//! update the generic parts of the layouts
|
||||
Layout::GenericLayout *genericActive= m_corona->layoutManager()->layout(m_layouts[id]->name());
|
||||
Layout::GenericLayout *genericActive= m_corona->layoutsManager()->layout(m_layouts[id]->name());
|
||||
Layout::GenericLayout *generic = genericActive ? genericActive : m_layouts[id];
|
||||
|
||||
//! unlock read-only layout
|
||||
@ -1608,7 +1608,7 @@ bool SettingsDialog::saveAllChanges()
|
||||
}
|
||||
|
||||
//! update only the Central-specific layout parts
|
||||
CentralLayout *centralActive= m_corona->layoutManager()->centralLayout(m_layouts[id]->name());
|
||||
CentralLayout *centralActive= m_corona->layoutsManager()->centralLayout(m_layouts[id]->name());
|
||||
CentralLayout *central = centralActive ? centralActive : m_layouts[id];
|
||||
|
||||
if (central->showInMenu() != menu) {
|
||||
@ -1626,7 +1626,7 @@ bool SettingsDialog::saveAllChanges()
|
||||
//! If the layout name changed OR the layout path is a temporary one
|
||||
if (generic->name() != name || (id.startsWith("/tmp/"))) {
|
||||
//! If the layout is Active in MultipleLayouts
|
||||
if (m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts && generic->isActive()) {
|
||||
if (m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts && generic->isActive()) {
|
||||
qDebug() << " Active Layout Should Be Renamed From : " << generic->name() << " TO :: " << name;
|
||||
activeLayoutsToRename[name] = generic;
|
||||
}
|
||||
@ -1634,7 +1634,7 @@ bool SettingsDialog::saveAllChanges()
|
||||
QString tempFile = layoutTempDir.path() + "/" + QString(generic->name() + ".layout.latte");
|
||||
qDebug() << "new temp file ::: " << tempFile;
|
||||
|
||||
if ((m_corona->layoutManager()->memoryUsage() == Types::SingleLayout) && (generic->name() == m_corona->layoutManager()->currentLayoutName())) {
|
||||
if ((m_corona->layoutsManager()->memoryUsage() == Types::SingleLayout) && (generic->name() == m_corona->layoutsManager()->currentLayoutName())) {
|
||||
switchToLayout = name;
|
||||
}
|
||||
|
||||
@ -1677,7 +1677,7 @@ bool SettingsDialog::saveAllChanges()
|
||||
|
||||
QString orphanedLayout;
|
||||
|
||||
if (m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
if (m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
for (const auto &newLayoutName : activeLayoutsToRename.keys()) {
|
||||
Layout::GenericLayout *layout = activeLayoutsToRename[newLayoutName];
|
||||
qDebug() << " Active Layout of Type: " << layout->type() << " Is Renamed From : " << activeLayoutsToRename[newLayoutName]->name() << " TO :: " << newLayoutName;
|
||||
@ -1707,7 +1707,7 @@ bool SettingsDialog::saveAllChanges()
|
||||
QString name = m_model->data(m_model->index(i, NAMECOLUMN), Qt::DisplayRole).toString();
|
||||
bool locked = m_model->data(m_model->index(i, NAMECOLUMN), Qt::UserRole).toBool();
|
||||
|
||||
Layout::GenericLayout *generic = m_corona->layoutManager()->layout(m_layouts[id]->name());
|
||||
Layout::GenericLayout *generic = m_corona->layoutsManager()->layout(m_layouts[id]->name());
|
||||
Layout::GenericLayout *layout = generic ? generic : m_layouts[id];
|
||||
|
||||
if (layout && locked && layout->isWritable()) {
|
||||
@ -1716,29 +1716,29 @@ bool SettingsDialog::saveAllChanges()
|
||||
}
|
||||
|
||||
//! update SharedLayouts that are Active
|
||||
if (m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
if (m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
updateActiveShares();
|
||||
}
|
||||
|
||||
//! reload layouts in layoutmanager
|
||||
m_corona->layoutManager()->loadLayouts();
|
||||
//! reload layouts in layoutsmanager
|
||||
m_corona->layoutsManager()->loadLayouts();
|
||||
|
||||
//! send to layout manager in which layout to switch
|
||||
Latte::Types::LayoutsMemoryUsage inMemoryOption = static_cast<Latte::Types::LayoutsMemoryUsage>(m_inMemoryButtons->checkedId());
|
||||
|
||||
if (m_corona->layoutManager()->memoryUsage() != inMemoryOption) {
|
||||
Types::LayoutsMemoryUsage previousMemoryUsage = m_corona->layoutManager()->memoryUsage();
|
||||
m_corona->layoutManager()->setMemoryUsage(inMemoryOption);
|
||||
if (m_corona->layoutsManager()->memoryUsage() != inMemoryOption) {
|
||||
Types::LayoutsMemoryUsage previousMemoryUsage = m_corona->layoutsManager()->memoryUsage();
|
||||
m_corona->layoutsManager()->setMemoryUsage(inMemoryOption);
|
||||
|
||||
QVariant value = m_model->data(m_model->index(ui->layoutsView->currentIndex().row(), NAMECOLUMN), Qt::DisplayRole);
|
||||
QString layoutName = value.toString();
|
||||
|
||||
m_corona->layoutManager()->switchToLayout(layoutName, previousMemoryUsage);
|
||||
m_corona->layoutsManager()->switchToLayout(layoutName, previousMemoryUsage);
|
||||
} else {
|
||||
if (!switchToLayout.isEmpty()) {
|
||||
m_corona->layoutManager()->switchToLayout(switchToLayout);
|
||||
} else if (m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
m_corona->layoutManager()->syncMultipleLayoutsToActivities(orphanedLayout);
|
||||
m_corona->layoutsManager()->switchToLayout(switchToLayout);
|
||||
} else if (m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
m_corona->layoutsManager()->syncMultipleLayoutsToActivities(orphanedLayout);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1763,19 +1763,19 @@ void SettingsDialog::updateActiveShares()
|
||||
|
||||
//! CENTRAL (active) layouts that will become SHARED must be unloaded first
|
||||
for (QHash<const QString, QStringList>::iterator i=currentSharesMap.begin(); i!=currentSharesMap.end(); ++i) {
|
||||
CentralLayout *central = m_corona->layoutManager()->centralLayout(nameForId(i.key()));
|
||||
CentralLayout *central = m_corona->layoutsManager()->centralLayout(nameForId(i.key()));
|
||||
if (central) {
|
||||
m_corona->layoutManager()->unloadCentralLayout(central);
|
||||
m_corona->layoutsManager()->unloadCentralLayout(central);
|
||||
}
|
||||
}
|
||||
|
||||
//! CENTRAL (active) layouts that update their (active) SHARED layouts
|
||||
//! AND load SHARED layouts that are NOT ACTIVE
|
||||
for (QHash<const QString, QStringList>::iterator i=currentSharesMap.begin(); i!=currentSharesMap.end(); ++i) {
|
||||
SharedLayout *shared = m_corona->layoutManager()->sharedLayout(nameForId(i.key()));
|
||||
SharedLayout *shared = m_corona->layoutsManager()->sharedLayout(nameForId(i.key()));
|
||||
qDebug() << " SHARED :: " << nameForId(i.key());
|
||||
for (const auto ¢ralId : i.value()) {
|
||||
CentralLayout *central = m_corona->layoutManager()->centralLayout(nameForId(centralId));
|
||||
CentralLayout *central = m_corona->layoutsManager()->centralLayout(nameForId(centralId));
|
||||
qDebug() << " CENTRAL NAME :: " << nameForId(centralId);
|
||||
if (central) {
|
||||
//! Assign this Central Layout at a different Shared Layout
|
||||
@ -1783,8 +1783,8 @@ void SettingsDialog::updateActiveShares()
|
||||
|
||||
if (!shared) {
|
||||
//Shared not loaded and it must be loaded before proceed
|
||||
m_corona->layoutManager()->registerAtSharedLayout(central, nameForId(i.key()));
|
||||
shared = m_corona->layoutManager()->sharedLayout(nameForId(i.key()));
|
||||
m_corona->layoutsManager()->registerAtSharedLayout(central, nameForId(i.key()));
|
||||
shared = m_corona->layoutsManager()->sharedLayout(nameForId(i.key()));
|
||||
}
|
||||
|
||||
if (shared != oldShared) {
|
||||
@ -1803,7 +1803,7 @@ void SettingsDialog::updateActiveShares()
|
||||
for (QHash<const QString, QStringList>::iterator i=m_sharesMap.begin(); i!=m_sharesMap.end(); ++i) {
|
||||
for (const auto ¢ralId : i.value()) {
|
||||
if (!mapHasRecord(centralId, currentSharesMap)) {
|
||||
CentralLayout *central = m_corona->layoutManager()->centralLayout(nameForId(centralId));
|
||||
CentralLayout *central = m_corona->layoutsManager()->centralLayout(nameForId(centralId));
|
||||
if (central && central->sharedLayout()) {
|
||||
central->sharedLayout()->removeCentralLayout(central);
|
||||
central->setSharedLayoutName(QString());
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
// local
|
||||
#include "../importer.h"
|
||||
#include "../layoutmanager.h"
|
||||
#include "../layouts/manager.h"
|
||||
|
||||
// Qt
|
||||
#include <QDebug>
|
||||
|
@ -39,7 +39,9 @@
|
||||
#include <KSharedConfig>
|
||||
|
||||
namespace Latte {
|
||||
class LayoutManager;
|
||||
namespace Layouts {
|
||||
class Manager;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Latte {
|
||||
@ -184,7 +186,7 @@ private:
|
||||
KConfigGroup m_universalGroup;
|
||||
KSharedConfig::Ptr m_config;
|
||||
|
||||
friend class LayoutManager;
|
||||
friend class Layouts::Manager;
|
||||
friend class Latte::Corona;
|
||||
};
|
||||
|
||||
|
@ -24,8 +24,8 @@
|
||||
#include "modifiertracker.h"
|
||||
#include "shortcutstracker.h"
|
||||
#include "../lattecorona.h"
|
||||
#include "../layoutmanager.h"
|
||||
#include "../layout/centrallayout.h"
|
||||
#include "../layouts/manager.h"
|
||||
#include "../settings/universalsettings.h"
|
||||
#include "../view/view.h"
|
||||
|
||||
@ -118,7 +118,7 @@ void GlobalShortcuts::init()
|
||||
KGlobalAccel::setGlobalShortcut(layoutsAction, QKeySequence(Qt::META + Qt::Key_W));
|
||||
connect(layoutsAction, &QAction::triggered, this, [this]() {
|
||||
m_modifierTracker->cancelMetaPressed();
|
||||
m_corona->layoutManager()->showLatteSettingsDialog(Types::LayoutPage);
|
||||
m_corona->layoutsManager()->showLatteSettingsDialog(Types::LayoutPage);
|
||||
});
|
||||
|
||||
//show the latter universal settings
|
||||
@ -128,7 +128,7 @@ void GlobalShortcuts::init()
|
||||
KGlobalAccel::setGlobalShortcut(universalSettingsAction, QKeySequence(Qt::META + Qt::Key_E));
|
||||
connect(universalSettingsAction, &QAction::triggered, this, [this]() {
|
||||
m_modifierTracker->cancelMetaPressed();
|
||||
m_corona->layoutManager()->showLatteSettingsDialog(Types::PreferencesPage);
|
||||
m_corona->layoutsManager()->showLatteSettingsDialog(Types::PreferencesPage);
|
||||
});
|
||||
|
||||
KActionCollection *taskbarActions = new KActionCollection(m_corona);
|
||||
@ -223,7 +223,7 @@ void GlobalShortcuts::activateLauncherMenu()
|
||||
}
|
||||
|
||||
QList<Latte::View *> sortedViews;
|
||||
CentralLayout *currentLayout = m_corona->layoutManager()->currentLayout();
|
||||
CentralLayout *currentLayout = m_corona->layoutsManager()->currentLayout();
|
||||
|
||||
if (currentLayout) {
|
||||
sortedViews = currentLayout->sortedLatteViews();
|
||||
@ -387,7 +387,7 @@ void GlobalShortcuts::activateEntry(int index, Qt::Key modifier)
|
||||
m_lastInvokedAction = dynamic_cast<QAction *>(sender());
|
||||
|
||||
QList<Latte::View *> sortedViews;
|
||||
CentralLayout *currentLayout = m_corona->layoutManager()->currentLayout();
|
||||
CentralLayout *currentLayout = m_corona->layoutsManager()->currentLayout();
|
||||
|
||||
if (currentLayout) {
|
||||
sortedViews = currentLayout->sortedLatteViews();
|
||||
@ -460,7 +460,7 @@ void GlobalShortcuts::updateViewItemBadge(QString identifier, QString value)
|
||||
return false;
|
||||
};
|
||||
|
||||
CentralLayout *currentLayout = m_corona->layoutManager()->currentLayout();
|
||||
CentralLayout *currentLayout = m_corona->layoutsManager()->currentLayout();
|
||||
QList<Latte::View *> views;
|
||||
|
||||
if (currentLayout) {
|
||||
@ -618,7 +618,7 @@ void GlobalShortcuts::showViews()
|
||||
};
|
||||
|
||||
QList<Latte::View *> sortedViews;
|
||||
CentralLayout *currentLayout = m_corona->layoutManager()->currentLayout();
|
||||
CentralLayout *currentLayout = m_corona->layoutsManager()->currentLayout();
|
||||
|
||||
if (currentLayout) {
|
||||
sortedViews = currentLayout->sortedLatteViews();
|
||||
@ -710,7 +710,7 @@ void GlobalShortcuts::showViews()
|
||||
bool GlobalShortcuts::viewsToHideAreValid()
|
||||
{
|
||||
for(const auto view : m_hideViews) {
|
||||
if (!m_corona->layoutManager()->latteViewExists(view)) {
|
||||
if (!m_corona->layoutsManager()->latteViewExists(view)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -722,7 +722,7 @@ bool GlobalShortcuts::viewsToHideAreValid()
|
||||
void GlobalShortcuts::showSettings()
|
||||
{
|
||||
QList<Latte::View *> sortedViews;
|
||||
CentralLayout *currentLayout = m_corona->layoutManager()->currentLayout();
|
||||
CentralLayout *currentLayout = m_corona->layoutsManager()->currentLayout();
|
||||
|
||||
if (currentLayout) {
|
||||
sortedViews = currentLayout->sortedLatteViews();
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "view.h"
|
||||
#include "visibilitymanager.h"
|
||||
#include "../lattecorona.h"
|
||||
#include "../layoutmanager.h"
|
||||
|
||||
// Qt
|
||||
#include <QMouseEvent>
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "../panelshadows_p.h"
|
||||
#include "../view.h"
|
||||
#include "../../lattecorona.h"
|
||||
#include "../../layoutmanager.h"
|
||||
#include "../../layouts/manager.h"
|
||||
#include "../../layout/genericlayout.h"
|
||||
#include "../../settings/universalsettings.h"
|
||||
#include "../../shortcuts/globalshortcuts.h"
|
||||
@ -147,7 +147,7 @@ void PrimaryConfigView::init()
|
||||
|
||||
if (m_corona) {
|
||||
rootContext()->setContextProperty(QStringLiteral("universalSettings"), m_corona->universalSettings());
|
||||
rootContext()->setContextProperty(QStringLiteral("layoutManager"), m_corona->layoutManager());
|
||||
rootContext()->setContextProperty(QStringLiteral("layoutsManager"), m_corona->layoutsManager());
|
||||
}
|
||||
|
||||
KDeclarative::KDeclarative kdeclarative;
|
||||
|
@ -28,8 +28,8 @@
|
||||
#include "settings/primaryconfigview.h"
|
||||
#include "settings/secondaryconfigview.h"
|
||||
#include "../lattecorona.h"
|
||||
#include "../layoutmanager.h"
|
||||
#include "../layout/genericlayout.h"
|
||||
#include "../layouts/manager.h"
|
||||
#include "../plasma/extended/theme.h"
|
||||
#include "../screenpool.h"
|
||||
#include "../settings/universalsettings.h"
|
||||
@ -165,7 +165,7 @@ View::~View()
|
||||
|
||||
qDebug() << "dock view deleting...";
|
||||
rootContext()->setContextProperty(QStringLiteral("dock"), nullptr);
|
||||
rootContext()->setContextProperty(QStringLiteral("layoutManager"), nullptr);
|
||||
rootContext()->setContextProperty(QStringLiteral("layoutsManager"), nullptr);
|
||||
rootContext()->setContextProperty(QStringLiteral("shortcutsEngine"), nullptr);
|
||||
rootContext()->setContextProperty(QStringLiteral("themeExtended"), nullptr);
|
||||
rootContext()->setContextProperty(QStringLiteral("universalSettings"), nullptr);
|
||||
@ -244,7 +244,7 @@ void View::init()
|
||||
rootContext()->setContextProperty(QStringLiteral("latteView"), this);
|
||||
|
||||
if (m_corona) {
|
||||
rootContext()->setContextProperty(QStringLiteral("layoutManager"), m_corona->layoutManager());
|
||||
rootContext()->setContextProperty(QStringLiteral("layoutsManager"), m_corona->layoutsManager());
|
||||
rootContext()->setContextProperty(QStringLiteral("shortcutsEngine"), m_corona->globalShortcuts()->shortcutsTracker());
|
||||
rootContext()->setContextProperty(QStringLiteral("themeExtended"), m_corona->themeExtended());
|
||||
rootContext()->setContextProperty(QStringLiteral("universalSettings"), m_corona->universalSettings());
|
||||
@ -817,7 +817,7 @@ void View::setLayout(Layout::GenericLayout *layout)
|
||||
|
||||
Latte::Corona *latteCorona = qobject_cast<Latte::Corona *>(this->corona());
|
||||
|
||||
if (latteCorona->layoutManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
if (latteCorona->layoutsManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
connectionsLayout[2] = connect(latteCorona->activitiesConsumer(), &KActivities::Consumer::runningActivitiesChanged, this, [&]() {
|
||||
if (m_layout && m_visibility) {
|
||||
qDebug() << "DOCK VIEW FROM LAYOUT (runningActivitiesChanged) ::: " << m_layout->name()
|
||||
@ -834,7 +834,7 @@ void View::setLayout(Layout::GenericLayout *layout)
|
||||
}
|
||||
});
|
||||
|
||||
connectionsLayout[4] = connect(latteCorona->layoutManager(), &LayoutManager::layoutsChanged, this, [&]() {
|
||||
connectionsLayout[4] = connect(latteCorona->layoutsManager(), &Layouts::Manager::layoutsChanged, this, [&]() {
|
||||
if (m_layout) {
|
||||
applyActivitiesToWindows();
|
||||
emit activitiesChanged();
|
||||
@ -891,7 +891,7 @@ void View::moveToLayout(QString layoutName)
|
||||
Latte::Corona *latteCorona = qobject_cast<Latte::Corona *>(this->corona());
|
||||
|
||||
if (latteCorona && containments.size() > 0) {
|
||||
Layout::GenericLayout *newLayout = latteCorona->layoutManager()->layout(layoutName);
|
||||
Layout::GenericLayout *newLayout = latteCorona->layoutsManager()->layout(layoutName);
|
||||
|
||||
if (newLayout) {
|
||||
newLayout->assignToLayout(this, containments);
|
||||
|
@ -25,8 +25,8 @@
|
||||
#include "screenedgeghostwindow.h"
|
||||
#include "view.h"
|
||||
#include "../lattecorona.h"
|
||||
#include "../layoutmanager.h"
|
||||
#include "../screenpool.h"
|
||||
#include "../layouts/manager.h"
|
||||
#include "../wm/windowinfowrap.h"
|
||||
#include "../../liblatte2/extras.h"
|
||||
|
||||
@ -172,14 +172,14 @@ void VisibilityManager::setMode(Latte::Types::Visibility mode)
|
||||
}
|
||||
|
||||
|
||||
m_connections[base] = connect(m_corona->layoutManager(), &LayoutManager::currentLayoutNameChanged, this, [&]() {
|
||||
if (m_corona && m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
m_connections[base] = connect(m_corona->layoutsManager(), &Layouts::Manager::currentLayoutNameChanged, this, [&]() {
|
||||
if (m_corona && m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
updateStrutsBasedOnLayoutsAndActivities();
|
||||
}
|
||||
});
|
||||
|
||||
m_connections[base+1] = connect(m_latteView, &Latte::View::activitiesChanged, this, [&]() {
|
||||
if (m_corona && m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
if (m_corona && m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
updateStrutsBasedOnLayoutsAndActivities();
|
||||
}
|
||||
});
|
||||
@ -242,11 +242,11 @@ void VisibilityManager::setMode(Latte::Types::Visibility mode)
|
||||
|
||||
void VisibilityManager::updateStrutsBasedOnLayoutsAndActivities()
|
||||
{
|
||||
bool multipleLayoutsAndCurrent = (m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts
|
||||
bool multipleLayoutsAndCurrent = (m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts
|
||||
&& m_latteView->layout() && !m_latteView->positioner()->inLocationChangeAnimation()
|
||||
&& m_latteView->layout()->isCurrent());
|
||||
|
||||
if (m_corona->layoutManager()->memoryUsage() == Types::SingleLayout || multipleLayoutsAndCurrent) {
|
||||
if (m_corona->layoutsManager()->memoryUsage() == Types::SingleLayout || multipleLayoutsAndCurrent) {
|
||||
QRect computedStruts = acceptableStruts();
|
||||
|
||||
if (m_publishedStruts != computedStruts) {
|
||||
@ -397,10 +397,10 @@ bool VisibilityManager::supportsKWinEdges() const
|
||||
void VisibilityManager::updateGhostWindowState()
|
||||
{
|
||||
if (supportsKWinEdges()) {
|
||||
bool inCurrentLayout = (m_corona->layoutManager()->memoryUsage() == Types::SingleLayout ||
|
||||
(m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts
|
||||
bool inCurrentLayout = (m_corona->layoutsManager()->memoryUsage() == Types::SingleLayout ||
|
||||
(m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts
|
||||
&& m_latteView->layout() && !m_latteView->positioner()->inLocationChangeAnimation()
|
||||
&& m_latteView->layout()->name() == m_corona->layoutManager()->currentLayoutName()));
|
||||
&& m_latteView->layout()->name() == m_corona->layoutsManager()->currentLayoutName()));
|
||||
|
||||
if (inCurrentLayout) {
|
||||
m_wm->setEdgeStateFor(m_edgeGhostWindow, m_isHidden);
|
||||
@ -718,10 +718,10 @@ void VisibilityManager::createEdgeGhostWindow()
|
||||
|
||||
m_connectionsKWinEdges[0] = connect(m_wm, &WindowSystem::currentActivityChanged,
|
||||
this, [&]() {
|
||||
bool inCurrentLayout = (m_corona->layoutManager()->memoryUsage() == Types::SingleLayout ||
|
||||
(m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts
|
||||
bool inCurrentLayout = (m_corona->layoutsManager()->memoryUsage() == Types::SingleLayout ||
|
||||
(m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts
|
||||
&& m_latteView->layout() && !m_latteView->positioner()->inLocationChangeAnimation()
|
||||
&& m_latteView->layout()->name() == m_corona->layoutManager()->currentLayoutName()));
|
||||
&& m_latteView->layout()->name() == m_corona->layoutsManager()->currentLayoutName()));
|
||||
|
||||
if (m_edgeGhostWindow) {
|
||||
if (inCurrentLayout) {
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "positioner.h"
|
||||
#include "view.h"
|
||||
#include "../lattecorona.h"
|
||||
#include "../layoutmanager.h"
|
||||
#include "../layouts/manager.h"
|
||||
#include "../../liblatte2/types.h"
|
||||
|
||||
namespace Latte {
|
||||
@ -203,7 +203,7 @@ void WindowsTracker::setEnabled(bool active)
|
||||
});
|
||||
|
||||
m_connections[6] = connect(m_wm, &WindowSystem::currentActivityChanged, this, [&] {
|
||||
if (m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
if (m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
//! this is needed in MultipleLayouts because there is a chance that multiple
|
||||
//! layouts are providing different available screen geometries in different Activities
|
||||
updateAvailableScreenGeometry();
|
||||
|
@ -250,7 +250,7 @@ Item{
|
||||
}
|
||||
|
||||
Connections{
|
||||
target: universalLayoutManager
|
||||
target: layoutsManager
|
||||
onCurrentLayoutIsSwitching: {
|
||||
if (Latte.WindowSystem.compositingActive && latteView && latteView.layout && latteView.layout.name === layoutName) {
|
||||
manager.inTempHiding = true;
|
||||
|
@ -393,7 +393,7 @@ DragDrop.DropArea {
|
||||
property QtObject shortcutsEngine: null
|
||||
property QtObject themeExtended: null
|
||||
property QtObject universalSettings: null
|
||||
property QtObject universalLayoutManager: null
|
||||
property QtObject layoutsManager: null
|
||||
property QtObject viewLayout: latteView && latteView.layout ? latteView.layout : null
|
||||
|
||||
// TO BE DELETED, if not needed: property int counter:0;
|
||||
|
@ -700,7 +700,7 @@ PlasmaComponents.ContextMenu {
|
||||
}
|
||||
}
|
||||
|
||||
/* PlasmaComponents.MenuItem {
|
||||
/* PlasmaComponents.MenuItem {
|
||||
separator: true
|
||||
|
||||
visible: (visualParent
|
||||
@ -731,7 +731,7 @@ PlasmaComponents.ContextMenu {
|
||||
var launcher = get(atm.LauncherUrl);
|
||||
|
||||
if (latteView && latteView.launchersGroup >= Latte.Types.LayoutLaunchers) {
|
||||
latteView.universalLayoutManager.launchersSignals.removeLauncher(root.viewLayoutName,
|
||||
latteView.layoutsManager.launchersSignals.removeLauncher(root.viewLayoutName,
|
||||
latteView.launchersGroup, launcher);
|
||||
} else {
|
||||
root.launcherForRemoval = launcher;
|
||||
@ -742,7 +742,7 @@ PlasmaComponents.ContextMenu {
|
||||
} else {
|
||||
var launcher = get(atm.LauncherUrl);
|
||||
if (latteView && latteView.launchersGroup >= Latte.Types.LayoutLaunchers) {
|
||||
latteView.universalLayoutManager.launchersSignals.addLauncher(root.viewLayoutName,
|
||||
latteView.layoutsManager.launchersSignals.addLauncher(root.viewLayoutName,
|
||||
latteView.launchersGroup, launcher);
|
||||
} else {
|
||||
tasksModel.requestAddLauncher(launcher);
|
||||
@ -791,7 +791,7 @@ PlasmaComponents.ContextMenu {
|
||||
function() {
|
||||
if (result.checked) {
|
||||
if (latteView && latteView.launchersGroup >= Latte.Types.LayoutLaunchers) {
|
||||
latteView.universalLayoutManager.launchersSignals.addLauncherToActivity(root.viewLayoutName,
|
||||
latteView.layoutsManager.launchersSignals.addLauncherToActivity(root.viewLayoutName,
|
||||
latteView.launchersGroup, url, id);
|
||||
} else {
|
||||
if (id !== tasksModel.activity && (activities[0] === "00000000-0000-0000-0000-000000000000")) {
|
||||
@ -803,7 +803,7 @@ PlasmaComponents.ContextMenu {
|
||||
}
|
||||
} else {
|
||||
if (latteView && latteView.launchersGroup >= Latte.Types.LayoutLaunchers) {
|
||||
latteView.universalLayoutManager.launchersSignals.removeLauncherFromActivity(root.viewLayoutName,
|
||||
latteView.layoutsManager.launchersSignals.removeLauncherFromActivity(root.viewLayoutName,
|
||||
latteView.launchersGroup, url, id);
|
||||
} else {
|
||||
if (id === tasksModel.activity) {
|
||||
@ -862,7 +862,7 @@ PlasmaComponents.ContextMenu {
|
||||
var launcher = get(atm.LauncherUrlWithoutIcon);
|
||||
|
||||
if (latteView && latteView.launchersGroup >= Latte.Types.LayoutLaunchers) {
|
||||
latteView.universalLayoutManager.launchersSignals.removeLauncher(root.viewLayoutName,
|
||||
latteView.layoutsManager.launchersSignals.removeLauncher(root.viewLayoutName,
|
||||
latteView.launchersGroup, launcher);
|
||||
} else {
|
||||
root.launcherForRemoval = launcher
|
||||
@ -906,7 +906,7 @@ PlasmaComponents.ContextMenu {
|
||||
var launcher = get(atm.LauncherUrlWithoutIcon);
|
||||
|
||||
if (latteView && latteView.launchersGroup >= Latte.Types.LayoutLaunchers) {
|
||||
latteView.universalLayoutManager.launchersSignals.removeLauncher(root.viewLayoutName,
|
||||
latteView.layoutsManager.launchersSignals.removeLauncher(root.viewLayoutName,
|
||||
latteView.launchersGroup, launcher);
|
||||
} else {
|
||||
root.launcherForRemoval = launcher;
|
||||
@ -931,7 +931,7 @@ PlasmaComponents.ContextMenu {
|
||||
|
||||
action: latteView ? latteView.containmentActions()[1] : plasmoid.action("configure")
|
||||
enabled: visible
|
||||
visible: latteView && latteView.universalLayoutManager.menuLayouts.length>1
|
||||
visible: latteView && latteView.layoutsManager.menuLayouts.length>1
|
||||
}
|
||||
|
||||
PlasmaComponents.MenuItem {
|
||||
|
@ -537,7 +537,7 @@ Item {
|
||||
|
||||
tasksModel.move(from, to);
|
||||
if (latteView && latteView.launchersGroup >= Latte.Types.LayoutLaunchers) {
|
||||
latteView.universalLayoutManager.launchersSignals.moveTask(root.viewLayoutName,
|
||||
latteView.layoutsManager.launchersSignals.moveTask(root.viewLayoutName,
|
||||
plasmoid.id, latteView.launchersGroup, from, to);
|
||||
}
|
||||
delayedLaynchersSyncTimer.start();
|
||||
|
@ -248,8 +248,8 @@ Item {
|
||||
|
||||
readonly property rect screenGeometry: latteView ? latteView.screenGeometry : plasmoid.screenGeometry
|
||||
|
||||
readonly property bool viewLayoutIsCurrent: latteView && viewLayout && latteView.universalLayoutManager
|
||||
&& viewLayout.name === latteView.universalLayoutManager.currentLayoutName
|
||||
readonly property bool viewLayoutIsCurrent: latteView && viewLayout && latteView.layoutsManager
|
||||
&& viewLayout.name === latteView.layoutsManager.currentLayoutName
|
||||
readonly property string viewLayoutName: viewLayout ? viewLayout.name : ""
|
||||
readonly property QtObject viewLayout : latteView && latteView.viewLayout ? latteView.viewLayout : null
|
||||
|
||||
@ -349,7 +349,7 @@ Item {
|
||||
|
||||
|
||||
Connections{
|
||||
target: latteView && latteView.universalLayoutManager ? latteView.universalLayoutManager : null
|
||||
target: latteView && latteView.layoutsManager ? latteView.layoutsManager : null
|
||||
|
||||
onCurrentLayoutNameChanged: root.publishTasksGeometries();
|
||||
}
|
||||
@ -451,7 +451,7 @@ Item {
|
||||
var launchersList = [];
|
||||
|
||||
if (viewLayout) {
|
||||
if (latteView && latteView.universalLayoutManager
|
||||
if (latteView && latteView.layoutsManager
|
||||
&& latteView.viewLayout && latteView.universalSettings
|
||||
&& (latteView.launchersGroup === Latte.Types.LayoutLaunchers
|
||||
|| latteView.launchersGroup === Latte.Types.GlobalLaunchers)) {
|
||||
@ -774,7 +774,7 @@ Item {
|
||||
|
||||
onLauncherListChanged: {
|
||||
if (viewLayout) {
|
||||
if (latteView && latteView.universalLayoutManager
|
||||
if (latteView && latteView.layoutsManager
|
||||
&& latteView.viewLayout && latteView.universalSettings
|
||||
&& (latteView.launchersGroup === Latte.Types.LayoutLaunchers
|
||||
|| latteView.launchersGroup === Latte.Types.GlobalLaunchers)) {
|
||||
@ -787,7 +787,7 @@ Item {
|
||||
|
||||
if (inDraggingPhase) {
|
||||
if (latteView && latteView.launchersGroup >= Latte.Types.LayoutLaunchers) {
|
||||
latteView.universalLayoutManager.launchersSignals.validateLaunchersOrder(root.viewLayoutName,
|
||||
latteView.layoutsManager.launchersSignals.validateLaunchersOrder(root.viewLayoutName,
|
||||
plasmoid.id,
|
||||
latteView.launchersGroup,
|
||||
currentLauncherList());
|
||||
@ -1224,7 +1224,7 @@ Item {
|
||||
onUrlsDropped: {
|
||||
//! inform synced docks for new dropped launchers
|
||||
if (latteView && latteView.launchersGroup >= Latte.Types.LayoutLaunchers && onlyLaunchersInList(urls)) {
|
||||
latteView.universalLayoutManager.launchersSignals.urlsDropped(root.viewLayoutName,
|
||||
latteView.layoutsManager.launchersSignals.urlsDropped(root.viewLayoutName,
|
||||
latteView.launchersGroup, urls);
|
||||
return;
|
||||
}
|
||||
@ -1640,7 +1640,7 @@ Item {
|
||||
parabolicManager.addLauncherToBeMoved(separatorName, Math.max(0,pos));
|
||||
|
||||
if (latteView && latteView.launchersGroup >= Latte.Types.LayoutLaunchers) {
|
||||
latteView.universalLayoutManager.launchersSignals.addLauncher(root.viewLayoutName,
|
||||
latteView.layoutsManager.launchersSignals.addLauncher(root.viewLayoutName,
|
||||
latteView.launchersGroup, separatorName);
|
||||
} else {
|
||||
tasksModel.requestAddLauncher(separatorName);
|
||||
@ -1853,7 +1853,7 @@ Item {
|
||||
parabolicManager.addLauncherToBeMoved(separatorName, Math.max(0,pos));
|
||||
|
||||
if (latteView && latteView.launchersGroup >= Latte.Types.LayoutLaunchers) {
|
||||
latteView.universalLayoutManager.launchersSignals.addLauncher(latteView.launchersGroup, separatorName);
|
||||
latteView.layoutsManager.launchersSignals.addLauncher(latteView.launchersGroup, separatorName);
|
||||
} else {
|
||||
tasksModel.requestAddLauncher(separatorName);
|
||||
}
|
||||
@ -1865,7 +1865,7 @@ Item {
|
||||
|
||||
if (separatorName !== "") {
|
||||
if (latteView && latteView.launchersGroup >= Latte.Types.LayoutLaunchers) {
|
||||
latteView.universalLayoutManager.launchersSignals.removeLauncher(root.viewLayoutName,
|
||||
latteView.layoutsManager.launchersSignals.removeLauncher(root.viewLayoutName,
|
||||
latteView.launchersGroup, separatorName);
|
||||
} else {
|
||||
root.launcherForRemoval = separatorName;
|
||||
|
@ -162,7 +162,7 @@ Item {
|
||||
tasksModel.move(pos, insertAt);
|
||||
//! disable syncing for moving launchers action in favor of validatorOrder launchersSignal
|
||||
/* if (latteView && latteView.launchersGroup >= Latte.Types.LayoutLaunchers) {
|
||||
latteView.universalLayoutManager.launchersSignals.moveTask(root.viewLayoutName,
|
||||
latteView.layoutsManager.launchersSignals.moveTask(root.viewLayoutName,
|
||||
plasmoid.id,
|
||||
latteView.launchersGroup, pos, insertAt);
|
||||
}*/
|
||||
|
@ -301,7 +301,7 @@ FocusScope {
|
||||
tooltip: i18n("Open Latte settings window")
|
||||
onPressedChanged: {
|
||||
if (pressed) {
|
||||
layoutManager.showLatteSettingsDialog(Latte.Types.PreferencesPage)
|
||||
layoutsManager.showLatteSettingsDialog(Latte.Types.PreferencesPage)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -611,8 +611,8 @@ FocusScope {
|
||||
|
||||
updateCopyText();
|
||||
|
||||
var tempCentralLayouts = layoutManager.centralLayoutsNames();
|
||||
var tempSharedLayouts = layoutManager.sharedLayoutsNames();
|
||||
var tempCentralLayouts = layoutsManager.centralLayoutsNames();
|
||||
var tempSharedLayouts = layoutsManager.sharedLayoutsNames();
|
||||
|
||||
if (tempSharedLayouts.length > 0) {
|
||||
var curIndex = tempSharedLayouts.indexOf(latteView.layout.name);
|
||||
|
@ -80,20 +80,20 @@ PlasmaComponents.Page {
|
||||
Component.onCompleted: loadLayouts();
|
||||
|
||||
Connections {
|
||||
target:layoutManager
|
||||
target:layoutsManager
|
||||
onMenuLayoutsChanged: layoutCmb.loadLayouts();
|
||||
}
|
||||
|
||||
function loadLayouts(){
|
||||
layouts = layoutManager.menuLayouts;
|
||||
layouts = layoutsManager.menuLayouts;
|
||||
layoutTexts = [];
|
||||
|
||||
//if current layout isnt at the menu layouts
|
||||
if (layouts.indexOf(layoutManager.currentLayoutName) === -1) {
|
||||
if (layouts.indexOf(layoutsManager.currentLayoutName) === -1) {
|
||||
if (Qt.application.layoutDirection === Qt.RightToLeft) {
|
||||
layoutTexts.push( layoutManager.currentLayoutName + " ✔ ");
|
||||
layoutTexts.push( layoutsManager.currentLayoutName + " ✔ ");
|
||||
} else {
|
||||
layoutTexts.push( " ✔ "+layoutManager.currentLayoutName);
|
||||
layoutTexts.push( " ✔ "+layoutsManager.currentLayoutName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ PlasmaComponents.Page {
|
||||
var selText1 = " ";
|
||||
var selText2 = " ";
|
||||
|
||||
if (layouts[i] === layoutManager.currentLayoutName) {
|
||||
if (layouts[i] === layoutsManager.currentLayoutName) {
|
||||
selText1 = " ✔ ";
|
||||
activeLayout = i;
|
||||
}
|
||||
@ -120,7 +120,7 @@ PlasmaComponents.Page {
|
||||
}
|
||||
|
||||
onActivated: {
|
||||
layoutManager.switchToLayout(layouts[index]);
|
||||
layoutsManager.switchToLayout(layouts[index]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ PlasmaComponents.Page {
|
||||
iconSource: "document-edit"
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
|
||||
onClicked: layoutManager.showLatteSettingsDialog()
|
||||
onClicked: layoutsManager.showLatteSettingsDialog()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ PlasmaCore.FrameSvgItem {
|
||||
viewLayout.shortcutsEngine = shortcutsEngine;
|
||||
viewLayout.themeExtended = themeExtended;
|
||||
viewLayout.universalSettings = universalSettings;
|
||||
viewLayout.universalLayoutManager = layoutManager;
|
||||
viewLayout.layoutsManager = layoutsManager;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user