diff options
Diffstat (limited to 'application/widgets')
-rw-r--r-- | application/widgets/DropLabel.cpp | 41 | ||||
-rw-r--r-- | application/widgets/DropLabel.h | 20 | ||||
-rw-r--r-- | application/widgets/ServerStatus.cpp | 2 | ||||
-rw-r--r-- | application/widgets/VersionListView.cpp | 2 |
4 files changed, 64 insertions, 1 deletions
diff --git a/application/widgets/DropLabel.cpp b/application/widgets/DropLabel.cpp new file mode 100644 index 00000000..a900e57c --- /dev/null +++ b/application/widgets/DropLabel.cpp @@ -0,0 +1,41 @@ +#include "DropLabel.h" + +#include <QMimeData> +#include <QDropEvent> + +DropLabel::DropLabel(QWidget *parent) : QLabel(parent) +{ + setAcceptDrops(true); +} + +void DropLabel::dragEnterEvent(QDragEnterEvent *event) +{ + event->acceptProposedAction(); +} + +void DropLabel::dragMoveEvent(QDragMoveEvent *event) +{ + event->acceptProposedAction(); +} + +void DropLabel::dragLeaveEvent(QDragLeaveEvent *event) +{ + event->accept(); +} + +void DropLabel::dropEvent(QDropEvent *event) +{ + const QMimeData *mimeData = event->mimeData(); + + if (!mimeData) + { + return; + } + + if (mimeData->hasUrls()) { + auto urls = mimeData->urls(); + emit droppedURLs(urls); + } + + event->acceptProposedAction(); +} diff --git a/application/widgets/DropLabel.h b/application/widgets/DropLabel.h new file mode 100644 index 00000000..c5ca0bcc --- /dev/null +++ b/application/widgets/DropLabel.h @@ -0,0 +1,20 @@ +#pragma once + +#include <QLabel> + +class DropLabel : public QLabel +{ + Q_OBJECT + +public: + explicit DropLabel(QWidget *parent = nullptr); + +signals: + void droppedURLs(QList<QUrl> urls); + +protected: + void dropEvent(QDropEvent *event) override; + void dragEnterEvent(QDragEnterEvent *event) override; + void dragMoveEvent(QDragMoveEvent *event) override; + void dragLeaveEvent(QDragLeaveEvent *event) override; +}; diff --git a/application/widgets/ServerStatus.cpp b/application/widgets/ServerStatus.cpp index a7016c0c..ce0aed9c 100644 --- a/application/widgets/ServerStatus.cpp +++ b/application/widgets/ServerStatus.cpp @@ -125,7 +125,7 @@ void ServerStatus::addStatus(QString key, QString name) void ServerStatus::clicked() { - DesktopServices::openUrl(QUrl("https://help.mojang.com/")); + DesktopServices::openUrl(QUrl("https://github.com/MultiMC/MultiMC5/wiki/Mojang-Services-Status")); } void ServerStatus::setStatus(QString key, int value) diff --git a/application/widgets/VersionListView.cpp b/application/widgets/VersionListView.cpp index 09df75b7..fdcb84e6 100644 --- a/application/widgets/VersionListView.cpp +++ b/application/widgets/VersionListView.cpp @@ -82,7 +82,9 @@ void VersionListView::setEmptyMode(VersionListView::EmptyMode mode) void VersionListView::updateEmptyViewPort() { +#ifndef QT_NO_ACCESSIBILITY setAccessibleDescription(currentEmptyString()); +#endif /* !QT_NO_ACCESSIBILITY */ if(!m_itemCount) { |