#include "downloadhistoryelement.h" #include "ui_downloadhistoryelement.h" DownloadHistoryElement::DownloadHistoryElement(FileDownloaderTask *task, QWidget *parent) : QWidget(parent), ui(new Ui::DownloadHistoryElement) { ui->setupUi(this); if(task) { this->associatedTask=task; this->ui->DownloadDate->setText(task->startDateTime().toString("yyyy:MM:dd-hh:mm:ss")); this->ui->FileNameLbl->setText(task->fileName()); this->ui->linkLbl->setText(task->url()); connect(associatedTask,SIGNAL(updateProgress(int)),this,SLOT(updateProgress(int))); } /*this->setStyleSheet("QWidget#DownloadHistoryElement{\ border: 1px solid gray;\ border-radius: 9px;\ margin-top: 0.5em; \ }");*/ } DownloadHistoryElement::~DownloadHistoryElement() { delete ui; } void DownloadHistoryElement::updateProgress(int percent) { this->ui->progressBar->setValue(percent); } void DownloadHistoryElement::changeEvent(QEvent *e) { QWidget::changeEvent(e); switch (e->type()) { case QEvent::LanguageChange: ui->retranslateUi(this); break; default: break; } }