PageRenderTime 89ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/openbr/gui/help.cpp

https://gitlab.com/biometricscurious/openbr
C++ | 44 lines | 34 code | 7 blank | 3 comment | 0 complexity | 7ac96c9721ac0bce8944d10a16b68cfb MD5 | raw file
  1. #include <QDesktopServices>
  2. #include <QFile>
  3. #include <QMessageBox>
  4. #include <QString>
  5. #include <QUrl>
  6. #include <openbr/openbr.h>
  7. #include "help.h"
  8. /**** HELP ****/
  9. /*** PUBLIC ***/
  10. br::Help::Help(QWidget *parent)
  11. : QMenu(parent)
  12. {
  13. actions.append(QSharedPointer<QAction>(addAction("About")));
  14. connect(actions.last().data(), SIGNAL(triggered()), this, SLOT(showAbout()));
  15. actions.append(QSharedPointer<QAction>(addAction("Documentation")));
  16. connect(actions.last().data(), SIGNAL(triggered()), this, SLOT(showDocumentation()));
  17. actions.append(QSharedPointer<QAction>(addAction("License")));
  18. connect(actions.last().data(), SIGNAL(triggered()), this, SLOT(showLicense()));
  19. }
  20. /*** PUBLIC SLOTS ***/
  21. void br::Help::showAbout()
  22. {
  23. QMessageBox::about(this, "About", br_about());
  24. }
  25. void br::Help::showDocumentation()
  26. {
  27. QDesktopServices::openUrl(QUrl(QString("file:///%1/doc/html/index.html").arg(br_sdk_path())));
  28. }
  29. void br::Help::showLicense()
  30. {
  31. QFile file(QString("%1/LICENSE.txt").arg(br_sdk_path()));
  32. file.open(QFile::ReadOnly);
  33. QString license = file.readAll();
  34. file.close();
  35. QMessageBox::about(this, "License", license);
  36. }
  37. #include "moc_help.cpp"