adinterface.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. *
  3. * adinterface.h
  4. * © Copyrights 2012 inneractive LTD, Nokia. All rights reserved
  5. *
  6. * This file is part of inneractiveAdQML.
  7. *
  8. * inneractiveAdQML is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * inneractiveAdQML is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with inneractiveAdQML. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. #ifndef INNERINTERFACE_H
  22. #define INNERINTERFACE_H
  23. #include <QObject>
  24. #include <QQueue>
  25. class RequestQueue;
  26. class QUrl;
  27. class AdInterface : public QObject
  28. {
  29. Q_OBJECT
  30. Q_PROPERTY(bool networkAccessible READ networkAccessible NOTIFY networkAccessibilityChanged)
  31. friend class RequestQueue;
  32. public:
  33. explicit AdInterface(QObject *parent = 0);
  34. bool networkAccessible() const;
  35. Q_INVOKABLE void requestAd(const QVariant &adItem);
  36. Q_INVOKABLE void openAd(const QUrl &adUrl);
  37. signals:
  38. void networkAccessibilityChanged(bool accessibility);
  39. void networkNotAccessible();
  40. private:
  41. void checkUserAgent();
  42. mutable QByteArray m_userAgent;
  43. RequestQueue* m_requestQueue;
  44. };
  45. #endif // INNERINTERFACE_H