2017-06-07 10:09:24 +02:00
|
|
|
#pragma once
|
2017-01-01 02:30:42 +01:00
|
|
|
|
2019-08-13 16:39:22 +02:00
|
|
|
#include "util/QObjectRef.hpp"
|
2018-06-26 14:09:39 +02:00
|
|
|
#include "widgets/BaseWidget.hpp"
|
2019-08-13 18:48:22 +02:00
|
|
|
#include "widgets/dialogs/EmotePopup.hpp"
|
2017-01-21 05:14:27 +01:00
|
|
|
|
|
|
|
#include <QHBoxLayout>
|
2017-01-22 05:58:23 +01:00
|
|
|
#include <QLabel>
|
2017-01-21 05:14:27 +01:00
|
|
|
#include <QLineEdit>
|
2017-01-18 04:52:47 +01:00
|
|
|
#include <QPaintEvent>
|
2017-01-20 06:10:28 +01:00
|
|
|
#include <QTextEdit>
|
2017-01-21 05:14:27 +01:00
|
|
|
#include <QVBoxLayout>
|
2017-01-18 04:52:47 +01:00
|
|
|
#include <QWidget>
|
2017-01-01 02:30:42 +01:00
|
|
|
|
2017-01-18 21:30:23 +01:00
|
|
|
namespace chatterino {
|
|
|
|
|
2017-11-12 17:21:50 +01:00
|
|
|
class Split;
|
2018-08-11 22:23:06 +02:00
|
|
|
class EmotePopup;
|
2020-08-15 18:59:17 +02:00
|
|
|
class EmoteInputPopup;
|
2018-08-11 22:23:06 +02:00
|
|
|
class EffectLabel;
|
|
|
|
class ResizingTextEdit;
|
2017-01-29 13:23:22 +01:00
|
|
|
|
2017-11-12 17:21:50 +01:00
|
|
|
class SplitInput : public BaseWidget
|
2017-01-01 02:30:42 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2017-12-17 02:18:13 +01:00
|
|
|
SplitInput(Split *_chatWidget);
|
2017-01-01 02:30:42 +01:00
|
|
|
|
2017-09-21 02:20:02 +02:00
|
|
|
void clearSelection();
|
2017-12-17 16:19:16 +01:00
|
|
|
QString getInputText() const;
|
2018-01-24 20:58:53 +01:00
|
|
|
void insertText(const QString &text);
|
2017-12-17 16:19:16 +01:00
|
|
|
|
|
|
|
pajlada::Signals::Signal<const QString &> textChanged;
|
2017-09-21 02:20:02 +02:00
|
|
|
|
2017-01-01 02:30:42 +01:00
|
|
|
protected:
|
2018-07-06 17:11:37 +02:00
|
|
|
virtual void scaleChangedEvent(float scale_) override;
|
|
|
|
virtual void themeChangedEvent() override;
|
2018-01-25 20:49:49 +01:00
|
|
|
|
2017-06-11 11:36:42 +02:00
|
|
|
virtual void paintEvent(QPaintEvent *) override;
|
|
|
|
virtual void resizeEvent(QResizeEvent *) override;
|
2017-01-22 05:58:23 +01:00
|
|
|
|
2017-07-31 01:26:20 +02:00
|
|
|
virtual void mousePressEvent(QMouseEvent *event) override;
|
|
|
|
|
2017-01-20 06:10:28 +01:00
|
|
|
private:
|
2018-07-06 19:23:47 +02:00
|
|
|
void initLayout();
|
|
|
|
void installKeyPressedEvent();
|
2020-08-15 18:59:17 +02:00
|
|
|
void onCursorPositionChanged();
|
2021-05-15 16:24:46 +02:00
|
|
|
void onTextChanged();
|
2018-07-06 19:23:47 +02:00
|
|
|
void updateEmoteButton();
|
2020-08-15 18:59:17 +02:00
|
|
|
void updateColonMenu();
|
|
|
|
void showColonMenu(const QString &text);
|
|
|
|
void hideColonMenu();
|
|
|
|
void insertColonText(const QString &text);
|
2018-08-27 14:36:01 +02:00
|
|
|
void openEmotePopup();
|
2018-07-06 19:23:47 +02:00
|
|
|
|
2018-06-06 18:57:22 +02:00
|
|
|
Split *const split_;
|
2019-08-13 16:39:22 +02:00
|
|
|
QObjectRef<EmotePopup> emotePopup_;
|
2020-08-15 18:59:17 +02:00
|
|
|
QObjectRef<EmoteInputPopup> emoteInputPopup_;
|
2017-01-29 13:23:22 +01:00
|
|
|
|
2018-01-25 20:49:49 +01:00
|
|
|
struct {
|
|
|
|
ResizingTextEdit *textEdit;
|
|
|
|
QLabel *textEditLength;
|
2018-08-08 15:35:54 +02:00
|
|
|
EffectLabel *emoteButton;
|
2018-01-25 20:49:49 +01:00
|
|
|
|
|
|
|
QHBoxLayout *hbox;
|
2018-06-06 18:57:22 +02:00
|
|
|
} ui_;
|
2018-01-25 20:49:49 +01:00
|
|
|
|
2018-06-06 18:57:22 +02:00
|
|
|
std::vector<pajlada::Signals::ScopedConnection> managedConnections_;
|
|
|
|
QStringList prevMsg_;
|
|
|
|
QString currMsg_;
|
|
|
|
int prevIndex_ = 0;
|
2018-01-25 20:49:49 +01:00
|
|
|
|
2017-01-22 05:58:23 +01:00
|
|
|
private slots:
|
2017-01-29 13:23:22 +01:00
|
|
|
void editTextChanged();
|
2017-06-11 20:53:43 +02:00
|
|
|
|
2017-11-12 17:21:50 +01:00
|
|
|
friend class Split;
|
2017-01-01 02:30:42 +01:00
|
|
|
};
|
2017-06-07 10:09:24 +02:00
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
} // namespace chatterino
|