- Use bold and a bit bigger font.

- Use correct KColorScheme ctor, not the deprecated one

svn path=/trunk/KDE/kdebase/workspace/; revision=707988
This commit is contained in:
Rivo Laks 2007-09-03 15:02:26 +00:00
parent e6069e9cf6
commit 8246723251
2 changed files with 17 additions and 9 deletions

View file

@ -91,9 +91,7 @@ void BoxSwitchEffect::paintScreen( int mask, QRegion region, ScreenPaintData& da
paintWindowThumbnail( w ); paintWindowThumbnail( w );
paintWindowIcon( w ); paintWindowIcon( w );
} }
int maxwidth = text_area.width(); paintText( selected_window->caption() );
QColor color = KColorScheme( KColorScheme::Window ).foreground();
effects->paintText( selected_window->caption(), text_area.center(), maxwidth, color );
} }
else else
{ {
@ -110,9 +108,7 @@ void BoxSwitchEffect::paintScreen( int mask, QRegion region, ScreenPaintData& da
paintDesktopThumbnail( painting_desktop ); paintDesktopThumbnail( painting_desktop );
} }
int maxwidth = text_area.width(); paintText( effects->desktopName( selected_desktop ));
QColor color = KColorScheme( KColorScheme::Window ).foreground();
effects->paintText( effects->desktopName( selected_desktop ), text_area.center(), maxwidth, color );
painting_desktop = 0; painting_desktop = 0;
} }
} }
@ -381,7 +377,9 @@ void BoxSwitchEffect::calculateFrameSize()
item_max_size.setHeight( 200 ); item_max_size.setHeight( 200 );
} }
// How much height to reserve for a one-line text label // How much height to reserve for a one-line text label
text_area.setHeight( int( kapp->fontMetrics().height() * 1.2 )); text_font.setBold( true );
text_font.setPointSize( 12 );
text_area.setHeight( QFontMetrics( text_font ).height() * 1.2 );
// Shrink the size until all windows/desktops can fit onscreen // Shrink the size until all windows/desktops can fit onscreen
frame_area.setWidth( frame_margin * 2 + itemcount * item_max_size.width()); frame_area.setWidth( frame_margin * 2 + itemcount * item_max_size.width());
while( frame_area.width() > displayWidth()) while( frame_area.width() > displayWidth())
@ -432,7 +430,7 @@ void BoxSwitchEffect::calculateItemSizes()
void BoxSwitchEffect::paintFrame() void BoxSwitchEffect::paintFrame()
{ {
QColor color = KColorScheme( KColorScheme::Window ).background(); QColor color = KColorScheme( QPalette::Active, KColorScheme::Window ).background();
color.setAlphaF( 0.9 ); color.setAlphaF( 0.9 );
#ifdef HAVE_OPENGL #ifdef HAVE_OPENGL
if( effects->compositingType() == OpenGLCompositing ) if( effects->compositingType() == OpenGLCompositing )
@ -467,7 +465,7 @@ void BoxSwitchEffect::paintFrame()
void BoxSwitchEffect::paintHighlight( QRect area ) void BoxSwitchEffect::paintHighlight( QRect area )
{ {
QColor color = KColorScheme( KColorScheme::Selection ).background(); QColor color = KColorScheme( QPalette::Active, KColorScheme::Selection ).background();
color.setAlphaF( 0.9 ); color.setAlphaF( 0.9 );
#ifdef HAVE_OPENGL #ifdef HAVE_OPENGL
if( effects->compositingType() == OpenGLCompositing ) if( effects->compositingType() == OpenGLCompositing )
@ -619,4 +617,11 @@ void BoxSwitchEffect::paintWindowIcon( EffectWindow* w )
#endif #endif
} }
void BoxSwitchEffect::paintText( const QString& text )
{
int maxwidth = text_area.width();
QColor color = KColorScheme( QPalette::Active, KColorScheme::Window ).foreground();
effects->paintText( text, text_area.center(), maxwidth, color, text_font );
}
} // namespace } // namespace

View file

@ -18,6 +18,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include <QRect> #include <QRect>
#include <QRegion> #include <QRegion>
#include <QSize> #include <QSize>
#include <QFont>
#include <kwinglutils.h> #include <kwinglutils.h>
@ -59,6 +60,7 @@ class BoxSwitchEffect
void paintWindowThumbnail( EffectWindow* w ); void paintWindowThumbnail( EffectWindow* w );
void paintDesktopThumbnail( int iDesktop ); void paintDesktopThumbnail( int iDesktop );
void paintWindowIcon( EffectWindow* w ); void paintWindowIcon( EffectWindow* w );
void paintText( const QString& text );
bool mActivated; bool mActivated;
Window mInput; Window mInput;
@ -69,6 +71,7 @@ class BoxSwitchEffect
int highlight_margin; // TODO graphical background int highlight_margin; // TODO graphical background
QSize item_max_size; // maximum item display size (including highlight) QSize item_max_size; // maximum item display size (including highlight)
QRect text_area; QRect text_area;
QFont text_font;
QHash< EffectWindow*, ItemInfo* > windows; QHash< EffectWindow*, ItemInfo* > windows;
EffectWindowList original_windows; EffectWindowList original_windows;