2014-05-30 12:53:19 +04:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2014-12-01 13:47:38 +03:00
|
|
|
the official desktop version of Telegram messaging app, see https://telegram.org
|
2014-05-30 12:53:19 +04: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.
|
|
|
|
|
|
|
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
2014-12-01 13:47:38 +03:00
|
|
|
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
2014-05-30 12:53:19 +04:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2015-04-02 13:33:19 +03:00
|
|
|
#include "abstractbox.h"
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2015-09-23 20:43:08 +03:00
|
|
|
class ConfirmBox : public AbstractBox {
|
2014-05-30 12:53:19 +04:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2015-04-04 23:01:34 +03:00
|
|
|
ConfirmBox(const QString &text, const QString &doneText = QString(), const QString &cancelText = QString(), const style::flatButton &doneStyle = st::btnSelectDone, const style::flatButton &cancelStyle = st::btnSelectCancel);
|
2014-12-05 16:44:27 +03:00
|
|
|
ConfirmBox(const QString &text, bool noDone, const QString &cancelText = QString());
|
2014-05-30 12:53:19 +04:00
|
|
|
void keyPressEvent(QKeyEvent *e);
|
|
|
|
void paintEvent(QPaintEvent *e);
|
2015-04-02 13:33:19 +03:00
|
|
|
void resizeEvent(QResizeEvent *e);
|
2014-12-05 16:44:27 +03:00
|
|
|
void mouseMoveEvent(QMouseEvent *e);
|
|
|
|
void mousePressEvent(QMouseEvent *e);
|
|
|
|
void mouseReleaseEvent(QMouseEvent *e);
|
|
|
|
void leaveEvent(QEvent *e);
|
|
|
|
void updateLink();
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2015-08-12 21:01:32 +03:00
|
|
|
public slots:
|
|
|
|
|
|
|
|
void onCancel();
|
|
|
|
|
2014-05-30 12:53:19 +04:00
|
|
|
signals:
|
|
|
|
|
|
|
|
void confirmed();
|
|
|
|
void cancelled();
|
2015-08-12 21:01:32 +03:00
|
|
|
void cancelPressed();
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2015-04-02 13:33:19 +03:00
|
|
|
protected:
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2015-04-02 13:33:19 +03:00
|
|
|
void closePressed();
|
|
|
|
void hideAll();
|
|
|
|
void showAll();
|
2014-05-30 12:53:19 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2014-12-05 16:44:27 +03:00
|
|
|
void init(const QString &text);
|
|
|
|
|
|
|
|
bool _infoMsg;
|
|
|
|
|
2014-05-30 12:53:19 +04:00
|
|
|
FlatButton _confirm, _cancel;
|
2014-12-05 16:44:27 +03:00
|
|
|
BottomButton _close;
|
2014-05-30 12:53:19 +04:00
|
|
|
Text _text;
|
|
|
|
int32 _textWidth, _textHeight;
|
|
|
|
|
2014-12-05 16:44:27 +03:00
|
|
|
void updateHover();
|
|
|
|
|
|
|
|
QPoint _lastMousePos;
|
|
|
|
TextLinkPtr _myLink;
|
2014-05-30 12:53:19 +04:00
|
|
|
};
|
2015-09-10 14:20:28 +03:00
|
|
|
|
|
|
|
class ConfirmLinkBox : public ConfirmBox {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
ConfirmLinkBox(const QString &url);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
void onOpenLink();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
QString _url;
|
|
|
|
|
|
|
|
};
|
2015-09-23 20:43:08 +03: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);
|
|
|
|
void updateLink();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
void hideAll();
|
|
|
|
void showAll();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
void updateSelected(const QPoint &cursorGlobalPosition);
|
|
|
|
bool goodAnimStep(float64 ms);
|
|
|
|
|
|
|
|
BottomButton _close;
|
|
|
|
Text _text;
|
|
|
|
int32 _textWidth, _textHeight;
|
|
|
|
|
|
|
|
QString _link;
|
|
|
|
QRect _invitationLink;
|
|
|
|
bool _linkOver;
|
|
|
|
|
|
|
|
QPoint _lastMousePos;
|
|
|
|
|
|
|
|
QString _goodTextLink;
|
|
|
|
anim::fvalue a_goodOpacity;
|
|
|
|
Animation a_good;
|
|
|
|
};
|