Skip to content

Commit

Permalink
chore: mini refactorings and dead code removal (#5512)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerixyz authored Jul 20, 2024
1 parent deb4401 commit b3c09b6
Show file tree
Hide file tree
Showing 28 changed files with 65 additions and 506 deletions.
1 change: 0 additions & 1 deletion src/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#include "providers/twitch/PubSubActions.hpp"
#include "providers/twitch/PubSubManager.hpp"
#include "providers/twitch/PubSubMessages.hpp"
#include "providers/twitch/pubsubmessages/LowTrustUsers.hpp"
#include "providers/twitch/TwitchChannel.hpp"
#include "providers/twitch/TwitchIrcServer.hpp"
#include "providers/twitch/TwitchMessageBuilder.hpp"
Expand Down
3 changes: 0 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,6 @@ set(SOURCE_FILES
util/ChannelHelpers.hpp
util/Clipboard.cpp
util/Clipboard.hpp
util/ConcurrentMap.hpp
util/DebugCount.cpp
util/DebugCount.hpp
util/DisplayBadge.cpp
Expand Down Expand Up @@ -517,8 +516,6 @@ set(SOURCE_FILES
util/SampleData.cpp
util/SampleData.hpp
util/SharedPtrElementLess.hpp
util/SplitCommand.cpp
util/SplitCommand.hpp
util/StreamLink.cpp
util/StreamLink.hpp
util/ThreadGuard.hpp
Expand Down
102 changes: 0 additions & 102 deletions src/common/ConcurrentMap.hpp

This file was deleted.

1 change: 0 additions & 1 deletion src/common/Credentials.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "singletons/Paths.hpp"
#include "singletons/Settings.hpp"
#include "util/CombinePath.hpp"
#include "util/Overloaded.hpp"
#include "util/Variant.hpp"

#include <QJsonDocument>
Expand Down
1 change: 0 additions & 1 deletion src/providers/irc/IrcCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "messages/MessageBuilder.hpp"
#include "providers/irc/IrcChannel2.hpp"
#include "providers/irc/IrcServer.hpp"
#include "util/Overloaded.hpp"
#include "util/QStringHash.hpp"

namespace chatterino {
Expand Down
1 change: 0 additions & 1 deletion src/providers/twitch/PubSubClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "providers/twitch/PubSubActions.hpp"
#include "providers/twitch/PubSubHelpers.hpp"
#include "providers/twitch/PubSubMessages.hpp"
#include "providers/twitch/pubsubmessages/Unlisten.hpp"
#include "singletons/Settings.hpp"
#include "util/DebugCount.hpp"
#include "util/Helpers.hpp"
Expand Down
1 change: 0 additions & 1 deletion src/providers/twitch/PubSubManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "providers/twitch/PubSubHelpers.hpp"
#include "providers/twitch/PubSubMessages.hpp"
#include "providers/twitch/TwitchAccount.hpp"
#include "pubsubmessages/LowTrustUsers.hpp"
#include "util/DebugCount.hpp"
#include "util/Helpers.hpp"
#include "util/RapidjsonHelpers.hpp"
Expand Down
17 changes: 9 additions & 8 deletions src/providers/twitch/PubSubMessages.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#pragma once

#include "providers/twitch/pubsubmessages/AutoMod.hpp"
#include "providers/twitch/pubsubmessages/Base.hpp"
#include "providers/twitch/pubsubmessages/ChannelPoints.hpp"
#include "providers/twitch/pubsubmessages/ChatModeratorAction.hpp"
#include "providers/twitch/pubsubmessages/Listen.hpp"
#include "providers/twitch/pubsubmessages/Message.hpp"
#include "providers/twitch/pubsubmessages/Unlisten.hpp"
#include "providers/twitch/pubsubmessages/Whisper.hpp"
#include "providers/twitch/pubsubmessages/AutoMod.hpp" // IWYU pragma: export
#include "providers/twitch/pubsubmessages/Base.hpp" // IWYU pragma: export
#include "providers/twitch/pubsubmessages/ChannelPoints.hpp" // IWYU pragma: export
#include "providers/twitch/pubsubmessages/ChatModeratorAction.hpp" // IWYU pragma: export
#include "providers/twitch/pubsubmessages/Listen.hpp" // IWYU pragma: export
#include "providers/twitch/pubsubmessages/LowTrustUsers.hpp" // IWYU pragma: export
#include "providers/twitch/pubsubmessages/Message.hpp" // IWYU pragma: export
#include "providers/twitch/pubsubmessages/Unlisten.hpp" // IWYU pragma: export
#include "providers/twitch/pubsubmessages/Whisper.hpp" // IWYU pragma: export
6 changes: 2 additions & 4 deletions src/singletons/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
#include "controllers/nicknames/Nickname.hpp"
#include "debug/Benchmark.hpp"
#include "pajlada/settings/signalargs.hpp"
#include "util/Clamp.hpp"
#include "util/PersistSignalVector.hpp"
#include "util/WindowsHelper.hpp"

#include <pajlada/signals/scoped-connection.hpp>
Expand Down Expand Up @@ -267,12 +265,12 @@ void Settings::restoreSnapshot()

float Settings::getClampedUiScale() const
{
return clamp<float>(this->uiScale.getValue(), 0.2f, 10);
return std::clamp(this->uiScale.getValue(), 0.2F, 10.F);
}

void Settings::setClampedUiScale(float value)
{
this->uiScale.setValue(clamp<float>(value, 0.2f, 10));
this->uiScale.setValue(std::clamp(value, 0.2F, 10.F));
}

Settings &Settings::instance()
Expand Down
1 change: 0 additions & 1 deletion src/singletons/WindowManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "singletons/Paths.hpp"
#include "singletons/Settings.hpp"
#include "singletons/Theme.hpp"
#include "util/Clamp.hpp"
#include "util/CombinePath.hpp"
#include "widgets/AccountSwitchPopup.hpp"
#include "widgets/dialogs/SettingsDialog.hpp"
Expand Down
13 changes: 0 additions & 13 deletions src/util/Clamp.hpp

This file was deleted.

102 changes: 0 additions & 102 deletions src/util/ConcurrentMap.hpp

This file was deleted.

1 change: 1 addition & 0 deletions src/util/DisplayBadge.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <QString>

namespace chatterino {

class DisplayBadge
{
public:
Expand Down
8 changes: 3 additions & 5 deletions src/util/DistanceBetweenPoints.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@

namespace chatterino {

inline float distanceBetweenPoints(const QPointF &p1, const QPointF &p2)
inline qreal distanceBetweenPoints(const QPointF &p1, const QPointF &p2)
{
QPointF tmp = p1 - p2;

float distance = 0.f;
distance += tmp.x() * tmp.x();
distance += tmp.y() * tmp.y();
qreal distance = tmp.x() * tmp.x() + tmp.y() * tmp.y();

return sqrt(distance);
return std::sqrt(distance);
}

} // namespace chatterino
4 changes: 1 addition & 3 deletions src/util/ExponentialBackoff.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#include <algorithm>
#include <chrono>

namespace chatterino {
Expand All @@ -20,7 +19,6 @@ class ExponentialBackoff
**/
ExponentialBackoff(const std::chrono::milliseconds &start)
: start_(start)
, step_{1}
{
static_assert(maxSteps > 1, "maxSteps must be higher than 1");
}
Expand Down Expand Up @@ -54,7 +52,7 @@ class ExponentialBackoff

private:
const std::chrono::milliseconds start_;
unsigned step_;
unsigned step_ = 1;
};

} // namespace chatterino
6 changes: 3 additions & 3 deletions src/util/Helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace chatterino {

namespace _helpers_internal {
namespace helpers::detail {

SizeType skipSpace(QStringView view, SizeType startPos)
{
Expand Down Expand Up @@ -110,8 +110,8 @@ namespace _helpers_internal {
return std::make_pair(0, false);
}

} // namespace _helpers_internal
using namespace _helpers_internal;
} // namespace helpers::detail
using namespace helpers::detail;

bool startsWithOrContains(const QString &str1, const QString &str2,
Qt::CaseSensitivity caseSensitivity, bool startsWith)
Expand Down
Loading

0 comments on commit b3c09b6

Please sign in to comment.