-
-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: Message #4915
refactor: Message #4915
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There were too many comments to post at once. Showing the first 25 out of 48. Check the log or trigger a new build to see more.
@@ -33,8 +33,8 @@ class CommandController final : public Singleton | |||
bool dryRun); | |||
QStringList getDefaultChatterinoCommandList(); | |||
|
|||
virtual void initialize(Settings &, Paths &paths) override; | |||
virtual void save() override; | |||
void initialize(Settings &, Paths &paths) override; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: all parameters should be named in a function [readability-named-parameter]
void initialize(Settings &, Paths &paths) override; | |
void initialize(Settings & /*settings*/, Paths &paths) override; |
} | ||
|
||
if (chan->isBroadcaster()) | ||
// get username, duration and message of the timed out user | ||
QString username = message->parameter(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'username' of type 'QString' can be declared 'const' [misc-const-correctness]
QString username = message->parameter(1); | |
QString const username = message->parameter(1); |
// get username, duration and message of the timed out user | ||
QString username = message->parameter(1); | ||
QString durationInSeconds; | ||
QVariant v = message->tag("ban-duration"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'v' of type 'QVariant' can be declared 'const' [misc-const-correctness]
QVariant v = message->tag("ban-duration"); | |
QVariant const v = message->tag("ban-duration"); |
{ | ||
std::vector<MessagePtr> builtMessage; | ||
|
||
QString remainingTime = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'remainingTime' of type 'QString' can be declared 'const' [misc-const-correctness]
QString remainingTime = | |
QString const remainingTime = |
|
||
QString remainingTime = | ||
formatTime(message->content().split(" ").value(5)); | ||
QString formattedMessage = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'formattedMessage' of type 'QString' can be declared 'const' [misc-const-correctness]
QString formattedMessage = | |
QString const formattedMessage = |
src/widgets/BaseWindow.hpp
Outdated
@@ -72,20 +72,20 @@ class BaseWindow : public BaseWidget | |||
bool nativeEvent(const QByteArray &eventType, void *message, | |||
long *result) override; | |||
#endif | |||
virtual void scaleChangedEvent(float) override; | |||
void scaleChangedEvent(float) override; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: all parameters should be named in a function [readability-named-parameter]
void scaleChangedEvent(float) override; | |
void scaleChangedEvent(float /*newScale*/) override; |
src/widgets/BaseWindow.hpp
Outdated
|
||
virtual void paintEvent(QPaintEvent *) override; | ||
void paintEvent(QPaintEvent *) override; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: all parameters should be named in a function [readability-named-parameter]
void paintEvent(QPaintEvent *) override; | |
void paintEvent(QPaintEvent * /*event*/) override; |
src/widgets/BaseWindow.hpp
Outdated
virtual void moveEvent(QMoveEvent *) override; | ||
virtual void closeEvent(QCloseEvent *) override; | ||
virtual void showEvent(QShowEvent *) override; | ||
void changeEvent(QEvent *) override; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: all parameters should be named in a function [readability-named-parameter]
void changeEvent(QEvent *) override; | |
void changeEvent(QEvent * /*unused*/) override; |
src/widgets/BaseWindow.hpp
Outdated
virtual void closeEvent(QCloseEvent *) override; | ||
virtual void showEvent(QShowEvent *) override; | ||
void changeEvent(QEvent *) override; | ||
void leaveEvent(QEvent *) override; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: all parameters should be named in a function [readability-named-parameter]
void leaveEvent(QEvent *) override; | |
void leaveEvent(QEvent * /*event*/) override; |
src/widgets/BaseWindow.hpp
Outdated
virtual void showEvent(QShowEvent *) override; | ||
void changeEvent(QEvent *) override; | ||
void leaveEvent(QEvent *) override; | ||
void resizeEvent(QResizeEvent *) override; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: all parameters should be named in a function [readability-named-parameter]
void resizeEvent(QResizeEvent *) override; | |
void resizeEvent(QResizeEvent * /*event*/) override; |
5c0b98f
to
df9a866
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
src/widgets/helper/ChannelView.cpp
Outdated
} | ||
|
||
// Link copy | ||
QString url = link.value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'url' of type 'QString' can be declared 'const' [misc-const-correctness]
QString url = link.value; | |
QString const url = link.value; |
src/widgets/helper/ChannelView.cpp
Outdated
{ | ||
openTwitchUsercard(this->channel_->getName(), | ||
hoverLayoutElement->getLink().value); | ||
return; | ||
} | ||
else if (hoverLayoutElement->getLink().isUrl() == false) | ||
if (hoverLayoutElement->getLink().isUrl() == false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr]
if (hoverLayoutElement->getLink().isUrl() == false) | |
if (!hoverLayoutElement->getLink().isUrl()) |
src/widgets/helper/ChannelView.cpp
Outdated
@@ -2742,7 +2814,9 @@ | |||
int ChannelView::getLayoutWidth() const | |||
{ | |||
if (this->scrollBar_->isVisible()) | |||
return int(this->width() - scrollbarPadding * this->scale()); | |||
{ | |||
return int(this->width() - SCROLLBAR_PADDING * this->scale()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: narrowing conversion from 'int' to 'float' [bugprone-narrowing-conversions]
return int(this->width() - SCROLLBAR_PADDING * this->scale());
^
0609034
to
11f2704
Compare
11f2704
to
6b4eb87
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a future refactoring: There are a few #pragma comment(lib, "my.lib")
in the code (e.g. in AttachedWindow.cpp). These can be replaced by target_link_libraries(<target> PRIVATE my.lib)
(maybe there's even a better way of doing this in CMake).
return { | ||
ColorProvider::instance().color(ColorType::FirstMessageHighlight), | ||
SBHighlight::Default, false, true); | ||
ScrollbarHighlight::Default, | ||
false, | ||
true, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not from this PR: The ScrollbarHighlight
needs some refactoring. The arguments isRedeemedHighlight
,
isFirstMessageHighlight
, and isElevatedMessageHighlight
are mutually exclusive - shouldn't this be refactored to an enum? Even if they're not mutually exclusive, a bit field would be more readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely should be enums yeah
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description
this PR was cherry-picked into smaller PRs
With the last remaining changes to
Message
& some other small changes staying hereMessage: Remove empty anon namespace
Message: Remove else after return
Message: Avoid repeating type in return
Message: Remove unused includes (there were a few)
Helix: Remove unneccesary
static
for already-static variablesAttachedWindow: Remove unused ForwardDecl.hpp include