~ubuntu-branches/ubuntu/natty/kdemultimedia/natty-proposed

« back to all changes in this revision

Viewing changes to juk/systemtray.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Debian Qt/KDE Maintainers
  • Date: 2011-05-26 02:41:36 UTC
  • mfrom: (0.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 108.
  • Revision ID: james.westby@ubuntu.com-20110526024136-jjwsigfy402jhupm
Tags: upstream-4.6.3
ImportĀ upstreamĀ versionĀ 4.6.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#include <kwindowsystem.h>
32
32
 
33
33
#include <QTimer>
 
34
#include <QWheelEvent>
34
35
#include <QColor>
35
36
#include <QPushButton>
36
37
#include <QPalette>
61
62
    connect(m_timer, SIGNAL(timeout()), SLOT(timerExpired()));
62
63
    setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
63
64
 
64
 
    // I'd like StyledPanel but it doesn't work in the default KDE style...
65
 
    setFrameStyle(Box | Plain);
66
 
    setLineWidth(3);
 
65
    // Workaround transparent background in Oxygen when (ab-)using Qt::ToolTip
 
66
    setAutoFillBackground(true);
 
67
 
 
68
    setFrameStyle(StyledPanel | Plain);
 
69
    setLineWidth(2);
67
70
}
68
71
 
69
72
void PassiveInfo::startTimer(int delay)
117
120
{
118
121
}
119
122
 
 
123
void PassiveInfo::wheelEvent(QWheelEvent *e)
 
124
{
 
125
    if(e->delta() >= 0) {
 
126
        emit nextSong();
 
127
    }
 
128
    else {
 
129
        emit previousSong();
 
130
    }
 
131
 
 
132
    e->accept();
 
133
}
 
134
 
120
135
void PassiveInfo::positionSelf()
121
136
{
122
137
    // Start with a QRect of our size, move it to the right spot.
187
202
    cm->addAction( action("togglePopups") );
188
203
 
189
204
    m_fadeTimer = new QTimer(this);
190
 
    m_fadeTimer->setObjectName("systrayFadeTimer");
 
205
    m_fadeTimer->setObjectName( QLatin1String("systrayFadeTimer" ));
191
206
    connect(m_fadeTimer, SIGNAL(timeout()), SLOT(slotNextStep()));
192
207
 
193
208
    // Handle wheel events
364
379
    m_popup = new PassiveInfo(this);
365
380
    connect(m_popup, SIGNAL(destroyed()), SLOT(slotPopupDestroyed()));
366
381
    connect(m_popup, SIGNAL(timeExpired()), SLOT(slotFadeOut()));
 
382
    connect(m_popup, SIGNAL(nextSong()), SLOT(slotForward()));
 
383
    connect(m_popup, SIGNAL(previousSong()), SLOT(slotBack()));
367
384
 
368
385
    KHBox *box = new KHBox(m_popup);
369
386
    box->setSpacing(15); // Add space between text and buttons
407
424
    buttonBox->setSpacing(3);
408
425
 
409
426
    QPushButton *forwardButton = new QPushButton(m_forwardPix, 0, buttonBox);
410
 
    forwardButton->setObjectName("popup_forward");
 
427
    forwardButton->setObjectName( QLatin1String("popup_forward" ));
411
428
    connect(forwardButton, SIGNAL(clicked()), SLOT(slotForward()));
412
429
 
413
430
    QPushButton *backButton = new QPushButton(m_backPix, 0, buttonBox);
414
 
    backButton->setObjectName("popup_back");
 
431
    backButton->setObjectName( QLatin1String("popup_back" ));
415
432
    connect(backButton, SIGNAL(clicked()), SLOT(slotBack()));
416
433
}
417
434
 
486
503
            myCover = cover.scaled(iconSize, iconSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
487
504
        }
488
505
 
489
 
        QString html = QString("%1").arg(tip);
490
 
        html.replace(" ", "&nbsp;");
491
 
        KStatusNotifierItem::setToolTip(QIcon(myCover), i18n("JuK"), html);
 
506
        KStatusNotifierItem::setToolTip(QIcon(myCover), i18n("JuK"), tip);
492
507
    }
493
508
}
494
509