/app/nag_screen.cpp

https://github.com/c3d/tao-3D · C++ · 81 lines · 29 code · 9 blank · 43 comment · 2 complexity · 2a18176cb0683c7d25d9540f6bd0a2c6 MD5 · raw file

  1. // *****************************************************************************
  2. // nag_screen.cpp Tao3D project
  3. // *****************************************************************************
  4. //
  5. // File description:
  6. //
  7. // A dialog box to remind the user that the application is not free and
  8. // propose a "Buy" option.
  9. //
  10. //
  11. //
  12. //
  13. //
  14. //
  15. //
  16. // *****************************************************************************
  17. // This software is licensed under the GNU General Public License v3
  18. // (C) 2014-2015,2019, Christophe de Dinechin <christophe@dinechin.org>
  19. // (C) 2013, Jérôme Forissier <jerome@taodyne.com>
  20. // *****************************************************************************
  21. // This file is part of Tao3D
  22. //
  23. // Tao3D is free software: you can r redistribute it and/or modify
  24. // it under the terms of the GNU General Public License as published by
  25. // the Free Software Foundation, either version 3 of the License, or
  26. // (at your option) any later version.
  27. //
  28. // Tao3D is distributed in the hope that it will be useful,
  29. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  30. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  31. // GNU General Public License for more details.
  32. //
  33. // You should have received a copy of the GNU General Public License
  34. // along with Tao3D, in a file named COPYING.
  35. // If not, see <https://www.gnu.org/licenses/>.
  36. // *****************************************************************************
  37. #include "nag_screen.h"
  38. #include <QAbstractButton>
  39. #include <QUrl>
  40. #include <QDesktopServices>
  41. namespace Tao {
  42. NagScreen::NagScreen(QWidget *parent)
  43. // ----------------------------------------------------------------------------
  44. // Constructor
  45. // ----------------------------------------------------------------------------
  46. : QMessageBox(parent)
  47. {
  48. setWindowTitle(tr("Tao3D"));
  49. setText(tr("<h3>Reminder</h3>"));
  50. setInformativeText(tr("<p>This is an evaluation copy of "
  51. "Tao3D.<p>"));
  52. setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
  53. button(QMessageBox::Ok)->setText(tr("Buy now"));
  54. button(QMessageBox::Cancel)->setText(tr("Buy later"));
  55. setDefaultButton(QMessageBox::Cancel);
  56. // Icon from:
  57. // http://www.iconfinder.com/icondetails/61809/64/buy_cart_ecommerce_shopping_webshop_icon
  58. // Author: Ivan M. (www.visual-blast.com)
  59. // License: free for commercial use, do not redistribute
  60. QPixmap pm(":/images/shopping_cart.png");
  61. setIconPixmap(pm);
  62. connect(this, SIGNAL(finished(int)), this, SLOT(processDialogStatus(int)));
  63. }
  64. void NagScreen::processDialogStatus(int st)
  65. {
  66. if (st == QMessageBox::Ok)
  67. {
  68. QUrl url(tr("http://www.taodyne.com/taopresentations/buynow"));
  69. QDesktopServices::openUrl(url);
  70. }
  71. }
  72. }