2017-10-14 09:35:49 +00:00
|
|
|
#ifndef CONFIGURATION_H
|
|
|
|
#define CONFIGURATION_H
|
|
|
|
|
|
|
|
#include <QSettings>
|
|
|
|
#include <QFont>
|
2018-03-04 17:42:02 +00:00
|
|
|
#include <Cutter.h>
|
2017-10-14 09:35:49 +00:00
|
|
|
|
|
|
|
#define Config() (Configuration::instance())
|
2017-10-15 07:14:05 +00:00
|
|
|
#define ConfigColor(x) Config()->getColor(x)
|
2017-10-14 09:35:49 +00:00
|
|
|
|
|
|
|
class Configuration : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
private:
|
|
|
|
QSettings s;
|
2018-02-26 22:25:23 +00:00
|
|
|
static Configuration *mPtr;
|
2017-10-14 09:35:49 +00:00
|
|
|
|
2017-12-03 12:10:09 +00:00
|
|
|
void loadInitial();
|
|
|
|
|
2017-11-20 11:23:37 +00:00
|
|
|
// Colors
|
|
|
|
void loadDefaultTheme();
|
|
|
|
void loadDarkTheme();
|
|
|
|
void setColor(const QString &name, const QColor &color);
|
2017-10-15 07:14:05 +00:00
|
|
|
|
2018-02-12 12:22:53 +00:00
|
|
|
// Images
|
|
|
|
QString logoFile;
|
|
|
|
|
2017-10-14 09:35:49 +00:00
|
|
|
public:
|
|
|
|
// Functions
|
|
|
|
Configuration();
|
2018-03-21 20:32:32 +00:00
|
|
|
static Configuration *instance();
|
2017-10-14 09:35:49 +00:00
|
|
|
|
2017-12-03 12:10:09 +00:00
|
|
|
void resetAll();
|
|
|
|
|
2017-10-14 09:35:49 +00:00
|
|
|
// Fonts
|
|
|
|
const QFont getFont() const;
|
|
|
|
void setFont(const QFont &font);
|
|
|
|
|
2017-10-15 07:14:05 +00:00
|
|
|
// Colors
|
|
|
|
const QColor getColor(const QString &name) const;
|
2017-11-20 11:23:37 +00:00
|
|
|
void setDarkTheme(bool set);
|
2018-03-21 20:32:32 +00:00
|
|
|
bool getDarkTheme()
|
|
|
|
{
|
|
|
|
return s.value("dark").toBool();
|
|
|
|
}
|
2017-10-15 07:14:05 +00:00
|
|
|
|
2018-02-12 12:22:53 +00:00
|
|
|
// Images
|
|
|
|
QString getLogoFile();
|
|
|
|
|
2017-12-19 16:00:42 +00:00
|
|
|
// Graph
|
2018-03-21 20:32:32 +00:00
|
|
|
int getGraphBlockMaxChars() const
|
|
|
|
{
|
|
|
|
return s.value("graph.maxcols", 50).toInt();
|
|
|
|
}
|
|
|
|
void setGraphBlockMaxChars(int ch)
|
|
|
|
{
|
|
|
|
s.setValue("graph.maxcols", ch);
|
|
|
|
}
|
2017-12-19 16:00:42 +00:00
|
|
|
|
2017-10-14 09:35:49 +00:00
|
|
|
// TODO Imho it's wrong doing it this way. Should find something else.
|
2018-03-21 20:32:32 +00:00
|
|
|
bool getAsmESIL() const
|
|
|
|
{
|
|
|
|
return s.value("asm.esil", false).toBool();
|
|
|
|
}
|
|
|
|
void setAsmESIL(bool v)
|
|
|
|
{
|
|
|
|
s.setValue("asm.esil", v);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool getAsmPseudo() const
|
|
|
|
{
|
|
|
|
return s.value("asm.pseudo", false).toBool();
|
|
|
|
}
|
|
|
|
void setAsmPseudo(bool v)
|
|
|
|
{
|
|
|
|
s.setValue("asm.pseudo", v);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool getAsmOffset() const
|
|
|
|
{
|
|
|
|
return s.value("asm.offset", true).toBool();
|
|
|
|
}
|
|
|
|
void setAsmOffset(bool v)
|
|
|
|
{
|
|
|
|
s.setValue("asm.offset", v);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool getAsmDescribe() const
|
|
|
|
{
|
|
|
|
return s.value("asm.describe", false).toBool();
|
|
|
|
}
|
|
|
|
void setAsmDescribe(bool v)
|
|
|
|
{
|
|
|
|
s.setValue("asm.describe", v);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool getAsmStackPointer() const
|
|
|
|
{
|
|
|
|
return s.value("asm.stackptr", false).toBool();
|
|
|
|
}
|
|
|
|
void setAsmStackPointer(bool v)
|
|
|
|
{
|
|
|
|
s.setValue("asm.stackptr", v);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool getAsmSlow() const
|
|
|
|
{
|
|
|
|
return s.value("asm.slow", true).toBool();
|
|
|
|
}
|
|
|
|
void setAsmSlow(bool v)
|
|
|
|
{
|
|
|
|
s.setValue("asm.slow", v);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool getAsmLines() const
|
|
|
|
{
|
|
|
|
return s.value("asm.lines", true).toBool();
|
|
|
|
}
|
|
|
|
void setAsmLines(bool v)
|
|
|
|
{
|
|
|
|
s.setValue("asm.lines", v);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool getAsmFcnLines() const
|
|
|
|
{
|
|
|
|
return s.value("asm.fcnlines", true).toBool();
|
|
|
|
}
|
|
|
|
void setAsmFcnLines(bool v)
|
|
|
|
{
|
|
|
|
s.setValue("asm.fcnlines", v);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool getAsmEmu() const
|
|
|
|
{
|
|
|
|
return s.value("asm.emu", false).toBool();
|
|
|
|
}
|
|
|
|
void setAsmEmu(bool v)
|
|
|
|
{
|
|
|
|
s.setValue("asm.emu", v);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool getAsmCmtRight() const
|
|
|
|
{
|
|
|
|
return s.value("asm.cmt.right", true).toBool();
|
|
|
|
}
|
|
|
|
void setAsmCmtRight(bool v)
|
|
|
|
{
|
|
|
|
s.setValue("asm.cmt.right", v);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool getAsmVarSum() const
|
|
|
|
{
|
|
|
|
return s.value("asm.varsum", false).toBool();
|
|
|
|
}
|
|
|
|
void setAsmVarSum(bool v)
|
|
|
|
{
|
|
|
|
s.setValue("asm.varsum", v);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool getAsmBytes() const
|
|
|
|
{
|
|
|
|
return s.value("asm.bytes", false).toBool();
|
|
|
|
}
|
|
|
|
void setAsmBytes(bool v)
|
|
|
|
{
|
|
|
|
s.setValue("asm.bytes", v);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool getAsmSize() const
|
|
|
|
{
|
|
|
|
return s.value("asm.size", false).toBool();
|
|
|
|
}
|
|
|
|
void setAsmSize(bool v)
|
|
|
|
{
|
|
|
|
s.setValue("asm.size", v);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool getAsmBytespace() const
|
|
|
|
{
|
|
|
|
return s.value("asm.bytespace", false).toBool();
|
|
|
|
}
|
|
|
|
void setAsmBytespace(bool v)
|
|
|
|
{
|
|
|
|
s.setValue("asm.bytespace", v);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool getAsmLBytes() const
|
|
|
|
{
|
|
|
|
return s.value("asm.lbytes", true).toBool();
|
|
|
|
}
|
|
|
|
void setAsmLBytes(bool v)
|
|
|
|
{
|
|
|
|
s.setValue("asm.lbytes", v);
|
|
|
|
}
|
|
|
|
|
|
|
|
int getAsmNBytes() const
|
|
|
|
{
|
|
|
|
return s.value("asm.nbytes", 10).toInt();
|
|
|
|
}
|
|
|
|
void setAsmNBytes(int v)
|
|
|
|
{
|
|
|
|
s.setValue("asm.nbytes", v);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString getAsmSyntax() const
|
|
|
|
{
|
|
|
|
return s.value("asm.syntax", "intel").toString();
|
|
|
|
}
|
|
|
|
void setAsmSyntax(const QString &v)
|
|
|
|
{
|
|
|
|
s.setValue("asm.syntax", v);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool getAsmUppercase() const
|
|
|
|
{
|
|
|
|
return s.value("asm.ucase", false).toBool();
|
|
|
|
}
|
|
|
|
void setAsmUppercase(bool v)
|
|
|
|
{
|
|
|
|
s.setValue("asm.ucase", v);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool getAsmBBLine() const
|
|
|
|
{
|
|
|
|
return s.value("asm.bbline", false).toBool();
|
|
|
|
}
|
|
|
|
void setAsmBBLine(bool v)
|
|
|
|
{
|
|
|
|
s.setValue("asm.bbline", v);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool getAsmCapitalize() const
|
|
|
|
{
|
|
|
|
return s.value("asm.capitalize", false).toBool();
|
|
|
|
}
|
|
|
|
void setAsmCapitalize(bool v)
|
|
|
|
{
|
|
|
|
s.setValue("asm.capitalize", v);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool getAsmVarsub() const
|
|
|
|
{
|
|
|
|
return s.value("asm.varsub", true).toBool();
|
|
|
|
}
|
|
|
|
void setAsmVarsub(bool v)
|
|
|
|
{
|
|
|
|
s.setValue("asm.varsub", v);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool getAsmVarsubOnly() const
|
|
|
|
{
|
|
|
|
return s.value("asm.varsub_only", true).toBool();
|
|
|
|
}
|
|
|
|
void setAsmVarsubOnly(bool v)
|
|
|
|
{
|
|
|
|
s.setValue("asm.varsub_only", v);
|
|
|
|
}
|
|
|
|
|
|
|
|
int getAsmTabs() const
|
|
|
|
{
|
|
|
|
return s.value("asm.tabs", 5).toInt();
|
|
|
|
}
|
|
|
|
void setAsmTabs(int v)
|
|
|
|
{
|
|
|
|
s.setValue("asm.tabs", v);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString getCurrentTheme() const
|
|
|
|
{
|
|
|
|
return s.value("theme", "solarized").toString();
|
|
|
|
}
|
2018-02-26 22:25:23 +00:00
|
|
|
void setColorTheme(QString theme);
|
|
|
|
|
2017-10-14 09:35:49 +00:00
|
|
|
signals:
|
|
|
|
void fontsUpdated();
|
2017-11-20 11:23:37 +00:00
|
|
|
void colorsUpdated();
|
2017-10-14 09:35:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CONFIGURATION_H
|