"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/mediawidget.cpp" between
kaffeine-2.0.17.tar.gz and kaffeine-2.0.18.tar.gz

About: Kaffeine is a full featured Multimedia-Player for KDE (default backend is xine).

mediawidget.cpp  (kaffeine-2.0.17):mediawidget.cpp  (kaffeine-2.0.18)
skipping to change at line 33 skipping to change at line 33
#include <KActionCollection> #include <KActionCollection>
#include <KConfigGroup> #include <KConfigGroup>
#include <KSharedConfig> #include <KSharedConfig>
#include <KToolBar> #include <KToolBar>
#include <QAbstractItemView> #include <QAbstractItemView>
#include <QBoxLayout> #include <QBoxLayout>
#include <QComboBox> #include <QComboBox>
#include <QContextMenuEvent> #include <QContextMenuEvent>
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QDBusInterface> #include <QDBusInterface>
#include <QEvent>
#include <QFileDialog> #include <QFileDialog>
#include <QLabel> #include <QLabel>
#include <QMenu> #include <QMenu>
#include <QMimeData> #include <QMimeData>
#include <QPushButton> #include <QPushButton>
#include <QStringListModel> #include <QStringListModel>
#include <QTimeEdit> #include <QTimeEdit>
#include <QTimer> #include <QTimer>
#include <QWidgetAction> #include <QWidgetAction>
#include <QX11Info> #include <QX11Info>
skipping to change at line 778 skipping to change at line 779
} }
void MediaWidget::setVolume(int volume) void MediaWidget::setVolume(int volume)
{ {
// QSlider ensures that the value is within the range // QSlider ensures that the value is within the range
volumeSlider->setValue(volume); volumeSlider->setValue(volume);
} }
void MediaWidget::setVolumeUnderMouse(int volume) void MediaWidget::setVolumeUnderMouse(int volume)
{ {
if (!backend->underMouse())
return;
if (volume == 100 || !volume) if (volume == 100 || !volume)
osdWidget->showText(i18nc("osd", "Volume: %1%", volume), 1500); osdWidget->showText(i18nc("osd", "Volume: %1%", volume), 1500);
else else
setVolume(volume); setVolume(volume);
} }
void MediaWidget::toggleMuted() void MediaWidget::toggleMuted()
{ {
muteAction->trigger(); muteAction->trigger();
} }
skipping to change at line 1312 skipping to change at line 1310
void MediaWidget::dropEvent(QDropEvent *event) void MediaWidget::dropEvent(QDropEvent *event)
{ {
const QMimeData *mimeData = event->mimeData(); const QMimeData *mimeData = event->mimeData();
if (mimeData->hasUrls()) { if (mimeData->hasUrls()) {
emit playlistUrlsDropped(mimeData->urls()); emit playlistUrlsDropped(mimeData->urls());
event->acceptProposedAction(); event->acceptProposedAction();
} }
} }
void MediaWidget::keyPressEvent(QKeyEvent *event) bool MediaWidget::event(QEvent *event)
{ {
int key = event->key(); switch (event->type()) {
case QEvent::ShortcutOverride:
if (backend->hasDvdMenu()) { {
switch (key){ QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
case Qt::Key_Return: int key = keyEvent->key();
case Qt::Key_Up:
case Qt::Key_Down: if (backend->hasDvdMenu()) {
case Qt::Key_Left: switch (key){
case Qt::Key_Right: case Qt::Key_Return:
backend->dvdNavigate(key); case Qt::Key_Up:
case Qt::Key_Down:
case Qt::Key_Left:
case Qt::Key_Right:
backend->dvdNavigate(key);
event->accept();
return true;
}
}
break;
} }
default:
break;
} }
return QWidget::event(event);
}
void MediaWidget::keyPressEvent(QKeyEvent *event)
{
int key = event->key();
if ((key >= Qt::Key_0) && (key <= Qt::Key_9)) { if ((key >= Qt::Key_0) && (key <= Qt::Key_9)) {
event->accept();
emit osdKeyPressed(key); emit osdKeyPressed(key);
} else { } else {
QWidget::keyPressEvent(event); QWidget::keyPressEvent(event);
} }
} }
void MediaWidget::resizeEvent(QResizeEvent *event) void MediaWidget::resizeEvent(QResizeEvent *event)
{ {
osdWidget->resize(event->size()); osdWidget->resize(event->size());
QWidget::resizeEvent(event); QWidget::resizeEvent(event);
} }
void MediaWidget::wheelEvent(QWheelEvent *event) void MediaWidget::wheelEvent(QWheelEvent *event)
{ {
int shortSkipDuration = Configuration::instance()->getShortSkipDuration() int y = event->delta();
; int delta = (y < 0) ? -1 : 1;
int currentTime =
(backend->getCurrentTime() - ((25 * shortSkipDuration * event->de
lta()) / 3));
if (currentTime < 0) {
currentTime = 0;
}
backend->seek(currentTime); setVolumeUnderMouse(getVolume() + delta);
} }
void MediaWidget::playbackFinished() void MediaWidget::playbackFinished()
{ {
if (source->getType() == MediaSource::Url) if (source->getType() == MediaSource::Url)
emit playlistNext(); emit playlistNext();
source->playbackFinished(); source->playbackFinished();
} }
skipping to change at line 1421 skipping to change at line 1433
if (!artist.isEmpty()) { if (!artist.isEmpty()) {
caption += QLatin1Char('('); caption += QLatin1Char('(');
caption += artist; caption += artist;
caption += QLatin1Char(')'); caption += QLatin1Char(')');
} }
if (caption.isEmpty()) { if (caption.isEmpty()) {
caption = source->getDefaultCaption(); caption = source->getDefaultCaption();
} }
QString osdText = caption;
if (backend->hasDvdMenu())
osdText += "\nUse keys to navigate at DVD menu";
if (!caption.isEmpty()) { if (!caption.isEmpty()) {
osdWidget->showText(caption, 2500); osdWidget->showText(osdText, 2500);
} }
emit changeCaption(caption); emit changeCaption(caption);
} }
void MediaWidget::dvdMenuChanged() void MediaWidget::dvdMenuChanged()
{ {
bool hasDvdMenu = backend->hasDvdMenu(); bool hasDvdMenu = backend->hasDvdMenu();
menuAction->setEnabled(hasDvdMenu); menuAction->setEnabled(hasDvdMenu);
// Disable key left/right for DVD, in order to allow its usage
// to navigate at DVD's menu. Unfortunately, libVlc doesn't provide
// a way to tell if the device is at the DVB menu.
if (hasDvdMenu) {
shortSkipBackwardAction->setShortcut(Qt::Key_unknown);
shortSkipForwardAction->setShortcut(Qt::Key_unknown);
} else {
shortSkipBackwardAction->setShortcut(Qt::Key_Left);
shortSkipForwardAction->setShortcut(Qt::Key_Right);
}
} }
void MediaWidget::titlesChanged() void MediaWidget::titlesChanged()
{ {
int titleCount = backend->getTitleCount(); int titleCount = backend->getTitleCount();
int currentTitle = backend->getCurrentTitle(); int currentTitle = backend->getCurrentTitle();
if (titleCount > 1) { if (titleCount > 1) {
QList<QAction *> actions = titleGroup->actions(); QList<QAction *> actions = titleGroup->actions();
skipping to change at line 1606 skipping to change at line 1611
} }
void SeekSlider::mousePressEvent(QMouseEvent *event) void SeekSlider::mousePressEvent(QMouseEvent *event)
{ {
int buttons = style()->styleHint(QStyle::SH_Slider_AbsoluteSetButtons); int buttons = style()->styleHint(QStyle::SH_Slider_AbsoluteSetButtons);
Qt::MouseButton button = static_cast<Qt::MouseButton>(buttons & (~(button s - 1))); Qt::MouseButton button = static_cast<Qt::MouseButton>(buttons & (~(button s - 1)));
QMouseEvent modifiedEvent(event->type(), event->pos(), event->globalPos() , button, QMouseEvent modifiedEvent(event->type(), event->pos(), event->globalPos() , button,
event->buttons() ^ event->button() ^ button, event->modifiers()); event->buttons() ^ event->button() ^ button, event->modifiers());
QSlider::mousePressEvent(&modifiedEvent); QSlider::mousePressEvent(&modifiedEvent);
} }
void SeekSlider::wheelEvent(QWheelEvent *event)
{
int delta = (event->delta() < 0) ? -1 : 1;
int new_value = value() + delta * maximum() / 100;
event->accept();
setValue(new_value);
}
 End of changes. 13 change blocks. 
36 lines changed or deleted 39 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)