Skip to content

Commit a0af647

Browse files
UI Updates
1 parent d4153ee commit a0af647

11 files changed

+54
-52
lines changed

data/locale/en-US.ini

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ SetupWizard.GetStartedButton="Set up"
7979
SetupWizard.NewCollection="Create new"
8080
SetupWizard.MergeCollection="Merge with current"
8181
SetupWizard.StartInstallation.Description="First, let's name the scene collection and select your input devices"
82-
SetupWizard.MissingPlugins.Title="You're missing something"
83-
SetupWizard.MissingPlugins.Text="To continue, download the following free plugins, then restart OBS and try again"
82+
SetupWizard.MissingPlugins.Title.Plural="plugins are needed for this scene collection"
83+
SetupWizard.MissingPlugins.Title.Single="1 plugin is needed for this scene collection"
84+
SetupWizard.MissingPlugins.Text="Download and install the required plugins, then restart OBS and try again"
8485
SetupWizard.MissingPlugins.DownloadButton="Get"
8586
SetupWizard.SelectInstall.Title="How do you want to install this?"
8687
SetupWizard.SelectInstall.NewInstallButton="New"
@@ -120,14 +121,14 @@ SetupWizard.MergeSelectScenes.NoCustomMergeAvailable="This scene collection only
120121
SetupWizard.ThirdParty.DownloadButton="Get"
121122
SetupWizard.ThirdParty.Title="Required third party downloads."
122123
SetupWizard.ThirdParty.SubTitle="This scene collection requires a few third party downloads. Please ensure you have installed each of the items below to ensure this scene collections works properly on your OBS."
123-
SetupWizard.MissingSourceClone.Title="Source Clone Required"
124-
SetupWizard.MissingSourceClone.Description="The Source Clone plugin is required for merging scene collections. Please click 'Get' below, install the plugin, restart OBS, and try again."
124+
SetupWizard.MissingSourceClone.Title="Source Clone plugin is required to merge scene collections"
125+
SetupWizard.MissingSourceClone.Description="Download and install the plugin, then restart OBS Studio and try again"
125126
UpdateModal.Title="Update available"
126127
UpdateModal.SkipVersionButton="No thanks"
127128
UpdateModal.LaterButton="Ask me later"
128129
UpdateModal.DownloadUpdateButton="Update now"
129130
UpdateModal.Description="Get the latest version of Elgato Marketplace Connect to access new features and improvements"
130131
SceneCollectionInfo.WindowTitle="Scene Collection Info"
131-
SceneCollectionInfo.Title="Required Assets"
132-
SceneCollectionInfo.Text="This scene collection requires the following third party assets. Please click on the 'Get' button for each and ensure you have installed them all."
132+
SceneCollectionInfo.Title="Third party assets are required for this scene collection"
133+
SceneCollectionInfo.Text="Download and install the required assets, then restart OBS Studio to use this collection"
133134
SceneCollectionInfo.CloseButton="Close"

src/downloader.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ void Downloader::fillEntry(Downloader::Entry &dst,
419419
last.first - first.first)
420420
.count();
421421
auto bytesDownloaded = last.second - first.second;
422-
dst.speedBps = bytesDownloaded / interval;
422+
dst.speedBps = interval != 0 ? bytesDownloaded / interval : 0;
423423
}
424424
}
425425

@@ -434,6 +434,9 @@ void Downloader::Entry::Update()
434434

435435
void Downloader::Entry::Stop()
436436
{
437+
if (!parent) {
438+
return;
439+
}
437440
std::unique_lock l(parent->lock);
438441
auto dlentry = parent->queue.find(id);
439442
if (dlentry != parent->queue.end()) {
@@ -474,6 +477,9 @@ void Downloader::tryDelete(decltype(Downloader::queue)::iterator iter)
474477

475478
Downloader::Entry::~Entry()
476479
{
480+
if (!parent) {
481+
return;
482+
}
477483
std::unique_lock l(parent->lock);
478484
auto dlentry = parent->queue.find(id);
479485
if (dlentry != parent->queue.end()) {

src/downloader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class Downloader {
132132
public:
133133
struct Entry {
134134
size_t id;
135-
Downloader *parent;
135+
Downloader *parent = nullptr;
136136

137137
std::string fileName, url;
138138
uint64_t fileSize, downloaded, speedBps; // bytes per second

src/elgato-cloud-config.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ void SimpleVolumeMeter::calculateDisplayPeak(uint64_t ts)
443443
_displayPeak = _currentPeak;
444444
} else {
445445
float decay = deltaT * _decayRate;
446-
_displayPeak = std::max(_displayPeak - decay, _minMag);
446+
_displayPeak = (std::max)(_displayPeak - decay, _minMag);
447447
}
448448
}
449449

@@ -459,7 +459,7 @@ void SimpleVolumeMeter::paintEvent(QPaintEvent *event)
459459
float fwidth = static_cast<float>(width) * (_displayPeak - _minMag) /
460460
(-_minMag);
461461
int newWidth = static_cast<int>(fwidth);
462-
widgetRect.setWidth(std::min(width, newWidth));
462+
widgetRect.setWidth((std::min)(width, newWidth));
463463

464464
QPainter painter(this);
465465

@@ -775,8 +775,8 @@ void ElgatoCloudConfig::DrawVideoPreview(void *data, uint32_t cx, uint32_t cy)
775775
return;
776776

777777
uint32_t sourceCX =
778-
std::max(obs_source_get_width(window->_videoCaptureSource), 1u);
779-
uint32_t sourceCY = std::max(
778+
(std::max)(obs_source_get_width(window->_videoCaptureSource), 1u);
779+
uint32_t sourceCY = (std::max)(
780780
obs_source_get_height(window->_videoCaptureSource), 1u);
781781

782782
int x, y;

src/elgato-cloud-window.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,13 @@ void ProductThumbnail::setDownloading(bool downloading)
904904
_downloading = downloading;
905905
}
906906

907+
ProductThumbnail::~ProductThumbnail()
908+
{
909+
if (_downloading) {
910+
emit cancelDownloadClicked();
911+
}
912+
}
913+
907914
ElgatoProductItem::ElgatoProductItem(QWidget *parent, ElgatoProduct *product)
908915
: QWidget(parent),
909916
_product(product)

src/elgato-cloud-window.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ class ProductThumbnail : public QWidget {
130130

131131
public:
132132
ProductThumbnail(QWidget* parent, const QPixmap& pixmap);
133+
~ProductThumbnail();
133134
void setPixmap(const QPixmap& pixmap);
134135
inline void updateDownloadProgress(float progress) { _thumbnail->setProgress(progress); }
135136
void disable(bool disable);

src/elgato-product.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ with this program. If not, see <https://www.gnu.org/licenses/>
3939
#include "elgato-cloud-window.hpp"
4040
#include "util.h"
4141
#include "setup-wizard.hpp"
42-
#include "downloader.h"
42+
4343

4444
namespace elgatocloud {
4545

@@ -119,13 +119,16 @@ bool ElgatoProduct::DownloadProduct()
119119
os_mkdirs(savePath.c_str());
120120

121121
std::shared_ptr<Downloader> dl = Downloader::getInstance("");
122-
dl->Enqueue(url, savePath, ElgatoProduct::DownloadProgress, nullptr, this);
122+
auto download = dl->Enqueue(url, savePath, ElgatoProduct::DownloadProgress, nullptr, this);
123+
downloadId_ = download.id;
123124
return true;
124125
}
125126

126127
void ElgatoProduct::StopProductDownload()
127128
{
128-
129+
std::shared_ptr<Downloader> dl = Downloader::getInstance("");
130+
auto download = dl->Lookup(downloadId_);
131+
download.Stop();
129132
}
130133

131134
void ElgatoProduct::_downloadThumbnail()

src/elgato-product.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ with this program. If not, see <https://www.gnu.org/licenses/>
2222

2323
#include <nlohmann/json.hpp>
2424

25+
#include "downloader.h"
26+
2527
namespace elgatocloud {
2628

2729
class ElgatoProductItem;
@@ -61,6 +63,7 @@ class ElgatoProduct {
6163
bool _thumbnailReady;
6264
size_t _fileSize;
6365
ElgatoProductItem *_productItem = nullptr;
66+
size_t downloadId_;
6467
};
6568

6669
} // namespace elgatocloud

src/elgato-styles.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ namespace elgatocloud {
4848
"QListWidget::item {"
4949
"border: none;"
5050
"padding: 0px;"
51+
"font-size: 16px;"
5152
"background-color: #232323;"
5253
"border-radius: 8px;"
5354
"}"

src/scene-collection-info.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ ThirdPartyItem::ThirdPartyItem(std::string label,
3434
{
3535
auto layout = new QHBoxLayout(this);
3636
auto itemLabel = new QLabel(this);
37+
setStyleSheet("background-color: #232323;");
38+
3739
itemLabel->setText(label.c_str());
3840
itemLabel->setStyleSheet(EWizardFieldLabel);
3941
layout->addWidget(itemLabel);
@@ -62,15 +64,13 @@ SceneCollectionInfo::SceneCollectionInfo(std::vector<SceneCollectionLineItem> co
6264

6365
QLabel* title = new QLabel(this);
6466
title->setText(obs_module_text("SceneCollectionInfo.Title"));
65-
title->setAlignment(Qt::AlignCenter);
66-
title->setStyleSheet("QLabel {font-size: 14pt;}");
67+
title->setStyleSheet(EWizardStepTitle);
6768
layout->addWidget(title);
6869

6970
QLabel* subTitle = new QLabel(this);
7071
subTitle->setText(obs_module_text("SceneCollectionInfo.Text"));
71-
subTitle->setAlignment(Qt::AlignCenter);
7272
subTitle->setWordWrap(true);
73-
subTitle->setStyleSheet("QLabel {font-size: 12pt;}");
73+
subTitle->setStyleSheet(EWizardStepSubTitle);
7474
layout->addWidget(subTitle);
7575

7676
auto thirdPartyList = new QListWidget(this);

0 commit comments

Comments
 (0)