fix: replace defines with constexpr/const and use more absolute paths for includes (#5527)

bye bye nuuls
This commit is contained in:
nerix
2024-08-03 12:00:58 +02:00
committed by GitHub
parent 5ee5abf5b2
commit aed55ac1ba
83 changed files with 386 additions and 380 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
#include "AccountSwitchWidget.hpp"
#include "widgets/AccountSwitchWidget.hpp"
#include "Application.hpp"
#include "common/Common.hpp"
+3 -3
View File
@@ -7,11 +7,11 @@
#include <QPainter>
// number of columns in grid mode
#define GRID_NUM_COLS 3
namespace {
// number of columns in grid mode
constexpr int GRID_NUM_COLS = 3;
#ifdef Q_OS_WIN
template <typename T>
inline constexpr T *tooltipParentFor(T * /*desiredParent*/)
+3 -3
View File
@@ -737,19 +737,19 @@ void Window::addMenuBar()
// Help->Chatterino Wiki item
QAction *helpWiki = helpMenu->addAction(QString("Chatterino Wiki"));
connect(helpWiki, &QAction::triggered, this, []() {
QDesktopServices::openUrl(QUrl(LINK_CHATTERINO_WIKI));
QDesktopServices::openUrl(QUrl(LINK_CHATTERINO_WIKI.toString()));
});
// Help->Chatterino Github
QAction *helpGithub = helpMenu->addAction(QString("Chatterino GitHub"));
connect(helpGithub, &QAction::triggered, this, []() {
QDesktopServices::openUrl(QUrl(LINK_CHATTERINO_SOURCE));
QDesktopServices::openUrl(QUrl(LINK_CHATTERINO_SOURCE.toString()));
});
// Help->Chatterino Discord
QAction *helpDiscord = helpMenu->addAction(QString("Chatterino Discord"));
connect(helpDiscord, &QAction::triggered, this, []() {
QDesktopServices::openUrl(QUrl(LINK_CHATTERINO_DISCORD));
QDesktopServices::openUrl(QUrl(LINK_CHATTERINO_DISCORD.toString()));
});
}
+1 -1
View File
@@ -1,4 +1,4 @@
#include "BadgePickerDialog.hpp"
#include "widgets/dialogs/BadgePickerDialog.hpp"
#include "Application.hpp"
#include "providers/twitch/TwitchBadges.hpp"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "EmotePopup.hpp"
#include "widgets/dialogs/EmotePopup.hpp"
#include "Application.hpp"
#include "common/QLogging.hpp"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "IrcConnectionEditor.hpp"
#include "widgets/dialogs/IrcConnectionEditor.hpp"
#include "ui_IrcConnectionEditor.h"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "QualityPopup.hpp"
#include "widgets/dialogs/QualityPopup.hpp"
#include "Application.hpp"
#include "common/QLogging.hpp"
+4 -4
View File
@@ -1,4 +1,4 @@
#include "SelectChannelDialog.hpp"
#include "widgets/dialogs/SelectChannelDialog.hpp"
#include "Application.hpp"
#include "common/QLogging.hpp"
@@ -25,11 +25,11 @@
#include <QTableView>
#include <QVBoxLayout>
#define TAB_TWITCH 0
#define TAB_IRC 1
namespace chatterino {
constexpr int TAB_TWITCH = 0;
constexpr int TAB_IRC = 1;
SelectChannelDialog::SelectChannelDialog(QWidget *parent)
: BaseWindow(
{
@@ -1,4 +1,4 @@
#include "SelectChannelFiltersDialog.hpp"
#include "widgets/dialogs/SelectChannelFiltersDialog.hpp"
#include "controllers/filters/FilterRecord.hpp"
#include "singletons/Settings.hpp"
+87 -85
View File
@@ -38,101 +38,104 @@
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QPointer>
#include <QStringBuilder>
const QString TEXT_FOLLOWERS("Followers: %1");
const QString TEXT_CREATED("Created: %1");
const QString TEXT_TITLE("%1's Usercard - #%2");
#define TEXT_USER_ID "ID: "
#define TEXT_UNAVAILABLE "(not available)"
namespace chatterino {
namespace {
Label *addCopyableLabel(LayoutCreator<QHBoxLayout> box, const char *tooltip,
Button **copyButton = nullptr)
constexpr QStringView TEXT_FOLLOWERS = u"Followers: %1";
constexpr QStringView TEXT_CREATED = u"Created: %1";
constexpr QStringView TEXT_TITLE = u"%1's Usercard - #%2";
constexpr QStringView TEXT_USER_ID = u"ID: ";
constexpr QStringView TEXT_UNAVAILABLE = u"(not available)";
using namespace chatterino;
Label *addCopyableLabel(LayoutCreator<QHBoxLayout> box, const char *tooltip,
Button **copyButton = nullptr)
{
auto label = box.emplace<Label>();
auto button = box.emplace<Button>();
if (copyButton != nullptr)
{
auto label = box.emplace<Label>();
auto button = box.emplace<Button>();
if (copyButton != nullptr)
{
button.assign(copyButton);
}
button->setPixmap(getApp()->getThemes()->buttons.copy);
button->setScaleIndependantSize(18, 18);
button->setDim(Button::Dim::Lots);
button->setToolTip(tooltip);
QObject::connect(
button.getElement(), &Button::leftClicked,
[label = label.getElement()] {
auto copyText = label->property("copy-text").toString();
button.assign(copyButton);
}
button->setPixmap(getApp()->getThemes()->buttons.copy);
button->setScaleIndependantSize(18, 18);
button->setDim(Button::Dim::Lots);
button->setToolTip(tooltip);
QObject::connect(
button.getElement(), &Button::leftClicked,
[label = label.getElement()] {
auto copyText = label->property("copy-text").toString();
crossPlatformCopy(copyText.isEmpty() ? label->getText()
: copyText);
});
crossPlatformCopy(copyText.isEmpty() ? label->getText() : copyText);
});
return label.getElement();
};
return label.getElement();
};
bool checkMessageUserName(const QString &userName, MessagePtr message)
bool checkMessageUserName(const QString &userName, MessagePtr message)
{
if (message->flags.has(MessageFlag::Whisper))
{
if (message->flags.has(MessageFlag::Whisper))
{
return false;
}
bool isSubscription = message->flags.has(MessageFlag::Subscription) &&
message->loginName.isEmpty() &&
message->messageText.split(" ").at(0).compare(
userName, Qt::CaseInsensitive) == 0;
bool isModAction =
message->timeoutUser.compare(userName, Qt::CaseInsensitive) == 0;
bool isSelectedUser =
message->loginName.compare(userName, Qt::CaseInsensitive) == 0;
return (isSubscription || isModAction || isSelectedUser);
return false;
}
ChannelPtr filterMessages(const QString &userName, ChannelPtr channel)
bool isSubscription = message->flags.has(MessageFlag::Subscription) &&
message->loginName.isEmpty() &&
message->messageText.split(" ").at(0).compare(
userName, Qt::CaseInsensitive) == 0;
bool isModAction =
message->timeoutUser.compare(userName, Qt::CaseInsensitive) == 0;
bool isSelectedUser =
message->loginName.compare(userName, Qt::CaseInsensitive) == 0;
return (isSubscription || isModAction || isSelectedUser);
}
ChannelPtr filterMessages(const QString &userName, ChannelPtr channel)
{
LimitedQueueSnapshot<MessagePtr> snapshot = channel->getMessageSnapshot();
ChannelPtr channelPtr;
if (channel->isTwitchChannel())
{
LimitedQueueSnapshot<MessagePtr> snapshot =
channel->getMessageSnapshot();
ChannelPtr channelPtr;
if (channel->isTwitchChannel())
{
channelPtr = std::make_shared<TwitchChannel>(channel->getName());
}
else
{
channelPtr = std::make_shared<Channel>(channel->getName(),
Channel::Type::None);
}
for (size_t i = 0; i < snapshot.size(); i++)
{
MessagePtr message = snapshot[i];
if (checkMessageUserName(userName, message))
{
channelPtr->addMessage(message, MessageContext::Repost);
}
}
return channelPtr;
};
const auto borderColor = QColor(255, 255, 255, 80);
int calculateTimeoutDuration(TimeoutButton timeout)
{
static const QMap<QString, int> durations{
{"s", 1}, {"m", 60}, {"h", 3600}, {"d", 86400}, {"w", 604800},
};
return timeout.second * durations[timeout.first];
channelPtr = std::make_shared<TwitchChannel>(channel->getName());
}
else
{
channelPtr =
std::make_shared<Channel>(channel->getName(), Channel::Type::None);
}
for (size_t i = 0; i < snapshot.size(); i++)
{
MessagePtr message = snapshot[i];
if (checkMessageUserName(userName, message))
{
channelPtr->addMessage(message, MessageContext::Repost);
}
}
return channelPtr;
};
const auto borderColor = QColor(255, 255, 255, 80);
int calculateTimeoutDuration(TimeoutButton timeout)
{
static const QMap<QString, int> durations{
{"s", 1}, {"m", 60}, {"h", 3600}, {"d", 86400}, {"w", 604800},
};
return timeout.second * durations[timeout.first];
}
} // namespace
namespace chatterino {
UserInfoPopup::UserInfoPopup(bool closeAutomatically, Split *split)
: DraggablePopup(closeAutomatically, split)
, split_(split)
@@ -813,10 +816,9 @@ void UserInfoPopup::updateUserData()
this->ui_.nameLabel->setText(this->userName_);
this->ui_.userIDLabel->setText(QString("ID ") +
QString(TEXT_UNAVAILABLE));
this->ui_.userIDLabel->setText(u"ID " % TEXT_UNAVAILABLE);
this->ui_.userIDLabel->setProperty("copy-text",
QString(TEXT_UNAVAILABLE));
TEXT_UNAVAILABLE.toString());
};
const auto onUserFetched = [this, hack,
currentUser](const HelixUser &user) {
@@ -855,7 +857,7 @@ void UserInfoPopup::updateUserData()
user.displayName, this->underlyingChannel_->getName()));
this->ui_.createdDateLabel->setText(
TEXT_CREATED.arg(user.createdAt.section("T", 0, 0)));
this->ui_.userIDLabel->setText(TEXT_USER_ID + user.id);
this->ui_.userIDLabel->setText(TEXT_USER_ID % user.id);
this->ui_.userIDLabel->setProperty("copy-text", user.id);
if (getApp()->getStreamerMode()->isEnabled() &&
+1 -1
View File
@@ -1,4 +1,4 @@
#include "WelcomeDialog.hpp"
#include "widgets/dialogs/WelcomeDialog.hpp"
namespace chatterino {
+1 -1
View File
@@ -1,4 +1,4 @@
#include "Button.hpp"
#include "widgets/helper/Button.hpp"
#include "singletons/Theme.hpp"
#include "util/FunctionEventFilter.hpp"
+2 -4
View File
@@ -68,12 +68,10 @@
#include <functional>
#include <memory>
#define SELECTION_RESUME_SCROLLING_MSG_THRESHOLD 3
#define CHAT_HOVER_PAUSE_DURATION 1000
#define TOOLTIP_EMOTE_ENTRIES_LIMIT 7
namespace {
constexpr size_t TOOLTIP_EMOTE_ENTRIES_LIMIT = 7;
using namespace chatterino;
constexpr int SCROLLBAR_PADDING = 8;
+1 -1
View File
@@ -1,4 +1,4 @@
#include "ComboBoxItemDelegate.hpp"
#include "widgets/helper/ComboBoxItemDelegate.hpp"
#include <QComboBox>
+15 -6
View File
@@ -1,8 +1,17 @@
#pragma once
#define OPEN_IN_BROWSER "Open stream in browser"
#define OPEN_PLAYER_IN_BROWSER "Open player in browser"
#define OPEN_MOD_VIEW_IN_BROWSER "Open mod view in browser"
#define OPEN_IN_STREAMLINK "Open in streamlink"
#define DONT_OPEN "Don't open"
#define OPEN_WHISPERS_IN_BROWSER "Open whispers in browser"
#include <QString>
namespace chatterino {
inline const QString OPEN_IN_BROWSER = QStringLiteral("Open stream in browser");
inline const QString OPEN_PLAYER_IN_BROWSER =
QStringLiteral("Open player in browser");
inline const QString OPEN_MOD_VIEW_IN_BROWSER =
QStringLiteral("Open mod view in browser");
inline const QString OPEN_IN_STREAMLINK = QStringLiteral("Open in streamlink");
inline const QString DONT_OPEN = QStringLiteral("Don't open");
inline const QString OPEN_WHISPERS_IN_BROWSER =
QStringLiteral("Open whispers in browser");
} // namespace chatterino
+1 -1
View File
@@ -1,4 +1,4 @@
#include "EditableModelView.hpp"
#include "widgets/helper/EditableModelView.hpp"
#include "widgets/helper/RegExpItemDelegate.hpp"
#include "widgets/helper/TableStyles.hpp"
-2
View File
@@ -14,8 +14,6 @@
#include <QPainterPath>
#include <QRadialGradient>
#define nuuls nullptr
namespace chatterino {
NotebookButton::NotebookButton(Notebook *parent)
+1 -1
View File
@@ -11,7 +11,7 @@
namespace chatterino {
#define NOTEBOOK_TAB_HEIGHT 28
constexpr int NOTEBOOK_TAB_HEIGHT = 28;
class SplitContainer;
+1 -1
View File
@@ -1,4 +1,4 @@
#include "SearchPopup.hpp"
#include "widgets/helper/SearchPopup.hpp"
#include "Application.hpp"
#include "common/Channel.hpp"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "TitlebarButton.hpp"
#include "widgets/helper/TitlebarButton.hpp"
#include "singletons/Theme.hpp"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "GenericListItem.hpp"
#include "widgets/listview/GenericListItem.hpp"
namespace chatterino {
+1 -1
View File
@@ -1,4 +1,4 @@
#include "GenericListModel.hpp"
#include "widgets/listview/GenericListModel.hpp"
namespace chatterino {
+10 -11
View File
@@ -1,30 +1,29 @@
#include "AboutPage.hpp"
#include "widgets/settingspages/AboutPage.hpp"
#include "common/Common.hpp"
#include "common/Modes.hpp"
#include "common/QLogging.hpp"
#include "common/Version.hpp"
#include "util/LayoutCreator.hpp"
#include "util/RemoveScrollAreaBackground.hpp"
#include "widgets/BasePopup.hpp"
#include "widgets/helper/SignalLabel.hpp"
#include "widgets/layout/FlowLayout.hpp"
#include <QFile>
#include <QFormLayout>
#include <QGroupBox>
#include <QLabel>
#include <QStringBuilder>
#include <QTextEdit>
#include <QTextStream>
#include <QVBoxLayout>
#define PIXMAP_WIDTH 500
#define LINK_DONATE "https://streamelements.com/fourtf/tip"
#define LINK_CHATTERINO_FEATURES "https://chatterino.com/#features"
namespace chatterino {
constexpr int PIXMAP_WIDTH = 500;
constexpr QStringView LINK_CHATTERINO_FEATURES =
u"https://chatterino.com/#features";
AboutPage::AboutPage()
{
LayoutCreator<AboutPage> layoutCreator(this);
@@ -66,9 +65,9 @@ AboutPage::AboutPage()
auto l = aboutChatterino.emplace<QVBoxLayout>();
// clang-format off
l.emplace<QLabel>("Chatterino Wiki can be found <a href=\"" LINK_CHATTERINO_WIKI "\">here</a>")->setOpenExternalLinks(true);
l.emplace<QLabel>("All about Chatterino's <a href=\"" LINK_CHATTERINO_FEATURES "\">features</a>")->setOpenExternalLinks(true);
l.emplace<QLabel>("Join the official Chatterino <a href=\"" LINK_CHATTERINO_DISCORD "\">Discord</a>")->setOpenExternalLinks(true);
l.emplace<QLabel>("Chatterino Wiki can be found <a href=\"" % LINK_CHATTERINO_WIKI % "\">here</a>")->setOpenExternalLinks(true);
l.emplace<QLabel>("All about Chatterino's <a href=\"" % LINK_CHATTERINO_FEATURES % "\">features</a>")->setOpenExternalLinks(true);
l.emplace<QLabel>("Join the official Chatterino <a href=\"" % LINK_CHATTERINO_DISCORD % "\">Discord</a>")->setOpenExternalLinks(true);
// clang-format on
}
+1 -1
View File
@@ -1,4 +1,4 @@
#include "AccountsPage.hpp"
#include "widgets/settingspages/AccountsPage.hpp"
#include "Application.hpp"
#include "controllers/accounts/AccountController.hpp"
+9 -7
View File
@@ -1,6 +1,7 @@
#include "CommandPage.hpp"
#include "widgets/settingspages/CommandPage.hpp"
#include "Application.hpp"
#include "common/Literals.hpp"
#include "controllers/commands/Command.hpp"
#include "controllers/commands/CommandController.hpp"
#include "controllers/commands/CommandModel.hpp"
@@ -18,13 +19,14 @@
#include <QTableView>
#include <QTextEdit>
// clang-format off
#define TEXT "{1} => first word &nbsp;&nbsp;&nbsp; {1+} => first word and after &nbsp;&nbsp;&nbsp; {{ => { &nbsp;&nbsp;&nbsp; <a href='https://chatterino.com/help/commands'>more info</a>"
// clang-format on
namespace {
using namespace chatterino;
using namespace literals;
// clang-format off
inline const QString HELP_TEXT = u"{1} => first word &nbsp;&nbsp;&nbsp; {1+} => first word and after &nbsp;&nbsp;&nbsp; {{ => { &nbsp;&nbsp;&nbsp; <a href='https://chatterino.com/help/commands'>more info</a>"_s;
// clang-format on
QString c1settingsPath()
{
@@ -106,7 +108,7 @@ CommandPage::CommandPage()
view->addCustomButton(button);
QObject::connect(button, &QPushButton::clicked, this, [] {
QFile c1settings = c1settingsPath();
QFile c1settings(c1settingsPath());
c1settings.open(QIODevice::ReadOnly);
for (auto line :
QString(c1settings.readAll())
@@ -125,7 +127,7 @@ CommandPage::CommandPage()
this->createCheckBox("Also match the trigger at the end of the message",
getSettings()->allowCommandsAtEnd));
QLabel *text = layout.emplace<QLabel>(TEXT).getElement();
QLabel *text = layout.emplace<QLabel>(HELP_TEXT).getElement();
text->setWordWrap(true);
text->setStyleSheet("color: #bbb");
text->setOpenExternalLinks(true);
@@ -10,11 +10,11 @@
#include <QGroupBox>
#include <QLabel>
#define STREAMLINK_QUALITY \
"Choose", "Source", "High", "Medium", "Low", "Audio only"
namespace chatterino {
inline const QStringList STREAMLINK_QUALITY = {
"Choose", "Source", "High", "Medium", "Low", "Audio only"};
ExternalToolsPage::ExternalToolsPage()
{
LayoutCreator<ExternalToolsPage> layoutCreator(this);
@@ -75,7 +75,7 @@ ExternalToolsPage::ExternalToolsPage()
groupLayout->addRow("Custom streamlink path:", customPath);
groupLayout->addRow(
"Preferred quality:",
this->createComboBox({STREAMLINK_QUALITY},
this->createComboBox(STREAMLINK_QUALITY,
getSettings()->preferredQuality));
groupLayout->addRow(
"Additional options:",
+6 -6
View File
@@ -1,4 +1,4 @@
#include "FiltersPage.hpp"
#include "widgets/settingspages/FiltersPage.hpp"
#include "Application.hpp"
#include "controllers/filters/FilterModel.hpp"
@@ -8,15 +8,15 @@
#include "util/LayoutCreator.hpp"
#include "widgets/dialogs/ChannelFilterEditorDialog.hpp"
#include "widgets/helper/EditableModelView.hpp"
#include "widgets/Window.hpp"
#include <QHeaderView>
#include <QTableView>
#define FILTERS_DOCUMENTATION "https://wiki.chatterino.com/Filters"
namespace chatterino {
constexpr QStringView FILTERS_DOCUMENTATION =
u"https://wiki.chatterino.com/Filters";
FiltersPage::FiltersPage()
{
LayoutCreator<FiltersPage> layoutCreator(this);
@@ -67,8 +67,8 @@ FiltersPage::FiltersPage()
});
auto *filterHelpLabel =
new QLabel(QString("<a href='%1'><span "
"style='color:#99f'>filter info</span></a>")
new QLabel(QStringView(u"<a href='%1'><span "
"style='color:#99f'>filter info</span></a>")
.arg(FILTERS_DOCUMENTATION));
filterHelpLabel->setOpenExternalLinks(true);
view->addCustomButton(filterHelpLabel);
+50 -51
View File
@@ -1,6 +1,7 @@
#include "widgets/settingspages/GeneralPage.hpp"
#include "Application.hpp"
#include "common/Literals.hpp"
#include "common/QLogging.hpp"
#include "common/Version.hpp"
#include "controllers/hotkeys/HotkeyCategory.hpp"
@@ -19,7 +20,6 @@
#include "util/IncognitoBrowser.hpp"
#include "widgets/BaseWindow.hpp"
#include "widgets/settingspages/GeneralPageView.hpp"
#include "widgets/splits/SplitInput.hpp"
#include <magic_enum/magic_enum.hpp>
#include <QDesktopServices>
@@ -28,64 +28,63 @@
#include <QLabel>
#include <QScrollArea>
#define CHROME_EXTENSION_LINK \
"https://chrome.google.com/webstore/detail/chatterino-native-host/" \
"glknmaideaikkmemifbfkhnomoknepka"
#define FIREFOX_EXTENSION_LINK \
"https://addons.mozilla.org/en-US/firefox/addon/chatterino-native-host/"
namespace {
// define to highlight sections in editor
#define addTitle addTitle
#define addSubtitle addSubtitle
using namespace chatterino;
using namespace literals;
const QString CHROME_EXTENSION_LINK =
u"https://chrome.google.com/webstore/detail/chatterino-native-host/glknmaideaikkmemifbfkhnomoknepka"_s;
const QString FIREFOX_EXTENSION_LINK =
u"https://addons.mozilla.org/en-US/firefox/addon/chatterino-native-host/"_s;
#ifdef Q_OS_WIN
# define META_KEY "Windows"
const QString META_KEY = u"Windows"_s;
#else
# define META_KEY "Meta"
const QString META_KEY = u"Meta"_s;
#endif
namespace chatterino {
namespace {
void addKeyboardModifierSetting(GeneralPageView &layout,
const QString &title,
EnumSetting<Qt::KeyboardModifier> &setting)
{
layout.addDropdown<std::underlying_type<Qt::KeyboardModifier>::type>(
title, {"None", "Shift", "Control", "Alt", META_KEY}, setting,
[](int index) {
switch (index)
{
case Qt::ShiftModifier:
return 1;
case Qt::ControlModifier:
return 2;
case Qt::AltModifier:
return 3;
case Qt::MetaModifier:
return 4;
default:
return 0;
}
},
[](DropdownArgs args) {
switch (args.index)
{
case 1:
return Qt::ShiftModifier;
case 2:
return Qt::ControlModifier;
case 3:
return Qt::AltModifier;
case 4:
return Qt::MetaModifier;
default:
return Qt::NoModifier;
}
},
false);
}
void addKeyboardModifierSetting(GeneralPageView &layout, const QString &title,
EnumSetting<Qt::KeyboardModifier> &setting)
{
layout.addDropdown<std::underlying_type<Qt::KeyboardModifier>::type>(
title, {"None", "Shift", "Control", "Alt", META_KEY}, setting,
[](int index) {
switch (index)
{
case Qt::ShiftModifier:
return 1;
case Qt::ControlModifier:
return 2;
case Qt::AltModifier:
return 3;
case Qt::MetaModifier:
return 4;
default:
return 0;
}
},
[](DropdownArgs args) {
switch (args.index)
{
case 1:
return Qt::ShiftModifier;
case 2:
return Qt::ControlModifier;
case 3:
return Qt::AltModifier;
case 4:
return Qt::MetaModifier;
default:
return Qt::NoModifier;
}
},
false);
}
} // namespace
namespace chatterino {
GeneralPage::GeneralPage()
{
auto *y = new QVBoxLayout;
@@ -1,4 +1,4 @@
#include "HighlightingPage.hpp"
#include "widgets/settingspages/HighlightingPage.hpp"
#include "Application.hpp"
#include "controllers/highlights/BadgeHighlightModel.hpp"
@@ -10,7 +10,6 @@
#include "controllers/highlights/UserHighlightModel.hpp"
#include "providers/colors/ColorProvider.hpp"
#include "singletons/Settings.hpp"
#include "singletons/Theme.hpp"
#include "util/Helpers.hpp"
#include "util/LayoutCreator.hpp"
#include "widgets/dialogs/BadgePickerDialog.hpp"
@@ -25,8 +24,6 @@
#include <QTableView>
#include <QTabWidget>
#define ALWAYS_PLAY "Play highlight sound even when Chatterino is focused"
namespace chatterino {
namespace {
@@ -312,8 +309,9 @@ HighlightingPage::HighlightingPage()
this->managedConnections_);
}
layout.append(createCheckBox(ALWAYS_PLAY,
getSettings()->highlightAlwaysPlaySound));
layout.append(createCheckBox(
"Play highlight sound even when Chatterino is focused",
getSettings()->highlightAlwaysPlaySound));
layout.append(createCheckBox(
"Flash taskbar only stops highlighting when Chatterino is focused",
getSettings()->longAlerts));
+5 -5
View File
@@ -1,6 +1,7 @@
#include "widgets/settingspages/IgnoresPage.hpp"
#include "Application.hpp"
#include "common/Literals.hpp"
#include "controllers/accounts/AccountController.hpp"
#include "controllers/ignores/IgnoreModel.hpp"
#include "controllers/ignores/IgnorePhrase.hpp"
@@ -19,12 +20,10 @@
#include <QTableView>
#include <QVBoxLayout>
// clang-format off
#define INFO "/block <user> in chat blocks a user.\n/unblock <user> in chat unblocks a user.\nYou can also click on a user to open the usercard."
// clang-format on
namespace chatterino {
using namespace literals;
static void addPhrasesTab(LayoutCreator<QVBoxLayout> box);
static void addUsersTab(IgnoresPage &page, LayoutCreator<QVBoxLayout> box,
QStringListModel &model);
@@ -74,7 +73,8 @@ void addPhrasesTab(LayoutCreator<QVBoxLayout> layout)
void addUsersTab(IgnoresPage &page, LayoutCreator<QVBoxLayout> users,
QStringListModel &userModel)
{
auto label = users.emplace<QLabel>(INFO);
auto label = users.emplace<QLabel>(
u"/block <user> in chat blocks a user.\n/unblock <user> in chat unblocks a user.\nYou can also click on a user to open the usercard."_s);
label->setWordWrap(true);
users.append(page.createCheckBox("Enable Twitch blocked users",
getSettings()->enableTwitchBlockedUsers));
+1 -1
View File
@@ -1,4 +1,4 @@
#include "ModerationPage.hpp"
#include "widgets/settingspages/ModerationPage.hpp"
#include "Application.hpp"
#include "controllers/logging/ChannelLoggingModel.hpp"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "NicknamesPage.hpp"
#include "widgets/settingspages/NicknamesPage.hpp"
#include "controllers/nicknames/Nickname.hpp"
#include "controllers/nicknames/NicknamesModel.hpp"
@@ -1,4 +1,4 @@
#include "NotificationPage.hpp"
#include "widgets/settingspages/NotificationPage.hpp"
#include "Application.hpp"
#include "controllers/notifications/NotificationController.hpp"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "SettingsPage.hpp"
#include "widgets/settingspages/SettingsPage.hpp"
#include "Application.hpp"
#include "singletons/WindowManager.hpp"
+1 -1
View File
@@ -1,4 +1,4 @@
#include "ClosedSplits.hpp"
#include "widgets/splits/ClosedSplits.hpp"
namespace chatterino {
+24 -23
View File
@@ -343,29 +343,30 @@ Split::Split(QWidget *parent)
this->refreshModerationMode();
});
this->signalHolder_.managedConnect(
modifierStatusChanged, [this](Qt::KeyboardModifiers status) {
if ((status ==
showSplitOverlayModifiers /*|| status == showAddSplitRegions*/) &&
this->isMouseOver_)
{
this->overlay_->show();
}
else
{
this->overlay_->hide();
}
this->signalHolder_.managedConnect(modifierStatusChanged, [this](
Qt::KeyboardModifiers
status) {
if ((status ==
SHOW_SPLIT_OVERLAY_MODIFIERS /*|| status == showAddSplitRegions*/) &&
this->isMouseOver_)
{
this->overlay_->show();
}
else
{
this->overlay_->hide();
}
if (getSettings()->pauseChatModifier.getEnum() != Qt::NoModifier &&
status == getSettings()->pauseChatModifier.getEnum())
{
this->view_->pause(PauseReason::KeyboardModifier);
}
else
{
this->view_->unpause(PauseReason::KeyboardModifier);
}
});
if (getSettings()->pauseChatModifier.getEnum() != Qt::NoModifier &&
status == getSettings()->pauseChatModifier.getEnum())
{
this->view_->pause(PauseReason::KeyboardModifier);
}
else
{
this->view_->unpause(PauseReason::KeyboardModifier);
}
});
this->signalHolder_.managedConnect(this->input_->ui_.textEdit->focused,
[this] {
@@ -1019,7 +1020,7 @@ void Split::enterEvent(QEvent * /*event*/)
this->handleModifiers(QGuiApplication::queryKeyboardModifiers());
if (modifierStatus ==
showSplitOverlayModifiers /*|| modifierStatus == showAddSplitRegions*/)
SHOW_SPLIT_OVERLAY_MODIFIERS /*|| modifierStatus == showAddSplitRegions*/)
{
this->overlay_->show();
}
+5 -5
View File
@@ -41,7 +41,7 @@ SplitContainer::SplitContainer(Notebook *parent)
Split::modifierStatusChanged, [this](auto modifiers) {
this->layout();
if (modifiers == showResizeHandlesModifiers)
if (modifiers == SHOW_RESIZE_HANDLES_MODIFIERS)
{
for (auto &handle : this->resizeHandles_)
{
@@ -57,7 +57,7 @@ SplitContainer::SplitContainer(Notebook *parent)
}
}
if (modifiers == showSplitOverlayModifiers)
if (modifiers == SHOW_SPLIT_OVERLAY_MODIFIERS)
{
this->setCursor(Qt::PointingHandCursor);
}
@@ -496,7 +496,7 @@ void SplitContainer::layout()
std::vector<ResizeRect> resizeRects;
const bool addSpacing =
Split::modifierStatus == showAddSplitRegions || this->isDragging_;
Split::modifierStatus == SHOW_ADD_SPLIT_REGIONS || this->isDragging_;
this->baseNode_.layout(addSpacing, this->scale(), dropRects, resizeRects);
this->dropRects_ = dropRects;
@@ -559,7 +559,7 @@ void SplitContainer::layout()
handle->setVertical(resizeRect.vertical);
handle->node = resizeRect.node;
if (Split::modifierStatus == showResizeHandlesModifiers)
if (Split::modifierStatus == SHOW_RESIZE_HANDLES_MODIFIERS)
{
handle->show();
handle->raise();
@@ -720,7 +720,7 @@ void SplitContainer::dragEnterEvent(QDragEnterEvent *event)
void SplitContainer::mouseMoveEvent(QMouseEvent *event)
{
if (Split::modifierStatus == showSplitOverlayModifiers)
if (Split::modifierStatus == SHOW_SPLIT_OVERLAY_MODIFIERS)
{
this->setCursor(Qt::PointingHandCursor);
}
+1 -1
View File
@@ -1,4 +1,4 @@
#include "SplitOverlay.hpp"
#include "widgets/splits/SplitOverlay.hpp"
#include "Application.hpp"
#include "singletons/Resources.hpp"