Gui: Use auto and range-based for (#7481)

* On lines where the variable type is obvious from inspection, avoid repeating the type using auto. 
* When possible use a ranged for loop instead of begin() and end() iterators
This commit is contained in:
berniev
2022-09-15 04:25:13 +10:00
committed by GitHub
parent d7792826b4
commit 75acacd1b7
175 changed files with 2051 additions and 2057 deletions

View File

@@ -161,7 +161,7 @@ void DownloadManager::handleUnsupportedContent(QNetworkReply *reply, bool reques
if (ok && size == 0)
return;
DownloadItem *item = new DownloadItem(reply, requestFileName, this);
auto item = new DownloadItem(reply, requestFileName, this);
addItem(item);
}
@@ -182,7 +182,7 @@ void DownloadManager::addItem(DownloadItem *item)
void DownloadManager::updateRow()
{
DownloadItem *item = qobject_cast<DownloadItem*>(sender());
auto item = qobject_cast<DownloadItem*>(sender());
int row = m_downloads.indexOf(item);
if (-1 == row)
return;
@@ -264,7 +264,7 @@ void DownloadManager::load()
QString fileName = settings.value(key + QLatin1String("location")).toString();
bool done = settings.value(key + QLatin1String("done"), true).toBool();
if (!url.isEmpty() && !fileName.isEmpty()) {
DownloadItem *item = new DownloadItem(nullptr, false, this);
auto item = new DownloadItem(nullptr, false, this);
item->m_output.setFileName(fileName);
item->fileNameLabel->setText(QFileInfo(item->m_output.fileName()).fileName());
item->m_url = url;