Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
panmareksadowski committed May 11, 2020
0 parents commit 510a800
Show file tree
Hide file tree
Showing 61 changed files with 5,417 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*pro.user
*.autosave
674 changes: 674 additions & 0 deletions COPYING

Large diffs are not rendered by default.

674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

105 changes: 105 additions & 0 deletions Pandemic-simulator.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#Copyright 2020 Marek Sadowski

#This file is part of Pandemic-simulator.
#Pandemic-simulator is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 3 of the License, or
#(at your option) any later version.

#Pandemic-simulator is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.

#You should have received a copy of the GNU General Public License
#along with Pandemic-simulator. If not, see <http://www.gnu.org/licenses/>.

!versionAtLeast(QT_VERSION, 5.14.0):error("The minimum Qt required version is 5.14.0.")

VERSION = 1.0.0
DEFINES += APPLICATION_VERSION='\\"$${VERSION}\\"'

#if c++ compiler has --version command line options
system("$$QMAKE_CXX --version"){
#get --version output
COMPILER_VERSION = $$system("$$QMAKE_CXX --version", lines)
#get only first line if --version produce multiline output
#for g++ first line has all important info
COMPILER_VERSION = $$first(COMPILER_VERSION)
DEFINES += COMPILER_VERSION='\\"$$shell_quote($$COMPILER_VERSION)\\"'
} else {
#if compiler has no --version command line options just get compiler name
DEFINES += COMPILER_VERSION='\\"$$QMAKE_CXX\\"'
}

QT += multimedia quickcontrols2 charts concurrent
CONFIG += c++17

# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Refer to the documentation for the
# deprecated API to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

SOURCES += \
src/application.cpp \
src/deadpersonsremover.cpp \
src/drawingtoolscontroller.cpp \
src/main.cpp \
src/models/map.cpp \
src/models/person.cpp \
src/models/personposition.cpp \
src/models/personslist.cpp \
src/models/personstatus.cpp \
src/models/simulationsettings.cpp \
src/models/simulationstatistics.cpp \
src/periodicallyinvoker.cpp \
src/personsmovecontroller.cpp \
src/recoveredpersonsmarker.cpp \
src/simulationcontroller.cpp \
src/simulationdrawer.cpp \
src/simulationexecutor.cpp \
src/simulationvideoprovider.cpp

RESOURCES += \
resources.qrc

# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =

# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

INCLUDEPATH += src/

HEADERS += \
src/application.h \
src/deadpersonsremover.h \
src/drawingtoolscontroller.h \
src/models/applicationsettings.hpp \
src/models/map.h \
src/models/person.h \
src/models/personposition.h \
src/models/personslist.h \
src/models/personstatus.h \
src/models/simulation.hpp \
src/models/simulationsettings.h \
src/models/simulationstatistics.h \
src/periodicallyinvoker.h \
src/personsmovecontroller.h \
src/recoveredpersonsmarker.h \
src/simulationcontroller.h \
src/simulationdrawer.h \
src/simulationexecutor.h \
src/simulationvideoprovider.h \
src/utils/applicationcolors.hpp \
src/utils/enums.h \
src/utils/geometry.hpp \
src/utils/randomgeneretor.hpp

win32: RC_ICONS = icon.ico
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Pandemic-simulator

## Description
Program Pandemic-simulator provides visualization of a simple model of the virus(e.g. COVID-19) spreading during a pandemic. The model can be customized by different parameters such as spread distance, spread chance, mortality, recovering time, population size, and area size, also some parts of the population can be to lock down or separate from other parts. Model is a big simplification of reality and can not be used for any prediction. Anyway, a simplified model can be useful to visualize differences in virus spreading under different circumstances.

## Project page
https://panmareksadowski.github.io/Pandemic-simulator

## Demo
[<img src="https://cdn.loom.com/sessions/thumbnails/a188d653b17d4dbe898cd9747da72a1c-with-play.gif" alt="Demo 1" title="Demo 1" width="49%">](https://www.loom.com/share/a188d653b17d4dbe898cd9747da72a1c) [<img src="https://cdn.loom.com/sessions/thumbnails/845028336b8148c3b592ad8e4d5763b0-with-play.gif" alt="Demo 2" title="Demo 2" width="49%">](https://www.loom.com/share/845028336b8148c3b592ad8e4d5763b0)
[<img src="https://cdn.loom.com/sessions/thumbnails/cfc29412bc3f48318f90fd1ec6bead91-with-play.gif" alt="Demo 3" title="Demo 3" width="49%">](https://www.loom.com/share/cfc29412bc3f48318f90fd1ec6bead91)

## Download
Latest realease:
[Win64bit installer](https://github.com/panmareksadowski/Pandemic-simulator/releases/latest/download/PandemicSimulatorWin64Setup.exe)
[Win32bit installer](https://github.com/panmareksadowski/Pandemic-simulator/releases/latest/download/PandemicSimulatorWin32Setup.exe)
[Source code and all assets](https://github.com/panmareksadowski/Pandemic-simulator/releases/latest)

All releases: [link](https://github.com/panmareksadowski/Pandemic-simulator/releases)

## Build
### Build dependencies
- **qmake** is used as a build system
- **gcc** >= 7 or any other compiler that support c++17, has been tested with g++ 8.4.0 on ubuntu and g++ 7.3.0 from MinGw project on Windows
- **Qt** >= 5.14.0 has been tested with Qt 15.4.1

### Build instruction
On Linux:
```
mkdir build
cd build
qmake ../Pandemic-simulator.pro
make
```
On any system can be used Qt Creator Ide to build project with one click.(Please choose toolset >= 5.14)

## Notice
The program is consuming most of the available CPU to model calculations.

## License
Source code and the program are provided under GNU GENERAL PUBLIC LICENSE Version 3. Full license is available [here](https://github.com/panmareksadowski/Pandemic-simulator/blob/master/COPYING) and [here](https://github.com/panmareksadowski/Pandemic-simulator/blob/master/LICENSE).

Program used QT library under GPLv3 license. Here is [link](https://code.qt.io/cgit/) to source code.
Binary file added icon.ico
Binary file not shown.
45 changes: 45 additions & 0 deletions qml/AboutDialog.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import QtQuick 2.14
import QtQuick.Controls 2.14

Dialog {
modal: true

Column {

spacing: 12

Label {
text: "Built from <a href=\"https://github.com/panmareksadowski/Pandemic-simulator/releases/tag/v"
+ Qt.application.version + "\">source code</a>"
onLinkActivated: Qt.openUrlExternally(link)
}

Label {
text: "Built with " + compilerversion
}

Label {
text: "Based on Qt " + qtversion
}

Label {
text: "Copyright 2020 Marek Sadowski
Pandemic-simulator is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Pandemic-simulator is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Pandemic-simulator. If not, see <http://www.gnu.org/licenses/>."
}
}

standardButtons: Dialog.Close
title: Qt.application.name + " v" + Qt.application.version
}
51 changes: 51 additions & 0 deletions qml/AllStatisticsChart.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Copyright 2020 Marek Sadowski


/******************************************************************************
* This file is part of Pandemic-simulator.
* Pandemic-simulator is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Pandemic-simulator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Pandemic-simulator. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
import QtQuick 2.14
import QtCharts 2.14
import Enums 1.0

ChartView {
legend.visible: false
dropShadowEnabled: true
antialiasing: false

PieSeries {
id: pieSeries
PieSlice {
label: "Health"
value: Statistics.allPersons === 0 ? 1 : Statistics.health
color: AppColors.healthColor
}
PieSlice {
label: "Recovered"
value: Statistics.recovered
color: AppColors.recoveredColor
}
PieSlice {
label: "Ill"
value: Statistics.ill
color: AppColors.illColor
}
PieSlice {
label: "Dead"
value: Statistics.dead
color: AppColors.deadColor
}
}
}
Loading

0 comments on commit 510a800

Please sign in to comment.