src/basics.cpp

changeset 1323
05b3e173c900
parent 1319
39d7a9642eea
child 1324
563a9b65777b
--- a/src/basics.cpp	Sat Mar 24 12:09:26 2018 +0200
+++ b/src/basics.cpp	Sat Mar 24 12:34:20 2018 +0200
@@ -16,10 +16,13 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <QApplication>
+#include <QSettings>
 #include <QLineF>
 #include "basics.h"
 #include "types/vertex.h"
 #include "format.h"
+#include "version.h"
 
 int gcd(int a, int b)
 {
@@ -86,3 +89,15 @@
 	magnitude = qBound(0, magnitude, countof(suffixes) - 1);
 	return QString::number(size / pow(1000, magnitude)) + suffixes[magnitude];
 }
+
+/*
+ * Returns a settings object that interfaces the ini file.
+ */
+QSettings& settingsObject()
+{
+	static QSettings settings {
+		qApp->applicationDirPath() + "/" UNIXNAME ".ini",
+		QSettings::IniFormat
+	};
+	return settings;
+}

mercurial