Commit e0c091f3 authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas

implement hiding of control bar

parent aa1808ca
......@@ -178,6 +178,9 @@ public:
dtkWidgetsOverlayPane *overlay = nullptr;
dtkWidgetsHUD *hud = nullptr;
public:
int hide_timer = 5000;
public:
dtkVisualizationViewVideoPlayer *q = nullptr;
......@@ -255,6 +258,7 @@ dtkVisualizationViewVideoPlayer::dtkVisualizationViewVideoPlayer(QWidget *parent
this->setAcceptDrops(true); // ?
this->setMouseTracking(true); // ??
this->widget()->setMouseTracking(true);
}
dtkVisualizationViewVideoPlayer::~dtkVisualizationViewVideoPlayer(void)
......@@ -280,6 +284,7 @@ void dtkVisualizationViewVideoPlayer::open(void)
d->controls->reset();
d->player->setMedia(fileDialog.selectedUrls().first());
d->controls->setVisible(true);
QTimer::singleShot(d->hide_timer, [=]() {d->controls->setVisible(false);});
d->controls->toggle();
}
}
......@@ -324,16 +329,22 @@ void dtkVisualizationViewVideoPlayer::dropEvent(QDropEvent *event)
if(!path.startsWith("file://"))
return;
// path.remove("file://");
d->controls->reset();
d->player->setMedia(QUrl(path));
d->controls->setVisible(true);
QTimer::singleShot(d->hide_timer, [=]() {d->controls->setVisible(false);});
d->controls->toggle();
event->accept();
}
}
void dtkVisualizationViewVideoPlayer::mouseMoveEvent(QMouseEvent *event)
{
if ((this->size().height() - event->pos().y() < 64) && (!d->controls->isVisible())) {
d->controls->setVisible(true);
QTimer::singleShot(d->hide_timer, [=]() {d->controls->setVisible(false) ;} );
}
}
void dtkVisualizationViewVideoPlayer::keyPressEvent(QKeyEvent *event)
{
......
......@@ -41,6 +41,7 @@ protected:
void dropEvent(QDropEvent *) override;
void keyPressEvent(QKeyEvent *) override;
void resizeEvent(QResizeEvent *) override;
void mouseMoveEvent(QMouseEvent *event) override;
private:
class dtkVisualizationViewVideoPlayerPrivate *d;
......
Markdown is supported
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