mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
feat: add chibi icons
meet AyuChan <3
This commit is contained in:
parent
4e0fde560c
commit
81938514f1
10 changed files with 47 additions and 20 deletions
BIN
Telegram/Resources/art/ayu/chibi/app.png
Normal file
BIN
Telegram/Resources/art/ayu/chibi/app.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4 KiB |
BIN
Telegram/Resources/art/ayu/chibi/app_icon.ico
Normal file
BIN
Telegram/Resources/art/ayu/chibi/app_icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 36 KiB |
BIN
Telegram/Resources/art/ayu/chibi/app_preview.png
Normal file
BIN
Telegram/Resources/art/ayu/chibi/app_preview.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
BIN
Telegram/Resources/art/ayu/chibi2/app.png
Normal file
BIN
Telegram/Resources/art/ayu/chibi2/app.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
BIN
Telegram/Resources/art/ayu/chibi2/app_icon.ico
Normal file
BIN
Telegram/Resources/art/ayu/chibi2/app_icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 56 KiB |
BIN
Telegram/Resources/art/ayu/chibi2/app_preview.png
Normal file
BIN
Telegram/Resources/art/ayu/chibi2/app_preview.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
|
@ -6,6 +6,12 @@
|
||||||
<file alias="art/ayu/bard/app.png">../../art/ayu/bard/app.png</file>
|
<file alias="art/ayu/bard/app.png">../../art/ayu/bard/app.png</file>
|
||||||
<file alias="art/ayu/bard/app_preview.png">../../art/ayu/bard/app_preview.png</file>
|
<file alias="art/ayu/bard/app_preview.png">../../art/ayu/bard/app_preview.png</file>
|
||||||
<file alias="art/ayu/bard/app_icon.ico">../../art/ayu/bard/app_icon.ico</file>
|
<file alias="art/ayu/bard/app_icon.ico">../../art/ayu/bard/app_icon.ico</file>
|
||||||
|
<file alias="art/ayu/chibi/app.png">../../art/ayu/chibi/app.png</file>
|
||||||
|
<file alias="art/ayu/chibi/app_preview.png">../../art/ayu/chibi/app_preview.png</file>
|
||||||
|
<file alias="art/ayu/chibi/app_icon.ico">../../art/ayu/chibi/app_icon.ico</file>
|
||||||
|
<file alias="art/ayu/chibi2/app.png">../../art/ayu/chibi2/app.png</file>
|
||||||
|
<file alias="art/ayu/chibi2/app_preview.png">../../art/ayu/chibi2/app_preview.png</file>
|
||||||
|
<file alias="art/ayu/chibi2/app_icon.ico">../../art/ayu/chibi2/app_icon.ico</file>
|
||||||
<file alias="art/ayu/default/app.png">../../art/ayu/default/app.png</file>
|
<file alias="art/ayu/default/app.png">../../art/ayu/default/app.png</file>
|
||||||
<file alias="art/ayu/default/app_preview.png">../../art/ayu/default/app_preview.png</file>
|
<file alias="art/ayu/default/app_preview.png">../../art/ayu/default/app_preview.png</file>
|
||||||
<file alias="art/ayu/default/app_icon.ico">../../art/ayu/default/app_icon.ico</file>
|
<file alias="art/ayu/default/app_icon.ico">../../art/ayu/default/app_icon.ico</file>
|
||||||
|
|
|
@ -18,6 +18,8 @@ ICON(EXTERA, "extera");
|
||||||
ICON(NOTHING, "nothing");
|
ICON(NOTHING, "nothing");
|
||||||
ICON(BARD, "bard");
|
ICON(BARD, "bard");
|
||||||
ICON(YAPLUS, "yaplus");
|
ICON(YAPLUS, "yaplus");
|
||||||
|
ICON(CHIBI, "chibi");
|
||||||
|
ICON(CHIBI2, "chibi2");
|
||||||
|
|
||||||
void loadAppIco();
|
void loadAppIco();
|
||||||
|
|
||||||
|
|
|
@ -12,12 +12,10 @@ using "ui/colors.palette";
|
||||||
using "ui/widgets/widgets.style";
|
using "ui/widgets/widgets.style";
|
||||||
using "info/info.style";
|
using "info/info.style";
|
||||||
|
|
||||||
iconPreviewStroke: activeButtonBg;
|
|
||||||
|
|
||||||
/* Color Picker */
|
/* Color Picker */
|
||||||
cpPadding: 14px;
|
cpPadding: 14px;
|
||||||
cpSelectedPadding: 2px;
|
cpSelectedPadding: 2px;
|
||||||
cpPenSize: 2px;
|
cpSelectedRounding: 12px;
|
||||||
cpImagePadding: 4px;
|
cpImagePadding: 4px;
|
||||||
cpSpacingX: 16px;
|
cpSpacingX: 16px;
|
||||||
cpSpacingY: 8px;
|
cpSpacingY: 8px;
|
||||||
|
|
|
@ -28,7 +28,9 @@ const QVector<QString> icons{
|
||||||
AyuAssets::EXTERA_ICON,
|
AyuAssets::EXTERA_ICON,
|
||||||
AyuAssets::NOTHING_ICON,
|
AyuAssets::NOTHING_ICON,
|
||||||
AyuAssets::BARD_ICON,
|
AyuAssets::BARD_ICON,
|
||||||
AyuAssets::YAPLUS_ICON
|
AyuAssets::YAPLUS_ICON,
|
||||||
|
AyuAssets::CHIBI_ICON,
|
||||||
|
AyuAssets::CHIBI2_ICON,
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto rows = static_cast<int>(icons.size()) / 4 + std::min(1, static_cast<int>(icons.size()) % 4);
|
const auto rows = static_cast<int>(icons.size()) / 4 + std::min(1, static_cast<int>(icons.size()) % 4);
|
||||||
|
@ -36,18 +38,26 @@ const auto rows = static_cast<int>(icons.size()) / 4 + std::min(1, static_cast<i
|
||||||
void drawIcon(QPainter &p, const QImage &icon, int xOffset, int yOffset, float strokeOpacity) {
|
void drawIcon(QPainter &p, const QImage &icon, int xOffset, int yOffset, float strokeOpacity) {
|
||||||
xOffset += st::cpPadding;
|
xOffset += st::cpPadding;
|
||||||
|
|
||||||
// stroke
|
|
||||||
p.save();
|
p.save();
|
||||||
p.setPen(QPen(st::iconPreviewStroke, st::cpPenSize));
|
p.setPen(QPen(st::boxDividerBg, 0));
|
||||||
|
p.setBrush(QBrush(st::boxDividerBg));
|
||||||
p.setOpacity(strokeOpacity);
|
p.setOpacity(strokeOpacity);
|
||||||
p.drawEllipse(xOffset + st::cpSelectedPadding,
|
p.drawRoundedRect(
|
||||||
yOffset + st::cpSelectedPadding,
|
xOffset + st::cpSelectedPadding,
|
||||||
st::cpIconSize + st::cpSelectedPadding * 2,
|
yOffset + st::cpSelectedPadding,
|
||||||
st::cpIconSize + st::cpSelectedPadding * 2);
|
st::cpIconSize + st::cpSelectedPadding * 2,
|
||||||
|
st::cpIconSize + st::cpSelectedPadding * 2,
|
||||||
|
st::cpSelectedRounding,
|
||||||
|
st::cpSelectedRounding
|
||||||
|
);
|
||||||
p.restore();
|
p.restore();
|
||||||
// /stroke
|
|
||||||
|
|
||||||
auto rect = QRect(xOffset + st::cpImagePadding, yOffset + st::cpImagePadding, st::cpIconSize, st::cpIconSize);
|
auto rect = QRect(
|
||||||
|
xOffset + st::cpImagePadding,
|
||||||
|
yOffset + st::cpImagePadding,
|
||||||
|
st::cpIconSize,
|
||||||
|
st::cpIconSize
|
||||||
|
);
|
||||||
p.drawImage(rect, icon);
|
p.drawImage(rect, icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +75,7 @@ void applyIcon() {
|
||||||
|
|
||||||
IconPicker::IconPicker(QWidget *parent)
|
IconPicker::IconPicker(QWidget *parent)
|
||||||
: RpWidget(parent) {
|
: RpWidget(parent) {
|
||||||
setMinimumSize(st::boxWidth, (st::cpIconSize + st::cpPadding) * rows);
|
setMinimumSize(st::boxWidth, (st::cpIconSize + st::cpPadding) * rows - st::cpPadding);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IconPicker::paintEvent(QPaintEvent *e) {
|
void IconPicker::paintEvent(QPaintEvent *e) {
|
||||||
|
@ -80,21 +90,27 @@ void IconPicker::paintEvent(QPaintEvent *e) {
|
||||||
auto const idx = i + row * 4;
|
auto const idx = i + row * 4;
|
||||||
|
|
||||||
const auto &iconName = icons[idx];
|
const auto &iconName = icons[idx];
|
||||||
|
if (iconName.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
auto icon = AyuAssets::loadPreview(iconName)
|
auto icon = AyuAssets::loadPreview(iconName)
|
||||||
.scaled(st::cpIconSize, st::cpIconSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
.scaled(st::cpIconSize, st::cpIconSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
|
|
||||||
auto opacity = 0.0f;
|
auto opacity = 0.0f;
|
||||||
if (iconName == wasSelected) {
|
if (iconName == wasSelected) {
|
||||||
opacity = 1.0f - animation.value(1.0f);
|
opacity = 1.0f - animation.value(1.0f);
|
||||||
} else if (iconName == AyuAssets::currentAppLogoName()) {
|
} else if (iconName == AyuAssets::currentAppLogoName()) {
|
||||||
opacity = wasSelected.isEmpty() ? 1.0f : animation.value(1.0f);
|
opacity = wasSelected.isEmpty() ? 1.0f : animation.value(1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
drawIcon(p,
|
drawIcon(
|
||||||
icon,
|
p,
|
||||||
(st::cpIconSize + st::cpSpacingX) * i + offset,
|
icon,
|
||||||
row * (st::cpIconSize + st::cpSpacingY),
|
(st::cpIconSize + st::cpSpacingX) * i + offset,
|
||||||
opacity);
|
row * (st::cpIconSize + st::cpSpacingY),
|
||||||
|
opacity
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,6 +130,10 @@ void IconPicker::mousePressEvent(QMouseEvent *e) {
|
||||||
if (x >= xOffset && x <= xOffset + st::cpIconSize && e->pos().y() >= yOffset
|
if (x >= xOffset && x <= xOffset + st::cpIconSize && e->pos().y() >= yOffset
|
||||||
&& e->pos().y() <= yOffset + st::cpIconSize) {
|
&& e->pos().y() <= yOffset + st::cpIconSize) {
|
||||||
const auto &iconName = icons[idx];
|
const auto &iconName = icons[idx];
|
||||||
|
if (iconName.isEmpty()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (settings->appIcon != iconName) {
|
if (settings->appIcon != iconName) {
|
||||||
wasSelected = settings->appIcon;
|
wasSelected = settings->appIcon;
|
||||||
animation.start(
|
animation.start(
|
||||||
|
@ -124,7 +144,8 @@ void IconPicker::mousePressEvent(QMouseEvent *e) {
|
||||||
0.0,
|
0.0,
|
||||||
1.0,
|
1.0,
|
||||||
200,
|
200,
|
||||||
anim::easeOutCubic);
|
anim::easeOutCubic
|
||||||
|
);
|
||||||
|
|
||||||
settings->set_appIcon(iconName);
|
settings->set_appIcon(iconName);
|
||||||
changed = true;
|
changed = true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue