tdesktop/Telegram/SourceFiles/boxes/confirmbox.h

125 lines
2.6 KiB
C
Raw Normal View History

/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
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
Copyright (c) 2014 John Preston, https://desktop.telegram.org
*/
#pragma once
#include "abstractbox.h"
class ConfirmBox : public AbstractBox {
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);
ConfirmBox(const QString &text, bool noDone, const QString &cancelText = QString());
void keyPressEvent(QKeyEvent *e);
void paintEvent(QPaintEvent *e);
void resizeEvent(QResizeEvent *e);
void mouseMoveEvent(QMouseEvent *e);
void mousePressEvent(QMouseEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
void leaveEvent(QEvent *e);
void updateLink();
public slots:
void onCancel();
signals:
void confirmed();
void cancelled();
void cancelPressed();
protected:
void closePressed();
void hideAll();
void showAll();
private:
void init(const QString &text);
bool _infoMsg;
FlatButton _confirm, _cancel;
BottomButton _close;
Text _text;
int32 _textWidth, _textHeight;
void updateHover();
QPoint _lastMousePos;
TextLinkPtr _myLink;
};
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;
};
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;
};