/*------------------------------------------------------------------------------ -- This file is a part of the QLop Software -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -------------------------------------------------------------------------------*/ /*-- Author : Alexis Jeandet -- Mail : alexis.jeandet@member.fsf.org ----------------------------------------------------------------------------*/ #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; } }