2018-03-04 17:42:02 +00:00
|
|
|
#include <Cutter.h>
|
2017-10-01 19:09:42 +00:00
|
|
|
#include "AboutDialog.h"
|
|
|
|
#include "ui_AboutDialog.h"
|
2018-03-09 15:05:40 +00:00
|
|
|
#include "R2PluginsDialog.h"
|
2017-04-05 02:12:00 +00:00
|
|
|
#include "r_version.h"
|
2018-10-17 07:55:53 +00:00
|
|
|
#include "common/Configuration.h"
|
2017-03-29 10:18:37 +00:00
|
|
|
|
2018-09-13 06:32:14 +00:00
|
|
|
#include <QUrl>
|
|
|
|
#include <QTimer>
|
|
|
|
#include <QJsonObject>
|
|
|
|
#include <QProgressBar>
|
|
|
|
#include <QProgressDialog>
|
|
|
|
#include <QtNetwork/QNetworkRequest>
|
|
|
|
#include <QtNetwork/QNetworkAccessManager>
|
|
|
|
|
2018-08-26 18:37:11 +00:00
|
|
|
#include "CutterConfig.h"
|
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
AboutDialog::AboutDialog(QWidget *parent) :
|
|
|
|
QDialog(parent),
|
|
|
|
ui(new Ui::AboutDialog)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
2017-03-31 00:51:14 +00:00
|
|
|
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
2018-02-12 12:59:47 +00:00
|
|
|
ui->logoSvgWidget->load(Config()->getLogoFile());
|
2017-12-03 20:01:11 +00:00
|
|
|
|
2017-09-25 12:55:41 +00:00
|
|
|
ui->label->setText(tr("<h1>Cutter</h1>"
|
2018-08-26 18:37:11 +00:00
|
|
|
"Version " CUTTER_VERSION_FULL "<br/>"
|
2017-09-27 20:23:18 +00:00
|
|
|
"Using r2-" R2_GITTAP
|
2018-03-02 14:10:50 +00:00
|
|
|
"<p><b>Optional Features:</b><br/>"
|
|
|
|
"Jupyter: %1<br/>"
|
|
|
|
"QtWebEngine: %2</p>"
|
2017-09-27 20:23:18 +00:00
|
|
|
"<h2>License</h2>"
|
|
|
|
"This Software is released under the GNU General Public License v3.0"
|
|
|
|
"<h2>Authors</h2>"
|
2017-11-27 17:10:25 +00:00
|
|
|
"xarkes, thestr4ng3r, ballessay<br/>"
|
2018-03-02 14:10:50 +00:00
|
|
|
"Based on work by Hugo Teso <hugo.teso@gmail.org> (originally Iaito).")
|
2018-03-21 20:32:32 +00:00
|
|
|
.arg(
|
2018-03-02 14:10:50 +00:00
|
|
|
#ifdef CUTTER_ENABLE_JUPYTER
|
2018-03-21 20:32:32 +00:00
|
|
|
"ON"
|
2018-03-02 14:10:50 +00:00
|
|
|
#else
|
2018-03-21 20:32:32 +00:00
|
|
|
"OFF"
|
2018-03-02 14:10:50 +00:00
|
|
|
#endif
|
2018-03-21 20:32:32 +00:00
|
|
|
,
|
2018-03-02 14:10:50 +00:00
|
|
|
#ifdef CUTTER_ENABLE_QTWEBENGINE
|
2018-03-21 20:32:32 +00:00
|
|
|
"ON"
|
2018-03-02 14:10:50 +00:00
|
|
|
#else
|
2018-03-21 20:32:32 +00:00
|
|
|
"OFF"
|
2018-03-02 14:10:50 +00:00
|
|
|
#endif
|
2018-03-21 20:32:32 +00:00
|
|
|
));
|
2017-03-29 10:18:37 +00:00
|
|
|
}
|
|
|
|
|
2017-10-02 09:41:28 +00:00
|
|
|
AboutDialog::~AboutDialog() {}
|
2017-03-29 10:18:37 +00:00
|
|
|
|
|
|
|
void AboutDialog::on_buttonBox_rejected()
|
|
|
|
{
|
|
|
|
close();
|
|
|
|
}
|
2017-12-15 16:09:04 +00:00
|
|
|
|
|
|
|
void AboutDialog::on_showVersionButton_clicked()
|
|
|
|
{
|
|
|
|
QMessageBox popup(this);
|
2018-09-13 06:32:14 +00:00
|
|
|
popup.setWindowTitle(tr("radare2 version information"));
|
2017-12-15 16:09:04 +00:00
|
|
|
auto versionInformation = Core()->getVersionInformation();
|
|
|
|
popup.setText(versionInformation);
|
|
|
|
popup.exec();
|
|
|
|
}
|
2018-03-09 15:05:40 +00:00
|
|
|
|
|
|
|
void AboutDialog::on_showPluginsButton_clicked()
|
|
|
|
{
|
|
|
|
R2PluginsDialog dialog(this);
|
|
|
|
dialog.exec();
|
|
|
|
}
|
2018-09-13 06:32:14 +00:00
|
|
|
|
|
|
|
void AboutDialog::on_checkForUpdatesButton_clicked()
|
|
|
|
{
|
|
|
|
QUrl url("https://api.github.com/repos/radareorg/cutter/releases/latest");
|
|
|
|
QNetworkRequest request;
|
|
|
|
request.setUrl(url);
|
|
|
|
|
|
|
|
QProgressDialog waitDialog;
|
|
|
|
QProgressBar *bar = new QProgressBar(&waitDialog);
|
|
|
|
bar->setMaximum(0);
|
|
|
|
|
|
|
|
waitDialog.setBar(bar);
|
|
|
|
waitDialog.setLabel(new QLabel(tr("Checking for updates..."), &waitDialog));
|
|
|
|
|
|
|
|
QNetworkAccessManager nm;
|
|
|
|
|
|
|
|
QTimer timeoutTimer;
|
|
|
|
timeoutTimer.setSingleShot(true);
|
|
|
|
timeoutTimer.setInterval(7000);
|
|
|
|
|
|
|
|
connect(&nm, &QNetworkAccessManager::finished, &timeoutTimer, &QTimer::stop);
|
|
|
|
connect(&nm, &QNetworkAccessManager::finished, &waitDialog, &QProgressDialog::cancel);
|
|
|
|
connect(&nm, &QNetworkAccessManager::finished, this, &AboutDialog::serveVersionCheckReply);
|
|
|
|
|
|
|
|
QNetworkReply *reply = nm.get(request);
|
|
|
|
timeoutTimer.start();
|
|
|
|
|
|
|
|
connect(&timeoutTimer, &QTimer::timeout, []() {
|
|
|
|
QMessageBox mb;
|
|
|
|
mb.setIcon(QMessageBox::Critical);
|
|
|
|
mb.setStandardButtons(QMessageBox::Ok);
|
|
|
|
mb.setWindowTitle(tr("Timeout error!"));
|
|
|
|
mb.setText(tr("Please check your internet connection and try again."));
|
|
|
|
mb.exec();
|
|
|
|
});
|
|
|
|
|
|
|
|
waitDialog.exec();
|
|
|
|
delete reply;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AboutDialog::serveVersionCheckReply(QNetworkReply *reply)
|
|
|
|
{
|
|
|
|
QString currVersion = "";
|
|
|
|
QMessageBox mb;
|
|
|
|
mb.setStandardButtons(QMessageBox::Ok);
|
|
|
|
if (reply->error()) {
|
|
|
|
mb.setIcon(QMessageBox::Critical);
|
|
|
|
mb.setWindowTitle(tr("Error!"));
|
|
|
|
mb.setText(reply->errorString());
|
|
|
|
} else {
|
|
|
|
currVersion = QJsonDocument::fromJson(reply->readAll()).object().value("tag_name").toString();
|
|
|
|
currVersion.remove('v');
|
|
|
|
|
|
|
|
mb.setWindowTitle(tr("Version control"));
|
|
|
|
mb.setIcon(QMessageBox::Information);
|
|
|
|
if (currVersion == CUTTER_VERSION_FULL) {
|
|
|
|
mb.setText(tr("You have latest version and no need to update!"));
|
|
|
|
} else {
|
|
|
|
mb.setText(tr("<b>Current version</b>: " CUTTER_VERSION_FULL "<br/>"
|
|
|
|
"<b>Latest version</b>: %1<br/><br/>"
|
|
|
|
"For update, please check the link: <a href=\"%2\">%2</a>")
|
|
|
|
.arg(currVersion, "https://github.com/radareorg/cutter/releases"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mb.exec();
|
|
|
|
}
|