Compare commits

...

3 Commits

Author SHA1 Message Date
Simon Quigley 45e3835a55 If there are no packages to consider, do not go further
11 months ago
Simon Quigley cae134166b Instead of calling the count() method every time, assign to a variable
11 months ago
Simon Quigley 8cebb36a9c Invoke setEnabled less, which will help with resource usage
11 months ago

@ -43,10 +43,13 @@ void MainWindow::setUpdateInfo(QList<QStringList> updateInfo)
ui->closeButton->setEnabled(true);
ui->installButton->setEnabled(false); // Correct, it starts out false, we turn it to true if there are any updates.
bool installEnabled = false;
for (int i = 0;i < 4;i++) {
if (updateInfo[i].count() > 0) {
ui->installButton->setEnabled(true);
}
int count = updateInfo[i].count();
if (count > 0) {
installEnabled = true;
} else { continue; }
QTreeWidgetItem *installItem;
switch (i) {
@ -64,7 +67,7 @@ void MainWindow::setUpdateInfo(QList<QStringList> updateInfo)
break;
}
for (int j = 0;j < updateInfo[i].count();j++) {
for (int j = 0;j < count;j++) {
// TODO: Add security update detection here - security updates should be marked in some way
installItem->addChild(new QTreeWidgetItem(QStringList() << updateInfo[i][j]));
}
@ -74,6 +77,8 @@ void MainWindow::setUpdateInfo(QList<QStringList> updateInfo)
ui->statLabel->setText(QString("%1 package(s) will be updated. %2 of these updates are security-related.")
.arg(QString::number(updateInfo[0].count() + updateInfo[1].count() + updateInfo[2].count()),
QString::number(updateInfo[4].count())));
ui->installButton->setEnabled(installEnabled);
}
bool MainWindow::isLockedOpen()

Loading…
Cancel
Save