Răsfoiți Sursa

New Application Paths

Replacing AStandardPaths with OPL::Paths in all locations
Felix Turo 2 ani în urmă
părinte
comite
640999d5d4

+ 7 - 9
CMakeLists.txt

@@ -81,8 +81,6 @@ set(PROJECT_SOURCES
     src/classes/astyle.cpp
     src/classes/paths.h
     src/classes/paths.cpp
-    src/classes/astandardpaths.h
-    src/classes/astandardpaths.cpp
     src/classes/adownload.h
     src/classes/adownload.cpp
     src/classes/arunguard.h
@@ -97,18 +95,18 @@ set(PROJECT_SOURCES
     src/classes/ahash.cpp
 
     # Namespaces
-    src/functions/acalc.h
-    src/functions/acalc.cpp
+    src/functions/calc.h
+    src/functions/calc.cpp
     src/functions/adatetime.h
-    src/functions/alog.h
-    src/functions/alog.cpp
+    src/functions/log.h
+    src/functions/log.cpp
     src/functions/areadcsv.h
     src/functions/areadcsv.cpp
-    src/functions/astat.h
-    src/functions/astat.cpp
+    src/functions/statistics.h
+    src/functions/statistics.cpp
     src/functions/adate.h
     src/functions/adate.cpp
-    src/functions/atime.h
+    src/functions/time.h
 
     # Database
     src/database/database.h

+ 3 - 3
main.cpp

@@ -17,13 +17,13 @@
  */
 #include "mainwindow.h"
 #include "src/opl.h"
-#include "src/functions/alog.h"
+#include "src/functions/log.h"
 #include "src/gui/dialogues/firstrundialog.h"
 #include "src/classes/arunguard.h"
 #include "src/classes/asettings.h"
 #include "src/classes/asettings.h"
 #include "src/classes/astyle.h"
-#include "src/functions/alog.h"
+#include "src/functions/log.h"
 #include "src/classes/paths.h"
 #include <QApplication>
 #include <QProcess>
@@ -51,7 +51,7 @@ void init()
         LOG << "Unable to create directories.";
     }
     LOG << "Setting up logging facilities...";
-    if(ALog::init(true)) {
+    if(OPL::Log::init(true)) {
         LOG << "Logging enabled.";
     } else {
         LOG << "Unable to initalise logging.";

+ 0 - 3
mainwindow.cpp

@@ -27,7 +27,6 @@
 #include "src/classes/paths.h"
 void MainWindow::doDebugStuff()
 {
-    AStandardPaths::setup();
     DEB << OPL::Paths::directory(OPL::Paths::Backup);
     DEB << OPL::Paths::path(OPL::Paths::Backup);
     DEB << OPL::Paths::filePath(OPL::Paths::Database, "logbook.db");
@@ -36,7 +35,6 @@ void MainWindow::doDebugStuff()
     QDir dir(QCoreApplication::applicationDirPath());
     QString filename("file.f");
 
-    DEB << AStandardPaths::asChildOfDir(AStandardPaths::Backup, filename);
     DEB << OPL::Paths::filePath(OPL::Paths::Backup, filename);
 }
 
@@ -235,7 +233,6 @@ void MainWindow::onDatabaseInvalid()
         QString db_path = QFileDialog::getOpenFileName(this,
                                                        tr("Select Database"),
                                                        OPL::Paths::directory(OPL::Paths::Backup).canonicalPath(),
-                                                       //AStandardPaths::directory(AStandardPaths::Backup).canonicalPath(),
                                                        tr("Database file (*.db)"));
         if (!db_path.isEmpty()) {
             if(!DB->restoreBackup(db_path)) {

+ 1 - 1
src/classes/adownload.cpp

@@ -17,7 +17,7 @@
  */
 #include "adownload.h"
 #include "src/opl.h"
-#include "src/functions/alog.h"
+#include "src/functions/log.h"
 
 
 

+ 2 - 2
src/classes/ajson.cpp

@@ -47,7 +47,7 @@ void AJson::importDatabase()
         const QString table_name = OPL::GLOBALS->getDbTableName(table);
         q.prepare(QLatin1String("DELETE FROM ") + table_name);
         q.exec();
-        const auto doc = readFileToDoc(AStandardPaths::asChildOfDir(AStandardPaths::JSON,
+        const auto doc = readFileToDoc(OPL::Paths::filePath(OPL::Paths::Templates,
                                                                table_name + QLatin1String(".json")));
         DB->commit(doc.array(), table);
     }
@@ -66,7 +66,7 @@ QJsonDocument AJson::readFileToDoc(const QString &file_path)
 
 void AJson::writeDocToFile(const QJsonDocument &doc, const QString &file_name)
 {
-    QFile out(AStandardPaths::asChildOfDir(AStandardPaths::JSON,file_name));
+    QFile out(OPL::Paths::filePath(OPL::Paths::Export,file_name));
     out.open(QFile::WriteOnly);
     out.write(doc.toJson());
     out.close();

+ 2 - 1
src/classes/ajson.h

@@ -18,6 +18,7 @@
 #ifndef AJSON_H
 #define AJSON_H
 #include "src/opl.h"
+#include "src/classes/paths.h"
 #include <QJsonDocument>
 #include <QJsonValue>
 #include <QJsonObject>
@@ -36,7 +37,7 @@ public:
      *
      * \details QJsonObject can be constructed from QHash<QString, QVariant> aka QVariantmap.
      * All rows are put into a QJsonArray and the Array is embedded into a QJsonDocument, which
-     * can be exported. The files are created at AStandardPaths::JSON.
+     * can be exported. The files are created at Paths::Export.
      */
     static void exportDatabase();
 

+ 1 - 1
src/classes/astyle.cpp

@@ -32,7 +32,7 @@
 #include <QApplication>
 #include <QFont>
 #include "src/classes/asettings.h"
-#include "src/functions/alog.h"
+#include "src/functions/log.h"
 
 const QString AStyle::defaultStyle = QLatin1String("Fusion");
 

+ 2 - 0
src/classes/paths.h

@@ -17,6 +17,7 @@ public:
         Templates,
         Backup,
         Log,
+        Export,
     };
 
     const static inline QHash<Directories, QLatin1String> directories = {
@@ -24,6 +25,7 @@ public:
         {Templates, QLatin1String("/templates")},
         {Backup, QLatin1String("/backup")},
         {Log, QLatin1String("/log")},
+        {Export, QLatin1String("/export")},
     };
 
     Paths();

+ 0 - 1
src/database/database.cpp

@@ -16,7 +16,6 @@
  *along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 #include "database.h"
-#include "src/classes/astandardpaths.h"
 #include "src/opl.h"
 #include "src/classes/ajson.h"
 

+ 0 - 1
src/database/database.h

@@ -34,7 +34,6 @@
 #include "src/classes/paths.h"
 #include "src/opl.h"
 #include "src/database/row.h"
-#include "src/classes/astandardpaths.h"
 
 
 

+ 2 - 0
src/database/dbcompletiondata.cpp

@@ -15,8 +15,10 @@
  *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 "src/database/database.h"
 #include "dbcompletiondata.h"
 
+
 namespace OPL {
 
 void DbCompletionData::init()

+ 0 - 2
src/database/dbcompletiondata.h

@@ -18,8 +18,6 @@
 #ifndef DBCOMPLETIONDATA_H
 #define DBCOMPLETIONDATA_H
 
-#include "src/database/database.h"
-
 namespace OPL {
 
 /*!

+ 13 - 15
src/functions/acalc.cpp → src/functions/calc.cpp

@@ -15,22 +15,20 @@
  *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 "acalc.h"
-#include "src/functions/alog.h"
+#include "calc.h"
 #include "src/database/database.h"
 #include "src/classes/asettings.h"
 #include "src/opl.h"
-#include "src/functions/atime.h"
 
 /*!
- * \brief ACalc::formatTimeInput verifies user input and formats to hh:mm
+ * \brief OPL::Calc::formatTimeInput verifies user input and formats to hh:mm
  * if the output is not a valid time, an empty string is returned. Accepts
  * input as hh:mm, h:mm, hhmm or hmm.
  * \param userinput from a QLineEdit
  * \return formatted QString "hh:mm" or Empty String
  */
 QT_DEPRECATED
-QString ACalc::formatTimeInput(QString user_input)
+QString OPL::Calc::formatTimeInput(QString user_input)
 {
     QString output; //
     QTime temp_time; //empty time object is invalid by default
@@ -83,7 +81,7 @@ QString ACalc::formatTimeInput(QString user_input)
  */
 
 
-double ACalc::greatCircleDistance(double lat1, double lon1, double lat2, double lon2)
+double OPL::Calc::greatCircleDistance(double lat1, double lon1, double lat2, double lon2)
 {
     // Converting Latitude and Longitude to Radians
     lat1 = degToRad(lat1);
@@ -102,7 +100,7 @@ double ACalc::greatCircleDistance(double lat1, double lon1, double lat2, double
 }
 
 
-double ACalc::greatCircleDistanceBetweenAirports(const QString &dept, const QString &dest)
+double OPL::Calc::greatCircleDistanceBetweenAirports(const QString &dept, const QString &dest)
 {
     QString statement = QLatin1String("SELECT lat, long FROM airports WHERE icao = '")
             + dept
@@ -132,7 +130,7 @@ double ACalc::greatCircleDistanceBetweenAirports(const QString &dept, const QStr
 }
 
 
-QVector<QVector<double>> ACalc::intermediatePointsOnGreatCircle(double lat1, double lon1,
+QVector<QVector<double>> OPL::Calc::intermediatePointsOnGreatCircle(double lat1, double lon1,
                                                                double lat2, double lon2, int tblk)
 {
     double d = greatCircleDistance(lat1, lon1, lat2, lon2); //Calculate distance (Haversine)
@@ -166,7 +164,7 @@ QVector<QVector<double>> ACalc::intermediatePointsOnGreatCircle(double lat1, dou
 }
 
 
-double ACalc::solarElevation(QDateTime utc_time_point, double lat, double lon)
+double OPL::Calc::solarElevation(QDateTime utc_time_point, double lat, double lon)
 {
     double Alt = 11; // Assuming 11 kilometers as an average cruising height for a commercial passenger airplane.
     // convert current DateTime Object to a J2000 value used in the Calculation
@@ -225,7 +223,7 @@ double ACalc::solarElevation(QDateTime utc_time_point, double lat, double lon)
 }
 
 
-int ACalc::calculateNightTime(const QString &dept, const QString &dest, QDateTime departureTime, int tblk, int night_angle)
+int OPL::Calc::calculateNightTime(const QString &dept, const QString &dest, QDateTime departureTime, int tblk, int night_angle)
 {
 
     const QString statement = QLatin1String("SELECT lat, long FROM airports WHERE icao = '")
@@ -271,7 +269,7 @@ int ACalc::calculateNightTime(const QString &dept, const QString &dest, QDateTim
     return night_time;
 }
 
-bool ACalc::isNight(const QString &icao, QDateTime event_time, int night_angle)
+bool OPL::Calc::isNight(const QString &icao, QDateTime event_time, int night_angle)
 {
     const QString statement = QLatin1String("SELECT lat, long FROM airports WHERE icao = '")
             + icao
@@ -294,13 +292,13 @@ bool ACalc::isNight(const QString &icao, QDateTime event_time, int night_angle)
 }
 
 /*!
- * \brief ACalc::updateAutoTimes When the details of an aircraft are changed,
+ * \brief OPL::Calc::updateAutoTimes When the details of an aircraft are changed,
  * this function recalculates deductable times for this aircraft and updates
  * the database accordingly.
  * \param acft An aircraft object.
  * \return
  */
-void ACalc::updateAutoTimes(int acft_id)
+void OPL::Calc::updateAutoTimes(int acft_id)
 {
     //find all flights for aircraft
     const QString statement = QStringLiteral("SELECT flight_id FROM flights WHERE acft = ") + QString::number(acft_id);
@@ -340,10 +338,10 @@ void ACalc::updateAutoTimes(int acft_id)
     }
 }
 /*!
- * \brief ACalc::updateNightTimes updates the night times in the database,
+ * \brief OPL::Calc::updateNightTimes updates the night times in the database,
  * used when changing night angle setting for example
  */
-void ACalc::updateNightTimes()
+void OPL::Calc::updateNightTimes()
 {
     const int night_angle = ASettings::read(ASettings::FlightLogging::NightAngle).toInt();
 

+ 9 - 10
src/functions/acalc.h → src/functions/calc.h

@@ -15,8 +15,8 @@
  *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 ACALC_H
-#define ACALC_H
+#ifndef CALC_H
+#define CALC_H
 
 #ifdef _MSC_VER
 #define _USE_MATH_DEFINES
@@ -24,15 +24,14 @@
 #include <cmath>
 #include <QDateTime>
 #include <QDebug>
-#include "src/functions/alog.h"
-#include "src/functions/atime.h"
+#include "src/functions/time.h"
 /*!
  * \brief The ACalc namespace provides various functions for calculations that are performed
  * outside of the database. This includes tasks like converting different units and formats,
  * or functions calculating block time or night time.
  */
 
-namespace ACalc {
+namespace OPL::Calc {
 
 /*!
  * \brief radToDeg Converts radians to degrees
@@ -78,7 +77,7 @@ inline double radToNauticalMiles(double rad)
 double greatCircleDistance(double lat1, double lon1, double lat2, double lon2);
 
 /*!
- * \brief ACalc::greatCircleDistanceBetweenAirports Calculates Great
+ * \brief Opl::Calc::greatCircleDistanceBetweenAirports Calculates Great
  * Circle distance between two coordinates, return in nautical miles.
  * \param dept ICAO 4-letter Airport Identifier
  * \param dest ICAO 4-letter Airport Identifier
@@ -148,8 +147,8 @@ struct NightTimeValues{
     {
         nightMinutes = calculateNightTime(dept, dest, departure_time, block_minutes, night_angle);
 
-        nightTime = ATime::qTimefromMinutes(nightMinutes);
-        totalTime = ATime::qTimefromMinutes(block_minutes);
+        nightTime = OPL::Time::qTimefromMinutes(nightMinutes);
+        totalTime = OPL::Time::qTimefromMinutes(block_minutes);
 
         if (nightMinutes == 0) { // all day
             takeOffNight = false;
@@ -185,6 +184,6 @@ struct NightTimeValues{
 };
 
 
-} // namespace ACalc
+} // namespace OPL::Calc
 
-#endif // ACALC_H
+#endif // CALC_H

+ 3 - 3
src/functions/alog.cpp → src/functions/log.cpp

@@ -15,12 +15,12 @@
  *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 "alog.h"
+#include "log.h"
 #include "src/classes/paths.h"
 #include <QMessageBox>
 #include <QTextStream>
 
-namespace ALog {
+namespace OPL::Log {
 
 static bool logDebug = false; // Debug doesn't log to file by default
 
@@ -67,7 +67,7 @@ bool init(bool log_debug)
 
     QFile log_file((logFileName));
     if(log_file.open(QIODevice::WriteOnly | QIODevice::Append)) {
-        qInstallMessageHandler(ALog::aMessageHandler);
+        qInstallMessageHandler(aMessageHandler);
         return true;
     } else {
         return false;

+ 5 - 6
src/functions/alog.h → src/functions/log.h

@@ -15,8 +15,8 @@
  *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 ALOG_H
-#define ALOG_H
+#ifndef LOG_H
+#define LOG_H
 
 #include <QTime>
 #include <QFile>
@@ -26,10 +26,9 @@
 #include <QFileInfoList>
 #include <iostream>
 #include <QDebug>
-#include "src/classes/astandardpaths.h"
 
 /*!
- * \brief The ALog namespace encapsulates constants and functions used to provide logging to files
+ * \brief The OPL::Log namespace encapsulates constants and functions used to provide logging to files
  * and logging to console (stdout)
  *
  * \details
@@ -47,7 +46,7 @@
  *
  * Credits to [Andy Dunkel](https://andydunkel.net/) for his excellent blog post on Qt Log File Rotation!
  */
-namespace ALog
+namespace OPL::Log
 {
     static QDir logFolder;
     static QString logFileName;
@@ -109,4 +108,4 @@ QDebug operator<<(QDebug qdb, const cls& object) \
     return qdb; \
 }
 
-#endif // ALOG_H
+#endif // LOG_H

+ 7 - 8
src/functions/astat.cpp → src/functions/statistics.cpp

@@ -15,16 +15,15 @@
  *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 "astat.h"
+#include "statistics.h"
 #include "src/database/database.h"
-#include "src/functions/alog.h"
 
 /*!
- * \brief AStat::totalTime Looks up Total Blocktime in the flights database
+ * \brief OPL::Statistics::totalTime Looks up Total Blocktime in the flights database
  * \param TimeFrame - The timeframe used for the calculations.
  * \return Amount of Total Block Time in minutes
  */
-int AStat::totalTime(TimeFrame time_frame)
+int OPL::Statistics::totalTime(TimeFrame time_frame)
 {
     QString statement;
     QDate start;
@@ -66,12 +65,12 @@ int AStat::totalTime(TimeFrame time_frame)
 }
 
 /*!
- * \brief AStat::currencyTakeOffLanding Returns the amount of Take Offs and
+ * \brief OPL::Statistics::currencyTakeOffLanding Returns the amount of Take Offs and
  * Landings performed in the last x days. If no vallue for days is provided, 90 is used,
  * as per EASA regulations
  * \return QVector<QString>{#TO,#LDG}
  */
-QVector<QVariant> AStat::countTakeOffLanding(int days)
+QVector<QVariant> OPL::Statistics::countTakeOffLanding(int days)
 {
     QDate start = QDate::fromJulianDay(QDate::currentDate().toJulianDay() - days);
     QString startdate = start.toString(Qt::ISODate);
@@ -94,7 +93,7 @@ QVector<QVariant> AStat::countTakeOffLanding(int days)
     return result;
 }
 
-QVector<QPair<QString, QString>> AStat::totals()
+QVector<QPair<QString, QString>> OPL::Statistics::totals()
 {
     QString statement = QStringLiteral("SELECT "
             "printf('%02d',CAST(SUM(tblk) AS INT)/60)||':'||printf('%02d',CAST(SUM(tblk) AS INT)%60) AS 'TOTAL', "
@@ -140,7 +139,7 @@ QVector<QPair<QString, QString>> AStat::totals()
  * The default value for days is 90.
  * \return
  */
-QDate AStat::currencyTakeOffLandingExpiry(int expiration_days)
+QDate OPL::Statistics::currencyTakeOffLandingExpiry(int expiration_days)
 {
     int number_of_days = 0;
     QVector<QVariant> takeoff_landings;

+ 5 - 5
src/functions/astat.h → src/functions/statistics.h

@@ -15,13 +15,13 @@
  *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 ASTAT_H
-#define ASTAT_H
+#ifndef STAT_H
+#define STAT_H
 #include <QtCore>
 #include <QSqlQuery>
 #include <QSqlError>
 
-namespace AStat {
+namespace OPL::Statistics {
 
 /*!
  * \brief The AStat namespace provides functionality for retreiving various statistics
@@ -42,6 +42,6 @@ namespace AStat {
 
     QVector<QPair<QString, QString>> totals();
 
-} // namespace AStat
+} // namespace OPL::Statistics
 
-#endif // ASTAT_H
+#endif // STAT_H

+ 13 - 14
src/functions/atime.h → src/functions/time.h

@@ -15,15 +15,14 @@
  *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 ATIME_H
-#define ATIME_H
+#ifndef TIME_H
+#define TIME_H
 
 #include <QtCore>
 #include <QTime>
 #include "src/opl.h"
-#include "src/functions/alog.h"
 
-namespace ATime {
+namespace OPL::Time {
 
 /*!
  * \brief Converts a QTime to a String to be used in the UI
@@ -144,8 +143,8 @@ inline QTime blocktime(const QTime &tofb, const QTime &tonb)
 
 inline QTime blocktime(const QString& tofb, const QString& tonb)
 {
-    QTime t_tofb = ATime::fromString(tofb);
-    QTime t_tonb = ATime::fromString(tonb);
+    QTime t_tofb = OPL::Time::fromString(tofb);
+    QTime t_tonb = OPL::Time::fromString(tonb);
     return blocktime(t_tofb, t_tonb);
 }
 
@@ -155,11 +154,11 @@ inline QTime blocktime(const QString& tofb, const QString& tonb)
  */
 inline int blockMinutes(const QString& tofb, const QString& tonb)
 {
-    const QTime t_tofb = ATime::fromString(tofb);
-    const QTime t_tonb = ATime::fromString(tonb);
+    const QTime t_tofb = OPL::Time::fromString(tofb);
+    const QTime t_tonb = OPL::Time::fromString(tonb);
     if (t_tofb.isValid() && t_tonb.isValid()) {
-        const auto tblk = ATime::blocktime(t_tofb, t_tonb);
-        return ATime::toMinutes(tblk);
+        const auto tblk = OPL::Time::blocktime(t_tofb, t_tonb);
+        return OPL::Time::toMinutes(tblk);
     } else
         return 0;
 }
@@ -171,8 +170,8 @@ inline int blockMinutes(const QString& tofb, const QString& tonb)
 inline int blockMinutes(const QTime& tofb, const QTime& tonb)
 {
     if (tofb.isValid() && tonb.isValid()) {
-        const auto tblk = ATime::blocktime(tofb, tonb);
-        return ATime::toMinutes(tblk);
+        const auto tblk = OPL::Time::blocktime(tofb, tonb);
+        return OPL::Time::toMinutes(tblk);
     } else
         return 0;
 }
@@ -212,6 +211,6 @@ inline const QString formatTimeInput(QString user_input)
     return output;
 }
 
-} // namespace ATime
+} // namespace OPL::Time
 
-#endif // ATIME_H
+#endif // TIME_H

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

@@ -116,10 +116,8 @@ void FirstRunDialog::on_nextPushButton_clicked()
 bool FirstRunDialog::finishSetup()
 {
     writeSettings();
-
     QFileInfo database_file(OPL::Paths::databaseFileInfo());
-    //QFileInfo database_file(AStandardPaths::directory(AStandardPaths::Database).
-    //                             absoluteFilePath(QStringLiteral("logbook.db")));
+
     if (database_file.exists()) {
 
         QMessageBox message_box(QMessageBox::Question, tr("Existing Database found"),
@@ -199,7 +197,6 @@ bool FirstRunDialog::downloadTemplates(QString branch_name)
     template_url_string.append(QLatin1String("/assets/database/templates/"));
 
     QDir template_dir(OPL::Paths::directory(OPL::Paths::Templates));
-    //QDir template_dir(AStandardPaths::directory(AStandardPaths::Templates));
 
     QStringList template_table_names;
     for (const auto table : DB->getTemplateTables())
@@ -253,7 +250,6 @@ bool FirstRunDialog::verifyTemplates()
         template_table_names.append(OPL::GLOBALS->getDbTableName(table));
     for (const auto &table_name : template_table_names) {
         const QString path = OPL::Paths::filePath(OPL::Paths::Templates, table_name);
-        //const QString path = AStandardPaths::asChildOfDir(AStandardPaths::Templates, table_name);
 
         QFileInfo check_file(path + QLatin1String(".json"));
         AHash hash(check_file);

+ 13 - 13
src/gui/dialogues/newflightdialog.cpp

@@ -20,7 +20,7 @@
 #include "src/opl.h"
 #include "src/functions/adate.h"
 #include "src/classes/asettings.h"
-#include "src/functions/acalc.h"
+#include "src/functions/calc.h"
 #include "src/functions/adatetime.h"
 #include "src/gui/dialogues/newtaildialog.h"
 #include "src/gui/dialogues/newpilotdialog.h"
@@ -203,8 +203,8 @@ void NewFlightDialog::fillWithEntryData()
     ui->deptLocationLineEdit->setText(flight_data.value(OPL::Db::FLIGHTS_DEPT).toString());
     ui->destLocationLineEdit->setText(flight_data.value(OPL::Db::FLIGHTS_DEST).toString());
     // Times
-    ui->tofbTimeLineEdit->setText(ATime::toString(flight_data.value(OPL::Db::FLIGHTS_TOFB).toInt()));
-    ui->tonbTimeLineEdit->setText(ATime::toString(flight_data.value(OPL::Db::FLIGHTS_TONB).toInt()));
+    ui->tofbTimeLineEdit->setText(OPL::Time::toString(flight_data.value(OPL::Db::FLIGHTS_TOFB).toInt()));
+    ui->tonbTimeLineEdit->setText(OPL::Time::toString(flight_data.value(OPL::Db::FLIGHTS_TONB).toInt()));
     ui->acftLineEdit->setText(completionData.tailsIdMap.value(flight_data.value(OPL::Db::FLIGHTS_ACFT).toInt()));
     ui->picNameLineEdit->setText(completionData.pilotsIdMap.value(flight_data.value(OPL::Db::FLIGHTS_PIC).toInt()));
     ui->sicNameLineEdit->setText(completionData.pilotsIdMap.value(flight_data.value(OPL::Db::FLIGHTS_SECONDPILOT).toInt()));
@@ -278,8 +278,8 @@ void NewFlightDialog::onBadInputReceived(QLineEdit *line_edit)
 
 void NewFlightDialog::updateBlockTimeLabel()
 {
-    QTime tblk = ATime::blocktime(ui->tofbTimeLineEdit->text(), ui->tonbTimeLineEdit->text());
-    ui->tblkDisplayLabel->setText(ATime::toString(tblk));
+    QTime tblk = OPL::Time::blocktime(ui->tofbTimeLineEdit->text(), ui->tonbTimeLineEdit->text());
+    ui->tblkDisplayLabel->setText(OPL::Time::toString(tblk));
 }
 
 /*!
@@ -369,16 +369,16 @@ OPL::RowData_T NewFlightDialog::prepareFlightEntryData()
 
     OPL::RowData_T new_data;
     // Calculate Block and Night Time
-    const int block_minutes = ATime::blockMinutes(ui->tofbTimeLineEdit->text(), ui->tonbTimeLineEdit->text());
+    const int block_minutes = OPL::Time::blockMinutes(ui->tofbTimeLineEdit->text(), ui->tonbTimeLineEdit->text());
     QDateTime departure_date_time = ADateTime::fromString(ui->doftLineEdit->text() + ui->tofbTimeLineEdit->text());
-    const auto night_time_data = ACalc::NightTimeValues(ui->deptLocationLineEdit->text(), ui->destLocationLineEdit->text(),
+    const auto night_time_data = OPL::Calc::NightTimeValues(ui->deptLocationLineEdit->text(), ui->destLocationLineEdit->text(),
                            departure_date_time, block_minutes, ASettings::read(ASettings::FlightLogging::NightAngle).toInt());
     // Mandatory data
     new_data.insert(OPL::Db::FLIGHTS_DOFT, ui->doftLineEdit->text());
     new_data.insert(OPL::Db::FLIGHTS_DEPT, ui->deptLocationLineEdit->text());
-    new_data.insert(OPL::Db::FLIGHTS_TOFB, ATime::toMinutes(ui->tofbTimeLineEdit->text()));
+    new_data.insert(OPL::Db::FLIGHTS_TOFB, OPL::Time::toMinutes(ui->tofbTimeLineEdit->text()));
     new_data.insert(OPL::Db::FLIGHTS_DEST, ui->destLocationLineEdit->text());
-    new_data.insert(OPL::Db::FLIGHTS_TONB, ATime::toMinutes(ui->tonbTimeLineEdit->text()));
+    new_data.insert(OPL::Db::FLIGHTS_TONB, OPL::Time::toMinutes(ui->tonbTimeLineEdit->text()));
     new_data.insert(OPL::Db::FLIGHTS_TBLK, block_minutes);
     // Night
     new_data.insert(OPL::Db::FLIGHTS_TNIGHT, night_time_data.nightMinutes);
@@ -480,9 +480,9 @@ void NewFlightDialog::updateNightCheckBoxes()
     // Calculate Night Time
     const QString dept_date = (ui->doftLineEdit->text() + ui->tofbTimeLineEdit->text());
     const auto dept_date_time = ADateTime::fromString(dept_date);
-    const int block_minutes = ATime::blockMinutes(ui->tofbTimeLineEdit->text(), ui->tonbTimeLineEdit->text());
+    const int block_minutes = OPL::Time::blockMinutes(ui->tofbTimeLineEdit->text(), ui->tonbTimeLineEdit->text());
     const int night_angle = ASettings::read(ASettings::FlightLogging::NightAngle).toInt();
-    const auto night_values = ACalc::NightTimeValues(
+    const auto night_values = OPL::Calc::NightTimeValues(
                 ui->deptLocationLineEdit->text(),
                 ui->destLocationLineEdit->text(),
                 dept_date_time,
@@ -517,8 +517,8 @@ void NewFlightDialog::onTimeLineEdit_editingFinished()
     auto line_edit = this->findChild<QLineEdit*>(sender()->objectName());
     DEB << line_edit->objectName() << "Editing finished -" << line_edit->text();
 
-    const QString time_string = ATime::formatTimeInput(line_edit->text());
-    const QTime time = ATime::fromString(time_string);
+    const QString time_string = OPL::Time::formatTimeInput(line_edit->text());
+    const QTime time = OPL::Time::fromString(time_string);
 
     if (time.isValid()) {
         line_edit->setText(time_string);

+ 1 - 1
src/gui/dialogues/newflightdialog.h

@@ -24,7 +24,7 @@
 #include <QList>
 #include <QBitArray>
 
-#include "src/functions/atime.h"
+#include "src/functions/time.h"
 #include "src/database/database.h"
 #include "src/database/dbcompletiondata.h"
 #include "src/opl.h"

+ 1 - 1
src/gui/dialogues/newpilotdialog.cpp

@@ -22,7 +22,7 @@
 #include "src/database/database.h"
 #include "src/database/dbcompletiondata.h"
 #include "src/database/row.h"
-#include "src/functions/alog.h"
+#include "src/functions/log.h"
 
 /*!
  * \brief NewPilotDialog::NewPilotDialog - creates a new pilot dialog which can be used to add a new entry to the database

+ 9 - 7
src/gui/dialogues/newsimdialog.cpp

@@ -1,8 +1,10 @@
 #include "newsimdialog.h"
 #include "ui_newsimdialog.h"
 #include "src/opl.h"
-#include "src/functions/atime.h"
+#include "src/functions/time.h"
 #include "src/functions/adate.h"
+#include "src/database/database.h"
+#include "src/database/dbcompletiondata.h"
 #include <QCompleter>
 /*!
  * \brief create a NewSimDialog to add a new Simulator Entry to the database
@@ -53,7 +55,7 @@ void NewSimDialog::fillEntryData()
 {
     const auto& data = entry.getData();
     ui->dateLineEdit->setText(data.value(OPL::Db::SIMULATORS_DATE).toString());
-    ui->totalTimeLineEdit->setText(ATime::toString(data.value(OPL::Db::SIMULATORS_TIME).toInt()));
+    ui->totalTimeLineEdit->setText(OPL::Time::toString(data.value(OPL::Db::SIMULATORS_TIME).toInt()));
     ui->deviceTypeComboBox->setCurrentIndex(data.value(OPL::Db::SIMULATORS_TYPE).toInt());
     ui->aircraftTypeLineEdit->setText(data.value(OPL::Db::SIMULATORS_ACFT).toString());
     ui->registrationLineEdit->setText(data.value(OPL::Db::SIMULATORS_REG).toString());
@@ -84,8 +86,8 @@ void NewSimDialog::on_dateLineEdit_editingFinished()
 
 void NewSimDialog::on_totalTimeLineEdit_editingFinished()
 {
-    const QString time_string = ATime::formatTimeInput(ui->totalTimeLineEdit->text());
-    const QTime time = ATime::fromString(time_string);
+    const QString time_string = OPL::Time::formatTimeInput(ui->totalTimeLineEdit->text());
+    const QTime time = OPL::Time::fromString(time_string);
 
     if (time.isValid()) {
         ui->totalTimeLineEdit->setText(time_string);
@@ -127,8 +129,8 @@ bool NewSimDialog::verifyInput(QString& error_msg)
         return false;
     }
     // Time
-    const QString time_string = ATime::formatTimeInput(ui->totalTimeLineEdit->text());
-    const QTime time = ATime::fromString(time_string);
+    const QString time_string = OPL::Time::formatTimeInput(ui->totalTimeLineEdit->text());
+    const QTime time = OPL::Time::fromString(time_string);
 
     if (!time.isValid()) {
         ui->totalTimeLineEdit->setStyleSheet(OPL::Styles::RED_BORDER);
@@ -153,7 +155,7 @@ OPL::RowData_T NewSimDialog::collectInput()
     // Date
     new_entry.insert(OPL::Db::SIMULATORS_DATE, ui->dateLineEdit->text());
     // Time
-    new_entry.insert(OPL::Db::SIMULATORS_TIME, ATime::toMinutes(ui->totalTimeLineEdit->text()));
+    new_entry.insert(OPL::Db::SIMULATORS_TIME, OPL::Time::toMinutes(ui->totalTimeLineEdit->text()));
     // Device Type
     new_entry.insert(OPL::Db::SIMULATORS_TYPE, ui->deviceTypeComboBox->currentText());
     // Aircraft Type

+ 0 - 2
src/gui/dialogues/newsimdialog.h

@@ -3,8 +3,6 @@
 
 #include <QDialog>
 #include "src/database/row.h"
-#include "src/database/database.h"
-#include "src/database/dbcompletiondata.h"
 
 namespace Ui {
 class NewSimDialog;

+ 0 - 1
src/gui/dialogues/newtaildialog.cpp

@@ -17,7 +17,6 @@
  */
 #include "newtaildialog.h"
 #include "ui_newtail.h"
-#include "src/functions/alog.h"
 #include "src/opl.h"
 #include "src/database/dbcompletiondata.h"
 

+ 1 - 1
src/gui/dialogues/newtaildialog.h

@@ -25,7 +25,7 @@
 #include <QComboBox>
 
 #include "src/classes/asettings.h"
-#include "src/functions/acalc.h"
+#include "src/functions/calc.h"
 #include "src/database/database.h"
 #include "src/database/row.h"
 

+ 2 - 3
src/gui/widgets/aircraftwidget.cpp

@@ -21,7 +21,6 @@
 #include "src/classes/asettings.h"
 #include "src/database/database.h"
 #include "src/database/row.h"
-#include "src/functions/alog.h"
 
 AircraftWidget::AircraftWidget(QWidget *parent) :
     QWidget(parent),
@@ -281,9 +280,9 @@ const QString AircraftWidget::getFlightSummary(const OPL::FlightEntry &flight) c
     auto space = QLatin1Char(' ');
     flight_summary.append(tableData.value(OPL::Db::FLIGHTS_DOFT).toString() + space);
     flight_summary.append(tableData.value(OPL::Db::FLIGHTS_DEPT).toString() + space);
-    flight_summary.append(ATime::toString(tableData.value(OPL::Db::FLIGHTS_TOFB).toInt())
+    flight_summary.append(OPL::Time::toString(tableData.value(OPL::Db::FLIGHTS_TOFB).toInt())
                           + space);
-    flight_summary.append(ATime::toString(tableData.value(OPL::Db::FLIGHTS_TONB).toInt())
+    flight_summary.append(OPL::Time::toString(tableData.value(OPL::Db::FLIGHTS_TONB).toInt())
                           + space);
     flight_summary.append(tableData.value(OPL::Db::FLIGHTS_DEST).toString());
 

+ 5 - 7
src/gui/widgets/backupwidget.cpp

@@ -57,7 +57,6 @@ void BackupWidget::refresh()
 {
     // First column in table, would be created by listing the files in backupdir
     QDir backup_dir = OPL::Paths::directory(OPL::Paths::Backup);
-    //QDir backup_dir = QDir(AStandardPaths::directory(AStandardPaths::Backup));
     const QStringList entries = backup_dir.entryList(QStringList{"*.db"}, QDir::Files, QDir::Time);
     QFileIconProvider provider;
 
@@ -70,7 +69,7 @@ void BackupWidget::refresh()
                           new QStandardItem(summary[OPL::DbSummaryKey::total_tails]),
                           new QStandardItem(summary[OPL::DbSummaryKey::total_pilots]),
                           new QStandardItem(summary[OPL::DbSummaryKey::last_flight]),
-                          new FileStandardItem(provider.icon(QFileIconProvider::File), entry, OPL::Paths::Backup)
+                          new QStandardItem(provider.icon(QFileIconProvider::File), entry),
                          });
     }
 
@@ -84,7 +83,6 @@ const QString BackupWidget::absoluteBackupPath()
             + ADateTime::toString(QDateTime::currentDateTime(), OPL::DateTimeFormat::Backup)
             + QLatin1String(".db");
     return OPL::Paths::filePath(OPL::Paths::Backup, backup_name);
-    //return AStandardPaths::asChildOfDir(AStandardPaths::Backup, backup_name);
 }
 
 const QString BackupWidget::backupName()
@@ -98,7 +96,6 @@ void BackupWidget::on_tableView_clicked(const QModelIndex &index)
 {
     selectedRows.clear();
     selectedRows.append(index.row());
-    DEB << model->item(index.row(), 5)->data(Qt::DisplayRole);
 }
 
 void BackupWidget::on_createLocalPushButton_clicked()
@@ -113,6 +110,7 @@ void BackupWidget::on_createLocalPushButton_clicked()
         INFO(tr("Backup successfully created."));
     }
 
+    QFileInfo file_info(filename);
     QFileIconProvider provider;
     QMap<OPL::DbSummaryKey, QString> summary = OPL::DbSummary::databaseSummary(filename);
     model->insertRow(0, {new QStandardItem(summary[OPL::DbSummaryKey::total_time]),
@@ -120,7 +118,7 @@ void BackupWidget::on_createLocalPushButton_clicked()
                          new QStandardItem(summary[OPL::DbSummaryKey::total_tails]),
                          new QStandardItem(summary[OPL::DbSummaryKey::total_pilots]),
                          new QStandardItem(summary[OPL::DbSummaryKey::last_flight]),
-                         new FileStandardItem(provider.icon(QFileIconProvider::File), QFileInfo(filename)),
+                         new QStandardItem(provider.icon(QFileIconProvider::File), file_info.fileName()),
                      });
 }
 
@@ -186,7 +184,7 @@ void BackupWidget::on_deleteSelectedPushButton_clicked()
 
     LOG << "Deleting backup:" << file_name;
     if(!file.remove()) {
-        WARN(tr("Unable to remove file %1\nError: %2").arg(file_name,file.errorString()));
+        WARN(tr("Unable to remove file %1<br>Error: %2").arg(file_name,file.errorString()));
         return;
     } else {
         INFO(tr("Backup successfully deleted."));
@@ -244,7 +242,7 @@ void BackupWidget::on_restoreExternalPushButton_clicked()
     confirm.setWindowTitle(tr("Import Database"));
     confirm.setText(tr("The following database will be imported:<br><br><b><tt>"
                        "%1<br></b></tt>"
-                       "<br>Is this correct?"
+                       "<br>Continue?"
                        ).arg(OPL::DbSummary::summaryString(filename)));
     if (confirm.exec() == QMessageBox::Yes) {
         if(!DB->restoreBackup(filename)) {

+ 3 - 29
src/gui/widgets/backupwidget.h

@@ -30,37 +30,11 @@ namespace Ui {
 class BackupWidget;
 }
 
-/*!
- * \brief Simple QStandardItem subclass to encapsulate necessary file info.
- * Using only a QStandardItem would mean that the full path should be inputted
- * as data and of course displayed by default. However this way we create
- * the absolute path in the fileInfo attribute for further use while
- * displaying only the base name.
- */
-class FileStandardItem : public QStandardItem {
-private:
-    QFileInfo fileInfo;
-public:
-    FileStandardItem(const QIcon& icon, const QString& filename, const OPL::Paths::Directories dir)
-        : QStandardItem(icon, filename),
-          fileInfo(QFileInfo(OPL::Paths::filePath(dir, filename)))
-    {}
-    FileStandardItem(const QIcon& icon, const QFileInfo file_info)
-        : QStandardItem(icon, file_info.baseName()),
-          fileInfo(QFileInfo(file_info))
-    {}
-
-    const QFileInfo& info() const
-    {
-        return fileInfo;
-    }
-};
-
 /*!
  * \brief The BackupWidget is the interface for the user to create and restore backups of the
  * database.
  * \details OpenPilotLog offers two kinds of backups: Local and External Backups.<br><br>Local backups
- * are automatically stored in a folder determined by AStandardpaths and automatically presented to the user in a List.
+ * are automatically stored in a folder determined by OPL::Paths and automatically presented to the user in a List.
  * <b>Create Local backup</b> and <b>Restore Local Backup</b>. are convenient shortcuts.<br>
  * When using <b>Create External Backup</b>, the user will be asked where to save the backup file. This can be a pen drive, a cloud location or any other location of his choice.
  * This functionality can also be used to sync the database across devices. External backup files con be restored with <b>Restore external backup</b>.
@@ -86,12 +60,12 @@ private slots:
     void on_tableView_clicked(const QModelIndex &index);
 
     /*!
-     * \brief Creates a local Backup in the location determined by AStandardPaths::Backup
+     * \brief Creates a local Backup in the location determined by Paths::Backup
      */
     void on_createLocalPushButton_clicked();
 
     /*!
-     * \brief Restores a backup from the folder determined by AStandardPaths::Backup
+     * \brief Restores a backup from the folder determined by Paths::Backup
      */
     void on_restoreLocalPushButton_clicked();
 

+ 3 - 17
src/gui/widgets/debugwidget.cpp

@@ -17,21 +17,7 @@
  */
 #include "debugwidget.h"
 #include "ui_debugwidget.h"
-#include "src/classes/astandardpaths.h"
-#include "src/gui/widgets/logbookwidget.h"
-#include "src/gui/widgets/pilotswidget.h"
-#include "src/gui/widgets/aircraftwidget.h"
-#include "src/gui/dialogues/firstrundialog.h"
-#include "src/gui/widgets/backupwidget.h"
 #include <QtGlobal>
-#include "src/functions/atime.h"
-#include "src/functions/astat.h"
-#include "src/classes/atranslator.h"
-#include "src/classes/ahash.h"
-#include "src/classes/ajson.h"
-#include "src/functions/adate.h"
-
-
 #include "src/testing/importCrewlounge/processflights.h"
 #include "src/testing/importCrewlounge/processpilots.h"
 #include "src/testing/importCrewlounge/processaircraft.h"
@@ -85,7 +71,7 @@ void DebugWidget::on_resetDatabasePushButton_clicked()
 {
     // disconnect and remove old database
     DB->disconnect();
-    QFile db_file(AStandardPaths::directory(AStandardPaths::Database).absoluteFilePath(QStringLiteral("logbook.db")));
+    QFile db_file(OPL::Paths::databaseFileInfo().absoluteFilePath());
     if (!db_file.remove()) {
         WARN(tr("Unable to delete existing database file."));
         return;
@@ -100,7 +86,7 @@ void DebugWidget::on_resetDatabasePushButton_clicked()
     template_url_string.append(branch_name);
     template_url_string.append(QLatin1String("/assets/database/templates/"));
 
-    QDir template_dir(AStandardPaths::directory(AStandardPaths::Templates));
+    QDir template_dir(OPL::Paths::directory(OPL::Paths::Templates));
     QStringList template_table_names;
     for (const auto table : DB->getTemplateTables())
         template_table_names.append(OPL::GLOBALS->getDbTableName(table));
@@ -209,7 +195,7 @@ void DebugWidget::on_selectCsvPushButton_clicked()
 {
     auto fileName = QFileDialog::getOpenFileName(this,
                                                  tr("Open CSV File for import"),
-                                                 AStandardPaths::directory(AStandardPaths::Templates).absolutePath(),
+                                                 OPL::Paths::directory(OPL::Paths::Templates).absolutePath(),
                                                  tr("CSV files (*.csv)"));
     ui->importCsvLineEdit->setText(fileName);
 }

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

@@ -32,7 +32,7 @@
 #include "src/database/row.h"
 
 #include "src/testing/atimer.h"
-#include "src/functions/alog.h"
+#include "src/functions/log.h"
 
 namespace Ui {
 class DebugWidget;

+ 13 - 14
src/gui/widgets/homewidget.cpp

@@ -17,9 +17,8 @@
  */
 #include "homewidget.h"
 #include "ui_homewidget.h"
-#include "src/functions/alog.h"
 #include "src/database/database.h"
-#include "src/functions/atime.h"
+#include "src/functions/time.h"
 #include "src/classes/asettings.h"
 #include "src/database/row.h"
 
@@ -94,12 +93,12 @@ void HomeWidget::changeEvent(QEvent *event)
 }
 
 /*!
- * \brief HomeWidget::fillTotals Retreives a Database Summary of Total Flight Time via the AStat::totals
+ * \brief HomeWidget::fillTotals Retreives a Database Summary of Total Flight Time via the OPL::Statistics::totals
  * function and parses the return to fill out the QLineEdits.
  */
 void HomeWidget::fillTotals()
 {
-    const auto data = AStat::totals();
+    const auto data = OPL::Statistics::totals();
     for (const auto &field : data) {
         auto line_edit = this->findChild<QLineEdit *>(field.first + QLatin1String("LineEdit"));
         line_edit->setText(field.second);
@@ -167,13 +166,13 @@ void HomeWidget::fillSelectedCurrencies()
 }
 
 /*!
- * \brief HomeWidget::fillCurrencyTakeOffLanding Uses AStat::countTakeOffLandings to determine
+ * \brief HomeWidget::fillCurrencyTakeOffLanding Uses OPL::Statistics::countTakeOffLandings to determine
  * the amount of Take-Offs and Landings in the last 90 days and displays data and notifications
  * as required.
  */
 void HomeWidget::fillCurrencyTakeOffLanding()
 {
-    const auto takeoff_landings = AStat::countTakeOffLanding();
+    const auto takeoff_landings = OPL::Statistics::countTakeOffLanding();
     if(takeoff_landings.isEmpty())
         return;
 
@@ -185,7 +184,7 @@ void HomeWidget::fillCurrencyTakeOffLanding()
         setLabelColour(ui->LandingsDisplayLabel, Colour::Red);
 
     if (ASettings::read(ASettings::UserData::ShowToLgdCurrency).toBool()) {
-        QDate expiration_date = AStat::currencyTakeOffLandingExpiry();
+        QDate expiration_date = OPL::Statistics::currencyTakeOffLandingExpiry();
         if (expiration_date <= QDate::currentDate())
             setLabelColour(ui->currToLdgDisplayLabel, Colour::Red);
         ui->currToLdgDisplayLabel->setText(expiration_date.toString(Qt::TextDate));
@@ -196,29 +195,29 @@ void HomeWidget::fillCurrencyTakeOffLanding()
 }
 
 /*!
- * \brief HomeWidget::fillLimitations Queries AStat to obtain information regarding cumulative
+ * \brief HomeWidget::fillLimitations Queries OPL::Statistics to obtain information regarding cumulative
  * Flight Times and Calculates and Notifies about approaching Flight Time Limitations
  */
 void HomeWidget::fillLimitations()
 {
-    int minutes = AStat::totalTime(AStat::TimeFrame::Rolling28Days);
-    ui->FlightTime28dDisplayLabel->setText(ATime::toString(minutes));
+    int minutes = OPL::Statistics::totalTime(OPL::Statistics::TimeFrame::Rolling28Days);
+    ui->FlightTime28dDisplayLabel->setText(OPL::Time::toString(minutes));
     if (minutes >= ROLLING_28_DAYS) {
         setLabelColour(ui->FlightTime28dDisplayLabel, Colour::Red);
     } else if (minutes >= ROLLING_28_DAYS * ftlWarningThreshold) {
         setLabelColour(ui->FlightTime28dDisplayLabel, Colour::Orange);
     }
 
-    minutes = AStat::totalTime(AStat::TimeFrame::Rolling12Months);
-    ui->FlightTime12mDisplayLabel->setText(ATime::toString(minutes));
+    minutes = OPL::Statistics::totalTime(OPL::Statistics::TimeFrame::Rolling12Months);
+    ui->FlightTime12mDisplayLabel->setText(OPL::Time::toString(minutes));
     if (minutes >= ROLLING_12_MONTHS) {
         setLabelColour(ui->FlightTime12mDisplayLabel, Colour::Red);
     } else if (minutes >= ROLLING_12_MONTHS * ftlWarningThreshold) {
         setLabelColour(ui->FlightTime12mDisplayLabel, Colour::Orange);
     }
 
-    minutes = AStat::totalTime(AStat::TimeFrame::CalendarYear);
-    ui->FlightTimeCalYearDisplayLabel->setText(ATime::toString(minutes));
+    minutes = OPL::Statistics::totalTime(OPL::Statistics::TimeFrame::CalendarYear);
+    ui->FlightTimeCalYearDisplayLabel->setText(OPL::Time::toString(minutes));
     if (minutes >= CALENDAR_YEAR) {
         setLabelColour(ui->FlightTimeCalYearDisplayLabel, Colour::Red);
     } else if (minutes >= CALENDAR_YEAR * ftlWarningThreshold) {

+ 1 - 1
src/gui/widgets/homewidget.h

@@ -23,7 +23,7 @@
 #include <QLabel>
 #include <QLineEdit>
 #include <QSettings>
-#include "src/functions/astat.h"
+#include "src/functions/statistics.h"
 #include "src/database/database.h"
 #include "src/classes/asettings.h"
 

+ 3 - 5
src/gui/widgets/logbookwidget.cpp

@@ -15,16 +15,14 @@
  *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 "src/database/database.h"
 #include "logbookwidget.h"
 #include "ui_logbookwidget.h"
-
 #include "src/database/row.h"
 #include "src/database/database.h"
 #include "src/classes/asettings.h"
 #include "src/gui/dialogues/newflightdialog.h"
 #include "src/gui/dialogues/newsimdialog.h"
-#include "src/functions/alog.h"
-#include "src/functions/alog.h"
 
 const QHash<int, QString> FILTER_MAP = {
     {0, QStringLiteral("Date LIKE \"%")},
@@ -107,9 +105,9 @@ const QString LogbookWidget::getFlightSummary(const OPL::FlightEntry &flight) co
     auto space = QLatin1Char(' ');
     flight_summary.append(tableData.value(OPL::Db::FLIGHTS_DOFT).toString() + space);
     flight_summary.append(tableData.value(OPL::Db::FLIGHTS_DEPT).toString() + space);
-    flight_summary.append(ATime::toString(tableData.value(OPL::Db::FLIGHTS_TOFB).toInt())
+    flight_summary.append(OPL::Time::toString(tableData.value(OPL::Db::FLIGHTS_TOFB).toInt())
                           + space);
-    flight_summary.append(ATime::toString(tableData.value(OPL::Db::FLIGHTS_TONB).toInt())
+    flight_summary.append(OPL::Time::toString(tableData.value(OPL::Db::FLIGHTS_TONB).toInt())
                           + space);
     flight_summary.append(tableData.value(OPL::Db::FLIGHTS_DEST).toString());
 

+ 5 - 3
src/gui/widgets/pilotswidget.cpp

@@ -17,10 +17,12 @@
  */
 #include "pilotswidget.h"
 #include "ui_pilotswidget.h"
+#include "src/gui/dialogues/newpilotdialog.h"
 #include "src/opl.h"
-#include "src/functions/alog.h"
 #include "src/database/database.h"
 #include "src/database/row.h"
+#include "src/functions/time.h"
+#include "src/classes/asettings.h"
 
 PilotsWidget::PilotsWidget(QWidget *parent) :
     QWidget(parent),
@@ -258,9 +260,9 @@ const QString PilotsWidget::getFlightSummary(const OPL::FlightEntry &flight) con
     auto space = QLatin1Char(' ');
     flight_summary.append(tableData.value(OPL::Db::FLIGHTS_DOFT).toString() + space);
     flight_summary.append(tableData.value(OPL::Db::FLIGHTS_DEPT).toString() + space);
-    flight_summary.append(ATime::toString(tableData.value(OPL::Db::FLIGHTS_TOFB).toInt())
+    flight_summary.append(OPL::Time::toString(tableData.value(OPL::Db::FLIGHTS_TOFB).toInt())
                           + space);
-    flight_summary.append(ATime::toString(tableData.value(OPL::Db::FLIGHTS_TONB).toInt())
+    flight_summary.append(OPL::Time::toString(tableData.value(OPL::Db::FLIGHTS_TONB).toInt())
                           + space);
     flight_summary.append(tableData.value(OPL::Db::FLIGHTS_DEST).toString());
 

+ 1 - 3
src/gui/widgets/pilotswidget.h

@@ -22,10 +22,8 @@
 #include <QItemSelection>
 #include <QSqlTableModel>
 #include <QTableView>
-#include "src/classes/asettings.h"
-#include "src/gui/dialogues/newpilotdialog.h"
+#include "src/database/row.h"
 #include "src/gui/widgets/settingswidget.h"
-#include "src/functions/acalc.h"
 
 namespace Ui {
 class PilotsWidget;

+ 1 - 1
src/testing/atimer.h

@@ -21,7 +21,7 @@
 #include <QObject>
 #include <chrono>
 #include <QDebug>
-#include "src/functions/alog.h"
+#include "src/functions/log.h"
 
 /*!
  * \brief The ATimer class provides an easy to use performance timer.

+ 3 - 3
src/testing/importCrewlounge/processflights.cpp

@@ -1,5 +1,5 @@
 #include "processflights.h"
-#include <src/functions/atime.h>
+#include <src/functions/time.h>
 
 void ProcessFlights::parseRawData()
 {
@@ -53,14 +53,14 @@ void ProcessFlights::processParsedData()
         auto time_off = QTime::fromString(row[4], QStringLiteral("hh:mm"));
         if (!time_off.isValid())
             time_off = QTime::fromString(row[4], QStringLiteral("h:mm"));
-        int tofb = ATime::toMinutes(time_off);
+        int tofb = OPL::Time::toMinutes(time_off);
         new_flight_data.insert(OPL::Db::FLIGHTS_TOFB, tofb);
 
         auto time_on = QTime::fromString(row[5], QStringLiteral("hh:mm"));
         if (!time_on.isValid())
             time_on = QTime::fromString(row[5], QStringLiteral("h:mm"));
 
-        int tonb = ATime::toMinutes(time_on);
+        int tonb = OPL::Time::toMinutes(time_on);
         new_flight_data.insert(OPL::Db::FLIGHTS_TONB, tonb);
 
         // map pilots