1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-09 17:18:11 +03:00

rename internal containments to subcontainments

--applets that act as internal containments are now called
subcontainments because they are containments inside
main containments
This commit is contained in:
Michail Vourlakos 2020-08-02 01:22:25 +03:00
parent 59878a3f28
commit 8c1d0d34e5
4 changed files with 15 additions and 15 deletions

View File

@ -176,7 +176,7 @@ bool GenericLayout::isCurrent() const
return name() == m_corona->layoutsManager()->currentLayoutName(); return name() == m_corona->layoutsManager()->currentLayoutName();
} }
bool GenericLayout::isInternalContainment(Plasma::Applet *applet) const bool GenericLayout::isSubContainment(Plasma::Applet *applet) const
{ {
if (!applet) { if (!applet) {
return false; return false;
@ -217,13 +217,13 @@ QString GenericLayout::textColor() const
return AbstractLayout::textColor(); return AbstractLayout::textColor();
} }
Plasma::Containment *GenericLayout::internalContainmentOf(Plasma::Applet *applet) const Plasma::Containment *GenericLayout::subContainmentOf(Plasma::Applet *applet) const
{ {
if (!applet) { if (!applet) {
return nullptr; return nullptr;
} }
if (isInternalContainment(applet)) { if (isSubContainment(applet)) {
for (const auto containment : m_containments) { for (const auto containment : m_containments) {
Plasma::Applet *parentApplet = qobject_cast<Plasma::Applet *>(containment->parent()); Plasma::Applet *parentApplet = qobject_cast<Plasma::Applet *>(containment->parent());
if (parentApplet && parentApplet == applet) { if (parentApplet && parentApplet == applet) {

View File

@ -90,8 +90,8 @@ public:
bool isWritable() const; bool isWritable() const;
bool layoutIsBroken() const; bool layoutIsBroken() const;
bool isInternalContainment(Plasma::Applet *applet) const; bool isSubContainment(Plasma::Applet *applet) const;
Plasma::Containment *internalContainmentOf(Plasma::Applet *applet) const; Plasma::Containment *subContainmentOf(Plasma::Applet *applet) const;
virtual int viewsCount(int screen) const; virtual int viewsCount(int screen) const;
virtual int viewsCount(QScreen *screen) const; virtual int viewsCount(QScreen *screen) const;

View File

@ -418,7 +418,7 @@ bool ContainmentInterface::appletIsExpandable(const int id)
for (const auto applet : m_view->containment()->applets()) { for (const auto applet : m_view->containment()->applets()) {
if (applet && applet->id() == (uint)id) { if (applet && applet->id() == (uint)id) {
if (m_view->layout() && m_view->layout()->isInternalContainment(applet)) { if (m_view->layout() && m_view->layout()->isSubContainment(applet)) {
return true; return true;
} }
@ -549,7 +549,7 @@ void ContainmentInterface::toggleAppletExpanded(const int id)
} }
for (const auto applet : m_view->containment()->applets()) { for (const auto applet : m_view->containment()->applets()) {
if (applet->id() == (uint)id && !m_view->layout()->isInternalContainment(applet)/*block for internal containments*/) { if (applet->id() == (uint)id && !m_view->layout()->isSubContainment(applet)/*block for sub-containments*/) {
PlasmaQuick::AppletQuickItem *ai = applet->property("_plasma_graphicObject").value<PlasmaQuick::AppletQuickItem *>(); PlasmaQuick::AppletQuickItem *ai = applet->property("_plasma_graphicObject").value<PlasmaQuick::AppletQuickItem *>();
if (ai) { if (ai) {
@ -580,9 +580,9 @@ void ContainmentInterface::on_appletAdded(Plasma::Applet *applet)
return; return;
} }
if (m_view->layout() && m_view->layout()->isInternalContainment(applet)) { if (m_view->layout() && m_view->layout()->isSubContainment(applet)) {
//! internal containment case //! internal containment case
Plasma::Containment *internalC = m_view->layout()->internalContainmentOf(applet); Plasma::Containment *subContainment = m_view->layout()->subContainmentOf(applet);
PlasmaQuick::AppletQuickItem *contAi = applet->property("_plasma_graphicObject").value<PlasmaQuick::AppletQuickItem *>(); PlasmaQuick::AppletQuickItem *contAi = applet->property("_plasma_graphicObject").value<PlasmaQuick::AppletQuickItem *>();
if (contAi && !m_appletsExpandedConnections.contains(contAi)) { if (contAi && !m_appletsExpandedConnections.contains(contAi)) {
@ -594,7 +594,7 @@ void ContainmentInterface::on_appletAdded(Plasma::Applet *applet)
}); });
} }
for (const auto internalApplet : internalC->applets()) { for (const auto internalApplet : subContainment->applets()) {
PlasmaQuick::AppletQuickItem *ai = internalApplet->property("_plasma_graphicObject").value<PlasmaQuick::AppletQuickItem *>(); PlasmaQuick::AppletQuickItem *ai = internalApplet->property("_plasma_graphicObject").value<PlasmaQuick::AppletQuickItem *>();
if (ai && !m_appletsExpandedConnections.contains(ai) ){ if (ai && !m_appletsExpandedConnections.contains(ai) ){

View File

@ -129,7 +129,7 @@ QPoint ContextMenu::popUpTopLeft(Plasma::Applet *applet, const QRect popUpRect)
if ((itemLength > menuLength) if ((itemLength > menuLength)
|| (applet == m_latteView->containment()) || (applet == m_latteView->containment())
|| (m_latteView && m_latteView->layout() && m_latteView->layout()->isInternalContainment(applet)) ) { || (m_latteView && m_latteView->layout() && m_latteView->layout()->isSubContainment(applet)) ) {
return popUpRelevantToGlobalPoint(globalItemRect, popUpRect); return popUpRelevantToGlobalPoint(globalItemRect, popUpRect);
} else { } else {
return popUpRelevantToParent(globalItemRect, popUpRect); return popUpRelevantToParent(globalItemRect, popUpRect);
@ -279,13 +279,13 @@ bool ContextMenu::mousePressEvent(QMouseEvent *event)
if (ai && ai->isVisible() && appletContainsMouse) { if (ai && ai->isVisible() && appletContainsMouse) {
applet = ai->applet(); applet = ai->applet();
if (m_latteView && m_latteView->layout() && m_latteView->layout()->isInternalContainment(applet)) { if (m_latteView && m_latteView->layout() && m_latteView->layout()->isSubContainment(applet)) {
Plasma::Containment *internalC = m_latteView->layout()->internalContainmentOf(applet); Plasma::Containment *subContainment = m_latteView->layout()->subContainmentOf(applet);
if (internalC) { if (subContainment) {
Plasma::Applet *internalApplet{nullptr}; Plasma::Applet *internalApplet{nullptr};
for (const Plasma::Applet *appletCont : internalC->applets()) { for (const Plasma::Applet *appletCont : subContainment->applets()) {
PlasmaQuick::AppletQuickItem *ai2 = appletCont->property("_plasma_graphicObject").value<PlasmaQuick::AppletQuickItem *>(); PlasmaQuick::AppletQuickItem *ai2 = appletCont->property("_plasma_graphicObject").value<PlasmaQuick::AppletQuickItem *>();
if (ai2 && ai2->isVisible() && ai2->contains(ai2->mapFromItem(m_latteView->contentItem(), event->pos()))) { if (ai2 && ai2->isVisible() && ai2->contains(ai2->mapFromItem(m_latteView->contentItem(), event->pos()))) {