InnerActiveAdRotate.qml 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import QtQuick 1.0
  2. //This is simply an InnerActiveAd with a timer which will load a new ad
  3. //defaults to 2 mins
  4. Item {
  5. id: adWrapper
  6. //specific to the timed ads
  7. property int interval: 120 //reload ad every x seconds
  8. property bool autoStart: true //autostart
  9. //aliased to the ad properties so they can be set here but reflected in the child
  10. property alias appid: ad.appid
  11. //these probably don't need to be specified
  12. property alias channelid: ad.channelid
  13. property alias screenWidth: ad.screenWidth
  14. property alias screenHeight: ad.screenHeight
  15. InnerActiveAd {
  16. id: ad
  17. width: parent.width
  18. height: parent.height
  19. }
  20. Timer {
  21. id: adTimer
  22. repeat: true
  23. interval: parent.interval * 1000 //in seconds
  24. onTriggered: {
  25. ad.loadAd();
  26. }
  27. }
  28. function stop() {
  29. adTimer.stop();
  30. }
  31. function start() {
  32. adTimer.start();
  33. }
  34. Component.onCompleted: { ad.loadAd(); if(autoStart == true) { adTimer.start(); } }
  35. }