Skip to content

Commit da3cc53

Browse files
Adds restart message when user turns on/off maker tools. (#8)
1 parent 2c3ee78 commit da3cc53

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

src/elgato-cloud-config.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,10 +547,21 @@ ElgatoCloudConfig::ElgatoCloudConfig(QWidget *parent) : QDialog(parent)
547547
QString checkBoxStyle = ECheckBoxStyle;
548548
checkBoxStyle.replace("${checked-img}", checkedImage.c_str());
549549
checkBoxStyle.replace("${unchecked-img}", uncheckedImage.c_str());
550-
551550
_makerCheckbox->setStyleSheet(checkBoxStyle);
552551
layout->addWidget(_makerCheckbox);
553552

553+
connect(_makerCheckbox, &QCheckBox::stateChanged, [this](int state) {
554+
bool makerTools = state == Qt::Checked;
555+
_makerRestartMsg->setVisible(makerTools != elgatoCloud->MakerToolsOnStart());
556+
});
557+
558+
std::string restartTxt = elgatoCloud->MakerToolsOnStart() ? "Maker tools will be disabled after restarting OBS." : "Maker tools will be enabled after restarting OBS.";
559+
_makerRestartMsg = new QLabel(restartTxt.c_str(), this);
560+
_makerRestartMsg->setVisible(false);
561+
_makerRestartMsg->setStyleSheet(
562+
"QLabel {color: #FFFFFF; padding: 8px 16px 0px 16px; font-size: 12pt; font-style: italic; }");
563+
_makerRestartMsg->setAlignment(Qt::AlignCenter);
564+
layout->addWidget(_makerRestartMsg);
554565
layout->addStretch();
555566

556567
std::string version = "v";

src/elgato-cloud-config.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ class ElgatoCloudConfig : public QDialog {
133133
obs_volmeter_t *_volmeter = nullptr;
134134
OBSQTDisplay *_videoPreview = nullptr;
135135
QCheckBox *_makerCheckbox = nullptr;
136+
QLabel* _makerRestartMsg = nullptr;
136137
std::string _installDirectory;
137138

138139
signals:

src/elgato-cloud-data.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,9 @@ void ElgatoCloud::_Listen()
201201
void ElgatoCloud::_Initialize()
202202
{
203203
_config = get_module_config();
204+
bool makerTools = obs_data_get_bool(_config, "MakerTools");
205+
_makerToolsOnStart = makerTools;
206+
204207
_GetSavedState();
205208

206209
const auto now = std::chrono::system_clock::now();
@@ -277,8 +280,9 @@ void ElgatoCloud::LoadPurchasedProducts()
277280
auto api = MarketplaceApi::getInstance();
278281
std::string api_url = api->gatewayUrl();
279282
api_url +=
280-
"/my-products?extension=scene-collections&offset=0&limit=100";
283+
"/my-products?extension=overlays&offset=0&limit=100";
281284
auto productsResponse = fetch_string_from_get(api_url, _accessToken);
285+
obs_log(LOG_INFO, "url: %s", api_url.c_str());
282286
obs_log(LOG_INFO, "Products: %s", productsResponse.c_str());
283287
products.clear();
284288
try {

src/elgato-cloud-data.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class ElgatoCloud {
6565
void Thread();
6666
bool mainWindowOpen = false;
6767
ElgatoCloudWindow *window = nullptr;
68+
inline bool MakerToolsOnStart() const { return _makerToolsOnStart; }
6869

6970
private:
7071
void _Initialize();
@@ -86,6 +87,7 @@ class ElgatoCloud {
8687
int64_t _accessTokenExpiration;
8788
int64_t _refreshTokenExpiration;
8889
obs_data_t *_config;
90+
bool _makerToolsOnStart;
8991
};
9092

9193
class ElgatoCloudThread : public QThread {

0 commit comments

Comments
 (0)