mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Chore: Proper Lambda Formatting (#2167)
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
parent
fbd5df53d8
commit
0eed45ae67
71 changed files with 712 additions and 415 deletions
|
@ -4,6 +4,7 @@ AccessModifierOffset: -4
|
||||||
AlignEscapedNewlinesLeft: true
|
AlignEscapedNewlinesLeft: true
|
||||||
AllowShortFunctionsOnASingleLine: false
|
AllowShortFunctionsOnASingleLine: false
|
||||||
AllowShortIfStatementsOnASingleLine: false
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLambdasOnASingleLine: Empty
|
||||||
AllowShortLoopsOnASingleLine: false
|
AllowShortLoopsOnASingleLine: false
|
||||||
AlwaysBreakAfterDefinitionReturnType: false
|
AlwaysBreakAfterDefinitionReturnType: false
|
||||||
AlwaysBreakBeforeMultilineStrings: false
|
AlwaysBreakBeforeMultilineStrings: false
|
||||||
|
|
|
@ -61,8 +61,9 @@ Application::Application(Settings &_settings, Paths &_paths)
|
||||||
{
|
{
|
||||||
this->instance = this;
|
this->instance = this;
|
||||||
|
|
||||||
this->fonts->fontChanged.connect(
|
this->fonts->fontChanged.connect([this]() {
|
||||||
[this]() { this->windows->layoutChannelViews(); });
|
this->windows->layoutChannelViews();
|
||||||
|
});
|
||||||
|
|
||||||
this->twitch.server = this->twitch2;
|
this->twitch.server = this->twitch2;
|
||||||
this->twitch.pubsub = this->twitch2->pubsub;
|
this->twitch.pubsub = this->twitch2->pubsub;
|
||||||
|
@ -137,14 +138,20 @@ int Application::run(QApplication &qtApp)
|
||||||
this->windows->getMainWindow().show();
|
this->windows->getMainWindow().show();
|
||||||
|
|
||||||
getSettings()->betaUpdates.connect(
|
getSettings()->betaUpdates.connect(
|
||||||
[] { Updates::instance().checkForUpdates(); }, false);
|
[] {
|
||||||
getSettings()->moderationActions.delayedItemsChanged.connect(
|
Updates::instance().checkForUpdates();
|
||||||
[this] { this->windows->forceLayoutChannelViews(); });
|
},
|
||||||
|
false);
|
||||||
|
getSettings()->moderationActions.delayedItemsChanged.connect([this] {
|
||||||
|
this->windows->forceLayoutChannelViews();
|
||||||
|
});
|
||||||
|
|
||||||
getSettings()->highlightedMessages.delayedItemsChanged.connect(
|
getSettings()->highlightedMessages.delayedItemsChanged.connect([this] {
|
||||||
[this] { this->windows->forceLayoutChannelViews(); });
|
this->windows->forceLayoutChannelViews();
|
||||||
getSettings()->highlightedUsers.delayedItemsChanged.connect(
|
});
|
||||||
[this] { this->windows->forceLayoutChannelViews(); });
|
getSettings()->highlightedUsers.delayedItemsChanged.connect([this] {
|
||||||
|
this->windows->forceLayoutChannelViews();
|
||||||
|
});
|
||||||
|
|
||||||
return qtApp.exec();
|
return qtApp.exec();
|
||||||
}
|
}
|
||||||
|
@ -184,7 +191,9 @@ void Application::initPubsub()
|
||||||
QString("%1 cleared the chat").arg(action.source.name);
|
QString("%1 cleared the chat").arg(action.source.name);
|
||||||
|
|
||||||
auto msg = makeSystemMessage(text);
|
auto msg = makeSystemMessage(text);
|
||||||
postToThread([chan, msg] { chan->addMessage(msg); });
|
postToThread([chan, msg] {
|
||||||
|
chan->addMessage(msg);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this->twitch.pubsub->signals_.moderation.modeChanged.connect(
|
this->twitch.pubsub->signals_.moderation.modeChanged.connect(
|
||||||
|
@ -197,7 +206,7 @@ void Application::initPubsub()
|
||||||
}
|
}
|
||||||
|
|
||||||
QString text =
|
QString text =
|
||||||
QString("%1 turned %2 %3 mode") //
|
QString("%1 turned %2 %3 mode")
|
||||||
.arg(action.source.name)
|
.arg(action.source.name)
|
||||||
.arg(action.state == ModeChangedAction::State::On ? "on"
|
.arg(action.state == ModeChangedAction::State::On ? "on"
|
||||||
: "off")
|
: "off")
|
||||||
|
@ -210,7 +219,9 @@ void Application::initPubsub()
|
||||||
}
|
}
|
||||||
|
|
||||||
auto msg = makeSystemMessage(text);
|
auto msg = makeSystemMessage(text);
|
||||||
postToThread([chan, msg] { chan->addMessage(msg); });
|
postToThread([chan, msg] {
|
||||||
|
chan->addMessage(msg);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this->twitch.pubsub->signals_.moderation.moderationStateChanged.connect(
|
this->twitch.pubsub->signals_.moderation.moderationStateChanged.connect(
|
||||||
|
@ -236,7 +247,9 @@ void Application::initPubsub()
|
||||||
}
|
}
|
||||||
|
|
||||||
auto msg = makeSystemMessage(text);
|
auto msg = makeSystemMessage(text);
|
||||||
postToThread([chan, msg] { chan->addMessage(msg); });
|
postToThread([chan, msg] {
|
||||||
|
chan->addMessage(msg);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this->twitch.pubsub->signals_.moderation.userBanned.connect(
|
this->twitch.pubsub->signals_.moderation.userBanned.connect(
|
||||||
|
@ -269,7 +282,9 @@ void Application::initPubsub()
|
||||||
|
|
||||||
auto msg = MessageBuilder(action).release();
|
auto msg = MessageBuilder(action).release();
|
||||||
|
|
||||||
postToThread([chan, msg] { chan->addMessage(msg); });
|
postToThread([chan, msg] {
|
||||||
|
chan->addMessage(msg);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this->twitch.pubsub->signals_.moderation.automodMessage.connect(
|
this->twitch.pubsub->signals_.moderation.automodMessage.connect(
|
||||||
|
@ -301,7 +316,9 @@ void Application::initPubsub()
|
||||||
|
|
||||||
auto msg = MessageBuilder(action).release();
|
auto msg = MessageBuilder(action).release();
|
||||||
|
|
||||||
postToThread([chan, msg] { chan->addMessage(msg); });
|
postToThread([chan, msg] {
|
||||||
|
chan->addMessage(msg);
|
||||||
|
});
|
||||||
chan->deleteMessage(msg->id);
|
chan->deleteMessage(msg->id);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -334,7 +351,7 @@ void Application::initPubsub()
|
||||||
// moderation topics this->twitch.pubsub->UnlistenAllAuthedTopics();
|
// moderation topics this->twitch.pubsub->UnlistenAllAuthedTopics();
|
||||||
|
|
||||||
this->twitch.server->pubsub->listenToWhispers(
|
this->twitch.server->pubsub->listenToWhispers(
|
||||||
this->accounts->twitch.getCurrent()); //
|
this->accounts->twitch.getCurrent());
|
||||||
};
|
};
|
||||||
|
|
||||||
this->accounts->twitch.currentUserChanged.connect(RequestModerationActions);
|
this->accounts->twitch.currentUserChanged.connect(RequestModerationActions);
|
||||||
|
|
|
@ -164,8 +164,9 @@ void runGui(QApplication &a, Paths &paths, Settings &settings)
|
||||||
initResources();
|
initResources();
|
||||||
initSignalHandler();
|
initSignalHandler();
|
||||||
|
|
||||||
settings.restartOnCrash.connect(
|
settings.restartOnCrash.connect([](const bool &value) {
|
||||||
[](const bool &value) { restartOnSignal = value; });
|
restartOnSignal = value;
|
||||||
|
});
|
||||||
|
|
||||||
auto thread = std::thread([dir = paths.miscDirectory] {
|
auto thread = std::thread([dir = paths.miscDirectory] {
|
||||||
{
|
{
|
||||||
|
@ -186,7 +187,9 @@ void runGui(QApplication &a, Paths &paths, Settings &settings)
|
||||||
|
|
||||||
// Clear the cache 1 minute after start.
|
// Clear the cache 1 minute after start.
|
||||||
QTimer::singleShot(60 * 1000, [cachePath = paths.cacheDirectory()] {
|
QTimer::singleShot(60 * 1000, [cachePath = paths.cacheDirectory()] {
|
||||||
QtConcurrent::run([cachePath]() { clearCache(cachePath); });
|
QtConcurrent::run([cachePath]() {
|
||||||
|
clearCache(cachePath);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
chatterino::NetworkManager::init();
|
chatterino::NetworkManager::init();
|
||||||
|
|
|
@ -130,17 +130,17 @@ void Channel::addOrReplaceTimeout(MessagePtr message)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->flags.has(MessageFlag::Timeout) &&
|
if (s->flags.has(MessageFlag::Timeout) &&
|
||||||
s->timeoutUser == message->timeoutUser) //
|
s->timeoutUser == message->timeoutUser)
|
||||||
{
|
{
|
||||||
if (message->flags.has(MessageFlag::PubSub) &&
|
if (message->flags.has(MessageFlag::PubSub) &&
|
||||||
!s->flags.has(MessageFlag::PubSub)) //
|
!s->flags.has(MessageFlag::PubSub))
|
||||||
{
|
{
|
||||||
this->replaceMessage(s, message);
|
this->replaceMessage(s, message);
|
||||||
addMessage = false;
|
addMessage = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!message->flags.has(MessageFlag::PubSub) &&
|
if (!message->flags.has(MessageFlag::PubSub) &&
|
||||||
s->flags.has(MessageFlag::PubSub)) //
|
s->flags.has(MessageFlag::PubSub))
|
||||||
{
|
{
|
||||||
addMessage = timeoutStackStyle == TimeoutStackStyle::DontStack;
|
addMessage = timeoutStackStyle == TimeoutStackStyle::DontStack;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -113,7 +113,9 @@ namespace {
|
||||||
job->setKey(set.name);
|
job->setKey(set.name);
|
||||||
job->setTextData(set.credential);
|
job->setTextData(set.credential);
|
||||||
QObject::connect(job, &QKeychain::Job::finished, qApp,
|
QObject::connect(job, &QKeychain::Job::finished, qApp,
|
||||||
[](auto) { runNextJob(); });
|
[](auto) {
|
||||||
|
runNextJob();
|
||||||
|
});
|
||||||
job->start();
|
job->start();
|
||||||
}
|
}
|
||||||
else // erase job
|
else // erase job
|
||||||
|
@ -123,7 +125,9 @@ namespace {
|
||||||
job->setAutoDelete(true);
|
job->setAutoDelete(true);
|
||||||
job->setKey(erase.name);
|
job->setKey(erase.name);
|
||||||
QObject::connect(job, &QKeychain::Job::finished, qApp,
|
QObject::connect(job, &QKeychain::Job::finished, qApp,
|
||||||
[](auto) { runNextJob(); });
|
[](auto) {
|
||||||
|
runNextJob();
|
||||||
|
});
|
||||||
job->start();
|
job->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -180,9 +180,10 @@ void loadUncached(const std::shared_ptr<NetworkData> &data)
|
||||||
if (data->onSuccess_)
|
if (data->onSuccess_)
|
||||||
{
|
{
|
||||||
if (data->executeConcurrently_)
|
if (data->executeConcurrently_)
|
||||||
QtConcurrent::run(
|
QtConcurrent::run([onSuccess = std::move(data->onSuccess_),
|
||||||
[onSuccess = std::move(data->onSuccess_),
|
result = std::move(result)] {
|
||||||
result = std::move(result)] { onSuccess(result); });
|
onSuccess(result);
|
||||||
|
});
|
||||||
else
|
else
|
||||||
data->onSuccess_(result);
|
data->onSuccess_(result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,9 @@ public:
|
||||||
SignalVector()
|
SignalVector()
|
||||||
: readOnly_(new std::vector<T>())
|
: readOnly_(new std::vector<T>())
|
||||||
{
|
{
|
||||||
QObject::connect(&this->itemsChangedTimer_, &QTimer::timeout,
|
QObject::connect(&this->itemsChangedTimer_, &QTimer::timeout, [this] {
|
||||||
[this] { this->delayedItemsChanged.invoke(); });
|
this->delayedItemsChanged.invoke();
|
||||||
|
});
|
||||||
this->itemsChangedTimer_.setInterval(100);
|
this->itemsChangedTimer_.setInterval(100);
|
||||||
this->itemsChangedTimer_.setSingleShot(true);
|
this->itemsChangedTimer_.setSingleShot(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,8 +115,11 @@ bool appendWhisperMessageWordsLocally(const QStringList &words)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} visitor;
|
} visitor;
|
||||||
boost::apply_visitor([&b](auto &&arg) { visitor(arg, b); },
|
boost::apply_visitor(
|
||||||
variant);
|
[&b](auto &&arg) {
|
||||||
|
visitor(arg, b);
|
||||||
|
},
|
||||||
|
variant);
|
||||||
} // emoji/text
|
} // emoji/text
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -211,7 +214,7 @@ void CommandController::initialize(Settings &, Paths &paths)
|
||||||
|
|
||||||
// Update the setting when the vector of commands has been updated (most
|
// Update the setting when the vector of commands has been updated (most
|
||||||
// likely from the settings dialog)
|
// likely from the settings dialog)
|
||||||
this->items_.delayedItemsChanged.connect([this] { //
|
this->items_.delayedItemsChanged.connect([this] {
|
||||||
this->commandsSetting_->setValue(this->items_.raw());
|
this->commandsSetting_->setValue(this->items_.raw());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,9 @@ public:
|
||||||
FilterSet()
|
FilterSet()
|
||||||
{
|
{
|
||||||
this->listener_ =
|
this->listener_ =
|
||||||
getCSettings().filterRecords.delayedItemsChanged.connect(
|
getCSettings().filterRecords.delayedItemsChanged.connect([this] {
|
||||||
[this] { this->reloadFilters(); });
|
this->reloadFilters();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
FilterSet(const QList<QUuid> &filterIds)
|
FilterSet(const QList<QUuid> &filterIds)
|
||||||
|
@ -25,8 +26,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
this->listener_ =
|
this->listener_ =
|
||||||
getCSettings().filterRecords.delayedItemsChanged.connect(
|
getCSettings().filterRecords.delayedItemsChanged.connect([this] {
|
||||||
[this] { this->reloadFilters(); });
|
this->reloadFilters();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
~FilterSet()
|
~FilterSet()
|
||||||
|
|
|
@ -29,7 +29,7 @@ void NotificationController::initialize(Settings &settings, Paths &paths)
|
||||||
this->channelMap[Platform::Twitch].append(channelName);
|
this->channelMap[Platform::Twitch].append(channelName);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->channelMap[Platform::Twitch].delayedItemsChanged.connect([this] { //
|
this->channelMap[Platform::Twitch].delayedItemsChanged.connect([this] {
|
||||||
this->twitchSetting_.setValue(this->channelMap[Platform::Twitch].raw());
|
this->twitchSetting_.setValue(this->channelMap[Platform::Twitch].raw());
|
||||||
});
|
});
|
||||||
/*
|
/*
|
||||||
|
@ -37,7 +37,7 @@ void NotificationController::initialize(Settings &settings, Paths &paths)
|
||||||
this->channelMap[Platform::Mixer].appendItem(channelName);
|
this->channelMap[Platform::Mixer].appendItem(channelName);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->channelMap[Platform::Mixer].delayedItemsChanged.connect([this] { //
|
this->channelMap[Platform::Mixer].delayedItemsChanged.connect([this] {
|
||||||
this->mixerSetting_.setValue(
|
this->mixerSetting_.setValue(
|
||||||
this->channelMap[Platform::Mixer]);
|
this->channelMap[Platform::Mixer]);
|
||||||
});*/
|
});*/
|
||||||
|
@ -46,8 +46,9 @@ void NotificationController::initialize(Settings &settings, Paths &paths)
|
||||||
|
|
||||||
this->fetchFakeChannels();
|
this->fetchFakeChannels();
|
||||||
|
|
||||||
QObject::connect(this->liveStatusTimer_, &QTimer::timeout,
|
QObject::connect(this->liveStatusTimer_, &QTimer::timeout, [=] {
|
||||||
[=] { this->fetchFakeChannels(); });
|
this->fetchFakeChannels();
|
||||||
|
});
|
||||||
this->liveStatusTimer_->start(60 * 1000);
|
this->liveStatusTimer_->start(60 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,13 +38,16 @@ namespace detail {
|
||||||
DebugCount::increase("animated images");
|
DebugCount::increase("animated images");
|
||||||
|
|
||||||
this->gifTimerConnection_ =
|
this->gifTimerConnection_ =
|
||||||
getApp()->emotes->gifTimer.signal.connect(
|
getApp()->emotes->gifTimer.signal.connect([this] {
|
||||||
[this] { this->advance(); });
|
this->advance();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
auto totalLength = std::accumulate(
|
auto totalLength =
|
||||||
this->items_.begin(), this->items_.end(), 0UL,
|
std::accumulate(this->items_.begin(), this->items_.end(), 0UL,
|
||||||
[](auto init, auto &&frame) { return init + frame.duration; });
|
[](auto init, auto &&frame) {
|
||||||
|
return init + frame.duration;
|
||||||
|
});
|
||||||
|
|
||||||
if (totalLength == 0)
|
if (totalLength == 0)
|
||||||
{
|
{
|
||||||
|
@ -222,7 +225,9 @@ Image::~Image()
|
||||||
// run destructor of Frames in gui thread
|
// run destructor of Frames in gui thread
|
||||||
if (!isGuiThread())
|
if (!isGuiThread())
|
||||||
{
|
{
|
||||||
postToThread([frames = this->frames_.release()]() { delete frames; });
|
postToThread([frames = this->frames_.release()]() {
|
||||||
|
delete frames;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -352,7 +352,7 @@ void TextElement::addToContainer(MessageLayoutContainer &container,
|
||||||
|
|
||||||
// QChar::isHighSurrogate(text[0].unicode()) ? 2 : 1
|
// QChar::isHighSurrogate(text[0].unicode()) ? 2 : 1
|
||||||
|
|
||||||
for (int i = 0; i < textLength; i++) //
|
for (int i = 0; i < textLength; i++)
|
||||||
{
|
{
|
||||||
auto isSurrogate = text.size() > i + 1 &&
|
auto isSurrogate = text.size() > i + 1 &&
|
||||||
QChar::isHighSurrogate(text[i].unicode());
|
QChar::isHighSurrogate(text[i].unicode());
|
||||||
|
@ -360,7 +360,7 @@ void TextElement::addToContainer(MessageLayoutContainer &container,
|
||||||
auto charWidth = isSurrogate ? metrics.width(text.mid(i, 2))
|
auto charWidth = isSurrogate ? metrics.width(text.mid(i, 2))
|
||||||
: metrics.width(text[i]);
|
: metrics.width(text[i]);
|
||||||
|
|
||||||
if (!container.fitsInLine(width + charWidth)) //
|
if (!container.fitsInLine(width + charWidth))
|
||||||
{
|
{
|
||||||
container.addElementNoLineBreak(getTextLayoutElement(
|
container.addElementNoLineBreak(getTextLayoutElement(
|
||||||
text.mid(wordStart, i - wordStart), width, false));
|
text.mid(wordStart, i - wordStart), width, false));
|
||||||
|
@ -621,7 +621,7 @@ void IrcTextElement::addToContainer(MessageLayoutContainer &container,
|
||||||
// QChar::isHighSurrogate(text[0].unicode()) ? 2 : 1
|
// QChar::isHighSurrogate(text[0].unicode()) ? 2 : 1
|
||||||
|
|
||||||
// XXX(pajlada): NOT TESTED
|
// XXX(pajlada): NOT TESTED
|
||||||
for (int i = 0; i < textLength; i++) //
|
for (int i = 0; i < textLength; i++)
|
||||||
{
|
{
|
||||||
auto isSurrogate = text.size() > i + 1 &&
|
auto isSurrogate = text.size() > i + 1 &&
|
||||||
QChar::isHighSurrogate(text[i].unicode());
|
QChar::isHighSurrogate(text[i].unicode());
|
||||||
|
|
|
@ -356,7 +356,7 @@ void SharedMessageBuilder::appendChannelName()
|
||||||
Link link(Link::Url, this->channel->getName() + "\n" + this->message().id);
|
Link link(Link::Url, this->channel->getName() + "\n" + this->message().id);
|
||||||
|
|
||||||
this->emplace<TextElement>(channelName, MessageElementFlag::ChannelName,
|
this->emplace<TextElement>(channelName, MessageElementFlag::ChannelName,
|
||||||
MessageColor::System) //
|
MessageColor::System)
|
||||||
->setLink(link);
|
->setLink(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ void MessageLayout::actuallyLayout(int width, MessageElementFlags flags)
|
||||||
|
|
||||||
if (this->flags.has(MessageLayoutFlag::Expanded) ||
|
if (this->flags.has(MessageLayoutFlag::Expanded) ||
|
||||||
(flags.has(MessageElementFlag::ModeratorTools) &&
|
(flags.has(MessageElementFlag::ModeratorTools) &&
|
||||||
!this->message_->flags.has(MessageFlag::Disabled))) //
|
!this->message_->flags.has(MessageFlag::Disabled)))
|
||||||
{
|
{
|
||||||
messageFlags.unset(MessageFlag::Collapsed);
|
messageFlags.unset(MessageFlag::Collapsed);
|
||||||
}
|
}
|
||||||
|
|
|
@ -390,7 +390,7 @@ void MessageLayoutContainer::paintSelection(QPainter &painter, int messageIndex,
|
||||||
// ends in same line
|
// ends in same line
|
||||||
if (selection.selectionMax.messageIndex == messageIndex &&
|
if (selection.selectionMax.messageIndex == messageIndex &&
|
||||||
line.endCharIndex >
|
line.endCharIndex >
|
||||||
/*=*/selection.selectionMax.charIndex) //
|
/*=*/selection.selectionMax.charIndex)
|
||||||
{
|
{
|
||||||
returnAfter = true;
|
returnAfter = true;
|
||||||
index = line.startCharIndex;
|
index = line.startCharIndex;
|
||||||
|
|
|
@ -217,7 +217,7 @@ void TextLayoutElement::listenToLinkChanges()
|
||||||
.linkChanged.connect([this]() {
|
.linkChanged.connect([this]() {
|
||||||
// log("Old link: {}", this->getCreator().getLink().value);
|
// log("Old link: {}", this->getCreator().getLink().value);
|
||||||
// log("This link: {}", this->getLink().value);
|
// log("This link: {}", this->getLink().value);
|
||||||
this->setLink(this->getCreator().getLink()); //
|
this->setLink(this->getCreator().getLink());
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,36 +22,47 @@ AbstractIrcServer::AbstractIrcServer()
|
||||||
this->writeConnection_->moveToThread(
|
this->writeConnection_->moveToThread(
|
||||||
QCoreApplication::instance()->thread());
|
QCoreApplication::instance()->thread());
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(this->writeConnection_.get(),
|
||||||
this->writeConnection_.get(), &Communi::IrcConnection::messageReceived,
|
&Communi::IrcConnection::messageReceived, this,
|
||||||
this, [this](auto msg) { this->writeConnectionMessageReceived(msg); });
|
[this](auto msg) {
|
||||||
QObject::connect(
|
this->writeConnectionMessageReceived(msg);
|
||||||
this->writeConnection_.get(), &Communi::IrcConnection::connected, this,
|
});
|
||||||
[this] { this->onWriteConnected(this->writeConnection_.get()); });
|
QObject::connect(this->writeConnection_.get(),
|
||||||
|
&Communi::IrcConnection::connected, this, [this] {
|
||||||
|
this->onWriteConnected(this->writeConnection_.get());
|
||||||
|
});
|
||||||
|
|
||||||
// Listen to read connection message signals
|
// Listen to read connection message signals
|
||||||
this->readConnection_.reset(new IrcConnection);
|
this->readConnection_.reset(new IrcConnection);
|
||||||
this->readConnection_->moveToThread(QCoreApplication::instance()->thread());
|
this->readConnection_->moveToThread(QCoreApplication::instance()->thread());
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(this->readConnection_.get(),
|
||||||
this->readConnection_.get(), &Communi::IrcConnection::messageReceived,
|
&Communi::IrcConnection::messageReceived, this,
|
||||||
this, [this](auto msg) { this->readConnectionMessageReceived(msg); });
|
[this](auto msg) {
|
||||||
|
this->readConnectionMessageReceived(msg);
|
||||||
|
});
|
||||||
QObject::connect(this->readConnection_.get(),
|
QObject::connect(this->readConnection_.get(),
|
||||||
&Communi::IrcConnection::privateMessageReceived, this,
|
&Communi::IrcConnection::privateMessageReceived, this,
|
||||||
[this](auto msg) { this->privateMessageReceived(msg); });
|
[this](auto msg) {
|
||||||
QObject::connect(
|
this->privateMessageReceived(msg);
|
||||||
this->readConnection_.get(), &Communi::IrcConnection::connected, this,
|
});
|
||||||
[this] { this->onReadConnected(this->readConnection_.get()); });
|
|
||||||
QObject::connect(this->readConnection_.get(),
|
QObject::connect(this->readConnection_.get(),
|
||||||
&Communi::IrcConnection::disconnected, this,
|
&Communi::IrcConnection::connected, this, [this] {
|
||||||
[this] { this->onDisconnected(); });
|
this->onReadConnected(this->readConnection_.get());
|
||||||
|
});
|
||||||
QObject::connect(this->readConnection_.get(),
|
QObject::connect(this->readConnection_.get(),
|
||||||
&Communi::IrcConnection::socketError, this,
|
&Communi::IrcConnection::disconnected, this, [this] {
|
||||||
[this] { this->onSocketError(); });
|
this->onDisconnected();
|
||||||
|
});
|
||||||
|
QObject::connect(this->readConnection_.get(),
|
||||||
|
&Communi::IrcConnection::socketError, this, [this] {
|
||||||
|
this->onSocketError();
|
||||||
|
});
|
||||||
|
|
||||||
// listen to reconnect request
|
// listen to reconnect request
|
||||||
this->readConnection_->reconnectRequested.connect(
|
this->readConnection_->reconnectRequested.connect([this] {
|
||||||
[this] { this->connect(); });
|
this->connect();
|
||||||
|
});
|
||||||
// this->writeConnection->reconnectRequested.connect([this] {
|
// this->writeConnection->reconnectRequested.connect([this] {
|
||||||
// this->connect(); });
|
// this->connect(); });
|
||||||
this->reconnectTimer_.setInterval(RECONNECT_BASE_INTERVAL);
|
this->reconnectTimer_.setInterval(RECONNECT_BASE_INTERVAL);
|
||||||
|
|
|
@ -137,7 +137,9 @@ Irc::Irc()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this->connections.delayedItemsChanged.connect([this] { this->save(); });
|
this->connections.delayedItemsChanged.connect([this] {
|
||||||
|
this->save();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
QAbstractTableModel *Irc::newConnectionModel(QObject *parent)
|
QAbstractTableModel *Irc::newConnectionModel(QObject *parent)
|
||||||
|
|
|
@ -33,9 +33,13 @@ Outcome invokeIrcCommand(const QString &commandName, const QString &allParams,
|
||||||
|
|
||||||
// CUSTOM COMMANDS
|
// CUSTOM COMMANDS
|
||||||
auto params = allParams.split(' ');
|
auto params = allParams.split(' ');
|
||||||
auto paramsAfter = [&](int i) { return params.mid(i + 1).join(' '); };
|
auto paramsAfter = [&](int i) {
|
||||||
|
return params.mid(i + 1).join(' ');
|
||||||
|
};
|
||||||
|
|
||||||
auto sendRaw = [&](QString str) { channel.server()->sendRawMessage(str); };
|
auto sendRaw = [&](QString str) {
|
||||||
|
channel.server()->sendRawMessage(str);
|
||||||
|
};
|
||||||
|
|
||||||
if (cmd == "msg")
|
if (cmd == "msg")
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,8 +45,9 @@ IrcConnection::IrcConnection(QObject *parent)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
QObject::connect(this, &Communi::IrcConnection::connected, this,
|
QObject::connect(this, &Communi::IrcConnection::connected, this, [this] {
|
||||||
[this] { this->waitingForPong_ = false; });
|
this->waitingForPong_ = false;
|
||||||
|
});
|
||||||
|
|
||||||
QObject::connect(this, &Communi::IrcConnection::pongMessageReceived,
|
QObject::connect(this, &Communi::IrcConnection::pongMessageReceived,
|
||||||
[this](Communi::IrcPongMessage *message) {
|
[this](Communi::IrcPongMessage *message) {
|
||||||
|
|
|
@ -702,7 +702,7 @@ void IrcMessageHandler::handleNoticeMessage(Communi::IrcNoticeMessage *message)
|
||||||
// channels
|
// channels
|
||||||
app->twitch.server->forEachChannelAndSpecialChannels(
|
app->twitch.server->forEachChannelAndSpecialChannels(
|
||||||
[msg](const auto &c) {
|
[msg](const auto &c) {
|
||||||
c->addMessage(msg); //
|
c->addMessage(msg);
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -166,7 +166,7 @@ namespace detail {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
self->ping(); //
|
self->ping();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ void TwitchAccount::ignore(
|
||||||
{
|
{
|
||||||
const auto onUserFetched = [this, targetName,
|
const auto onUserFetched = [this, targetName,
|
||||||
onFinished](const auto &user) {
|
onFinished](const auto &user) {
|
||||||
this->ignoreByID(user.id, targetName, onFinished); //
|
this->ignoreByID(user.id, targetName, onFinished);
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto onUserFetchFailed = [] {};
|
const auto onUserFetchFailed = [] {};
|
||||||
|
@ -230,7 +230,7 @@ void TwitchAccount::unignore(
|
||||||
{
|
{
|
||||||
const auto onUserFetched = [this, targetName,
|
const auto onUserFetched = [this, targetName,
|
||||||
onFinished](const auto &user) {
|
onFinished](const auto &user) {
|
||||||
this->unignoreByID(user.id, targetName, onFinished); //
|
this->unignoreByID(user.id, targetName, onFinished);
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto onUserFetchFailed = [] {};
|
const auto onUserFetchFailed = [] {};
|
||||||
|
|
|
@ -17,7 +17,7 @@ TwitchAccountManager::TwitchAccountManager()
|
||||||
currentUser->loadIgnores();
|
currentUser->loadIgnores();
|
||||||
});
|
});
|
||||||
|
|
||||||
this->accounts.itemRemoved.connect([this](const auto &acc) { //
|
this->accounts.itemRemoved.connect([this](const auto &acc) {
|
||||||
this->removeUser(acc.item.get());
|
this->removeUser(acc.item.get());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,14 +156,18 @@ TwitchChannel::TwitchChannel(const QString &name,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this->managedConnect(getApp()->accounts->twitch.currentUserChanged,
|
this->managedConnect(getApp()->accounts->twitch.currentUserChanged, [=] {
|
||||||
[=] { this->setMod(false); });
|
this->setMod(false);
|
||||||
|
});
|
||||||
|
|
||||||
// pubsub
|
// pubsub
|
||||||
this->managedConnect(getApp()->accounts->twitch.currentUserChanged,
|
this->managedConnect(getApp()->accounts->twitch.currentUserChanged, [=] {
|
||||||
[=] { this->refreshPubsub(); });
|
this->refreshPubsub();
|
||||||
|
});
|
||||||
this->refreshPubsub();
|
this->refreshPubsub();
|
||||||
this->userStateChanged.connect([this] { this->refreshPubsub(); });
|
this->userStateChanged.connect([this] {
|
||||||
|
this->refreshPubsub();
|
||||||
|
});
|
||||||
|
|
||||||
// room id loaded -> refresh live status
|
// room id loaded -> refresh live status
|
||||||
this->roomIdChanged.connect([this]() {
|
this->roomIdChanged.connect([this]() {
|
||||||
|
@ -177,12 +181,14 @@ TwitchChannel::TwitchChannel(const QString &name,
|
||||||
});
|
});
|
||||||
|
|
||||||
// timers
|
// timers
|
||||||
QObject::connect(&this->chattersListTimer_, &QTimer::timeout,
|
QObject::connect(&this->chattersListTimer_, &QTimer::timeout, [=] {
|
||||||
[=] { this->refreshChatters(); });
|
this->refreshChatters();
|
||||||
|
});
|
||||||
this->chattersListTimer_.start(5 * 60 * 1000);
|
this->chattersListTimer_.start(5 * 60 * 1000);
|
||||||
|
|
||||||
QObject::connect(&this->liveStatusTimer_, &QTimer::timeout,
|
QObject::connect(&this->liveStatusTimer_, &QTimer::timeout, [=] {
|
||||||
[=] { this->refreshLiveStatus(); });
|
this->refreshLiveStatus();
|
||||||
|
});
|
||||||
this->liveStatusTimer_.start(60 * 1000);
|
this->liveStatusTimer_.start(60 * 1000);
|
||||||
|
|
||||||
// debugging
|
// debugging
|
||||||
|
|
|
@ -38,8 +38,11 @@ TwitchIrcServer::TwitchIrcServer()
|
||||||
|
|
||||||
void TwitchIrcServer::initialize(Settings &settings, Paths &paths)
|
void TwitchIrcServer::initialize(Settings &settings, Paths &paths)
|
||||||
{
|
{
|
||||||
getApp()->accounts->twitch.currentUserChanged.connect(
|
getApp()->accounts->twitch.currentUserChanged.connect([this]() {
|
||||||
[this]() { postToThread([this] { this->connect(); }); });
|
postToThread([this] {
|
||||||
|
this->connect();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
this->twitchBadges.loadTwitchBadges();
|
this->twitchBadges.loadTwitchBadges();
|
||||||
this->bttv.loadEmotes();
|
this->bttv.loadEmotes();
|
||||||
|
|
|
@ -295,7 +295,7 @@ MessagePtr TwitchMessageBuilder::build()
|
||||||
|
|
||||||
std::sort(twitchEmotes.begin(), twitchEmotes.end(),
|
std::sort(twitchEmotes.begin(), twitchEmotes.end(),
|
||||||
[](const auto &a, const auto &b) {
|
[](const auto &a, const auto &b) {
|
||||||
return a.start < b.start; //
|
return a.start < b.start;
|
||||||
});
|
});
|
||||||
twitchEmotes.erase(std::unique(twitchEmotes.begin(), twitchEmotes.end(),
|
twitchEmotes.erase(std::unique(twitchEmotes.begin(), twitchEmotes.end(),
|
||||||
[](const auto &first, const auto &second) {
|
[](const auto &first, const auto &second) {
|
||||||
|
@ -399,7 +399,10 @@ void TwitchMessageBuilder::addWords(
|
||||||
for (auto &variant : getApp()->emotes->emojis.parse(preText))
|
for (auto &variant : getApp()->emotes->emojis.parse(preText))
|
||||||
{
|
{
|
||||||
boost::apply_visitor(
|
boost::apply_visitor(
|
||||||
[&](auto &&arg) { this->addTextOrEmoji(arg); }, variant);
|
[&](auto &&arg) {
|
||||||
|
this->addTextOrEmoji(arg);
|
||||||
|
},
|
||||||
|
variant);
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor += preText.size();
|
cursor += preText.size();
|
||||||
|
@ -415,8 +418,11 @@ void TwitchMessageBuilder::addWords(
|
||||||
// split words
|
// split words
|
||||||
for (auto &variant : getApp()->emotes->emojis.parse(word))
|
for (auto &variant : getApp()->emotes->emojis.parse(word))
|
||||||
{
|
{
|
||||||
boost::apply_visitor([&](auto &&arg) { this->addTextOrEmoji(arg); },
|
boost::apply_visitor(
|
||||||
variant);
|
[&](auto &&arg) {
|
||||||
|
this->addTextOrEmoji(arg);
|
||||||
|
},
|
||||||
|
variant);
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor += word.size() + 1;
|
cursor += word.size() + 1;
|
||||||
|
|
|
@ -11,8 +11,9 @@ Emotes::Emotes()
|
||||||
|
|
||||||
void Emotes::initialize(Settings &settings, Paths &paths)
|
void Emotes::initialize(Settings &settings, Paths &paths)
|
||||||
{
|
{
|
||||||
getApp()->accounts->twitch.currentUserChanged.connect(
|
getApp()->accounts->twitch.currentUserChanged.connect([] {
|
||||||
[] { getApp()->accounts->twitch.getCurrent()->loadEmotes(); });
|
getApp()->accounts->twitch.getCurrent()->loadEmotes();
|
||||||
|
});
|
||||||
|
|
||||||
this->emojis.load();
|
this->emojis.load();
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ QString Paths::cacheDirectory()
|
||||||
QStringSetting cachePathSetting("/cache/path");
|
QStringSetting cachePathSetting("/cache/path");
|
||||||
|
|
||||||
cachePathSetting.connect([](const auto &newPath, auto) {
|
cachePathSetting.connect([](const auto &newPath, auto) {
|
||||||
QDir().mkpath(newPath); //
|
QDir().mkpath(newPath);
|
||||||
});
|
});
|
||||||
|
|
||||||
return cachePathSetting;
|
return cachePathSetting;
|
||||||
|
|
|
@ -125,7 +125,10 @@ Settings::Settings(const QString &settingsDirectory)
|
||||||
#ifdef USEWINSDK
|
#ifdef USEWINSDK
|
||||||
this->autorun = isRegisteredForStartup();
|
this->autorun = isRegisteredForStartup();
|
||||||
this->autorun.connect(
|
this->autorun.connect(
|
||||||
[](bool autorun) { setRegisteredForStartup(autorun); }, false);
|
[](bool autorun) {
|
||||||
|
setRegisteredForStartup(autorun);
|
||||||
|
},
|
||||||
|
false);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,16 @@ Theme::Theme()
|
||||||
{
|
{
|
||||||
this->update();
|
this->update();
|
||||||
|
|
||||||
this->themeName.connectSimple([this](auto) { this->update(); }, false);
|
this->themeName.connectSimple(
|
||||||
this->themeHue.connectSimple([this](auto) { this->update(); }, false);
|
[this](auto) {
|
||||||
|
this->update();
|
||||||
|
},
|
||||||
|
false);
|
||||||
|
this->themeHue.connectSimple(
|
||||||
|
[this](auto) {
|
||||||
|
this->update();
|
||||||
|
},
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// hue: theme color (0 - 1)
|
// hue: theme color (0 - 1)
|
||||||
|
@ -60,7 +68,7 @@ void Theme::actuallyUpdate(double hue, double multiplier)
|
||||||
this->splits.input.styleSheet =
|
this->splits.input.styleSheet =
|
||||||
"background:" + this->splits.input.background.name() + ";" +
|
"background:" + this->splits.input.background.name() + ";" +
|
||||||
"border:" + this->tabs.selected.backgrounds.regular.color().name() +
|
"border:" + this->tabs.selected.backgrounds.regular.color().name() +
|
||||||
";" + "color:" + this->messages.textColors.regular.name() + ";" + //
|
";" + "color:" + this->messages.textColors.regular.name() + ";" +
|
||||||
"selection-background-color:" +
|
"selection-background-color:" +
|
||||||
(isLight ? "#68B1FF"
|
(isLight ? "#68B1FF"
|
||||||
: this->tabs.selected.backgrounds.regular.color().name());
|
: this->tabs.selected.backgrounds.regular.color().name());
|
||||||
|
|
|
@ -362,7 +362,9 @@ void Updates::setStatus_(Status status)
|
||||||
if (this->status_ != status)
|
if (this->status_ != status)
|
||||||
{
|
{
|
||||||
this->status_ = status;
|
this->status_ = status;
|
||||||
postToThread([this, status] { this->statusUpdated.invoke(status); });
|
postToThread([this, status] {
|
||||||
|
this->statusUpdated.invoke(status);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ WindowManager::WindowManager()
|
||||||
this->wordFlagsListener_.addSetting(settings->boldUsernames);
|
this->wordFlagsListener_.addSetting(settings->boldUsernames);
|
||||||
this->wordFlagsListener_.addSetting(settings->lowercaseDomains);
|
this->wordFlagsListener_.addSetting(settings->lowercaseDomains);
|
||||||
this->wordFlagsListener_.setCB([this] {
|
this->wordFlagsListener_.setCB([this] {
|
||||||
this->updateWordTypeMask(); //
|
this->updateWordTypeMask();
|
||||||
});
|
});
|
||||||
|
|
||||||
this->saveTimer = new QTimer;
|
this->saveTimer = new QTimer;
|
||||||
|
@ -108,13 +108,13 @@ WindowManager::WindowManager()
|
||||||
this->saveTimer->setSingleShot(true);
|
this->saveTimer->setSingleShot(true);
|
||||||
|
|
||||||
QObject::connect(this->saveTimer, &QTimer::timeout, [] {
|
QObject::connect(this->saveTimer, &QTimer::timeout, [] {
|
||||||
getApp()->windows->save(); //
|
getApp()->windows->save();
|
||||||
});
|
});
|
||||||
|
|
||||||
this->miscUpdateTimer_.start(100);
|
this->miscUpdateTimer_.start(100);
|
||||||
|
|
||||||
QObject::connect(&this->miscUpdateTimer_, &QTimer::timeout, [this] {
|
QObject::connect(&this->miscUpdateTimer_, &QTimer::timeout, [this] {
|
||||||
this->miscUpdate.invoke(); //
|
this->miscUpdate.invoke();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,8 +289,9 @@ void WindowManager::initialize(Settings &settings, Paths &paths)
|
||||||
{
|
{
|
||||||
assertInGuiThread();
|
assertInGuiThread();
|
||||||
|
|
||||||
getApp()->themes->repaintVisibleChatWidgets_.connect(
|
getApp()->themes->repaintVisibleChatWidgets_.connect([this] {
|
||||||
[this] { this->repaintVisibleChatWidgets(); });
|
this->repaintVisibleChatWidgets();
|
||||||
|
});
|
||||||
|
|
||||||
assert(!this->initialized_);
|
assert(!this->initialized_);
|
||||||
|
|
||||||
|
@ -309,22 +310,29 @@ void WindowManager::initialize(Settings &settings, Paths &paths)
|
||||||
mainWindow_->getNotebook().addPage(true);
|
mainWindow_->getNotebook().addPage(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.timestampFormat.connect(
|
settings.timestampFormat.connect([this](auto, auto) {
|
||||||
[this](auto, auto) { this->layoutChannelViews(); });
|
this->layoutChannelViews();
|
||||||
|
});
|
||||||
|
|
||||||
settings.emoteScale.connect(
|
settings.emoteScale.connect([this](auto, auto) {
|
||||||
[this](auto, auto) { this->forceLayoutChannelViews(); });
|
this->forceLayoutChannelViews();
|
||||||
|
});
|
||||||
|
|
||||||
settings.timestampFormat.connect(
|
settings.timestampFormat.connect([this](auto, auto) {
|
||||||
[this](auto, auto) { this->forceLayoutChannelViews(); });
|
this->forceLayoutChannelViews();
|
||||||
settings.alternateMessages.connect(
|
});
|
||||||
[this](auto, auto) { this->forceLayoutChannelViews(); });
|
settings.alternateMessages.connect([this](auto, auto) {
|
||||||
settings.separateMessages.connect(
|
this->forceLayoutChannelViews();
|
||||||
[this](auto, auto) { this->forceLayoutChannelViews(); });
|
});
|
||||||
settings.collpseMessagesMinLines.connect(
|
settings.separateMessages.connect([this](auto, auto) {
|
||||||
[this](auto, auto) { this->forceLayoutChannelViews(); });
|
this->forceLayoutChannelViews();
|
||||||
settings.enableRedeemedHighlight.connect(
|
});
|
||||||
[this](auto, auto) { this->forceLayoutChannelViews(); });
|
settings.collpseMessagesMinLines.connect([this](auto, auto) {
|
||||||
|
this->forceLayoutChannelViews();
|
||||||
|
});
|
||||||
|
settings.enableRedeemedHighlight.connect([this](auto, auto) {
|
||||||
|
this->forceLayoutChannelViews();
|
||||||
|
});
|
||||||
|
|
||||||
this->initialized_ = true;
|
this->initialized_ = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,9 +58,10 @@ void initUpdateButton(Button &button,
|
||||||
|
|
||||||
updateChange(Updates::instance().getStatus());
|
updateChange(Updates::instance().getStatus());
|
||||||
|
|
||||||
signalHolder.managedConnect(
|
signalHolder.managedConnect(Updates::instance().statusUpdated,
|
||||||
Updates::instance().statusUpdated,
|
[updateChange](auto status) {
|
||||||
[updateChange](auto status) { updateChange(status); });
|
updateChange(status);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|
|
@ -69,7 +69,9 @@ private:
|
||||||
// the cast here should absolutely not be necessary, but gcc still requires it
|
// the cast here should absolutely not be necessary, but gcc still requires it
|
||||||
this->conn_ =
|
this->conn_ =
|
||||||
QObject::connect((QObject *)other, &QObject::destroyed, qApp,
|
QObject::connect((QObject *)other, &QObject::destroyed, qApp,
|
||||||
[this](QObject *) { this->set(nullptr); },
|
[this](QObject *) {
|
||||||
|
this->set(nullptr);
|
||||||
|
},
|
||||||
Qt::DirectConnection);
|
Qt::DirectConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ namespace {
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
p, static_cast<void (QProcess::*)(int)>(&QProcess::finished),
|
p, static_cast<void (QProcess::*)(int)>(&QProcess::finished),
|
||||||
[=](int res) {
|
[=](int res) {
|
||||||
p->deleteLater(); //
|
p->deleteLater();
|
||||||
});
|
});
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
|
|
|
@ -31,8 +31,7 @@ AccountSwitchPopup::AccountSwitchPopup(QWidget *parent)
|
||||||
vbox->addLayout(hbox);
|
vbox->addLayout(hbox);
|
||||||
|
|
||||||
connect(manageAccountsButton, &QPushButton::clicked, [this]() {
|
connect(manageAccountsButton, &QPushButton::clicked, [this]() {
|
||||||
SettingsDialog::showDialog(this,
|
SettingsDialog::showDialog(this, SettingsDialogPreference::Accounts);
|
||||||
SettingsDialogPreference::Accounts); //
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this->getLayoutContainer()->setLayout(vbox);
|
this->getLayoutContainer()->setLayout(vbox);
|
||||||
|
|
|
@ -137,7 +137,9 @@ void BaseWidget::childEvent(QChildEvent *event)
|
||||||
{
|
{
|
||||||
// find element to be removed
|
// find element to be removed
|
||||||
auto it = std::find_if(this->widgets_.begin(), this->widgets_.end(),
|
auto it = std::find_if(this->widgets_.begin(), this->widgets_.end(),
|
||||||
[&](auto &&x) { return x == event->child(); });
|
[&](auto &&x) {
|
||||||
|
return x == event->child();
|
||||||
|
});
|
||||||
|
|
||||||
// remove if found
|
// remove if found
|
||||||
if (it != this->widgets_.end())
|
if (it != this->widgets_.end())
|
||||||
|
|
|
@ -83,15 +83,17 @@ BaseWindow::BaseWindow(FlagsEnum<Flags> _flags, QWidget *parent)
|
||||||
|
|
||||||
this->updateScale();
|
this->updateScale();
|
||||||
|
|
||||||
createWindowShortcut(this, "CTRL+0",
|
createWindowShortcut(this, "CTRL+0", [] {
|
||||||
[] { getSettings()->uiScale.setValue(1); });
|
getSettings()->uiScale.setValue(1);
|
||||||
|
});
|
||||||
|
|
||||||
this->resize(300, 150);
|
this->resize(300, 150);
|
||||||
|
|
||||||
#ifdef USEWINSDK
|
#ifdef USEWINSDK
|
||||||
this->useNextBounds_.setSingleShot(true);
|
this->useNextBounds_.setSingleShot(true);
|
||||||
QObject::connect(&this->useNextBounds_, &QTimer::timeout, this,
|
QObject::connect(&this->useNextBounds_, &QTimer::timeout, this, [this]() {
|
||||||
[this]() { this->currentBounds_ = this->nextBounds_; });
|
this->currentBounds_ = this->nextBounds_;
|
||||||
|
});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
this->themeChangedEvent();
|
this->themeChangedEvent();
|
||||||
|
@ -154,9 +156,10 @@ void BaseWindow::init()
|
||||||
|
|
||||||
// title
|
// title
|
||||||
Label *title = new Label;
|
Label *title = new Label;
|
||||||
QObject::connect(
|
QObject::connect(this, &QWidget::windowTitleChanged,
|
||||||
this, &QWidget::windowTitleChanged,
|
[title](const QString &text) {
|
||||||
[title](const QString &text) { title->setText(text); });
|
title->setText(text);
|
||||||
|
});
|
||||||
|
|
||||||
QSizePolicy policy(QSizePolicy::Ignored,
|
QSizePolicy policy(QSizePolicy::Ignored,
|
||||||
QSizePolicy::Preferred);
|
QSizePolicy::Preferred);
|
||||||
|
@ -187,7 +190,9 @@ void BaseWindow::init()
|
||||||
: Qt::WindowMaximized);
|
: Qt::WindowMaximized);
|
||||||
});
|
});
|
||||||
QObject::connect(_exitButton, &TitleBarButton::leftClicked,
|
QObject::connect(_exitButton, &TitleBarButton::leftClicked,
|
||||||
this, [this] { this->close(); });
|
this, [this] {
|
||||||
|
this->close();
|
||||||
|
});
|
||||||
|
|
||||||
this->ui_.minButton = _minButton;
|
this->ui_.minButton = _minButton;
|
||||||
this->ui_.maxButton = _maxButton;
|
this->ui_.maxButton = _maxButton;
|
||||||
|
@ -460,8 +465,9 @@ TitleBarButton *BaseWindow::addTitleBarButton(const TitleBarButtonStyle &style,
|
||||||
this->ui_.titlebarBox->insertWidget(1, button);
|
this->ui_.titlebarBox->insertWidget(1, button);
|
||||||
button->setButtonStyle(style);
|
button->setButtonStyle(style);
|
||||||
|
|
||||||
QObject::connect(button, &TitleBarButton::leftClicked, this,
|
QObject::connect(button, &TitleBarButton::leftClicked, this, [onClicked] {
|
||||||
[onClicked] { onClicked(); });
|
onClicked();
|
||||||
|
});
|
||||||
|
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
@ -474,8 +480,9 @@ EffectLabel *BaseWindow::addTitleBarLabel(std::function<void()> onClicked)
|
||||||
this->ui_.buttons.push_back(button);
|
this->ui_.buttons.push_back(button);
|
||||||
this->ui_.titlebarBox->insertWidget(1, button);
|
this->ui_.titlebarBox->insertWidget(1, button);
|
||||||
|
|
||||||
QObject::connect(button, &EffectLabel::leftClicked, this,
|
QObject::connect(button, &EffectLabel::leftClicked, this, [onClicked] {
|
||||||
[onClicked] { onClicked(); });
|
onClicked();
|
||||||
|
});
|
||||||
|
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
@ -550,8 +557,9 @@ void BaseWindow::resizeEvent(QResizeEvent *)
|
||||||
::SetWindowPos((HWND)this->winId(), nullptr, 0, 0,
|
::SetWindowPos((HWND)this->winId(), nullptr, 0, 0,
|
||||||
rect.right - rect.left, rect.bottom - rect.top,
|
rect.right - rect.left, rect.bottom - rect.top,
|
||||||
SWP_NOMOVE | SWP_NOZORDER);
|
SWP_NOMOVE | SWP_NOZORDER);
|
||||||
QTimer::singleShot(10, this,
|
QTimer::singleShot(10, this, [this] {
|
||||||
[this] { this->isResizeFixing_ = false; });
|
this->isResizeFixing_ = false;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -579,8 +587,9 @@ void BaseWindow::showEvent(QShowEvent *)
|
||||||
this->moveIntoDesktopRect(this, this->pos());
|
this->moveIntoDesktopRect(this, this->pos());
|
||||||
if (this->frameless_)
|
if (this->frameless_)
|
||||||
{
|
{
|
||||||
QTimer::singleShot(
|
QTimer::singleShot(30, this, [this] {
|
||||||
30, this, [this] { this->moveIntoDesktopRect(this, this->pos()); });
|
this->moveIntoDesktopRect(this, this->pos());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,9 @@ Label::Label(BaseWidget *parent, QString text, FontStyle style)
|
||||||
, text_(text)
|
, text_(text)
|
||||||
, fontStyle_(style)
|
, fontStyle_(style)
|
||||||
{
|
{
|
||||||
this->connections_.managedConnect(getFonts()->fontChanged,
|
this->connections_.managedConnect(getFonts()->fontChanged, [this] {
|
||||||
[this] { this->updateSize(); });
|
this->updateSize();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &Label::getText() const
|
const QString &Label::getText() const
|
||||||
|
|
|
@ -181,14 +181,17 @@ void Notebook::select(QWidget *page)
|
||||||
bool Notebook::containsPage(QWidget *page)
|
bool Notebook::containsPage(QWidget *page)
|
||||||
{
|
{
|
||||||
return std::any_of(this->items_.begin(), this->items_.end(),
|
return std::any_of(this->items_.begin(), this->items_.end(),
|
||||||
[page](const auto &item) { return item.page == page; });
|
[page](const auto &item) {
|
||||||
|
return item.page == page;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Notebook::Item &Notebook::findItem(QWidget *page)
|
Notebook::Item &Notebook::findItem(QWidget *page)
|
||||||
{
|
{
|
||||||
auto it =
|
auto it = std::find_if(this->items_.begin(), this->items_.end(),
|
||||||
std::find_if(this->items_.begin(), this->items_.end(),
|
[page](const auto &item) {
|
||||||
[page](const auto &item) { return page == item.page; });
|
return page == item.page;
|
||||||
|
});
|
||||||
assert(it != this->items_.end());
|
assert(it != this->items_.end());
|
||||||
return *it;
|
return *it;
|
||||||
}
|
}
|
||||||
|
@ -617,7 +620,9 @@ SplitNotebook::SplitNotebook(Window *parent)
|
||||||
: Notebook(parent)
|
: Notebook(parent)
|
||||||
{
|
{
|
||||||
this->connect(this->getAddButton(), &NotebookButton::leftClicked, [this]() {
|
this->connect(this->getAddButton(), &NotebookButton::leftClicked, [this]() {
|
||||||
QTimer::singleShot(80, this, [this] { this->addPage(true); });
|
QTimer::singleShot(80, this, [this] {
|
||||||
|
this->addPage(true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// add custom buttons if they are not in the parent window frame
|
// add custom buttons if they are not in the parent window frame
|
||||||
|
@ -646,19 +651,24 @@ void SplitNotebook::addCustomButtons()
|
||||||
settingsBtn->setVisible(!getSettings()->hidePreferencesButton.getValue());
|
settingsBtn->setVisible(!getSettings()->hidePreferencesButton.getValue());
|
||||||
|
|
||||||
getSettings()->hidePreferencesButton.connect(
|
getSettings()->hidePreferencesButton.connect(
|
||||||
[settingsBtn](bool hide, auto) { settingsBtn->setVisible(!hide); },
|
[settingsBtn](bool hide, auto) {
|
||||||
|
settingsBtn->setVisible(!hide);
|
||||||
|
},
|
||||||
this->connections_);
|
this->connections_);
|
||||||
|
|
||||||
settingsBtn->setIcon(NotebookButton::Settings);
|
settingsBtn->setIcon(NotebookButton::Settings);
|
||||||
|
|
||||||
QObject::connect(settingsBtn, &NotebookButton::leftClicked,
|
QObject::connect(settingsBtn, &NotebookButton::leftClicked, [this] {
|
||||||
[this] { getApp()->windows->showSettingsDialog(this); });
|
getApp()->windows->showSettingsDialog(this);
|
||||||
|
});
|
||||||
|
|
||||||
// account
|
// account
|
||||||
auto userBtn = this->addCustomButton();
|
auto userBtn = this->addCustomButton();
|
||||||
userBtn->setVisible(!getSettings()->hideUserButton.getValue());
|
userBtn->setVisible(!getSettings()->hideUserButton.getValue());
|
||||||
getSettings()->hideUserButton.connect(
|
getSettings()->hideUserButton.connect(
|
||||||
[userBtn](bool hide, auto) { userBtn->setVisible(!hide); },
|
[userBtn](bool hide, auto) {
|
||||||
|
userBtn->setVisible(!hide);
|
||||||
|
},
|
||||||
this->connections_);
|
this->connections_);
|
||||||
|
|
||||||
userBtn->setIcon(NotebookButton::User);
|
userBtn->setIcon(NotebookButton::User);
|
||||||
|
|
|
@ -43,8 +43,9 @@ TooltipWidget::TooltipWidget(BaseWidget *parent)
|
||||||
layout->addWidget(displayText_);
|
layout->addWidget(displayText_);
|
||||||
this->setLayout(layout);
|
this->setLayout(layout);
|
||||||
|
|
||||||
this->fontChangedConnection_ =
|
this->fontChangedConnection_ = getFonts()->fontChanged.connect([this] {
|
||||||
getFonts()->fontChanged.connect([this] { this->updateFont(); });
|
this->updateFont();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
TooltipWidget::~TooltipWidget()
|
TooltipWidget::~TooltipWidget()
|
||||||
|
|
|
@ -58,8 +58,9 @@ Window::Window(WindowType type)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
this->signalHolder_.managedConnect(
|
this->signalHolder_.managedConnect(
|
||||||
getApp()->accounts->twitch.currentUserChanged,
|
getApp()->accounts->twitch.currentUserChanged, [this] {
|
||||||
[this] { this->onAccountSelected(); });
|
this->onAccountSelected();
|
||||||
|
});
|
||||||
this->onAccountSelected();
|
this->onAccountSelected();
|
||||||
|
|
||||||
if (type == WindowType::Main)
|
if (type == WindowType::Main)
|
||||||
|
@ -159,7 +160,7 @@ void Window::addCustomTitlebarButtons()
|
||||||
|
|
||||||
// settings
|
// settings
|
||||||
this->addTitleBarButton(TitleBarButtonStyle::Settings, [this] {
|
this->addTitleBarButton(TitleBarButtonStyle::Settings, [this] {
|
||||||
getApp()->windows->showSettingsDialog(this); //
|
getApp()->windows->showSettingsDialog(this);
|
||||||
});
|
});
|
||||||
|
|
||||||
// updates
|
// updates
|
||||||
|
@ -293,7 +294,7 @@ void Window::addShortcuts()
|
||||||
/// Initialize program-wide hotkeys
|
/// Initialize program-wide hotkeys
|
||||||
// Open settings
|
// Open settings
|
||||||
createWindowShortcut(this, "CTRL+P", [this] {
|
createWindowShortcut(this, "CTRL+P", [this] {
|
||||||
SettingsDialog::showDialog(this); //
|
SettingsDialog::showDialog(this);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Switch tab
|
// Switch tab
|
||||||
|
@ -306,17 +307,22 @@ void Window::addShortcuts()
|
||||||
{
|
{
|
||||||
char hotkey[7];
|
char hotkey[7];
|
||||||
std::sprintf(hotkey, "CTRL+%d", i + 1);
|
std::sprintf(hotkey, "CTRL+%d", i + 1);
|
||||||
const auto openTab = [this, i] { this->notebook_->selectIndex(i); };
|
const auto openTab = [this, i] {
|
||||||
|
this->notebook_->selectIndex(i);
|
||||||
|
};
|
||||||
createWindowShortcut(this, hotkey, openTab);
|
createWindowShortcut(this, hotkey, openTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
createWindowShortcut(this, "CTRL+9",
|
createWindowShortcut(this, "CTRL+9", [this] {
|
||||||
[this] { this->notebook_->selectLastTab(); });
|
this->notebook_->selectLastTab();
|
||||||
|
});
|
||||||
|
|
||||||
createWindowShortcut(this, "CTRL+TAB",
|
createWindowShortcut(this, "CTRL+TAB", [this] {
|
||||||
[this] { this->notebook_->selectNextTab(); });
|
this->notebook_->selectNextTab();
|
||||||
createWindowShortcut(this, "CTRL+SHIFT+TAB",
|
});
|
||||||
[this] { this->notebook_->selectPreviousTab(); });
|
createWindowShortcut(this, "CTRL+SHIFT+TAB", [this] {
|
||||||
|
this->notebook_->selectPreviousTab();
|
||||||
|
});
|
||||||
|
|
||||||
createWindowShortcut(this, "CTRL+N", [this] {
|
createWindowShortcut(this, "CTRL+N", [this] {
|
||||||
if (auto page = dynamic_cast<SplitContainer *>(
|
if (auto page = dynamic_cast<SplitContainer *>(
|
||||||
|
@ -350,12 +356,14 @@ void Window::addShortcuts()
|
||||||
}
|
}
|
||||||
|
|
||||||
// New tab
|
// New tab
|
||||||
createWindowShortcut(this, "CTRL+SHIFT+T",
|
createWindowShortcut(this, "CTRL+SHIFT+T", [this] {
|
||||||
[this] { this->notebook_->addPage(true); });
|
this->notebook_->addPage(true);
|
||||||
|
});
|
||||||
|
|
||||||
// Close tab
|
// Close tab
|
||||||
createWindowShortcut(this, "CTRL+SHIFT+W",
|
createWindowShortcut(this, "CTRL+SHIFT+W", [this] {
|
||||||
[this] { this->notebook_->removeCurrentPage(); });
|
this->notebook_->removeCurrentPage();
|
||||||
|
});
|
||||||
|
|
||||||
// Reopen last closed split
|
// Reopen last closed split
|
||||||
createWindowShortcut(this, "CTRL+G", [this] {
|
createWindowShortcut(this, "CTRL+G", [this] {
|
||||||
|
@ -402,7 +410,7 @@ void Window::addMenuBar()
|
||||||
QAction *prefs = menu->addAction(QString());
|
QAction *prefs = menu->addAction(QString());
|
||||||
prefs->setMenuRole(QAction::PreferencesRole);
|
prefs->setMenuRole(QAction::PreferencesRole);
|
||||||
connect(prefs, &QAction::triggered, this, [this] {
|
connect(prefs, &QAction::triggered, this, [this] {
|
||||||
SettingsDialog::showDialog(this); //
|
SettingsDialog::showDialog(this);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Window menu.
|
// Window menu.
|
||||||
|
@ -410,13 +418,15 @@ void Window::addMenuBar()
|
||||||
|
|
||||||
QAction *nextTab = windowMenu->addAction(QString("Select next tab"));
|
QAction *nextTab = windowMenu->addAction(QString("Select next tab"));
|
||||||
nextTab->setShortcuts({QKeySequence("Meta+Tab")});
|
nextTab->setShortcuts({QKeySequence("Meta+Tab")});
|
||||||
connect(nextTab, &QAction::triggered, this,
|
connect(nextTab, &QAction::triggered, this, [=] {
|
||||||
[=] { this->notebook_->selectNextTab(); });
|
this->notebook_->selectNextTab();
|
||||||
|
});
|
||||||
|
|
||||||
QAction *prevTab = windowMenu->addAction(QString("Select previous tab"));
|
QAction *prevTab = windowMenu->addAction(QString("Select previous tab"));
|
||||||
prevTab->setShortcuts({QKeySequence("Meta+Shift+Tab")});
|
prevTab->setShortcuts({QKeySequence("Meta+Shift+Tab")});
|
||||||
connect(prevTab, &QAction::triggered, this,
|
connect(prevTab, &QAction::triggered, this, [=] {
|
||||||
[=] { this->notebook_->selectPreviousTab(); });
|
this->notebook_->selectPreviousTab();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::onAccountSelected()
|
void Window::onAccountSelected()
|
||||||
|
|
|
@ -103,7 +103,7 @@ ChannelFilterEditorDialog::ValueSpecifier::ValueSpecifier()
|
||||||
this->layout_->addWidget(this->valueInput_, 1);
|
this->layout_->addWidget(this->valueInput_, 1);
|
||||||
this->layout_->setContentsMargins(5, 5, 5, 5);
|
this->layout_->setContentsMargins(5, 5, 5, 5);
|
||||||
|
|
||||||
QObject::connect( //
|
QObject::connect(
|
||||||
this->typeCombo_, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
this->typeCombo_, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||||
[this](int index) {
|
[this](int index) {
|
||||||
const auto isNumber = (index == 1);
|
const auto isNumber = (index == 1);
|
||||||
|
@ -183,7 +183,7 @@ ChannelFilterEditorDialog::BinaryOperationSpecifier::BinaryOperationSpecifier(
|
||||||
this->layout_->addLayout(this->right_->layout());
|
this->layout_->addLayout(this->right_->layout());
|
||||||
this->layout_->setContentsMargins(5, 5, 5, 5);
|
this->layout_->setContentsMargins(5, 5, 5, 5);
|
||||||
|
|
||||||
QObject::connect( //
|
QObject::connect(
|
||||||
this->opCombo_, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
this->opCombo_, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||||
[this](int index) {
|
[this](int index) {
|
||||||
// disable if set to "(nothing)"
|
// disable if set to "(nothing)"
|
||||||
|
|
|
@ -90,11 +90,13 @@ ColorPickerDialog::ColorPickerDialog(const QColor &initial, QWidget *parent)
|
||||||
layout.emplace<QHBoxLayout>().emplace<QDialogButtonBox>(this);
|
layout.emplace<QHBoxLayout>().emplace<QDialogButtonBox>(this);
|
||||||
{
|
{
|
||||||
auto *button_ok = buttons->addButton(QDialogButtonBox::Ok);
|
auto *button_ok = buttons->addButton(QDialogButtonBox::Ok);
|
||||||
QObject::connect(button_ok, &QPushButton::clicked,
|
QObject::connect(button_ok, &QPushButton::clicked, [=](bool) {
|
||||||
[=](bool) { this->ok(); });
|
this->ok();
|
||||||
|
});
|
||||||
auto *button_cancel = buttons->addButton(QDialogButtonBox::Cancel);
|
auto *button_cancel = buttons->addButton(QDialogButtonBox::Cancel);
|
||||||
QObject::connect(button_cancel, &QAbstractButton::clicked,
|
QObject::connect(button_cancel, &QAbstractButton::clicked, [=](bool) {
|
||||||
[=](bool) { this->close(); });
|
this->close();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this->themeChangedEvent();
|
this->themeChangedEvent();
|
||||||
|
@ -216,8 +218,9 @@ void ColorPickerDialog::initRecentColors(LayoutCreator<QWidget> &creator)
|
||||||
|
|
||||||
grid->addWidget(button, rowInd, columnInd);
|
grid->addWidget(button, rowInd, columnInd);
|
||||||
|
|
||||||
QObject::connect(button, &QPushButton::clicked,
|
QObject::connect(button, &QPushButton::clicked, [=] {
|
||||||
[=] { this->selectColor(button->color(), false); });
|
this->selectColor(button->color(), false);
|
||||||
|
});
|
||||||
|
|
||||||
++it;
|
++it;
|
||||||
++ind;
|
++ind;
|
||||||
|
@ -249,8 +252,9 @@ void ColorPickerDialog::initDefaultColors(LayoutCreator<QWidget> &creator)
|
||||||
|
|
||||||
grid->addWidget(button, rowInd, columnInd);
|
grid->addWidget(button, rowInd, columnInd);
|
||||||
|
|
||||||
QObject::connect(button, &QPushButton::clicked,
|
QObject::connect(button, &QPushButton::clicked, [=] {
|
||||||
[=] { this->selectColor(button->color(), false); });
|
this->selectColor(button->color(), false);
|
||||||
|
});
|
||||||
|
|
||||||
++it;
|
++it;
|
||||||
++ind;
|
++ind;
|
||||||
|
|
|
@ -132,7 +132,9 @@ EmotePopup::EmotePopup(QWidget *parent)
|
||||||
layout->addWidget(notebook);
|
layout->addWidget(notebook);
|
||||||
layout->setMargin(0);
|
layout->setMargin(0);
|
||||||
|
|
||||||
auto clicked = [this](const Link &link) { this->linkClicked.invoke(link); };
|
auto clicked = [this](const Link &link) {
|
||||||
|
this->linkClicked.invoke(link);
|
||||||
|
};
|
||||||
|
|
||||||
auto makeView = [&](QString tabTitle) {
|
auto makeView = [&](QString tabTitle) {
|
||||||
auto view = new ChannelView();
|
auto view = new ChannelView();
|
||||||
|
@ -154,9 +156,12 @@ EmotePopup::EmotePopup(QWidget *parent)
|
||||||
|
|
||||||
this->loadEmojis();
|
this->loadEmojis();
|
||||||
|
|
||||||
createWindowShortcut(this, "CTRL+Tab", [=] { notebook->selectNextTab(); });
|
createWindowShortcut(this, "CTRL+Tab", [=] {
|
||||||
createWindowShortcut(this, "CTRL+Shift+Tab",
|
notebook->selectNextTab();
|
||||||
[=] { notebook->selectPreviousTab(); });
|
});
|
||||||
|
createWindowShortcut(this, "CTRL+Shift+Tab", [=] {
|
||||||
|
notebook->selectPreviousTab();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmotePopup::loadChannel(ChannelPtr _channel)
|
void EmotePopup::loadChannel(ChannelPtr _channel)
|
||||||
|
|
|
@ -40,8 +40,9 @@ LastRunCrashDialog::LastRunCrashDialog()
|
||||||
|
|
||||||
auto *okButton =
|
auto *okButton =
|
||||||
buttons->addButton("Ignore", QDialogButtonBox::ButtonRole::NoRole);
|
buttons->addButton("Ignore", QDialogButtonBox::ButtonRole::NoRole);
|
||||||
QObject::connect(okButton, &QPushButton::clicked,
|
QObject::connect(okButton, &QPushButton::clicked, [this] {
|
||||||
[this] { this->accept(); });
|
this->accept();
|
||||||
|
});
|
||||||
|
|
||||||
// Updates
|
// Updates
|
||||||
// auto updateUpdateLabel = [update]() mutable {
|
// auto updateUpdateLabel = [update]() mutable {
|
||||||
|
|
|
@ -187,14 +187,18 @@ AdvancedLoginWidget::AdvancedLoginWidget()
|
||||||
|
|
||||||
this->ui_.oauthTokenInput.setEchoMode(QLineEdit::Password);
|
this->ui_.oauthTokenInput.setEchoMode(QLineEdit::Password);
|
||||||
|
|
||||||
connect(&this->ui_.userIDInput, &QLineEdit::textChanged,
|
connect(&this->ui_.userIDInput, &QLineEdit::textChanged, [=]() {
|
||||||
[=]() { this->refreshButtons(); });
|
this->refreshButtons();
|
||||||
connect(&this->ui_.usernameInput, &QLineEdit::textChanged,
|
});
|
||||||
[=]() { this->refreshButtons(); });
|
connect(&this->ui_.usernameInput, &QLineEdit::textChanged, [=]() {
|
||||||
connect(&this->ui_.clientIDInput, &QLineEdit::textChanged,
|
this->refreshButtons();
|
||||||
[=]() { this->refreshButtons(); });
|
});
|
||||||
connect(&this->ui_.oauthTokenInput, &QLineEdit::textChanged,
|
connect(&this->ui_.clientIDInput, &QLineEdit::textChanged, [=]() {
|
||||||
[=]() { this->refreshButtons(); });
|
this->refreshButtons();
|
||||||
|
});
|
||||||
|
connect(&this->ui_.oauthTokenInput, &QLineEdit::textChanged, [=]() {
|
||||||
|
this->refreshButtons();
|
||||||
|
});
|
||||||
|
|
||||||
/// Upper button row
|
/// Upper button row
|
||||||
|
|
||||||
|
@ -259,7 +263,7 @@ LoginWidget::LoginWidget()
|
||||||
|
|
||||||
QObject::connect(&this->ui_.buttonBox, &QDialogButtonBox::rejected,
|
QObject::connect(&this->ui_.buttonBox, &QDialogButtonBox::rejected,
|
||||||
[this]() {
|
[this]() {
|
||||||
this->close(); //
|
this->close();
|
||||||
});
|
});
|
||||||
|
|
||||||
this->ui_.mainLayout.addWidget(&this->ui_.buttonBox);
|
this->ui_.mainLayout.addWidget(&this->ui_.buttonBox);
|
||||||
|
|
|
@ -80,9 +80,10 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||||
whispers_lbl->setWordWrap(true);
|
whispers_lbl->setWordWrap(true);
|
||||||
whispers_btn->installEventFilter(&this->tabFilter_);
|
whispers_btn->installEventFilter(&this->tabFilter_);
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(whispers_btn.getElement(), &QRadioButton::toggled,
|
||||||
whispers_btn.getElement(), &QRadioButton::toggled,
|
[=](bool enabled) mutable {
|
||||||
[=](bool enabled) mutable { whispers_lbl->setVisible(enabled); });
|
whispers_lbl->setVisible(enabled);
|
||||||
|
});
|
||||||
|
|
||||||
// mentions_btn
|
// mentions_btn
|
||||||
auto mentions_btn = vbox.emplace<QRadioButton>("Mentions")
|
auto mentions_btn = vbox.emplace<QRadioButton>("Mentions")
|
||||||
|
@ -95,9 +96,10 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||||
mentions_lbl->setWordWrap(true);
|
mentions_lbl->setWordWrap(true);
|
||||||
mentions_btn->installEventFilter(&this->tabFilter_);
|
mentions_btn->installEventFilter(&this->tabFilter_);
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(mentions_btn.getElement(), &QRadioButton::toggled,
|
||||||
mentions_btn.getElement(), &QRadioButton::toggled,
|
[=](bool enabled) mutable {
|
||||||
[=](bool enabled) mutable { mentions_lbl->setVisible(enabled); });
|
mentions_lbl->setVisible(enabled);
|
||||||
|
});
|
||||||
|
|
||||||
// watching_btn
|
// watching_btn
|
||||||
auto watching_btn = vbox.emplace<QRadioButton>("Watching")
|
auto watching_btn = vbox.emplace<QRadioButton>("Watching")
|
||||||
|
@ -109,9 +111,10 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||||
watching_lbl->setWordWrap(true);
|
watching_lbl->setWordWrap(true);
|
||||||
watching_btn->installEventFilter(&this->tabFilter_);
|
watching_btn->installEventFilter(&this->tabFilter_);
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(watching_btn.getElement(), &QRadioButton::toggled,
|
||||||
watching_btn.getElement(), &QRadioButton::toggled,
|
[=](bool enabled) mutable {
|
||||||
[=](bool enabled) mutable { watching_lbl->setVisible(enabled); });
|
watching_lbl->setVisible(enabled);
|
||||||
|
});
|
||||||
|
|
||||||
vbox->addStretch(1);
|
vbox->addStretch(1);
|
||||||
|
|
||||||
|
@ -204,11 +207,13 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||||
layout.emplace<QHBoxLayout>().emplace<QDialogButtonBox>(this);
|
layout.emplace<QHBoxLayout>().emplace<QDialogButtonBox>(this);
|
||||||
{
|
{
|
||||||
auto *button_ok = buttons->addButton(QDialogButtonBox::Ok);
|
auto *button_ok = buttons->addButton(QDialogButtonBox::Ok);
|
||||||
QObject::connect(button_ok, &QPushButton::clicked,
|
QObject::connect(button_ok, &QPushButton::clicked, [=](bool) {
|
||||||
[=](bool) { this->ok(); });
|
this->ok();
|
||||||
|
});
|
||||||
auto *button_cancel = buttons->addButton(QDialogButtonBox::Cancel);
|
auto *button_cancel = buttons->addButton(QDialogButtonBox::Cancel);
|
||||||
QObject::connect(button_cancel, &QAbstractButton::clicked,
|
QObject::connect(button_cancel, &QAbstractButton::clicked, [=](bool) {
|
||||||
[=](bool) { this->close(); });
|
this->close();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this->setMinimumSize(300, 310);
|
this->setMinimumSize(300, 310);
|
||||||
|
@ -217,10 +222,10 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||||
|
|
||||||
// Shortcuts
|
// Shortcuts
|
||||||
createWindowShortcut(this, "Return", [=] {
|
createWindowShortcut(this, "Return", [=] {
|
||||||
this->ok(); //
|
this->ok();
|
||||||
});
|
});
|
||||||
createWindowShortcut(this, "Esc", [=] {
|
createWindowShortcut(this, "Esc", [=] {
|
||||||
this->close(); //
|
this->close();
|
||||||
});
|
});
|
||||||
|
|
||||||
// restore ui state
|
// restore ui state
|
||||||
|
@ -229,10 +234,10 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||||
{
|
{
|
||||||
this->ui_.notebook->selectIndex(getSettings()->lastSelectChannelTab);
|
this->ui_.notebook->selectIndex(getSettings()->lastSelectChannelTab);
|
||||||
createWindowShortcut(this, "Ctrl+Tab", [=] {
|
createWindowShortcut(this, "Ctrl+Tab", [=] {
|
||||||
this->ui_.notebook->selectNextTab(); //
|
this->ui_.notebook->selectNextTab();
|
||||||
});
|
});
|
||||||
createWindowShortcut(this, "CTRL+Shift+Tab", [=] {
|
createWindowShortcut(this, "CTRL+Shift+Tab", [=] {
|
||||||
this->ui_.notebook->selectPreviousTab(); //
|
this->ui_.notebook->selectPreviousTab();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,9 +35,10 @@ UpdateDialog::UpdateDialog()
|
||||||
});
|
});
|
||||||
|
|
||||||
this->updateStatusChanged(Updates::instance().getStatus());
|
this->updateStatusChanged(Updates::instance().getStatus());
|
||||||
this->connections_.managedConnect(
|
this->connections_.managedConnect(Updates::instance().statusUpdated,
|
||||||
Updates::instance().statusUpdated,
|
[this](auto status) {
|
||||||
[this](auto status) { this->updateStatusChanged(status); });
|
this->updateStatusChanged(status);
|
||||||
|
});
|
||||||
|
|
||||||
this->setScaleIndependantHeight(150);
|
this->setScaleIndependantHeight(150);
|
||||||
this->setScaleIndependantWidth(500);
|
this->setScaleIndependantWidth(500);
|
||||||
|
|
|
@ -131,7 +131,9 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, QWidget *parent)
|
||||||
this->setAttribute(Qt::WA_DeleteOnClose);
|
this->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
// Close the popup when Escape is pressed
|
// Close the popup when Escape is pressed
|
||||||
createWindowShortcut(this, "Escape", [this] { this->deleteLater(); });
|
createWindowShortcut(this, "Escape", [this] {
|
||||||
|
this->deleteLater();
|
||||||
|
});
|
||||||
|
|
||||||
auto layout = LayoutCreator<QWidget>(this->getLayoutContainer())
|
auto layout = LayoutCreator<QWidget>(this->getLayoutContainer())
|
||||||
.setLayoutType<QVBoxLayout>();
|
.setLayoutType<QVBoxLayout>();
|
||||||
|
@ -213,8 +215,9 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, QWidget *parent)
|
||||||
"/viewercard/" + this->userName_);
|
"/viewercard/" + this->userName_);
|
||||||
});
|
});
|
||||||
|
|
||||||
QObject::connect(refresh.getElement(), &Button::leftClicked,
|
QObject::connect(refresh.getElement(), &Button::leftClicked, [this] {
|
||||||
[this] { this->updateLatestMessages(); });
|
this->updateLatestMessages();
|
||||||
|
});
|
||||||
QObject::connect(mod.getElement(), &Button::leftClicked, [this] {
|
QObject::connect(mod.getElement(), &Button::leftClicked, [this] {
|
||||||
this->channel_->sendMessage("/mod " + this->userName_);
|
this->channel_->sendMessage("/mod " + this->userName_);
|
||||||
});
|
});
|
||||||
|
@ -367,7 +370,7 @@ void UserInfoPopup::installEvents()
|
||||||
auto currentUser = getApp()->accounts->twitch.getCurrent();
|
auto currentUser = getApp()->accounts->twitch.getCurrent();
|
||||||
|
|
||||||
const auto reenableFollowCheckbox = [this] {
|
const auto reenableFollowCheckbox = [this] {
|
||||||
this->ui_.follow->setEnabled(true); //
|
this->ui_.follow->setEnabled(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!this->ui_.follow->isEnabled())
|
if (!this->ui_.follow->isEnabled())
|
||||||
|
@ -502,7 +505,9 @@ void UserInfoPopup::setData(const QString &name, const ChannelPtr &channel)
|
||||||
this->userStateChanged_.invoke();
|
this->userStateChanged_.invoke();
|
||||||
|
|
||||||
this->updateLatestMessages();
|
this->updateLatestMessages();
|
||||||
QTimer::singleShot(1, this, [this] { this->setStayInScreenRect(true); });
|
QTimer::singleShot(1, this, [this] {
|
||||||
|
this->setStayInScreenRect(true);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserInfoPopup::updateLatestMessages()
|
void UserInfoPopup::updateLatestMessages()
|
||||||
|
@ -825,9 +830,10 @@ UserInfoPopup::TimeoutWidget::TimeoutWidget()
|
||||||
const auto pair =
|
const auto pair =
|
||||||
std::make_pair(Action::Timeout, calculateTimeoutDuration(item));
|
std::make_pair(Action::Timeout, calculateTimeoutDuration(item));
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(a.getElement(), &EffectLabel2::leftClicked,
|
||||||
a.getElement(), &EffectLabel2::leftClicked,
|
[this, pair] {
|
||||||
[this, pair] { this->buttonClicked.invoke(pair); });
|
this->buttonClicked.invoke(pair);
|
||||||
|
});
|
||||||
|
|
||||||
//auto addTimeouts = [&](const QString &title_,
|
//auto addTimeouts = [&](const QString &title_,
|
||||||
// const std::vector<std::pair<QString, int>> &items) {
|
// const std::vector<std::pair<QString, int>> &items) {
|
||||||
|
|
|
@ -72,8 +72,9 @@ void QuickSwitcherPopup::initWidgets()
|
||||||
listView->setModel(&this->switcherModel_);
|
listView->setModel(&this->switcherModel_);
|
||||||
|
|
||||||
QObject::connect(listView.getElement(),
|
QObject::connect(listView.getElement(),
|
||||||
&GenericListView::closeRequested, this,
|
&GenericListView::closeRequested, this, [this] {
|
||||||
[this] { this->close(); });
|
this->close();
|
||||||
|
});
|
||||||
|
|
||||||
this->ui_.searchEdit->installEventFilter(listView.getElement());
|
this->ui_.searchEdit->installEventFilter(listView.getElement());
|
||||||
}
|
}
|
||||||
|
@ -128,7 +129,9 @@ void QuickSwitcherPopup::updateSuggestions(const QString &text)
|
||||||
* Timeout interval 0 means the call will be delayed until all window events
|
* Timeout interval 0 means the call will be delayed until all window events
|
||||||
* have been processed (cf. https://doc.qt.io/qt-5/qtimer.html#interval-prop).
|
* have been processed (cf. https://doc.qt.io/qt-5/qtimer.html#interval-prop).
|
||||||
*/
|
*/
|
||||||
QTimer::singleShot(0, [this] { this->adjustSize(); });
|
QTimer::singleShot(0, [this] {
|
||||||
|
this->adjustSize();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickSwitcherPopup::themeChangedEvent()
|
void QuickSwitcherPopup::themeChangedEvent()
|
||||||
|
|
|
@ -119,8 +119,9 @@ void Button::setMenu(std::unique_ptr<QMenu> menu)
|
||||||
new FunctionEventFilter(this, [this](QObject *, QEvent *event) {
|
new FunctionEventFilter(this, [this](QObject *, QEvent *event) {
|
||||||
if (event->type() == QEvent::Hide)
|
if (event->type() == QEvent::Hide)
|
||||||
{
|
{
|
||||||
QTimer::singleShot(20, this,
|
QTimer::singleShot(20, this, [this] {
|
||||||
[this] { this->menuVisible_ = false; });
|
this->menuVisible_ = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}));
|
}));
|
||||||
|
@ -243,7 +244,9 @@ void Button::mousePressEvent(QMouseEvent *event)
|
||||||
|
|
||||||
if (this->menu_ && !this->menuVisible_)
|
if (this->menu_ && !this->menuVisible_)
|
||||||
{
|
{
|
||||||
QTimer::singleShot(80, this, [this] { this->showMenu(); });
|
QTimer::singleShot(80, this, [this] {
|
||||||
|
this->showMenu();
|
||||||
|
});
|
||||||
this->mouseDown_ = false;
|
this->mouseDown_ = false;
|
||||||
this->mouseOver_ = false;
|
this->mouseOver_ = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,9 +71,10 @@ namespace {
|
||||||
auto addImageLink = [&](const ImagePtr &image, char scale) {
|
auto addImageLink = [&](const ImagePtr &image, char scale) {
|
||||||
if (!image->isEmpty())
|
if (!image->isEmpty())
|
||||||
{
|
{
|
||||||
copyMenu->addAction(
|
copyMenu->addAction(QString(scale) + "x link",
|
||||||
QString(scale) + "x link",
|
[url = image->url()] {
|
||||||
[url = image->url()] { crossPlatformCopy(url.string); });
|
crossPlatformCopy(url.string);
|
||||||
|
});
|
||||||
openMenu->addAction(
|
openMenu->addAction(
|
||||||
QString(scale) + "x link", [url = image->url()] {
|
QString(scale) + "x link", [url = image->url()] {
|
||||||
QDesktopServices::openUrl(QUrl(url.string));
|
QDesktopServices::openUrl(QUrl(url.string));
|
||||||
|
@ -90,13 +91,14 @@ namespace {
|
||||||
copyMenu->addSeparator();
|
copyMenu->addSeparator();
|
||||||
openMenu->addSeparator();
|
openMenu->addSeparator();
|
||||||
|
|
||||||
copyMenu->addAction(
|
copyMenu->addAction("Copy " + name + " emote link",
|
||||||
"Copy " + name + " emote link",
|
[url = emote.homePage] {
|
||||||
[url = emote.homePage] { crossPlatformCopy(url.string); });
|
crossPlatformCopy(url.string);
|
||||||
openMenu->addAction(
|
});
|
||||||
"Open " + name + " emote link", [url = emote.homePage] {
|
openMenu->addAction("Open " + name + " emote link",
|
||||||
QDesktopServices::openUrl(QUrl(url.string)); //
|
[url = emote.homePage] {
|
||||||
});
|
QDesktopServices::openUrl(QUrl(url.string));
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (creatorFlags.has(MessageElementFlag::BttvEmote))
|
if (creatorFlags.has(MessageElementFlag::BttvEmote))
|
||||||
|
@ -134,8 +136,9 @@ ChannelView::ChannelView(BaseWidget *parent)
|
||||||
});
|
});
|
||||||
|
|
||||||
auto shortcut = new QShortcut(QKeySequence::StandardKey::Copy, this);
|
auto shortcut = new QShortcut(QKeySequence::StandardKey::Copy, this);
|
||||||
QObject::connect(shortcut, &QShortcut::activated,
|
QObject::connect(shortcut, &QShortcut::activated, [this] {
|
||||||
[this] { crossPlatformCopy(this->getSelectedText()); });
|
crossPlatformCopy(this->getSelectedText());
|
||||||
|
});
|
||||||
|
|
||||||
this->clickTimer_ = new QTimer(this);
|
this->clickTimer_ = new QTimer(this);
|
||||||
this->clickTimer_->setSingleShot(true);
|
this->clickTimer_->setSingleShot(true);
|
||||||
|
@ -181,10 +184,14 @@ void ChannelView::initializeSignals()
|
||||||
}));
|
}));
|
||||||
|
|
||||||
getSettings()->showLastMessageIndicator.connect(
|
getSettings()->showLastMessageIndicator.connect(
|
||||||
[this](auto, auto) { this->update(); }, this->connections_);
|
[this](auto, auto) {
|
||||||
|
this->update();
|
||||||
|
},
|
||||||
|
this->connections_);
|
||||||
|
|
||||||
connections_.push_back(getApp()->windows->gifRepaintRequested.connect(
|
connections_.push_back(getApp()->windows->gifRepaintRequested.connect([&] {
|
||||||
[&] { this->queueUpdate(); }));
|
this->queueUpdate();
|
||||||
|
}));
|
||||||
|
|
||||||
connections_.push_back(
|
connections_.push_back(
|
||||||
getApp()->windows->layoutRequested.connect([&](Channel *channel) {
|
getApp()->windows->layoutRequested.connect([&](Channel *channel) {
|
||||||
|
@ -195,8 +202,9 @@ void ChannelView::initializeSignals()
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
connections_.push_back(
|
connections_.push_back(getApp()->fonts->fontChanged.connect([this] {
|
||||||
getApp()->fonts->fontChanged.connect([this] { this->queueLayout(); }));
|
this->queueLayout();
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChannelView::pausable() const
|
bool ChannelView::pausable() const
|
||||||
|
@ -272,7 +280,9 @@ void ChannelView::updatePauses()
|
||||||
this->queueLayout();
|
this->queueLayout();
|
||||||
}
|
}
|
||||||
else if (std::any_of(this->pauses_.begin(), this->pauses_.end(),
|
else if (std::any_of(this->pauses_.begin(), this->pauses_.end(),
|
||||||
[](auto &&value) { return !value.second; }))
|
[](auto &&value) {
|
||||||
|
return !value.second;
|
||||||
|
}))
|
||||||
{
|
{
|
||||||
/// Some of the pauses are infinite
|
/// Some of the pauses are infinite
|
||||||
this->pauseEnd_ = boost::none;
|
this->pauseEnd_ = boost::none;
|
||||||
|
@ -282,9 +292,10 @@ void ChannelView::updatePauses()
|
||||||
{
|
{
|
||||||
/// Get the maximum pause
|
/// Get the maximum pause
|
||||||
auto pauseEnd =
|
auto pauseEnd =
|
||||||
std::max_element(
|
std::max_element(this->pauses_.begin(), this->pauses_.end(),
|
||||||
this->pauses_.begin(), this->pauses_.end(),
|
[](auto &&a, auto &&b) {
|
||||||
[](auto &&a, auto &&b) { return a.second > b.second; })
|
return a.second > b.second;
|
||||||
|
})
|
||||||
->second.get();
|
->second.get();
|
||||||
|
|
||||||
if (pauseEnd != this->pauseEnd_)
|
if (pauseEnd != this->pauseEnd_)
|
||||||
|
@ -605,11 +616,11 @@ void ChannelView::setChannel(ChannelPtr underlyingChannel)
|
||||||
underlyingChannel->messagesAddedAtStart.connect(
|
underlyingChannel->messagesAddedAtStart.connect(
|
||||||
[this](std::vector<MessagePtr> &messages) {
|
[this](std::vector<MessagePtr> &messages) {
|
||||||
std::vector<MessagePtr> filtered;
|
std::vector<MessagePtr> filtered;
|
||||||
std::copy_if( //
|
std::copy_if(messages.begin(), messages.end(),
|
||||||
messages.begin(), messages.end(),
|
std::back_inserter(filtered),
|
||||||
std::back_inserter(filtered), [this](MessagePtr msg) {
|
[this](MessagePtr msg) {
|
||||||
return this->shouldIncludeMessage(msg);
|
return this->shouldIncludeMessage(msg);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!filtered.empty())
|
if (!filtered.empty())
|
||||||
this->channel_->addMessagesAtStart(filtered);
|
this->channel_->addMessagesAtStart(filtered);
|
||||||
|
@ -689,7 +700,7 @@ void ChannelView::setChannel(ChannelPtr underlyingChannel)
|
||||||
if (auto tc = dynamic_cast<TwitchChannel *>(underlyingChannel.get()))
|
if (auto tc = dynamic_cast<TwitchChannel *>(underlyingChannel.get()))
|
||||||
{
|
{
|
||||||
this->connections_.push_back(tc->liveStatusChanged.connect([this]() {
|
this->connections_.push_back(tc->liveStatusChanged.connect([this]() {
|
||||||
this->liveStatusChanged.invoke(); //
|
this->liveStatusChanged.invoke();
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1813,15 +1824,19 @@ void ChannelView::addContextMenuItems(
|
||||||
QString url = hoveredElement->getLink().value;
|
QString url = hoveredElement->getLink().value;
|
||||||
|
|
||||||
// open link
|
// open link
|
||||||
menu->addAction("Open link",
|
menu->addAction("Open link", [url] {
|
||||||
[url] { QDesktopServices::openUrl(QUrl(url)); });
|
QDesktopServices::openUrl(QUrl(url));
|
||||||
|
});
|
||||||
// open link default
|
// open link default
|
||||||
if (supportsIncognitoLinks())
|
if (supportsIncognitoLinks())
|
||||||
{
|
{
|
||||||
menu->addAction("Open link incognito",
|
menu->addAction("Open link incognito", [url] {
|
||||||
[url] { openLinkIncognito(url); });
|
openLinkIncognito(url);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
menu->addAction("Copy link", [url] { crossPlatformCopy(url); });
|
menu->addAction("Copy link", [url] {
|
||||||
|
crossPlatformCopy(url);
|
||||||
|
});
|
||||||
|
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
}
|
}
|
||||||
|
@ -1829,8 +1844,9 @@ void ChannelView::addContextMenuItems(
|
||||||
// Copy actions
|
// Copy actions
|
||||||
if (!this->selection_.isEmpty())
|
if (!this->selection_.isEmpty())
|
||||||
{
|
{
|
||||||
menu->addAction("Copy selection",
|
menu->addAction("Copy selection", [this] {
|
||||||
[this] { crossPlatformCopy(this->getSelectedText()); });
|
crossPlatformCopy(this->getSelectedText());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
menu->addAction("Copy message", [layout] {
|
menu->addAction("Copy message", [layout] {
|
||||||
|
|
|
@ -16,8 +16,9 @@ DebugPopup::DebugPopup()
|
||||||
auto *timer = new QTimer(this);
|
auto *timer = new QTimer(this);
|
||||||
|
|
||||||
timer->setInterval(300);
|
timer->setInterval(300);
|
||||||
QObject::connect(timer, &QTimer::timeout,
|
QObject::connect(timer, &QTimer::timeout, [text] {
|
||||||
[text] { text->setText(DebugCount::getDebugText()); });
|
text->setText(DebugCount::getDebugText());
|
||||||
|
});
|
||||||
timer->start();
|
timer->start();
|
||||||
|
|
||||||
text->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
|
text->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
|
||||||
|
|
|
@ -36,8 +36,9 @@ EditableModelView::EditableModelView(QAbstractTableModel *model, bool movable)
|
||||||
// add
|
// add
|
||||||
QPushButton *add = new QPushButton("Add");
|
QPushButton *add = new QPushButton("Add");
|
||||||
buttons->addWidget(add);
|
buttons->addWidget(add);
|
||||||
QObject::connect(add, &QPushButton::clicked,
|
QObject::connect(add, &QPushButton::clicked, [this] {
|
||||||
[this] { this->addButtonPressed.invoke(); });
|
this->addButtonPressed.invoke();
|
||||||
|
});
|
||||||
|
|
||||||
// remove
|
// remove
|
||||||
QPushButton *remove = new QPushButton("Remove");
|
QPushButton *remove = new QPushButton("Remove");
|
||||||
|
@ -61,22 +62,25 @@ EditableModelView::EditableModelView(QAbstractTableModel *model, bool movable)
|
||||||
// move up
|
// move up
|
||||||
QPushButton *moveUp = new QPushButton("Move up");
|
QPushButton *moveUp = new QPushButton("Move up");
|
||||||
buttons->addWidget(moveUp);
|
buttons->addWidget(moveUp);
|
||||||
QObject::connect(moveUp, &QPushButton::clicked, this,
|
QObject::connect(moveUp, &QPushButton::clicked, this, [this] {
|
||||||
[this] { this->moveRow(-1); });
|
this->moveRow(-1);
|
||||||
|
});
|
||||||
|
|
||||||
// move down
|
// move down
|
||||||
QPushButton *moveDown = new QPushButton("Move down");
|
QPushButton *moveDown = new QPushButton("Move down");
|
||||||
buttons->addWidget(moveDown);
|
buttons->addWidget(moveDown);
|
||||||
QObject::connect(moveDown, &QPushButton::clicked, this,
|
QObject::connect(moveDown, &QPushButton::clicked, this, [this] {
|
||||||
[this] { this->moveRow(1); });
|
this->moveRow(1);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
buttons->addStretch();
|
buttons->addStretch();
|
||||||
|
|
||||||
QObject::connect(this->model_, &QAbstractTableModel::rowsMoved, this,
|
QObject::connect(this->model_, &QAbstractTableModel::rowsMoved, this,
|
||||||
[this](const QModelIndex &parent, int start, int end,
|
[this](const QModelIndex &parent, int start, int end,
|
||||||
const QModelIndex &destination,
|
const QModelIndex &destination, int row) {
|
||||||
int row) { this->selectRow(row); });
|
this->selectRow(row);
|
||||||
|
});
|
||||||
|
|
||||||
// add tableview
|
// add tableview
|
||||||
vbox->addWidget(this->tableView_);
|
vbox->addWidget(this->tableView_);
|
||||||
|
|
|
@ -46,23 +46,30 @@ NotebookTab::NotebookTab(Notebook *notebook)
|
||||||
getSettings()->showTabCloseButton.connectSimple(
|
getSettings()->showTabCloseButton.connectSimple(
|
||||||
boost::bind(&NotebookTab::hideTabXChanged, this),
|
boost::bind(&NotebookTab::hideTabXChanged, this),
|
||||||
this->managedConnections_);
|
this->managedConnections_);
|
||||||
getSettings()->showTabLive.connect([this](auto, auto) { this->update(); },
|
getSettings()->showTabLive.connect(
|
||||||
this->managedConnections_);
|
[this](auto, auto) {
|
||||||
|
this->update();
|
||||||
|
},
|
||||||
|
this->managedConnections_);
|
||||||
|
|
||||||
this->setMouseTracking(true);
|
this->setMouseTracking(true);
|
||||||
|
|
||||||
this->menu_.addAction("Rename", [this]() { this->showRenameDialog(); });
|
this->menu_.addAction("Rename", [this]() {
|
||||||
|
this->showRenameDialog();
|
||||||
|
});
|
||||||
|
|
||||||
this->menu_.addAction("Close",
|
this->menu_.addAction("Close", [=]() {
|
||||||
[=]() { this->notebook_->removePage(this->page); });
|
this->notebook_->removePage(this->page);
|
||||||
|
});
|
||||||
|
|
||||||
highlightNewMessagesAction_ =
|
highlightNewMessagesAction_ =
|
||||||
new QAction("Enable highlights on new messages", &this->menu_);
|
new QAction("Enable highlights on new messages", &this->menu_);
|
||||||
highlightNewMessagesAction_->setCheckable(true);
|
highlightNewMessagesAction_->setCheckable(true);
|
||||||
highlightNewMessagesAction_->setChecked(highlightEnabled_);
|
highlightNewMessagesAction_->setChecked(highlightEnabled_);
|
||||||
QObject::connect(
|
QObject::connect(highlightNewMessagesAction_, &QAction::triggered,
|
||||||
highlightNewMessagesAction_, &QAction::triggered,
|
[this](bool checked) {
|
||||||
[this](bool checked) { this->highlightEnabled_ = checked; });
|
this->highlightEnabled_ = checked;
|
||||||
|
});
|
||||||
this->menu_.addAction(highlightNewMessagesAction_);
|
this->menu_.addAction(highlightNewMessagesAction_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -559,7 +566,7 @@ void NotebookTab::dragEnterEvent(QDragEnterEvent *event)
|
||||||
void NotebookTab::mouseMoveEvent(QMouseEvent *event)
|
void NotebookTab::mouseMoveEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (getSettings()->showTabCloseButton &&
|
if (getSettings()->showTabCloseButton &&
|
||||||
this->notebook_->getAllowUserTabManagement()) //
|
this->notebook_->getAllowUserTabManagement())
|
||||||
{
|
{
|
||||||
bool overX = this->getXRect().contains(event->pos());
|
bool overX = this->getXRect().contains(event->pos());
|
||||||
|
|
||||||
|
@ -575,7 +582,7 @@ void NotebookTab::mouseMoveEvent(QMouseEvent *event)
|
||||||
QPoint relPoint = this->mapToParent(event->pos());
|
QPoint relPoint = this->mapToParent(event->pos());
|
||||||
|
|
||||||
if (this->mouseDown_ && !this->getDesiredRect().contains(relPoint) &&
|
if (this->mouseDown_ && !this->getDesiredRect().contains(relPoint) &&
|
||||||
this->notebook_->getAllowUserTabManagement()) //
|
this->notebook_->getAllowUserTabManagement())
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
QWidget *clickedPage =
|
QWidget *clickedPage =
|
||||||
|
|
|
@ -21,8 +21,9 @@ ResizingTextEdit::ResizingTextEdit()
|
||||||
|
|
||||||
// Whenever the setting for emote completion changes, force a
|
// Whenever the setting for emote completion changes, force a
|
||||||
// refresh on the completion model the next time "Tab" is pressed
|
// refresh on the completion model the next time "Tab" is pressed
|
||||||
getSettings()->prefixOnlyEmoteCompletion.connect(
|
getSettings()->prefixOnlyEmoteCompletion.connect([this] {
|
||||||
[this] { this->completionInProgress_ = false; });
|
this->completionInProgress_ = false;
|
||||||
|
});
|
||||||
|
|
||||||
this->setFocusPolicy(Qt::ClickFocus);
|
this->setFocusPolicy(Qt::ClickFocus);
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,9 @@ void SearchPopup::initLayout()
|
||||||
this->searchInput_ = new QLineEdit(this);
|
this->searchInput_ = new QLineEdit(this);
|
||||||
layout2->addWidget(this->searchInput_);
|
layout2->addWidget(this->searchInput_);
|
||||||
QObject::connect(this->searchInput_, &QLineEdit::returnPressed,
|
QObject::connect(this->searchInput_, &QLineEdit::returnPressed,
|
||||||
[this] { this->search(); });
|
[this] {
|
||||||
|
this->search();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// SEARCH BUTTON
|
// SEARCH BUTTON
|
||||||
|
@ -117,8 +119,9 @@ void SearchPopup::initLayout()
|
||||||
QPushButton *searchButton = new QPushButton(this);
|
QPushButton *searchButton = new QPushButton(this);
|
||||||
searchButton->setText("Search");
|
searchButton->setText("Search");
|
||||||
layout2->addWidget(searchButton);
|
layout2->addWidget(searchButton);
|
||||||
QObject::connect(searchButton, &QPushButton::clicked,
|
QObject::connect(searchButton, &QPushButton::clicked, [this] {
|
||||||
[this] { this->search(); });
|
this->search();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
layout1->addLayout(layout2);
|
layout1->addLayout(layout2);
|
||||||
|
|
|
@ -71,7 +71,7 @@ ExternalToolsPage::ExternalToolsPage()
|
||||||
|
|
||||||
getSettings()->streamlinkUseCustomPath.connect(
|
getSettings()->streamlinkUseCustomPath.connect(
|
||||||
[=](const auto &value, auto) {
|
[=](const auto &value, auto) {
|
||||||
customPath->setEnabled(value); //
|
customPath->setEnabled(value);
|
||||||
},
|
},
|
||||||
this->managedConnections_);
|
this->managedConnections_);
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,13 +110,22 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||||
getApp()->themes->themeName);
|
getApp()->themes->themeName);
|
||||||
layout.addDropdown<QString>(
|
layout.addDropdown<QString>(
|
||||||
"Font", {"Segoe UI", "Arial", "Choose..."},
|
"Font", {"Segoe UI", "Arial", "Choose..."},
|
||||||
getApp()->fonts->chatFontFamily, [](auto val) { return val; },
|
getApp()->fonts->chatFontFamily,
|
||||||
[this](auto args) { return this->getFont(args); });
|
[](auto val) {
|
||||||
|
return val;
|
||||||
|
},
|
||||||
|
[this](auto args) {
|
||||||
|
return this->getFont(args);
|
||||||
|
});
|
||||||
layout.addDropdown<int>(
|
layout.addDropdown<int>(
|
||||||
"Font size", {"9pt", "10pt", "12pt", "14pt", "16pt", "20pt"},
|
"Font size", {"9pt", "10pt", "12pt", "14pt", "16pt", "20pt"},
|
||||||
getApp()->fonts->chatFontSize,
|
getApp()->fonts->chatFontSize,
|
||||||
[](auto val) { return QString::number(val) + "pt"; },
|
[](auto val) {
|
||||||
[](auto args) { return fuzzyToInt(args.value, 10); });
|
return QString::number(val) + "pt";
|
||||||
|
},
|
||||||
|
[](auto args) {
|
||||||
|
return fuzzyToInt(args.value, 10);
|
||||||
|
});
|
||||||
layout.addDropdown<float>(
|
layout.addDropdown<float>(
|
||||||
"Zoom",
|
"Zoom",
|
||||||
{"0.5x", "0.6x", "0.7x", "0.8x", "0.9x", "Default", "1.2x", "1.4x",
|
{"0.5x", "0.6x", "0.7x", "0.8x", "0.9x", "Default", "1.2x", "1.4x",
|
||||||
|
@ -128,7 +137,9 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||||
else
|
else
|
||||||
return QString::number(val) + "x";
|
return QString::number(val) + "x";
|
||||||
},
|
},
|
||||||
[](auto args) { return fuzzyToFloat(args.value, 1.f); });
|
[](auto args) {
|
||||||
|
return fuzzyToFloat(args.value, 1.f);
|
||||||
|
});
|
||||||
layout.addDropdown<int>(
|
layout.addDropdown<int>(
|
||||||
"Tab layout", {"Horizontal", "Vertical"}, s.tabDirection,
|
"Tab layout", {"Horizontal", "Vertical"}, s.tabDirection,
|
||||||
[](auto val) {
|
[](auto val) {
|
||||||
|
@ -201,7 +212,9 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||||
else
|
else
|
||||||
return QString::number(val) + "x";
|
return QString::number(val) + "x";
|
||||||
},
|
},
|
||||||
[](auto args) { return fuzzyToFloat(args.value, 1.f); });
|
[](auto args) {
|
||||||
|
return fuzzyToFloat(args.value, 1.f);
|
||||||
|
});
|
||||||
layout.addCheckbox("Smooth scrolling", s.enableSmoothScrolling);
|
layout.addCheckbox("Smooth scrolling", s.enableSmoothScrolling);
|
||||||
layout.addCheckbox("Smooth scrolling on new messages",
|
layout.addCheckbox("Smooth scrolling on new messages",
|
||||||
s.enableSmoothScrollingNewMessages);
|
s.enableSmoothScrollingNewMessages);
|
||||||
|
@ -266,7 +279,9 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||||
[](auto val) {
|
[](auto val) {
|
||||||
return val ? QString::number(val) + " lines" : QString("Never");
|
return val ? QString::number(val) + " lines" : QString("Never");
|
||||||
},
|
},
|
||||||
[](auto args) { return fuzzyToInt(args.value, 0); });
|
[](auto args) {
|
||||||
|
return fuzzyToInt(args.value, 0);
|
||||||
|
});
|
||||||
|
|
||||||
layout.addTitle("Emotes");
|
layout.addTitle("Emotes");
|
||||||
layout.addCheckbox("Enable", s.enableEmoteImages);
|
layout.addCheckbox("Enable", s.enableEmoteImages);
|
||||||
|
@ -284,12 +299,20 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||||
else
|
else
|
||||||
return QString::number(val) + "x";
|
return QString::number(val) + "x";
|
||||||
},
|
},
|
||||||
[](auto args) { return fuzzyToFloat(args.value, 1.f); });
|
[](auto args) {
|
||||||
|
return fuzzyToFloat(args.value, 1.f);
|
||||||
|
});
|
||||||
|
|
||||||
layout.addDropdown<int>(
|
layout.addDropdown<int>(
|
||||||
"Show info on hover", {"Don't show", "Always show", "Hold shift"},
|
"Show info on hover", {"Don't show", "Always show", "Hold shift"},
|
||||||
s.emotesTooltipPreview, [](int index) { return index; },
|
s.emotesTooltipPreview,
|
||||||
[](auto args) { return args.index; }, false);
|
[](int index) {
|
||||||
|
return index;
|
||||||
|
},
|
||||||
|
[](auto args) {
|
||||||
|
return args.index;
|
||||||
|
},
|
||||||
|
false);
|
||||||
layout.addDropdown("Emoji style",
|
layout.addDropdown("Emoji style",
|
||||||
{"EmojiOne 2", "EmojiOne 3", "Twitter", "Facebook",
|
{"EmojiOne 2", "EmojiOne 3", "Twitter", "Facebook",
|
||||||
"Apple", "Google", "Messenger"},
|
"Apple", "Google", "Messenger"},
|
||||||
|
@ -304,7 +327,10 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||||
ComboBox *dankDropdown =
|
ComboBox *dankDropdown =
|
||||||
layout.addDropdown<std::underlying_type<StreamerModeSetting>::type>(
|
layout.addDropdown<std::underlying_type<StreamerModeSetting>::type>(
|
||||||
"Enable Streamer Mode", {"No", "Yes", "Detect OBS (Windows only)"},
|
"Enable Streamer Mode", {"No", "Yes", "Detect OBS (Windows only)"},
|
||||||
s.enableStreamerMode, [](int value) { return value; },
|
s.enableStreamerMode,
|
||||||
|
[](int value) {
|
||||||
|
return value;
|
||||||
|
},
|
||||||
[](DropdownArgs args) {
|
[](DropdownArgs args) {
|
||||||
return static_cast<StreamerModeSetting>(args.index);
|
return static_cast<StreamerModeSetting>(args.index);
|
||||||
},
|
},
|
||||||
|
@ -445,8 +471,9 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||||
box->addWidget(layout.makeButton("Choose cache path", [this]() {
|
box->addWidget(layout.makeButton("Choose cache path", [this]() {
|
||||||
getSettings()->cachePath = QFileDialog::getExistingDirectory(this);
|
getSettings()->cachePath = QFileDialog::getExistingDirectory(this);
|
||||||
}));
|
}));
|
||||||
box->addWidget(layout.makeButton(
|
box->addWidget(layout.makeButton("Reset", []() {
|
||||||
"Reset", []() { getSettings()->cachePath = ""; }));
|
getSettings()->cachePath = "";
|
||||||
|
}));
|
||||||
box->addStretch(1);
|
box->addStretch(1);
|
||||||
|
|
||||||
layout.addLayout(box);
|
layout.addLayout(box);
|
||||||
|
@ -471,21 +498,36 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||||
layout.addCheckbox("Receive notification sounds from hidden messages",
|
layout.addCheckbox("Receive notification sounds from hidden messages",
|
||||||
s.shownSimilarTriggerHighlights);
|
s.shownSimilarTriggerHighlights);
|
||||||
s.hideSimilar.connect(
|
s.hideSimilar.connect(
|
||||||
[]() { getApp()->windows->forceLayoutChannelViews(); }, false);
|
[]() {
|
||||||
|
getApp()->windows->forceLayoutChannelViews();
|
||||||
|
},
|
||||||
|
false);
|
||||||
layout.addDropdown<float>(
|
layout.addDropdown<float>(
|
||||||
"Similarity threshold", {"0.5", "0.75", "0.9"}, s.similarityPercentage,
|
"Similarity threshold", {"0.5", "0.75", "0.9"}, s.similarityPercentage,
|
||||||
[](auto val) { return QString::number(val); },
|
[](auto val) {
|
||||||
[](auto args) { return fuzzyToFloat(args.value, 0.9f); });
|
return QString::number(val);
|
||||||
|
},
|
||||||
|
[](auto args) {
|
||||||
|
return fuzzyToFloat(args.value, 0.9f);
|
||||||
|
});
|
||||||
layout.addDropdown<int>(
|
layout.addDropdown<int>(
|
||||||
"Maximum delay between messages",
|
"Maximum delay between messages",
|
||||||
{"5s", "10s", "15s", "30s", "60s", "120s"}, s.hideSimilarMaxDelay,
|
{"5s", "10s", "15s", "30s", "60s", "120s"}, s.hideSimilarMaxDelay,
|
||||||
[](auto val) { return QString::number(val) + "s"; },
|
[](auto val) {
|
||||||
[](auto args) { return fuzzyToInt(args.value, 5); });
|
return QString::number(val) + "s";
|
||||||
|
},
|
||||||
|
[](auto args) {
|
||||||
|
return fuzzyToInt(args.value, 5);
|
||||||
|
});
|
||||||
layout.addDropdown<int>(
|
layout.addDropdown<int>(
|
||||||
"Amount of previous messages to check", {"1", "2", "3", "4", "5"},
|
"Amount of previous messages to check", {"1", "2", "3", "4", "5"},
|
||||||
s.hideSimilarMaxMessagesToCheck,
|
s.hideSimilarMaxMessagesToCheck,
|
||||||
[](auto val) { return QString::number(val); },
|
[](auto val) {
|
||||||
[](auto args) { return fuzzyToInt(args.value, 3); });
|
return QString::number(val);
|
||||||
|
},
|
||||||
|
[](auto args) {
|
||||||
|
return fuzzyToInt(args.value, 3);
|
||||||
|
});
|
||||||
|
|
||||||
layout.addSubtitle("Visible badges");
|
layout.addSubtitle("Visible badges");
|
||||||
layout.addCheckbox("Authority (staff, admin)",
|
layout.addCheckbox("Authority (staff, admin)",
|
||||||
|
@ -540,7 +582,9 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||||
else
|
else
|
||||||
return QString::number(val);
|
return QString::number(val);
|
||||||
},
|
},
|
||||||
[](auto args) { return fuzzyToFloat(args.value, 63.f); });
|
[](auto args) {
|
||||||
|
return fuzzyToFloat(args.value, 63.f);
|
||||||
|
});
|
||||||
layout.addCheckbox("Double click to open links and other elements in chat",
|
layout.addCheckbox("Double click to open links and other elements in chat",
|
||||||
s.linksDoubleClickOnly);
|
s.linksDoubleClickOnly);
|
||||||
layout.addCheckbox("Unshorten links", s.unshortLinks);
|
layout.addCheckbox("Unshorten links", s.unshortLinks);
|
||||||
|
@ -563,8 +607,14 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||||
s.showUnhandledIrcMessages);
|
s.showUnhandledIrcMessages);
|
||||||
layout.addDropdown<int>(
|
layout.addDropdown<int>(
|
||||||
"Stack timeouts", {"Stack", "Stack until timeout", "Don't stack"},
|
"Stack timeouts", {"Stack", "Stack until timeout", "Don't stack"},
|
||||||
s.timeoutStackStyle, [](int index) { return index; },
|
s.timeoutStackStyle,
|
||||||
[](auto args) { return args.index; }, false);
|
[](int index) {
|
||||||
|
return index;
|
||||||
|
},
|
||||||
|
[](auto args) {
|
||||||
|
return args.index;
|
||||||
|
},
|
||||||
|
false);
|
||||||
layout.addCheckbox("Combine multiple bit tips into one", s.stackBits);
|
layout.addCheckbox("Combine multiple bit tips into one", s.stackBits);
|
||||||
layout.addCheckbox("Ask for confirmation when uploading an image",
|
layout.addCheckbox("Ask for confirmation when uploading an image",
|
||||||
s.askOnImageUpload);
|
s.askOnImageUpload);
|
||||||
|
|
|
@ -27,7 +27,9 @@ GeneralPageView::GeneralPageView(QWidget *parent)
|
||||||
{scrollArea, new QSpacerItem(16, 1), navigation}));
|
{scrollArea, new QSpacerItem(16, 1), navigation}));
|
||||||
|
|
||||||
QObject::connect(scrollArea->verticalScrollBar(), &QScrollBar::valueChanged,
|
QObject::connect(scrollArea->verticalScrollBar(), &QScrollBar::valueChanged,
|
||||||
this, [=] { this->updateNavigationHighlighting(); });
|
this, [=] {
|
||||||
|
this->updateNavigationHighlighting();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralPageView::addWidget(QWidget *widget)
|
void GeneralPageView::addWidget(QWidget *widget)
|
||||||
|
@ -96,9 +98,10 @@ QCheckBox *GeneralPageView::addCheckbox(const QString &text,
|
||||||
this->managedConnections_);
|
this->managedConnections_);
|
||||||
|
|
||||||
// update setting on toggle
|
// update setting on toggle
|
||||||
QObject::connect(
|
QObject::connect(check, &QCheckBox::toggled, this,
|
||||||
check, &QCheckBox::toggled, this,
|
[&setting, inverse](bool state) {
|
||||||
[&setting, inverse](bool state) { setting = inverse ^ state; });
|
setting = inverse ^ state;
|
||||||
|
});
|
||||||
|
|
||||||
this->addWidget(check);
|
this->addWidget(check);
|
||||||
|
|
||||||
|
@ -141,7 +144,9 @@ ComboBox *GeneralPageView::addDropdown(
|
||||||
|
|
||||||
// update when setting changes
|
// update when setting changes
|
||||||
setting.connect(
|
setting.connect(
|
||||||
[combo](const QString &value, auto) { combo->setCurrentText(value); },
|
[combo](const QString &value, auto) {
|
||||||
|
combo->setCurrentText(value);
|
||||||
|
},
|
||||||
this->managedConnections_);
|
this->managedConnections_);
|
||||||
|
|
||||||
QObject::connect(combo, &QComboBox::currentTextChanged,
|
QObject::connect(combo, &QComboBox::currentTextChanged,
|
||||||
|
|
|
@ -86,8 +86,9 @@ void addUsersTab(IgnoresPage &page, LayoutCreator<QVBoxLayout> users,
|
||||||
|
|
||||||
auto &setting = getSettings()->showIgnoredUsersMessages;
|
auto &setting = getSettings()->showIgnoredUsersMessages;
|
||||||
|
|
||||||
setting.connect(
|
setting.connect([combo](const int value) {
|
||||||
[combo](const int value) { combo->setCurrentIndex(value); });
|
combo->setCurrentIndex(value);
|
||||||
|
});
|
||||||
|
|
||||||
QObject::connect(combo,
|
QObject::connect(combo,
|
||||||
QOverload<int>::of(&QComboBox::currentIndexChanged),
|
QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||||
|
|
|
@ -120,21 +120,23 @@ ModerationPage::ModerationPage()
|
||||||
|
|
||||||
// Show how big (size-wise) the logs are
|
// Show how big (size-wise) the logs are
|
||||||
auto logsPathSizeLabel = logs.emplace<QLabel>();
|
auto logsPathSizeLabel = logs.emplace<QLabel>();
|
||||||
logsPathSizeLabel->setText(
|
logsPathSizeLabel->setText(QtConcurrent::run([] {
|
||||||
QtConcurrent::run([] { return fetchLogDirectorySize(); }));
|
return fetchLogDirectorySize();
|
||||||
|
}));
|
||||||
|
|
||||||
// Select event
|
// Select event
|
||||||
QObject::connect(
|
QObject::connect(selectDir.getElement(), &QPushButton::clicked, this,
|
||||||
selectDir.getElement(), &QPushButton::clicked, this,
|
[this, logsPathSizeLabel]() mutable {
|
||||||
[this, logsPathSizeLabel]() mutable {
|
auto dirName =
|
||||||
auto dirName = QFileDialog::getExistingDirectory(this);
|
QFileDialog::getExistingDirectory(this);
|
||||||
|
|
||||||
getSettings()->logPath = dirName;
|
getSettings()->logPath = dirName;
|
||||||
|
|
||||||
// Refresh: Show how big (size-wise) the logs are
|
// Refresh: Show how big (size-wise) the logs are
|
||||||
logsPathSizeLabel->setText(
|
logsPathSizeLabel->setText(QtConcurrent::run([] {
|
||||||
QtConcurrent::run([] { return fetchLogDirectorySize(); }));
|
return fetchLogDirectorySize();
|
||||||
});
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
buttons->addSpacing(16);
|
buttons->addSpacing(16);
|
||||||
|
|
||||||
|
@ -144,8 +146,9 @@ ModerationPage::ModerationPage()
|
||||||
getSettings()->logPath = "";
|
getSettings()->logPath = "";
|
||||||
|
|
||||||
// Refresh: Show how big (size-wise) the logs are
|
// Refresh: Show how big (size-wise) the logs are
|
||||||
logsPathSizeLabel->setText(QtConcurrent::run(
|
logsPathSizeLabel->setText(QtConcurrent::run([] {
|
||||||
[] { return fetchLogDirectorySize(); }));
|
return fetchLogDirectorySize();
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
} // logs end
|
} // logs end
|
||||||
|
|
|
@ -96,7 +96,7 @@ QCheckBox *SettingsPage::createCheckBox(
|
||||||
// update when setting changes
|
// update when setting changes
|
||||||
setting.connect(
|
setting.connect(
|
||||||
[checkbox](const bool &value, auto) {
|
[checkbox](const bool &value, auto) {
|
||||||
checkbox->setChecked(value); //
|
checkbox->setChecked(value);
|
||||||
},
|
},
|
||||||
this->managedConnections_);
|
this->managedConnections_);
|
||||||
|
|
||||||
|
@ -120,12 +120,15 @@ QComboBox *SettingsPage::createComboBox(
|
||||||
|
|
||||||
// update when setting changes
|
// update when setting changes
|
||||||
setting.connect(
|
setting.connect(
|
||||||
[combo](const QString &value, auto) { combo->setCurrentText(value); },
|
[combo](const QString &value, auto) {
|
||||||
|
combo->setCurrentText(value);
|
||||||
|
},
|
||||||
this->managedConnections_);
|
this->managedConnections_);
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(combo, &QComboBox::currentTextChanged,
|
||||||
combo, &QComboBox::currentTextChanged,
|
[&setting](const QString &newValue) {
|
||||||
[&setting](const QString &newValue) { setting = newValue; });
|
setting = newValue;
|
||||||
|
});
|
||||||
|
|
||||||
return combo;
|
return combo;
|
||||||
}
|
}
|
||||||
|
@ -138,9 +141,10 @@ QLineEdit *SettingsPage::createLineEdit(
|
||||||
edit->setText(setting);
|
edit->setText(setting);
|
||||||
|
|
||||||
// update when setting changes
|
// update when setting changes
|
||||||
QObject::connect(
|
QObject::connect(edit, &QLineEdit::textChanged,
|
||||||
edit, &QLineEdit::textChanged,
|
[&setting](const QString &newValue) {
|
||||||
[&setting](const QString &newValue) { setting = newValue; });
|
setting = newValue;
|
||||||
|
});
|
||||||
|
|
||||||
return edit;
|
return edit;
|
||||||
}
|
}
|
||||||
|
@ -153,9 +157,13 @@ QSpinBox *SettingsPage::createSpinBox(pajlada::Settings::Setting<int> &setting,
|
||||||
w->setMinimum(min);
|
w->setMinimum(min);
|
||||||
w->setMaximum(max);
|
w->setMaximum(max);
|
||||||
|
|
||||||
setting.connect([w](const int &value, auto) { w->setValue(value); });
|
setting.connect([w](const int &value, auto) {
|
||||||
|
w->setValue(value);
|
||||||
|
});
|
||||||
QObject::connect(w, QOverload<int>::of(&QSpinBox::valueChanged),
|
QObject::connect(w, QOverload<int>::of(&QSpinBox::valueChanged),
|
||||||
[&setting](int value) { setting.setValue(value); });
|
[&setting](int value) {
|
||||||
|
setting.setValue(value);
|
||||||
|
});
|
||||||
|
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,11 @@ std::vector<ClosedSplits::SplitInfo> ClosedSplits::closedSplits_;
|
||||||
void ClosedSplits::invalidateTab(NotebookTab *const tab)
|
void ClosedSplits::invalidateTab(NotebookTab *const tab)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lk(ClosedSplits::m_);
|
std::lock_guard<std::mutex> lk(ClosedSplits::m_);
|
||||||
auto it = std::find_if(
|
auto it = std::find_if(ClosedSplits::closedSplits_.begin(),
|
||||||
ClosedSplits::closedSplits_.begin(), ClosedSplits::closedSplits_.end(),
|
ClosedSplits::closedSplits_.end(),
|
||||||
[tab](const auto &item) -> bool { return item.tab == tab; });
|
[tab](const auto &item) -> bool {
|
||||||
|
return item.tab == tab;
|
||||||
|
});
|
||||||
if (it == ClosedSplits::closedSplits_.end())
|
if (it == ClosedSplits::closedSplits_.end())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -66,7 +66,9 @@ void EmoteInputPopup::initLayout()
|
||||||
|
|
||||||
listView->setModel(&this->model_);
|
listView->setModel(&this->model_);
|
||||||
QObject::connect(listView.getElement(), &GenericListView::closeRequested,
|
QObject::connect(listView.getElement(), &GenericListView::closeRequested,
|
||||||
this, [this] { this->close(); });
|
this, [this] {
|
||||||
|
this->close();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmoteInputPopup::updateEmotes(const QString &text, ChannelPtr channel)
|
void EmoteInputPopup::updateEmotes(const QString &text, ChannelPtr channel)
|
||||||
|
|
|
@ -134,11 +134,12 @@ Split::Split(QWidget *parent)
|
||||||
this->input_->ui_.textEdit->installEventFilter(parent);
|
this->input_->ui_.textEdit->installEventFilter(parent);
|
||||||
|
|
||||||
this->signalHolder_.managedConnect(
|
this->signalHolder_.managedConnect(
|
||||||
getApp()->accounts->twitch.currentUserChanged,
|
getApp()->accounts->twitch.currentUserChanged, [this] {
|
||||||
[this] { this->onAccountSelected(); });
|
this->onAccountSelected();
|
||||||
|
});
|
||||||
this->onAccountSelected();
|
this->onAccountSelected();
|
||||||
|
|
||||||
this->view_->mouseDown.connect([this](QMouseEvent *) { //
|
this->view_->mouseDown.connect([this](QMouseEvent *) {
|
||||||
this->giveFocus(Qt::MouseFocusReason);
|
this->giveFocus(Qt::MouseFocusReason);
|
||||||
});
|
});
|
||||||
this->view_->selectionChanged.connect([this]() {
|
this->view_->selectionChanged.connect([this]() {
|
||||||
|
@ -212,10 +213,12 @@ Split::Split(QWidget *parent)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this->input_->ui_.textEdit->focused.connect(
|
this->input_->ui_.textEdit->focused.connect([this] {
|
||||||
[this] { this->focused.invoke(); });
|
this->focused.invoke();
|
||||||
this->input_->ui_.textEdit->focusLost.connect(
|
});
|
||||||
[this] { this->focusLost.invoke(); });
|
this->input_->ui_.textEdit->focusLost.connect([this] {
|
||||||
|
this->focusLost.invoke();
|
||||||
|
});
|
||||||
this->input_->ui_.textEdit->imagePasted.connect(
|
this->input_->ui_.textEdit->imagePasted.connect(
|
||||||
[this](const QMimeData *source) {
|
[this](const QMimeData *source) {
|
||||||
if (!getSettings()->imageUploaderEnabled)
|
if (!getSettings()->imageUploaderEnabled)
|
||||||
|
@ -249,7 +252,9 @@ Split::Split(QWidget *parent)
|
||||||
});
|
});
|
||||||
|
|
||||||
getSettings()->imageUploaderEnabled.connect(
|
getSettings()->imageUploaderEnabled.connect(
|
||||||
[this](const bool &val) { this->setAcceptDrops(val); },
|
[this](const bool &val) {
|
||||||
|
this->setAcceptDrops(val);
|
||||||
|
},
|
||||||
this->managedConnections_);
|
this->managedConnections_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +311,7 @@ void Split::onAccountSelected()
|
||||||
|
|
||||||
this->updateTooltipColor();
|
this->updateTooltipColor();
|
||||||
this->signalHolder_.managedConnect(this->theme->updated, [this]() {
|
this->signalHolder_.managedConnect(this->theme->updated, [this]() {
|
||||||
this->updateTooltipColor(); //
|
this->updateTooltipColor();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,13 +352,16 @@ void Split::setChannel(IndirectChannel newChannel)
|
||||||
this->header_->updateRoomModes();
|
this->header_->updateRoomModes();
|
||||||
});
|
});
|
||||||
|
|
||||||
this->roomModeChangedConnection_ = tc->roomModesChanged.connect(
|
this->roomModeChangedConnection_ = tc->roomModesChanged.connect([this] {
|
||||||
[this] { this->header_->updateRoomModes(); });
|
this->header_->updateRoomModes();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this->indirectChannelChangedConnection_ =
|
this->indirectChannelChangedConnection_ =
|
||||||
newChannel.getChannelChanged().connect([this] { //
|
newChannel.getChannelChanged().connect([this] {
|
||||||
QTimer::singleShot(0, [this] { this->setChannel(this->channel_); });
|
QTimer::singleShot(0, [this] {
|
||||||
|
this->setChannel(this->channel_);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this->header_->updateModerationModeIcon();
|
this->header_->updateModerationModeIcon();
|
||||||
|
@ -544,8 +552,9 @@ void Split::deleteFromContainer()
|
||||||
{
|
{
|
||||||
this->container_->deleteSplit(this);
|
this->container_->deleteSplit(this);
|
||||||
auto *tab = this->getContainer()->getTab();
|
auto *tab = this->getContainer()->getTab();
|
||||||
tab->connect(tab, &QWidget::destroyed,
|
tab->connect(tab, &QWidget::destroyed, [tab]() mutable {
|
||||||
[tab]() mutable { ClosedSplits::invalidateTab(tab); });
|
ClosedSplits::invalidateTab(tab);
|
||||||
|
});
|
||||||
ClosedSplits::push({this->getChannel()->getName(), tab});
|
ClosedSplits::push({this->getChannel()->getName(), tab});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -747,8 +756,9 @@ void Split::showViewerList()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
QObject::connect(viewerDock, &QDockWidget::topLevelChanged, this,
|
QObject::connect(viewerDock, &QDockWidget::topLevelChanged, this, [=]() {
|
||||||
[=]() { viewerDock->setMinimumWidth(300); });
|
viewerDock->setMinimumWidth(300);
|
||||||
|
});
|
||||||
|
|
||||||
auto listDoubleClick = [=](QString userName) {
|
auto listDoubleClick = [=](QString userName) {
|
||||||
if (!labels.contains(userName) && !userName.isEmpty())
|
if (!labels.contains(userName) && !userName.isEmpty())
|
||||||
|
|
|
@ -220,10 +220,12 @@ void SplitContainer::addSplit(Split *split)
|
||||||
});
|
});
|
||||||
|
|
||||||
split->getChannelView().liveStatusChanged.connect([this]() {
|
split->getChannelView().liveStatusChanged.connect([this]() {
|
||||||
this->refreshTabLiveStatus(); //
|
this->refreshTabLiveStatus();
|
||||||
});
|
});
|
||||||
|
|
||||||
split->focused.connect([this, split] { this->setSelected(split); });
|
split->focused.connect([this, split] {
|
||||||
|
this->setSelected(split);
|
||||||
|
});
|
||||||
|
|
||||||
this->layout();
|
this->layout();
|
||||||
}
|
}
|
||||||
|
@ -318,9 +320,10 @@ void SplitContainer::selectSplitRecursive(Node *node, Direction direction)
|
||||||
{
|
{
|
||||||
auto &siblings = node->parent_->children_;
|
auto &siblings = node->parent_->children_;
|
||||||
|
|
||||||
auto it = std::find_if(
|
auto it = std::find_if(siblings.begin(), siblings.end(),
|
||||||
siblings.begin(), siblings.end(),
|
[node](const auto &other) {
|
||||||
[node](const auto &other) { return other.get() == node; });
|
return other.get() == node;
|
||||||
|
});
|
||||||
assert(it != siblings.end());
|
assert(it != siblings.end());
|
||||||
|
|
||||||
if (direction == Direction::Left || direction == Direction::Above)
|
if (direction == Direction::Left || direction == Direction::Above)
|
||||||
|
@ -993,8 +996,10 @@ void SplitContainer::Node::insertNextToThis(Split *_split, Direction _direction)
|
||||||
this->geometry_ = QRect(0, 0, int(width), int(height));
|
this->geometry_ = QRect(0, 0, int(width), int(height));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto it = std::find_if(siblings.begin(), siblings.end(),
|
auto it =
|
||||||
[this](auto &node) { return this == node.get(); });
|
std::find_if(siblings.begin(), siblings.end(), [this](auto &node) {
|
||||||
|
return this == node.get();
|
||||||
|
});
|
||||||
|
|
||||||
assert(it != siblings.end());
|
assert(it != siblings.end());
|
||||||
if (_direction == Direction::Right || _direction == Direction::Below)
|
if (_direction == Direction::Right || _direction == Direction::Below)
|
||||||
|
@ -1035,8 +1040,9 @@ SplitContainer::Position SplitContainer::Node::releaseSplit()
|
||||||
auto &siblings = this->parent_->children_;
|
auto &siblings = this->parent_->children_;
|
||||||
|
|
||||||
auto it =
|
auto it =
|
||||||
std::find_if(begin(siblings), end(siblings),
|
std::find_if(begin(siblings), end(siblings), [this](auto &node) {
|
||||||
[this](auto &node) { return this == node.get(); });
|
return this == node.get();
|
||||||
|
});
|
||||||
assert(it != siblings.end());
|
assert(it != siblings.end());
|
||||||
|
|
||||||
Position position;
|
Position position;
|
||||||
|
|
|
@ -191,15 +191,23 @@ SplitHeader::SplitHeader(Split *_split)
|
||||||
this->handleChannelChanged();
|
this->handleChannelChanged();
|
||||||
this->updateModerationModeIcon();
|
this->updateModerationModeIcon();
|
||||||
|
|
||||||
this->split_->focused.connect([this]() { this->themeChangedEvent(); });
|
this->split_->focused.connect([this]() {
|
||||||
this->split_->focusLost.connect([this]() { this->themeChangedEvent(); });
|
this->themeChangedEvent();
|
||||||
this->split_->channelChanged.connect(
|
});
|
||||||
[this]() { this->handleChannelChanged(); });
|
this->split_->focusLost.connect([this]() {
|
||||||
|
this->themeChangedEvent();
|
||||||
|
});
|
||||||
|
this->split_->channelChanged.connect([this]() {
|
||||||
|
this->handleChannelChanged();
|
||||||
|
});
|
||||||
|
|
||||||
this->managedConnect(getApp()->accounts->twitch.currentUserChanged,
|
this->managedConnect(getApp()->accounts->twitch.currentUserChanged, [this] {
|
||||||
[this] { this->updateModerationModeIcon(); });
|
this->updateModerationModeIcon();
|
||||||
|
});
|
||||||
|
|
||||||
auto _ = [this](const auto &, const auto &) { this->updateChannelText(); };
|
auto _ = [this](const auto &, const auto &) {
|
||||||
|
this->updateChannelText();
|
||||||
|
};
|
||||||
getSettings()->headerViewerCount.connect(_, this->managedConnections_);
|
getSettings()->headerViewerCount.connect(_, this->managedConnections_);
|
||||||
getSettings()->headerStreamTitle.connect(_, this->managedConnections_);
|
getSettings()->headerStreamTitle.connect(_, this->managedConnections_);
|
||||||
getSettings()->headerGame.connect(_, this->managedConnections_);
|
getSettings()->headerGame.connect(_, this->managedConnections_);
|
||||||
|
@ -210,8 +218,9 @@ void SplitHeader::initializeLayout()
|
||||||
{
|
{
|
||||||
auto layout = makeLayout<QHBoxLayout>({
|
auto layout = makeLayout<QHBoxLayout>({
|
||||||
// space
|
// space
|
||||||
makeWidget<BaseWidget>(
|
makeWidget<BaseWidget>([](auto w) {
|
||||||
[](auto w) { w->setScaleIndependantSize(8, 4); }),
|
w->setScaleIndependantSize(8, 4);
|
||||||
|
}),
|
||||||
// title
|
// title
|
||||||
this->titleLabel_ = makeWidget<Label>([](auto w) {
|
this->titleLabel_ = makeWidget<Label>([](auto w) {
|
||||||
w->setSizePolicy(QSizePolicy::MinimumExpanding,
|
w->setSizePolicy(QSizePolicy::MinimumExpanding,
|
||||||
|
@ -220,8 +229,9 @@ void SplitHeader::initializeLayout()
|
||||||
w->setHasOffset(false);
|
w->setHasOffset(false);
|
||||||
}),
|
}),
|
||||||
// space
|
// space
|
||||||
makeWidget<BaseWidget>(
|
makeWidget<BaseWidget>([](auto w) {
|
||||||
[](auto w) { w->setScaleIndependantSize(8, 4); }),
|
w->setScaleIndependantSize(8, 4);
|
||||||
|
}),
|
||||||
// mode
|
// mode
|
||||||
this->modeButton_ = makeWidget<EffectLabel>([&](auto w) {
|
this->modeButton_ = makeWidget<EffectLabel>([&](auto w) {
|
||||||
w->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
w->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||||
|
@ -266,8 +276,9 @@ void SplitHeader::initializeLayout()
|
||||||
}),
|
}),
|
||||||
// viewer list
|
// viewer list
|
||||||
this->viewersButton_ = makeWidget<Button>([&](auto w) {
|
this->viewersButton_ = makeWidget<Button>([&](auto w) {
|
||||||
QObject::connect(w, &Button::leftClicked, this,
|
QObject::connect(w, &Button::leftClicked, this, [this]() {
|
||||||
[this]() { this->split_->showViewerList(); });
|
this->split_->showViewerList();
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
// dropdown
|
// dropdown
|
||||||
this->dropdownButton_ = makeWidget<Button>([&](auto w) {
|
this->dropdownButton_ = makeWidget<Button>([&](auto w) {
|
||||||
|
@ -281,8 +292,9 @@ void SplitHeader::initializeLayout()
|
||||||
w->setPixmap(getResources().buttons.addSplitDark);
|
w->setPixmap(getResources().buttons.addSplitDark);
|
||||||
w->setEnableMargin(false);
|
w->setEnableMargin(false);
|
||||||
|
|
||||||
QObject::connect(w, &Button::leftClicked, this,
|
QObject::connect(w, &Button::leftClicked, this, [this]() {
|
||||||
[this]() { this->split_->addSibling(); });
|
this->split_->addSibling();
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -476,7 +488,7 @@ std::unique_ptr<QMenu> SplitHeader::createChatModeMenu()
|
||||||
menu->addAction(setR9k);
|
menu->addAction(setR9k);
|
||||||
menu->addAction(setFollowers);
|
menu->addAction(setFollowers);
|
||||||
|
|
||||||
this->managedConnections_.push_back(this->modeUpdateRequested_.connect( //
|
this->managedConnections_.push_back(this->modeUpdateRequested_.connect(
|
||||||
[this, setSub, setEmote, setSlow, setR9k, setFollowers]() {
|
[this, setSub, setEmote, setSlow, setR9k, setFollowers]() {
|
||||||
auto twitchChannel =
|
auto twitchChannel =
|
||||||
dynamic_cast<TwitchChannel *>(this->split_->getChannel().get());
|
dynamic_cast<TwitchChannel *>(this->split_->getChannel().get());
|
||||||
|
@ -501,13 +513,15 @@ std::unique_ptr<QMenu> SplitHeader::createChatModeMenu()
|
||||||
action->setChecked(!action->isChecked());
|
action->setChecked(!action->isChecked());
|
||||||
};
|
};
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(setSub, &QAction::triggered, this,
|
||||||
setSub, &QAction::triggered, this,
|
[setSub, toggle]() mutable {
|
||||||
[setSub, toggle]() mutable { toggle("/subscribers", setSub); });
|
toggle("/subscribers", setSub);
|
||||||
|
});
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(setEmote, &QAction::triggered, this,
|
||||||
setEmote, &QAction::triggered, this,
|
[setEmote, toggle]() mutable {
|
||||||
[setEmote, toggle]() mutable { toggle("/emoteonly", setEmote); });
|
toggle("/emoteonly", setEmote);
|
||||||
|
});
|
||||||
|
|
||||||
QObject::connect(setSlow, &QAction::triggered, this, [setSlow, this]() {
|
QObject::connect(setSlow, &QAction::triggered, this, [setSlow, this]() {
|
||||||
if (!setSlow->isChecked())
|
if (!setSlow->isChecked())
|
||||||
|
@ -554,9 +568,10 @@ std::unique_ptr<QMenu> SplitHeader::createChatModeMenu()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(setR9k, &QAction::triggered, this,
|
||||||
setR9k, &QAction::triggered, this,
|
[setR9k, toggle]() mutable {
|
||||||
[setR9k, toggle]() mutable { toggle("/r9kbeta", setR9k); });
|
toggle("/r9kbeta", setR9k);
|
||||||
|
});
|
||||||
|
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
@ -569,8 +584,8 @@ void SplitHeader::updateRoomModes()
|
||||||
void SplitHeader::initializeModeSignals(EffectLabel &label)
|
void SplitHeader::initializeModeSignals(EffectLabel &label)
|
||||||
{
|
{
|
||||||
this->modeUpdateRequested_.connect([this, &label] {
|
this->modeUpdateRequested_.connect([this, &label] {
|
||||||
if (auto twitchChannel = dynamic_cast<TwitchChannel *>(
|
if (auto twitchChannel =
|
||||||
this->split_->getChannel().get())) //
|
dynamic_cast<TwitchChannel *>(this->split_->getChannel().get()))
|
||||||
{
|
{
|
||||||
label.setEnable(twitchChannel->hasModRights());
|
label.setEnable(twitchChannel->hasModRights());
|
||||||
|
|
||||||
|
@ -608,7 +623,7 @@ void SplitHeader::handleChannelChanged()
|
||||||
{
|
{
|
||||||
this->channelConnections_.emplace_back(
|
this->channelConnections_.emplace_back(
|
||||||
twitchChannel->liveStatusChanged.connect([this]() {
|
twitchChannel->liveStatusChanged.connect([this]() {
|
||||||
this->updateChannelText(); //
|
this->updateChannelText();
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,9 @@ SplitInput::SplitInput(Split *_chatWidget)
|
||||||
|
|
||||||
// misc
|
// misc
|
||||||
this->installKeyPressedEvent();
|
this->installKeyPressedEvent();
|
||||||
this->ui_.textEdit->focusLost.connect([this] { this->hideColonMenu(); });
|
this->ui_.textEdit->focusLost.connect([this] {
|
||||||
|
this->hideColonMenu();
|
||||||
|
});
|
||||||
this->scaleChangedEvent(this->scale());
|
this->scaleChangedEvent(this->scale());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,8 +92,9 @@ void SplitInput::initLayout()
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// open emote popup
|
// open emote popup
|
||||||
QObject::connect(this->ui_.emoteButton, &EffectLabel::leftClicked,
|
QObject::connect(this->ui_.emoteButton, &EffectLabel::leftClicked, [=] {
|
||||||
[=] { this->openEmotePopup(); });
|
this->openEmotePopup();
|
||||||
|
});
|
||||||
|
|
||||||
// clear channelview selection when selecting in the input
|
// clear channelview selection when selecting in the input
|
||||||
QObject::connect(this->ui_.textEdit, &QTextEdit::copyAvailable,
|
QObject::connect(this->ui_.textEdit, &QTextEdit::copyAvailable,
|
||||||
|
@ -599,7 +602,7 @@ void SplitInput::editTextChanged()
|
||||||
QString text = this->ui_.textEdit->toPlainText();
|
QString text = this->ui_.textEdit->toPlainText();
|
||||||
|
|
||||||
if (text.startsWith("/r ", Qt::CaseInsensitive) &&
|
if (text.startsWith("/r ", Qt::CaseInsensitive) &&
|
||||||
this->split_->getChannel()->isTwitchChannel()) //
|
this->split_->getChannel()->isTwitchChannel())
|
||||||
{
|
{
|
||||||
QString lastUser = app->twitch.server->lastUserThatWhisperedMe.get();
|
QString lastUser = app->twitch.server->lastUserThatWhisperedMe.get();
|
||||||
if (!lastUser.isEmpty())
|
if (!lastUser.isEmpty())
|
||||||
|
|
Loading…
Reference in a new issue