mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Add settings for last message line style (#2019)
This commit is contained in:
parent
aff59495df
commit
35816c5d8a
|
@ -10,6 +10,7 @@
|
|||
- Minor: Changed the English in two rate-limited system messages (#1878)
|
||||
- Minor: Added image for streamer mode in the user popup icon.
|
||||
- Minor: Added vip and unvip buttons.
|
||||
- Minor: Added settings for displaying where the last message was.
|
||||
- Minor: Commands are now saved upon pressing Ok in the settings window
|
||||
- Minor: Colorized nicknames now enabled by default
|
||||
- Minor: Show channels live now enabled by default
|
||||
|
|
|
@ -65,8 +65,8 @@ public:
|
|||
"h:mm"};
|
||||
BoolSetting showLastMessageIndicator = {
|
||||
"/appearance/messages/showLastMessageIndicator", false};
|
||||
IntSetting lastMessagePattern = {"/appearance/messages/lastMessagePattern",
|
||||
Qt::VerPattern};
|
||||
EnumSetting<Qt::BrushStyle> lastMessagePattern = {
|
||||
"/appearance/messages/lastMessagePattern", Qt::VerPattern};
|
||||
QStringSetting lastMessageColor = {"/appearance/messages/lastMessageColor",
|
||||
""};
|
||||
BoolSetting showEmptyInput = {"/appearance/showEmptyInputBox", true};
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include "util/Helpers.hpp"
|
||||
#include "util/IncognitoBrowser.hpp"
|
||||
#include "widgets/BaseWindow.hpp"
|
||||
#include "widgets/dialogs/ColorPickerDialog.hpp"
|
||||
#include "widgets/helper/ColorButton.hpp"
|
||||
#include "widgets/helper/Line.hpp"
|
||||
|
||||
#define CHROME_EXTENSION_LINK \
|
||||
|
@ -159,6 +161,36 @@ ComboBox *SettingsLayout::addDropdown(
|
|||
return combo;
|
||||
}
|
||||
|
||||
ColorButton *SettingsLayout::addColorButton(
|
||||
const QString &text, const QColor &color,
|
||||
pajlada::Settings::Setting<QString> &setting)
|
||||
{
|
||||
auto colorButton = new ColorButton(color);
|
||||
auto layout = new QHBoxLayout();
|
||||
auto label = new QLabel(text + ":");
|
||||
layout->addWidget(label);
|
||||
layout->addStretch(1);
|
||||
layout->addWidget(colorButton);
|
||||
this->addLayout(layout);
|
||||
QObject::connect(
|
||||
colorButton, &ColorButton::clicked, [&setting, colorButton]() {
|
||||
auto dialog = new ColorPickerDialog(QColor(setting));
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dialog->show();
|
||||
dialog->closed.connect([&setting, colorButton, &dialog] {
|
||||
QColor selected = dialog->selectedColor();
|
||||
|
||||
if (selected.isValid())
|
||||
{
|
||||
setting = selected.name(QColor::HexArgb);
|
||||
colorButton->setColor(selected);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return colorButton;
|
||||
}
|
||||
|
||||
DescriptionLabel *SettingsLayout::addDescription(const QString &text)
|
||||
{
|
||||
auto label = new DescriptionLabel(text);
|
||||
|
@ -384,9 +416,34 @@ void GeneralPage::initLayout(SettingsLayout &layout)
|
|||
layout.addTitle("Messages");
|
||||
layout.addCheckbox("Separate with lines", s.separateMessages);
|
||||
layout.addCheckbox("Alternate background color", s.alternateMessages);
|
||||
// layout.addCheckbox("Mark last message you read");
|
||||
// layout.addDropdown("Last read message style", {"Default"});
|
||||
layout.addCheckbox("Show deleted messages", s.hideModerated, true);
|
||||
layout.addCheckbox("Show last message line", s.showLastMessageIndicator);
|
||||
layout.addDropdown<std::underlying_type<Qt::BrushStyle>::type>(
|
||||
"Last message line style", {"Dotted", "Solid"}, s.lastMessagePattern,
|
||||
[](int value) {
|
||||
switch (value)
|
||||
{
|
||||
case Qt::VerPattern:
|
||||
return 0;
|
||||
case Qt::SolidPattern:
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
},
|
||||
[](DropdownArgs args) {
|
||||
switch (args.index)
|
||||
{
|
||||
case 0:
|
||||
return Qt::VerPattern;
|
||||
case 1:
|
||||
default:
|
||||
return Qt::SolidPattern;
|
||||
}
|
||||
},
|
||||
false);
|
||||
layout.addColorButton("Last message line color",
|
||||
QColor(getSettings()->lastMessageColor.getValue()),
|
||||
getSettings()->lastMessageColor);
|
||||
layout.addCheckbox("Highlight messages redeemed with Channel Points",
|
||||
s.enableRedeemedHighlight);
|
||||
layout.addDropdown<QString>(
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "pajlada/signals/signal.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "singletons/WindowManager.hpp"
|
||||
#include "widgets/helper/ColorButton.hpp"
|
||||
#include "widgets/settingspages/SettingsPage.hpp"
|
||||
|
||||
class QLabel;
|
||||
|
@ -72,6 +73,8 @@ public:
|
|||
ComboBox *addDropdown(const QString &text, const QStringList &items,
|
||||
pajlada::Settings::Setting<QString> &setting,
|
||||
bool editable = false);
|
||||
ColorButton *addColorButton(const QString &text, const QColor &color,
|
||||
pajlada::Settings::Setting<QString> &setting);
|
||||
|
||||
template <typename OnClick>
|
||||
QPushButton *makeButton(const QString &text, OnClick onClick)
|
||||
|
|
Loading…
Reference in a new issue