summaryrefslogtreecommitdiff
path: root/qmap/main.cpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2025-09-15 23:04:33 +0200
committerChristoph Berg <myon@debian.org>2025-09-15 23:04:33 +0200
commite1c678ef00f0159bbeb5571e5ebb0d4697121334 (patch)
tree6547edef81a62a812a4d0f64e03fda226b5f0a7e /qmap/main.cpp
parentb9daa22c4c3ad51cd4bc0ef624a19f21d01c9305 (diff)
parent0a13f1fdb9928b6d012569dd65f7f6ef18fac2f8 (diff)
Update upstream source from tag 'upstream/3.0.0_rc1+repack'
Update to upstream version '3.0.0~rc1+repack' with Debian dir 68c212e23136fecf9ebc6f12ff355579224d27ee
Diffstat (limited to 'qmap/main.cpp')
-rwxr-xr-xqmap/main.cpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/qmap/main.cpp b/qmap/main.cpp
new file mode 100755
index 00000000..784044fa
--- /dev/null
+++ b/qmap/main.cpp
@@ -0,0 +1,54 @@
+#include <fftw3.h>
+#ifdef QT5
+#include <QtWidgets>
+#else
+#include <QtGui>
+#endif
+#include <QApplication>
+
+#include "revision_utils.hpp"
+#include "mainwindow.h"
+
+extern "C" {
+ // Fortran procedures we need
+ void four2a_ (_Complex float *, int * nfft, int * ndim, int * isign, int * iform, int len);
+
+ void _gfortran_set_args(int argc, char *argv[]);
+ void _gfortran_set_convert(int conv);
+ void ftninit_(void);
+ void fftbig_(float dd[], int* nfft);
+}
+
+int main(int argc, char *argv[])
+{
+ QApplication a {argc, argv};
+
+// Initialize libgfortran:
+ _gfortran_set_args(argc, argv);
+ _gfortran_set_convert(0);
+ ftninit_();
+
+ // Override programs executable basename as application name.
+ a.setApplicationName ("QMAP");
+ a.setApplicationVersion ("0.5");
+ // switch off as we share an Info.plist file with WSJT-X
+ a.setAttribute (Qt::AA_DontUseNativeMenuBar);
+ MainWindow w;
+ w.show ();
+ QObject::connect (&a, &QApplication::lastWindowClosed, &a, &QApplication::quit);
+ auto result = a.exec ();
+
+ // clean up lazily initialized FFTW3 resources
+ {
+ int nfft {-1};
+ int ndim {1};
+ int isign {1};
+ int iform {1};
+ // free FFT plan resources
+ four2a_ (nullptr, &nfft, &ndim, &isign, &iform, 0);
+ fftbig_(nullptr, &nfft);
+ }
+ fftwf_forget_wisdom ();
+ fftwf_cleanup ();
+ return result;
+}