/
atikbif
/
RelkonIDE
Обзор
Документация
Войти
/
atikbif
/
RelkonIDE
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Loader/ymodemthread.cpp
61 строка
2 KB
Roman Pelevin
Компиляция по типу контроллера
10 мар 2016, 14:30
10 мар 2016, 14:30
69d826c
Код
Авторство
О чём код?
#include "ymodemthread.h" #include "ui_ymodemthread.h" #include "RCompiler/rcompiler.h" #include <QProgressBar> #include "pathstorage.h" YmodemThread::YmodemThread(const QString& pName, QWidget *parent) : QDialog(parent), ui(new Ui::YmodemThread) { ui->setupUi(this); bar = new QProgressBar(); bar->setMaximum(100); bar->setMinimum(0); bar->setValue(0); label = new QLabel(); ui->verticalLayout->addWidget(label); label->setVisible(false); ui->verticalLayout->addWidget(bar); loader = new Ymodem(); loader->moveToThread(&bootThread); connect(&bootThread,SIGNAL(finished()),loader,SLOT(deleteLater())); connect(loader,SIGNAL(percentUpdate(float)),this,SLOT(percentUpdate(float))); connect(loader,SIGNAL(finished()),this,SLOT(finished())); connect(loader,SIGNAL(bootError(QString)),this,SLOT(bootError(QString))); connect(this,SIGNAL(startProcess(QString,QString)),loader,SLOT(startProcess(QString,QString))); bootThread.start(); if(QFile::exists(PathStorage::getBinFileFullName())) { emit startProcess(pName,PathStorage::getBinFileFullName()); }else { label->setVisible(true); label->setText("Ошибка открытия файла"); repaint(); } } YmodemThread::~YmodemThread() { loader->stopProcess(); bootThread.quit(); bootThread.wait(); delete ui; } void YmodemThread::finished() { accept(); } void YmodemThread::percentUpdate(float value) { bar->setValue(value); repaint(); } void YmodemThread::bootError(const QString &message) { label->setVisible(true); label->setText(message); }