Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into chatterino7
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerixyz committed Sep 2, 2024
2 parents e229207 + 61b04db commit 403a0b6
Show file tree
Hide file tree
Showing 56 changed files with 1,466 additions and 551 deletions.
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ CheckOptions:
- key: readability-identifier-naming.FunctionCase
value: camelBack
- key: readability-identifier-naming.FunctionIgnoredRegexp
value: ^TEST$
value: ^(TEST|MOCK_METHOD)$

- key: readability-identifier-naming.MemberCase
value: camelBack
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
include:
- os: ubuntu-22.04
container: ghcr.io/chatterino/chatterino2-build-ubuntu-22.04:latest
qt-version: 6.6.1
qt-version: 6.7.2
force-lto: false
plugins: true
skip-artifact: false
Expand All @@ -42,7 +42,7 @@ jobs:
build-deb: true
- os: ubuntu-24.04
container: ghcr.io/chatterino/chatterino2-build-ubuntu-24.04:latest
qt-version: 6.6.1
qt-version: 6.7.2
force-lto: false
plugins: true
skip-artifact: false
Expand Down Expand Up @@ -363,13 +363,19 @@ jobs:
- uses: actions/download-artifact@v4
name: Linux AppImage
with:
name: Chatterino-x86_64-Qt-6.6.1.AppImage
name: Chatterino-x86_64-Qt-6.7.2.AppImage
path: release-artifacts/

- uses: actions/download-artifact@v4
name: Ubuntu 22.04 deb
with:
name: Chatterino-ubuntu-22.04-Qt-6.6.1.deb
name: Chatterino-ubuntu-22.04-Qt-6.7.2.deb
path: release-artifacts/

- uses: actions/download-artifact@v4
name: Ubuntu 24.04 deb
with:
name: Chatterino-ubuntu-24.04-Qt-6.7.2.deb
path: release-artifacts/

# macOS
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
build_dir: build-clang-tidy
config_file: ".clang-tidy"
split_workflow: true
exclude: "lib/*,tools/crash-handler/*"
exclude: "lib/*,tools/crash-handler/*,mocks/*"
cmake_command: >-
./.CI/setup-clang-tidy.sh
apt_packages: >-
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/create-installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ jobs:
working-directory: build
run: |
ls -l
mv Chatterino-ubuntu-22.04-Qt-6.6.1.deb Chatterino-Ubuntu-22.04-Qt6.deb
mv Chatterino-ubuntu-22.04-Qt-6.7.2.deb Chatterino-Ubuntu-22.04-Qt6.deb
mv Chatterino-ubuntu-24.04-Qt-6.7.2.deb Chatterino-Ubuntu-24.04-Qt6.deb
mv Chatterino-x86_64-Qt-6.6.1.AppImage Chatterino-x86_64-Qt6.AppImage
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
include:
- os: "ubuntu-22.04"
container: ghcr.io/chatterino/chatterino2-build-ubuntu-22.04:latest
qt-version: 6.6.1
qt-version: 6.7.1
plugins: true
fail-fast: false
env:
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
- Minor: Links can now have prefixes and suffixes such as parentheses. (#5486, #5515)
- Minor: Added support for scrolling in splits with touchscreen panning gestures. (#5524)
- Minor: Removed experimental IRC support. (#5547)
- Minor: Moderators can now see which mods start and cancel raids. (#5563)
- Minor: The emote popup now reloads when Twitch emotes are reloaded. (#5580)
- Bugfix: Fixed tab move animation occasionally failing to start after closing a tab. (#5426)
- Bugfix: If a network request errors with 200 OK, Qt's error code is now reported instead of the HTTP status. (#5378)
- Bugfix: Fixed restricted users usernames not being clickable. (#5405)
Expand All @@ -35,14 +37,16 @@
- Bugfix: Fixed a crash when tab completing while having an invalid plugin loaded. (#5401)
- Bugfix: Fixed windows on Windows not saving correctly when snapping them to the edges. (#5478)
- Bugfix: Fixed user info card popups adding duplicate line to log files. (#5499)
- Bugfix: Fixed tooltips and input completion popups not working after moving a split. (#5541)
- Bugfix: Fixed tooltips and input completion popups not working after moving a split. (#5541, #5576)
- Bugfix: Fixed rare issue on shutdown where the client would hang. (#5557)
- Bugfix: Fixed `/clearmessages` not working with more than one window. (#5489)
- Bugfix: Fixed splits staying paused after unfocusing Chatterino in certain configurations. (#5504)
- Bugfix: Links with invalid characters in the domain are no longer detected. (#5509)
- Bugfix: Fixed janky selection for messages with RTL segments (selection is still wrong, but consistently wrong). (#5525)
- Bugfix: Fixed event emotes not showing up in autocomplete and popups. (#5239, #5580)
- Bugfix: Fixed tab visibility being controllable in the emote popup. (#5530)
- Bugfix: Fixed account switch not being saved if no other settings were changed. (#5558)
- Bugfix: Fixed some tooltips not being readable. (#5578)
- Dev: Update Windows build from Qt 6.5.0 to Qt 6.7.1. (#5420)
- Dev: Update vcpkg build Qt from 6.5.0 to 6.7.0, boost from 1.83.0 to 1.85.0, openssl from 3.1.3 to 3.3.0. (#5422)
- Dev: Unsingletonize `ISoundController`. (#5462)
Expand Down Expand Up @@ -79,6 +83,7 @@
- Dev: Fixed benchmarks segfaulting on run. (#5559)
- Dev: Refactored `MessageBuilder` to be a single class. (#5548)
- Dev: Recent changes are now shown in the nightly release description. (#5553, #5554)
- Dev: The timer for `StreamerMode` is now destroyed on the correct thread. (#5571)

## 2.5.1

Expand Down
7 changes: 7 additions & 0 deletions mocks/include/mocks/EmptyApplication.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,13 @@ class EmptyApplication : public IApplication
return nullptr;
}

ITwitchUsers *getTwitchUsers() override
{
assert(false && "EmptyApplication::getTwitchUsers was called without "
"being initialized");
return nullptr;
}

QTemporaryDir settingsDir;
Paths paths_;
Args args_;
Expand Down
17 changes: 17 additions & 0 deletions mocks/include/mocks/Helix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,23 @@ class Helix : public IHelix
(FailureCallback<HelixSendMessageError, QString> failureCallback)),
(override));

// get user emotes
MOCK_METHOD(
void, getUserEmotes,
(QString userID, QString broadcasterID,
(ResultCallback<std::vector<HelixChannelEmote>, HelixPaginationState>
successCallback),
FailureCallback<QString> failureCallback, CancellationToken &&token),
(override));

// get followed channel
MOCK_METHOD(
void, getFollowedChannel,
(QString userID, QString broadcasterID,
ResultCallback<std::optional<HelixFollowedChannel>> successCallback,
FailureCallback<QString> failureCallback),
(override));

MOCK_METHOD(void, update, (QString clientId, QString oauthToken),
(override));

Expand Down
10 changes: 10 additions & 0 deletions src/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "providers/twitch/PubSubMessages.hpp"
#include "providers/twitch/TwitchChannel.hpp"
#include "providers/twitch/TwitchIrcServer.hpp"
#include "providers/twitch/TwitchUsers.hpp"
#include "singletons/CrashHandler.hpp"
#include "singletons/Emotes.hpp"
#include "singletons/Fonts.hpp"
Expand Down Expand Up @@ -181,6 +182,7 @@ Application::Application(Settings &_settings, const Paths &paths,
, logging(new Logging(_settings))
, linkResolver(new LinkResolver)
, streamerMode(new StreamerMode)
, twitchUsers(new TwitchUsers)
#ifdef CHATTERINO_HAVE_PLUGINS
, plugins(new PluginController(paths))
#endif
Expand Down Expand Up @@ -556,6 +558,14 @@ IStreamerMode *Application::getStreamerMode()
return this->streamerMode.get();
}

ITwitchUsers *Application::getTwitchUsers()
{
assertInGuiThread();
assert(this->twitchUsers);

return this->twitchUsers.get();
}

BttvEmotes *Application::getBttvEmotes()
{
assertInGuiThread();
Expand Down
4 changes: 4 additions & 0 deletions src/Application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class SeventvEmotes;
class SeventvEventAPI;
class ILinkResolver;
class IStreamerMode;
class ITwitchUsers;

class IApplication
{
Expand Down Expand Up @@ -108,6 +109,7 @@ class IApplication
virtual SeventvEventAPI *getSeventvEventAPI() = 0;
virtual ILinkResolver *getLinkResolver() = 0;
virtual IStreamerMode *getStreamerMode() = 0;
virtual ITwitchUsers *getTwitchUsers() = 0;
};

class Application : public IApplication
Expand Down Expand Up @@ -173,6 +175,7 @@ class Application : public IApplication
const std::unique_ptr<Logging> logging;
std::unique_ptr<ILinkResolver> linkResolver;
std::unique_ptr<IStreamerMode> streamerMode;
std::unique_ptr<ITwitchUsers> twitchUsers;
#ifdef CHATTERINO_HAVE_PLUGINS
std::unique_ptr<PluginController> plugins;
#endif
Expand Down Expand Up @@ -225,6 +228,7 @@ class Application : public IApplication

ILinkResolver *getLinkResolver() override;
IStreamerMode *getStreamerMode() override;
ITwitchUsers *getTwitchUsers() override;

private:
void initBttvLiveUpdates();
Expand Down
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,8 @@ set(SOURCE_FILES
providers/twitch/TwitchIrcServer.hpp
providers/twitch/TwitchUser.cpp
providers/twitch/TwitchUser.hpp
providers/twitch/TwitchUsers.cpp
providers/twitch/TwitchUsers.hpp

providers/twitch/pubsubmessages/AutoMod.cpp
providers/twitch/pubsubmessages/AutoMod.hpp
Expand Down Expand Up @@ -490,6 +492,7 @@ set(SOURCE_FILES
util/DebugCount.hpp
util/DisplayBadge.cpp
util/DisplayBadge.hpp
util/Expected.hpp
util/FormatTime.cpp
util/FormatTime.hpp
util/FunctionEventFilter.cpp
Expand Down
1 change: 1 addition & 0 deletions src/PrecompiledHeader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# include <IrcCommand>
# include <IrcConnection>
# include <IrcMessage>
# include <nonstd/expected.hpp>
# include <pajlada/serialize.hpp>
# include <pajlada/settings/setting.hpp>
# include <pajlada/settings/settinglistener.hpp>
Expand Down
2 changes: 1 addition & 1 deletion src/RunGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace {
dark.setColor(QPalette::Base, QColor("#333"));
dark.setColor(QPalette::AlternateBase, QColor("#444"));
dark.setColor(QPalette::ToolTipBase, Qt::white);
dark.setColor(QPalette::ToolTipText, Qt::white);
dark.setColor(QPalette::ToolTipText, Qt::black);
dark.setColor(QPalette::Dark, QColor(35, 35, 35));
dark.setColor(QPalette::Shadow, QColor(20, 20, 20));
dark.setColor(QPalette::Button, QColor(70, 70, 70));
Expand Down
58 changes: 35 additions & 23 deletions src/common/Aliases.hpp
Original file line number Diff line number Diff line change
@@ -1,38 +1,50 @@
#pragma once

#include <boost/container_hash/hash_fwd.hpp>
#include <QHash>
#include <QString>

#include <functional>

#define QStringAlias(name) \
namespace chatterino { \
struct name { \
QString string; \
bool operator==(const name &other) const \
{ \
return this->string == other.string; \
} \
bool operator!=(const name &other) const \
{ \
return this->string != other.string; \
} \
}; \
} /* namespace chatterino */ \
namespace std { \
template <> \
struct hash<chatterino::name> { \
size_t operator()(const chatterino::name &s) const \
{ \
return qHash(s.string); \
} \
}; \
} /* namespace std */
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define QStringAlias(name) \
namespace chatterino { \
struct name { \
QString string; \
bool operator==(const name &other) const \
{ \
return this->string == other.string; \
} \
bool operator!=(const name &other) const \
{ \
return this->string != other.string; \
} \
}; \
} /* namespace chatterino */ \
namespace std { \
template <> \
struct hash<chatterino::name> { \
size_t operator()(const chatterino::name &s) const \
{ \
return qHash(s.string); \
} \
}; \
} /* namespace std */ \
namespace boost { \
template <> \
struct hash<chatterino::name> { \
std::size_t operator()(chatterino::name const &s) const \
{ \
return qHash(s.string); \
} \
}; \
} /* namespace boost */

QStringAlias(UserName);
QStringAlias(UserId);
QStringAlias(Url);
QStringAlias(Tooltip);
QStringAlias(EmoteId);
QStringAlias(EmoteSetId);
QStringAlias(EmoteName);
QStringAlias(EmoteAuthor);
6 changes: 6 additions & 0 deletions src/common/Channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,12 @@ void Channel::deleteMessage(QString messageID)
}
}

void Channel::clearMessages()
{
this->messages_.clear();
this->messagesCleared.invoke();
}

MessagePtr Channel::findMessage(QString messageID)
{
MessagePtr res;
Expand Down
4 changes: 4 additions & 0 deletions src/common/Channel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class Channel : public std::enable_shared_from_this<Channel>
pajlada::Signals::Signal<const std::vector<MessagePtr> &> filledInMessages;
pajlada::Signals::NoArgSignal destroyed;
pajlada::Signals::NoArgSignal displayNameChanged;
pajlada::Signals::NoArgSignal messagesCleared;

Type getType() const;
const QString &getName() const;
Expand Down Expand Up @@ -99,6 +100,9 @@ class Channel : public std::enable_shared_from_this<Channel>
void replaceMessage(size_t index, MessagePtr replacement);
void deleteMessage(QString messageID);

/// Removes all messages from this channel and invokes #messagesCleared
void clearMessages();

MessagePtr findMessage(QString messageID);

bool hasMessages() const;
Expand Down
9 changes: 4 additions & 5 deletions src/controllers/commands/builtin/twitch/Raid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,8 @@ QString startRaid(const CommandContext &ctx)
channel{ctx.channel}](const HelixUser &targetUser) {
getHelix()->startRaid(
twitchChannel->roomId(), targetUser.id,
[channel, targetUser] {
channel->addSystemMessage(QString("You started to raid %1.")
.arg(targetUser.displayName));
[] {
// do nothing
},
[channel, targetUser](auto error, auto message) {
auto errorMessage = formatStartRaidError(error, message);
Expand Down Expand Up @@ -202,8 +201,8 @@ QString cancelRaid(const CommandContext &ctx)

getHelix()->cancelRaid(
ctx.twitchChannel->roomId(),
[channel{ctx.channel}] {
channel->addSystemMessage("You cancelled the raid.");
[] {
// do nothing
},
[channel{ctx.channel}](auto error, auto message) {
auto errorMessage = formatCancelRaidError(error, message);
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/commands/builtin/twitch/SendWhisper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ bool appendWhisperMessageWordsLocally(const QStringList &words)
for (int i = 2; i < words.length(); i++)
{
{ // Twitch emote
auto it = accemotes.emotes.find({words[i]});
if (it != accemotes.emotes.end())
auto it = accemotes->find({words[i]});
if (it != accemotes->end())
{
b.emplace<EmoteElement>(it->second,
MessageElementFlag::TwitchEmote);
Expand Down
Loading

0 comments on commit 403a0b6

Please sign in to comment.