Sphere and Cylinder become part of Cube effect. That is much more convenient than having an own effect for each (only loading the shader is actually required).

Btw caps of cylinder and sphere are working correctly again.

svn path=/trunk/KDE/kdebase/workspace/; revision=925809
icc-effect-5.14.5
Martin Gräßlin 2009-02-14 09:29:01 +00:00
parent 78e5461790
commit 4fa09b63b4
22 changed files with 453 additions and 2711 deletions

View File

@ -37,8 +37,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "coverswitch/coverswitch_config.h"
#include "cube/cube_config.h"
#include "cube/cubeslide_config.h"
#include "cube/cylinder_config.h"
#include "cube/sphere_config.h"
#include "flipswitch/flipswitch_config.h"
#include "invert/invert_config.h"
#include "lookingglass/lookingglass_config.h"
@ -73,8 +71,6 @@ KWIN_EFFECT_CONFIG_MULTIPLE( builtins,
KWIN_EFFECT_CONFIG_SINGLE( coverswitch, CoverSwitchEffectConfig )
KWIN_EFFECT_CONFIG_SINGLE( cube, CubeEffectConfig )
KWIN_EFFECT_CONFIG_SINGLE( cubeslide, CubeSlideEffectConfig )
KWIN_EFFECT_CONFIG_SINGLE( cylinder, CylinderEffectConfig )
KWIN_EFFECT_CONFIG_SINGLE( sphere, SphereEffectConfig )
KWIN_EFFECT_CONFIG_SINGLE( flipswitch, FlipSwitchEffectConfig )
KWIN_EFFECT_CONFIG_SINGLE( invert, InvertEffectConfig )
KWIN_EFFECT_CONFIG_SINGLE( lookingglass, LookingGlassEffectConfig )

View File

@ -5,16 +5,12 @@
set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources}
cube/cube.cpp
cube/cubeslide.cpp
cube/cylinder.cpp
cube/sphere.cpp
)
# .desktop files
install( FILES
cube/cube.desktop
cube/cubeslide.desktop
cube/cylinder.desktop
cube/sphere.desktop
DESTINATION ${SERVICES_INSTALL_DIR}/kwin )
# Data files
@ -34,16 +30,9 @@ set( kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources
cube/cube_config.ui
cube/cubeslide_config.cpp
cube/cubeslide_config.ui
cube/cylinder_config.cpp
cube/cylinder_config.ui
cube/sphere_config.cpp
cube/sphere_config.ui
)
# .desktop files
install( FILES
cube/cube_config.desktop
cube/cubeslide_config.desktop
cube/cylinder_config.desktop
cube/sphere_config.desktop
DESTINATION ${SERVICES_INSTALL_DIR}/kwin )

View File

@ -51,6 +51,8 @@ CubeEffect::CubeEffect()
, keyboard_grab( false )
, schedule_close( false )
, borderActivate( ElectricNone )
, borderActivateCylinder( ElectricNone )
, borderActivateSphere( ElectricNone )
, frontDesktop( 0 )
, cubeOpacity( 1.0 )
, opacityDesktopOnly( true )
@ -80,6 +82,10 @@ CubeEffect::CubeEffect()
, useForTabBox( false )
, tabBoxMode( false )
, shortcutsRegistered( false )
, mode( Cube )
, useShaders( false )
, cylinderShader( 0 )
, sphereShader( 0 )
, capListCreated( false )
, recompileList( true )
, glList( 0 )
@ -100,9 +106,12 @@ void CubeEffect::reconfigure( ReconfigureFlags )
void CubeEffect::loadConfig( QString config )
{
KConfigGroup conf = effects->effectConfig( config );
effects->unreserveElectricBorder( borderActivate );
borderActivate = (ElectricBorder)conf.readEntry( "BorderActivate", (int)ElectricNone );
borderActivateCylinder = (ElectricBorder)conf.readEntry( "BorderActivateCylinder", (int)ElectricNone );
borderActivateSphere = (ElectricBorder)conf.readEntry( "BorderActivateSphere", (int)ElectricNone );
effects->reserveElectricBorder( borderActivate );
effects->reserveElectricBorder( borderActivateCylinder );
effects->reserveElectricBorder( borderActivateSphere );
cubeOpacity = (float)conf.readEntry( "Opacity", 80 )/100.0f;
opacityDesktopOnly = conf.readEntry( "OpacityDesktopOnly", false );
@ -111,16 +120,6 @@ void CubeEffect::loadConfig( QString config )
rotationDuration = animationTime( conf, "RotationDuration", 500 );
backgroundColor = conf.readEntry( "BackgroundColor", QColor( Qt::black ) );
bigCube = conf.readEntry( "BigCube", false );
// different settings for cylinder and sphere
if( config == "Cylinder" )
{
bigCube = true;
}
if( config == "Sphere" )
{
bigCube = true;
reflection = false;
}
capColor = conf.readEntry( "CapColor", KColorScheme( QPalette::Active, KColorScheme::Window ).background().color() );
paintCaps = conf.readEntry( "Caps", true );
closeOnMouseRelease = conf.readEntry( "CloseOnMouseRelease", false );
@ -131,6 +130,7 @@ void CubeEffect::loadConfig( QString config )
useForTabBox = conf.readEntry( "TabBox", false );
invertKeys = conf.readEntry( "InvertKeys", false );
invertMouse = conf.readEntry( "InvertMouse", false );
capDeformationFactor = conf.readEntry( "CapDeformation", 0 )/100.0f;
QString file = conf.readEntry( "Wallpaper", QString("") );
if( wallpaper )
wallpaper->discard();
@ -192,29 +192,21 @@ void CubeEffect::loadConfig( QString config )
verticalTimeLine.setDuration( rotationDuration );
// do not connect the shortcut if we use cylinder or sphere
KActionCollection* actionCollection = new KActionCollection( this );
if( config == "Cube" && !shortcutsRegistered )
if( !shortcutsRegistered )
{
KAction* a = static_cast< KAction* >( actionCollection->addAction( "Cube" ));
a->setText( i18n("Desktop Cube" ));
a->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::Key_F11 ));
connect( a, SIGNAL( triggered( bool )), this, SLOT( toggle()));
shortcutsRegistered = true;
}
if( config == "Cylinder" && !shortcutsRegistered )
{
KAction* a = static_cast< KAction* >( actionCollection->addAction( "Cylinder" ));
a->setText( i18n("Desktop Cylinder" ));
a->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_F11 ));
connect( a, SIGNAL( triggered( bool )), this, SLOT( toggle()));
shortcutsRegistered = true;
}
if( config == "Sphere" && !shortcutsRegistered )
{
KAction* a = static_cast< KAction* >( actionCollection->addAction( "Sphere" ));
a->setText( i18n("Desktop Sphere" ));
a->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::META + Qt::Key_F11 ));
connect( a, SIGNAL( triggered( bool )), this, SLOT( toggle()));
KActionCollection* actionCollection = new KActionCollection( this );
KAction* cubeAction = static_cast< KAction* >( actionCollection->addAction( "Cube" ));
cubeAction->setText( i18n("Desktop Cube" ));
cubeAction->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::Key_F11 ));
KAction* cylinderAction = static_cast< KAction* >( actionCollection->addAction( "Cylinder" ));
cylinderAction->setText( i18n("Desktop Cylinder" ));
cylinderAction->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_F11 ));
KAction* sphereAction = static_cast< KAction* >( actionCollection->addAction( "Sphere" ));
sphereAction->setText( i18n("Desktop Sphere" ));
sphereAction->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::META + Qt::Key_F11 ));
connect( cubeAction, SIGNAL( triggered( bool )), this, SLOT( toggleCube()));
connect( cylinderAction, SIGNAL( triggered( bool )), this, SLOT( toggleCylinder()));
connect( sphereAction, SIGNAL( triggered( bool )), this, SLOT( toggleSphere()));
shortcutsRegistered = true;
}
}
@ -222,8 +214,64 @@ void CubeEffect::loadConfig( QString config )
CubeEffect::~CubeEffect()
{
effects->unreserveElectricBorder( borderActivate );
effects->unreserveElectricBorder( borderActivateCylinder );
effects->unreserveElectricBorder( borderActivateSphere );
delete wallpaper;
delete capTexture;
delete cylinderShader;
delete sphereShader;
}
bool CubeEffect::loadShader()
{
if( !(GLShader::fragmentShaderSupported() &&
(effects->compositingType() == OpenGLCompositing)))
return false;
QString fragmentshader = KGlobal::dirs()->findResource( "data", "kwin/cylinder.frag" );
QString cylinderVertexshader = KGlobal::dirs()->findResource( "data", "kwin/cylinder.vert" );
QString sphereVertexshader = KGlobal::dirs()->findResource( "data", "kwin/sphere.vert" );
if( fragmentshader.isEmpty() || cylinderVertexshader.isEmpty() || sphereVertexshader.isEmpty() )
{
kError(1212) << "Couldn't locate shader files" << endl;
return false;
}
cylinderShader = new GLShader(cylinderVertexshader, fragmentshader);
if( !cylinderShader->isValid() )
{
kError(1212) << "The cylinder shader failed to load!" << endl;
return false;
}
else
{
cylinderShader->bind();
cylinderShader->setUniform( "winTexture", 0 );
cylinderShader->setUniform( "opacity", cubeOpacity );
QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop());
if( effects->numScreens() > 1 && bigCube )
rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() );
cylinderShader->setUniform( "width", (float)rect.width() );
cylinderShader->unbind();
}
sphereShader = new GLShader( sphereVertexshader, fragmentshader );
if( !sphereShader->isValid() )
{
kError(1212) << "The sphere shader failed to load!" << endl;
return false;
}
else
{
sphereShader->bind();
sphereShader->setUniform( "winTexture", 0 );
sphereShader->setUniform( "opacity", cubeOpacity );
QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop());
if( effects->numScreens() > 1 && bigCube )
rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() );
sphereShader->setUniform( "width", (float)rect.width() );
sphereShader->setUniform( "height", (float)rect.height() );
sphereShader->unbind();
}
return true;
}
void CubeEffect::prePaintScreen( ScreenPrePaintData& data, int time )
@ -355,7 +403,7 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data )
if( stop )
zTranslate *= ( 1.0 - timeLine.value() );
// reflection
if( reflection )
if( reflection && mode != Sphere )
{
// restrict painting the reflections to the current screen
PaintClipper::push( QRegion( rect ));
@ -387,11 +435,23 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data )
// cube
glCullFace( GL_FRONT );
if( mode == Cylinder )
{
cylinderShader->bind();
cylinderShader->setUniform( "front", 1.0f );
cylinderShader->unbind();
}
glPushMatrix();
glCallList( glList );
glCallList( glList + 1 );
glPopMatrix();
glCullFace( GL_BACK );
if( mode == Cylinder )
{
cylinderShader->bind();
cylinderShader->setUniform( "front", -1.0f );
cylinderShader->unbind();
}
glPushMatrix();
glCallList( glList );
glCallList( glList + 1 );
@ -458,7 +518,14 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data )
glRotatef( (1-frontDesktop)*360.0f / effects->numberOfDesktops(), 0.0, 1.0, 0.0 );
glTranslatef( 0.0, rect.height(), 0.0 );
glCullFace( GL_BACK );
if( mode == Sphere )
{
glPushMatrix();
glScalef( 1.0, -1.0, 1.0 );
}
glCallList( glList + 2 );
if( mode == Sphere )
glPopMatrix();
glTranslatef( 0.0, -rect.height(), 0.0 );
glCullFace( GL_FRONT );
glCallList( glList + 2 );
@ -467,11 +534,35 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data )
// cube
glCullFace( GL_BACK );
if( mode == Cylinder )
{
cylinderShader->bind();
cylinderShader->setUniform( "front", -1.0f );
cylinderShader->unbind();
}
if( mode == Sphere )
{
sphereShader->bind();
sphereShader->setUniform( "front", -1.0f );
sphereShader->unbind();
}
glPushMatrix();
glCallList( glList );
glCallList( glList + 1 );
glPopMatrix();
glCullFace( GL_FRONT );
if( mode == Cylinder )
{
cylinderShader->bind();
cylinderShader->setUniform( "front", 1.0f );
cylinderShader->unbind();
}
if( mode == Sphere )
{
sphereShader->bind();
sphereShader->setUniform( "front", 1.0f );
sphereShader->unbind();
}
glPushMatrix();
glCallList( glList );
glCallList( glList + 1 );
@ -486,7 +577,14 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data )
glRotatef( (1-frontDesktop)*360.0f / effects->numberOfDesktops(), 0.0, 1.0, 0.0 );
glTranslatef( 0.0, rect.height(), 0.0 );
glCullFace( GL_FRONT );
if( mode == Sphere )
{
glPushMatrix();
glScalef( 1.0, -1.0, 1.0 );
}
glCallList( glList + 2 );
if( mode == Sphere )
glPopMatrix();
glTranslatef( 0.0, -rect.height(), 0.0 );
glCullFace( GL_BACK );
glCallList( glList + 2 );
@ -758,48 +856,47 @@ void CubeEffect::paintCube( int mask, QRegion region, ScreenPaintData& data )
painting_desktop = effects->currentDesktop();
}
void CubeEffect::paintCap( float z, float zTexture )
void CubeEffect::paintCap()
{
QRect rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop());
if( ( !paintCaps ) || effects->numberOfDesktops() <= 2 )
return;
float opacity = cubeOpacity;
if( start )
opacity = 1.0 - (1.0 - opacity)*timeLine.value();
if( stop )
opacity = 1.0 - (1.0 - opacity)*( 1.0 - timeLine.value() );
glColor4f( capColor.redF(), capColor.greenF(), capColor.blueF(), opacity );
float angle = 360.0f/effects->numberOfDesktops();
glPushMatrix();
float zTranslate = zPosition + zoom;
if( start )
zTranslate *= timeLine.value();
if( stop )
zTranslate *= ( 1.0 - timeLine.value() );
glTranslatef( rect.width()/2, 0.0, -z-zTranslate );
glRotatef( (1-frontDesktop)*angle, 0.0, 1.0, 0.0 );
if( !capListCreated )
{
capListCreated = true;
glNewList( glList + 2, GL_COMPILE );
if( texturedCaps && effects->numberOfDesktops() > 3 && capTexture )
glColor4f( capColor.redF(), capColor.greenF(), capColor.blueF(), cubeOpacity );
glPushMatrix();
switch( mode )
{
paintCapStep( z, zTexture, true );
case Cube:
paintCubeCap();
break;
case Cylinder:
paintCylinderCap();
break;
case Sphere:
paintSphereCap();
break;
default:
// impossible
break;
}
else
paintCapStep( z, zTexture, false );
glPopMatrix();
glEndList();
}
else
glCallList( glList + 2 );
glPopMatrix();
}
void CubeEffect::paintCapStep( float z, float zTexture, bool texture )
void CubeEffect::paintCubeCap()
{
QRect rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop());
QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop());
if( effects->numScreens() > 1 && bigCube )
rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() );
float cubeAngle = (float)((float)(effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f);
float z = rect.width()/2*tan(cubeAngle*0.5f*M_PI/180.0f);
float zTexture = rect.width()/2*tan(45.0f*M_PI/180.0f);
float angle = 360.0f/effects->numberOfDesktops();
bool texture = texturedCaps && effects->numberOfDesktops() > 3 && capTexture;
if( texture )
capTexture->bind();
for( int i=0; i<effects->numberOfDesktops(); i++ )
@ -906,6 +1003,117 @@ void CubeEffect::paintCapStep( float z, float zTexture, bool texture )
}
}
void CubeEffect::paintCylinderCap()
{
QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop());
if( effects->numScreens() > 1 && bigCube )
rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() );
float cubeAngle = (float)((float)(effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f);
float z = rect.width()/2*tan(cubeAngle*0.5f*M_PI/180.0f);
glPushMatrix();
paintCubeCap();
glPopMatrix();
float radian = (cubeAngle*0.5)*M_PI/180;
// height of the triangle compound of one side of the cube and the two bisecting lines
float midpoint = rect.width()*0.5*tan(radian);
// radius of the circle
float radius = (rect.width()*0.5)/cos(radian);
// paint round part of the cap
glPushMatrix();
glTranslatef( -rect.width()*0.5, 0.0, z );
float triangleWidth = 40.0;
for( int i=0; i<effects->numberOfDesktops(); i++ )
{
glPushMatrix();
glTranslatef( rect.width()/2, 0.0, -z );
glRotatef( i*(360.0f/effects->numberOfDesktops()), 0.0, 1.0, 0.0 );
glTranslatef( -rect.width()/2, 0.0, z );
glBegin( GL_TRIANGLE_STRIP );
for( int j=0; j<rect.width()/triangleWidth; j++ )
{
float zValue = 0.0;
// distance from midpoint of desktop to x coord
// calculation is same as in shader -> see comments
float distance = rect.width()*0.5 - (j*triangleWidth);
if( (j*triangleWidth) > rect.width()*0.5 )
{
distance = (j*triangleWidth) - rect.width()*0.5;
}
// distance in correct format
float angle = acos( distance/radius );
float h = radius;
// if distance == 0 -> angle=90 -> tan(90) singularity
if( distance != 0.0 )
h = tan( angle ) * distance;
zValue = h - midpoint;
glVertex3f( (j+1)*triangleWidth, 0.0, 0.0 );
glVertex3f( j*triangleWidth, 0.0, zValue );
}
glEnd();
glPopMatrix();
}
glPopMatrix();
}
void CubeEffect::paintSphereCap()
{
QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop());
if( effects->numScreens() > 1 && bigCube )
rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() );
float cubeAngle = (float)((float)(effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f);
float zTexture = rect.width()/2*tan(45.0f*M_PI/180.0f);
float radius = (rect.width()*0.5)/cos(cubeAngle*0.5*M_PI/180.0);
float angle = acos( (rect.height()*0.5)/radius )*180.0/M_PI;
angle /= 30;
bool texture = texturedCaps && effects->numberOfDesktops() > 3 && capTexture;
if( texture )
capTexture->bind();
glPushMatrix();
glTranslatef( 0.0, -rect.height()*0.5, 0.0 );
glBegin( GL_QUADS );
for( int i=0; i<30; i++ )
{
float topAngle = angle*i*M_PI/180.0;
float bottomAngle = angle*(i+1)*M_PI/180.0;
float yTop = rect.height() - radius * cos( topAngle );
yTop -= (yTop-rect.height()*0.5)*capDeformationFactor;
float yBottom = rect.height() -radius * cos( bottomAngle );
yBottom -= (yBottom-rect.height()*0.5)*capDeformationFactor;
for( int j=0; j<36; j++ )
{
float x = radius * sin( topAngle ) * sin( (90.0+j*10.0)*M_PI/180.0 );
float z = radius * sin( topAngle ) * cos( (90.0+j*10.0)*M_PI/180.0 );
if( texture )
glTexCoord2f( x/(rect.width())+0.5, 0.5 - z/zTexture * 0.5 );
glVertex3f( x, yTop, z );
x = radius * sin( bottomAngle ) * sin( (90.0+j*10.0)*M_PI/180.00 );
z = radius * sin( bottomAngle ) * cos( (90.0+j*10.0)*M_PI/180.0 );
if( texture )
glTexCoord2f( x/(rect.width())+0.5, 0.5 - z/zTexture * 0.5 );
glVertex3f( x, yBottom, z );
x = radius * sin( bottomAngle ) * sin( (90.0+(j+1)*10.0)*M_PI/180.0 );
z = radius * sin( bottomAngle ) * cos( (90.0+(j+1)*10.0)*M_PI/180.0 );
if( texture )
glTexCoord2f( x/(rect.width())+0.5, 0.5 - z/zTexture * 0.5 );
glVertex3f( x, yBottom, z );
x = radius * sin( topAngle ) * sin( (90.0+(j+1)*10.0)*M_PI/180.0 );
z = radius * sin( topAngle ) * cos( (90.0+(j+1)*10.0)*M_PI/180.0 );
if( texture )
glTexCoord2f( x/(rect.width())+0.5, 0.5 - z/zTexture * 0.5 );
glVertex3f( x, yTop, z );
}
}
glEnd();
glPopMatrix();
if( texture )
{
capTexture->unbind();
}
}
void CubeEffect::postPaintScreen()
{
effects->postPaintScreen();
@ -1065,6 +1273,8 @@ void CubeEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int
{
if( cube_painting )
{
if( mode == Cylinder || mode == Sphere )
data.quads = data.quads.makeGrid( 40 );
if( ( w->isDesktop() || w->isDock() ) && w->screen() != activeScreen && w->isOnDesktop( effects->currentDesktop() ) )
{
windowsOnOtherScreens.append( w );
@ -1156,6 +1366,25 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP
{
if( activated && cube_painting )
{
if( mode == Cylinder )
{
cylinderShader->bind();
cylinderShader->setUniform( "windowWidth", (float)w->width() );
cylinderShader->setUniform( "windowHeight", (float)w->height() );
cylinderShader->setUniform( "xCoord", (float)w->x() );
cylinderShader->setUniform( "cubeAngle", (effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f );
data.shader = cylinderShader;
}
if( mode == Sphere )
{
sphereShader->bind();
sphereShader->setUniform( "windowWidth", (float)w->width() );
sphereShader->setUniform( "windowHeight", (float)w->height() );
sphereShader->setUniform( "xCoord", (float)w->x() );
sphereShader->setUniform( "yCoord", (float)w->y() );
sphereShader->setUniform( "cubeAngle", (effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f );
data.shader = sphereShader;
}
//kDebug(1212) << w->caption();
float opacity = cubeOpacity;
if( start )
@ -1319,26 +1548,82 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP
}
}
effects->paintWindow( w, mask, region, data );
if( activated && cube_painting )
{
if( mode == Cylinder )
cylinderShader->unbind();
if( mode == Sphere )
sphereShader->unbind();
}
}
bool CubeEffect::borderActivated( ElectricBorder border )
{
if( border != borderActivate )
if( border != borderActivate && border != borderActivateCylinder && border != borderActivateSphere )
return false;
if( effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this )
return true;
return false;
kDebug(1212) << "border activated";
toggle();
if( border == borderActivate )
{
if( !activated || ( activated && mode == Cube ) )
toggleCube();
else
return false;
}
if( border == borderActivateCylinder )
{
if( !activated || ( activated && mode == Cylinder ) )
toggleCylinder();
else
return false;
}
if( border == borderActivateSphere )
{
if( !activated || ( activated && mode == Sphere ) )
toggleSphere();
else
return false;
}
return true;
}
void CubeEffect::toggle()
void CubeEffect::toggleCube()
{
kDebug(1212) << "toggle cube";
toggle( Cube );
}
void CubeEffect::toggleCylinder()
{
kDebug(1212) << "toggle cylinder";
if( !useShaders )
useShaders = loadShader();
if( useShaders )
toggle( Cylinder );
else
kError( 1212 ) << "Sorry shaders are not available - cannot activate Cylinder";
}
void CubeEffect::toggleSphere()
{
kDebug(1212) << "toggle sphere";
if( !useShaders )
useShaders = loadShader();
if( useShaders )
toggle( Sphere );
else
kError( 1212 ) << "Sorry shaders are not available - cannot activate Sphere";
}
void CubeEffect::toggle( CubeMode newMode )
{
if( ( effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this ) ||
effects->numberOfDesktops() < 2 )
return;
if( !activated )
{
mode = newMode;
setActive( true );
}
else
@ -1653,16 +1938,7 @@ void CubeEffect::setActive( bool active )
recompileList = true;
// create the capList
if( paintCaps )
{
QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop());
if( effects->numScreens() > 1 && bigCube )
rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() );
float cubeAngle = (float)((float)(effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f);
float point = rect.width()/2*tan(cubeAngle*0.5f*M_PI/180.0f);
float zTexture = rect.width()/2*tan(45.0f*M_PI/180.0f);
paintCap( point, zTexture );
}
paintCap();
effects->addRepaintFull();
}
else

View File

@ -53,9 +53,11 @@ class CubeEffect
virtual void tabBoxClosed();
static bool supported();
protected slots:
void toggle();
protected:
private slots:
void toggleCube();
void toggleCylinder();
void toggleSphere();
private:
enum RotationDirection
{
Left,
@ -69,9 +71,19 @@ class CubeEffect
Normal,
Down
};
virtual void paintCube( int mask, QRegion region, ScreenPaintData& data );
virtual void paintCap( float z, float zTexture );
virtual void paintCapStep( float z, float zTexture, bool texture );
enum CubeMode
{
Cube,
Cylinder,
Sphere
};
void toggle( CubeMode newMode = Cube );
void paintCube( int mask, QRegion region, ScreenPaintData& data );
void paintCap();
void paintCubeCap();
void paintCylinderCap();
void paintSphereCap();
bool loadShader();
void loadConfig( QString config );
void rotateCube();
void rotateToDesktop( int desktop );
@ -82,6 +94,8 @@ class CubeEffect
bool keyboard_grab;
bool schedule_close;
ElectricBorder borderActivate;
ElectricBorder borderActivateCylinder;
ElectricBorder borderActivateSphere;
int painting_desktop;
Window input;
int frontDesktop;
@ -124,6 +138,11 @@ class CubeEffect
bool invertMouse;
bool tabBoxMode;
bool shortcutsRegistered;
CubeMode mode;
bool useShaders;
GLShader* cylinderShader;
GLShader* sphereShader;
float capDeformationFactor;
// GL lists
bool capListCreated;

View File

@ -58,10 +58,18 @@ CubeEffectConfig::CubeEffectConfig(QWidget* parent, const QVariantList& args) :
m_actionCollection->setConfigGroup( "Cube" );
m_actionCollection->setConfigGlobal(true);
KAction* a = (KAction*) m_actionCollection->addAction( "Cube" );
a->setText( i18n("Desktop Cube" ));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::Key_F11 ));
KAction* cubeAction = (KAction*) m_actionCollection->addAction( "Cube" );
cubeAction->setText( i18n("Desktop Cube" ));
cubeAction->setProperty("isConfigurationAction", true);
cubeAction->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::Key_F11 ));
KAction* cylinderAction = (KAction*) m_actionCollection->addAction( "Cylinder" );
cylinderAction->setText( i18n("Desktop Cylinder" ));
cylinderAction->setProperty("isConfigurationAction", true);
cylinderAction->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_F11 ));
KAction* sphereAction = (KAction*) m_actionCollection->addAction( "Sphere" );
sphereAction->setText( i18n("Desktop Sphere" ));
sphereAction->setProperty("isConfigurationAction", true);
sphereAction->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::META + Qt::Key_F11 ));
m_ui->editor->addCollection(m_actionCollection);
@ -85,6 +93,7 @@ CubeEffectConfig::CubeEffectConfig(QWidget* parent, const QVariantList& args) :
connect(m_ui->walkThroughDesktopBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
connect(m_ui->invertKeysBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
connect(m_ui->invertMouseBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
connect(m_ui->capDeformationSlider, SIGNAL(valueChanged(int)), this, SLOT(changed()));
load();
}
@ -111,7 +120,8 @@ void CubeEffectConfig::load()
m_ui->wallpaperRequester->setPath( conf.readEntry( "Wallpaper", "" ) );
bool invertKeys = conf.readEntry( "InvertKeys", false );
bool invertMouse = conf.readEntry( "InvertMouse", false );
m_ui->capDeformationSlider->setValue( conf.readEntry( "CapDeformation", 0 ) );
m_ui->rotationDurationSpin->setValue( duration );
m_ui->cubeOpacitySlider->setValue( opacity );
m_ui->cubeOpacitySpin->setValue( opacity );
@ -201,6 +211,7 @@ void CubeEffectConfig::save()
conf.writeEntry( "TabBox", m_ui->walkThroughDesktopBox->checkState() == Qt::Checked ? true : false );
conf.writeEntry( "InvertKeys", m_ui->invertKeysBox->isChecked() );
conf.writeEntry( "InvertMouse", m_ui->invertMouseBox->isChecked() );
conf.writeEntry( "CapDeformation", m_ui->capDeformationSlider->value() );
m_ui->editor->save();
@ -229,6 +240,7 @@ void CubeEffectConfig::defaults()
m_ui->walkThroughDesktopBox->setCheckState( Qt::Unchecked );
m_ui->invertKeysBox->setChecked( false );
m_ui->invertMouseBox->setChecked( false );
m_ui->capDeformationSlider->setValue( 0 );
m_ui->editor->allDefault();
emit changed(true);
}

View File

@ -446,6 +446,48 @@ otherwise it will remain active</string>
</layout>
</widget>
</item>
<item row="3" column="0" colspan="2" >
<widget class="QGroupBox" name="capDeformationGroupBox" >
<property name="title" >
<string>Sphere Cap Deformation</string>
</property>
<layout class="QGridLayout" name="gridLayout_9" >
<item row="0" column="0" colspan="2" >
<widget class="QSlider" name="capDeformationSlider" >
<property name="maximum" >
<number>100</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition" >
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval" >
<number>25</number>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="capDeformationSphereLabel" >
<property name="text" >
<string>Sphere</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLabel" name="capDeformationPlaneLabel" >
<property name="text" >
<string>Plane</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>

View File

@ -1,215 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2008 Martin Gräßlin <ubuntu@martin-graesslin.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "cube.h"
#include "cylinder.h"
#include <kdebug.h>
#include <KStandardDirs>
#include <math.h>
#include <GL/gl.h>
namespace KWin
{
KWIN_EFFECT( cylinder, CylinderEffect )
KWIN_EFFECT_SUPPORTED( cylinder, CylinderEffect::supported() )
CylinderEffect::CylinderEffect()
: CubeEffect()
, mInited( false )
, mValid( true )
, mShader( 0 )
{
shortcutsRegistered = false;
reconfigure( ReconfigureAll );
}
CylinderEffect::~CylinderEffect()
{
delete mShader;
}
void CylinderEffect::reconfigure( ReconfigureFlags )
{
loadConfig( "Cylinder" );
}
bool CylinderEffect::supported()
{
return GLShader::fragmentShaderSupported() &&
(effects->compositingType() == OpenGLCompositing);
}
bool CylinderEffect::loadData()
{
mInited = true;
QString fragmentshader = KGlobal::dirs()->findResource("data", "kwin/cylinder.frag");
QString vertexshader = KGlobal::dirs()->findResource("data", "kwin/cylinder.vert");
if(fragmentshader.isEmpty() || vertexshader.isEmpty())
{
kError(1212) << "Couldn't locate shader files" << endl;
return false;
}
mShader = new GLShader(vertexshader, fragmentshader);
if(!mShader->isValid())
{
kError(1212) << "The shader failed to load!" << endl;
return false;
}
else
{
mShader->bind();
mShader->setUniform( "winTexture", 0 );
mShader->setUniform( "opacity", cubeOpacity );
QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop());
if( effects->numScreens() > 1 && bigCube )
rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() );
mShader->setUniform( "width", (float)rect.width() );
mShader->unbind();
}
return true;
}
void CylinderEffect::paintCube( int mask, QRegion region, ScreenPaintData& data )
{
glPushMatrix();
QRect rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop());
float cubeAngle = (effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f;
float radian = (cubeAngle*0.5)*M_PI/180;
// height of the triangle compound of one side of the cube and the two bisecting lines
float midpoint = rect.width()*0.5*tan(radian);
// radius of the circle
float radius = (rect.width()*0.5)/cos(radian);
glTranslatef( 0.0, 0.0, midpoint - radius );
CubeEffect::paintCube( mask, region, data );
glPopMatrix();
}
void CylinderEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time )
{
if( activated )
{
if( cube_painting )
{
if( w->isOnDesktop( painting_desktop ))
{
data.quads = data.quads.makeGrid( 40 );
QRect rect = effects->clientArea( FullArea, activeScreen, painting_desktop );
if( w->x() < rect.width()/2 && w->x() + w->width() > rect.width()/ 2 )
data.quads = data.quads.splitAtX( rect.width()/2 - w->x() );
w->enablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP );
}
else
{
w->disablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP );
}
}
}
effects->prePaintWindow( w, data, time );
}
void CylinderEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data )
{
if( activated && cube_painting )
{
if( mValid && !mInited )
mValid = loadData();
bool useShader = mValid;
if( useShader )
{
mShader->bind();
mShader->setUniform( "windowWidth", (float)w->width() );
mShader->setUniform( "windowHeight", (float)w->height() );
mShader->setUniform( "xCoord", (float)w->x() );
mShader->setUniform( "cubeAngle", (effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f );
data.shader = mShader;
}
CubeEffect::paintWindow( w, mask, region, data );
if( useShader )
{
mShader->unbind();
}
}
else
effects->paintWindow( w, mask, region, data );
}
void CylinderEffect::paintCap( float z, float zTexture )
{
if( ( !paintCaps ) || effects->numberOfDesktops() <= 2 )
return;
CubeEffect::paintCap( z, zTexture );
QRect rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() );
float cubeAngle = (effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f;
float radian = (cubeAngle*0.5)*M_PI/180;
// height of the triangle compound of one side of the cube and the two bisecting lines
float midpoint = rect.width()*0.5*tan(radian);
// radius of the circle
float radius = (rect.width()*0.5)/cos(radian);
// paint round part of the cap
glPushMatrix();
float zTranslate = zPosition + zoom;
if( start )
zTranslate *= timeLine.value();
if( stop )
zTranslate *= ( 1.0 - timeLine.value() );
glTranslatef( 0.0, 0.0, -zTranslate );
float triangleWidth = 40.0;
for( int i=0; i<effects->numberOfDesktops(); i++ )
{
glPushMatrix();
glTranslatef( rect.width()/2, 0.0, -z );
glRotatef( i*(360.0f/effects->numberOfDesktops()), 0.0, 1.0, 0.0 );
glTranslatef( -rect.width()/2, 0.0, z );
glBegin( GL_TRIANGLE_STRIP );
for( int j=0; j<rect.width()/triangleWidth; j++ )
{
float zValue = 0.0;
// distance from midpoint of desktop to x coord
// calculation is same as in shader -> see comments
float distance = rect.width()*0.5 - (j*triangleWidth);
if( (j*triangleWidth) > rect.width()*0.5 )
{
distance = (j*triangleWidth) - rect.width()*0.5;
}
// distance in correct format
float angle = acos( distance/radius );
float h = radius;
// if distance == 0 -> angle=90 -> tan(90) singularity
if( distance != 0.0 )
h = tan( angle ) * distance;
zValue = h - midpoint;
glVertex3f( j*triangleWidth, 0.0, zValue );
glVertex3f( (j+1)*triangleWidth, 0.0, 0.0 );
}
glEnd();
glPopMatrix();
}
glPopMatrix();
}
} // namespace

View File

@ -1,126 +0,0 @@
[Desktop Entry]
Name=Desktop Cylinder
Name[ar]=أسطوانة سطح المكتب
Name[be@latin]=Rabočy cylinder
Name[bg]=Цилиндричен работен плот
Name[bn]=ডেস্কটপ সিলিন্ডার
Name[bn_IN]=ডেস্কটপ সিলিন্ডার
Name[ca]=Cilindre d'escriptori
Name[ca@valencia]=Cilindre d'escriptori
Name[csb]=Cylinder pùltu
Name[da]=Desktop-cylinder
Name[de]=Arbeitsflächen-Zylinder
Name[el]=Κύλινδρος επιφάνειας εργασίας
Name[es]=Cilindro de escritorio
Name[et]=Töölauasilinder
Name[eu]=Mahaigain-zilindroa
Name[fi]=Työpöytäsylinteri
Name[fr]=Bureau en cylindre
Name[fy]=Buroblêdsilinder
Name[gl]=Escritorio cilíndrico
Name[gu]=ડેસ્કટોપ સિલિન્ડર
Name[he]=שולחן עבודה בצילינדר
Name[hi]=डेस्कटॉप बेलन
Name[is]=Skjáborðssúla
Name[it]=Cilindro desktop
Name[ja]=デスクトップシリンダー
Name[kk]=Үстел цилиндірі
Name[km]=ស៊ីឡាំង​ផ្ទៃតុ
Name[kn]=ಗಣಕತೆರೆ ಹೊರಳು (ಸಿಲಿಂಡರ್)
Name[ko]=데스크톱 실린더
Name[ku]=Sermase ya Gundorkî
Name[lt]=Darbastalio cilindras
Name[lv]=Darbvirsmas cilindrs
Name[mk]=Работен цилиндар
Name[ml]=പണിയിടം ഗോളസ്തംഭം
Name[mr]=डेस्कटॉप सिलींडर
Name[nb]=Skrivebordssylinder
Name[nds]=Zylinner-Schriefdisch
Name[nl]=Bureaubladcilinder
Name[nn]=Skrivebordsylinder
Name[pa]=ਡੈਸਕਟਾਪ ਸਿਲੰਡਰ
Name[pl]=Cylinder pulpitu
Name[pt]=Cilindro de Ecrãs
Name[pt_BR]=Cilindro da área de trabalho
Name[ro]=Cilindru de birou
Name[sk]=Plocha valec
Name[sl]=Valj z namizji
Name[sr]=Ваљак површи
Name[sr@latin]=Valjak površi
Name[sv]=Skrivbordscylinder
Name[ta]=மேல்மேசை உருளி
Name[te]=డెస్‍క్ టాప్ సిలెండర్
Name[th]=พื้นที่ทำงานทรงกระบอก
Name[tr]=Masaüstü Silindiri
Name[uk]=Циліндр стільниць
Name[wa]=Cilinde di scribannes
Name[x-test]=xxDesktop Cylinderxx
Name[zh_CN]=桌面圆柱
Name[zh_TW]=桌面圓柱
Icon=preferences-system-windows-effect-cylinder
Comment=Display each virtual desktop on the side of a cylinder
Comment[ar]=تعرض كل سطح مكتب افتراضي على جانب من جوانب الأسطوانة
Comment[be@latin]=Pakazvaje virtualnyja rabočyja stały na baku cylindra
Comment[bg]=Всеки виртуален работен плот се показва като част от цилиндър
Comment[bn]=প্রত্যেকটি ভার্চুয়াল ডেস্কটপ একটি সিলিণ্ডার-এর ধারে দেখাও
Comment[bn_IN]=প্রত্যেকটি ভার্চুয়াল ডেস্কটপ একটি সিলিণ্ডার-এর ধারে দেখাও
Comment[ca]=Visualitza cada escriptori virtual a la cara d'un cilindre
Comment[ca@valencia]=Visualitza cada escriptori virtual a la cara d'un cilindre
Comment[da]=Vis hver virtuel desktop på en side af en cylinder
Comment[de]=Zeigt jede virtuelle Arbeitsfläche auf einer Zylinderseite an.
Comment[el]=Εμφάνιση κάθε εικονικής επιφάνειας εργασίας στην πλευρά ενός κυλίνδρου
Comment[es]=Mostrar cada escritorio virtual en un lado de un cilindro
Comment[et]=Virtuaalsete töölaudade asetamine silindrile
Comment[eu]=Erakutsi laneko area bakoitza zilindroaren alde batean
Comment[fr]=Affiche chaque bureau virtuel sur la face d'un cylindre
Comment[fy]=Elts firtueel buroblêd op in side fan in silinder sjen litte
Comment[gl]=Mostra cada escritorios virtual a un lado dun cilindro
Comment[gu]=સિલિન્ડરની બાજુઓ પર વર્ચ્યુઅલ ડેસ્કટોપ બતાવે છે
Comment[he]=הצג כל שולחן עבודה וירטואלי בצד של צילינדר
Comment[hi]=बेलन के हर बाजू पर आभासी डेस्कटॉप दिखाएँ
Comment[is]=Sýnir hvert sýndarskjáborð á sinni hlið súlu
Comment[it]=Mostra ogni desktop virtuale sul lato di un cilindro
Comment[ja]=仮想デスクトップをシリンダーの側面に表示します
Comment[kk]=Әрбір виртуалды үстелді цилиндрдің бүйірінде көрсету
Comment[km]=បង្ហាញ​ផ្ទៃតុ​និម្មិត​នីមួយៗ​នៅ​លើ​ស៊ីឡាំង
Comment[kn]=ಪ್ರತಿ ವಾಸ್ತವಪ್ರಾಯ (ವರ್ಚುಯಲ್) ಗಣಕತೆರೆಗಯನ್ನೂ ಹೊರಳು (ಸಿಲಿಂಡರ್) ನ ಬದಿಗಳ ಮೇಲೆ ತೋರಿಸು
Comment[ko]=실린더의 각각 면에 가상 데스크톱을 표시합니다
Comment[ku]=Her sermase ya farazî di rexê gundor de nîşan bide
Comment[lt]=Rodo kiekvieną virtualų darbastalį ant cilindro šono
Comment[lv]=Rāda visas virtuālās darbvirsmas uz cilindra malas
Comment[mk]=Ги прикажува виртуелните работни површини на страниците на цилиндар
Comment[ml]=ഓരോ വര്‍ച്ചുവല്‍ പണിയിടവും ഓരോ ഗോളസ്തംഭത്തിന്റെ വശത്തായ് കാണിക്കുക
Comment[mr]=सिलींडरच्या बाजूला प्रत्येक आभासी डेस्कटॉप दर्शवा
Comment[nb]=Avbild virtuelle skrivebord på en sylinder
Comment[nds]=Elkeen Schriefdisch op en Zylinnersiet wiesen
Comment[nl]=Toont elk virtueel bureaublad als zijde van een cilinder
Comment[pa]=ਸਿਲੰਡਰ ਦੀ ਸਾਈਡ ਉੱਤੇ ਹਰੇਕ ਵੁਰਚੁਅਲ ਡੈਸਕਟਾਪ ਵੇਖੋ
Comment[pl]=Pokazanie każdego wirtualnego pulpitu na innej ścianie cylindra
Comment[pt]=Mostrar cada ecrã virtual como uma face de um cilindro
Comment[pt_BR]=Mostra cada área de trabalho virtual em um lado de um cilindro
Comment[ro]=Afișează fiecare birou virtual pe fața unui cilindru
Comment[sk]=Zobrazí virtuálne plochy na stranách valca
Comment[sl]=Vsako navidezno namizje prikaže na plašču valja
Comment[sr]=Пресликава виртуелне површи на омотач цилиндра
Comment[sr@latin]=Preslikava virtuelne površi na omotač cilindra
Comment[sv]=Visar varje virtuellt skrivbord på sidan av en cylinder
Comment[th]=แสดงแต่ละพื้นที่ทำงานเสมือนบนด้านข้างของทรงกระบอก
Comment[tr]=Sanal masaüstlerini bir silindirin yanı olarak göster
Comment[uk]=Показувати всі стільниці на поверхні циліндра
Comment[wa]=Håyene tchaeke forveyou scribanne sol costé d' on cilinde
Comment[x-test]=xxDisplay each virtual desktop on the side of a cylinderxx
Comment[zh_CN]=在一排圆柱体中显示各虚拟桌面
Comment[zh_TW]=將虛擬桌面顯示在圓柱的邊邊
Type=Service
X-KDE-ServiceTypes=KWin/Effect
X-KDE-PluginInfo-Author=Martin Gräßlin
X-KDE-PluginInfo-Email=ubuntu@martin-graesslin.com
X-KDE-PluginInfo-Name=kwin4_effect_cylinder
X-KDE-PluginInfo-Version=0.1.0
X-KDE-PluginInfo-Category=Window Management
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=false
X-KDE-Library=kwin4_effect_builtins
X-KDE-Ordering=50

View File

@ -1,53 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2008 Martin Gräßlin <ubuntu@martin-graesslin.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#ifndef KWIN_CYLINDER_H
#define KWIN_CYLINDER_H
#include <kwineffects.h>
#include <kwinglutils.h>
namespace KWin
{
class CylinderEffect
: public CubeEffect
{
public:
CylinderEffect();
~CylinderEffect();
virtual void reconfigure( ReconfigureFlags );
virtual void prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time );
virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data );
static bool supported();
protected:
virtual void paintCube( int mask, QRegion region, ScreenPaintData& data );
virtual void paintCap( float z, float zTexture );
private:
bool loadData();
bool mInited;
bool mValid;
GLShader* mShader;
};
} // namespace
#endif

View File

@ -1,246 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2008 Martin Gräßlin <ubuntu@martin-graesslin.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "cylinder_config.h"
#include <kwineffects.h>
#include <kconfiggroup.h>
#include <kcolorscheme.h>
#include <KActionCollection>
#include <kaction.h>
#include <KFileDialog>
#include <KImageFilePreview>
#include <QVBoxLayout>
#include <QColor>
namespace KWin
{
KWIN_EFFECT_CONFIG_FACTORY
CylinderEffectConfigForm::CylinderEffectConfigForm(QWidget* parent) : QWidget(parent)
{
setupUi(this);
}
CylinderEffectConfig::CylinderEffectConfig(QWidget* parent, const QVariantList& args) :
KCModule(EffectFactory::componentData(), parent, args)
{
m_ui = new CylinderEffectConfigForm(this);
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(m_ui, 0, 0);
m_ui->tabWidget->setTabText( 0, i18nc("@title:tab Basic Settings", "Basic") );
m_ui->tabWidget->setTabText( 1, i18nc("@title:tab Advanced Settings", "Advanced") );
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection( this, KComponentData("kwin") );
m_actionCollection->setConfigGroup( "Cylinder" );
m_actionCollection->setConfigGlobal(true);
KAction* a = (KAction*) m_actionCollection->addAction( "Cylinder" );
a->setText( i18n("Desktop Cylinder" ));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_F11 ));
m_ui->editor->addCollection(m_actionCollection);
connect(m_ui->rotationDurationSpin, SIGNAL(valueChanged(int)), this, SLOT(changed()));
connect(m_ui->cubeOpacitySlider, SIGNAL(valueChanged(int)), this, SLOT(changed()));
connect(m_ui->cubeOpacitySpin, SIGNAL(valueChanged(int)), this, SLOT(changed()));
connect(m_ui->desktopOpacityOnlyBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
connect(m_ui->displayDesktopNameBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
connect(m_ui->reflectionBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
connect(m_ui->backgroundColorButton, SIGNAL(changed(QColor)), this, SLOT(changed()));
connect(m_ui->cubeCapsBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
connect(m_ui->cubeCapsBox, SIGNAL(stateChanged(int)), this, SLOT(capsSelectionChanged()));
connect(m_ui->capsImageBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
connect(m_ui->capColorButton, SIGNAL(changed(QColor)), this, SLOT(changed()));
connect(m_ui->wallpaperRequester, SIGNAL(textChanged(QString)), this, SLOT(changed()));
connect(m_ui->closeOnMouseReleaseBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
connect(m_ui->zPositionSlider, SIGNAL(valueChanged(int)), this, SLOT(changed()));
connect(m_ui->walkThroughDesktopBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
connect(m_ui->invertKeysBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
connect(m_ui->invertMouseBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
load();
}
void CylinderEffectConfig::load()
{
KCModule::load();
KConfigGroup conf = EffectsHandler::effectConfig( "Cylinder" );
int duration = conf.readEntry( "RotationDuration", 0 );
float opacity = conf.readEntry( "Opacity", 80 );
bool desktopOpacityOnly = conf.readEntry( "OpacityDesktopOnly", false );
bool desktopName = conf.readEntry( "DisplayDesktopName", true );
bool reflection = conf.readEntry( "Reflection", true );
QColor background = conf.readEntry( "BackgroundColor", QColor( Qt::black ) );
QColor capColor = conf.readEntry( "CapColor", KColorScheme( QPalette::Active, KColorScheme::Window ).background().color() );
bool texturedCaps = conf.readEntry( "TexturedCaps", true );
bool caps = conf.readEntry( "Caps", true );
bool closeOnMouseRelease = conf.readEntry( "CloseOnMouseRelease", false );
bool walkThroughDesktop = conf.readEntry( "TabBox", false );
m_ui->zPositionSlider->setValue( conf.readEntry( "ZPosition", 100 ) );
m_ui->wallpaperRequester->setPath( conf.readEntry( "Wallpaper", "" ) );
bool invertKeys = conf.readEntry( "InvertKeys", false );
bool invertMouse = conf.readEntry( "InvertMouse", false );
m_ui->rotationDurationSpin->setValue( duration );
m_ui->cubeOpacitySlider->setValue( opacity );
m_ui->cubeOpacitySpin->setValue( opacity );
m_ui->desktopOpacityOnlyBox->setChecked( desktopOpacityOnly );
if( desktopName )
{
m_ui->displayDesktopNameBox->setCheckState( Qt::Checked );
}
else
{
m_ui->displayDesktopNameBox->setCheckState( Qt::Unchecked );
}
if( reflection )
{
m_ui->reflectionBox->setCheckState( Qt::Checked );
}
else
{
m_ui->reflectionBox->setCheckState( Qt::Unchecked );
}
if( caps )
{
m_ui->cubeCapsBox->setCheckState( Qt::Checked );
}
else
{
m_ui->cubeCapsBox->setCheckState( Qt::Unchecked );
}
if( texturedCaps )
{
m_ui->capsImageBox->setCheckState( Qt::Checked );
}
else
{
m_ui->capsImageBox->setCheckState( Qt::Unchecked );
}
if( closeOnMouseRelease )
{
m_ui->closeOnMouseReleaseBox->setCheckState( Qt::Checked );
}
else
{
m_ui->closeOnMouseReleaseBox->setCheckState( Qt::Unchecked );
}
if( walkThroughDesktop )
{
m_ui->walkThroughDesktopBox->setCheckState( Qt::Checked );
}
else
{
m_ui->walkThroughDesktopBox->setCheckState( Qt::Unchecked );
}
m_ui->backgroundColorButton->setColor( background );
m_ui->capColorButton->setColor( capColor );
m_ui->invertKeysBox->setChecked( invertKeys );
m_ui->invertMouseBox->setChecked( invertMouse );
capsSelectionChanged();
emit changed(false);
}
void CylinderEffectConfig::save()
{
KConfigGroup conf = EffectsHandler::effectConfig( "Cylinder" );
conf.writeEntry( "RotationDuration", m_ui->rotationDurationSpin->value() );
conf.writeEntry( "DisplayDesktopName", m_ui->displayDesktopNameBox->checkState() == Qt::Checked ? true : false );
conf.writeEntry( "Reflection", m_ui->reflectionBox->checkState() == Qt::Checked ? true : false );
conf.writeEntry( "Opacity", m_ui->cubeOpacitySpin->value() );
conf.writeEntry( "OpacityDesktopOnly", m_ui->desktopOpacityOnlyBox->isChecked() );
conf.writeEntry( "BackgroundColor", m_ui->backgroundColorButton->color() );
conf.writeEntry( "Caps", m_ui->cubeCapsBox->checkState() == Qt::Checked ? true : false );
conf.writeEntry( "CapColor", m_ui->capColorButton->color() );
conf.writeEntry( "TexturedCaps", m_ui->capsImageBox->checkState() == Qt::Checked ? true : false );
conf.writeEntry( "CloseOnMouseRelease", m_ui->closeOnMouseReleaseBox->checkState() == Qt::Checked ? true : false );
conf.writeEntry( "Wallpaper", m_ui->wallpaperRequester->url().path() );
conf.writeEntry( "ZPosition", m_ui->zPositionSlider->value() );
conf.writeEntry( "TabBox", m_ui->walkThroughDesktopBox->checkState() == Qt::Checked ? true : false );
conf.writeEntry( "InvertKeys", m_ui->invertKeysBox->isChecked() );
conf.writeEntry( "InvertMouse", m_ui->invertMouseBox->isChecked() );
m_ui->editor->save();
conf.sync();
emit changed(false);
EffectsHandler::sendReloadMessage( "cylinder" );
}
void CylinderEffectConfig::defaults()
{
m_ui->rotationDurationSpin->setValue( 0 );
m_ui->displayDesktopNameBox->setCheckState( Qt::Checked );
m_ui->reflectionBox->setCheckState( Qt::Checked );
m_ui->cubeOpacitySpin->setValue( 80 );
m_ui->cubeOpacitySlider->setValue( 80 );
m_ui->desktopOpacityOnlyBox->setChecked( false );
m_ui->backgroundColorButton->setColor( QColor( Qt::black ) );
m_ui->cubeCapsBox->setCheckState( Qt::Checked );
m_ui->capColorButton->setColor( KColorScheme( QPalette::Active, KColorScheme::Window ).background().color() );
m_ui->capsImageBox->setCheckState( Qt::Checked );
m_ui->closeOnMouseReleaseBox->setCheckState( Qt::Unchecked );
m_ui->wallpaperRequester->setPath( "" );
m_ui->zPositionSlider->setValue( 100 );
m_ui->walkThroughDesktopBox->setCheckState( Qt::Unchecked );
m_ui->invertKeysBox->setChecked( false );
m_ui->invertMouseBox->setChecked( false );
m_ui->editor->allDefault();
emit changed(true);
}
void CylinderEffectConfig::capsSelectionChanged()
{
if( m_ui->cubeCapsBox->checkState() == Qt::Checked )
{
// activate cap color
m_ui->capColorButton->setEnabled( true );
m_ui->capColorLabel->setEnabled( true );
m_ui->capsImageBox->setEnabled( true );
}
else
{
// deactivate cap color
m_ui->capColorButton->setEnabled( false );
m_ui->capColorLabel->setEnabled( false );
m_ui->capsImageBox->setEnabled( false );
}
}
} // namespace
#include "cylinder_config.moc"

View File

@ -1,66 +0,0 @@
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KCModule
X-KDE-Library=kcm_kwin4_effect_builtins
X-KDE-ParentComponents=kwin4_effect_cylinder
X-KDE-PluginKeyword=cylinder
Name=Desktop Cylinder
Name[ar]=أسطوانة سطح المكتب
Name[be@latin]=Rabočy cylinder
Name[bg]=Цилиндричен работен плот
Name[bn]=ডেস্কটপ সিলিন্ডার
Name[bn_IN]=ডেস্কটপ সিলিন্ডার
Name[ca]=Cilindre d'escriptori
Name[ca@valencia]=Cilindre d'escriptori
Name[csb]=Cylinder pùltu
Name[da]=Desktop-cylinder
Name[de]=Arbeitsflächen-Zylinder
Name[el]=Κύλινδρος επιφάνειας εργασίας
Name[es]=Cilindro de escritorio
Name[et]=Töölauasilinder
Name[eu]=Mahaigain-zilindroa
Name[fi]=Työpöytäsylinteri
Name[fr]=Bureau en cylindre
Name[fy]=Buroblêdsilinder
Name[gl]=Escritorio cilíndrico
Name[gu]=ડેસ્કટોપ સિલિન્ડર
Name[he]=שולחן עבודה בצילינדר
Name[hi]=डेस्कटॉप बेलन
Name[is]=Skjáborðssúla
Name[it]=Cilindro desktop
Name[ja]=デスクトップシリンダー
Name[kk]=Үстел цилиндірі
Name[km]=ស៊ីឡាំង​ផ្ទៃតុ
Name[kn]=ಗಣಕತೆರೆ ಹೊರಳು (ಸಿಲಿಂಡರ್)
Name[ko]=데스크톱 실린더
Name[ku]=Sermase ya Gundorkî
Name[lt]=Darbastalio cilindras
Name[lv]=Darbvirsmas cilindrs
Name[mk]=Работен цилиндар
Name[ml]=പണിയിടം ഗോളസ്തംഭം
Name[mr]=डेस्कटॉप सिलींडर
Name[nb]=Skrivebordssylinder
Name[nds]=Zylinner-Schriefdisch
Name[nl]=Bureaubladcilinder
Name[nn]=Skrivebordsylinder
Name[pa]=ਡੈਸਕਟਾਪ ਸਿਲੰਡਰ
Name[pl]=Cylinder pulpitu
Name[pt]=Cilindro de Ecrãs
Name[pt_BR]=Cilindro da área de trabalho
Name[ro]=Cilindru de birou
Name[sk]=Plocha valec
Name[sl]=Valj z namizji
Name[sr]=Ваљак површи
Name[sr@latin]=Valjak površi
Name[sv]=Skrivbordscylinder
Name[ta]=மேல்மேசை உருளி
Name[te]=డెస్‍క్ టాప్ సిలెండర్
Name[th]=พื้นที่ทำงานทรงกระบอก
Name[tr]=Masaüstü Silindiri
Name[uk]=Циліндр стільниць
Name[wa]=Cilinde di scribannes
Name[x-test]=xxDesktop Cylinderxx
Name[zh_CN]=桌面圆柱
Name[zh_TW]=桌面圓柱

View File

@ -1,60 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2008 Martin Gräßlin <ubuntu@martin-graesslin.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#ifndef KWIN_CYLINDER_CONFIG_H
#define KWIN_CYLINDER_CONFIG_H
#include <kcmodule.h>
#include "ui_cylinder_config.h"
class KFileDialog;
namespace KWin
{
class CylinderEffectConfigForm : public QWidget, public Ui::CylinderEffectConfigForm
{
Q_OBJECT
public:
explicit CylinderEffectConfigForm(QWidget* parent);
};
class CylinderEffectConfig : public KCModule
{
Q_OBJECT
public:
explicit CylinderEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList());
public slots:
virtual void save();
virtual void load();
virtual void defaults();
private slots:
void capsSelectionChanged();
private:
CylinderEffectConfigForm* m_ui;
KActionCollection* m_actionCollection;
};
} // namespace
#endif

View File

@ -1,517 +0,0 @@
<ui version="4.0" >
<class>KWin::CylinderEffectConfigForm</class>
<widget class="QWidget" name="KWin::CylinderEffectConfigForm" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>729</width>
<height>542</height>
</rect>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QTabWidget" name="tabWidget" >
<property name="currentIndex" >
<number>0</number>
</property>
<widget class="QWidget" name="tab" >
<attribute name="title" >
<string>Tab 1</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_5" >
<item row="1" column="1" >
<widget class="QGroupBox" name="groupBox_5" >
<property name="title" >
<string>Background</string>
</property>
<layout class="QGridLayout" name="gridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label_6" >
<property name="text" >
<string>Background color:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<cstring>backgroundColorButton</cstring>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="KColorButton" name="backgroundColorButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Wallpaper:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<cstring>wallpaperRequester</cstring>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="KUrlRequester" name="wallpaperRequester" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0" colspan="2" >
<widget class="QGroupBox" name="groupBox_8" >
<property name="title" >
<string>Activation</string>
</property>
<layout class="QGridLayout" name="gridLayout_3" >
<item row="0" column="0" colspan="2" >
<widget class="KWin::GlobalShortcutsEditor" native="1" name="editor" >
<property name="minimumSize" >
<size>
<width>0</width>
<height>200</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item rowspan="2" row="0" column="0" >
<widget class="QGroupBox" name="groupBox_7" >
<property name="title" >
<string>Appearance</string>
</property>
<layout class="QGridLayout" name="gridLayout_2" >
<item row="0" column="0" colspan="2" >
<widget class="QCheckBox" name="displayDesktopNameBox" >
<property name="text" >
<string>Display desktop name</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2" >
<widget class="QCheckBox" name="reflectionBox" >
<property name="text" >
<string>Reflection</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Rotation duration:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<cstring>rotationDurationSpin</cstring>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QSpinBox" name="rotationDurationSpin" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="specialValueText" >
<string comment="Duration of rotation" >Default</string>
</property>
<property name="suffix" >
<string> msec</string>
</property>
<property name="maximum" >
<number>5000</number>
</property>
<property name="singleStep" >
<number>10</number>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2" >
<spacer name="verticalSpacer_2" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="0" column="1" >
<widget class="QGroupBox" name="groupBox_4" >
<property name="title" >
<string>Opacity</string>
</property>
<layout class="QGridLayout" name="gridLayout_6" >
<item row="1" column="0" colspan="2" >
<widget class="QSlider" name="cubeOpacitySlider" >
<property name="minimumSize" >
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="maximum" >
<number>100</number>
</property>
<property name="singleStep" >
<number>1</number>
</property>
<property name="value" >
<number>100</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition" >
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval" >
<number>10</number>
</property>
</widget>
</item>
<item row="1" column="2" >
<widget class="QSpinBox" name="cubeOpacitySpin" >
<property name="minimumSize" >
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="suffix" >
<string> %</string>
</property>
<property name="maximum" >
<number>100</number>
</property>
<property name="value" >
<number>100</number>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Transparent</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QLabel" name="label_5" >
<property name="text" >
<string>Opaque</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3" >
<widget class="QCheckBox" name="desktopOpacityOnlyBox" >
<property name="text" >
<string>Do not change opacity of windows</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="0" colspan="2" >
<spacer name="verticalSpacer_3" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2" >
<attribute name="title" >
<string>Tab 2</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_7" >
<item row="0" column="0" >
<widget class="QGroupBox" name="groupBox_3" >
<property name="title" >
<string>Caps</string>
</property>
<layout class="QGridLayout" name="gridLayout_4" >
<item row="0" column="0" colspan="2" >
<widget class="QCheckBox" name="cubeCapsBox" >
<property name="text" >
<string>Show caps</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="capColorLabel" >
<property name="text" >
<string>Cap color:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<cstring>capColorButton</cstring>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="KColorButton" name="capColorButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2" >
<widget class="QCheckBox" name="capsImageBox" >
<property name="text" >
<string>Display image on caps</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<spacer name="verticalSpacer_4" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="1" column="0" colspan="2" >
<widget class="QGroupBox" name="groupBox_2" >
<property name="title" >
<string>Zoom</string>
</property>
<layout class="QGridLayout" name="gridLayout_8" >
<item row="1" column="0" >
<widget class="QLabel" name="label_8" >
<property name="text" >
<string>Near</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLabel" name="label_9" >
<property name="text" >
<string>Far</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2" >
<widget class="QSlider" name="zPositionSlider" >
<property name="toolTip" >
<string>Define how far away the object should appear</string>
</property>
<property name="maximum" >
<number>3000</number>
</property>
<property name="singleStep" >
<number>10</number>
</property>
<property name="pageStep" >
<number>100</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition" >
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval" >
<number>100</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0" colspan="2" >
<spacer name="verticalSpacer" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1" >
<widget class="QGroupBox" name="groupBox_9" >
<property name="title" >
<string>Additional Options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" >
<item>
<widget class="QCheckBox" name="closeOnMouseReleaseBox" >
<property name="toolTip" >
<string>If enabled the effect will be deactivated after rotating the cylinder with the mouse,
otherwise it will remain active.</string>
</property>
<property name="text" >
<string>Close after mouse dragging</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="walkThroughDesktopBox" >
<property name="text" >
<string>Use this effect for walking through the desktops</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="invertKeysBox" >
<property name="text" >
<string>Invert cursor keys</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="invertMouseBox" >
<property name="text" >
<string>Invert mouse</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KColorButton</class>
<extends>QPushButton</extends>
<header>kcolorbutton.h</header>
</customwidget>
<customwidget>
<class>KUrlRequester</class>
<extends>QFrame</extends>
<header>kurlrequester.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KWin::GlobalShortcutsEditor</class>
<extends>QWidget</extends>
<header location="global" >kwineffects.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>tabWidget</tabstop>
<tabstop>displayDesktopNameBox</tabstop>
<tabstop>reflectionBox</tabstop>
<tabstop>rotationDurationSpin</tabstop>
<tabstop>cubeOpacitySlider</tabstop>
<tabstop>cubeOpacitySpin</tabstop>
<tabstop>desktopOpacityOnlyBox</tabstop>
<tabstop>backgroundColorButton</tabstop>
<tabstop>wallpaperRequester</tabstop>
<tabstop>cubeCapsBox</tabstop>
<tabstop>capColorButton</tabstop>
<tabstop>capsImageBox</tabstop>
<tabstop>closeOnMouseReleaseBox</tabstop>
<tabstop>walkThroughDesktopBox</tabstop>
<tabstop>invertMouseBox</tabstop>
<tabstop>invertKeysBox</tabstop>
<tabstop>zPositionSlider</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>cubeOpacitySpin</sender>
<signal>valueChanged(int)</signal>
<receiver>cubeOpacitySlider</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel" >
<x>524</x>
<y>96</y>
</hint>
<hint type="destinationlabel" >
<x>433</x>
<y>97</y>
</hint>
</hints>
</connection>
<connection>
<sender>cubeOpacitySlider</sender>
<signal>valueChanged(int)</signal>
<receiver>cubeOpacitySpin</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel" >
<x>331</x>
<y>97</y>
</hint>
<hint type="destinationlabel" >
<x>524</x>
<y>96</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -2,6 +2,7 @@ uniform sampler2D winTexture;
uniform float windowWidth;
uniform float windowHeight;
uniform float opacity;
uniform float front;
vec2 pix2tex(vec2 pix)
{
@ -10,5 +11,14 @@ vec2 pix2tex(vec2 pix)
void main()
{
if( front > 0.0 && gl_FrontFacing )
discard;
if( front < 0.0 && !gl_FrontFacing )
discard;
// remove the shadow decoration quads
if( gl_TexCoord[0].x < 0.0 || gl_TexCoord[0].x > windowWidth ||
gl_TexCoord[0].y < 0.0 || gl_TexCoord[0].y > windowHeight )
discard;
gl_FragColor.rgba = texture2D(winTexture, pix2tex(gl_TexCoord[0].xy)).rgba;
gl_FragColor.a = gl_FragColor.a * opacity;
}

View File

@ -1,209 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2008 Martin Gräßlin <ubuntu@martin-graesslin.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "cube.h"
#include "sphere.h"
#include <kdebug.h>
#include <KStandardDirs>
#include <math.h>
#include <GL/gl.h>
namespace KWin
{
KWIN_EFFECT( sphere, SphereEffect )
KWIN_EFFECT_SUPPORTED( sphere, SphereEffect::supported() )
SphereEffect::SphereEffect()
: CubeEffect()
, mInited( false )
, mValid( true )
, mShader( 0 )
{
shortcutsRegistered = false;
reconfigure( ReconfigureAll );
}
SphereEffect::~SphereEffect()
{
delete mShader;
}
void SphereEffect::reconfigure( ReconfigureFlags )
{
loadConfig( "Sphere" );
}
bool SphereEffect::supported()
{
return GLShader::fragmentShaderSupported() &&
(effects->compositingType() == OpenGLCompositing);
}
bool SphereEffect::loadData()
{
mInited = true;
QString fragmentshader = KGlobal::dirs()->findResource("data", "kwin/cylinder.frag");
QString vertexshader = KGlobal::dirs()->findResource("data", "kwin/sphere.vert");
if( fragmentshader.isEmpty() || vertexshader.isEmpty() )
{
kError(1212) << "Couldn't locate shader files" << endl;
return false;
}
mShader = new GLShader( vertexshader, fragmentshader );
if( !mShader->isValid() )
{
kError(1212) << "The shader failed to load!" << endl;
return false;
}
else
{
mShader->bind();
mShader->setUniform( "winTexture", 0 );
mShader->setUniform( "opacity", cubeOpacity );
QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop());
if( effects->numScreens() > 1 && bigCube )
rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() );
mShader->setUniform( "width", (float)rect.width() );
mShader->setUniform( "height", (float)rect.height() );
mShader->unbind();
}
return true;
}
void SphereEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time )
{
if( activated )
{
if( cube_painting )
{
if( w->isOnDesktop( painting_desktop ))
{
data.quads = data.quads.makeGrid( 40 );
QRect rect = effects->clientArea( FullArea, activeScreen, painting_desktop );
if( w->x() < rect.width()/2 && w->x() + w->width() > rect.width()/ 2 )
data.quads = data.quads.splitAtX( rect.width()/2 - w->x() );
w->enablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP );
}
else
{
w->disablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP );
}
}
}
effects->prePaintWindow( w, data, time );
}
void SphereEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data )
{
if( activated && cube_painting )
{
if( mValid && !mInited )
mValid = loadData();
bool useShader = mValid;
if( useShader )
{
mShader->bind();
mShader->setUniform( "windowWidth", (float)w->width() );
mShader->setUniform( "windowHeight", (float)w->height() );
mShader->setUniform( "xCoord", (float)w->x() );
mShader->setUniform( "yCoord", (float)w->y() );
mShader->setUniform( "cubeAngle", (effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f );
data.shader = mShader;
}
CubeEffect::paintWindow( w, mask, region, data );
if( useShader )
{
mShader->unbind();
}
}
else
effects->paintWindow( w, mask, region, data );
}
void SphereEffect::paintCap( float z, float zTexture )
{
if( bottomCap )
{
glPushMatrix();
glScalef( 1.0, -1.0, 1.0 );
}
CubeEffect::paintCap( z, zTexture );
if( bottomCap )
glPopMatrix();
}
void SphereEffect::paintCapStep( float z, float zTexture, bool texture )
{
QRect rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() );
float cubeAngle = (effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f;
float radius = (rect.width()*0.5)/cos(cubeAngle*0.5*M_PI/180.0);
float angle = acos( (rect.height()*0.5)/radius )*180.0/M_PI;
angle /= 30;
if( texture )
capTexture->bind();
glPushMatrix();
glTranslatef( 0.0, -rect.height()*0.5, 0.0 );
glBegin( GL_QUADS );
for( int i=0; i<30; i++ )
{
float topAngle = angle*i*M_PI/180.0;
float bottomAngle = angle*(i+1)*M_PI/180.0;
float yTop = rect.height() - radius * cos( topAngle );
yTop -= (yTop-rect.height()*0.5)*capDeformationFactor;
float yBottom = rect.height() -radius * cos( bottomAngle );
yBottom -= (yBottom-rect.height()*0.5)*capDeformationFactor;
for( int j=0; j<36; j++ )
{
float x = radius * sin( topAngle ) * sin( (90.0+j*10.0)*M_PI/180.0 );
float z = radius * sin( topAngle ) * cos( (90.0+j*10.0)*M_PI/180.0 );
if( texture )
glTexCoord2f( x/(rect.width())+0.5, 0.5 - z/zTexture * 0.5 );
glVertex3f( x, yTop, z );
x = radius * sin( bottomAngle ) * sin( (90.0+j*10.0)*M_PI/180.00 );
z = radius * sin( bottomAngle ) * cos( (90.0+j*10.0)*M_PI/180.0 );
if( texture )
glTexCoord2f( x/(rect.width())+0.5, 0.5 - z/zTexture * 0.5 );
glVertex3f( x, yBottom, z );
x = radius * sin( bottomAngle ) * sin( (90.0+(j+1)*10.0)*M_PI/180.0 );
z = radius * sin( bottomAngle ) * cos( (90.0+(j+1)*10.0)*M_PI/180.0 );
if( texture )
glTexCoord2f( x/(rect.width())+0.5, 0.5 - z/zTexture * 0.5 );
glVertex3f( x, yBottom, z );
x = radius * sin( topAngle ) * sin( (90.0+(j+1)*10.0)*M_PI/180.0 );
z = radius * sin( topAngle ) * cos( (90.0+(j+1)*10.0)*M_PI/180.0 );
if( texture )
glTexCoord2f( x/(rect.width())+0.5, 0.5 - z/zTexture * 0.5 );
glVertex3f( x, yTop, z );
}
}
glEnd();
glPopMatrix();
if( texture )
{
capTexture->unbind();
}
}
} // namespace

View File

@ -1,122 +0,0 @@
[Desktop Entry]
Name=Desktop Sphere
Name[ar]=دائرة سطح المكتب
Name[be@latin]=Rabočaja kula
Name[bg]=Сферичен работен плот
Name[ca]=Esfera d'escriptori
Name[ca@valencia]=Esfera d'escriptori
Name[csb]=Sfera pùltu
Name[da]=Desktop-sfære
Name[de]=Arbeitsflächen-Kugel
Name[el]=Σφαίρα επιφάνειας εργασίας
Name[es]=Escritorio esfera
Name[et]=Töölauasfäär
Name[eu]=Mahaigaina esfera gisa
Name[fr]=Bureau en sphère
Name[fy]=Buroblêdbol
Name[ga]=Sféar Deisce
Name[gl]=Escritorio en esfera
Name[gu]=ડેસ્કટોપ ગોળો
Name[he]=שולחן עבודה בספירה
Name[hi]=डेस्कटॉप गोला
Name[is]=Skjáborðshvolf
Name[it]=Sfera Desktop
Name[ja]=デスクトップ球形
Name[kk]=Үстел сферасы
Name[km]=ស៊្វែរ​ផ្ទៃតុ
Name[kn]=ಗಣಕತೆರೆ ಗೋಲ
Name[ko]=데스크톱 구
Name[ku]=Sermaseyê Erdgilor
Name[lt]=Darbastalio sfera
Name[lv]=Darbvirsmas sfēra
Name[mk]=Работна сфера
Name[ml]=പണിയറഗോളം
Name[nb]=Skrivebordskule
Name[nds]=Schriefdischkugel
Name[nl]=Bureaubladbol
Name[nn]=Skrivebordskule
Name[pa]=ਡੈਸਕਟਾਪ ਗੋਲਾ
Name[pl]=Sfera pulpitu
Name[pt]=Esfera de Ecrãs
Name[pt_BR]=Esfera da área de trabalho
Name[ro]=Sferă de birou
Name[sk]=Plocha guľa
Name[sl]=Krogla z namizji
Name[sr]=Сфера површи
Name[sr@latin]=Sfera površi
Name[sv]=Skrivbordsklot
Name[ta]=திரைமேசை உருண்டை
Name[te]=డెస్క్ టాప్ గొళం
Name[tg]=Сфераи мизи корӣ
Name[tr]=Masaüstü Küresi
Name[uk]=Стільнична сфера
Name[x-test]=xxDesktop Spherexx
Name[zh_CN]=桌面球体
Name[zh_TW]=桌面球體
Icon=preferences-system-windows-effect-sphere
Comment=Display each virtual desktop on the side of a sphere
Comment[ar]=تعرض كل سطح مكتب افتراضي على جانب من جوانب الدائرة
Comment[be@latin]=Pakazvaje virtualnyja rabočyja stały na baku kuli.
Comment[bg]=Всеки виртуален работен плот се показва като част от сфера
Comment[bn]=প্রত্যেকটি ভার্চুয়াল ডেস্কটপ একটি গোলক-এর ধারে দেখাও
Comment[bn_IN]=প্রত্যেকটি ভার্চুয়াল ডেস্কটপ একটি গোলক-এর ধারে দেখাও
Comment[ca]=Visualitza cada escriptori virtual als costats d'una esfera
Comment[ca@valencia]=Visualitza cada escriptori virtual als costats d'una esfera
Comment[csb]=Wëszkrzëniô wirtualny pùlt na starnie sferë
Comment[da]=Vis hver virtuel desktop på en siden af en sfære
Comment[de]=Zeigt die virtuellen Arbeitsflächen auf einer Kugel an.
Comment[el]=Εμφάνιση κάθε εικονικής επιφάνειας εργασίας στην επιφάνεια μιας σφαίρας
Comment[es]=Muestra cada escritorio virtual como una esfera
Comment[et]=Virtuaalsete töölaudade asetamine kõrvuti sfäärile
Comment[eu]=Bistaratu laneko area bakoitza esfera baten alde batean
Comment[fr]=Affiche chaque bureau virtuel sur une sphère
Comment[fy]=Elts firtueel buroblêd op in side fan in bol sjen litte
Comment[ga]=Taispeáin gach deasc fíorúil ar thaobh de sféar
Comment[gl]=Mostra os escritorios virtuais na superficie dunha esfera
Comment[gu]=ગોળાની બાજુ પર દરેક વર્ચ્યુઅલ ડેસ્કટોપ બતાવો
Comment[he]=הצג כל שולחן עבודה וירטואלי בחלק אחר של ספירה
Comment[hi]=किसी गोले के किनारे पर प्रत्येक आभासी डेस्कटॉप को दिखाएं
Comment[is]=Sýnir hvert sýndarskjáborð á sinni hlið súlu
Comment[it]=Mostra ogni desktop virtuale sul lato di una sfera
Comment[ja]=仮想デスクトップを球の側面に表示します
Comment[kk]=Әрбір виртуалды үстелді сфераның бетінде көрсету
Comment[km]=ផ្គូផ្គង​ផ្ទៃតុ​និម្មិត​នៅ​លើ​ស៊្វែរ
Comment[kn]=ವಾಸ್ತವಪ್ರಾಯ ಗಣಕತೆರೆಗಳನ್ನು ಗೋಲವೊಂದರ ಬದಿಗಳ ಮೇಲೇ ತೋರುವಂತೆ ಮಾಡು
Comment[ko]=구의 각각 면에 가상 데스크톱을 표시합니다
Comment[ku]=Her sermase ya farazî di rexê erdgilor de nîşan bide
Comment[lv]=Rāda visas virtuālās darbvirsmas uz sfēras malas
Comment[mk]=Ги прикажува виртуелните работни површини на страниците на сфера
Comment[ml]=ഓരോ വര്‍ച്ചുവല്‍ പണിയിടവും ഒരു ഗോളത്തിന്റെ വശത്തായ് കാണിക്കുക
Comment[nb]=Vis hvert virtuelt skrivebord på siden av en kule
Comment[nds]=Elkeen Schriefdisch op de Siet vun en Kugel wiesen
Comment[nl]=Toont elk virtueel bureaublad op een zijde van een bol
Comment[pa]=ਗੋਲ਼ੇ ਦੇ ਪਾਸੇ ਹਰੇਕ ਵੁਰਚੁਅਲ ਡੈਸਕਟਾਪ ਵੇਖੋ
Comment[pl]=Pokazanie każdego wirtualnego pulpitu na innej stronie sfery
Comment[pt]=Mostrar cada ecrã virtual como uma face de uma esfera
Comment[pt_BR]=Mostrar cada área de trabalho virtual como um lado de uma esfera
Comment[ro]=Afișează fiecare birou virtual pe suprafața unei sfere
Comment[sk]=Zobrazí virtuálne plochy na stranách gule
Comment[sl]=Vsako navidezno namizje prikaže na krogli
Comment[sr]=Пресликава виртуелне површи на сферу
Comment[sr@latin]=Preslikava virtuelne površi na sferu
Comment[sv]=Visa varje virtuellt skrivbord på sidan av ett klot
Comment[ta]=உருண்டையின் பக்கத்தில் திரைமேசையின் பிரதியொரு தோற்றத்தையும் காட்டுக
Comment[th]=แสดงแต่ละพื้นที่ทำงานเสมือนบนทรงกลม
Comment[tr]=Her bir sanal masaüstünü bir kürenin yanı olarak göster
Comment[uk]=Показувати всі стільниці на поверхні сфери
Comment[x-test]=xxDisplay each virtual desktop on the side of a spherexx
Comment[zh_CN]=在一排球体中显示各虚拟桌面
Comment[zh_TW]=將每個虛擬桌面顯示在球體上
Type=Service
X-KDE-ServiceTypes=KWin/Effect
X-KDE-PluginInfo-Author=Martin Gräßlin
X-KDE-PluginInfo-Email=ubuntu@martin-graesslin.com
X-KDE-PluginInfo-Name=kwin4_effect_sphere
X-KDE-PluginInfo-Version=0.1.0
X-KDE-PluginInfo-Category=Window Management
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=false
X-KDE-Library=kwin4_effect_builtins
X-KDE-Ordering=50

View File

@ -1,54 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2008 Martin Gräßlin <ubuntu@martin-graesslin.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#ifndef KWIN_SPHERE_H
#define KWIN_SPHERE_H
#include <kwineffects.h>
#include <kwinglutils.h>
namespace KWin
{
class SphereEffect
: public CubeEffect
{
public:
SphereEffect();
~SphereEffect();
virtual void reconfigure( ReconfigureFlags );
virtual void prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time );
virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data );
static bool supported();
protected:
virtual void paintCap( float z, float zTexture );
virtual void paintCapStep( float z, float zTexture, bool texture );
private:
bool loadData();
bool mInited;
bool mValid;
GLShader* mShader;
float capDeformationFactor;
};
} // namespace
#endif

View File

@ -1,242 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2008 Martin Gräßlin <ubuntu@martin-graesslin.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "sphere_config.h"
#include <kwineffects.h>
#include <kconfiggroup.h>
#include <kcolorscheme.h>
#include <KActionCollection>
#include <kaction.h>
#include <KFileDialog>
#include <KImageFilePreview>
#include <QGridLayout>
#include <QColor>
namespace KWin
{
KWIN_EFFECT_CONFIG_FACTORY
SphereEffectConfigForm::SphereEffectConfigForm(QWidget* parent) : QWidget(parent)
{
setupUi(this);
}
SphereEffectConfig::SphereEffectConfig(QWidget* parent, const QVariantList& args) :
KCModule(EffectFactory::componentData(), parent, args)
{
m_ui = new SphereEffectConfigForm(this);
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(m_ui);
m_ui->tabWidget->setTabText( 0, i18nc("@title:tab Basic Settings", "Basic") );
m_ui->tabWidget->setTabText( 1, i18nc("@title:tab Advanced Settings", "Advanced") );
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection( this, KComponentData("kwin") );
m_actionCollection->setConfigGroup( "Sphere" );
m_actionCollection->setConfigGlobal(true);
KAction* a = (KAction*) m_actionCollection->addAction( "Sphere" );
a->setText( i18n("Desktop Sphere" ));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::META + Qt::Key_F11 ));
m_ui->editor->addCollection(m_actionCollection);
connect(m_ui->rotationDurationSpin, SIGNAL(valueChanged(int)), this, SLOT(changed()));
connect(m_ui->cubeOpacitySlider, SIGNAL(valueChanged(int)), this, SLOT(changed()));
connect(m_ui->cubeOpacitySpin, SIGNAL(valueChanged(int)), this, SLOT(changed()));
connect(m_ui->desktopOpacityOnlyBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
connect(m_ui->displayDesktopNameBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
connect(m_ui->backgroundColorButton, SIGNAL(changed(QColor)), this, SLOT(changed()));
connect(m_ui->cubeCapsBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
connect(m_ui->cubeCapsBox, SIGNAL(stateChanged(int)), this, SLOT(capsSelectionChanged()));
connect(m_ui->capsImageBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
connect(m_ui->capColorButton, SIGNAL(changed(QColor)), this, SLOT(changed()));
connect(m_ui->wallpaperRequester, SIGNAL(textChanged(QString)), this, SLOT(changed()));
connect(m_ui->closeOnMouseReleaseBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
connect(m_ui->zPositionSlider, SIGNAL(valueChanged(int)), this, SLOT(changed()));
connect(m_ui->capDeformationSlider, SIGNAL(valueChanged(int)), this, SLOT(changed()));
connect(m_ui->walkThroughDesktopBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
connect(m_ui->invertKeysBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
connect(m_ui->invertMouseBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
load();
}
void SphereEffectConfig::load()
{
KCModule::load();
KConfigGroup conf = EffectsHandler::effectConfig( "Sphere" );
int duration = conf.readEntry( "RotationDuration", 0 );
float opacity = conf.readEntry( "Opacity", 80 );
bool desktopOpacityOnly = conf.readEntry( "OpacityDesktopOnly", false );
bool desktopName = conf.readEntry( "DisplayDesktopName", true );
QColor background = conf.readEntry( "BackgroundColor", QColor( Qt::black ) );
QColor capColor = conf.readEntry( "CapColor", KColorScheme( QPalette::Active, KColorScheme::Window ).background().color() );
bool texturedCaps = conf.readEntry( "TexturedCaps", true );
bool caps = conf.readEntry( "Caps", true );
bool closeOnMouseRelease = conf.readEntry( "CloseOnMouseRelease", false );
bool walkThroughDesktop = conf.readEntry( "TabBox", false );
m_ui->zPositionSlider->setValue( conf.readEntry( "ZPosition", 450 ) );
m_ui->capDeformationSlider->setValue( conf.readEntry( "CapDeformation", 0 ) );
m_ui->wallpaperRequester->setPath( conf.readEntry( "Wallpaper", "" ) );
bool invertKeys = conf.readEntry( "InvertKeys", false );
bool invertMouse = conf.readEntry( "InvertMouse", false );
m_ui->rotationDurationSpin->setValue( duration );
m_ui->cubeOpacitySlider->setValue( opacity );
m_ui->cubeOpacitySpin->setValue( opacity );
m_ui->desktopOpacityOnlyBox->setChecked( desktopOpacityOnly );
if( desktopName )
{
m_ui->displayDesktopNameBox->setCheckState( Qt::Checked );
}
else
{
m_ui->displayDesktopNameBox->setCheckState( Qt::Unchecked );
}
if( caps )
{
m_ui->cubeCapsBox->setCheckState( Qt::Checked );
}
else
{
m_ui->cubeCapsBox->setCheckState( Qt::Unchecked );
}
if( texturedCaps )
{
m_ui->capsImageBox->setCheckState( Qt::Checked );
}
else
{
m_ui->capsImageBox->setCheckState( Qt::Unchecked );
}
if( closeOnMouseRelease )
{
m_ui->closeOnMouseReleaseBox->setCheckState( Qt::Checked );
}
else
{
m_ui->closeOnMouseReleaseBox->setCheckState( Qt::Unchecked );
}
if( walkThroughDesktop )
{
m_ui->walkThroughDesktopBox->setCheckState( Qt::Checked );
}
else
{
m_ui->walkThroughDesktopBox->setCheckState( Qt::Unchecked );
}
m_ui->backgroundColorButton->setColor( background );
m_ui->capColorButton->setColor( capColor );
m_ui->invertKeysBox->setChecked( invertKeys );
m_ui->invertMouseBox->setChecked( invertMouse );
capsSelectionChanged();
emit changed(false);
}
void SphereEffectConfig::save()
{
KConfigGroup conf = EffectsHandler::effectConfig( "Sphere" );
conf.writeEntry( "RotationDuration", m_ui->rotationDurationSpin->value() );
conf.writeEntry( "DisplayDesktopName", m_ui->displayDesktopNameBox->checkState() == Qt::Checked ? true : false );
conf.writeEntry( "Opacity", m_ui->cubeOpacitySpin->value() );
conf.writeEntry( "OpacityDesktopOnly", m_ui->desktopOpacityOnlyBox->isChecked() );
conf.writeEntry( "BackgroundColor", m_ui->backgroundColorButton->color() );
conf.writeEntry( "Caps", m_ui->cubeCapsBox->checkState() == Qt::Checked ? true : false );
conf.writeEntry( "CapColor", m_ui->capColorButton->color() );
conf.writeEntry( "TexturedCaps", m_ui->capsImageBox->checkState() == Qt::Checked ? true : false );
conf.writeEntry( "CloseOnMouseRelease", m_ui->closeOnMouseReleaseBox->checkState() == Qt::Checked ? true : false );
conf.writeEntry( "Wallpaper", m_ui->wallpaperRequester->url().path() );
conf.writeEntry( "ZPosition", m_ui->zPositionSlider->value() );
conf.writeEntry( "CapDeformation", m_ui->capDeformationSlider->value() );
conf.writeEntry( "TabBox", m_ui->walkThroughDesktopBox->checkState() == Qt::Checked ? true : false );
conf.writeEntry( "InvertKeys", m_ui->invertKeysBox->isChecked() );
conf.writeEntry( "InvertMouse", m_ui->invertMouseBox->isChecked() );
m_ui->editor->save();
conf.sync();
emit changed(false);
EffectsHandler::sendReloadMessage( "sphere" );
}
void SphereEffectConfig::defaults()
{
m_ui->rotationDurationSpin->setValue( 0 );
m_ui->displayDesktopNameBox->setCheckState( Qt::Checked );
m_ui->cubeOpacitySpin->setValue( 80 );
m_ui->cubeOpacitySlider->setValue( 80 );
m_ui->desktopOpacityOnlyBox->setChecked( false );
m_ui->backgroundColorButton->setColor( QColor( Qt::black ) );
m_ui->cubeCapsBox->setCheckState( Qt::Checked );
m_ui->capColorButton->setColor( KColorScheme( QPalette::Active, KColorScheme::Window ).background().color() );
m_ui->capsImageBox->setCheckState( Qt::Checked );
m_ui->closeOnMouseReleaseBox->setCheckState( Qt::Unchecked );
m_ui->wallpaperRequester->setPath( "" );
m_ui->zPositionSlider->setValue( 450 );
m_ui->capDeformationSlider->setValue( 0 );
m_ui->walkThroughDesktopBox->setCheckState( Qt::Unchecked );
m_ui->invertKeysBox->setChecked( false );
m_ui->invertMouseBox->setChecked( false );
m_ui->editor->allDefault();
emit changed(true);
}
void SphereEffectConfig::capsSelectionChanged()
{
if( m_ui->cubeCapsBox->checkState() == Qt::Checked )
{
// activate cap color
m_ui->capColorButton->setEnabled( true );
m_ui->capColorLabel->setEnabled( true );
m_ui->capsImageBox->setEnabled( true );
m_ui->capDeformationGroupBox->setEnabled( true );
m_ui->capDeformationSlider->setEnabled( true );
m_ui->capDeformationSphereLabel->setEnabled( true );
m_ui->capDeformationPlaneLabel->setEnabled( true );
}
else
{
// deactivate cap color
m_ui->capColorButton->setEnabled( false );
m_ui->capColorLabel->setEnabled( false );
m_ui->capsImageBox->setEnabled( false );
m_ui->capDeformationGroupBox->setEnabled( false );
m_ui->capDeformationSlider->setEnabled( false );
m_ui->capDeformationSphereLabel->setEnabled( false );
m_ui->capDeformationPlaneLabel->setEnabled( false );
}
}
} // namespace
#include "sphere_config.moc"

View File

@ -1,62 +0,0 @@
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KCModule
X-KDE-Library=kcm_kwin4_effect_builtins
X-KDE-ParentComponents=kwin4_effect_sphere
X-KDE-PluginKeyword=sphere
Name=Desktop Sphere
Name[ar]=دائرة سطح المكتب
Name[be@latin]=Rabočaja kula
Name[bg]=Сферичен работен плот
Name[ca]=Esfera d'escriptori
Name[ca@valencia]=Esfera d'escriptori
Name[csb]=Sfera pùltu
Name[da]=Desktop-sfære
Name[de]=Arbeitsflächen-Kugel
Name[el]=Σφαίρα επιφάνειας εργασίας
Name[es]=Escritorio esfera
Name[et]=Töölauasfäär
Name[eu]=Mahaigaina esfera gisa
Name[fr]=Bureau en sphère
Name[fy]=Buroblêdbol
Name[ga]=Sféar Deisce
Name[gl]=Escritorio en esfera
Name[gu]=ડેસ્કટોપ ગોળો
Name[he]=שולחן עבודה בספירה
Name[hi]=डेस्कटॉप गोला
Name[is]=Skjáborðshvolf
Name[it]=Sfera Desktop
Name[ja]=デスクトップ球形
Name[kk]=Үстел сферасы
Name[km]=ស៊្វែរ​ផ្ទៃតុ
Name[kn]=ಗಣಕತೆರೆ ಗೋಲ
Name[ko]=데스크톱 구
Name[ku]=Sermaseyê Erdgilor
Name[lt]=Darbastalio sfera
Name[lv]=Darbvirsmas sfēra
Name[mk]=Работна сфера
Name[ml]=പണിയറഗോളം
Name[nb]=Skrivebordskule
Name[nds]=Schriefdischkugel
Name[nl]=Bureaubladbol
Name[nn]=Skrivebordskule
Name[pa]=ਡੈਸਕਟਾਪ ਗੋਲਾ
Name[pl]=Sfera pulpitu
Name[pt]=Esfera de Ecrãs
Name[pt_BR]=Esfera da área de trabalho
Name[ro]=Sferă de birou
Name[sk]=Plocha guľa
Name[sl]=Krogla z namizji
Name[sr]=Сфера површи
Name[sr@latin]=Sfera površi
Name[sv]=Skrivbordsklot
Name[ta]=திரைமேசை உருண்டை
Name[te]=డెస్క్ టాప్ గొళం
Name[tg]=Сфераи мизи корӣ
Name[tr]=Masaüstü Küresi
Name[uk]=Стільнична сфера
Name[x-test]=xxDesktop Spherexx
Name[zh_CN]=桌面球体
Name[zh_TW]=桌面球體

View File

@ -1,60 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2008 Martin Gräßlin <ubuntu@martin-graesslin.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#ifndef KWIN_SPHERE_CONFIG_H
#define KWIN_SPHERE_CONFIG_H
#include <kcmodule.h>
#include "ui_sphere_config.h"
class KFileDialog;
namespace KWin
{
class SphereEffectConfigForm : public QWidget, public Ui::SphereEffectConfigForm
{
Q_OBJECT
public:
explicit SphereEffectConfigForm(QWidget* parent);
};
class SphereEffectConfig : public KCModule
{
Q_OBJECT
public:
explicit SphereEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList());
public slots:
virtual void save();
virtual void load();
virtual void defaults();
private slots:
void capsSelectionChanged();
private:
SphereEffectConfigForm* m_ui;
KActionCollection* m_actionCollection;
};
} // namespace
#endif

View File

@ -1,560 +0,0 @@
<ui version="4.0" >
<class>KWin::SphereEffectConfigForm</class>
<widget class="QWidget" name="KWin::SphereEffectConfigForm" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>700</width>
<height>542</height>
</rect>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QTabWidget" name="tabWidget" >
<property name="currentIndex" >
<number>0</number>
</property>
<widget class="QWidget" name="tab" >
<attribute name="title" >
<string>Tab 1</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_5" >
<item row="1" column="1" >
<widget class="QGroupBox" name="groupBox_5" >
<property name="title" >
<string>Background</string>
</property>
<layout class="QGridLayout" name="gridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label_6" >
<property name="text" >
<string>Background color:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<cstring>backgroundColorButton</cstring>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="KColorButton" name="backgroundColorButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Wallpaper:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<cstring>wallpaperRequester</cstring>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="KUrlRequester" name="wallpaperRequester" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0" colspan="2" >
<widget class="QGroupBox" name="groupBox_8" >
<property name="title" >
<string>Activation</string>
</property>
<layout class="QGridLayout" name="gridLayout_3" >
<item row="0" column="0" colspan="2" >
<widget class="KWin::GlobalShortcutsEditor" native="1" name="editor" >
<property name="minimumSize" >
<size>
<width>0</width>
<height>200</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item rowspan="2" row="0" column="0" >
<widget class="QGroupBox" name="groupBox_7" >
<property name="title" >
<string>Appearance</string>
</property>
<layout class="QGridLayout" name="gridLayout_2" >
<item row="0" column="0" colspan="2" >
<widget class="QCheckBox" name="displayDesktopNameBox" >
<property name="text" >
<string>Display desktop name</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2" >
<widget class="QCheckBox" name="reflectionBox" >
<property name="text" >
<string>Reflection</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Rotation duration:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<cstring>rotationDurationSpin</cstring>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QSpinBox" name="rotationDurationSpin" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="specialValueText" >
<string comment="Duration of rotation">Default</string>
</property>
<property name="suffix" >
<string> msec</string>
</property>
<property name="maximum" >
<number>5000</number>
</property>
<property name="singleStep" >
<number>10</number>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2" >
<spacer name="verticalSpacer_2" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="0" column="1" >
<widget class="QGroupBox" name="groupBox_4" >
<property name="title" >
<string>Opacity</string>
</property>
<layout class="QGridLayout" name="gridLayout_6" >
<item row="1" column="0" colspan="2" >
<widget class="QSlider" name="cubeOpacitySlider" >
<property name="minimumSize" >
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="maximum" >
<number>100</number>
</property>
<property name="singleStep" >
<number>1</number>
</property>
<property name="value" >
<number>100</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition" >
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval" >
<number>10</number>
</property>
</widget>
</item>
<item row="1" column="2" >
<widget class="QSpinBox" name="cubeOpacitySpin" >
<property name="minimumSize" >
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="suffix" >
<string> %</string>
</property>
<property name="maximum" >
<number>100</number>
</property>
<property name="value" >
<number>100</number>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Transparent</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QLabel" name="label_5" >
<property name="text" >
<string>Opaque</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3" >
<widget class="QCheckBox" name="desktopOpacityOnlyBox" >
<property name="text" >
<string>Do not change opacity of windows</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="0" colspan="2" >
<spacer name="verticalSpacer_3" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2" >
<attribute name="title" >
<string>Tab 2</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_7" >
<item row="0" column="0" >
<widget class="QGroupBox" name="groupBox_3" >
<property name="title" >
<string>Caps</string>
</property>
<layout class="QGridLayout" name="gridLayout_4" >
<item row="0" column="0" colspan="2" >
<widget class="QCheckBox" name="cubeCapsBox" >
<property name="text" >
<string>Show caps</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="capColorLabel" >
<property name="text" >
<string>Cap color:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<cstring>capColorButton</cstring>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="KColorButton" name="capColorButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2" >
<widget class="QCheckBox" name="capsImageBox" >
<property name="text" >
<string>Display image on caps</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<spacer name="verticalSpacer_4" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="4" column="0" colspan="2" >
<widget class="QGroupBox" name="groupBox_2" >
<property name="title" >
<string>Zoom</string>
</property>
<layout class="QGridLayout" name="gridLayout_8" >
<item row="1" column="0" >
<widget class="QLabel" name="label_8" >
<property name="text" >
<string>Near</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLabel" name="label_9" >
<property name="text" >
<string>Far</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2" >
<widget class="QSlider" name="zPositionSlider" >
<property name="toolTip" >
<string>Define how far away the object should appear</string>
</property>
<property name="maximum" >
<number>3000</number>
</property>
<property name="singleStep" >
<number>10</number>
</property>
<property name="pageStep" >
<number>100</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition" >
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval" >
<number>100</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="6" column="0" colspan="2" >
<spacer name="verticalSpacer" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1" >
<widget class="QGroupBox" name="groupBox_9" >
<property name="title" >
<string>Additional Options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" >
<item>
<widget class="QCheckBox" name="closeOnMouseReleaseBox" >
<property name="toolTip" >
<string>If enabled the effect will be deactivated after rotating the sphere with the mouse,
otherwise it will remain active</string>
</property>
<property name="text" >
<string>Close after mouse dragging</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="walkThroughDesktopBox" >
<property name="text" >
<string>Use this effect for walking through the desktops</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="invertKeysBox" >
<property name="text" >
<string>Invert cursor keys</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="invertMouseBox" >
<property name="text" >
<string>Invert mouse</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0" colspan="2" >
<widget class="QGroupBox" name="capDeformationGroupBox" >
<property name="title" >
<string>Cap Deformation</string>
</property>
<layout class="QGridLayout" name="gridLayout_9" >
<item row="0" column="0" colspan="2" >
<widget class="QSlider" name="capDeformationSlider" >
<property name="maximum" >
<number>100</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition" >
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval" >
<number>25</number>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="capDeformationSphereLabel" >
<property name="text" >
<string>Sphere</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLabel" name="capDeformationPlaneLabel" >
<property name="text" >
<string>Plane</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KColorButton</class>
<extends>QPushButton</extends>
<header>kcolorbutton.h</header>
</customwidget>
<customwidget>
<class>KUrlRequester</class>
<extends>QFrame</extends>
<header>kurlrequester.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KWin::GlobalShortcutsEditor</class>
<extends>QWidget</extends>
<header location="global" >kwineffects.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>tabWidget</tabstop>
<tabstop>displayDesktopNameBox</tabstop>
<tabstop>reflectionBox</tabstop>
<tabstop>rotationDurationSpin</tabstop>
<tabstop>cubeOpacitySlider</tabstop>
<tabstop>cubeOpacitySpin</tabstop>
<tabstop>desktopOpacityOnlyBox</tabstop>
<tabstop>backgroundColorButton</tabstop>
<tabstop>wallpaperRequester</tabstop>
<tabstop>cubeCapsBox</tabstop>
<tabstop>capColorButton</tabstop>
<tabstop>capsImageBox</tabstop>
<tabstop>closeOnMouseReleaseBox</tabstop>
<tabstop>walkThroughDesktopBox</tabstop>
<tabstop>invertMouseBox</tabstop>
<tabstop>invertKeysBox</tabstop>
<tabstop>capDeformationSlider</tabstop>
<tabstop>zPositionSlider</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>cubeOpacitySpin</sender>
<signal>valueChanged(int)</signal>
<receiver>cubeOpacitySlider</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel" >
<x>524</x>
<y>96</y>
</hint>
<hint type="destinationlabel" >
<x>433</x>
<y>97</y>
</hint>
</hints>
</connection>
<connection>
<sender>cubeOpacitySlider</sender>
<signal>valueChanged(int)</signal>
<receiver>cubeOpacitySpin</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel" >
<x>331</x>
<y>97</y>
</hint>
<hint type="destinationlabel" >
<x>524</x>
<y>96</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -682,13 +682,11 @@ void KWinCompositingConfig::setupElectricBorders()
addItemToEdgesMonitor( services.first()->name());
services = trader->query("KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_cube'");
if( !services.isEmpty() )
addItemToEdgesMonitor( services.first()->name());
services = trader->query("KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_cylinder'");
if( !services.isEmpty() )
addItemToEdgesMonitor( services.first()->name());
services = trader->query("KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_sphere'");
if( !services.isEmpty() )
addItemToEdgesMonitor( services.first()->name());
{
addItemToEdgesMonitor( services.first()->name() + " - " + i18n( "Cube") );
addItemToEdgesMonitor( services.first()->name() + " - " + i18n( "Cylinder") );
addItemToEdgesMonitor( services.first()->name() + " - " + i18n( "Sphere") );
}
}
void KWinCompositingConfig::addItemToEdgesMonitor(const QString& item)
@ -727,13 +725,9 @@ void KWinCompositingConfig::loadElectricBorders()
KConfigGroup cubeconfig(mKWinConfig, "Effect-Cube");
changeElectricBorder( (ElectricBorder)cubeconfig.readEntry( "BorderActivate",
int( ElectricNone )), (int)Cube );
// Desktop Cylinder
KConfigGroup cylinderconfig(mKWinConfig, "Effect-Cylinder");
changeElectricBorder( (ElectricBorder)cylinderconfig.readEntry( "BorderActivate",
changeElectricBorder( (ElectricBorder)cubeconfig.readEntry( "BorderActivateCylinder",
int( ElectricNone )), (int)Cylinder );
// Desktop Grid
KConfigGroup sphereconfig(mKWinConfig, "Effect-Sphere");
changeElectricBorder( (ElectricBorder)sphereconfig.readEntry( "BorderActivate",
changeElectricBorder( (ElectricBorder)cubeconfig.readEntry( "BorderActivateSphere",
int( ElectricNone )), (int)Sphere );
}
@ -803,12 +797,8 @@ void KWinCompositingConfig::saveElectricBorders()
KConfigGroup cubeconfig(mKWinConfig, "Effect-Cube");
cubeconfig.writeEntry( "BorderActivate", (int)checkEffectHasElectricBorder( (int)Cube ));
KConfigGroup cylinderconfig(mKWinConfig, "Effect-Cylinder");
cylinderconfig.writeEntry( "BorderActivate", (int)checkEffectHasElectricBorder( (int)Cylinder ));
KConfigGroup sphereconfig(mKWinConfig, "Effect-Sphere");
sphereconfig.writeEntry( "BorderActivate", (int)checkEffectHasElectricBorder( (int)Sphere ));
cubeconfig.writeEntry( "BorderActivateCylinder", (int)checkEffectHasElectricBorder( (int)Cylinder ));
cubeconfig.writeEntry( "BorderActivateSphere", (int)checkEffectHasElectricBorder( (int)Sphere ));
}
} // namespace