Merge branch 'master' of github.com:Chatterino/chatterino2 into feature/lua_scripting

This commit is contained in:
Mm2PL 2023-02-20 14:17:14 +01:00
commit debd7aaa51
No known key found for this signature in database
GPG key ID: 94AC9B80EFA15ED9
33 changed files with 303 additions and 90 deletions

View file

@ -0,0 +1,9 @@
[Flatpak Ref]
Name=com.chatterino.chatterino
Branch=nightly
Title=com.chatterino.chatterino from flathub
IsRuntime=false
Url=https://dl.flathub.org/repo/
SuggestRemoteName=flathub
GPGKey=mQINBFlD2sABEADsiUZUOYBg1UdDaWkEdJYkTSZD68214m8Q1fbrP5AptaUfCl8KYKFMNoAJRBXn9FbE6q6VBzghHXj/rSnA8WPnkbaEWR7xltOqzB1yHpCQ1l8xSfH5N02DMUBSRtD/rOYsBKbaJcOgW0K21sX+BecMY/AI2yADvCJEjhVKrjR9yfRX+NQEhDcbXUFRGt9ZT+TI5yT4xcwbvvTu7aFUR/dH7+wjrQ7lzoGlZGFFrQXSs2WI0WaYHWDeCwymtohXryF8lcWQkhH8UhfNJVBJFgCY8Q6UHkZG0FxMu8xnIDBMjBmSZKwKQn0nwzwM2afskZEnmNPYDI8nuNsSZBZSAw+ThhkdCZHZZRwzmjzyRuLLVFpOj3XryXwZcSefNMPDkZAuWWzPYjxS80cm2hG1WfqrG0Gl8+iX69cbQchb7gbEb0RtqNskTo9DDmO0bNKNnMbzmIJ3/rTbSahKSwtewklqSP/01o0WKZiy+n/RAkUKOFBprjJtWOZkc8SPXV/rnoS2dWsJWQZhuPPtv3tefdDiEyp7ePrfgfKxuHpZES0IZRiFI4J/nAUP5bix+srcIxOVqAam68CbAlPvWTivRUMRVbKjJiGXIOJ78wAMjqPg3QIC0GQ0EPAWwAOzzpdgbnG7TCQetaVV8rSYCuirlPYN+bJIwBtkOC9SWLoPMVZTwQARAQABtC5GbGF0aHViIFJlcG8gU2lnbmluZyBLZXkgPGZsYXRodWJAZmxhdGh1Yi5vcmc+iQJUBBMBCAA+FiEEblwF2XnHba+TwIE1QYTdTZB6f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hvPrYW2eu8jGCdVGxi6HX7L1qcfEd0378S71dZ3g9o6KKl1OsDWWQ6MJ6FGBZedl/ibRfs8p5+sbCX3lQSjEFy3rx6n0rUrXx8U2qb+RCLzJlmC5MNBOTDJwHPcX6gKsUcXZrEQALmRHoo3SrewO41RCr+5nUlqiqV3AohBMhnQbGzyHf2+drutIaoh7Rj80XRh2bkkuPLwlNPf+bTXwNVGse4bej7B3oV6Ae1N7lTNVF4Qh+1OowtGjmfJPWo0z1s6HFJVxoIof9z58Msvgao0zrKGqaMWaNQ6LUeC9g9Aj/9Uqjbo8X54aLiYs8Z1WNc06jKP+gv8AWLtv6CR+l2kLez1YMDucjm7v6iuCMVAmZdmxhg5I/X2+OM3vBsqPDdQpr2TPDLX3rCrSBiS0gOQ6DwN5N5QeTkxmY/7QO8bgLo/Wzu1iilH4vMKW6LBKCaRx5UEJxKpL4wkgITsYKneIt3NTHo5EOuaYk+y2+Dvt6EQFiuMsdbfUjs3seIHsghX/cbPJa4YUqZAL8C4OtVHaijwGo0ymt9MWvS9yNKMyT0JhN2/BdeOVWrHk7wXXJn/ZjpXilicXKPx4udCF76meE+6N2u/T+RYZ7fP1QMEtNZNmYDOfA6sViuPDfQSHLNbauJBo/n1sRYAsL5mcG22UDchJrlKvmK3EOADCQg+myrm8006LltubNB4wWNzHDJ0Ls2JGzQZCd/xGyVmUiidCBUrD537WdknOYE4FD7P0cHaM9brKJ/M8LkEH0zUlo73bY4XagbnCqve6PvQb5G2Z55qhWphd6f4B6DGed86zJEa/RhS
RuntimeRepo=https://dl.flathub.org/repo/flathub.flatpakrepo

View file

@ -14,6 +14,8 @@ concurrency:
env:
C2_ENABLE_LTO: ${{ github.ref == 'refs/heads/master' }}
CHATTERINO_REQUIRE_CLEAN_GIT: On
C2_BUILD_WITH_QT6: Off
jobs:
build:
@ -39,6 +41,11 @@ jobs:
qt-version: 5.15.2
pch: true
force-lto: false
# Ubuntu 22.04, Qt 6.2.4
- os: ubuntu-22.04
qt-version: 6.2.4
pch: false
force-lto: false
# Test for disabling Precompiled Headers & enabling link-time optimization
- os: ubuntu-22.04
qt-version: 5.15.2
@ -101,18 +108,33 @@ jobs:
echo "vs_version=2022" >> "$GITHUB_ENV"
shell: bash
- name: Set BUILD_WITH_QT6
if: startsWith(matrix.qt-version, '6.')
run: |
echo "C2_BUILD_WITH_QT6=ON" >> "$GITHUB_ENV"
shell: bash
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0 # allows for tags access
- name: Install Qt
uses: jurplel/install-qt-action@v3.0.0
- name: Install Qt5
if: startsWith(matrix.qt-version, '5.')
uses: jurplel/install-qt-action@v3.1.0
with:
cache: true
cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}
cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-v2
version: ${{ matrix.qt-version }}
- name: Install Qt6
if: startsWith(matrix.qt-version, '6.')
uses: jurplel/install-qt-action@v3.1.0
with:
cache: true
cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-v2
modules: qt5compat
version: ${{ matrix.qt-version }}
dir: "${{ github.workspace }}/qt/"
# WINDOWS
- name: Cache conan packages part 1
@ -161,6 +183,7 @@ jobs:
-DBUILD_WITH_CRASHPAD="$Env:C2_ENABLE_CRASHPAD" `
-DCHATTERINO_LTO="$Env:C2_ENABLE_LTO" `
-DCHATTERINO_PLUGINS="$Env:C2_PLUGINS" `
-DBUILD_WITH_QT6="$Env:C2_BUILD_WITH_QT6" `
..
set cl=/MP
nmake /S /NOLOGO
@ -247,6 +270,7 @@ jobs:
-DCMAKE_EXPORT_COMPILE_COMMANDS=On \
-DCHATTERINO_LTO="$C2_ENABLE_LTO" \
-DCHATTERINO_PLUGINS="$C2_PLUGINS" \
-DBUILD_WITH_QT6="$C2_BUILD_WITH_QT6" \
..
make -j"$(nproc)"
shell: bash
@ -323,6 +347,7 @@ jobs:
-DUSE_PRECOMPILED_HEADERS=${{ matrix.pch }} \
-DCHATTERINO_LTO="$C2_ENABLE_LTO" \
-DCHATTERINO_PLUGINS="$C2_PLUGINS" \
-DBUILD_WITH_QT6="$C2_BUILD_WITH_QT6" \
..
make -j"$(sysctl -n hw.logicalcpu)"
shell: bash
@ -382,6 +407,11 @@ jobs:
name: chatterino-osx-5.15.2.dmg
path: release-artifacts/
- name: Copy flatpakref
run: |
cp .CI/chatterino-nightly.flatpakref release-artifacts/
shell: bash
- name: Create release
uses: ncipollo/release-action@v1.12.0
with:

View file

@ -11,6 +11,7 @@ on:
env:
# This gets updated later on in the run by a bash script to strip the prefix
C2_CASK_NAME: chatterino
# The full version of Chatterino (e.g. v2.4.1)
C2_TAGGED_VERSION: ${{ github.ref_name }}
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
@ -23,4 +24,6 @@ jobs:
- name: Execute brew bump-cask-pr with version
run: |
echo "Running bump-cask-pr for cask '$C2_CASK_NAME' and version '$C2_TAGGED_VERSION'"
brew bump-cask-pr --version "$C2_TAGGED_VERSION" "$C2_CASK_NAME"
C2_TAGGED_VERSION_STRIPPED="${C2_TAGGED_VERSION:1}"
echo "Stripped version: '$C2_TAGGED_VERSION_STRIPPED'"
brew bump-cask-pr --version "$C2_TAGGED_VERSION_STRIPPED" "$C2_CASK_NAME"

View file

@ -34,7 +34,7 @@ jobs:
key: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}
- name: Install Qt
uses: jurplel/install-qt-action@v3.0.0
uses: jurplel/install-qt-action@v3.1.0
with:
cache: true
cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}

3
.gitignore vendored
View file

@ -118,3 +118,6 @@ qt6.natvis
# Autogenerated resource file
resources/resources_autogenerated.qrc
# Leftovers from running `aqt install`
aqtinstall.log

View file

@ -2,6 +2,12 @@
## Unversioned
- Minor: Delete all but the last 5 crashdumps on application start. (#4392)
- Dev: Add capability to build Chatterino with Qt6. (#4393)
- Dev: Fix homebrew update action. (#4394)
## 2.4.1
- Major: Added live emote updates for BTTV. (#4147)
- Minor: Added setting to turn off rendering of reply context. (#4224)
- Minor: Changed the highlight order to prioritize Message highlights over User highlights. (#4303)
@ -14,9 +20,10 @@
- Minor: Added channel name to /mentions log entries. (#4371)
- Minor: Added link to streamlink docs for easier user setup. (#4217)
- Minor: Added support for HTTP and Socks5 proxies through environment variables. (#4321)
- Minor: Removed sending part of the multipart emoji workaround. (#4361)
- Minor: Added crashpad to capture crashes on Windows locally. See PR for build/crash analysis instructions. (#4351)
- Minor: Github releases now include flatpakref files for nightly builds
- Bugfix: Fixed User Card moderation actions not working after Twitch IRC chat command deprecation. (#4378)
- Bugfix: Fixed User Card broadcaster actions (mod, unmod, vip, unvip) not working after Twitch IRC chat command deprecation. (#4387)
- Bugfix: Fixed crash that would occur when performing certain actions after removing all tabs. (#4271)
- Bugfix: Fixed highlight sounds not reloading on change properly. (#4194)
- Bugfix: Fixed CTRL + C not working in reply thread popups. (#4209)
@ -33,8 +40,10 @@
- Bugfix: Fixed the split "Search" menu action not opening the correct search window. (#4305)
- Bugfix: Fixed an issue on Windows when opening links in incognito mode that contained forward slashes in hash (#4307)
- Bugfix: Fixed an issue where beta versions wouldn't update to stable versions correctly. (#4329)
- Bugfix: Fixed builds from GitHub showing up as modified. (#4384)
- Bugfix: Avoided crash that could occur when receiving channel point reward information. (#4360)
- Dev: Changed sound backend from Qt to miniaudio. (#4334)
- Dev: Removed sending part of the multipart emoji workaround. (#4361)
- Dev: Removed protocol from QApplication's Organization Domain (so changed from `https://www.chatterino.com` to `chatterino.com`). (#4256)
- Dev: Ignore `WM_SHOWWINDOW` hide events, causing fewer attempted rescales. (#4198)
- Dev: Migrated to C++ 20 (#4252, #4257)
@ -147,6 +156,7 @@
- Bugfix: Fixed crash happening when QuickSwitcher is used with a popout window. (#4187)
- Bugfix: Fixed low contrast of text in settings tooltips. (#4188)
- Bugfix: Fixed being unable to see the usercard of VIPs who have Asian language display names. (#4174)
- Bugfix: Fixed whispers always being shown in the /mentions split. (#4389)
- Bugfix: Fixed messages where Right-to-Left order is mixed in multiple lines. (#4173)
- Bugfix: Fixed the wrong right-click menu showing in the chat input box. (#4177)
- Bugfix: Fixed popup windows not appearing/minimizing correctly on the Windows taskbar. (#4181)

View file

@ -8,7 +8,7 @@ list(APPEND CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/cmake/sanitizers-cmake/cmake"
)
project(chatterino VERSION 2.4.0)
project(chatterino VERSION 2.4.1)
option(BUILD_APP "Build Chatterino" ON)
option(BUILD_TESTS "Build the tests for Chatterino" OFF)
@ -59,6 +59,13 @@ find_package(Qt${MAJOR_QT_VERSION} REQUIRED
Concurrent
)
if (BUILD_WITH_QT6)
find_package(Qt${MAJOR_QT_VERSION} REQUIRED
COMPONENTS
Core5Compat
)
endif ()
message(STATUS "Qt version: ${Qt${MAJOR_QT_VERSION}_VERSION}")
if (WIN32)

View file

@ -9,7 +9,7 @@
# If the git binary is found and the git work tree is intact, GIT_RELEASE is worked out using the `git describe` command
# The value of GIT_RELEASE can be overriden by defining the GIT_RELEASE environment variable
# GIT_MODIFIED
# If the git binary is found and the git work tree is intact, GIT_MODIFIED is worked out by checking if output of `git status --porcelain -z` command is empty
# If the git binary is found and the git work tree is intact, GIT_MODIFIED is worked out by checking if output of `git status --porcelain -z` command is empty
# The value of GIT_MODIFIED cannot be overriden
find_package(Git)
@ -19,67 +19,75 @@ set(GIT_COMMIT "GIT-REPOSITORY-NOT-FOUND")
set(GIT_RELEASE "${PROJECT_VERSION}")
set(GIT_MODIFIED 0)
if (DEFINED ENV{CHATTERINO_SKIP_GIT_GEN})
if(DEFINED ENV{CHATTERINO_SKIP_GIT_GEN})
return()
endif ()
endif()
if (GIT_EXECUTABLE)
if(GIT_EXECUTABLE)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --is-inside-work-tree
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE GIT_REPOSITORY_NOT_FOUND
OUTPUT_QUIET
ERROR_QUIET
COMMAND ${GIT_EXECUTABLE} rev-parse --is-inside-work-tree
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE GIT_REPOSITORY_NOT_FOUND
OUTPUT_QUIET
ERROR_QUIET
)
if (GIT_REPOSITORY_NOT_FOUND)
if(GIT_REPOSITORY_NOT_FOUND)
set(GIT_REPOSITORY_FOUND 0)
else ()
else()
set(GIT_REPOSITORY_FOUND 1)
endif()
if (GIT_REPOSITORY_FOUND)
if(GIT_REPOSITORY_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND ${GIT_EXECUTABLE} describe
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_RELEASE
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND ${GIT_EXECUTABLE} describe
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_RELEASE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND ${GIT_EXECUTABLE} status --porcelain -z
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_MODIFIED_OUTPUT
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND ${GIT_EXECUTABLE} status --porcelain -z
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_MODIFIED_OUTPUT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif (GIT_REPOSITORY_FOUND)
endif (GIT_EXECUTABLE)
endif(GIT_REPOSITORY_FOUND)
endif(GIT_EXECUTABLE)
if(GIT_MODIFIED_OUTPUT)
if(DEFINED ENV{CHATTERINO_REQUIRE_CLEAN_GIT})
message(STATUS "git status --porcelain -z\n${GIT_MODIFIED_OUTPUT}")
message(FATAL_ERROR "Git repository was expected to be clean, but modifications were found!")
endif()
if (GIT_MODIFIED_OUTPUT)
set(GIT_MODIFIED 1)
endif ()
endif()
if (DEFINED ENV{GIT_HASH})
if(DEFINED ENV{GIT_HASH})
set(GIT_HASH "$ENV{GIT_HASH}")
endif ()
if (DEFINED ENV{GIT_COMMIT})
endif()
if(DEFINED ENV{GIT_COMMIT})
set(GIT_COMMIT "$ENV{GIT_COMMIT}")
endif ()
if (DEFINED ENV{GIT_RELEASE})
endif()
if(DEFINED ENV{GIT_RELEASE})
set(GIT_RELEASE "$ENV{GIT_RELEASE}")
endif ()
endif()
message(STATUS "Injected git values: ${GIT_COMMIT} (${GIT_RELEASE}) modified: ${GIT_MODIFIED}")

View file

@ -32,6 +32,6 @@
<binary>chatterino</binary>
</provides>
<releases>
<release version="2.4.0" date="2022-11-28"/>
<release version="2.4.1" date="2023-02-18"/>
</releases>
</component>

View file

@ -643,6 +643,13 @@ if (CHATTERINO_PLUGINS)
target_link_libraries(${LIBRARY_PROJECT} PUBLIC lua)
endif()
if (BUILD_WITH_QT6)
target_link_libraries(${LIBRARY_PROJECT}
PUBLIC
Qt${MAJOR_QT_VERSION}::Core5Compat
)
endif ()
if (BUILD_WITH_QTKEYCHAIN)
target_link_libraries(${LIBRARY_PROJECT}
PUBLIC

View file

@ -105,7 +105,6 @@
# include <QThreadPool>
# include <QTime>
# include <QTimer>
# include <QtWidgets/QAction>
# include <QtWidgets/QApplication>
# include <QtWidgets/QButtonGroup>
# include <QtWidgets/QDialog>

View file

@ -185,6 +185,38 @@ namespace {
}
qCDebug(chatterinoCache) << "Deleted" << deletedCount << "files";
}
// We delete all but the five most recent crashdumps. This strategy may be
// improved in the future.
void clearCrashes(QDir dir)
{
// crashpad crashdumps are stored inside the Crashes/report directory
if (!dir.cd("reports"))
{
// no reports directory exists = no files to delete
return;
}
dir.setNameFilters({"*.dmp"});
size_t deletedCount = 0;
// TODO: use std::views::drop once supported by all compilers
size_t filesToSkip = 5;
for (auto &&info : dir.entryInfoList(QDir::Files, QDir::Time))
{
if (filesToSkip > 0)
{
filesToSkip--;
continue;
}
if (QFile(info.absoluteFilePath()).remove())
{
deletedCount++;
}
}
qCDebug(chatterinoApp) << "Deleted" << deletedCount << "crashdumps";
}
} // namespace
void runGui(QApplication &a, Paths &paths, Settings &settings)
@ -215,10 +247,15 @@ void runGui(QApplication &a, Paths &paths, Settings &settings)
});
// Clear the cache 1 minute after start.
QTimer::singleShot(60 * 1000, [cachePath = paths.cacheDirectory()] {
QTimer::singleShot(60 * 1000, [cachePath = paths.cacheDirectory(),
crashDirectory = paths.crashdumpDirectory] {
QtConcurrent::run([cachePath]() {
clearCache(cachePath);
});
QtConcurrent::run([crashDirectory]() {
clearCrashes(crashDirectory);
});
});
chatterino::NetworkManager::init();

View file

@ -16,7 +16,12 @@ namespace {
QFile file(":/tlds.txt");
file.open(QFile::ReadOnly);
QTextStream stream(&file);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
// Default encoding of QTextStream is already UTF-8, at least in Qt6
#else
stream.setCodec("UTF-8");
#endif
int safetyMax = 20000;
QSet<QString> set;

View file

@ -24,7 +24,7 @@
* - 2.4.0-alpha.2
* - 2.4.0-alpha
**/
#define CHATTERINO_VERSION "2.4.0"
#define CHATTERINO_VERSION "2.4.1"
#if defined(Q_OS_WIN)
# define CHATTERINO_OS "win"

View file

@ -3192,7 +3192,8 @@ QString CommandController::execCommand(const QString &textNoEmoji,
}
}
auto maxSpaces = std::min(this->maxSpaces_, words.length() - 1);
// We have checks to ensure words cannot be empty, so this can never wrap around
auto maxSpaces = std::min(this->maxSpaces_, (qsizetype)words.length() - 1);
for (int i = 0; i < maxSpaces; ++i)
{
commandName += ' ' + words[i + 1];

View file

@ -71,7 +71,7 @@ private:
// User-created commands
QMap<QString, Command> userCommands_;
int maxSpaces_ = 0;
qsizetype maxSpaces_ = 0;
std::shared_ptr<pajlada::Settings::SettingManager> sm_;
// Because the setting manager is not initialized until the initialize

View file

@ -7,6 +7,7 @@
#define MINIAUDIO_IMPLEMENTATION
#include <miniaudio.h>
#include <QFile>
#include <limits>
#include <memory>

View file

@ -1,5 +1,6 @@
#include "providers/bttv/liveupdates/BttvLiveUpdateSubscription.hpp"
#include <QDebug>
#include <QJsonDocument>
namespace chatterino {

View file

@ -94,7 +94,8 @@ void IrcServer::initializeConnectionSignals(IrcConnection *connection,
QObject::connect(connection, &Communi::IrcConnection::nickNameRequired,
this, [](const QString &reserved, QString *result) {
*result = reserved + (std::rand() % 100);
*result = QString("%1%2").arg(
reserved, QString::number(std::rand() % 100));
});
QObject::connect(connection, &Communi::IrcConnection::noticeMessageReceived,

View file

@ -810,7 +810,7 @@ void IrcMessageHandler::handleWhisperMessage(Communi::IrcMessage *message)
getApp()->twitch->lastUserThatWhisperedMe.set(builder.userName);
if (_message->flags.has(MessageFlag::Highlighted))
if (_message->flags.has(MessageFlag::ShowInMentions))
{
getApp()->twitch->mentionsChannel->addMessage(_message);
}

View file

@ -325,7 +325,7 @@ std::shared_ptr<Channel> TwitchIrcServer::getChannelOrEmptyByID(
continue;
if (twitchChannel->roomId() == channelId &&
twitchChannel->getName().splitRef(":").size() < 3)
twitchChannel->getName().count(':') < 2)
{
return twitchChannel;
}

View file

@ -821,14 +821,14 @@ void TwitchMessageBuilder::runIgnoreReplaces(
};
auto addReplEmotes = [&twitchEmotes](const IgnorePhrase &phrase,
const QStringRef &midrepl,
const auto &midrepl,
int startIndex) mutable {
if (!phrase.containsEmote())
{
return;
}
QVector<QStringRef> words = midrepl.split(' ');
auto words = midrepl.split(' ');
int pos = 0;
for (const auto &word : words)
{
@ -843,7 +843,7 @@ void TwitchMessageBuilder::runIgnoreReplaces(
}
twitchEmotes.push_back(TwitchEmoteOccurrence{
startIndex + pos,
startIndex + pos + emote.first.string.length(),
startIndex + pos + (int)emote.first.string.length(),
emote.second,
emote.first,
});
@ -904,8 +904,13 @@ void TwitchMessageBuilder::runIgnoreReplaces(
shiftIndicesAfter(from + len, midsize - len);
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
auto midExtendedRef =
QStringView{this->originalMessage_}.mid(pos1, pos2 - pos1);
#else
auto midExtendedRef =
this->originalMessage_.midRef(pos1, pos2 - pos1);
#endif
for (auto &tup : vret)
{
@ -969,8 +974,13 @@ void TwitchMessageBuilder::runIgnoreReplaces(
shiftIndicesAfter(from + len, replacesize - len);
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
auto midExtendedRef =
QStringView{this->originalMessage_}.mid(pos1, pos2 - pos1);
#else
auto midExtendedRef =
this->originalMessage_.midRef(pos1, pos2 - pos1);
#endif
for (auto &tup : vret)
{

View file

@ -174,6 +174,12 @@ QString localizeNumbers(unsigned int number)
return locale.toString(number);
}
QString localizeNumbers(qsizetype number)
{
QLocale locale;
return locale.toString(number);
}
QString kFormatNumbers(const int &number)
{
return QString("%1K").arg(number / 1000);

View file

@ -74,6 +74,7 @@ QString shortenString(const QString &str, unsigned maxWidth = 50);
QString localizeNumbers(const int &number);
QString localizeNumbers(unsigned int number);
QString localizeNumbers(qsizetype number);
QString kFormatNumbers(const int &number);

View file

@ -641,8 +641,8 @@ void Notebook::performLayout(bool animated)
bool isLastColumn = col == columnCount - 1;
auto largestWidth = 0;
int tabStart = col * tabsPerColumn;
int tabEnd =
std::min((col + 1) * tabsPerColumn, this->items_.size());
int tabEnd = std::min((col + 1) * tabsPerColumn,
(int)this->items_.size());
for (int i = tabStart; i < tabEnd; i++)
{
@ -743,8 +743,8 @@ void Notebook::performLayout(bool animated)
bool isLastColumn = col == columnCount - 1;
auto largestWidth = 0;
int tabStart = col * tabsPerColumn;
int tabEnd =
std::min((col + 1) * tabsPerColumn, this->items_.size());
int tabEnd = std::min((col + 1) * tabsPerColumn,
(int)this->items_.size());
for (int i = tabStart; i < tabEnd; i++)
{

View file

@ -23,6 +23,7 @@
#include "widgets/settingspages/PluginsPage.hpp"
#include <QDialogButtonBox>
#include <QFile>
#include <QLineEdit>
namespace chatterino {

View file

@ -419,16 +419,28 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, QWidget *parent,
});
QObject::connect(mod.getElement(), &Button::leftClicked, [this] {
this->underlyingChannel_->sendMessage("/mod " + this->userName_);
QString value = "/mod " + this->userName_;
value = getApp()->commands->execCommand(
value, this->underlyingChannel_, false);
this->underlyingChannel_->sendMessage(value);
});
QObject::connect(unmod.getElement(), &Button::leftClicked, [this] {
this->underlyingChannel_->sendMessage("/unmod " + this->userName_);
QString value = "/unmod " + this->userName_;
value = getApp()->commands->execCommand(
value, this->underlyingChannel_, false);
this->underlyingChannel_->sendMessage(value);
});
QObject::connect(vip.getElement(), &Button::leftClicked, [this] {
this->underlyingChannel_->sendMessage("/vip " + this->userName_);
QString value = "/vip " + this->userName_;
value = getApp()->commands->execCommand(
value, this->underlyingChannel_, false);
this->underlyingChannel_->sendMessage(value);
});
QObject::connect(unvip.getElement(), &Button::leftClicked, [this] {
this->underlyingChannel_->sendMessage("/unvip " + this->userName_);
QString value = "/unvip " + this->userName_;
value = getApp()->commands->execCommand(
value, this->underlyingChannel_, false);
this->underlyingChannel_->sendMessage(value);
});
// userstate

View file

@ -62,7 +62,11 @@ QString ResizingTextEdit::textUnderCursor(bool *hadSpace) const
auto textUpToCursor = currentText.left(tc.selectionStart());
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
auto words = QStringView{textUpToCursor}.split(' ');
#else
auto words = textUpToCursor.splitRef(' ');
#endif
if (words.size() == 0)
{
return QString();

View file

@ -54,7 +54,7 @@ void SettingsDialogTab::paintEvent(QPaintEvent *)
QPainter painter(this);
QStyleOption opt;
opt.init(this);
opt.initFrom(this);
this->style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);

View file

@ -8,6 +8,7 @@
#include "widgets/BasePopup.hpp"
#include "widgets/helper/SignalLabel.hpp"
#include <QFile>
#include <QFormLayout>
#include <QGroupBox>
#include <QLabel>
@ -151,7 +152,11 @@ AboutPage::AboutPage()
contributorsFile.open(QFile::ReadOnly);
QTextStream stream(&contributorsFile);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
// Default encoding of QTextStream is already UTF-8
#else
stream.setCodec("UTF-8");
#endif
QString line;

View file

@ -112,35 +112,36 @@ ModerationPage::ModerationPage()
// Show how big (size-wise) the logs are
auto logsPathSizeLabel = logs.emplace<QLabel>();
logsPathSizeLabel->setText(QtConcurrent::run([] {
return fetchLogDirectorySize();
}));
return fetchLogDirectorySize();
}).result());
// Select event
QObject::connect(selectDir.getElement(), &QPushButton::clicked, this,
[this, logsPathSizeLabel]() mutable {
auto dirName =
QFileDialog::getExistingDirectory(this);
QObject::connect(
selectDir.getElement(), &QPushButton::clicked, this,
[this, logsPathSizeLabel]() mutable {
auto dirName = QFileDialog::getExistingDirectory(this);
getSettings()->logPath = dirName;
getSettings()->logPath = dirName;
// Refresh: Show how big (size-wise) the logs are
logsPathSizeLabel->setText(QtConcurrent::run([] {
return fetchLogDirectorySize();
}));
});
// Refresh: Show how big (size-wise) the logs are
logsPathSizeLabel->setText(QtConcurrent::run([] {
return fetchLogDirectorySize();
}).result());
});
buttons->addSpacing(16);
// Reset custom logpath
QObject::connect(resetDir.getElement(), &QPushButton::clicked, this,
[logsPathSizeLabel]() mutable {
getSettings()->logPath = "";
QObject::connect(
resetDir.getElement(), &QPushButton::clicked, this,
[logsPathSizeLabel]() mutable {
getSettings()->logPath = "";
// Refresh: Show how big (size-wise) the logs are
logsPathSizeLabel->setText(QtConcurrent::run([] {
return fetchLogDirectorySize();
}));
});
// Refresh: Show how big (size-wise) the logs are
logsPathSizeLabel->setText(QtConcurrent::run([] {
return fetchLogDirectorySize();
}).result());
});
QCheckBox *onlyLogListedChannels =
this->createCheckBox("Only log channels listed below",

View file

@ -699,7 +699,7 @@ void SplitInput::updateCompletionPopup()
return;
}
for (int i = clamp(position, 0, text.length() - 1); i >= 0; i--)
for (int i = clamp(position, 0, (int)text.length() - 1); i >= 0; i--)
{
if (text[i] == ' ')
{
@ -766,7 +766,7 @@ void SplitInput::showCompletionPopup(const QString &text, bool emoteCompletion)
popup->updateUsers(text, this->split_->getChannel());
}
auto pos = this->mapToGlobal({0, 0}) - QPoint(0, popup->height()) +
auto pos = this->mapToGlobal(QPoint{0, 0}) - QPoint(0, popup->height()) +
QPoint((this->width() - popup->width()) / 2, 0);
popup->move(pos);
@ -789,7 +789,7 @@ void SplitInput::insertCompletionText(const QString &input_) const
auto text = edit.toPlainText();
auto position = edit.textCursor().position() - 1;
for (int i = clamp(position, 0, text.length() - 1); i >= 0; i--)
for (int i = clamp(position, 0, (int)text.length() - 1); i >= 0; i--)
{
bool done = false;
if (text[i] == ':')

View file

@ -3,6 +3,7 @@
#include "Application.hpp"
#include "BaseSettings.hpp"
#include "controllers/accounts/AccountController.hpp"
#include "controllers/highlights/HighlightPhrase.hpp"
#include "messages/MessageBuilder.hpp" // for MessageParseArgs
#include "mocks/UserData.hpp"
#include "providers/twitch/api/Helix.hpp"
@ -774,6 +775,56 @@ TEST_F(HighlightControllerTest, A)
},
},
},
{
// TEST CASE: Whispers that do not hit a highlight phrase should not be added to /mentions
{
// input
.args =
MessageParseArgs{
.isReceivedWhisper = true,
},
.senderName = "forsen",
.originalMessage = "Hello NymN!",
},
{
// expected
.state = true, // state
.result =
{
false, // alert
false, // playsound
boost::none, // custom sound url
std::make_shared<QColor>(
HighlightPhrase::
FALLBACK_HIGHLIGHT_COLOR), // color
false, // showInMentions
},
},
},
{
// TEST CASE: Whispers that do hit a highlight phrase should be added to /mentions
{
// input
.args =
MessageParseArgs{
.isReceivedWhisper = true,
},
.senderName = "forsen",
.originalMessage = "!testmanxd",
},
{
// expected
.state = true, // state
.result =
{
true, // alert
true, // playsound
boost::none, // custom sound url
std::make_shared<QColor>("#7f7f3f49"), // color
true, // showInMentions
},
},
},
};
for (const auto &[input, expected] : tests)