diff --git a/assignments/06/ThinkPink/main.cpp b/assignments/06/ThinkPink/main.cpp index 6d3bc64..5f0cb49 100644 --- a/assignments/06/ThinkPink/main.cpp +++ b/assignments/06/ThinkPink/main.cpp @@ -1,6 +1,5 @@ #include "mainwindow.h" -#include #include #include #include @@ -14,10 +13,6 @@ std::unique_ptr settings; // sogar auf Android, wenn man wahnsinnig sein sollte! void initialise_settings() { 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() << std::endl; - } settings.reset( new QSettings( config_string, QSettings::IniFormat ) ); } diff --git a/assignments/06/ThinkPink/mainwindow.cpp b/assignments/06/ThinkPink/mainwindow.cpp index f47116b..4cca7b5 100644 --- a/assignments/06/ThinkPink/mainwindow.cpp +++ b/assignments/06/ThinkPink/mainwindow.cpp @@ -3,17 +3,14 @@ extern std::unique_ptr settings; -void MainWindow::initialiseAbout() { - QCoreApplication::setOrganizationName("Isabell Elise"); - QCoreApplication::setOrganizationDomain("https://liberapay.com/isabell-elise/"); - QCoreApplication::setApplicationName("ThinkPink"); -} - +// initialisation functions void MainWindow::initialiseGameGrid() { - int n_rows = settings->value("size/rows", 9).toInt(); - int n_columns = settings->value("size/columns", 9).toInt(); - std::cout << "Number of rows: " << n_rows << std::endl; - std::cout << "Number of columns: " << n_columns << std::endl; + qDebug() << "Number of rows: " << n_rows; + qDebug() << "Number of columns: " << n_columns; + qDebug() << "Colors: "; + for (long long i = 0; i < colors.size(); i++) { + qDebug() << colors.value(i); + } } void MainWindow::initialiseWindow() { @@ -30,9 +27,12 @@ void MainWindow::initialiseMenuBar() { MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) + , n_rows(settings->value("size/rows", 9).toInt()) + , n_columns(settings->value("size/columns", 9).toInt()) + , colors(settings->value("colors/colors", QStringList() << "0xBD005E" << "0xFFC0CB" << "0xDB7093" << "0xF7A8B8" << "0x660033").toStringList()) { ui->setupUi(this); - initialiseAbout(); + initialiseGameGrid(); initialiseWindow(); initialiseMenuBar(); diff --git a/assignments/06/ThinkPink/mainwindow.h b/assignments/06/ThinkPink/mainwindow.h index deae66a..a4ecdf9 100644 --- a/assignments/06/ThinkPink/mainwindow.h +++ b/assignments/06/ThinkPink/mainwindow.h @@ -2,6 +2,9 @@ #define MAINWINDOW_H #include +#include + +#include #include #include @@ -16,12 +19,15 @@ class MainWindow : public QMainWindow public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); - void initialiseAbout(); + // initialisation functions void initialiseGameGrid(); void initialiseWindow(); void initialiseMenuBar(); private: Ui::MainWindow *ui; + const int n_rows; + const int n_columns; + const QStringList colors; }; #endif // MAINWINDOW_H