From 8e1c1caab7c8637ba6713d00aff0e948657dfa9e Mon Sep 17 00:00:00 2001 From: Isabell Pflug Date: Thu, 1 Jun 2023 10:16:57 +0200 Subject: [PATCH] :fire: Removed old and bad documentation --- ThinkPink/main.cpp | 10 +++------- ThinkPink/mainwindow.cpp | 4 ---- ThinkPink/samegame.cpp | 6 ------ 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/ThinkPink/main.cpp b/ThinkPink/main.cpp index 136acc9..d8f8e1c 100644 --- a/ThinkPink/main.cpp +++ b/ThinkPink/main.cpp @@ -5,25 +5,21 @@ #include #include -// maximum level an safety! std::unique_ptr settings; -// funktioniert komplett plattformunabhängig! -// sogar auf Android, wenn man wahnsinnig sein sollte! -void initialise_settings() { // sucht für die Config Datei an diversen sinnvollen Orten +void initialise_settings() { QString config_filename = "ThinkPink.ini"; QString config_path = ""; - // priorisiert Config Datei, die direkt neben der Binary liegt, falls vorhanden QString prio_path = QDir(QCoreApplication::applicationDirPath()).filePath(config_filename); if (QFileInfo::exists(prio_path)) { config_path = prio_path; } - else {// schaut an den gängigen Orten (abhängig vom Betriebssystem) nach der Config-Datei + else { QList locations{ QStandardPaths::ConfigLocation, QStandardPaths::AppConfigLocation}; for (long long i = 0; i < locations.size(); i++) { config_path = QStandardPaths::locate( locations.value(i), config_filename); - if (config_path != "") // config found + if (config_path != "") break; } } diff --git a/ThinkPink/mainwindow.cpp b/ThinkPink/mainwindow.cpp index 93c1c2e..9958728 100644 --- a/ThinkPink/mainwindow.cpp +++ b/ThinkPink/mainwindow.cpp @@ -111,13 +111,11 @@ QMap, int> MainWindow::newEntry() { QLCDNumber *lcdNumber = new QLCDNumber(); lcdNumber->display(ui->lcdScore->intValue()); - // Verbinden des Button-Klicks mit einem Slot entryDial.connect(button, &QPushButton::clicked, &entryDial, [&]() { confirmed_name = lineEdit->text(); entryDial.done(0); }); - // Erstellen des Layouts QVBoxLayout *layout = new QVBoxLayout; QHBoxLayout *sub_layout1 = new QHBoxLayout; QHBoxLayout *sub_layout2 = new QHBoxLayout; @@ -257,7 +255,6 @@ void MainWindow::showHighscore_triggered() { highscoreDial.exec(); } -// slots void MainWindow::button_clicked(int row, int column) { MainWindow::setEnabled(false); if(game->getCell(row, column) != "none") { @@ -302,7 +299,6 @@ void MainWindow::newGame_triggered() { } } -// initialisation functions void MainWindow::initialiseGame() { game->initialiseGameMatrix(rows, columns); initialiseGameGrid(); diff --git a/ThinkPink/samegame.cpp b/ThinkPink/samegame.cpp index e3b2335..5bc6499 100644 --- a/ThinkPink/samegame.cpp +++ b/ThinkPink/samegame.cpp @@ -1,6 +1,5 @@ #include "samegame.h" -// ist es nicht cool? extern std::unique_ptr settings; void SameGame::initialiseGameMatrix(int rows, int columns) { @@ -11,7 +10,6 @@ void SameGame::initialiseGameMatrix(int rows, int columns) { for (int i = 0; i < rows; i++) { t_row.clear(); for (int j = 0; j < columns; j++) { - // wähle zufällige Farbe aus den verfügbaren Farben t_row.push_back( colors[rand() % colors.size()] ); } gameMatrix.push_back(std::move(t_row)); @@ -20,7 +18,6 @@ void SameGame::initialiseGameMatrix(int rows, int columns) { SameGame::SameGame(int rows, int columns) : colors(settings->value("colors/colors", QList() << "#A90A5A" << "#FFD1D9" << "#DB7093" << "#F7A8B8" << "#660033").toStringList()) - // also ich finds echt cool! { initialiseGameMatrix(rows, columns); } @@ -34,11 +31,8 @@ void SameGame::setCell(int row, int column, QString color) { } void SameGame::checkNeighbour(std::set> *connectedSet, QString color, int row, int column) { - // check for grid boundaries if (row > -1 && column > -1 && (unsigned long) row < gameMatrix.size() && (unsigned long) column < gameMatrix[0].size()) { - // check if already visited if ( !(connectedSet->contains(std::vector{row, column})) ) { - // check color if (gameMatrix[row][column] == color) getConnected(connectedSet, color, row, column); }