compilation fixes from trunk (r621518, r621469)

svn path=/branches/work/kwin_composite/; revision=621785
This commit is contained in:
Philip Falkner 2007-01-09 19:34:49 +00:00
parent 877a4df9d6
commit 051143b3b7
2 changed files with 57 additions and 68 deletions

View file

@ -152,8 +152,8 @@
a->setText( i18n("Miscellaneous") );
DEF( I18N_NOOP("Mouse Emulation"), Qt::ALT+Qt::Key_F12, slotMouseEmulation() );
DEF( I18N_NOOP("Kill Window"), Qt::CTRL+Qt::Key_Delete, slotKillWindow() );
DEF( I18N_NOOP("Window Screenshot To Clipboard"), Qt::ALT+Qt::Key_Print, slotGrabWindow() );
DEF( I18N_NOOP("Desktop Screenshot To Clipboard"), Qt::CTRL+Qt::Key_Print, slotGrabDesktop() );
DEF( I18N_NOOP("Window Screenshot"), Qt::ALT+Qt::Key_Print, slotGrabWindow() );
DEF( I18N_NOOP("Desktop Screenshot"), Qt::CTRL+Qt::Key_Print, slotGrabDesktop() );
DEF( I18N_NOOP("Block Global Shortcuts"), 0, slotDisableGlobalShortcuts());
/*This belongs in taskbar rather than here, so it'll have to wait until after 2.2 is done.

View file

@ -60,7 +60,7 @@ QMenu* Workspace::clientPopup()
advanced_popup->setFont(KGlobalSettings::menuFont());
mKeepAboveOpAction = advanced_popup->addAction( i18n("Keep &Above Others") );
mKeepAboveOpAction->setIcon( KIcon( "up" ) );
mKeepAboveOpAction->setIcon( SmallIconSet( "up" ) );
KAction *kaction = qobject_cast<KAction*>( keys->action("Window Above Other Windows") );
if ( kaction!=0 )
mKeepAboveOpAction->setShortcut( kaction->globalShortcut().primary() );
@ -68,7 +68,7 @@ QMenu* Workspace::clientPopup()
mKeepAboveOpAction->setData( Options::KeepAboveOp );
mKeepBelowOpAction = advanced_popup->addAction( i18n("Keep &Below Others") );
mKeepBelowOpAction->setIcon( KIcon( "down" ) );
mKeepBelowOpAction->setIcon( SmallIconSet( "down" ) );
kaction = qobject_cast<KAction*>( keys->action("Window Below Other Windows") );
if ( kaction!=0 )
mKeepBelowOpAction->setShortcut( kaction->globalShortcut().primary() );
@ -76,7 +76,7 @@ QMenu* Workspace::clientPopup()
mKeepBelowOpAction->setData( Options::KeepBelowOp );
mFullScreenOpAction = advanced_popup->addAction( i18n("&Fullscreen") );
mFullScreenOpAction->setIcon( KIcon( "window_fullscreen" ) );
mFullScreenOpAction->setIcon( SmallIconSet( "window_fullscreen" ) );
kaction = qobject_cast<KAction*>( keys->action("Window Fullscreen") );
if ( kaction!=0 )
mFullScreenOpAction->setShortcut( kaction->globalShortcut().primary() );
@ -91,18 +91,18 @@ QMenu* Workspace::clientPopup()
mNoBorderOpAction->setData( Options::NoBorderOp );
QAction *action = advanced_popup->addAction( i18n("Window &Shortcut...") );
action->setIcon( KIcon("key_bindings") );
action->setIcon( SmallIconSet("key_bindings") );
kaction = qobject_cast<KAction*>( keys->action("Setup Window Shortcut") );
if ( kaction!=0 )
action->setShortcut( kaction->globalShortcut().primary() );
action->setData( Options::SetupWindowShortcutOp );
action = advanced_popup->addAction( i18n("&Special Window Settings...") );
action->setIcon( KIcon( "wizard" ) );
action->setIcon( SmallIconSet( "wizard" ) );
action->setData( Options::WindowRulesOp );
action = advanced_popup->addAction( i18n("&Special Application Settings...") );
action->setIcon( KIcon( "wizard" ) );
action->setIcon( SmallIconSet( "wizard" ) );
action->setData( Options::ApplicationRulesOp );
action = popup->addMenu( advanced_popup );
@ -111,28 +111,24 @@ QMenu* Workspace::clientPopup()
desk_popup_index = popup->actions().count();
if (options->useTranslucency){
QMenu *trans_popup = new QMenu( popup );
QVBoxLayout *transLayout = new QVBoxLayout(trans_popup);
trans_popup->setLayout( transLayout );
transButton = new QPushButton(trans_popup);
transButton->setObjectName("transButton");
transButton->setToolTip( i18n("Reset opacity to default value"));
transSlider = new QSlider(trans_popup);
transSlider->setObjectName( "transSlider" );
transSlider->setRange( 0, 100 );
transSlider->setValue( 100 );
transSlider->setOrientation( Qt::Vertical );
transSlider->setToolTip( i18n("Slide this to set the window's opacity"));
connect(transButton, SIGNAL(clicked()), SLOT(resetClientOpacity()));
connect(transButton, SIGNAL(clicked()), trans_popup, SLOT(hide()));
connect(transSlider, SIGNAL(valueChanged(int)), SLOT(setTransButtonText(int)));
connect(transSlider, SIGNAL(valueChanged(int)), this, SLOT(setPopupClientOpacity(int)));
trans_popup = new QMenu( popup );
trans_popup->setFont(KGlobalSettings::menuFont());
connect( trans_popup, SIGNAL( triggered(QAction*) ), this, SLOT( setPopupClientOpacity(QAction*)));
const int levels[] = { 100, 90, 75, 50, 25, 10 };
for( unsigned int i = 0;
i < sizeof( levels ) / sizeof( levels[ 0 ] );
++i )
{
action = trans_popup->addAction( QString::number( levels[ i ] ) + "%" );
action->setCheckable( true );
action->setData( levels[ i ] );
}
action = popup->addMenu( trans_popup );
action->setText( i18n("&Opacity") );
}
mMoveOpAction = popup->addAction( i18n("&Move") );
mMoveOpAction->setIcon( KIcon( "move" ) );
mMoveOpAction->setIcon( SmallIconSet( "move" ) );
kaction = qobject_cast<KAction*>( keys->action("Window Move") );
if ( kaction!=0 )
mMoveOpAction->setShortcut( kaction->globalShortcut().primary() );
@ -170,13 +166,13 @@ QMenu* Workspace::clientPopup()
!KAuthorized::authorizeControlModules(Workspace::configModules(true)).isEmpty())
{
action = popup->addAction( i18n("Configur&e Window Behavior...") );
action->setIcon( KIcon( "configure" ) );
action->setIcon( SmallIconSet( "configure" ) );
connect( action, SIGNAL( triggered() ), this, SLOT( configureWM() ) );
popup->addSeparator();
}
mCloseOpAction = popup->addAction( i18n("&Close") );
mCloseOpAction->setIcon( KIcon( "fileclose" ) );
mCloseOpAction->setIcon( SmallIconSet( "fileclose" ) );
kaction = qobject_cast<KAction*>( keys->action("Window Close") );
if ( kaction!=0 )
mCloseOpAction->setShortcut( kaction->globalShortcut().primary() );
@ -185,31 +181,14 @@ QMenu* Workspace::clientPopup()
return popup;
}
//sets the transparency of the client to given value(given by slider)
void Workspace::setPopupClientOpacity(int value)
void Workspace::setPopupClientOpacity( QAction* action )
{
// TODO
if( active_popup_client == NULL )
return;
int level = action->data().toInt();
active_popup_client->setOpacity( level / 100.0 );
}
void Workspace::setTransButtonText(int value)
{
value = 100 - value;
if(value < 0)
transButton->setText("000 %");
else if (value >= 100 )
transButton->setText("100 %");
else if(value < 10)
transButton->setText("00"+QString::number(value)+" %");
else if(value < 100)
transButton->setText('0'+QString::number(value)+" %");
}
void Workspace::resetClientOpacity()
{
// TODO
}
/*!
The client popup menu will become visible soon.
@ -244,6 +223,16 @@ void Workspace::clientPopupAboutToShow()
mNoBorderOpAction->setChecked( active_popup_client->noBorder() );
mMinimizeOpAction->setEnabled( active_popup_client->isMinimizable() );
mCloseOpAction->setEnabled( active_popup_client->isCloseable() );
if (options->useTranslucency)
{
foreach( QAction* action, trans_popup->actions())
{
if( action->data().toInt() == qRound( active_popup_client->opacity() * 100 ))
action->setChecked( true );
else
action->setChecked( false );
}
}
}
@ -441,7 +430,7 @@ void Workspace::clientPopupActivated( QAction *action )
}
void Workspace::performWindowOperation( Client* c, Options::WindowOperation op )
void Workspace::performWindowOperation( Client* c, Options::WindowOperation op )
{
if ( !c )
return;
@ -450,19 +439,19 @@ void Workspace::performWindowOperation( Client* c, Options::WindowOperation op )
QCursor::setPos( c->geometry().center() );
if (op == Options::ResizeOp || op == Options::UnrestrictedResizeOp )
QCursor::setPos( c->geometry().bottomRight());
switch ( op )
switch ( op )
{
case Options::MoveOp:
c->performMouseCommand( Options::MouseMove, QCursor::pos() );
c->performMouseCommand( Options::MouseMove, cursorPos() );
break;
case Options::UnrestrictedMoveOp:
c->performMouseCommand( Options::MouseUnrestrictedMove, QCursor::pos() );
c->performMouseCommand( Options::MouseUnrestrictedMove, cursorPos() );
break;
case Options::ResizeOp:
c->performMouseCommand( Options::MouseResize, QCursor::pos() );
c->performMouseCommand( Options::MouseResize, cursorPos() );
break;
case Options::UnrestrictedResizeOp:
c->performMouseCommand( Options::MouseUnrestrictedResize, QCursor::pos() );
c->performMouseCommand( Options::MouseUnrestrictedResize, cursorPos() );
break;
case Options::CloseOp:
c->closeWindow();
@ -484,7 +473,7 @@ void Workspace::performWindowOperation( Client* c, Options::WindowOperation op )
c->minimize();
break;
case Options::ShadeOp:
c->performMouseCommand( Options::MouseShade, QCursor::pos());
c->performMouseCommand( Options::MouseShade, cursorPos());
break;
case Options::OnAllDesktopsOp:
c->setOnAllDesktops( !c->isOnAllDesktops() );
@ -514,7 +503,7 @@ void Workspace::performWindowOperation( Client* c, Options::WindowOperation op )
break;
}
case Options::OperationsOp:
c->performMouseCommand( Options::MouseShade, QCursor::pos());
c->performMouseCommand( Options::MouseShade, cursorPos());
break;
case Options::WindowRulesOp:
editWindowRules( c, false );
@ -539,7 +528,7 @@ void Workspace::performWindowOperation( Client* c, Options::WindowOperation op )
bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPos, bool handled )
{
bool replay = false;
switch (command)
switch (command)
{
case Options::MouseRaise:
workspace()->raiseClient( this );
@ -679,10 +668,10 @@ bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPo
workspace()->windowToNextDesktop( this );
break;
case Options::MouseOpacityMore:
// TODO
setOpacity( qMin( opacity() + 0.1, 1.0 ));
break;
case Options::MouseOpacityLess:
// TODO
setOpacity( qMax( opacity() - 0.1, 0.0 ));
break;
case Options::MouseNothing:
replay = true;
@ -706,13 +695,13 @@ void Workspace::slotActivateAttentionWindow()
void Workspace::slotSwitchDesktopNext()
{
int d = currentDesktop() + 1;
if ( d > numberOfDesktops() )
if ( d > numberOfDesktops() )
{
if ( options->rollOverDesktops )
if ( options->rollOverDesktops )
{
d = 1;
}
else
else
{
return;
}
@ -723,7 +712,7 @@ void Workspace::slotSwitchDesktopNext()
void Workspace::slotSwitchDesktopPrevious()
{
int d = currentDesktop() - 1;
if ( d <= 0 )
if ( d <= 0 )
{
if ( options->rollOverDesktops )
d = numberOfDesktops();
@ -908,7 +897,7 @@ void Workspace::slotWindowToNextDesktop()
{
windowToNextDesktop( active_popup_client ? active_popup_client : active_client );
}
void Workspace::windowToNextDesktop( Client* c )
{
int d = currentDesktop() + 1;
@ -930,7 +919,7 @@ void Workspace::slotWindowToPreviousDesktop()
{
windowToPreviousDesktop( active_popup_client ? active_popup_client : active_client );
}
void Workspace::windowToPreviousDesktop( Client* c )
{
int d = currentDesktop() - 1;
@ -1025,7 +1014,7 @@ void Workspace::slotSendToDesktop( QAction *action )
int desk = action->data().toInt();
if ( !active_popup_client )
return;
if ( desk == 0 )
if ( desk == 0 )
{ // the 'on_all_desktops' menu entry
active_popup_client->setOnAllDesktops( !active_popup_client->isOnAllDesktops());
return;
@ -1184,7 +1173,7 @@ bool Workspace::shortcutAvailable( const KShortcut& cut, Client* ignore ) const
++it )
{
if( (*it) != ignore && (*it)->shortcut() == cut )
return false;
return false;
}
return true;
}