Merge pull request #107 from sophiekovalevsky/move-metatypes

app/main/device: move metatypes to device
This commit is contained in:
jankae 2022-06-06 20:40:07 +02:00 committed by GitHub
commit b2ea09e1a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 5 deletions

View File

@ -234,6 +234,14 @@ Device::~Device()
}
}
void Device::RegisterTypes()
{
qRegisterMetaType<Protocol::Datapoint>("Datapoint");
qRegisterMetaType<Protocol::ManualStatusV1>("ManualV1");
qRegisterMetaType<Protocol::SpectrumAnalyzerResult>("SpectrumAnalyzerResult");
qRegisterMetaType<Protocol::AmplitudeCorrectionPoint>("AmplitudeCorrection");
}
bool Device::SendPacket(const Protocol::PacketInfo& packet, std::function<void(TransmissionResult)> cb, unsigned int timeout)
{
Transmission t;

View File

@ -58,6 +58,8 @@ public:
// connect to a VNA device. If serial is specified only connecting to this device, otherwise to the first one found
Device(QString serial = QString());
~Device();
static void RegisterTypes();
bool SendPacket(const Protocol::PacketInfo& packet, std::function<void(TransmissionResult)> cb = nullptr, unsigned int timeout = 500);
bool Configure(Protocol::SweepSettings settings, std::function<void(TransmissionResult)> cb = nullptr);
bool Configure(Protocol::SpectrumAnalyzerSettings settings, std::function<void(TransmissionResult)> cb = nullptr);

View File

@ -234,11 +234,6 @@ AppWindow::AppWindow(QWidget *parent)
// Set default mode
vna->activate();
qRegisterMetaType<Protocol::Datapoint>("Datapoint");
qRegisterMetaType<Protocol::ManualStatusV1>("ManualV1");
qRegisterMetaType<Protocol::SpectrumAnalyzerResult>("SpectrumAnalyzerResult");
qRegisterMetaType<Protocol::AmplitudeCorrectionPoint>("AmplitudeCorrection");
auto pref = Preferences::getInstance();
if(pref.Startup.UseSetupFile) {
LoadSetup(pref.Startup.SetupFile);

View File

@ -1,5 +1,6 @@
#include "appwindow.h"
#include <QtWidgets/QApplication>
#include "Device/device.h"
#ifdef Q_OS_UNIX
#include <signal.h>
#endif
@ -23,6 +24,8 @@ int main(int argc, char *argv[]) {
QCoreApplication::setApplicationVersion(window->getAppVersion() + "-" +
window->getAppGitHash().left(9));
Device::RegisterTypes();
#ifdef Q_OS_UNIX
signal(SIGINT, tryExitGracefully);
#endif