Skip to content

Commit

Permalink
Merge branch 'Chatterino:master' into chatterino7
Browse files Browse the repository at this point in the history
  • Loading branch information
TroyKomodo committed May 19, 2022
2 parents d612b88 + 28efd29 commit a0e87b9
Show file tree
Hide file tree
Showing 21 changed files with 117 additions and 19 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,6 @@ Stamp
tmp
Source
Dependencies_*

# vcpkg
vcpkg_installed/
35 changes: 35 additions & 0 deletions BUILDING_ON_WINDOWS_WITH_VCPKG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Building on Windows with vcpkg

## Prerequisites

1. Install [Visual Studio](https://visualstudio.microsoft.com/) with "Desktop development with C++" (~9.66 GB)
1. Install [CMake](https://cmake.org/) (~109 MB)
1. Install [git](https://git-scm.com/) (~264 MB)
1. Install [vcpkg](https://vcpkg.io/) (~80 MB)
- `git clone https://github.com/Microsoft/vcpkg.git`
- `cd .\vcpkg\`
- `.\bootstrap-vcpkg.bat`
- `.\vcpkg integrate install`
- `.\vcpkg integrate powershell`
- `cd ..`
1. Configure the environment for vcpkg
- `set VCPKG_DEFAULT_TRIPLET=x64-windows`
- [default](https://github.com/microsoft/vcpkg/blob/master/docs/users/triplets.md#additional-remarks) is `x86-windows`
- `set VCPKG_ROOT=C:\path\to\vcpkg\`
- `set PATH=%PATH%;%VCPKG_ROOT%`

## Building

1. Clone
- `git clone --recurse-submodules https://github.com/Chatterino/chatterino2.git`
1. Install dependencies (~21 GB)
- `cd .\chatterino2\`
- `vcpkg install`
1. Build
- `mkdir .\build\`
- `cd .\build\`
- (cmd) `cmake .. -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake`
- (ps1) `cmake .. -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"`
- `cmake --build . --parallel <threads> --config Release`
1. Run
- `.\bin\chatterino2.exe`
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
- Minor: Sorted usernames in /vips message to be case-insensitive. (#3696)
- Minor: Added option to open a user's chat in a new tab from the usercard profile picture context menu. (#3625)
- Minor: Fixed tag parsing for consecutive escaped characters. (#3711)
- Minor: Prevent user from entering incorrect characters in Live Notifications channels list. (#3715)
- Minor: Prevent user from entering incorrect characters in Live Notifications channels list. (#3715, #3730)
- Minor: Fixed automod caught message notice appearing twice for mods. (#3717)
- Bugfix: Fixed live notifications for usernames containing uppercase characters. (#3646)
- Bugfix: Fixed live notifications not getting updated for closed streams going offline. (#3678)
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ find_package(Sanitizers)

# Find boost on the system
find_package(Boost REQUIRED)
find_package(Boost COMPONENTS random)

# Find OpenSSL on the system
find_package(OpenSSL REQUIRED)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ git submodule update --init --recursive

[Building on Windows](../master/BUILDING_ON_WINDOWS.md)

[Building on Windows with vcpkg](../master/BUILDING_ON_WINDOWS_WITH_VCPKG.md)

[Building on Linux](../master/BUILDING_ON_LINUX.md)

[Building on Mac](../master/BUILDING_ON_MAC.md)
Expand Down
2 changes: 2 additions & 0 deletions chatterino.pro
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ SOURCES += \
src/widgets/helper/NotebookTab.cpp \
src/widgets/helper/QColorPicker.cpp \
src/widgets/helper/RegExpItemDelegate.cpp \
src/widgets/helper/TrimRegExpValidator.cpp \
src/widgets/helper/ResizingTextEdit.cpp \
src/widgets/helper/ScrollbarHighlight.cpp \
src/widgets/helper/SearchPopup.cpp \
Expand Down Expand Up @@ -596,6 +597,7 @@ HEADERS += \
src/widgets/helper/NotebookTab.hpp \
src/widgets/helper/QColorPicker.hpp \
src/widgets/helper/RegExpItemDelegate.hpp \
src/widgets/helper/TrimRegExpValidator.hpp \
src/widgets/helper/ResizingTextEdit.hpp \
src/widgets/helper/ScrollbarHighlight.hpp \
src/widgets/helper/SearchPopup.hpp \
Expand Down
6 changes: 4 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,8 @@ set(SOURCE_FILES
widgets/helper/QColorPicker.hpp
widgets/helper/RegExpItemDelegate.cpp
widgets/helper/RegExpItemDelegate.hpp
widgets/helper/TrimRegExpValidator.cpp
widgets/helper/TrimRegExpValidator.hpp
widgets/helper/ResizingTextEdit.cpp
widgets/helper/ResizingTextEdit.hpp
widgets/helper/ScrollbarHighlight.cpp
Expand Down Expand Up @@ -654,7 +656,7 @@ if (WIN32)
endif ()

if (MSVC)
target_compile_options(${LIBRARY_PROJECT} PUBLIC /EHsc)
target_compile_options(${LIBRARY_PROJECT} PUBLIC /EHsc /bigobj)
endif ()

if (APPLE AND BUILD_APP)
Expand Down Expand Up @@ -687,7 +689,7 @@ if (USE_CONAN AND TARGET CONAN_PKG::boost)
else ()
target_link_libraries(${LIBRARY_PROJECT}
PUBLIC
Boost::boost
${Boost_LIBRARIES}
)
endif ()

Expand Down
3 changes: 0 additions & 3 deletions src/common/Env.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ Env::Env()
, linkResolverUrl(readStringEnv(
"CHATTERINO2_LINK_RESOLVER_URL",
"https://braize.pajlada.com/chatterino/link_resolver/%1"))
, twitchEmoteSetResolverUrl(readStringEnv(
"CHATTERINO2_TWITCH_EMOTE_SET_RESOLVER_URL",
"https://braize.pajlada.com/chatterino/twitchemotes/set/%1/"))
, twitchServerHost(
readStringEnv("CHATTERINO2_TWITCH_SERVER_HOST", "irc.chat.twitch.tv"))
, twitchServerPort(readPortEnv("CHATTERINO2_TWITCH_SERVER_PORT", 443))
Expand Down
1 change: 0 additions & 1 deletion src/common/Env.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class Env

const QString recentMessagesApiUrl;
const QString linkResolverUrl;
const QString twitchEmoteSetResolverUrl;
const QString twitchServerHost;
const uint16_t twitchServerPort;
const bool twitchServerSecure;
Expand Down
1 change: 0 additions & 1 deletion src/controllers/commands/CommandController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,6 @@ void CommandController::initialize(Settings &, Paths &paths)
QStringList debugMessages{
"recentMessagesApiUrl: " + env.recentMessagesApiUrl,
"linkResolverUrl: " + env.linkResolverUrl,
"twitchEmoteSetResolverUrl: " + env.twitchEmoteSetResolverUrl,
"twitchServerHost: " + env.twitchServerHost,
"twitchServerPort: " + QString::number(env.twitchServerPort),
"twitchServerSecure: " + QString::number(env.twitchServerSecure),
Expand Down
4 changes: 2 additions & 2 deletions src/messages/SharedMessageBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "singletons/Settings.hpp"
#include "singletons/WindowManager.hpp"
#include "util/Helpers.hpp"
#include "util/Qt.hpp"
#include "util/StreamerMode.hpp"

#include <QFileInfo>
Expand Down Expand Up @@ -41,8 +42,7 @@ namespace {
if (iterator == tags.end())
return QStringList{};

return iterator.value().toString().split(
',', QString::SplitBehavior::SkipEmptyParts);
return iterator.value().toString().split(',', Qt::SkipEmptyParts);
}

std::vector<Badge> parseBadges(const QVariantMap &tags)
Expand Down
1 change: 1 addition & 0 deletions src/providers/ffz/FfzBadges.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <map>
#include <memory>
#include <shared_mutex>
#include <unordered_map>
#include <vector>

#include <QColor>
Expand Down
4 changes: 2 additions & 2 deletions src/providers/twitch/TwitchMessageBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "singletons/WindowManager.hpp"
#include "util/Helpers.hpp"
#include "util/IrcHelpers.hpp"
#include "util/Qt.hpp"
#include "widgets/Window.hpp"

#include <QApplication>
Expand Down Expand Up @@ -55,8 +56,7 @@ namespace {
if (iterator == tags.end())
return QStringList{};

return iterator.value().toString().split(
',', QString::SplitBehavior::SkipEmptyParts);
return iterator.value().toString().split(',', Qt::SkipEmptyParts);
}

std::map<QString, QString> parseBadgeInfos(const QVariantMap &tags)
Expand Down
5 changes: 2 additions & 3 deletions src/widgets/dialogs/EmotePopup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
#include "widgets/Notebook.hpp"
#include "widgets/Scrollbar.hpp"
#include "widgets/helper/ChannelView.hpp"
#include "widgets/helper/TrimRegExpValidator.hpp"

#include <QAbstractButton>
#include <QHBoxLayout>
#include <QRegularExpression>
#include <QRegularExpressionValidator>
#include <QTabWidget>

namespace chatterino {
Expand Down Expand Up @@ -166,7 +166,6 @@ EmotePopup::EmotePopup(QWidget *parent)

QRegularExpression searchRegex("\\S*");
searchRegex.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
QValidator *searchValidator = new QRegularExpressionValidator(searchRegex);

layout->setMargin(0);
layout->setSpacing(0);
Expand All @@ -177,7 +176,7 @@ EmotePopup::EmotePopup(QWidget *parent)

this->search_ = new QLineEdit();
this->search_->setPlaceholderText("Search all emotes...");
this->search_->setValidator(searchValidator);
this->search_->setValidator(new TrimRegExpValidator(searchRegex));
this->search_->setClearButtonEnabled(true);
this->search_->findChild<QAbstractButton *>()->setIcon(
QPixmap(":/buttons/clearSearch.png"));
Expand Down
1 change: 0 additions & 1 deletion src/widgets/dialogs/UserInfoPopup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ class UserInfoPopup final : public BaseWindow

Label *noMessagesLabel = nullptr;
ChannelView *latestMessages = nullptr;
QPushButton *refreshButton = nullptr;
} ui_;

class TimeoutWidget : public BaseWidget
Expand Down
5 changes: 3 additions & 2 deletions src/widgets/helper/RegExpItemDelegate.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "widgets/helper/RegExpItemDelegate.hpp"

#include "widgets/helper/TrimRegExpValidator.hpp"

#include <QLineEdit>

namespace chatterino {
Expand All @@ -16,8 +18,7 @@ QWidget *RegExpItemDelegate::createEditor(QWidget *parent,
const QModelIndex &index) const
{
auto *editor = new QLineEdit(parent);
editor->setValidator(
new QRegularExpressionValidator(this->regexp_, editor));
editor->setValidator(new TrimRegExpValidator(this->regexp_, editor));
return editor;
}

Expand Down
17 changes: 17 additions & 0 deletions src/widgets/helper/TrimRegExpValidator.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "widgets/helper/TrimRegExpValidator.hpp"

namespace chatterino {

TrimRegExpValidator::TrimRegExpValidator(const QRegularExpression &re,
QObject *parent)
: QRegularExpressionValidator(re, parent)
{
}

QValidator::State TrimRegExpValidator::validate(QString &input, int &pos) const
{
input = input.trimmed();
return QRegularExpressionValidator::validate(input, pos);
}

} // namespace chatterino
19 changes: 19 additions & 0 deletions src/widgets/helper/TrimRegExpValidator.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once

#include <QRegularExpression>
#include <QRegularExpressionValidator>

namespace chatterino {

class TrimRegExpValidator : public QRegularExpressionValidator
{
Q_OBJECT

public:
TrimRegExpValidator(const QRegularExpression &re,
QObject *parent = nullptr);

QValidator::State validate(QString &input, int &pos) const override;
};

} // namespace chatterino
1 change: 1 addition & 0 deletions src/widgets/splits/SplitContainer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <functional>
#include <pajlada/signals/signal.hpp>
#include <pajlada/signals/signalholder.hpp>
#include <unordered_map>
#include <vector>

class QJsonObject;
Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ add_sanitizers(${PROJECT_NAME})

target_link_libraries(${PROJECT_NAME} PRIVATE chatterino-lib)

target_link_libraries(${PROJECT_NAME} PRIVATE gtest)
target_link_libraries(${PROJECT_NAME} PRIVATE ${GTEST_BOTH_LIBRARIES})

target_compile_definitions(${PROJECT_NAME} PRIVATE
CHATTERINO_TEST
Expand Down
21 changes: 21 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
"name": "chatterino",
"version": "2.0.0",
"dependencies": [
"benchmark",
"boost-asio",
"boost-foreach",
"boost-interprocess",
"boost-random",
"boost-variant",
"gtest",
"openssl",
"qt5-multimedia",
"qt5-tools"
],
"builtin-baseline": "2ac61f87f69f0484b8044f95ab274038fbaf7bdd",
"overrides": [
{ "name": "openssl", "version-string": "1.1.1n" }
]
}

0 comments on commit a0e87b9

Please sign in to comment.