Changeset 88161 in webkit
- Timestamp:
- Jun 6, 2011 6:19:23 AM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r88159 r88161 1 2011-06-06 Barát Tibor <Barat.Tibor@stud.u-szeged.hu> 2 3 Reviewed by Csaba Osztrogonác. 4 5 [Qt] Implement download feature for QtTestBrowser 6 https://bugs.webkit.org/show_bug.cgi?id=61865 7 8 * QtTestBrowser/launcherwindow.cpp: 9 (LauncherWindow::LauncherWindow): 10 (LauncherWindow::downloadRequest): 11 (LauncherWindow::fileDownloadFinished): 12 * QtTestBrowser/launcherwindow.h: 13 1 14 2011-06-04 Dominic Cooney <dominicc@chromium.org> 2 15 -
trunk/Tools/QtTestBrowser/launcherwindow.cpp
r87724 r88161 35 35 #include "launcherwindow.h" 36 36 #include "urlloader.h" 37 #include <QFileDialog> 38 #include <QFileInfo> 39 #include <QMessageBox> 40 #include <QNetworkReply> 37 41 38 42 const int gExitClickArea = 80; … … 47 51 , m_formatMenuAction(0) 48 52 , m_zoomAnimation(0) 53 , m_reply(0) 49 54 #ifndef QT_NO_LINEEDIT 50 55 , m_findFlag(0) … … 59 64 60 65 createChrome(); 66 67 connect(page(), SIGNAL(downloadRequested(const QNetworkRequest&)), this, SLOT(downloadRequest(const QNetworkRequest&))); 61 68 } 62 69 … … 969 976 } 970 977 978 void LauncherWindow::downloadRequest(const QNetworkRequest &request) 979 { 980 QNetworkAccessManager* manager = new QNetworkAccessManager(this); 981 m_reply = manager->get(request); 982 connect(m_reply, SIGNAL(finished()), this, SLOT(fileDownloadFinished())); 983 } 984 985 void LauncherWindow::fileDownloadFinished() 986 { 987 QFileInfo fileInf(m_reply->request().url().toString()); 988 QString requestFileName = QDir::homePath() + "/" + fileInf.fileName(); 989 QString fileName = QFileDialog::getSaveFileName(this, "Save as...", requestFileName, "All Files (*)"); 990 991 if (fileName.isEmpty()) 992 return; 993 if (m_reply->error() != QNetworkReply::NoError) 994 QMessageBox::critical(this, QString("Download"), QString("Download failed.")); 995 else { 996 QFile file(fileName); 997 file.open(QIODevice::WriteOnly); 998 file.write(m_reply->readAll()); 999 file.close(); 1000 QMessageBox::information(this, QString("Download"), fileName + QString(" downloaded successfully.")); 1001 } 1002 } 1003 971 1004 void LauncherWindow::updateFPS(int fps) 972 1005 { -
trunk/Tools/QtTestBrowser/launcherwindow.h
r87724 r88161 207 207 208 208 void printURL(const QUrl&); 209 void downloadRequest(const QNetworkRequest&); 210 void fileDownloadFinished(); 209 211 210 212 public slots: … … 239 241 240 242 QPropertyAnimation* m_zoomAnimation; 243 QNetworkReply* m_reply; 241 244 QList<QTouchEvent::TouchPoint> m_touchPoints; 242 245 bool m_touchMocking;
Note: See TracChangeset
for help on using the changeset viewer.