inital commit
This commit is contained in:
33
mainobject.cpp
Normal file
33
mainobject.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include "mainobject.h"
|
||||
#include <QMessageBox>
|
||||
|
||||
MainObject::MainObject(QApplication* appI, VhfMillThread* millThreadI, QObject *parent):
|
||||
app(appI),
|
||||
millThread(millThreadI),
|
||||
QObject{parent}
|
||||
{
|
||||
connect(millThread, &VhfMillThread::ready, this, &MainObject::activate);
|
||||
}
|
||||
|
||||
void MainObject::activate()
|
||||
{
|
||||
if(millThread->ret != 0)
|
||||
{
|
||||
if(millThread->ret == -2)
|
||||
QMessageBox::critical(nullptr, "Error", "Can not connect to to Server");
|
||||
if(millThread->ret == -3)
|
||||
QMessageBox::critical(nullptr, "Error", "Can not open serial port read write");
|
||||
}
|
||||
else
|
||||
{
|
||||
w = new MainWindow(millThread->mill);
|
||||
app->installEventFilter(w);
|
||||
w->show();
|
||||
}
|
||||
}
|
||||
|
||||
MainObject::~MainObject()
|
||||
{
|
||||
if(w)
|
||||
delete w;
|
||||
}
|
Reference in New Issue
Block a user