#include "mainwindow.h"
#include "ui_mainwindow.h"

extern std::unique_ptr<QSettings> settings;

// initialisation functions
void MainWindow::initialiseGameGrid() {
    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() {
    MainWindow::setWindowTitle("ThinkPink | SameGame in PINK by Isifluff");
    MainWindow::setWindowIcon(QIcon(":/icons/ThinkPink.png"));
}

void MainWindow::initialiseMenuBar() {
    ui->menuPlay->addAction(QIcon(":/icons/game.png"), "New Game");
    ui->menuPlay->addSeparator();
    //ui->menuPlay->addAction("Brag");
}

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);

    initialiseGameGrid();
    initialiseWindow();
    initialiseMenuBar();
}

MainWindow::~MainWindow()
{
    delete ui;
}

