Fix #133 (r2 -V tab in AboutDialog)

This commit is contained in:
xarkes 2017-12-15 17:09:04 +01:00
parent 4330b7ddaa
commit d92f016ead
6 changed files with 85 additions and 18 deletions

@ -1 +1 @@
Subproject commit 7b380cc56105e77a5a765eb2138d1d33f2b22e91 Subproject commit 52af9d8b35c67c9a41a4c7c1ce2b06023b899ec4

View File

@ -1356,3 +1356,44 @@ void CutterCore::loadScript(const QString &scriptname)
{ {
r_core_cmd_file(core_, scriptname.toStdString().data()); 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;
}

View File

@ -334,6 +334,7 @@ public:
void saveDefaultAsmOptions(); void saveDefaultAsmOptions();
void loadScript(const QString &scriptname); void loadScript(const QString &scriptname);
QString getVersionInformation();
RCoreLocked core() const; RCoreLocked core() const;

View File

@ -29,3 +29,12 @@ void AboutDialog::on_buttonBox_rejected()
{ {
close(); close();
} }
void AboutDialog::on_showVersionButton_clicked()
{
QMessageBox popup(this);
popup.setWindowTitle("radare2 version information");
auto versionInformation = Core()->getVersionInformation();
popup.setText(versionInformation);
popup.exec();
}

View File

@ -19,6 +19,7 @@ public:
private slots: private slots:
void on_buttonBox_rejected(); void on_buttonBox_rejected();
void on_showVersionButton_clicked();
private: private:
std::unique_ptr<Ui::AboutDialog> ui; std::unique_ptr<Ui::AboutDialog> ui;

View File

@ -15,20 +15,37 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<widget class="QSvgWidget" name="logoSvgWidget" native="true"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="minimumSize"> <item>
<size> <widget class="QSvgWidget" name="logoSvgWidget" native="true">
<width>96</width> <property name="minimumSize">
<height>96</height> <size>
</size> <width>96</width>
</property> <height>96</height>
<property name="maximumSize"> </size>
<size> </property>
<width>96</width> <property name="maximumSize">
<height>96</height> <size>
</size> <width>96</width>
</property> <height>96</height>
</widget> </size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="showVersionButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Show version information</string>
</property>
</widget>
</item>
</layout>
</item> </item>
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
@ -69,8 +86,6 @@
<container>1</container> <container>1</container>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources> <resources/>
<include location="../resources.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>