mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-18 17:40:59 +00:00
Share background from preview.
This commit is contained in:
parent
bf87de3706
commit
e7804d014d
@ -402,6 +402,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_background_text2" = "Sounds awful.";
|
||||
"lng_background_bad_link" = "This background link appears to be invalid.";
|
||||
"lng_background_apply" = "Apply";
|
||||
"lng_background_share" = "Share";
|
||||
"lng_background_link_copied" = "Link copied to clipboard";
|
||||
|
||||
"lng_download_path_ask" = "Ask download path for each file";
|
||||
"lng_download_path" = "Download path";
|
||||
|
@ -12,12 +12,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "mainwindow.h"
|
||||
#include "window/themes/window_theme.h"
|
||||
#include "ui/effects/round_checkbox.h"
|
||||
#include "ui/toast/toast.h"
|
||||
#include "ui/image/image.h"
|
||||
#include "history/history.h"
|
||||
#include "history/history_message.h"
|
||||
#include "history/view/history_view_message.h"
|
||||
#include "auth_session.h"
|
||||
#include "apiwrap.h"
|
||||
#include "messenger.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_user.h"
|
||||
#include "data/data_document.h"
|
||||
@ -153,9 +155,10 @@ void BackgroundBox::prepare() {
|
||||
void BackgroundBox::backgroundChosen(int index) {
|
||||
const auto &papers = Auth().data().wallpapers();
|
||||
if (index >= 0 && index < papers.size()) {
|
||||
App::main()->setChatBackground(papers[index]);
|
||||
Ui::show(
|
||||
Box<BackgroundPreviewBox>(papers[index]),
|
||||
LayerOption::KeepOther);
|
||||
}
|
||||
closeBox();
|
||||
}
|
||||
|
||||
BackgroundBox::Inner::Inner(QWidget *parent) : RpWidget(parent)
|
||||
@ -305,6 +308,9 @@ void BackgroundPreviewBox::prepare() {
|
||||
|
||||
addButton(langFactory(lng_background_apply), [=] { apply(); });
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
if (!_paper.slug.isEmpty()) {
|
||||
addLeftButton(langFactory(lng_background_share), [=] { share(); });
|
||||
}
|
||||
|
||||
_scaled = PrepareScaledFromThumb(_paper.thumb);
|
||||
checkLoadedDocument();
|
||||
@ -337,6 +343,14 @@ void BackgroundPreviewBox::apply() {
|
||||
closeBox();
|
||||
}
|
||||
|
||||
void BackgroundPreviewBox::share() {
|
||||
Expects(!_paper.slug.isEmpty());
|
||||
|
||||
QApplication::clipboard()->setText(
|
||||
Messenger::Instance().createInternalLinkFull("bg/" + _paper.slug));
|
||||
Ui::Toast::Show(lang(lng_background_link_copied));
|
||||
}
|
||||
|
||||
void BackgroundPreviewBox::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
|
||||
|
@ -61,6 +61,7 @@ protected:
|
||||
|
||||
private:
|
||||
void apply();
|
||||
void share();
|
||||
void step_radial(TimeMs ms, bool timer);
|
||||
QRect radialRect() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user