ATBUpdateTool/mainwindow.cpp

64 lines
2.8 KiB
C++

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "worker.h"
#include <QDateTime>
MainWindow::MainWindow(Worker *worker, QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
, m_worker(worker) {
ui->setupUi(this);
connect(ui->start, SIGNAL(clicked()), m_worker, SLOT(update()));
connect(ui->exit, SIGNAL(clicked()), qApp, SLOT(quit()));
int w = 52;
QStringList lst;
QString start = QDateTime::currentDateTime().toString(Qt::ISODate);
lst << QString("Start: ") + start.leftJustified(w-10);
lst << QString("").leftJustified(w-3, '=');
lst << QString("Machine number : %1 ").arg(996).leftJustified(w-3);
lst << QString("Customer number : %1 ").arg(281).leftJustified(w-3);
lst << QString("Zone number : %1 (%2)").arg(1).arg("yellow").leftJustified(w-3);
lst << QString("").leftJustified(w-3, '=');
lst << QString("Backend connected ").leftJustified(w-10) + " [ ok]";
lst << QString("Update trigger set ").leftJustified(w-10) + " [ ok]";
// lst << QString("Found ISMAS machine number : %1 ").arg(996).leftJustified(w-10) + " [done]";
// lst << QString("Found ISMAS customer number: %1 ").arg(281).leftJustified(w-10) + " [done]";
lst << QString("Prepare customer environment ").leftJustified(w-10) + " [done]";
lst << QString("Found %1 files to update ").arg(5).leftJustified(w-10) + " [done]";
lst << QString("(") + QString("%1").arg(1).rightJustified(2, ' ') + QString(")")
+ (QString(" Update ") + "DC2C_print01.json ").leftJustified(w-14) + " [done]";
lst << QString("(") + QString("%1").arg(2).rightJustified(2, ' ') + QString(")")
+ (QString(" Update ") + "DC2C_print01.json ").leftJustified(w-14) + " [done]";
lst << QString("(") + QString("%1").arg(3).rightJustified(2, ' ') + QString(")")
+ QString(" Update opkg pakets ").leftJustified(w-14) + " [done]";
lst << QString("(") + QString("%1").arg(4).rightJustified(2, ' ') + QString(")")
+ QString(" Update device controller %1 ").arg("04.38").leftJustified(w-14) + " [done]";
lst << QString("Sync customer environment with filesystem ").leftJustified(w-10) + " [done]";
lst << QString("(") + QString("%1").arg(5).rightJustified(2, ' ') + QString(")")
+ (QString(" Update ") + "tariff01.json ").leftJustified(w-14) + " [done]";
lst << QString("Send ISMAS notification ").leftJustified(w-10) + " [done]";
lst << QString("Save log file %1.log").arg(start).leftJustified(w-10) + " [done]";
lst << QString("").leftJustified(w-3, '=');
lst << QString("").leftJustified(w-13) + " [SUCCESS]";
ui->updateStatus->setText(lst.join('\n'));
ui->updateStatus->setEnabled(true);
}
MainWindow::~MainWindow() {
delete ui;
}
void MainWindow::onStartClicked() {
}
void MainWindow::onExitClicked() {
}