2017-10-14 09:35:49 +00:00
|
|
|
#ifndef CONFIGURATION_H
|
|
|
|
#define CONFIGURATION_H
|
|
|
|
|
|
|
|
#include <QSettings>
|
|
|
|
#include <QFont>
|
2017-10-15 07:14:05 +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;
|
|
|
|
static Configuration* mPtr;
|
|
|
|
|
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();
|
|
|
|
static Configuration* instance();
|
|
|
|
|
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);
|
2017-12-14 15:14:33 +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
|
|
|
|
int getGraphBlockMaxChars() const { return s.value("graph.maxcols", 50).toInt(); }
|
|
|
|
void setGraphBlockMaxChars(int ch) { s.setValue("graph.maxcols", ch); }
|
|
|
|
|
2017-10-14 09:35:49 +00:00
|
|
|
// TODO Imho it's wrong doing it this way. Should find something else.
|
|
|
|
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); }
|
|
|
|
|
2018-02-02 10:56:07 +00:00
|
|
|
bool getAsmSlow() const { return s.value("asm.slow", true).toBool(); }
|
2018-01-31 08:01:16 +00:00
|
|
|
void setAsmSlow(bool v) { s.setValue("asm.slow", v); }
|
|
|
|
|
2018-02-04 19:34:52 +00:00
|
|
|
bool getAsmLines() const { return s.value("asm.lines", true).toBool(); }
|
2018-01-28 22:28:25 +00:00
|
|
|
void setAsmLines(bool v) { s.setValue("asm.lines", v); }
|
|
|
|
|
2018-02-04 19:34:52 +00:00
|
|
|
bool getAsmFcnLines() const { return s.value("asm.fcnlines", true).toBool(); }
|
|
|
|
void setAsmFcnLines(bool v) { s.setValue("asm.fcnlines", v); }
|
|
|
|
|
2018-01-31 08:01:16 +00:00
|
|
|
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.cmtright", true).toBool(); }
|
|
|
|
void setAsmCmtRight(bool v) { s.setValue("asm.cmtright", v); }
|
|
|
|
|
2018-02-01 09:01:09 +00:00
|
|
|
bool getAsmVarSum() const { return s.value("asm.varsum", false).toBool(); }
|
|
|
|
void setAsmVarSum(bool v) { s.setValue("asm.varsum", v); }
|
2018-01-31 08:01:16 +00:00
|
|
|
|
2017-10-14 09:35:49 +00:00
|
|
|
bool getAsmBytes() const { return s.value("asm.bytes", false).toBool(); }
|
|
|
|
void setAsmBytes(bool v) { s.setValue("asm.bytes", 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); }
|
|
|
|
|
2018-02-01 09:01:09 +00:00
|
|
|
int getAsmNBytes() const { return s.value("asm.nbytes", 10).toInt(); }
|
|
|
|
void setAsmNBytes(int v) { s.setValue("asm.nbytes", v); }
|
|
|
|
|
2017-10-14 09:35:49 +00:00
|
|
|
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); }
|
|
|
|
|
2018-01-31 08:01:16 +00:00
|
|
|
int getAsmTabs() const { return s.value("asm.tabs", 5).toInt(); }
|
|
|
|
void setAsmTabs(int v) { s.setValue("asm.tabs", v); }
|
|
|
|
|
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
|