2022-08-05 18:20:41 +08:00
|
|
|
|
#include "appwindow.h"
|
2021-10-21 19:00:34 +08:00
|
|
|
|
#include <QtWidgets/QApplication>
|
2022-05-30 01:43:50 +08:00
|
|
|
|
#include "Device/device.h"
|
2022-05-14 07:59:35 +08:00
|
|
|
|
#ifdef Q_OS_UNIX
|
2021-04-11 06:10:22 +08:00
|
|
|
|
#include <signal.h>
|
2022-05-14 07:59:35 +08:00
|
|
|
|
#endif
|
2021-04-11 06:10:22 +08:00
|
|
|
|
|
2022-09-05 01:15:53 +08:00
|
|
|
|
#include "Tools/parameters.h"
|
|
|
|
|
#include <complex>
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
2021-04-11 06:10:22 +08:00
|
|
|
|
static QApplication *app;
|
|
|
|
|
static AppWindow *window;
|
|
|
|
|
|
2022-05-14 07:59:35 +08:00
|
|
|
|
#ifdef Q_OS_UNIX
|
|
|
|
|
static void tryExitGracefully(int s) {
|
2021-04-11 06:10:22 +08:00
|
|
|
|
Q_UNUSED(s)
|
|
|
|
|
window->close();
|
2021-06-28 06:34:42 +08:00
|
|
|
|
app->quit();
|
2021-04-11 06:10:22 +08:00
|
|
|
|
}
|
2022-05-14 07:59:35 +08:00
|
|
|
|
#endif
|
2021-04-11 06:10:22 +08:00
|
|
|
|
|
2020-08-31 04:03:41 +08:00
|
|
|
|
int main(int argc, char *argv[]) {
|
2022-06-21 06:35:38 +08:00
|
|
|
|
|
|
|
|
|
qSetMessagePattern("%{time process}: [%{type}] %{message}");
|
|
|
|
|
|
2022-03-03 19:28:59 +08:00
|
|
|
|
app = new QApplication(argc, argv);
|
2021-06-28 00:04:27 +08:00
|
|
|
|
QCoreApplication::setOrganizationName("LibreVNA");
|
|
|
|
|
QCoreApplication::setApplicationName("LibreVNA-GUI");
|
2021-04-11 06:10:22 +08:00
|
|
|
|
window = new AppWindow;
|
2021-06-28 00:04:27 +08:00
|
|
|
|
QCoreApplication::setApplicationVersion(window->getAppVersion() + "-" +
|
|
|
|
|
window->getAppGitHash().left(9));
|
2022-05-14 07:59:35 +08:00
|
|
|
|
|
2022-05-30 01:43:50 +08:00
|
|
|
|
Device::RegisterTypes();
|
|
|
|
|
|
2022-09-05 01:15:53 +08:00
|
|
|
|
auto S11 = complex<double>(-0.5, 0.25);
|
|
|
|
|
auto S22 = complex<double>(0.5, 0.15);
|
|
|
|
|
auto S33 = complex<double>(0.8, -0.25);
|
|
|
|
|
|
|
|
|
|
auto S12 = complex<double>(0.1, 0);
|
|
|
|
|
auto S21 = complex<double>(0.2, 0.3);
|
|
|
|
|
|
|
|
|
|
auto S13 = complex<double>(0.3, -0.2);
|
|
|
|
|
auto S31 = complex<double>(0.4, 0.4);
|
|
|
|
|
|
|
|
|
|
auto S23 = complex<double>(0.5, 0.2);
|
|
|
|
|
auto S32 = complex<double>(0.6, -0.2);
|
|
|
|
|
|
|
|
|
|
auto p12 = Sparam(S11, S12, S21, S22);
|
|
|
|
|
auto p12_only = Sparam(0.0, S12, 1.0, 0.0);
|
|
|
|
|
auto p13 = Sparam(S11, S13, S31, S33);
|
|
|
|
|
auto p23 = Sparam(S22, S23, S32, S33);
|
|
|
|
|
|
|
|
|
|
// convert to 75 ohm
|
|
|
|
|
auto p12_75 = Sparam(ABCDparam(p12, 50.0), 75.0);
|
|
|
|
|
auto p12_only_75 = Sparam(ABCDparam(p12_only, 50.0), 75.0);
|
|
|
|
|
auto p13_75 = Sparam(ABCDparam(p12, 50.0), 75.0);
|
|
|
|
|
auto Zp23_75 = Sparam(ABCDparam(p12, 50.0), 75.0);
|
|
|
|
|
|
|
|
|
|
auto p1 = Sparam(S11, 0.0, 0.0, 1.0);
|
|
|
|
|
auto p1_75 = Sparam(ABCDparam(p12, 50.0), 75.0);
|
2022-08-06 00:29:31 +08:00
|
|
|
|
|
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;
|
2020-08-31 04:03:41 +08:00
|
|
|
|
}
|