networkaccessmanagerfactory.cpp 773 B

1234567891011121314151617181920212223
  1. #include "networkaccessmanagerfactory.h"
  2. #include "customnetworkaccessmanager.h"
  3. #include <QNetworkDiskCache>
  4. #include <QDesktopServices>
  5. NetworkAccessManagerFactory::NetworkAccessManagerFactory(QString p_userAgent) : QDeclarativeNetworkAccessManagerFactory(), __userAgent(p_userAgent)
  6. {
  7. }
  8. QNetworkAccessManager* NetworkAccessManagerFactory::create(QObject* parent)
  9. {
  10. CustomNetworkAccessManager* manager = new CustomNetworkAccessManager(__userAgent, parent);
  11. // QNetworkDiskCache *diskCache = new QNetworkDiskCache(manager);
  12. // diskCache->setCacheDirectory(QDesktopServices::storageLocation(QDesktopServices::CacheLocation));
  13. // diskCache->setMaximumCacheSize(1024 * 1024);
  14. // manager->setCache(diskCache);
  15. return manager;
  16. }