Synchronize Show Desktop Wording in TabBox Effects

Use "Show Desktop" for the desktop entry with the same
message as in "normal" TabBox.

FEATURE: 273478
FIXED-IN: 4.9.0
REVIEW: 104436
This commit is contained in:
Martin Gräßlin 2012-03-29 10:34:33 +02:00
parent e89fc7333f
commit 96c1046158
4 changed files with 42 additions and 6 deletions

View file

@ -577,7 +577,7 @@ void CoverSwitchEffect::slotTabBoxAdded(int mode)
captionFrame->setGeometry(frameRect);
captionFrame->setIconSize(QSize(frameRect.height(), frameRect.height()));
// And initial contents
captionFrame->setText(selected_window->caption());
updateCaption();
captionFrame->setIcon(selected_window->icon());
}
@ -657,7 +657,7 @@ void CoverSwitchEffect::slotTabBoxUpdated()
}
selected_window = effects->currentTabBoxWindow();
currentWindowList = effects->currentTabBoxWindowList();
captionFrame->setText(selected_window->caption());
updateCaption();
captionFrame->setIcon(selected_window->icon());
}
}
@ -1000,4 +1000,17 @@ bool CoverSwitchEffect::isActive() const
return mActivated || stop || stopRequested;
}
void CoverSwitchEffect::updateCaption()
{
if (!selected_window || !windowTitle) {
return;
}
if (selected_window->isDesktop()) {
captionFrame->setText(i18nc("Special entry in alt+tab list for minimizing all windows",
"Show Desktop"));
} else {
captionFrame->setText(selected_window->caption());
}
}
} // namespace

View file

@ -65,6 +65,11 @@ private:
void paintFrontWindow(EffectWindow* frontWindow, int width, int leftWindows, int rightWindows, bool reflectedWindow);
void paintWindows(const EffectWindowList& windows, bool left, bool reflectedWindows, EffectWindow* additionalWindow = NULL);
void abort();
/**
* Updates the caption of the caption frame.
* Taking care of rewording the desktop client.
**/
void updateCaption();
bool mActivated;
float angle;

View file

@ -564,7 +564,7 @@ void FlipSwitchEffect::slotTabBoxUpdated()
}
}
m_selectedWindow = effects->currentTabBoxWindow();
m_captionFrame->setText(m_selectedWindow->caption());
updateCaption();
m_captionFrame->setIcon(m_selectedWindow->icon());
}
}
@ -662,7 +662,7 @@ void FlipSwitchEffect::setActive(bool activate, FlipSwitchMode mode)
QFontMetrics(m_captionFont).height());
m_captionFrame->setGeometry(frameRect);
m_captionFrame->setIconSize(QSize(frameRect.height(), frameRect.height()));
m_captionFrame->setText(m_selectedWindow->caption());
updateCaption();
m_captionFrame->setIcon(m_selectedWindow->icon());
effects->addRepaintFull();
} else {
@ -886,7 +886,7 @@ void FlipSwitchEffect::grabbedKeyboardEvent(QKeyEvent* e)
}
}
if (found) {
m_captionFrame->setText(m_selectedWindow->caption());
updateCaption();
m_captionFrame->setIcon(m_selectedWindow->icon());
scheduleAnimation(DirectionForward);
}
@ -914,7 +914,7 @@ void FlipSwitchEffect::grabbedKeyboardEvent(QKeyEvent* e)
}
}
if (found) {
m_captionFrame->setText(m_selectedWindow->caption());
updateCaption();
m_captionFrame->setIcon(m_selectedWindow->icon());
scheduleAnimation(DirectionBackward);
}
@ -939,6 +939,19 @@ bool FlipSwitchEffect::isActive() const
return m_active;
}
void FlipSwitchEffect::updateCaption()
{
if (!m_selectedWindow) {
return;
}
if (m_selectedWindow->isDesktop()) {
m_captionFrame->setText(i18nc("Special entry in alt+tab list for minimizing all windows",
"Show Desktop"));
} else {
m_captionFrame->setText(m_selectedWindow->caption());
}
}
//*************************************************************
// Item Info
//*************************************************************

View file

@ -76,6 +76,11 @@ private:
bool isSelectableWindow(EffectWindow *w) const;
void scheduleAnimation(const SwitchingDirection& direction, int distance = 1);
void adjustWindowMultiScreen(const EffectWindow *w, WindowPaintData& data);
/**
* Updates the caption of the caption frame.
* Taking care of rewording the desktop client.
**/
void updateCaption();
QQueue< SwitchingDirection> m_scheduledDirections;
EffectWindow* m_selectedWindow;
QTimeLine m_timeLine;