added text for empty categories in emote popup

This commit is contained in:
fourtf 2018-09-04 20:09:06 +02:00
parent 12670e51b7
commit 3f4e9cdf91
2 changed files with 23 additions and 7 deletions

View file

@ -29,11 +29,17 @@ namespace {
builder->flags.set(MessageFlag::Centered);
builder->flags.set(MessageFlag::DisableCompactEmotes);
for (const auto &emote : map) {
builder
.emplace<EmoteElement>(emote.second,
MessageElementFlag::AlwaysShow)
->setLink(Link(Link::InsertText, emote.first.string));
if (!map.empty()) {
for (const auto &emote : map) {
builder
.emplace<EmoteElement>(emote.second,
MessageElementFlag::AlwaysShow)
->setLink(Link(Link::InsertText, emote.first.string));
}
} else {
builder.emplace<TextElement>("no emotes available",
MessageElementFlag::Text,
MessageColor::System);
}
return builder.release();
@ -139,6 +145,16 @@ void EmotePopup::loadChannel(ChannelPtr _channel)
this->globalEmotesView_->setChannel(globalChannel);
this->subEmotesView_->setChannel(subChannel);
this->channelEmotesView_->setChannel(channelChannel);
if (subChannel->getMessageSnapshot().getLength() == 0) {
MessageBuilder builder;
builder->flags.set(MessageFlag::Centered);
builder->flags.set(MessageFlag::DisableCompactEmotes);
builder.emplace<TextElement>("no subscription emotes available",
MessageElementFlag::Text,
MessageColor::System);
subChannel->addMessage(builder.release());
}
}
void EmotePopup::loadEmojis()

View file

@ -173,9 +173,9 @@ void SplitHeader::initializeLayout()
std::unique_ptr<QMenu> SplitHeader::createMainMenu()
{
auto menu = std::make_unique<QMenu>();
menu->addAction("New split", this->split_, &Split::addSibling,
menu->addAction("Add new", this->split_, &Split::addSibling,
QKeySequence("Ctrl+T"));
menu->addAction("Close split", this->split_, &Split::deleteFromContainer,
menu->addAction("Close", this->split_, &Split::deleteFromContainer,
QKeySequence("Ctrl+W"));
menu->addAction("Change channel", this->split_, &Split::changeChannel,
QKeySequence("Ctrl+R"));