mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Merge branch 'master' of https://github.com/fourtf/chatterino2
This commit is contained in:
commit
1fb0ca649a
16 changed files with 52 additions and 74 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit d3faa9b3996e0871473b0e2b1821c93a50821f40
|
Subproject commit a8c167976e907d8caa19f921d7a4984c6658a2a9
|
|
@ -1 +1 @@
|
||||||
Subproject commit 2c9c92b971f4a1313eeb4d9daf8ea59565d3c691
|
Subproject commit fcce2886e5443e88bc70228b1929d8c0e1bb641a
|
|
@ -77,7 +77,7 @@ AccountManager::AccountManager()
|
||||||
{
|
{
|
||||||
this->Twitch.anonymousUser.reset(new twitch::TwitchUser("justinfan64537", "", ""));
|
this->Twitch.anonymousUser.reset(new twitch::TwitchUser("justinfan64537", "", ""));
|
||||||
|
|
||||||
this->Twitch.currentUsername.getValueChangedSignal().connect([this](const auto &newValue) {
|
this->Twitch.currentUsername.connect([this](const auto &newValue, auto) {
|
||||||
QString newUsername(QString::fromStdString(newValue));
|
QString newUsername(QString::fromStdString(newValue));
|
||||||
auto user = this->Twitch.findUserByUsername(newUsername);
|
auto user = this->Twitch.findUserByUsername(newUsername);
|
||||||
if (user) {
|
if (user) {
|
||||||
|
|
|
@ -34,13 +34,8 @@ ColorScheme::ColorScheme(WindowManager &windowManager)
|
||||||
{
|
{
|
||||||
this->update();
|
this->update();
|
||||||
|
|
||||||
this->themeName.getValueChangedSignal().connect([=](const auto &) {
|
this->themeName.connectSimple([this](auto) { this->update(); });
|
||||||
this->update(); //
|
this->themeHue.connectSimple([this](auto) { this->update(); });
|
||||||
});
|
|
||||||
|
|
||||||
this->themeHue.getValueChangedSignal().connect([=](const auto &) {
|
|
||||||
this->update(); //
|
|
||||||
});
|
|
||||||
|
|
||||||
this->updated.connect([&windowManager] {
|
this->updated.connect([&windowManager] {
|
||||||
windowManager.repaintVisibleChatWidgets(); //
|
windowManager.repaintVisibleChatWidgets(); //
|
||||||
|
@ -140,10 +135,10 @@ void ColorScheme::normalizeColor(QColor &color)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (color.lightnessF() < 0.6f && color.hueF() > 0.54444 && color.hueF() < 0.83333) {
|
if (color.lightnessF() < 0.6f && color.hueF() > 0.54444 && color.hueF() < 0.83333) {
|
||||||
color.setHslF(color.hueF(), color.saturationF(),
|
color.setHslF(
|
||||||
color.lightnessF() +
|
color.hueF(), color.saturationF(),
|
||||||
sin((color.hueF() - 0.54444) / (0.8333 - 0.54444) * 3.14159) *
|
color.lightnessF() + sin((color.hueF() - 0.54444) / (0.8333 - 0.54444) * 3.14159) *
|
||||||
color.saturationF() * 0.2);
|
color.saturationF() * 0.2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ EmoteManager::EmoteManager()
|
||||||
pajlada::Settings::Setting<std::string> roomID(
|
pajlada::Settings::Setting<std::string> roomID(
|
||||||
"/accounts/current/roomID", "", pajlada::Settings::SettingOption::DoNotWriteToJSON);
|
"/accounts/current/roomID", "", pajlada::Settings::SettingOption::DoNotWriteToJSON);
|
||||||
|
|
||||||
roomID.getValueChangedSignal().connect([this](const std::string &roomID) {
|
roomID.getValueChangedSignal().connect([this](const std::string &roomID, auto) {
|
||||||
this->refreshTwitchEmotes(roomID); //
|
this->refreshTwitchEmotes(roomID); //
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,12 +9,12 @@ FontManager::FontManager()
|
||||||
, currentFontSize("/appearance/currentFontSize", 14)
|
, currentFontSize("/appearance/currentFontSize", 14)
|
||||||
, currentFont(this->currentFontFamily.getValue().c_str(), currentFontSize.getValue())
|
, currentFont(this->currentFontFamily.getValue().c_str(), currentFontSize.getValue())
|
||||||
{
|
{
|
||||||
this->currentFontFamily.getValueChangedSignal().connect([this](const std::string &newValue) {
|
this->currentFontFamily.connect([this](const std::string &newValue, auto) {
|
||||||
this->incGeneration();
|
this->incGeneration();
|
||||||
this->currentFont.setFamily(newValue.c_str()); //
|
this->currentFont.setFamily(newValue.c_str());
|
||||||
this->fontChanged.invoke();
|
this->fontChanged.invoke();
|
||||||
});
|
});
|
||||||
this->currentFontSize.getValueChangedSignal().connect([this](const int &newValue) {
|
this->currentFontSize.connect([this](const int &newValue, auto) {
|
||||||
this->incGeneration();
|
this->incGeneration();
|
||||||
this->currentFont.setSize(newValue);
|
this->currentFont.setSize(newValue);
|
||||||
this->fontChanged.invoke();
|
this->fontChanged.invoke();
|
||||||
|
|
|
@ -20,31 +20,31 @@ SettingsManager::SettingsManager()
|
||||||
QMap<QString, QPair<bool, bool>>())
|
QMap<QString, QPair<bool, bool>>())
|
||||||
, highlightUserBlacklist(this->settingsItems, "highlightUserBlacklist", "")
|
, highlightUserBlacklist(this->settingsItems, "highlightUserBlacklist", "")
|
||||||
{
|
{
|
||||||
this->showTimestamps.getValueChangedSignal().connect([this](const auto &) {
|
this->showTimestamps.connectSimple([this](auto) {
|
||||||
this->updateWordTypeMask(); //
|
this->updateWordTypeMask(); //
|
||||||
});
|
});
|
||||||
|
|
||||||
this->showTimestampSeconds.getValueChangedSignal().connect([this](const auto &) {
|
this->showTimestampSeconds.connectSimple([this](auto) {
|
||||||
this->updateWordTypeMask(); //
|
this->updateWordTypeMask(); //
|
||||||
});
|
});
|
||||||
|
|
||||||
this->showBadges.getValueChangedSignal().connect([this](const auto &) {
|
this->showBadges.connectSimple([this](auto) {
|
||||||
this->updateWordTypeMask(); //
|
this->updateWordTypeMask(); //
|
||||||
});
|
});
|
||||||
|
|
||||||
this->enableBttvEmotes.getValueChangedSignal().connect([this](const auto &) {
|
this->enableBttvEmotes.connectSimple([this](auto) {
|
||||||
this->updateWordTypeMask(); //
|
this->updateWordTypeMask(); //
|
||||||
});
|
});
|
||||||
|
|
||||||
this->enableEmojis.getValueChangedSignal().connect([this](const auto &) {
|
this->enableEmojis.connectSimple([this](auto) {
|
||||||
this->updateWordTypeMask(); //
|
this->updateWordTypeMask(); //
|
||||||
});
|
});
|
||||||
|
|
||||||
this->enableFfzEmotes.getValueChangedSignal().connect([this](const auto &) {
|
this->enableFfzEmotes.connectSimple([this](auto) {
|
||||||
this->updateWordTypeMask(); //
|
this->updateWordTypeMask(); //
|
||||||
});
|
});
|
||||||
|
|
||||||
this->enableTwitchEmotes.getValueChangedSignal().connect([this](const auto &) {
|
this->enableTwitchEmotes.connectSimple([this](auto) {
|
||||||
this->updateWordTypeMask(); //
|
this->updateWordTypeMask(); //
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,9 +61,9 @@ ChannelView::ChannelView(BaseWidget *parent)
|
||||||
this->goToBottom->getLabel().setText("Jump to bottom");
|
this->goToBottom->getLabel().setText("Jump to bottom");
|
||||||
this->goToBottom->setVisible(false);
|
this->goToBottom->setVisible(false);
|
||||||
|
|
||||||
this->fontChangedConnection = FontManager::getInstance().fontChanged.connect([this] {
|
this->managedConnections.emplace_back(FontManager::getInstance().fontChanged.connect([this] {
|
||||||
this->layoutMessages(); //
|
this->layoutMessages(); //
|
||||||
});
|
}));
|
||||||
|
|
||||||
connect(goToBottom, &RippleEffectLabel::clicked, this,
|
connect(goToBottom, &RippleEffectLabel::clicked, this,
|
||||||
[this] { QTimer::singleShot(180, [this] { this->scrollBar.scrollToBottom(); }); });
|
[this] { QTimer::singleShot(180, [this] { this->scrollBar.scrollToBottom(); }); });
|
||||||
|
@ -83,7 +83,6 @@ ChannelView::~ChannelView()
|
||||||
{
|
{
|
||||||
QObject::disconnect(&SettingsManager::getInstance(), &SettingsManager::wordTypeMaskChanged,
|
QObject::disconnect(&SettingsManager::getInstance(), &SettingsManager::wordTypeMaskChanged,
|
||||||
this, &ChannelView::wordTypeMaskChanged);
|
this, &ChannelView::wordTypeMaskChanged);
|
||||||
FontManager::getInstance().fontChanged.disconnect(this->fontChangedConnection);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelView::queueUpdate()
|
void ChannelView::queueUpdate()
|
||||||
|
@ -246,9 +245,8 @@ QString ChannelView::getSelectedText()
|
||||||
|
|
||||||
if (first) {
|
if (first) {
|
||||||
first = false;
|
first = false;
|
||||||
bool isSingleWord =
|
bool isSingleWord = isSingleMessage && this->selection.max.charIndex - charIndex <
|
||||||
isSingleMessage &&
|
part.getCharacterLength();
|
||||||
this->selection.max.charIndex - charIndex < part.getCharacterLength();
|
|
||||||
|
|
||||||
if (isSingleWord) {
|
if (isSingleWord) {
|
||||||
// return single word
|
// return single word
|
||||||
|
@ -525,10 +523,9 @@ void ChannelView::updateMessageBuffer(messages::MessageRef *messageRef, QPixmap
|
||||||
// this->selectionMax.messageIndex >= messageIndex) {
|
// this->selectionMax.messageIndex >= messageIndex) {
|
||||||
// painter.fillRect(buffer->rect(), QColor(24, 55, 25));
|
// painter.fillRect(buffer->rect(), QColor(24, 55, 25));
|
||||||
//} else {
|
//} else {
|
||||||
painter.fillRect(buffer->rect(),
|
painter.fillRect(buffer->rect(), (messageRef->getMessage()->getCanHighlightTab())
|
||||||
(messageRef->getMessage()->getCanHighlightTab())
|
? this->colorScheme.ChatBackgroundHighlighted
|
||||||
? this->colorScheme.ChatBackgroundHighlighted
|
: this->colorScheme.ChatBackground);
|
||||||
: this->colorScheme.ChatBackground);
|
|
||||||
//}
|
//}
|
||||||
|
|
||||||
// draw selection
|
// draw selection
|
||||||
|
|
|
@ -163,7 +163,7 @@ private:
|
||||||
boost::signals2::connection repaintGifsConnection;
|
boost::signals2::connection repaintGifsConnection;
|
||||||
boost::signals2::connection layoutConnection;
|
boost::signals2::connection layoutConnection;
|
||||||
|
|
||||||
pajlada::Signals::NoArgSignal::Connection fontChangedConnection;
|
std::vector<pajlada::Signals::ScopedConnection> managedConnections;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void wordTypeMaskChanged()
|
void wordTypeMaskChanged()
|
||||||
|
|
|
@ -22,8 +22,8 @@ NotebookTab::NotebookTab(Notebook *_notebook)
|
||||||
|
|
||||||
this->positionChangedAnimation.setEasingCurve(QEasingCurve(QEasingCurve::InCubic));
|
this->positionChangedAnimation.setEasingCurve(QEasingCurve(QEasingCurve::InCubic));
|
||||||
|
|
||||||
this->hideXConnection = SettingsManager::getInstance().hideTabX.getValueChangedSignal().connect(
|
SettingsManager::getInstance().hideTabX.connect(
|
||||||
boost::bind(&NotebookTab::hideTabXChanged, this, _1));
|
boost::bind(&NotebookTab::hideTabXChanged, this, _1), this->managedConnections);
|
||||||
|
|
||||||
this->setMouseTracking(true);
|
this->setMouseTracking(true);
|
||||||
|
|
||||||
|
@ -60,12 +60,6 @@ NotebookTab::NotebookTab(Notebook *_notebook)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
NotebookTab::~NotebookTab()
|
|
||||||
{
|
|
||||||
SettingsManager::getInstance().hideTabX.getValueChangedSignal().disconnect(
|
|
||||||
this->hideXConnection);
|
|
||||||
}
|
|
||||||
|
|
||||||
void NotebookTab::calcSize()
|
void NotebookTab::calcSize()
|
||||||
{
|
{
|
||||||
float scale = getDpiMultiplier();
|
float scale = getDpiMultiplier();
|
||||||
|
|
|
@ -5,9 +5,7 @@
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QPropertyAnimation>
|
#include <QPropertyAnimation>
|
||||||
#include <boost/property_tree/ptree.hpp>
|
#include <boost/property_tree/ptree.hpp>
|
||||||
#include <boost/signals2.hpp>
|
#include <pajlada/signals/connection.hpp>
|
||||||
#include <boost/signals2/connection.hpp>
|
|
||||||
#include <pajlada/signals/signal.hpp>
|
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
|
@ -26,7 +24,6 @@ public:
|
||||||
enum HighlightStyle { HighlightNone, HighlightHighlighted, HighlightNewMessage };
|
enum HighlightStyle { HighlightNone, HighlightHighlighted, HighlightNewMessage };
|
||||||
|
|
||||||
explicit NotebookTab(Notebook *_notebook);
|
explicit NotebookTab(Notebook *_notebook);
|
||||||
~NotebookTab();
|
|
||||||
|
|
||||||
void calcSize();
|
void calcSize();
|
||||||
|
|
||||||
|
@ -58,7 +55,7 @@ protected:
|
||||||
void mouseMoveEvent(QMouseEvent *event) override;
|
void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
pajlada::Signals::Signal<const bool &>::Connection hideXConnection;
|
std::vector<pajlada::Signals::ScopedConnection> managedConnections;
|
||||||
|
|
||||||
QPropertyAnimation positionChangedAnimation;
|
QPropertyAnimation positionChangedAnimation;
|
||||||
bool positionChangedAnimationRunning = false;
|
bool positionChangedAnimationRunning = false;
|
||||||
|
|
|
@ -30,9 +30,9 @@ SplitInput::SplitInput(Split *_chatWidget)
|
||||||
auto &fontManager = FontManager::getInstance();
|
auto &fontManager = FontManager::getInstance();
|
||||||
|
|
||||||
this->textInput.setFont(fontManager.getFont(FontManager::Type::Medium));
|
this->textInput.setFont(fontManager.getFont(FontManager::Type::Medium));
|
||||||
fontManager.fontChanged.connect([this, &fontManager]() {
|
this->managedConnections.emplace_back(fontManager.fontChanged.connect([this, &fontManager]() {
|
||||||
this->textInput.setFont(fontManager.getFont(FontManager::Type::Medium));
|
this->textInput.setFont(fontManager.getFont(FontManager::Type::Medium));
|
||||||
});
|
}));
|
||||||
|
|
||||||
this->editContainer.addWidget(&this->textInput);
|
this->editContainer.addWidget(&this->textInput);
|
||||||
this->editContainer.setMargin(4);
|
this->editContainer.setMargin(4);
|
||||||
|
@ -177,9 +177,9 @@ SplitInput::SplitInput(Split *_chatWidget)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this->textLengthVisibleChangedConnection =
|
SettingsManager::getInstance().showMessageLength.connect(
|
||||||
SettingsManager::getInstance().showMessageLength.getValueChangedSignal().connect(
|
[this](const bool &value, auto) { this->textLengthLabel.setHidden(!value); },
|
||||||
[this](const bool &value) { this->textLengthLabel.setHidden(!value); });
|
this->managedConnections);
|
||||||
|
|
||||||
QObject::connect(&this->textInput, &QTextEdit::copyAvailable, [this](bool available) {
|
QObject::connect(&this->textInput, &QTextEdit::copyAvailable, [this](bool available) {
|
||||||
if (available) {
|
if (available) {
|
||||||
|
@ -188,12 +188,6 @@ SplitInput::SplitInput(Split *_chatWidget)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
SplitInput::~SplitInput()
|
|
||||||
{
|
|
||||||
SettingsManager::getInstance().showMessageLength.getValueChangedSignal().disconnect(
|
|
||||||
this->textLengthVisibleChangedConnection);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SplitInput::clearSelection()
|
void SplitInput::clearSelection()
|
||||||
{
|
{
|
||||||
QTextCursor c = this->textInput.textCursor();
|
QTextCursor c = this->textInput.textCursor();
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include <boost/signals2.hpp>
|
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
||||||
|
@ -26,7 +24,6 @@ class SplitInput : public BaseWidget
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SplitInput(Split *_chatWidget);
|
SplitInput(Split *_chatWidget);
|
||||||
~SplitInput();
|
|
||||||
|
|
||||||
void clearSelection();
|
void clearSelection();
|
||||||
|
|
||||||
|
@ -40,7 +37,7 @@ private:
|
||||||
Split *const chatWidget;
|
Split *const chatWidget;
|
||||||
EmotePopup *emotePopup = nullptr;
|
EmotePopup *emotePopup = nullptr;
|
||||||
|
|
||||||
pajlada::Signals::Signal<const bool &>::Connection textLengthVisibleChangedConnection;
|
std::vector<pajlada::Signals::ScopedConnection> managedConnections;
|
||||||
QHBoxLayout hbox;
|
QHBoxLayout hbox;
|
||||||
QVBoxLayout vbox;
|
QVBoxLayout vbox;
|
||||||
QHBoxLayout editContainer;
|
QHBoxLayout editContainer;
|
||||||
|
|
|
@ -36,10 +36,10 @@ Notebook::Notebook(ChannelManager &_channelManager, Window *parent, bool _showBu
|
||||||
this->userButton.move(24, 0);
|
this->userButton.move(24, 0);
|
||||||
this->userButton.icon = NotebookButton::IconUser;
|
this->userButton.icon = NotebookButton::IconUser;
|
||||||
|
|
||||||
SettingsManager::getInstance().hidePreferencesButton.getValueChangedSignal().connect(
|
auto &settingsManager = SettingsManager::getInstance();
|
||||||
[this](const bool &) { this->performLayout(); });
|
|
||||||
SettingsManager::getInstance().hideUserButton.getValueChangedSignal().connect(
|
settingsManager.hidePreferencesButton.connectSimple([this](auto) { this->performLayout(); });
|
||||||
[this](const bool &) { this->performLayout(); });
|
settingsManager.hideUserButton.connectSimple([this](auto) { this->performLayout(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
SplitContainer *Notebook::addPage(bool select)
|
SplitContainer *Notebook::addPage(bool select)
|
||||||
|
|
|
@ -181,15 +181,17 @@ QVBoxLayout *SettingsDialog::createAppearanceTab()
|
||||||
{
|
{
|
||||||
auto &fontManager = FontManager::getInstance();
|
auto &fontManager = FontManager::getInstance();
|
||||||
|
|
||||||
fontManager.currentFontFamily.getValueChangedSignal().connect(
|
fontManager.currentFontFamily.connect(
|
||||||
[fontFamilyLabel](const std::string &newValue) {
|
[fontFamilyLabel](const std::string &newValue, auto) {
|
||||||
fontFamilyLabel->setText(QString::fromStdString(newValue)); //
|
fontFamilyLabel->setText(QString::fromStdString(newValue)); //
|
||||||
});
|
},
|
||||||
|
this->managedConnections);
|
||||||
|
|
||||||
fontManager.currentFontSize.getValueChangedSignal().connect(
|
fontManager.currentFontSize.connect(
|
||||||
[fontSizeLabel](const int &newValue) {
|
[fontSizeLabel](const int &newValue, auto) {
|
||||||
fontSizeLabel->setText(QString(QString::number(newValue))); //
|
fontSizeLabel->setText(QString(QString::number(newValue))); //
|
||||||
});
|
},
|
||||||
|
this->managedConnections);
|
||||||
}
|
}
|
||||||
|
|
||||||
fontButton->connect(fontButton, &QPushButton::clicked, []() {
|
fontButton->connect(fontButton, &QPushButton::clicked, []() {
|
||||||
|
|
|
@ -80,6 +80,8 @@ private:
|
||||||
|
|
||||||
void okButtonClicked();
|
void okButtonClicked();
|
||||||
void cancelButtonClicked();
|
void cancelButtonClicked();
|
||||||
|
|
||||||
|
std::vector<pajlada::Signals::ScopedConnection> managedConnections;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace widgets
|
} // namespace widgets
|
||||||
|
|
Loading…
Reference in a new issue