mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-19 06:26:55 +00:00
Added Ctrl+E and Ctrl+O shortcut to edit media.
This commit is contained in:
parent
be2b2cbf7e
commit
6e69069ba2
@ -407,7 +407,7 @@ void EditCaptionBox::createEditMediaButton() {
|
||||
}
|
||||
};
|
||||
|
||||
addButton(langFactory(lng_edit_media), [=] {
|
||||
const auto buttonCallback = [=] {
|
||||
const auto filters = _isNotAlbum
|
||||
? QStringList(FileDialog::AllFilesFilter())
|
||||
: QStringList(qsl("Image and Video Files (*.png *.jpg *.mp4)"));
|
||||
@ -416,7 +416,13 @@ void EditCaptionBox::createEditMediaButton() {
|
||||
lang(lng_choose_file),
|
||||
filters.join(qsl(";;")),
|
||||
crl::guard(this, callback));
|
||||
});
|
||||
};
|
||||
|
||||
_editMediaClicks.events() | rpl::start_with_next([=] {
|
||||
buttonCallback();
|
||||
}, lifetime());
|
||||
|
||||
addButton(langFactory(lng_edit_media), buttonCallback);
|
||||
}
|
||||
|
||||
void EditCaptionBox::prepare() {
|
||||
@ -719,3 +725,12 @@ void EditCaptionBox::setName(QString nameString, qint64 size) {
|
||||
_name.maxWidth(),
|
||||
st::normalFont->width(_status));
|
||||
}
|
||||
|
||||
void EditCaptionBox::keyPressEvent(QKeyEvent *e) {
|
||||
if ((e->key() == Qt::Key_E || e->key() == Qt::Key_O)
|
||||
&& e->modifiers() == Qt::ControlModifier) {
|
||||
_editMediaClicks.fire({});
|
||||
} else {
|
||||
e->ignore();
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "boxes/abstract_box.h"
|
||||
#include "storage/storage_media_prepare.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include <rpl/event_stream.h>
|
||||
|
||||
namespace ChatHelpers {
|
||||
class TabbedPanel;
|
||||
@ -46,6 +47,7 @@ protected:
|
||||
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
void keyPressEvent(QKeyEvent *e) override;
|
||||
|
||||
private:
|
||||
void updateBoxSize();
|
||||
@ -108,6 +110,7 @@ private:
|
||||
QString _newMediaPath;
|
||||
bool _isAllowedEditMedia = false;
|
||||
bool _isNotAlbum;
|
||||
rpl::event_stream<> _editMediaClicks;
|
||||
|
||||
QString _error;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user