PageRenderTime 26ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/desktop-widgets/about.cpp

http://github.com/torvalds/subsurface
C++ | 46 lines | 38 code | 7 blank | 1 comment | 1 complexity | 8a16a4bdc1766fcf216b0f663a759210 MD5 | raw file
Possible License(s): GPL-2.0
  1. // SPDX-License-Identifier: GPL-2.0
  2. #include "desktop-widgets/about.h"
  3. #include "core/version.h"
  4. #include <QDesktopServices>
  5. #include <QUrl>
  6. #include <QShortcut>
  7. SubsurfaceAbout::SubsurfaceAbout(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f)
  8. {
  9. ui.setupUi(this);
  10. setWindowModality(Qt::ApplicationModal);
  11. QString versionString(subsurface_git_version());
  12. QStringList readableVersions = QStringList() << "4.5.95" << "4.6 Beta 0" <<
  13. "4.5.96" << "4.6 Beta 1" <<
  14. "4.5.97" << "4.6 Beta 2";
  15. if (readableVersions.contains(versionString))
  16. versionString = readableVersions[readableVersions.indexOf(versionString) + 1];
  17. ui.aboutLabel->setText(tr("<span style='font-size: 18pt; font-weight: bold;'>"
  18. "Subsurface %1 </span><br><br>"
  19. "Multi-platform divelog software<br>"
  20. "<span style='font-size: 8pt'>"
  21. "Linus Torvalds, Dirk Hohndel, Tomaz Canabrava, and others, 2011-2019"
  22. "</span>").arg(versionString));
  23. QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this);
  24. connect(close, SIGNAL(activated()), this, SLOT(close()));
  25. QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this);
  26. connect(quit, SIGNAL(activated()), parent, SLOT(close()));
  27. }
  28. void SubsurfaceAbout::on_licenseButton_clicked()
  29. {
  30. QDesktopServices::openUrl(QUrl("http://www.gnu.org/licenses/gpl-2.0.txt"));
  31. }
  32. void SubsurfaceAbout::on_websiteButton_clicked()
  33. {
  34. QDesktopServices::openUrl(QUrl("http://subsurface-divelog.org"));
  35. }
  36. void SubsurfaceAbout::on_creditButton_clicked()
  37. {
  38. QDesktopServices::openUrl(QUrl("http://subsurface-divelog.org/misc/credits"));
  39. }