Exemple #1
0
MainWindow::MainWindow(Controller *c) :
    QMainWindow(0),
    ui(new Ui::MainWindow)
{
    controller = c;

    ui->setupUi(this);

    // Controller -> Main window
    connect(controller, &Controller::signalDataReceived,
            this, &MainWindow::processResponse);
    connect(controller, &Controller::signalStatusChange,
            this, &MainWindow::processStatus);
    connect(controller, &Controller::signalDisplayThermalImage,
            this, &MainWindow::processThermalImage);

    SetupDialog dlg;
    if (dlg.exec() == QDialog::Accepted) {
        controller->connectPort(dlg.getSelectedSerialPort());
        ui->statusBar->showMessage("Status: Connecting...");
    } else {
        exit(0);
    }

    ui->thermalImage->setStyleSheet("QLabel { background-color : black; }");
    ui->thermalImage->setMouseTracking(true);
    ui->thermalImage->installEventFilter(this);

    ui->thermalScale->setPixmap(QPixmap::fromImage(getScale()).scaled(ui->thermalScale->size(),
                                                                 Qt::KeepAspectRatio,
                                                                 Qt::FastTransformation));
}