Adding option to only show the desktop name in the desktop change OSD.
This brings back the behaviour of the old popup info. FEATURE: 193926 svn path=/trunk/KDE/kdebase/workspace/; revision=1028358icc-effect-5.14.5
parent
6339148ecb
commit
b61c6b1ccb
|
@ -43,6 +43,7 @@ DesktopChangeOSD::DesktopChangeOSD( Workspace* ws )
|
|||
, m_active( false )
|
||||
, m_show( false )
|
||||
, m_delayTime( 0 )
|
||||
, m_textOnly( false )
|
||||
{
|
||||
setWindowFlags( Qt::X11BypassWindowManagerHint );
|
||||
setFrameStyle( QFrame::NoFrame );
|
||||
|
@ -58,14 +59,14 @@ DesktopChangeOSD::DesktopChangeOSD( Workspace* ws )
|
|||
m_item_frame.setCacheAllRenderedFrames( true );
|
||||
m_item_frame.setEnabledBorders( Plasma::FrameSvg::AllBorders );
|
||||
|
||||
reconfigure();
|
||||
|
||||
m_delayedHideTimer.setSingleShot( true );
|
||||
connect( &m_delayedHideTimer, SIGNAL(timeout()), this, SLOT(hide()) );
|
||||
|
||||
m_scene = new QGraphicsScene( 0 );
|
||||
setScene( m_scene );
|
||||
|
||||
reconfigure();
|
||||
|
||||
m_scene->addItem( new DesktopChangeText( m_wspace ) );
|
||||
}
|
||||
|
||||
|
@ -80,6 +81,8 @@ void DesktopChangeOSD::reconfigure()
|
|||
const KConfigGroup cg = c->group( "PopupInfo" );
|
||||
m_show = cg.readEntry( "ShowPopup", false );
|
||||
m_delayTime = cg.readEntry( "PopupHideDelay", 1000 );
|
||||
m_textOnly = cg.readEntry( "TextOnly", false );
|
||||
numberDesktopsChanged();
|
||||
}
|
||||
|
||||
void DesktopChangeOSD::desktopChanged( int old )
|
||||
|
@ -184,6 +187,9 @@ void DesktopChangeOSD::desktopChanged( int old )
|
|||
}
|
||||
if( m_active )
|
||||
{
|
||||
// for text only we need to resize
|
||||
if( m_textOnly )
|
||||
resize();
|
||||
// already active - just update and reset timer
|
||||
update();
|
||||
}
|
||||
|
@ -227,10 +233,13 @@ void DesktopChangeOSD::numberDesktopsChanged()
|
|||
}
|
||||
}
|
||||
|
||||
for( int i=1; i<=m_wspace->numberOfDesktops(); i++ )
|
||||
if( !m_textOnly )
|
||||
{
|
||||
DesktopChangeItem* item = new DesktopChangeItem( m_wspace, this, i );
|
||||
m_scene->addItem( item );
|
||||
for( int i=1; i<=m_wspace->numberOfDesktops(); i++ )
|
||||
{
|
||||
DesktopChangeItem* item = new DesktopChangeItem( m_wspace, this, i );
|
||||
m_scene->addItem( item );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -275,6 +284,14 @@ void DesktopChangeOSD::resize()
|
|||
itemOffset *= (float)desktopGridSize.width()*0.5f;
|
||||
}
|
||||
|
||||
// set size to the desktop name if the "pager" is not shown
|
||||
if( m_textOnly )
|
||||
{
|
||||
height = fontMetrics().height() + 4 + top + bottom;
|
||||
width = fontMetrics().boundingRect( m_wspace->desktopName( m_wspace->currentDesktop() ) ).width() +
|
||||
4 + left + right;
|
||||
}
|
||||
|
||||
QRect rect = QRect( screenRect.x() + (screenRect.width()-width)/2,
|
||||
screenRect.y() + (screenRect.height()-height)/2,
|
||||
width,
|
||||
|
@ -307,7 +324,10 @@ void DesktopChangeOSD::resize()
|
|||
{
|
||||
text->setPos( left, top );
|
||||
text->setWidth( width - left - right );
|
||||
text->setHeight( fontMetrics().height() );
|
||||
if( m_textOnly )
|
||||
text->setHeight( fontMetrics().height() + 4 );
|
||||
else
|
||||
text->setHeight( fontMetrics().height() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,6 +80,7 @@ class DesktopChangeOSD : public QGraphicsView
|
|||
QTimer m_delayedHideTimer;
|
||||
bool m_show;
|
||||
int m_delayTime;
|
||||
bool m_textOnly;
|
||||
};
|
||||
|
||||
class DesktopChangeItem : public QObject, public QGraphicsItem
|
||||
|
|
|
@ -175,9 +175,8 @@ void KWinDesktopConfig::init()
|
|||
connect( m_ui->activityCheckBox, SIGNAL(stateChanged(int)), SLOT(changed()));
|
||||
connect( m_ui->desktopNames, SIGNAL(changed()), SLOT(changed()));
|
||||
connect( m_ui->popupInfoCheckBox, SIGNAL(toggled(bool)), SLOT(changed()));
|
||||
connect( m_ui->popupInfoCheckBox, SIGNAL(toggled(bool)), m_ui->popupHideSpinBox, SLOT(setEnabled(bool)));
|
||||
connect( m_ui->popupInfoCheckBox, SIGNAL(toggled(bool)), m_ui->hideLabel, SLOT(setEnabled(bool)));
|
||||
connect( m_ui->popupHideSpinBox, SIGNAL(valueChanged(int)), SLOT(changed()));
|
||||
connect( m_ui->desktopLayoutIndicatorCheckBox, SIGNAL(stateChanged(int)), SLOT(changed()));
|
||||
connect( m_editor, SIGNAL(keyChange()), SLOT(changed()));
|
||||
connect( m_ui->allShortcutsCheckBox, SIGNAL(stateChanged(int)), SLOT(slotShowAllShortcuts()));
|
||||
connect( m_ui->effectComboBox, SIGNAL(currentIndexChanged(int)), SLOT(changed()));
|
||||
|
@ -240,6 +239,7 @@ void KWinDesktopConfig::defaults()
|
|||
// popup info
|
||||
m_ui->popupInfoCheckBox->setChecked( false );
|
||||
m_ui->popupHideSpinBox->setValue( 1000 );
|
||||
m_ui->desktopLayoutIndicatorCheckBox->setChecked( true );
|
||||
|
||||
m_ui->effectComboBox->setCurrentIndex( 1 );
|
||||
|
||||
|
@ -270,8 +270,7 @@ void KWinDesktopConfig::load()
|
|||
KConfigGroup popupInfo( m_config, "PopupInfo" );
|
||||
m_ui->popupInfoCheckBox->setChecked( popupInfo.readEntry( "ShowPopup", false ));
|
||||
m_ui->popupHideSpinBox->setValue( popupInfo.readEntry( "PopupHideDelay", 1000 ));
|
||||
m_ui->popupHideSpinBox->setEnabled( m_ui->popupInfoCheckBox->isChecked() );
|
||||
m_ui->hideLabel->setEnabled( m_ui->popupInfoCheckBox->isChecked() );
|
||||
m_ui->desktopLayoutIndicatorCheckBox->setChecked( !popupInfo.readEntry( "TextOnly", false) );
|
||||
|
||||
// Effect for desktop switching
|
||||
// Set current option to "none" if no plugin is activated.
|
||||
|
@ -314,6 +313,7 @@ void KWinDesktopConfig::save()
|
|||
KConfigGroup popupInfo( m_config, "PopupInfo" );
|
||||
popupInfo.writeEntry( "ShowPopup", m_ui->popupInfoCheckBox->isChecked() );
|
||||
popupInfo.writeEntry( "PopupHideDelay", m_ui->popupHideSpinBox->value() );
|
||||
popupInfo.writeEntry( "TextOnly", !m_ui->desktopLayoutIndicatorCheckBox->isChecked() );
|
||||
|
||||
// Effect desktop switching
|
||||
KConfigGroup effectconfig( m_config, "Plugins" );
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>560</width>
|
||||
<width>622</width>
|
||||
<height>258</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -260,7 +260,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
@ -273,6 +273,16 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="desktopLayoutIndicatorCheckBox">
|
||||
<property name="toolTip">
|
||||
<string>Enabling this option will show a small preview of the desktop layout indicating the selected desktop.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show desktop layout indicators</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
Loading…
Reference in New Issue