@@ -26,8 +26,11 @@ DevGraphsDialog::DevGraphsDialog(RDContext* ctx, QWidget* parent)
2626 connect (m_ui.tvfunctions , &QTreeView::clicked, this ,
2727 &DevGraphsDialog::show_dot);
2828
29- connect (m_ui.ftbcopytests , &FeedbackPushButton::feedback, this ,
30- &DevGraphsDialog::copy_tests);
29+ connect (m_ui.ftbcopygraphhashes , &FeedbackPushButton::feedback, this ,
30+ &DevGraphsDialog::copy_graph_hashes);
31+
32+ connect (m_ui.ftbcopyfunctions , &FeedbackPushButton::feedback, this ,
33+ &DevGraphsDialog::copy_functions);
3134
3235 connect (m_ui.ftbcopygraph , &FeedbackPushButton::feedback, this ,
3336 [&]() { qApp->clipboard ()->setText (m_currentgraph); });
@@ -38,7 +41,7 @@ DevGraphsDialog::DevGraphsDialog(RDContext* ctx, QWidget* parent)
3841 });
3942}
4043
41- void DevGraphsDialog::copy_tests () {
44+ void DevGraphsDialog::copy_graph_hashes () {
4245 QString s = " {\n " ;
4346
4447 for (int i = 0 ; i < m_functionsmodel->rowCount ({}); i++) {
@@ -57,6 +60,26 @@ void DevGraphsDialog::copy_tests() {
5760 qApp->clipboard ()->setText (s);
5861}
5962
63+ void DevGraphsDialog::copy_functions () {
64+ QString s = " {\n " ;
65+
66+ for (int i = 0 ; i < m_functionsmodel->rowCount ({}); i++) {
67+ QModelIndex index = m_functionsmodel->index (i);
68+ RDAddress address = m_functionsmodel->address (index);
69+ const RDFunction* f = rd_find_function (m_context, address);
70+ Q_ASSERT (f);
71+ const char * name = rd_get_name (m_context, address);
72+ Q_ASSERT (name);
73+
74+ s.append (QString{" {0x%1, \" %2\" },\n " }
75+ .arg (utils::to_hex (address))
76+ .arg (QString::fromUtf8 (name)));
77+ }
78+
79+ s.append (" };" );
80+ qApp->clipboard ()->setText (s);
81+ }
82+
6083void DevGraphsDialog::show_dot (const QModelIndex& index) {
6184 m_currentgraph = {};
6285 m_currenthash = {};
0 commit comments