LibreVNA/Software/PC_Application/main.cpp

35 lines
810 B
C++
Raw Normal View History

#include "appwindow.h"
2021-10-21 19:00:34 +08:00
#include <QtWidgets/QApplication>
#include "Device/device.h"
2022-05-14 07:59:35 +08:00
#ifdef Q_OS_UNIX
#include <signal.h>
2022-05-14 07:59:35 +08:00
#endif
static QApplication *app;
static AppWindow *window;
2022-05-14 07:59:35 +08:00
#ifdef Q_OS_UNIX
static void tryExitGracefully(int s) {
Q_UNUSED(s)
window->close();
2021-06-28 06:34:42 +08:00
app->quit();
}
2022-05-14 07:59:35 +08:00
#endif
int main(int argc, char *argv[]) {
app = new QApplication(argc, argv);
QCoreApplication::setOrganizationName("LibreVNA");
QCoreApplication::setApplicationName("LibreVNA-GUI");
window = new AppWindow;
QCoreApplication::setApplicationVersion(window->getAppVersion() + "-" +
window->getAppGitHash().left(9));
2022-05-14 07:59:35 +08:00
Device::RegisterTypes();
2022-05-14 07:59:35 +08:00
#ifdef Q_OS_UNIX
signal(SIGINT, tryExitGracefully);
#endif
2021-06-28 06:34:42 +08:00
auto rc = app->exec();
return rc;
}