mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Handle click on premium star in profile.
This commit is contained in:
parent
705753efb2
commit
b023044cc8
2 changed files with 17 additions and 2 deletions
|
@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "info/info_memento.h"
|
#include "info/info_memento.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/effects/ripple_animation.h"
|
#include "ui/effects/ripple_animation.h"
|
||||||
#include "ui/text/text_utilities.h"
|
#include "ui/text/text_utilities.h"
|
||||||
#include "ui/special_buttons.h"
|
#include "ui/special_buttons.h"
|
||||||
|
@ -26,6 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "window/window_session_controller.h"
|
#include "window/window_session_controller.h"
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
|
#include "settings/settings_premium.h"
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
#include "api/api_peer_photo.h"
|
#include "api/api_peer_photo.h"
|
||||||
#include "styles/style_boxes.h"
|
#include "styles/style_boxes.h"
|
||||||
|
@ -184,6 +186,7 @@ Cover::Cover(
|
||||||
st::infoProfilePhotoTop
|
st::infoProfilePhotoTop
|
||||||
+ st::infoProfilePhoto.size.height()
|
+ st::infoProfilePhoto.size.height()
|
||||||
+ st::infoProfilePhotoBottom)
|
+ st::infoProfilePhotoBottom)
|
||||||
|
, _controller(controller)
|
||||||
, _peer(peer)
|
, _peer(peer)
|
||||||
, _userpic(
|
, _userpic(
|
||||||
this,
|
this,
|
||||||
|
@ -304,6 +307,16 @@ void Cover::setBadge(Badge badge) {
|
||||||
Painter p(check);
|
Painter p(check);
|
||||||
icon->paint(p, 0, 0, check->width());
|
icon->paint(p, 0, 0, check->width());
|
||||||
}, _verifiedCheck->lifetime());
|
}, _verifiedCheck->lifetime());
|
||||||
|
if (_badge == Badge::Premium) {
|
||||||
|
const auto userId = peerToUser(_peer->id).bare;
|
||||||
|
_verifiedCheck->setClickedCallback([=] {
|
||||||
|
::Settings::ShowPremium(
|
||||||
|
_controller,
|
||||||
|
u"profile__%1"_q.arg(userId));
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
_verifiedCheck->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
|
}
|
||||||
} break;
|
} break;
|
||||||
case Badge::Scam:
|
case Badge::Scam:
|
||||||
case Badge::Fake: {
|
case Badge::Fake: {
|
||||||
|
|
|
@ -20,6 +20,7 @@ struct InfoToggle;
|
||||||
} // namespace style
|
} // namespace style
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
class AbstractButton;
|
||||||
class UserpicButton;
|
class UserpicButton;
|
||||||
class FlatLabel;
|
class FlatLabel;
|
||||||
template <typename Widget>
|
template <typename Widget>
|
||||||
|
@ -65,13 +66,14 @@ private:
|
||||||
void refreshUploadPhotoOverlay();
|
void refreshUploadPhotoOverlay();
|
||||||
void setBadge(Badge badge);
|
void setBadge(Badge badge);
|
||||||
|
|
||||||
not_null<PeerData*> _peer;
|
const not_null<Window::SessionController*> _controller;
|
||||||
|
const not_null<PeerData*> _peer;
|
||||||
int _onlineCount = 0;
|
int _onlineCount = 0;
|
||||||
Badge _badge = Badge();
|
Badge _badge = Badge();
|
||||||
|
|
||||||
object_ptr<Ui::UserpicButton> _userpic;
|
object_ptr<Ui::UserpicButton> _userpic;
|
||||||
object_ptr<Ui::FlatLabel> _name = { nullptr };
|
object_ptr<Ui::FlatLabel> _name = { nullptr };
|
||||||
object_ptr<Ui::RpWidget> _verifiedCheck = { nullptr };
|
object_ptr<Ui::AbstractButton> _verifiedCheck = { nullptr };
|
||||||
object_ptr<Ui::RpWidget> _scamFakeBadge = { nullptr };
|
object_ptr<Ui::RpWidget> _scamFakeBadge = { nullptr };
|
||||||
object_ptr<Ui::FlatLabel> _status = { nullptr };
|
object_ptr<Ui::FlatLabel> _status = { nullptr };
|
||||||
//object_ptr<CoverDropArea> _dropArea = { nullptr };
|
//object_ptr<CoverDropArea> _dropArea = { nullptr };
|
||||||
|
|
Loading…
Add table
Reference in a new issue