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 Aug 26, 2024
2 parents e67b8aa + 6e104bd commit e229207
Show file tree
Hide file tree
Showing 118 changed files with 4,325 additions and 4,208 deletions.
10 changes: 7 additions & 3 deletions .CI/CreateUbuntuDeb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ install_prefix="appdir/usr"
# The directory we finally pack into our .deb package
packaging_dir="package"

# Get the Ubuntu Release (e.g. 20.04 or 22.04)
# Get the Ubuntu Release (e.g. 20.04, 22.04 or 24.04)
ubuntu_release="$(lsb_release -rs)"

# The final path where we'll save the .deb package
Expand All @@ -22,11 +22,15 @@ deb_path="Chatterino-ubuntu-${ubuntu_release}-x86_64.deb"
case "$ubuntu_release" in
20.04)
# Qt6 static-linked deb, see https://github.com/Chatterino/docker
dependencies="libc6, libstdc++6, libblkid1, libbsd0, libc6, libexpat1, libffi7, libfontconfig1, libfreetype6, libglib2.0-0, libglvnd0, libglx0, libgraphite2-3, libharfbuzz0b, libicu66, libjpeg-turbo8, libmount1, libopengl0, libpcre2-16-0, libpcre3, libpng16-16, libselinux1, libssl1.1, libstdc++6, libuuid1, libx11-xcb1, libxau6, libxcb1, libxcb-cursor0, libxcb-glx0, libxcb-icccm4, libxcb-image0, libxcb-keysyms1, libxcb-randr0, libxcb-render0, libxcb-render-util0, libxcb-shape0, libxcb-shm0, libxcb-sync1, libxcb-util1, libxcb-xfixes0, libxcb-xkb1, libxdmcp6, libxkbcommon0, libxkbcommon-x11-0, zlib1g"
dependencies="libc6, libstdc++6, libblkid1, libbsd0, libexpat1, libffi7, libfontconfig1, libfreetype6, libglib2.0-0, libglvnd0, libglx0, libgraphite2-3, libharfbuzz0b, libicu66, libjpeg-turbo8, libmount1, libopengl0, libpcre2-16-0, libpcre3, libpng16-16, libselinux1, libssl1.1, libuuid1, libx11-xcb1, libxau6, libxcb1, libxcb-cursor0, libxcb-glx0, libxcb-icccm4, libxcb-image0, libxcb-keysyms1, libxcb-randr0, libxcb-render0, libxcb-render-util0, libxcb-shape0, libxcb-shm0, libxcb-sync1, libxcb-util1, libxcb-xfixes0, libxcb-xkb1, libxdmcp6, libxkbcommon0, libxkbcommon-x11-0, zlib1g"
;;
22.04)
# Qt6 static-linked deb, see https://github.com/Chatterino/docker
dependencies="libc6, libstdc++6, libglx0, libopengl0, libpng16-16, libharfbuzz0b, libfreetype6, libfontconfig1, libjpeg-turbo8, libxcb-glx0, libegl1, libx11-6, libxkbcommon0, libx11-xcb1, libxkbcommon-x11-0, libxcb-cursor0, libxcb-icccm4, libxcb-image0, libxcb-keysyms1, libxcb-randr0, libxcb-render-util0, libxcb-shm0, libxcb-sync1, libxcb-xfixes0, libxcb-render0, libxcb-shape0, libxcb-xkb1, libxcb1, libbrotli1, libglib2.0-0, zlib1g, libicu70, libpcre2-16-0, libssl3, libgraphite2-3, libexpat1, libuuid1, libxcb-util1, libxau6, libxdmcp6, libbrotli1, libffi8, libmount1, libselinux1, libpcre3, libicu70, libbsd0, libblkid1, libpcre2-8-0, libmd0"
dependencies="libc6, libstdc++6, libglx0, libopengl0, libpng16-16, libharfbuzz0b, libfreetype6, libfontconfig1, libjpeg-turbo8, libxcb-glx0, libegl1, libx11-6, libxkbcommon0, libx11-xcb1, libxkbcommon-x11-0, libxcb-cursor0, libxcb-icccm4, libxcb-image0, libxcb-keysyms1, libxcb-randr0, libxcb-render-util0, libxcb-shm0, libxcb-sync1, libxcb-xfixes0, libxcb-render0, libxcb-shape0, libxcb-xkb1, libxcb1, libbrotli1, libglib2.0-0, zlib1g, libicu70, libpcre2-16-0, libssl3, libgraphite2-3, libexpat1, libuuid1, libxcb-util1, libxau6, libxdmcp6, libffi8, libmount1, libselinux1, libpcre3, libbsd0, libblkid1, libpcre2-8-0, libmd0"
;;
24.04)
# Qt6 static-linked deb, see https://github.com/Chatterino/docker
dependencies="libc6, libstdc++6, libglx0, libopengl0, libpng16-16, libharfbuzz0b, libfreetype6, libfontconfig1, libjpeg-turbo8, libxcb-glx0, libegl1, libx11-6, libxkbcommon0, libx11-xcb1, libxkbcommon-x11-0, libxcb-cursor0, libxcb-icccm4, libxcb-image0, libxcb-keysyms1, libxcb-randr0, libxcb-render-util0, libxcb-shm0, libxcb-sync1, libxcb-xfixes0, libxcb-render0, libxcb-shape0, libxcb-xkb1, libxcb1, libbrotli1, libglib2.0-0, zlib1g, libicu74, libpcre2-16-0, libssl3, libgraphite2-3, libexpat1, libuuid1, libxcb-util1, libxau6, libxdmcp6, libffi8, libmount1, libselinux1, libpcre3, libbsd0, libblkid1, libpcre2-8-0, libmd0"
;;
*)
echo "Unsupported Ubuntu release $ubuntu_release"
Expand Down
61 changes: 61 additions & 0 deletions .CI/format-recent-changes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
from datetime import datetime, timezone
import os
import subprocess
import re

LINE_REGEX = re.compile(
r"""(?x)
^(?P<commit>[A-Fa-f0-9]+)\s+
\(
<(?P<email>[^>]+)>\s+
(?P<date>[^\s]+\s[^\s]+\s[^\s]+)\s+
(?P<line>\d+)
\)\s
(?P<content>.*)$
"""
)
VERSION_REGEX = re.compile(r"^#+\s*v?\d")

# contains lines in the form of
# {commit-sha} (<{email}>\s+{date}\s+{line-no}) {line}
p = subprocess.run(
["git", "blame", "-e", "--date=iso", "../CHANGELOG.md"],
cwd=os.path.dirname(os.path.realpath(__file__)),
text=True,
check=True,
capture_output=True,
)

unreleased_lines: list[tuple[datetime, str]] = []
for line in p.stdout.splitlines():
if not line:
continue
m = LINE_REGEX.match(line)
assert m, f"Failed to match '{line}'"
content = m.group("content")

if not content:
continue
if content.startswith("#"):
if VERSION_REGEX.match(content):
break
continue # ignore lines with '#'

d = datetime.fromisoformat(m.group("date"))
d = d.astimezone(tz=timezone.utc)
content = content.replace("- ", f"- [{d.strftime('%Y-%m-%d')}] ", 1)
unreleased_lines.append((d, content))

unreleased_lines.sort(key=lambda it: it[0], reverse=True)

if len(unreleased_lines) == 0:
print("No changes since last release.")

for _, line in unreleased_lines[:5]:
print(line)

if len(unreleased_lines) > 5:
print("<details><summary>More Changes</summary>\n")
for _, line in unreleased_lines[5:]:
print(line)
print("</details>")
3 changes: 3 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,6 @@ CheckOptions:

- key: misc-const-correctness.AnalyzeValues
value: false

- key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor
value: true
27 changes: 26 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ jobs:
skip-crashpad: false
build-appimage: true
build-deb: true
- os: ubuntu-24.04
container: ghcr.io/chatterino/chatterino2-build-ubuntu-24.04:latest
qt-version: 6.6.1
force-lto: false
plugins: true
skip-artifact: false
skip-crashpad: false
build-appimage: false
build-deb: true
env:
C2_ENABLE_LTO: ${{ matrix.force-lto }}
C2_PLUGINS: ${{ matrix.plugins }}
Expand Down Expand Up @@ -385,14 +394,30 @@ jobs:
working-directory: release-artifacts
shell: bash

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Format changes
id: format-changes
run: |
delimiter=$(openssl rand -hex 32)
{
echo "changelog<<$delimiter"
python3 ./.CI/format-recent-changes.py
echo $delimiter
} >> "$GITHUB_OUTPUT"
shell: bash

- name: Create release
uses: ncipollo/[email protected]
with:
replacesArtifacts: true
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: "release-artifacts/*"
body: ${{ github.event.head_commit.message }}
body: ${{ steps.format-changes.outputs.changelog }}
prerelease: true
name: Nightly Release
tag: nightly-build
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

- Major: Release plugins alpha. (#5288)
- Major: Improve high-DPI support on Windows. (#4868, #5391)
- Minor: Removed the Ctrl+Shift+L hotkey for toggling the "live only" tab visibility state. (#5530)
- Minor: Moved tab visibility control to a submenu, without any toggle actions. (#5530)
- Minor: Add option to customise Moderation buttons with images. (#5369)
- Minor: Colored usernames now update on the fly when changing the "Color @usernames" setting. (#5300)
- Minor: Added `flags.action` filter variable, allowing you to filter on `/me` messages. (#5397)
Expand Down Expand Up @@ -34,10 +36,13 @@
- 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 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 tab visibility being controllable in the emote popup. (#5530)
- Bugfix: Fixed account switch not being saved if no other settings were changed. (#5558)
- 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 All @@ -52,6 +57,7 @@
- Dev: Unsingletonize `Resources2`. (#5460)
- Dev: All Lua globals now show in the `c2` global in the LuaLS metadata. (#5385)
- Dev: Images are now loaded in worker threads. (#5431)
- Dev: Fixed broken `SignalVector::operator[]` implementation. (#5556)
- Dev: Qt Creator now auto-configures Conan when loading the project and skips vcpkg. (#5305)
- Dev: The MSVC CRT is now bundled with Chatterino as it depends on having a recent version installed. (#5447)
- Dev: Refactor/unsingletonize `UserDataController`. (#5459)
Expand All @@ -64,10 +70,15 @@
- Dev: Refactored 7TV/BTTV definitions out of `TwitchIrcServer` into `Application`. (#5532)
- Dev: Refactored code that's responsible for deleting old update files. (#5535)
- Dev: Cleanly exit on shutdown. (#5537)
- Dev: Removed the `getTwitchAbstract` method in `Application`. (#5560)
- Dev: Renamed threads created by Chatterino on Linux and Windows. (#5538, #5539, #5544)
- Dev: Refactored a few `#define`s into `const(expr)` and cleaned includes. (#5527)
- Dev: Added `FlagsEnum::isEmpty`. (#5550)
- Dev: Prepared for Qt 6.8 by addressing some deprecations. (#5529)
- Dev: Moved some responsibility away from Application into WindowManager. (#5551)
- 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)

## 2.5.1

Expand Down
17 changes: 11 additions & 6 deletions benchmarks/src/Highlights.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#include "controllers/highlights/HighlightController.hpp"
#include "controllers/highlights/HighlightPhrase.hpp"
#include "messages/Message.hpp"
#include "messages/SharedMessageBuilder.hpp"
#include "messages/MessageBuilder.hpp"
#include "mocks/BaseApplication.hpp"
#include "singletons/Settings.hpp"
#include "mocks/UserData.hpp"
#include "util/Helpers.hpp"

#include <benchmark/benchmark.h>
Expand All @@ -16,15 +16,16 @@

using namespace chatterino;

class BenchmarkMessageBuilder : public SharedMessageBuilder
class BenchmarkMessageBuilder : public MessageBuilder
{
public:
explicit BenchmarkMessageBuilder(
Channel *_channel, const Communi::IrcPrivateMessage *_ircMessage,
const MessageParseArgs &_args)
: SharedMessageBuilder(_channel, _ircMessage, _args)
: MessageBuilder(_channel, _ircMessage, _args)
{
}

virtual MessagePtr build()
{
// PARSE
Expand Down Expand Up @@ -64,15 +65,19 @@ class MockApplication : public mock::BaseApplication
return &this->highlights;
}

IUserDataController *getUserData() override
{
return &this->userData;
}

AccountController accounts;
HighlightController highlights;
mock::UserDataController userData;
};

static void BM_HighlightTest(benchmark::State &state)
{
MockApplication mockApplication;
QTemporaryDir settingsDir;
Settings settings(settingsDir.path());

std::string message =
R"(@badge-info=subscriber/34;badges=moderator/1,subscriber/24;color=#FF0000;display-name=테스트계정420;emotes=41:6-13,15-22;flags=;id=a3196c7e-be4c-4b49-9c5a-8b8302b50c2a;mod=1;room-id=11148817;subscriber=1;tmi-sent-ts=1590922213730;turbo=0;user-id=117166826;user-type=mod :testaccount_420!testaccount_420@testaccount_420.tmi.twitch.tv PRIVMSG #pajlada :-tags Kreygasm,Kreygasm (no space))";
Expand Down
5 changes: 4 additions & 1 deletion benchmarks/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "common/Args.hpp"
#include "singletons/Resources.hpp"
#include "singletons/Settings.hpp"

Expand All @@ -16,10 +17,12 @@ int main(int argc, char **argv)

::benchmark::Initialize(&argc, argv);

Args args;

// Ensure settings are initialized before any benchmarks are run
QTemporaryDir settingsDir;
settingsDir.setAutoRemove(false); // we'll remove it manually
chatterino::Settings settings(settingsDir.path());
chatterino::Settings settings(args, settingsDir.path());

QTimer::singleShot(0, [&]() {
::benchmark::RunSpecifiedBenchmarks();
Expand Down
32 changes: 30 additions & 2 deletions mocks/include/mocks/BaseApplication.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#pragma once

#include "common/Args.hpp"
#include "mocks/DisabledStreamerMode.hpp"
#include "mocks/EmptyApplication.hpp"
#include "providers/bttv/BttvLiveUpdates.hpp"
#include "singletons/Fonts.hpp"
#include "singletons/Settings.hpp"
#include "singletons/Theme.hpp"

#include <QString>

Expand All @@ -16,21 +19,42 @@ class BaseApplication : public EmptyApplication
{
public:
BaseApplication()
: settings(this->settingsDir.filePath("settings.json"))
: settings(this->args, this->settingsDir.path())
, updates(this->paths_, this->settings)
, theme(this->paths_)
, fonts(this->settings)
{
}

explicit BaseApplication(const QString &settingsData)
: EmptyApplication(settingsData)
, settings(this->settingsDir.filePath("settings.json"))
, settings(this->args, this->settingsDir.path())
, updates(this->paths_, this->settings)
, theme(this->paths_)
, fonts(this->settings)
{
}

Updates &getUpdates() override
{
return this->updates;
}

IStreamerMode *getStreamerMode() override
{
return &this->streamerMode;
}

Theme *getThemes() override
{
return &this->theme;
}

Fonts *getFonts() override
{
return &this->fonts;
}

BttvLiveUpdates *getBttvLiveUpdates() override
{
return nullptr;
Expand All @@ -41,8 +65,12 @@ class BaseApplication : public EmptyApplication
return nullptr;
}

Args args;
Settings settings;
Updates updates;
DisabledStreamerMode streamerMode;
Theme theme;
Fonts fonts;
};

} // namespace chatterino::mock
19 changes: 1 addition & 18 deletions mocks/include/mocks/EmptyApplication.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@ namespace chatterino::mock {
class EmptyApplication : public IApplication
{
public:
EmptyApplication()
: updates_(this->paths_)
{
}
EmptyApplication() = default;

explicit EmptyApplication(const QString &settingsData)
: EmptyApplication()
{
QFile settingsFile(this->settingsDir.filePath("settings.json"));
settingsFile.open(QIODevice::WriteOnly | QIODevice::Text);
Expand Down Expand Up @@ -133,13 +129,6 @@ class EmptyApplication : public IApplication
return nullptr;
}

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

PubSub *getTwitchPubSub() override
{
assert(false && "getTwitchPubSub was called without being initialized");
Expand Down Expand Up @@ -233,11 +222,6 @@ class EmptyApplication : public IApplication
}
#endif

Updates &getUpdates() override
{
return this->updates_;
}

BttvEmotes *getBttvEmotes() override
{
assert(false && "EmptyApplication::getBttvEmotes was called without "
Expand Down Expand Up @@ -290,7 +274,6 @@ class EmptyApplication : public IApplication
QTemporaryDir settingsDir;
Paths paths_;
Args args_;
Updates updates_;
};

} // namespace chatterino::mock
Loading

0 comments on commit e229207

Please sign in to comment.