2021-03-05 02:35:15 +03:00
|
|
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2020-11-25 19:02:23 +03:00
|
|
|
#include "NhekoDropArea.h"
|
|
|
|
|
|
|
|
#include <QMimeData>
|
|
|
|
|
|
|
|
#include "ChatPage.h"
|
|
|
|
#include "timeline/InputBar.h"
|
|
|
|
#include "timeline/TimelineModel.h"
|
|
|
|
#include "timeline/TimelineViewManager.h"
|
|
|
|
|
|
|
|
#include "Logging.h"
|
|
|
|
|
|
|
|
NhekoDropArea::NhekoDropArea(QQuickItem *parent)
|
|
|
|
: QQuickItem(parent)
|
|
|
|
{
|
2021-09-18 01:22:33 +03:00
|
|
|
setFlags(ItemAcceptsDrops);
|
2020-11-25 19:02:23 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
NhekoDropArea::dragEnterEvent(QDragEnterEvent *event)
|
|
|
|
{
|
2021-09-18 01:22:33 +03:00
|
|
|
event->acceptProposedAction();
|
2020-11-25 19:02:23 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
NhekoDropArea::dragMoveEvent(QDragMoveEvent *event)
|
|
|
|
{
|
2021-09-18 01:22:33 +03:00
|
|
|
event->acceptProposedAction();
|
2020-11-25 19:02:23 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
NhekoDropArea::dropEvent(QDropEvent *event)
|
|
|
|
{
|
2021-09-18 01:22:33 +03:00
|
|
|
if (event) {
|
|
|
|
auto model = ChatPage::instance()->timelineManager()->rooms()->getRoomById(roomid_);
|
|
|
|
if (model) {
|
|
|
|
model->input()->insertMimeData(event->mimeData());
|
2020-11-25 19:02:23 +03:00
|
|
|
}
|
2021-09-18 01:22:33 +03:00
|
|
|
}
|
2020-11-25 19:02:23 +03:00
|
|
|
}
|