From d95e533441dc6c9fe4a44e0678380261b51ee412 Mon Sep 17 00:00:00 2001 From: vit9696 Date: Sun, 18 Aug 2019 05:02:30 +0300 Subject: [PATCH] Fix Dock drag and drop --- .gitignore | 1 - UEFITool/Info.plist | 33 +++++++++++++++++++++++++ UEFITool/uefitool.pro | 5 +++- UEFITool/uefitool_main.cpp | 49 ++++++++++++++++++++++++++++---------- 4 files changed, 73 insertions(+), 15 deletions(-) create mode 100644 UEFITool/Info.plist diff --git a/.gitignore b/.gitignore index 154acc9..0281ad4 100644 --- a/.gitignore +++ b/.gitignore @@ -235,7 +235,6 @@ Makefile uefitool_plugin_import.cpp UEFITool.app/ -UEFITool/Info.plist UEFITool/XCBuildData UEFIDump/UEFIDump UEFIExtract/UEFIExtract diff --git a/UEFITool/Info.plist b/UEFITool/Info.plist new file mode 100644 index 0000000..bacb78f --- /dev/null +++ b/UEFITool/Info.plist @@ -0,0 +1,33 @@ + + + + + NSPrincipalClass + NSApplication + CFBundleIconFile + uefitool + CFBundlePackageType + APPL + CFBundleGetInfoString + UEFITool NE + CFBundleSignature + ???? + CFBundleExecutable + UEFITool + CFBundleIdentifier + org.longsoft.UEFITool + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + * + + CFBundleTypeRole + Viewer + LSHandlerRank + None + + + + diff --git a/UEFITool/uefitool.pro b/UEFITool/uefitool.pro index 64cfc18..70b61a7 100644 --- a/UEFITool/uefitool.pro +++ b/UEFITool/uefitool.pro @@ -122,4 +122,7 @@ FORMS += uefitool.ui \ RESOURCES += uefitool.qrc RC_FILE = uefitool.rc ICON = icons/uefitool.icns - +ICONFILE.files = icons/uefitool.icns +ICONFILE.path = Contents/Resources +QMAKE_BUNDLE_DATA += ICONFILE +QMAKE_INFO_PLIST = Info.plist diff --git a/UEFITool/uefitool_main.cpp b/UEFITool/uefitool_main.cpp index 1b2df2a..952e77d 100644 --- a/UEFITool/uefitool_main.cpp +++ b/UEFITool/uefitool_main.cpp @@ -15,18 +15,41 @@ #include #include "uefitool.h" +class UEFIToolApplication : public QApplication +{ + UEFITool tool; +public: + UEFIToolApplication(int &argc, char **argv) + : QApplication(argc, argv) + { + setOrganizationName("LongSoft"); + setOrganizationDomain("longsoft.org"); + setApplicationName("UEFITool"); + } + + int startup() + { + tool.setProgramPath(arguments().at(0)); + if (arguments().length() > 1) + tool.openImageFile(arguments().at(1)); + tool.show(); + + return exec(); + } + + bool event(QEvent *event) + { + if (event->type() == QEvent::FileOpen) { + QFileOpenEvent *openEvent = static_cast(event); + tool.openImageFile(openEvent->file()); + } + + return QApplication::event(event); + } +}; + int main(int argc, char *argv[]) { - QApplication a(argc, argv); - a.setOrganizationName("LongSoft"); - a.setOrganizationDomain("longsoft.org"); - a.setApplicationName("UEFITool"); - - UEFITool w; - w.setProgramPath(a.arguments().at(0)); - if (a.arguments().length() > 1) - w.openImageFile(a.arguments().at(1)); - w.show(); - - return a.exec(); -} \ No newline at end of file + UEFIToolApplication a(argc, argv); + return a.startup(); +}