Skip to content

Commit

Permalink
Merge branch 'chatterino7' into feat/regular-build
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerixyz committed Sep 17, 2023
2 parents 1403b4d + 41e4138 commit 3ce746c
Show file tree
Hide file tree
Showing 61 changed files with 420 additions and 276 deletions.
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ Checks: "-*,
-performance-noexcept-move-constructor,
-misc-non-private-member-variables-in-classes,
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-special-member-functions,
-modernize-use-nodiscard,
-modernize-use-trailing-return-type,
-readability-identifier-length,
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
echo "C2_BUILD_WITH_QT6=ON" >> "$GITHUB_ENV"
shell: bash

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # allows for tags access
Expand Down Expand Up @@ -284,7 +284,7 @@ jobs:

- name: clang-tidy review
if: matrix.clang-tidy-review && github.event_name == 'pull_request'
uses: ZedThree/clang-tidy-review@v0.13.3
uses: ZedThree/clang-tidy-review@v0.13.4
with:
build_dir: build-clang-tidy
config_file: ".clang-tidy"
Expand Down Expand Up @@ -312,7 +312,7 @@ jobs:
- name: clang-tidy-review upload
if: matrix.clang-tidy-review && github.event_name == 'pull_request'
uses: ZedThree/clang-tidy-review/upload@v0.13.3
uses: ZedThree/clang-tidy-review/upload@v0.13.4

- name: Package - AppImage (Ubuntu)
if: startsWith(matrix.os, 'ubuntu-22.04') && !matrix.skip-artifact
Expand Down Expand Up @@ -346,7 +346,7 @@ jobs:
- name: Install dependencies (MacOS)
if: startsWith(matrix.os, 'macos')
run: |
brew install boost openssl rapidjson p7zip create-dmg cmake tree libavif
brew install boost openssl rapidjson p7zip create-dmg cmake tree
shell: bash

- name: Build (MacOS)
Expand Down Expand Up @@ -391,7 +391,7 @@ jobs:
if: (github.event_name == 'push' && github.ref == 'refs/heads/chatterino7')

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # allows for tags access

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: apt-get update
run: sudo apt-get update
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create-installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
env:
VARIANT_SUFFIX: ${{ startsWith(matrix.qt-version, '6.') && '.EXPERIMENTAL-Qt6' || '' }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # allows for tags access

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Check formatting with Prettier
uses: actionsx/prettier@3d9f7c3fa44c9cb819e68292a328d7f4384be206
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/post-clang-tidy-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: ZedThree/clang-tidy-review/post@v0.13.3
- uses: ZedThree/clang-tidy-review/post@v0.13.4
with:
lgtm_comment_body: ""
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
QT_MODULES: ${{ startsWith(matrix.qt-version, '6.') && 'qt5compat qtimageformats' || '' }}

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

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Thumbs.db
dependencies
.cache
.editorconfig
vim.log

### CMake ###
CMakeLists.txt.user
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@

## Unversioned

- Minor: Migrate to the new Get Channel Followers Helix endpoint, fixing follower count not showing up in usercards. (#4809)
- Bugfix: Fixed a performance issue when displaying replies to certain messages. (#4807)
- Bugfix: Fixed a data race when disconnecting from Twitch PubSub. (#4771)
- Bugfix: Fixed `/shoutout` command not working with usernames starting with @'s (e.g. `/shoutout @forsen`). (#4800)
- Bugfix: Fixed selection of tabs after closing a tab when using "Live Tabs Only". (#4770)
- Bugfix: Fixed input in reply thread popup losing focus when dragging. (#4815)
- Dev: Fixed UTF16 encoding of `modes` file for the installer. (#4791)
- Dev: Temporarily disable High DPI scaling on Qt6 builds on Windows. (#4767)
- Dev: Tests now run on Ubuntu 22.04 instead of 20.04 to loosen C++ restrictions in tests. (#4774)
- Dev: Do a pretty major refactor of the Settings classes. List settings (e.g. highlights) are most heavily modified, and should have an extra eye kept on them. (#4775)
- Dev: Remove `boost::noncopyable` use & `boost_random` dependency. (#4776)
- Dev: Fix clang-tidy `cppcoreguidelines-pro-type-member-init` warnings. (#4426)
- Dev: Immediate layout for invisible `ChannelView`s is skipped. (#4811)
- Dev: Refactor `Image` & Image's `Frames`. (#4773)

## 2.4.5

Expand Down
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,15 @@ macro(set_alternate_linker linker)
else()
add_link_options("-fuse-ld=${USE_ALTERNATE_LINKER}")
endif()
message(STATUS "Linking with ${USE_ALTERNATE_LINKER}")
else()
set(USE_ALTERNATE_LINKER "" CACHE STRING "Use alternate linker" FORCE)
message(STATUS "Failed to find alternate linker ${USE_ALTERNATE_LINKER}")
endif()
endmacro()

set(USE_ALTERNATE_LINKER "" CACHE STRING "Use alternate linker. Leave empty for system default; alternatives are 'gold', 'lld', 'bfd', 'mold'")

if(NOT "${USE_ALTERNATE_LINKER}" STREQUAL "")
set_alternate_linker(${USE_ALTERNATE_LINKER})
endif()
Expand Down Expand Up @@ -119,9 +122,7 @@ endif ()
find_package(Sanitizers QUIET)

# Find boost on the system
# `OPTIONAL_COMPONENTS random` is required for vcpkg builds to link.
# `OPTIONAL` is required, because conan doesn't set `boost_random_FOUND`.
find_package(Boost REQUIRED OPTIONAL_COMPONENTS random)
find_package(Boost REQUIRED OPTIONAL_COMPONENTS headers)

# Find OpenSSL on the system
find_package(OpenSSL REQUIRED)
Expand Down
17 changes: 15 additions & 2 deletions cmake/AVIF.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
find_package(libavif)

if (libavif_FOUND)
if (libavif_FOUND AND NOT APPLE)
set(kimageformats_SRC ${CMAKE_SOURCE_DIR}/lib/kimageformats/src/imageformats)

add_library(kimageformats STATIC ${kimageformats_SRC}/avif.cpp)
set_target_properties(kimageformats PROPERTIES AUTOMOC ON)
target_link_libraries(kimageformats PRIVATE Qt${MAJOR_QT_VERSON}::Gui avif)
target_link_libraries(kimageformats PRIVATE Qt${MAJOR_QT_VERSON}::Gui)

if (WIN32)
target_link_libraries(kimageformats PRIVATE avif)
else()
# See https://github.com/desktop-app/cmake_helpers/blob/af968dc8eab6bde381ad62ef6a516bdfccb7d038/target_link_static_libraries.cmake
find_library(static_lib_avif libavif.a)
if (${static_lib_avif} STREQUAL static_lib_avif-NOTFOUND)
message(FATAL_ERROR "Could not find static library libavif.a")
endif()
target_include_directories(kimageformats PRIVATE ${_avif_dir})
target_link_libraries(kimageformats PRIVATE ${static_lib_avif})
endif()

target_compile_definitions(kimageformats PRIVATE QT_STATICPLUGIN)
endif()
2 changes: 1 addition & 1 deletion lib/lua/src
3 changes: 2 additions & 1 deletion lib/qt-plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ add_library(chatterino-qt-plugins OBJECT ${CMAKE_CURRENT_LIST_DIR}/QtPlugins.cpp
target_link_libraries(chatterino-qt-plugins PRIVATE Qt${MAJOR_QT_VERSION}::Core Qt${MAJOR_QT_VERSION}::Gui)
target_compile_definitions(chatterino-qt-plugins PRIVATE QT_STATICPLUGIN)

if (libavif_FOUND)
if (libavif_FOUND AND NOT APPLE)
message(STATUS "Adding AVIF plugin")
target_compile_definitions(chatterino-qt-plugins PRIVATE WITH_AVIF)
target_link_libraries(chatterino-qt-plugins PRIVATE kimageformats)
endif()
17 changes: 6 additions & 11 deletions mocks/include/mocks/Helix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,12 @@ class Helix : public IHelix
HelixFailureCallback failureCallback),
(override));

MOCK_METHOD(void, fetchUsersFollows,
(QString fromId, QString toId,
ResultCallback<HelixUsersFollowsResponse> successCallback,
HelixFailureCallback failureCallback),
(override));

MOCK_METHOD(void, getUserFollowers,
(QString userId,
ResultCallback<HelixUsersFollowsResponse> successCallback,
HelixFailureCallback failureCallback),
(override));
MOCK_METHOD(
void, getChannelFollowers,
(QString broadcasterID,
ResultCallback<HelixGetChannelFollowersResponse> successCallback,
std::function<void(QString)> failureCallback),
(override));

MOCK_METHOD(void, fetchStreams,
(QStringList userIds, QStringList userLogins,
Expand Down
4 changes: 2 additions & 2 deletions src/Application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ class IApplication
class Application : public IApplication
{
std::vector<std::unique_ptr<Singleton>> singletons_;
int argc_;
char **argv_;
int argc_{};
char **argv_{};

public:
static Application *instance;
Expand Down
1 change: 0 additions & 1 deletion src/PrecompiledHeader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# include <boost/circular_buffer.hpp>
# include <boost/current_function.hpp>
# include <boost/foreach.hpp>
# include <boost/noncopyable.hpp>
# include <boost/optional.hpp>
# include <boost/signals2.hpp>
# include <IrcCommand>
Expand Down
14 changes: 8 additions & 6 deletions src/common/Atomic.hpp
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
#pragma once

#include <boost/noncopyable.hpp>

#include <mutex>

namespace chatterino {

template <typename T>
class Atomic : boost::noncopyable
class Atomic
{
public:
Atomic()
{
}
Atomic() = default;

Atomic(T &&val)
: value_(val)
{
}

Atomic(const Atomic &) = delete;
Atomic &operator=(const Atomic &) = delete;

Atomic(Atomic &&) = delete;
Atomic &operator=(Atomic &&) = delete;

T get() const
{
std::lock_guard<std::mutex> guard(this->mutex_);
Expand Down
4 changes: 2 additions & 2 deletions src/common/DownloadManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class DownloadManager : public QObject

private:
QNetworkAccessManager *manager_;
QNetworkReply *reply_;
QFile *file_;
QNetworkReply *reply_{};
QFile *file_{};

private slots:
void onDownloadProgress(qint64, qint64);
Expand Down
9 changes: 7 additions & 2 deletions src/common/SignalVector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "debug/AssertInGuiThread.hpp"

#include <boost/noncopyable.hpp>
#include <pajlada/signals/signal.hpp>
#include <QStandardItemModel>
#include <QTimer>
Expand All @@ -19,7 +18,7 @@ struct SignalVectorItemEvent {
};

template <typename T>
class SignalVector : boost::noncopyable
class SignalVector
{
public:
pajlada::Signals::Signal<SignalVectorItemEvent<T>> itemInserted;
Expand All @@ -42,6 +41,12 @@ class SignalVector : boost::noncopyable
this->itemCompare_ = std::move(compare);
}

SignalVector(const SignalVector &) = delete;
SignalVector &operator=(const SignalVector &) = delete;

SignalVector(SignalVector &&) = delete;
SignalVector &operator=(SignalVector &&) = delete;

bool isSorted() const
{
return bool(this->itemCompare_);
Expand Down
11 changes: 8 additions & 3 deletions src/common/Singleton.hpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
#pragma once

#include <boost/noncopyable.hpp>

namespace chatterino {

class Settings;
class Paths;

class Singleton : boost::noncopyable
class Singleton
{
public:
Singleton() = default;
virtual ~Singleton() = default;

Singleton(const Singleton &) = delete;
Singleton &operator=(const Singleton &) = delete;

Singleton(Singleton &&) = delete;
Singleton &operator=(Singleton &&) = delete;

virtual void initialize(Settings &settings, Paths &paths)
{
(void)(settings);
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/commands/Command.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace chatterino {
struct Command {
QString name;
QString func;
bool showInMsgContextMenu;
bool showInMsgContextMenu{};

Command() = default;
explicit Command(const QString &text);
Expand Down
10 changes: 8 additions & 2 deletions src/debug/Benchmark.hpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
#pragma once

#include <boost/noncopyable.hpp>
#include <QElapsedTimer>
#include <QString>

namespace chatterino {

class BenchmarkGuard : boost::noncopyable
class BenchmarkGuard
{
public:
BenchmarkGuard(const QString &_name);
~BenchmarkGuard();

BenchmarkGuard(const BenchmarkGuard &) = delete;
BenchmarkGuard &operator=(const BenchmarkGuard &) = delete;

BenchmarkGuard(BenchmarkGuard &&) = delete;
BenchmarkGuard &operator=(BenchmarkGuard &&) = delete;

qreal getElapsedMs();

private:
Expand Down
Loading

0 comments on commit 3ce746c

Please sign in to comment.