mirror of
https://github.com/rizinorg/cutter.git
synced 2025-02-24 07:24:46 +00:00

* 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.
66 lines
1.5 KiB
C++
66 lines
1.5 KiB
C++
|
|
#include <cassert>
|
|
|
|
#include "core/Cutter.h"
|
|
#include "TempConfig.h"
|
|
|
|
TempConfig::~TempConfig()
|
|
{
|
|
for (auto i = resetValues.constBegin(); i != resetValues.constEnd(); ++i) {
|
|
switch (i.value().type()) {
|
|
case QVariant::String:
|
|
Core()->setConfig(i.key(), i.value().toString());
|
|
break;
|
|
case QVariant::Int:
|
|
Core()->setConfig(i.key(), i.value().toInt());
|
|
break;
|
|
case QVariant::Bool:
|
|
Core()->setConfig(i.key(), i.value().toBool());
|
|
break;
|
|
default:
|
|
assert(false);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
TempConfig &TempConfig::set(const QString &key, const QString &value)
|
|
{
|
|
if (!resetValues.contains(key)) {
|
|
resetValues[key] = Core()->getConfig(key);
|
|
}
|
|
|
|
Core()->setConfig(key, 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)) {
|
|
resetValues[key] = Core()->getConfigi(key);
|
|
}
|
|
|
|
Core()->setConfig(key, value);
|
|
return *this;
|
|
}
|
|
|
|
TempConfig &TempConfig::set(const QString &key, bool value)
|
|
{
|
|
if (!resetValues.contains(key)) {
|
|
resetValues[key] = Core()->getConfigb(key);
|
|
}
|
|
|
|
Core()->setConfig(key, value);
|
|
return *this;
|
|
}
|