From d92f016eadb951fbc7229479bf6ab35bfed18ac6 Mon Sep 17 00:00:00 2001 From: xarkes Date: Fri, 15 Dec 2017 17:09:04 +0100 Subject: [PATCH] Fix #133 (r2 -V tab in AboutDialog) --- radare2 | 2 +- src/cutter.cpp | 41 +++++++++++++++++++++++++++++++ src/cutter.h | 1 + src/dialogs/AboutDialog.cpp | 9 +++++++ src/dialogs/AboutDialog.h | 1 + src/dialogs/AboutDialog.ui | 49 ++++++++++++++++++++++++------------- 6 files changed, 85 insertions(+), 18 deletions(-) diff --git a/radare2 b/radare2 index 7b380cc5..52af9d8b 160000 --- a/radare2 +++ b/radare2 @@ -1 +1 @@ -Subproject commit 7b380cc56105e77a5a765eb2138d1d33f2b22e91 +Subproject commit 52af9d8b35c67c9a41a4c7c1ce2b06023b899ec4 diff --git a/src/cutter.cpp b/src/cutter.cpp index 5c02e0ab..0894494f 100644 --- a/src/cutter.cpp +++ b/src/cutter.cpp @@ -1356,3 +1356,44 @@ void CutterCore::loadScript(const QString &scriptname) { r_core_cmd_file(core_, scriptname.toStdString().data()); } + +QString CutterCore::getVersionInformation() +{ + int i; + QString ret; + struct vcs_t { + const char *name; + const char *(*callback)(); + } vcs[] = { + { "r_anal", &r_anal_version }, + { "r_lib", &r_lib_version }, + { "r_egg", &r_egg_version }, + { "r_asm", &r_asm_version }, + { "r_bin", &r_bin_version }, + { "r_cons", &r_cons_version }, + { "r_flag", &r_flag_version }, + { "r_core", &r_core_version }, + { "r_crypto", &r_crypto_version }, + { "r_bp", &r_bp_version }, + { "r_debug", &r_debug_version }, + { "r_hash", &r_hash_version }, + { "r_fs", &r_fs_version }, + { "r_io", &r_io_version }, + { "r_magic", &r_magic_version }, + { "r_parse", &r_parse_version }, + { "r_reg", &r_reg_version }, + { "r_sign", &r_sign_version }, + { "r_search", &r_search_version }, + { "r_syscall", &r_syscall_version }, + { "r_util", &r_util_version }, + /* ... */ + {NULL,NULL} + }; + ret.append(QString("%1 r2\n").arg(R2_GITTAP)); + for (i = 0; vcs[i].name; i++) { + struct vcs_t *v = &vcs[i]; + const char *name = v->callback (); + ret.append(QString("%1 %2\n").arg(name, v->name)); + } + return ret; +} diff --git a/src/cutter.h b/src/cutter.h index 707545eb..02e234b5 100644 --- a/src/cutter.h +++ b/src/cutter.h @@ -334,6 +334,7 @@ public: void saveDefaultAsmOptions(); void loadScript(const QString &scriptname); + QString getVersionInformation(); RCoreLocked core() const; diff --git a/src/dialogs/AboutDialog.cpp b/src/dialogs/AboutDialog.cpp index 256d6b6c..096c4626 100644 --- a/src/dialogs/AboutDialog.cpp +++ b/src/dialogs/AboutDialog.cpp @@ -29,3 +29,12 @@ void AboutDialog::on_buttonBox_rejected() { close(); } + +void AboutDialog::on_showVersionButton_clicked() +{ + QMessageBox popup(this); + popup.setWindowTitle("radare2 version information"); + auto versionInformation = Core()->getVersionInformation(); + popup.setText(versionInformation); + popup.exec(); +} diff --git a/src/dialogs/AboutDialog.h b/src/dialogs/AboutDialog.h index 71db1d15..0ba86734 100644 --- a/src/dialogs/AboutDialog.h +++ b/src/dialogs/AboutDialog.h @@ -19,6 +19,7 @@ public: private slots: void on_buttonBox_rejected(); + void on_showVersionButton_clicked(); private: std::unique_ptr ui; diff --git a/src/dialogs/AboutDialog.ui b/src/dialogs/AboutDialog.ui index 753af435..33aecd17 100644 --- a/src/dialogs/AboutDialog.ui +++ b/src/dialogs/AboutDialog.ui @@ -15,20 +15,37 @@ - - - - 96 - 96 - - - - - 96 - 96 - - - + + + + + + 96 + 96 + + + + + 96 + 96 + + + + + + + + + 0 + 0 + + + + Show version information + + + + @@ -69,8 +86,6 @@ 1 - - - +