Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/master' into chatterino7
Browse files Browse the repository at this point in the history
Now we're on commit b4b7450; Changes from upstream we've pulled:

- Minor: Clean up chat messages of special line characters prior to sending. (Chatterino#3312)
- Bugfix: Fixed `First Message` scrollbar highlights not being disabled. (Chatterino#3325)
- Dev: Add GitHub action to test builds without precompiled headers enabled. (Chatterino#3327)
  • Loading branch information
zneix committed Oct 30, 2021
2 parents a509654 + b4b7450 commit 8786c24
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 29 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,21 @@ jobs:
os: [windows-latest, ubuntu-latest, macos-latest]
qt-version: [5.15.2, 5.12.10]
build-system: [qmake, cmake]
pch: [true]
exclude:
- os: windows-latest
qt-version: 5.12.10
build-system: cmake
pch: true
include:
- os: windows-2016
qt-version: 5.12.10
build-system: cmake
pch: true
- os: ubuntu-latest
qt-version: 5.15.2
build-system: cmake
pch: false
fail-fast: false

steps:
Expand Down Expand Up @@ -158,7 +165,12 @@ jobs:
run: |
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=appdir/usr/ -DCMAKE_BUILD_TYPE=Release -DPAJLADA_SETTINGS_USE_BOOST_FILESYSTEM=On ..
cmake \
-DCMAKE_INSTALL_PREFIX=appdir/usr/ \
-DCMAKE_BUILD_TYPE=Release \
-DPAJLADA_SETTINGS_USE_BOOST_FILESYSTEM=On \
-DUSE_PRECOMPILED_HEADERS=${{ matrix.pch }} \
..
make -j8
shell: bash

Expand Down Expand Up @@ -214,6 +226,7 @@ jobs:
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl \
-DUSE_PRECOMPILED_HEADERS=${{ matrix.pch }} \
..
make -j8
shell: bash
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- Minor: Ignore out of bounds check for tiling wms (#3270)
- Minor: Added `flags.first_message` filter variable (#3292)
- Minor: Removed duplicate setting for toggling `Channel Point Redeemed Message` highlights (#3296)
- Minor: Clean up chat messages of special line characters prior to sending. (#3312)
- Bugfix: Fixed colored usernames sometimes not working. (#3170)
- Bugfix: Restored ability to send duplicate `/me` messages. (#3166)
- Bugfix: Notifications for moderators about other moderators deleting messages can now be disabled. (#3121)
Expand All @@ -42,6 +43,8 @@
- Bugfix: Fixed `QCharRef with an index pointing outside the valid range of a QString` warning that was emitted on every Tab press. (#3234)
- Bugfix: Fixed being unable to disable `First Message` highlights (#3293)
- Bugfix: Fixed `First Message` custom sound not persisting through restart. (#3303)
- Bugfix: Fixed `First Message` scrollbar highlights not being disabled. (#3325)
- Dev: Add GitHub action to test builds without precompiled headers enabled. (#3327)
- Dev: Renamed CMake's build option `USE_SYSTEM_QT5KEYCHAIN` to `USE_SYSTEM_QTKEYCHAIN`. (#3103)
- Dev: Add benchmarks that can be compiled with the `BUILD_BENCHMARKS` CMake flag. Off by default. (#3038)

Expand Down
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,10 @@ if (BUILD_APP)
endif ()

if (USE_PRECOMPILED_HEADERS)
message(STATUS "Building with precompiled headers")
target_precompile_headers(${LIBRARY_PROJECT} PRIVATE PrecompiledHeader.hpp)
else ()
message(STATUS "Building without precompiled headers")
endif ()

# Enable autogeneration of Qts MOC/RCC/UIC
Expand Down
2 changes: 1 addition & 1 deletion src/messages/Message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ SBHighlight Message::getScrollBarHighlight() const
{
return SBHighlight(
ColorProvider::instance().color(ColorType::FirstMessageHighlight),
SBHighlight::Default, true);
SBHighlight::Default, false, true);
}
return SBHighlight();
}
Expand Down
2 changes: 1 addition & 1 deletion src/providers/twitch/TwitchChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ void TwitchChannel::sendMessage(const QString &message)
// Do last message processing
QString parsedMessage = app->emotes->emojis.replaceShortCodes(message);

parsedMessage = parsedMessage.trimmed();
parsedMessage = parsedMessage.simplified();

if (parsedMessage.isEmpty())
{
Expand Down
58 changes: 34 additions & 24 deletions src/widgets/Scrollbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ void Scrollbar::paintEvent(QPaintEvent *)
painter.fillRect(rect(), this->theme->scrollbars.background);

bool enableRedeemedHighlights = getSettings()->enableRedeemedHighlight;
bool enableFirstMessageHighlights =
getSettings()->enableFirstMessageHighlight;

// painter.fillRect(QRect(xOffset, 0, width(), this->buttonHeight),
// this->themeManager->ScrollbarArrow);
Expand Down Expand Up @@ -287,36 +289,44 @@ void Scrollbar::paintEvent(QPaintEvent *)
int highlightHeight =
int(std::ceil(std::max<float>(this->scale() * 2, dY)));

for (size_t i = 0; i < snapshotLength; i++)
for (size_t i = 0; i < snapshotLength; i++, y += dY)
{
ScrollbarHighlight const &highlight = snapshot[i];

if (!highlight.isNull())
if (highlight.isNull())
{
if (!highlight.isRedeemedHighlight() || enableRedeemedHighlights)
{
QColor color = highlight.getColor();
color.setAlpha(255);

switch (highlight.getStyle())
{
case ScrollbarHighlight::Default: {
painter.fillRect(w / 8 * 3, int(y), w / 4,
highlightHeight, color);
}
break;

case ScrollbarHighlight::Line: {
painter.fillRect(0, int(y), w, 1, color);
}
break;

case ScrollbarHighlight::None:;
}
}
continue;
}

if (highlight.isRedeemedHighlight() && !enableRedeemedHighlights)
{
continue;
}

if (highlight.isFirstMessageHighlight() &&
!enableFirstMessageHighlights)
{
continue;
}

y += dY;
QColor color = highlight.getColor();
color.setAlpha(255);

switch (highlight.getStyle())
{
case ScrollbarHighlight::Default: {
painter.fillRect(w / 8 * 3, int(y), w / 4, highlightHeight,
color);
}
break;

case ScrollbarHighlight::Line: {
painter.fillRect(0, int(y), w, 1, color);
}
break;

case ScrollbarHighlight::None:;
}
}
}

Expand Down
9 changes: 8 additions & 1 deletion src/widgets/helper/ScrollbarHighlight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ ScrollbarHighlight::ScrollbarHighlight()
}

ScrollbarHighlight::ScrollbarHighlight(const std::shared_ptr<QColor> color,
Style style, bool isRedeemedHighlight)
Style style, bool isRedeemedHighlight,
bool isFirstMessageHighlight)
: color_(color)
, style_(style)
, isRedeemedHighlight_(isRedeemedHighlight)
, isFirstMessageHighlight_(isFirstMessageHighlight)
{
}

Expand All @@ -35,6 +37,11 @@ bool ScrollbarHighlight::isRedeemedHighlight() const
return this->isRedeemedHighlight_;
}

bool ScrollbarHighlight::isFirstMessageHighlight() const
{
return this->isFirstMessageHighlight_;
}

bool ScrollbarHighlight::isNull() const
{
return this->style_ == None;
Expand Down
5 changes: 4 additions & 1 deletion src/widgets/helper/ScrollbarHighlight.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,20 @@ class ScrollbarHighlight
ScrollbarHighlight();

ScrollbarHighlight(const std::shared_ptr<QColor> color,
Style style = Default, bool isRedeemedHighlight = false);
Style style = Default, bool isRedeemedHighlight = false,
bool isFirstMessageHighlight = false);

QColor getColor() const;
Style getStyle() const;
bool isRedeemedHighlight() const;
bool isFirstMessageHighlight() const;
bool isNull() const;

private:
std::shared_ptr<QColor> color_;
Style style_;
bool isRedeemedHighlight_;
bool isFirstMessageHighlight_;
};

} // namespace chatterino

0 comments on commit 8786c24

Please sign in to comment.