diff --git a/src/canvas.cpp b/src/canvas.cpp --- a/src/canvas.cpp +++ b/src/canvas.cpp @@ -20,6 +20,8 @@ */ #include +#include +#include #include #include #include @@ -41,6 +43,8 @@ #include #include #include +#include + #include #include @@ -558,7 +562,7 @@ Main::Main(QGraphicsScene& c, Mesh &m, Q helpmenu->insertSeparator(); helpmenu->insertItem("&About", this, SLOT(about()) ); //, Key_F1); helpmenu->insertSeparator(); - helpmenu->insertItem("&GPL", this, SLOT(gpl()) ); + helpmenu->insertItem("&LICENSE", this, SLOT(gpl()) ); menu->insertItem("&Help",helpmenu); statusBar(); setCentralWidget(editor); @@ -665,8 +669,6 @@ void Main::readPars() } emit ParsChanged(); - /* if (timer_active) - timer->start( 0 );*/ } @@ -948,30 +950,37 @@ void Main::about() } -#include -#include -#include void Main::gpl() { - static QMessageBox* gpl = new QMessageBox ( "License", "", + static QMessageBox* gpl = new QMessageBox ( "GPL License", "", QMessageBox::Information, 1, 0, 0, this, 0, FALSE ); - std::ifstream t("../doc/GPL"); + QDir docDir(QApplication::applicationDirPath()); + docDir.cd("../doc"); + QString path = docDir.filePath("gpl3.txt"); + + std::ifstream file(path.toStdString().c_str()); std::string str; - t.seekg(0, std::ios::end); - str.reserve(t.tellg()); - t.seekg(0, std::ios::beg); + if (file) { + file.seekg(0, std::ios::end); + str.reserve(file.tellg()); + file.seekg(0, std::ios::beg); + + str.assign((std::istreambuf_iterator(file)), + std::istreambuf_iterator()); - str.assign((std::istreambuf_iterator(t)), - std::istreambuf_iterator()); - gpl->setText(QString("

GNU GENERAL PUBLIC LICENSE

" - "

Version 2, June 1991

" - "

Copyright (C) 1989, 1991 Free Software Foundation, Inc. " - "59 Temple Place, Suite 330, Boston, MA 02111-1307 USA: " - "Everyone is permitted to copy and distribute verbatim copies " - "of this license document, but changing it is not allowed.

")); - gpl->setDetailedText(QString(str.c_str())); + gpl->setDetailedText(QString(str.c_str())); + } + + gpl->setText(QString( "

GNU GENERAL PUBLIC LICENSE

" + "

Version 3, 29 June 2007

" + "

Copyright © 2007 Free Software Foundation, Inc. " + "<http://fsf.org/>

" + "Everyone is permitted to copy and distribute verbatim copies " + "of this license document, but changing it is not allowed.

" + "

GNU GENERAL PUBLIC LICENSE

")); + gpl->setButtonText( 1, "Dismiss" ); gpl->show(); }