Removed any references to CA-plugin from MainWindow.
This commit is contained in:
parent
1f8b88b2b6
commit
3588b25e65
@ -89,15 +89,12 @@ void MainWindow::emergencyLeaveBL() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MainWindow::MainWindow(hwinf *hw, Worker *worker, Update *update, QWidget *parent)
|
MainWindow::MainWindow(Worker *worker, QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
, ui(new Ui::MainWindow)
|
, ui(new Ui::MainWindow)
|
||||||
, m_hw(hw)
|
|
||||||
, m_worker(worker)
|
, m_worker(worker)
|
||||||
, m_width(70)
|
, m_width(70)
|
||||||
, m_progressRunning(false)
|
, m_progressRunning(false)
|
||||||
// , m_progressValue(0)
|
|
||||||
, m_update(update)
|
|
||||||
, m_updateStep(UpdateDcEvent::UpdateStep::NONE) {
|
, m_updateStep(UpdateDcEvent::UpdateStep::NONE) {
|
||||||
|
|
||||||
#if EMERGENCY_LEAVE_BL==1
|
#if EMERGENCY_LEAVE_BL==1
|
||||||
@ -138,7 +135,7 @@ MainWindow::MainWindow(hwinf *hw, Worker *worker, Update *update, QWidget *paren
|
|||||||
// ui->updateStatus->installEventFilter(this);
|
// ui->updateStatus->installEventFilter(this);
|
||||||
|
|
||||||
m_startTimer = new QTimer(this);
|
m_startTimer = new QTimer(this);
|
||||||
connect(m_startTimer, SIGNAL(timeout()), m_worker, SLOT(update()));
|
connect(m_startTimer, SIGNAL(timeout()), m_worker, SLOT(start()));
|
||||||
m_startTimer->setSingleShot(true);
|
m_startTimer->setSingleShot(true);
|
||||||
m_startTimer->start(1000);
|
m_startTimer->start(1000);
|
||||||
|
|
||||||
@ -215,86 +212,6 @@ void MainWindow::customEvent(QEvent *event) {
|
|||||||
} else {
|
} else {
|
||||||
qCritical() << "!!! UNKNOWN SENDER !!!";
|
qCritical() << "!!! UNKNOWN SENDER !!!";
|
||||||
}
|
}
|
||||||
} else
|
|
||||||
if (event->type() == UpdateDcEvent::type()) {
|
|
||||||
UpdateDcEvent *pevent = (UpdateDcEvent *)event;
|
|
||||||
UpdateDcEvent::UpdateStep const updateStep = pevent->updateStep();
|
|
||||||
QObject const *sender = pevent->sender();
|
|
||||||
if (sender == m_worker) {
|
|
||||||
QDateTime const &recv = QDateTime::currentDateTime();
|
|
||||||
QDateTime const &send = pevent->sendDateTime();
|
|
||||||
qint64 const delay = recv.toMSecsSinceEpoch() - send.toMSecsSinceEpoch();
|
|
||||||
switch(updateStep) {
|
|
||||||
case UpdateDcEvent::UpdateStep::NONE:
|
|
||||||
break;
|
|
||||||
case UpdateDcEvent::UpdateStep::DC_REBOOT: {
|
|
||||||
m_hw->bl_rebootDC();
|
|
||||||
QString msg = QDateTime::currentDateTime().toString(Qt::ISODateWithMs)
|
|
||||||
+ QString(": reset device controller (delay=%1ms").arg(delay);
|
|
||||||
emit m_worker->showStatusMessage("dc update", msg);
|
|
||||||
Utils::printInfoMsg(msg.toUpper());
|
|
||||||
m_updateStep = UpdateDcEvent::UpdateStep::DC_REBOOT;
|
|
||||||
} break;
|
|
||||||
case UpdateDcEvent::UpdateStep::BL_START: {
|
|
||||||
QString const &msg = recv.toString(Qt::ISODateWithMs)
|
|
||||||
+ QString(": start bootloader (%1, delay=%2ms)").arg(pevent->count()).arg(delay);
|
|
||||||
emit m_worker->showStatusMessage("dc update", msg);
|
|
||||||
Utils::printInfoMsg(msg.toUpper());
|
|
||||||
m_hw->bl_startBL();
|
|
||||||
if (pevent->count() == BL_START_COUNT) {
|
|
||||||
m_updateStep = UpdateDcEvent::UpdateStep::BL_START;
|
|
||||||
}
|
|
||||||
} break;
|
|
||||||
case UpdateDcEvent::UpdateStep::BL_CHECK: {
|
|
||||||
if (m_updateStep != UpdateDcEvent::UpdateStep::BL_IS_UP) {
|
|
||||||
QString const &msg = recv.toString(Qt::ISODateWithMs)
|
|
||||||
+ QString(": request bootloader version (%1, delay=%2ms)").arg(pevent->count()).arg(delay);
|
|
||||||
emit m_worker->showStatusMessage("dc update", msg);
|
|
||||||
Utils::printInfoMsg(msg.toUpper());
|
|
||||||
m_hw->bl_checkBL();
|
|
||||||
//m_updateStep = UpdateDcEvent::UpdateStep::BL_CHECK;
|
|
||||||
}
|
|
||||||
} break;
|
|
||||||
case UpdateDcEvent::UpdateStep::BL_IS_UP: {
|
|
||||||
QString msg = recv.toString(Qt::ISODateWithMs)
|
|
||||||
+ QString(": check running bootloader (%1, delay=%2ms)").arg(pevent->count()).arg(delay);
|
|
||||||
emit m_worker->showStatusMessage("dc update", msg);
|
|
||||||
Utils::printInfoMsg(msg.toUpper());
|
|
||||||
if (m_updateStep != UpdateDcEvent::UpdateStep::BL_IS_UP) {
|
|
||||||
if (m_hw->bl_isUp()) {
|
|
||||||
msg = recv.toString(Qt::ISODateWithMs)
|
|
||||||
+ QString(": bootloader running (%1, delay=%2ms)").arg(pevent->count()).arg(delay);
|
|
||||||
emit m_worker->showStatusMessage("dc update", msg);
|
|
||||||
Utils::printInfoMsg(msg.toUpper());
|
|
||||||
m_updateStep = UpdateDcEvent::UpdateStep::BL_IS_UP;
|
|
||||||
} else {
|
|
||||||
msg = recv.toString(Qt::ISODateWithMs)
|
|
||||||
+ QString(": bootloader stop requested (%1, delay=%2ms)").arg(pevent->count()).arg(delay);
|
|
||||||
emit m_worker->showStatusMessage("dc update", msg);
|
|
||||||
Utils::printInfoMsg(msg.toUpper());
|
|
||||||
if (m_updateStep == UpdateDcEvent::UpdateStep::BL_STOP) {
|
|
||||||
msg = QDateTime::currentDateTime().toString(Qt::ISODateWithMs)
|
|
||||||
+ QString(": bootloader down (%1, delay=%2ms)").arg(pevent->count()).arg(delay);
|
|
||||||
emit m_worker->showStatusMessage("dc update", msg);
|
|
||||||
Utils::printInfoMsg(msg.toUpper());
|
|
||||||
m_updateStep = UpdateDcEvent::UpdateStep::BL_IS_DOWN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} break;
|
|
||||||
case UpdateDcEvent::UpdateStep::BL_STOP: {
|
|
||||||
QString const &msg = QDateTime::currentDateTime().toString(Qt::ISODateWithMs)
|
|
||||||
+ QString(": stop bootloader (%1, delay=%2ms)").arg(pevent->count()).arg(delay);
|
|
||||||
emit m_worker->showStatusMessage("dc update", msg);
|
|
||||||
Utils::printInfoMsg(msg.toUpper());
|
|
||||||
//if (m_bootLoaderIsUp) {
|
|
||||||
m_hw->bl_stopBL();
|
|
||||||
m_updateStep = UpdateDcEvent::UpdateStep::BL_STOP;
|
|
||||||
//}
|
|
||||||
} break;
|
|
||||||
default: ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QThread::yieldCurrentThread();
|
QThread::yieldCurrentThread();
|
||||||
@ -312,13 +229,6 @@ void MainWindow::onEnableExit() {
|
|||||||
ui->exit->setEnabled(true);
|
ui->exit->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//bool MainWindow::eventFilter(QObject *obj, QEvent *ev) {
|
|
||||||
// if (obj == ui->updateStatus) {
|
|
||||||
// qCritical() << "REc. event for text edit" << ev->type();
|
|
||||||
// }
|
|
||||||
// return QMainWindow::eventFilter(obj, ev);
|
|
||||||
//}
|
|
||||||
|
|
||||||
void MainWindow::onRestartExitTimer() {
|
void MainWindow::onRestartExitTimer() {
|
||||||
m_exitTimer->stop();
|
m_exitTimer->stop();
|
||||||
m_exitTimer->start(60 * 1000);
|
m_exitTimer->start(60 * 1000);
|
||||||
|
@ -33,10 +33,6 @@ public:
|
|||||||
static const int BL_IS_UP_COUNT = 5;
|
static const int BL_IS_UP_COUNT = 5;
|
||||||
static const int BL_STOP_COUNT = 5;
|
static const int BL_STOP_COUNT = 5;
|
||||||
|
|
||||||
// int progressValue() const { return m_progressValue; }
|
|
||||||
//hwinf *getPlugin() { return m_hw; }
|
|
||||||
//hwinf const *getPlugin() const { return m_hw; }
|
|
||||||
|
|
||||||
UpdateDcEvent::UpdateStep updateStep() const { return m_updateStep; }
|
UpdateDcEvent::UpdateStep updateStep() const { return m_updateStep; }
|
||||||
void setUpdateStep(UpdateDcEvent::UpdateStep updateStep) { m_updateStep = updateStep; }
|
void setUpdateStep(UpdateDcEvent::UpdateStep updateStep) { m_updateStep = updateStep; }
|
||||||
|
|
||||||
@ -71,7 +67,6 @@ private:
|
|||||||
|
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
Worker *m_worker;
|
Worker *m_worker;
|
||||||
hwinf *m_hw = nullptr;
|
|
||||||
int const m_width;
|
int const m_width;
|
||||||
QTimer *m_startTimer;
|
QTimer *m_startTimer;
|
||||||
QTimer *m_exitTimer;
|
QTimer *m_exitTimer;
|
||||||
|
Loading…
Reference in New Issue
Block a user