mirror of
https://github.com/Aitum/obs-aitum-multistream.git
synced 2024-11-22 02:12:40 +01:00
refactor outputButtonStyle
This commit is contained in:
parent
59aa58f4ac
commit
ea2a29925b
@ -106,13 +106,15 @@ void RemoveWidget(QWidget *widget)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Output button styling
|
// Output button styling
|
||||||
void outputButtonStyle(QPushButton *button)
|
void MultistreamDock::outputButtonStyle(QPushButton *button)
|
||||||
{
|
{
|
||||||
button->setMinimumHeight(24);
|
button->setMinimumHeight(24);
|
||||||
|
|
||||||
std::string baseStyles = "min-width: 30px; padding: 2px 10px; ";
|
std::string baseStyles = "min-width: 30px; padding: 2px 10px; ";
|
||||||
|
|
||||||
button->setStyleSheet(QString::fromUtf8(baseStyles + (button->isChecked() ? "background: rgb(0,210,153);" : "")));
|
button->setStyleSheet(QString::fromUtf8(baseStyles + (button->isChecked() ? "background: rgb(0,210,153);" : "")));
|
||||||
|
|
||||||
|
button->setIcon(button->isChecked() ? streamActiveIcon : streamInactiveIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Common styling things here
|
// Common styling things here
|
||||||
@ -184,9 +186,7 @@ MultistreamDock::MultistreamDock(QWidget *parent) : QFrame(parent)
|
|||||||
obs_frontend_streaming_start();
|
obs_frontend_streaming_start();
|
||||||
mainStreamButton->setChecked(true);
|
mainStreamButton->setChecked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
outputButtonStyle(mainStreamButton);
|
outputButtonStyle(mainStreamButton);
|
||||||
mainStreamButton->setIcon(mainStreamButton->isChecked() ? streamActiveIcon : streamInactiveIcon);
|
|
||||||
});
|
});
|
||||||
//streamButton->setSizePolicy(sp2);
|
//streamButton->setSizePolicy(sp2);
|
||||||
mainStreamButton->setToolTip(QString::fromUtf8(obs_module_text("Stream")));
|
mainStreamButton->setToolTip(QString::fromUtf8(obs_module_text("Stream")));
|
||||||
@ -289,14 +289,12 @@ void MultistreamDock::frontend_event(enum obs_frontend_event event, void *privat
|
|||||||
md->SaveSettings();
|
md->SaveSettings();
|
||||||
} else if (event == OBS_FRONTEND_EVENT_STREAMING_STARTING || event == OBS_FRONTEND_EVENT_STREAMING_STARTED) {
|
} else if (event == OBS_FRONTEND_EVENT_STREAMING_STARTING || event == OBS_FRONTEND_EVENT_STREAMING_STARTED) {
|
||||||
md->mainStreamButton->setChecked(true);
|
md->mainStreamButton->setChecked(true);
|
||||||
outputButtonStyle(md->mainStreamButton);
|
md->outputButtonStyle(md->mainStreamButton);
|
||||||
|
|
||||||
md->mainStreamButton->setIcon(md->streamActiveIcon);
|
md->mainStreamButton->setIcon(md->streamActiveIcon);
|
||||||
} else if (event == OBS_FRONTEND_EVENT_STREAMING_STOPPING || event == OBS_FRONTEND_EVENT_STREAMING_STOPPED) {
|
} else if (event == OBS_FRONTEND_EVENT_STREAMING_STOPPING || event == OBS_FRONTEND_EVENT_STREAMING_STOPPED) {
|
||||||
md->mainStreamButton->setChecked(false);
|
md->mainStreamButton->setChecked(false);
|
||||||
outputButtonStyle(md->mainStreamButton);
|
md->outputButtonStyle(md->mainStreamButton);
|
||||||
|
|
||||||
md->mainStreamButton->setIcon(md->streamInactiveIcon);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,7 +428,6 @@ void MultistreamDock::LoadOutput(obs_data_t *data, bool vertical)
|
|||||||
}
|
}
|
||||||
calldata_free(&cd);
|
calldata_free(&cd);
|
||||||
|
|
||||||
streamButton->setIcon(streamButton->isChecked() ? streamActiveIcon : streamInactiveIcon);
|
|
||||||
outputButtonStyle(streamButton);
|
outputButtonStyle(streamButton);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -447,8 +444,6 @@ void MultistreamDock::LoadOutput(obs_data_t *data, bool vertical)
|
|||||||
outputs.erase(it);
|
outputs.erase(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
streamButton->setIcon(streamButton->isChecked() ? streamActiveIcon : streamInactiveIcon);
|
|
||||||
outputButtonStyle(streamButton);
|
outputButtonStyle(streamButton);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,8 @@ private:
|
|||||||
|
|
||||||
bool StartOutput(obs_data_t *settings, QPushButton *streamButton);
|
bool StartOutput(obs_data_t *settings, QPushButton *streamButton);
|
||||||
|
|
||||||
|
void outputButtonStyle(QPushButton *button);
|
||||||
|
|
||||||
QIcon streamActiveIcon = QIcon(":/aitum/media/streaming.svg");
|
QIcon streamActiveIcon = QIcon(":/aitum/media/streaming.svg");
|
||||||
QIcon streamInactiveIcon = QIcon(":/aitum/media/stream.svg");
|
QIcon streamInactiveIcon = QIcon(":/aitum/media/stream.svg");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user