2019-02-22 16:50:45 +00:00
|
|
|
#include "r_version.h"
|
|
|
|
#include "core/Cutter.h"
|
2017-10-01 19:09:42 +00:00
|
|
|
#include "AboutDialog.h"
|
2019-02-22 16:50:45 +00:00
|
|
|
|
2017-10-01 19:09:42 +00:00
|
|
|
#include "ui_AboutDialog.h"
|
2018-03-09 15:05:40 +00:00
|
|
|
#include "R2PluginsDialog.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>
|
2019-03-09 13:11:39 +00:00
|
|
|
#include <QEventLoop>
|
2018-09-13 06:32:14 +00:00
|
|
|
#include <QJsonObject>
|
|
|
|
#include <QProgressBar>
|
|
|
|
#include <QProgressDialog>
|
2019-03-09 13:11:39 +00:00
|
|
|
#include <UpdateWorker.h>
|
2018-09-13 06:32:14 +00:00
|
|
|
#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
|
|
|
|
2019-09-30 11:33:24 +00:00
|
|
|
QString aboutString(tr("Version") + " " CUTTER_VERSION_FULL "<br/>"
|
2019-07-18 17:56:00 +00:00
|
|
|
+ tr("Using r2-") + R2_GITTAP + "<br/>"
|
|
|
|
+ buildQtVersionString()
|
2019-03-09 13:11:39 +00:00
|
|
|
+ "<p><b>" + tr("Optional Features:") + "</b><br/>"
|
2019-03-25 20:43:00 +00:00
|
|
|
+ QString("Python: %1<br/>").arg(
|
|
|
|
#ifdef CUTTER_ENABLE_PYTHON
|
2019-03-09 13:11:39 +00:00
|
|
|
"ON"
|
2018-03-02 14:10:50 +00:00
|
|
|
#else
|
2019-03-09 13:11:39 +00:00
|
|
|
"OFF"
|
2018-03-02 14:10:50 +00:00
|
|
|
#endif
|
2019-03-09 13:11:39 +00:00
|
|
|
)
|
2019-03-25 20:43:00 +00:00
|
|
|
+ QString("Python Bindings: %2</p>").arg(
|
|
|
|
#ifdef CUTTER_ENABLE_PYTHON_BINDINGS
|
2019-03-09 13:11:39 +00:00
|
|
|
"ON"
|
2018-03-02 14:10:50 +00:00
|
|
|
#else
|
2019-03-09 13:11:39 +00:00
|
|
|
"OFF"
|
2018-03-02 14:10:50 +00:00
|
|
|
#endif
|
2019-03-09 13:11:39 +00:00
|
|
|
)
|
|
|
|
+ "<h2>" + tr("License") + "</h2>"
|
|
|
|
+ tr("This Software is released under the GNU General Public License v3.0")
|
|
|
|
+ "<h2>" + tr("Authors") + "</h2>"
|
2019-09-30 11:33:24 +00:00
|
|
|
+ tr("Cutter is developed by the community and maintained by its core and development teams.<br/>")
|
|
|
|
+ tr("Check our <a href='https://github.com/radareorg/cutter/graphs/contributors'>contributors page</a> for the full list of contributors."));
|
2018-10-30 07:42:43 +00:00
|
|
|
ui->label->setText(aboutString);
|
2019-03-09 13:11:39 +00:00
|
|
|
|
|
|
|
QSignalBlocker s(ui->updatesCheckBox);
|
|
|
|
ui->updatesCheckBox->setChecked(Config()->getAutoUpdateEnabled());
|
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"));
|
2018-10-23 07:09:56 +00:00
|
|
|
popup.setTextInteractionFlags(Qt::TextSelectableByMouse);
|
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()
|
|
|
|
{
|
2019-03-09 13:11:39 +00:00
|
|
|
UpdateWorker updateWorker;
|
2018-09-13 06:32:14 +00:00
|
|
|
|
|
|
|
QProgressDialog waitDialog;
|
|
|
|
QProgressBar *bar = new QProgressBar(&waitDialog);
|
|
|
|
bar->setMaximum(0);
|
|
|
|
|
|
|
|
waitDialog.setBar(bar);
|
|
|
|
waitDialog.setLabel(new QLabel(tr("Checking for updates..."), &waitDialog));
|
|
|
|
|
2019-03-09 13:11:39 +00:00
|
|
|
connect(&updateWorker, &UpdateWorker::checkComplete, &waitDialog, &QProgressDialog::cancel);
|
|
|
|
connect(&updateWorker, &UpdateWorker::checkComplete,
|
2019-07-18 17:56:00 +00:00
|
|
|
[&updateWorker](const QVersionNumber & version, const QString & error) {
|
2019-03-23 10:54:34 +00:00
|
|
|
if (!error.isEmpty()) {
|
2019-03-09 13:11:39 +00:00
|
|
|
QMessageBox::critical(nullptr, tr("Error!"), error);
|
|
|
|
} else {
|
2019-03-18 20:42:00 +00:00
|
|
|
if (version <= UpdateWorker::currentVersionNumber()) {
|
2019-03-09 13:11:39 +00:00
|
|
|
QMessageBox::information(nullptr, tr("Version control"), tr("Cutter is up to date!"));
|
|
|
|
} else {
|
|
|
|
updateWorker.showUpdateDialog(false);
|
|
|
|
}
|
|
|
|
}
|
2018-09-13 06:32:14 +00:00
|
|
|
});
|
|
|
|
|
2019-03-09 13:11:39 +00:00
|
|
|
updateWorker.checkCurrentVersion(7000);
|
2018-09-13 06:32:14 +00:00
|
|
|
waitDialog.exec();
|
|
|
|
}
|
|
|
|
|
2019-03-11 10:38:36 +00:00
|
|
|
void AboutDialog::on_updatesCheckBox_stateChanged(int)
|
2018-09-13 06:32:14 +00:00
|
|
|
{
|
2019-03-09 13:11:39 +00:00
|
|
|
Config()->setAutoUpdateEnabled(!Config()->getAutoUpdateEnabled());
|
2018-09-13 06:32:14 +00:00
|
|
|
}
|
2019-07-18 17:56:00 +00:00
|
|
|
|
|
|
|
static QString compilerString()
|
|
|
|
{
|
|
|
|
#if defined(Q_CC_CLANG) // must be before GNU, because clang claims to be GNU too
|
|
|
|
QString isAppleString;
|
|
|
|
#if defined(__apple_build_version__) // Apple clang has other version numbers
|
|
|
|
isAppleString = QLatin1String(" (Apple)");
|
|
|
|
#endif
|
|
|
|
return QLatin1String("Clang " ) + QString::number(__clang_major__) + QLatin1Char('.')
|
|
|
|
+ QString::number(__clang_minor__) + isAppleString;
|
|
|
|
#elif defined(Q_CC_GNU)
|
|
|
|
return QLatin1String("GCC " ) + QLatin1String(__VERSION__);
|
|
|
|
#elif defined(Q_CC_MSVC)
|
|
|
|
if (_MSC_VER > 1999)
|
|
|
|
return QLatin1String("MSVC <unknown>");
|
|
|
|
if (_MSC_VER >= 1910)
|
|
|
|
return QLatin1String("MSVC 2017");
|
|
|
|
if (_MSC_VER >= 1900)
|
|
|
|
return QLatin1String("MSVC 2015");
|
|
|
|
#endif
|
|
|
|
return QLatin1String("<unknown compiler>");
|
|
|
|
}
|
|
|
|
|
|
|
|
QString AboutDialog::buildQtVersionString(void)
|
|
|
|
{
|
|
|
|
return tr("Based on Qt %1 (%2, %3 bit)").arg(QLatin1String(qVersion()),
|
|
|
|
compilerString(),
|
|
|
|
QString::number(QSysInfo::WordSize));
|
|
|
|
}
|