| 12345678910111213141516171819202122232425262728293031323334353637 |
- #include "advertisement.h"
- #include "SNCDataBase.h"
- #include "loghelper.h"
- Advertisement::Advertisement()
- {
- QMap<QString,QString> ads= SNCDataBase::getLocalTextAds();
- foreach(QString key,ads.keys())
- {
- this->adText<<ads.value(key);
- this->adUrl<<key;
- }
- this->stop = false;
- this->index = 0;
- }
- Advertisement::~Advertisement()
- {
- qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
- <<"Advertisement Destroyed.";
- }
- void Advertisement::abort()
- {
- this->stop = true;
- }
- void Advertisement::run()
- {
- emit bannerAdSet(SNCDataBase::getLocalBannerAd());
- while(!stop)
- {
- if(index>=adText.size())
- index=0;
- if(adText.size()>0)
- emit adUpdated(adText.at(index),adUrl.at(index));
- index++;
- msleep(3000);
- }
- }
|