mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 07:07:08 +02:00
Add 'Copy Link' and 'Share Link' buttons.
This commit is contained in:
parent
7e89ed48c2
commit
8c7030378a
11 changed files with 95 additions and 1 deletions
Telegram
Resources/icons/info/edit
SourceFiles
boxes/peers
info
ui/controls
cmake
BIN
Telegram/Resources/icons/info/edit/links_copy.png
Normal file
BIN
Telegram/Resources/icons/info/edit/links_copy.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 397 B |
BIN
Telegram/Resources/icons/info/edit/links_copy@2x.png
Normal file
BIN
Telegram/Resources/icons/info/edit/links_copy@2x.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 682 B |
BIN
Telegram/Resources/icons/info/edit/links_copy@3x.png
Normal file
BIN
Telegram/Resources/icons/info/edit/links_copy@3x.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 1 KiB |
BIN
Telegram/Resources/icons/info/edit/links_share.png
Normal file
BIN
Telegram/Resources/icons/info/edit/links_share.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 464 B |
BIN
Telegram/Resources/icons/info/edit/links_share@2x.png
Normal file
BIN
Telegram/Resources/icons/info/edit/links_share@2x.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 859 B |
BIN
Telegram/Resources/icons/info/edit/links_share@3x.png
Normal file
BIN
Telegram/Resources/icons/info/edit/links_share@3x.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 1.3 KiB |
|
@ -12,8 +12,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "main/main_session.h"
|
||||
#include "api/api_invite_links.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "ui/wrap/padding_wrap.h"
|
||||
#include "ui/widgets/popup_menu.h"
|
||||
#include "ui/controls/invite_link_label.h"
|
||||
#include "ui/controls/invite_link_buttons.h"
|
||||
#include "ui/toast/toast.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "apiwrap.h"
|
||||
|
@ -88,4 +90,9 @@ void AddPermanentLinkBlock(
|
|||
|
||||
label->clicks(
|
||||
) | rpl::start_with_next(copyLink, label->lifetime());
|
||||
|
||||
AddCopyShareLinkButtons(
|
||||
container,
|
||||
copyLink,
|
||||
shareLink);
|
||||
}
|
||||
|
|
|
@ -848,4 +848,20 @@ inviteLinkThreeDots: IconButton(defaultIconButton) {
|
|||
|
||||
rippleAreaSize: 0px;
|
||||
}
|
||||
inviteLinkFieldPadding: margins(22px, 7px, 22px, 9px);
|
||||
inviteLinkFieldPadding: margins(22px, 7px, 22px, 14px);
|
||||
|
||||
inviteLinkButton: RoundButton(defaultActiveButton) {
|
||||
height: 36px;
|
||||
textTop: 9px;
|
||||
}
|
||||
inviteLinkButtonsPadding: margins(22px, 0px, 22px, 0px);
|
||||
inviteLinkButtonsSkip: 10px;
|
||||
inviteLinkCopy: RoundButton(inviteLinkButton) {
|
||||
icon: icon {{ "info/edit/links_copy", activeButtonFg }};
|
||||
iconOver: icon {{ "info/edit/links_copy", activeButtonFgOver }};
|
||||
iconPosition: point(-1px, 2px);
|
||||
}
|
||||
inviteLinkShare: RoundButton(inviteLinkCopy) {
|
||||
icon: icon {{ "info/edit/links_share", activeButtonFg }};
|
||||
iconOver: icon {{ "info/edit/links_share", activeButtonFgOver }};
|
||||
}
|
||||
|
|
50
Telegram/SourceFiles/ui/controls/invite_link_buttons.cpp
Normal file
50
Telegram/SourceFiles/ui/controls/invite_link_buttons.cpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "ui/controls/invite_link_buttons.h"
|
||||
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "ui/wrap/padding_wrap.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "styles/style_info.h"
|
||||
|
||||
namespace Ui {
|
||||
|
||||
void AddCopyShareLinkButtons(
|
||||
not_null<VerticalLayout*> container,
|
||||
Fn<void()> copyLink,
|
||||
Fn<void()> shareLink) {
|
||||
const auto wrap = container->add(
|
||||
object_ptr<FixedHeightWidget>(
|
||||
container,
|
||||
st::inviteLinkButton.height),
|
||||
st::inviteLinkButtonsPadding);
|
||||
const auto copy = CreateChild<RoundButton>(
|
||||
wrap,
|
||||
tr::lng_group_invite_copy(),
|
||||
st::inviteLinkCopy);
|
||||
copy->setTextTransform(RoundButton::TextTransform::NoTransform);
|
||||
copy->setClickedCallback(copyLink);
|
||||
const auto share = CreateChild<RoundButton>(
|
||||
wrap,
|
||||
tr::lng_group_invite_share(),
|
||||
st::inviteLinkShare);
|
||||
share->setTextTransform(RoundButton::TextTransform::NoTransform);
|
||||
share->setClickedCallback(shareLink);
|
||||
|
||||
wrap->widthValue(
|
||||
) | rpl::start_with_next([=](int width) {
|
||||
const auto buttonWidth = (width - st::inviteLinkButtonsSkip) / 2;
|
||||
copy->setFullWidth(buttonWidth);
|
||||
share->setFullWidth(buttonWidth);
|
||||
copy->moveToLeft(0, 0, width);
|
||||
share->moveToRight(0, 0, width);
|
||||
}, wrap->lifetime());
|
||||
}
|
||||
|
||||
} // namespace Ui
|
19
Telegram/SourceFiles/ui/controls/invite_link_buttons.h
Normal file
19
Telegram/SourceFiles/ui/controls/invite_link_buttons.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
namespace Ui {
|
||||
|
||||
class VerticalLayout;
|
||||
|
||||
void AddCopyShareLinkButtons(
|
||||
not_null<VerticalLayout*> container,
|
||||
Fn<void()> copyLink,
|
||||
Fn<void()> shareLink);
|
||||
|
||||
} // namespace Ui
|
|
@ -88,6 +88,8 @@ PRIVATE
|
|||
ui/chat/pinned_bar.h
|
||||
ui/controls/emoji_button.cpp
|
||||
ui/controls/emoji_button.h
|
||||
ui/controls/invite_link_buttons.cpp
|
||||
ui/controls/invite_link_buttons.h
|
||||
ui/controls/invite_link_label.cpp
|
||||
ui/controls/invite_link_label.h
|
||||
ui/controls/send_button.cpp
|
||||
|
|
Loading…
Add table
Reference in a new issue