removed unused settings pages

This commit is contained in:
fourtf 2019-09-03 11:49:44 +02:00
parent ac26bd8d2d
commit 6aa6e084af
13 changed files with 10 additions and 986 deletions

View file

@ -82,8 +82,8 @@ SOURCES += \
src/common/DownloadManager.cpp \
src/common/Env.cpp \
src/common/LinkParser.cpp \
src/common/NetworkPrivate.cpp \
src/common/NetworkManager.cpp \
src/common/NetworkPrivate.cpp \
src/common/NetworkRequest.cpp \
src/common/NetworkResult.cpp \
src/common/UsernameSet.cpp \
@ -104,6 +104,8 @@ SOURCES += \
src/controllers/moderationactions/ModerationActions.cpp \
src/controllers/notifications/NotificationController.cpp \
src/controllers/notifications/NotificationModel.cpp \
src/controllers/pings/PingController.cpp \
src/controllers/pings/PingModel.cpp \
src/controllers/taggedusers/TaggedUser.cpp \
src/controllers/taggedusers/TaggedUsersController.cpp \
src/controllers/taggedusers/TaggedUsersModel.cpp \
@ -161,9 +163,9 @@ SOURCES += \
src/singletons/Settings.cpp \
src/singletons/Theme.cpp \
src/singletons/Toasts.cpp \
src/singletons/TooltipPreviewImage.cpp \
src/singletons/Updates.cpp \
src/singletons/WindowManager.cpp \
src/singletons/TooltipPreviewImage.cpp \
src/util/DebugCount.cpp \
src/util/FormatTime.cpp \
src/util/IncognitoBrowser.cpp \
@ -201,21 +203,15 @@ SOURCES += \
src/widgets/settingspages/AboutPage.cpp \
src/widgets/settingspages/AccountsPage.cpp \
src/widgets/settingspages/AdvancedPage.cpp \
src/widgets/settingspages/BrowserExtensionPage.cpp \
src/widgets/settingspages/CommandPage.cpp \
src/widgets/settingspages/EmotesPage.cpp \
src/widgets/settingspages/ExternalToolsPage.cpp \
src/widgets/settingspages/FeelPage.cpp \
src/widgets/settingspages/GeneralPage.cpp \
src/widgets/settingspages/HighlightingPage.cpp \
src/widgets/settingspages/IgnoresPage.cpp \
src/widgets/settingspages/KeyboardSettingsPage.cpp \
src/widgets/settingspages/LogsPage.cpp \
src/widgets/settingspages/LookPage.cpp \
src/widgets/settingspages/ModerationPage.cpp \
src/widgets/settingspages/NotificationPage.cpp \
src/widgets/settingspages/SettingsPage.cpp \
src/widgets/settingspages/SpecialChannelsPage.cpp \
src/widgets/splits/ClosedSplits.cpp \
src/widgets/splits/Split.cpp \
src/widgets/splits/SplitContainer.cpp \
@ -224,8 +220,6 @@ SOURCES += \
src/widgets/splits/SplitOverlay.cpp \
src/widgets/StreamView.cpp \
src/widgets/Window.cpp \
src/controllers/pings/PingController.cpp \
src/controllers/pings/PingModel.cpp \
HEADERS += \
src/Application.hpp \
@ -238,10 +232,11 @@ HEADERS += \
src/common/CompletionModel.hpp \
src/common/ConcurrentMap.hpp \
src/common/DownloadManager.hpp \
src/common/Env.hpp \
src/common/LinkParser.hpp \
src/common/NetworkCommon.hpp \
src/common/NetworkPrivate.hpp \
src/common/NetworkManager.hpp \
src/common/NetworkPrivate.hpp \
src/common/NetworkRequest.hpp \
src/common/NetworkResult.hpp \
src/common/NullablePtr.hpp \
@ -271,6 +266,8 @@ HEADERS += \
src/controllers/moderationactions/ModerationActions.hpp \
src/controllers/notifications/NotificationController.hpp \
src/controllers/notifications/NotificationModel.hpp \
src/controllers/pings/PingController.hpp \
src/controllers/pings/PingModel.hpp \
src/controllers/taggedusers/TaggedUser.hpp \
src/controllers/taggedusers/TaggedUsersController.hpp \
src/controllers/taggedusers/TaggedUsersModel.hpp \
@ -323,7 +320,6 @@ HEADERS += \
src/providers/twitch/TwitchServer.hpp \
src/providers/twitch/TwitchUser.hpp \
src/RunGui.hpp \
src/singletons/TooltipPreviewImage.hpp \
src/singletons/Badges.hpp \
src/singletons/Emotes.hpp \
src/singletons/helper/GifTimer.hpp \
@ -335,6 +331,7 @@ HEADERS += \
src/singletons/Settings.hpp \
src/singletons/Theme.hpp \
src/singletons/Toasts.hpp \
src/singletons/TooltipPreviewImage.hpp \
src/singletons/Updates.hpp \
src/singletons/WindowManager.hpp \
src/util/ConcurrentMap.hpp \
@ -386,21 +383,15 @@ HEADERS += \
src/widgets/settingspages/AboutPage.hpp \
src/widgets/settingspages/AccountsPage.hpp \
src/widgets/settingspages/AdvancedPage.hpp \
src/widgets/settingspages/BrowserExtensionPage.hpp \
src/widgets/settingspages/CommandPage.hpp \
src/widgets/settingspages/EmotesPage.hpp \
src/widgets/settingspages/ExternalToolsPage.hpp \
src/widgets/settingspages/FeelPage.hpp \
src/widgets/settingspages/GeneralPage.hpp \
src/widgets/settingspages/HighlightingPage.hpp \
src/widgets/settingspages/IgnoresPage.hpp \
src/widgets/settingspages/KeyboardSettingsPage.hpp \
src/widgets/settingspages/LogsPage.hpp \
src/widgets/settingspages/LookPage.hpp \
src/widgets/settingspages/ModerationPage.hpp \
src/widgets/settingspages/NotificationPage.hpp \
src/widgets/settingspages/SettingsPage.hpp \
src/widgets/settingspages/SpecialChannelsPage.hpp \
src/widgets/splits/ClosedSplits.hpp \
src/widgets/splits/Split.hpp \
src/widgets/splits/SplitContainer.hpp \
@ -409,8 +400,6 @@ HEADERS += \
src/widgets/splits/SplitOverlay.hpp \
src/widgets/StreamView.hpp \
src/widgets/Window.hpp \
src/controllers/pings/PingController.hpp \
src/controllers/pings/PingModel.hpp \
RESOURCES += \
resources/resources.qrc \
@ -460,4 +449,4 @@ git_hash = $$str_member($$git_commit, 0, 8)
# https://stackoverflow.com/questions/3348711/add-a-define-to-qmake-with-a-value/18343449#18343449
DEFINES += CHATTERINO_GIT_COMMIT=\\\"$$git_commit\\\"
DEFINES += CHATTERINO_GIT_RELEASE=\\\"$$git_release\\\"
DEFINES += CHATTERINO_GIT_HASH=\\\"$$git_hash\\\"
DEFINES += CHATTERINO_GIT_HASH=\\\"$$git_hash\\\"

View file

@ -1,36 +0,0 @@
#include "BrowserExtensionPage.hpp"
#include "util/LayoutCreator.hpp"
#include <QLabel>
#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 chatterino {
BrowserExtensionPage::BrowserExtensionPage()
: SettingsPage("Browser integration", ":/settings/browser.svg")
{
auto layout =
LayoutCreator<BrowserExtensionPage>(this).setLayoutType<QVBoxLayout>();
auto label = layout.emplace<QLabel>(
"The browser extension will replace the default Twitch.tv chat with "
"chatterino while chatterino is running.");
label->setWordWrap(true);
auto chrome = layout.emplace<QLabel>("<a href=\"" CHROME_EXTENSION_LINK
"\">Download for Google Chrome</a>");
chrome->setOpenExternalLinks(true);
auto firefox =
layout.emplace<QLabel>("<a href=\"" FIREFOX_EXTENSION_LINK
"\">Download for Mozilla Firefox</a>");
firefox->setOpenExternalLinks(true);
layout->addStretch(1);
}
} // namespace chatterino

View file

@ -1,13 +0,0 @@
#pragma once
#include "widgets/settingspages/SettingsPage.hpp"
namespace chatterino {
class BrowserExtensionPage : public SettingsPage
{
public:
BrowserExtensionPage();
};
} // namespace chatterino

View file

@ -1,29 +0,0 @@
#include "EmotesPage.hpp"
#include "util/LayoutCreator.hpp"
namespace chatterino {
EmotesPage::EmotesPage()
: SettingsPage("Emotes", ":/settings/emote.svg")
{
// SettingManager &settings = SettingManager::getInstance();
// LayoutCreator<EmotesPage> layoutCreator(this);
// auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
// // clang-format off
// layout.append(this->createCheckBox("Enable Twitch emotes",
// settings.enableTwitchEmotes));
// layout.append(this->createCheckBox("Enable BetterTTV emotes",
// settings.enableBttvEmotes));
// layout.append(this->createCheckBox("Enable FrankerFaceZ emotes",
// settings.enableFfzEmotes)); layout.append(this->createCheckBox("Enable
// emojis", settings.enableEmojis));
// layout.append(this->createCheckBox("Enable gif animations",
// settings.enableGifAnimations));
// // clang-format on
// layout->addStretch(1);
}
} // namespace chatterino

View file

@ -1,13 +0,0 @@
#pragma once
#include "widgets/settingspages/SettingsPage.hpp"
namespace chatterino {
class EmotesPage : public SettingsPage
{
public:
EmotesPage();
};
} // namespace chatterino

View file

@ -1,103 +0,0 @@
#include "FeelPage.hpp"
#include "Application.hpp"
#include "util/LayoutCreator.hpp"
#include <QFormLayout>
#include <QGroupBox>
#include <QLabel>
#include <QVBoxLayout>
#define PAUSE_HOVERING "When hovering"
#define SCROLL_SMOOTH "Smooth scrolling"
#define SCROLL_NEWMSG "Smooth scrolling for new messages"
#define LIMIT_CHATTERS_FOR_SMALLER_STREAMERS \
"Only fetch chatters list for viewers under X viewers"
namespace chatterino {
FeelPage::FeelPage()
: SettingsPage("Feel", ":/settings/behave.svg")
{
LayoutCreator<FeelPage> layoutCreator(this);
auto layout = layoutCreator.setLayoutType<QVBoxLayout>();
// layout.append(this->createCheckBox("Use a seperate write connection.",
// getSettings()->twitchSeperateWriteConnection));
layout.append(this->createCheckBox(SCROLL_SMOOTH,
getSettings()->enableSmoothScrolling));
layout.append(this->createCheckBox(
SCROLL_NEWMSG, getSettings()->enableSmoothScrollingNewMessages));
auto form = layout.emplace<QFormLayout>().withoutMargin();
{
form->addRow(
"", this->createCheckBox(
"Show which users joined the channel (up to 1000 chatters)",
getSettings()->showJoins));
form->addRow(
"", this->createCheckBox(
"Show which users parted the channel (up to 1000 chatters)",
getSettings()->showParts));
form->addRow("Pause chat:",
this->createCheckBox(PAUSE_HOVERING,
getSettings()->pauseChatOnHover));
form->addRow("Mouse scroll speed:", this->createMouseScrollSlider());
form->addRow("Links:",
this->createCheckBox("Open links only on double click",
getSettings()->linksDoubleClickOnly));
form->addRow("", this->createCheckBox("Show link info in tooltips",
getSettings()->linkInfoTooltip));
form->addRow(
"", this->createCheckBox("Auto unshort links (requires restart)",
getSettings()->unshortLinks));
}
layout->addSpacing(16);
{
auto group = layout.emplace<QGroupBox>("Auto-completion");
auto groupLayout = group.setLayoutType<QFormLayout>();
groupLayout->addRow(
LIMIT_CHATTERS_FOR_SMALLER_STREAMERS,
this->createCheckBox(
"", getSettings()->onlyFetchChattersForSmallerStreamers));
groupLayout->addRow(
"What viewer count counts as a \"smaller streamer\"",
this->createSpinBox(getSettings()->smallStreamerLimit, 10, 50000));
}
{
auto group = layout.emplace<QGroupBox>("Misc");
auto groupLayout = group.setLayoutType<QVBoxLayout>();
groupLayout.append(this->createCheckBox("Show whispers inline",
getSettings()->inlineWhispers));
}
layout->addStretch(1);
}
QSlider *FeelPage::createMouseScrollSlider()
{
auto slider = new QSlider(Qt::Horizontal);
float currentValue = getSettings()->mouseScrollMultiplier;
int sliderValue = int(((currentValue - 0.1f) / 2.f) * 99.f);
slider->setValue(sliderValue);
QObject::connect(slider, &QSlider::valueChanged, [=](int newValue) {
float mul = static_cast<float>(newValue) / 99.f;
float newSliderValue = (mul * 2.1f) + 0.1f;
getSettings()->mouseScrollMultiplier = newSliderValue;
});
return slider;
}
} // namespace chatterino

View file

@ -1,18 +0,0 @@
#pragma once
#include <QSlider>
#include "widgets/settingspages/SettingsPage.hpp"
namespace chatterino {
class FeelPage : public SettingsPage
{
public:
FeelPage();
private:
QSlider *createMouseScrollSlider();
};
} // namespace chatterino

View file

@ -1,53 +0,0 @@
//#include "LogsPage.hpp"
//#include "Application.hpp"
//#include "singletons/PathManager.hpp"
//#include <QFormLayout>
//#include <QVBoxLayout>
//#include "util/LayoutCreator.hpp"
// namespace chatterino {
// namespace widgets {
// namespace settingspages {
// inline QString CreateLink(const QString &url, bool file = false)
//{
// if (file) {
// return QString("<a href=\"file:///" + url + "\"><span style=\"color:
// white;\">" + url +
// "</span></a>");
// }
// return QString("<a href=\"" + url + "\"><span style=\"color: white;\">" +
// url +
// "</span></a>");
//}
// LogsPage::LogsPage()
// : SettingsPage("Logs", "")
//{
// auto app = getApp();
// LayoutCreator<LogsPage> layoutCreator(this);
// auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
// auto logPath = getPaths()->logsFolderPath;
// auto created = layout.emplace<QLabel>();
// created->setText("Logs are saved to " + CreateLink(logPath, true));
// created->setTextFormat(Qt::RichText);
// created->setTextInteractionFlags(Qt::TextBrowserInteraction |
// Qt::LinksAccessibleByKeyboard |
// Qt::LinksAccessibleByKeyboard);
// created->setOpenExternalLinks(true);
// layout.append(this->createCheckBox("Enable logging",
// getSettings()->enableLogging));
// layout->addStretch(1);
//}
//} // namespace settingspages
//} // namespace widgets
//} // namespace chatterino

View file

@ -1,17 +0,0 @@
//#pragma once
//#include "widgets/settingspages/SettingsPage.hpp"
// namespace chatterino {
// namespace widgets {
// namespace settingspages {
// class LogsPage : public SettingsPage
//{
// public:
// LogsPage();
//};
//} // namespace settingspages
//} // namespace widgets
//} // namespace chatterino

View file

@ -1,596 +0,0 @@
#include "LookPage.hpp"
#include "Application.hpp"
#include "messages/Image.hpp"
#include "messages/MessageBuilder.hpp"
#include "singletons/Resources.hpp"
#include "singletons/Theme.hpp"
#include "singletons/WindowManager.hpp"
#include "util/LayoutCreator.hpp"
#include "util/RemoveScrollAreaBackground.hpp"
#include "widgets/helper/ChannelView.hpp"
#include "widgets/helper/Line.hpp"
#include <QColorDialog>
#include <QFontDialog>
#include <QFormLayout>
#include <QGroupBox>
#include <QLabel>
#include <QPushButton>
#include <QScrollArea>
#include <QSlider>
#include <QVBoxLayout>
#define THEME_ITEMS "White", "Light", "Dark", "Black", "Custom"
#define TAB_X "Show tab close button"
#define TAB_PREF "Hide preferences button (ctrl+p to show)"
#define TAB_USER "Hide user button"
// clang-format off
#define TIMESTAMP_FORMATS "hh:mm a", "h:mm a", "hh:mm:ss a", "h:mm:ss a", "HH:mm", "H:mm", "HH:mm:ss", "H:mm:ss"
// clang-format on
#ifdef USEWINSDK
# define WINDOW_TOPMOST "Window always on top"
#else
# define WINDOW_TOPMOST "Window always on top (requires restart)"
#endif
#define INPUT_EMPTY "Show input box when empty"
#define LAST_MSG "Mark the last message you read"
namespace chatterino {
LookPage::LookPage()
: SettingsPage("Look", ":/settings/theme.svg")
{
this->initializeUi();
}
void LookPage::initializeUi()
{
LayoutCreator<LookPage> layoutCreator(this);
auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
// settings
auto tabs = layout.emplace<QTabWidget>();
this->addInterfaceTab(tabs.appendTab(new QVBoxLayout, "Interface"));
this->addMessageTab(tabs.appendTab(new QVBoxLayout, "Messages"));
this->addEmoteTab(tabs.appendTab(new QVBoxLayout, "Emotes"));
this->addSplitHeaderTab(tabs.appendTab(new QVBoxLayout, "Split header"));
this->addBadgesTab(tabs.appendTab(new QVBoxLayout, "Badges"));
layout->addStretch(1);
// preview
layout.emplace<Line>(false);
auto channelView = layout.emplace<ChannelView>();
auto channel = this->createPreviewChannel();
channelView->setChannel(channel);
channelView->setScaleIndependantHeight(74);
}
void LookPage::addInterfaceTab(LayoutCreator<QVBoxLayout> layout)
{
// theme
{
auto *theme =
this->createComboBox({THEME_ITEMS}, getApp()->themes->themeName);
QDoubleSpinBox *w = new QDoubleSpinBox;
QObject::connect(theme, &QComboBox::currentTextChanged,
[w](const QString &themeName) {
if (themeName == "Custom")
{
w->show();
}
else
{
w->hide();
}
getApp()->windows->forceLayoutChannelViews();
});
auto box = layout.emplace<QHBoxLayout>().withoutMargin();
box.emplace<QLabel>("Theme: ");
box.append(theme);
{
w->setButtonSymbols(QDoubleSpinBox::NoButtons);
if (getApp()->themes->themeName.getValue() != "Custom")
{
w->hide();
}
else
{
w->show();
}
w->setRange(-1.0, 1.0);
w->setSingleStep(0.05);
w->setValue(getSettings()->customThemeMultiplier.getValue());
QObject::connect(
w, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
[](double value) {
getSettings()->customThemeMultiplier.setValue(float(value));
getApp()->themes->update();
getApp()->windows->forceLayoutChannelViews();
});
box.append(w);
}
box->addStretch(1);
}
layout.append(
this->createCheckBox(WINDOW_TOPMOST, getSettings()->windowTopMost));
// --
layout.emplace<Line>(false);
// tab x
layout.append(
this->createCheckBox(TAB_X, getSettings()->showTabCloseButton));
// show buttons
#ifndef USEWINSDK
layout.append(
this->createCheckBox(TAB_PREF, getSettings()->hidePreferencesButton));
layout.append(
this->createCheckBox(TAB_USER, getSettings()->hideUserButton));
#endif
// empty input
layout.append(
this->createCheckBox(INPUT_EMPTY, getSettings()->showEmptyInput));
layout.append(this->createCheckBox("Show message length while typing",
getSettings()->showMessageLength));
layout->addStretch(1);
}
void LookPage::addMessageTab(LayoutCreator<QVBoxLayout> layout)
{
// font
layout.append(this->createFontChanger());
// --
layout.emplace<Line>(false);
// timestamps
{
auto box = layout.emplace<QHBoxLayout>().withoutMargin();
box.append(this->createCheckBox("Show timestamps",
getSettings()->showTimestamps));
box.append(this->createComboBox({TIMESTAMP_FORMATS},
getSettings()->timestampFormat));
box->addStretch(1);
}
// --
layout.emplace<Line>(false);
// separate
layout.append(this->createCheckBox("Lines between messages",
getSettings()->separateMessages));
// alternate
layout.append(this->createCheckBox("Alternate background",
getSettings()->alternateMessages));
layout.append(
this->createCheckBox("Compact emotes", getSettings()->compactEmotes));
layout.emplace<Line>(false);
// bold-slider
{
auto box = layout.emplace<QHBoxLayout>().withoutMargin();
box.emplace<QLabel>("Username boldness: ");
box.append(this->createBoldScaleSlider());
}
// bold usernames
layout.append(this->createCheckBox("Bold mentions (@username)",
getSettings()->boldUsernames));
// --
layout.emplace<Line>(false);
// lowercase links
layout.append(this->createCheckBox("Lowercase domains",
getSettings()->lowercaseDomains));
// collapsing
{
auto *combo = new QComboBox(this);
combo->addItems({"Never", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"11", "12", "13", "14", "15"});
const auto currentIndex = []() -> int {
auto val = getSettings()->collpseMessagesMinLines.getValue();
if (val > 0)
{
--val;
}
return val;
}();
combo->setCurrentIndex(currentIndex);
QObject::connect(
combo, &QComboBox::currentTextChanged, [](const QString &str) {
getSettings()->collpseMessagesMinLines = str.toInt();
});
auto hbox = layout.emplace<QHBoxLayout>().withoutMargin();
hbox.emplace<QLabel>("Collapse messages longer than");
hbox.append(combo);
hbox.emplace<QLabel>("lines");
}
// last read message
this->addLastReadMessageIndicatorPatternSelector(layout);
// --
layout->addStretch(1);
}
void LookPage::addEmoteTab(LayoutCreator<QVBoxLayout> layout)
{
layout.append(
this->createCheckBox("Animations", getSettings()->animateEmotes));
layout.append(
this->createCheckBox("Animations only when chatterino has focus",
getSettings()->animationsWhenFocused));
auto scaleBox = layout.emplace<QHBoxLayout>().withoutMargin();
{
scaleBox.emplace<QLabel>("Size:");
auto emoteScale = scaleBox.emplace<QSlider>(Qt::Horizontal);
emoteScale->setMinimum(5);
emoteScale->setMaximum(50);
auto scaleLabel = scaleBox.emplace<QLabel>("1.0");
scaleLabel->setFixedWidth(100);
QObject::connect(emoteScale.getElement(), &QSlider::valueChanged,
[scaleLabel](int value) mutable {
float f = float(value) / 10.f;
scaleLabel->setText(QString::number(f));
getSettings()->emoteScale.setValue(f);
});
emoteScale->setValue(std::max<int>(
5, std::min<int>(
50, int(getSettings()->emoteScale.getValue() * 10.f))));
scaleLabel->setText(
QString::number(getSettings()->emoteScale.getValue()));
}
{
auto *combo = new QComboBox(this);
combo->addItems({"EmojiOne 2", "EmojiOne 3", "Twitter", "Facebook",
"Apple", "Google", "Messenger"});
combo->setCurrentText(getSettings()->emojiSet);
QObject::connect(combo, &QComboBox::currentTextChanged,
[](const QString &str) {
getSettings()->emojiSet = str; //
});
auto hbox = layout.emplace<QHBoxLayout>().withoutMargin();
hbox.emplace<QLabel>("Emoji set:");
hbox.append(combo);
}
layout->addStretch(1);
}
void LookPage::addSplitHeaderTab(LayoutCreator<QVBoxLayout> layout)
{
layout.append(
this->createCheckBox("Show uptime", getSettings()->headerUptime));
layout.append(this->createCheckBox("Show viewer count",
getSettings()->headerViewerCount));
layout.append(this->createCheckBox("Show game", getSettings()->headerGame));
layout.append(
this->createCheckBox("Show title", getSettings()->headerStreamTitle));
layout->addStretch(1);
}
void LookPage::addBadgesTab(LayoutCreator<QVBoxLayout> layout)
{
// layout.append(
// this->createCheckBox(("Show all badges"), getSettings()->showBadges));
auto fastSelection = layout.emplace<QHBoxLayout>();
{
auto addAll = fastSelection.emplace<QPushButton>("Enable all");
QObject::connect(addAll.getElement(), &QPushButton::clicked, this, [] {
getSettings()->showBadgesGlobalAuthority = true;
getSettings()->showBadgesChannelAuthority = true;
getSettings()->showBadgesSubscription = true;
getSettings()->showBadgesVanity = true;
getSettings()->showBadgesChatterino = true;
});
auto removeAll = fastSelection.emplace<QPushButton>("Disable all");
QObject::connect(removeAll.getElement(), &QPushButton::clicked, this,
[] {
getSettings()->showBadgesGlobalAuthority = false;
getSettings()->showBadgesChannelAuthority = false;
getSettings()->showBadgesSubscription = false;
getSettings()->showBadgesVanity = false;
getSettings()->showBadgesChatterino = false;
});
}
layout.emplace<Line>(false);
layout.append(this->createCheckBox(
("Show authority badges (staff, admin, turbo, etc)"),
getSettings()->showBadgesGlobalAuthority));
layout.append(this->createCheckBox(
("Show channel badges (broadcaster, moderator, VIP)"),
getSettings()->showBadgesChannelAuthority));
layout.append(this->createCheckBox(("Show subscriber badges "),
getSettings()->showBadgesSubscription));
layout.append(
this->createCheckBox(("Show vanity badges (prime, bits, subgifter)"),
getSettings()->showBadgesVanity));
layout.append(this->createCheckBox(("Show chatterino badges"),
getSettings()->showBadgesChatterino));
layout->addStretch(1);
}
void LookPage::addLastReadMessageIndicatorPatternSelector(
LayoutCreator<QVBoxLayout> layout)
{
// combo
auto *combo = new QComboBox(this);
combo->addItems({"Dotted line", "Solid line"});
const auto currentIndex = []() -> int {
switch (getSettings()->lastMessagePattern.getValue())
{
case Qt::SolidLine:
return 1;
case Qt::VerPattern:
default:
return 0;
}
}();
combo->setCurrentIndex(currentIndex);
QObject::connect(
combo,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
[](int index) {
getSettings()->lastMessagePattern = [&] {
switch (index)
{
case 1:
return Qt::SolidPattern;
case 0:
default:
return Qt::VerPattern;
}
}();
});
// color picker
QLabel *colorPreview = new QLabel();
auto updatePreviewColor = [colorPreview](QColor newColor) {
QPixmap pixmap(16, 16);
pixmap.fill(QColor(0, 0, 0, 255));
QPainter painter(&pixmap);
QBrush brush(newColor);
painter.fillRect(1, 1, pixmap.width() - 2, pixmap.height() - 2, brush);
colorPreview->setPixmap(pixmap);
};
auto getCurrentColor = []() {
return getSettings()->lastMessageColor != ""
? QColor(getSettings()->lastMessageColor.getValue())
: getApp()
->themes->tabs.selected.backgrounds.regular.color();
};
updatePreviewColor(getCurrentColor());
QPushButton *button = new QPushButton("Select Color");
button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Policy::Fixed);
QObject::connect(
button, &QPushButton::clicked, [updatePreviewColor, getCurrentColor]() {
QColor newColor = QColorDialog::getColor(getCurrentColor());
if (newColor.isValid())
{
updatePreviewColor(newColor);
getSettings()->lastMessageColor = newColor.name();
}
});
QPushButton *resetButton = new QPushButton("Reset Color");
resetButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Policy::Fixed);
QObject::connect(
resetButton, &QPushButton::clicked, [updatePreviewColor]() {
QColor defaultColor =
getApp()->themes->tabs.selected.backgrounds.regular.color();
updatePreviewColor(defaultColor);
getSettings()->lastMessageColor = "";
});
// layout
auto hbox = layout.emplace<QHBoxLayout>().withoutMargin();
hbox.append(this->createCheckBox(LAST_MSG,
getSettings()->showLastMessageIndicator));
hbox.append(combo);
hbox.append(colorPreview);
hbox.append(button);
hbox.append(resetButton);
hbox->addStretch(1);
}
ChannelPtr LookPage::createPreviewChannel()
{
auto channel = ChannelPtr(new Channel("preview", Channel::Type::Misc));
// clang-format off
{
MessageBuilder builder;
builder.emplace<TimestampElement>(QTime(8, 13, 42));
builder.emplace<ImageElement>(Image::fromPixmap(getApp()->resources->twitch.moderator), MessageElementFlag::BadgeChannelAuthority);
builder.emplace<ImageElement>(Image::fromPixmap(getApp()->resources->twitch.subscriber, 0.25), MessageElementFlag::BadgeSubscription);
builder.emplace<TextElement>("username1:", MessageElementFlag::Username, QColor("#0094FF"), FontStyle::ChatMediumBold);
builder.emplace<TextElement>("This is a preview message", MessageElementFlag::Text);
builder.emplace<ImageElement>(Image::fromPixmap(getApp()->resources->pajaDank, 0.25), MessageElementFlag::AlwaysShow);
builder.emplace<TextElement>("@fourtf", MessageElementFlag::BoldUsername, MessageColor::Text, FontStyle::ChatMediumBold);
builder.emplace<TextElement>("@fourtf", MessageElementFlag::NonBoldUsername);
channel->addMessage(builder.release());
}
{
MessageBuilder message;
message.emplace<TimestampElement>(QTime(8, 15, 21));
message.emplace<ImageElement>(Image::fromPixmap(getApp()->resources->twitch.broadcaster), MessageElementFlag::BadgeChannelAuthority);
message.emplace<TextElement>("username2:", MessageElementFlag::Username, QColor("#FF6A00"), FontStyle::ChatMediumBold);
message.emplace<TextElement>("This is another one", MessageElementFlag::Text);
// message.emplace<ImageElement>(Image::fromNonOwningPixmap(&getApp()->resources->ppHop), MessageElementFlag::BttvEmote);
message.emplace<TextElement>("www.fourtf.com", MessageElementFlag::LowercaseLink, MessageColor::Link)->setLink(Link(Link::Url, "https://www.fourtf.com"));
message.emplace<TextElement>("wWw.FoUrTf.CoM", MessageElementFlag::OriginalLink, MessageColor::Link)->setLink(Link(Link::Url, "https://www.fourtf.com"));
channel->addMessage(message.release());
}
// clang-format on
return channel;
}
QLayout *LookPage::createThemeColorChanger()
{
auto app = getApp();
QHBoxLayout *layout = new QHBoxLayout;
auto &themeHue = app->themes->themeHue;
// SLIDER
QSlider *slider = new QSlider(Qt::Horizontal);
layout->addWidget(slider);
slider->setValue(
int(std::min(std::max(themeHue.getValue(), 0.0), 1.0) * 100));
// BUTTON
QPushButton *button = new QPushButton;
layout->addWidget(button);
button->setFlat(true);
button->setFixedWidth(64);
auto setButtonColor = [button, app](int value) mutable {
double newValue = value / 100.0;
app->themes->themeHue.setValue(newValue);
QPalette pal = button->palette();
QColor color;
color.setHsvF(newValue, 1.0, 1.0, 1.0);
pal.setColor(QPalette::Button, color);
button->setAutoFillBackground(true);
button->setPalette(pal);
button->update();
};
// SIGNALS
QObject::connect(slider, &QSlider::valueChanged, this, setButtonColor);
setButtonColor(themeHue * 100);
return layout;
}
QLayout *LookPage::createFontChanger()
{
auto app = getApp();
QHBoxLayout *layout = new QHBoxLayout;
layout->setMargin(0);
// LABEL
QLabel *label = new QLabel();
layout->addWidget(label);
auto updateFontFamilyLabel = [=]() {
label->setText("Font (" + app->fonts->chatFontFamily.getValue() + ", " +
QString::number(app->fonts->chatFontSize) + "pt)");
};
app->fonts->chatFontFamily.connect(updateFontFamilyLabel,
this->managedConnections_);
app->fonts->chatFontSize.connect(updateFontFamilyLabel,
this->managedConnections_);
// BUTTON
QPushButton *button = new QPushButton("Select");
layout->addWidget(button);
button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Policy::Fixed);
QObject::connect(button, &QPushButton::clicked, [=]() {
QFontDialog dialog(app->fonts->getFont(FontStyle::ChatMedium, 1.));
dialog.setWindowFlag(Qt::WindowStaysOnTopHint);
dialog.connect(&dialog, &QFontDialog::fontSelected,
[=](const QFont &font) {
app->fonts->chatFontFamily = font.family();
app->fonts->chatFontSize = font.pointSize();
});
dialog.show();
dialog.exec();
});
layout->addStretch(1);
return layout;
}
QLayout *LookPage::createBoldScaleSlider()
{
auto layout = new QHBoxLayout();
auto slider = new QSlider(Qt::Horizontal);
auto label = new QLabel();
layout->addWidget(slider);
layout->addWidget(label);
slider->setMinimum(50);
slider->setMaximum(100);
slider->setValue(getSettings()->boldScale.getValue());
label->setMinimumWidth(100);
QObject::connect(slider, &QSlider::valueChanged, [](auto value) {
getSettings()->boldScale.setValue(value);
});
// show value
// getSettings()->boldScale.connect(
// [label](auto, auto) {
// label->setText(QString::number(getSettings()->boldScale.getValue()));
// },
// this->connections_);
// QPushButton *button = new QPushButton("Reset");
// layout->addWidget(button);
// button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Policy::Fixed);
// QObject::connect(button, &QPushButton::clicked, [=]() {
// getSettings()->boldScale.setValue(57);
// slider->setValue(57);
//});
return layout;
}
} // namespace chatterino

View file

@ -1,40 +0,0 @@
#pragma once
#include "common/Channel.hpp"
#include "util/LayoutCreator.hpp"
#include "widgets/settingspages/SettingsPage.hpp"
#include <QScrollArea>
#include <pajlada/signals/signalholder.hpp>
class QVBoxLayout;
namespace chatterino {
class LookPage : public SettingsPage
{
public:
LookPage();
private:
void initializeUi();
void addInterfaceTab(LayoutCreator<QVBoxLayout> layout);
void addMessageTab(LayoutCreator<QVBoxLayout> layout);
void addEmoteTab(LayoutCreator<QVBoxLayout> layout);
void addSplitHeaderTab(LayoutCreator<QVBoxLayout> layout);
void addBadgesTab(LayoutCreator<QVBoxLayout> layout);
void addLastReadMessageIndicatorPatternSelector(
LayoutCreator<QVBoxLayout> layout);
QLayout *createThemeColorChanger();
QLayout *createFontChanger();
QLayout *createBoldScaleSlider();
ChannelPtr createPreviewChannel();
std::vector<pajlada::Signals::ScopedConnection> connections_;
};
} // namespace chatterino

View file

@ -1,34 +0,0 @@
#include "SpecialChannelsPage.hpp"
#include "Application.hpp"
#include "singletons/Settings.hpp"
#include "util/LayoutCreator.hpp"
#include <QGroupBox>
#include <QLabel>
#include <QVBoxLayout>
namespace chatterino {
SpecialChannelsPage::SpecialChannelsPage()
: SettingsPage("Special channels", "")
{
LayoutCreator<SpecialChannelsPage> layoutCreator(this);
auto layout = layoutCreator.setLayoutType<QVBoxLayout>();
auto mentions = layout.emplace<QGroupBox>("Mentions channel")
.setLayoutType<QVBoxLayout>();
{
mentions.emplace<QLabel>("Join /mentions to view your mentions.");
}
auto whispers =
layout.emplace<QGroupBox>("Whispers").setLayoutType<QVBoxLayout>();
{
whispers.emplace<QLabel>("Join /whispers to view your mentions.");
}
layout->addStretch(1);
}
} // namespace chatterino

View file

@ -1,13 +0,0 @@
#pragma once
#include "widgets/settingspages/SettingsPage.hpp"
namespace chatterino {
class SpecialChannelsPage : public SettingsPage
{
public:
SpecialChannelsPage();
};
} // namespace chatterino