feat: show live indicator in usercard (#6383)
This commit is contained in:
@@ -32,6 +32,8 @@
|
||||
#include "widgets/helper/ChannelView.hpp"
|
||||
#include "widgets/helper/InvisibleSizeGrip.hpp"
|
||||
#include "widgets/helper/Line.hpp"
|
||||
#include "widgets/helper/LiveIndicator.hpp"
|
||||
#include "widgets/helper/ScalingSpacerItem.hpp"
|
||||
#include "widgets/Label.hpp"
|
||||
#include "widgets/Notebook.hpp"
|
||||
#include "widgets/Scrollbar.hpp"
|
||||
@@ -355,6 +357,13 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, Split *split)
|
||||
|
||||
this->ui_.nameLabel = addCopyableLabel(box, "Copy name");
|
||||
this->ui_.nameLabel->setFontStyle(FontStyle::UiMediumBold);
|
||||
this->ui_.nameLabel->setPadding(QMargins(8, 0, 1, 0));
|
||||
this->ui_.liveIndicator = new LiveIndicator;
|
||||
this->ui_.liveIndicator->hide();
|
||||
// addCopyableLabel adds the copy button last -> add the indicator before that
|
||||
box->insertWidget(box->count() - 1, this->ui_.liveIndicator);
|
||||
box->insertItem(box->count() - 1,
|
||||
ScalingSpacerItem::horizontal(7));
|
||||
box->addSpacing(5);
|
||||
box->addStretch(1);
|
||||
|
||||
@@ -973,6 +982,29 @@ void UserInfoPopup::updateUserData()
|
||||
qCWarning(chatterinoTwitch)
|
||||
<< "Error getting followers:" << errorMessage;
|
||||
});
|
||||
getHelix()->getStreamById(
|
||||
user.id,
|
||||
[this, hack](bool isLive, const auto &stream) {
|
||||
if (!hack.lock())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (isLive)
|
||||
{
|
||||
this->ui_.liveIndicator->setViewers(stream.viewerCount);
|
||||
this->ui_.liveIndicator->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->ui_.liveIndicator->hide();
|
||||
}
|
||||
},
|
||||
[id{user.id}]() {
|
||||
qCWarning(chatterinoWidget)
|
||||
<< "Failed to get stream for user ID" << id;
|
||||
},
|
||||
[]() {});
|
||||
|
||||
// get ignore state
|
||||
bool isIgnoring = currentUser->blockedUserIds().contains(user.id);
|
||||
@@ -1169,7 +1201,7 @@ UserInfoPopup::TimeoutWidget::TimeoutWidget()
|
||||
title->addStretch(1);
|
||||
auto label = title.emplace<Label>(text);
|
||||
label->setStyleSheet("color: #BBB");
|
||||
label->setHasPadding(false);
|
||||
label->setPadding(QMargins{});
|
||||
title->addStretch(1);
|
||||
|
||||
auto hbox = vbox.emplace<QHBoxLayout>().withoutMargin();
|
||||
|
||||
Reference in New Issue
Block a user