mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-25 04:38:23 +00:00
sticker set menu named Add Stickers, improved stickers panel
This commit is contained in:
parent
ea4186eb0c
commit
dfd5cb4f4e
@ -508,6 +508,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
"lng_context_open_audio" = "Open Audio";
|
||||
"lng_context_save_audio" = "Save Audio As..";
|
||||
"lng_context_pack_info" = "Pack Info";
|
||||
"lng_context_pack_add" = "Add Stickers";
|
||||
"lng_context_open_file" = "Open File";
|
||||
"lng_context_save_file" = "Save File As..";
|
||||
"lng_context_forward_file" = "Forward File";
|
||||
|
@ -1573,67 +1573,67 @@ rbEmoji: flatCheckbox {
|
||||
imagePos: point(8px, 12px);
|
||||
}
|
||||
rbEmojiRecent: flatCheckbox(rbEmoji) {
|
||||
imageRect: emojiRecent;
|
||||
imageRect: emojiRecentOver;
|
||||
chkImageRect: emojiRecentActive;
|
||||
overImageRect: emojiRecentOver;
|
||||
chkOverImageRect: emojiRecentActive;
|
||||
disImageRect: emojiRecent;
|
||||
disImageRect: emojiRecentOver;
|
||||
chkDisImageRect: emojiRecentActive;
|
||||
}
|
||||
rbEmojiPeople: flatCheckbox(rbEmoji) {
|
||||
imageRect: emojiPeople;
|
||||
imageRect: emojiPeopleOver;
|
||||
chkImageRect: emojiPeopleActive;
|
||||
overImageRect: emojiPeopleOver;
|
||||
chkOverImageRect: emojiPeopleActive;
|
||||
disImageRect: emojiPeople;
|
||||
disImageRect: emojiPeopleOver;
|
||||
chkDisImageRect: emojiPeopleActive;
|
||||
}
|
||||
rbEmojiNature: flatCheckbox(rbEmoji) {
|
||||
imageRect: emojiNature;
|
||||
imageRect: emojiNatureOver;
|
||||
chkImageRect: emojiNatureActive;
|
||||
overImageRect: emojiNatureOver;
|
||||
chkOverImageRect: emojiNatureActive;
|
||||
disImageRect: emojiNature;
|
||||
disImageRect: emojiNatureOver;
|
||||
chkDisImageRect: emojiNatureActive;
|
||||
}
|
||||
rbEmojiFood: flatCheckbox(rbEmoji) {
|
||||
imageRect: emojiFood;
|
||||
imageRect: emojiFoodOver;
|
||||
chkImageRect: emojiFoodActive;
|
||||
overImageRect: emojiFoodOver;
|
||||
chkOverImageRect: emojiFoodActive;
|
||||
disImageRect: emojiFood;
|
||||
disImageRect: emojiFoodOver;
|
||||
chkDisImageRect: emojiFoodActive;
|
||||
}
|
||||
rbEmojiCelebration: flatCheckbox(rbEmoji) {
|
||||
imageRect: emojiCelebration;
|
||||
imageRect: emojiCelebrationOver;
|
||||
chkImageRect: emojiCelebrationActive;
|
||||
overImageRect: emojiCelebrationOver;
|
||||
chkOverImageRect: emojiCelebrationActive;
|
||||
disImageRect: emojiCelebration;
|
||||
disImageRect: emojiCelebrationOver;
|
||||
chkDisImageRect: emojiCelebrationActive;
|
||||
}
|
||||
rbEmojiActivity: flatCheckbox(rbEmoji) {
|
||||
imageRect: emojiActivity;
|
||||
imageRect: emojiActivityOver;
|
||||
chkImageRect: emojiActivityActive;
|
||||
overImageRect: emojiActivityOver;
|
||||
chkOverImageRect: emojiActivityActive;
|
||||
disImageRect: emojiActivity;
|
||||
disImageRect: emojiActivityOver;
|
||||
chkDisImageRect: emojiActivityActive;
|
||||
}
|
||||
rbEmojiTravel: flatCheckbox(rbEmoji) {
|
||||
imageRect: emojiTravel;
|
||||
imageRect: emojiTravelOver;
|
||||
chkImageRect: emojiTravelActive;
|
||||
overImageRect: emojiTravelOver;
|
||||
chkOverImageRect: emojiTravelActive;
|
||||
disImageRect: emojiTravel;
|
||||
disImageRect: emojiTravelOver;
|
||||
chkDisImageRect: emojiTravelActive;
|
||||
}
|
||||
rbEmojiObjects: flatCheckbox(rbEmoji) {
|
||||
imageRect: emojiObjects;
|
||||
imageRect: emojiObjectsOver;
|
||||
chkImageRect: emojiObjectsActive;
|
||||
overImageRect: emojiObjectsOver;
|
||||
chkOverImageRect: emojiObjectsActive;
|
||||
disImageRect: emojiObjects;
|
||||
disImageRect: emojiObjectsOver;
|
||||
chkDisImageRect: emojiObjectsActive;
|
||||
}
|
||||
emojiPanPadding: 10px;
|
||||
|
@ -325,7 +325,7 @@ enum {
|
||||
};
|
||||
|
||||
inline const QRegularExpression &cWordSplit() {
|
||||
static QRegularExpression regexp(qsl("[\\s\\-\\+\\)\\(\\,\\.\\:\\!\\_\\;\\\"\\'\\x0]"));
|
||||
static QRegularExpression regexp(qsl("[\\@\\s\\-\\+\\)\\(\\,\\.\\:\\!\\_\\;\\\"\\'\\x0]"));
|
||||
return regexp;
|
||||
}
|
||||
|
||||
|
@ -1794,11 +1794,11 @@ void EmojiPan::paintEvent(QPaintEvent *e) {
|
||||
const StickerIcon &s(_icons.at(i));
|
||||
s.sticker->thumb->load();
|
||||
QPixmap pix(s.sticker->thumb->pix(s.pixw, s.pixh));
|
||||
if (_iconSel == i) {
|
||||
p.setOpacity(1);
|
||||
} else {
|
||||
p.setOpacity(1. * _iconHovers.at(i) + st::stickerIconOpacity * (1 - _iconHovers.at(i)));
|
||||
}
|
||||
//if (_iconSel == i) {
|
||||
// p.setOpacity(1);
|
||||
//} else {
|
||||
// p.setOpacity(1. * _iconHovers.at(i) + st::stickerIconOpacity * (1 - _iconHovers.at(i)));
|
||||
//}
|
||||
p.drawPixmapLeft(x + (st::rbEmoji.width - s.pixw) / 2, _iconsTop + (st::rbEmoji.height - s.pixh) / 2, width(), pix);
|
||||
x += st::rbEmoji.width;
|
||||
p.setOpacity(1);
|
||||
@ -1939,6 +1939,7 @@ void EmojiPan::mouseReleaseEvent(QMouseEvent *e) {
|
||||
updateSelected();
|
||||
|
||||
if (wasDown == _iconOver && _iconOver >= 0) {
|
||||
_iconSelX = anim::ivalue(_iconOver * st::rbEmoji.width, _iconOver * st::rbEmoji.width);
|
||||
s_inner.showStickerSet(_icons.at(_iconOver).setId);
|
||||
}
|
||||
}
|
||||
|
@ -726,7 +726,7 @@ void HistoryList::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||
DocumentData *doc = sticker->document();
|
||||
if (doc && doc->sticker && doc->sticker->set.type() != mtpc_inputStickerSetEmpty) {
|
||||
if (!_menu) _menu = new ContextMenu(this);
|
||||
_menu->addAction(lang(lng_context_pack_info), historyWidget, SLOT(onStickerPackInfo()));
|
||||
_menu->addAction(lang(doc->sticker->setInstalled() ? lng_context_pack_info : lng_context_pack_add), historyWidget, SLOT(onStickerPackInfo()));
|
||||
}
|
||||
}
|
||||
QString contextMenuText = item->selectedText(FullItemSel);
|
||||
|
@ -502,6 +502,21 @@ void AudioCancelLink::onClick(Qt::MouseButton button) const {
|
||||
data->cancel();
|
||||
}
|
||||
|
||||
bool StickerData::setInstalled() const {
|
||||
switch (set.type()) {
|
||||
case mtpc_inputStickerSetID: {
|
||||
return (cStickerSets().constFind(set.c_inputStickerSetID().vid.v) != cStickerSets().cend());
|
||||
} break;
|
||||
case mtpc_inputStickerSetShortName: {
|
||||
QString name = qs(set.c_inputStickerSetShortName().vshort_name).toLower();
|
||||
for (StickerSets::const_iterator i = cStickerSets().cbegin(), e = cStickerSets().cend(); i != e; ++i) {
|
||||
if (i->shortName.toLower() == name) return true;
|
||||
}
|
||||
} break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
AudioData::AudioData(const AudioId &id, const uint64 &access, int32 user, int32 date, const QString &mime, int32 duration, int32 dc, int32 size) :
|
||||
id(id), access(access), user(user), date(date), mime(mime), duration(duration), dc(dc), size(size), status(FileReady), uploadOffset(0), openOnSave(0), openOnSaveMsgId(0), loader(0) {
|
||||
location = Local::readFileLocation(mediaKey(AudioFileLocation, dc, id));
|
||||
|
@ -440,6 +440,8 @@ struct StickerData {
|
||||
QString alt;
|
||||
|
||||
MTPInputStickerSet set;
|
||||
bool setInstalled() const;
|
||||
|
||||
StorageImageLocation loc; // doc thumb location
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user