Add a Send button that can be used to send messages (#4607)
This button is disabled by default, and can be enabled with the "Show send message button" setting.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "widgets/splits/SplitInput.hpp"
|
||||
|
||||
#include "Application.hpp"
|
||||
#include "common/enums/MessageOverflow.hpp"
|
||||
#include "common/QLogging.hpp"
|
||||
#include "controllers/commands/CommandController.hpp"
|
||||
#include "controllers/hotkeys/HotkeyController.hpp"
|
||||
@@ -114,6 +115,28 @@ void SplitInput::initLayout()
|
||||
connect(textEdit.getElement(), &ResizingTextEdit::textChanged, this,
|
||||
&SplitInput::editTextChanged);
|
||||
|
||||
hboxLayout.emplace<EffectLabel>().assign(&this->ui_.sendButton);
|
||||
this->ui_.sendButton->getLabel().setText("SEND");
|
||||
this->ui_.sendButton->hide();
|
||||
|
||||
QObject::connect(this->ui_.sendButton, &EffectLabel::leftClicked, [this] {
|
||||
std::vector<QString> arguments;
|
||||
this->handleSendMessage(arguments);
|
||||
});
|
||||
|
||||
getSettings()->showSendButton.connect(
|
||||
[this](const bool value, auto) {
|
||||
if (value)
|
||||
{
|
||||
this->ui_.sendButton->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->ui_.sendButton->hide();
|
||||
}
|
||||
},
|
||||
this->managedConnections_);
|
||||
|
||||
// right box
|
||||
auto box = hboxLayout.emplace<QVBoxLayout>().withoutMargin();
|
||||
box->setSpacing(0);
|
||||
|
||||
@@ -23,19 +23,6 @@ class MessageThread;
|
||||
class ResizingTextEdit;
|
||||
class ChannelView;
|
||||
|
||||
// MessageOverflow is used for controlling how to guide the user into not
|
||||
// sending a message that will be discarded by Twitch
|
||||
enum MessageOverflow {
|
||||
// Allow overflowing characters to be inserted into the input box, but highlight them in red
|
||||
Highlight,
|
||||
|
||||
// Prevent more characters from being inserted into the input box
|
||||
Prevent,
|
||||
|
||||
// Do nothing
|
||||
Allow,
|
||||
};
|
||||
|
||||
class SplitInput : public BaseWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -132,6 +119,7 @@ protected:
|
||||
struct {
|
||||
ResizingTextEdit *textEdit;
|
||||
QLabel *textEditLength;
|
||||
EffectLabel *sendButton;
|
||||
EffectLabel *emoteButton;
|
||||
|
||||
QHBoxLayout *hbox;
|
||||
|
||||
Reference in New Issue
Block a user