cutter/src/dialogs/AboutDialog.cpp

114 lines
3.4 KiB
C++
Raw Normal View History

#include "r_version.h"
#include "core/Cutter.h"
2017-10-01 19:09:42 +00:00
#include "AboutDialog.h"
2017-10-01 19:09:42 +00:00
#include "ui_AboutDialog.h"
#include "R2PluginsDialog.h"
2018-10-17 07:55:53 +00:00
#include "common/Configuration.h"
#include <QUrl>
#include <QTimer>
#include <QEventLoop>
#include <QJsonObject>
#include <QProgressBar>
#include <QProgressDialog>
#include <UpdateWorker.h>
#include <QtNetwork/QNetworkRequest>
#include <QtNetwork/QNetworkAccessManager>
#include "CutterConfig.h"
AboutDialog::AboutDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::AboutDialog)
{
ui->setupUi(this);
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
ui->logoSvgWidget->load(Config()->getLogoFile());
QString aboutString("<h1>Cutter</h1>"
+ tr("Version") + " " CUTTER_VERSION_FULL "<br/>"
+ tr("Using r2-") + R2_GITTAP
+ "<p><b>" + tr("Optional Features:") + "</b><br/>"
+ QString("Jupyter: %1<br/>").arg(
#ifdef CUTTER_ENABLE_JUPYTER
"ON"
#else
"OFF"
#endif
)
+ QString("QtWebEngine: %2</p>").arg(
#ifdef CUTTER_ENABLE_QTWEBENGINE
"ON"
#else
"OFF"
#endif
)
+ "<h2>" + tr("License") + "</h2>"
+ tr("This Software is released under the GNU General Public License v3.0")
+ "<h2>" + tr("Authors") + "</h2>"
"xarkes, thestr4ng3r, ballessay<br/>"
"Based on work by Hugo Teso &lt;hugo.teso@gmail.org&gt; (originally Iaito).");
ui->label->setText(aboutString);
QSignalBlocker s(ui->updatesCheckBox);
ui->updatesCheckBox->setChecked(Config()->getAutoUpdateEnabled());
}
2017-10-02 09:41:28 +00:00
AboutDialog::~AboutDialog() {}
void AboutDialog::on_buttonBox_rejected()
{
close();
}
2017-12-15 16:09:04 +00:00
void AboutDialog::on_showVersionButton_clicked()
{
QMessageBox popup(this);
popup.setWindowTitle(tr("radare2 version information"));
popup.setTextInteractionFlags(Qt::TextSelectableByMouse);
2017-12-15 16:09:04 +00:00
auto versionInformation = Core()->getVersionInformation();
popup.setText(versionInformation);
popup.exec();
}
void AboutDialog::on_showPluginsButton_clicked()
{
R2PluginsDialog dialog(this);
dialog.exec();
}
void AboutDialog::on_checkForUpdatesButton_clicked()
{
UpdateWorker updateWorker;
QProgressDialog waitDialog;
QProgressBar *bar = new QProgressBar(&waitDialog);
bar->setMaximum(0);
waitDialog.setBar(bar);
waitDialog.setLabel(new QLabel(tr("Checking for updates..."), &waitDialog));
connect(&updateWorker, &UpdateWorker::checkComplete, &waitDialog, &QProgressDialog::cancel);
connect(&updateWorker, &UpdateWorker::checkComplete,
[&updateWorker](const QVersionNumber &version, const QString & error) {
2019-03-23 10:54:34 +00:00
if (!error.isEmpty()) {
QMessageBox::critical(nullptr, tr("Error!"), error);
} else {
if (version <= UpdateWorker::currentVersionNumber()) {
QMessageBox::information(nullptr, tr("Version control"), tr("Cutter is up to date!"));
} else {
updateWorker.showUpdateDialog(false);
}
}
});
updateWorker.checkCurrentVersion(7000);
waitDialog.exec();
}
2019-03-11 10:38:36 +00:00
void AboutDialog::on_updatesCheckBox_stateChanged(int)
{
Config()->setAutoUpdateEnabled(!Config()->getAutoUpdateEnabled());
}