refactored SplitInput
This commit is contained in:
@@ -25,8 +25,7 @@
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
#define LAYOUT_WIDTH \
|
||||
(this->width() - (this->scrollBar.isVisible() ? 16 : 4) * this->getDpiMultiplier())
|
||||
#define LAYOUT_WIDTH (this->width() - (this->scrollBar.isVisible() ? 16 : 4) * this->getScale())
|
||||
|
||||
using namespace chatterino::messages;
|
||||
|
||||
@@ -115,9 +114,9 @@ ChannelView::~ChannelView()
|
||||
this->messageReplacedConnection.disconnect();
|
||||
}
|
||||
|
||||
void ChannelView::refreshTheme()
|
||||
void ChannelView::themeRefreshEvent()
|
||||
{
|
||||
BaseWidget::refreshTheme();
|
||||
BaseWidget::themeRefreshEvent();
|
||||
|
||||
this->layoutMessages();
|
||||
}
|
||||
@@ -175,7 +174,7 @@ void ChannelView::actuallyLayoutMessages()
|
||||
for (size_t i = start; i < messagesSnapshot.getLength(); ++i) {
|
||||
auto message = messagesSnapshot[i];
|
||||
|
||||
redrawRequired |= message->layout(layoutWidth, this->getDpiMultiplier(), flags);
|
||||
redrawRequired |= message->layout(layoutWidth, this->getScale(), flags);
|
||||
|
||||
y += message->getHeight();
|
||||
|
||||
@@ -191,7 +190,7 @@ void ChannelView::actuallyLayoutMessages()
|
||||
for (int i = (int)messagesSnapshot.getLength() - 1; i >= 0; i--) {
|
||||
auto *message = messagesSnapshot[i].get();
|
||||
|
||||
message->layout(layoutWidth, this->getDpiMultiplier(), flags);
|
||||
message->layout(layoutWidth, this->getScale(), flags);
|
||||
|
||||
h -= message->getHeight();
|
||||
|
||||
@@ -582,8 +581,7 @@ void ChannelView::wheelEvent(QWheelEvent *event)
|
||||
if (i == 0) {
|
||||
desired = 0;
|
||||
} else {
|
||||
snapshot[i - 1]->layout(LAYOUT_WIDTH, this->getDpiMultiplier(),
|
||||
this->getFlags());
|
||||
snapshot[i - 1]->layout(LAYOUT_WIDTH, this->getScale(), this->getFlags());
|
||||
scrollFactor = 1;
|
||||
currentScrollLeft = snapshot[i - 1]->getHeight();
|
||||
}
|
||||
@@ -605,8 +603,7 @@ void ChannelView::wheelEvent(QWheelEvent *event)
|
||||
if (i == snapshotLength - 1) {
|
||||
desired = snapshot.getLength();
|
||||
} else {
|
||||
snapshot[i + 1]->layout(LAYOUT_WIDTH, this->getDpiMultiplier(),
|
||||
this->getFlags());
|
||||
snapshot[i + 1]->layout(LAYOUT_WIDTH, this->getScale(), this->getFlags());
|
||||
|
||||
scrollFactor = 1;
|
||||
currentScrollLeft = snapshot[i + 1]->getHeight();
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
pajlada::Signals::Signal<const messages::Link &> linkClicked;
|
||||
|
||||
protected:
|
||||
virtual void refreshTheme() override;
|
||||
virtual void themeRefreshEvent() override;
|
||||
|
||||
virtual void resizeEvent(QResizeEvent *) override;
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ NotebookTab::NotebookTab(Notebook *_notebook, const std::string &_uuid)
|
||||
, useDefaultBehaviour(fS("{}/useDefaultBehaviour", this->settingRoot), true)
|
||||
, menu(this)
|
||||
{
|
||||
this->calcSize();
|
||||
this->setAcceptDrops(true);
|
||||
|
||||
this->positionChangedAnimation.setEasingCurve(QEasingCurve(QEasingCurve::InCubic));
|
||||
@@ -65,22 +64,25 @@ NotebookTab::NotebookTab(Notebook *_notebook, const std::string &_uuid)
|
||||
|
||||
this->menu.addAction(enableHighlightsOnNewMessageAction);
|
||||
|
||||
connect(enableHighlightsOnNewMessageAction, &QAction::toggled, [this](bool newValue) {
|
||||
QObject::connect(enableHighlightsOnNewMessageAction, &QAction::toggled, [this](bool newValue) {
|
||||
debug::Log("New value is {}", newValue); //
|
||||
});
|
||||
}
|
||||
|
||||
void NotebookTab::calcSize()
|
||||
void NotebookTab::themeRefreshEvent()
|
||||
{
|
||||
float scale = getDpiMultiplier();
|
||||
this->update();
|
||||
}
|
||||
|
||||
void NotebookTab::updateSize()
|
||||
{
|
||||
float scale = getScale();
|
||||
QString qTitle(qS(this->title));
|
||||
|
||||
if (singletons::SettingManager::getInstance().hideTabX) {
|
||||
this->resize(static_cast<int>((fontMetrics().width(qTitle) + 16) * scale),
|
||||
static_cast<int>(24 * scale));
|
||||
this->resize((int)((fontMetrics().width(qTitle) + 16) * scale), (int)(24 * scale));
|
||||
} else {
|
||||
this->resize(static_cast<int>((fontMetrics().width(qTitle) + 8 + 24) * scale),
|
||||
static_cast<int>(24 * scale));
|
||||
this->resize((int)((fontMetrics().width(qTitle) + 8 + 24) * scale), (int)(24 * scale));
|
||||
}
|
||||
|
||||
if (this->parent() != nullptr) {
|
||||
@@ -97,7 +99,7 @@ void NotebookTab::setTitle(const QString &newTitle)
|
||||
{
|
||||
this->title = newTitle.toStdString();
|
||||
|
||||
this->calcSize();
|
||||
this->updateSize();
|
||||
}
|
||||
|
||||
bool NotebookTab::isSelected() const
|
||||
@@ -134,7 +136,7 @@ QRect NotebookTab::getDesiredRect() const
|
||||
|
||||
void NotebookTab::hideTabXChanged(bool)
|
||||
{
|
||||
this->calcSize();
|
||||
this->updateSize();
|
||||
this->update();
|
||||
}
|
||||
|
||||
@@ -197,7 +199,7 @@ void NotebookTab::paintEvent(QPaintEvent *)
|
||||
painter.setPen(colors.text);
|
||||
|
||||
// set area for text
|
||||
float scale = this->getDpiMultiplier();
|
||||
float scale = this->getScale();
|
||||
int rectW = (settingManager.hideTabX ? 0 : static_cast<int>(16) * scale);
|
||||
QRect rect(0, 0, this->width() - rectW, this->height());
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class NotebookTab : public BaseWidget
|
||||
public:
|
||||
explicit NotebookTab(Notebook *_notebook, const std::string &_uuid);
|
||||
|
||||
void calcSize();
|
||||
void updateSize();
|
||||
|
||||
SplitContainer *page;
|
||||
|
||||
@@ -42,16 +42,18 @@ public:
|
||||
void hideTabXChanged(bool);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
virtual void themeRefreshEvent() override;
|
||||
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
void enterEvent(QEvent *) override;
|
||||
void leaveEvent(QEvent *) override;
|
||||
virtual void paintEvent(QPaintEvent *) override;
|
||||
|
||||
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||
virtual void mousePressEvent(QMouseEvent *event) override;
|
||||
virtual void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
virtual void enterEvent(QEvent *) override;
|
||||
virtual void leaveEvent(QEvent *) override;
|
||||
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
virtual void dragEnterEvent(QDragEnterEvent *event) override;
|
||||
|
||||
virtual void mouseMoveEvent(QMouseEvent *event) override;
|
||||
|
||||
private:
|
||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections;
|
||||
@@ -80,7 +82,7 @@ private:
|
||||
|
||||
QRect getXRect()
|
||||
{
|
||||
float scale = this->getDpiMultiplier();
|
||||
float scale = this->getScale();
|
||||
return QRect(this->width() - static_cast<int>(20 * scale), static_cast<int>(4 * scale),
|
||||
static_cast<int>(16 * scale), static_cast<int>(16 * scale));
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ void RippleEffectButton::paintEvent(QPaintEvent *)
|
||||
|
||||
if (this->pixmap != nullptr) {
|
||||
QRect rect = this->rect();
|
||||
int xD = 6 * this->getDpiMultiplier();
|
||||
int xD = 6 * this->getScale();
|
||||
|
||||
rect.moveLeft(xD);
|
||||
rect.setRight(rect.right() - xD - xD);
|
||||
|
||||
@@ -66,7 +66,7 @@ SplitHeader::SplitHeader(Split *_split)
|
||||
|
||||
// ---- misc
|
||||
this->layout()->setMargin(0);
|
||||
this->refreshTheme();
|
||||
this->themeRefreshEvent();
|
||||
|
||||
this->updateChannelText();
|
||||
|
||||
@@ -135,7 +135,7 @@ void SplitHeader::initializeChannelSignals()
|
||||
|
||||
void SplitHeader::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
int w = 28 * getDpiMultiplier();
|
||||
int w = 28 * getScale();
|
||||
|
||||
this->setFixedHeight(w);
|
||||
this->dropdownButton->setFixedWidth(w);
|
||||
@@ -242,7 +242,7 @@ void SplitHeader::rightButtonClicked()
|
||||
{
|
||||
}
|
||||
|
||||
void SplitHeader::refreshTheme()
|
||||
void SplitHeader::themeRefreshEvent()
|
||||
{
|
||||
QPalette palette;
|
||||
palette.setColor(QPalette::Foreground, this->themeManager.splits.header.text);
|
||||
|
||||
@@ -57,7 +57,7 @@ private:
|
||||
|
||||
void rightButtonClicked();
|
||||
|
||||
virtual void refreshTheme() override;
|
||||
virtual void themeRefreshEvent() override;
|
||||
|
||||
void initializeChannelSignals();
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "singletons/ircmanager.hpp"
|
||||
#include "singletons/settingsmanager.hpp"
|
||||
#include "singletons/thememanager.hpp"
|
||||
#include "util/layoutcreator.hpp"
|
||||
#include "widgets/notebook.hpp"
|
||||
#include "widgets/split.hpp"
|
||||
#include "widgets/splitcontainer.hpp"
|
||||
@@ -17,41 +18,59 @@ namespace widgets {
|
||||
SplitInput::SplitInput(Split *_chatWidget)
|
||||
: BaseWidget(_chatWidget)
|
||||
, chatWidget(_chatWidget)
|
||||
, emotesLabel(this)
|
||||
{
|
||||
this->setLayout(&this->hbox);
|
||||
this->initLayout();
|
||||
|
||||
this->hbox.setMargin(4);
|
||||
// auto completion
|
||||
auto completer = new QCompleter(
|
||||
singletons::CompletionManager::getInstance().createModel(this->chatWidget->channelName));
|
||||
|
||||
this->hbox.addLayout(&this->editContainer);
|
||||
this->hbox.addLayout(&this->vbox);
|
||||
this->ui.textEdit->setCompleter(completer);
|
||||
|
||||
// misc
|
||||
this->installKeyPressedEvent();
|
||||
this->themeRefreshEvent();
|
||||
this->scaleChangedEvent(this->getScale());
|
||||
}
|
||||
|
||||
void SplitInput::initLayout()
|
||||
{
|
||||
auto &fontManager = singletons::FontManager::getInstance();
|
||||
util::LayoutCreator<SplitInput> layoutCreator(this);
|
||||
|
||||
auto layout = layoutCreator.setLayoutType<QHBoxLayout>().withoutMargin().assign(&this->ui.hbox);
|
||||
|
||||
// input
|
||||
auto textEdit = layout.emplace<ResizingTextEdit>().assign(&this->ui.textEdit);
|
||||
connect(textEdit.getElement(), &ResizingTextEdit::textChanged, this,
|
||||
&SplitInput::editTextChanged);
|
||||
|
||||
// right box
|
||||
auto box = layout.emplace<QVBoxLayout>().withoutMargin();
|
||||
box->setSpacing(0);
|
||||
{
|
||||
auto textEditLength = box.emplace<QLabel>().assign(&this->ui.textEditLength);
|
||||
textEditLength->setAlignment(Qt::AlignRight);
|
||||
|
||||
box->addStretch(1);
|
||||
box.emplace<RippleEffectLabel>().assign(&this->ui.emoteButton);
|
||||
}
|
||||
|
||||
this->ui.emoteButton->getLabel().setTextFormat(Qt::RichText);
|
||||
|
||||
// ---- misc
|
||||
|
||||
// set edit font
|
||||
this->ui.textEdit->setFont(
|
||||
fontManager.getFont(singletons::FontManager::Type::Medium, this->getScale()));
|
||||
|
||||
this->textInput.setFont(
|
||||
fontManager.getFont(singletons::FontManager::Type::Medium, this->getDpiMultiplier()));
|
||||
this->managedConnections.emplace_back(fontManager.fontChanged.connect([this, &fontManager]() {
|
||||
this->textInput.setFont(
|
||||
fontManager.getFont(singletons::FontManager::Type::Medium, this->getDpiMultiplier()));
|
||||
this->ui.textEdit->setFont(
|
||||
fontManager.getFont(singletons::FontManager::Type::Medium, this->getScale()));
|
||||
}));
|
||||
|
||||
this->editContainer.addWidget(&this->textInput);
|
||||
this->editContainer.setMargin(2);
|
||||
|
||||
this->emotesLabel.setMinimumHeight(24);
|
||||
|
||||
this->vbox.addWidget(&this->textLengthLabel);
|
||||
this->vbox.addStretch(1);
|
||||
this->vbox.addWidget(&this->emotesLabel);
|
||||
|
||||
this->textLengthLabel.setText("");
|
||||
this->textLengthLabel.setAlignment(Qt::AlignRight);
|
||||
|
||||
this->emotesLabel.getLabel().setTextFormat(Qt::RichText);
|
||||
this->emotesLabel.getLabel().setText("<img src=':/images/emote.svg' width='12' height='12' "
|
||||
"/>");
|
||||
|
||||
connect(&this->emotesLabel, &RippleEffectLabel::clicked, [this] {
|
||||
// open emote popup
|
||||
QObject::connect(this->ui.emoteButton, &RippleEffectLabel::clicked, [this] {
|
||||
if (!this->emotePopup) {
|
||||
this->emotePopup = std::make_unique<EmotePopup>(this->themeManager);
|
||||
this->emotePopup->linkClicked.connect([this](const messages::Link &link) {
|
||||
@@ -61,29 +80,62 @@ SplitInput::SplitInput(Split *_chatWidget)
|
||||
});
|
||||
}
|
||||
|
||||
this->emotePopup->resize((int)(300 * this->emotePopup->getDpiMultiplier()),
|
||||
(int)(500 * this->emotePopup->getDpiMultiplier()));
|
||||
this->emotePopup->resize((int)(300 * this->emotePopup->getScale()),
|
||||
(int)(500 * this->emotePopup->getScale()));
|
||||
this->emotePopup->loadChannel(this->chatWidget->getChannel());
|
||||
this->emotePopup->show();
|
||||
});
|
||||
|
||||
connect(&textInput, &ResizingTextEdit::textChanged, this, &SplitInput::editTextChanged);
|
||||
// clear channelview selection when selecting in the input
|
||||
QObject::connect(this->ui.textEdit, &QTextEdit::copyAvailable, [this](bool available) {
|
||||
if (available) {
|
||||
this->chatWidget->view.clearSelection();
|
||||
}
|
||||
});
|
||||
|
||||
this->refreshTheme();
|
||||
textLengthLabel.setHidden(!singletons::SettingManager::getInstance().showMessageLength);
|
||||
// textEditLength visibility
|
||||
singletons::SettingManager::getInstance().showMessageLength.connect(
|
||||
[this](const bool &value, auto) { this->ui.textEditLength->setHidden(!value); },
|
||||
this->managedConnections);
|
||||
}
|
||||
|
||||
auto completer = new QCompleter(
|
||||
singletons::CompletionManager::getInstance().createModel(this->chatWidget->channelName));
|
||||
void SplitInput::scaleChangedEvent(float scale)
|
||||
{
|
||||
// update the icon size of the emote button
|
||||
QString text = "<img src=':/images/emote.svg' width='xD' height='xD' />";
|
||||
text.replace("xD", QString::number((int)12 * scale));
|
||||
|
||||
this->textInput.setCompleter(completer);
|
||||
this->ui.emoteButton->getLabel().setText(text);
|
||||
this->ui.emoteButton->setFixedHeight((int)18 * scale);
|
||||
|
||||
this->textInput.keyPressed.connect([this](QKeyEvent *event) {
|
||||
// set maximum height
|
||||
this->setMaximumHeight((int)(150 * this->getScale()));
|
||||
|
||||
this->themeRefreshEvent();
|
||||
}
|
||||
|
||||
void SplitInput::themeRefreshEvent()
|
||||
{
|
||||
QPalette palette;
|
||||
|
||||
palette.setColor(QPalette::Foreground, this->themeManager.splits.input.text);
|
||||
|
||||
this->ui.textEditLength->setPalette(palette);
|
||||
|
||||
this->ui.textEdit->setStyleSheet(this->themeManager.splits.input.styleSheet);
|
||||
|
||||
this->ui.hbox->setMargin((this->themeManager.isLightTheme() ? 4 : 2) * this->getScale());
|
||||
}
|
||||
|
||||
void SplitInput::installKeyPressedEvent()
|
||||
{
|
||||
this->ui.textEdit->keyPressed.connect([this](QKeyEvent *event) {
|
||||
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) {
|
||||
auto c = this->chatWidget->getChannel();
|
||||
if (c == nullptr) {
|
||||
return;
|
||||
}
|
||||
QString message = textInput.toPlainText();
|
||||
QString message = ui.textEdit->toPlainText();
|
||||
|
||||
QString sendMessage =
|
||||
singletons::CommandManager::getInstance().execCommand(message, c, false);
|
||||
@@ -94,9 +146,9 @@ SplitInput::SplitInput(Split *_chatWidget)
|
||||
|
||||
event->accept();
|
||||
if (!(event->modifiers() == Qt::ControlModifier)) {
|
||||
this->textInput.setText(QString());
|
||||
this->ui.textEdit->setText(QString());
|
||||
this->prevIndex = 0;
|
||||
} else if (this->textInput.toPlainText() ==
|
||||
} else if (this->ui.textEdit->toPlainText() ==
|
||||
this->prevMsg.at(this->prevMsg.size() - 1)) {
|
||||
this->prevMsg.removeLast();
|
||||
}
|
||||
@@ -115,7 +167,7 @@ SplitInput::SplitInput(Split *_chatWidget)
|
||||
} else {
|
||||
if (this->prevMsg.size() && this->prevIndex) {
|
||||
this->prevIndex--;
|
||||
this->textInput.setText(this->prevMsg.at(this->prevIndex));
|
||||
this->ui.textEdit->setText(this->prevMsg.at(this->prevIndex));
|
||||
}
|
||||
}
|
||||
} else if (event->key() == Qt::Key_Down) {
|
||||
@@ -133,10 +185,10 @@ SplitInput::SplitInput(Split *_chatWidget)
|
||||
if (this->prevIndex != (this->prevMsg.size() - 1) &&
|
||||
this->prevIndex != this->prevMsg.size()) {
|
||||
this->prevIndex++;
|
||||
this->textInput.setText(this->prevMsg.at(this->prevIndex));
|
||||
this->ui.textEdit->setText(this->prevMsg.at(this->prevIndex));
|
||||
} else {
|
||||
this->prevIndex = this->prevMsg.size();
|
||||
this->textInput.setText(QString());
|
||||
this->ui.textEdit->setText(QString());
|
||||
}
|
||||
}
|
||||
} else if (event->key() == Qt::Key_Left) {
|
||||
@@ -188,54 +240,32 @@ SplitInput::SplitInput(Split *_chatWidget)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
singletons::SettingManager::getInstance().showMessageLength.connect(
|
||||
[this](const bool &value, auto) { this->textLengthLabel.setHidden(!value); },
|
||||
this->managedConnections);
|
||||
|
||||
QObject::connect(&this->textInput, &QTextEdit::copyAvailable, [this](bool available) {
|
||||
if (available) {
|
||||
this->chatWidget->view.clearSelection();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void SplitInput::clearSelection()
|
||||
{
|
||||
QTextCursor c = this->textInput.textCursor();
|
||||
QTextCursor c = this->ui.textEdit->textCursor();
|
||||
|
||||
c.setPosition(c.position());
|
||||
c.setPosition(c.position(), QTextCursor::KeepAnchor);
|
||||
|
||||
this->textInput.setTextCursor(c);
|
||||
this->ui.textEdit->setTextCursor(c);
|
||||
}
|
||||
|
||||
QString SplitInput::getInputText() const
|
||||
{
|
||||
return this->textInput.toPlainText();
|
||||
return this->ui.textEdit->toPlainText();
|
||||
}
|
||||
|
||||
void SplitInput::insertText(const QString &text)
|
||||
{
|
||||
this->textInput.insertPlainText(text);
|
||||
}
|
||||
|
||||
void SplitInput::refreshTheme()
|
||||
{
|
||||
QPalette palette;
|
||||
|
||||
palette.setColor(QPalette::Foreground, this->themeManager.splits.input.text);
|
||||
|
||||
this->textLengthLabel.setPalette(palette);
|
||||
|
||||
this->textInput.setStyleSheet(this->themeManager.splits.input.styleSheet);
|
||||
|
||||
this->hbox.setMargin((this->themeManager.isLightTheme() ? 4 : 2) * this->getDpiMultiplier());
|
||||
this->ui.textEdit->insertPlainText(text);
|
||||
}
|
||||
|
||||
void SplitInput::editTextChanged()
|
||||
{
|
||||
QString text = this->textInput.toPlainText();
|
||||
// set textLengthLabel value
|
||||
QString text = this->ui.textEdit->toPlainText();
|
||||
|
||||
this->textChanged.invoke(text);
|
||||
|
||||
@@ -254,7 +284,7 @@ void SplitInput::editTextChanged()
|
||||
labelText = QString::number(text.length());
|
||||
}
|
||||
|
||||
this->textLengthLabel.setText(labelText);
|
||||
this->ui.textEditLength->setText(labelText);
|
||||
}
|
||||
|
||||
void SplitInput::paintEvent(QPaintEvent *)
|
||||
@@ -265,7 +295,7 @@ void SplitInput::paintEvent(QPaintEvent *)
|
||||
|
||||
QPen pen(this->themeManager.splits.input.border);
|
||||
if (this->themeManager.isLightTheme()) {
|
||||
pen.setWidth((int)(6 * this->getDpiMultiplier()));
|
||||
pen.setWidth((int)(6 * this->getScale()));
|
||||
}
|
||||
painter.setPen(pen);
|
||||
painter.drawRect(0, 0, this->width() - 1, this->height() - 1);
|
||||
@@ -274,14 +304,10 @@ void SplitInput::paintEvent(QPaintEvent *)
|
||||
void SplitInput::resizeEvent(QResizeEvent *)
|
||||
{
|
||||
if (this->height() == this->maximumHeight()) {
|
||||
this->textInput.setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
this->ui.textEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
} else {
|
||||
this->textInput.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
this->ui.textEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
}
|
||||
|
||||
this->setMaximumHeight((int)(150 * this->getDpiMultiplier()));
|
||||
|
||||
this->refreshTheme();
|
||||
}
|
||||
|
||||
void SplitInput::mousePressEvent(QMouseEvent *)
|
||||
|
||||
@@ -32,6 +32,8 @@ public:
|
||||
pajlada::Signals::Signal<const QString &> textChanged;
|
||||
|
||||
protected:
|
||||
virtual void scaleChangedEvent(float scale) override;
|
||||
|
||||
virtual void paintEvent(QPaintEvent *) override;
|
||||
virtual void resizeEvent(QResizeEvent *) override;
|
||||
|
||||
@@ -41,16 +43,27 @@ private:
|
||||
Split *const chatWidget;
|
||||
std::unique_ptr<EmotePopup> emotePopup;
|
||||
|
||||
struct {
|
||||
ResizingTextEdit *textEdit;
|
||||
QLabel *textEditLength;
|
||||
RippleEffectLabel *emoteButton;
|
||||
|
||||
QHBoxLayout *hbox;
|
||||
} ui;
|
||||
|
||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections;
|
||||
QHBoxLayout hbox;
|
||||
QVBoxLayout vbox;
|
||||
QHBoxLayout editContainer;
|
||||
ResizingTextEdit textInput;
|
||||
QLabel textLengthLabel;
|
||||
RippleEffectLabel emotesLabel;
|
||||
// QHBoxLayout hbox;
|
||||
// QVBoxLayout vbox;
|
||||
// QHBoxLayout editContainer;
|
||||
// ResizingTextEdit textInput;
|
||||
// QLabel textLengthLabel;
|
||||
// RippleEffectLabel emotesLabel;
|
||||
QStringList prevMsg;
|
||||
int prevIndex = 0;
|
||||
virtual void refreshTheme() override;
|
||||
|
||||
void initLayout();
|
||||
void installKeyPressedEvent();
|
||||
virtual void themeRefreshEvent() override;
|
||||
|
||||
private slots:
|
||||
void editTextChanged();
|
||||
|
||||
Reference in New Issue
Block a user