2019-04-05 19:59:15 +03:00
/*
2021-05-27 18:01:00 +03:00
SPDX - FileCopyrightText : 2019 Michail Vourlakos < mvourlakos @ gmail . com >
SPDX - License - Identifier : GPL - 2.0 - or - later
2019-04-05 19:59:15 +03:00
*/
# include "genericlayout.h"
2019-04-05 20:39:19 +03:00
// local
# include "abstractlayout.h"
2020-04-24 12:31:03 +03:00
# include "../apptypes.h"
2019-04-06 02:00:37 +03:00
# include "../lattecorona.h"
# include "../screenpool.h"
2019-05-09 17:57:12 +03:00
# include "../layouts/importer.h"
2019-05-09 17:12:57 +03:00
# include "../layouts/manager.h"
2020-08-18 01:23:41 +03:00
# include "../layouts/storage.h"
2019-05-11 09:23:14 +03:00
# include "../layouts/synchronizer.h"
2019-04-06 02:00:37 +03:00
# include "../shortcuts/shortcutstracker.h"
2021-06-28 17:07:53 +03:00
# include "../templates/templatesmanager.h"
2021-12-11 18:39:44 +03:00
# include "../view/clonedview.h"
# include "../view/originalview.h"
2019-04-06 02:00:37 +03:00
# include "../view/positioner.h"
2021-12-11 18:39:44 +03:00
# include "../view/view.h"
2019-04-06 02:00:37 +03:00
// Qt
# include <QDebug>
# include <QScreen>
// Plasma
# include <Plasma>
# include <Plasma/Applet>
# include <Plasma/Containment>
// KDE
2021-04-22 00:38:44 +03:00
# include <KActionCollection>
2019-04-06 02:00:37 +03:00
# include <KConfigGroup>
2019-04-05 20:39:19 +03:00
2019-04-05 19:59:15 +03:00
namespace Latte {
namespace Layout {
2019-04-05 20:39:19 +03:00
GenericLayout : : GenericLayout ( QObject * parent , QString layoutFile , QString assignedName )
2020-08-18 03:13:05 +03:00
: AbstractLayout ( parent , layoutFile , assignedName )
2019-04-05 19:59:15 +03:00
{
}
GenericLayout : : ~ GenericLayout ( )
{
}
2019-05-02 12:58:56 +03:00
Type GenericLayout : : type ( ) const
{
return Type : : Generic ;
}
2019-04-06 02:00:37 +03:00
void GenericLayout : : unloadContainments ( )
{
if ( ! m_corona ) {
return ;
}
2019-11-13 17:21:00 +03:00
qDebug ( ) < < " Layout - " + name ( ) + " : [unloadContainments] "
< < " containments ::: " < < m_containments . size ( )
2019-04-06 02:00:37 +03:00
< < " ,latteViews in memory ::: " < < m_latteViews . size ( )
< < " ,hidden latteViews in memory ::: " < < m_waitingLatteViews . size ( ) ;
2019-12-27 20:14:31 +03:00
for ( const auto view : m_latteViews ) {
view - > disconnectSensitiveSignals ( ) ;
}
for ( const auto view : m_waitingLatteViews ) {
view - > disconnectSensitiveSignals ( ) ;
}
2019-04-06 02:00:37 +03:00
m_unloadedContainmentsIds . clear ( ) ;
2020-08-19 16:26:08 +03:00
QList < Plasma : : Containment * > subcontainments ;
2019-04-06 02:00:37 +03:00
2020-08-19 16:26:08 +03:00
//!identify subcontainments and unload them first
2019-04-06 02:00:37 +03:00
for ( const auto containment : m_containments ) {
if ( Plasma : : Applet * parentApplet = qobject_cast < Plasma : : Applet * > ( containment - > parent ( ) ) ) {
2020-08-19 16:26:08 +03:00
subcontainments . append ( containment ) ;
2019-04-06 02:00:37 +03:00
}
}
2020-08-19 16:26:08 +03:00
while ( ! subcontainments . isEmpty ( ) ) {
Plasma : : Containment * sub = subcontainments . at ( 0 ) ;
m_unloadedContainmentsIds < < QString : : number ( sub - > id ( ) ) ;
subcontainments . removeFirst ( ) ;
m_containments . removeAll ( sub ) ;
delete sub ;
2019-04-06 02:00:37 +03:00
}
while ( ! m_containments . isEmpty ( ) ) {
Plasma : : Containment * containment = m_containments . at ( 0 ) ;
m_unloadedContainmentsIds < < QString : : number ( containment - > id ( ) ) ;
m_containments . removeFirst ( ) ;
delete containment ;
}
}
void GenericLayout : : unloadLatteViews ( )
{
if ( ! m_corona ) {
return ;
}
2019-11-13 17:21:00 +03:00
qDebug ( ) < < " Layout - " + name ( ) + " : [unloadLatteViews] "
< < " containments ::: " < < m_containments . size ( )
< < " ,latteViews in memory ::: " < < m_latteViews . size ( )
< < " ,hidden latteViews in memory ::: " < < m_waitingLatteViews . size ( ) ;
//!disconnect signals in order to avoid crashes when the layout is unloading
disconnect ( this , & GenericLayout : : viewsCountChanged , m_corona , & Plasma : : Corona : : availableScreenRectChanged ) ;
disconnect ( this , & GenericLayout : : viewsCountChanged , m_corona , & Plasma : : Corona : : availableScreenRegionChanged ) ;
2020-08-30 20:32:13 +03:00
disconnect ( this , & GenericLayout : : activitiesChanged , this , & GenericLayout : : updateLastUsedActivity ) ;
2020-03-18 18:39:19 +03:00
disconnect ( m_corona - > activitiesConsumer ( ) , & KActivities : : Consumer : : currentActivityChanged , this , & GenericLayout : : updateLastUsedActivity ) ;
2019-11-13 17:21:00 +03:00
for ( const auto view : m_latteViews ) {
view - > disconnectSensitiveSignals ( ) ;
}
for ( const auto view : m_waitingLatteViews ) {
view - > disconnectSensitiveSignals ( ) ;
}
2019-04-06 02:00:37 +03:00
qDeleteAll ( m_latteViews ) ;
qDeleteAll ( m_waitingLatteViews ) ;
m_latteViews . clear ( ) ;
m_waitingLatteViews . clear ( ) ;
}
bool GenericLayout : : blockAutomaticLatteViewCreation ( ) const
{
return m_blockAutomaticLatteViewCreation ;
}
void GenericLayout : : setBlockAutomaticLatteViewCreation ( bool block )
{
if ( m_blockAutomaticLatteViewCreation = = block ) {
return ;
}
m_blockAutomaticLatteViewCreation = block ;
}
2019-05-04 03:01:16 +03:00
bool GenericLayout : : isActive ( ) const
{
2021-12-11 18:39:44 +03:00
return m_corona & & m_hasInitializedContainments & & ( m_corona - > layoutsManager ( ) - > synchronizer ( ) - > layout ( m_layoutName ) ! = nullptr ) ;
2019-05-04 03:01:16 +03:00
}
2020-08-26 00:15:06 +03:00
bool GenericLayout : : isCurrent ( )
2019-04-07 20:15:58 +03:00
{
2019-04-08 18:57:32 +03:00
if ( ! m_corona ) {
return false ;
}
2020-08-27 17:10:13 +03:00
return m_corona - > layoutsManager ( ) - > currentLayoutsNames ( ) . contains ( name ( ) ) ;
2019-04-07 20:15:58 +03:00
}
2021-12-11 18:39:44 +03:00
bool GenericLayout : : hasCorona ( ) const
{
return ( m_corona ! = nullptr ) ;
}
void GenericLayout : : setCorona ( Latte : : Corona * corona )
{
m_corona = corona ;
}
2020-07-30 18:09:49 +03:00
QString GenericLayout : : background ( ) const
{
QString colorsPath = m_corona - > kPackage ( ) . path ( ) + " ../../shells/org.kde.latte.shell/contents/images/canvas/ " ;
if ( backgroundStyle ( ) = = Layout : : PatternBackgroundStyle ) {
if ( customBackground ( ) . isEmpty ( ) ) {
return colorsPath + " defaultcustomprint.jpg " ;
} else {
return AbstractLayout : : customBackground ( ) ;
}
}
return colorsPath + AbstractLayout : : color ( ) + " print.jpg " ;
}
QString GenericLayout : : textColor ( ) const
{
2021-03-24 14:18:07 +03:00
if ( backgroundStyle ( ) = = Layout : : PatternBackgroundStyle & & customBackground ( ) . isEmpty ( ) & & customTextColor ( ) . isEmpty ( ) ) {
2020-07-30 18:09:49 +03:00
return AbstractLayout : : defaultCustomTextColor ( ) ;
}
return AbstractLayout : : textColor ( ) ;
}
2019-04-06 02:00:37 +03:00
int GenericLayout : : viewsCount ( int screen ) const
{
if ( ! m_corona ) {
return 0 ;
}
QScreen * scr = m_corona - > screenPool ( ) - > screenForId ( screen ) ;
int views { 0 } ;
for ( const auto view : m_latteViews ) {
if ( view & & view - > screen ( ) = = scr & & ! view - > containment ( ) - > destroyed ( ) ) {
+ + views ;
}
}
return views ;
}
int GenericLayout : : viewsCount ( QScreen * screen ) const
{
if ( ! m_corona ) {
return 0 ;
}
int views { 0 } ;
for ( const auto view : m_latteViews ) {
if ( view & & view - > screen ( ) = = screen & & ! view - > containment ( ) - > destroyed ( ) ) {
+ + views ;
}
}
return views ;
}
int GenericLayout : : viewsCount ( ) const
{
if ( ! m_corona ) {
return 0 ;
}
int views { 0 } ;
for ( const auto view : m_latteViews ) {
if ( view & & view - > containment ( ) & & ! view - > containment ( ) - > destroyed ( ) ) {
+ + views ;
}
}
return views ;
}
QList < int > GenericLayout : : qmlFreeEdges ( int screen ) const
{
if ( ! m_corona ) {
const QList < int > emptyEdges ;
return emptyEdges ;
}
const auto edges = freeEdges ( screen ) ;
QList < int > edgesInt ;
for ( const Plasma : : Types : : Location & edge : edges ) {
edgesInt . append ( static_cast < int > ( edge ) ) ;
}
return edgesInt ;
}
QList < Plasma : : Types : : Location > GenericLayout : : freeEdges ( QScreen * scr ) const
{
using Plasma : : Types ;
QList < Types : : Location > edges { Types : : BottomEdge , Types : : LeftEdge ,
2019-04-07 19:35:55 +03:00
Types : : TopEdge , Types : : RightEdge } ;
2019-04-06 02:00:37 +03:00
if ( ! m_corona ) {
return edges ;
}
for ( const auto view : m_latteViews ) {
if ( view & & view - > positioner ( ) - > currentScreenName ( ) = = scr - > name ( ) ) {
edges . removeOne ( view - > location ( ) ) ;
}
}
return edges ;
}
QList < Plasma : : Types : : Location > GenericLayout : : freeEdges ( int screen ) const
{
using Plasma : : Types ;
QList < Types : : Location > edges { Types : : BottomEdge , Types : : LeftEdge ,
2019-04-07 19:35:55 +03:00
Types : : TopEdge , Types : : RightEdge } ;
2019-04-06 02:00:37 +03:00
if ( ! m_corona ) {
return edges ;
}
QScreen * scr = m_corona - > screenPool ( ) - > screenForId ( screen ) ;
for ( const auto view : m_latteViews ) {
if ( view & & scr & & view - > positioner ( ) - > currentScreenName ( ) = = scr - > name ( ) ) {
edges . removeOne ( view - > location ( ) ) ;
}
}
return edges ;
}
int GenericLayout : : viewsWithTasks ( ) const
{
if ( ! m_corona ) {
return 0 ;
}
int result = 0 ;
for ( const auto view : m_latteViews ) {
2020-05-18 20:02:30 +03:00
if ( view - > extendedInterface ( ) - > hasLatteTasks ( ) | | view - > extendedInterface ( ) - > hasPlasmaTasks ( ) ) {
2019-04-06 02:00:37 +03:00
result + + ;
}
}
return result ;
}
QStringList GenericLayout : : unloadedContainmentsIds ( )
{
return m_unloadedContainmentsIds ;
}
2020-08-18 01:44:10 +03:00
Latte : : Corona * GenericLayout : : corona ( ) const
2019-04-06 18:56:24 +03:00
{
return m_corona ;
}
2020-03-14 15:41:07 +03:00
Types : : ViewType GenericLayout : : latteViewType ( uint containmentId ) const
2019-04-06 02:00:37 +03:00
{
for ( const auto view : m_latteViews ) {
if ( view - > containment ( ) & & view - > containment ( ) - > id ( ) = = containmentId ) {
return view - > type ( ) ;
}
}
return Types : : DockView ;
}
Latte : : View * GenericLayout : : highestPriorityView ( )
{
QList < Latte : : View * > views = sortedLatteViews ( ) ;
2019-04-07 19:35:55 +03:00
return ( views . count ( ) > 0 ? views [ 0 ] : nullptr ) ;
2019-04-06 02:00:37 +03:00
}
2019-05-25 18:05:24 +03:00
Latte : : View * GenericLayout : : lastConfigViewFor ( )
2019-05-25 17:49:02 +03:00
{
return m_lastConfigViewFor ;
}
void GenericLayout : : setLastConfigViewFor ( Latte : : View * view )
{
if ( m_lastConfigViewFor = = view ) {
return ;
}
m_lastConfigViewFor = view ;
2020-08-26 00:41:13 +03:00
if ( view ) {
emit lastConfigViewForChanged ( view ) ;
}
}
void GenericLayout : : onLastConfigViewChangedFrom ( Latte : : View * view )
{
if ( ! m_latteViews . values ( ) . contains ( view ) ) {
setLastConfigViewFor ( nullptr ) ;
}
2019-05-25 17:49:02 +03:00
}
2020-08-25 19:30:33 +03:00
Latte : : View * GenericLayout : : viewForContainment ( uint id ) const
{
for ( auto view : m_latteViews ) {
if ( view & & view - > containment ( ) - > id ( ) = = id ) {
return view ;
}
}
2021-12-11 18:39:44 +03:00
for ( auto view : m_waitingLatteViews ) {
if ( view & & view - > containment ( ) - > id ( ) = = id ) {
return view ;
}
}
2020-08-25 19:30:33 +03:00
return nullptr ;
}
2021-04-13 00:54:42 +03:00
Plasma : : Containment * GenericLayout : : containmentForId ( uint id ) const
{
for ( auto containment : m_containments ) {
if ( containment - > id ( ) = = id ) {
return containment ;
}
}
return nullptr ;
}
2021-04-13 10:56:15 +03:00
bool GenericLayout : : contains ( Plasma : : Containment * containment ) const
{
return m_containments . contains ( containment ) ;
}
int GenericLayout : : screenForContainment ( Plasma : : Containment * containment )
{
if ( ! containment ) {
return - 1 ;
}
//! there is a pending update
QString containmentid = QString : : number ( containment - > id ( ) ) ;
if ( m_pendingContainmentUpdates . containsId ( containmentid ) ) {
if ( m_corona & & m_pendingContainmentUpdates [ containmentid ] . onPrimary ) {
return m_corona - > screenPool ( ) - > primaryScreenId ( ) ;
} else {
return m_pendingContainmentUpdates [ containmentid ] . screen ;
}
}
//! there is a view present
Latte : : View * view { nullptr } ;
if ( m_latteViews . contains ( containment ) ) {
view = m_latteViews [ containment ] ;
} else if ( m_waitingLatteViews . contains ( containment ) ) {
view = m_waitingLatteViews [ containment ] ;
}
if ( view & & view - > screen ( ) ) {
return m_corona - > screenPool ( ) - > id ( view - > screen ( ) - > name ( ) ) ;
}
//! fallback scenario
return containment - > lastScreen ( ) ;
}
2021-04-15 00:58:41 +03:00
bool GenericLayout : : containsView ( const int & containmentId ) const
{
if ( ! isActive ( ) ) {
return Layouts : : Storage : : self ( ) - > containsView ( file ( ) , containmentId ) ;
}
for ( auto containment : m_containments ) {
if ( ( int ) containment - > id ( ) = = containmentId & & Layouts : : Storage : : self ( ) - > isLatteContainment ( containment ) ) {
return true ;
}
}
return false ;
}
2021-04-13 10:56:15 +03:00
2020-08-18 02:56:33 +03:00
Latte : : View * GenericLayout : : viewForContainment ( Plasma : : Containment * containment ) const
2019-04-06 02:00:37 +03:00
{
2019-06-15 21:38:07 +03:00
if ( m_containments . contains ( containment ) & & m_latteViews . contains ( containment ) ) {
2019-04-07 19:35:55 +03:00
return m_latteViews [ containment ] ;
}
return nullptr ;
}
QList < Latte : : View * > GenericLayout : : latteViews ( )
{
return m_latteViews . values ( ) ;
2019-04-06 02:00:37 +03:00
}
2021-12-11 18:39:44 +03:00
QList < Latte : : View * > GenericLayout : : onlyOriginalViews ( )
{
QList < Latte : : View * > viewslist ;
for ( const auto v : m_latteViews ) {
if ( v - > isOriginal ( ) ) {
viewslist < < v ;
}
}
return viewslist ;
}
2020-08-25 19:30:33 +03:00
QList < Latte : : View * > GenericLayout : : sortedLatteViews ( )
{
2022-05-08 13:52:55 +03:00
QScreen * primaryScreen = ( m_corona ? m_corona - > screenPool ( ) - > primaryScreen ( ) : nullptr ) ;
return sortedLatteViews ( latteViews ( ) , primaryScreen ) ;
2020-08-25 19:30:33 +03:00
}
2022-05-08 13:52:55 +03:00
QList < Latte : : View * > GenericLayout : : sortedLatteViews ( QList < Latte : : View * > views , QScreen * primaryScreen )
2019-04-06 02:00:37 +03:00
{
2020-08-25 19:30:33 +03:00
QList < Latte : : View * > sortedViews = views ;
2019-04-06 02:00:37 +03:00
qDebug ( ) < < " -------- " ;
for ( int i = 0 ; i < sortedViews . count ( ) ; + + i ) {
qDebug ( ) < < i < < " . " < < sortedViews [ i ] - > screen ( ) - > name ( ) < < " - " < < sortedViews [ i ] - > location ( ) ;
}
//! sort the views based on screens and edges priorities
//! views on primary screen have higher priority and
//! for views in the same screen the priority goes to
//! Bottom,Left,Top,Right
for ( int i = 0 ; i < sortedViews . size ( ) ; + + i ) {
for ( int j = 0 ; j < sortedViews . size ( ) - i - 1 ; + + j ) {
2022-05-08 13:52:55 +03:00
if ( viewAtLowerScreenPriority ( sortedViews [ j ] , sortedViews [ j + 1 ] , primaryScreen )
2019-04-06 02:00:37 +03:00
| | ( sortedViews [ j ] - > screen ( ) = = sortedViews [ j + 1 ] - > screen ( )
& & viewAtLowerEdgePriority ( sortedViews [ j ] , sortedViews [ j + 1 ] ) ) ) {
Latte : : View * temp = sortedViews [ j + 1 ] ;
sortedViews [ j + 1 ] = sortedViews [ j ] ;
sortedViews [ j ] = temp ;
}
}
}
Latte : : View * highestPriorityView { nullptr } ;
for ( int i = 0 ; i < sortedViews . size ( ) ; + + i ) {
if ( sortedViews [ i ] - > isPreferredForShortcuts ( ) ) {
highestPriorityView = sortedViews [ i ] ;
sortedViews . removeAt ( i ) ;
break ;
}
}
if ( highestPriorityView ) {
sortedViews . prepend ( highestPriorityView ) ;
}
qDebug ( ) < < " -------- sorted ----- " ;
for ( int i = 0 ; i < sortedViews . count ( ) ; + + i ) {
qDebug ( ) < < i < < " . " < < sortedViews [ i ] - > isPreferredForShortcuts ( ) < < " - " < < sortedViews [ i ] - > screen ( ) - > name ( ) < < " - " < < sortedViews [ i ] - > location ( ) ;
}
return sortedViews ;
}
2022-05-08 13:52:55 +03:00
bool GenericLayout : : viewAtLowerScreenPriority ( Latte : : View * test , Latte : : View * base , QScreen * primaryScreen )
2019-04-06 02:00:37 +03:00
{
if ( ! base | | ! test ) {
return true ;
}
if ( base - > screen ( ) = = test - > screen ( ) ) {
return false ;
2022-05-08 13:52:55 +03:00
} else if ( base - > screen ( ) ! = primaryScreen & & test - > screen ( ) = = primaryScreen ) {
2019-04-06 02:00:37 +03:00
return false ;
2022-05-08 13:52:55 +03:00
} else if ( base - > screen ( ) = = primaryScreen & & test - > screen ( ) ! = primaryScreen ) {
2019-04-06 02:00:37 +03:00
return true ;
} else {
int basePriority = - 1 ;
int testPriority = - 1 ;
for ( int i = 0 ; i < qGuiApp - > screens ( ) . count ( ) ; + + i ) {
if ( base - > screen ( ) = = qGuiApp - > screens ( ) [ i ] ) {
basePriority = i ;
}
if ( test - > screen ( ) = = qGuiApp - > screens ( ) [ i ] ) {
testPriority = i ;
}
}
if ( testPriority < = basePriority ) {
return true ;
} else {
return false ;
}
}
qDebug ( ) < < " viewAtLowerScreenPriority : shouldn't had reached here... " ;
return false ;
}
bool GenericLayout : : viewAtLowerEdgePriority ( Latte : : View * test , Latte : : View * base )
{
if ( ! base | | ! test ) {
return true ;
}
QList < Plasma : : Types : : Location > edges { Plasma : : Types : : RightEdge , Plasma : : Types : : TopEdge ,
Plasma : : Types : : LeftEdge , Plasma : : Types : : BottomEdge } ;
int testPriority = - 1 ;
int basePriority = - 1 ;
for ( int i = 0 ; i < edges . count ( ) ; + + i ) {
if ( edges [ i ] = = base - > location ( ) ) {
basePriority = i ;
}
if ( edges [ i ] = = test - > location ( ) ) {
testPriority = i ;
}
}
2019-07-14 18:23:52 +03:00
if ( testPriority < basePriority ) {
2019-04-06 02:00:37 +03:00
return true ;
2019-07-14 18:23:52 +03:00
} else {
2019-04-06 02:00:37 +03:00
return false ;
2019-07-14 18:23:52 +03:00
}
}
2021-03-21 15:36:25 +03:00
bool GenericLayout : : viewDataAtLowerScreenPriority ( const Latte : : Data : : View & test , const Latte : : Data : : View & base ) const
2019-07-14 18:23:52 +03:00
{
if ( test . onPrimary & & base . onPrimary ) {
return false ;
} else if ( ! base . onPrimary & & test . onPrimary ) {
return false ;
} else if ( base . onPrimary & & ! test . onPrimary ) {
return true ;
} else {
2021-03-21 15:36:25 +03:00
return test . screen < = base . screen ;
2019-07-14 18:23:52 +03:00
}
2019-04-06 02:00:37 +03:00
}
2021-03-21 15:36:25 +03:00
bool GenericLayout : : viewDataAtLowerStatePriority ( const Latte : : Data : : View & test , const Latte : : Data : : View & base ) const
2019-07-14 18:23:52 +03:00
{
2021-03-21 15:36:25 +03:00
if ( test . isActive = = base . isActive ) {
2019-07-14 18:23:52 +03:00
return false ;
2021-03-21 15:36:25 +03:00
} else if ( ! base . isActive & & test . isActive ) {
2019-07-14 18:23:52 +03:00
return false ;
2021-03-21 15:36:25 +03:00
} else if ( base . isActive & & ! test . isActive ) {
2019-07-14 18:23:52 +03:00
return true ;
}
return false ;
}
2021-03-21 15:36:25 +03:00
bool GenericLayout : : viewDataAtLowerEdgePriority ( const Latte : : Data : : View & test , const Latte : : Data : : View & base ) const
2019-07-14 18:23:52 +03:00
{
QList < Plasma : : Types : : Location > edges { Plasma : : Types : : RightEdge , Plasma : : Types : : TopEdge ,
Plasma : : Types : : LeftEdge , Plasma : : Types : : BottomEdge } ;
int testPriority = - 1 ;
int basePriority = - 1 ;
for ( int i = 0 ; i < edges . count ( ) ; + + i ) {
2021-03-21 15:36:25 +03:00
if ( edges [ i ] = = base . edge ) {
2019-07-14 18:23:52 +03:00
basePriority = i ;
}
2021-03-21 15:36:25 +03:00
if ( edges [ i ] = = test . edge ) {
2019-07-14 18:23:52 +03:00
testPriority = i ;
}
}
if ( testPriority < basePriority ) {
return true ;
} else {
return false ;
}
}
2021-03-21 15:36:25 +03:00
QList < Latte : : Data : : View > GenericLayout : : sortedViewsData ( const QList < Latte : : Data : : View > & viewsData )
2019-07-14 18:23:52 +03:00
{
2021-03-21 15:36:25 +03:00
QList < Latte : : Data : : View > sortedData = viewsData ;
2019-07-14 18:23:52 +03:00
//! sort the views based on screens and edges priorities
//! views on primary screen have higher priority and
//! for views in the same screen the priority goes to
//! Bottom,Left,Top,Right
for ( int i = 0 ; i < sortedData . size ( ) ; + + i ) {
for ( int j = 0 ; j < sortedData . size ( ) - i - 1 ; + + j ) {
if ( viewDataAtLowerStatePriority ( sortedData [ j ] , sortedData [ j + 1 ] )
| | viewDataAtLowerScreenPriority ( sortedData [ j ] , sortedData [ j + 1 ] )
| | ( ! viewDataAtLowerScreenPriority ( sortedData [ j ] , sortedData [ j + 1 ] )
& & viewDataAtLowerEdgePriority ( sortedData [ j ] , sortedData [ j + 1 ] ) ) ) {
2021-03-21 15:36:25 +03:00
Latte : : Data : : View temp = sortedData [ j + 1 ] ;
2019-07-14 18:23:52 +03:00
sortedData [ j + 1 ] = sortedData [ j ] ;
sortedData [ j ] = temp ;
}
}
}
return sortedData ;
}
2020-08-18 02:15:28 +03:00
const QList < Plasma : : Containment * > * GenericLayout : : containments ( ) const
2019-04-06 02:00:37 +03:00
{
return & m_containments ;
}
QList < Latte : : View * > GenericLayout : : viewsWithPlasmaShortcuts ( )
{
QList < Latte : : View * > views ;
if ( ! m_corona ) {
return views ;
}
2020-03-14 15:41:07 +03:00
QList < uint > appletsWithShortcuts = m_corona - > globalShortcuts ( ) - > shortcutsTracker ( ) - > appletsWithPlasmaShortcuts ( ) ;
2019-04-06 02:00:37 +03:00
for ( const auto & appletId : appletsWithShortcuts ) {
for ( const auto view : m_latteViews ) {
bool found { false } ;
for ( const auto applet : view - > containment ( ) - > applets ( ) ) {
if ( appletId = = applet - > id ( ) ) {
if ( ! views . contains ( view ) ) {
views . append ( view ) ;
found = true ;
break ;
}
}
}
if ( found ) {
break ;
}
}
}
return views ;
}
//! Containments Actions
void GenericLayout : : addContainment ( Plasma : : Containment * containment )
{
if ( ! containment | | m_containments . contains ( containment ) ) {
return ;
}
bool containmentInLayout { false } ;
2020-04-24 12:31:03 +03:00
if ( m_corona - > layoutsManager ( ) - > memoryUsage ( ) = = MemoryUsage : : SingleLayout ) {
2019-04-06 02:00:37 +03:00
m_containments . append ( containment ) ;
containmentInLayout = true ;
2020-04-24 12:31:03 +03:00
} else if ( m_corona - > layoutsManager ( ) - > memoryUsage ( ) = = MemoryUsage : : MultipleLayouts ) {
2019-04-06 02:00:37 +03:00
QString layoutId = containment - > config ( ) . readEntry ( " layoutId " , QString ( ) ) ;
if ( ! layoutId . isEmpty ( ) & & ( layoutId = = m_layoutName ) ) {
m_containments . append ( containment ) ;
containmentInLayout = true ;
}
}
if ( containmentInLayout ) {
if ( ! blockAutomaticLatteViewCreation ( ) ) {
addView ( containment ) ;
} else {
qDebug ( ) < < " delaying LatteView creation for containment :: " < < containment - > id ( ) ;
}
connect ( containment , & QObject : : destroyed , this , & GenericLayout : : containmentDestroyed ) ;
}
}
void GenericLayout : : appletCreated ( Plasma : : Applet * applet )
{
2020-08-19 16:26:08 +03:00
//! In Multiple Layout the orphaned subcontainments must be assigned to layouts
2019-04-06 02:00:37 +03:00
//! when the user adds them
2020-08-19 16:26:08 +03:00
KConfigGroup appletSettings = applet - > containment ( ) - > config ( ) . group ( " Applets " ) . group ( QString : : number ( applet - > id ( ) ) ) ;
2019-04-06 02:00:37 +03:00
2020-08-19 16:26:08 +03:00
int subId = Layouts : : Storage : : self ( ) - > subContainmentId ( appletSettings ) ;
2019-04-06 02:00:37 +03:00
2020-08-19 17:36:25 +03:00
if ( Layouts : : Storage : : isValid ( subId ) ) {
2020-08-19 16:26:08 +03:00
uint sId = ( uint ) subId ;
2019-04-06 02:00:37 +03:00
for ( const auto containment : m_corona - > containments ( ) ) {
if ( containment - > id ( ) = = sId ) {
containment - > config ( ) . writeEntry ( " layoutId " , m_layoutName ) ;
}
addContainment ( containment ) ;
}
}
}
void GenericLayout : : containmentDestroyed ( QObject * cont )
{
if ( ! m_corona ) {
return ;
}
Plasma : : Containment * containment = static_cast < Plasma : : Containment * > ( cont ) ;
if ( containment ) {
int containmentIndex = m_containments . indexOf ( containment ) ;
if ( containmentIndex > = 0 ) {
m_containments . removeAt ( containmentIndex ) ;
}
qDebug ( ) < < " Layout " < < name ( ) < < " :: containment destroyed!!!! " ;
auto view = m_latteViews . take ( containment ) ;
if ( ! view ) {
view = m_waitingLatteViews . take ( containment ) ;
}
if ( view ) {
view - > disconnectSensitiveSignals ( ) ;
2021-04-22 10:11:20 +03:00
view - > positioner ( ) - > slideOutDuringExit ( containment - > location ( ) ) ;
2019-04-06 02:00:37 +03:00
view - > deleteLater ( ) ;
2019-05-10 00:00:47 +03:00
emit viewEdgeChanged ( ) ;
2019-04-06 02:00:37 +03:00
emit viewsCountChanged ( ) ;
}
}
}
void GenericLayout : : destroyedChanged ( bool destroyed )
{
if ( ! m_corona ) {
return ;
}
qDebug ( ) < < " dock containment destroyed changed!!!! " ;
Plasma : : Containment * sender = qobject_cast < Plasma : : Containment * > ( QObject : : sender ( ) ) ;
if ( ! sender ) {
return ;
}
2021-05-04 10:13:24 +03:00
Latte : : View * view ;
2019-04-06 02:00:37 +03:00
if ( destroyed ) {
2021-05-04 10:13:24 +03:00
view = m_latteViews . take ( static_cast < Plasma : : Containment * > ( sender ) ) ;
m_waitingLatteViews [ sender ] = view ;
2019-04-06 02:00:37 +03:00
} else {
2021-05-04 10:13:24 +03:00
view = m_waitingLatteViews . take ( static_cast < Plasma : : Containment * > ( sender ) ) ;
m_latteViews [ sender ] = view ;
2019-04-06 02:00:37 +03:00
}
2021-05-04 10:13:24 +03:00
if ( view ) {
emit m_corona - > availableScreenRectChangedFrom ( view ) ;
emit m_corona - > availableScreenRegionChangedFrom ( view ) ;
emit viewEdgeChanged ( ) ;
emit viewsCountChanged ( ) ;
}
2019-04-06 02:00:37 +03:00
}
void GenericLayout : : renameLayout ( QString newName )
{
2020-04-24 12:31:03 +03:00
if ( ! m_corona | | m_corona - > layoutsManager ( ) - > memoryUsage ( ) ! = MemoryUsage : : MultipleLayouts ) {
2019-05-05 17:46:14 +03:00
return ;
}
2020-08-14 09:33:39 +03:00
if ( m_layoutFile ! = Layouts : : Importer : : layoutUserFilePath ( newName ) ) {
setFile ( Layouts : : Importer : : layoutUserFilePath ( newName ) ) ;
2019-04-06 02:00:37 +03:00
}
2019-05-05 17:46:14 +03:00
setName ( newName ) ;
2019-04-06 02:00:37 +03:00
2019-05-05 17:46:14 +03:00
for ( const auto containment : m_containments ) {
qDebug ( ) < < " Cont ID :: " < < containment - > id ( ) ;
containment - > config ( ) . writeEntry ( " layoutId " , m_layoutName ) ;
2019-04-06 02:00:37 +03:00
}
}
2021-12-11 18:39:44 +03:00
void GenericLayout : : addView ( Plasma : : Containment * containment )
2019-04-06 02:00:37 +03:00
{
2021-12-11 18:39:44 +03:00
qDebug ( ) . noquote ( ) < < " Adding View: Called for layout: " < < m_layoutName < < " with m_containments.size() :: " < < m_containments . size ( ) ;
2019-04-06 02:00:37 +03:00
if ( ! containment | | ! m_corona | | ! containment - > kPackage ( ) . isValid ( ) ) {
2021-12-11 18:39:44 +03:00
qWarning ( ) < < " Adding View: The requested containment plugin can not be located or loaded " ;
2019-04-06 02:00:37 +03:00
return ;
}
2021-12-11 18:39:44 +03:00
qDebug ( ) < < " Adding View: " < < containment - > id ( ) < < " - Step 1... " ;
2019-04-06 02:00:37 +03:00
2020-08-18 01:23:41 +03:00
if ( ! Layouts : : Storage : : self ( ) - > isLatteContainment ( containment ) ) {
2019-04-06 02:00:37 +03:00
return ;
2020-08-18 01:23:41 +03:00
}
2019-04-06 02:00:37 +03:00
2021-12-11 18:39:44 +03:00
qDebug ( ) < < " Adding View: " < < containment - > id ( ) < < " - Step 2... " ;
2019-04-06 02:00:37 +03:00
2021-12-11 18:39:44 +03:00
if ( hasLatteView ( containment ) ) {
return ;
2019-04-06 02:00:37 +03:00
}
2021-12-11 18:39:44 +03:00
qDebug ( ) < < " Adding View: " < < containment - > id ( ) < < " - Step 3... " ;
2019-04-06 02:00:37 +03:00
2022-05-08 13:52:55 +03:00
QScreen * nextScreen { m_corona - > screenPool ( ) - > primaryScreen ( ) } ;
2021-12-11 18:39:44 +03:00
Data : : View viewdata = Layouts : : Storage : : self ( ) - > view ( this , containment ) ;
viewdata . screen = Layouts : : Storage : : self ( ) - > expectedViewScreenId ( m_corona , viewdata ) ;
2019-04-06 02:00:37 +03:00
2021-12-11 18:39:44 +03:00
QString nextScreenName = m_corona - > screenPool ( ) - > hasScreenId ( viewdata . screen ) ? m_corona - > screenPool ( ) - > connector ( viewdata . screen ) : " " ;
2019-04-08 22:02:50 +03:00
2021-12-11 18:39:44 +03:00
qDebug ( ) . noquote ( ) < < " Adding View: " < < viewdata . id < < " - "
< < " IsClonedFrom: " < < viewdata . isClonedFrom
< < " , NextScreen: " < < viewdata . screen < < " - " < < nextScreenName
< < " , OnPrimary: " < < viewdata . onPrimary
< < " , Edge: " < < viewdata . edge ;
2019-05-01 18:52:03 +03:00
2021-12-11 18:39:44 +03:00
if ( ! viewdata . onPrimary & & Layouts : : Storage : : isValid ( viewdata . screen ) ) {
bool foundNextExplicitScreen { false } ;
2019-04-08 22:02:50 +03:00
2021-12-11 18:39:44 +03:00
if ( m_corona - > screenPool ( ) - > isScreenActive ( viewdata . screen ) ) {
foundNextExplicitScreen = true ;
nextScreen = m_corona - > screenPool ( ) - > screenForId ( viewdata . screen ) ;
2019-04-06 02:00:37 +03:00
}
2021-12-11 18:39:44 +03:00
if ( ! foundNextExplicitScreen ) {
qDebug ( ) . noquote ( ) < < " Adding View: " < < viewdata . id < < " - Rejected because Screen is not available :: " < < nextScreenName ;
2019-04-06 02:00:37 +03:00
return ;
}
}
//! it is used to set the correct flag during the creation
//! of the window... This of course is also used during
//! recreations of the window between different visibility modes
auto mode = static_cast < Types : : Visibility > ( containment - > config ( ) . readEntry ( " visibility " , static_cast < int > ( Types : : DodgeActive ) ) ) ;
bool byPassWM { false } ;
2019-12-27 15:20:31 +03:00
if ( mode = = Types : : AlwaysVisible
| | mode = = Types : : WindowsGoBelow
| | mode = = Types : : WindowsCanCover
| | mode = = Types : : WindowsAlwaysCover ) {
2019-04-06 02:00:37 +03:00
byPassWM = false ;
} else {
byPassWM = containment - > config ( ) . readEntry ( " byPassWM " , false ) ;
}
2021-12-11 18:39:44 +03:00
Latte : : View * latteView ;
2019-04-06 02:00:37 +03:00
2021-12-11 18:39:44 +03:00
if ( ! viewdata . isCloned ( ) ) {
latteView = new Latte : : OriginalView ( m_corona , nextScreen , byPassWM ) ;
} else {
auto view = viewForContainment ( ( uint ) viewdata . isClonedFrom ) ;
if ( ! containsView ( viewdata . isClonedFrom ) | | ! view ) {
qDebug ( ) . noquote ( ) < < " Adding View: " < < viewdata . id < < " - Clone did not find OriginalView and as such was stopped!!! " ;
return ;
}
2019-04-06 02:00:37 +03:00
2021-12-11 18:39:44 +03:00
auto originalview = qobject_cast < Latte : : OriginalView * > ( view ) ;
latteView = new Latte : : ClonedView ( m_corona , originalview , nextScreen , byPassWM ) ;
2019-04-06 02:00:37 +03:00
}
2021-12-11 18:39:44 +03:00
qDebug ( ) . noquote ( ) < < " Adding View: " < < viewdata . id < < " - Passed ALL checks !!! " ;
m_latteViews [ containment ] = latteView ;
2019-04-06 02:00:37 +03:00
2021-12-11 18:39:44 +03:00
latteView - > init ( containment ) ;
latteView - > setContainment ( containment ) ;
latteView - > setLayout ( this ) ;
2020-04-27 21:09:32 +03:00
2019-04-06 02:00:37 +03:00
//! Qt 5.9 creates a crash for this in wayland, that is why the check is used
//! but on the other hand we need this for copy to work correctly and show
//! the copied dock under X11
//if (!KWindowSystem::isPlatformWayland()) {
latteView - > show ( ) ;
//}
emit viewsCountChanged ( ) ;
}
2021-05-03 23:49:39 +03:00
void GenericLayout : : toggleHiddenState ( QString viewName , QString screenName , Plasma : : Types : : Location edge )
2020-03-01 18:19:24 +03:00
{
if ( ! m_corona ) {
return ;
}
2022-05-08 13:52:55 +03:00
QString validScreenName = m_corona - > screenPool ( ) - > primaryScreen ( ) - > name ( ) ;
2020-03-01 18:19:24 +03:00
if ( ! screenName . isEmpty ( ) ) {
validScreenName = screenName ;
}
2020-03-07 22:24:06 +03:00
int viewsOnEdge { 0 } ;
2020-03-01 18:19:24 +03:00
for ( const auto view : latteViews ( ) ) {
2021-05-03 23:49:39 +03:00
if ( ( viewName . isEmpty ( ) | | ( ! viewName . isEmpty ( ) & & viewName = = view - > name ( ) ) )
& & view - > positioner ( ) - > currentScreenName ( ) = = validScreenName
& & ( edge = = Plasma : : Types : : Floating | | ( ( edge ! = Plasma : : Types : : Floating ) & & view - > location ( ) = = edge ) ) ) {
2020-03-07 22:24:06 +03:00
viewsOnEdge + + ;
}
}
if ( viewsOnEdge > = 1 ) {
for ( const auto view : latteViews ( ) ) {
2021-05-03 23:49:39 +03:00
if ( ( viewName . isEmpty ( ) | | ( ! viewName . isEmpty ( ) & & viewName = = view - > name ( ) ) )
& & view - > positioner ( ) - > currentScreenName ( ) = = validScreenName
& & ( edge = = Plasma : : Types : : Floating | | ( ( edge ! = Plasma : : Types : : Floating ) & & view - > location ( ) = = edge ) ) ) {
view - > visibility ( ) - > toggleHiddenState ( ) ;
2020-03-07 22:24:06 +03:00
}
2020-03-01 18:19:24 +03:00
}
}
}
2019-04-06 02:00:37 +03:00
2021-12-11 18:39:44 +03:00
bool GenericLayout : : initCorona ( )
2019-04-06 02:00:37 +03:00
{
2021-12-11 18:39:44 +03:00
if ( ! m_corona ) {
2019-04-06 02:00:37 +03:00
return false ;
}
2021-12-11 18:39:44 +03:00
connect ( m_corona , & Plasma : : Corona : : containmentAdded , this , & GenericLayout : : addContainment ) ;
2019-04-06 02:00:37 +03:00
2019-05-04 03:01:16 +03:00
updateLastUsedActivity ( ) ;
2019-04-07 15:46:03 +03:00
//! signals
2020-08-30 20:32:13 +03:00
connect ( this , & GenericLayout : : activitiesChanged , this , & GenericLayout : : updateLastUsedActivity ) ;
connect ( m_corona - > activitiesConsumer ( ) , & KActivities : : Consumer : : currentActivityChanged , this , & GenericLayout : : updateLastUsedActivity ) ;
2021-01-25 23:14:16 +03:00
connect ( m_corona - > activitiesConsumer ( ) , & KActivities : : Consumer : : runningActivitiesChanged , this , & GenericLayout : : updateLastUsedActivity ) ;
2019-04-07 15:46:03 +03:00
2020-08-26 00:41:13 +03:00
connect ( this , & GenericLayout : : lastConfigViewForChanged , m_corona - > layoutsManager ( ) , & Layouts : : Manager : : lastConfigViewChangedFrom ) ;
connect ( m_corona - > layoutsManager ( ) , & Layouts : : Manager : : lastConfigViewChangedFrom , this , & GenericLayout : : onLastConfigViewChangedFrom ) ;
2019-04-06 02:00:37 +03:00
//!connect signals after adding the containment
connect ( this , & GenericLayout : : viewsCountChanged , m_corona , & Plasma : : Corona : : availableScreenRectChanged ) ;
connect ( this , & GenericLayout : : viewsCountChanged , m_corona , & Plasma : : Corona : : availableScreenRegionChanged ) ;
2021-12-11 18:39:44 +03:00
return true ;
}
bool GenericLayout : : initContainments ( )
{
if ( ! m_corona | | m_hasInitializedContainments ) {
return false ;
}
qDebug ( ) < < " Layout ::::: " < < name ( ) < < " added containments ::: " < < m_containments . size ( ) ;
for ( int pass = 1 ; pass < = 2 ; + + pass ) {
for ( const auto containment : m_corona - > containments ( ) ) {
//! in first pass we load subcontainments
//! in second pass we load main dock and panel containments
//! this way subcontainments will be always available to find when the layout is activating
//! for example during startup that clones must be created and subcontainments should be taken into account
if ( ( pass = = 1 & & Layouts : : Storage : : self ( ) - > isLatteContainment ( containment )
| | ( pass = = 2 & & ! Layouts : : Storage : : self ( ) - > isLatteContainment ( containment ) ) ) ) {
continue ;
}
2019-04-06 02:00:37 +03:00
2021-12-11 18:39:44 +03:00
if ( m_corona - > layoutsManager ( ) - > memoryUsage ( ) = = MemoryUsage : : SingleLayout ) {
addContainment ( containment ) ;
} else if ( m_corona - > layoutsManager ( ) - > memoryUsage ( ) = = MemoryUsage : : MultipleLayouts ) {
QString layoutId = containment - > config ( ) . readEntry ( " layoutId " , QString ( ) ) ;
if ( ! layoutId . isEmpty ( ) & & ( layoutId = = m_layoutName ) ) {
addContainment ( containment ) ;
}
}
}
}
m_hasInitializedContainments = true ;
emit viewsCountChanged ( ) ;
2019-04-06 02:00:37 +03:00
return true ;
}
2019-04-07 15:46:03 +03:00
void GenericLayout : : updateLastUsedActivity ( )
{
if ( ! m_corona ) {
return ;
}
QString currentId = m_corona - > activitiesConsumer ( ) - > currentActivity ( ) ;
QStringList appliedActivitiesIds = appliedActivities ( ) ;
2020-08-26 15:07:11 +03:00
if ( appliedActivitiesIds . contains ( Data : : Layout : : ALLACTIVITIESID )
| | ( m_lastUsedActivity ! = currentId & & appliedActivitiesIds . contains ( currentId ) ) ) {
2019-04-07 15:46:03 +03:00
m_lastUsedActivity = currentId ;
emit lastUsedActivityChanged ( ) ;
}
}
2019-04-06 02:00:37 +03:00
void GenericLayout : : assignToLayout ( Latte : : View * latteView , QList < Plasma : : Containment * > containments )
{
2021-04-27 00:08:16 +03:00
if ( ! m_corona | | containments . isEmpty ( ) ) {
2019-04-06 02:00:37 +03:00
return ;
}
if ( latteView ) {
m_latteViews [ latteView - > containment ( ) ] = latteView ;
2021-04-27 00:08:16 +03:00
}
2019-04-06 02:00:37 +03:00
2021-04-27 00:08:16 +03:00
m_containments < < containments ;
2019-04-06 02:00:37 +03:00
2021-04-27 00:08:16 +03:00
for ( const auto containment : containments ) {
containment - > config ( ) . writeEntry ( " layoutId " , name ( ) ) ;
if ( ! latteView | | ( latteView & & latteView - > containment ( ) ! = containment ) ) {
//! assign signals only to subcontainments
//! the View::setLayout() is responsible for the View::Containment signals
connect ( containment , & QObject : : destroyed , this , & GenericLayout : : containmentDestroyed ) ;
connect ( containment , & Plasma : : Applet : : destroyedChanged , this , & GenericLayout : : destroyedChanged ) ;
connect ( containment , & Plasma : : Containment : : appletCreated , this , & GenericLayout : : appletCreated ) ;
2019-04-06 02:00:37 +03:00
}
2021-04-27 00:08:16 +03:00
}
2019-04-06 02:00:37 +03:00
2021-04-27 00:08:16 +03:00
if ( latteView ) {
2019-05-08 23:42:06 +03:00
latteView - > setLayout ( this ) ;
2019-04-06 02:00:37 +03:00
}
2021-04-27 00:08:16 +03:00
emit viewsCountChanged ( ) ;
2019-04-06 02:00:37 +03:00
//! sync the original layout file for integrity
2021-04-27 00:08:16 +03:00
if ( m_corona - > layoutsManager ( ) - > memoryUsage ( ) = = MemoryUsage : : MultipleLayouts ) {
2020-08-18 02:23:34 +03:00
Layouts : : Storage : : self ( ) - > syncToLayoutFile ( this , false ) ;
2019-04-06 02:00:37 +03:00
}
}
2021-04-27 00:08:16 +03:00
QList < Plasma : : Containment * > GenericLayout : : unassignFromLayout ( Plasma : : Containment * latteContainment )
2019-04-06 02:00:37 +03:00
{
QList < Plasma : : Containment * > containments ;
2021-04-27 00:08:16 +03:00
if ( ! m_corona | | ! latteContainment | | ! contains ( latteContainment ) ) {
2019-04-06 02:00:37 +03:00
return containments ;
}
2021-04-27 00:08:16 +03:00
containments < < latteContainment ;
2019-04-06 02:00:37 +03:00
for ( const auto containment : m_containments ) {
Plasma : : Applet * parentApplet = qobject_cast < Plasma : : Applet * > ( containment - > parent ( ) ) ;
2020-08-19 16:26:08 +03:00
//! add subcontainments from that latteView
2021-04-27 00:08:16 +03:00
if ( parentApplet & & parentApplet - > containment ( ) & & parentApplet - > containment ( ) = = latteContainment ) {
2019-04-06 02:00:37 +03:00
containments < < containment ;
2020-08-19 16:26:08 +03:00
//! unassign signals only to subcontainments
2019-05-09 23:45:52 +03:00
//! the View::setLayout() is responsible for the View::Containment signals
2019-04-06 02:00:37 +03:00
disconnect ( containment , & QObject : : destroyed , this , & GenericLayout : : containmentDestroyed ) ;
disconnect ( containment , & Plasma : : Applet : : destroyedChanged , this , & GenericLayout : : destroyedChanged ) ;
disconnect ( containment , & Plasma : : Containment : : appletCreated , this , & GenericLayout : : appletCreated ) ;
}
}
for ( const auto containment : containments ) {
m_containments . removeAll ( containment ) ;
}
if ( containments . size ( ) > 0 ) {
2021-04-27 00:08:16 +03:00
m_latteViews . remove ( latteContainment ) ;
2019-04-06 02:00:37 +03:00
}
//! sync the original layout file for integrity
2020-04-24 12:31:03 +03:00
if ( m_corona & & m_corona - > layoutsManager ( ) - > memoryUsage ( ) = = MemoryUsage : : MultipleLayouts ) {
2020-08-18 02:23:34 +03:00
Layouts : : Storage : : self ( ) - > syncToLayoutFile ( this , false ) ;
2019-04-06 02:00:37 +03:00
}
return containments ;
}
2019-06-20 17:42:49 +03:00
void GenericLayout : : recreateView ( Plasma : : Containment * containment , bool delayed )
2019-04-06 02:00:37 +03:00
{
2019-06-20 17:42:49 +03:00
if ( ! m_corona | | m_viewsToRecreate . contains ( containment ) | | ! containment | | ! m_latteViews . contains ( containment ) ) {
2019-04-06 02:00:37 +03:00
return ;
}
2019-06-20 17:42:49 +03:00
int delay = delayed ? 350 : 0 ;
m_viewsToRecreate < < containment ;
2019-06-20 11:21:12 +03:00
2019-06-20 17:42:49 +03:00
//! give the time to config window to close itself first and then recreate the dock
//! step:1 remove the latteview
QTimer : : singleShot ( delay , [ this , containment ] ( ) {
auto view = m_latteViews [ containment ] ;
view - > disconnectSensitiveSignals ( ) ;
2019-06-20 11:21:12 +03:00
2019-06-20 17:42:49 +03:00
//! step:2 add the new latteview
connect ( view , & QObject : : destroyed , this , [ this , containment ] ( ) {
auto view = m_latteViews . take ( containment ) ;
QTimer : : singleShot ( 250 , this , [ this , containment ] ( ) {
if ( ! m_latteViews . contains ( containment ) ) {
qDebug ( ) < < " recreate - step 2: adding dock for containment: " < < containment - > id ( ) ;
addView ( containment ) ;
m_viewsToRecreate . removeAll ( containment ) ;
}
} ) ;
2019-06-20 11:21:12 +03:00
} ) ;
2019-06-20 17:42:49 +03:00
view - > deleteLater ( ) ;
} ) ;
2019-04-06 02:00:37 +03:00
}
2021-12-11 18:39:44 +03:00
bool GenericLayout : : hasLatteView ( Plasma : : Containment * containment )
2019-04-06 02:00:37 +03:00
{
if ( ! m_corona ) {
return false ;
}
return m_latteViews . keys ( ) . contains ( containment ) ;
}
QList < Plasma : : Types : : Location > GenericLayout : : availableEdgesForView ( QScreen * scr , Latte : : View * forView ) const
{
using Plasma : : Types ;
QList < Types : : Location > edges { Types : : BottomEdge , Types : : LeftEdge ,
2019-04-07 19:35:55 +03:00
Types : : TopEdge , Types : : RightEdge } ;
2019-04-06 02:00:37 +03:00
if ( ! m_corona ) {
return edges ;
}
for ( const auto view : m_latteViews ) {
//! make sure that availabe edges takes into account only views that should be excluded,
//! this is why the forView should not be excluded
if ( view & & view ! = forView & & view - > positioner ( ) - > currentScreenName ( ) = = scr - > name ( ) ) {
edges . removeOne ( view - > location ( ) ) ;
}
}
return edges ;
}
bool GenericLayout : : explicitDockOccupyEdge ( int screen , Plasma : : Types : : Location location ) const
{
if ( ! m_corona ) {
return false ;
}
for ( const auto containment : m_containments ) {
2020-08-18 01:23:41 +03:00
if ( Layouts : : Storage : : self ( ) - > isLatteContainment ( containment ) ) {
2019-04-06 02:00:37 +03:00
bool onPrimary = containment - > config ( ) . readEntry ( " onPrimary " , true ) ;
int id = containment - > lastScreen ( ) ;
Plasma : : Types : : Location contLocation = containment - > location ( ) ;
if ( ! onPrimary & & id = = screen & & contLocation = = location ) {
return true ;
}
}
}
return false ;
}
bool GenericLayout : : primaryDockOccupyEdge ( Plasma : : Types : : Location location ) const
{
if ( ! m_corona ) {
return false ;
}
for ( const auto containment : m_containments ) {
2020-08-18 01:23:41 +03:00
if ( Layouts : : Storage : : self ( ) - > isLatteContainment ( containment ) ) {
2020-03-07 19:30:22 +03:00
bool onPrimary { false } ;
if ( m_latteViews . contains ( containment ) ) {
onPrimary = m_latteViews [ containment ] - > onPrimary ( ) ;
} else {
onPrimary = containment - > config ( ) . readEntry ( " onPrimary " , true ) ;
}
2019-04-06 02:00:37 +03:00
Plasma : : Types : : Location contLocation = containment - > location ( ) ;
if ( onPrimary & & contLocation = = location ) {
return true ;
}
}
}
return false ;
}
2019-04-08 18:57:32 +03:00
bool GenericLayout : : mapContainsId ( const Layout : : ViewsMap * map , uint viewId ) const
2019-04-07 01:16:59 +03:00
{
for ( const auto & scr : map - > keys ( ) ) {
for ( const auto & edge : ( * map ) [ scr ] . keys ( ) ) {
2020-03-07 19:30:22 +03:00
if ( ( * map ) [ scr ] [ edge ] . contains ( viewId ) ) {
2019-04-07 01:16:59 +03:00
return true ;
}
}
}
2019-04-06 02:00:37 +03:00
2019-04-07 01:16:59 +03:00
return false ;
}
2021-12-11 18:39:44 +03:00
QString GenericLayout : : mapScreenName ( const ViewsMap * map , uint viewId ) const
{
for ( const auto & scr : map - > keys ( ) ) {
for ( const auto & edge : ( * map ) [ scr ] . keys ( ) ) {
if ( ( * map ) [ scr ] [ edge ] . contains ( viewId ) ) {
return scr ;
}
}
}
return QString : : number ( Latte : : ScreenPool : : NOSCREENID ) ;
}
2019-04-07 01:16:59 +03:00
//! screen name, location, containmentId
2021-12-11 18:39:44 +03:00
Layout : : ViewsMap GenericLayout : : validViewsMap ( )
2019-04-06 02:00:37 +03:00
{
2019-04-08 18:57:32 +03:00
Layout : : ViewsMap map ;
2019-04-07 01:16:59 +03:00
2019-04-06 02:00:37 +03:00
if ( ! m_corona ) {
2019-04-07 01:16:59 +03:00
return map ;
2019-04-06 02:00:37 +03:00
}
2022-05-08 13:52:55 +03:00
QString prmScreenName = m_corona - > screenPool ( ) - > primaryScreen ( ) - > name ( ) ;
2019-04-06 02:00:37 +03:00
for ( const auto containment : m_containments ) {
2021-12-11 18:39:44 +03:00
if ( Layouts : : Storage : : self ( ) - > isLatteContainment ( containment )
& & ! Layouts : : Storage : : self ( ) - > isClonedView ( containment ) ) {
Data : : View view = hasLatteView ( containment ) ? m_latteViews [ containment ] - > data ( ) : Latte : : Layouts : : Storage : : self ( ) - > view ( this , containment ) ;
view . screen = Layouts : : Storage : : self ( ) - > expectedViewScreenId ( m_corona , view ) ;
2019-04-06 02:00:37 +03:00
2021-12-11 18:39:44 +03:00
if ( view . onPrimary ) {
map [ prmScreenName ] [ view . edge ] < < containment - > id ( ) ;
2019-04-06 02:00:37 +03:00
} else {
2021-12-11 18:39:44 +03:00
QString expScreenName = m_corona - > screenPool ( ) - > connector ( view . screen ) ;
2019-04-06 02:00:37 +03:00
2021-12-11 18:39:44 +03:00
if ( m_corona - > screenPool ( ) - > isScreenActive ( view . screen ) ) {
map [ expScreenName ] [ view . edge ] < < containment - > id ( ) ;
2019-04-06 02:00:37 +03:00
}
}
}
}
2019-04-07 01:16:59 +03:00
return map ;
}
//! the central functions that updates loading/unloading latteviews
//! concerning screen changed (for multi-screen setups mainly)
2021-12-11 18:39:44 +03:00
void GenericLayout : : syncLatteViewsToScreens ( )
2019-04-07 01:16:59 +03:00
{
if ( ! m_corona ) {
return ;
}
qDebug ( ) < < " START of SyncLatteViewsToScreens .... " ;
qDebug ( ) < < " LAYOUT ::: " < < name ( ) ;
qDebug ( ) < < " screen count changed -+-+ " < < qGuiApp - > screens ( ) . size ( ) ;
2021-04-13 10:56:15 +03:00
//! Clear up pendingContainmentUpdates when no-needed any more
QStringList clearpendings ;
for ( int i = 0 ; i < m_pendingContainmentUpdates . rowCount ( ) ; + + i ) {
auto viewdata = m_pendingContainmentUpdates [ i ] ;
auto containment = containmentForId ( viewdata . id . toUInt ( ) ) ;
if ( containment ) {
if ( ( viewdata . onPrimary & & containment - > lastScreen ( ) = = m_corona - > screenPool ( ) - > primaryScreenId ( ) )
| | ( ! viewdata . onPrimary & & containment - > lastScreen ( ) = = viewdata . screen ) ) {
clearpendings < < viewdata . id ;
}
}
}
for ( auto pendingid : clearpendings ) {
m_pendingContainmentUpdates . remove ( pendingid ) ;
}
2021-04-13 12:16:41 +03:00
if ( m_pendingContainmentUpdates . rowCount ( ) > 0 ) {
qDebug ( ) < < " Pending View updates still valid : " ;
m_pendingContainmentUpdates . print ( ) ;
}
2021-04-13 10:56:15 +03:00
//! use valid views map based on active screens
2021-12-11 18:39:44 +03:00
Layout : : ViewsMap viewsMap = validViewsMap ( ) ;
2019-04-07 01:16:59 +03:00
2022-05-08 13:52:55 +03:00
QString prmScreenName = m_corona - > screenPool ( ) - > primaryScreen ( ) - > name ( ) ;
2019-04-07 01:16:59 +03:00
2019-04-06 02:00:37 +03:00
qDebug ( ) < < " PRIMARY SCREEN :: " < < prmScreenName ;
2019-04-07 01:16:59 +03:00
qDebug ( ) < < " LATTEVIEWS MAP :: " < < viewsMap ;
2019-04-06 02:00:37 +03:00
//! add views
for ( const auto containment : m_containments ) {
2021-12-11 18:39:44 +03:00
if ( ! hasLatteView ( containment ) & & mapContainsId ( & viewsMap , containment - > id ( ) ) ) {
qDebug ( ) < < " syncLatteViewsToScreens: view must be added... for containment: " < < containment - > id ( ) < < " at screen: " < < mapScreenName ( & viewsMap , containment - > id ( ) ) ;
2019-04-06 02:00:37 +03:00
addView ( containment ) ;
}
}
//! remove views
2019-04-08 18:57:32 +03:00
QList < Plasma : : Containment * > viewsToDelete ;
for ( auto view : m_latteViews ) {
auto containment = view - > containment ( ) ;
2021-12-11 18:39:44 +03:00
if ( containment & & view - > isOriginal ( ) & & ! mapContainsId ( & viewsMap , containment - > id ( ) ) ) {
2019-04-08 18:57:32 +03:00
viewsToDelete < < containment ;
2019-04-06 02:00:37 +03:00
}
}
2019-04-08 18:57:32 +03:00
while ( ! viewsToDelete . isEmpty ( ) ) {
auto containment = viewsToDelete . takeFirst ( ) ;
auto view = m_latteViews . take ( containment ) ;
qDebug ( ) < < " syncLatteViewsToScreens: view must be deleted... for containment: " < < containment - > id ( ) < < " at screen: " < < view - > positioner ( ) - > currentScreenName ( ) ;
view - > disconnectSensitiveSignals ( ) ;
view - > deleteLater ( ) ;
}
2019-04-06 02:00:37 +03:00
//! reconsider views
for ( const auto view : m_latteViews ) {
2021-12-11 18:39:44 +03:00
if ( view - > containment ( ) & & view - > isOriginal ( ) & & mapContainsId ( & viewsMap , view - > containment ( ) - > id ( ) ) ) {
2019-04-06 02:00:37 +03:00
//! if the dock will not be deleted its a very good point to reconsider
//! if the screen in which is running is the correct one
2019-04-08 18:57:32 +03:00
qDebug ( ) < < " syncLatteViewsToScreens: view must consider its screen... for containment: " < < view - > containment ( ) - > id ( ) < < " at screen: " < < view - > positioner ( ) - > currentScreenName ( ) ;
2019-04-06 02:00:37 +03:00
view - > reconsiderScreen ( ) ;
}
}
qDebug ( ) < < " end of, syncLatteViewsToScreens .... " ;
}
2021-04-18 11:03:22 +03:00
QList < Plasma : : Containment * > GenericLayout : : subContainmentsOf ( uint id ) const
{
QList < Plasma : : Containment * > subs ;
auto containment = containmentForId ( id ) ;
if ( ! containment | | ! Layouts : : Storage : : self ( ) - > isLatteContainment ( containment ) ) {
return subs ;
}
auto applets = containment - > config ( ) . group ( " Applets " ) ;
for ( const auto & applet : applets . groupList ( ) ) {
int tSubId = Layouts : : Storage : : self ( ) - > subContainmentId ( applets . group ( applet ) ) ;
if ( Layouts : : Storage : : isValid ( tSubId ) ) {
auto subcontainment = containmentForId ( tSubId ) ;
if ( subcontainment ) {
subs < < subcontainment ;
}
}
}
return subs ;
}
2020-08-19 16:26:08 +03:00
QList < int > GenericLayout : : subContainmentsOf ( Plasma : : Containment * containment ) const
2019-07-14 18:23:52 +03:00
{
2020-08-19 16:26:08 +03:00
QList < int > subs ;
2019-07-14 18:23:52 +03:00
2020-08-18 01:23:41 +03:00
if ( Layouts : : Storage : : self ( ) - > isLatteContainment ( containment ) ) {
2019-07-14 18:23:52 +03:00
auto applets = containment - > config ( ) . group ( " Applets " ) ;
for ( const auto & applet : applets . groupList ( ) ) {
2020-08-19 16:26:08 +03:00
int tSubId = Layouts : : Storage : : self ( ) - > subContainmentId ( applets . group ( applet ) ) ;
2019-07-14 18:23:52 +03:00
2020-08-19 17:36:25 +03:00
if ( Layouts : : Storage : : isValid ( tSubId ) ) {
2020-08-19 16:26:08 +03:00
subs < < tSubId ;
2019-07-14 18:23:52 +03:00
}
}
}
2020-08-19 16:26:08 +03:00
return subs ;
2019-07-14 18:23:52 +03:00
}
2021-06-03 20:36:54 +03:00
QList < int > GenericLayout : : viewsExplicitScreens ( )
2019-07-14 13:59:02 +03:00
{
2021-05-18 22:07:42 +03:00
Data : : ViewsTable views = viewsTable ( ) ;
2019-07-14 13:59:02 +03:00
QList < int > screens ;
2021-05-18 22:07:42 +03:00
for ( int i = 0 ; i < views . rowCount ( ) ; + + i ) {
if ( ! views [ i ] . onPrimary & & ! screens . contains ( views [ i ] . screen ) ) {
screens < < views [ i ] . screen ;
2019-07-14 13:59:02 +03:00
}
}
2021-05-18 22:07:42 +03:00
return screens ;
}
2019-04-06 02:00:37 +03:00
2019-04-06 18:56:24 +03:00
//! STORAGE
2019-04-06 02:00:37 +03:00
bool GenericLayout : : isWritable ( ) const
{
2020-08-18 01:23:41 +03:00
return Layouts : : Storage : : self ( ) - > isWritable ( this ) ;
2019-04-06 02:00:37 +03:00
}
void GenericLayout : : lock ( )
{
2020-08-18 01:23:41 +03:00
Layouts : : Storage : : self ( ) - > lock ( this ) ;
2019-04-06 02:00:37 +03:00
}
void GenericLayout : : unlock ( )
{
2020-08-18 01:23:41 +03:00
Layouts : : Storage : : self ( ) - > unlock ( this ) ;
2019-04-06 02:00:37 +03:00
}
void GenericLayout : : syncToLayoutFile ( bool removeLayoutId )
{
2020-08-14 10:52:13 +03:00
syncSettings ( ) ;
2020-08-18 02:23:34 +03:00
Layouts : : Storage : : self ( ) - > syncToLayoutFile ( this , removeLayoutId ) ;
2019-04-06 02:00:37 +03:00
}
2021-06-28 17:07:53 +03:00
bool GenericLayout : : newView ( const QString & templateName )
{
if ( ! isActive ( ) | | ! m_corona - > templatesManager ( ) - > hasViewTemplate ( templateName ) ) {
return false ;
}
QString templatefilepath = m_corona - > templatesManager ( ) - > viewTemplateFilePath ( templateName ) ;
Data : : ViewsTable templateviews = Layouts : : Storage : : self ( ) - > views ( templatefilepath ) ;
if ( templateviews . rowCount ( ) < = 0 ) {
return false ;
}
Data : : View nextdata = templateviews [ 0 ] ;
int scrId = m_corona - > screenPool ( ) - > primaryScreenId ( ) ;
QList < Plasma : : Types : : Location > freeedges = freeEdges ( scrId ) ;
if ( ! freeedges . contains ( nextdata . edge ) ) {
nextdata . edge = ( freeedges . count ( ) > 0 ? freeedges [ 0 ] : Plasma : : Types : : BottomEdge ) ;
}
nextdata . setState ( Data : : View : : OriginFromViewTemplate , templatefilepath ) ;
newView ( nextdata ) ;
return true ;
}
2021-04-18 10:19:14 +03:00
Data : : View GenericLayout : : newView ( const Latte : : Data : : View & nextViewData )
2021-02-06 01:14:11 +03:00
{
2021-04-17 14:37:09 +03:00
if ( nextViewData . state ( ) = = Data : : View : : IsInvalid ) {
2021-04-17 19:32:40 +03:00
return Data : : View ( ) ;
2021-02-06 01:14:11 +03:00
}
2021-04-18 10:19:14 +03:00
Data : : View result = Layouts : : Storage : : self ( ) - > newView ( this , nextViewData ) ;
2021-02-06 01:14:11 +03:00
emit viewEdgeChanged ( ) ;
2021-04-17 19:32:40 +03:00
return result ;
2021-02-06 01:14:11 +03:00
}
2021-04-11 19:37:54 +03:00
void GenericLayout : : updateView ( const Latte : : Data : : View & viewData )
{
2021-04-13 10:20:48 +03:00
//! storage -> storage [view scenario]
2021-04-11 19:37:54 +03:00
if ( ! isActive ( ) ) {
2021-04-13 10:20:48 +03:00
Layouts : : Storage : : self ( ) - > updateView ( this , viewData ) ;
2021-04-11 19:37:54 +03:00
return ;
}
2021-04-13 10:20:48 +03:00
//! active -> active [view scenario]
Latte : : View * view = viewForContainment ( viewData . id . toUInt ( ) ) ;
bool viewMustBeDeleted = ( view & & ! viewData . onPrimary & & ! m_corona - > screenPool ( ) - > isScreenActive ( viewData . screen ) ) ;
2021-04-11 19:37:54 +03:00
2021-04-27 01:43:38 +03:00
QString nextactivelayoutname = ( viewData . state ( ) = = Data : : View : : OriginFromLayout & & ! viewData . originLayout ( ) . isEmpty ( ) ? viewData . originLayout ( ) : QString ( ) ) ;
2021-04-11 19:37:54 +03:00
if ( view ) {
2021-04-13 10:20:48 +03:00
if ( ! viewMustBeDeleted ) {
QString scrName = Latte : : Data : : Screen : : ONPRIMARYNAME ;
2021-04-12 00:14:42 +03:00
2021-04-13 10:20:48 +03:00
if ( ! viewData . onPrimary ) {
if ( m_corona - > screenPool ( ) - > hasScreenId ( viewData . screen ) ) {
scrName = m_corona - > screenPool ( ) - > connector ( viewData . screen ) ;
} else {
scrName = " " ;
}
2021-04-12 00:14:42 +03:00
}
2021-04-13 10:20:48 +03:00
view - > setName ( viewData . name ) ;
2021-12-11 18:39:44 +03:00
view - > positioner ( ) - > setNextLocation ( nextactivelayoutname , viewData . screensGroup , scrName , viewData . edge , viewData . alignment ) ;
2021-04-13 10:20:48 +03:00
return ;
} else {
//! viewMustBeDeleted
m_latteViews . remove ( view - > containment ( ) ) ;
view - > disconnectSensitiveSignals ( ) ;
delete view ;
2021-04-12 00:14:42 +03:00
}
2021-04-13 10:20:48 +03:00
}
//! inactiveinmemory -> active/inactiveinmemory [viewscenario]
//! active -> inactiveinmemory [viewscenario]
auto containment = containmentForId ( viewData . id . toUInt ( ) ) ;
if ( containment ) {
2021-04-13 12:16:41 +03:00
Layouts : : Storage : : self ( ) - > updateView ( this , viewData ) ;
2021-04-13 10:56:15 +03:00
//! by using pendingContainmentUpdates we make sure that when containment->screen() will be
//! called though reactToScreenChange() the proper screen will be returned
if ( ! m_pendingContainmentUpdates . containsId ( viewData . id ) ) {
m_pendingContainmentUpdates < < viewData ;
} else {
m_pendingContainmentUpdates [ viewData . id ] = viewData ;
}
containment - > reactToScreenChange ( ) ;
2021-04-13 10:20:48 +03:00
}
2021-04-12 00:14:42 +03:00
2021-04-27 01:43:38 +03:00
if ( ! nextactivelayoutname . isEmpty ( ) ) {
m_corona - > layoutsManager ( ) - > moveView ( name ( ) , viewData . id . toUInt ( ) , nextactivelayoutname ) ;
}
2021-04-13 10:20:48 +03:00
//! complete update circle and inform the others about the changes
if ( viewMustBeDeleted ) {
emit viewEdgeChanged ( ) ;
emit viewsCountChanged ( ) ;
2021-04-11 19:37:54 +03:00
}
2021-04-13 10:20:48 +03:00
syncLatteViewsToScreens ( ) ;
2021-04-11 19:37:54 +03:00
}
2021-04-15 00:58:41 +03:00
void GenericLayout : : removeView ( const Latte : : Data : : View & viewData )
{
if ( ! containsView ( viewData . id . toInt ( ) ) ) {
return ;
}
if ( ! isActive ( ) ) {
Layouts : : Storage : : self ( ) - > removeView ( file ( ) , viewData ) ;
return ;
}
Plasma : : Containment * viewcontainment = containmentForId ( viewData . id . toUInt ( ) ) ;
2021-05-02 09:08:30 +03:00
destroyContainment ( viewcontainment ) ;
}
void GenericLayout : : removeOrphanedSubContainment ( const int & containmentId )
{
Data : : ViewsTable views = viewsTable ( ) ;
QString cidstr = QString : : number ( containmentId ) ;
if ( views . hasContainmentId ( cidstr ) ) {
return ;
}
if ( ! isActive ( ) ) {
Layouts : : Storage : : self ( ) - > removeContainment ( file ( ) , cidstr ) ;
return ;
}
Plasma : : Containment * orphanedcontainment = containmentForId ( cidstr . toUInt ( ) ) ;
destroyContainment ( orphanedcontainment ) ;
}
2021-04-15 00:58:41 +03:00
2021-05-02 09:08:30 +03:00
void GenericLayout : : destroyContainment ( Plasma : : Containment * containment )
{
2021-05-04 10:13:24 +03:00
if ( ! containment | | ! m_corona | | ! contains ( containment ) ) {
2021-05-02 09:08:30 +03:00
return ;
2021-04-15 00:58:41 +03:00
}
2021-05-02 09:08:30 +03:00
containment - > setImmutability ( Plasma : : Types : : Mutable ) ;
containment - > destroy ( ) ;
2021-04-15 00:58:41 +03:00
}
2021-04-18 11:03:22 +03:00
QString GenericLayout : : storedView ( const int & containmentId )
{
return Layouts : : Storage : : self ( ) - > storedView ( this , containmentId ) ;
}
2019-04-06 02:00:37 +03:00
void GenericLayout : : importToCorona ( )
{
2020-08-18 01:56:11 +03:00
Layouts : : Storage : : self ( ) - > importToCorona ( this ) ;
2019-04-06 02:00:37 +03:00
}
2021-04-30 00:26:47 +03:00
Data : : ErrorsList GenericLayout : : errors ( ) const
{
return Layouts : : Storage : : self ( ) - > errors ( this ) ;
}
Data : : WarningsList GenericLayout : : warnings ( ) const
{
return Layouts : : Storage : : self ( ) - > warnings ( this ) ;
}
2021-03-21 17:54:58 +03:00
Latte : : Data : : ViewsTable GenericLayout : : viewsTable ( ) const
{
return Layouts : : Storage : : self ( ) - > views ( this ) ;
}
2019-04-05 19:59:15 +03:00
}
}