1
0
mirror of https://github.com/clementine-player/Clementine synced 2025-02-01 20:06:53 +01:00

Added mouse forward and back button actions.

This commit is contained in:
Kerem Seyhan 2018-08-12 17:54:07 +02:00 committed by John Maguire
parent 4a1236f8da
commit 4ac2dedefa
6 changed files with 20 additions and 0 deletions

View File

@ -841,6 +841,10 @@ void PlaylistView::mousePressEvent(QMouseEvent* event) {
// Update only this item rating
playlist_->RateSong(playlist_->proxy()->mapToSource(index), new_rating);
}
} else if (event->button() == Qt::XButton1 && index.isValid()) {
app_->player()->Previous();
} else if (event->button() == Qt::XButton2 && index.isValid()) {
app_->player()->Next();
} else {
QTreeView::mousePressEvent(event);
}

View File

@ -612,6 +612,10 @@ MainWindow::MainWindow(Application* app, SystemTrayIcon* tray_icon, OSD* osd,
connect(ui_->track_slider, SIGNAL(SeekBackward()), app_->player(),
SLOT(SeekBackward()));
connect(ui_->track_slider, SIGNAL(Previous()), app_->player(),
SLOT(Previous()));
connect(ui_->track_slider, SIGNAL(Next()), app_->player(), SLOT(Next()));
// Library connections
connect(library_view_->view(), SIGNAL(AddToPlaylistSignal(QMimeData*)),
SLOT(AddToPlaylist(QMimeData*)));

View File

@ -49,6 +49,8 @@ TrackSlider::TrackSlider(QWidget* parent)
connect(ui_->slider, SIGNAL(valueChanged(int)), SLOT(ValueMaybeChanged(int)));
connect(ui_->slider, SIGNAL(SeekForward()), SIGNAL(SeekForward()));
connect(ui_->slider, SIGNAL(SeekBackward()), SIGNAL(SeekBackward()));
connect(ui_->slider, SIGNAL(Previous()), SIGNAL(Previous()));
connect(ui_->slider, SIGNAL(Next()), SIGNAL(Next()));
connect(ui_->remaining, SIGNAL(Clicked()), SLOT(ToggleTimeDisplay()));
}

View File

@ -57,6 +57,8 @@ signals:
void SeekForward();
void SeekBackward();
void Next();
void Previous();
private slots:
void ValueMaybeChanged(int value);

View File

@ -61,6 +61,12 @@ void TrackSliderSlider::mousePressEvent(QMouseEvent* e) {
void TrackSliderSlider::mouseReleaseEvent(QMouseEvent* e) {
QSlider::mouseReleaseEvent(e);
if (e->button() == Qt::XButton1) {
emit Previous();
} else if (e->button() == Qt::XButton2) {
emit Next();
}
e->accept();
}
void TrackSliderSlider::mouseMoveEvent(QMouseEvent* e) {

View File

@ -32,6 +32,8 @@ class TrackSliderSlider : public QSlider {
signals:
void SeekForward();
void SeekBackward();
void Previous();
void Next();
protected:
void mousePressEvent(QMouseEvent* e);