formcommandarea.cpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #include "formcommandarea.h"
  2. #include "ui_formcommandarea.h"
  3. #include "dialogselectsegment.h"
  4. #include "respgetservertime.h"
  5. #include "respencrypt.h"
  6. #include "sncdatabase.h"
  7. FormCommandArea::FormCommandArea(QWidget *parent) :
  8. QWidget(parent),
  9. ui(new Ui::FormCommandArea)
  10. {
  11. ui->setupUi(this);
  12. //m_ssows = new WSSSO();
  13. m_state = NotLogin;
  14. initUI();
  15. }
  16. void FormCommandArea::setAccountInfo(QMap<QString, QString> info)
  17. {
  18. m_account = info;
  19. QString ssoHash = info.value("ssohash");
  20. if(!ssoHash.isEmpty())
  21. {
  22. m_state = LoginOk;
  23. }
  24. else
  25. {
  26. m_state = NotLogin;
  27. }
  28. }
  29. FormCommandArea::~FormCommandArea()
  30. {
  31. qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
  32. <<"FormCommandArea Destroyed.";
  33. delete ui;
  34. qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
  35. <<"FormCommandArea Destroyed.";
  36. }
  37. bool FormCommandArea::chkAccountState(AccountLoginState state)
  38. {
  39. bool ret = false;
  40. switch(state)
  41. {
  42. case NotLogin:
  43. QMessageBox::critical(this,"提示","您现在还没有登录系统,请登录后再操作!",QMessageBox::Ok);
  44. break;
  45. case NotBind:
  46. QMessageBox::critical(this,"提示","此项服务尚未开通,请开通后再操作!",QMessageBox::Ok);
  47. break;
  48. case LoginError:
  49. QMessageBox::critical(this,"提示","此项服务暂时无法连接,请稍候重试!",QMessageBox::Ok);
  50. break;
  51. default:
  52. ret = true;
  53. }
  54. return ret;
  55. }
  56. void FormCommandArea::initUI()
  57. {
  58. ui->pushButtonFree->setProperty("class","big-red-bg");
  59. //ui->pushButtonShkj->setProperty("class","big-yellow-bg");
  60. ui->pushButtonFree->setCursor(Qt::PointingHandCursor);
  61. //ui->pushButtonShkj->setCursor(Qt::PointingHandCursor);
  62. ui->widget->setProperty("class","blackborder");
  63. }
  64. void FormCommandArea::on_pushButtonFree_clicked()
  65. {
  66. // if(!chkAccountState(m_state))
  67. // return;
  68. DialogSelectSegment dialog;
  69. dialog.setAccountInfo(m_account);
  70. connect(&dialog,SIGNAL(zxshDownDataUpdated()),this,SIGNAL(zxshDownDataUpdated()));
  71. int rtCode = dialog.exec();
  72. disconnect(&dialog,SIGNAL(zxshDownDataUpdated()),this,SIGNAL(zxshDownDataUpdated()));
  73. if(rtCode == QDialog::Accepted)
  74. {
  75. if(!dialog.isReserve())
  76. ;//emit zxshDownDataUpdated();
  77. else
  78. emit zxshReserveDataUpdated();
  79. }
  80. }
  81. void FormCommandArea::onRowButtonClicked(QString type, QString data)
  82. {
  83. QStringList list = data.split("-");
  84. QString province,city;
  85. QMap<QString,QString> map;
  86. if(type=="HOTAREA" || type=="RESERVE")
  87. {
  88. province = list.at(0);
  89. city = list.at(1);
  90. }
  91. else if(type=="FREE")
  92. {
  93. qDebug()<<list;
  94. province = list.at(0);
  95. city = list.at(1);
  96. map.insert("updatedays",list.at(2));
  97. map.insert("isp",list.at(3));
  98. }
  99. DialogSelectSegment dialog;
  100. dialog.setAccountInfo(m_account);
  101. dialog.setCustomInfo(map);;
  102. dialog.setAreaInfo(province,city);
  103. connect(&dialog,SIGNAL(zxshDownDataUpdated()),this,SIGNAL(zxshDownDataUpdated()));
  104. connect(&dialog,SIGNAL(zxshReserveDataUpdated()),this,SIGNAL(zxshReserveDataUpdated()));
  105. dialog.exec();
  106. disconnect(&dialog,SIGNAL(zxshDownDataUpdated()),this,SIGNAL(zxshDownDataUpdated()));
  107. disconnect(&dialog,SIGNAL(zxshReserveDataUpdated()),this,SIGNAL(zxshReserveDataUpdated()));
  108. }