void SmileyPickerController::updateView() { // ---------------------------------------------------------------------------------------------- // get the dataModel of the listview if not already available using namespace bb::cascades; if(m_ListView == NULL) { qWarning() << "did not received the listview. quit."; return; } GroupDataModel* dataModel = dynamic_cast<GroupDataModel*>(m_ListView->dataModel()); if (dataModel) { dataModel->clear(); } else { qDebug() << "create new model"; dataModel = new GroupDataModel( QStringList() << "tag" << "localUrl" ); m_ListView->setDataModel(dataModel); } // ---------------------------------------------------------------------------------------------- // push data to the view QList<QObject*> datas; for(int i = 0 ; i < m_Emoticons.size() ; ++i) { Emoticon *e = new Emoticon; e->setLocalUrl(m_Emoticons.at(i)->getLocalUrl()); e->setTag(m_Emoticons.at(i)->getTag()); datas.push_back(e); } dataModel->clear(); dataModel->insertList(datas); }
void SmileyPickerController::loadDefautSmiley() { m_Emoticons.clear(); Emoticon *e; e = new Emoticon; e->setLocalUrl("asset:///images/smiley/smilies/pfff.gif"); e->setTag(":pfff:"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/smile.gif"); e->setTag(":)"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/mad.gif"); e->setTag(":fou:"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/smilies/love.gif"); e->setTag(":love:"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/ddr555.gif"); e->setTag("[:ddr555]"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/smilies/ange.gif"); e->setTag(":ange:"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/frown.gif"); e->setTag(":("); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/confused.gif"); e->setTag(":??:"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/smilies/heink.gif");e->setTag(":heink:"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/biggrin.gif"); e->setTag(":D"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/tongue.gif"); e->setTag(":p"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/smilies/lol.gif"); e->setTag(":lol:"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/smilies/cry.gif"); e->setTag(":cry:"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/smilies/sleep.gif");e->setTag(":sleep:"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/smilies/sweat.gif");e->setTag(":sweat:"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/wink.gif"); e->setTag(";)"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/smilies/na.gif"); e->setTag(":na:"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/smilies/wahoo.gif");e->setTag(":wahoo:"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/smilies/bounce.gif");e->setTag(":bounce:"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/smilies/ouch.gif"); e->setTag(":ouch:"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/smilies/sarcastic.gif"); e->setTag(":sarcastic:"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/smilies/kaola.gif"); e->setTag(":kaola:"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/smilies/sol.gif"); e->setTag(":sol:"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/smilies/hello.gif"); e->setTag(":hello:"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/smilies/non.gif"); e->setTag(":non:"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/smilies/pouah.gif"); e->setTag(":pouah:"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/smilies/whistle.gif");e->setTag(":whistle:"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/smilies/miam.gif"); e->setTag(":miam:"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/hebe.gif"); e->setTag(":hebe:"); m_Emoticons.push_back(e); e = new Emoticon; e->setLocalUrl("asset:///images/smiley/redface.gif"); e->setTag(":o"); m_Emoticons.push_back(e); m_Mutex.lockForWrite(); m_Pushing = false; m_Page = ""; m_Mutex.unlock(); updateView(); }