mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-18 19:06:10 +00:00
Fix the "all green" navbar (#2305)
* Specify the search range for search.in * Add config_set(key, const char*) overloads to prevent char* being automatically casted to bool and config_set(key, bool) being chosen unexpectedly.
This commit is contained in:
parent
e14d0d8ef6
commit
c923576b7e
@ -34,6 +34,16 @@ TempConfig &TempConfig::set(const QString &key, const QString &value)
|
||||
return *this;
|
||||
}
|
||||
|
||||
TempConfig &TempConfig::set(const QString &key, const char *value)
|
||||
{
|
||||
if (!resetValues.contains(key)) {
|
||||
resetValues[key] = Core()->getConfig(key);
|
||||
}
|
||||
|
||||
Core()->setConfig(key, value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
TempConfig &TempConfig::set(const QString &key, int value)
|
||||
{
|
||||
if (!resetValues.contains(key)) {
|
||||
|
@ -29,6 +29,7 @@ public:
|
||||
~TempConfig();
|
||||
|
||||
TempConfig &set(const QString &key, const QString &value);
|
||||
TempConfig &set(const QString &key, const char *value);
|
||||
TempConfig &set(const QString &key, int value);
|
||||
TempConfig &set(const QString &key, bool value);
|
||||
|
||||
|
@ -956,6 +956,18 @@ QString CutterCore::itoa(ut64 num, int rdx)
|
||||
return QString::number(num, rdx);
|
||||
}
|
||||
|
||||
void CutterCore::setConfig(const char *k, const char *v)
|
||||
{
|
||||
CORE_LOCK();
|
||||
r_config_set(core->config, k, v);
|
||||
}
|
||||
|
||||
void CutterCore::setConfig(const QString &k, const char *v)
|
||||
{
|
||||
CORE_LOCK();
|
||||
r_config_set(core->config, k.toUtf8().constData(), v);
|
||||
}
|
||||
|
||||
void CutterCore::setConfig(const char *k, const QString &v)
|
||||
{
|
||||
CORE_LOCK();
|
||||
@ -3397,7 +3409,15 @@ BlockStatistics CutterCore::getBlockStatistics(unsigned int blocksCount)
|
||||
return blockStats;
|
||||
}
|
||||
|
||||
QJsonObject statsObj = cmdj("p-j " + QString::number(blocksCount)).object();
|
||||
QJsonObject statsObj;
|
||||
|
||||
// User TempConfig here to set the search boundaries to all sections. This makes sure
|
||||
// that the Visual Navbar will show all the relevant addresses.
|
||||
{
|
||||
TempConfig tempConfig;
|
||||
tempConfig.set("search.in", "bin.sections");
|
||||
statsObj = cmdj("p-j " + QString::number(blocksCount)).object();
|
||||
}
|
||||
|
||||
blockStats.from = statsObj[RJsonKey::from].toVariant().toULongLong();
|
||||
blockStats.to = statsObj[RJsonKey::to].toVariant().toULongLong();
|
||||
|
@ -287,6 +287,8 @@ public:
|
||||
QString itoa(ut64 num, int rdx = 16);
|
||||
|
||||
/* Config functions */
|
||||
void setConfig(const char *k, const char *v);
|
||||
void setConfig(const QString &k, const char *v);
|
||||
void setConfig(const char *k, const QString &v);
|
||||
void setConfig(const QString &k, const QString &v) { setConfig(k.toUtf8().constData(), v); }
|
||||
void setConfig(const char *k, int v);
|
||||
|
Loading…
Reference in New Issue
Block a user