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 Feb 17, 2024
2 parents 1132751 + 42e4559 commit 3da8ec4
Show file tree
Hide file tree
Showing 17 changed files with 345 additions and 79 deletions.
30 changes: 30 additions & 0 deletions .CI/full-ubuntu-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh

# TODO: Investigate if the -fno-sized-deallocation flag is still necessary
# TODO: Test appimage/deb creation

set -e

env

rm -rf build
mkdir build
cmake \
-B build \
-DCMAKE_INSTALL_PREFIX=appdir/usr/ \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_APP=On \
-DBUILD_TESTS=On \
-DBUILD_BENCHMARKS=On \
-DUSE_PRECOMPILED_HEADERS=OFF \
-DCMAKE_EXPORT_COMPILE_COMMANDS=On \
-DCHATTERINO_PLUGINS="$C2_PLUGINS" \
-DCMAKE_PREFIX_PATH="$Qt6_DIR/lib/cmake" \
-DBUILD_WITH_QT6="$C2_BUILD_WITH_QT6" \
-DCHATTERINO_STATIC_QT_BUILD=On \
-DCMAKE_CXX_FLAGS="-fno-sized-deallocation" \
.
cmake --build build

# sh ./../.CI/CreateAppImage.sh
# sh ./../.CI/CreateUbuntuDeb.sh
100 changes: 41 additions & 59 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
name: Test
name: Test Ubuntu

on:
pull_request:
workflow_dispatch:
merge_group:

env:
TWITCH_PUBSUB_SERVER_IMAGE: ghcr.io/chatterino/twitch-pubsub-server-test:v1.0.6
TWITCH_PUBSUB_SERVER_TAG: v1.0.7
QT_QPA_PLATFORM: minimal

concurrency:
Expand All @@ -16,89 +16,71 @@ concurrency:

jobs:
test:
runs-on: ${{ matrix.os }}
name: "${{ matrix.os }}"
runs-on: ubuntu-latest
container: ${{ matrix.container }}
strategy:
matrix:
include:
- os: "ubuntu-22.04"
qt-version: "5.15.2"
- os: "ubuntu-22.04"
qt-version: "6.2.4"
container: ghcr.io/chatterino/chatterino2-build-ubuntu-22.04:latest
qt-version: 6.6.1
plugins: true
fail-fast: false
env:
C2_BUILD_WITH_QT6: ${{ startsWith(matrix.qt-version, '6.') && 'ON' || 'OFF' }}
QT_MODULES: ${{ startsWith(matrix.qt-version, '6.') && 'qt5compat qtimageformats' || '' }}
C2_PLUGINS: ${{ matrix.plugins }}
C2_BUILD_WITH_QT6: ${{ startsWith(matrix.qt-version, '6.') }}

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Qt
uses: jurplel/[email protected]
with:
cache: true
cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-v2
modules: ${{ env.QT_MODULES }}
version: ${{ matrix.qt-version }}

- name: Apply Qt patches (Ubuntu)
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.qt-version, '5.')
run: |
patch "$Qt5_DIR/include/QtConcurrent/qtconcurrentthreadengine.h" .patches/qt5-on-newer-gcc.patch
shell: bash

# LINUX
- name: Install dependencies (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get -y install \
libbenchmark-dev \
cmake \
rapidjson-dev \
libssl-dev \
libboost-dev \
libboost-system-dev \
libboost-filesystem-dev \
libpulse-dev \
libxkbcommon-x11-0 \
libgstreamer-plugins-base1.0-0 \
build-essential \
libgl1-mesa-dev \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-render-util0 \
libxcb-xinerama0
- name: Create build directory (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: mkdir build-test

- name: Install googlebench
run: |
mkdir build-test
shell: bash
sudo apt update
sudo apt -y install \
libbenchmark-dev
- name: Build (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: |
cmake \
-DBUILD_TESTS=On \
-DBUILD_BENCHMARKS=On \
-DBUILD_APP=OFF \
-DCHATTERINO_PLUGINS="$C2_PLUGINS" \
-DCMAKE_PREFIX_PATH="$Qt6_DIR/lib/cmake" \
-DBUILD_WITH_QT6="$C2_BUILD_WITH_QT6" \
-DCHATTERINO_STATIC_QT_BUILD=On \
..
cmake --build .
working-directory: build-test
shell: bash

- name: Test (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
- name: Download and extract Twitch PubSub Server Test
run: |
mkdir pubsub-server-test
curl -L -o pubsub-server.tar.gz "https://github.com/Chatterino/twitch-pubsub-server-test/releases/download/${{ env.TWITCH_PUBSUB_SERVER_TAG }}/server-${{ env.TWITCH_PUBSUB_SERVER_TAG }}-linux-amd64.tar.gz"
tar -xzf pubsub-server.tar.gz -C pubsub-server-test
rm pubsub-server.tar.gz
cd pubsub-server-test
curl -L -o server.crt "https://github.com/Chatterino/twitch-pubsub-server-test/raw/${{ env.TWITCH_PUBSUB_SERVER_TAG }}/cmd/server/server.crt"
curl -L -o server.key "https://github.com/Chatterino/twitch-pubsub-server-test/raw/${{ env.TWITCH_PUBSUB_SERVER_TAG }}/cmd/server/server.key"
cd ..
- uses: dtolnay/rust-toolchain@stable
- name: Cargo Install httpbox
run: |
cargo install --git https://github.com/kevinastone/httpbox --rev 89b971f
- name: Test
timeout-minutes: 30
run: |
docker pull kennethreitz/httpbin
docker pull ${{ env.TWITCH_PUBSUB_SERVER_IMAGE }}
docker run --network=host --detach ${{ env.TWITCH_PUBSUB_SERVER_IMAGE }}
docker run -p 9051:80 --detach kennethreitz/httpbin
ctest --repeat until-pass:4 --output-on-failure
httpbox --port 9051 &
cd ../pubsub-server-test
./server 127.0.0.1:9050 &
cd ../build-test
ctest --repeat until-pass:4 --output-on-failure --exclude-regex ClassicEmoteNameFiltering
working-directory: build-test
shell: bash
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@
- Bugfix: Fixed too much text being copied when copying chat messages. (#4812, #4830, #4839)
- Bugfix: Fixed an issue where the setting `Only search for emote autocompletion at the start of emote names` wouldn't disable if it was enabled when the client started. (#4855)
- Bugfix: Fixed empty page being added when showing out of bounds dialog. (#4849)
- Bugfix: Fixed an issue preventing searching a redemption by it's title when the redemption contained text input. (#5117)
- Bugfix: Fixed issue on Windows preventing the title bar from being dragged in the top left corner. (#4873)
- Bugfix: Fixed an issue where reply context didn't render correctly if an emoji was touching text. (#4875, #4977)
- Bugfix: Fixed the input completion popup from disappearing when clicking on it on Windows and macOS. (#4876)
- Bugfix: Fixed double-click text selection moving its position with each new message. (#4898)
- Bugfix: Fixed an issue where notifications on Windows would contain no or an old avatar. (#4899)
- Bugfix: Fixed headers of tables in the settings switching to bold text when selected. (#4913)
- Bugfix: Fixed an issue in the `/live` split that caused some channels to not get grayed-out when they went offline. (#5172)
- Bugfix: Fixed tooltips appearing too large and/or away from the cursor. (#4920)
- Bugfix: Fixed a crash when clicking `More messages below` button in a usercard and closing it quickly. (#4933)
- Bugfix: Fixed thread popup window missing messages for nested threads. (#4923)
Expand All @@ -65,7 +67,7 @@
- Bugfix: Fixed rare crash with Image Uploader when closing a split right after starting an upload. (#4971)
- Bugfix: Fixed an issue on macOS where the image uploader would keep prompting the user even after they clicked "Yes, don't ask again". (#5011)
- Bugfix: Hide the Usercard button in the User Info Popup when in special channels. (#4972)
- Bugfix: Fixed support for Windows 11 Snap layouts. (#4994)
- Bugfix: Fixed support for Windows 11 Snap layouts. (#4994, #5175)
- Bugfix: Fixed some windows appearing between screens. (#4797)
- Bugfix: Fixed a crash that could occur when using certain features in a Usercard after closing the split from which it was created. (#5034, #5051)
- Bugfix: Fixed a crash that could occur when using certain features in a Reply popup after closing the split from which it was created. (#5036, #5051)
Expand All @@ -75,6 +77,7 @@
- Bugfix: Fixed avatar in usercard and moderation button triggering when releasing the mouse outside their area. (#5052)
- Bugfix: Fixed moderator-only topics being subscribed to for non-moderators. (#5056)
- Bugfix: Fixed a bug where buttons would remain in a hovered state after leaving them. (#5077)
- Bugfix: Fixed an issue where you had to click the `reply` button twice if you already had that users @ in your input box. (#5173)
- Bugfix: Fixed popup windows not persisting between restarts. (#5081)
- Bugfix: Fixed splits not retaining their focus after minimizing. (#5080)
- Bugfix: Fixed _Copy message_ copying the channel name in global search. (#5106)
Expand Down Expand Up @@ -103,6 +106,7 @@
- Dev: Replace `boost::optional` with `std::optional`. (#4877)
- Dev: Improve performance of selecting text. (#4889, #4911)
- Dev: Removed direct dependency on Qt 5 compatibility module. (#4906)
- Dev: Added unit test capabilities to SplitInput. (#5179)
- Dev: Refactor `Emoji`'s EmojiMap into a vector. (#4980)
- Dev: Refactor `DebugCount` and add copy button to debug popup. (#4921)
- Dev: Refactor `common/Credentials`. (#4979)
Expand Down
7 changes: 7 additions & 0 deletions benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,10 @@ set_target_properties(${PROJECT_NAME}
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/bin"
AUTORCC ON
)

if (CHATTERINO_STATIC_QT_BUILD)
qt_import_plugins(${PROJECT_NAME} INCLUDE_BY_TYPE
platforms Qt::QXcbIntegrationPlugin
Qt::QMinimalIntegrationPlugin
)
endif ()
9 changes: 9 additions & 0 deletions mocks/include/mocks/EmptyApplication.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,15 @@ class EmptyApplication : public IApplication
return nullptr;
}

#ifdef CHATTERINO_HAVE_PLUGINS
PluginController *getPlugins() override
{
assert(false && "EmptyApplication::getPlugins was called without "
"being initialized");
return nullptr;
}
#endif

Updates &getUpdates() override
{
return this->updates_;
Expand Down
6 changes: 6 additions & 0 deletions mocks/include/mocks/TwitchIrcServer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ class MockTwitchIrcServer : public ITwitchIrcServer
return this->watchingChannel;
}

QString getLastUserThatWhisperedMe() const override
{
return this->lastUserThatWhisperedMe;
}

ChannelPtr watchingChannelInner;
IndirectChannel watchingChannel;
QString lastUserThatWhisperedMe{"forsen"};
};

} // namespace chatterino::mock
7 changes: 5 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ add_library(${LIBRARY_PROJECT} OBJECT ${SOURCE_FILES})

if(CHATTERINO_PLUGINS)
target_compile_definitions(${LIBRARY_PROJECT}
PRIVATE
PUBLIC
CHATTERINO_HAVE_PLUGINS
)
message(STATUS "Building Chatterino with lua plugin support enabled.")
Expand Down Expand Up @@ -838,7 +838,10 @@ if (BUILD_APP)
endif()

if (CHATTERINO_STATIC_QT_BUILD)
qt_import_plugins(${EXECUTABLE_PROJECT} INCLUDE_BY_TYPE platforms Qt::QXcbIntegrationPlugin)
qt_import_plugins(${EXECUTABLE_PROJECT} INCLUDE_BY_TYPE
platforms Qt::QXcbIntegrationPlugin
Qt::QMinimalIntegrationPlugin
)
endif ()

target_include_directories(${EXECUTABLE_PROJECT} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR}/autogen/)
Expand Down
3 changes: 2 additions & 1 deletion src/controllers/notifications/NotificationController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ void NotificationController::removeFakeChannel(const QString channelName)
{
const auto &s = snapshot[i];

if (s->messageText == liveMessageSearchText)
if (QString::compare(s->messageText, liveMessageSearchText,
Qt::CaseInsensitive) == 0)
{
s->flags.set(MessageFlag::Disabled);
break;
Expand Down
6 changes: 3 additions & 3 deletions src/providers/twitch/TwitchChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,14 @@ TwitchChannel::TwitchChannel(const QString &name)
MessageBuilder builder;
TwitchMessageBuilder::liveSystemMessage(this->getDisplayName(),
&builder);
builder.message().id = this->roomId();
this->addMessage(builder.release());

// Message in /live channel
MessageBuilder builder2;
TwitchMessageBuilder::liveMessage(this->getDisplayName(),
&builder2);
builder2.message().id = this->roomId();
getApp()->twitch->liveChannel->addMessage(builder2.release());

// Notify on all channels with a ping sound
Expand Down Expand Up @@ -200,14 +202,12 @@ TwitchChannel::TwitchChannel(const QString &name)

// MSVC hates this code if the parens are not there
int end = (std::max)(0, snapshotLength - 200);
auto liveMessageSearchText =
QString("%1 is live!").arg(this->getDisplayName());

for (int i = snapshotLength - 1; i >= end; --i)
{
const auto &s = snapshot[i];

if (s->messageText == liveMessageSearchText)
if (s->id == this->roomId())
{
s->flags.set(MessageFlag::Disabled);
break;
Expand Down
5 changes: 5 additions & 0 deletions src/providers/twitch/TwitchIrcServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,11 @@ const IndirectChannel &TwitchIrcServer::getWatchingChannel() const
return this->watchingChannel;
}

QString TwitchIrcServer::getLastUserThatWhisperedMe() const
{
return this->lastUserThatWhisperedMe.get();
}

void TwitchIrcServer::reloadBTTVGlobalEmotes()
{
getIApp()->getBttvEmotes()->loadEmotes();
Expand Down
4 changes: 4 additions & 0 deletions src/providers/twitch/TwitchIrcServer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ class ITwitchIrcServer

virtual const IndirectChannel &getWatchingChannel() const = 0;

virtual QString getLastUserThatWhisperedMe() const = 0;

// Update this interface with TwitchIrcServer methods as needed
};

Expand Down Expand Up @@ -81,6 +83,8 @@ class TwitchIrcServer final : public AbstractIrcServer,

const IndirectChannel &getWatchingChannel() const override;

QString getLastUserThatWhisperedMe() const override;

protected:
void initializeConnection(IrcConnection *connection,
ConnectionType type) override;
Expand Down
7 changes: 4 additions & 3 deletions src/providers/twitch/TwitchMessageBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,9 +565,10 @@ MessagePtr TwitchMessageBuilder::build()
this->stylizeUsername(this->userName, this->message());

this->message().messageText = this->originalMessage_;
this->message().searchText = stylizedUsername + " " +
this->message().localizedName + " " +
this->userName + ": " + this->originalMessage_;
this->message().searchText =
stylizedUsername + " " + this->message().localizedName + " " +
this->userName + ": " + this->originalMessage_ + " " +
this->message().searchText;

// highlights
this->parseHighlights();
Expand Down
7 changes: 7 additions & 0 deletions src/widgets/BaseWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,13 @@ bool BaseWindow::handleSIZE(MSG *msg)
QPoint(rect.right - 1, rect.bottom - 1));
}
this->useNextBounds_.stop();

if (msg->wParam == SIZE_MINIMIZED && this->ui_.titlebarButtons)
{
// Windows doesn't send a WM_NCMOUSELEAVE event when clicking
// the minimize button, so we have to emulate it.
this->ui_.titlebarButtons->leave();
}
}
}
return false;
Expand Down
Loading

0 comments on commit 3da8ec4

Please sign in to comment.