Skip to content

Commit 8e8a6bd

Browse files
Fixes avatar and product thumbnail loading bugs.
1 parent 7812224 commit 8e8a6bd

File tree

4 files changed

+48
-5
lines changed

4 files changed

+48
-5
lines changed

src/elgato-cloud-window.cpp

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,15 @@ void ProductGrid::enableDownload()
409409
}
410410
}
411411

412+
void ProductGrid::resetDownloads()
413+
{
414+
for (int i = 0; i < layout()->count(); ++i) {
415+
auto item = dynamic_cast<ElgatoProductItem*>(
416+
layout()->itemAt(i)->widget());
417+
item->resetDownload();
418+
}
419+
}
420+
412421
void ProductGrid::closing() {
413422
for (int i = 0; i < layout()->count(); ++i) {
414423
auto item = dynamic_cast<ElgatoProductItem*>(
@@ -531,6 +540,11 @@ void OwnedProducts::closing()
531540
_purchased->closing();
532541
}
533542

543+
void OwnedProducts::resetDownloads()
544+
{
545+
_purchased->resetDownloads();
546+
}
547+
534548
ElgatoCloudWindow::ElgatoCloudWindow(QWidget *parent) : QDialog(parent)
535549
//ui(new Ui_ElgatoCloudWindow)
536550
{
@@ -608,7 +622,14 @@ void ElgatoCloudWindow::initialize()
608622
_layout->addWidget(_mainWidget);
609623

610624
setLayout(_layout);
611-
setFixedSize(970, 520);
625+
setFixedSize(978, 520);
626+
}
627+
628+
void ElgatoCloudWindow::resetDownloads()
629+
{
630+
if (_ownedProducts) {
631+
_ownedProducts->resetDownloads();
632+
}
612633
}
613634

614635
void ElgatoCloudWindow::setLoading()
@@ -874,7 +895,7 @@ void ProductThumbnail::updateButton_()
874895

875896
void ProductThumbnail::setPixmap(const QPixmap& pixmap)
876897
{
877-
_thumbnail->setPixmap(pixmap);
898+
_thumbnail->setCustomPixmap(pixmap);
878899
}
879900

880901
bool ProductThumbnail::event(QEvent* e)
@@ -992,6 +1013,10 @@ ElgatoProductItem::ElgatoProductItem(QWidget *parent, ElgatoProduct *product)
9921013
p->enableDownload();
9931014
resetDownload();
9941015
}
1016+
else {
1017+
p->enableDownload();
1018+
resetDownload();
1019+
}
9951020
});
9961021

9971022
connect(_labelImg, &ProductThumbnail::cancelDownloadClicked, [this]() {
@@ -1049,6 +1074,7 @@ void ElgatoProductItem::updateImage()
10491074
: imageBaseDir + "image-loading.svg";
10501075
QPixmap image = _setupImage(imagePath);
10511076
_labelImg->setPixmap(image);
1077+
_labelImg->update();
10521078
}
10531079

10541080
QPixmap ElgatoProductItem::_setupImage(std::string imagePath)

src/elgato-cloud-window.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ class ProductGrid : public QWidget {
206206
size_t loadProducts();
207207
void disableDownload(ElgatoProductItem* skip = nullptr);
208208
void enableDownload();
209+
void resetDownloads();
209210
void closing();
210211

211212
private:
@@ -230,6 +231,7 @@ class OwnedProducts : public QWidget {
230231

231232
void refreshProducts();
232233
void closing();
234+
void resetDownloads();
233235

234236
private:
235237
QHBoxLayout *_layout = nullptr;
@@ -286,6 +288,7 @@ class ElgatoCloudWindow : public QDialog {
286288
void setLoggedIn();
287289
void setLoading();
288290
void setupOwnedProducts();
291+
void resetDownloads();
289292

290293
static ElgatoCloudWindow *window;
291294

src/export-wizard.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,9 @@ FileCollectionCheck::FileCollectionCheck(std::string name,
345345
form->addWidget(fileList);
346346
} else {
347347
form->addStretch();
348-
replace_all(titleLookup, "{COUNT}", std::to_string(0));
349-
title->setText(titleLookup.c_str());
348+
std::string titleText = obs_module_text(titleLookup.c_str());
349+
replace_all(titleText, "{COUNT}", std::to_string(0));
350+
title->setText(titleText.c_str());
350351
title->setStyleSheet(EWizardStepTitle);
351352
title->setAlignment(Qt::AlignCenter);
352353

src/setup-wizard.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ with this program. If not, see <https://www.gnu.org/licenses/>
4242
#include <plugin-support.h>
4343
#include "setup-wizard.hpp"
4444
#include "elgato-product.hpp"
45+
#include "elgato-cloud-window.hpp"
4546
#include "scene-bundle.hpp"
4647
#include "obs-utils.hpp"
4748
#include "util.h"
@@ -983,7 +984,7 @@ StreamPackageSetupWizard::StreamPackageSetupWizard(QWidget *parent,
983984
StreamPackageSetupWizard::~StreamPackageSetupWizard()
984985
{
985986
if (!_installStarted) { // We've not yet handed control over
986-
// too install routine.
987+
// to install routine.
987988
if (_deleteOnClose) {
988989
// Delete the scene collection file
989990
os_unlink(_filename.c_str());
@@ -993,6 +994,10 @@ StreamPackageSetupWizard::~StreamPackageSetupWizard()
993994
EnableVideoCaptureSourcesActive,
994995
this);
995996
}
997+
auto elgatoCloudWindow = GetElgatoCloudWindow();
998+
if (elgatoCloudWindow) {
999+
elgatoCloudWindow->resetDownloads();
1000+
}
9961001
setupWizard = nullptr;
9971002
}
9981003

@@ -1055,6 +1060,14 @@ void StreamPackageSetupWizard::OpenArchive()
10551060
}
10561061
}
10571062

1063+
// In case the setup wizard was closed while the
1064+
// archive was being extracted, stop execution before
1065+
// anything is called on the now null setupWizard pointer.
1066+
auto setupWizard = GetSetupWizard();
1067+
if (!setupWizard) {
1068+
return;
1069+
}
1070+
10581071
// Disable all video capture sources so that single-thread
10591072
// capture sources, such as the Elgato Facecam, can be properly
10601073
// selected in the wizard. Will re-enable any disabled sources

0 commit comments

Comments
 (0)