PageRenderTime 48ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/releases/1_1_1/lescienze500_1.1.1/src/about.cpp

https://github.com/simon-r/-Archivio---LeScienze500
C++ | 89 lines | 57 code | 15 blank | 17 comment | 0 complexity | 151936f94ff95c3210d0f6b61d6b09ce MD5 | raw file
  1. // Copyright 2010 Simone Riva
  2. // mail: simone (dot) rva (lumachina) gmail.com
  3. //
  4. // This file is part of LeScienze500.
  5. //
  6. // LeScienze500 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. //
  11. // LeScienze500 is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. // GNU General Public License for more details.
  15. //
  16. // You should have received a copy of the GNU General Public License
  17. // along with LeScienze500. If not, see <http://www.gnu.org/licenses/>.
  18. #include "about.h"
  19. #include "ui_about.h"
  20. #include <QDesktopServices>
  21. #include <QFile>
  22. #include <QRegExp>
  23. About::About(QWidget *parent) :
  24. QDialog(parent),
  25. ui(new Ui::About)
  26. {
  27. QString autore ;
  28. QString ema ;
  29. QString al ;
  30. QString alom ;
  31. ui->setupUi(this);
  32. al += "Jacopo" ;
  33. ema.append( "simone" ) ; ema += "." ;
  34. alom.append("jacopo") ;
  35. autore += "Simone" ;
  36. alom += "fois" ;
  37. autore += " " ;
  38. al += " " ; al.append("Fois") ;
  39. connect( ui->Credits , SIGNAL(linkActivated(QString)), this , SLOT(on_linkActivated(QString))) ;
  40. connect( ui->AboutText , SIGNAL(anchorClicked(QUrl)) , this ,SLOT(on_linkMessageClicked(QUrl)) ) ;
  41. QFile res ;
  42. res.setFileName( ":/html/html/copyright_message.html" );
  43. res.open(QIODevice::ReadOnly) ;
  44. QString message = QString::fromLocal8Bit ( res.readAll() ) ;
  45. res.close();
  46. alom.append("@") ;
  47. ema.append("rva") ;
  48. autore += "Riva" ;
  49. alom += "gmail" ;
  50. ema += "@" ;
  51. alom.append(".") ;
  52. ema.append( "gmail" ) ;
  53. ema += "." ;
  54. ema += "com" ;
  55. alom.append("com") ;
  56. message.replace( QRegExp("<!--autore-->") , autore ) ;
  57. message.replace( QRegExp("<!--email-->") , ema ) ;
  58. message.replace( QRegExp("<!--autore_logo-->") , al ) ;
  59. message.replace( QRegExp("<!--email_logo-->") , alom ) ;
  60. ui->AboutText->setHtml( message ) ;
  61. }
  62. About::~About()
  63. {
  64. delete ui;
  65. }
  66. void About::on_linkActivated( const QString& link )
  67. {
  68. QUrl url( link ) ;
  69. QDesktopServices::openUrl ( url ) ;
  70. }
  71. void About::on_linkMessageClicked( const QUrl& url )
  72. {
  73. QDesktopServices::openUrl ( url ) ;
  74. }