Commit 368843ef authored by Paweł Wegner's avatar Paweł Wegner
Browse files

Cloudbrowser: disable focus when autoplaying.

parent 53f241fe
...@@ -75,10 +75,8 @@ Window::Window(QWidget* player_widget) ...@@ -75,10 +75,8 @@ Window::Window(QWidget* player_widget)
connect(this, &Window::hidePlayer, this, connect(this, &Window::hidePlayer, this,
[this]() { [this]() {
stop(); stop();
if (container()) { if (container())
container()->show(); container()->show();
container()->setFocus();
}
}, },
Qt::QueuedConnection); Qt::QueuedConnection);
connect(this, &Window::runListDirectory, this, [this]() { listDirectory(); }, connect(this, &Window::runListDirectory, this, [this]() { listDirectory(); },
...@@ -94,6 +92,7 @@ Window::Window(QWidget* player_widget) ...@@ -94,6 +92,7 @@ Window::Window(QWidget* player_widget)
if (type == IItem::FileType::Audio || if (type == IItem::FileType::Audio ||
type == IItem::FileType::Video || type == IItem::FileType::Video ||
type == IItem::FileType::Image) { type == IItem::FileType::Image) {
emit currentItemChanged(i);
play(i); play(i);
break; break;
} }
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include <QAbstractListModel> #include <QAbstractListModel>
#include <QQuickImageProvider> #include <QQuickImageProvider>
#include <QQuickView> #include <QQuickView>
#include <QQuickWidget> #include <QWidget>
#include <future> #include <future>
#include <vlcpp/vlc.hpp> #include <vlcpp/vlc.hpp>
...@@ -136,6 +136,7 @@ class Window : public QQuickView { ...@@ -136,6 +136,7 @@ class Window : public QQuickView {
void runListDirectory(); void runListDirectory();
void runClearDirectory(); void runClearDirectory();
void playNext(); void playNext();
void currentItemChanged(int index);
private: private:
friend class CloudProviderCallback; friend class CloudProviderCallback;
......
...@@ -49,9 +49,10 @@ class MainWidget : public QWidget { ...@@ -49,9 +49,10 @@ class MainWidget : public QWidget {
void keyPressEvent(QKeyEvent* e) { void keyPressEvent(QKeyEvent* e) {
QWidget::keyPressEvent(e); QWidget::keyPressEvent(e);
if (e->isAccepted()) return; if (e->isAccepted()) return;
if (e->key() == Qt::Key_Q) if (e->key() == Qt::Key_Q) {
window_.stop(); window_.stop();
else if (e->key() == Qt::Key_P) container_->setFocus();
} else if (e->key() == Qt::Key_P)
window_.media_player().pause(); window_.media_player().pause();
} }
......
...@@ -71,6 +71,9 @@ Item { ...@@ -71,6 +71,9 @@ Item {
onHidePlayer: { onHidePlayer: {
directory.focus = true; directory.focus = true;
} }
onCurrentItemChanged: {
directory.currentIndex = index;
}
} }
ListView { ListView {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment