UrlLoader.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
  3. * Copyright (C) 2009 University of Szeged
  4. *
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  19. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
  20. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  21. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  22. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  23. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  24. * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  26. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. */
  28. #ifndef UrlLoader_h
  29. #define UrlLoader_h
  30. #include "BrowserWindow.h"
  31. #include <QTextStream>
  32. #include <QTimer>
  33. #include <QVector>
  34. class QWebLoadRequest;
  35. class UrlLoader : public QObject {
  36. Q_OBJECT
  37. public:
  38. UrlLoader(BrowserWindow*, const QString&, int, int);
  39. public Q_SLOTS:
  40. void loadNext();
  41. private Q_SLOTS:
  42. void checkIfFinished();
  43. void frameLoadStarted();
  44. void frameLoadFinished();
  45. void loadingChanged(QWebLoadRequest*);
  46. Q_SIGNALS:
  47. void pageLoadFinished();
  48. void loadStarted();
  49. void loadFinished();
  50. private:
  51. void loadUrlList(const QString& inputFileName);
  52. bool getUrl(QString& qstr);
  53. private:
  54. QVector<QString> m_urls;
  55. int m_index;
  56. BrowserWindow* m_browserWindow;
  57. QTextStream m_stdOut;
  58. int m_loaded;
  59. QTimer m_timeoutTimer;
  60. QTimer m_extraTimeTimer;
  61. QTimer m_checkIfFinishedTimer;
  62. int m_numFramesLoading;
  63. };
  64. #endif