summaryrefslogtreecommitdiff
path: root/src/Preferences.h
blob: 79fa7ab6682a830e656232a427d40c15b11a2f23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef PREFERENCES_H_
#define PREFERENCES_H_

#include <QMainWindow>
#include <QSettings>
#include "ui_Preferences.h"

class Preferences : public QMainWindow, public Ui::Preferences
{
	Q_OBJECT;

public:
	~Preferences();
	static Preferences *inst() { if (!instance) instance = new Preferences(); return instance; }

	enum RenderColor {
		BACKGROUND_COLOR,
		OPENCSG_FACE_FRONT_COLOR,
		OPENCSG_FACE_BACK_COLOR,
		CGAL_FACE_FRONT_COLOR,
		CGAL_FACE_2D_COLOR,
		CGAL_FACE_BACK_COLOR,
		CGAL_EDGE_FRONT_COLOR,
		CGAL_EDGE_BACK_COLOR,
		CGAL_EDGE_2D_COLOR,
		CROSSHAIR_COLOR
	};
	const QColor &color(RenderColor idx);
	QVariant getValue(const QString &key) const;
	void apply() const;

public slots:
	void actionTriggered(class QAction *);
	void colorSchemeChanged();
	void fontFamilyChanged(const QString &);
	void fontSizeChanged(const QString &);
	void OpenGL20WarningChanged(bool);

signals:
	void requestRedraw() const;
	void fontChanged(const QString &family, uint size) const;

private:
	Preferences(QWidget *parent = NULL);
	void keyPressEvent(QKeyEvent *e);
	void updateGUI();
	void removeDefaultSettings();

	QSettings::SettingsMap defaultmap;
	QHash<QString, QMap<RenderColor, QColor> > colorschemes;

	static Preferences *instance;
};

#endif
contact: Jan Huwald // Impressum