MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / packageCurrent

Method packageCurrent

launcher/ui/pages/instance/VersionPage.cpp:186–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184}
185
186void VersionPage::packageCurrent(const QModelIndex &current, const QModelIndex &previous)
187{
188 if (!current.isValid())
189 {
190 ui->frame->clear();
191 return;
192 }
193 int row = current.row();
194 auto patch = m_profile->getComponent(row);
195 auto severity = patch->getProblemSeverity();
196 switch(severity)
197 {
198 case ProblemSeverity::Warning:
199 ui->frame->setName(tr("%1 possibly has issues.").arg(patch->getName()));
200 break;
201 case ProblemSeverity::Error:
202 ui->frame->setName(tr("%1 has issues!").arg(patch->getName()));
203 break;
204 default:
205 case ProblemSeverity::None:
206 ui->frame->clear();
207 return;
208 }
209
210 auto &problems = patch->getProblems();
211 QString problemOut;
212 for (auto &problem: problems)
213 {
214 if(problem.m_severity == ProblemSeverity::Error)
215 {
216 problemOut += tr("Error: ");
217 }
218 else if(problem.m_severity == ProblemSeverity::Warning)
219 {
220 problemOut += tr("Warning: ");
221 }
222 problemOut += problem.m_description;
223 problemOut += "\n";
224 }
225 ui->frame->setDescription(problemOut);
226}
227
228void VersionPage::updateRunningStatus(bool running)
229{

Callers

nothing calls this directly

Calls 8

getComponentMethod · 0.80
getNameMethod · 0.80
isValidMethod · 0.45
clearMethod · 0.45
getProblemSeverityMethod · 0.45
setNameMethod · 0.45
getProblemsMethod · 0.45
setDescriptionMethod · 0.45

Tested by

no test coverage detected