mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-03-05 23:26:13 -05:00
clang-format: Apply formatting
Code submissions have continually suffered from formatting inconsistencies that constantly have to be addressed. Using clang-format simplifies this by making code formatting more consistent, and allows automation of the code formatting so that maintainers can focus more on the code itself instead of code formatting.
This commit is contained in:
@@ -28,9 +28,10 @@ struct AddSourceData {
|
||||
|
||||
bool OBSBasicSourceSelect::EnumSources(void *data, obs_source_t *source)
|
||||
{
|
||||
OBSBasicSourceSelect *window = static_cast<OBSBasicSourceSelect*>(data);
|
||||
OBSBasicSourceSelect *window =
|
||||
static_cast<OBSBasicSourceSelect *>(data);
|
||||
const char *name = obs_source_get_name(source);
|
||||
const char *id = obs_source_get_id(source);
|
||||
const char *id = obs_source_get_id(source);
|
||||
|
||||
if (strcmp(id, window->id) == 0)
|
||||
window->ui->sourceList->addItem(QT_UTF8(name));
|
||||
@@ -40,13 +41,14 @@ bool OBSBasicSourceSelect::EnumSources(void *data, obs_source_t *source)
|
||||
|
||||
bool OBSBasicSourceSelect::EnumGroups(void *data, obs_source_t *source)
|
||||
{
|
||||
OBSBasicSourceSelect *window = static_cast<OBSBasicSourceSelect*>(data);
|
||||
OBSBasicSourceSelect *window =
|
||||
static_cast<OBSBasicSourceSelect *>(data);
|
||||
const char *name = obs_source_get_name(source);
|
||||
const char *id = obs_source_get_id(source);
|
||||
const char *id = obs_source_get_id(source);
|
||||
|
||||
if (strcmp(id, window->id) == 0) {
|
||||
OBSBasic *main = reinterpret_cast<OBSBasic*>(
|
||||
App()->GetMainWindow());
|
||||
OBSBasic *main =
|
||||
reinterpret_cast<OBSBasic *>(App()->GetMainWindow());
|
||||
OBSScene scene = main->GetCurrentScene();
|
||||
|
||||
obs_sceneitem_t *existing = obs_scene_get_group(scene, name);
|
||||
@@ -59,25 +61,27 @@ bool OBSBasicSourceSelect::EnumGroups(void *data, obs_source_t *source)
|
||||
|
||||
void OBSBasicSourceSelect::OBSSourceAdded(void *data, calldata_t *calldata)
|
||||
{
|
||||
OBSBasicSourceSelect *window = static_cast<OBSBasicSourceSelect*>(data);
|
||||
obs_source_t *source = (obs_source_t*)calldata_ptr(calldata, "source");
|
||||
OBSBasicSourceSelect *window =
|
||||
static_cast<OBSBasicSourceSelect *>(data);
|
||||
obs_source_t *source = (obs_source_t *)calldata_ptr(calldata, "source");
|
||||
|
||||
QMetaObject::invokeMethod(window, "SourceAdded",
|
||||
Q_ARG(OBSSource, source));
|
||||
Q_ARG(OBSSource, source));
|
||||
}
|
||||
|
||||
void OBSBasicSourceSelect::OBSSourceRemoved(void *data, calldata_t *calldata)
|
||||
{
|
||||
OBSBasicSourceSelect *window = static_cast<OBSBasicSourceSelect*>(data);
|
||||
obs_source_t *source = (obs_source_t*)calldata_ptr(calldata, "source");
|
||||
OBSBasicSourceSelect *window =
|
||||
static_cast<OBSBasicSourceSelect *>(data);
|
||||
obs_source_t *source = (obs_source_t *)calldata_ptr(calldata, "source");
|
||||
|
||||
QMetaObject::invokeMethod(window, "SourceRemoved",
|
||||
Q_ARG(OBSSource, source));
|
||||
Q_ARG(OBSSource, source));
|
||||
}
|
||||
|
||||
void OBSBasicSourceSelect::SourceAdded(OBSSource source)
|
||||
{
|
||||
const char *name = obs_source_get_name(source);
|
||||
const char *name = obs_source_get_name(source);
|
||||
const char *sourceId = obs_source_get_id(source);
|
||||
|
||||
if (strcmp(sourceId, id) != 0)
|
||||
@@ -88,13 +92,13 @@ void OBSBasicSourceSelect::SourceAdded(OBSSource source)
|
||||
|
||||
void OBSBasicSourceSelect::SourceRemoved(OBSSource source)
|
||||
{
|
||||
const char *name = obs_source_get_name(source);
|
||||
const char *name = obs_source_get_name(source);
|
||||
const char *sourceId = obs_source_get_id(source);
|
||||
|
||||
if (strcmp(sourceId, id) != 0)
|
||||
return;
|
||||
|
||||
QList<QListWidgetItem*> items =
|
||||
QList<QListWidgetItem *> items =
|
||||
ui->sourceList->findItems(name, Qt::MatchFixedString);
|
||||
|
||||
if (!items.count())
|
||||
@@ -120,8 +124,8 @@ static char *get_new_source_name(const char *name)
|
||||
dstr_copy(&new_name, name);
|
||||
|
||||
for (;;) {
|
||||
obs_source_t *existing_source = obs_get_source_by_name(
|
||||
new_name.array);
|
||||
obs_source_t *existing_source =
|
||||
obs_get_source_by_name(new_name.array);
|
||||
if (!existing_source)
|
||||
break;
|
||||
|
||||
@@ -135,7 +139,7 @@ static char *get_new_source_name(const char *name)
|
||||
|
||||
static void AddExisting(const char *name, bool visible, bool duplicate)
|
||||
{
|
||||
OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow());
|
||||
OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow());
|
||||
OBSScene scene = main->GetCurrentScene();
|
||||
if (!scene)
|
||||
return;
|
||||
@@ -166,19 +170,18 @@ static void AddExisting(const char *name, bool visible, bool duplicate)
|
||||
}
|
||||
|
||||
bool AddNew(QWidget *parent, const char *id, const char *name,
|
||||
const bool visible, OBSSource &newSource)
|
||||
const bool visible, OBSSource &newSource)
|
||||
{
|
||||
OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow());
|
||||
OBSScene scene = main->GetCurrentScene();
|
||||
bool success = false;
|
||||
OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow());
|
||||
OBSScene scene = main->GetCurrentScene();
|
||||
bool success = false;
|
||||
if (!scene)
|
||||
return false;
|
||||
|
||||
obs_source_t *source = obs_get_source_by_name(name);
|
||||
if (source) {
|
||||
OBSMessageBox::information(parent,
|
||||
QTStr("NameExists.Title"),
|
||||
QTStr("NameExists.Text"));
|
||||
OBSMessageBox::information(parent, QTStr("NameExists.Title"),
|
||||
QTStr("NameExists.Text"));
|
||||
|
||||
} else {
|
||||
source = obs_source_create(id, name, NULL, nullptr);
|
||||
@@ -216,13 +219,13 @@ void OBSBasicSourceSelect::on_buttonBox_accepted()
|
||||
} else {
|
||||
if (ui->sourceName->text().isEmpty()) {
|
||||
OBSMessageBox::warning(this,
|
||||
QTStr("NoNameEntered.Title"),
|
||||
QTStr("NoNameEntered.Text"));
|
||||
QTStr("NoNameEntered.Title"),
|
||||
QTStr("NoNameEntered.Text"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!AddNew(this, id, QT_TO_UTF8(ui->sourceName->text()),
|
||||
visible, newSource))
|
||||
visible, newSource))
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -243,16 +246,13 @@ static inline const char *GetSourceDisplayName(const char *id)
|
||||
|
||||
Q_DECLARE_METATYPE(OBSScene);
|
||||
|
||||
template <typename T>
|
||||
static inline T GetOBSRef(QListWidgetItem *item)
|
||||
template<typename T> static inline T GetOBSRef(QListWidgetItem *item)
|
||||
{
|
||||
return item->data(static_cast<int>(QtDataRole::OBSRef)).value<T>();
|
||||
}
|
||||
|
||||
OBSBasicSourceSelect::OBSBasicSourceSelect(OBSBasic *parent, const char *id_)
|
||||
: QDialog (parent),
|
||||
ui (new Ui::OBSBasicSourceSelect),
|
||||
id (id_)
|
||||
: QDialog(parent), ui(new Ui::OBSBasicSourceSelect), id(id_)
|
||||
{
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
||||
@@ -271,14 +271,14 @@ OBSBasicSourceSelect::OBSBasicSourceSelect(OBSBasic *parent, const char *id_)
|
||||
}
|
||||
|
||||
ui->sourceName->setText(text);
|
||||
ui->sourceName->setFocus(); //Fixes deselect of text.
|
||||
ui->sourceName->setFocus(); //Fixes deselect of text.
|
||||
ui->sourceName->selectAll();
|
||||
|
||||
installEventFilter(CreateShortcutFilter());
|
||||
|
||||
if (strcmp(id_, "scene") == 0) {
|
||||
OBSBasic *main = reinterpret_cast<OBSBasic*>(
|
||||
App()->GetMainWindow());
|
||||
OBSBasic *main =
|
||||
reinterpret_cast<OBSBasic *>(App()->GetMainWindow());
|
||||
OBSSource curSceneSource = main->GetCurrentSceneSource();
|
||||
|
||||
ui->selectExisting->setChecked(true);
|
||||
|
||||
Reference in New Issue
Block a user