Advertisement
Guest User

MainWindow.cpp

a guest
Dec 16th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. #include "mainwindow.h"
  2. #include "noscrypto.h"
  3. #include "ui_mainwindow.h"
  4. #include "formsettings.h"
  5. #include <QMainWindow>
  6. #include <QJsonObject>
  7. #include <QJsonDocument>
  8. #include <QFile>
  9.  
  10. MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
  11. {
  12. ui->setupUi(this);
  13. mFormSettings = new FormSettings();
  14. }
  15.  
  16. MainWindow::~MainWindow()
  17. {
  18. delete ui;
  19. }
  20.  
  21. void MainWindow::on_actionSettings_triggered()
  22. {
  23. mFormSettings->show();
  24. }
  25.  
  26. bool MainWindow::checkConf()
  27. {
  28. QJsonObject json;
  29. QFile loadFile(QStringLiteral("save.json"));
  30. if (!loadFile.open(QIODevice::ReadOnly))
  31. return false;
  32. QByteArray saveData = loadFile.readAll();
  33. QJsonDocument loadDoc(QJsonDocument::fromJson(saveData));
  34. json = loadDoc.object();
  35. if(json.contains("gfuid") && json["gfuid"].isString() && json.contains("hashdx") && json["hashdx"].isString() && json.contains("hashgl") && json["hashgl"].isString()
  36. && json.contains("language") && json["language"].isString() && json.contains("loginip") && json["loginip"].isString()
  37. && json.contains("loginport") && json["loginport"].isString() && json.contains("ntdirectory") && json["ntdirectory"].isString()
  38. && json.contains("version") && json["version"].isString() && json.contains("version") && json["version"].isString())
  39. {
  40. return true;
  41. }
  42. else {
  43. return false;
  44. }
  45. }
  46.  
  47. void MainWindow::on_connecttontrBT_clicked()
  48. {
  49. if(checkConf())
  50. {
  51.  
  52. if(NosCrypto::getPort() != "" && NosCrypto::getGFuid() != "" && NosCrypto::getIpLogin() != ""
  53. && NosCrypto::getVersion() != "" && NosCrypto::getLanguage() != "" && NosCrypto::getDirectory() != ""
  54. && NosCrypto::getClientHash() != "" && NosCrypto::getClientXHash() != "")
  55. {
  56. mBotWind = new BotWind();// @TODO se connecter au site qui est relié à la BDD qui renverra ici si oui ou non son compte existe
  57. mBotWind->show();
  58. }
  59. else {
  60. mFormSettings->show();
  61. }
  62. }
  63. else {
  64. mFormSettings->show();
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement