mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-23 13:33:50 +03:00
REFACTOR: rename Active TO -> CENTRALLAYOUT
This commit is contained in:
parent
e8d79632bd
commit
1f14405e63
@ -28,7 +28,7 @@
|
||||
#include "layoutmanager.h"
|
||||
#include "screenpool.h"
|
||||
#include "indicator/factory.h"
|
||||
#include "layout/activelayout.h"
|
||||
#include "layout/centrallayout.h"
|
||||
#include "layout/genericlayout.h"
|
||||
#include "layout/sharedlayout.h"
|
||||
#include "shortcuts/globalshortcuts.h"
|
||||
@ -476,10 +476,10 @@ QRegion Corona::availableScreenRegionWithCriteria(int id, QString forLayout) con
|
||||
QList<Latte::View *> views;
|
||||
|
||||
if (forLayout.isEmpty()) {
|
||||
Latte::ActiveLayout *currentLayout = m_layoutManager->currentLayout();
|
||||
Latte::CentralLayout *currentLayout = m_layoutManager->currentLayout();
|
||||
views = currentLayout->latteViews();
|
||||
} else {
|
||||
Layout::GenericLayout *generic = m_layoutManager->activeLayout(forLayout);
|
||||
Layout::GenericLayout *generic = m_layoutManager->centralLayout(forLayout);
|
||||
|
||||
if (!generic) {
|
||||
//! Identify best active layout to be used for metrics calculations.
|
||||
@ -487,7 +487,7 @@ QRegion Corona::availableScreenRegionWithCriteria(int id, QString forLayout) con
|
||||
SharedLayout *sharedLayout = m_layoutManager->sharedLayout(forLayout);
|
||||
|
||||
if (sharedLayout) {
|
||||
generic = sharedLayout->currentActiveLayout();
|
||||
generic = sharedLayout->currentCentralLayout();
|
||||
}
|
||||
}
|
||||
|
||||
@ -619,7 +619,7 @@ QRect Corona::availableScreenRectWithCriteria(int id, QList<Types::Visibility> m
|
||||
|
||||
auto available = screen->geometry();
|
||||
|
||||
Latte::ActiveLayout *currentLayout = m_layoutManager->currentLayout();
|
||||
Latte::CentralLayout *currentLayout = m_layoutManager->currentLayout();
|
||||
QList<Latte::View *> views;
|
||||
|
||||
if (currentLayout) {
|
||||
@ -767,7 +767,7 @@ int Corona::screenForContainment(const Plasma::Containment *containment) const
|
||||
}
|
||||
}
|
||||
|
||||
Latte::ActiveLayout *currentLayout = m_layoutManager->currentLayout();
|
||||
Latte::CentralLayout *currentLayout = m_layoutManager->currentLayout();
|
||||
Latte::View *view = currentLayout->viewForContainment(containment);
|
||||
|
||||
if (view && view->screen()) {
|
||||
@ -801,7 +801,7 @@ void Corona::showAlternativesForApplet(Plasma::Applet *applet)
|
||||
return;
|
||||
}
|
||||
|
||||
Latte::ActiveLayout *currentLayout = m_layoutManager->currentLayout();
|
||||
Latte::CentralLayout *currentLayout = m_layoutManager->currentLayout();
|
||||
Latte::View *latteView = currentLayout->viewForContainment(applet->containment());
|
||||
|
||||
KDeclarative::QmlObjectSharedEngine *qmlObj{nullptr};
|
||||
@ -1006,7 +1006,7 @@ QStringList Corona::contextMenuData()
|
||||
QStringList data;
|
||||
Types::ViewType viewType{Types::DockView};
|
||||
|
||||
Latte::ActiveLayout *currentLayout = m_layoutManager->currentLayout();
|
||||
Latte::CentralLayout *currentLayout = m_layoutManager->currentLayout();
|
||||
|
||||
if (currentLayout) {
|
||||
viewType = currentLayout->latteViewType(m_contextMenuViewId);
|
||||
@ -1017,7 +1017,7 @@ QStringList Corona::contextMenuData()
|
||||
data << QString::number((int)viewType);
|
||||
|
||||
for(const auto &layoutName : m_layoutManager->menuLayouts()) {
|
||||
if (m_layoutManager->activeLayout(layoutName)) {
|
||||
if (m_layoutManager->centralLayout(layoutName)) {
|
||||
data << QString("1," + layoutName);
|
||||
} else {
|
||||
data << QString("0," + layoutName);
|
||||
|
@ -23,7 +23,7 @@
|
||||
// local
|
||||
#include "lattecorona.h"
|
||||
#include "layoutmanager.h"
|
||||
#include "layout/activelayout.h"
|
||||
#include "layout/centrallayout.h"
|
||||
|
||||
// Qt
|
||||
#include <QQuickItem>
|
||||
@ -48,7 +48,7 @@ QList<Plasma::Applet *> LaunchersSignals::lattePlasmoids(QString layoutName)
|
||||
{
|
||||
QList<Plasma::Applet *> applets;
|
||||
|
||||
ActiveLayout *layout = m_manager->activeLayout(layoutName);
|
||||
CentralLayout *layout = m_manager->centralLayout(layoutName);
|
||||
QList<Plasma::Containment *> containments;
|
||||
|
||||
if (layoutName.isEmpty()) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
set(lattedock-app_SRCS
|
||||
${lattedock-app_SRCS}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/abstractlayout.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/activelayout.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/centrallayout.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/genericlayout.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sharedlayout.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/storage.cpp
|
||||
|
@ -40,7 +40,7 @@ Q_NAMESPACE
|
||||
enum Type {
|
||||
Abstract = 0,
|
||||
Generic,
|
||||
Active,
|
||||
Central,
|
||||
Shared
|
||||
};
|
||||
Q_ENUM_NS(Type);
|
||||
|
@ -18,7 +18,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "activelayout.h"
|
||||
#include "centrallayout.h"
|
||||
|
||||
// local
|
||||
#include "sharedlayout.h"
|
||||
@ -39,7 +39,7 @@
|
||||
|
||||
namespace Latte {
|
||||
|
||||
ActiveLayout::ActiveLayout(QObject *parent, QString layoutFile, QString assignedName)
|
||||
CentralLayout::CentralLayout(QObject *parent, QString layoutFile, QString assignedName)
|
||||
: Layout::GenericLayout(parent, layoutFile, assignedName)
|
||||
{
|
||||
if (m_loadedCorrectly) {
|
||||
@ -48,32 +48,32 @@ ActiveLayout::ActiveLayout(QObject *parent, QString layoutFile, QString assigned
|
||||
}
|
||||
}
|
||||
|
||||
ActiveLayout::~ActiveLayout()
|
||||
CentralLayout::~CentralLayout()
|
||||
{
|
||||
if (!m_layoutFile.isEmpty()) {
|
||||
m_layoutGroup.sync();
|
||||
}
|
||||
}
|
||||
|
||||
void ActiveLayout::unloadContainments()
|
||||
void CentralLayout::unloadContainments()
|
||||
{
|
||||
Layout::GenericLayout::unloadContainments();
|
||||
|
||||
if (m_sharedLayout) {
|
||||
disconnect(m_sharedLayout, &Layout::GenericLayout::viewsCountChanged, this, &Layout::GenericLayout::viewsCountChanged);
|
||||
m_sharedLayout->removeActiveLayout(this);
|
||||
m_sharedLayout->removeCentralLayout(this);
|
||||
}
|
||||
}
|
||||
|
||||
void ActiveLayout::init()
|
||||
void CentralLayout::init()
|
||||
{
|
||||
connect(this, &ActiveLayout::activitiesChanged, this, &ActiveLayout::saveConfig);
|
||||
connect(this, &ActiveLayout::disableBordersForMaximizedWindowsChanged, this, &ActiveLayout::saveConfig);
|
||||
connect(this, &ActiveLayout::sharedLayoutNameChanged, this, &ActiveLayout::saveConfig);
|
||||
connect(this, &ActiveLayout::showInMenuChanged, this, &ActiveLayout::saveConfig);
|
||||
connect(this, &CentralLayout::activitiesChanged, this, &CentralLayout::saveConfig);
|
||||
connect(this, &CentralLayout::disableBordersForMaximizedWindowsChanged, this, &CentralLayout::saveConfig);
|
||||
connect(this, &CentralLayout::sharedLayoutNameChanged, this, &CentralLayout::saveConfig);
|
||||
connect(this, &CentralLayout::showInMenuChanged, this, &CentralLayout::saveConfig);
|
||||
}
|
||||
|
||||
void ActiveLayout::initToCorona(Latte::Corona *corona)
|
||||
void CentralLayout::initToCorona(Latte::Corona *corona)
|
||||
{
|
||||
if (GenericLayout::initToCorona(corona)) {
|
||||
connect(m_corona->universalSettings(), &UniversalSettings::canDisableBordersChanged, this, [&]() {
|
||||
@ -98,19 +98,19 @@ void ActiveLayout::initToCorona(Latte::Corona *corona)
|
||||
|
||||
//! Request the SharedLayout in case there is one and Latte is functioning in MultipleLayouts mode
|
||||
if (m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts && !m_sharedLayoutName.isEmpty()) {
|
||||
if (m_corona->layoutManager()->assignActiveToSharedLayout(this, m_sharedLayoutName)) {
|
||||
if (m_corona->layoutManager()->registerAtSharedLayout(this, m_sharedLayoutName)) {
|
||||
setSharedLayout(m_corona->layoutManager()->sharedLayout(m_sharedLayoutName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ActiveLayout::disableBordersForMaximizedWindows() const
|
||||
bool CentralLayout::disableBordersForMaximizedWindows() const
|
||||
{
|
||||
return m_disableBordersForMaximizedWindows;
|
||||
}
|
||||
|
||||
void ActiveLayout::setDisableBordersForMaximizedWindows(bool disable)
|
||||
void CentralLayout::setDisableBordersForMaximizedWindows(bool disable)
|
||||
{
|
||||
if (m_disableBordersForMaximizedWindows == disable) {
|
||||
return;
|
||||
@ -122,7 +122,7 @@ void ActiveLayout::setDisableBordersForMaximizedWindows(bool disable)
|
||||
emit disableBordersForMaximizedWindowsChanged();
|
||||
}
|
||||
|
||||
bool ActiveLayout::kwin_disabledMaximizedBorders() const
|
||||
bool CentralLayout::kwin_disabledMaximizedBorders() const
|
||||
{
|
||||
//! Identify Plasma Desktop version
|
||||
QProcess process;
|
||||
@ -135,7 +135,7 @@ bool ActiveLayout::kwin_disabledMaximizedBorders() const
|
||||
return (output == "true");
|
||||
}
|
||||
|
||||
void ActiveLayout::kwin_setDisabledMaximizedBorders(bool disable)
|
||||
void CentralLayout::kwin_setDisabledMaximizedBorders(bool disable)
|
||||
{
|
||||
if (kwin_disabledMaximizedBorders() == disable) {
|
||||
return;
|
||||
@ -156,12 +156,12 @@ void ActiveLayout::kwin_setDisabledMaximizedBorders(bool disable)
|
||||
|
||||
}
|
||||
|
||||
bool ActiveLayout::showInMenu() const
|
||||
bool CentralLayout::showInMenu() const
|
||||
{
|
||||
return m_showInMenu;
|
||||
}
|
||||
|
||||
void ActiveLayout::setShowInMenu(bool show)
|
||||
void CentralLayout::setShowInMenu(bool show)
|
||||
{
|
||||
if (m_showInMenu == show) {
|
||||
return;
|
||||
@ -171,17 +171,17 @@ void ActiveLayout::setShowInMenu(bool show)
|
||||
emit showInMenuChanged();
|
||||
}
|
||||
|
||||
Layout::Type ActiveLayout::type() const
|
||||
Layout::Type CentralLayout::type() const
|
||||
{
|
||||
return Layout::Type::Active;
|
||||
return Layout::Type::Central;
|
||||
}
|
||||
|
||||
QStringList ActiveLayout::activities() const
|
||||
QStringList CentralLayout::activities() const
|
||||
{
|
||||
return m_activities;
|
||||
}
|
||||
|
||||
void ActiveLayout::setActivities(QStringList activities)
|
||||
void CentralLayout::setActivities(QStringList activities)
|
||||
{
|
||||
if (m_activities == activities) {
|
||||
return;
|
||||
@ -192,12 +192,12 @@ void ActiveLayout::setActivities(QStringList activities)
|
||||
emit activitiesChanged();
|
||||
}
|
||||
|
||||
QString ActiveLayout::sharedLayoutName() const
|
||||
QString CentralLayout::sharedLayoutName() const
|
||||
{
|
||||
return m_sharedLayoutName;
|
||||
}
|
||||
|
||||
void ActiveLayout::setSharedLayoutName(QString name)
|
||||
void CentralLayout::setSharedLayoutName(QString name)
|
||||
{
|
||||
if (m_sharedLayoutName == name || !Importer::layoutExists(name)) {
|
||||
return;
|
||||
@ -207,7 +207,7 @@ void ActiveLayout::setSharedLayoutName(QString name)
|
||||
emit sharedLayoutNameChanged();
|
||||
}
|
||||
|
||||
void ActiveLayout::setSharedLayout(SharedLayout *layout)
|
||||
void CentralLayout::setSharedLayout(SharedLayout *layout)
|
||||
{
|
||||
if (m_sharedLayout == layout) {
|
||||
return;
|
||||
@ -220,27 +220,27 @@ void ActiveLayout::setSharedLayout(SharedLayout *layout)
|
||||
emit viewsCountChanged();
|
||||
}
|
||||
|
||||
bool ActiveLayout::isActiveLayout() const
|
||||
bool CentralLayout::isCentralLayout() const
|
||||
{
|
||||
if (!m_corona) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ActiveLayout *activeLayout = m_corona->layoutManager()->activeLayout(m_layoutName);
|
||||
CentralLayout *centralLayout = m_corona->layoutManager()->centralLayout(m_layoutName);
|
||||
|
||||
if (activeLayout) {
|
||||
if (centralLayout) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool ActiveLayout::isOriginalLayout() const
|
||||
bool CentralLayout::isPseudoLayout() const
|
||||
{
|
||||
return m_layoutName != MultipleLayoutsName;
|
||||
return m_layoutName == MultipleLayoutsName;
|
||||
}
|
||||
|
||||
void ActiveLayout::loadConfig()
|
||||
void CentralLayout::loadConfig()
|
||||
{
|
||||
m_disableBordersForMaximizedWindows = m_layoutGroup.readEntry("disableBordersForMaximizedWindows", false);
|
||||
m_showInMenu = m_layoutGroup.readEntry("showInMenu", false);
|
||||
@ -255,9 +255,9 @@ void ActiveLayout::loadConfig()
|
||||
emit activitiesChanged();
|
||||
}
|
||||
|
||||
void ActiveLayout::saveConfig()
|
||||
void CentralLayout::saveConfig()
|
||||
{
|
||||
qDebug() << "active layout is saving... for layout:" << m_layoutName;
|
||||
qDebug() << "CENTRAL layout is saving... for layout:" << m_layoutName;
|
||||
m_layoutGroup.writeEntry("showInMenu", m_showInMenu);
|
||||
m_layoutGroup.writeEntry("disableBordersForMaximizedWindows", m_disableBordersForMaximizedWindows);
|
||||
m_layoutGroup.writeEntry("sharedLayout", m_sharedLayoutName);
|
||||
@ -268,7 +268,7 @@ void ActiveLayout::saveConfig()
|
||||
|
||||
//! OVERRIDES
|
||||
|
||||
void ActiveLayout::addView(Plasma::Containment *containment, bool forceOnPrimary, int explicitScreen, Layout::ViewsMap *occupied)
|
||||
void CentralLayout::addView(Plasma::Containment *containment, bool forceOnPrimary, int explicitScreen, Layout::ViewsMap *occupied)
|
||||
{
|
||||
if (m_sharedLayout) {
|
||||
//! consider already occupied edges from SharedLayout
|
||||
@ -279,7 +279,7 @@ void ActiveLayout::addView(Plasma::Containment *containment, bool forceOnPrimary
|
||||
}
|
||||
}
|
||||
|
||||
const QStringList ActiveLayout::appliedActivities()
|
||||
const QStringList CentralLayout::appliedActivities()
|
||||
{
|
||||
if (!m_corona) {
|
||||
return {};
|
||||
@ -298,7 +298,7 @@ const QStringList ActiveLayout::appliedActivities()
|
||||
}
|
||||
}
|
||||
|
||||
QList<Latte::View *> ActiveLayout::latteViews()
|
||||
QList<Latte::View *> CentralLayout::latteViews()
|
||||
{
|
||||
if (m_sharedLayout) {
|
||||
QList<Latte::View *> views = Layout::GenericLayout::latteViews();
|
||||
@ -310,7 +310,7 @@ QList<Latte::View *> ActiveLayout::latteViews()
|
||||
return Layout::GenericLayout::latteViews();
|
||||
}
|
||||
|
||||
int ActiveLayout::viewsCount(int screen) const
|
||||
int CentralLayout::viewsCount(int screen) const
|
||||
{
|
||||
if (!m_corona) {
|
||||
return 0;
|
||||
@ -331,7 +331,7 @@ int ActiveLayout::viewsCount(int screen) const
|
||||
return views;
|
||||
}
|
||||
|
||||
int ActiveLayout::viewsCount(QScreen *screen) const
|
||||
int CentralLayout::viewsCount(QScreen *screen) const
|
||||
{
|
||||
if (!m_corona) {
|
||||
return 0;
|
||||
@ -350,7 +350,7 @@ int ActiveLayout::viewsCount(QScreen *screen) const
|
||||
return views;
|
||||
}
|
||||
|
||||
int ActiveLayout::viewsCount() const
|
||||
int CentralLayout::viewsCount() const
|
||||
{
|
||||
if (!m_corona) {
|
||||
return 0;
|
||||
@ -369,7 +369,7 @@ int ActiveLayout::viewsCount() const
|
||||
return views;
|
||||
}
|
||||
|
||||
QList<Plasma::Types::Location> ActiveLayout::availableEdgesForView(QScreen *scr, Latte::View *forView) const
|
||||
QList<Plasma::Types::Location> CentralLayout::availableEdgesForView(QScreen *scr, Latte::View *forView) const
|
||||
{
|
||||
using Plasma::Types;
|
||||
QList<Types::Location> edges{Types::BottomEdge, Types::LeftEdge,
|
||||
@ -394,7 +394,7 @@ QList<Plasma::Types::Location> ActiveLayout::availableEdgesForView(QScreen *scr,
|
||||
return edges;
|
||||
}
|
||||
|
||||
QList<Plasma::Types::Location> ActiveLayout::freeEdges(QScreen *scr) const
|
||||
QList<Plasma::Types::Location> CentralLayout::freeEdges(QScreen *scr) const
|
||||
{
|
||||
using Plasma::Types;
|
||||
QList<Types::Location> edges{Types::BottomEdge, Types::LeftEdge,
|
||||
@ -417,7 +417,7 @@ QList<Plasma::Types::Location> ActiveLayout::freeEdges(QScreen *scr) const
|
||||
return edges;
|
||||
}
|
||||
|
||||
QList<Plasma::Types::Location> ActiveLayout::freeEdges(int screen) const
|
||||
QList<Plasma::Types::Location> CentralLayout::freeEdges(int screen) const
|
||||
{
|
||||
using Plasma::Types;
|
||||
QList<Types::Location> edges{Types::BottomEdge, Types::LeftEdge,
|
||||
@ -441,14 +441,14 @@ QList<Plasma::Types::Location> ActiveLayout::freeEdges(int screen) const
|
||||
return edges;
|
||||
}
|
||||
|
||||
QList<Latte::View *> ActiveLayout::sortedLatteViews(QList<Latte::View *> views)
|
||||
QList<Latte::View *> CentralLayout::sortedLatteViews(QList<Latte::View *> views)
|
||||
{
|
||||
QList<Latte::View *> vws = latteViews();
|
||||
|
||||
return Layout::GenericLayout::sortedLatteViews(vws);
|
||||
}
|
||||
|
||||
QList<Latte::View *> ActiveLayout::viewsWithPlasmaShortcuts()
|
||||
QList<Latte::View *> CentralLayout::viewsWithPlasmaShortcuts()
|
||||
{
|
||||
QList<Latte::View *> combined = Layout::GenericLayout::viewsWithPlasmaShortcuts();
|
||||
|
||||
@ -459,7 +459,7 @@ QList<Latte::View *> ActiveLayout::viewsWithPlasmaShortcuts()
|
||||
return combined;
|
||||
}
|
||||
|
||||
void ActiveLayout::syncLatteViewsToScreens(Layout::ViewsMap *occupiedMap)
|
||||
void CentralLayout::syncLatteViewsToScreens(Layout::ViewsMap *occupiedMap)
|
||||
{
|
||||
if (m_sharedLayout) {
|
||||
Layout::ViewsMap map = m_sharedLayout->validViewsMap();
|
@ -18,8 +18,8 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef ACTIVELAYOUT_H
|
||||
#define ACTIVELAYOUT_H
|
||||
#ifndef CENTRALLAYOUT_H
|
||||
#define CENTRALLAYOUT_H
|
||||
|
||||
// local
|
||||
#include "genericlayout.h"
|
||||
@ -34,16 +34,24 @@ class SharedLayout;
|
||||
|
||||
namespace Latte {
|
||||
|
||||
//! This class is responsible to hold the settings for a specific layout.
|
||||
//! It also updates always the relevant layout configuration concerning
|
||||
//! its general settings (no the containments)
|
||||
class ActiveLayout : public Layout::GenericLayout
|
||||
//! CentralLayout is a very IMPORTANT layout that is responsible for specific Activities or not
|
||||
//! and it is used for all memory modes (SINGLE/MULTIPLE) at all times.
|
||||
//!
|
||||
//! It holds all the important settings in order to provide specific
|
||||
//! behavior for the Activities is assigned at.
|
||||
//! for example: activities for which its views should be shown,
|
||||
//! if the maximized windows will be borderless,
|
||||
//! if the layout will be shown at user layout contextmenu,
|
||||
//! which shared layout will be used on top of that layout.
|
||||
//!
|
||||
|
||||
class CentralLayout : public Layout::GenericLayout
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ActiveLayout(QObject *parent, QString layoutFile, QString layoutName = QString());
|
||||
~ActiveLayout() override;
|
||||
CentralLayout(QObject *parent, QString layoutFile, QString layoutName = QString());
|
||||
~CentralLayout() override;
|
||||
|
||||
void initToCorona(Latte::Corona *corona);
|
||||
|
||||
@ -54,9 +62,9 @@ public:
|
||||
void setShowInMenu(bool show);
|
||||
|
||||
//!this layout is loaded and running
|
||||
bool isActiveLayout() const;
|
||||
bool isCentralLayout() const;
|
||||
//!it is original layout compared to pseudo-layouts that are combinations of multiple-original layouts
|
||||
bool isOriginalLayout() const;
|
||||
bool isPseudoLayout() const;
|
||||
|
||||
QString sharedLayoutName() const;
|
||||
void setSharedLayoutName(QString name);
|
||||
@ -116,4 +124,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif //ACTIVELAYOUT_H
|
||||
#endif //CENTRALLAYOUT_H
|
@ -20,7 +20,7 @@
|
||||
#include "sharedlayout.h"
|
||||
|
||||
// local
|
||||
#include "activelayout.h"
|
||||
#include "centrallayout.h"
|
||||
#include "../lattecorona.h"
|
||||
#include "../layoutmanager.h"
|
||||
#include "../screenpool.h"
|
||||
@ -28,15 +28,15 @@
|
||||
|
||||
namespace Latte {
|
||||
|
||||
SharedLayout::SharedLayout(ActiveLayout *assigned, QObject *parent, QString layoutFile, QString layoutName)
|
||||
SharedLayout::SharedLayout(CentralLayout *assigned, QObject *parent, QString layoutFile, QString layoutName)
|
||||
: Layout::GenericLayout (parent, layoutFile, layoutName)
|
||||
{
|
||||
initToCorona(assigned->corona());
|
||||
|
||||
connect(m_corona->layoutManager(), &LayoutManager::currentLayoutNameChanged, this, &SharedLayout::updateLastUsedActiveLayout);
|
||||
connect(m_corona->layoutManager(), &LayoutManager::currentLayoutNameChanged, this, &SharedLayout::updateLastUsedCentralLayout);
|
||||
|
||||
addActiveLayout(assigned);
|
||||
updateLastUsedActiveLayout();
|
||||
addCentralLayout(assigned);
|
||||
updateLastUsedCentralLayout();
|
||||
}
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ SharedLayout::~SharedLayout()
|
||||
|
||||
bool SharedLayout::isCurrent() const
|
||||
{
|
||||
for (const auto &layout : m_activeLayouts) {
|
||||
for (const auto &layout : m_centralLayouts) {
|
||||
if (layout->isCurrent()) {
|
||||
return true;
|
||||
}
|
||||
@ -70,35 +70,35 @@ const QStringList SharedLayout::appliedActivities()
|
||||
|
||||
QStringList activities;
|
||||
|
||||
for (const auto &layout : m_activeLayouts) {
|
||||
for (const auto &layout : m_centralLayouts) {
|
||||
activities << layout->appliedActivities();
|
||||
}
|
||||
|
||||
return activities;
|
||||
}
|
||||
|
||||
void SharedLayout::updateLastUsedActiveLayout()
|
||||
void SharedLayout::updateLastUsedCentralLayout()
|
||||
{
|
||||
for (const auto &layout : m_activeLayouts) {
|
||||
for (const auto &layout : m_centralLayouts) {
|
||||
if (layout->isCurrent()) {
|
||||
m_lastUsedActiveLayout = layout->name();
|
||||
m_lastUsedCentralLayout = layout->name();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ActiveLayout *SharedLayout::currentActiveLayout() const
|
||||
CentralLayout *SharedLayout::currentCentralLayout() const
|
||||
{
|
||||
//! first the current active one
|
||||
for (const auto &layout : m_activeLayouts) {
|
||||
for (const auto &layout : m_centralLayouts) {
|
||||
if (layout->isCurrent()) {
|
||||
return layout;
|
||||
}
|
||||
}
|
||||
|
||||
//! the last used
|
||||
for (const auto &layout : m_activeLayouts) {
|
||||
if (layout->name() == m_lastUsedActiveLayout) {
|
||||
for (const auto &layout : m_centralLayouts) {
|
||||
if (layout->name() == m_lastUsedCentralLayout) {
|
||||
return layout;
|
||||
}
|
||||
}
|
||||
@ -106,10 +106,10 @@ ActiveLayout *SharedLayout::currentActiveLayout() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void SharedLayout::addActiveLayout(ActiveLayout *layout)
|
||||
void SharedLayout::addCentralLayout(CentralLayout *layout)
|
||||
{
|
||||
if (layout != nullptr && !m_activeLayouts.contains(layout)) {
|
||||
m_activeLayouts.append(layout);
|
||||
if (layout != nullptr && !m_centralLayouts.contains(layout)) {
|
||||
m_centralLayouts.append(layout);
|
||||
|
||||
connect(layout, &GenericLayout::activitiesChanged, this, &GenericLayout::activitiesChanged);
|
||||
emit activitiesChanged();
|
||||
@ -119,15 +119,15 @@ void SharedLayout::addActiveLayout(ActiveLayout *layout)
|
||||
}
|
||||
}
|
||||
|
||||
void SharedLayout::removeActiveLayout(ActiveLayout *layout)
|
||||
void SharedLayout::removeCentralLayout(CentralLayout *layout)
|
||||
{
|
||||
if (m_activeLayouts.contains(layout)) {
|
||||
if (m_centralLayouts.contains(layout)) {
|
||||
qDebug() << "SHAREDLAYOUT <" << name() << "> : Removing active layout, " << layout->name();
|
||||
m_activeLayouts.removeAll(layout);
|
||||
m_centralLayouts.removeAll(layout);
|
||||
|
||||
disconnect(layout, &GenericLayout::activitiesChanged, this, &GenericLayout::activitiesChanged);
|
||||
|
||||
if (m_activeLayouts.count() > 0) {
|
||||
if (m_centralLayouts.count() > 0) {
|
||||
emit activitiesChanged();
|
||||
} else {
|
||||
//! all assigned layouts have been unloaded so the shared layout should be destroyed also
|
||||
@ -147,7 +147,7 @@ int SharedLayout::viewsCount(int screen) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
ActiveLayout *current = currentActiveLayout();
|
||||
CentralLayout *current = currentCentralLayout();
|
||||
|
||||
if (current) {
|
||||
return current->viewsCount(screen);
|
||||
@ -162,7 +162,7 @@ int SharedLayout::viewsCount(QScreen *screen) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
ActiveLayout *current = currentActiveLayout();
|
||||
CentralLayout *current = currentCentralLayout();
|
||||
|
||||
if (current) {
|
||||
return current->viewsCount(screen);
|
||||
@ -177,7 +177,7 @@ int SharedLayout::viewsCount() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
ActiveLayout *current = currentActiveLayout();
|
||||
CentralLayout *current = currentCentralLayout();
|
||||
|
||||
if (current) {
|
||||
return current->viewsCount();
|
||||
@ -209,7 +209,7 @@ QList<Plasma::Types::Location> SharedLayout::freeEdges(QScreen *scr) const
|
||||
return edges;
|
||||
}
|
||||
|
||||
ActiveLayout *current = currentActiveLayout();
|
||||
CentralLayout *current = currentCentralLayout();
|
||||
|
||||
if (current) {
|
||||
return current->freeEdges(scr);
|
||||
@ -228,7 +228,7 @@ QList<Plasma::Types::Location> SharedLayout::freeEdges(int screen) const
|
||||
return edges;
|
||||
}
|
||||
|
||||
ActiveLayout *current = currentActiveLayout();
|
||||
CentralLayout *current = currentCentralLayout();
|
||||
|
||||
if (current) {
|
||||
return current->freeEdges(screen);
|
||||
@ -239,7 +239,7 @@ QList<Plasma::Types::Location> SharedLayout::freeEdges(int screen) const
|
||||
|
||||
QList<Latte::View *> SharedLayout::sortedLatteViews(QList<Latte::View *> views)
|
||||
{
|
||||
ActiveLayout *current = currentActiveLayout();
|
||||
CentralLayout *current = currentCentralLayout();
|
||||
|
||||
if (current) {
|
||||
return current->sortedLatteViews();
|
||||
|
@ -27,17 +27,17 @@
|
||||
#include <QObject>
|
||||
|
||||
namespace Latte {
|
||||
class ActiveLayout;
|
||||
class CentralLayout;
|
||||
}
|
||||
|
||||
|
||||
namespace Latte {
|
||||
|
||||
//! SharedLayout is a layout that exists only as long as it belongs to one or
|
||||
//! more ActiveLayout(s). It is a layer above an active or more layouts and can
|
||||
//! be used from ActiveLayouts to share Latte:View(s) . Much of its functionality
|
||||
//! is provided by the ActiveLayouts it belongs to. For example the activities
|
||||
//! that its views should be shown is identified only from the active layouts
|
||||
//! more CentralLayout(s). It is a layer above a central or more layouts and can
|
||||
//! be used from CentralLayouts to share Latte:View(s) . Much of its functionality
|
||||
//! is provided by the CentralLayouts it belongs to. For example the activities
|
||||
//! that its views should be shown is identified only from the central layouts
|
||||
//! it belongs to
|
||||
|
||||
class SharedLayout : public Layout::GenericLayout
|
||||
@ -45,11 +45,11 @@ class SharedLayout : public Layout::GenericLayout
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SharedLayout(ActiveLayout *assigned, QObject *parent, QString layoutFile, QString layoutName = QString());
|
||||
SharedLayout(CentralLayout *assigned, QObject *parent, QString layoutFile, QString layoutName = QString());
|
||||
~SharedLayout() override;
|
||||
|
||||
const QStringList appliedActivities();
|
||||
ActiveLayout *currentActiveLayout() const;
|
||||
CentralLayout *currentCentralLayout() const;
|
||||
|
||||
//! OVERRIDE GeneralLayout implementations
|
||||
bool isCurrent() const override;
|
||||
@ -69,19 +69,19 @@ public:
|
||||
QList<Latte::View *> sortedLatteViews(QList<Latte::View *> views = QList<Latte::View *>()) override;
|
||||
|
||||
public slots:
|
||||
void addActiveLayout(ActiveLayout *layout);
|
||||
void removeActiveLayout(ActiveLayout *layout);
|
||||
void addCentralLayout(CentralLayout *layout);
|
||||
void removeCentralLayout(CentralLayout *layout);
|
||||
|
||||
signals:
|
||||
void layoutDestroyed(SharedLayout *layout);
|
||||
|
||||
private slots:
|
||||
void updateLastUsedActiveLayout();
|
||||
void updateLastUsedCentralLayout();
|
||||
|
||||
private:
|
||||
QString m_lastUsedActiveLayout;
|
||||
QString m_lastUsedCentralLayout;
|
||||
|
||||
QList<ActiveLayout *> m_activeLayouts;
|
||||
QList<CentralLayout *> m_centralLayouts;
|
||||
|
||||
};
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "launcherssignals.h"
|
||||
#include "screenpool.h"
|
||||
#include "layout/abstractlayout.h"
|
||||
#include "layout/activelayout.h"
|
||||
#include "layout/centrallayout.h"
|
||||
#include "layout/genericlayout.h"
|
||||
#include "layout/sharedlayout.h"
|
||||
#include "settings/settingsdialog.h"
|
||||
@ -123,21 +123,21 @@ void LayoutManager::load()
|
||||
|
||||
void LayoutManager::unload()
|
||||
{
|
||||
bool multipleMode{activeLayout(Layout::AbstractLayout::MultipleLayoutsName)};
|
||||
bool multipleMode{centralLayout(Layout::AbstractLayout::MultipleLayoutsName)};
|
||||
|
||||
//! Unload all ActiveLayouts
|
||||
while (!m_activeLayouts.isEmpty()) {
|
||||
ActiveLayout *layout = m_activeLayouts.at(0);
|
||||
m_activeLayouts.removeFirst();
|
||||
//! Unload all CentralLayouts
|
||||
while (!m_centralLayouts.isEmpty()) {
|
||||
CentralLayout *layout = m_centralLayouts.at(0);
|
||||
m_centralLayouts.removeFirst();
|
||||
|
||||
if (layout->isOriginalLayout() && multipleMode) {
|
||||
if (!layout->isPseudoLayout() && multipleMode) {
|
||||
layout->syncToLayoutFile(true);
|
||||
}
|
||||
|
||||
layout->unloadContainments();
|
||||
layout->unloadLatteViews();
|
||||
|
||||
if (layout->isOriginalLayout() && multipleMode) {
|
||||
if (!layout->isPseudoLayout() && multipleMode) {
|
||||
clearUnloadedContainmentsFromLinkedFile(layout->unloadedContainmentsIds(), true);
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ void LayoutManager::unload()
|
||||
|
||||
//! Unload all SharedLayouts
|
||||
//! DEPRECATED as now SharedLayouts are unloading themselves when
|
||||
//! they have no active layouts assigned to them
|
||||
//! they have no central layouts assigned to them
|
||||
/*while (!m_sharedLayouts.isEmpty()) {
|
||||
SharedLayout *layout = m_sharedLayouts.at(0);
|
||||
m_sharedLayouts.removeFirst();
|
||||
@ -227,7 +227,7 @@ QString LayoutManager::defaultLayoutName() const
|
||||
{
|
||||
QByteArray presetNameOrig = QString("preset" + QString::number(1)).toUtf8();
|
||||
QString presetPath = m_corona->kPackage().filePath(presetNameOrig);
|
||||
QString presetName = ActiveLayout::layoutName(presetPath);
|
||||
QString presetName = CentralLayout::layoutName(presetPath);
|
||||
QByteArray presetNameChars = presetName.toUtf8();
|
||||
presetName = i18n(presetNameChars);
|
||||
|
||||
@ -253,8 +253,8 @@ QStringList LayoutManager::menuLayouts() const
|
||||
if (!fixedMenuLayouts.contains(currentLayoutName()) && memoryUsage() == Types::SingleLayout) {
|
||||
fixedMenuLayouts.prepend(currentLayoutName());
|
||||
} else if (memoryUsage() == Types::MultipleLayouts) {
|
||||
for (const auto layout : m_activeLayouts) {
|
||||
if (layout->isOriginalLayout() && !fixedMenuLayouts.contains(layout->name())) {
|
||||
for (const auto layout : m_centralLayouts) {
|
||||
if (!layout->isPseudoLayout() && !fixedMenuLayouts.contains(layout->name())) {
|
||||
fixedMenuLayouts.prepend(layout->name());
|
||||
}
|
||||
}
|
||||
@ -329,7 +329,7 @@ void LayoutManager::setMemoryUsage(Types::LayoutsMemoryUsage memoryUsage)
|
||||
|
||||
bool LayoutManager::latteViewExists(Latte::View *view) const
|
||||
{
|
||||
for (const auto layout : m_activeLayouts) {
|
||||
for (const auto layout : m_centralLayouts) {
|
||||
for (const auto &v : layout->latteViews()) {
|
||||
if (v == view) {
|
||||
return true;
|
||||
@ -340,17 +340,17 @@ bool LayoutManager::latteViewExists(Latte::View *view) const
|
||||
return false;
|
||||
}
|
||||
|
||||
QStringList LayoutManager::activeLayoutsNames()
|
||||
QStringList LayoutManager::centralLayoutsNames()
|
||||
{
|
||||
QStringList names;
|
||||
|
||||
if (memoryUsage() == Types::SingleLayout) {
|
||||
names << currentLayoutName();
|
||||
} else {
|
||||
for (int i = 0; i < m_activeLayouts.size(); ++i) {
|
||||
ActiveLayout *layout = m_activeLayouts.at(i);
|
||||
for (int i = 0; i < m_centralLayouts.size(); ++i) {
|
||||
CentralLayout *layout = m_centralLayouts.at(i);
|
||||
|
||||
if (layout->isOriginalLayout()) {
|
||||
if (!layout->isPseudoLayout()) {
|
||||
names << layout->name();
|
||||
}
|
||||
}
|
||||
@ -379,7 +379,7 @@ QStringList LayoutManager::storedSharedLayouts() const
|
||||
|
||||
Layout::GenericLayout *LayoutManager::layout(QString id) const
|
||||
{
|
||||
Layout::GenericLayout *l = activeLayout(id);
|
||||
Layout::GenericLayout *l = centralLayout(id);
|
||||
|
||||
if (!l) {
|
||||
l = sharedLayout(id);
|
||||
@ -389,10 +389,10 @@ Layout::GenericLayout *LayoutManager::layout(QString id) const
|
||||
}
|
||||
|
||||
|
||||
ActiveLayout *LayoutManager::activeLayout(QString id) const
|
||||
CentralLayout *LayoutManager::centralLayout(QString id) const
|
||||
{
|
||||
for (int i = 0; i < m_activeLayouts.size(); ++i) {
|
||||
ActiveLayout *layout = m_activeLayouts.at(i);
|
||||
for (int i = 0; i < m_centralLayouts.size(); ++i) {
|
||||
CentralLayout *layout = m_centralLayouts.at(i);
|
||||
|
||||
if (layout->name() == id) {
|
||||
|
||||
@ -403,10 +403,10 @@ ActiveLayout *LayoutManager::activeLayout(QString id) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int LayoutManager::activeLayoutPos(QString id) const
|
||||
int LayoutManager::centralLayoutPos(QString id) const
|
||||
{
|
||||
for (int i = 0; i < m_activeLayouts.size(); ++i) {
|
||||
ActiveLayout *layout = m_activeLayouts.at(i);
|
||||
for (int i = 0; i < m_centralLayouts.size(); ++i) {
|
||||
CentralLayout *layout = m_centralLayouts.at(i);
|
||||
|
||||
if (layout->name() == id) {
|
||||
|
||||
@ -430,11 +430,11 @@ SharedLayout *LayoutManager::sharedLayout(QString id) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool LayoutManager::assignActiveToSharedLayout(ActiveLayout *active, QString id)
|
||||
bool LayoutManager::registerAtSharedLayout(CentralLayout *central, QString id)
|
||||
{
|
||||
if (memoryUsage() == Types::SingleLayout || activeLayout(id)) {
|
||||
if (memoryUsage() == Types::SingleLayout || centralLayout(id)) {
|
||||
//! if memory is functioning to SINGLE mode OR shared layout has already
|
||||
//! been loaded as ActiveLayout
|
||||
//! been loaded as CentralLayout
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -442,13 +442,13 @@ bool LayoutManager::assignActiveToSharedLayout(ActiveLayout *active, QString id)
|
||||
SharedLayout *layout = m_sharedLayouts.at(i);
|
||||
|
||||
if (layout->name() == id) {
|
||||
layout->addActiveLayout(active);
|
||||
layout->addCentralLayout(central);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//! If SharedLayout was not found, we must create it
|
||||
SharedLayout *top = new SharedLayout(active, this, Importer::layoutFilePath(id));
|
||||
SharedLayout *top = new SharedLayout(central, this, Importer::layoutFilePath(id));
|
||||
m_sharedLayouts.append(top);
|
||||
top->importToCorona();
|
||||
|
||||
@ -457,18 +457,18 @@ bool LayoutManager::assignActiveToSharedLayout(ActiveLayout *active, QString id)
|
||||
return true;
|
||||
}
|
||||
|
||||
ActiveLayout *LayoutManager::currentLayout() const
|
||||
CentralLayout *LayoutManager::currentLayout() const
|
||||
{
|
||||
if (memoryUsage() == Types::SingleLayout) {
|
||||
return m_activeLayouts.at(0);
|
||||
return m_centralLayouts.at(0);
|
||||
} else {
|
||||
for (auto layout : m_activeLayouts) {
|
||||
for (auto layout : m_centralLayouts) {
|
||||
if (layout->activities().contains(m_corona->m_activityConsumer->currentActivity())) {
|
||||
return layout;
|
||||
}
|
||||
}
|
||||
|
||||
for (auto layout : m_activeLayouts) {
|
||||
for (auto layout : m_centralLayouts) {
|
||||
if ((layout->name() != Layout::AbstractLayout::MultipleLayoutsName) && (layout->activities().isEmpty())) {
|
||||
return layout;
|
||||
}
|
||||
@ -480,16 +480,16 @@ ActiveLayout *LayoutManager::currentLayout() const
|
||||
|
||||
void LayoutManager::updateCurrentLayoutNameInMultiEnvironment()
|
||||
{
|
||||
for (const auto layout : m_activeLayouts) {
|
||||
if (layout->isOriginalLayout() && layout->activities().contains(m_corona->activitiesConsumer()->currentActivity())) {
|
||||
for (const auto layout : m_centralLayouts) {
|
||||
if (!layout->isPseudoLayout() && layout->activities().contains(m_corona->activitiesConsumer()->currentActivity())) {
|
||||
m_currentLayoutNameInMultiEnvironment = layout->name();
|
||||
emit currentLayoutNameChanged();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto layout : m_activeLayouts) {
|
||||
if (layout->isOriginalLayout() && layout->activities().isEmpty()) {
|
||||
for (const auto layout : m_centralLayouts) {
|
||||
if (!layout->isPseudoLayout() && layout->activities().isEmpty()) {
|
||||
m_currentLayoutNameInMultiEnvironment = layout->name();
|
||||
emit currentLayoutNameChanged();
|
||||
return;
|
||||
@ -571,22 +571,22 @@ void LayoutManager::loadLayouts()
|
||||
QStringList files = layoutDir.entryList(filter, QDir::Files | QDir::NoSymLinks);
|
||||
|
||||
for (const auto &layout : files) {
|
||||
ActiveLayout activeLayout(this, layoutDir.absolutePath() + "/" + layout);
|
||||
CentralLayout centralLayout(this, layoutDir.absolutePath() + "/" + layout);
|
||||
|
||||
QStringList validActivityIds = validActivities(activeLayout.activities());
|
||||
activeLayout.setActivities(validActivityIds);
|
||||
QStringList validActivityIds = validActivities(centralLayout.activities());
|
||||
centralLayout.setActivities(validActivityIds);
|
||||
|
||||
for (const auto &activity : validActivityIds) {
|
||||
m_assignedLayouts[activity] = activeLayout.name();
|
||||
m_assignedLayouts[activity] = centralLayout.name();
|
||||
}
|
||||
|
||||
m_layouts.append(activeLayout.name());
|
||||
m_layouts.append(centralLayout.name());
|
||||
|
||||
if (activeLayout.showInMenu()) {
|
||||
m_menuLayouts.append(activeLayout.name());
|
||||
if (centralLayout.showInMenu()) {
|
||||
m_menuLayouts.append(centralLayout.name());
|
||||
}
|
||||
|
||||
QString sharedName = activeLayout.sharedLayoutName();
|
||||
QString sharedName = centralLayout.sharedLayoutName();
|
||||
|
||||
if (!sharedName.isEmpty() && !m_sharedLayoutIds.contains(sharedName)) {
|
||||
m_sharedLayoutIds << sharedName;
|
||||
@ -719,31 +719,31 @@ void LayoutManager::importLatteLayout(QString layoutPath)
|
||||
|
||||
void LayoutManager::hideAllViews()
|
||||
{
|
||||
for (const auto layout : m_activeLayouts) {
|
||||
if (layout->isOriginalLayout()) {
|
||||
for (const auto layout : m_centralLayouts) {
|
||||
if (!layout->isPseudoLayout()) {
|
||||
emit currentLayoutIsSwitching(layout->name());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutManager::addLayout(ActiveLayout *layout)
|
||||
void LayoutManager::addLayout(CentralLayout *layout)
|
||||
{
|
||||
if (!m_activeLayouts.contains(layout)) {
|
||||
m_activeLayouts.append(layout);
|
||||
if (!m_centralLayouts.contains(layout)) {
|
||||
m_centralLayouts.append(layout);
|
||||
layout->initToCorona(m_corona);
|
||||
}
|
||||
}
|
||||
|
||||
bool LayoutManager::switchToLayout(QString layoutName, int previousMemoryUsage)
|
||||
{
|
||||
if (m_activeLayouts.size() > 0 && currentLayoutName() == layoutName && previousMemoryUsage == -1) {
|
||||
if (m_centralLayouts.size() > 0 && currentLayoutName() == layoutName && previousMemoryUsage == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//! First Check If that Layout is already present and in that case
|
||||
//! we can just switch to the proper Activity
|
||||
if (memoryUsage() == Types::MultipleLayouts && previousMemoryUsage == -1) {
|
||||
ActiveLayout *layout = activeLayout(layoutName);
|
||||
CentralLayout *layout = centralLayout(layoutName);
|
||||
|
||||
if (layout) {
|
||||
|
||||
@ -762,8 +762,8 @@ bool LayoutManager::switchToLayout(QString layoutName, int previousMemoryUsage)
|
||||
//! send the layouts that will be changed. This signal creates the
|
||||
//! nice animation that hides these docks/panels
|
||||
if (previousMemoryUsage != -1) {
|
||||
for (const auto layout : m_activeLayouts) {
|
||||
if (layout->isOriginalLayout()) {
|
||||
for (const auto layout : m_centralLayouts) {
|
||||
if (!layout->isPseudoLayout()) {
|
||||
emit currentLayoutIsSwitching(layout->name());
|
||||
}
|
||||
}
|
||||
@ -783,21 +783,21 @@ bool LayoutManager::switchToLayout(QString layoutName, int previousMemoryUsage)
|
||||
if (memoryUsage() == Types::SingleLayout) {
|
||||
// emit currentLayoutIsSwitching(currentLayoutName());
|
||||
} else if (memoryUsage() == Types::MultipleLayouts && layoutName != Layout::AbstractLayout::MultipleLayoutsName) {
|
||||
ActiveLayout toLayout(this, lPath);
|
||||
CentralLayout toLayout(this, lPath);
|
||||
|
||||
QStringList toActivities = toLayout.activities();
|
||||
|
||||
ActiveLayout *activeForOrphans{nullptr};
|
||||
CentralLayout *centralForOrphans{nullptr};
|
||||
|
||||
for (const auto fromLayout : m_activeLayouts) {
|
||||
if (fromLayout->isOriginalLayout() && fromLayout->activities().isEmpty()) {
|
||||
activeForOrphans = fromLayout;
|
||||
for (const auto fromLayout : m_centralLayouts) {
|
||||
if (!fromLayout->isPseudoLayout() && fromLayout->activities().isEmpty()) {
|
||||
centralForOrphans = fromLayout;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (toActivities.isEmpty() && activeForOrphans && (toLayout.name() != activeForOrphans->name())) {
|
||||
emit currentLayoutIsSwitching(activeForOrphans->name());
|
||||
if (toActivities.isEmpty() && centralForOrphans && (toLayout.name() != centralForOrphans->name())) {
|
||||
emit currentLayoutIsSwitching(centralForOrphans->name());
|
||||
}
|
||||
}
|
||||
|
||||
@ -813,7 +813,7 @@ bool LayoutManager::switchToLayout(QString layoutName, int previousMemoryUsage)
|
||||
|
||||
bool initializingMultipleLayouts{false};
|
||||
|
||||
if (memoryUsage() == Types::MultipleLayouts && !activeLayout(Layout::AbstractLayout::MultipleLayoutsName)) {
|
||||
if (memoryUsage() == Types::MultipleLayouts && !centralLayout(Layout::AbstractLayout::MultipleLayoutsName)) {
|
||||
initializingMultipleLayouts = true;
|
||||
}
|
||||
|
||||
@ -825,20 +825,20 @@ bool LayoutManager::switchToLayout(QString layoutName, int previousMemoryUsage)
|
||||
fixedLPath = layoutPath(fixedLayoutName);
|
||||
}
|
||||
|
||||
ActiveLayout *newLayout = new ActiveLayout(this, fixedLPath, fixedLayoutName);
|
||||
CentralLayout *newLayout = new CentralLayout(this, fixedLPath, fixedLayoutName);
|
||||
addLayout(newLayout);
|
||||
loadLatteLayout(fixedLPath);
|
||||
|
||||
emit activeLayoutsChanged();
|
||||
emit centralLayoutsChanged();
|
||||
}
|
||||
|
||||
if (memoryUsage() == Types::MultipleLayouts) {
|
||||
if (!initializingMultipleLayouts && !activeLayout(layoutName)) {
|
||||
if (!initializingMultipleLayouts && !centralLayout(layoutName)) {
|
||||
//! When we are in Multiple Layouts Environment and the user activates
|
||||
//! a Layout that is assigned to specific activities but this
|
||||
//! layout isnt loaded (this means neither of its activities are running)
|
||||
//! is such case we just activate these Activities
|
||||
ActiveLayout layout(this, Importer::layoutFilePath(layoutName));
|
||||
CentralLayout layout(this, Importer::layoutFilePath(layoutName));
|
||||
|
||||
int i = 0;
|
||||
bool lastUsedActivityFound{false};
|
||||
@ -934,7 +934,7 @@ void LayoutManager::syncMultipleLayoutsToActivities(QString layoutForOrphans)
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto layout : m_activeLayouts) {
|
||||
for (const auto layout : m_centralLayouts) {
|
||||
QString tempLayoutName;
|
||||
|
||||
if (!layoutsToLoad.contains(layout->name()) && layout->name() != layoutForOrphans) {
|
||||
@ -952,14 +952,14 @@ void LayoutManager::syncMultipleLayoutsToActivities(QString layoutForOrphans)
|
||||
//! Unload no needed Layouts
|
||||
for (const auto &layoutName : layoutsToUnload) {
|
||||
if (layoutName != Layout::AbstractLayout::MultipleLayoutsName) {
|
||||
ActiveLayout *layout = activeLayout(layoutName);
|
||||
int posLayout = activeLayoutPos(layoutName);
|
||||
CentralLayout *layout = centralLayout(layoutName);
|
||||
int posLayout = centralLayoutPos(layoutName);
|
||||
|
||||
if (posLayout >= 0) {
|
||||
qDebug() << "REMOVING LAYOUT ::::: " << layoutName;
|
||||
m_activeLayouts.removeAt(posLayout);
|
||||
m_centralLayouts.removeAt(posLayout);
|
||||
|
||||
if (layout->isOriginalLayout()) {
|
||||
if (!layout->isPseudoLayout()) {
|
||||
layout->syncToLayoutFile(true);
|
||||
}
|
||||
|
||||
@ -973,8 +973,8 @@ void LayoutManager::syncMultipleLayoutsToActivities(QString layoutForOrphans)
|
||||
|
||||
//! Add Layout for orphan activities
|
||||
if (!allRunningActivitiesWillBeReserved) {
|
||||
if (!activeLayout(layoutForOrphans)) {
|
||||
ActiveLayout *newLayout = new ActiveLayout(this, layoutPath(layoutForOrphans), layoutForOrphans);
|
||||
if (!centralLayout(layoutForOrphans)) {
|
||||
CentralLayout *newLayout = new CentralLayout(this, layoutPath(layoutForOrphans), layoutForOrphans);
|
||||
|
||||
if (newLayout) {
|
||||
qDebug() << "ACTIVATING ORPHANED LAYOUT ::::: " << layoutForOrphans;
|
||||
@ -986,15 +986,15 @@ void LayoutManager::syncMultipleLayoutsToActivities(QString layoutForOrphans)
|
||||
|
||||
//! Add needed Layouts based on Activities
|
||||
for (const auto &layoutName : layoutsToLoad) {
|
||||
if (!activeLayout(layoutName)) {
|
||||
ActiveLayout *newLayout = new ActiveLayout(this, QString(layoutPath(layoutName)), layoutName);
|
||||
if (!centralLayout(layoutName)) {
|
||||
CentralLayout *newLayout = new CentralLayout(this, QString(layoutPath(layoutName)), layoutName);
|
||||
|
||||
if (newLayout) {
|
||||
qDebug() << "ACTIVATING LAYOUT ::::: " << layoutName;
|
||||
addLayout(newLayout);
|
||||
newLayout->importToCorona();
|
||||
|
||||
if (newLayout->isOriginalLayout() && m_corona->universalSettings()->showInfoWindow()) {
|
||||
if (!newLayout->isPseudoLayout() && m_corona->universalSettings()->showInfoWindow()) {
|
||||
showInfoWindow(i18n("Activating layout: <b>%0</b> ...").arg(newLayout->name()), 5000, newLayout->appliedActivities());
|
||||
}
|
||||
}
|
||||
@ -1002,13 +1002,13 @@ void LayoutManager::syncMultipleLayoutsToActivities(QString layoutForOrphans)
|
||||
}
|
||||
|
||||
updateCurrentLayoutNameInMultiEnvironment();
|
||||
emit activeLayoutsChanged();
|
||||
emit centralLayoutsChanged();
|
||||
}
|
||||
|
||||
void LayoutManager::pauseLayout(QString layoutName)
|
||||
{
|
||||
if (memoryUsage() == Types::MultipleLayouts) {
|
||||
ActiveLayout *layout = activeLayout(layoutName);
|
||||
CentralLayout *layout = centralLayout(layoutName);
|
||||
|
||||
if (layout && !layout->activities().isEmpty()) {
|
||||
int i = 0;
|
||||
@ -1029,11 +1029,15 @@ void LayoutManager::pauseLayout(QString layoutName)
|
||||
void LayoutManager::syncActiveLayoutsToOriginalFiles()
|
||||
{
|
||||
if (memoryUsage() == Types::MultipleLayouts) {
|
||||
for (const auto layout : m_activeLayouts) {
|
||||
if (layout->isOriginalLayout()) {
|
||||
for (const auto layout : m_centralLayouts) {
|
||||
if (!layout->isPseudoLayout()) {
|
||||
layout->syncToLayoutFile();
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto layout : m_sharedLayouts) {
|
||||
layout->syncToLayoutFile();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1061,7 +1065,7 @@ void LayoutManager::syncLatteViewsToScreens()
|
||||
layout->syncLatteViewsToScreens();
|
||||
}
|
||||
|
||||
for (const auto layout : m_activeLayouts) {
|
||||
for (const auto layout : m_centralLayouts) {
|
||||
layout->syncLatteViewsToScreens();
|
||||
}
|
||||
}
|
||||
@ -1124,7 +1128,7 @@ void LayoutManager::importPreset(int presetNo, bool newInstanceIfPresent)
|
||||
|
||||
QByteArray presetNameOrig = QString("preset" + QString::number(presetNo)).toUtf8();
|
||||
QString presetPath = m_corona->kPackage().filePath(presetNameOrig);
|
||||
QString presetName = ActiveLayout::layoutName(presetPath);
|
||||
QString presetName = Layout::AbstractLayout::layoutName(presetPath);
|
||||
QByteArray presetNameChars = presetName.toUtf8();
|
||||
presetName = i18n(presetNameChars);
|
||||
|
||||
|
@ -45,7 +45,7 @@ class Controller;
|
||||
namespace Latte {
|
||||
class Corona;
|
||||
class Importer;
|
||||
class ActiveLayout;
|
||||
class CentralLayout;
|
||||
class LaunchersSignals;
|
||||
class SharedLayout;
|
||||
class View;
|
||||
@ -100,17 +100,17 @@ public:
|
||||
Types::LayoutsMemoryUsage memoryUsage() const;
|
||||
void setMemoryUsage(Types::LayoutsMemoryUsage memoryUsage);
|
||||
|
||||
//! returns an active layout with that #id (name), it returns null if such
|
||||
//! returns an central layout with that #id (name), it returns null if such
|
||||
//! layout cant be found
|
||||
ActiveLayout *activeLayout(QString id) const;
|
||||
int activeLayoutPos(QString id) const;
|
||||
CentralLayout *centralLayout(QString id) const;
|
||||
int centralLayoutPos(QString id) const;
|
||||
SharedLayout *sharedLayout(QString id) const;
|
||||
//! return an active or shared layout with #id (name), it returns null if such
|
||||
//! return an central or shared layout with #id (name), it returns null if such
|
||||
//! loaded layout was not found
|
||||
Layout::GenericLayout *layout(QString id) const;
|
||||
|
||||
//! returns the current and active layout based on activities and user preferences
|
||||
ActiveLayout *currentLayout() const;
|
||||
//! returns the current and central layout based on activities and user preferences
|
||||
CentralLayout *currentLayout() const;
|
||||
LaunchersSignals *launchersSignals();
|
||||
|
||||
QStringList activities();
|
||||
@ -120,7 +120,7 @@ public:
|
||||
void importDefaultLayout(bool newInstanceIfPresent = false);
|
||||
void importPresets(bool includeDefault = false);
|
||||
|
||||
bool assignActiveToSharedLayout(ActiveLayout *active, QString id);
|
||||
bool registerAtSharedLayout(CentralLayout *central, QString id);
|
||||
|
||||
public slots:
|
||||
void showAboutDialog();
|
||||
@ -136,11 +136,11 @@ public slots:
|
||||
//! creates a new layout with layoutName based on the preset
|
||||
Q_INVOKABLE QString newLayout(QString layoutName, QString preset = i18n("Default"));
|
||||
|
||||
Q_INVOKABLE QStringList activeLayoutsNames();
|
||||
Q_INVOKABLE QStringList centralLayoutsNames();
|
||||
Q_INVOKABLE QStringList sharedLayoutsNames();
|
||||
|
||||
signals:
|
||||
void activeLayoutsChanged();
|
||||
void centralLayoutsChanged();
|
||||
void currentLayoutChanged();
|
||||
void currentLayoutNameChanged();
|
||||
void launchersSignalsChanged();
|
||||
@ -156,7 +156,7 @@ private slots:
|
||||
void unloadSharedLayout(SharedLayout *layout);
|
||||
|
||||
private:
|
||||
void addLayout(ActiveLayout *layout);
|
||||
void addLayout(CentralLayout *layout);
|
||||
void cleanupOnStartup(QString path); //!remove deprecated or oldstyle config options
|
||||
void clearSharedLayoutsFromAssigned();
|
||||
void clearUnloadedContainmentsFromLinkedFile(QStringList containmentsIds, bool bypassChecks = false);
|
||||
@ -198,7 +198,7 @@ private:
|
||||
Importer *m_importer{nullptr};
|
||||
LaunchersSignals *m_launchersSignals{nullptr};
|
||||
|
||||
QList<ActiveLayout *> m_activeLayouts;
|
||||
QList<CentralLayout *> m_centralLayouts;
|
||||
QList<SharedLayout *> m_sharedLayouts;
|
||||
|
||||
KActivities::Controller *m_activitiesController;
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "universalsettings.h"
|
||||
#include "ui_settingsdialog.h"
|
||||
#include "../lattecorona.h"
|
||||
#include "../layout/activelayout.h"
|
||||
#include "../layout/centrallayout.h"
|
||||
#include "../liblatte2/types.h"
|
||||
#include "../plasma/extended/theme.h"
|
||||
#include "delegates/checkboxdelegate.h"
|
||||
@ -97,7 +97,7 @@ SettingsDialog::SettingsDialog(QWidget *parent, Latte::Corona *corona)
|
||||
ui->layoutsView->verticalHeader()->setVisible(false);
|
||||
|
||||
connect(m_corona->layoutManager(), &LayoutManager::currentLayoutNameChanged, this, &SettingsDialog::layoutsChanged);
|
||||
connect(m_corona->layoutManager(), &LayoutManager::activeLayoutsChanged, this, &SettingsDialog::layoutsChanged);
|
||||
connect(m_corona->layoutManager(), &LayoutManager::centralLayoutsChanged, this, &SettingsDialog::layoutsChanged);
|
||||
|
||||
QString iconsPath(m_corona->kPackage().path() + "../../plasmoids/org.kde.latte.containment/contents/icons/");
|
||||
|
||||
@ -298,7 +298,7 @@ void SettingsDialog::on_newButton_clicked()
|
||||
|
||||
//! find Default preset path
|
||||
for (const auto &preset : m_corona->layoutManager()->presetsPaths()) {
|
||||
QString presetName = ActiveLayout::layoutName(preset);
|
||||
QString presetName = CentralLayout::layoutName(preset);
|
||||
|
||||
if (presetName == "Default") {
|
||||
QByteArray presetNameChars = presetName.toUtf8();
|
||||
@ -326,9 +326,9 @@ void SettingsDialog::on_copyButton_clicked()
|
||||
QString lName = (m_model->data(m_model->index(row, NAMECOLUMN), Qt::DisplayRole)).toString();
|
||||
|
||||
if (Importer::layoutExists(lName)) {
|
||||
ActiveLayout *layout = m_corona->layoutManager()->activeLayout(lName);
|
||||
CentralLayout *layout = m_corona->layoutManager()->centralLayout(lName);
|
||||
|
||||
if (layout && layout->isOriginalLayout()) {
|
||||
if (layout && !layout->isPseudoLayout()) {
|
||||
layout->syncToLayoutFile();
|
||||
}
|
||||
}
|
||||
@ -352,7 +352,7 @@ void SettingsDialog::on_copyButton_clicked()
|
||||
QFile(copiedId).setPermissions(QFileDevice::ReadUser | QFileDevice::WriteUser | QFileDevice::ReadGroup | QFileDevice::ReadOther);
|
||||
}
|
||||
|
||||
ActiveLayout *settings = new ActiveLayout(this, copiedId);
|
||||
CentralLayout *settings = new CentralLayout(this, copiedId);
|
||||
m_layouts[copiedId] = settings;
|
||||
|
||||
insertLayoutInfoAtRow(row + 1, copiedId, color, textColor, layoutName, menu, disabledBorders, QStringList(), false);
|
||||
@ -403,7 +403,7 @@ void SettingsDialog::on_removeButton_clicked()
|
||||
|
||||
QString layoutName = m_model->data(m_model->index(row, NAMECOLUMN), Qt::DisplayRole).toString();
|
||||
|
||||
if (m_corona->layoutManager()->activeLayout(layoutName)) {
|
||||
if (m_corona->layoutManager()->centralLayout(layoutName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -621,7 +621,7 @@ void SettingsDialog::on_exportButton_clicked()
|
||||
QFile(file).setPermissions(QFileDevice::ReadUser | QFileDevice::WriteUser | QFileDevice::ReadGroup | QFileDevice::ReadOther);
|
||||
}
|
||||
|
||||
ActiveLayout layoutS(this, file);
|
||||
CentralLayout layoutS(this, file);
|
||||
layoutS.setActivities(QStringList());
|
||||
layoutS.clearLastUsedActivity();
|
||||
|
||||
@ -740,7 +740,7 @@ void SettingsDialog::restoreDefaults()
|
||||
if (ui->tabWidget->currentIndex() == 0) {
|
||||
//! Default layouts missing from layouts list
|
||||
for (const auto &preset : m_corona->layoutManager()->presetsPaths()) {
|
||||
QString presetName = ActiveLayout::layoutName(preset);
|
||||
QString presetName = CentralLayout::layoutName(preset);
|
||||
QByteArray presetNameChars = presetName.toUtf8();
|
||||
const char *prset_str = presetNameChars.data();
|
||||
presetName = i18n(prset_str);
|
||||
@ -765,7 +765,7 @@ void SettingsDialog::restoreDefaults()
|
||||
void SettingsDialog::addLayoutForFile(QString file, QString layoutName, bool newTempDirectory, bool showNotification)
|
||||
{
|
||||
if (layoutName.isEmpty()) {
|
||||
layoutName = ActiveLayout::layoutName(file);
|
||||
layoutName = CentralLayout::layoutName(file);
|
||||
}
|
||||
|
||||
QString copiedId;
|
||||
@ -785,11 +785,11 @@ void SettingsDialog::addLayoutForFile(QString file, QString layoutName, bool new
|
||||
}
|
||||
|
||||
if (m_layouts.contains(copiedId)) {
|
||||
ActiveLayout *oldSettings = m_layouts.take(copiedId);
|
||||
CentralLayout *oldSettings = m_layouts.take(copiedId);
|
||||
delete oldSettings;
|
||||
}
|
||||
|
||||
ActiveLayout *settings = new ActiveLayout(this, copiedId);
|
||||
CentralLayout *settings = new CentralLayout(this, copiedId);
|
||||
m_layouts[copiedId] = settings;
|
||||
|
||||
QString id = copiedId;
|
||||
@ -836,7 +836,7 @@ void SettingsDialog::loadSettings()
|
||||
QString layoutPath = QDir::homePath() + "/.config/latte/" + layout + ".layout.latte";
|
||||
m_initLayoutPaths.append(layoutPath);
|
||||
|
||||
ActiveLayout *layoutSets = new ActiveLayout(this, layoutPath);
|
||||
CentralLayout *layoutSets = new CentralLayout(this, layoutPath);
|
||||
m_layouts[layoutPath] = layoutSets;
|
||||
|
||||
QString background = layoutSets->background();
|
||||
@ -859,9 +859,9 @@ void SettingsDialog::loadSettings()
|
||||
ui->layoutsView->selectRow(i - 1);
|
||||
}
|
||||
|
||||
ActiveLayout *activeLayout = m_corona->layoutManager()->activeLayout(layoutSets->name());
|
||||
CentralLayout *centralLayout = m_corona->layoutManager()->centralLayout(layoutSets->name());
|
||||
|
||||
if ((activeLayout && activeLayout->layoutIsBroken()) || (!activeLayout && layoutSets->layoutIsBroken())) {
|
||||
if ((centralLayout && centralLayout->layoutIsBroken()) || (!centralLayout && layoutSets->layoutIsBroken())) {
|
||||
brokenLayouts.append(layoutSets->name());
|
||||
}
|
||||
}
|
||||
@ -1047,7 +1047,7 @@ void SettingsDialog::insertLayoutInfoAtRow(int row, QString path, QString color,
|
||||
|
||||
QFont font;
|
||||
|
||||
if (m_corona->layoutManager()->activeLayout(name)) {
|
||||
if (m_corona->layoutManager()->centralLayout(name)) {
|
||||
font.setBold(true);
|
||||
} else {
|
||||
font.setBold(false);
|
||||
@ -1105,7 +1105,7 @@ void SettingsDialog::on_pauseButton_clicked()
|
||||
ui->pauseButton->setEnabled(false);
|
||||
|
||||
QString id = m_model->data(m_model->index(ui->layoutsView->currentIndex().row(), IDCOLUMN), Qt::DisplayRole).toString();
|
||||
ActiveLayout *layout = m_layouts[id];
|
||||
CentralLayout *layout = m_layouts[id];
|
||||
|
||||
if (layout) {
|
||||
m_corona->layoutManager()->pauseLayout(layout->name());
|
||||
@ -1126,7 +1126,7 @@ void SettingsDialog::layoutsChanged()
|
||||
font.setBold(true);
|
||||
// ui->layoutsView->selectRow(i);
|
||||
} else {
|
||||
ActiveLayout *layout = m_corona->layoutManager()->activeLayout(name);
|
||||
CentralLayout *layout = m_corona->layoutManager()->centralLayout(name);
|
||||
|
||||
if (layout && (m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts)) {
|
||||
font.setBold(true);
|
||||
@ -1191,7 +1191,7 @@ void SettingsDialog::updateApplyButtonsState()
|
||||
bool layoutMissing{false};
|
||||
|
||||
for (const auto &preset : m_corona->layoutManager()->presetsPaths()) {
|
||||
QString presetName = ActiveLayout::layoutName(preset);
|
||||
QString presetName = CentralLayout::layoutName(preset);
|
||||
QByteArray presetNameChars = presetName.toUtf8();
|
||||
const char *prset_str = presetNameChars.data();
|
||||
presetName = i18n(prset_str);
|
||||
@ -1249,9 +1249,9 @@ void SettingsDialog::updatePerLayoutButtonsState()
|
||||
|
||||
QStringList lActivities = m_model->data(m_model->index(currentRow, ACTIVITYCOLUMN), Qt::UserRole).toStringList();
|
||||
|
||||
Latte::ActiveLayout *layout = m_layouts[id];
|
||||
Latte::CentralLayout *layout = m_layouts[id];
|
||||
|
||||
if (!lActivities.isEmpty() && layout && m_corona->layoutManager()->activeLayout(layout->name())) {
|
||||
if (!lActivities.isEmpty() && layout && m_corona->layoutManager()->centralLayout(layout->name())) {
|
||||
ui->pauseButton->setEnabled(true);
|
||||
} else {
|
||||
ui->pauseButton->setEnabled(false);
|
||||
@ -1261,7 +1261,7 @@ void SettingsDialog::updatePerLayoutButtonsState()
|
||||
//! Remove Layout Button
|
||||
if (originalName != nameInModel
|
||||
|| (originalName == m_corona->layoutManager()->currentLayoutName())
|
||||
|| (m_corona->layoutManager()->activeLayout(originalName))
|
||||
|| (m_corona->layoutManager()->centralLayout(originalName))
|
||||
|| lockedInModel) {
|
||||
ui->removeButton->setEnabled(false);
|
||||
} else {
|
||||
@ -1365,7 +1365,7 @@ bool SettingsDialog::saveAllChanges()
|
||||
|
||||
QString switchToLayout;
|
||||
|
||||
QHash<QString, ActiveLayout *> activeLayoutsToRename;
|
||||
QHash<QString, CentralLayout *> centralLayoutsToRename;
|
||||
|
||||
//! remove layouts that have been removed from the user
|
||||
for (const auto &initLayout : m_initLayoutPaths) {
|
||||
@ -1373,7 +1373,7 @@ bool SettingsDialog::saveAllChanges()
|
||||
QFile(initLayout).remove();
|
||||
|
||||
if (m_layouts.contains(initLayout)) {
|
||||
ActiveLayout *removedLayout = m_layouts.take(initLayout);
|
||||
CentralLayout *removedLayout = m_layouts.take(initLayout);
|
||||
delete removedLayout;
|
||||
}
|
||||
}
|
||||
@ -1399,9 +1399,9 @@ bool SettingsDialog::saveAllChanges()
|
||||
}
|
||||
|
||||
//qDebug() << i << ". " << id << " - " << color << " - " << name << " - " << menu << " - " << lActivities;
|
||||
ActiveLayout *activeLayout = m_corona->layoutManager()->activeLayout(m_layouts[id]->name());
|
||||
CentralLayout *centralLayout = m_corona->layoutManager()->centralLayout(m_layouts[id]->name());
|
||||
|
||||
ActiveLayout *layout = activeLayout ? activeLayout : m_layouts[id];
|
||||
CentralLayout *layout = centralLayout ? centralLayout : m_layouts[id];
|
||||
|
||||
//! unlock read-only layout
|
||||
if (!layout->isWritable()) {
|
||||
@ -1440,9 +1440,9 @@ bool SettingsDialog::saveAllChanges()
|
||||
//! If the layout name changed OR the layout path is a temporary one
|
||||
if (layout->name() != name || (id.startsWith("/tmp/"))) {
|
||||
//! If the layout is Active in MultipleLayouts
|
||||
if (m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts && activeLayout) {
|
||||
if (m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts && centralLayout) {
|
||||
qDebug() << " Active Layout Should Be Renamed From : " << layout->name() << " TO :: " << name;
|
||||
activeLayoutsToRename[name] = layout;
|
||||
centralLayoutsToRename[name] = layout;
|
||||
}
|
||||
|
||||
QString tempFile = layoutTempDir.path() + "/" + QString(layout->name() + ".layout.latte");
|
||||
@ -1470,7 +1470,7 @@ bool SettingsDialog::saveAllChanges()
|
||||
QString newFile = QDir::homePath() + "/.config/latte/" + toRenameNames[i] + ".layout.latte";
|
||||
QFile(toRenamePaths[i]).rename(newFile);
|
||||
|
||||
ActiveLayout *nLayout = new ActiveLayout(this, newFile);
|
||||
CentralLayout *nLayout = new CentralLayout(this, newFile);
|
||||
m_layouts[newFile] = nLayout;
|
||||
|
||||
for (int j = 0; j < m_model->rowCount(); ++j) {
|
||||
@ -1491,9 +1491,9 @@ bool SettingsDialog::saveAllChanges()
|
||||
QString orphanedLayout;
|
||||
|
||||
if (m_corona->layoutManager()->memoryUsage() == Types::MultipleLayouts) {
|
||||
for (const auto &newLayoutName : activeLayoutsToRename.keys()) {
|
||||
qDebug() << " Active Layout Is Renamed From : " << activeLayoutsToRename[newLayoutName]->name() << " TO :: " << newLayoutName;
|
||||
ActiveLayout *layout = activeLayoutsToRename[newLayoutName];
|
||||
for (const auto &newLayoutName : centralLayoutsToRename.keys()) {
|
||||
qDebug() << " Active Layout Is Renamed From : " << centralLayoutsToRename[newLayoutName]->name() << " TO :: " << newLayoutName;
|
||||
CentralLayout *layout = centralLayoutsToRename[newLayoutName];
|
||||
layout->renameLayout(newLayoutName);
|
||||
|
||||
//! that means it is an active layout for orphaned Activities
|
||||
@ -1509,8 +1509,8 @@ 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();
|
||||
|
||||
ActiveLayout *activeLayout = m_corona->layoutManager()->activeLayout(m_layouts[id]->name());
|
||||
ActiveLayout *layout = activeLayout ? activeLayout : m_layouts[id];
|
||||
CentralLayout *centralLayout = m_corona->layoutManager()->centralLayout(m_layouts[id]->name());
|
||||
CentralLayout *layout = centralLayout ? centralLayout : m_layouts[id];
|
||||
|
||||
if (layout && locked && layout->isWritable()) {
|
||||
layout->lock();
|
||||
|
@ -43,7 +43,7 @@ class Controller;
|
||||
|
||||
namespace Latte {
|
||||
class Corona;
|
||||
class ActiveLayout;
|
||||
class CentralLayout;
|
||||
}
|
||||
|
||||
namespace Latte {
|
||||
@ -127,7 +127,7 @@ private:
|
||||
QStandardItemModel *m_model{nullptr};
|
||||
Ui::SettingsDialog *ui;
|
||||
|
||||
QHash<const QString, Latte::ActiveLayout *> m_layouts;
|
||||
QHash<const QString, Latte::CentralLayout *> m_layouts;
|
||||
|
||||
QList<int> o_settings;
|
||||
QStringList o_settingsLayouts;
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "shortcutstracker.h"
|
||||
#include "../lattecorona.h"
|
||||
#include "../layoutmanager.h"
|
||||
#include "../layout/activelayout.h"
|
||||
#include "../layout/centrallayout.h"
|
||||
#include "../settings/universalsettings.h"
|
||||
#include "../view/view.h"
|
||||
|
||||
@ -223,7 +223,7 @@ void GlobalShortcuts::activateLauncherMenu()
|
||||
}
|
||||
|
||||
QList<Latte::View *> sortedViews;
|
||||
ActiveLayout *currentLayout = m_corona->layoutManager()->currentLayout();
|
||||
CentralLayout *currentLayout = m_corona->layoutManager()->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;
|
||||
ActiveLayout *currentLayout = m_corona->layoutManager()->currentLayout();
|
||||
CentralLayout *currentLayout = m_corona->layoutManager()->currentLayout();
|
||||
|
||||
if (currentLayout) {
|
||||
sortedViews = currentLayout->sortedLatteViews();
|
||||
@ -460,7 +460,7 @@ void GlobalShortcuts::updateViewItemBadge(QString identifier, QString value)
|
||||
return false;
|
||||
};
|
||||
|
||||
ActiveLayout *currentLayout = m_corona->layoutManager()->currentLayout();
|
||||
CentralLayout *currentLayout = m_corona->layoutManager()->currentLayout();
|
||||
QList<Latte::View *> views;
|
||||
|
||||
if (currentLayout) {
|
||||
@ -618,7 +618,7 @@ void GlobalShortcuts::showViews()
|
||||
};
|
||||
|
||||
QList<Latte::View *> sortedViews;
|
||||
ActiveLayout *currentLayout = m_corona->layoutManager()->currentLayout();
|
||||
CentralLayout *currentLayout = m_corona->layoutManager()->currentLayout();
|
||||
|
||||
if (currentLayout) {
|
||||
sortedViews = currentLayout->sortedLatteViews();
|
||||
@ -722,7 +722,7 @@ bool GlobalShortcuts::viewsToHideAreValid()
|
||||
void GlobalShortcuts::showSettings()
|
||||
{
|
||||
QList<Latte::View *> sortedViews;
|
||||
ActiveLayout *currentLayout = m_corona->layoutManager()->currentLayout();
|
||||
CentralLayout *currentLayout = m_corona->layoutManager()->currentLayout();
|
||||
|
||||
if (currentLayout) {
|
||||
sortedViews = currentLayout->sortedLatteViews();
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "../view.h"
|
||||
#include "../../lattecorona.h"
|
||||
#include "../../layoutmanager.h"
|
||||
#include "../../layout/activelayout.h"
|
||||
#include "../../layout/genericlayout.h"
|
||||
#include "../../settings/universalsettings.h"
|
||||
#include "../../shortcuts/globalshortcuts.h"
|
||||
#include "../../shortcuts/shortcutstracker.h"
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "settings/secondaryconfigview.h"
|
||||
#include "../lattecorona.h"
|
||||
#include "../layoutmanager.h"
|
||||
#include "../layout/activelayout.h"
|
||||
#include "../layout/genericlayout.h"
|
||||
#include "../plasma/extended/theme.h"
|
||||
#include "../screenpool.h"
|
||||
|
Loading…
Reference in New Issue
Block a user