From 5e1cc9feae465d937cdf66c71a38c13bcff8c86f Mon Sep 17 00:00:00 2001 From: thjazi Date: Mon, 11 May 2020 23:55:05 +0200 Subject: [PATCH] better popup --- res/html/about.html | 21 +++++++++++++++++ res/html/doc.html | 4 ++++ res/html/help.html | 52 +++++++++++++++++++++++++++++++++++++++++++ res/html/licence.html | 6 +++++ shortcut.txt | 20 +++++++++++++++++ src/ui/MainWindow.cpp | 50 ++++++++++++++++++++++++----------------- 6 files changed, 133 insertions(+), 20 deletions(-) create mode 100644 res/html/about.html create mode 100644 res/html/doc.html create mode 100644 res/html/help.html create mode 100644 res/html/licence.html create mode 100644 shortcut.txt diff --git a/res/html/about.html b/res/html/about.html new file mode 100644 index 0000000..a9b3b36 --- /dev/null +++ b/res/html/about.html @@ -0,0 +1,21 @@ +

Contexte

+

Ce projet à été réalisé dans le cadre de notre 3eme année +d'informatique à l'université Savoie Mont-blanc.

+

Contacts :

+ \ No newline at end of file diff --git a/res/html/doc.html b/res/html/doc.html new file mode 100644 index 0000000..7b2cf67 --- /dev/null +++ b/res/html/doc.html @@ -0,0 +1,4 @@ +

Aging's documentation :

+

Documentation génerée par DOxygen : +http://93.7.113.241/aging/index.html

+ diff --git a/res/html/help.html b/res/html/help.html new file mode 100644 index 0000000..d37f38e --- /dev/null +++ b/res/html/help.html @@ -0,0 +1,52 @@ +

Help

+

Ce programme permet de calculer les évolutions du jeu de la vie selon 2 algorithmes.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Aging's Shortcut :
Play/pause -> Key_Space
Onestep -> Key_P
Increase speed -> CTRL + Key_Plus
Decrease speed -> CTRL + Key_Minus
Fit patern -> Key_F
Zoom in -> Key_Plus
Zoom out -> Key_Minus
New file -> CTRL + Key_N
Open file -> CTRL + Key_O
Save file -> CTRL + Key_S
Quit -> CTRL + Key_Q
Move up -> Key_Up or Key_Z
Move down -> Key_Down or Key_S
Move left -> Key_Left or Key_Q
Move right -> Key_Right or Key_D
\ No newline at end of file diff --git a/res/html/licence.html b/res/html/licence.html new file mode 100644 index 0000000..c31ba23 --- /dev/null +++ b/res/html/licence.html @@ -0,0 +1,6 @@ +

GNU GENERAL PUBLIC LICENSE

+ +

Version 3, 29 June 2007 Copyright (C) 2007 + Free Software Foundation, Inc. http://fsf.org/

+

Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed.

diff --git a/shortcut.txt b/shortcut.txt new file mode 100644 index 0000000..a398135 --- /dev/null +++ b/shortcut.txt @@ -0,0 +1,20 @@ +Aging's Shortcut : +Play/pause -> Key_Space +OneStep -> Key_P +increase_speed -> CTRL + Key_Plus +decrease_speed -> CTRL + Key_Minus +fit_patern -> Key_F +zoom_In -> Key_Plus +zoom_Out -> Key_Minus +new_file -> CTRL + Key_N +open_file -> CTRL + Key_O +save_file -> CTRL + Key_S +act_quit -> CTRL + Key_Q +move_up -> Key_Z +move_up -> Key_Up +move_down -> Key_S +move_down -> Key_Down +move_left -> Key_Q +move_left -> Key_Left +move_right -> Key_D +move_right -> Key_Right \ No newline at end of file diff --git a/src/ui/MainWindow.cpp b/src/ui/MainWindow.cpp index 0c54c9f..685b90b 100644 --- a/src/ui/MainWindow.cpp +++ b/src/ui/MainWindow.cpp @@ -3,6 +3,8 @@ #include #include +#include +#include #include #include #include @@ -495,43 +497,51 @@ void MainWindow::action_darkTheme() { } void MainWindow::action_help() { + QFile file("../res/html/help.html"); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { return; } + QString text; + QTextStream in(&file); + while (!in.atEnd()) { text += in.readLine(); } QMessageBox msgBox; msgBox.setWindowTitle("Help"); - std::string s; - s += "Ce programme permet de calculer l'evolution d'une grille "; - s += "du jeu de la vie selon 2 algorithmes."; - msgBox.setText(s.c_str()); + msgBox.setTextFormat(Qt::RichText); + msgBox.setText(text); msgBox.exec(); } void MainWindow::action_documentation() { + QFile file("../res/html/doc.html"); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { return; } + QString text; + QTextStream in(&file); + while (!in.atEnd()) { text += in.readLine(); } QMessageBox msgBox; msgBox.setWindowTitle("Documentation"); - std::string s; - s += "Aging's documentation : "; - s += "http://93.7.113.241/aging/index.html"; - msgBox.setText(s.c_str()); + msgBox.setTextFormat(Qt::RichText); + msgBox.setText(text); msgBox.exec(); } void MainWindow::action_licence() { + QFile file("../res/html/licence.html"); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { return; } + QString text; + QTextStream in(&file); + while (!in.atEnd()) { text += in.readLine(); } QMessageBox msgBox; msgBox.setWindowTitle("Licence"); - // msgBox.setTextFormat(Qt::TextFormat::AlignHCenter); - std::string s; - s += "GNU GENERAL PUBLIC LICENSE\n"; - s += "Version 3, 29 June 2007 "; - s += "Copyright (C) 2007 Free Software Foundation, Inc. \n"; - s += "Everyone is permitted to copy and distribute verbatim copies "; - s += "of this license document, but changing it is not allowed."; - msgBox.setText(s.c_str()); + msgBox.setTextFormat(Qt::RichText); + msgBox.setText(text); msgBox.exec(); } void MainWindow::action_about() { + QFile file("../res/html/about.html"); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { return; } + QString text; + QTextStream in(&file); + while (!in.atEnd()) { text += in.readLine(); } QMessageBox msgBox; msgBox.setWindowTitle("About"); - std::string s; - s += "Ce projet à été réalisé dans le cadre de notre 3eme année "; - s += "d'informatique à l'université Savoie Mont-blanc."; - msgBox.setText(s.c_str()); + msgBox.setTextFormat(Qt::RichText); + msgBox.setText(text); msgBox.exec(); }