diff --git a/src/frontend/qt_sdl/AudioSettingsDialog.ui b/src/frontend/qt_sdl/AudioSettingsDialog.ui index bcaf937c..e57b6c52 100644 --- a/src/frontend/qt_sdl/AudioSettingsDialog.ui +++ b/src/frontend/qt_sdl/AudioSettingsDialog.ui @@ -62,7 +62,7 @@ - + 290 @@ -136,6 +136,13 @@ + + + QPathInput + QLineEdit +
QPathInput.h
+
+
diff --git a/src/frontend/qt_sdl/CMakeLists.txt b/src/frontend/qt_sdl/CMakeLists.txt index 5ccab7d0..d47005c1 100644 --- a/src/frontend/qt_sdl/CMakeLists.txt +++ b/src/frontend/qt_sdl/CMakeLists.txt @@ -18,6 +18,7 @@ SET(SOURCES_QT_SDL font.h Platform.cpp PlatformConfig.cpp + QPathInput.h ArchiveUtil.h ArchiveUtil.cpp diff --git a/src/frontend/qt_sdl/EmuSettingsDialog.ui b/src/frontend/qt_sdl/EmuSettingsDialog.ui index ac5506ff..42915397 100644 --- a/src/frontend/qt_sdl/EmuSettingsDialog.ui +++ b/src/frontend/qt_sdl/EmuSettingsDialog.ui @@ -90,14 +90,14 @@ - + <html><head/><body><p>DS-mode ARM7 BIOS</p><p>Size should be 16 KB</p></body></html> - + <html><head/><body><p>DS-mode firmware</p><p><br/></p><p>Possible firmwares:</p><p>* 128 KB: DS-mode firmware from a DSi or 3DS. Not bootable.</p><p>* 256 KB: regular DS firmware.</p><p>* 512 KB: iQue DS firmware.</p></body></html> @@ -155,7 +155,7 @@ - + 0 @@ -197,7 +197,7 @@ - + <html><head/><body><p>DSi-mode ARM7 BIOS</p><p><br/></p><p>Size should be 64 KB</p></body></html> @@ -239,7 +239,7 @@ - + <html><head/><body><p>DSi NAND dump</p><p><br/></p><p>Should have 'nocash footer' at the end</p></body></html> @@ -260,7 +260,7 @@ - + 0 @@ -287,14 +287,14 @@ - + <html><head/><body><p>DSi-mode firmware (used for DS-mode backwards compatibility)</p><p><br/></p><p>Size should be 128 KB</p></body></html> - + <html><head/><body><p>SD image file for emulating the DSi's SD card</p></body></html> @@ -410,7 +410,7 @@ - + @@ -448,6 +448,13 @@ + + + QPathInput + QLineEdit +
QPathInput.h
+
+
cbxConsoleType chkDirectBoot diff --git a/src/frontend/qt_sdl/QPathInput.h b/src/frontend/qt_sdl/QPathInput.h new file mode 100644 index 00000000..1cb1f7c5 --- /dev/null +++ b/src/frontend/qt_sdl/QPathInput.h @@ -0,0 +1,66 @@ +/* + Copyright 2016-2021 Arisotura + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ + +#ifndef QPATHINPUT_H +#define QPATHINPUT_H + +#include +#include +#include +#include + +class QPathInput : public QLineEdit +{ + Q_OBJECT + +public: + QPathInput(QWidget* parent = nullptr) : QLineEdit(parent) + { + setAcceptDrops(true); + } + + ~QPathInput() + { + } + +protected: + void dragEnterEvent(QDragEnterEvent* event) override + { + if (!event->mimeData()->hasUrls()) return QLineEdit::dragEnterEvent(event); + + QList urls = event->mimeData()->urls(); + if (urls.count() > 1) return QLineEdit::dragEnterEvent(event); + + QString filename = urls.at(0).toLocalFile(); + + event->acceptProposedAction(); + } + + void dropEvent(QDropEvent* event) override + { + if (!event->mimeData()->hasUrls()) return QLineEdit::dropEvent(event); + + QList urls = event->mimeData()->urls(); + if (urls.count() > 1) return QLineEdit::dropEvent(event); + + QString filename = urls.at(0).toLocalFile(); + setText(filename); + } +}; + +#endif // QPATHINPUT_H