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 <QPainter>
#include <QPixmapCache> #include <QPixmapCache>
#include <QScreen> #include <QScreen>
#include <QStatusBar>
#include <QThread> #include <QThread>
#include <algorithm> #include <algorithm>
#include <qstatusbar.h>
#include <utility> #include <utility>
// never cache more than 300 cards at once for a single deck // never cache more than 300 cards at once for a single deck

View file

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

View file

@ -1,15 +1,11 @@
#ifndef PICTURE_LOADER_REQUEST_STATUS_DISPLAY_WIDGET_H #ifndef PICTURE_LOADER_REQUEST_STATUS_DISPLAY_WIDGET_H
#define 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 <QHBoxLayout>
#include <QLabel> #include <QLabel>
#include <QWidget> #include <QWidget>
struct PictureLoaderRequestStatus
{
};
class PictureLoaderRequestStatusDisplayWidget : public QWidget class PictureLoaderRequestStatusDisplayWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
@ -37,11 +33,12 @@ public:
int queryElapsedSeconds() int queryElapsedSeconds()
{ {
if (!finished) { if (!finished) {
int elapsedTime = QDateTime::fromString(startTime->text()).secsTo(QDateTime::currentDateTime());
elapsedTime->setText( elapsedTime->setText(
QString::number(QDateTime::fromString(startTime->text()).secsTo(QDateTime::currentDateTime()))); QString::number(elapsedTime));
update(); update();
repaint(); repaint();
return QDateTime::fromString(startTime->text()).secsTo(QDateTime::currentDateTime()); return elapsedTime;
} }
return elapsedTime->text().toInt(); return elapsedTime->text().toInt();
} }

View file

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