mirror of https://github.com/procxx/kepka.git
Finalizing files rename.
Also moved peer_avatar_button to ui/special_buttons.
This commit is contained in:
parent
9510492174
commit
6456a83a22
|
@ -33,7 +33,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "ui/widgets/input_fields.h"
|
#include "ui/widgets/input_fields.h"
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
#include "ui/toast/toast.h"
|
#include "ui/toast/toast.h"
|
||||||
#include "ui/buttons/peer_avatar_button.h"
|
#include "ui/special_buttons.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
|
|
|
@ -30,7 +30,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "boxes/sharebox.h"
|
#include "boxes/sharebox.h"
|
||||||
#include "core/file_utilities.h"
|
#include "core/file_utilities.h"
|
||||||
#include "ui/toast/toast.h"
|
#include "ui/toast/toast.h"
|
||||||
#include "ui/buttons/history_down_button.h"
|
#include "ui/special_buttons.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/widgets/inner_dropdown.h"
|
#include "ui/widgets/inner_dropdown.h"
|
||||||
#include "ui/widgets/dropdown_menu.h"
|
#include "ui/widgets/dropdown_menu.h"
|
||||||
|
|
|
@ -30,7 +30,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/widgets/input_fields.h"
|
#include "ui/widgets/input_fields.h"
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
#include "ui/buttons/peer_avatar_button.h"
|
#include "ui/special_buttons.h"
|
||||||
|
|
||||||
namespace Intro {
|
namespace Intro {
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
|
|
||||||
#include "styles/style_dialogs.h"
|
#include "styles/style_dialogs.h"
|
||||||
#include "styles/style_history.h"
|
#include "styles/style_history.h"
|
||||||
#include "ui/buttons/peer_avatar_button.h"
|
#include "ui/special_buttons.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/widgets/shadow.h"
|
#include "ui/widgets/shadow.h"
|
||||||
#include "window/section_memento.h"
|
#include "window/section_memento.h"
|
||||||
|
|
|
@ -41,7 +41,6 @@ class Panel;
|
||||||
} // namespace Media
|
} // namespace Media
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class PeerAvatarButton;
|
|
||||||
class PlainShadow;
|
class PlainShadow;
|
||||||
class DropdownMenu;
|
class DropdownMenu;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
|
@ -1,79 +0,0 @@
|
||||||
/*
|
|
||||||
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.
|
|
||||||
|
|
||||||
In addition, as a special exception, the copyright holders give permission
|
|
||||||
to link the code of portions of this program with the OpenSSL library.
|
|
||||||
|
|
||||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
|
||||||
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|
||||||
*/
|
|
||||||
#include "ui/buttons/peer_avatar_button.h"
|
|
||||||
|
|
||||||
#include "structs.h"
|
|
||||||
#include "ui/effects/ripple_animation.h"
|
|
||||||
#include "styles/style_boxes.h"
|
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
|
|
||||||
PeerAvatarButton::PeerAvatarButton(QWidget *parent, PeerData *peer, const style::PeerAvatarButton &st) : AbstractButton(parent)
|
|
||||||
, _peer(peer)
|
|
||||||
, _st(st) {
|
|
||||||
resize(_st.size, _st.size);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PeerAvatarButton::paintEvent(QPaintEvent *e) {
|
|
||||||
if (_peer) {
|
|
||||||
Painter p(this);
|
|
||||||
_peer->paintUserpic(p, (_st.size - _st.photoSize) / 2, (_st.size - _st.photoSize) / 2, _st.photoSize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NewAvatarButton::NewAvatarButton(QWidget *parent, int size, QPoint position) : RippleButton(parent, st::defaultActiveButton.ripple)
|
|
||||||
, _position(position) {
|
|
||||||
resize(size, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
void NewAvatarButton::paintEvent(QPaintEvent *e) {
|
|
||||||
Painter p(this);
|
|
||||||
|
|
||||||
if (!_image.isNull()) {
|
|
||||||
p.drawPixmap(0, 0, _image);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.setPen(Qt::NoPen);
|
|
||||||
p.setBrush(isOver() ? st::defaultActiveButton.textBgOver : st::defaultActiveButton.textBg);
|
|
||||||
{
|
|
||||||
PainterHighQualityEnabler hq(p);
|
|
||||||
p.drawEllipse(rect());
|
|
||||||
}
|
|
||||||
|
|
||||||
paintRipple(p, 0, 0, getms());
|
|
||||||
|
|
||||||
st::newGroupPhotoIcon.paint(p, _position, width());
|
|
||||||
}
|
|
||||||
|
|
||||||
void NewAvatarButton::setImage(const QImage &image) {
|
|
||||||
auto small = image.scaled(size() * cIntRetinaFactor(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
|
||||||
Images::prepareCircle(small);
|
|
||||||
_image = App::pixmapFromImageInPlace(std::move(small));
|
|
||||||
_image.setDevicePixelRatio(cRetinaFactor());
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
QImage NewAvatarButton::prepareRippleMask() const {
|
|
||||||
return Ui::RippleAnimation::ellipseMask(size());
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Ui
|
|
|
@ -1,65 +0,0 @@
|
||||||
/*
|
|
||||||
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.
|
|
||||||
|
|
||||||
In addition, as a special exception, the copyright holders give permission
|
|
||||||
to link the code of portions of this program with the OpenSSL library.
|
|
||||||
|
|
||||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
|
||||||
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "ui/widgets/buttons.h"
|
|
||||||
#include "styles/style_window.h"
|
|
||||||
|
|
||||||
class PeerData;
|
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
|
|
||||||
class PeerAvatarButton : public AbstractButton {
|
|
||||||
public:
|
|
||||||
PeerAvatarButton(QWidget *parent, PeerData *peer, const style::PeerAvatarButton &st);
|
|
||||||
|
|
||||||
void setPeer(PeerData *peer) {
|
|
||||||
_peer = peer;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void paintEvent(QPaintEvent *e) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
PeerData *_peer;
|
|
||||||
const style::PeerAvatarButton &_st;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
class NewAvatarButton : public RippleButton {
|
|
||||||
public:
|
|
||||||
NewAvatarButton(QWidget *parent, int size, QPoint position);
|
|
||||||
|
|
||||||
void setImage(const QImage &image);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void paintEvent(QPaintEvent *e) override;
|
|
||||||
|
|
||||||
QImage prepareRippleMask() const override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
QPixmap _image;
|
|
||||||
QPoint _position;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Ui
|
|
|
@ -18,8 +18,9 @@ to link the code of portions of this program with the OpenSSL library.
|
||||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||||
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#include "ui/buttons/history_down_button.h"
|
#include "ui/special_buttons.h"
|
||||||
|
|
||||||
|
#include "styles/style_boxes.h"
|
||||||
#include "styles/style_history.h"
|
#include "styles/style_history.h"
|
||||||
#include "dialogs/dialogs_layout.h"
|
#include "dialogs/dialogs_layout.h"
|
||||||
#include "ui/effects/ripple_animation.h"
|
#include "ui/effects/ripple_animation.h"
|
||||||
|
@ -288,4 +289,54 @@ void SendButton::recordAnimationCallback() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PeerAvatarButton::PeerAvatarButton(QWidget *parent, PeerData *peer, const style::PeerAvatarButton &st) : AbstractButton(parent)
|
||||||
|
, _peer(peer)
|
||||||
|
, _st(st) {
|
||||||
|
resize(_st.size, _st.size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PeerAvatarButton::paintEvent(QPaintEvent *e) {
|
||||||
|
if (_peer) {
|
||||||
|
Painter p(this);
|
||||||
|
_peer->paintUserpic(p, (_st.size - _st.photoSize) / 2, (_st.size - _st.photoSize) / 2, _st.photoSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NewAvatarButton::NewAvatarButton(QWidget *parent, int size, QPoint position) : RippleButton(parent, st::defaultActiveButton.ripple)
|
||||||
|
, _position(position) {
|
||||||
|
resize(size, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NewAvatarButton::paintEvent(QPaintEvent *e) {
|
||||||
|
Painter p(this);
|
||||||
|
|
||||||
|
if (!_image.isNull()) {
|
||||||
|
p.drawPixmap(0, 0, _image);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
p.setPen(Qt::NoPen);
|
||||||
|
p.setBrush(isOver() ? st::defaultActiveButton.textBgOver : st::defaultActiveButton.textBg);
|
||||||
|
{
|
||||||
|
PainterHighQualityEnabler hq(p);
|
||||||
|
p.drawEllipse(rect());
|
||||||
|
}
|
||||||
|
|
||||||
|
paintRipple(p, 0, 0, getms());
|
||||||
|
|
||||||
|
st::newGroupPhotoIcon.paint(p, _position, width());
|
||||||
|
}
|
||||||
|
|
||||||
|
void NewAvatarButton::setImage(const QImage &image) {
|
||||||
|
auto small = image.scaled(size() * cIntRetinaFactor(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||||
|
Images::prepareCircle(small);
|
||||||
|
_image = App::pixmapFromImageInPlace(std::move(small));
|
||||||
|
_image.setDevicePixelRatio(cRetinaFactor());
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
QImage NewAvatarButton::prepareRippleMask() const {
|
||||||
|
return Ui::RippleAnimation::ellipseMask(size());
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
|
@ -21,8 +21,11 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
|
#include "styles/style_window.h"
|
||||||
#include "styles/style_widgets.h"
|
#include "styles/style_widgets.h"
|
||||||
|
|
||||||
|
class PeerData;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
|
||||||
class HistoryDownButton : public RippleButton {
|
class HistoryDownButton : public RippleButton {
|
||||||
|
@ -136,4 +139,39 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class PeerAvatarButton : public AbstractButton {
|
||||||
|
public:
|
||||||
|
PeerAvatarButton(QWidget *parent, PeerData *peer, const style::PeerAvatarButton &st);
|
||||||
|
|
||||||
|
void setPeer(PeerData *peer) {
|
||||||
|
_peer = peer;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
PeerData *_peer;
|
||||||
|
const style::PeerAvatarButton &_st;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class NewAvatarButton : public RippleButton {
|
||||||
|
public:
|
||||||
|
NewAvatarButton(QWidget *parent, int size, QPoint position);
|
||||||
|
|
||||||
|
void setImage(const QImage &image);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
|
||||||
|
QImage prepareRippleMask() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QPixmap _image;
|
||||||
|
QPoint _position;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
|
@ -27,7 +27,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "shortcuts.h"
|
#include "shortcuts.h"
|
||||||
#include "lang.h"
|
#include "lang.h"
|
||||||
#include "ui/buttons/peer_avatar_button.h"
|
#include "ui/special_buttons.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/widgets/dropdown_menu.h"
|
#include "ui/widgets/dropdown_menu.h"
|
||||||
#include "dialogs/dialogs_layout.h"
|
#include "dialogs/dialogs_layout.h"
|
||||||
|
|
|
@ -433,10 +433,6 @@
|
||||||
'<(src_loc)/storage/serialize_common.h',
|
'<(src_loc)/storage/serialize_common.h',
|
||||||
'<(src_loc)/storage/serialize_document.cpp',
|
'<(src_loc)/storage/serialize_document.cpp',
|
||||||
'<(src_loc)/storage/serialize_document.h',
|
'<(src_loc)/storage/serialize_document.h',
|
||||||
'<(src_loc)/ui/buttons/history_down_button.cpp',
|
|
||||||
'<(src_loc)/ui/buttons/history_down_button.h',
|
|
||||||
'<(src_loc)/ui/buttons/peer_avatar_button.cpp',
|
|
||||||
'<(src_loc)/ui/buttons/peer_avatar_button.h',
|
|
||||||
'<(src_loc)/ui/effects/cross_animation.cpp',
|
'<(src_loc)/ui/effects/cross_animation.cpp',
|
||||||
'<(src_loc)/ui/effects/cross_animation.h',
|
'<(src_loc)/ui/effects/cross_animation.h',
|
||||||
'<(src_loc)/ui/effects/panel_animation.cpp',
|
'<(src_loc)/ui/effects/panel_animation.cpp',
|
||||||
|
@ -515,6 +511,8 @@
|
||||||
'<(src_loc)/ui/emoji_config.h',
|
'<(src_loc)/ui/emoji_config.h',
|
||||||
'<(src_loc)/ui/images.cpp',
|
'<(src_loc)/ui/images.cpp',
|
||||||
'<(src_loc)/ui/images.h',
|
'<(src_loc)/ui/images.h',
|
||||||
|
'<(src_loc)/ui/special_buttons.cpp',
|
||||||
|
'<(src_loc)/ui/special_buttons.h',
|
||||||
'<(src_loc)/ui/twidget.cpp',
|
'<(src_loc)/ui/twidget.cpp',
|
||||||
'<(src_loc)/ui/twidget.h',
|
'<(src_loc)/ui/twidget.h',
|
||||||
'<(src_loc)/window/main_window.cpp',
|
'<(src_loc)/window/main_window.cpp',
|
||||||
|
|
Loading…
Reference in New Issue