Skip to content

Commit 6edf3e7

Browse files
committed
feat(AboutDialog): added analyzers and commands
1 parent 52c2509 commit 6edf3e7

2 files changed

Lines changed: 68 additions & 1 deletion

File tree

src/dialogs/about.cpp

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,68 @@ void compile_processors(QTextBrowser* txb) {
122122
txb->setHtml(CONTENT.arg(html));
123123
}
124124

125+
void compile_analyzers(QTextBrowser* txb) {
126+
const QString CONTENT = R"(
127+
<table>
128+
<tr>
129+
<th valign="middle" width="50%">Name</th>
130+
<th valign="middle" width="50%">Id</th>
131+
<th valign="middle" width="50%">Order</th>
132+
</tr>
133+
%1
134+
</table>
135+
)";
136+
137+
RDPluginSlice analyzers = rd_get_all_analyzer_plugins();
138+
QString html;
139+
140+
const RDPlugin** it;
141+
rd_slice_each(it, analyzers) {
142+
const RDPlugin* p = *it;
143+
144+
QString row = R"(
145+
<tr>
146+
<td align="center" valign="middle">%1</td>
147+
<td align="center" valign="middle">%2</td>
148+
<td align="center" valign="middle">%3</td>
149+
</tr>
150+
)";
151+
152+
html.append(row.arg(p->analyzer->name)
153+
.arg(p->analyzer->id)
154+
.arg(p->analyzer->order));
155+
}
156+
157+
txb->setLineWrapMode(QTextBrowser::NoWrap);
158+
txb->setHtml(CONTENT.arg(html));
159+
}
160+
161+
void compile_commands(QTextBrowser* txb) {
162+
RDPluginSlice commands = rd_get_all_command_plugins();
163+
QString html;
164+
165+
const RDPlugin** it;
166+
rd_slice_each(it, commands) {
167+
const RDPlugin* p = *it;
168+
QString params;
169+
const RDCommandParam* cp = p->command->params;
170+
171+
while(cp->name && cp->kind) {
172+
if(!params.isEmpty()) params.append(", ");
173+
174+
params.append(rd_command_valuekind_str(cp->kind))
175+
.append(" ")
176+
.append(cp->name);
177+
cp++;
178+
}
179+
180+
html.append(QString("- %1(%2)").arg(p->command->id).arg(params));
181+
}
182+
183+
txb->setLineWrapMode(QTextBrowser::NoWrap);
184+
txb->setHtml(html);
185+
}
186+
125187
} // namespace
126188

127189
AboutDialog::AboutDialog(QWidget* parent): QDialog{parent}, m_ui{this} {
@@ -135,4 +197,6 @@ AboutDialog::AboutDialog(QWidget* parent): QDialog{parent}, m_ui{this} {
135197
compile_modules(m_ui.txbmodules);
136198
compile_loaders(m_ui.txbloaders);
137199
compile_processors(m_ui.txbprocessors);
200+
compile_analyzers(m_ui.txbanalyzers);
201+
compile_commands(m_ui.txbcommands);
138202
}

src/ui/aboutdialog.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ namespace ui {
1313
struct AboutDialog {
1414
QDialogButtonBox* buttonbox;
1515
QLabel *lbllogo, *lbltitle;
16-
QTextBrowser *txbconfig, *txbmodules, *txbloaders, *txbprocessors;
16+
QTextBrowser *txbconfig, *txbmodules, *txbloaders, *txbprocessors,
17+
*txbanalyzers, *txbcommands;
1718
QTabWidget* tabwidget;
1819

1920
explicit AboutDialog(QDialog* self) {
@@ -32,6 +33,8 @@ struct AboutDialog {
3233
this->txbmodules = this->add_tab("Modules");
3334
this->txbloaders = this->add_tab("Loaders");
3435
this->txbprocessors = this->add_tab("Processors");
36+
this->txbanalyzers = this->add_tab("Analyzers");
37+
this->txbcommands = this->add_tab("Commands");
3538

3639
this->buttonbox = new QDialogButtonBox(QDialogButtonBox::Close);
3740
QObject::connect(this->buttonbox, &QDialogButtonBox::rejected, self,

0 commit comments

Comments
 (0)