Skip to content

Commit

Permalink
Merge branch 'master' into fix/more-luals-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mm2PL committed May 22, 2024
2 parents a3bb481 + da526b3 commit 883c60a
Show file tree
Hide file tree
Showing 60 changed files with 1,540 additions and 777 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,24 @@ jobs:

- name: Install Qt5
if: startsWith(matrix.qt-version, '5.')
uses: jurplel/install-qt-action@v3.3.0
uses: jurplel/install-qt-action@v4.0.0
with:
cache: true
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@v4.0.0
with:
cache: true
cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-v2
modules: qt5compat qtimageformats
version: ${{ matrix.qt-version }}

- name: Install Qt 6.5.3 imageformats
if: startsWith(matrix.qt-version, '6.')
uses: jurplel/install-qt-action@v3.3.0
uses: jurplel/install-qt-action@v4.0.0
with:
cache: false
modules: qtimageformats
Expand All @@ -176,15 +185,6 @@ jobs:
cd plugins/imageformats
echo "PLUGIN_PATH=$(pwd)" | Out-File -Path "$Env:GITHUB_OUTPUT" -Encoding ASCII
- name: Install Qt6
if: startsWith(matrix.qt-version, '6.')
uses: jurplel/install-qt-action@v3.3.0
with:
cache: true
cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-v2
modules: qt5compat qtimageformats
version: ${{ matrix.qt-version }}

# WINDOWS
- name: Enable Developer Command Prompt (Windows)
if: startsWith(matrix.os, 'windows')
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

- name: Install Qt6
if: startsWith(matrix.qt-version, '6.')
uses: jurplel/install-qt-action@v3.3.0
uses: jurplel/install-qt-action@v4.0.0
with:
cache: true
cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-v2
Expand All @@ -40,7 +40,7 @@ jobs:

- name: clang-tidy review
timeout-minutes: 20
uses: ZedThree/clang-tidy-review@v0.18.0
uses: ZedThree/clang-tidy-review@v0.19.0
with:
build_dir: build-clang-tidy
config_file: ".clang-tidy"
Expand All @@ -62,4 +62,4 @@ jobs:
libxkbcommon-x11-0, libxcb-xkb-dev, libxcb-cursor0
- name: clang-tidy-review upload
uses: ZedThree/clang-tidy-review/upload@v0.18.0
uses: ZedThree/clang-tidy-review/upload@v0.19.0
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 @@ -14,7 +14,7 @@ jobs:
if: ${{ github.event.workflow_run.conclusion == 'success' }}

steps:
- uses: ZedThree/clang-tidy-review/post@v0.18.0
- uses: ZedThree/clang-tidy-review/post@v0.19.0
with:
lgtm_comment_body: ""
num_comments_as_exitcode: false
2 changes: 1 addition & 1 deletion .github/workflows/test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
fetch-depth: 0 # allows for tags access

- name: Install Qt
uses: jurplel/install-qt-action@v3.3.0
uses: jurplel/install-qt-action@v4.0.0
with:
cache: true
cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
fetch-depth: 0 # allows for tags access

- name: Install Qt
uses: jurplel/install-qt-action@v3.3.0
uses: jurplel/install-qt-action@v4.0.0
with:
cache: true
cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-v2
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@
## Unversioned

- Major: Release plugins alpha. (#5288)
- Major: Improve high-DPI support on Windows. (#4868, #5391)
- 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)
- Bugfix: If a network request errors with 200 OK, Qt's error code is now reported instead of the HTTP status. (#5378)
- Dev: Use Qt's high DPI scaling. (#4868, #5400)
- Dev: Add doxygen build target. (#5377)
- Dev: Make printing of strings in tests easier. (#5379)
- Dev: Refactor and document `Scrollbar`. (#5334, #5393)
- Dev: Reduced the amount of scale events. (#5404, #5406)
- Dev: All Lua globals now show in the `c2` global in the LuaLS metadata. (#5385)

## 2.5.1
Expand Down
6 changes: 3 additions & 3 deletions resources/qss/settings.qss
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
* {
font-size: <font-size>px;
font-size: 14px;
font-family: "Segoe UI";
}

QCheckBox::indicator {
width: <checkbox-size>px;
height: <checkbox-size>px;
width: 14px;
height: 14px;
}

chatterino--ComboBox {
Expand Down
8 changes: 6 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,8 @@ set(SOURCE_FILES
util/IpcQueue.hpp
util/LayoutHelper.cpp
util/LayoutHelper.hpp
util/LoadPixmap.cpp
util/LoadPixmap.hpp
util/RapidjsonHelpers.cpp
util/RapidjsonHelpers.hpp
util/RatelimitBucket.cpp
Expand Down Expand Up @@ -631,6 +633,8 @@ set(SOURCE_FILES
widgets/helper/EditableModelView.hpp
widgets/helper/EffectLabel.cpp
widgets/helper/EffectLabel.hpp
widgets/helper/IconDelegate.cpp
widgets/helper/IconDelegate.hpp
widgets/helper/InvisibleSizeGrip.cpp
widgets/helper/InvisibleSizeGrip.hpp
widgets/helper/NotebookButton.cpp
Expand All @@ -639,8 +643,6 @@ set(SOURCE_FILES
widgets/helper/NotebookTab.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 All @@ -655,6 +657,8 @@ set(SOURCE_FILES
widgets/helper/TitlebarButton.hpp
widgets/helper/TitlebarButtons.cpp
widgets/helper/TitlebarButtons.hpp
widgets/helper/TrimRegExpValidator.cpp
widgets/helper/TrimRegExpValidator.hpp

widgets/layout/FlowLayout.cpp
widgets/layout/FlowLayout.hpp
Expand Down
4 changes: 0 additions & 4 deletions src/RunGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ namespace {
QApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
#endif

#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
#endif

QApplication::setStyle(QStyleFactory::create("Fusion"));

#ifndef Q_OS_MAC
Expand Down
1 change: 1 addition & 0 deletions src/controllers/filters/lang/Filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ ContextMap buildContextMap(const MessagePtr &m, chatterino::Channel *channel)
{"channel.name", m->channelName},
{"channel.watching", watching},

{"flags.action", m->flags.has(MessageFlag::Action)},
{"flags.highlighted", m->flags.has(MessageFlag::Highlighted)},
{"flags.points_redeemed", m->flags.has(MessageFlag::RedeemedHighlight)},
{"flags.sub_message", m->flags.has(MessageFlag::Subscription)},
Expand Down
1 change: 1 addition & 0 deletions src/controllers/filters/lang/Filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ static const QMap<QString, Type> MESSAGE_TYPING_CONTEXT = {
{"channel.name", Type::String},
{"channel.watching", Type::Bool},
{"channel.live", Type::Bool},
{"flags.action", Type::Bool},
{"flags.highlighted", Type::Bool},
{"flags.points_redeemed", Type::Bool},
{"flags.sub_message", Type::Bool},
Expand Down
1 change: 1 addition & 0 deletions src/controllers/filters/lang/Tokenizer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ static const QMap<QString, QString> validIdentifiersMap = {
{"channel.name", "channel name"},
{"channel.watching", "/watching channel?"},
{"channel.live", "channel live?"},
{"flags.action", "action/me message?"},
{"flags.highlighted", "highlighted?"},
{"flags.points_redeemed", "redeemed points?"},
{"flags.sub_message", "sub/resub message?"},
Expand Down
77 changes: 38 additions & 39 deletions src/controllers/moderationactions/ModerationAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,11 @@
#include "singletons/Resources.hpp"

#include <QRegularExpression>
#include <QUrl>

namespace chatterino {

// ModerationAction::ModerationAction(Image *_image, const QString &_action)
// : _isImage(true)
// , image(_image)
// , action(_action)
//{
//}

// ModerationAction::ModerationAction(const QString &_line1, const QString
// &_line2,
// const QString &_action)
// : _isImage(false)
// , image(nullptr)
// , line1(_line1)
// , line2(_line2)
// , action(_action)
//{
//}

ModerationAction::ModerationAction(const QString &action)
ModerationAction::ModerationAction(const QString &action, const QUrl &iconPath)
: action_(action)
{
static QRegularExpression replaceRegex("[!/.]");
Expand All @@ -37,6 +20,8 @@ ModerationAction::ModerationAction(const QString &action)

if (timeoutMatch.hasMatch())
{
this->type_ = Type::Timeout;

// if (multipleTimeouts > 1) {
// QString line1;
// QString line2;
Expand Down Expand Up @@ -99,31 +84,31 @@ ModerationAction::ModerationAction(const QString &action)
}
this->line2_ = "w";
}

// line1 = this->line1_;
// line2 = this->line2_;
// } else {
// this->_moderationActions.emplace_back(getResources().buttonTimeout,
// str);
// }
}
else if (action.startsWith("/ban "))
{
this->imageToLoad_ = 1;
this->type_ = Type::Ban;
}
else if (action.startsWith("/delete "))
{
this->imageToLoad_ = 2;
this->type_ = Type::Delete;
}
else
{
this->type_ = Type::Custom;

QString xD = action;

xD.replace(replaceRegex, "");

this->line1_ = xD.mid(0, 2);
this->line2_ = xD.mid(2, 2);
}

if (iconPath.isValid())
{
this->iconPath_ = iconPath;
}
}

bool ModerationAction::operator==(const ModerationAction &other) const
Expand All @@ -139,19 +124,23 @@ bool ModerationAction::isImage() const
const std::optional<ImagePtr> &ModerationAction::getImage() const
{
assertInGuiThread();
if (this->image_.has_value())
{
return this->image_;
}

if (this->imageToLoad_ != 0)
if (this->iconPath_.isValid())
{
if (this->imageToLoad_ == 1)
{
this->image_ =
Image::fromResourcePixmap(getResources().buttons.ban);
}
else if (this->imageToLoad_ == 2)
{
this->image_ =
Image::fromResourcePixmap(getResources().buttons.trashCan);
}
this->image_ = Image::fromUrl({this->iconPath_.toString()});
}
else if (this->type_ == Type::Ban)
{
this->image_ = Image::fromResourcePixmap(getResources().buttons.ban);
}
else if (this->type_ == Type::Delete)
{
this->image_ =
Image::fromResourcePixmap(getResources().buttons.trashCan);
}

return this->image_;
Expand All @@ -172,4 +161,14 @@ const QString &ModerationAction::getAction() const
return this->action_;
}

const QUrl &ModerationAction::iconPath() const
{
return this->iconPath_;
}

ModerationAction::Type ModerationAction::getType() const
{
return this->type_;
}

} // namespace chatterino
Loading

0 comments on commit 883c60a

Please sign in to comment.