comparison widgets/ImageDialog.cpp @ 378:22b72f0f6a4e

* More work to abstract out interactive components used in the data library, so that it does not need to depend on QtGui.
author Chris Cannam
date Fri, 14 Mar 2008 17:14:21 +0000
parents 832d246b327b
children 3228b7913aa4
comparison
equal deleted inserted replaced
377:0bcb449d15f4 378:22b72f0f6a4e
24 #include <QDesktopWidget> 24 #include <QDesktopWidget>
25 #include <QApplication> 25 #include <QApplication>
26 #include <QUrl> 26 #include <QUrl>
27 #include <QMessageBox> 27 #include <QMessageBox>
28 28
29 #include "ProgressDialog.h"
30
29 #include "data/fileio/FileSource.h" 31 #include "data/fileio/FileSource.h"
30 #include "data/fileio/FileFinder.h" 32 #include "FileFinder.h"
31 33
32 #include <iostream> 34 #include <iostream>
33 35
34 ImageDialog::ImageDialog(QString title, 36 ImageDialog::ImageDialog(QString title,
35 QString image, 37 QString image,
184 if (!FileSource::canHandleScheme(url)) { 186 if (!FileSource::canHandleScheme(url)) {
185 QMessageBox::critical(this, tr("Unsupported scheme in URL"), 187 QMessageBox::critical(this, tr("Unsupported scheme in URL"),
186 tr("The URL scheme \"%1\" is not supported") 188 tr("The URL scheme \"%1\" is not supported")
187 .arg(url.scheme())); 189 .arg(url.scheme()));
188 } else { 190 } else {
189 m_remoteFile = new FileSource(url, FileSource::ProgressDialog); 191
192 ProgressDialog dialog(tr("Opening image URL..."), true, 2000);
193 m_remoteFile = new FileSource(url, &dialog);
190 m_remoteFile->waitForData(); 194 m_remoteFile->waitForData();
191 if (!m_remoteFile->isOK()) { 195 if (!m_remoteFile->isOK()) {
192 QMessageBox::critical(this, tr("File download failed"), 196 QMessageBox::critical(this, tr("File download failed"),
193 tr("Failed to download URL \"%1\": %2") 197 tr("Failed to download URL \"%1\": %2")
194 .arg(url.toString()).arg(m_remoteFile->getErrorString())); 198 .arg(url.toString()).arg(m_remoteFile->getErrorString()));