Codebase list cutemaze / 8de0b97
Import upstream version 1.3.1 Debian Janitor 1 year, 5 months ago
21 changed file(s) with 62 addition(s) and 184 deletion(s). Raw diff Collapse all Expand all
00 cmake_minimum_required(VERSION 3.16.0)
11
22 # Configure project
3 project(cutemaze VERSION 1.3.0 LANGUAGES CXX)
3 project(cutemaze VERSION 1.3.1 LANGUAGES CXX)
44
55 set(CMAKE_CXX_STANDARD 17)
66 set(CMAKE_CXX_STANDARD_REQUIRED ON)
1313 include(GNUInstallDirs)
1414 endif()
1515
16 add_compile_definitions(
17 QT_STRICT_ITERATORS
18 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
19 QT_DISABLE_DEPRECATED_BEFORE=0x060000
20 )
16 if(CMAKE_BUILD_TYPE STREQUAL "Debug")
17 add_compile_definitions(
18 QT_STRICT_ITERATORS
19 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
20 QT_DISABLE_DEPRECATED_BEFORE=0x060300
21 )
22 endif()
2123
2224 # Create translations
2325 file(GLOB translations_SRCS translations/*.ts)
7678 QT_TARGET_VERSION "${PROJECT_VERSION}"
7779 QT_TARGET_COMPANY_NAME "Graeme Gott"
7880 QT_TARGET_DESCRIPTION "Simple maze game"
79 QT_TARGET_COPYRIGHT "Copyright (C) 2021 Graeme Gott"
81 QT_TARGET_COPYRIGHT "Copyright (C) 2022 Graeme Gott"
8082 QT_TARGET_PRODUCT_NAME "CuteMaze"
8183 QT_TARGET_RC_ICONS ${CMAKE_SOURCE_DIR}/icons/cutemaze.ico
8284 )
0 1.3.1
1 -----
2 * Switched to Qt 6.
3 * Translation updates: Dutch, Turkish.
4
05 1.3.0
16 -----
27 * Added pausing when menus are shown.
+0
-104
cutemaze.pro less more
0 !versionAtLeast(QT_VERSION, 5.12) {
1 error("CuteMaze requires Qt 5.12 or greater")
2 }
3
4 TEMPLATE = app
5 QT += svg widgets
6 CONFIG += c++17
7
8 CONFIG(debug, debug|release) {
9 CONFIG += warn_on
10 DEFINES += QT_DEPRECATED_WARNINGS
11 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000
12 DEFINES += QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
13 }
14
15 # Allow in-tree builds
16 MOC_DIR = build
17 OBJECTS_DIR = build
18 RCC_DIR = build
19
20 # Set program version
21 VERSION = 1.3.0
22 DEFINES += VERSIONSTR=\\\"$${VERSION}\\\"
23
24 # Set program name
25 unix: !macx {
26 TARGET = cutemaze
27 } else {
28 TARGET = CuteMaze
29 }
30
31 # Specify program sources
32 HEADERS = src/board.h \
33 src/cell.h \
34 src/locale_dialog.h \
35 src/maze.h \
36 src/new_game_dialog.h \
37 src/path.h \
38 src/scores_dialog.h \
39 src/settings.h \
40 src/solver.h \
41 src/theme.h \
42 src/window.h
43
44 SOURCES = src/board.cpp \
45 src/cell.cpp \
46 src/locale_dialog.cpp \
47 src/main.cpp \
48 src/maze.cpp \
49 src/new_game_dialog.cpp \
50 src/path.cpp \
51 src/scores_dialog.cpp \
52 src/settings.cpp \
53 src/solver.cpp \
54 src/theme.cpp \
55 src/window.cpp
56
57 # Generate translations
58 TRANSLATIONS = $$files(translations/cutemaze_*.ts)
59 qtPrepareTool(LRELEASE, lrelease)
60 updateqm.input = TRANSLATIONS
61 updateqm.output = ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.qm
62 updateqm.commands = $$LRELEASE -silent ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_OUT}
63 updateqm.CONFIG += no_link target_predeps
64 QMAKE_EXTRA_COMPILERS += updateqm
65
66 # Install program data
67 RESOURCES = icons/icons.qrc themes/theme.qrc preview/preview.qrc
68 macx {
69 ICON = icons/cutemaze.icns
70 } else:win32 {
71 RC_ICONS = icons/cutemaze.ico
72 QMAKE_TARGET_DESCRIPTION = "Simple maze game"
73 QMAKE_TARGET_COPYRIGHT = "Copyright (C) 2021 Graeme Gott"
74 } else:unix {
75 RESOURCES += icons/icon.qrc
76
77 isEmpty(PREFIX) {
78 PREFIX = /usr/local
79 }
80 isEmpty(BINDIR) {
81 BINDIR = bin
82 }
83
84 target.path = $$PREFIX/$$BINDIR/
85
86 icon.files = icons/hicolor/*
87 icon.path = $$PREFIX/share/icons/hicolor/
88
89 desktop.files = icons/cutemaze.desktop
90 desktop.path = $$PREFIX/share/applications/
91
92 appdata.files = icons/cutemaze.appdata.xml
93 appdata.path = $$PREFIX/share/metainfo/
94
95 qm.files = $$replace(TRANSLATIONS, .ts, .qm)
96 qm.path = $$PREFIX/share/cutemaze/translations
97 qm.CONFIG += no_check_exist
98
99 man.files = doc/cutemaze.6
100 man.path = $$PREFIX/share/man/man6
101
102 INSTALLS += target icon desktop appdata qm man
103 }
3030 <summary xml:lang="pl">Znajdź cele w labiryncie</summary>
3131 <summary xml:lang="pt">Procura alvos num labirinto</summary>
3232 <summary xml:lang="ro">Căutaţi ţintele într-un labirint</summary>
33 <summary xml:lang="tr">Labirentte hedefleri bul</summary>
3334 <summary xml:lang="zh">在迷宫中寻找目标</summary>
3435
3536 <description>
7677 <content_rating type="oars-1.1"/>
7778
7879 <releases>
80 <release version="1.3.1" date="2022-05-03">
81 <description>
82 <ul>
83 <li>Switched to Qt 6</li>
84 <li>Translation updates: Dutch, Turkish</li>
85 </ul>
86 </description>
87 </release>
7988 <release version="1.3.0" date="2021-05-06">
8089 <description>
8190 <ul>
4343 Comment[pl]=Znajdź cele w labiryncie
4444 Comment[pt]=Procura alvos num labirinto
4545 Comment[ro]=Căutaţi ţintele într-un labirint
46 Comment[tr]=Labirentte hedefleri bul
4647 Comment[zh]=在迷宫中寻找目标
48 TryExec=cutemaze
4749 Exec=cutemaze
4850 Icon=cutemaze
4951 Terminal=false
1010 "Project-Id-Version: CuteMaze\n"
1111 "Report-Msgid-Bugs-To: \n"
1212 "POT-Creation-Date: 2018-05-27 19:05-0400\n"
13 "PO-Revision-Date: 2018-05-27 23:12+0000\n"
14 "Last-Translator: Graeme Gott <graeme@gottcode.org>\n"
13 "PO-Revision-Date: 2018-09-26 19:18+0000\n"
14 "Last-Translator: RobertBorst <webmaster@fam-borst.nl>\n"
1515 "Language-Team: Dutch (http://www.transifex.com/gottcode/cutemaze/language/"
1616 "nl/)\n"
1717 "Language: nl\n"
22 # This file is distributed under the same license as the CuteMaze package.
33 #
44 # Translators:
5 # Cuneyt Oktay <cuneytoktay@gmail.com>, 2021
56 msgid ""
67 msgstr ""
78 "Project-Id-Version: CuteMaze\n"
89 "Report-Msgid-Bugs-To: \n"
910 "POT-Creation-Date: 2018-05-27 19:05-0400\n"
10 "PO-Revision-Date: 2018-05-27 23:15+0000\n"
11 "Last-Translator: Graeme Gott <graeme@gottcode.org>\n"
11 "PO-Revision-Date: 2014-11-13 16:22+0000\n"
12 "Last-Translator: Cuneyt Oktay <cuneytoktay@gmail.com>, 2021\n"
1213 "Language-Team: Turkish (http://www.transifex.com/gottcode/cutemaze/language/"
1314 "tr/)\n"
1415 "Language: tr\n"
2324
2425 #: ../cutemaze.appdata.xml.in:7 ../cutemaze.desktop.in:5
2526 msgid "Find targets in a maze"
26 msgstr ""
27 msgstr "Labirentte hedefleri bul"
2728
2829 #: ../cutemaze.appdata.xml.in:10
2930 msgid ""
11
22 APP='CuteMaze'
33 BUNDLE="$APP.app"
4 VERSION='1.3.0'
4 VERSION='1.3.1'
55
66 # Remove any previous disk folder or DMG
77 echo -n 'Preparing... '
9494 if (translator.load(m_appname + locale, m_path)) {
9595 QCoreApplication::installTranslator(&translator);
9696
97 #if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
9897 const QString path = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
99 #else
100 const QString path = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
101 #endif
10298
10399 static QTranslator qtbase_translator;
104100 if (qtbase_translator.load("qtbase_" + locale, m_path) || qtbase_translator.load("qtbase_" + locale, path)) {
1212
1313 int main(int argc, char** argv)
1414 {
15 #if (QT_VERSION < QT_VERSION_CHECK(6,0,0))
16 #if !defined(Q_OS_MAC)
17 if (!qEnvironmentVariableIsSet("QT_DEVICE_PIXEL_RATIO")
18 && !qEnvironmentVariableIsSet("QT_AUTO_SCREEN_SCALE_FACTOR")
19 && !qEnvironmentVariableIsSet("QT_SCALE_FACTOR")
20 && !qEnvironmentVariableIsSet("QT_SCREEN_SCALE_FACTORS")) {
21 QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
22 }
23 #endif
24 QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
25 #endif
2615 QApplication app(argc, argv);
2716 app.setApplicationName("CuteMaze");
2817 app.setApplicationVersion(VERSIONSTR);
1515
1616 void HuntAndKillMaze::generate()
1717 {
18 m_visited = QVector<QVector<bool>>(columns(), QVector<bool>(rows()));
18 m_visited = QList<QList<bool>>(columns(), QList<bool>(rows()));
1919 m_unvisited = columns() * rows();
2020
2121 QPoint current(0, randomInt(rows()));
8484 void KruskalMaze::generate()
8585 {
8686 // Generate sets
87 m_set_ids = QVector<QVector<Set*>>(columns(), QVector<Set*>(rows()));
87 m_set_ids = QList<QList<Set*>>(columns(), QList<Set*>(rows()));
8888 for (int c = 0; c < columns(); ++c) {
8989 for (int r = 0; r < rows(); ++r) {
9090 m_sets.push_back(QList<QPoint>() << QPoint(c, r));
137137 void PrimMaze::generate()
138138 {
139139 // Generate cell lists
140 m_regions = QVector<QVector<int>>(columns(), QVector<int>(rows(), 0));
140 m_regions = QList<QList<int>>(columns(), QList<int>(rows(), 0));
141141
142142 // Move first cell
143143 QPoint cell(0, randomInt(columns()));
214214
215215 void RecursiveBacktrackerMaze::generate()
216216 {
217 m_visited = QVector<QVector<bool>>(columns(), QVector<bool>(rows()));
217 m_visited = QList<QList<bool>>(columns(), QList<bool>(rows()));
218218
219219 QPoint start(0, randomInt(rows()));
220220 m_visited[start.x()][start.y()] = true;
242242 void StackMaze::generate()
243243 {
244244 // Generate cell lists
245 m_visited = QVector<QVector<bool>>(columns(), QVector<bool>(rows()));
245 m_visited = QList<QList<bool>>(columns(), QList<bool>(rows()));
246246 QList<QPoint> active;
247247
248248 // Start maze
326326 m_random = random;
327327 m_columns = columns;
328328 m_rows = rows;
329 m_cells = QVector<QVector<Cell>>(m_columns, QVector<Cell>(m_rows));
329 m_cells = QList<QList<Cell>>(m_columns, QList<Cell>(m_rows));
330330 generate();
331331 random = m_random;
332332 }
348348 }
349349
350350 // Deserialize data
351 #if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
352351 QDataStream stream(&data, QDataStream::ReadOnly);
353 #else
354 QDataStream stream(&data, QIODevice::ReadOnly);
355 #endif
356352 stream.setVersion(QDataStream::Qt_5_12);
357353 for (int c = 0; c < m_columns; ++c) {
358354 for (int r = 0; r < m_rows; ++r) {
376372 {
377373 // Serialize data
378374 QByteArray data;
379 #if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
380375 QDataStream stream(&data, QDataStream::WriteOnly);
381 #else
382 QDataStream stream(&data, QIODevice::WriteOnly);
383 #endif
384376 stream.setVersion(QDataStream::Qt_5_12);
385377 for (int c = 0; c < m_columns; ++c) {
386378 for (int r = 0; r < m_rows; ++r) {
420412
421413 //-----------------------------------------------------------------------------
422414
423 QPoint Maze::randomNeighbor(QVector<QVector<bool>>& visited, const QPoint& cell)
415 QPoint Maze::randomNeighbor(QList<QList<bool>>& visited, const QPoint& cell)
424416 {
425417 // Find unvisited neighbors
426418 QPoint neighbors[4];
1010
1111 #include <QList>
1212 #include <QPoint>
13 #include <QVector>
1413
1514 #include <list>
1615 #include <random>
5554 return gen(m_random);
5655 }
5756
58 QPoint randomNeighbor(QVector<QVector<bool>>& visited, const QPoint& cell);
57 QPoint randomNeighbor(QList<QList<bool>>& visited, const QPoint& cell);
5958
6059 private:
6160 virtual void generate() = 0;
6463 std::mt19937 m_random;
6564 int m_columns;
6665 int m_rows;
67 QVector<QVector<Cell>> m_cells;
66 QList<QList<Cell>> m_cells;
6867 };
6968
7069
7574 QPoint hunt();
7675
7776 private:
78 QVector<QVector<bool>> m_visited;
77 QList<QList<bool>> m_visited;
7978 int m_unvisited;
8079 };
8180
8887 private:
8988 typedef QList<QPoint> Set;
9089 std::list<Set> m_sets;
91 QVector<QVector<Set*>> m_set_ids;
90 QList<QList<Set*>> m_set_ids;
9291 };
9392
9493
102101
103102 private:
104103 QList<QPoint> m_frontier;
105 QVector<QVector<int>> m_regions;
104 QList<QList<int>> m_regions;
106105 };
107106
108107
113112 void makePath(const QPoint& current);
114113
115114 private:
116 QVector<QVector<bool>> m_visited;
115 QList<QList<bool>> m_visited;
117116 };
118117
119118
124123 virtual int nextActive(int size);
125124
126125 private:
127 QVector<QVector<bool>> m_visited;
126 QList<QList<bool>> m_visited;
128127 };
129128
130129
1313 : m_maze(maze)
1414 , m_start(start)
1515 , m_end(end)
16 , m_cells(maze->columns(), QVector<bool>(maze->rows(), false))
16 , m_cells(maze->columns(), QList<bool>(maze->rows(), false))
1717 {
1818 // Fill in dead ends
1919 for (int r = 0; r < m_maze->rows(); ++r) {
1111
1212 #include <QList>
1313 #include <QPoint>
14 #include <QVector>
1514
1615 class Path
1716 {
4342 Maze* m_maze;
4443 QPoint m_start;
4544 QPoint m_end;
46 QVector<QVector<bool>> m_cells;
45 QList<QList<bool>> m_cells;
4746 QList<QPoint> m_solution;
4847 };
4948
7979 divider->setFrameStyle(QFrame::HLine | QFrame::Sunken);
8080 m_scores_layout->addWidget(divider, 2, 0, 1, TotalColumns);
8181
82 QVector<Qt::Alignment> alignments(TotalColumns, Qt::AlignTrailing);
82 QList<Qt::Alignment> alignments(TotalColumns, Qt::AlignTrailing);
8383 alignments[NameColumn] = Qt::AlignLeading;
8484 alignments[AlgorithmColumn] = Qt::AlignHCenter;
8585 for (int r = 0; r < 10; ++r) {
160160 settings.beginWriteArray("Scores_Cutemaze");
161161 int index = 0;
162162 for (const QString& score : scores) {
163 #if (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
164163 const QStringList values = score.split(":", Qt::SkipEmptyParts);
165 #else
166 const QStringList values = score.split(":", QString::SkipEmptyParts);
167 #endif
168164 if (values.size() != 5) {
169165 continue;
170166 }
8383 QDir dir("", "*.svg");
8484 for (const QString& path : m_locations) {
8585 if (dir.cd(path)) {
86 #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
8786 const QStringList entries = dir.entryList();
8887 files += QSet<QString>(entries.begin(), entries.end());
89 #else
90 files += dir.entryList(QDir::Files).toSet();
91 #endif
9288 }
9389 }
9490
95 #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
9691 QStringList list(files.begin(), files.end());
97 #else
98 QStringList list = QStringList::fromSet(files);
99 #endif
10092 int count = list.count();
10193 for (int i = 0; i < count; ++i) {
10294 QString& theme = list[i];
00 /*
1 SPDX-FileCopyrightText: 2007-2021 Graeme Gott <graeme@gottcode.org>
1 // SPDX-FileCopyrightText: 2007-2022 Graeme Gott <graeme@gottcode.org>
22
33 SPDX-License-Identifier: GPL-3.0-or-later
44 */
149149 QMessageBox::about(this, tr("About"), QString("<p><center><big><b>%1 %2</b></big><br/>%3<br/><small>%4<br/>%5</small></center></p><p><center>%6<br/><small>%7</small></center></p>")
150150 .arg(tr("CuteMaze"), QCoreApplication::applicationVersion(),
151151 tr("A top-down maze game"),
152 tr("Copyright &copy; 2007-%1 Graeme Gott").arg("2021"),
152 tr("Copyright &copy; 2007-%1 Graeme Gott").arg("2022"),
153153 tr("Released under the <a href=%1>GPL 3</a> license").arg("\"http://www.gnu.org/licenses/gpl.html\""),
154154 tr("Icons are from the <a href=%1>Oxygen</a> theme").arg("\"http://www.oxygen-icons.org/\""),
155155 tr("Used under the <a href=%1>LGPL 3</a> license").arg("\"http://www.gnu.org/licenses/lgpl.html\""))
88 </message>
99 <message>
1010 <source>Unable to load previous game. A new game will be started.</source>
11 <translation>Het vorige spel kan niet worden gestart; er zal een nieuw spel worden gestart.</translation>
11 <translation>Het vorige spel kan niet worden gestart - er zal een nieuw spel worden gestart.</translation>
1212 </message>
1313 <message>
1414 <source>%1 elapsed</source>
1616 </message>
1717 <message>
1818 <source>%1 steps taken</source>
19 <translation>%1 genomen stappen</translation>
19 <translation>%1 stappen genomen</translation>
2020 </message>
2121 <message>
2222 <source>%1 of %2 targets remain</source>
2828 </message>
2929 <message>
3030 <source>Paused</source>
31 <translation>Gepauzeerd</translation>
31 <translation>Onderbroken</translation>
3232 </message>
3333 </context>
3434 <context>
7474 <name>LocaleDialog</name>
7575 <message>
7676 <source>Select application language:</source>
77 <translation>Selecteer de applicatietaal:</translation>
77 <translation>Kies de programmataal:</translation>
7878 </message>
7979 <message>
8080 <source>&lt;System Language&gt;</source>
211211 </message>
212212 <message>
213213 <source>Show where you&apos;ve been</source>
214 <translation>Laat zien waar je geweest bent</translation>
214 <translation>Genomen route tonen</translation>
215215 </message>
216216 <message>
217217 <source>Show number of steps taken</source>
334334 </message>
335335 <message>
336336 <source>&amp;Pause</source>
337 <translation>&amp;Pauzeren</translation>
337 <translation>&amp;Onderbreken</translation>
338338 </message>
339339 <message>
340340 <source>&amp;Hint</source>
362362 </message>
363363 <message>
364364 <source>Application &amp;Language...</source>
365 <translation>Programmataa&amp;l...</translation>
365 <translation>Programmataa&amp;l…</translation>
366366 </message>
367367 <message>
368368 <source>&amp;Preferences...</source>
394394 </message>
395395 <message>
396396 <source>Used under the &lt;a href=%1&gt;LGPL 3&lt;/a&gt; license</source>
397 <translation>Gebruikt onder de &lt;a href=%1&gt;LGPL 3&lt;/a&gt; licentie</translation>
397 <translation>Gebruikt onder de &lt;a href=%1&gt;LGPL 3&lt;/a&gt;-licentie</translation>
398398 </message>
399399 <message>
400400 <source>Ctrl+H</source>
8282 </message>
8383 <message>
8484 <source>Note</source>
85 <translation>Önemli</translation>
85 <translation>Not</translation>
8686 </message>
8787 <message>
8888 <source>Please restart this application for the change in language to take effect.</source>
33 !define APPNAME "CuteMaze"
44 !define VERSIONMAJOR 1
55 !define VERSIONMINOR 3
6 !define VERSIONPATCH 0
6 !define VERSIONPATCH 1
77 !define APPVERSION "${VERSIONMAJOR}.${VERSIONMINOR}.${VERSIONPATCH}"
88 !define ABOUTURL "https://gottcode.org/cutemaze/"
99
33
44 SET SRCDIR=..\cutemaze
55 SET APP=CuteMaze
6 SET VERSION=1.3.0
6 SET VERSION=1.3.1
77
88 ECHO Copying executable
99 MKDIR %SRCDIR%\%APP%