mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-23 21:35:28 +00:00
93 lines
2.0 KiB
C++
93 lines
2.0 KiB
C++
#ifndef CONFIGURATION_H
|
|
#define CONFIGURATION_H
|
|
|
|
#include <QSettings>
|
|
#include <QFont>
|
|
#include <Cutter.h>
|
|
|
|
#define Config() (Configuration::instance())
|
|
#define ConfigColor(x) Config()->getColor(x)
|
|
|
|
class Configuration : public QObject
|
|
{
|
|
Q_OBJECT
|
|
private:
|
|
QSettings s;
|
|
static Configuration *mPtr;
|
|
|
|
void loadInitial();
|
|
|
|
// Colors
|
|
void loadBaseDark();
|
|
void loadDefaultTheme();
|
|
void loadDarkTheme();
|
|
void loadDarkGreyTheme();
|
|
void setColor(const QString &name, const QColor &color);
|
|
|
|
// Images
|
|
QString logoFile;
|
|
|
|
// Asm Options
|
|
void applySavedAsmOptions();
|
|
|
|
public:
|
|
// Functions
|
|
Configuration();
|
|
static Configuration *instance();
|
|
|
|
void resetAll();
|
|
|
|
// Fonts
|
|
const QFont getFont() const;
|
|
void setFont(const QFont &font);
|
|
|
|
// Colors
|
|
const QColor getColor(const QString &name) const;
|
|
void setDarkTheme(int theme);
|
|
int getDarkTheme()
|
|
{
|
|
return s.value("dark").toInt();
|
|
}
|
|
|
|
QString getDirProjects();
|
|
void setDirProjects(const QString& dir);
|
|
|
|
// Images
|
|
QString getLogoFile();
|
|
|
|
// Asm Options
|
|
void resetToDefaultAsmOptions();
|
|
|
|
// Graph
|
|
int getGraphBlockMaxChars() const
|
|
{
|
|
return s.value("graph.maxcols", 50).toInt();
|
|
}
|
|
void setGraphBlockMaxChars(int ch)
|
|
{
|
|
s.setValue("graph.maxcols", ch);
|
|
}
|
|
|
|
QString getCurrentTheme() const { return s.value("theme", "solarized").toString(); }
|
|
void setColorTheme(QString theme);
|
|
|
|
/*!
|
|
* \brief Get the value of a config var either from r2 or settings, depending on the key.
|
|
*/
|
|
QVariant getConfigVar(const QString &key);
|
|
bool getConfigBool(const QString &key);
|
|
int getConfigInt(const QString &key);
|
|
QString getConfigString(const QString &key);
|
|
|
|
/*!
|
|
* \brief Set the value of a config var either to r2 or settings, depending on the key.
|
|
*/
|
|
void setConfig(const QString &key, const QVariant &value);
|
|
|
|
signals:
|
|
void fontsUpdated();
|
|
void colorsUpdated();
|
|
};
|
|
|
|
#endif // CONFIGURATION_H
|