فهرست منبع

Created Hash class

Enabling checking downloaded files for correctness
Felix Turo 3 سال پیش
والد
کامیت
4c08f0a159

+ 2 - 0
CMakeLists.txt

@@ -36,6 +36,7 @@ set(PROJECT_SOURCES
     src/classes/atailentry.cpp
     src/classes/atranslator.cpp
     src/classes/ajson.cpp
+    src/classes/ahash.cpp
     src/database/adatabase.cpp
     src/database/adatabasesetup.cpp
     src/database/adbsetup.cpp
@@ -72,6 +73,7 @@ set(PROJECT_SOURCES
     src/classes/atailentry.h
     src/classes/atranslator.h
     src/classes/ajson.h
+    src/classes/ahash.h
     src/database/adatabase.h
     src/database/adatabasesetup.h
     src/database/adbsetup.h

+ 1 - 0
assets/database/templates/aircraft.md5

@@ -0,0 +1 @@
+80ba2debfd085e21fcf7602a9f473471  aircraft.json

+ 1 - 0
assets/database/templates/airports.md5

@@ -0,0 +1 @@
+b9467aeeddc6d4bcaffdccd934008586  airports.json

+ 1 - 0
assets/database/templates/changelog.md5

@@ -0,0 +1 @@
+d7e78defe6401569eddf45592da9acc2  changelog.json

+ 1 - 0
assets/database/templates/currencies.md5

@@ -0,0 +1 @@
+65dcce8e3df9bcc8681edd746774f6d6  currencies.json

+ 40 - 40
l10n/openpilotlog_de.ts

@@ -4,27 +4,27 @@
 <context>
     <name>ADatabase</name>
     <message>
-        <location filename="../src/database/adatabase.cpp" line="767"/>
+        <location filename="../src/database/adatabase.cpp" line="774"/>
         <source>&lt;tr&gt;&lt;td&gt;Total Time: &lt;/td&gt;&lt;td&gt;%1&lt;/td&gt;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/database/adatabase.cpp" line="768"/>
+        <location filename="../src/database/adatabase.cpp" line="775"/>
         <source>&lt;tr&gt;&lt;td&gt;Last Flight: &lt;/td&gt;&lt;td&gt;%1&lt;/td&gt;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/database/adatabase.cpp" line="769"/>
+        <location filename="../src/database/adatabase.cpp" line="776"/>
         <source>&lt;tr&gt;&lt;td&gt;Number of flights: &lt;/td&gt;&lt;td&gt;%1&lt;/td&gt;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/database/adatabase.cpp" line="770"/>
+        <location filename="../src/database/adatabase.cpp" line="777"/>
         <source>&lt;tr&gt;&lt;td&gt;Number of aircraft: &lt;/td&gt;&lt;td&gt;%1&lt;/td&gt;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/database/adatabase.cpp" line="771"/>
+        <location filename="../src/database/adatabase.cpp" line="778"/>
         <source>&lt;tr&gt;&lt;td&gt;Number of Pilots: &lt;/td&gt;&lt;td&gt;%1&lt;/td&gt;</source>
         <translation type="unfinished"></translation>
     </message>
@@ -362,12 +362,12 @@ Error: %2</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/widgets/debugwidget.cpp" line="168"/>
+        <location filename="../src/gui/widgets/debugwidget.cpp" line="190"/>
         <source>Open CSV File for import</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/widgets/debugwidget.cpp" line="170"/>
+        <location filename="../src/gui/widgets/debugwidget.cpp" line="192"/>
         <source>CSV files (*.csv)</source>
         <translation type="unfinished"></translation>
     </message>
@@ -386,7 +386,7 @@ Error: %2</source>
     </message>
     <message>
         <location filename="../src/gui/dialogues/firstrundialog.ui" line="27"/>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="88"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="87"/>
         <source>Next</source>
         <translation type="unfinished"></translation>
     </message>
@@ -431,7 +431,7 @@ Error: %2</source>
     </message>
     <message>
         <location filename="../src/gui/dialogues/firstrundialog.ui" line="136"/>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="464"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="475"/>
         <source>Import Database</source>
         <translation type="unfinished"></translation>
     </message>
@@ -654,126 +654,126 @@ Error: %2</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="103"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="102"/>
         <source>Error</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="104"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="103"/>
         <source>Please enter first and last name</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="111"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="110"/>
         <source>Done</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="132"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="131"/>
         <source>Existing Database found</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="133"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="132"/>
         <source>An existing database file has been detected on your system.&lt;br&gt;Would you like to create a backup of the existing database?&lt;br&gt;&lt;br&gt;Note: if you select no, the existing database will be overwritten. Thisaction is irreversible.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="145"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="144"/>
         <source>Unable to backup old database:&lt;br&gt;%1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="148"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="147"/>
         <source>Backup successfully created.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="155"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="154"/>
         <source>Unable to delete existing database file.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="161"/>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="171"/>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="181"/>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="190"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="160"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="170"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="180"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="189"/>
         <source>Database setup failed</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="162"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="161"/>
         <source>Errors have ocurred creating the database.Without a working database The application will not be usable.&lt;br&gt;The following error has ocurred:&lt;br&gt;Database: Unable to connect</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="172"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="171"/>
         <source>Errors have ocurred creating the database.Without a working database The application will not be usable.&lt;br&gt;The following error has ocurred:&lt;br&gt;%1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="182"/>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="191"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="181"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="190"/>
         <source>Unable to execute database query&lt;br&gt;The following error has occured:&lt;br&gt;%1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="281"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="292"/>
         <source>Create Database</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="282"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="293"/>
         <source>We are now going to create the database.&lt;br&gt;Would you like to download the latest database information?&lt;br&gt;(Recommended, Internet connection required)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="292"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="303"/>
         <source>Downloading latest data has failed.&lt;br&gt;&lt;br&gt;Using local data instead.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="301"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="312"/>
         <source>Database creation has been unsuccessful. The following error has ocurred:&lt;br&gt;&lt;br&gt;%1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="308"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="319"/>
         <source>Database creation has been unsuccessful. Unable to fill template data.&lt;br&gt;&lt;br&gt;%1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="358"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="369"/>
         <source>Setup incomplete</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="359"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="370"/>
         <source>Without completing the initial setup you cannot use the application.&lt;br&gt;&lt;br&gt;Quit anyway?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="450"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="461"/>
         <source>Choose backup file</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="456"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="467"/>
         <source>No Database has been selected.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="465"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="476"/>
         <source>The following database will be imported:&lt;br&gt;&lt;br&gt;&lt;b&gt;&lt;tt&gt;%1&lt;br&gt;&lt;/b&gt;&lt;/tt&gt;&lt;br&gt;Is this correct?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="471"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="482"/>
         <source>Unable to import database file:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="474"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="485"/>
         <source>Database successfully imported.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1254,12 +1254,12 @@ Error: %2</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="94"/>
-        <source>Database revision out of date!</source>
+        <location filename="../mainwindow.cpp" line="87"/>
+        <source>Your database is out of date.Minimum required revision: %1&lt;br&gt;You have revision: %2&lt;br&gt;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="109"/>
+        <location filename="../mainwindow.cpp" line="103"/>
         <source>This feature is not yet available!</source>
         <translation type="unfinished"></translation>
     </message>

+ 40 - 40
l10n/openpilotlog_en.ts

@@ -4,27 +4,27 @@
 <context>
     <name>ADatabase</name>
     <message>
-        <location filename="../src/database/adatabase.cpp" line="767"/>
+        <location filename="../src/database/adatabase.cpp" line="774"/>
         <source>&lt;tr&gt;&lt;td&gt;Total Time: &lt;/td&gt;&lt;td&gt;%1&lt;/td&gt;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/database/adatabase.cpp" line="768"/>
+        <location filename="../src/database/adatabase.cpp" line="775"/>
         <source>&lt;tr&gt;&lt;td&gt;Last Flight: &lt;/td&gt;&lt;td&gt;%1&lt;/td&gt;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/database/adatabase.cpp" line="769"/>
+        <location filename="../src/database/adatabase.cpp" line="776"/>
         <source>&lt;tr&gt;&lt;td&gt;Number of flights: &lt;/td&gt;&lt;td&gt;%1&lt;/td&gt;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/database/adatabase.cpp" line="770"/>
+        <location filename="../src/database/adatabase.cpp" line="777"/>
         <source>&lt;tr&gt;&lt;td&gt;Number of aircraft: &lt;/td&gt;&lt;td&gt;%1&lt;/td&gt;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/database/adatabase.cpp" line="771"/>
+        <location filename="../src/database/adatabase.cpp" line="778"/>
         <source>&lt;tr&gt;&lt;td&gt;Number of Pilots: &lt;/td&gt;&lt;td&gt;%1&lt;/td&gt;</source>
         <translation type="unfinished"></translation>
     </message>
@@ -362,12 +362,12 @@ Error: %2</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/widgets/debugwidget.cpp" line="168"/>
+        <location filename="../src/gui/widgets/debugwidget.cpp" line="190"/>
         <source>Open CSV File for import</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/widgets/debugwidget.cpp" line="170"/>
+        <location filename="../src/gui/widgets/debugwidget.cpp" line="192"/>
         <source>CSV files (*.csv)</source>
         <translation type="unfinished"></translation>
     </message>
@@ -386,7 +386,7 @@ Error: %2</source>
     </message>
     <message>
         <location filename="../src/gui/dialogues/firstrundialog.ui" line="27"/>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="88"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="87"/>
         <source>Next</source>
         <translation type="unfinished"></translation>
     </message>
@@ -431,7 +431,7 @@ Error: %2</source>
     </message>
     <message>
         <location filename="../src/gui/dialogues/firstrundialog.ui" line="136"/>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="464"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="475"/>
         <source>Import Database</source>
         <translation type="unfinished"></translation>
     </message>
@@ -654,126 +654,126 @@ Error: %2</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="103"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="102"/>
         <source>Error</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="104"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="103"/>
         <source>Please enter first and last name</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="111"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="110"/>
         <source>Done</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="132"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="131"/>
         <source>Existing Database found</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="133"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="132"/>
         <source>An existing database file has been detected on your system.&lt;br&gt;Would you like to create a backup of the existing database?&lt;br&gt;&lt;br&gt;Note: if you select no, the existing database will be overwritten. Thisaction is irreversible.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="145"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="144"/>
         <source>Unable to backup old database:&lt;br&gt;%1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="148"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="147"/>
         <source>Backup successfully created.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="155"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="154"/>
         <source>Unable to delete existing database file.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="161"/>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="171"/>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="181"/>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="190"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="160"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="170"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="180"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="189"/>
         <source>Database setup failed</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="162"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="161"/>
         <source>Errors have ocurred creating the database.Without a working database The application will not be usable.&lt;br&gt;The following error has ocurred:&lt;br&gt;Database: Unable to connect</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="172"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="171"/>
         <source>Errors have ocurred creating the database.Without a working database The application will not be usable.&lt;br&gt;The following error has ocurred:&lt;br&gt;%1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="182"/>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="191"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="181"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="190"/>
         <source>Unable to execute database query&lt;br&gt;The following error has occured:&lt;br&gt;%1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="281"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="292"/>
         <source>Create Database</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="282"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="293"/>
         <source>We are now going to create the database.&lt;br&gt;Would you like to download the latest database information?&lt;br&gt;(Recommended, Internet connection required)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="292"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="303"/>
         <source>Downloading latest data has failed.&lt;br&gt;&lt;br&gt;Using local data instead.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="301"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="312"/>
         <source>Database creation has been unsuccessful. The following error has ocurred:&lt;br&gt;&lt;br&gt;%1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="308"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="319"/>
         <source>Database creation has been unsuccessful. Unable to fill template data.&lt;br&gt;&lt;br&gt;%1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="358"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="369"/>
         <source>Setup incomplete</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="359"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="370"/>
         <source>Without completing the initial setup you cannot use the application.&lt;br&gt;&lt;br&gt;Quit anyway?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="450"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="461"/>
         <source>Choose backup file</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="456"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="467"/>
         <source>No Database has been selected.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="465"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="476"/>
         <source>The following database will be imported:&lt;br&gt;&lt;br&gt;&lt;b&gt;&lt;tt&gt;%1&lt;br&gt;&lt;/b&gt;&lt;/tt&gt;&lt;br&gt;Is this correct?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="471"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="482"/>
         <source>Unable to import database file:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="474"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="485"/>
         <source>Database successfully imported.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1254,12 +1254,12 @@ Error: %2</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="94"/>
-        <source>Database revision out of date!</source>
+        <location filename="../mainwindow.cpp" line="87"/>
+        <source>Your database is out of date.Minimum required revision: %1&lt;br&gt;You have revision: %2&lt;br&gt;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="109"/>
+        <location filename="../mainwindow.cpp" line="103"/>
         <source>This feature is not yet available!</source>
         <translation type="unfinished"></translation>
     </message>

+ 40 - 40
l10n/openpilotlog_es.ts

@@ -4,27 +4,27 @@
 <context>
     <name>ADatabase</name>
     <message>
-        <location filename="../src/database/adatabase.cpp" line="767"/>
+        <location filename="../src/database/adatabase.cpp" line="774"/>
         <source>&lt;tr&gt;&lt;td&gt;Total Time: &lt;/td&gt;&lt;td&gt;%1&lt;/td&gt;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/database/adatabase.cpp" line="768"/>
+        <location filename="../src/database/adatabase.cpp" line="775"/>
         <source>&lt;tr&gt;&lt;td&gt;Last Flight: &lt;/td&gt;&lt;td&gt;%1&lt;/td&gt;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/database/adatabase.cpp" line="769"/>
+        <location filename="../src/database/adatabase.cpp" line="776"/>
         <source>&lt;tr&gt;&lt;td&gt;Number of flights: &lt;/td&gt;&lt;td&gt;%1&lt;/td&gt;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/database/adatabase.cpp" line="770"/>
+        <location filename="../src/database/adatabase.cpp" line="777"/>
         <source>&lt;tr&gt;&lt;td&gt;Number of aircraft: &lt;/td&gt;&lt;td&gt;%1&lt;/td&gt;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/database/adatabase.cpp" line="771"/>
+        <location filename="../src/database/adatabase.cpp" line="778"/>
         <source>&lt;tr&gt;&lt;td&gt;Number of Pilots: &lt;/td&gt;&lt;td&gt;%1&lt;/td&gt;</source>
         <translation type="unfinished"></translation>
     </message>
@@ -362,12 +362,12 @@ Error: %2</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/widgets/debugwidget.cpp" line="168"/>
+        <location filename="../src/gui/widgets/debugwidget.cpp" line="190"/>
         <source>Open CSV File for import</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/widgets/debugwidget.cpp" line="170"/>
+        <location filename="../src/gui/widgets/debugwidget.cpp" line="192"/>
         <source>CSV files (*.csv)</source>
         <translation type="unfinished"></translation>
     </message>
@@ -386,7 +386,7 @@ Error: %2</source>
     </message>
     <message>
         <location filename="../src/gui/dialogues/firstrundialog.ui" line="27"/>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="88"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="87"/>
         <source>Next</source>
         <translation type="unfinished"></translation>
     </message>
@@ -431,7 +431,7 @@ Error: %2</source>
     </message>
     <message>
         <location filename="../src/gui/dialogues/firstrundialog.ui" line="136"/>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="464"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="475"/>
         <source>Import Database</source>
         <translation type="unfinished"></translation>
     </message>
@@ -654,126 +654,126 @@ Error: %2</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="103"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="102"/>
         <source>Error</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="104"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="103"/>
         <source>Please enter first and last name</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="111"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="110"/>
         <source>Done</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="132"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="131"/>
         <source>Existing Database found</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="133"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="132"/>
         <source>An existing database file has been detected on your system.&lt;br&gt;Would you like to create a backup of the existing database?&lt;br&gt;&lt;br&gt;Note: if you select no, the existing database will be overwritten. Thisaction is irreversible.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="145"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="144"/>
         <source>Unable to backup old database:&lt;br&gt;%1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="148"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="147"/>
         <source>Backup successfully created.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="155"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="154"/>
         <source>Unable to delete existing database file.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="161"/>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="171"/>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="181"/>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="190"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="160"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="170"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="180"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="189"/>
         <source>Database setup failed</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="162"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="161"/>
         <source>Errors have ocurred creating the database.Without a working database The application will not be usable.&lt;br&gt;The following error has ocurred:&lt;br&gt;Database: Unable to connect</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="172"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="171"/>
         <source>Errors have ocurred creating the database.Without a working database The application will not be usable.&lt;br&gt;The following error has ocurred:&lt;br&gt;%1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="182"/>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="191"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="181"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="190"/>
         <source>Unable to execute database query&lt;br&gt;The following error has occured:&lt;br&gt;%1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="281"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="292"/>
         <source>Create Database</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="282"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="293"/>
         <source>We are now going to create the database.&lt;br&gt;Would you like to download the latest database information?&lt;br&gt;(Recommended, Internet connection required)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="292"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="303"/>
         <source>Downloading latest data has failed.&lt;br&gt;&lt;br&gt;Using local data instead.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="301"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="312"/>
         <source>Database creation has been unsuccessful. The following error has ocurred:&lt;br&gt;&lt;br&gt;%1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="308"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="319"/>
         <source>Database creation has been unsuccessful. Unable to fill template data.&lt;br&gt;&lt;br&gt;%1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="358"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="369"/>
         <source>Setup incomplete</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="359"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="370"/>
         <source>Without completing the initial setup you cannot use the application.&lt;br&gt;&lt;br&gt;Quit anyway?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="450"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="461"/>
         <source>Choose backup file</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="456"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="467"/>
         <source>No Database has been selected.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="465"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="476"/>
         <source>The following database will be imported:&lt;br&gt;&lt;br&gt;&lt;b&gt;&lt;tt&gt;%1&lt;br&gt;&lt;/b&gt;&lt;/tt&gt;&lt;br&gt;Is this correct?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="471"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="482"/>
         <source>Unable to import database file:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="474"/>
+        <location filename="../src/gui/dialogues/firstrundialog.cpp" line="485"/>
         <source>Database successfully imported.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1254,12 +1254,12 @@ Error: %2</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="94"/>
-        <source>Database revision out of date!</source>
+        <location filename="../mainwindow.cpp" line="87"/>
+        <source>Your database is out of date.Minimum required revision: %1&lt;br&gt;You have revision: %2&lt;br&gt;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="109"/>
+        <location filename="../mainwindow.cpp" line="103"/>
         <source>This feature is not yet available!</source>
         <translation type="unfinished"></translation>
     </message>

+ 0 - 1
main.cpp

@@ -39,7 +39,6 @@
 #define ORGNAME QStringLiteral("opl")
 #define ORGDOMAIN QStringLiteral("https://github.com/fiffty-50/openpilotlog")
 
-
 void init()
 {
     LOG << "Setting up / verifying Application Directories...";

+ 6 - 12
mainwindow.cpp

@@ -83,18 +83,12 @@ MainWindow::MainWindow(QWidget *parent)
 
 
     // check database version (Debug)
-    int db_ver = aDB->dbRevision();
-    if (db_ver != DATABASE_REVISION) {
-        DEB << "############## WARNING ##############";
-        DEB << "Your database is out of date.";
-        DEB << "Current Revision:\t" << DATABASE_REVISION;
-        DEB << "You have revision:\t" << db_ver;
-        DEB << "############## WARNING ##############";
-        QMessageBox message_box(this); //error box
-        message_box.setText(tr("Database revision out of date!"));
-        message_box.exec();
-    } else {
-        DEB << "Your database is up to date with the latest revision:" << db_ver;
+    if (aDB->dbRevision() < aDB->getMinimumDatabaseRevision()) {
+        QString message = tr("Your database is out of date."
+                             "Minimum required revision: %1<br>"
+                             "You have revision: %2<br>")
+                             .arg(aDB->getMinimumDatabaseRevision(), aDB->dbRevision());
+        WARN(message);
     }
 }
 

+ 58 - 0
src/classes/ahash.cpp

@@ -0,0 +1,58 @@
+#include "ahash.h"
+#include "src/opl.h"
+
+AHash::AHash(QFile &file)
+{
+    if (file.open(QFile::ReadOnly)) {
+        QCryptographicHash hash(QCryptographicHash::Md5);
+        if (hash.addData(&file)) {
+            checksum = hash.result();
+            DEB << "File: " << file;
+            DEB << "Hash: " << hash.result();
+        } else {
+            checksum = QByteArray();
+        }
+    } else {
+        checksum = QByteArray();
+    }
+    file.close();
+}
+
+AHash::AHash(QFileInfo &file_info)
+{
+    QFile f(file_info.absoluteFilePath());
+    if (f.open(QFile::ReadOnly)) {
+        QCryptographicHash hash(QCryptographicHash::Md5);
+        if (hash.addData(&f)) {
+            checksum = hash.result();
+            DEB << "File: " << f;
+            DEB << "Hash: " << hash.result().toHex();
+        } else {
+            checksum = QByteArray();
+        }
+    } else {
+        checksum = QByteArray();
+    }
+    f.close();
+}
+
+bool AHash::compare(QFileInfo &md5_file)
+{
+    // Open the file and read the first 32 characters
+    QFile f(md5_file.absoluteFilePath());
+    if (f.open(QFile::ReadOnly)) {
+        QTextStream in(&f);
+        const QString hash_string = in.read(32);
+        DEB << "Checksum:" << hash_string;
+
+        // Verify checksum is not empty and compare to md5 read from file
+        if (checksum == QByteArray())
+            return false;
+        else
+            if (checksum.toHex() == hash_string)
+                return true;
+            else
+                return false;
+    }
+    return false;
+}

+ 39 - 0
src/classes/ahash.h

@@ -0,0 +1,39 @@
+#ifndef AHASH_H
+#define AHASH_H
+#include <QtCore>
+#include <QByteArray>
+#include <QCryptographicHash>
+
+/*!
+ * \brief The AHash class is responsible for calculating cryptographic hashes of files (used to verify downloads)
+ */
+class AHash
+{
+public:
+    /*!
+     * \brief AHash - calculates the MD5-checksum for the parameter given in the constructor and
+     * saves the result in the checksum member variable
+     */
+    AHash(QFile &file);
+
+    AHash(QFileInfo &file_info);
+
+    QByteArray checksum;
+
+    /*!
+     * \brief hashString returns a hex representation of the hash
+     */
+    inline const QString hashToHex()
+    {
+            return QString(checksum.toHex());
+    };
+
+    /*!
+     * \brief compare reads the pre-calculated md5-sum from a checkfile and compares the hashes.
+     * \param md5_file - the checkfile containing the md5 checksum in hex format
+     * \return true if hashes match
+     */
+    bool compare(QFileInfo &md5_file);
+};
+
+#endif // AHASH_H

+ 2 - 2
src/classes/ajson.cpp

@@ -16,7 +16,7 @@
  *along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 #include "ajson.h"
-#include "src/database/adatabasesetup.h"
+#include "src/database/adbsetup.h"
 
 const QList<QPair<TableName_T, ADatabaseTable>> AJson::tables {
     qMakePair(Opl::Db::TABLE_TAILS, ADatabaseTable::tails),
@@ -53,7 +53,7 @@ void AJson::importDatabase()
         q.exec();
         const auto doc = readFileToDoc(AStandardPaths::asChildOfDir(AStandardPaths::JSON,
                                                                pair.first + QLatin1String(".json")));
-        ADataBaseSetup::commitDataJson(doc.array(), pair.first);
+        aDbSetup::commitData(doc.array(), pair.first);
     }
 }
 

+ 7 - 0
src/database/adatabase.cpp

@@ -21,6 +21,8 @@
 #include "src/opl.h"
 #include "src/functions/alog.h"
 
+const int ADatabase::minimumDatabaseRevision = 0;
+
 const QStringList ADatabase::userTableNames = {
     QStringLiteral("flights"),
     QStringLiteral("pilots"),
@@ -68,6 +70,11 @@ int ADatabase::checkDbVersion() const
     return query.value(0).toInt();
 }
 
+int ADatabase::getMinimumDatabaseRevision()
+{
+    return minimumDatabaseRevision;
+}
+
 QStringList ADatabase::getTemplateTableNames()
 {
     return templateTableNames;

+ 6 - 2
src/database/adatabase.h

@@ -121,6 +121,7 @@ private:
 
     const static QStringList userTableNames;
     const static QStringList templateTableNames;
+    const static int minimumDatabaseRevision;
 public:
     /*!
      * \brief lastError extends QSqlError. Holds information about the last error that ocurred during
@@ -348,17 +349,20 @@ public:
     /*!
      * \brief getUserTableNames returns a list of the table names of tables that contain user-created data
      * (flights, pilots,..)
-     * \return
      */
     QStringList getUserTableNames();
 
     /*!
      * \brief getTemplateTableNames returns a list of the table names of tables that contain template data
      * (aiports, aircraft,..)
-     * \return
      */
     QStringList getTemplateTableNames();
 
+    /*!
+     * \brief getMinimumDatabaseRevision returns the minimum required database revision number required by the application.
+     */
+    static int getMinimumDatabaseRevision();
+
 signals:
     /*!
      * \brief updated is emitted whenever the database contents have been updated.

+ 17 - 0
src/database/adbsetup.cpp

@@ -1,3 +1,20 @@
+/*
+ *openPilotLog - A FOSS Pilot Logbook Application
+ *Copyright (C) 2020-2021 Felix Turowsky
+ *
+ *This program 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.
+ *
+ *This program 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 this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
 #include "adbsetup.h"
 #include "src/opl.h"
 #include "src/database/adatabase.h"

+ 17 - 0
src/database/adbsetup.h

@@ -1,3 +1,20 @@
+/*
+ *openPilotLog - A FOSS Pilot Logbook Application
+ *Copyright (C) 2020-2021 Felix Turowsky
+ *
+ *This program 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.
+ *
+ *This program 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 this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
 #ifndef ADBSETUP_H
 #define ADBSETUP_H
 

+ 12 - 1
src/gui/dialogues/firstrundialog.cpp

@@ -20,7 +20,6 @@
 #include "src/functions/alog.h"
 #include "src/database/adatabase.h"
 #include "src/gui/widgets/backupwidget.h"
-//#include "src/database/adatabasesetup.h"
 #include "src/database/adbsetup.h"
 #include "src/classes/apilotentry.h"
 #include "src/classes/adownload.h"
@@ -229,6 +228,18 @@ bool FirstRunDialog::downloadTemplates(QString branch_name)
     return true;
 }
 
+bool FirstRunDialog::verifyTemplates()
+{
+    QDir template_dir(AStandardPaths::directory(AStandardPaths::Templates));
+    const QStringList entries = template_dir.entryList(QStringList{"*.md5"}, QDir::Files, QDir::Time);
+
+    //QVector<QFile> json_files;
+    //for (const auto &table_name : aDB->getTemplateTableNames()) {
+    //    json_files.append(QFile(AStandardPaths::asChildOfDir(AStandardPaths::Templates, table_name)));
+    //}
+
+}
+
 void FirstRunDialog::writeSettings()
 {
     ASettings::resetToDefaults();

+ 1 - 0
src/gui/dialogues/firstrundialog.h

@@ -69,6 +69,7 @@ private:
     bool writeCurrencies();
     bool finishSetup();
     bool downloadTemplates(QString branch_name);
+    bool verifyTemplates();
 
     QList<QDateEdit*> dateEdits;
 

+ 26 - 2
src/gui/widgets/debugwidget.cpp

@@ -28,13 +28,37 @@
 #include "src/functions/astat.h"
 #include "src/classes/acurrencyentry.h"
 #include "src/classes/atranslator.h"
+#include "src/database/adatabasesetup.h"
+#include "src/classes/ahash.h"
 
 #include "src/classes/ajson.h"
 void DebugWidget::on_debugPushButton_clicked()
 {
     // Debug
-    auto frd = new FirstRunDialog(this);
-    frd->exec();
+    QFileInfo check_file("/home/felix/.local/share/opl/openPilotLog/templates/changelog.json");
+    AHash hash(check_file);
+
+    QFileInfo md5_file("/home/felix/.local/share/opl/openPilotLog/templates/changelog.md5");
+    DEB << "Sums are equal?" << hash.compare(md5_file);
+    //test_file2.open(QFile::ReadOnly);
+    //QTextStream in(&test_file2);
+    //auto read = in.read(32);
+    //auto array = read.toUtf8();
+    //test_file2.close();
+    //DEB << read;
+    //DEB << (read == hash.hashToHex());
+    //DEB << array;
+
+
+    //for (const auto &table_name : aDB->getTemplateTableNames()) {
+    //    //json_files.append(QFile(AStandardPaths::asChildOfDir(AStandardPaths::Templates, table_name)));
+    //    QString json_path = AStandardPaths::asChildOfDir(AStandardPaths::Templates, table_name) + QLatin1String(".json");
+    //    QString md5_path = AStandardPaths::asChildOfDir(AStandardPaths::Templates, table_name) + QLatin1String(".md5");
+    //    DEB << json_path << md5_path;
+    //    QFileInfo json_fi(json_path);
+    //    QFileInfo md5_fi(md5_path);
+    //    DEB << "Exists? " << json_fi.exists() << md5_fi.exists();
+    //}
 
 }
 

+ 0 - 1
src/gui/widgets/debugwidget.h

@@ -25,7 +25,6 @@
 #include <QFileDialog>
 #include <QMessageBox>
 #include <QProcess>
-#include "src/database/adatabasesetup.h"
 #include "src/classes/adownload.h"
 #include "src/functions/areadcsv.h"