fix audo connection for sinks and add a try catch block for the file sorting
Some checks are pending
ContinuousDelivery / linux-ubuntu (push) Waiting to run
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Waiting to run
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Waiting to run
ContinuousDelivery / windows (push) Waiting to run
ContinuousDelivery / windows-asan (push) Waiting to run
ContinuousDelivery / release (push) Blocked by required conditions
ContinuousIntegration / linux (push) Waiting to run
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Waiting to run
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Waiting to run
ContinuousIntegration / macos (push) Waiting to run
ContinuousIntegration / windows (push) Waiting to run

This commit is contained in:
Green Sky 2024-09-29 18:24:34 +02:00
parent ce6febdc29
commit 28be54ac97
No known key found for this signature in database
3 changed files with 55 additions and 51 deletions

View File

@ -111,56 +111,60 @@ void FileSelector::render(void) {
} }
} }
// do sorting here try {
// TODO: cache the result (lol) // do sorting here
if (ImGuiTableSortSpecs* sorts_specs = ImGui::TableGetSortSpecs(); sorts_specs != nullptr && sorts_specs->SpecsCount >= 1) { // TODO: cache the result (lol)
switch (static_cast<SortID>(sorts_specs->Specs->ColumnUserID)) { if (ImGuiTableSortSpecs* sorts_specs = ImGui::TableGetSortSpecs(); sorts_specs != nullptr && sorts_specs->SpecsCount >= 1) {
break; case SortID::name: switch (static_cast<SortID>(sorts_specs->Specs->ColumnUserID)) {
if (sorts_specs->Specs->SortDirection == ImGuiSortDirection_Descending) { break; case SortID::name:
std::sort(dirs.begin(), dirs.end(), [](const auto& a, const auto& b) -> bool { if (sorts_specs->Specs->SortDirection == ImGuiSortDirection_Descending) {
return a.path() < b.path(); std::sort(dirs.begin(), dirs.end(), [](const auto& a, const auto& b) -> bool {
}); return a.path() < b.path();
std::sort(files.begin(), files.end(), [](const auto& a, const auto& b) -> bool { });
return a.path().filename() < b.path().filename(); std::sort(files.begin(), files.end(), [](const auto& a, const auto& b) -> bool {
}); return a.path().filename() < b.path().filename();
} else { });
std::sort(dirs.begin(), dirs.end(), [](const auto& a, const auto& b) -> bool { } else {
return a.path() > b.path(); std::sort(dirs.begin(), dirs.end(), [](const auto& a, const auto& b) -> bool {
}); return a.path() > b.path();
std::sort(files.begin(), files.end(), [](const auto& a, const auto& b) -> bool { });
return a.path().filename() > b.path().filename(); std::sort(files.begin(), files.end(), [](const auto& a, const auto& b) -> bool {
}); return a.path().filename() > b.path().filename();
} });
break; case SortID::size: }
if (sorts_specs->Specs->SortDirection == ImGuiSortDirection_Descending) { break; case SortID::size:
// TODO: sort dirs? if (sorts_specs->Specs->SortDirection == ImGuiSortDirection_Descending) {
std::sort(files.begin(), files.end(), [](const auto& a, const auto& b) -> bool { // TODO: sort dirs?
return a.file_size() < b.file_size(); std::sort(files.begin(), files.end(), [](const auto& a, const auto& b) -> bool {
}); return a.file_size() < b.file_size();
} else { });
// TODO: sort dirs? } else {
std::sort(files.begin(), files.end(), [](const auto& a, const auto& b) -> bool { // TODO: sort dirs?
return a.file_size() > b.file_size(); std::sort(files.begin(), files.end(), [](const auto& a, const auto& b) -> bool {
}); return a.file_size() > b.file_size();
} });
break; case SortID::date: }
if (sorts_specs->Specs->SortDirection == ImGuiSortDirection_Descending) { break; case SortID::date:
std::sort(dirs.begin(), dirs.end(), [](const auto& a, const auto& b) -> bool { if (sorts_specs->Specs->SortDirection == ImGuiSortDirection_Descending) {
return a.last_write_time() < b.last_write_time(); std::sort(dirs.begin(), dirs.end(), [](const auto& a, const auto& b) -> bool {
}); return a.last_write_time() < b.last_write_time();
std::sort(files.begin(), files.end(), [](const auto& a, const auto& b) -> bool { });
return a.last_write_time() < b.last_write_time(); std::sort(files.begin(), files.end(), [](const auto& a, const auto& b) -> bool {
}); return a.last_write_time() < b.last_write_time();
} else { });
std::sort(dirs.begin(), dirs.end(), [](const auto& a, const auto& b) -> bool { } else {
return a.last_write_time() > b.last_write_time(); std::sort(dirs.begin(), dirs.end(), [](const auto& a, const auto& b) -> bool {
}); return a.last_write_time() > b.last_write_time();
std::sort(files.begin(), files.end(), [](const auto& a, const auto& b) -> bool { });
return a.last_write_time() > b.last_write_time(); std::sort(files.begin(), files.end(), [](const auto& a, const auto& b) -> bool {
}); return a.last_write_time() > b.last_write_time();
} });
break; default: ; }
break; default: ;
}
} }
} catch (...) {
// we likely saw a file disapear
} }
for (auto const& dir_entry : dirs) { for (auto const& dir_entry : dirs) {

View File

@ -168,7 +168,7 @@ bool StreamManager::onEvent(const ObjectStore::Events::ObjectConstruct& e) {
auto it_d_src = _default_sources.find(e.e.get<Components::StreamSink>().frame_type_name); auto it_d_src = _default_sources.find(e.e.get<Components::StreamSink>().frame_type_name);
if (it_d_src != _default_sources.cend()) { if (it_d_src != _default_sources.cend()) {
// TODO: threaded // TODO: threaded
connect(e.e, it_d_src->second); connect(it_d_src->second, e.e);
} }
} }
} }

View File

@ -126,7 +126,7 @@ void StreamManagerUI::render(void) {
if (_os.registry().all_of<Components::TagDefaultTarget>(oc)) { if (_os.registry().all_of<Components::TagDefaultTarget>(oc)) {
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg1, ImGui::GetColorU32(ImVec4{0.6f, 0.f, 0.6f, 0.25f})); ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg1, ImGui::GetColorU32(ImVec4{0.6f, 0.f, 0.6f, 0.25f}));
} else if (_os.registry().all_of<Components::TagDefaultTarget>(oc)) { } else if (_os.registry().all_of<Components::TagConnectToDefault>(oc)) {
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg1, ImGui::GetColorU32(ImVec4{0.6f, 0.6f, 0.f, 0.25f})); ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg1, ImGui::GetColorU32(ImVec4{0.6f, 0.6f, 0.f, 0.25f}));
} }