mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added shortcuts to flip photos in media viewer.
This commit is contained in:
parent
0248be5543
commit
33aa904cb7
2 changed files with 27 additions and 0 deletions
|
@ -1200,6 +1200,9 @@ void OverlayWidget::setStaticContent(QImage image) {
|
||||||
image = std::move(image).convertToFormat(kGood);
|
image = std::move(image).convertToFormat(kGood);
|
||||||
}
|
}
|
||||||
image.setDevicePixelRatio(style::DevicePixelRatio());
|
image.setDevicePixelRatio(style::DevicePixelRatio());
|
||||||
|
if (_flip) {
|
||||||
|
image = image.mirrored(_flip & Qt::Horizontal, _flip & Qt::Vertical);
|
||||||
|
}
|
||||||
_staticContent = std::move(image);
|
_staticContent = std::move(image);
|
||||||
_staticContentTransparent = IsSemitransparent(_staticContent);
|
_staticContentTransparent = IsSemitransparent(_staticContent);
|
||||||
}
|
}
|
||||||
|
@ -2286,6 +2289,7 @@ OverlayWidget::~OverlayWidget() {
|
||||||
|
|
||||||
void OverlayWidget::assignMediaPointer(DocumentData *document) {
|
void OverlayWidget::assignMediaPointer(DocumentData *document) {
|
||||||
_savePhotoVideoWhenLoaded = SavePhotoVideo::None;
|
_savePhotoVideoWhenLoaded = SavePhotoVideo::None;
|
||||||
|
_flip = {};
|
||||||
_photo = nullptr;
|
_photo = nullptr;
|
||||||
_photoMedia = nullptr;
|
_photoMedia = nullptr;
|
||||||
if (_document != document) {
|
if (_document != document) {
|
||||||
|
@ -2314,6 +2318,7 @@ void OverlayWidget::assignMediaPointer(not_null<PhotoData*> photo) {
|
||||||
_documentMedia = nullptr;
|
_documentMedia = nullptr;
|
||||||
_documentLoadingTo = QString();
|
_documentLoadingTo = QString();
|
||||||
if (_photo != photo) {
|
if (_photo != photo) {
|
||||||
|
_flip = {};
|
||||||
_photo = photo;
|
_photo = photo;
|
||||||
_photoMedia = _photo->createMediaView();
|
_photoMedia = _photo->createMediaView();
|
||||||
_photoMedia->wanted(Data::PhotoSize::Small, fileOrigin());
|
_photoMedia->wanted(Data::PhotoSize::Small, fileOrigin());
|
||||||
|
@ -5461,6 +5466,26 @@ void OverlayWidget::handleKeyPress(not_null<QKeyEvent*> e) {
|
||||||
activateControls();
|
activateControls();
|
||||||
}
|
}
|
||||||
moveToNext(-1);
|
moveToNext(-1);
|
||||||
|
} else if (key == Qt::Key_H) {
|
||||||
|
if (_flip & Qt::Horizontal) {
|
||||||
|
_flip &= ~Qt::Horizontal;
|
||||||
|
} else {
|
||||||
|
_flip |= Qt::Horizontal;
|
||||||
|
}
|
||||||
|
if (_photo) {
|
||||||
|
validatePhotoCurrentImage();
|
||||||
|
redisplayContent();
|
||||||
|
}
|
||||||
|
} else if (key == Qt::Key_V) {
|
||||||
|
if (_flip & Qt::Vertical) {
|
||||||
|
_flip &= ~Qt::Vertical;
|
||||||
|
} else {
|
||||||
|
_flip |= Qt::Vertical;
|
||||||
|
}
|
||||||
|
if (_photo) {
|
||||||
|
validatePhotoCurrentImage();
|
||||||
|
redisplayContent();
|
||||||
|
}
|
||||||
} else if (key == Qt::Key_Right) {
|
} else if (key == Qt::Key_Right) {
|
||||||
if (_controlsHideTimer.isActive()) {
|
if (_controlsHideTimer.isActive()) {
|
||||||
activateControls();
|
activateControls();
|
||||||
|
|
|
@ -638,6 +638,8 @@ private:
|
||||||
bool _streamedQualityChangeFinished = false;
|
bool _streamedQualityChangeFinished = false;
|
||||||
bool _showAsPip = false;
|
bool _showAsPip = false;
|
||||||
|
|
||||||
|
Qt::Orientations _flip;
|
||||||
|
|
||||||
std::unique_ptr<Stories::View> _stories;
|
std::unique_ptr<Stories::View> _stories;
|
||||||
std::shared_ptr<Show> _cachedShow;
|
std::shared_ptr<Show> _cachedShow;
|
||||||
rpl::event_stream<> _storiesChanged;
|
rpl::event_stream<> _storiesChanged;
|
||||||
|
|
Loading…
Add table
Reference in a new issue