diff --git a/CMakeLists.txt b/CMakeLists.txt
index c07544d..a1b554b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,6 +29,7 @@ add_subdirectory(libXISF)
set(TENMON_SRC
src/about.cpp src/about.h
+ src/application.cpp src/application.h
src/batchprocessing.cpp src/batchprocessing.h src/batchprocessing.ui
src/chartgraph.h src/chartgraph.cpp
src/database.cpp src/database.h
@@ -74,6 +75,8 @@ elseif(APPLE)
set(tenmon_ICON ${CMAKE_CURRENT_SOURCE_DIR}/resources/tenmon.icns)
find_package(Qt6 COMPONENTS DBus REQUIRED)
set_source_files_properties(${tenmon_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
+ set(MACOSX_BUNDLE_INFO_PLIST "Info.plist")
+ set(MACOSX_BUNDLE_ICON_FILE ${tenmon_ICON})
else()
set(tenmon_ICON "")
find_package(Qt6 COMPONENTS DBus REQUIRED)
diff --git a/Info.plist b/Info.plist
new file mode 100644
index 0000000..ae1cc9e
--- /dev/null
+++ b/Info.plist
@@ -0,0 +1,50 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ English
+ CFBundleExecutable
+ tenmon
+ CFBundleGetInfoString
+ ${MACOSX_BUNDLE_INFO_STRING}
+ CFBundleIconFile
+ ${MACOSX_BUNDLE_ICON_FILE}
+ CFBundleIdentifier
+ ${MACOSX_BUNDLE_GUI_IDENTIFIER}
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleLongVersionString
+ ${MACOSX_BUNDLE_LONG_VERSION_STRING}
+ CFBundleName
+ ${MACOSX_BUNDLE_BUNDLE_NAME}
+ CFBundlePackageType
+ APPL
+ CFBundleShortVersionString
+ ${MACOSX_BUNDLE_SHORT_VERSION_STRING}
+ CFBundleVersion
+ ${MACOSX_BUNDLE_BUNDLE_VERSION}
+ CSResourcesFileMapped
+
+ NSHumanReadableCopyright
+ ${MACOSX_BUNDLE_COPYRIGHT}
+ CFBundleDocumentTypes
+
+
+ CFBundleTypeExtensions
+
+ fits
+ fit
+ xisf
+ png
+ jpg
+ jpeg
+ tiff
+ tif
+
+ CFBundleTypeRole
+ Viewer
+
+
+
+
diff --git a/src/application.cpp b/src/application.cpp
new file mode 100644
index 0000000..21b1ca1
--- /dev/null
+++ b/src/application.cpp
@@ -0,0 +1,19 @@
+#include "application.h"
+
+#include
+
+Application::Application(int &argc, char **argv) : QApplication(argc, argv)
+{
+}
+
+bool Application::event(QEvent *event)
+{
+ if (event->type() == QEvent::FileOpen) {
+ QFileOpenEvent *openEvent = static_cast(event);
+ emit openFileEvent(openEvent->file());
+ }
+
+ return QApplication::event(event);
+}
+
+
diff --git a/src/application.h b/src/application.h
new file mode 100644
index 0000000..1bb1be5
--- /dev/null
+++ b/src/application.h
@@ -0,0 +1,16 @@
+#ifndef APPLICATION_H
+#define APPLICATION_H
+
+#include
+
+class Application : public QApplication
+{
+ Q_OBJECT
+public:
+ Application(int &argc, char **argv);
+ bool event(QEvent *event) override;
+signals:
+ void openFileEvent(const QString &file);
+};
+
+#endif // APPLICATION_H
diff --git a/src/main.cpp b/src/main.cpp
index b03212c..e85422d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,5 +1,5 @@
#include "mainwindow.h"
-#include
+#include "application.h"
#include
#include
#include
@@ -102,11 +102,10 @@ int main(int argc, char *argv[])
}
QSurfaceFormat::setDefaultFormat(format);
-
- QApplication a(argc, argv);
+ Application a(argc, argv);
a.setOrganizationName("nou");
a.setApplicationName("Tenmon");
- a.setWindowIcon(QIcon(":/space.nouspiro.tenmon.png"));
+ a.setWindowIcon(QIcon(":/space.nouspiro.tenmon_64.png"));
QTranslator translator;
QTranslator translator2;
@@ -127,6 +126,7 @@ int main(int argc, char *argv[])
a.installTranslator(&translator2);
MainWindow w;
+ QObject::connect(&a, &Application::openFileEvent, &w, static_cast(&MainWindow::loadFile));
w.show();
if(!cmd.positionalArguments().isEmpty() && !cmd.isSet("script"))