mirror of https://github.com/procxx/kepka.git
Double click on PiP to switch back to fullscreen.
This commit is contained in:
parent
2e1e13b843
commit
47f9978c46
|
@ -734,6 +734,9 @@ void Pip::setupPanel() {
|
||||||
case QEvent::MouseButtonRelease:
|
case QEvent::MouseButtonRelease:
|
||||||
handleMouseRelease(static_cast<QMouseEvent*>(e.get())->button());
|
handleMouseRelease(static_cast<QMouseEvent*>(e.get())->button());
|
||||||
break;
|
break;
|
||||||
|
case QEvent::MouseButtonDblClick:
|
||||||
|
handleDoubleClick(static_cast<QMouseEvent*>(e.get())->button());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}, _panel.lifetime());
|
}, _panel.lifetime());
|
||||||
}
|
}
|
||||||
|
@ -797,9 +800,11 @@ void Pip::handleMouseRelease(Qt::MouseButton button) {
|
||||||
|| _panel.dragging()
|
|| _panel.dragging()
|
||||||
|| !pressed
|
|| !pressed
|
||||||
|| *pressed != _over) {
|
|| *pressed != _over) {
|
||||||
|
_lastHandledPress = std::nullopt;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_lastHandledPress = _over;
|
||||||
switch (_over) {
|
switch (_over) {
|
||||||
case OverState::Close: _panel.close(); break;
|
case OverState::Close: _panel.close(); break;
|
||||||
case OverState::Enlarge: _closeAndContinue(); break;
|
case OverState::Enlarge: _closeAndContinue(); break;
|
||||||
|
@ -807,6 +812,16 @@ void Pip::handleMouseRelease(Qt::MouseButton button) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Pip::handleDoubleClick(Qt::MouseButton button) {
|
||||||
|
if (_over != OverState::Other
|
||||||
|
|| !_lastHandledPress
|
||||||
|
|| *_lastHandledPress != _over) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
playbackPauseResume(); // Un-click the first click.
|
||||||
|
_closeAndContinue();
|
||||||
|
}
|
||||||
|
|
||||||
void Pip::setupButtons() {
|
void Pip::setupButtons() {
|
||||||
_close.state = OverState::Close;
|
_close.state = OverState::Close;
|
||||||
_enlarge.state = OverState::Enlarge;
|
_enlarge.state = OverState::Enlarge;
|
||||||
|
|
|
@ -153,6 +153,7 @@ private:
|
||||||
void handleMouseMove(QPoint position);
|
void handleMouseMove(QPoint position);
|
||||||
void handleMousePress(Qt::MouseButton button);
|
void handleMousePress(Qt::MouseButton button);
|
||||||
void handleMouseRelease(Qt::MouseButton button);
|
void handleMouseRelease(Qt::MouseButton button);
|
||||||
|
void handleDoubleClick(Qt::MouseButton button);
|
||||||
void handleLeave();
|
void handleLeave();
|
||||||
void handleClose();
|
void handleClose();
|
||||||
|
|
||||||
|
@ -166,6 +167,7 @@ private:
|
||||||
bool _showPause = false;
|
bool _showPause = false;
|
||||||
OverState _over = OverState::None;
|
OverState _over = OverState::None;
|
||||||
std::optional<OverState> _pressed;
|
std::optional<OverState> _pressed;
|
||||||
|
std::optional<OverState> _lastHandledPress;
|
||||||
Button _close;
|
Button _close;
|
||||||
Button _enlarge;
|
Button _enlarge;
|
||||||
Button _playback;
|
Button _playback;
|
||||||
|
|
Loading…
Reference in New Issue