bool QtSystemTrayIcon::eventFilter(QObject* object, QEvent* event) { if (QObject::eventFilter(object, event)) return true; if (object != tray_) return false; if (event->type() == QEvent::Wheel) { QWheelEvent* e = static_cast<QWheelEvent*>(event); if (e->modifiers() == Qt::ShiftModifier) { if (e->delta() > 0) { emit SeekForward(); } else { emit SeekBackward(); } } else if (e->modifiers() == Qt::ControlModifier) { if (e->delta() < 0) { emit NextTrack(); } else { emit PreviousTrack(); } } else { emit ChangeVolume(e->delta()); } return true; } return false; }
GlobalShortcuts::GlobalShortcuts(QObject *parent) : QObject(parent), gnome_backend_(NULL), system_backend_(NULL), use_gnome_(false), rating_signals_mapper_(new QSignalMapper(this)) { settings_.beginGroup(kSettingsGroup); // Create actions AddShortcut("play", tr("Play"), SIGNAL(Play())); AddShortcut("pause", tr("Pause"), SIGNAL(Pause())); AddShortcut("play_pause", tr("Play/Pause"), SIGNAL(PlayPause()), QKeySequence(Qt::Key_MediaPlay)); AddShortcut("stop", tr("Stop"), SIGNAL(Stop()), QKeySequence(Qt::Key_MediaStop)); AddShortcut("stop_after", tr("Stop playing after current track"), SIGNAL(StopAfter())); AddShortcut("next_track", tr("Next track"), SIGNAL(Next()), QKeySequence(Qt::Key_MediaNext)); AddShortcut("prev_track", tr("Previous track"), SIGNAL(Previous()), QKeySequence(Qt::Key_MediaPrevious)); AddShortcut("inc_volume", tr("Increase volume"), SIGNAL(IncVolume())); AddShortcut("dec_volume", tr("Decrease volume"), SIGNAL(DecVolume())); AddShortcut("mute", tr("Mute"), SIGNAL(Mute())); AddShortcut("seek_forward", tr("Seek forward"), SIGNAL(SeekForward())); AddShortcut("seek_backward", tr("Seek backward"), SIGNAL(SeekBackward())); AddShortcut("show_hide", tr("Show/Hide"), SIGNAL(ShowHide())); AddShortcut("show_osd", tr("Show OSD"), SIGNAL(ShowOSD())); AddShortcut("toggle_pretty_osd", tr("Toggle Pretty OSD"), SIGNAL(TogglePrettyOSD())); // Toggling possible only for pretty OSD AddShortcut("shuffle_mode", tr("Change shuffle mode"), SIGNAL(CycleShuffleMode())); AddShortcut("repeat_mode", tr("Change repeat mode"), SIGNAL(CycleRepeatMode())); AddShortcut("toggle_last_fm_scrobbling", tr("Enable/disable Last.fm scrobbling"), SIGNAL(ToggleScrobbling())); AddShortcut("global_search_popup", tr("Show Global Search Popup"), SIGNAL(ShowGlobalSearch())); AddRatingShortcut("rate_zero_star", tr("Rate the current song 0 stars"), rating_signals_mapper_, 0); AddRatingShortcut("rate_one_star", tr("Rate the current song 1 star"), rating_signals_mapper_, 1); AddRatingShortcut("rate_two_star", tr("Rate the current song 2 stars"), rating_signals_mapper_, 2); AddRatingShortcut("rate_three_star", tr("Rate the current song 3 stars"), rating_signals_mapper_, 3); AddRatingShortcut("rate_four_star", tr("Rate the current song 4 stars"), rating_signals_mapper_, 4); AddRatingShortcut("rate_five_star", tr("Rate the current song 5 stars"), rating_signals_mapper_, 5); connect(rating_signals_mapper_, SIGNAL(mapped(int)), SIGNAL(RateCurrentSong(int))); // Create backends - these do the actual shortcut registration gnome_backend_ = new GnomeGlobalShortcutBackend(this); #ifndef Q_OS_DARWIN system_backend_ = new QxtGlobalShortcutBackend(this); #else system_backend_ = new MacGlobalShortcutBackend(this); #endif ReloadSettings(); }
GlobalShortcuts::GlobalShortcuts(QObject *parent) : QObject(parent), backend(nullptr) { // Create actions AddShortcut("play", tr("Play"), SIGNAL(Play())); AddShortcut("pause", tr("Pause"), SIGNAL(Pause())); AddShortcut("play_pause", tr("Play/Pause"), SIGNAL(PlayPause()), QKeySequence(Qt::Key_MediaPlay)); AddShortcut("stop", tr("Stop"), SIGNAL(Stop()), QKeySequence(Qt::Key_MediaStop)); AddShortcut("stop_after", tr("Stop playing after current track"), SIGNAL(StopAfter())); AddShortcut("next_track", tr("Next track"), SIGNAL(Next()), QKeySequence(Qt::Key_MediaNext)); AddShortcut("prev_track", tr("Previous track"), SIGNAL(Previous()), QKeySequence(Qt::Key_MediaPrevious)); AddShortcut("inc_volume", tr("Increase volume"), SIGNAL(IncVolume())); AddShortcut("dec_volume", tr("Decrease volume"), SIGNAL(DecVolume())); AddShortcut("mute", tr("Mute"), SIGNAL(Mute())); AddShortcut("seek_forward", tr("Seek forward"), SIGNAL(SeekForward())); AddShortcut("seek_backward", tr("Seek backward"), SIGNAL(SeekBackward())); }
int PlayerController::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: playing(); break; case 1: stopped(); break; case 2: paused(); break; case 3: playerStarted((*reinterpret_cast< bool(*)>(_a[1]))); break; case 4: playerClosed(); break; case 5: changeTrackInfo((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; case 6: changePos((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 7: passAlbumArt((*reinterpret_cast< CFbsBitmap*(*)>(_a[1]))); break; case 8: updateAlbumArt((*reinterpret_cast< int(*)>(_a[1]))); break; case 9: CheckPlayerState(); break; case 10: Tick(); break; case 11: Play(); break; case 12: Pause(); break; case 13: Next(); break; case 14: Previous(); break; case 15: SeekForward(); break; case 16: SeekBack(); break; case 17: StopSeeking(); break; case 18: AlbumArtSaved((*reinterpret_cast< CFbsBitmap*(*)>(_a[1]))); break; case 19: GoToNowPlaying(); break; case 20: ClosePlayer(); break; case 21: SeekToPos((*reinterpret_cast< int(*)>(_a[1]))); break; case 22: GetState(); break; default: ; } _id -= 23; } return _id; }