Skip to content

Commit

Permalink
Merge pull request #42 from OPENSPHERE-Inc/patch-0.9.15
Browse files Browse the repository at this point in the history
0.9.15
  • Loading branch information
hanatyan128 authored Dec 10, 2024
2 parents b883f8d + 82a386c commit 0aa2633
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 13 deletions.
2 changes: 1 addition & 1 deletion buildspec.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
},
"name": "osi-branch-output",
"displayName": "Branch Output Plugin",
"version": "0.9.14",
"version": "0.9.15",
"author": "OPENSPHERE Inc.",
"website": "https://opensphere.co.jp/",
"email": "[email protected]",
Expand Down
22 changes: 12 additions & 10 deletions src/UI/output-status-dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ void BranchOutputStatusDock::addFilter(BranchOutputFilter *filter)

auto resetButton = new QPushButton(QTStr("Reset"), this);
connect(resetButton, &QPushButton::clicked, [this, row]() { outputTableRows[row]->reset(); });
resetButton->setProperty("toolButton", true);
resetButton->setProperty("toolButton", true); // Until OBS 30
resetButton->setProperty("class", "btn-tool"); // Since OBS 31
resetButton->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);

resetButtonContainerLayout->addWidget(resetButton);
Expand Down Expand Up @@ -309,27 +310,27 @@ void OutputTableRow::update()

if (reconnecting) {
status->setText(QTStr("Status.Reconnecting"));
status->setTheme("error");
status->setTheme("error", "text-danger");
status->setIconShow(false);
} else {
status->setText(QTStr("Status.Live"));
status->setTheme("good");
status->setTheme("good", "text-success");
status->setIconShow(true);
}
} else {
status->setText(QTStr("Status.Inactive"));
status->setTheme("");
status->setTheme("", "");
status->setIconShow(false);
}

// Recording display
if (filter->recordingOutput && obs_output_active(filter->recordingOutput)) {
recording->setText(QTStr("Status.Recording"));
recording->setTheme("good");
recording->setTheme("good", "text-success");
recording->setIconShow(true);
} else {
recording->setText(QTStr("Status.Inactive"));
recording->setTheme("");
recording->setTheme("", "");
recording->setIconShow(false);
}

Expand Down Expand Up @@ -369,11 +370,11 @@ void OutputTableRow::update()
droppedFrames->setText(dropFramesStr);

if (num > 5.0l) {
setThemeID(droppedFrames, "error");
setThemeID(droppedFrames, "error", "text-danger");
} else if (num > 1.0l) {
setThemeID(droppedFrames, "warning");
setThemeID(droppedFrames, "warning", "text-warning");
} else {
setThemeID(droppedFrames, "");
setThemeID(droppedFrames, "", "");
}

lastBytesSent = bytesSent;
Expand Down Expand Up @@ -401,7 +402,8 @@ FilterCell::FilterCell(const QString &text, obs_source_t *source, QWidget *paren
setMinimumHeight(27);

visibilityCheckbox = new QCheckBox(this);
visibilityCheckbox->setProperty("visibilityCheckBox", true);
visibilityCheckbox->setProperty("visibilityCheckBox", true); // Until OBS 30
visibilityCheckbox->setProperty("class", "indicator-visibility"); // Since OBS 31
visibilityCheckbox->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
visibilityCheckbox->setChecked(obs_source_enabled(source));
visibilityCheckbox->setCursor(Qt::PointingHandCursor);
Expand Down
2 changes: 1 addition & 1 deletion src/UI/output-status-dock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class StatusCell : public QWidget {
inline void setText(const QString &text) { statusText->setText(text); };
inline void setIcon(const QPixmap &pixmap) { icon->setPixmap(pixmap); };
inline void setIconShow(bool show) { icon->setVisible(show); };
inline void setTheme(const QString &id) { setThemeID(statusText, id); };
inline void setTheme(const QString &id, const QString &classes) { setThemeID(statusText, id, classes); };
};

class BranchOutputStatusDock : public QFrame {
Expand Down
13 changes: 12 additions & 1 deletion src/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,22 @@ inline void pthreadMutexUnlock(pthread_mutex_t *mutex)
using OBSMutexAutoUnlock = OBSPtr<pthread_mutex_t *, pthreadMutexUnlock>;

// Imitate UI/window-basic-stats.cpp
inline void setThemeID(QWidget *widget, const QString &themeID)
// themeID: until OBS 30
// themeClasses: since OBS 31
inline void setThemeID(QWidget *widget, const QString &themeID, const QString &themeClasses)
{
bool changed = false;
if (widget->property("themeID").toString() != themeID) {
widget->setProperty("themeID", themeID);
changed = true;
}

if (widget->property("class").toString() != themeClasses) {
widget->setProperty("class", themeClasses);
changed = true;
}

if (changed) {
/* force style sheet recalculation */
QString qss = widget->styleSheet();
widget->setStyleSheet("/* */");
Expand Down

0 comments on commit 0aa2633

Please sign in to comment.