matrixion/src/timeline/InputBar.h

37 lines
783 B
C
Raw Normal View History

2020-11-01 01:24:07 +03:00
#pragma once
#include <QObject>
2020-11-09 05:12:37 +03:00
#include <deque>
2020-11-01 01:24:07 +03:00
class TimelineModel;
2020-11-09 05:12:37 +03:00
class InputBar : public QObject
{
2020-11-01 01:24:07 +03:00
Q_OBJECT
public:
InputBar(TimelineModel *parent)
: QObject()
, room(parent)
{}
public slots:
void send();
2020-11-09 05:12:37 +03:00
void paste(bool fromMouse);
2020-11-01 01:24:07 +03:00
void updateState(int selectionStart, int selectionEnd, int cursorPosition, QString text);
2020-11-09 05:12:37 +03:00
signals:
void insertText(QString text);
2020-11-01 01:24:07 +03:00
private:
2020-11-09 05:12:37 +03:00
void message(QString body);
void emote(QString body);
void command(QString name, QString args);
2020-11-01 01:24:07 +03:00
TimelineModel *room;
QString text;
2020-11-09 05:12:37 +03:00
std::deque<QString> history_;
std::size_t history_index_ = 0;
2020-11-01 01:24:07 +03:00
int selectionStart = 0, selectionEnd = 0, cursorPosition = 0;
};