mirror of
https://github.com/rizinorg/cutter.git
synced 2025-02-21 22:23:46 +00:00
Add configuration description getter to improve Initial Analysis dialog (#2088)
* Implement configuration description getter * Use helper function and remove trimming
This commit is contained in:
parent
6c8530e136
commit
a327a33c3e
@ -912,6 +912,13 @@ bool CutterCore::getConfigb(const char *k)
|
|||||||
return r_config_get_i(core->config, k) != 0;
|
return r_config_get_i(core->config, k) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString CutterCore::getConfigDescription(const char *k)
|
||||||
|
{
|
||||||
|
CORE_LOCK();
|
||||||
|
RConfigNode *node = r_config_node_get (core->config, k);
|
||||||
|
return QString(node->desc);
|
||||||
|
}
|
||||||
|
|
||||||
void CutterCore::triggerRefreshAll()
|
void CutterCore::triggerRefreshAll()
|
||||||
{
|
{
|
||||||
emit refreshAll();
|
emit refreshAll();
|
||||||
|
@ -265,6 +265,7 @@ public:
|
|||||||
bool getConfigb(const QString &k) { return getConfigb(k.toUtf8().constData()); }
|
bool getConfigb(const QString &k) { return getConfigb(k.toUtf8().constData()); }
|
||||||
QString getConfig(const char *k);
|
QString getConfig(const char *k);
|
||||||
QString getConfig(const QString &k) { return getConfig(k.toUtf8().constData()); }
|
QString getConfig(const QString &k) { return getConfig(k.toUtf8().constData()); }
|
||||||
|
QString getConfigDescription(const char *k);
|
||||||
QList<QString> getColorThemes();
|
QList<QString> getColorThemes();
|
||||||
|
|
||||||
/* Assembly\Hexdump related methods */
|
/* Assembly\Hexdump related methods */
|
||||||
|
@ -31,20 +31,22 @@ InitialOptionsDialog::InitialOptionsDialog(MainWindow *main):
|
|||||||
for (const auto &plugin : asm_plugins) {
|
for (const auto &plugin : asm_plugins) {
|
||||||
ui->archComboBox->addItem(plugin, plugin);
|
ui->archComboBox->addItem(plugin, plugin);
|
||||||
}
|
}
|
||||||
ui->archComboBox->setToolTip(core->cmd("e? asm.arch").trimmed());
|
|
||||||
|
setTooltipWithConfigHelp(ui->archComboBox,"asm.arch");
|
||||||
|
|
||||||
// cpu combo box
|
// cpu combo box
|
||||||
ui->cpuComboBox->lineEdit()->setPlaceholderText(tr("Auto"));
|
ui->cpuComboBox->lineEdit()->setPlaceholderText(tr("Auto"));
|
||||||
ui->cpuComboBox->setToolTip(core->cmd("e? asm.cpu").trimmed());
|
setTooltipWithConfigHelp(ui->cpuComboBox, "asm.cpu");
|
||||||
|
|
||||||
updateCPUComboBox();
|
updateCPUComboBox();
|
||||||
|
|
||||||
// os combo box
|
// os combo box
|
||||||
for (const auto &plugin : core->cmdList("e asm.os=?")) {
|
for (const auto &plugin : core->cmdList("e asm.os=?")) {
|
||||||
ui->kernelComboBox->addItem(plugin, plugin);
|
ui->kernelComboBox->addItem(plugin, plugin);
|
||||||
}
|
}
|
||||||
ui->kernelComboBox->setToolTip(core->cmd("e? asm.os").trimmed());
|
|
||||||
|
|
||||||
ui->bitsComboBox->setToolTip(core->cmd("e? asm.bits").trimmed());
|
setTooltipWithConfigHelp(ui->kernelComboBox, "asm.os");
|
||||||
|
setTooltipWithConfigHelp(ui->bitsComboBox, "asm.bits");
|
||||||
|
|
||||||
for (const auto &plugin : core->getRBinPluginDescriptions("bin")) {
|
for (const auto &plugin : core->getRBinPluginDescriptions("bin")) {
|
||||||
ui->formatComboBox->addItem(plugin.name, QVariant::fromValue(plugin));
|
ui->formatComboBox->addItem(plugin.name, QVariant::fromValue(plugin));
|
||||||
@ -166,6 +168,14 @@ void InitialOptionsDialog::loadOptions(const InitialOptions &options)
|
|||||||
// TODO: all other options should also be applied to the ui
|
// TODO: all other options should also be applied to the ui
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void InitialOptionsDialog::setTooltipWithConfigHelp(QWidget *w, const char *config) {
|
||||||
|
w->setToolTip(QString("%1 (%2)")
|
||||||
|
.arg(core->getConfigDescription(config))
|
||||||
|
.arg(config));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QString InitialOptionsDialog::getSelectedArch() const
|
QString InitialOptionsDialog::getSelectedArch() const
|
||||||
{
|
{
|
||||||
QVariant archValue = ui->archComboBox->currentData();
|
QVariant archValue = ui->archComboBox->currentData();
|
||||||
|
@ -65,6 +65,14 @@ private:
|
|||||||
QString getSelectedOS() const;
|
QString getSelectedOS() const;
|
||||||
QList<CommandDescription> getSelectedAdvancedAnalCmds() const;
|
QList<CommandDescription> getSelectedAdvancedAnalCmds() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setTooltipWithConfigHelp is an helper function that add a tolltip to a widget with
|
||||||
|
* a description of a given radare2 eval config.
|
||||||
|
* @param w - a widget to which to add the tooltip
|
||||||
|
* @param config - name of a configuration variable such as "asm.bits".
|
||||||
|
*/
|
||||||
|
void setTooltipWithConfigHelp(QWidget *w, const char *config);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void loadOptions(const InitialOptions &options);
|
void loadOptions(const InitialOptions &options);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user