Address comments.

This commit is contained in:
Lukas Brübach 2025-06-11 23:52:10 +02:00
parent 35eb98eb3b
commit 895f51b6a4
4 changed files with 25 additions and 25 deletions

View file

@ -14,9 +14,9 @@
#include <QPainter>
#include <QPixmapCache>
#include <QScreen>
#include <QStatusBar>
#include <QThread>
#include <algorithm>
#include <qstatusbar.h>
#include <utility>
// never cache more than 300 cards at once for a single deck

View file

@ -7,24 +7,24 @@ PictureLoaderRequestStatusDisplayWidget::PictureLoaderRequestStatusDisplayWidget
{
layout = new QHBoxLayout(this);
name = new QLabel(this);
name->setText(worker->cardToDownload.getCard()->getName());
setShortname = new QLabel(this);
setShortname->setText(worker->cardToDownload.getSetName());
providerId = new QLabel(this);
providerId->setText(worker->cardToDownload.getCard()->getProperty("uuid"));
startTime = new QLabel(this);
startTime->setText(QDateTime::currentDateTime().toString());
elapsedTime = new QLabel(this);
elapsedTime->setText("0");
finished = new QLabel(this);
finished->setText("False");
url = new QLabel(this);
url->setText(_url.toString());
if (worker->cardToDownload.getCard()) {
name = new QLabel(this);
name->setText(worker->cardToDownload.getCard()->getName());
setShortname = new QLabel(this);
setShortname->setText(worker->cardToDownload.getSetName());
providerId = new QLabel(this);
providerId->setText(worker->cardToDownload.getCard()->getProperty("uuid"));
layout->addWidget(name);
layout->addWidget(setShortname);
layout->addWidget(providerId);
}
startTime = new QLabel(QDateTime::currentDateTime().toString(), this);
elapsedTime = new QLabel("0", this);
finished = new QLabel("False", this);
url = new QLabel(_url.toString(), this);
layout->addWidget(name);
layout->addWidget(setShortname);
layout->addWidget(providerId);
layout->addWidget(startTime);
layout->addWidget(elapsedTime);
layout->addWidget(finished);

View file

@ -1,15 +1,11 @@
#ifndef PICTURE_LOADER_REQUEST_STATUS_DISPLAY_WIDGET_H
#define PICTURE_LOADER_REQUEST_STATUS_DISPLAY_WIDGET_H
#include "../../../../../../../../../../mnt/games-hdd/coding/CLionProjects/Cockatrice/cockatrice/src/client/ui/picture_loader/picture_loader_worker_work.h"
#include "picture_loader_worker_work.h"
#include <QHBoxLayout>
#include <QLabel>
#include <QWidget>
struct PictureLoaderRequestStatus
{
};
class PictureLoaderRequestStatusDisplayWidget : public QWidget
{
Q_OBJECT
@ -37,11 +33,12 @@ public:
int queryElapsedSeconds()
{
if (!finished) {
int elapsedTime = QDateTime::fromString(startTime->text()).secsTo(QDateTime::currentDateTime());
elapsedTime->setText(
QString::number(QDateTime::fromString(startTime->text()).secsTo(QDateTime::currentDateTime())));
QString::number(elapsedTime));
update();
repaint();
return QDateTime::fromString(startTime->text()).secsTo(QDateTime::currentDateTime());
return elapsedTime;
}
return elapsedTime->text().toInt();
}

View file

@ -23,6 +23,9 @@ PictureLoaderStatusBar::PictureLoaderStatusBar(QWidget *parent) : QWidget(parent
void PictureLoaderStatusBar::cleanOldEntries()
{
if (!loadLog || !loadLog->popup) {
return;
}
for (PictureLoaderRequestStatusDisplayWidget *statusDisplayWidget :
loadLog->popup->findChildren<PictureLoaderRequestStatusDisplayWidget *>()) {
statusDisplayWidget->queryElapsedSeconds();