"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/common/Configuration.cpp" between
cutter-1.10.2.tar.gz and cutter-1.10.3.tar.gz

About: cutter is a Qt and C++ GUI for radare2 reverse engineering framework.

Configuration.cpp  (cutter-1.10.2):Configuration.cpp  (cutter-1.10.3)
skipping to change at line 36 skipping to change at line 36
{ "darkda", DarkFlag }, { "darkda", DarkFlag },
{ "onedark", DarkFlag }, { "onedark", DarkFlag },
{ "solarized", DarkFlag }, { "solarized", DarkFlag },
{ "zenburn", DarkFlag }, { "zenburn", DarkFlag },
{ "cutter", LightFlag }, { "cutter", LightFlag },
{ "dark", LightFlag }, { "dark", LightFlag },
{ "matrix", LightFlag }, { "matrix", LightFlag },
{ "tango", LightFlag }, { "tango", LightFlag },
{ "white", LightFlag } { "white", LightFlag }
}; };
static const QString DEFAULT_LIGHT_COLOR_THEME = "cutter";
static const QString DEFAULT_DARK_COLOR_THEME = "ayu";
const QHash<QString, QHash<ColorFlags, QColor>> Configuration::cutterOptionColor s = { const QHash<QString, QHash<ColorFlags, QColor>> Configuration::cutterOptionColor s = {
{ "gui.cflow", { { DarkFlag, QColor(0xff, 0xff, 0xff) }, { "gui.cflow", { { DarkFlag, QColor(0xff, 0xff, 0xff) },
{ LightFlag, QColor(0x00, 0x00, 0x00) }} }, { LightFlag, QColor(0x00, 0x00, 0x00) }} },
{ "gui.dataoffset", { { DarkFlag, QColor(0xff, 0xff, 0xff) }, { "gui.dataoffset", { { DarkFlag, QColor(0xff, 0xff, 0xff) },
{ LightFlag, QColor(0x00, 0x00, 0x00) }} }, { LightFlag, QColor(0x00, 0x00, 0x00) }} },
{ "gui.imports", { { DarkFlag, QColor(0x32, 0x8c, 0xff) }, { "gui.imports", { { DarkFlag, QColor(0x32, 0x8c, 0xff) },
{ LightFlag, QColor(0x32, 0x8c, 0xff) }} }, { LightFlag, QColor(0x32, 0x8c, 0xff) }} },
{ "gui.item_invalid", { { DarkFlag, QColor(0x9b, 0x9b, 0x9b) }, { "gui.item_invalid", { { DarkFlag, QColor(0x9b, 0x9b, 0x9b) },
{ LightFlag, QColor(0x9b, 0x9b, 0x9b) }} }, { LightFlag, QColor(0x9b, 0x9b, 0x9b) }} },
skipping to change at line 210 skipping to change at line 212
s.setValue("newFileLastClicked", lastClicked); s.setValue("newFileLastClicked", lastClicked);
} }
int Configuration::getNewFileLastClicked() int Configuration::getNewFileLastClicked()
{ {
return s.value("newFileLastClicked").toInt(); return s.value("newFileLastClicked").toInt();
} }
void Configuration::resetAll() void Configuration::resetAll()
{ {
Core()->cmd("e-"); // Don't reset all r2 vars, that currently breaks a bunch of stuff.
// settingsFile.remove()+loadInitials() should reset all settings configurab
le using Cutter GUI.
//Core()->cmdRaw("e-");
Core()->setSettings(); Core()->setSettings();
// Delete the file so no extra configuration is in it. // Delete the file so no extra configuration is in it.
QFile settingsFile(s.fileName()); QFile settingsFile(s.fileName());
settingsFile.remove(); settingsFile.remove();
s.clear(); s.clear();
loadInitial(); loadInitial();
emit fontsUpdated(); emit fontsUpdated();
} }
skipping to change at line 442 skipping to change at line 447
} else if (interfaceTheme.name == "Light") { } else if (interfaceTheme.name == "Light") {
loadLightStylesheet(); loadLightStylesheet();
} else { } else {
loadNativeStylesheet(); loadNativeStylesheet();
} }
for (auto it = cutterOptionColors.cbegin(); it != cutterOptionColors.cend(); it++) { for (auto it = cutterOptionColors.cbegin(); it != cutterOptionColors.cend(); it++) {
setColor(it.key(), it.value()[interfaceTheme.flag]); setColor(it.key(), it.value()[interfaceTheme.flag]);
} }
adjustColorThemeDarkness();
emit interfaceThemeChanged(); emit interfaceThemeChanged();
emit colorsUpdated(); emit colorsUpdated();
#ifdef CUTTER_ENABLE_KSYNTAXHIGHLIGHTING #ifdef CUTTER_ENABLE_KSYNTAXHIGHLIGHTING
emit kSyntaxHighlightingThemeChanged(); emit kSyntaxHighlightingThemeChanged();
#endif #endif
} }
const CutterInterfaceTheme *Configuration::getCurrentTheme() const CutterInterfaceTheme *Configuration::getCurrentTheme()
{ {
int i = getInterfaceTheme(); int i = getInterfaceTheme();
skipping to change at line 526 skipping to change at line 533
if (s.contains("colors." + name)) { if (s.contains("colors." + name)) {
return s.value("colors." + name).value<QColor>(); return s.value("colors." + name).value<QColor>();
} else { } else {
return s.value("colors.other").value<QColor>(); return s.value("colors.other").value<QColor>();
} }
} }
void Configuration::setColorTheme(const QString &theme) void Configuration::setColorTheme(const QString &theme)
{ {
if (theme == "default") { if (theme == "default") {
Core()->cmd("ecd"); Core()->cmdRaw("ecd");
s.setValue("theme", "default"); s.setValue("theme", "default");
} else { } else {
Core()->cmd(QStringLiteral("eco %1").arg(theme)); Core()->cmdRaw(QStringLiteral("eco %1").arg(theme));
s.setValue("theme", theme); s.setValue("theme", theme);
} }
QJsonObject colorTheme = ThemeWorker().getTheme(theme).object(); QJsonObject colorTheme = ThemeWorker().getTheme(theme).object();
for (auto it = colorTheme.constBegin(); it != colorTheme.constEnd(); it++) { for (auto it = colorTheme.constBegin(); it != colorTheme.constEnd(); it++) {
QJsonArray rgb = it.value().toArray(); QJsonArray rgb = it.value().toArray();
if (rgb.size() != 4) { if (rgb.size() != 4) {
continue; continue;
} }
setColor(it.key(), QColor(rgb[0].toInt(), rgb[1].toInt(), rgb[2].toInt() , rgb[3].toInt())); setColor(it.key(), QColor(rgb[0].toInt(), rgb[1].toInt(), rgb[2].toInt() , rgb[3].toInt()));
} }
emit colorsUpdated(); emit colorsUpdated();
} }
void Configuration::adjustColorThemeDarkness()
{
bool windowIsDark = windowColorIsDark();
int windowDarkness = windowIsDark ? DarkFlag : LightFlag;
int currentColorThemeDarkness = colorThemeDarkness(getColorTheme());
if ((currentColorThemeDarkness & windowDarkness) == 0) {
setColorTheme(windowIsDark ? DEFAULT_DARK_COLOR_THEME : DEFAULT_LIGHT_CO
LOR_THEME);
}
}
int Configuration::colorThemeDarkness(const QString &colorTheme) const
{
auto flags = relevantThemes.find(colorTheme);
if (flags != relevantThemes.end()) {
return static_cast<int>(*flags);
}
return DarkFlag | LightFlag;
}
void Configuration::resetToDefaultAsmOptions() void Configuration::resetToDefaultAsmOptions()
{ {
for (auto it = asmOptions.cbegin(); it != asmOptions.cend(); it++) { for (auto it = asmOptions.cbegin(); it != asmOptions.cend(); it++) {
setConfig(it.key(), it.value()); setConfig(it.key(), it.value());
} }
} }
void Configuration::applySavedAsmOptions() void Configuration::applySavedAsmOptions()
{ {
for (auto it = asmOptions.cbegin(); it != asmOptions.cend(); it++) { for (auto it = asmOptions.cbegin(); it != asmOptions.cend(); it++) {
skipping to change at line 728 skipping to change at line 755
void Configuration::setBitmapTransparentState(bool inputValueGraph) void Configuration::setBitmapTransparentState(bool inputValueGraph)
{ {
s.setValue("bitmapGraphExportTransparency", inputValueGraph); s.setValue("bitmapGraphExportTransparency", inputValueGraph);
} }
void Configuration::setBitmapExportScaleFactor(double inputValueGraph) void Configuration::setBitmapExportScaleFactor(double inputValueGraph)
{ {
s.setValue("bitmapGraphExportScale", inputValueGraph); s.setValue("bitmapGraphExportScale", inputValueGraph);
} }
void Configuration::setOutputRedirectionEnabled(bool enabled)
{
this->outputRedirectEnabled = enabled;
}
bool Configuration::getOutputRedirectionEnabled() const
{
return outputRedirectEnabled;
}
 End of changes. 7 change blocks. 
3 lines changed or deleted 32 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)