src/cfg.h

changeset 37
c82a86ea87be
parent 30
6b82f6a3ad53
child 39
2c368cf5cc19
--- a/src/cfg.h	Mon Jun 01 17:06:13 2015 +0300
+++ b/src/cfg.h	Fri Jun 05 18:33:51 2015 +0300
@@ -1,6 +1,6 @@
 /*
  *  ZCinema: Zandronum demo launcher
- *  Copyright (C) 2013 Santeri Piippo
+ *  Copyright (C) 2013-2015 Teemu Piippo
  *
  *  This program is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -16,49 +16,13 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef ZCINEMA_CFG_H
-#define ZCINEMA_CFG_H
-
-// =============================================================================
-#include <QString>
+#pragma once
 #include <QVariant>
-#include <QKeySequence>
-
-#define CONFIG(T, NAME, DEFAULT) namespace cfg { T NAME = DEFAULT; } \
-	cfg::ConfigAdder zz_ConfigAdder_##NAME (&cfg::NAME, cfg::T##Type, #NAME, DEFAULT);
-
-#define EXTERN_CONFIG(T, NAME) namespace cfg { extern T NAME; }
 
 // =========================================================
-namespace cfg {
-	enum Type {
-		IntType,
-		StringType,
-		FloatType,
-		BoolType,
-		KeySeqType,
-		ListType,
-		MapType,
-	};
-	
-	// Type-definitions for the above enum list
-	typedef int Int;
-	typedef QString String;
-	typedef float Float;
-	typedef bool Bool;
-	typedef QKeySequence KeySeq;
-	typedef QList<QVariant> List;
-	typedef QMap<QString, QVariant> Map;
-	
-	// ------------------------------------------
-	bool load();
-	bool save();
+namespace Config
+{
 	void reset();
-	
-	class ConfigAdder {
-	public:
-		ConfigAdder (void* ptr, Type type, const char* name, QVariant def);
-	};
-};
-
-#endif // ZCINEMA_CFG_H
\ No newline at end of file
+	QVariant get (const QString& name);
+	bool set(const QString& name, const QVariant& value);
+};
\ No newline at end of file

mercurial