@ -45,7 +45,7 @@ void ExpoCell::setLayout(ExpoLayout *layout)
void ExpoCell : : update ( )
void ExpoCell : : update ( )
{
{
if ( m_layout ) {
if ( m_layout ) {
m_layout - > sc heduleUpdate ( ) ;
m_layout - > poli sh( ) ;
}
}
}
}
@ -199,8 +199,6 @@ void ExpoCell::setPersistentKey(const QString &key)
ExpoLayout : : ExpoLayout ( QQuickItem * parent )
ExpoLayout : : ExpoLayout ( QQuickItem * parent )
: QQuickItem ( parent )
: QQuickItem ( parent )
{
{
m_updateTimer . setSingleShot ( true ) ;
connect ( & m_updateTimer , & QTimer : : timeout , this , & ExpoLayout : : update ) ;
}
}
ExpoLayout : : LayoutMode ExpoLayout : : mode ( ) const
ExpoLayout : : LayoutMode ExpoLayout : : mode ( ) const
@ -212,7 +210,7 @@ void ExpoLayout::setMode(LayoutMode mode)
{
{
if ( m_mode ! = mode ) {
if ( m_mode ! = mode ) {
m_mode = mode ;
m_mode = mode ;
sc heduleUpdate ( ) ;
poli sh( ) ;
Q_EMIT modeChanged ( ) ;
Q_EMIT modeChanged ( ) ;
}
}
}
}
@ -226,7 +224,7 @@ void ExpoLayout::setFillGaps(bool fill)
{
{
if ( m_fillGaps ! = fill ) {
if ( m_fillGaps ! = fill ) {
m_fillGaps = fill ;
m_fillGaps = fill ;
sc heduleUpdate ( ) ;
poli sh( ) ;
Q_EMIT fillGapsChanged ( ) ;
Q_EMIT fillGapsChanged ( ) ;
}
}
}
}
@ -240,51 +238,60 @@ void ExpoLayout::setSpacing(int spacing)
{
{
if ( m_spacing ! = spacing ) {
if ( m_spacing ! = spacing ) {
m_spacing = spacing ;
m_spacing = spacing ;
sc heduleUpdate ( ) ;
poli sh( ) ;
Q_EMIT spacingChanged ( ) ;
Q_EMIT spacingChanged ( ) ;
}
}
}
}
void ExpoLayout : : update ( )
bool ExpoLayout : : isReady ( ) const
{
{
if ( m_cells . isEmpty ( ) ) {
return m_ready ;
return ;
}
}
switch ( m_mode ) {
void ExpoLayout : : setReady ( )
case LayoutClosest :
{
calculateWindowTransformationsClosest ( ) ;
if ( ! m_ready ) {
break ;
m_ready = true ;
case LayoutKompose :
Q_EMIT readyChanged ( ) ;
calculateWindowTransformationsKompose ( ) ;
break ;
case LayoutNatural :
calculateWindowTransformationsNatural ( ) ;
break ;
}
}
}
}
void ExpoLayout : : sched uleU pdate( )
void ExpoLayout : : updatePolish ( )
{
{
m_updateTimer . start ( ) ;
if ( ! m_cells . isEmpty ( ) ) {
switch ( m_mode ) {
case LayoutClosest :
calculateWindowTransformationsClosest ( ) ;
break ;
case LayoutKompose :
calculateWindowTransformationsKompose ( ) ;
break ;
case LayoutNatural :
calculateWindowTransformationsNatural ( ) ;
break ;
}
}
setReady ( ) ;
}
}
void ExpoLayout : : addCell ( ExpoCell * cell )
void ExpoLayout : : addCell ( ExpoCell * cell )
{
{
Q_ASSERT ( ! m_cells . contains ( cell ) ) ;
Q_ASSERT ( ! m_cells . contains ( cell ) ) ;
m_cells . append ( cell ) ;
m_cells . append ( cell ) ;
scheduleUpdate ( ) ;
poli sh( ) ;
}
}
void ExpoLayout : : removeCell ( ExpoCell * cell )
void ExpoLayout : : removeCell ( ExpoCell * cell )
{
{
m_cells . removeOne ( cell ) ;
m_cells . removeOne ( cell ) ;
scheduleUpdate ( ) ;
poli sh( ) ;
}
}
void ExpoLayout : : geometryChanged ( const QRectF & newGeometry , const QRectF & oldGeometry )
void ExpoLayout : : geometryChanged ( const QRectF & newGeometry , const QRectF & oldGeometry )
{
{
if ( newGeometry . size ( ) ! = oldGeometry . size ( ) ) {
if ( newGeometry . size ( ) ! = oldGeometry . size ( ) ) {
sc heduleUpdate ( ) ;
poli sh( ) ;
}
}
QQuickItem : : geometryChanged ( newGeometry , oldGeometry ) ;
QQuickItem : : geometryChanged ( newGeometry , oldGeometry ) ;
}
}