|
|
|
@ -19,33 +19,34 @@
@@ -19,33 +19,34 @@
|
|
|
|
|
|
|
|
|
|
#include "genericchatform.h" |
|
|
|
|
|
|
|
|
|
#include <QDebug> |
|
|
|
|
#include <QFileDialog> |
|
|
|
|
#include <QHBoxLayout> |
|
|
|
|
#include <QDebug> |
|
|
|
|
#include <QShortcut> |
|
|
|
|
#include <QKeyEvent> |
|
|
|
|
#include <QPushButton> |
|
|
|
|
#include <QShortcut> |
|
|
|
|
#include <QSplitter> |
|
|
|
|
|
|
|
|
|
#include "src/chatlog/chatlog.h" |
|
|
|
|
#include "src/chatlog/content/timestamp.h" |
|
|
|
|
#include "src/core/core.h" |
|
|
|
|
#include "src/friend.h" |
|
|
|
|
#include "src/friendlist.h" |
|
|
|
|
#include "src/group.h" |
|
|
|
|
#include "src/grouplist.h" |
|
|
|
|
#include "src/persistence/settings.h" |
|
|
|
|
#include "src/persistence/smileypack.h" |
|
|
|
|
#include "src/video/genericnetcamview.h" |
|
|
|
|
#include "src/widget/contentdialog.h" |
|
|
|
|
#include "src/widget/contentlayout.h" |
|
|
|
|
#include "src/widget/emoticonswidget.h" |
|
|
|
|
#include "src/widget/maskablepixmapwidget.h" |
|
|
|
|
#include "src/widget/style.h" |
|
|
|
|
#include "src/widget/widget.h" |
|
|
|
|
#include "src/persistence/settings.h" |
|
|
|
|
#include "src/widget/tool/chattextedit.h" |
|
|
|
|
#include "src/widget/maskablepixmapwidget.h" |
|
|
|
|
#include "src/core/core.h" |
|
|
|
|
#include "src/grouplist.h" |
|
|
|
|
#include "src/group.h" |
|
|
|
|
#include "src/friendlist.h" |
|
|
|
|
#include "src/friend.h" |
|
|
|
|
#include "src/chatlog/chatlog.h" |
|
|
|
|
#include "src/chatlog/content/timestamp.h" |
|
|
|
|
#include "src/widget/tool/croppinglabel.h" |
|
|
|
|
#include "src/widget/tool/flyoutoverlaywidget.h" |
|
|
|
|
#include "src/widget/translator.h" |
|
|
|
|
#include "src/widget/contentlayout.h" |
|
|
|
|
#include "src/widget/tool/croppinglabel.h" |
|
|
|
|
#include <QPushButton> |
|
|
|
|
#include "src/video/genericnetcamview.h" |
|
|
|
|
#include "src/widget/widget.h" |
|
|
|
|
|
|
|
|
|
GenericChatForm::GenericChatForm(QWidget *parent) |
|
|
|
|
: QWidget(parent, Qt::Window) |
|
|
|
@ -226,7 +227,7 @@ GenericChatForm::~GenericChatForm()
@@ -226,7 +227,7 @@ GenericChatForm::~GenericChatForm()
|
|
|
|
|
|
|
|
|
|
void GenericChatForm::adjustFileMenuPosition() |
|
|
|
|
{ |
|
|
|
|
QPoint pos = fileButton->pos(); |
|
|
|
|
QPoint pos = fileButton->mapTo(bodySplitter, QPoint()); |
|
|
|
|
QSize size = fileFlyout->size(); |
|
|
|
|
fileFlyout->move(pos.x() - size.width(), pos.y()); |
|
|
|
|
} |
|
|
|
@ -244,7 +245,6 @@ void GenericChatForm::hideFileMenu()
@@ -244,7 +245,6 @@ void GenericChatForm::hideFileMenu()
|
|
|
|
|
{ |
|
|
|
|
if(fileFlyout->isShown() || fileFlyout->isBeingShown()) |
|
|
|
|
fileFlyout->animateHide(); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool GenericChatForm::isEmpty() |
|
|
|
@ -506,8 +506,8 @@ void GenericChatForm::resizeEvent(QResizeEvent* event)
@@ -506,8 +506,8 @@ void GenericChatForm::resizeEvent(QResizeEvent* event)
|
|
|
|
|
|
|
|
|
|
bool GenericChatForm::eventFilter(QObject* object, QEvent* event) |
|
|
|
|
{ |
|
|
|
|
EmoticonsWidget * ev = qobject_cast<EmoticonsWidget *>(object); |
|
|
|
|
if (( ev) && (event->type() == QEvent::KeyPress) ) |
|
|
|
|
EmoticonsWidget* ev = qobject_cast<EmoticonsWidget*>(object); |
|
|
|
|
if (ev && event->type() == QEvent::KeyPress) |
|
|
|
|
{ |
|
|
|
|
QKeyEvent* key = static_cast<QKeyEvent*>(event); |
|
|
|
|
msgEdit->sendKeyEvent(key); |
|
|
|
@ -527,15 +527,21 @@ bool GenericChatForm::eventFilter(QObject* object, QEvent* event)
@@ -527,15 +527,21 @@ bool GenericChatForm::eventFilter(QObject* object, QEvent* event)
|
|
|
|
|
showFileMenu(); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case QEvent::Leave: { |
|
|
|
|
QPoint pos = mapFromGlobal(QCursor::pos()); |
|
|
|
|
QRect fileRect(fileFlyout->pos(), fileFlyout->size()); |
|
|
|
|
fileRect = fileRect.united(QRect(fileButton->pos(), fileButton->size())); |
|
|
|
|
case QEvent::Leave: |
|
|
|
|
{ |
|
|
|
|
QPoint flyPos = fileFlyout->mapToGlobal(QPoint()); |
|
|
|
|
QSize flySize = fileFlyout->size(); |
|
|
|
|
|
|
|
|
|
QPoint filePos = fileButton->mapToGlobal(QPoint()); |
|
|
|
|
QSize fileSize = fileButton->size(); |
|
|
|
|
|
|
|
|
|
if (!fileRect.contains(pos)) |
|
|
|
|
QRect region = QRect(flyPos, flySize).united(QRect(filePos, fileSize)); |
|
|
|
|
|
|
|
|
|
if (!region.contains(QCursor::pos())) |
|
|
|
|
hideFileMenu(); |
|
|
|
|
|
|
|
|
|
} break; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
case QEvent::MouseButtonPress: |
|
|
|
|
hideFileMenu(); |
|
|
|
@ -625,6 +631,11 @@ void GenericChatForm::showNetcam()
@@ -625,6 +631,11 @@ void GenericChatForm::showNetcam()
|
|
|
|
|
|
|
|
|
|
bodySplitter->insertWidget(0, netcam); |
|
|
|
|
bodySplitter->setCollapsible(0, false); |
|
|
|
|
|
|
|
|
|
QSize minSize = netcam->getSurfaceMinSize(); |
|
|
|
|
ContentDialog* current = ContentDialog::current(); |
|
|
|
|
if (current) |
|
|
|
|
current->onVideoShow(minSize); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void GenericChatForm::hideNetcam() |
|
|
|
@ -632,6 +643,10 @@ void GenericChatForm::hideNetcam()
@@ -632,6 +643,10 @@ void GenericChatForm::hideNetcam()
|
|
|
|
|
if (!netcam) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
ContentDialog* current = ContentDialog::current(); |
|
|
|
|
if (current) |
|
|
|
|
current->onVideoHide(); |
|
|
|
|
|
|
|
|
|
netcam->close(); |
|
|
|
|
netcam->hide(); |
|
|
|
|
delete netcam; |
|
|
|
|