clean this up a bit, move the bottom aligned text up a bit so it's a 2/3rds, make sure the selection item is always pointing at the right place
took a stab at updating the items when the window information changes, but couldn't get anything i'm used to to work (KWindowSystem, installX11EventFilter); someone with more kwin-foo than i (not hard ;) will need to take this one on svn path=/trunk/KDE/kdebase/workspace/; revision=984108icc-effect-5.14.5
parent
1d5c437fb7
commit
3f98bb5616
46
tabbox.cpp
46
tabbox.cpp
|
@ -94,7 +94,6 @@ TabBox::TabBox( Workspace *ws )
|
||||||
CopyFromParent, CopyFromParent, CopyFromParent, CWOverrideRedirect, &attr );
|
CopyFromParent, CopyFromParent, CopyFromParent, CWOverrideRedirect, &attr );
|
||||||
outline_bottom = XCreateWindow( QX11Info::display(), QX11Info::appRootWindow(), 0, 0, 1, 1, 0,
|
outline_bottom = XCreateWindow( QX11Info::display(), QX11Info::appRootWindow(), 0, 0, 1, 1, 0,
|
||||||
CopyFromParent, CopyFromParent, CopyFromParent, CWOverrideRedirect, &attr );
|
CopyFromParent, CopyFromParent, CopyFromParent, CWOverrideRedirect, &attr );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TabBox::~TabBox()
|
TabBox::~TabBox()
|
||||||
|
@ -369,16 +368,23 @@ void TabBox::initScene()
|
||||||
// add clients to scene
|
// add clients to scene
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
foreach( Client* client, clients )
|
foreach( Client* c, clients )
|
||||||
{
|
{
|
||||||
TabBoxWindowItem* item = new TabBoxWindowItem( client, this );
|
TabBoxWindowItem* item = new TabBoxWindowItem( c, this );
|
||||||
item->setHeight( lineHeight );
|
item->setHeight( lineHeight );
|
||||||
item->setWidth( width() - left - right );
|
item->setWidth( width() - left - right );
|
||||||
item->setShowMiniIcons( showMiniIcon );
|
item->setShowMiniIcons( showMiniIcon );
|
||||||
item->setPos( left, top + lineHeight * index );
|
item->setPos( left, top + lineHeight * index );
|
||||||
scene->addItem( item );
|
scene->addItem( item );
|
||||||
|
|
||||||
|
if ( selectionItem && c == client )
|
||||||
|
{
|
||||||
|
selectionItem->setPos( item->pos() );
|
||||||
|
}
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -401,7 +407,6 @@ void TabBox::initScene()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Shows the next or previous item, depending on \a next
|
Shows the next or previous item, depending on \a next
|
||||||
*/
|
*/
|
||||||
|
@ -951,7 +956,9 @@ void TabBoxWindowItem::paint( QPainter* painter, const QStyleOptionGraphicsItem*
|
||||||
icon = *menu_pix;
|
icon = *menu_pix;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !icon.isNull())
|
const int iconX = x + 5;
|
||||||
|
const int iconY = ( m_height - iconWidth ) / 2;
|
||||||
|
if( !icon.isNull() )
|
||||||
{
|
{
|
||||||
if( m_client->isMinimized())
|
if( m_client->isMinimized())
|
||||||
KIconEffect::semiTransparent( icon );
|
KIconEffect::semiTransparent( icon );
|
||||||
|
@ -960,32 +967,39 @@ void TabBoxWindowItem::paint( QPainter* painter, const QStyleOptionGraphicsItem*
|
||||||
KIconEffect *effect = KIconLoader::global()->iconEffect();
|
KIconEffect *effect = KIconLoader::global()->iconEffect();
|
||||||
icon = effect->apply( icon, KIconLoader::Desktop, KIconLoader::ActiveState );
|
icon = effect->apply( icon, KIconLoader::Desktop, KIconLoader::ActiveState );
|
||||||
}
|
}
|
||||||
painter->drawPixmap( x+5, (m_height - iconWidth)/2, icon );
|
painter->drawPixmap( iconX, iconY, icon );
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate text to display
|
// generate text to display
|
||||||
QString s;
|
QString s;
|
||||||
|
|
||||||
if ( !m_client->isOnDesktop(m_parent->workspace()->currentDesktop()) )
|
if ( !m_client->isOnDesktop(m_parent->workspace()->currentDesktop()) )
|
||||||
s = m_parent->workspace()->desktopName(m_client->desktop()) + ": ";
|
s = m_parent->workspace()->desktopName(m_client->desktop()).append(": ");
|
||||||
|
|
||||||
|
int textOptions = Qt::AlignLeft | Qt::AlignBottom | Qt ::TextSingleLine;
|
||||||
|
QFont font = painter->font();
|
||||||
|
font.setPointSize( KGlobalSettings::smallestReadableFont().pointSize() );
|
||||||
|
|
||||||
if ( m_client->isMinimized() )
|
if ( m_client->isMinimized() )
|
||||||
|
{
|
||||||
s += '(' + m_client->caption() + ')';
|
s += '(' + m_client->caption() + ')';
|
||||||
|
font.setItalic( true );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
s += m_client->caption();
|
s += m_client->caption();
|
||||||
|
|
||||||
QFont font = painter->font();
|
|
||||||
font.setPointSize( KGlobalSettings::smallestReadableFont().pointSize() );
|
|
||||||
QFontMetrics fm = QFontMetrics( font );
|
QFontMetrics fm = QFontMetrics( font );
|
||||||
s = fm.elidedText( s, Qt::ElideMiddle, m_width - 5 - iconWidth - 8 );
|
const int textWidth = m_width - iconX - iconWidth;
|
||||||
painter->setPen( Plasma::Theme::defaultTheme()->color( Plasma::Theme::TextColor ) );
|
int textHeight = m_height - (iconX * 2);
|
||||||
if( m_client->isMinimized() )
|
|
||||||
{
|
if (!m_showMiniIcons && fm.height() < m_height * 2 / 3) {
|
||||||
font.setItalic( true );
|
textHeight = m_height - (m_height / 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s = fm.elidedText( s, Qt::ElideMiddle, textWidth );
|
||||||
|
painter->setPen( Plasma::Theme::defaultTheme()->color( Plasma::Theme::TextColor ) );
|
||||||
painter->setFont( font );
|
painter->setFont( font );
|
||||||
painter->drawText( x+5 + iconWidth + 8, 0, m_width - 5 - iconWidth - 8, m_height - (m_showMiniIcons ? 2 : 4),
|
painter->drawText( iconX + iconWidth + 8, iconY, textWidth, textHeight, textOptions, s );
|
||||||
Qt::AlignLeft | Qt::AlignBottom | Qt::TextSingleLine, s );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabBoxWindowItem::drawBackground( QPainter* painter, const QStyleOptionGraphicsItem* , QWidget* )
|
void TabBoxWindowItem::drawBackground( QPainter* painter, const QStyleOptionGraphicsItem* , QWidget* )
|
||||||
|
|
Loading…
Reference in New Issue