mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
added int setting for collapsed messages
This commit is contained in:
parent
7ad4e36dbb
commit
70617e294f
5 changed files with 22 additions and 8 deletions
|
@ -9,7 +9,7 @@
|
|||
#include <QPainter>
|
||||
|
||||
#define COMPACT_EMOTES_OFFSET 6
|
||||
#define MAX_UNCOLLAPSED_LINES 3
|
||||
#define MAX_UNCOLLAPSED_LINES (getApp()->settings->collpseMessagesMinLines.getValue())
|
||||
|
||||
namespace chatterino {
|
||||
namespace messages {
|
||||
|
@ -214,7 +214,7 @@ void MessageLayoutContainer::end()
|
|||
|
||||
bool MessageLayoutContainer::canCollapse()
|
||||
{
|
||||
return getApp()->settings->collapseLongMessages.getValue() &&
|
||||
return getApp()->settings->collpseMessagesMinLines.getValue() > 0 &&
|
||||
this->flags & Message::MessageFlags::Collapsed;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ void SettingManager::initialize()
|
|||
[](auto, auto) { getApp()->windows->forceLayoutChannelViews(); });
|
||||
this->seperateMessages.connect(
|
||||
[](auto, auto) { getApp()->windows->forceLayoutChannelViews(); });
|
||||
this->collapseLongMessages.connect(
|
||||
this->collpseMessagesMinLines.connect(
|
||||
[](auto, auto) { getApp()->windows->forceLayoutChannelViews(); });
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,8 @@ public:
|
|||
BoolSetting hideEmptyInput = {"/appearance/hideEmptyInputBox", false};
|
||||
BoolSetting showMessageLength = {"/appearance/messages/showMessageLength", false};
|
||||
BoolSetting seperateMessages = {"/appearance/messages/separateMessages", false};
|
||||
BoolSetting collapseLongMessages = {"/appearance/messages/collapseLongMessages", false};
|
||||
// BoolSetting collapseLongMessages = {"/appearance/messages/collapseLongMessages", false};
|
||||
IntSetting collpseMessagesMinLines = {"/appearance/messages/collapseMessagesMinLines", 0};
|
||||
BoolSetting alternateMessageBackground = {"/appearance/messages/alternateMessageBackground",
|
||||
false};
|
||||
BoolSetting windowTopMost = {"/appearance/windowAlwaysOnTop", false};
|
||||
|
|
|
@ -35,8 +35,8 @@ private:
|
|||
|
||||
class ButtonEventFilter : public QObject
|
||||
{
|
||||
HoveredElement hoveredElement;
|
||||
SplitOverlay *parent;
|
||||
HoveredElement hoveredElement;
|
||||
|
||||
public:
|
||||
ButtonEventFilter(SplitOverlay *parent, HoveredElement hoveredElement);
|
||||
|
|
|
@ -82,8 +82,21 @@ AppearancePage::AppearancePage()
|
|||
|
||||
messages.append(this->createCheckBox("Show badges", app->settings->showBadges));
|
||||
|
||||
messages.append(this->createCheckBox("Collapse large messages (3+ lines)",
|
||||
app->settings->collapseLongMessages));
|
||||
{
|
||||
auto *combo = new QComboBox(this);
|
||||
combo->addItems({"Never", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12",
|
||||
"13", "14", "15"});
|
||||
|
||||
QObject::connect(combo, &QComboBox::currentTextChanged, [](const QString &str) {
|
||||
getApp()->settings->collpseMessagesMinLines = str.toInt();
|
||||
});
|
||||
|
||||
auto hbox = messages.emplace<QHBoxLayout>().withoutMargin();
|
||||
hbox.emplace<QLabel>("Collapse messages longer than");
|
||||
hbox.append(combo);
|
||||
hbox.emplace<QLabel>("lines");
|
||||
}
|
||||
|
||||
messages.append(this->createCheckBox("Seperate messages", app->settings->seperateMessages));
|
||||
messages.append(this->createCheckBox("Alternate message background color",
|
||||
app->settings->alternateMessageBackground));
|
||||
|
@ -130,7 +143,7 @@ AppearancePage::AppearancePage()
|
|||
}
|
||||
|
||||
layout->addStretch(1);
|
||||
}
|
||||
} // namespace settingspages
|
||||
|
||||
QLayout *AppearancePage::createThemeColorChanger()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue