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

Method onSelectionChanged

launcher/ui/pages/modplatform/ModPage.cpp:182–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182void ModPage::onSelectionChanged(QModelIndex curr, QModelIndex prev)
183{
184 ui->versionSelectionBox->clear();
185
186 if (!curr.isValid()) { return; }
187
188 current = listModel->data(curr, Qt::UserRole).value<ModPlatform::IndexedPack>();
189
190 if (!current.versionsLoaded) {
191 qDebug() << QString("Loading %1 mod versions").arg(debugName());
192
193 ui->modSelectionButton->setText(tr("Loading versions..."));
194 ui->modSelectionButton->setEnabled(false);
195
196 listModel->requestModVersions(current, curr);
197 } else {
198 for (int i = 0; i < current.versions.size(); i++) {
199 ui->versionSelectionBox->addItem(current.versions[i].version, QVariant(i));
200 }
201 if (ui->versionSelectionBox->count() == 0) { ui->versionSelectionBox->addItem(tr("No valid version found."), QVariant(-1)); }
202
203 updateSelectionButton();
204 }
205
206 if(!current.extraDataLoaded){
207 qDebug() << QString("Loading %1 mod info").arg(debugName());
208
209 listModel->requestModInfo(current, curr);
210 }
211
212 updateUi();
213}
214
215void ModPage::onVersionSelectionChanged(QString data)
216{

Callers

nothing calls this directly

Calls 11

QStringClass · 0.85
setEnabledMethod · 0.80
requestModVersionsMethod · 0.80
addItemMethod · 0.80
requestModInfoMethod · 0.80
clearMethod · 0.45
isValidMethod · 0.45
dataMethod · 0.45
setTextMethod · 0.45
sizeMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected