mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-10 05:55:26 +00:00
3fed97ad86
* init commit * bug fix * call slot of null object bug fix * delete extra disconnect() func * change api and add doc * run astyle * some improvements * memory leak fix * add check on start checkbox * add checkbox to about page * serve version check reply using lambda instead of slot * fix grammar mistakes * more docs * save some lines * change button text * astyle * change message text * dont use QApplication pointer as a parent for network manager * proper deletion of QNetworkReply* * VersionChecker -> UpdateWorker * windows dll hack * after rebase fix * some improvements * better determination of arch * more docs * improvements * add UpdateWorker::showUpdateDialog * remove odd condition * more improvements * fix windows bug * make dialog non-blocking * change text in download progress dialog * bug fix * remove debug conditions * change docs format
114 lines
3.4 KiB
C++
114 lines
3.4 KiB
C++
#include "r_version.h"
|
|
#include "core/Cutter.h"
|
|
#include "AboutDialog.h"
|
|
|
|
#include "ui_AboutDialog.h"
|
|
#include "R2PluginsDialog.h"
|
|
#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 <hugo.teso@gmail.org> (originally Iaito).");
|
|
ui->label->setText(aboutString);
|
|
|
|
QSignalBlocker s(ui->updatesCheckBox);
|
|
ui->updatesCheckBox->setChecked(Config()->getAutoUpdateEnabled());
|
|
}
|
|
|
|
AboutDialog::~AboutDialog() {}
|
|
|
|
void AboutDialog::on_buttonBox_rejected()
|
|
{
|
|
close();
|
|
}
|
|
|
|
void AboutDialog::on_showVersionButton_clicked()
|
|
{
|
|
QMessageBox popup(this);
|
|
popup.setWindowTitle(tr("radare2 version information"));
|
|
popup.setTextInteractionFlags(Qt::TextSelectableByMouse);
|
|
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 QString & version, const QString & error) {
|
|
if (error != "") {
|
|
QMessageBox::critical(nullptr, tr("Error!"), error);
|
|
} else {
|
|
if (version == CUTTER_VERSION_FULL) {
|
|
QMessageBox::information(nullptr, tr("Version control"), tr("Cutter is up to date!"));
|
|
} else {
|
|
updateWorker.showUpdateDialog(false);
|
|
}
|
|
}
|
|
});
|
|
|
|
updateWorker.checkCurrentVersion(7000);
|
|
waitDialog.exec();
|
|
}
|
|
|
|
void AboutDialog::on_updatesCheckBox_stateChanged(int state)
|
|
{
|
|
Config()->setAutoUpdateEnabled(!Config()->getAutoUpdateEnabled());
|
|
}
|