MCPcopy Create free account
hub / github.com/XorTroll/Goldleaf / OnFileSelected

Method OnFileSelected

Goldleaf/source/ui/ui_BrowserLayout.cpp:101–470  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99 }
100
101 void BrowserLayout::OnFileSelected(const std::string &item, const std::string &full_item, const std::string &pres_full_item) {
102 const auto ext = LowerCaseString(fs::GetExtension(item));
103 const auto item_size = this->cur_exp->GetFileSize(full_item);
104 std::string icon_path = "";
105 auto msg = cfg::Strings.GetString(52) + " ";
106 if(ext == "nsp") {
107 msg += cfg::Strings.GetString(53);
108 }
109 else if(ext == "nro") {
110 msg += cfg::Strings.GetString(54);
111 }
112 else if(ext == "tik") {
113 msg += cfg::Strings.GetString(55);
114 }
115 else if(ext == "nca") {
116 msg += cfg::Strings.GetString(57);
117 }
118 else if(ext == "nacp") {
119 msg += cfg::Strings.GetString(58);
120 }
121 else if((ext == "jpg") || (ext == "jpeg") || (ext == "png") || (ext == "webp")) {
122 msg += cfg::Strings.GetString(59);
123 icon_path = full_item;
124 }
125 else {
126 msg += cfg::Strings.GetString(270);
127 }
128 msg += "\n\n" + cfg::Strings.GetString(64) + " " + fs::FormatSize(this->cur_exp->GetFileSize(full_item));
129 const auto is_bin = this->cur_exp->IsFileBinary(full_item);
130 std::vector<std::string> dialog_opts;
131 u32 option_count = 5;
132 if(ext == "nsp") {
133 dialog_opts.push_back(cfg::Strings.GetString(65));
134 option_count++;
135 }
136 else if(ext == "nro") {
137 dialog_opts.push_back(cfg::Strings.GetString(66));
138 option_count++;
139 dialog_opts.push_back(cfg::Strings.GetString(453));
140 option_count++;
141 }
142 else if(ext == "tik") {
143 dialog_opts.push_back(cfg::Strings.GetString(67));
144 option_count++;
145 }
146 else if(ext == "nacp") {
147 dialog_opts.push_back(cfg::Strings.GetString(69));
148 option_count++;
149 }
150 else if((ext == "jpg") || (ext == "jpeg")) {
151 dialog_opts.push_back(cfg::Strings.GetString(70));
152 option_count++;
153 }
154 else if(ext == "bin") {
155 dialog_opts.push_back(cfg::Strings.GetString(66));
156 option_count++;
157 }
158 else if(!is_bin) {

Callers 2

fsItems_DefaultKeyMethod · 0.95
fsItems_YMethod · 0.95

Calls 15

ResetMenuHeadMethod · 0.95
PromptDeleteFileMethod · 0.95
CheckWriteAccessMethod · 0.95
UpdateElementsMethod · 0.95
LowerCaseStringFunction · 0.85
GetExtensionFunction · 0.85
FormatSizeFunction · 0.85
GetFreeSpaceForPartitionFunction · 0.85
HandleResultFunction · 0.85
GetExecutableModeFunction · 0.85
GetBaseNameFunction · 0.85

Tested by

no test coverage detected