comparison widgets/ImageDialog.cpp @ 1414:fa986b91d77f

Merge from branch fix-static-analysis
author Chris Cannam
date Wed, 09 Jan 2019 15:24:51 +0000
parents c8a6fd3f9dff
children
comparison
equal deleted inserted replaced
1413:0930a27ebea2 1414:fa986b91d77f
36 ImageDialog::ImageDialog(QString title, 36 ImageDialog::ImageDialog(QString title,
37 QString image, 37 QString image,
38 QString label, 38 QString label,
39 QWidget *parent) : 39 QWidget *parent) :
40 QDialog(parent), 40 QDialog(parent),
41 m_imagePreview(0), 41 m_imagePreview(nullptr),
42 m_remoteFile(0) 42 m_remoteFile(nullptr)
43 { 43 {
44 setWindowTitle(title); 44 setWindowTitle(title);
45 45
46 QGridLayout *grid = new QGridLayout; 46 QGridLayout *grid = new QGridLayout;
47 setLayout(grid); 47 setLayout(grid);
177 177
178 if (img != m_loadedImageFile) { 178 if (img != m_loadedImageFile) {
179 179
180 QString fileName = img; 180 QString fileName = img;
181 delete m_remoteFile; 181 delete m_remoteFile;
182 m_remoteFile = 0; 182 m_remoteFile = nullptr;
183 183
184 if (FileSource::isRemote(fileName)) { 184 if (FileSource::isRemote(fileName)) {
185 QUrl url(fileName); 185 QUrl url(fileName);
186 if (!FileSource::canHandleScheme(url)) { 186 if (!FileSource::canHandleScheme(url)) {
187 QMessageBox::critical(this, tr("Unsupported scheme in URL"), 187 QMessageBox::critical(this, tr("Unsupported scheme in URL"),
195 if (!m_remoteFile->isOK()) { 195 if (!m_remoteFile->isOK()) {
196 QMessageBox::critical(this, tr("File download failed"), 196 QMessageBox::critical(this, tr("File download failed"),
197 tr("Failed to download URL \"%1\": %2") 197 tr("Failed to download URL \"%1\": %2")
198 .arg(url.toString()).arg(m_remoteFile->getErrorString())); 198 .arg(url.toString()).arg(m_remoteFile->getErrorString()));
199 delete m_remoteFile; 199 delete m_remoteFile;
200 m_remoteFile = 0; 200 m_remoteFile = nullptr;
201 } else { 201 } else {
202 fileName = m_remoteFile->getLocalFilename(); 202 fileName = m_remoteFile->getLocalFilename();
203 } 203 }
204 } 204 }
205 } 205 }