I'm trying to make a program that downloads an image and saves it to the disk. Using C++ I've followed a reference for the downloading of a file, but how would I save it to disk? My code as I have it now gives me allot of unresolved external symbols. When I comment out lines 40 - 44 everything compiles successfully..

My Code: (I ended up putting everything under the button clicked function)
Qt Code:
  1. #include "minecraftskindownloader.h"
  2. #include "ui_minecraftskindownloader.h"
  3. #include <QWidget>
  4. #include <QObject>
  5. #include <QtNetwork/QNetworkAccessManager>
  6. #include <QFileDialog>
  7. #include <C:\Qt\Qt5.0.0\5.0.0\msvc2010\include\QtNetwork\QNetworkRequest>
  8. #include <QDebug>
  9. #include <QUrl>
  10. #include <QFile>
  11.  
  12. MinecraftSkinDownloader::MinecraftSkinDownloader(QWidget *parent) :
  13. QMainWindow(parent),
  14. ui(new Ui::MinecraftSkinDownloader)
  15. {
  16. ui->setupUi(this);
  17. this->setWindowTitle("Minecraft Skin Downloader");
  18. setFixedSize(400, 200);
  19. }
  20.  
  21. MinecraftSkinDownloader::~MinecraftSkinDownloader()
  22. {
  23. delete ui;
  24. }
  25.  
  26. void MinecraftSkinDownloader::on_actionClose_triggered()
  27. {
  28. qApp->quit();
  29. }
  30. //http://s3.amazonaws.com/MinecraftSkins/USERNAMEHERE.png
  31.  
  32. void MinecraftSkinDownloader::on_pushButton_clicked()
  33. {
  34. QString prefix = "http://s3.amazonaws.com/MinecraftSkins/";
  35. QString url = prefix += ui->lineEdit->text();
  36. url += ".png";
  37.  
  38. ui->textEdit->setText(url); //Just testing the link part
  39.  
  40. QNetworkAccessManager *manager = new QNetworkAccessManager(this);
  41. connect(manager, SIGNAL(finished(QNetworkReply*)),
  42. SLOT(replyFinished(QNetworkReply*)));
  43.  
  44. manager->get(QNetworkRequest(QUrl(url)));
  45.  
  46. QString fileName = QFileDialog::getSaveFileName(this, tr("Save"),"/Documents",tr("Images (*.png)"));
  47.  
  48. }
To copy to clipboard, switch view to plain text mode