/src/common/BugReporting.cpp

https://github.com/radareorg/cutter · C++ · 45 lines · 41 code · 3 blank · 1 comment · 5 complexity · a919c87a5f111a2e4cfcfa4e606d9712 MD5 · raw file

  1. #include "BugReporting.h"
  2. #include "Cutter.h"
  3. #include <QUrl>
  4. #include <QJsonObject>
  5. #include "CutterConfig.h"
  6. #include <QDesktopServices>
  7. void openIssue()
  8. {
  9. QString url, osInfo, format, arch, type;
  10. //Pull in info needed for git issue
  11. osInfo = QSysInfo::productType() + " " +
  12. (QSysInfo::productVersion() == "unknown"
  13. ? ""
  14. : QSysInfo::productVersion());
  15. QJsonDocument docu = Core()->getFileInfo();
  16. QJsonObject coreObj = docu.object()["core"].toObject();
  17. QJsonObject binObj = docu.object()["bin"].toObject();
  18. if (!binObj.QJsonObject::isEmpty()) {
  19. format = coreObj["format"].toString();
  20. arch = binObj["arch"].toString();
  21. if (!binObj["type"].isUndefined()) {
  22. type = coreObj["type"].toString();
  23. } else {
  24. type = "N/A";
  25. }
  26. } else {
  27. format = coreObj["format"].toString();
  28. arch = "N/A";
  29. type = "N/A";
  30. }
  31. url =
  32. "https://github.com/radareorg/cutter/issues/new?&body=**Environment information**\n* Operating System: "
  33. + osInfo + "\n* Cutter version: " + CUTTER_VERSION_FULL +
  34. "\n* File format: " + format + "\n * Arch: " + arch + "\n * Type: " + type +
  35. "\n\n**Describe the bug**\nA clear and concise description of what the bug is.\n\n**To Reproduce**\n"
  36. "Steps to reproduce the behavior:\n1. Go to '...'\n2. Click on '....'\n3. Scroll down to '....'\n"
  37. "4. See error\n\n**Expected behavior**\n"
  38. "A clear and concise description of what you expected to happen.\n\n"
  39. "**Screenshots**\nIf applicable, add screenshots to help explain your problem.\n\n"
  40. "**Additional context**\nAdd any other context about the problem here.";
  41. QDesktopServices::openUrl(QUrl(url, QUrl::TolerantMode));
  42. }