From f0df2fcb28fc2eebf2f25f02b434db3461ca20df Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Sat, 27 Nov 2021 12:47:31 +0000 Subject: [PATCH 01/11] Fix Split Input hotkeys not being available when input is hidden (#3362) --- CHANGELOG.md | 1 + src/widgets/splits/SplitInput.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 947bf049d16..dbaf61d04f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ - Minor: Made join and part message have links to usercards. (#3358) - Minor: Show picked outcome in prediction badges. (#3357) - Minor: Add support for Emoji in IRC (#3354) +- Bugfix: Fix Split Input hotkeys not being available when input is hidden (#3362) - Bugfix: Fixed colored usernames sometimes not working. (#3170) - Bugfix: Restored ability to send duplicate `/me` messages. (#3166) - Bugfix: Notifications for moderators about other moderators deleting messages can now be disabled. (#3121) diff --git a/src/widgets/splits/SplitInput.cpp b/src/widgets/splits/SplitInput.cpp index c447b8403c7..b97a9133b73 100644 --- a/src/widgets/splits/SplitInput.cpp +++ b/src/widgets/splits/SplitInput.cpp @@ -457,7 +457,7 @@ void SplitInput::addShortcuts() }; this->shortcuts_ = getApp()->hotkeys->shortcutsForCategory( - HotkeyCategory::SplitInput, actions, this); + HotkeyCategory::SplitInput, actions, this->parentWidget()); } bool SplitInput::eventFilter(QObject *obj, QEvent *event) From cb0c42779a40794f3c64a5c940897c4bfdf260f6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 27 Nov 2021 13:29:34 +0000 Subject: [PATCH 02/11] Bump actions/cache from 2.1.6 to 2.1.7 (#3364) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/build.yml | 4 ++-- .github/workflows/test.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c6d5cc81aa5..1a6603eaab4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -52,7 +52,7 @@ jobs: - name: Cache Qt id: cache-qt - uses: actions/cache@v2.1.6 + uses: actions/cache@v2.1.7 with: path: ../Qt key: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-20210109 @@ -73,7 +73,7 @@ jobs: # WINDOWS - name: Cache conan packages if: startsWith(matrix.os, 'windows') - uses: actions/cache@v2.1.6 + uses: actions/cache@v2.1.7 with: key: ${{ runner.os }}-conan-${{ hashFiles('**/conanfile.txt') }}-20210412 path: C:/.conan/ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bd363a78a2c..e87c58b337c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: - name: Cache Qt id: cache-qt - uses: actions/cache@v2.1.6 + uses: actions/cache@v2.1.7 with: path: ../Qt key: ${{ runner.os }}-QtCache-20201005 From bc847f144535405a04c3d79b2791cef50cfe8126 Mon Sep 17 00:00:00 2001 From: pajlada Date: Sat, 27 Nov 2021 15:35:13 +0100 Subject: [PATCH 03/11] Fix IRC server messages not triggering sounds properly (#3368) --- CHANGELOG.md | 1 + src/providers/irc/IrcServer.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbaf61d04f2..8a098314700 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,7 @@ - Bugfix: Fixed splits losing filters when closing and reopening them (#3351) - Bugfix: Fixed the first usercard being broken in `/mods` and `/vips` (#3349) - Bugfix: Fixed Chatterino attempting to send empty messages (#3355) +- Bugfix: Fixed IRC highlights not triggering sounds or alerts properly. (#3368) - Dev: Add GitHub action to test builds without precompiled headers enabled. (#3327) - Dev: Renamed CMake's build option `USE_SYSTEM_QT5KEYCHAIN` to `USE_SYSTEM_QTKEYCHAIN`. (#3103) - Dev: Add benchmarks that can be compiled with the `BUILD_BENCHMARKS` CMake flag. Off by default. (#3038) diff --git a/src/providers/irc/IrcServer.cpp b/src/providers/irc/IrcServer.cpp index 70227d6ce65..d75f7921605 100644 --- a/src/providers/irc/IrcServer.cpp +++ b/src/providers/irc/IrcServer.cpp @@ -187,8 +187,8 @@ void IrcServer::privateMessageReceived(Communi::IrcPrivateMessage *message) if (!builder.isIgnored()) { - builder.triggerHighlights(); channel->addMessage(builder.build()); + builder.triggerHighlights(); } else { From 0deedf0191d326a7a02ccd6008fd234b8f6c9e12 Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Sat, 27 Nov 2021 15:03:10 +0000 Subject: [PATCH 04/11] Add issue forms (#3366) --- .github/ISSUE_TEMPLATE/a_make_a_report.yml | 53 +++++++++++++++++++ .github/ISSUE_TEMPLATE/a_report_your_issue.md | 48 ----------------- 2 files changed, 53 insertions(+), 48 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/a_make_a_report.yml delete mode 100644 .github/ISSUE_TEMPLATE/a_report_your_issue.md diff --git a/.github/ISSUE_TEMPLATE/a_make_a_report.yml b/.github/ISSUE_TEMPLATE/a_make_a_report.yml new file mode 100644 index 00000000000..d3b3b5af19b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/a_make_a_report.yml @@ -0,0 +1,53 @@ +name: Issue report +description: Report something that's missing, that you have trouble with or that stopped working +labels: [issue-report] + +body: + - type: checkboxes + id: acknowledgments + attributes: + label: Checklist + description: + options: + - label: I'm reporting a problem with Chatterino + required: true + - label: I've verified that I'm running a recent nightly build or the *newest* stable release + required: true + - label: I've looked for my problem on the [wiki](https://wiki.chatterino.com/Help/) + required: true + - label: I've searched the [issues](https://github.com/Chatterino/chatterino2/issues?q=) for similar looking reports + required: true + + - type: textarea + id: description + validations: + required: true + attributes: + label: Describe your issue + description: | + Write a brief description of your issue. + Important: + Focus on the problem instead of a concrete solution. This ensures that the focus of the thread is to resolve your issue. + If you want to voice a concrete idea you can add a comment below after posting the issue. + placeholder: | + Examples: + - I cannot do X. + - I have trouble doing X. + - Feature X has stopped working for me. + + - type: textarea + id: screenshots + attributes: + label: Screenshots + description: While optional, it's highly encouraged to include screenshots or videos to illustrate what you mean. + placeholder: You can upload them using the text editor's dedicated button. + + - type: input + id: versions + validations: + required: true + attributes: + label: OS and Chatterino Version + description: The name of your Operating System and the version shown in Chatterino's title bar. + placeholder: Chatterino 2.3.4 on Windows 10 (insiders) + diff --git a/.github/ISSUE_TEMPLATE/a_report_your_issue.md b/.github/ISSUE_TEMPLATE/a_report_your_issue.md deleted file mode 100644 index 6ee780f791a..00000000000 --- a/.github/ISSUE_TEMPLATE/a_report_your_issue.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -name: Make a Report -about: Report something that's missing, that you have trouble with or that stopped working. -title: '' -labels: issue-report -assignees: '' - ---- - -**Describe your issue** - - - - -**Screenshots** - - - - -**OS and Chatterino Version** - - From 8116c302619ea101f03eb4e044ba3b73e24ac6ae Mon Sep 17 00:00:00 2001 From: Felanbird <41973452+Felanbird@users.noreply.github.com> Date: Sun, 28 Nov 2021 06:19:08 -0500 Subject: [PATCH 05/11] Add some commented First Message code for consistency (#3370) --- src/controllers/highlights/HighlightModel.cpp | 16 ++++++++++++++++ src/messages/SharedMessageBuilder.cpp | 1 + src/singletons/Settings.hpp | 4 ++++ 3 files changed, 21 insertions(+) diff --git a/src/controllers/highlights/HighlightModel.cpp b/src/controllers/highlights/HighlightModel.cpp index a1bcb93e717..de945a75c1c 100644 --- a/src/controllers/highlights/HighlightModel.cpp +++ b/src/controllers/highlights/HighlightModel.cpp @@ -159,6 +159,12 @@ void HighlightModel::afterInit() firstMessageRow[Column::Pattern]->setData("First Messages", Qt::DisplayRole); firstMessageRow[Column::ShowInMentions]->setFlags({}); + // setBoolItem(firstMessageRow[Column::FlashTaskbar], + // getSettings()->enableFirstMessageHighlightTaskbar.getValue(), + // true, false); + // setBoolItem(firstMessageRow[Column::PlaySound], + // getSettings()->enableFirstMessageHighlightSound.getValue(), + // true, false); firstMessageRow[Column::FlashTaskbar]->setFlags({}); firstMessageRow[Column::PlaySound]->setFlags({}); firstMessageRow[Column::UseRegex]->setFlags({}); @@ -245,6 +251,11 @@ void HighlightModel::customRowSetData(const std::vector &row, // getSettings()->enableRedeemedHighlightTaskbar.setValue( // value.toBool()); } + else if (rowIndex == 4) + { + // getSettings()->enableFirstMessageHighlightTaskbar.setValue( + // value.toBool()); + } } } break; @@ -271,6 +282,11 @@ void HighlightModel::customRowSetData(const std::vector &row, // getSettings()->enableRedeemedHighlightSound.setValue( // value.toBool()); } + else if (rowIndex == 4) + { + // getSettings()->enableFirstMessageHighlightSound.setValue( + // value.toBool()); + } } } break; diff --git a/src/messages/SharedMessageBuilder.cpp b/src/messages/SharedMessageBuilder.cpp index 3af860f9fa9..f7f63880082 100644 --- a/src/messages/SharedMessageBuilder.cpp +++ b/src/messages/SharedMessageBuilder.cpp @@ -130,6 +130,7 @@ void SharedMessageBuilder::parseHighlights() { auto app = getApp(); + // Highlight because it's a subscription if (this->message().flags.has(MessageFlag::Subscription) && getSettings()->enableSubHighlight) { diff --git a/src/singletons/Settings.hpp b/src/singletons/Settings.hpp index 1d967a9d826..3aa4e1aa57a 100644 --- a/src/singletons/Settings.hpp +++ b/src/singletons/Settings.hpp @@ -275,6 +275,10 @@ class Settings : public ABSettings, public ConcurrentSettings BoolSetting enableFirstMessageHighlight = { "/highlighting/firstMessageHighlight/highlighted", true}; + // BoolSetting enableFirstMessageHighlightSound = { + // "/highlighting/firstMessageHighlight/enableSound", false}; + // BoolSetting enableFirstMessageHighlightTaskbar = { + // "/highlighting/firstMessageHighlight/enableTaskbarFlashing", false}; QStringSetting firstMessageHighlightSoundUrl = { "/highlighting/firstMessageHighlightSoundUrl", ""}; QStringSetting firstMessageHighlightColor = { From 7131f9ed363f537539e1f2e55a7606d015fb3d8e Mon Sep 17 00:00:00 2001 From: mmb L Date: Sat, 27 Nov 2021 21:52:18 +0800 Subject: [PATCH 06/11] Rename updateOnlineChatters() argument name and local variable --- src/common/ChannelChatters.cpp | 6 +++--- src/common/ChannelChatters.hpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/ChannelChatters.cpp b/src/common/ChannelChatters.cpp index fbf26e31f63..59e843d1bc1 100644 --- a/src/common/ChannelChatters.cpp +++ b/src/common/ChannelChatters.cpp @@ -71,10 +71,10 @@ void ChannelChatters::addPartedUser(const QString &user) } void ChannelChatters::updateOnlineChatters( - const std::unordered_set &chatters) + const std::unordered_set &usernames) { - auto chatters_ = this->chatters_.access(); - chatters_->updateOnlineChatters(chatters); + auto chatters = this->chatters_.access(); + chatters->updateOnlineChatters(usernames); } size_t ChannelChatters::colorsSize() const diff --git a/src/common/ChannelChatters.hpp b/src/common/ChannelChatters.hpp index 70ca539246b..96d4810d1cb 100644 --- a/src/common/ChannelChatters.hpp +++ b/src/common/ChannelChatters.hpp @@ -23,7 +23,7 @@ class ChannelChatters void addPartedUser(const QString &user); const QColor getUserColor(const QString &user); void setUserColor(const QString &user, const QColor &color); - void updateOnlineChatters(const std::unordered_set &chatters); + void updateOnlineChatters(const std::unordered_set &usernames); // colorsSize returns the amount of colors stored in `chatterColors_` // NOTE: This function is only meant to be used in tests and benchmarks From 7d350adfeb65402811662404f44471a12a1b8a12 Mon Sep 17 00:00:00 2001 From: mmb L Date: Sat, 27 Nov 2021 21:06:41 +0800 Subject: [PATCH 07/11] Refactor DownloaderManager private member variable names --- src/common/DownloadManager.cpp | 37 +++++++++++++++++----------------- src/common/DownloadManager.hpp | 9 ++++----- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/common/DownloadManager.cpp b/src/common/DownloadManager.cpp index 3a1f1dc49bd..f8344c304c3 100644 --- a/src/common/DownloadManager.cpp +++ b/src/common/DownloadManager.cpp @@ -1,21 +1,21 @@ #include "DownloadManager.hpp" +#include "common/QLogging.hpp" #include "singletons/Paths.hpp" #include -#include "common/QLogging.hpp" namespace chatterino { DownloadManager::DownloadManager(QObject *parent) : QObject(parent) + , manager_(new QNetworkAccessManager) { - manager = new QNetworkAccessManager; } DownloadManager::~DownloadManager() { - manager->deleteLater(); + this->manager_->deleteLater(); } void DownloadManager::setFile(QString fileURL, const QString &channelName) @@ -25,18 +25,18 @@ void DownloadManager::setFile(QString fileURL, const QString &channelName) getPaths()->twitchProfileAvatars + "/twitch/" + channelName + ".png"; QNetworkRequest request; request.setUrl(QUrl(fileURL)); - reply = manager->get(request); + this->reply_ = this->manager_->get(request); - file = new QFile; - file->setFileName(saveFilePath); - file->open(QIODevice::WriteOnly); + this->file_ = new QFile; + this->file_->setFileName(saveFilePath); + this->file_->open(QIODevice::WriteOnly); - connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, + connect(this->reply_, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(onDownloadProgress(qint64, qint64))); - connect(manager, SIGNAL(finished(QNetworkReply *)), this, + connect(this->manager_, SIGNAL(finished(QNetworkReply *)), this, SLOT(onFinished(QNetworkReply *))); - connect(reply, SIGNAL(readyRead()), this, SLOT(onReadyRead())); - connect(reply, SIGNAL(finished()), this, SLOT(onReplyFinished())); + connect(this->reply_, SIGNAL(readyRead()), this, SLOT(onReadyRead())); + connect(this->reply_, SIGNAL(finished()), this, SLOT(onReplyFinished())); } void DownloadManager::onDownloadProgress(qint64 bytesRead, qint64 bytesTotal) @@ -58,25 +58,26 @@ void DownloadManager::onFinished(QNetworkReply *reply) }; } - if (file->isOpen()) + if (this->file_->isOpen()) { - file->close(); - file->deleteLater(); + this->file_->close(); + this->file_->deleteLater(); } emit downloadComplete(); } void DownloadManager::onReadyRead() { - file->write(reply->readAll()); + this->file_->write(this->reply_->readAll()); } void DownloadManager::onReplyFinished() { - if (file->isOpen()) + if (this->file_->isOpen()) { - file->close(); - file->deleteLater(); + this->file_->close(); + this->file_->deleteLater(); } } + } // namespace chatterino diff --git a/src/common/DownloadManager.hpp b/src/common/DownloadManager.hpp index a160570c340..c41cae9c8d7 100644 --- a/src/common/DownloadManager.hpp +++ b/src/common/DownloadManager.hpp @@ -1,7 +1,5 @@ #pragma once -#include "Application.hpp" - #include #include #include @@ -20,9 +18,9 @@ class DownloadManager : public QObject void setFile(QString fileURL, const QString &channelName); private: - QNetworkAccessManager *manager; - QNetworkReply *reply; - QFile *file; + QNetworkAccessManager *manager_; + QNetworkReply *reply_; + QFile *file_; private slots: void onDownloadProgress(qint64, qint64); @@ -33,4 +31,5 @@ private slots: signals: void downloadComplete(); }; + } // namespace chatterino From ec966a17916e2640ead8cc95afe70425a61fbb2f Mon Sep 17 00:00:00 2001 From: mmb L Date: Sat, 27 Nov 2021 21:27:01 +0800 Subject: [PATCH 08/11] Remove local variables that are not referenced --- src/controllers/commands/CommandController.cpp | 2 -- src/providers/irc/IrcMessageBuilder.cpp | 1 - src/providers/twitch/TwitchMessageBuilder.cpp | 1 - src/widgets/settingspages/ModerationPage.cpp | 1 - src/widgets/splits/SplitContainer.cpp | 2 -- 5 files changed, 7 deletions(-) diff --git a/src/controllers/commands/CommandController.cpp b/src/controllers/commands/CommandController.cpp index 32771933caa..b2c47ddd021 100644 --- a/src/controllers/commands/CommandController.cpp +++ b/src/controllers/commands/CommandController.cpp @@ -951,8 +951,6 @@ QString CommandController::execCommand(const QString &textNoEmoji, } } - auto *twitchChannel = dynamic_cast(channel.get()); - { // check if user command exists const auto it = this->userCommands_.find(commandName); diff --git a/src/providers/irc/IrcMessageBuilder.cpp b/src/providers/irc/IrcMessageBuilder.cpp index b58957f86d0..2b8a56f2fb5 100644 --- a/src/providers/irc/IrcMessageBuilder.cpp +++ b/src/providers/irc/IrcMessageBuilder.cpp @@ -113,7 +113,6 @@ void IrcMessageBuilder::addWords(const QStringList &words) continue; } - int pos = 0; int lastPos = 0; while (i.hasNext()) diff --git a/src/providers/twitch/TwitchMessageBuilder.cpp b/src/providers/twitch/TwitchMessageBuilder.cpp index b8c594d22da..89a48891acd 100644 --- a/src/providers/twitch/TwitchMessageBuilder.cpp +++ b/src/providers/twitch/TwitchMessageBuilder.cpp @@ -312,7 +312,6 @@ void TwitchMessageBuilder::addWords( while (doesWordContainATwitchEmote(cursor, word, twitchEmotes, currentTwitchEmoteIt)) { - auto wordEnd = cursor + word.length(); const auto ¤tTwitchEmote = *currentTwitchEmoteIt; if (currentTwitchEmote.start == cursor) diff --git a/src/widgets/settingspages/ModerationPage.cpp b/src/widgets/settingspages/ModerationPage.cpp index 2b7e41ab728..27b0fff56c4 100644 --- a/src/widgets/settingspages/ModerationPage.cpp +++ b/src/widgets/settingspages/ModerationPage.cpp @@ -71,7 +71,6 @@ QString fetchLogDirectorySize() ModerationPage::ModerationPage() { - auto app = getApp(); LayoutCreator layoutCreator(this); auto tabs = layoutCreator.emplace(); diff --git a/src/widgets/splits/SplitContainer.cpp b/src/widgets/splits/SplitContainer.cpp index 1ada39ee826..74ecf277160 100644 --- a/src/widgets/splits/SplitContainer.cpp +++ b/src/widgets/splits/SplitContainer.cpp @@ -819,8 +819,6 @@ void SplitContainer::applyFromDescriptorRecursively( bool vertical = containerNode.vertical_; - Direction direction = vertical ? Direction::Below : Direction::Right; - node->type_ = vertical ? Node::VerticalContainer : Node::HorizontalContainer; From 179527611ef4dbd9a30ff287ddc9ddcbc9ae76b6 Mon Sep 17 00:00:00 2001 From: mmb L Date: Sat, 27 Nov 2021 21:51:37 +0800 Subject: [PATCH 09/11] Rename local variable and remove unused local variable in IrcMessageBuild.cpp --- src/providers/twitch/IrcMessageHandler.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/providers/twitch/IrcMessageHandler.cpp b/src/providers/twitch/IrcMessageHandler.cpp index 47010fb822d..8fa9a619d18 100644 --- a/src/providers/twitch/IrcMessageHandler.cpp +++ b/src/providers/twitch/IrcMessageHandler.cpp @@ -827,18 +827,18 @@ void IrcMessageHandler::handleNoticeMessage(Communi::IrcNoticeMessage *message) { return; } - auto &channelName = hostOn ? parts[2] : parts[0]; - if (channelName.size() < 2) + auto &hostedChannelName = hostOn ? parts[2] : parts[0]; + if (hostedChannelName.size() < 2) { return; } if (hostOn) { - channelName.chop(1); + hostedChannelName.chop(1); } MessageBuilder builder; - TwitchMessageBuilder::hostingSystemMessage(channelName, &builder, - hostOn); + TwitchMessageBuilder::hostingSystemMessage(hostedChannelName, + &builder, hostOn); channel->addMessage(builder.release()); } else if (tags == "room_mods" || tags == "vips_success") From 2075e889901ada65b929074227bfbe4dd7e0874b Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 28 Nov 2021 12:38:52 +0100 Subject: [PATCH 10/11] Tokenizer.cpp: Rename local variable in regex matching --- src/controllers/filters/parser/Tokenizer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/controllers/filters/parser/Tokenizer.cpp b/src/controllers/filters/parser/Tokenizer.cpp index cc00697e030..e7da03247cb 100644 --- a/src/controllers/filters/parser/Tokenizer.cpp +++ b/src/controllers/filters/parser/Tokenizer.cpp @@ -8,9 +8,9 @@ Tokenizer::Tokenizer(const QString &text) QRegularExpressionMatchIterator i = tokenRegex.globalMatch(text); while (i.hasNext()) { - auto text = i.next().captured(); - this->tokens_ << text; - this->tokenTypes_ << this->tokenize(text); + auto capturedText = i.next().captured(); + this->tokens_ << capturedText; + this->tokenTypes_ << this->tokenize(capturedText); } } From 3fcb6346f5e1642e11eacb3c3e89745af972382d Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 28 Nov 2021 12:39:32 +0100 Subject: [PATCH 11/11] MessagePredicate: Add virtual destructor --- src/messages/search/MessagePredicate.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/messages/search/MessagePredicate.hpp b/src/messages/search/MessagePredicate.hpp index d74557d1579..6deb2de5249 100644 --- a/src/messages/search/MessagePredicate.hpp +++ b/src/messages/search/MessagePredicate.hpp @@ -17,6 +17,8 @@ namespace chatterino { class MessagePredicate { public: + virtual ~MessagePredicate() = default; + /** * @brief Checks whether this predicate applies to the passed message. *