Make desktopChanged() a slot

The method desktopChanged() was formerly called direcly and is now a slot,
which is connected with the signal currentDesktopChanged().
This commit is contained in:
Arthur Arlt 2011-06-27 17:45:49 +02:00
parent 8c430e22b6
commit ad2fb989cc
3 changed files with 8 additions and 5 deletions

View file

@ -63,6 +63,7 @@ DesktopChangeOSD::DesktopChangeOSD(Workspace* ws)
m_delayedHideTimer.setSingleShot(true);
connect(&m_delayedHideTimer, SIGNAL(timeout()), this, SLOT(hide()));
connect(ws, SIGNAL(currentDesktopChanged(int)), this, SLOT(desktopChanged(int)));
m_scene = new QGraphicsScene(0);
setScene(m_scene);
@ -89,6 +90,9 @@ void DesktopChangeOSD::reconfigure()
void DesktopChangeOSD::desktopChanged(int old)
{
// Not for the very first time, only if something changed and there are more than 1 desktops
if (old == 0 || old == m_wspace->currentDesktop() || m_wspace->numberOfDesktops() <= 1)
return;
if (!m_show)
return;
// we have to stop in case the old desktop does not exist anymore

View file

@ -65,12 +65,12 @@ private:
class DesktopChangeOSD : public QGraphicsView
{
Q_OBJECT
public:
DesktopChangeOSD(Workspace* ws);
~DesktopChangeOSD();
void reconfigure();
void desktopChanged(int old);
void numberDesktopsChanged();
inline Plasma::FrameSvg* itemFrame() {
@ -95,6 +95,9 @@ private:
bool m_show;
int m_delayTime;
bool m_textOnly;
private Q_SLOTS:
void desktopChanged(int old);
};
class DesktopChangeItem : public QObject, public QGraphicsItem

View file

@ -1330,10 +1330,6 @@ bool Workspace::setCurrentDesktop(int new_desktop)
// s += QString::number( desktop_focus_chain[i] ) + ", ";
//kDebug( 1212 ) << s << "}\n";
// Not for the very first time, only if something changed and there are more than 1 desktops
if (old_desktop != 0 && old_desktop != new_desktop && numberOfDesktops() > 1)
desktop_change_osd->desktopChanged(old_desktop);
if (compositing())
addRepaintFull();