Mercurial > minori
view src/gui/widgets/drop_list_widget.cc @ 390:2d3e10319112
http: optimize HTTP request thread
we don't need a mutex at all, in fact all we need is an atomic
boolean to signify whether the thread is cancelled.
curl options are now for the most part handled by a separate
function to keep them in sync between non-threaded and threaded
implementations
| author | Paper <paper@tflc.us> |
|---|---|
| date | Fri, 07 Nov 2025 07:08:57 -0500 |
| parents | ea3a74ed2ef9 |
| children |
line wrap: on
line source
#include "gui/widgets/drop_list_widget.h" #include <QDragMoveEvent> #include <QDropEvent> #include <QFileInfo> #include <QMimeData> /* currently this only sends local paths that are folders */ DroppableListWidget::DroppableListWidget(QWidget *parent) : QListWidget(parent) { setAcceptDrops(true); } void DroppableListWidget::dragMoveEvent(QDragMoveEvent *event) { if (event->mimeData()->hasUrls()) event->acceptProposedAction(); } void DroppableListWidget::dragEnterEvent(QDragEnterEvent *event) { if (event->mimeData()->hasUrls()) event->acceptProposedAction(); } void DroppableListWidget::dropEvent(QDropEvent *event) { const QMimeData *mime_data = event->mimeData(); if (!mime_data->hasUrls()) return; QStringList path_list; QList<QUrl> url_list = mime_data->urls(); for (const auto &url : url_list) { if (!url.isLocalFile()) continue; const QString file = url.toLocalFile(); const QFileInfo fileinfo(file); if (fileinfo.exists() && fileinfo.isDir()) path_list.append(file); } if (!path_list.isEmpty()) emit FilesDropped(path_list); event->acceptProposedAction(); }
