2014-05-30 08:53:19 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2014-12-01 10:47:38 +00:00
|
|
|
the official desktop version of Telegram messaging app, see https://telegram.org
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
Telegram Desktop is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
It is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
2015-10-03 13:16:42 +00:00
|
|
|
In addition, as a special exception, the copyright holders give permission
|
|
|
|
to link the code of portions of this program with the OpenSSL library.
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
2016-02-08 10:56:18 +00:00
|
|
|
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
2014-05-30 08:53:19 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2015-04-02 10:33:19 +00:00
|
|
|
#include "abstractbox.h"
|
2016-05-26 15:31:20 +00:00
|
|
|
#include "ui/flatlabel.h"
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-10-03 10:09:09 +00:00
|
|
|
class InformBox;
|
2016-03-29 17:17:00 +00:00
|
|
|
class ConfirmBox : public AbstractBox, public ClickHandlerHost {
|
2014-05-30 08:53:19 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2016-06-22 17:11:35 +00:00
|
|
|
ConfirmBox(const QString &text, const QString &doneText = QString(), const style::RoundButton &doneStyle = st::defaultBoxButton, const QString &cancelText = QString(), const style::RoundButton &cancelStyle = st::cancelBoxButton);
|
2014-05-30 08:53:19 +00:00
|
|
|
void keyPressEvent(QKeyEvent *e);
|
|
|
|
void paintEvent(QPaintEvent *e);
|
2015-04-02 10:33:19 +00:00
|
|
|
void resizeEvent(QResizeEvent *e);
|
2014-12-05 13:44:27 +00:00
|
|
|
void mouseMoveEvent(QMouseEvent *e);
|
|
|
|
void mousePressEvent(QMouseEvent *e);
|
|
|
|
void mouseReleaseEvent(QMouseEvent *e);
|
|
|
|
void leaveEvent(QEvent *e);
|
|
|
|
void updateLink();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-03-29 17:17:00 +00:00
|
|
|
// ClickHandlerHost interface
|
|
|
|
void clickHandlerActiveChanged(const ClickHandlerPtr &p, bool active);
|
|
|
|
void clickHandlerPressedChanged(const ClickHandlerPtr &p, bool pressed);
|
|
|
|
|
2015-08-12 18:01:32 +00:00
|
|
|
public slots:
|
|
|
|
|
|
|
|
void onCancel();
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
signals:
|
|
|
|
|
|
|
|
void confirmed();
|
|
|
|
void cancelled();
|
2015-08-12 18:01:32 +00:00
|
|
|
void cancelPressed();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-04-02 10:33:19 +00:00
|
|
|
protected:
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-04-02 10:33:19 +00:00
|
|
|
void closePressed();
|
|
|
|
void hideAll();
|
|
|
|
void showAll();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2016-06-22 17:11:35 +00:00
|
|
|
ConfirmBox(const QString &text, const QString &doneText, const style::RoundButton &doneStyle, bool informative);
|
2015-10-03 10:09:09 +00:00
|
|
|
friend class InformBox;
|
|
|
|
|
2014-12-05 13:44:27 +00:00
|
|
|
void init(const QString &text);
|
|
|
|
|
2015-10-03 10:09:09 +00:00
|
|
|
bool _informative;
|
2014-12-05 13:44:27 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
Text _text;
|
|
|
|
int32 _textWidth, _textHeight;
|
|
|
|
|
2014-12-05 13:44:27 +00:00
|
|
|
void updateHover();
|
|
|
|
|
|
|
|
QPoint _lastMousePos;
|
2015-10-03 10:09:09 +00:00
|
|
|
|
|
|
|
BoxButton _confirm, _cancel;
|
|
|
|
};
|
|
|
|
|
|
|
|
class InformBox : public ConfirmBox {
|
|
|
|
public:
|
2016-06-22 17:11:35 +00:00
|
|
|
InformBox(const QString &text, const QString &doneText = QString(), const style::RoundButton &doneStyle = st::defaultBoxButton) : ConfirmBox(text, doneText, doneStyle, true) {
|
2015-10-03 10:09:09 +00:00
|
|
|
}
|
2014-05-30 08:53:19 +00:00
|
|
|
};
|
2015-09-10 11:20:28 +00:00
|
|
|
|
2016-03-30 16:42:01 +00:00
|
|
|
class SharePhoneConfirmBox : public ConfirmBox {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
SharePhoneConfirmBox(PeerData *recipient);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void confirmed(PeerData *recipient);
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onConfirm();
|
|
|
|
|
|
|
|
private:
|
|
|
|
PeerData *_recipient;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2015-09-10 11:20:28 +00:00
|
|
|
class ConfirmLinkBox : public ConfirmBox {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
ConfirmLinkBox(const QString &url);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
void onOpenLink();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
QString _url;
|
|
|
|
|
|
|
|
};
|
2015-09-23 17:43:08 +00:00
|
|
|
|
|
|
|
class MaxInviteBox : public AbstractBox {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
MaxInviteBox(const QString &link);
|
|
|
|
void paintEvent(QPaintEvent *e);
|
|
|
|
void resizeEvent(QResizeEvent *e);
|
|
|
|
void mouseMoveEvent(QMouseEvent *e);
|
|
|
|
void mousePressEvent(QMouseEvent *e);
|
|
|
|
void leaveEvent(QEvent *e);
|
2016-03-04 22:04:15 +00:00
|
|
|
|
2015-09-23 17:43:08 +00:00
|
|
|
protected:
|
|
|
|
|
|
|
|
void hideAll();
|
|
|
|
void showAll();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
void updateSelected(const QPoint &cursorGlobalPosition);
|
2015-12-08 12:33:37 +00:00
|
|
|
void step_good(float64 ms, bool timer);
|
2015-09-23 17:43:08 +00:00
|
|
|
|
2015-10-03 10:09:09 +00:00
|
|
|
BoxButton _close;
|
2015-09-23 17:43:08 +00:00
|
|
|
Text _text;
|
|
|
|
int32 _textWidth, _textHeight;
|
|
|
|
|
|
|
|
QString _link;
|
|
|
|
QRect _invitationLink;
|
|
|
|
bool _linkOver;
|
|
|
|
|
|
|
|
QPoint _lastMousePos;
|
|
|
|
|
|
|
|
QString _goodTextLink;
|
|
|
|
anim::fvalue a_goodOpacity;
|
2015-12-08 12:33:37 +00:00
|
|
|
Animation _a_good;
|
2015-09-23 17:43:08 +00:00
|
|
|
};
|
2016-03-04 22:04:15 +00:00
|
|
|
|
|
|
|
class ConvertToSupergroupBox : public AbstractBox, public RPCSender {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
ConvertToSupergroupBox(ChatData *chat);
|
|
|
|
void keyPressEvent(QKeyEvent *e);
|
|
|
|
void paintEvent(QPaintEvent *e);
|
|
|
|
void resizeEvent(QResizeEvent *e);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
void onConvert();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
void hideAll();
|
|
|
|
void showAll();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
void convertDone(const MTPUpdates &updates);
|
|
|
|
bool convertFail(const RPCError &error);
|
|
|
|
|
|
|
|
ChatData *_chat;
|
|
|
|
Text _text, _note;
|
|
|
|
int32 _textWidth, _textHeight;
|
|
|
|
|
|
|
|
BoxButton _convert, _cancel;
|
2016-03-10 10:15:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class PinMessageBox : public AbstractBox, public RPCSender {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
PinMessageBox(ChannelData *channel, MsgId msgId);
|
|
|
|
|
|
|
|
void resizeEvent(QResizeEvent *e);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
void onPin();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
void showAll();
|
|
|
|
void hideAll();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
void pinDone(const MTPUpdates &updates);
|
|
|
|
bool pinFail(const RPCError &error);
|
|
|
|
|
|
|
|
ChannelData *_channel;
|
|
|
|
MsgId _msgId;
|
|
|
|
|
|
|
|
FlatLabel _text;
|
|
|
|
Checkbox _notify;
|
|
|
|
|
|
|
|
BoxButton _pin, _cancel;
|
|
|
|
|
2016-05-31 19:27:11 +00:00
|
|
|
mtpRequestId _requestId = 0;
|
2016-03-10 10:15:21 +00:00
|
|
|
|
2016-03-10 15:42:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class RichDeleteMessageBox : public AbstractBox, public RPCSender {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
RichDeleteMessageBox(ChannelData *channel, UserData *from, MsgId msgId);
|
|
|
|
|
|
|
|
void resizeEvent(QResizeEvent *e);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
void onDelete();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
void showAll();
|
|
|
|
void hideAll();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
ChannelData *_channel;
|
|
|
|
UserData *_from;
|
|
|
|
MsgId _msgId;
|
|
|
|
|
|
|
|
FlatLabel _text;
|
|
|
|
Checkbox _banUser, _reportSpam, _deleteAll;
|
|
|
|
|
|
|
|
BoxButton _delete, _cancel;
|
|
|
|
|
|
|
|
};
|
2016-06-20 15:40:36 +00:00
|
|
|
|
|
|
|
class KickMemberBox : public ConfirmBox {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
KickMemberBox(PeerData *chat, UserData *member);
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onConfirm();
|
|
|
|
|
|
|
|
private:
|
|
|
|
PeerData *_chat;
|
|
|
|
UserData *_member;
|
|
|
|
|
|
|
|
};
|