2021-03-05 02:35:15 +03:00
|
|
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
2022-01-01 06:57:53 +03:00
|
|
|
// SPDX-FileCopyrightText: 2022 Nheko Contributors
|
2023-01-02 06:25:33 +03:00
|
|
|
// SPDX-FileCopyrightText: 2023 Nheko Contributors
|
2021-03-05 02:35:15 +03:00
|
|
|
//
|
|
|
|
// 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
|
|
|
}
|