Update Settings and Signals version (#3398)
Co-authored-by: zneix <zneix@zneix.eu>
This commit is contained in:
@@ -65,6 +65,7 @@
|
|||||||
- Bugfix: Fixed Chatterino attempting to send empty messages (#3355)
|
- Bugfix: Fixed Chatterino attempting to send empty messages (#3355)
|
||||||
- Bugfix: Fixed IRC highlights not triggering sounds or alerts properly. (#3368)
|
- Bugfix: Fixed IRC highlights not triggering sounds or alerts properly. (#3368)
|
||||||
- Bugfix: Fixed IRC /kick command crashing if parameters were malformed. (#3382)
|
- Bugfix: Fixed IRC /kick command crashing if parameters were malformed. (#3382)
|
||||||
|
- Bugfix: Fixed crash that would occur if the user tries to modify the currently connected IRC connection. (#3398)
|
||||||
- Bugfix: Fixed a crash that could occur on certain Linux systems when toggling the Always on Top flag. (#3385)
|
- Bugfix: Fixed a crash that could occur on certain Linux systems when toggling the Always on Top flag. (#3385)
|
||||||
- Bugfix: Fixed zero-width emotes sometimes wrapping lines incorrectly. (#3389)
|
- Bugfix: Fixed zero-width emotes sometimes wrapping lines incorrectly. (#3389)
|
||||||
- Bugfix: Fixed using special chars in Windows username breaking the storage of custom commands (#3397)
|
- Bugfix: Fixed using special chars in Windows username breaking the storage of custom commands (#3397)
|
||||||
|
|||||||
+1
-1
Submodule lib/settings updated: 7cf8431d64...04792d853c
+1
-1
Submodule lib/signals updated: baf5bb04bd...25e4ec3b8d
@@ -222,13 +222,10 @@ TextLayoutElement::TextLayoutElement(MessageElement &_creator, QString &_text,
|
|||||||
|
|
||||||
void TextLayoutElement::listenToLinkChanges()
|
void TextLayoutElement::listenToLinkChanges()
|
||||||
{
|
{
|
||||||
this->managedConnections_.emplace_back(
|
this->managedConnections_.managedConnect(
|
||||||
static_cast<TextElement &>(this->getCreator())
|
static_cast<TextElement &>(this->getCreator()).linkChanged, [this]() {
|
||||||
.linkChanged.connect([this]() {
|
this->setLink(this->getCreator().getLink());
|
||||||
// log("Old link: {}", this->getCreator().getLink().value);
|
});
|
||||||
// log("This link: {}", this->getLink().value);
|
|
||||||
this->setLink(this->getCreator().getLink());
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextLayoutElement::addCopyTextToString(QString &str, int from,
|
void TextLayoutElement::addCopyTextToString(QString &str, int from,
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
#include "messages/MessageColor.hpp"
|
#include "messages/MessageColor.hpp"
|
||||||
#include "messages/MessageElement.hpp"
|
#include "messages/MessageElement.hpp"
|
||||||
|
|
||||||
|
#include <pajlada/signals/signalholder.hpp>
|
||||||
|
|
||||||
class QPainter;
|
class QPainter;
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
@@ -114,7 +116,7 @@ protected:
|
|||||||
FontStyle style_;
|
FontStyle style_;
|
||||||
float scale_;
|
float scale_;
|
||||||
|
|
||||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections_;
|
pajlada::Signals::SignalHolder managedConnections_;
|
||||||
};
|
};
|
||||||
|
|
||||||
// TEXT ICON
|
// TEXT ICON
|
||||||
|
|||||||
@@ -47,11 +47,12 @@ AbstractIrcServer::AbstractIrcServer()
|
|||||||
&Communi::IrcConnection::connected, this, [this] {
|
&Communi::IrcConnection::connected, this, [this] {
|
||||||
this->onWriteConnected(this->writeConnection_.get());
|
this->onWriteConnected(this->writeConnection_.get());
|
||||||
});
|
});
|
||||||
this->writeConnection_->connectionLost.connect([this](bool timeout) {
|
this->connections_.managedConnect(
|
||||||
qCDebug(chatterinoIrc)
|
this->writeConnection_->connectionLost, [this](bool timeout) {
|
||||||
<< "Write connection reconnect requested. Timeout:" << timeout;
|
qCDebug(chatterinoIrc)
|
||||||
this->writeConnection_->smartReconnect.invoke();
|
<< "Write connection reconnect requested. Timeout:" << timeout;
|
||||||
});
|
this->writeConnection_->smartReconnect.invoke();
|
||||||
|
});
|
||||||
|
|
||||||
// Listen to read connection message signals
|
// Listen to read connection message signals
|
||||||
this->readConnection_.reset(new IrcConnection);
|
this->readConnection_.reset(new IrcConnection);
|
||||||
@@ -75,18 +76,19 @@ AbstractIrcServer::AbstractIrcServer()
|
|||||||
&Communi::IrcConnection::disconnected, this, [this] {
|
&Communi::IrcConnection::disconnected, this, [this] {
|
||||||
this->onDisconnected();
|
this->onDisconnected();
|
||||||
});
|
});
|
||||||
this->readConnection_->connectionLost.connect([this](bool timeout) {
|
this->connections_.managedConnect(
|
||||||
qCDebug(chatterinoIrc)
|
this->readConnection_->connectionLost, [this](bool timeout) {
|
||||||
<< "Read connection reconnect requested. Timeout:" << timeout;
|
qCDebug(chatterinoIrc)
|
||||||
if (timeout)
|
<< "Read connection reconnect requested. Timeout:" << timeout;
|
||||||
{
|
if (timeout)
|
||||||
// Show additional message since this is going to interrupt a
|
{
|
||||||
// connection that is still "connected"
|
// Show additional message since this is going to interrupt a
|
||||||
this->addGlobalSystemMessage(
|
// connection that is still "connected"
|
||||||
"Server connection timed out, reconnecting");
|
this->addGlobalSystemMessage(
|
||||||
}
|
"Server connection timed out, reconnecting");
|
||||||
this->readConnection_->smartReconnect.invoke();
|
}
|
||||||
});
|
this->readConnection_->smartReconnect.invoke();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractIrcServer::initializeIrc()
|
void AbstractIrcServer::initializeIrc()
|
||||||
@@ -217,19 +219,18 @@ ChannelPtr AbstractIrcServer::getOrAddChannel(const QString &dirtyChannelName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
this->channels.insert(channelName, chan);
|
this->channels.insert(channelName, chan);
|
||||||
this->connections_.emplace_back(
|
this->connections_.managedConnect(chan->destroyed, [this, channelName] {
|
||||||
chan->destroyed.connect([this, channelName] {
|
// fourtf: issues when the server itself is destroyed
|
||||||
// fourtf: issues when the server itself is destroyed
|
|
||||||
|
|
||||||
qCDebug(chatterinoIrc) << "[AbstractIrcServer::addChannel]"
|
qCDebug(chatterinoIrc) << "[AbstractIrcServer::addChannel]"
|
||||||
<< channelName << "was destroyed";
|
<< channelName << "was destroyed";
|
||||||
this->channels.remove(channelName);
|
this->channels.remove(channelName);
|
||||||
|
|
||||||
if (this->readConnection_)
|
if (this->readConnection_)
|
||||||
{
|
{
|
||||||
this->readConnection_->sendRaw("PART #" + channelName);
|
this->readConnection_->sendRaw("PART #" + channelName);
|
||||||
}
|
}
|
||||||
}));
|
});
|
||||||
|
|
||||||
// join IRC channel
|
// join IRC channel
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -117,6 +117,12 @@ IrcConnection::IrcConnection(QObject *parent)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IrcConnection::~IrcConnection()
|
||||||
|
{
|
||||||
|
// Prematurely disconnect all QObject connections
|
||||||
|
this->disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
void IrcConnection::open()
|
void IrcConnection::open()
|
||||||
{
|
{
|
||||||
this->expectConnectionLoss_ = false;
|
this->expectConnectionLoss_ = false;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ class IrcConnection : public Communi::IrcConnection
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IrcConnection(QObject *parent = nullptr);
|
IrcConnection(QObject *parent = nullptr);
|
||||||
|
~IrcConnection() override;
|
||||||
|
|
||||||
// Signal to notify that we're unexpectedly no longer connected, either due
|
// Signal to notify that we're unexpectedly no longer connected, either due
|
||||||
// to a connection error or if we think we've timed out. It's up to the
|
// to a connection error or if we think we've timed out. It's up to the
|
||||||
|
|||||||
@@ -158,14 +158,16 @@ TwitchChannel::TwitchChannel(const QString &name)
|
|||||||
{
|
{
|
||||||
qCDebug(chatterinoTwitch) << "[TwitchChannel" << name << "] Opened";
|
qCDebug(chatterinoTwitch) << "[TwitchChannel" << name << "] Opened";
|
||||||
|
|
||||||
this->managedConnect(getApp()->accounts->twitch.currentUserChanged, [=] {
|
this->signalHolder_.managedConnect(
|
||||||
this->setMod(false);
|
getApp()->accounts->twitch.currentUserChanged, [=] {
|
||||||
});
|
this->setMod(false);
|
||||||
|
});
|
||||||
|
|
||||||
// pubsub
|
// pubsub
|
||||||
this->managedConnect(getApp()->accounts->twitch.currentUserChanged, [=] {
|
this->signalHolder_.managedConnect(
|
||||||
this->refreshPubsub();
|
getApp()->accounts->twitch.currentUserChanged, [=] {
|
||||||
});
|
this->refreshPubsub();
|
||||||
|
});
|
||||||
this->refreshPubsub();
|
this->refreshPubsub();
|
||||||
this->userStateChanged.connect([this] {
|
this->userStateChanged.connect([this] {
|
||||||
this->refreshPubsub();
|
this->refreshPubsub();
|
||||||
|
|||||||
@@ -35,9 +35,7 @@ class BttvEmotes;
|
|||||||
|
|
||||||
class TwitchIrcServer;
|
class TwitchIrcServer;
|
||||||
|
|
||||||
class TwitchChannel : public Channel,
|
class TwitchChannel : public Channel, public ChannelChatters
|
||||||
public ChannelChatters,
|
|
||||||
pajlada::Signals::SignalHolder
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct StreamStatus {
|
struct StreamStatus {
|
||||||
@@ -184,6 +182,8 @@ private:
|
|||||||
QElapsedTimer clipCreationTimer_;
|
QElapsedTimer clipCreationTimer_;
|
||||||
bool isClipCreationInProgress{false};
|
bool isClipCreationInProgress{false};
|
||||||
|
|
||||||
|
pajlada::Signals::SignalHolder signalHolder_;
|
||||||
|
|
||||||
friend class TwitchIrcServer;
|
friend class TwitchIrcServer;
|
||||||
friend class TwitchMessageBuilder;
|
friend class TwitchMessageBuilder;
|
||||||
friend class IrcMessageHandler;
|
friend class IrcMessageHandler;
|
||||||
|
|||||||
@@ -16,19 +16,19 @@ TooltipPreviewImage::TooltipPreviewImage()
|
|||||||
{
|
{
|
||||||
auto windows = getApp()->windows;
|
auto windows = getApp()->windows;
|
||||||
|
|
||||||
this->connections_.push_back(windows->gifRepaintRequested.connect([&] {
|
this->connections_.managedConnect(windows->gifRepaintRequested, [&] {
|
||||||
if (this->image_ && this->image_->animated())
|
if (this->image_ && this->image_->animated())
|
||||||
{
|
{
|
||||||
this->refreshTooltipWidgetPixmap();
|
this->refreshTooltipWidgetPixmap();
|
||||||
}
|
}
|
||||||
}));
|
});
|
||||||
|
|
||||||
this->connections_.push_back(windows->miscUpdate.connect([&] {
|
this->connections_.managedConnect(windows->miscUpdate, [&] {
|
||||||
if (this->attemptRefresh)
|
if (this->attemptRefresh)
|
||||||
{
|
{
|
||||||
this->refreshTooltipWidgetPixmap();
|
this->refreshTooltipWidgetPixmap();
|
||||||
}
|
}
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void TooltipPreviewImage::setImage(ImagePtr image)
|
void TooltipPreviewImage::setImage(ImagePtr image)
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include "messages/Image.hpp"
|
#include "messages/Image.hpp"
|
||||||
|
|
||||||
|
#include <pajlada/signals/signalholder.hpp>
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
class TooltipPreviewImage
|
class TooltipPreviewImage
|
||||||
@@ -21,7 +23,7 @@ private:
|
|||||||
int imageWidth_ = 0;
|
int imageWidth_ = 0;
|
||||||
int imageHeight_ = 0;
|
int imageHeight_ = 0;
|
||||||
|
|
||||||
std::vector<pajlada::Signals::ScopedConnection> connections_;
|
pajlada::Signals::SignalHolder connections_;
|
||||||
|
|
||||||
// attemptRefresh is set to true in case we want to preview an image that has not loaded yet (if pixmapOrLoad fails)
|
// attemptRefresh is set to true in case we want to preview an image that has not loaded yet (if pixmapOrLoad fails)
|
||||||
bool attemptRefresh{false};
|
bool attemptRefresh{false};
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "common/FlagsEnum.hpp"
|
#include "common/FlagsEnum.hpp"
|
||||||
#include "common/Singleton.hpp"
|
#include "common/Singleton.hpp"
|
||||||
#include "common/WindowDescriptors.hpp"
|
#include "common/WindowDescriptors.hpp"
|
||||||
|
|
||||||
#include "pajlada/settings/settinglistener.hpp"
|
#include "pajlada/settings/settinglistener.hpp"
|
||||||
#include "widgets/splits/SplitContainer.hpp"
|
#include "widgets/splits/SplitContainer.hpp"
|
||||||
|
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ void BaseWindow::init()
|
|||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
||||||
},
|
},
|
||||||
this->managedConnections_);
|
this->connections_);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@@ -245,7 +245,7 @@ void BaseWindow::init()
|
|||||||
this->show();
|
this->show();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
this->managedConnections_);
|
this->connections_);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,7 +134,6 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
pajlada::Signals::SignalHolder connections_;
|
pajlada::Signals::SignalHolder connections_;
|
||||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections_;
|
|
||||||
|
|
||||||
friend class BaseWidget;
|
friend class BaseWidget;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -759,7 +759,7 @@ void SplitNotebook::addCustomButtons()
|
|||||||
[settingsBtn](bool hide, auto) {
|
[settingsBtn](bool hide, auto) {
|
||||||
settingsBtn->setVisible(!hide);
|
settingsBtn->setVisible(!hide);
|
||||||
},
|
},
|
||||||
this->connections_);
|
this->signalHolder_);
|
||||||
|
|
||||||
settingsBtn->setIcon(NotebookButton::Settings);
|
settingsBtn->setIcon(NotebookButton::Settings);
|
||||||
|
|
||||||
@@ -774,7 +774,7 @@ void SplitNotebook::addCustomButtons()
|
|||||||
[userBtn](bool hide, auto) {
|
[userBtn](bool hide, auto) {
|
||||||
userBtn->setVisible(!hide);
|
userBtn->setVisible(!hide);
|
||||||
},
|
},
|
||||||
this->connections_);
|
this->signalHolder_);
|
||||||
|
|
||||||
userBtn->setIcon(NotebookButton::User);
|
userBtn->setIcon(NotebookButton::User);
|
||||||
QObject::connect(userBtn, &NotebookButton::leftClicked, [this, userBtn] {
|
QObject::connect(userBtn, &NotebookButton::leftClicked, [this, userBtn] {
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ private:
|
|||||||
NotebookTabDirection tabDirection_ = NotebookTabDirection::Horizontal;
|
NotebookTabDirection tabDirection_ = NotebookTabDirection::Horizontal;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SplitNotebook : public Notebook, pajlada::Signals::SignalHolder
|
class SplitNotebook : public Notebook
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SplitNotebook(Window *parent);
|
SplitNotebook(Window *parent);
|
||||||
@@ -117,8 +117,6 @@ private:
|
|||||||
void addCustomButtons();
|
void addCustomButtons();
|
||||||
|
|
||||||
pajlada::Signals::SignalHolder signalHolder_;
|
pajlada::Signals::SignalHolder signalHolder_;
|
||||||
|
|
||||||
std::vector<pajlada::Signals::ScopedConnection> connections_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ LastRunCrashDialog::LastRunCrashDialog()
|
|||||||
// };
|
// };
|
||||||
|
|
||||||
// updateUpdateLabel();
|
// updateUpdateLabel();
|
||||||
// this->managedConnect(updateManager.statusUpdated,
|
// this->signalHolder_.managedConnect(updateManager.statusUpdated,
|
||||||
// [updateUpdateLabel](auto) mutable {
|
// [updateUpdateLabel](auto) mutable {
|
||||||
// postToThread([updateUpdateLabel]() mutable { updateUpdateLabel();
|
// postToThread([updateUpdateLabel]() mutable { updateUpdateLabel();
|
||||||
// });
|
// });
|
||||||
|
|||||||
@@ -5,10 +5,13 @@
|
|||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
class LastRunCrashDialog : public QDialog, pajlada::Signals::SignalHolder
|
class LastRunCrashDialog : public QDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LastRunCrashDialog();
|
LastRunCrashDialog();
|
||||||
|
|
||||||
|
private:
|
||||||
|
pajlada::Signals::SignalHolder signalHolder_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|||||||
@@ -430,12 +430,6 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, QWidget *parent)
|
|||||||
this->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Policy::Ignored);
|
this->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Policy::Ignored);
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove once https://github.com/pajlada/signals/pull/10 gets merged
|
|
||||||
UserInfoPopup::~UserInfoPopup()
|
|
||||||
{
|
|
||||||
this->refreshConnection_.disconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
void UserInfoPopup::themeChangedEvent()
|
void UserInfoPopup::themeChangedEvent()
|
||||||
{
|
{
|
||||||
BaseWindow::themeChangedEvent();
|
BaseWindow::themeChangedEvent();
|
||||||
@@ -601,26 +595,25 @@ void UserInfoPopup::updateLatestMessages()
|
|||||||
// shrink dialog in case ChannelView goes from visible to hidden
|
// shrink dialog in case ChannelView goes from visible to hidden
|
||||||
this->adjustSize();
|
this->adjustSize();
|
||||||
|
|
||||||
this->refreshConnection_
|
this->refreshConnection_ =
|
||||||
.disconnect(); // remove once https://github.com/pajlada/signals/pull/10 gets merged
|
std::make_unique<pajlada::Signals::ScopedConnection>(
|
||||||
|
this->channel_->messageAppended.connect([this, hasMessages](
|
||||||
|
auto message, auto) {
|
||||||
|
if (!checkMessageUserName(this->userName_, message))
|
||||||
|
return;
|
||||||
|
|
||||||
this->refreshConnection_ = this->channel_->messageAppended.connect(
|
if (hasMessages)
|
||||||
[this, hasMessages](auto message, auto) {
|
{
|
||||||
if (!checkMessageUserName(this->userName_, message))
|
// display message in ChannelView
|
||||||
return;
|
this->ui_.latestMessages->channel()->addMessage(message);
|
||||||
|
}
|
||||||
if (hasMessages)
|
else
|
||||||
{
|
{
|
||||||
// display message in ChannelView
|
// The ChannelView is currently hidden, so manually refresh
|
||||||
this->ui_.latestMessages->channel()->addMessage(message);
|
// and display the latest messages
|
||||||
}
|
this->updateLatestMessages();
|
||||||
else
|
}
|
||||||
{
|
}));
|
||||||
// The ChannelView is currently hidden, so manually refresh
|
|
||||||
// and display the latest messages
|
|
||||||
this->updateLatestMessages();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserInfoPopup::updateUserData()
|
void UserInfoPopup::updateUserData()
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "widgets/BaseWindow.hpp"
|
#include "widgets/BaseWindow.hpp"
|
||||||
#include "widgets/helper/ChannelView.hpp"
|
#include "widgets/helper/ChannelView.hpp"
|
||||||
|
|
||||||
|
#include <pajlada/signals/scoped-connection.hpp>
|
||||||
#include <pajlada/signals/signal.hpp>
|
#include <pajlada/signals/signal.hpp>
|
||||||
|
|
||||||
class QCheckBox;
|
class QCheckBox;
|
||||||
@@ -19,7 +20,6 @@ class UserInfoPopup final : public BaseWindow
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
UserInfoPopup(bool closeAutomatically, QWidget *parent);
|
UserInfoPopup(bool closeAutomatically, QWidget *parent);
|
||||||
~UserInfoPopup();
|
|
||||||
|
|
||||||
void setData(const QString &name, const ChannelPtr &channel);
|
void setData(const QString &name, const ChannelPtr &channel);
|
||||||
|
|
||||||
@@ -43,8 +43,7 @@ private:
|
|||||||
|
|
||||||
pajlada::Signals::NoArgSignal userStateChanged_;
|
pajlada::Signals::NoArgSignal userStateChanged_;
|
||||||
|
|
||||||
// replace with ScopedConnection once https://github.com/pajlada/signals/pull/10 gets merged
|
std::unique_ptr<pajlada::Signals::ScopedConnection> refreshConnection_;
|
||||||
pajlada::Signals::Connection refreshConnection_;
|
|
||||||
|
|
||||||
std::shared_ptr<bool> hack_;
|
std::shared_ptr<bool> hack_;
|
||||||
|
|
||||||
|
|||||||
@@ -184,34 +184,35 @@ void ChannelView::initializeScrollbar()
|
|||||||
|
|
||||||
void ChannelView::initializeSignals()
|
void ChannelView::initializeSignals()
|
||||||
{
|
{
|
||||||
this->connections_.push_back(
|
this->signalHolder_.managedConnect(getApp()->windows->wordFlagsChanged,
|
||||||
getApp()->windows->wordFlagsChanged.connect([this] {
|
[this] {
|
||||||
this->queueLayout();
|
this->queueLayout();
|
||||||
this->update();
|
this->update();
|
||||||
}));
|
});
|
||||||
|
|
||||||
getSettings()->showLastMessageIndicator.connect(
|
getSettings()->showLastMessageIndicator.connect(
|
||||||
[this](auto, auto) {
|
[this](auto, auto) {
|
||||||
this->update();
|
this->update();
|
||||||
},
|
},
|
||||||
this->connections_);
|
this);
|
||||||
|
|
||||||
connections_.push_back(getApp()->windows->gifRepaintRequested.connect([&] {
|
this->signalHolder_.managedConnect(getApp()->windows->gifRepaintRequested,
|
||||||
this->queueUpdate();
|
[&] {
|
||||||
}));
|
this->queueUpdate();
|
||||||
|
});
|
||||||
|
|
||||||
connections_.push_back(
|
this->signalHolder_.managedConnect(
|
||||||
getApp()->windows->layoutRequested.connect([&](Channel *channel) {
|
getApp()->windows->layoutRequested, [&](Channel *channel) {
|
||||||
if (this->isVisible() &&
|
if (this->isVisible() &&
|
||||||
(channel == nullptr || this->channel_.get() == channel))
|
(channel == nullptr || this->channel_.get() == channel))
|
||||||
{
|
{
|
||||||
this->queueLayout();
|
this->queueLayout();
|
||||||
}
|
}
|
||||||
}));
|
});
|
||||||
|
|
||||||
connections_.push_back(getApp()->fonts->fontChanged.connect([this] {
|
this->signalHolder_.managedConnect(getApp()->fonts->fontChanged, [this] {
|
||||||
this->queueLayout();
|
this->queueLayout();
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChannelView::pausable() const
|
bool ChannelView::pausable() const
|
||||||
@@ -597,87 +598,87 @@ void ChannelView::setChannel(ChannelPtr underlyingChannel)
|
|||||||
// Use a proxy channel to keep filtered messages past the time they are removed from their origin channel
|
// Use a proxy channel to keep filtered messages past the time they are removed from their origin channel
|
||||||
//
|
//
|
||||||
|
|
||||||
this->channelConnections_.push_back(
|
this->channelConnections_.managedConnect(
|
||||||
underlyingChannel->messageAppended.connect(
|
underlyingChannel->messageAppended,
|
||||||
[this](MessagePtr &message,
|
[this](MessagePtr &message,
|
||||||
boost::optional<MessageFlags> overridingFlags) {
|
boost::optional<MessageFlags> overridingFlags) {
|
||||||
if (this->shouldIncludeMessage(message))
|
if (this->shouldIncludeMessage(message))
|
||||||
|
{
|
||||||
|
if (this->channel_->lastDate_ != QDate::currentDate())
|
||||||
{
|
{
|
||||||
if (this->channel_->lastDate_ != QDate::currentDate())
|
this->channel_->lastDate_ = QDate::currentDate();
|
||||||
{
|
auto msg = makeSystemMessage(
|
||||||
this->channel_->lastDate_ = QDate::currentDate();
|
QLocale().toString(QDate::currentDate(),
|
||||||
auto msg = makeSystemMessage(
|
QLocale::LongFormat),
|
||||||
QLocale().toString(QDate::currentDate(),
|
QTime(0, 0));
|
||||||
QLocale::LongFormat),
|
this->channel_->addMessage(msg);
|
||||||
QTime(0, 0));
|
}
|
||||||
this->channel_->addMessage(msg);
|
// When the message was received in the underlyingChannel,
|
||||||
}
|
// logging will be handled. Prevent duplications.
|
||||||
// When the message was received in the underlyingChannel,
|
if (overridingFlags)
|
||||||
// logging will be handled. Prevent duplications.
|
{
|
||||||
if (overridingFlags)
|
overridingFlags.get().set(MessageFlag::DoNotLog);
|
||||||
{
|
}
|
||||||
overridingFlags.get().set(MessageFlag::DoNotLog);
|
else
|
||||||
}
|
{
|
||||||
else
|
overridingFlags = MessageFlags(message->flags);
|
||||||
{
|
overridingFlags.get().set(MessageFlag::DoNotLog);
|
||||||
overridingFlags = MessageFlags(message->flags);
|
|
||||||
overridingFlags.get().set(MessageFlag::DoNotLog);
|
|
||||||
}
|
|
||||||
|
|
||||||
this->channel_->addMessage(message, overridingFlags);
|
|
||||||
}
|
}
|
||||||
}));
|
|
||||||
|
|
||||||
this->channelConnections_.push_back(
|
this->channel_->addMessage(message, overridingFlags);
|
||||||
underlyingChannel->messagesAddedAtStart.connect(
|
}
|
||||||
[this](std::vector<MessagePtr> &messages) {
|
});
|
||||||
std::vector<MessagePtr> filtered;
|
|
||||||
std::copy_if(messages.begin(), messages.end(),
|
|
||||||
std::back_inserter(filtered),
|
|
||||||
[this](MessagePtr msg) {
|
|
||||||
return this->shouldIncludeMessage(msg);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!filtered.empty())
|
this->channelConnections_.managedConnect(
|
||||||
this->channel_->addMessagesAtStart(filtered);
|
underlyingChannel->messagesAddedAtStart,
|
||||||
}));
|
[this](std::vector<MessagePtr> &messages) {
|
||||||
|
std::vector<MessagePtr> filtered;
|
||||||
|
std::copy_if(messages.begin(), messages.end(),
|
||||||
|
std::back_inserter(filtered), [this](MessagePtr msg) {
|
||||||
|
return this->shouldIncludeMessage(msg);
|
||||||
|
});
|
||||||
|
|
||||||
this->channelConnections_.push_back(
|
if (!filtered.empty())
|
||||||
underlyingChannel->messageReplaced.connect(
|
this->channel_->addMessagesAtStart(filtered);
|
||||||
[this](size_t index, MessagePtr replacement) {
|
});
|
||||||
if (this->shouldIncludeMessage(replacement))
|
|
||||||
this->channel_->replaceMessage(index, replacement);
|
this->channelConnections_.managedConnect(
|
||||||
}));
|
underlyingChannel->messageReplaced,
|
||||||
|
[this](size_t index, MessagePtr replacement) {
|
||||||
|
if (this->shouldIncludeMessage(replacement))
|
||||||
|
this->channel_->replaceMessage(index, replacement);
|
||||||
|
});
|
||||||
|
|
||||||
//
|
//
|
||||||
// Standard channel connections
|
// Standard channel connections
|
||||||
//
|
//
|
||||||
|
|
||||||
// on new message
|
// on new message
|
||||||
this->channelConnections_.push_back(this->channel_->messageAppended.connect(
|
this->channelConnections_.managedConnect(
|
||||||
|
this->channel_->messageAppended,
|
||||||
[this](MessagePtr &message,
|
[this](MessagePtr &message,
|
||||||
boost::optional<MessageFlags> overridingFlags) {
|
boost::optional<MessageFlags> overridingFlags) {
|
||||||
this->messageAppended(message, std::move(overridingFlags));
|
this->messageAppended(message, std::move(overridingFlags));
|
||||||
}));
|
});
|
||||||
|
|
||||||
this->channelConnections_.push_back(
|
this->channelConnections_.managedConnect(
|
||||||
this->channel_->messagesAddedAtStart.connect(
|
this->channel_->messagesAddedAtStart,
|
||||||
[this](std::vector<MessagePtr> &messages) {
|
[this](std::vector<MessagePtr> &messages) {
|
||||||
this->messageAddedAtStart(messages);
|
this->messageAddedAtStart(messages);
|
||||||
}));
|
});
|
||||||
|
|
||||||
// on message removed
|
// on message removed
|
||||||
this->channelConnections_.push_back(
|
this->channelConnections_.managedConnect(
|
||||||
this->channel_->messageRemovedFromStart.connect(
|
this->channel_->messageRemovedFromStart, [this](MessagePtr &message) {
|
||||||
[this](MessagePtr &message) {
|
this->messageRemoveFromStart(message);
|
||||||
this->messageRemoveFromStart(message);
|
});
|
||||||
}));
|
|
||||||
|
|
||||||
// on message replaced
|
// on message replaced
|
||||||
this->channelConnections_.push_back(this->channel_->messageReplaced.connect(
|
this->channelConnections_.managedConnect(
|
||||||
|
this->channel_->messageReplaced,
|
||||||
[this](size_t index, MessagePtr replacement) {
|
[this](size_t index, MessagePtr replacement) {
|
||||||
this->messageReplaced(index, replacement);
|
this->messageReplaced(index, replacement);
|
||||||
}));
|
});
|
||||||
|
|
||||||
auto snapshot = underlyingChannel->getMessageSnapshot();
|
auto snapshot = underlyingChannel->getMessageSnapshot();
|
||||||
|
|
||||||
@@ -715,9 +716,10 @@ void ChannelView::setChannel(ChannelPtr underlyingChannel)
|
|||||||
// Notifications
|
// Notifications
|
||||||
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->channelConnections_.managedConnect(
|
||||||
this->liveStatusChanged.invoke();
|
tc->liveStatusChanged, [this]() {
|
||||||
}));
|
this->liveStatusChanged.invoke();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -238,8 +238,10 @@ private:
|
|||||||
|
|
||||||
LimitedQueue<MessageLayoutPtr> messages_;
|
LimitedQueue<MessageLayoutPtr> messages_;
|
||||||
|
|
||||||
std::vector<pajlada::Signals::ScopedConnection> connections_;
|
pajlada::Signals::SignalHolder signalHolder_;
|
||||||
std::vector<pajlada::Signals::ScopedConnection> channelConnections_;
|
|
||||||
|
// channelConnections_ will be cleared when the underlying channel of the channelview changes
|
||||||
|
pajlada::Signals::SignalHolder channelConnections_;
|
||||||
|
|
||||||
std::unordered_set<std::shared_ptr<MessageLayout>> messagesOnScreen_;
|
std::unordered_set<std::shared_ptr<MessageLayout>> messagesOnScreen_;
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QPropertyAnimation>
|
#include <QPropertyAnimation>
|
||||||
#include <pajlada/settings/setting.hpp>
|
#include <pajlada/settings/setting.hpp>
|
||||||
#include <pajlada/signals/connection.hpp>
|
#include <pajlada/signals/signalholder.hpp>
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ private:
|
|||||||
|
|
||||||
QMenu menu_;
|
QMenu menu_;
|
||||||
|
|
||||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections_;
|
pajlada::Signals::SignalHolder managedConnections_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <boost/variant.hpp>
|
#include <boost/variant.hpp>
|
||||||
|
#include <pajlada/signals/signalholder.hpp>
|
||||||
#include "Application.hpp"
|
#include "Application.hpp"
|
||||||
#include "common/ChatterinoSetting.hpp"
|
#include "common/ChatterinoSetting.hpp"
|
||||||
#include "singletons/WindowManager.hpp"
|
#include "singletons/WindowManager.hpp"
|
||||||
@@ -218,7 +219,7 @@ private:
|
|||||||
QVBoxLayout *navigationLayout_;
|
QVBoxLayout *navigationLayout_;
|
||||||
|
|
||||||
std::vector<Group> groups_;
|
std::vector<Group> groups_;
|
||||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections_;
|
pajlada::Signals::SignalHolder managedConnections_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|||||||
@@ -55,9 +55,7 @@ NotificationPage::NotificationPage()
|
|||||||
// implementation of custom combobox done
|
// implementation of custom combobox done
|
||||||
// because addComboBox only can handle strings-settings
|
// because addComboBox only can handle strings-settings
|
||||||
// int setting for the ToastReaction is desired
|
// int setting for the ToastReaction is desired
|
||||||
openIn
|
openIn.append(this->createToastReactionComboBox())
|
||||||
.append(this->createToastReactionComboBox(
|
|
||||||
this->managedConnections_))
|
|
||||||
->setSizePolicy(QSizePolicy::Maximum,
|
->setSizePolicy(QSizePolicy::Maximum,
|
||||||
QSizePolicy::Preferred);
|
QSizePolicy::Preferred);
|
||||||
}
|
}
|
||||||
@@ -118,8 +116,7 @@ NotificationPage::NotificationPage()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QComboBox *NotificationPage::createToastReactionComboBox(
|
QComboBox *NotificationPage::createToastReactionComboBox()
|
||||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections)
|
|
||||||
{
|
{
|
||||||
QComboBox *toastReactionOptions = new QComboBox();
|
QComboBox *toastReactionOptions = new QComboBox();
|
||||||
|
|
||||||
@@ -135,7 +132,7 @@ QComboBox *NotificationPage::createToastReactionComboBox(
|
|||||||
[toastReactionOptions](const int &index, auto) {
|
[toastReactionOptions](const int &index, auto) {
|
||||||
toastReactionOptions->setCurrentIndex(index);
|
toastReactionOptions->setCurrentIndex(index);
|
||||||
},
|
},
|
||||||
managedConnections);
|
this->managedConnections_);
|
||||||
|
|
||||||
QObject::connect(toastReactionOptions,
|
QObject::connect(toastReactionOptions,
|
||||||
QOverload<int>::of(&QComboBox::currentIndexChanged),
|
QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ public:
|
|||||||
NotificationPage();
|
NotificationPage();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QComboBox *createToastReactionComboBox(
|
QComboBox *createToastReactionComboBox();
|
||||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|||||||
@@ -157,9 +157,11 @@ 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) {
|
setting.connect(
|
||||||
w->setValue(value);
|
[w](const int &value, auto) {
|
||||||
});
|
w->setValue(value);
|
||||||
|
},
|
||||||
|
this->managedConnections_);
|
||||||
QObject::connect(w, QOverload<int>::of(&QSpinBox::valueChanged),
|
QObject::connect(w, QOverload<int>::of(&QSpinBox::valueChanged),
|
||||||
[&setting](int value) {
|
[&setting](int value) {
|
||||||
setting.setValue(value);
|
setting.setValue(value);
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
SettingsDialogTab *tab_;
|
SettingsDialogTab *tab_;
|
||||||
pajlada::Signals::NoArgSignal onCancel_;
|
pajlada::Signals::NoArgSignal onCancel_;
|
||||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections_;
|
pajlada::Signals::SignalHolder managedConnections_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ Split::Split(QWidget *parent)
|
|||||||
this->input_->show();
|
this->input_->show();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
this->managedConnections_);
|
this->signalHolder_);
|
||||||
|
|
||||||
this->header_->updateModerationModeIcon();
|
this->header_->updateModerationModeIcon();
|
||||||
this->overlay_->hide();
|
this->overlay_->hide();
|
||||||
@@ -183,29 +183,29 @@ Split::Split(QWidget *parent)
|
|||||||
this->setSizePolicy(QSizePolicy::MinimumExpanding,
|
this->setSizePolicy(QSizePolicy::MinimumExpanding,
|
||||||
QSizePolicy::MinimumExpanding);
|
QSizePolicy::MinimumExpanding);
|
||||||
|
|
||||||
this->managedConnect(modifierStatusChanged, [this](Qt::KeyboardModifiers
|
this->signalHolder_.managedConnect(
|
||||||
status) {
|
modifierStatusChanged, [this](Qt::KeyboardModifiers status) {
|
||||||
if ((status ==
|
if ((status ==
|
||||||
showSplitOverlayModifiers /*|| status == showAddSplitRegions*/) &&
|
showSplitOverlayModifiers /*|| status == showAddSplitRegions*/) &&
|
||||||
this->isMouseOver_)
|
this->isMouseOver_)
|
||||||
{
|
{
|
||||||
this->overlay_->show();
|
this->overlay_->show();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->overlay_->hide();
|
this->overlay_->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getSettings()->pauseChatModifier.getEnum() != Qt::NoModifier &&
|
if (getSettings()->pauseChatModifier.getEnum() != Qt::NoModifier &&
|
||||||
status == getSettings()->pauseChatModifier.getEnum())
|
status == getSettings()->pauseChatModifier.getEnum())
|
||||||
{
|
{
|
||||||
this->view_->pause(PauseReason::KeyboardModifier);
|
this->view_->pause(PauseReason::KeyboardModifier);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->view_->unpause(PauseReason::KeyboardModifier);
|
this->view_->unpause(PauseReason::KeyboardModifier);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this->input_->ui_.textEdit->focused.connect([this] {
|
this->input_->ui_.textEdit->focused.connect([this] {
|
||||||
this->focused.invoke();
|
this->focused.invoke();
|
||||||
@@ -250,12 +250,13 @@ Split::Split(QWidget *parent)
|
|||||||
[this](const bool &val) {
|
[this](const bool &val) {
|
||||||
this->setAcceptDrops(val);
|
this->setAcceptDrops(val);
|
||||||
},
|
},
|
||||||
this->managedConnections_);
|
this->signalHolder_);
|
||||||
this->addShortcuts();
|
this->addShortcuts();
|
||||||
this->managedConnect(getApp()->hotkeys->onItemsUpdated, [this]() {
|
this->signalHolder_.managedConnect(getApp()->hotkeys->onItemsUpdated,
|
||||||
this->clearShortcuts();
|
[this]() {
|
||||||
this->addShortcuts();
|
this->clearShortcuts();
|
||||||
});
|
this->addShortcuts();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Split::addShortcuts()
|
void Split::addShortcuts()
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class SelectChannelDialog;
|
|||||||
// - Responsible for rendering and handling user text input
|
// - Responsible for rendering and handling user text input
|
||||||
//
|
//
|
||||||
// Each sub-element has a reference to the parent Chat Widget
|
// Each sub-element has a reference to the parent Chat Widget
|
||||||
class Split : public BaseWidget, pajlada::Signals::SignalHolder
|
class Split : public BaseWidget
|
||||||
{
|
{
|
||||||
friend class SplitInput;
|
friend class SplitInput;
|
||||||
|
|
||||||
@@ -152,8 +152,6 @@ private:
|
|||||||
pajlada::Signals::Connection indirectChannelChangedConnection_;
|
pajlada::Signals::Connection indirectChannelChangedConnection_;
|
||||||
pajlada::Signals::SignalHolder signalHolder_;
|
pajlada::Signals::SignalHolder signalHolder_;
|
||||||
|
|
||||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections_;
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void addSibling();
|
void addSibling();
|
||||||
void deleteFromContainer();
|
void deleteFromContainer();
|
||||||
|
|||||||
@@ -41,39 +41,40 @@ SplitContainer::SplitContainer(Notebook *parent)
|
|||||||
{
|
{
|
||||||
this->refreshTabTitle();
|
this->refreshTabTitle();
|
||||||
|
|
||||||
this->managedConnect(Split::modifierStatusChanged, [this](auto modifiers) {
|
this->signalHolder_.managedConnect(
|
||||||
this->layout();
|
Split::modifierStatusChanged, [this](auto modifiers) {
|
||||||
|
this->layout();
|
||||||
|
|
||||||
if (modifiers == showResizeHandlesModifiers)
|
if (modifiers == showResizeHandlesModifiers)
|
||||||
{
|
|
||||||
for (auto &handle : this->resizeHandles_)
|
|
||||||
{
|
{
|
||||||
handle->show();
|
for (auto &handle : this->resizeHandles_)
|
||||||
handle->raise();
|
{
|
||||||
|
handle->show();
|
||||||
|
handle->raise();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
|
||||||
{
|
|
||||||
for (auto &handle : this->resizeHandles_)
|
|
||||||
{
|
{
|
||||||
handle->hide();
|
for (auto &handle : this->resizeHandles_)
|
||||||
|
{
|
||||||
|
handle->hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (modifiers == showSplitOverlayModifiers)
|
if (modifiers == showSplitOverlayModifiers)
|
||||||
{
|
{
|
||||||
this->setCursor(Qt::PointingHandCursor);
|
this->setCursor(Qt::PointingHandCursor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->unsetCursor();
|
this->unsetCursor();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this->setCursor(Qt::PointingHandCursor);
|
this->setCursor(Qt::PointingHandCursor);
|
||||||
this->setAcceptDrops(true);
|
this->setAcceptDrops(true);
|
||||||
|
|
||||||
this->managedConnect(this->overlay_.dragEnded, [this]() {
|
this->signalHolder_.managedConnect(this->overlay_.dragEnded, [this]() {
|
||||||
this->isDragging_ = false;
|
this->isDragging_ = false;
|
||||||
this->layout();
|
this->layout();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class Notebook;
|
|||||||
// inside but it doesn't expose any of it publicly.
|
// inside but it doesn't expose any of it publicly.
|
||||||
//
|
//
|
||||||
|
|
||||||
class SplitContainer final : public BaseWidget, pajlada::Signals::SignalHolder
|
class SplitContainer final : public BaseWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -260,6 +260,8 @@ private:
|
|||||||
std::unordered_map<Split *, pajlada::Signals::SignalHolder>
|
std::unordered_map<Split *, pajlada::Signals::SignalHolder>
|
||||||
connectionsPerSplit_;
|
connectionsPerSplit_;
|
||||||
|
|
||||||
|
pajlada::Signals::SignalHolder signalHolder_;
|
||||||
|
|
||||||
bool isDragging_ = false;
|
bool isDragging_ = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -204,9 +204,10 @@ SplitHeader::SplitHeader(Split *_split)
|
|||||||
this->handleChannelChanged();
|
this->handleChannelChanged();
|
||||||
});
|
});
|
||||||
|
|
||||||
this->managedConnect(getApp()->accounts->twitch.currentUserChanged, [this] {
|
this->managedConnections_.managedConnect(
|
||||||
this->updateModerationModeIcon();
|
getApp()->accounts->twitch.currentUserChanged, [this] {
|
||||||
});
|
this->updateModerationModeIcon();
|
||||||
|
});
|
||||||
|
|
||||||
auto _ = [this](const auto &, const auto &) {
|
auto _ = [this](const auto &, const auto &) {
|
||||||
this->updateChannelText();
|
this->updateChannelText();
|
||||||
@@ -302,19 +303,19 @@ void SplitHeader::initializeLayout()
|
|||||||
});
|
});
|
||||||
|
|
||||||
// update moderation button when items changed
|
// update moderation button when items changed
|
||||||
this->managedConnect(getSettings()->moderationActions.delayedItemsChanged,
|
this->managedConnections_.managedConnect(
|
||||||
[this] {
|
getSettings()->moderationActions.delayedItemsChanged, [this] {
|
||||||
if (getSettings()->moderationActions.empty())
|
if (getSettings()->moderationActions.empty())
|
||||||
{
|
{
|
||||||
if (this->split_->getModerationMode())
|
if (this->split_->getModerationMode())
|
||||||
this->split_->setModerationMode(true);
|
this->split_->setModerationMode(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (this->split_->getModerationMode())
|
if (this->split_->getModerationMode())
|
||||||
this->split_->setModerationMode(true);
|
this->split_->setModerationMode(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
getSettings()->customURIScheme.connect(
|
getSettings()->customURIScheme.connect(
|
||||||
[this] {
|
[this] {
|
||||||
@@ -519,7 +520,8 @@ 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_.managedConnect(
|
||||||
|
this->modeUpdateRequested_,
|
||||||
[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());
|
||||||
@@ -536,7 +538,7 @@ std::unique_ptr<QMenu> SplitHeader::createChatModeMenu()
|
|||||||
setEmote->setChecked(roomModes->emoteOnly);
|
setEmote->setChecked(roomModes->emoteOnly);
|
||||||
setSub->setChecked(roomModes->submode);
|
setSub->setChecked(roomModes->submode);
|
||||||
setFollowers->setChecked(roomModes->followerOnly != -1);
|
setFollowers->setChecked(roomModes->followerOnly != -1);
|
||||||
}));
|
});
|
||||||
|
|
||||||
auto toggle = [this](const QString &command, QAction *action) mutable {
|
auto toggle = [this](const QString &command, QAction *action) mutable {
|
||||||
this->split_->getChannel().get()->sendMessage(
|
this->split_->getChannel().get()->sendMessage(
|
||||||
@@ -652,10 +654,10 @@ void SplitHeader::handleChannelChanged()
|
|||||||
auto channel = this->split_->getChannel();
|
auto channel = this->split_->getChannel();
|
||||||
if (auto twitchChannel = dynamic_cast<TwitchChannel *>(channel.get()))
|
if (auto twitchChannel = dynamic_cast<TwitchChannel *>(channel.get()))
|
||||||
{
|
{
|
||||||
this->channelConnections_.emplace_back(
|
this->channelConnections_.managedConnect(
|
||||||
twitchChannel->liveStatusChanged.connect([this]() {
|
twitchChannel->liveStatusChanged, [this]() {
|
||||||
this->updateChannelText();
|
this->updateChannelText();
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class EffectLabel;
|
|||||||
class Label;
|
class Label;
|
||||||
class Split;
|
class Split;
|
||||||
|
|
||||||
class SplitHeader final : public BaseWidget, pajlada::Signals::SignalHolder
|
class SplitHeader final : public BaseWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -81,8 +81,8 @@ private:
|
|||||||
|
|
||||||
// signals
|
// signals
|
||||||
pajlada::Signals::NoArgSignal modeUpdateRequested_;
|
pajlada::Signals::NoArgSignal modeUpdateRequested_;
|
||||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections_;
|
pajlada::Signals::SignalHolder managedConnections_;
|
||||||
std::vector<pajlada::Signals::ScopedConnection> channelConnections_;
|
pajlada::Signals::SignalHolder channelConnections_;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void reloadChannelEmotes();
|
void reloadChannelEmotes();
|
||||||
|
|||||||
@@ -99,10 +99,10 @@ void SplitInput::initLayout()
|
|||||||
QObject::connect(this->ui_.textEdit, &QTextEdit::textChanged, this,
|
QObject::connect(this->ui_.textEdit, &QTextEdit::textChanged, this,
|
||||||
&SplitInput::onTextChanged);
|
&SplitInput::onTextChanged);
|
||||||
|
|
||||||
this->managedConnections_.push_back(app->fonts->fontChanged.connect([=]() {
|
this->managedConnections_.managedConnect(app->fonts->fontChanged, [=]() {
|
||||||
this->ui_.textEdit->setFont(
|
this->ui_.textEdit->setFont(
|
||||||
app->fonts->getFont(FontStyle::ChatMedium, this->scale()));
|
app->fonts->getFont(FontStyle::ChatMedium, this->scale()));
|
||||||
}));
|
});
|
||||||
|
|
||||||
// open emote popup
|
// open emote popup
|
||||||
QObject::connect(this->ui_.emoteButton, &EffectLabel::leftClicked, [=] {
|
QObject::connect(this->ui_.emoteButton, &EffectLabel::leftClicked, [=] {
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ private:
|
|||||||
QHBoxLayout *hbox;
|
QHBoxLayout *hbox;
|
||||||
} ui_;
|
} ui_;
|
||||||
|
|
||||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections_;
|
pajlada::Signals::SignalHolder managedConnections_;
|
||||||
QStringList prevMsg_;
|
QStringList prevMsg_;
|
||||||
QString currMsg_;
|
QString currMsg_;
|
||||||
int prevIndex_ = 0;
|
int prevIndex_ = 0;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ SplitOverlay::SplitOverlay(Split *parent)
|
|||||||
up->setCursor(Qt::PointingHandCursor);
|
up->setCursor(Qt::PointingHandCursor);
|
||||||
down->setCursor(Qt::PointingHandCursor);
|
down->setCursor(Qt::PointingHandCursor);
|
||||||
|
|
||||||
this->managedConnect(this->scaleChanged, [=](float _scale) {
|
this->signalHolder_.managedConnect(this->scaleChanged, [=](float _scale) {
|
||||||
int a = int(_scale * 30);
|
int a = int(_scale * 30);
|
||||||
QSize size(a, a);
|
QSize size(a, a);
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace chatterino {
|
|||||||
|
|
||||||
class Split;
|
class Split;
|
||||||
|
|
||||||
class SplitOverlay : public BaseWidget, pajlada::Signals::SignalHolder
|
class SplitOverlay : public BaseWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit SplitOverlay(Split *parent = nullptr);
|
explicit SplitOverlay(Split *parent = nullptr);
|
||||||
@@ -52,6 +52,8 @@ private:
|
|||||||
QPushButton *right_;
|
QPushButton *right_;
|
||||||
QPushButton *down_;
|
QPushButton *down_;
|
||||||
|
|
||||||
|
pajlada::Signals::SignalHolder signalHolder_;
|
||||||
|
|
||||||
friend class ButtonEventFilter;
|
friend class ButtonEventFilter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user