mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Add "Photo or video" and "Document" attach menu items.
This commit is contained in:
parent
0e75204762
commit
0374d8caa8
12 changed files with 28 additions and 13 deletions
BIN
Telegram/Resources/icons/menu/file.png
Normal file
BIN
Telegram/Resources/icons/menu/file.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 567 B |
BIN
Telegram/Resources/icons/menu/file@2x.png
Normal file
BIN
Telegram/Resources/icons/menu/file@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 993 B |
BIN
Telegram/Resources/icons/menu/file@3x.png
Normal file
BIN
Telegram/Resources/icons/menu/file@3x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
Telegram/Resources/icons/menu/image.png
Normal file
BIN
Telegram/Resources/icons/menu/image.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 541 B |
BIN
Telegram/Resources/icons/menu/image@2x.png
Normal file
BIN
Telegram/Resources/icons/menu/image@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1 KiB |
BIN
Telegram/Resources/icons/menu/image@3x.png
Normal file
BIN
Telegram/Resources/icons/menu/image@3x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -1489,6 +1489,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_attach_file" = "File";
|
||||
"lng_attach_photo" = "Photo";
|
||||
"lng_attach_camera" = "Camera";
|
||||
"lng_attach_document" = "Document";
|
||||
"lng_attach_photo_or_video" = "Photo or video";
|
||||
|
||||
"lng_media_open_with" = "Open With";
|
||||
"lng_media_download" = "Download";
|
||||
|
|
|
@ -498,10 +498,14 @@ HistoryWidget::HistoryWidget(
|
|||
_attachBotsMenu->setAutoHiding(true);
|
||||
}
|
||||
};
|
||||
const auto attach = [=](bool compress) {
|
||||
chooseAttach(compress);
|
||||
};
|
||||
_attachBotsMenu = InlineBots::MakeAttachBotsMenu(
|
||||
this,
|
||||
controller,
|
||||
forceShown);
|
||||
forceShown,
|
||||
attach);
|
||||
_attachBotsMenu->setOrigin(
|
||||
Ui::PanelAnimation::Origin::BottomLeft);
|
||||
if (_history && _history->peer->isUser()) {
|
||||
|
@ -4039,7 +4043,8 @@ void HistoryWidget::cornerButtonsAnimationFinish() {
|
|||
updateCornerButtonsPositions();
|
||||
}
|
||||
|
||||
void HistoryWidget::chooseAttach() {
|
||||
void HistoryWidget::chooseAttach(
|
||||
std::optional<bool> overrideSendImagesAsPhotos) {
|
||||
if (_editMsgId) {
|
||||
controller()->show(Ui::MakeInformBox(tr::lng_edit_caption_attach()));
|
||||
return;
|
||||
|
@ -4058,7 +4063,9 @@ void HistoryWidget::chooseAttach() {
|
|||
return;
|
||||
}
|
||||
|
||||
const auto filter = FileDialog::AllOrImagesFilter();
|
||||
const auto filter = (overrideSendImagesAsPhotos == true)
|
||||
? FileDialog::ImagesOrAllFilter()
|
||||
: FileDialog::AllOrImagesFilter();
|
||||
|
||||
FileDialog::GetOpenPaths(this, tr::lng_choose_files(tr::now), filter, crl::guard(this, [=](
|
||||
FileDialog::OpenResult &&result) {
|
||||
|
@ -4073,7 +4080,8 @@ void HistoryWidget::chooseAttach() {
|
|||
if (!read.image.isNull() && !read.animated) {
|
||||
confirmSendingFiles(
|
||||
std::move(read.image),
|
||||
std::move(result.remoteContent));
|
||||
std::move(result.remoteContent),
|
||||
overrideSendImagesAsPhotos);
|
||||
} else {
|
||||
uploadFile(result.remoteContent, SendMediaType::File);
|
||||
}
|
||||
|
@ -4081,6 +4089,7 @@ void HistoryWidget::chooseAttach() {
|
|||
auto list = Storage::PrepareMediaList(
|
||||
result.paths,
|
||||
st::sendMediaPreviewSize);
|
||||
list.overrideSendImagesAsPhotos = overrideSendImagesAsPhotos;
|
||||
confirmSendingFiles(std::move(list));
|
||||
}
|
||||
}), nullptr);
|
||||
|
|
|
@ -423,7 +423,7 @@ private:
|
|||
|
||||
void animationCallback();
|
||||
void updateOverStates(QPoint pos);
|
||||
void chooseAttach();
|
||||
void chooseAttach(std::optional<bool> overrideSendImagesAsPhotos = {});
|
||||
void cornerButtonsAnimationFinish();
|
||||
void sendButtonClicked();
|
||||
void newItemAdded(not_null<HistoryItem*> item);
|
||||
|
|
|
@ -674,7 +674,8 @@ void AttachWebView::toggleInMenu(
|
|||
std::unique_ptr<Ui::DropdownMenu> MakeAttachBotsMenu(
|
||||
not_null<QWidget*> parent,
|
||||
not_null<Window::SessionController*> controller,
|
||||
Fn<void(bool)> forceShown) {
|
||||
Fn<void(bool)> forceShown,
|
||||
Fn<void(bool)> attach) {
|
||||
auto result = std::make_unique<Ui::DropdownMenu>(
|
||||
parent,
|
||||
st::dropdownMenuWithIcons);
|
||||
|
@ -682,12 +683,12 @@ std::unique_ptr<Ui::DropdownMenu> MakeAttachBotsMenu(
|
|||
const auto raw = result.get();
|
||||
const auto refresh = [=] {
|
||||
raw->clearActions();
|
||||
raw->addAction(u"Photo or video"_q, [=] {
|
||||
|
||||
});
|
||||
raw->addAction(u"Document"_q, [=] {
|
||||
|
||||
});
|
||||
raw->addAction(tr::lng_attach_photo_or_video(tr::now), [=] {
|
||||
attach(true);
|
||||
}, &st::menuIconPhoto);
|
||||
raw->addAction(tr::lng_attach_document(tr::now), [=] {
|
||||
attach(false);
|
||||
}, &st::menuIconFile);
|
||||
for (const auto &bot : bots->attachBots()) {
|
||||
const auto callback = [=] {
|
||||
const auto active = controller->activeChatCurrent();
|
||||
|
|
|
@ -132,6 +132,7 @@ private:
|
|||
[[nodiscard]] std::unique_ptr<Ui::DropdownMenu> MakeAttachBotsMenu(
|
||||
not_null<QWidget*> parent,
|
||||
not_null<Window::SessionController*> controller,
|
||||
Fn<void(bool)> forceShown);
|
||||
Fn<void(bool)> forceShown,
|
||||
Fn<void(bool)> attach);
|
||||
|
||||
} // namespace InlineBots
|
||||
|
|
|
@ -108,6 +108,8 @@ menuIconCustomize: icon {{ "menu/customize", menuIconColor }};
|
|||
menuIconSoundOn: icon {{ "menu/sound_enable", menuIconColor }};
|
||||
menuIconSoundOff: icon {{ "menu/sound_disable", menuIconColor }};
|
||||
menuIconSoundSelect: icon {{ "menu/sound_select", menuIconColor }};
|
||||
menuIconFile: icon {{ "menu/file", menuIconColor }};
|
||||
menuIconPhoto: icon {{ "menu/image", menuIconColor }};
|
||||
|
||||
menuIconTTLAny: icon {{ "menu/auto_delete_plain", menuIconColor }};
|
||||
menuIconTTLAnyTextPosition: point(11px, 22px);
|
||||
|
|
Loading…
Add table
Reference in a new issue