Update Settings and Signals version (#3398)

Co-authored-by: zneix <zneix@zneix.eu>
This commit is contained in:
pajlada
2021-12-19 15:57:56 +01:00
committed by GitHub
parent 60ff82f2de
commit 51ece94f58
39 changed files with 282 additions and 268 deletions
+1 -1
View File
@@ -83,7 +83,7 @@ LastRunCrashDialog::LastRunCrashDialog()
// };
// updateUpdateLabel();
// this->managedConnect(updateManager.statusUpdated,
// this->signalHolder_.managedConnect(updateManager.statusUpdated,
// [updateUpdateLabel](auto) mutable {
// postToThread([updateUpdateLabel]() mutable { updateUpdateLabel();
// });
+4 -1
View File
@@ -5,10 +5,13 @@
namespace chatterino {
class LastRunCrashDialog : public QDialog, pajlada::Signals::SignalHolder
class LastRunCrashDialog : public QDialog
{
public:
LastRunCrashDialog();
private:
pajlada::Signals::SignalHolder signalHolder_;
};
} // namespace chatterino
+18 -25
View File
@@ -430,12 +430,6 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, QWidget *parent)
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()
{
BaseWindow::themeChangedEvent();
@@ -601,26 +595,25 @@ void UserInfoPopup::updateLatestMessages()
// shrink dialog in case ChannelView goes from visible to hidden
this->adjustSize();
this->refreshConnection_
.disconnect(); // remove once https://github.com/pajlada/signals/pull/10 gets merged
this->refreshConnection_ =
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(
[this, hasMessages](auto message, auto) {
if (!checkMessageUserName(this->userName_, message))
return;
if (hasMessages)
{
// display message in ChannelView
this->ui_.latestMessages->channel()->addMessage(message);
}
else
{
// The ChannelView is currently hidden, so manually refresh
// and display the latest messages
this->updateLatestMessages();
}
});
if (hasMessages)
{
// display message in ChannelView
this->ui_.latestMessages->channel()->addMessage(message);
}
else
{
// The ChannelView is currently hidden, so manually refresh
// and display the latest messages
this->updateLatestMessages();
}
}));
}
void UserInfoPopup::updateUserData()
+2 -3
View File
@@ -3,6 +3,7 @@
#include "widgets/BaseWindow.hpp"
#include "widgets/helper/ChannelView.hpp"
#include <pajlada/signals/scoped-connection.hpp>
#include <pajlada/signals/signal.hpp>
class QCheckBox;
@@ -19,7 +20,6 @@ class UserInfoPopup final : public BaseWindow
public:
UserInfoPopup(bool closeAutomatically, QWidget *parent);
~UserInfoPopup();
void setData(const QString &name, const ChannelPtr &channel);
@@ -43,8 +43,7 @@ private:
pajlada::Signals::NoArgSignal userStateChanged_;
// replace with ScopedConnection once https://github.com/pajlada/signals/pull/10 gets merged
pajlada::Signals::Connection refreshConnection_;
std::unique_ptr<pajlada::Signals::ScopedConnection> refreshConnection_;
std::shared_ptr<bool> hack_;