1 /**
2  * UGENE - Integrated Bioinformatics Tools.
3  * Copyright (C) 2008-2021 UniPro <ugene@unipro.ru>
4  * http://ugene.net
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program 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 this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  */
21 
22 #include "LicenseDialog.h"
23 
24 #include <QFile>
25 
26 #include <U2Core/AppContext.h>
27 
28 #include "ui_LicenseDialog.h"
29 
30 namespace U2 {
31 
LicenseDialog(Plugin * _plugin,QWidget * parent)32 LicenseDialog::LicenseDialog(Plugin *_plugin, QWidget *parent)
33     : QDialog(parent), ui(new Ui_LicenseDialog), plugin(_plugin) {
34     ui->setupUi(this);
35     // Opening license file
36     QFile licenseFile(plugin->getLicensePath().getURLString());
37     if (!licenseFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
38         ui->licenseTextBrowser->setText(tr("License file not found."));
39     } else {
40         ui->licenseTextBrowser->setText(QString(licenseFile.readAll()));
41         licenseFile.close();
42     }
43 
44     connect(ui->acceptButton, SIGNAL(clicked()), SLOT(sl_accept()));
45 }
46 
~LicenseDialog()47 LicenseDialog::~LicenseDialog() {
48     delete ui;
49 }
50 
sl_accept()51 void LicenseDialog::sl_accept() {
52     AppContext::getPluginSupport()->setLicenseAccepted(plugin);
53     accept();
54 }
55 }  // namespace U2
56