MCPcopy Create free account
hub / github.com/chrxh/alien / processResourceNameField

Method processResourceNameField

source/Gui/BrowserWindow.cpp:762–811  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

760}
761
762bool BrowserWindow::processResourceNameField(NetworkResourceTreeTO const& treeTO, std::set<std::vector<std::string>>& collapsedFolderNames)
763{
764 auto result = false;
765
766 if (treeTO->isLeaf()) {
767 auto& leaf = treeTO->getLeaf();
768
769 result |= processFolderTreeSymbols(treeTO, collapsedFolderNames);
770 processDownloadButton(leaf);
771 ImGui::SameLine();
772 if (_currentWorkspace.workspaceType == WorkspaceType_Private && leaf.rawTO->workspaceType == WorkspaceType_Public) {
773 AlienImGui::Text(ICON_FA_SHARE_ALT);
774 AlienImGui::Tooltip("Visible in the public workspace");
775 }
776 ImGui::SameLine();
777
778 if (!isOwner(treeTO) && _lastSessionData.isNew(leaf.rawTO)) {
779 auto font = StyleRepository::get().getSmallBoldFont();
780 auto origSize = font->Scale;
781 font->Scale *= 0.65f;
782 ImGui::PushFont(font);
783 ImGui::PushStyleColor(ImGuiCol_Text, Const::BrowserResourceNewTextColor.Value);
784 AlienImGui::Text("NEW");
785 ImGui::PopStyleColor();
786 font->Scale = origSize;
787 ImGui::PopFont();
788
789 ImGui::SameLine();
790 }
791
792 processShortenedText(leaf.leafName, true);
793 } else {
794 auto& folder = treeTO->getFolder();
795
796 result |= processFolderTreeSymbols(treeTO, collapsedFolderNames);
797 processShortenedText(treeTO->folderNames.back());
798 ImGui::SameLine();
799 ImGui::PushStyleColor(ImGuiCol_Text, (ImU32)Const::TextLightDecentColor);
800 std::string resourceTypeString = [&] {
801 if (treeTO->type == NetworkResourceType_Simulation) {
802 return folder.numLeafs == 1 ? "sim" : "sims";
803 } else {
804 return folder.numLeafs == 1 ? "genome" : "genomes";
805 }
806 }();
807 AlienImGui::Text("(" + std::to_string(folder.numLeafs) + " " + resourceTypeString + ")");
808 ImGui::PopStyleColor();
809 }
810 return result;
811}
812
813void BrowserWindow::processDescriptionField(NetworkResourceTreeTO const& treeTO)
814{

Callers

nothing calls this directly

Calls 4

to_stringFunction · 0.85
isLeafMethod · 0.80
isNewMethod · 0.80
getSmallBoldFontMethod · 0.80

Tested by

no test coverage detected