Fixed crashes in thumb animation. Fix notifications show.

Also allow reporting bots. Also disable last used stickers click.
This commit is contained in:
John Preston 2016-12-09 09:19:55 +03:00
parent 4692fdeb5f
commit 2d48cde27a
12 changed files with 33 additions and 33 deletions

View File

@ -495,6 +495,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_report_title" = "Report channel";
"lng_report_group_title" = "Report group";
"lng_report_bot_title" = "Report bot";
"lng_report_reason_spam" = "Spam";
"lng_report_reason_violence" = "Violence";
"lng_report_reason_pornography" = "Pornography";

View File

@ -30,15 +30,15 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "ui/widgets/input_fields.h"
#include "mainwindow.h"
ReportBox::ReportBox(ChannelData *channel) : AbstractBox(st::boxWidth)
, _channel(channel)
ReportBox::ReportBox(PeerData *peer) : AbstractBox(st::boxWidth)
, _peer(peer)
, _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)
, _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)
, _report(this, lang(lng_report_button), st::defaultBoxButton)
, _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(_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
@ -119,7 +119,7 @@ void ReportBox::onReport() {
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) {

View File

@ -32,7 +32,7 @@ class ReportBox : public AbstractBox, public RPCSender {
Q_OBJECT
public:
ReportBox(ChannelData *channel);
ReportBox(PeerData *peer);
private slots:
void onReport();
@ -50,7 +50,7 @@ private:
void reportDone(const MTPBool &result);
bool reportFail(const RPCError &error);
ChannelData *_channel;
PeerData *_peer;
ChildWidget<Ui::Radiobutton> _reasonSpam;
ChildWidget<Ui::Radiobutton> _reasonViolence;

View File

@ -959,10 +959,13 @@ void StickersBox::Inner::mouseReleaseEvent(QMouseEvent *e) {
} else if (pressed == _selected && _actionSel < 0 && _actionDown < 0) {
if (_selected >= 0 && !_inDragArea) {
auto &sets = Global::RefStickerSets();
auto it = sets.find(_rows.at(pressed)->id);
if (it != sets.cend()) {
_selected = -1;
Ui::showLayer(new StickerSetBox(Stickers::inputSetId(*it)), KeepOtherLayers);
auto row = _rows[pressed];
if (!row->isRecentSet()) {
auto it = sets.find(row->id);
if (it != sets.cend()) {
_selected = -1;
Ui::showLayer(new StickerSetBox(Stickers::inputSetId(*it)), KeepOtherLayers);
}
}
}
}

View File

@ -164,7 +164,6 @@ void HistoryFileMedia::clickHandlerActiveChanged(const ClickHandlerPtr &p, bool
void HistoryFileMedia::thumbAnimationCallback() {
Ui::repaintHistoryItem(_parent);
checkAnimationFinished();
}
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 (dataLoaded()) {
_animation.reset();

View File

@ -75,7 +75,7 @@ protected:
void thumbAnimationCallback();
void ensureAnimation() const;
void checkAnimationFinished();
void checkAnimationFinished() const;
bool isRadialAnimation(TimeMs ms) const {
if (!_animation || !_animation->radial.animating()) return false;
@ -85,7 +85,10 @@ protected:
}
bool isThumbAnimation(TimeMs ms) const {
if (_animation) {
return _animation->a_thumbOver.animating(ms);
if (_animation->a_thumbOver.animating(ms)) {
return true;
}
checkAnimationFinished();
}
return false;
}

View File

@ -791,7 +791,6 @@ File::~File() {
void File::thumbAnimationCallback() {
Ui::repaintInlineItem(this);
checkAnimationFinished();
}
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 (getShownDocument()->loaded()) {
_animation.reset();

View File

@ -246,7 +246,7 @@ private:
void step_radial(TimeMs ms, bool timer);
void ensureAnimation() const;
void checkAnimationFinished();
void checkAnimationFinished() const;
bool updateStatusText() const;
bool isRadialAnimation(TimeMs ms) const {
@ -257,7 +257,10 @@ private:
}
bool isThumbAnimation(TimeMs ms) const {
if (_animation) {
return _animation->a_thumbOver.animating(ms);
if (_animation->a_thumbOver.animating(ms)) {
return true;
}
checkAnimationFinished();
}
return false;
}

View File

@ -131,6 +131,9 @@ void ActionsWidget::refreshButtons() {
}
addButton(lang(lng_profile_clear_history), SLOT(onClearHistory()));
addButton(lang(lng_profile_delete_conversation), SLOT(onDeleteConversation()));
if (user->botInfo) {
addButton(lang(lng_profile_report), SLOT(onReport()), st::defaultLeftOutlineButton, st::profileBlockOneLineSkip);
}
refreshBlockUser();
} else if (auto chat = peer()->asChat()) {
if (chat->amCreator()) {
@ -139,7 +142,7 @@ void ActionsWidget::refreshButtons() {
addButton(lang(lng_profile_clear_history), SLOT(onClearHistory()));
addButton(lang(lng_profile_clear_and_exit), SLOT(onDeleteConversation()));
} else if (auto channel = peer()->asChannel()) {
if (!channel->amCreator()) {
if (!channel->amCreator() && (!channel->isMegagroup() || channel->isPublic())) {
addButton(lang(lng_profile_report), SLOT(onReport()));
}
refreshDeleteChannel();
@ -359,9 +362,7 @@ void ActionsWidget::onLeaveChannelSure() {
}
void ActionsWidget::onReport() {
if (auto channel = peer()->asChannel()) {
Ui::showLayer(new ReportBox(channel));
}
Ui::showLayer(new ReportBox(peer()));
}
} // namespace Profile

View File

@ -88,15 +88,6 @@ private:
void sendBotCommand(const QString &command);
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.
bool _hasBotHelp = false;

View File

@ -412,7 +412,7 @@ void Widget::hideAnimated(float64 duration, const anim::transition &func) {
void Widget::updateOpacity() {
if (auto manager = ManagerInstance.data()) {
setWindowOpacity(_a_opacity.current(_hiding ? 1. : 0.) * manager->demoMasterOpacity());
setWindowOpacity(_a_opacity.current(_hiding ? 0. : 1.) * manager->demoMasterOpacity());
}
}

View File

@ -44,7 +44,7 @@ set "ReleasePath=%HomePath%\..\out\Release"
set "DeployPath=%ReleasePath%\deploy\%AppVersionStrMajor%\%AppVersionStrFull%"
set "SignPath=%HomePath%\..\..\TelegramPrivate\Sign.bat"
set "BinaryName=Telegram"
set "DropboxSymbolsPath=X:\Telegram\symbols"
set "DropboxSymbolsPath=Y:\Telegram\symbols"
if not exist %DropboxSymbolsPath% (
echo Dropbox path not found!