mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Add top window controls shadow.
This commit is contained in:
parent
fbe02dbb8d
commit
1b60829da8
6 changed files with 44 additions and 17 deletions
BIN
Telegram/Resources/icons/calls_shadow_controls.png
Normal file
BIN
Telegram/Resources/icons/calls_shadow_controls.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
BIN
Telegram/Resources/icons/calls_shadow_controls@2x.png
Normal file
BIN
Telegram/Resources/icons/calls_shadow_controls@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6 KiB |
BIN
Telegram/Resources/icons/calls_shadow_controls@3x.png
Normal file
BIN
Telegram/Resources/icons/calls_shadow_controls@3x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.3 KiB |
|
@ -370,3 +370,4 @@ callTitle: WindowTitle(defaultWindowTitle) {
|
||||||
closeIconActive: callTitleCloseIcon;
|
closeIconActive: callTitleCloseIcon;
|
||||||
closeIconActiveOver: callTitleCloseIconOver;
|
closeIconActiveOver: callTitleCloseIconOver;
|
||||||
}
|
}
|
||||||
|
callTitleShadow: icon {{ "calls_shadow_controls", windowShadowFg }};
|
||||||
|
|
|
@ -626,6 +626,45 @@ void Panel::initBottomShadow() {
|
||||||
_bottomShadow = Images::PixmapFast(std::move(image));
|
_bottomShadow = Images::PixmapFast(std::move(image));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Panel::fillTopShadow(QPainter &p, QRect incoming) {
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
const auto width = widget()->width();
|
||||||
|
const auto position = QPoint(width - st::callTitleShadow.width(), 0);
|
||||||
|
const auto shadowArea = QRect(
|
||||||
|
position,
|
||||||
|
st::callTitleShadow.size());
|
||||||
|
const auto fill = shadowArea.intersected(incoming);
|
||||||
|
if (fill.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
p.save();
|
||||||
|
p.setClipRect(fill);
|
||||||
|
st::callTitleShadow.paint(p, position, width);
|
||||||
|
p.restore();
|
||||||
|
#endif // Q_OS_WIN
|
||||||
|
}
|
||||||
|
|
||||||
|
void Panel::fillBottomShadow(QPainter &p, QRect incoming) {
|
||||||
|
const auto shadowArea = QRect(
|
||||||
|
0,
|
||||||
|
widget()->height() - st::callBottomShadowSize,
|
||||||
|
widget()->width(),
|
||||||
|
st::callBottomShadowSize);
|
||||||
|
const auto fill = shadowArea.intersected(incoming);
|
||||||
|
if (fill.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const auto factor = cIntRetinaFactor();
|
||||||
|
p.drawPixmap(
|
||||||
|
fill,
|
||||||
|
_bottomShadow,
|
||||||
|
QRect(
|
||||||
|
0,
|
||||||
|
factor * (fill.y() - shadowArea.y()),
|
||||||
|
factor,
|
||||||
|
factor * fill.height()));
|
||||||
|
}
|
||||||
|
|
||||||
void Panel::showControls() {
|
void Panel::showControls() {
|
||||||
Expects(_call != nullptr);
|
Expects(_call != nullptr);
|
||||||
|
|
||||||
|
@ -844,23 +883,8 @@ void Panel::paint(QRect clip) {
|
||||||
auto hq = PainterHighQualityEnabler(p);
|
auto hq = PainterHighQualityEnabler(p);
|
||||||
p.drawImage(incoming, frame);
|
p.drawImage(incoming, frame);
|
||||||
}
|
}
|
||||||
const auto shadowArea = QRect(
|
fillBottomShadow(p, incoming);
|
||||||
0,
|
fillTopShadow(p, incoming);
|
||||||
widget()->height() - st::callBottomShadowSize,
|
|
||||||
widget()->width(),
|
|
||||||
st::callBottomShadowSize);
|
|
||||||
const auto fill = shadowArea.intersected(incoming);
|
|
||||||
if (!fill.isEmpty()) {
|
|
||||||
const auto factor = cIntRetinaFactor();
|
|
||||||
p.drawPixmap(
|
|
||||||
fill,
|
|
||||||
_bottomShadow,
|
|
||||||
QRect(
|
|
||||||
0,
|
|
||||||
factor * (fill.y() - shadowArea.y()),
|
|
||||||
factor,
|
|
||||||
factor * fill.height()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_call->videoIncoming()->markFrameShown();
|
_call->videoIncoming()->markFrameShown();
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,8 @@ private:
|
||||||
void startDurationUpdateTimer(crl::time currentDuration);
|
void startDurationUpdateTimer(crl::time currentDuration);
|
||||||
void fillFingerprint();
|
void fillFingerprint();
|
||||||
void setIncomingSize(QSize size);
|
void setIncomingSize(QSize size);
|
||||||
|
void fillTopShadow(QPainter &p, QRect incoming);
|
||||||
|
void fillBottomShadow(QPainter &p, QRect incoming);
|
||||||
|
|
||||||
void refreshOutgoingPreviewInBody(State state);
|
void refreshOutgoingPreviewInBody(State state);
|
||||||
void toggleFullScreen(bool fullscreen);
|
void toggleFullScreen(bool fullscreen);
|
||||||
|
|
Loading…
Add table
Reference in a new issue