Skip to content

Commit

Permalink
Code cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
FiniteSingularity committed Oct 7, 2024
1 parent 8cb15ca commit 1e2b874
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
18 changes: 9 additions & 9 deletions src/quick-access-dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,10 @@ void QuickAccessDock::DrawDock(obs_data_t *obsData)

const auto d = static_cast<QDockWidget *>(parentWidget());

const auto floating = obs_data_get_bool(obsData, "dock_floating");
if (d->isFloating() != floating) {
d->setFloating(floating);
if (obs_data_get_bool(obsData, "dock_hidden")) {
d->hide();
} else {
d->show();
}

const auto area = static_cast<Qt::DockWidgetArea>(
Expand All @@ -244,17 +245,16 @@ void QuickAccessDock::DrawDock(obs_data_t *obsData)
mainWindow->addDockWidget(area, d);
}

const auto floating = obs_data_get_bool(obsData, "dock_floating");
if (d->isFloating() != floating) {
d->setFloating(floating);
}

const char *geometry = obs_data_get_string(obsData, "dock_geometry");
if (geometry && strlen(geometry)) {
d->restoreGeometry(
QByteArray::fromBase64(QByteArray(geometry)));
}

if (obs_data_get_bool(obsData, "dock_hidden")) {
d->hide();
} else {
d->show();
}
}

void QuickAccessDock::Save(obs_data_t *obsData)
Expand Down
16 changes: 7 additions & 9 deletions src/quick-access-utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ void QuickAccessUtility::Load(obs_data_t *data)
_firstRun = obs_data_get_bool(qauData, "first_run");
_dockSettings = obs_data_get_array(qauData, "docks");

_SetupDocks();

auto quickSearchHotkey =
obs_data_get_array(qauData, "quick_search_hotkey");
obs_hotkey_load(_quick_search_hotkey_id, quickSearchHotkey);
Expand All @@ -195,7 +197,7 @@ void QuickAccessUtility::Load(obs_data_t *data)

void QuickAccessUtility::_SetupDocks()
{
std::unique_lock lock(_m);
//std::unique_lock lock(_m);

// Add Scenes and sources to _allSources
obs_enum_all_sources(QuickAccessUtility::AddSource, qau);
Expand Down Expand Up @@ -362,7 +364,7 @@ void QuickAccessUtility::FrontendCallback(enum obs_frontend_event event,
blog(LOG_INFO,
"======== OBS_FRONTEND_EVENT_FINISHED_LOADING called.");
qau->_sceneCollectionChanging = false;
qau->_SetupDocks();
//qau->_SetupDocks();
qau->_SetupSignals();
qau->SceneChanged();
} else if (event == OBS_FRONTEND_EVENT_SCENE_COLLECTION_CLEANUP) {
Expand All @@ -378,7 +380,7 @@ void QuickAccessUtility::FrontendCallback(enum obs_frontend_event event,
blog(LOG_INFO,
"======== OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGED called.");
qau->_sceneCollectionChanging = false;
qau->_SetupDocks();
//qau->_SetupDocks();
qau->_SetupSignals();
qau->InitializeSearch();
qau->SceneChanged();
Expand Down Expand Up @@ -597,13 +599,9 @@ bool QuickAccessUtility::AddSource(void *data, obs_source_t *source)
UNUSED_PARAMETER(data);

bool priv = obs_obj_is_private(source);

if (priv) {
return true;
}

obs_source_type st = obs_source_get_type(source);
if (st == OBS_SOURCE_TYPE_FILTER || st == OBS_SOURCE_TYPE_TRANSITION) {
if (priv || st == OBS_SOURCE_TYPE_FILTER ||
st == OBS_SOURCE_TYPE_TRANSITION) {
return true;
}

Expand Down

0 comments on commit 1e2b874

Please sign in to comment.