Mercurial > minori
diff src/gui/dialog/settings/library.cc @ 317:b1f4d1867ab1
services: VERY initial Kitsu support
it only supports user authentication for now, but it's definitely
a start.
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 12 Jun 2024 04:07:10 -0400 |
parents | 862d0d8619f6 |
children |
line wrap: on
line diff
--- a/src/gui/dialog/settings/library.cc Tue Jun 11 15:11:09 2024 -0400 +++ b/src/gui/dialog/settings/library.cc Wed Jun 12 04:07:10 2024 -0400 @@ -1,63 +1,19 @@ #include "core/session.h" #include "core/strings.h" #include "gui/dialog/settings.h" +#include "gui/widgets/drop_list_widget.h" #include <QCheckBox> #include <QDir> -#include <QDropEvent> #include <QFileDialog> -#include <QFileInfo> #include <QGroupBox> #include <QLabel> #include <QListWidget> #include <QListWidgetItem> -#include <QMimeData> #include <QPushButton> #include <QSizePolicy> #include <QVBoxLayout> -#include <algorithm> -#include <iostream> - -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(); -} - QWidget* SettingsPageLibrary::CreateFoldersWidget() { QWidget* result = new QWidget(this); result->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);