From 55125b7dd2ed225a82a2ff430cab61029d10a188 Mon Sep 17 00:00:00 2001 From: Isabell Pflug Date: Tue, 23 May 2023 19:13:34 +0200 Subject: [PATCH] :sparkles: Added config file for game setup --- assignments/06/ThinkPink/main.cpp | 16 ++++++++++++++++ assignments/06/ThinkPink/mainwindow.cpp | 2 ++ assignments/06/ThinkPink/mainwindow.ui | 17 ++++++++++++++++- assignments/06/ThinkPink/thinkpink.ini | 7 +++++++ 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 assignments/06/ThinkPink/thinkpink.ini diff --git a/assignments/06/ThinkPink/main.cpp b/assignments/06/ThinkPink/main.cpp index fd3e533..c724fe7 100644 --- a/assignments/06/ThinkPink/main.cpp +++ b/assignments/06/ThinkPink/main.cpp @@ -1,6 +1,22 @@ #include "mainwindow.h" +#include #include +#include +#include +#include + +std::unique_ptr settings; + +void find_config() { + QString config_string = QStandardPaths::locate( QStandardPaths::ConfigLocation, "ThinkPink.ini"); + if (config_string == "") { + config_string = QDir(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)).filePath("ThinkPink.ini"); + std::cout << "No config file found. Creating default config at " << config_string.toStdString(); + } + settings.reset( new QSettings( ) ); +} + int main(int argc, char *argv[]) { diff --git a/assignments/06/ThinkPink/mainwindow.cpp b/assignments/06/ThinkPink/mainwindow.cpp index 41a26bd..4b29d95 100644 --- a/assignments/06/ThinkPink/mainwindow.cpp +++ b/assignments/06/ThinkPink/mainwindow.cpp @@ -1,3 +1,5 @@ +#include + #include "mainwindow.h" #include "ui_mainwindow.h" diff --git a/assignments/06/ThinkPink/mainwindow.ui b/assignments/06/ThinkPink/mainwindow.ui index b232854..de091fd 100644 --- a/assignments/06/ThinkPink/mainwindow.ui +++ b/assignments/06/ThinkPink/mainwindow.ui @@ -14,7 +14,22 @@ MainWindow - + + + + 0 + 0 + 800 + 26 + + + + + ThinkPink + + + + diff --git a/assignments/06/ThinkPink/thinkpink.ini b/assignments/06/ThinkPink/thinkpink.ini new file mode 100644 index 0000000..4cd3a2a --- /dev/null +++ b/assignments/06/ThinkPink/thinkpink.ini @@ -0,0 +1,7 @@ +[size] +columns = 9 +rows = 9 + +[colors] +colors = 0xBD005E, 0xFFC0CB, 0xDB7093, 0xF7A8B8 +;, 0xDB7093