@@ -171,39 +171,75 @@ class ChampsTab
171171 }
172172 }
173173
174+ ImGui::SameLine ();
175+ static char allNamesSeparator[64 ] = " ," ;
176+ if (ImGui::Button (" Copy names to clipboard##champsTab" ))
177+ {
178+ std::string allNames = " " ;
179+ for (const auto & champ : champsAll)
180+ {
181+ if (!champ.min .owned )
182+ continue ;
183+ allNames += champ.min .name + allNamesSeparator;
184+ }
185+ Utils::CopyToClipboard (allNames);
186+ }
187+ ImGui::SameLine ();
188+
189+ const ImVec2 label_size = ImGui::CalcTextSize (" W" , NULL , true );
190+ ImGui::InputTextMultiline (" ##separatorChampsTab" , allNamesSeparator, IM_ARRAYSIZE (allNamesSeparator),
191+ ImVec2 (0 , label_size.y + ImGui::GetStyle ().FramePadding .y * 2 .0f ), ImGuiInputTextFlags_AllowTabInput);
192+
174193 ImGui::Separator ();
175194 ImGui::Text (" Champions owned: %d" , iChampsOwned);
176195 for (const auto & champ : champsAll)
177196 {
178197 if (!champ.min .owned )
179198 continue ;
180199
181- ImGui::Separator ();
182- ImGui::Text (" name: %s" , champ.min .name .c_str ());
183200 int64_t t = std::stoll (champ.min .purchased );
184201 t /= 1000 ;
185202 char buffer[50 ];
186203 strftime (buffer, 100 , " %Y-%m-%d %H:%M:%S" , localtime (&t));
187- ImGui::Text (" purchased: %s" , buffer);
188- ImGui::Text (" id: %d" , champ.min .id );
189204
190- if (champ.mas .lastPlayTime .empty ())
191- continue ;
205+ std::string inputId = " champInput" ;
206+ inputId.append (std::to_string (champ.min .id ));
207+ char input[768 ];
192208
193- ImGui::Text (" championLevel: %d" , champ.mas .championLevel );
194- ImGui::Text (" championPoints: %d" , champ.mas .championPoints );
195- ImGui::Text (" championPointsSinceLastLevel: %d" , champ.mas .championPointsSinceLastLevel );
196- ImGui::Text (" championPointsUntilNextLevel: %d" , champ.mas .championPointsUntilNextLevel );
197- ImGui::Text (" chestGranted: %d" , champ.mas .chestGranted );
198- ImGui::Text (" formattedChampionPoints: %s" , champ.mas .formattedChampionPoints .c_str ());
199- ImGui::Text (" formattedMasteryGoal: %s" , champ.mas .formattedMasteryGoal .c_str ());
200- ImGui::Text (" highestGrade: %s" , champ.mas .highestGrade .c_str ());
201- t = std::stoll (champ.mas .lastPlayTime );
202- t /= 1000 ;
203- strftime (buffer, 100 , " %Y-%m-%d %H:%M:%S" , localtime (&t));
204- ImGui::Text (" lastPlayTime: %s" , buffer);
205- ImGui::Text (" playerId: %s" , champ.mas .playerId .c_str ());
206- ImGui::Text (" tokensEarned: %d" , champ.mas .tokensEarned );
209+ float textHeight = (label_size.y + ImGui::GetStyle ().FramePadding .y ) * 3 .f ;
210+ std::string text = std::format (R"( name: {}
211+ purchased: {}
212+ id: {})" , champ.min .name , buffer, champ.min .id );
213+
214+ if (!champ.mas .lastPlayTime .empty ())
215+ {
216+ textHeight = (label_size.y + ImGui::GetStyle ().FramePadding .y ) * 12 .f ;
217+
218+ t = std::stoll (champ.mas .lastPlayTime );
219+ t /= 1000 ;
220+ strftime (buffer, 100 , " %Y-%m-%d %H:%M:%S" , localtime (&t));
221+
222+ text += std::format (R"(
223+ championLevel: {}
224+ championPoints: {}
225+ championPointsSinceLastLevel: {}
226+ championPointsUntilNextLevel: {}
227+ chestGranted: {}
228+ formattedChampionPoints: {}
229+ formattedMasteryGoal: {}
230+ highestGrade: {}
231+ lastPlayTime: {}
232+ playerId: {}
233+ tokensEarned: {})" , champ.mas .championLevel , champ.mas .championPoints , champ.mas .championPointsSinceLastLevel ,
234+ champ.mas .championPointsUntilNextLevel , champ.mas .chestGranted , champ.mas .formattedChampionPoints , champ.mas .formattedMasteryGoal ,
235+ champ.mas .highestGrade , buffer, champ.mas .playerId , champ.mas .tokensEarned );
236+ }
237+
238+ strcpy (input, text.c_str ());
239+ ImGui::PushID (inputId.c_str ());
240+ ImGui::InputTextMultiline (" " , input, IM_ARRAYSIZE (input), ImVec2 (ImGui::GetWindowSize ().x , textHeight),
241+ ImGuiInputTextFlags_ReadOnly);
242+ ImGui::PopID ();
207243 }
208244
209245 ImGui::EndTabItem ();
0 commit comments