34 lines
695 B
C++
34 lines
695 B
C++
#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;
|
|
}
|