123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- #include "download_data.h"
- #include <QDebug>
- Download_data::Download_data(QObject *parent) :
- QObject(parent)
- {
- }
- void Download_data::split_data(QString qml_data)
- {
- QStringList data;
- QString str_data;
- data = qml_data.split("idProprietaireCompte",QString::SkipEmptyParts);
- str_data = list_to_str(data);
- setProprietaire(str_data);
- setInfoConso(str_data);
- setEntreConso(str_data);
- /*********** VOIX *******/
- setVoixConso(str_data);
- setVoixHors(str_data);
- setVoixSpec(str_data);
- /********** SMS *********/
- setSMS(str_data);
- setSMSHors(str_data);
- /******** MMS **********/
- setMMS(str_data);
- setMMSHors(str_data);
- /******* DATA *********/
- setData(str_data);
- setDataHors(str_data);
- //qDebug() << getProprietaire();
- }
- bool Download_data::check(QString qml_data)
- {
- if(qml_data.indexOf("Bonjour") == -1)
- {
- qDebug() << "# Pas trouver";
- return false;
- }
- else
- {
- qDebug() << "## Trouver";
- return true;
- }
- }
- void Download_data::setInfoConso(QString qml_data)
- {
- str_infoLigne = qml_data.section(">",68,68).remove(QChar('"')).remove("<input id=btnSwitch_1 onclick=javascript:toggleForfait('1'); type=image src=../images/moncompte/conso/btnHide.png align=absbottom style=display:inline;/margin-top:-15px;").trimmed();
- }
- void Download_data::setProprietaire(QString qml_data)
- {
- str_proprietaire = qml_data.section(">",2,2).remove(QChar('"')).remove("<a href=?act=logout").trimmed();
- }
- void Download_data::setEntreConso(QString qml_data)
- {
- str_entreConso = qml_data.section(">",71,75).remove(QChar('"')).remove("<span").remove("class=actif>").remove("</span>").remove("</div").trimmed();
- }
- void Download_data::setVoixConso(QString qml_data)
- {
- str_Voixconso = qml_data.section(">",92,92).remove(QChar('"')).remove("</span").trimmed();
- }
- void Download_data::setVoixHors(QString qml_data)
- {
- str_VoixHors = qml_data.section(">",100,102).remove(QChar('"')).remove("<span class=actif>").remove("</span>").remove("</p");
- }
- void Download_data::setVoixSpec(QString qml_data)
- {
- str_voixSpeciaux = qml_data.section(">",119,119).remove("</span").trimmed();
- }
- void Download_data::setSMS(QString qml_data)
- {
- str_sms = qml_data.section(">",143,143).remove("</span").trimmed();
- }
- void Download_data::setSMSHors(QString qml_data)
- {
- str_smsHors = qml_data.section(">",150,150).remove("</span").trimmed();
- }
- void Download_data::setMMS(QString qml_data)
- {
- str_mms = qml_data.section(">",168,168).remove("</span").trimmed();
- }
- void Download_data::setMMSHors(QString qml_data)
- {
- str_mmsHors = qml_data.section(">",174,174).remove("</span").trimmed();
- }
- void Download_data::setData(QString qml_data)
- {
- str_data = qml_data.section(">",192,192).remove("</span").trimmed();
- }
- void Download_data::setDataHors(QString qml_data)
- {
- str_dataHors = qml_data.section(">",198,198).remove("</span").trimmed();
- }
- QString Download_data::list_to_str(QStringList list_a_convert)
- {
- QString str_retour;
- for(int i = 0;i<list_a_convert.size();i++)
- {
- str_retour = list_a_convert[i];
- // qDebug() << i << " = " <<list_a_convert[i]<<endl;
- }
- return str_retour;
- }
|