mirror of https://github.com/procxx/kepka.git
Fixed title of recently used emoji in touchbar.
- Added "No found" title if sticker list is empty.
This commit is contained in:
parent
07a063e19e
commit
c7526ae1cd
|
@ -18,22 +18,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "styles/style_chat_helpers.h"
|
#include "styles/style_chat_helpers.h"
|
||||||
|
|
||||||
namespace ChatHelpers {
|
namespace ChatHelpers {
|
||||||
namespace {
|
|
||||||
|
|
||||||
tr::phrase<> CategoryTitle(int index) {
|
|
||||||
switch (index) {
|
|
||||||
case 1: return tr::lng_emoji_category1;
|
|
||||||
case 2: return tr::lng_emoji_category2;
|
|
||||||
case 3: return tr::lng_emoji_category3;
|
|
||||||
case 4: return tr::lng_emoji_category4;
|
|
||||||
case 5: return tr::lng_emoji_category5;
|
|
||||||
case 6: return tr::lng_emoji_category6;
|
|
||||||
case 7: return tr::lng_emoji_category7;
|
|
||||||
}
|
|
||||||
Unexpected("Index in CategoryTitle.");
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
class EmojiColorPicker : public Ui::RpWidget {
|
class EmojiColorPicker : public Ui::RpWidget {
|
||||||
public:
|
public:
|
||||||
|
@ -545,7 +529,7 @@ void EmojiListWidget::paintEvent(QPaintEvent *e) {
|
||||||
if (info.section > 0 && r.top() < info.rowsTop) {
|
if (info.section > 0 && r.top() < info.rowsTop) {
|
||||||
p.setFont(st::emojiPanHeaderFont);
|
p.setFont(st::emojiPanHeaderFont);
|
||||||
p.setPen(st::emojiPanHeaderFg);
|
p.setPen(st::emojiPanHeaderFg);
|
||||||
p.drawTextLeft(st::emojiPanHeaderLeft - st::buttonRadius, info.top + st::emojiPanHeaderTop, width(), CategoryTitle(info.section)(tr::now));
|
p.drawTextLeft(st::emojiPanHeaderLeft - st::buttonRadius, info.top + st::emojiPanHeaderTop, width(), Ui::Emoji::CategoryTitle(info.section)(tr::now));
|
||||||
}
|
}
|
||||||
if (r.top() + r.height() > info.rowsTop) {
|
if (r.top() + r.height() > info.rowsTop) {
|
||||||
ensureLoaded(info.section);
|
ensureLoaded(info.section);
|
||||||
|
|
|
@ -172,6 +172,15 @@ inline int UnreadCount(not_null<PeerData*> peer) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString TitleRecentlyUsed() {
|
||||||
|
const auto &sets = Auth().data().stickerSets();
|
||||||
|
const auto it = sets.constFind(Stickers::CloudRecentSetId);
|
||||||
|
if (it != sets.cend()) {
|
||||||
|
return it->title;
|
||||||
|
}
|
||||||
|
return tr::lng_recent_stickers(tr::now);
|
||||||
|
}
|
||||||
|
|
||||||
NSString *FormatTime(int time) {
|
NSString *FormatTime(int time) {
|
||||||
const auto seconds = time % 60;
|
const auto seconds = time % 60;
|
||||||
const auto minutes = (time / 60) % 60;
|
const auto minutes = (time / 60) % 60;
|
||||||
|
@ -324,16 +333,12 @@ void AppendFavedStickers(std::vector<PickerScrubberItem> &to) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppendEmojiPacks(std::vector<PickerScrubberItem> &to) {
|
void AppendEmojiPacks(std::vector<PickerScrubberItem> &to) {
|
||||||
// Get 'Recent' string.
|
|
||||||
const auto recent = Auth().data().stickerSets()
|
|
||||||
.constFind(Stickers::CloudRecentSetId)->title;
|
|
||||||
|
|
||||||
for (auto i = 0; i != ChatHelpers::kEmojiSectionCount; ++i) {
|
for (auto i = 0; i != ChatHelpers::kEmojiSectionCount; ++i) {
|
||||||
const auto section = Ui::Emoji::GetSection(
|
const auto section = Ui::Emoji::GetSection(
|
||||||
static_cast<Ui::Emoji::Section>(i));
|
static_cast<Ui::Emoji::Section>(i));
|
||||||
const auto title = i
|
const auto title = i
|
||||||
? lang(LangKey(lng_emoji_category1 + i))
|
? Ui::Emoji::CategoryTitle(i)(tr::now)
|
||||||
: recent;
|
: TitleRecentlyUsed();
|
||||||
to.emplace_back(title);
|
to.emplace_back(title);
|
||||||
for (const auto &emoji : section) {
|
for (const auto &emoji : section) {
|
||||||
to.emplace_back(PickerScrubberItem(emoji));
|
to.emplace_back(PickerScrubberItem(emoji));
|
||||||
|
@ -712,6 +717,10 @@ void AppendEmojiPacks(std::vector<PickerScrubberItem> &to) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!temp.size()) {
|
||||||
|
temp.emplace_back(PickerScrubberItem(
|
||||||
|
tr::lng_stickers_nothing_found(tr::now)));
|
||||||
|
}
|
||||||
_stickers = std::move(temp);
|
_stickers = std::move(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -576,6 +576,19 @@ void ClearIrrelevantCache() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tr::phrase<> CategoryTitle(int index) {
|
||||||
|
switch (index) {
|
||||||
|
case 1: return tr::lng_emoji_category1;
|
||||||
|
case 2: return tr::lng_emoji_category2;
|
||||||
|
case 3: return tr::lng_emoji_category3;
|
||||||
|
case 4: return tr::lng_emoji_category4;
|
||||||
|
case 5: return tr::lng_emoji_category5;
|
||||||
|
case 6: return tr::lng_emoji_category6;
|
||||||
|
case 7: return tr::lng_emoji_category7;
|
||||||
|
}
|
||||||
|
Unexpected("Index in CategoryTitle.");
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<Set> Sets() {
|
std::vector<Set> Sets() {
|
||||||
return kSets | ranges::to_vector;
|
return kSets | ranges::to_vector;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include "base/binary_guard.h"
|
#include "base/binary_guard.h"
|
||||||
#include "emoji.h"
|
#include "emoji.h"
|
||||||
|
#include "lang/lang_keys.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
namespace Emoji {
|
namespace Emoji {
|
||||||
|
@ -37,6 +38,8 @@ struct Set {
|
||||||
// Thread safe, callback is called on main thread.
|
// Thread safe, callback is called on main thread.
|
||||||
void SwitchToSet(int id, Fn<void(bool)> callback);
|
void SwitchToSet(int id, Fn<void(bool)> callback);
|
||||||
|
|
||||||
|
tr::phrase<> CategoryTitle(int index);
|
||||||
|
|
||||||
std::vector<Set> Sets();
|
std::vector<Set> Sets();
|
||||||
int CurrentSetId();
|
int CurrentSetId();
|
||||||
bool SetIsReady(int id);
|
bool SetIsReady(int id);
|
||||||
|
|
Loading…
Reference in New Issue