PageRenderTime 88ms CodeModel.GetById 20ms RepoModel.GetById 6ms app.codeStats 0ms

/src/ui/DroneshareDialog.cc

https://gitlab.com/fsgdez/apm_planner
C++ | 79 lines | 46 code | 11 blank | 22 comment | 0 complexity | 6ee6fc2fb14dc956a7b9008df4f20161 MD5 | raw file
  1. /*===================================================================
  2. APM_PLANNER Open Source Ground Control Station
  3. (c) 2014 APM_PLANNER PROJECT <http://www.diydrones.com>
  4. (c) author: Bill Bonney <billbonney@communistech.com>
  5. This file is part of the APM_PLANNER project
  6. APM_PLANNER is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. APM_PLANNER is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with APM_PLANNER. If not, see <http://www.gnu.org/licenses/>.
  16. ======================================================================*/
  17. #include "QsLog.h"
  18. #include "DroneshareDialog.h"
  19. #include "ui_DroneshareDialog.h"
  20. #include <QMessageBox>
  21. #include <QDesktopServices>
  22. #include <QPushButton>
  23. #include <QSettings>
  24. #include <QDesktopServices>
  25. #include <QUrl>
  26. DroneshareDialog::DroneshareDialog(QWidget *parent) :
  27. QDialog(parent),
  28. ui(new Ui::DroneshareDialog),
  29. m_skip(false)
  30. {
  31. ui->setupUi(this);
  32. ui->textEdit->setTextInteractionFlags(Qt::TextBrowserInteraction);
  33. connect(ui->okPushButton, SIGNAL(clicked()), this, SLOT(okClicked()));
  34. connect(ui->laterPushButton, SIGNAL(clicked()), this, SLOT(laterClicked()));
  35. connect(ui->signUpPushButton, SIGNAL(clicked()), this, SLOT(signupClicked()));
  36. }
  37. DroneshareDialog::~DroneshareDialog()
  38. {
  39. delete ui;
  40. }
  41. void DroneshareDialog::laterClicked()
  42. {
  43. QLOG_DEBUG() << "Dronshare: remind later";
  44. deleteLater();
  45. accept();
  46. }
  47. void DroneshareDialog::okClicked()
  48. {
  49. QLOG_DEBUG() << "Droneshare: ok notice until next update";
  50. QSettings settings;
  51. settings.beginGroup("QGC_MAINWINDOW");
  52. settings.setValue("DRONESHARE_NOTIFICATION_ENABLED", false);
  53. settings.endGroup();
  54. settings.sync();
  55. deleteLater();
  56. reject();
  57. }
  58. void DroneshareDialog::signupClicked()
  59. {
  60. QLOG_DEBUG() << "Droneshare: signupClicked";
  61. QDesktopServices::openUrl(QUrl("http://www.droneshare.com"));
  62. }