download_data.cpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #include "download_data.h"
  2. #include <QDebug>
  3. Download_data::Download_data(QObject *parent) :
  4. QObject(parent)
  5. {
  6. }
  7. void Download_data::split_data(QString qml_data)
  8. {
  9. QStringList data;
  10. QString str_data;
  11. data = qml_data.split("idProprietaireCompte",QString::SkipEmptyParts);
  12. str_data = list_to_str(data);
  13. setProprietaire(str_data);
  14. setInfoConso(str_data);
  15. setEntreConso(str_data);
  16. /*********** VOIX *******/
  17. setVoixConso(str_data);
  18. setVoixHors(str_data);
  19. setVoixSpec(str_data);
  20. /********** SMS *********/
  21. setSMS(str_data);
  22. setSMSHors(str_data);
  23. /******** MMS **********/
  24. setMMS(str_data);
  25. setMMSHors(str_data);
  26. /******* DATA *********/
  27. setData(str_data);
  28. setDataHors(str_data);
  29. //qDebug() << getProprietaire();
  30. }
  31. bool Download_data::check(QString qml_data)
  32. {
  33. if(qml_data.indexOf("Bonjour") == -1)
  34. {
  35. qDebug() << "# Pas trouver";
  36. return false;
  37. }
  38. else
  39. {
  40. qDebug() << "## Trouver";
  41. return true;
  42. }
  43. }
  44. void Download_data::setInfoConso(QString qml_data)
  45. {
  46. 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();
  47. }
  48. void Download_data::setProprietaire(QString qml_data)
  49. {
  50. str_proprietaire = qml_data.section(">",2,2).remove(QChar('"')).remove("<a href=?act=logout").trimmed();
  51. }
  52. void Download_data::setEntreConso(QString qml_data)
  53. {
  54. str_entreConso = qml_data.section(">",71,75).remove(QChar('"')).remove("<span").remove("class=actif>").remove("</span>").remove("</div").trimmed();
  55. }
  56. void Download_data::setVoixConso(QString qml_data)
  57. {
  58. str_Voixconso = qml_data.section(">",92,92).remove(QChar('"')).remove("</span").trimmed();
  59. }
  60. void Download_data::setVoixHors(QString qml_data)
  61. {
  62. str_VoixHors = qml_data.section(">",100,102).remove(QChar('"')).remove("<span class=actif>").remove("</span>").remove("</p");
  63. }
  64. void Download_data::setVoixSpec(QString qml_data)
  65. {
  66. str_voixSpeciaux = qml_data.section(">",119,119).remove("</span").trimmed();
  67. }
  68. void Download_data::setSMS(QString qml_data)
  69. {
  70. str_sms = qml_data.section(">",143,143).remove("</span").trimmed();
  71. }
  72. void Download_data::setSMSHors(QString qml_data)
  73. {
  74. str_smsHors = qml_data.section(">",150,150).remove("</span").trimmed();
  75. }
  76. void Download_data::setMMS(QString qml_data)
  77. {
  78. str_mms = qml_data.section(">",168,168).remove("</span").trimmed();
  79. }
  80. void Download_data::setMMSHors(QString qml_data)
  81. {
  82. str_mmsHors = qml_data.section(">",174,174).remove("</span").trimmed();
  83. }
  84. void Download_data::setData(QString qml_data)
  85. {
  86. str_data = qml_data.section(">",192,192).remove("</span").trimmed();
  87. }
  88. void Download_data::setDataHors(QString qml_data)
  89. {
  90. str_dataHors = qml_data.section(">",198,198).remove("</span").trimmed();
  91. }
  92. QString Download_data::list_to_str(QStringList list_a_convert)
  93. {
  94. QString str_retour;
  95. for(int i = 0;i<list_a_convert.size();i++)
  96. {
  97. str_retour = list_a_convert[i];
  98. // qDebug() << i << " = " <<list_a_convert[i]<<endl;
  99. }
  100. return str_retour;
  101. }