mirror of https://github.com/procxx/kepka.git
Refactored key handler in mediaview.cpp.
Refactored key handler in mediaview.cpp.
This commit is contained in:
parent
87d4d46ce7
commit
ad8c0737d6
|
@ -2445,9 +2445,10 @@ void MediaView::paintThemePreview(Painter &p, QRect clip) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaView::keyPressEvent(QKeyEvent *e) {
|
void MediaView::keyPressEvent(QKeyEvent *e) {
|
||||||
|
const auto ctrl = e->modifiers().testFlag(Qt::ControlModifier);
|
||||||
if (_clipController) {
|
if (_clipController) {
|
||||||
auto toggle1 = (e->key() == Qt::Key_F && e->modifiers().testFlag(Qt::ControlModifier));
|
auto toggle1 = (e->key() == Qt::Key_F && ctrl);
|
||||||
auto toggle2 = (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) && (e->modifiers().testFlag(Qt::AltModifier) || e->modifiers().testFlag(Qt::ControlModifier));
|
auto toggle2 = (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) && (e->modifiers().testFlag(Qt::AltModifier) || ctrl);
|
||||||
if (toggle1 || toggle2) {
|
if (toggle1 || toggle2) {
|
||||||
onVideoToggleFullScreen();
|
onVideoToggleFullScreen();
|
||||||
return;
|
return;
|
||||||
|
@ -2469,7 +2470,7 @@ void MediaView::keyPressEvent(QKeyEvent *e) {
|
||||||
}
|
}
|
||||||
} else if (e == QKeySequence::Save || e == QKeySequence::SaveAs) {
|
} else if (e == QKeySequence::Save || e == QKeySequence::SaveAs) {
|
||||||
onSaveAs();
|
onSaveAs();
|
||||||
} else if (e->key() == Qt::Key_Copy || (e->key() == Qt::Key_C && e->modifiers().testFlag(Qt::ControlModifier))) {
|
} else if (e->key() == Qt::Key_Copy || (e->key() == Qt::Key_C && ctrl)) {
|
||||||
onCopy();
|
onCopy();
|
||||||
} else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return || e->key() == Qt::Key_Space) {
|
} else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return || e->key() == Qt::Key_Space) {
|
||||||
if (_doc && !_doc->loading() && (fileBubbleShown() || !_doc->loaded())) {
|
if (_doc && !_doc->loading() && (fileBubbleShown() || !_doc->loaded())) {
|
||||||
|
@ -2487,12 +2488,12 @@ void MediaView::keyPressEvent(QKeyEvent *e) {
|
||||||
activateControls();
|
activateControls();
|
||||||
}
|
}
|
||||||
moveToNext(1);
|
moveToNext(1);
|
||||||
} else if (e->modifiers().testFlag(Qt::ControlModifier) && (e->key() == Qt::Key_Plus || e->key() == Qt::Key_Equal || e->key() == ']' || e->key() == Qt::Key_Asterisk || e->key() == Qt::Key_Minus || e->key() == Qt::Key_Underscore || e->key() == Qt::Key_0)) {
|
} else if (ctrl) {
|
||||||
if (e->key() == Qt::Key_Plus || e->key() == Qt::Key_Equal || e->key() == Qt::Key_Asterisk || e->key() == ']') {
|
if (e->key() == Qt::Key_Plus || e->key() == Qt::Key_Equal || e->key() == Qt::Key_Asterisk || e->key() == ']') {
|
||||||
zoomIn();
|
zoomIn();
|
||||||
} else if (e->key() == Qt::Key_Minus || e->key() == Qt::Key_Underscore) {
|
} else if (e->key() == Qt::Key_Minus || e->key() == Qt::Key_Underscore) {
|
||||||
zoomOut();
|
zoomOut();
|
||||||
} else {
|
} else if (e->key() == Qt::Key_0) {
|
||||||
zoomReset();
|
zoomReset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue