mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 10:11:41 -05:00
Fixed crashes in thumb animation. Fix notifications show.
Also allow reporting bots. Also disable last used stickers click.
This commit is contained in:
parent
4692fdeb5f
commit
2d48cde27a
12 changed files with 33 additions and 33 deletions
|
@ -495,6 +495,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
|
|
||||||
"lng_report_title" = "Report channel";
|
"lng_report_title" = "Report channel";
|
||||||
"lng_report_group_title" = "Report group";
|
"lng_report_group_title" = "Report group";
|
||||||
|
"lng_report_bot_title" = "Report bot";
|
||||||
"lng_report_reason_spam" = "Spam";
|
"lng_report_reason_spam" = "Spam";
|
||||||
"lng_report_reason_violence" = "Violence";
|
"lng_report_reason_violence" = "Violence";
|
||||||
"lng_report_reason_pornography" = "Pornography";
|
"lng_report_reason_pornography" = "Pornography";
|
||||||
|
|
|
@ -30,15 +30,15 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
#include "ui/widgets/input_fields.h"
|
#include "ui/widgets/input_fields.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
ReportBox::ReportBox(ChannelData *channel) : AbstractBox(st::boxWidth)
|
ReportBox::ReportBox(PeerData *peer) : AbstractBox(st::boxWidth)
|
||||||
, _channel(channel)
|
, _peer(peer)
|
||||||
, _reasonSpam(this, qsl("report_reason"), ReasonSpam, lang(lng_report_reason_spam), true, st::defaultBoxCheckbox)
|
, _reasonSpam(this, qsl("report_reason"), ReasonSpam, lang(lng_report_reason_spam), true, st::defaultBoxCheckbox)
|
||||||
, _reasonViolence(this, qsl("report_reason"), ReasonViolence, lang(lng_report_reason_violence), false, st::defaultBoxCheckbox)
|
, _reasonViolence(this, qsl("report_reason"), ReasonViolence, lang(lng_report_reason_violence), false, st::defaultBoxCheckbox)
|
||||||
, _reasonPornography(this, qsl("report_reason"), ReasonPornography, lang(lng_report_reason_pornography), false, st::defaultBoxCheckbox)
|
, _reasonPornography(this, qsl("report_reason"), ReasonPornography, lang(lng_report_reason_pornography), false, st::defaultBoxCheckbox)
|
||||||
, _reasonOther(this, qsl("report_reason"), ReasonOther, lang(lng_report_reason_other), false, st::defaultBoxCheckbox)
|
, _reasonOther(this, qsl("report_reason"), ReasonOther, lang(lng_report_reason_other), false, st::defaultBoxCheckbox)
|
||||||
, _report(this, lang(lng_report_button), st::defaultBoxButton)
|
, _report(this, lang(lng_report_button), st::defaultBoxButton)
|
||||||
, _cancel(this, lang(lng_cancel), st::cancelBoxButton) {
|
, _cancel(this, lang(lng_cancel), st::cancelBoxButton) {
|
||||||
setTitleText(lang(_channel->isMegagroup() ? lng_report_group_title : lng_report_title));
|
setTitleText(lang(_peer->isUser() ? lng_report_bot_title : (_peer->isMegagroup() ? lng_report_group_title : lng_report_title)));
|
||||||
|
|
||||||
connect(_report, SIGNAL(clicked()), this, SLOT(onReport()));
|
connect(_report, SIGNAL(clicked()), this, SLOT(onReport()));
|
||||||
connect(_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
|
connect(_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||||
|
@ -119,7 +119,7 @@ void ReportBox::onReport() {
|
||||||
return MTP_inputReportReasonSpam();
|
return MTP_inputReportReasonSpam();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
_requestId = MTP::send(MTPaccount_ReportPeer(_channel->input, getReason()), rpcDone(&ReportBox::reportDone), rpcFail(&ReportBox::reportFail));
|
_requestId = MTP::send(MTPaccount_ReportPeer(_peer->input, getReason()), rpcDone(&ReportBox::reportDone), rpcFail(&ReportBox::reportFail));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReportBox::reportDone(const MTPBool &result) {
|
void ReportBox::reportDone(const MTPBool &result) {
|
||||||
|
|
|
@ -32,7 +32,7 @@ class ReportBox : public AbstractBox, public RPCSender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ReportBox(ChannelData *channel);
|
ReportBox(PeerData *peer);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onReport();
|
void onReport();
|
||||||
|
@ -50,7 +50,7 @@ private:
|
||||||
void reportDone(const MTPBool &result);
|
void reportDone(const MTPBool &result);
|
||||||
bool reportFail(const RPCError &error);
|
bool reportFail(const RPCError &error);
|
||||||
|
|
||||||
ChannelData *_channel;
|
PeerData *_peer;
|
||||||
|
|
||||||
ChildWidget<Ui::Radiobutton> _reasonSpam;
|
ChildWidget<Ui::Radiobutton> _reasonSpam;
|
||||||
ChildWidget<Ui::Radiobutton> _reasonViolence;
|
ChildWidget<Ui::Radiobutton> _reasonViolence;
|
||||||
|
|
|
@ -959,13 +959,16 @@ void StickersBox::Inner::mouseReleaseEvent(QMouseEvent *e) {
|
||||||
} else if (pressed == _selected && _actionSel < 0 && _actionDown < 0) {
|
} else if (pressed == _selected && _actionSel < 0 && _actionDown < 0) {
|
||||||
if (_selected >= 0 && !_inDragArea) {
|
if (_selected >= 0 && !_inDragArea) {
|
||||||
auto &sets = Global::RefStickerSets();
|
auto &sets = Global::RefStickerSets();
|
||||||
auto it = sets.find(_rows.at(pressed)->id);
|
auto row = _rows[pressed];
|
||||||
|
if (!row->isRecentSet()) {
|
||||||
|
auto it = sets.find(row->id);
|
||||||
if (it != sets.cend()) {
|
if (it != sets.cend()) {
|
||||||
_selected = -1;
|
_selected = -1;
|
||||||
Ui::showLayer(new StickerSetBox(Stickers::inputSetId(*it)), KeepOtherLayers);
|
Ui::showLayer(new StickerSetBox(Stickers::inputSetId(*it)), KeepOtherLayers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
setActionDown(-1);
|
setActionDown(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,6 @@ void HistoryFileMedia::clickHandlerActiveChanged(const ClickHandlerPtr &p, bool
|
||||||
|
|
||||||
void HistoryFileMedia::thumbAnimationCallback() {
|
void HistoryFileMedia::thumbAnimationCallback() {
|
||||||
Ui::repaintHistoryItem(_parent);
|
Ui::repaintHistoryItem(_parent);
|
||||||
checkAnimationFinished();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryFileMedia::clickHandlerPressedChanged(const ClickHandlerPtr &p, bool pressed) {
|
void HistoryFileMedia::clickHandlerPressedChanged(const ClickHandlerPtr &p, bool pressed) {
|
||||||
|
@ -209,7 +208,7 @@ void HistoryFileMedia::ensureAnimation() const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryFileMedia::checkAnimationFinished() {
|
void HistoryFileMedia::checkAnimationFinished() const {
|
||||||
if (_animation && !_animation->a_thumbOver.animating() && !_animation->radial.animating()) {
|
if (_animation && !_animation->a_thumbOver.animating() && !_animation->radial.animating()) {
|
||||||
if (dataLoaded()) {
|
if (dataLoaded()) {
|
||||||
_animation.reset();
|
_animation.reset();
|
||||||
|
|
|
@ -75,7 +75,7 @@ protected:
|
||||||
void thumbAnimationCallback();
|
void thumbAnimationCallback();
|
||||||
|
|
||||||
void ensureAnimation() const;
|
void ensureAnimation() const;
|
||||||
void checkAnimationFinished();
|
void checkAnimationFinished() const;
|
||||||
|
|
||||||
bool isRadialAnimation(TimeMs ms) const {
|
bool isRadialAnimation(TimeMs ms) const {
|
||||||
if (!_animation || !_animation->radial.animating()) return false;
|
if (!_animation || !_animation->radial.animating()) return false;
|
||||||
|
@ -85,7 +85,10 @@ protected:
|
||||||
}
|
}
|
||||||
bool isThumbAnimation(TimeMs ms) const {
|
bool isThumbAnimation(TimeMs ms) const {
|
||||||
if (_animation) {
|
if (_animation) {
|
||||||
return _animation->a_thumbOver.animating(ms);
|
if (_animation->a_thumbOver.animating(ms)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
checkAnimationFinished();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -791,7 +791,6 @@ File::~File() {
|
||||||
|
|
||||||
void File::thumbAnimationCallback() {
|
void File::thumbAnimationCallback() {
|
||||||
Ui::repaintInlineItem(this);
|
Ui::repaintInlineItem(this);
|
||||||
checkAnimationFinished();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void File::step_radial(TimeMs ms, bool timer) {
|
void File::step_radial(TimeMs ms, bool timer) {
|
||||||
|
@ -812,7 +811,7 @@ void File::ensureAnimation() const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void File::checkAnimationFinished() {
|
void File::checkAnimationFinished() const {
|
||||||
if (_animation && !_animation->a_thumbOver.animating() && !_animation->radial.animating()) {
|
if (_animation && !_animation->a_thumbOver.animating() && !_animation->radial.animating()) {
|
||||||
if (getShownDocument()->loaded()) {
|
if (getShownDocument()->loaded()) {
|
||||||
_animation.reset();
|
_animation.reset();
|
||||||
|
|
|
@ -246,7 +246,7 @@ private:
|
||||||
void step_radial(TimeMs ms, bool timer);
|
void step_radial(TimeMs ms, bool timer);
|
||||||
|
|
||||||
void ensureAnimation() const;
|
void ensureAnimation() const;
|
||||||
void checkAnimationFinished();
|
void checkAnimationFinished() const;
|
||||||
bool updateStatusText() const;
|
bool updateStatusText() const;
|
||||||
|
|
||||||
bool isRadialAnimation(TimeMs ms) const {
|
bool isRadialAnimation(TimeMs ms) const {
|
||||||
|
@ -257,7 +257,10 @@ private:
|
||||||
}
|
}
|
||||||
bool isThumbAnimation(TimeMs ms) const {
|
bool isThumbAnimation(TimeMs ms) const {
|
||||||
if (_animation) {
|
if (_animation) {
|
||||||
return _animation->a_thumbOver.animating(ms);
|
if (_animation->a_thumbOver.animating(ms)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
checkAnimationFinished();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,6 +131,9 @@ void ActionsWidget::refreshButtons() {
|
||||||
}
|
}
|
||||||
addButton(lang(lng_profile_clear_history), SLOT(onClearHistory()));
|
addButton(lang(lng_profile_clear_history), SLOT(onClearHistory()));
|
||||||
addButton(lang(lng_profile_delete_conversation), SLOT(onDeleteConversation()));
|
addButton(lang(lng_profile_delete_conversation), SLOT(onDeleteConversation()));
|
||||||
|
if (user->botInfo) {
|
||||||
|
addButton(lang(lng_profile_report), SLOT(onReport()), st::defaultLeftOutlineButton, st::profileBlockOneLineSkip);
|
||||||
|
}
|
||||||
refreshBlockUser();
|
refreshBlockUser();
|
||||||
} else if (auto chat = peer()->asChat()) {
|
} else if (auto chat = peer()->asChat()) {
|
||||||
if (chat->amCreator()) {
|
if (chat->amCreator()) {
|
||||||
|
@ -139,7 +142,7 @@ void ActionsWidget::refreshButtons() {
|
||||||
addButton(lang(lng_profile_clear_history), SLOT(onClearHistory()));
|
addButton(lang(lng_profile_clear_history), SLOT(onClearHistory()));
|
||||||
addButton(lang(lng_profile_clear_and_exit), SLOT(onDeleteConversation()));
|
addButton(lang(lng_profile_clear_and_exit), SLOT(onDeleteConversation()));
|
||||||
} else if (auto channel = peer()->asChannel()) {
|
} else if (auto channel = peer()->asChannel()) {
|
||||||
if (!channel->amCreator()) {
|
if (!channel->amCreator() && (!channel->isMegagroup() || channel->isPublic())) {
|
||||||
addButton(lang(lng_profile_report), SLOT(onReport()));
|
addButton(lang(lng_profile_report), SLOT(onReport()));
|
||||||
}
|
}
|
||||||
refreshDeleteChannel();
|
refreshDeleteChannel();
|
||||||
|
@ -359,9 +362,7 @@ void ActionsWidget::onLeaveChannelSure() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionsWidget::onReport() {
|
void ActionsWidget::onReport() {
|
||||||
if (auto channel = peer()->asChannel()) {
|
Ui::showLayer(new ReportBox(peer()));
|
||||||
Ui::showLayer(new ReportBox(channel));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Profile
|
} // namespace Profile
|
||||||
|
|
|
@ -88,15 +88,6 @@ private:
|
||||||
void sendBotCommand(const QString &command);
|
void sendBotCommand(const QString &command);
|
||||||
|
|
||||||
QList<Ui::LeftOutlineButton*> _buttons;
|
QList<Ui::LeftOutlineButton*> _buttons;
|
||||||
//ChildWidget<Ui::LeftOutlineButton> _botHelp = { nullptr };
|
|
||||||
//ChildWidget<Ui::LeftOutlineButton> _botSettings = { nullptr };
|
|
||||||
//ChildWidget<Ui::LeftOutlineButton> _reportChannel = { nullptr };
|
|
||||||
//ChildWidget<Ui::LeftOutlineButton> _leaveChannel = { nullptr };
|
|
||||||
//ChildWidget<Ui::LeftOutlineButton> _deleteChannel = { nullptr };
|
|
||||||
//ChildWidget<Ui::LeftOutlineButton> _upgradeToSupergroup = { nullptr };
|
|
||||||
//ChildWidget<Ui::LeftOutlineButton> _clearHistory = { nullptr };
|
|
||||||
//ChildWidget<Ui::LeftOutlineButton> _deleteConversation = { nullptr };
|
|
||||||
//ChildWidget<Ui::LeftOutlineButton> _blockUser = { nullptr };
|
|
||||||
|
|
||||||
// Hold some button pointers to update / toggle them.
|
// Hold some button pointers to update / toggle them.
|
||||||
bool _hasBotHelp = false;
|
bool _hasBotHelp = false;
|
||||||
|
|
|
@ -412,7 +412,7 @@ void Widget::hideAnimated(float64 duration, const anim::transition &func) {
|
||||||
|
|
||||||
void Widget::updateOpacity() {
|
void Widget::updateOpacity() {
|
||||||
if (auto manager = ManagerInstance.data()) {
|
if (auto manager = ManagerInstance.data()) {
|
||||||
setWindowOpacity(_a_opacity.current(_hiding ? 1. : 0.) * manager->demoMasterOpacity());
|
setWindowOpacity(_a_opacity.current(_hiding ? 0. : 1.) * manager->demoMasterOpacity());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ set "ReleasePath=%HomePath%\..\out\Release"
|
||||||
set "DeployPath=%ReleasePath%\deploy\%AppVersionStrMajor%\%AppVersionStrFull%"
|
set "DeployPath=%ReleasePath%\deploy\%AppVersionStrMajor%\%AppVersionStrFull%"
|
||||||
set "SignPath=%HomePath%\..\..\TelegramPrivate\Sign.bat"
|
set "SignPath=%HomePath%\..\..\TelegramPrivate\Sign.bat"
|
||||||
set "BinaryName=Telegram"
|
set "BinaryName=Telegram"
|
||||||
set "DropboxSymbolsPath=X:\Telegram\symbols"
|
set "DropboxSymbolsPath=Y:\Telegram\symbols"
|
||||||
|
|
||||||
if not exist %DropboxSymbolsPath% (
|
if not exist %DropboxSymbolsPath% (
|
||||||
echo Dropbox path not found!
|
echo Dropbox path not found!
|
||||||
|
|
Loading…
Add table
Reference in a new issue