chore(cpn): Switch from component names to ids (#2602)
* cpn(fix): Switch from component names to ids * Fix Win compile * Sound packs list entries should not be editable
This commit is contained in:
@@ -163,8 +163,7 @@ UpdatesDialog::UpdatesDialog(QWidget * parent, UpdateFactories * factories) :
|
||||
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
int i = it.value();
|
||||
|
||||
const int i = it.value();
|
||||
const QString name = it.key();
|
||||
|
||||
row++;
|
||||
@@ -173,7 +172,7 @@ UpdatesDialog::UpdatesDialog(QWidget * parent, UpdateFactories * factories) :
|
||||
msg->setText(tr("Retrieving latest release information for %1").arg(name));
|
||||
chkUpdate[i] = new QCheckBox();
|
||||
chkUpdate[i]->setProperty("index", i);
|
||||
chkUpdate[i]->setChecked(!factories->isLatestRelease(name));
|
||||
chkUpdate[i]->setChecked(!factories->isLatestRelease(i));
|
||||
grid->addWidget(chkUpdate[i], row, col++);
|
||||
grid->setAlignment(chkUpdate[i], Qt::AlignHCenter);
|
||||
|
||||
@@ -185,27 +184,26 @@ UpdatesDialog::UpdatesDialog(QWidget * parent, UpdateFactories * factories) :
|
||||
cboRelChannel[i]->setCurrentIndex(g.component[i].releaseChannel());
|
||||
grid->addWidget(cboRelChannel[i], row, col++);
|
||||
|
||||
lblCurrentRel[i] = new QLabel(factories->currentRelease(name));
|
||||
lblCurrentRel[i] = new QLabel(factories->currentRelease(i));
|
||||
grid->addWidget(lblCurrentRel[i], row, col++);
|
||||
|
||||
cboUpdateRel[i] = new QComboBox();
|
||||
cboUpdateRel[i]->addItems(factories->releases(name));
|
||||
cboUpdateRel[i]->addItems(factories->releases(i));
|
||||
grid->addWidget(cboUpdateRel[i], row, col++);
|
||||
|
||||
connect(cboRelChannel[i], QOverload<int>::of(&QComboBox::currentIndexChanged), [=] (const int index) {
|
||||
factories->setReleaseChannel(name, index);
|
||||
factories->setReleaseChannel(i, index);
|
||||
cboUpdateRel[i]->clear();
|
||||
cboUpdateRel[i]->addItems(factories->releases(name));
|
||||
cboUpdateRel[i]->addItems(factories->releases(i));
|
||||
});
|
||||
|
||||
btnOptions[i] = new QPushButton(tr("Options"));
|
||||
connect(btnOptions[i], &QPushButton::clicked, [=]() {
|
||||
UpdateOptionsDialog *dlg = new UpdateOptionsDialog(this, factories, i, true);
|
||||
connect(dlg, &UpdateOptionsDialog::changed, [=](const int i) {
|
||||
QString name = g.component[i].name();
|
||||
chkUpdate[i]->setChecked(!factories->isLatestRelease(name));
|
||||
lblCurrentRel[i]->setText(factories->currentRelease(name));
|
||||
cboUpdateRel[i]->setCurrentText(factories->updateRelease(name));
|
||||
chkUpdate[i]->setChecked(!factories->isLatestRelease(i));
|
||||
lblCurrentRel[i]->setText(factories->currentRelease(i));
|
||||
cboUpdateRel[i]->setCurrentText(factories->updateRelease(i));
|
||||
});
|
||||
dlg->exec();
|
||||
dlg->deleteLater();
|
||||
@@ -270,12 +268,11 @@ void UpdatesDialog::accept()
|
||||
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
int i = it.value();
|
||||
const int i = it.value();
|
||||
|
||||
if (chkUpdate[i]->isChecked()) {
|
||||
cnt++;
|
||||
const QString name = it.key();
|
||||
UpdateParameters *params = factories->getParams(name);
|
||||
UpdateParameters *params = factories->getParams(i);
|
||||
params->updateRelease = cboUpdateRel[i]->currentText();
|
||||
params->flags |= UpdateInterface::UPDFLG_Update;
|
||||
params->downloadDir = ui->leDownloadDir->text();
|
||||
@@ -316,8 +313,8 @@ void UpdatesDialog::saveAsDefaults()
|
||||
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
int i = it.value();
|
||||
const int i = it.value();
|
||||
g.component[i].releaseChannel((ComponentData::ReleaseChannel)cboRelChannel[i]->currentIndex());
|
||||
factories->saveAssetSettings(it.key());
|
||||
factories->saveAssetSettings(i);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user