2020-09-13 14:44:45 +02:00
|
|
|
#include "appwindow.h"
|
2021-10-21 13:00:34 +02:00
|
|
|
#include <QtWidgets/QApplication>
|
2022-05-29 19:43:50 +02:00
|
|
|
#include "Device/device.h"
|
2022-05-14 01:59:35 +02:00
|
|
|
#ifdef Q_OS_UNIX
|
2021-04-11 00:10:22 +02:00
|
|
|
#include <signal.h>
|
2022-05-14 01:59:35 +02:00
|
|
|
#endif
|
2021-04-11 00:10:22 +02:00
|
|
|
|
|
|
|
|
static QApplication *app;
|
|
|
|
|
static AppWindow *window;
|
|
|
|
|
|
2022-05-14 01:59:35 +02:00
|
|
|
#ifdef Q_OS_UNIX
|
|
|
|
|
static void tryExitGracefully(int s) {
|
2021-04-11 00:10:22 +02:00
|
|
|
Q_UNUSED(s)
|
|
|
|
|
window->close();
|
2021-06-28 00:34:42 +02:00
|
|
|
app->quit();
|
2021-04-11 00:10:22 +02:00
|
|
|
}
|
2022-05-14 01:59:35 +02:00
|
|
|
#endif
|
2021-04-11 00:10:22 +02:00
|
|
|
|
2020-08-30 22:03:41 +02:00
|
|
|
int main(int argc, char *argv[]) {
|
2022-06-21 00:35:38 +02:00
|
|
|
|
|
|
|
|
qSetMessagePattern("%{time process}: [%{type}] %{message}");
|
|
|
|
|
|
2022-03-03 12:28:59 +01:00
|
|
|
app = new QApplication(argc, argv);
|
2021-06-27 18:04:27 +02:00
|
|
|
QCoreApplication::setOrganizationName("LibreVNA");
|
|
|
|
|
QCoreApplication::setApplicationName("LibreVNA-GUI");
|
2021-04-11 00:10:22 +02:00
|
|
|
window = new AppWindow;
|
2021-06-27 18:04:27 +02:00
|
|
|
QCoreApplication::setApplicationVersion(window->getAppVersion() + "-" +
|
|
|
|
|
window->getAppGitHash().left(9));
|
2022-05-14 01:59:35 +02:00
|
|
|
|
2022-05-29 19:43:50 +02:00
|
|
|
Device::RegisterTypes();
|
|
|
|
|
|
2022-05-14 01:59:35 +02:00
|
|
|
#ifdef Q_OS_UNIX
|
|
|
|
|
signal(SIGINT, tryExitGracefully);
|
|
|
|
|
#endif
|
2021-06-28 00:34:42 +02:00
|
|
|
auto rc = app->exec();
|
|
|
|
|
return rc;
|
2020-08-30 22:03:41 +02:00
|
|
|
}
|