Update the look of the chatbar to be floating with the rich text controls on top and send buttons inline
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "chattextitemhelper.h"
|
||||
#include "clipboard.h"
|
||||
#include "neochatroom.h"
|
||||
#include <qnamespace.h>
|
||||
|
||||
ChatKeyHelper::ChatKeyHelper(QObject *parent)
|
||||
: QObject(parent)
|
||||
@@ -29,7 +30,10 @@ bool ChatKeyHelper::handleKey(Qt::Key key, Qt::KeyboardModifiers modifiers)
|
||||
return backspace();
|
||||
case Qt::Key_Enter:
|
||||
case Qt::Key_Return:
|
||||
return insertReturn();
|
||||
return insertReturn(modifiers);
|
||||
case Qt::Key_Escape:
|
||||
case Qt::Key_Cancel:
|
||||
return cancel();
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -155,16 +159,28 @@ bool ChatKeyHelper::backspace()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ChatKeyHelper::insertReturn()
|
||||
bool ChatKeyHelper::insertReturn(Qt::KeyboardModifiers modifiers)
|
||||
{
|
||||
if (!textItem) {
|
||||
return false;
|
||||
}
|
||||
if (textItem->isCompleting) {
|
||||
|
||||
bool shiftPressed = modifiers.testFlag(Qt::ShiftModifier);
|
||||
if (shiftPressed && !sendMessageWithEnter) {
|
||||
Q_EMIT unhandledReturn(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!shiftPressed && textItem->isCompleting) {
|
||||
Q_EMIT unhandledReturn(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!shiftPressed && sendMessageWithEnter) {
|
||||
Q_EMIT unhandledReturn(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
QTextCursor cursor = textItem->textCursor();
|
||||
if (cursor.isNull()) {
|
||||
return false;
|
||||
@@ -173,6 +189,18 @@ bool ChatKeyHelper::insertReturn()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatKeyHelper::cancel()
|
||||
{
|
||||
if (!textItem) {
|
||||
return false;
|
||||
}
|
||||
if (textItem->isCompleting) {
|
||||
Q_EMIT closeCompletion();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ChatKeyHelper::pasteImage()
|
||||
{
|
||||
if (!textItem) {
|
||||
|
||||
Reference in New Issue
Block a user