Fix arrow colors #370

This commit is contained in:
xarkes 2018-03-09 12:24:26 +01:00
parent d6bc8c3af4
commit 54a91425f2

View File

@ -141,6 +141,21 @@ void Configuration::setDarkTheme(bool set)
emit colorsUpdated(); emit colorsUpdated();
} }
QString Configuration::getLogoFile()
{
return logoFile;
}
/*!
* \brief Configuration::setColor sets the local Cutter configuration color
* \param name Color Name
* \param color The color you want to set
*/
void Configuration::setColor(const QString &name, const QColor &color)
{
s.setValue("colors." + name, color);
}
const QColor Configuration::getColor(const QString &name) const const QColor Configuration::getColor(const QString &name) const
{ {
if (s.contains("colors." + name)) { if (s.contains("colors." + name)) {
@ -150,32 +165,25 @@ const QColor Configuration::getColor(const QString &name) const
} }
} }
QString Configuration::getLogoFile()
{
return logoFile;
}
/**
* @brief Configuration::setColor sets the local Cutter configuration color
* @param name Color Name
* @param color The color you want to set
*/
void Configuration::setColor(const QString &name, const QColor &color)
{
s.setValue("colors." + name, color);
}
void Configuration::setColorTheme(QString theme) void Configuration::setColorTheme(QString theme)
{ {
if (theme == "default") if (theme == "default") {
{
Core()->cmd("ecd"); Core()->cmd("ecd");
s.setValue("theme", "default"); s.setValue("theme", "default");
} } else {
else
{
Core()->cmd(QString("eco %1").arg(theme)); Core()->cmd(QString("eco %1").arg(theme));
s.setValue("theme", theme); s.setValue("theme", theme);
} }
// Duplicate interesting colors into our Cutter Settings
// Dirty fix for arrow colors, TODO refactor getColor, setColor, etc.
QJsonDocument colors = Core()->cmdj("ecj");
QJsonObject colorsObject = colors.object();
QJsonObject::iterator it;
for (it = colorsObject.begin(); it != colorsObject.end(); it++) {
if (!it.key().contains("graph"))
continue;
QJsonArray rgb = it.value().toArray();
s.setValue("colors." + it.key(), QColor(rgb[0].toInt(), rgb[1].toInt(), rgb[2].toInt()));
}
emit colorsUpdated(); emit colorsUpdated();
} }