Browse Source

Simplified Debug makro

As per suggestion
Felix 4 years ago
parent
commit
d8e5ddbf44

+ 4 - 4
main.cpp

@@ -61,7 +61,7 @@ int main(int argc, char *argv[])
 
     QApplication openPilotLog(argc, argv);
     if(!setup()){
-        DEB("error creating required directories");
+        DEB "error creating required directories";
         return 0;
     }
 
@@ -77,7 +77,7 @@ int main(int argc, char *argv[])
     QDir::setCurrent("/themes");
     switch (selectedtheme) {
     case 1:{
-        qDebug() << "main :: Loading light theme";
+        DEB "main :: Loading light theme";
         QFile file(":light.qss");
         file.open(QFile::ReadOnly | QFile::Text);
         QTextStream stream(&file);
@@ -85,7 +85,7 @@ int main(int argc, char *argv[])
         break;
     }
     case 2:{
-        qDebug() << "Loading dark theme";
+        DEB "Loading dark theme";
         QFile file(":dark.qss");
         file.open(QFile::ReadOnly | QFile::Text);
         QTextStream stream(&file);
@@ -100,7 +100,7 @@ int main(int argc, char *argv[])
     //sqlite does not deal well with multiple connections, ensure only one instance is running
     ARunGuard guard("opl_single_key");
         if ( !guard.tryToRun() ){
-            qDebug() << "Another Instance is already running. Exiting.";
+            DEB "Another Instance is already running. Exiting.";
             return 0;
         }
 

+ 8 - 8
mainwindow.cpp

@@ -51,7 +51,7 @@ MainWindow::MainWindow(QWidget *parent)
     ui->toolBar->insertWidget(ui->actionDebug, spacer);
 
 
-    DEB("Construction MainWindow Widgets\n");
+    DEB "Construction MainWindow Widgets\n";
     // Construct Widgets
     homeWidget = new HomeWidget(this);
     ui->stackedWidget->addWidget(homeWidget);
@@ -78,14 +78,14 @@ MainWindow::MainWindow(QWidget *parent)
     /// working when something has changed. Hopefully this check
     /// helps to avoid that in the future! 
     #if DATABASE < 15
-    DEB("Your database is up to date with the latest revision.");
+    DEB "Your database is up to date with the latest revision.";
     #else
-    DEB("##########################################");
-    DEB("Your database is out of date.");
-    DEB("Current Revision:  " << DATABASE_REVISION_NUMBER);
-    DEB("You have revision: " << query.value(0).toInt());
-    DEB("Use of DebugWidget to udpate recommended.");
-    DEB("##########################################");
+    DEB "##########################################";
+    DEB "Your database is out of date.";
+    DEB "Current Revision:  " << DATABASE_REVISION_NUMBER;
+    DEB "You have revision: " << query.value(0).toInt();
+    DEB "Use of DebugWidget to udpate recommended.";
+    DEB "##########################################";
     #endif
     //// END DEBUG ////
 

+ 4 - 4
src/classes/adownload.cpp

@@ -28,7 +28,7 @@ ADownload::ADownload() : QObject(nullptr)
 
 ADownload::~ADownload()
 {
-    DEB("Deleting Download object");
+    DEB "Deleting Download object" ;
 }
 
 void ADownload::setTarget(const QUrl &value)
@@ -44,7 +44,7 @@ void ADownload::setFileName(const QString &value)
 void ADownload::download()
 {
     QNetworkRequest request(target);
-    DEB("Downloading from: " << target.toString());
+    DEB "Downloading from: " << target.toString();
 
     QObject::connect(manager.get(request), SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(downloadProgress(qint64,qint64)));
 }
@@ -52,7 +52,7 @@ void ADownload::download()
 
 void ADownload::downloadProgress(qint64 received, qint64 total)
 {
-    DEB("Received " << received << " bytes of " << total);
+    DEB "Received " << received << " bytes of " << total;
 }
 
 
@@ -65,7 +65,7 @@ void ADownload::downloadFinished(QNetworkReply *data)
     const QByteArray sdata = data->readAll();
     localFile.write(sdata);
     localFile.close();
-    qDebug() << "Download finished. Output file: " << fileName;
+    DEB "Download finished. Output file: " << fileName;
 
     emit done();
 }

+ 3 - 3
src/classes/atailentry.cpp

@@ -37,11 +37,11 @@ const QString ATailEntry::registration()
 const QString ATailEntry::type()
 {
     QString type_string;
-    if (!getData().value(DB_TAILS_MAKE).toString().isEmpty())
+    if (!tableData.value(DB_TAILS_MAKE).toString().isEmpty())
         type_string.append(getData().value(DB_TAILS_MAKE).toString() + ' ');
-    if (!getData().value(DB_TAILS_MODEL).toString().isEmpty())
+    if (!tableData.value(DB_TAILS_MODEL).toString().isEmpty())
         type_string.append(getData().value(DB_TAILS_MODEL).toString());
-    if (!getData().value(DB_TAILS_VARIANT).toString().isEmpty())
+    if (!tableData.value(DB_TAILS_VARIANT).toString().isEmpty())
         type_string.append('-' + getData().value(DB_TAILS_VARIANT).toString() + ' ');
 
     return type_string;

+ 41 - 41
src/database/adatabase.cpp

@@ -75,7 +75,7 @@ bool ADatabase::connect()
     if (!db.open())
         return false;
 
-    DEB("Database connection established." << db.lastError().text());
+    DEB "Database connection established." << db.lastError().text();
     // Enable foreign key restrictions
     QSqlQuery query("PRAGMA foreign_keys = ON;");
     tableNames = db.tables();
@@ -89,8 +89,8 @@ bool ADatabase::connect()
             tableColumns.insert(table, column_names);
         }
     }
-    DEB("Database Tables: " << tableNames);
-    DEB("Tables and Columns: " << tableColumns);
+    DEB "Database Tables: " << tableNames;
+    DEB "Tables and Columns: " << tableColumns;
     return true;
 }
 
@@ -98,7 +98,7 @@ void ADatabase::disconnect()
 {
     auto db = ADatabase::database();
     db.close();
-    DEB("Database connection closed.");
+    DEB "Database connection closed.";
 }
 
 QSqlDatabase ADatabase::database()
@@ -118,7 +118,7 @@ bool ADatabase::commit(AEntry entry)
 bool ADatabase::remove(AEntry entry)
 {
     if (!exists(entry)) {
-        DEB("Error: Database entry not found.");
+        DEB "Error: Database entry not found.";
         lastError = ADatabaseError("Database entry not found.");
         return false;
     }
@@ -133,14 +133,14 @@ bool ADatabase::remove(AEntry entry)
 
     if (query.lastError().type() == QSqlError::NoError)
     {
-        DEB("Entry " << entry.getPosition().tableName << entry.getPosition().rowId << " removed.");
+        DEB "Entry " << entry.getPosition().tableName << entry.getPosition().rowId << " removed.";
         emit dataBaseUpdated();
         lastError = QString();
         return true;
     } else {
-        DEB("Unable to delete.");
-        DEB("Query: " << statement);
-        DEB("Query Error: " << query.lastError().text());
+        DEB "Unable to delete.";
+        DEB "Query: " << statement;
+        DEB "Query Error: " << query.lastError().text();
         lastError = query.lastError().text();
         return false;
     }
@@ -204,7 +204,7 @@ bool ADatabase::exists(AEntry entry)
     //this returns either 1 or 0 since row ids are unique
     if (!query.isActive()) {
         lastError = query.lastError().text();
-        DEB("Query Error: " << query.lastError().text() << statement);
+        DEB "Query Error: " << query.lastError().text() << statement;
         return false;
     }
     query.next();
@@ -212,7 +212,7 @@ bool ADatabase::exists(AEntry entry)
     if (rowId) {
         return true;
     } else {
-        DEB("Database entry not found.");
+        DEB "Database entry not found.";
         lastError = ADatabaseError("Database entry not found.");
         return false;
     }
@@ -234,14 +234,14 @@ bool ADatabase::exists(DataPosition data_position)
     //this returns either 1 or 0 since row ids are unique
     if (!query.isActive()) {
         lastError = query.lastError().text();
-        DEB("Query Error: " << query.lastError().text() << statement);
+        DEB "Query Error: " << query.lastError().text() << statement;
     }
     query.next();
     int rowId = query.value(0).toInt();
     if (rowId) {
         return true;
     } else {
-        DEB("No entry exists at DataPosition: " << data_position);
+        DEB "No entry exists at DataPosition: " << data_position;
         lastError = ADatabaseError("Database entry not found.");
         return false;
     }
@@ -271,14 +271,14 @@ bool ADatabase::update(AEntry updated_entry)
 
     if (query.lastError().type() == QSqlError::NoError)
     {
-        DEB("Entry successfully committed.");
+        DEB "Entry successfully committed.";
         emit dataBaseUpdated();
         lastError = QString();
         return true;
     } else {
-        DEB("Unable to commit.");
-        DEB("Query: " << statement);
-        DEB("Query Error: " << query.lastError().text());
+        DEB "Unable to commit.";
+        DEB "Query: " << statement;
+        DEB "Query Error: " << query.lastError().text();
         lastError = query.lastError().text();
         return false;
     }
@@ -316,14 +316,14 @@ bool ADatabase::insert(AEntry new_entry)
     //check result.
     if (query.lastError().type() == QSqlError::NoError)
     {
-        DEB("Entry successfully committed.");
+        DEB "Entry successfully committed.";
         emit dataBaseUpdated();
         lastError = QString();
         return true;
     } else {
-        DEB("Unable to commit.");
-        DEB("Query: " << statement);
-        DEB("Query Error: " << query.lastError().text());
+        DEB "Unable to commit.";
+        DEB "Query: " << statement;
+        DEB "Query Error: " << query.lastError().text();
         lastError = query.lastError().text();
         return false;
     }
@@ -334,7 +334,7 @@ RowData ADatabase::getEntryData(DataPosition data_position)
 {
     // check table exists
     if (!tableNames.contains(data_position.first)) {
-        DEB(data_position.first << " not a table in the database. Unable to retreive Entry data.");
+        DEB data_position.first << " not a table in the database. Unable to retreive Entry data.";
         return RowData();
     }
 
@@ -348,15 +348,15 @@ RowData ADatabase::getEntryData(DataPosition data_position)
     check_query.exec();
 
     if (check_query.lastError().type() != QSqlError::NoError) {
-        DEB("SQL error: " << check_query.lastError().text());
-        DEB("Statement: " << statement);
+        DEB "SQL error: " << check_query.lastError().text();
+        DEB "Statement: " << statement;
         lastError = check_query.lastError().text();
         return RowData();
     }
 
     check_query.next();
     if (check_query.value(0).toInt() == 0) {
-        DEB("No Entry found for row id: " << data_position.second );
+        DEB "No Entry found for row id: " << data_position.second;
         lastError = ADatabaseError("Database entry not found.");
         return RowData();
     }
@@ -372,8 +372,8 @@ RowData ADatabase::getEntryData(DataPosition data_position)
     select_query.exec();
 
     if (select_query.lastError().type() != QSqlError::NoError) {
-        DEB("SQL error: " << select_query.lastError().text());
-        DEB("Statement: " << statement);
+        DEB "SQL error: " << select_query.lastError().text();
+        DEB "Statement: " << statement;
         lastError = select_query.lastError().text();
         return RowData();
     }
@@ -445,7 +445,7 @@ const QStringList ADatabase::getCompletionList(ADatabaseTarget target)
         statement.append("SELECT company FROM pilots");
         break;
     default:
-        DEB("Not a valid completer target for this function.");
+        DEB "Not a valid completer target for this function.";
         return QStringList();
     }
 
@@ -496,16 +496,16 @@ const QMap<QString, int> ADatabase::getIdMap(ADatabaseTarget target)
         statement.append("SELECT ROWID, registration FROM tails");
         break;
     default:
-        DEB("Not a valid completer target for this function.");
+        DEB "Not a valid completer target for this function.";
         return QMap<QString, int>();
     }
 
     auto id_map = QMap<QString, int>();
     auto query = QSqlQuery(statement);
     if (!query.isActive()) {
-        DEB("No result found. Check Query and Error.");
-        DEB("Query: " << statement);
-        DEB("Error: " << query.lastError().text());
+        DEB "No result found. Check Query and Error.";
+        DEB "Query: " << statement;
+        DEB "Error: " << query.lastError().text();
         lastError = query.lastError().text();
         return QMap<QString, int>();
     } else {
@@ -532,7 +532,7 @@ int ADatabase::getLastEntry(ADatabaseTarget target)
         statement.append(DB_TABLE_TAILS);
         break;
     default:
-        DEB("Not a valid completer target for this function.");
+        DEB "Not a valid completer target for this function.";
         return 0;
     }
     auto query = QSqlQuery(statement);
@@ -540,7 +540,7 @@ int ADatabase::getLastEntry(ADatabaseTarget target)
         return query.value(0).toInt();
     } else {
         lastError = ADatabaseError("Database entry not found.");
-        DEB("No entry found.");
+        DEB "No entry found.";
         return 0;
     }
 }
@@ -557,7 +557,7 @@ QList<int> ADatabase::getForeignKeyConstraints(int foreign_row_id, ADatabaseTarg
         statement.append("acft=?");
         break;
     default:
-        DEB("Not a valid target for this function.");
+        DEB "Not a valid target for this function.";
         return QList<int>();
         break;
     }
@@ -569,9 +569,9 @@ QList<int> ADatabase::getForeignKeyConstraints(int foreign_row_id, ADatabaseTarg
 
     if (!query.isActive()) {
         lastError = query.lastError().text();
-        DEB("Error");
-        DEB(statement);
-        DEB(query.lastError().text());
+        DEB "Error";
+        DEB statement;
+        DEB query.lastError().text();
         return QList<int>();
     }
 
@@ -598,9 +598,9 @@ QVector<QString> ADatabase::customQuery(QString statement, int return_values)
     query.exec();
 
     if (!query.first()) {
-        DEB("No result found. Check Query and Error.");
-        DEB("Error: " << query.lastError().text());
-        DEB("Statement: " << statement);
+        DEB "No result found. Check Query and Error.";
+        DEB "Error: " << query.lastError().text();
+        DEB "Statement: " << statement;
         lastError = query.lastError().text();
         return QVector<QString>();
     } else {

+ 24 - 24
src/database/adatabasesetup.cpp

@@ -260,28 +260,28 @@ const QStringList templateTables= {
 bool ADataBaseSetup::createDatabase()
 {
 
-    DEB("Creating tables...");
+    DEB "Creating tables...";
     if (!createSchemata(tables)) {
-        DEB("Creating tables has failed.");
+        DEB "Creating tables has failed.";
         return false;
     }
 
-    DEB("Creating views...");
+    DEB "Creating views...";
     if (!createSchemata(views)) {
-        DEB("Creating views failed.");
+        DEB "Creating views failed.";
         return false;
     }
 
     // call connect again to (re-)populate tableNames and columnNames
     aDB()->connect();
 
-    DEB("Populating tables...");
+    DEB "Populating tables...";
     if (!importDefaultData()) {
-        DEB("Populating tables failed.");
+        DEB "Populating tables failed.";
         return false;
     }
 
-    DEB("Database successfully created!");
+    DEB "Database successfully created!";
     return true;
 }
 
@@ -294,11 +294,11 @@ bool ADataBaseSetup::importDefaultData()
         //clear tables
         query.prepare("DELETE FROM " + table);
         if (!query.exec()) {
-            DEB("Error: " << query.lastError().text());
+            DEB "Error: " << query.lastError().text();
         }
         //fill with data from csv
         if (!commitData(aReadCsv("data/templates/" + table + ".csv"), table)) {
-            DEB("Error importing data.");
+            DEB "Error importing data.";
             return false;
         }
     }
@@ -317,7 +317,7 @@ bool ADataBaseSetup::resetToDefault()
     for (const auto& table : userTables) {
         query.prepare("DELETE FROM " + table);
         if (!query.exec()) {
-            DEB("Error: " << query.lastError().text());
+            DEB "Error: " << query.lastError().text();
         }
     }
     return true;
@@ -328,7 +328,7 @@ bool ADataBaseSetup::resetToDefault()
  */
 void ADataBaseSetup::debug()
 {
-    DEB("Database tables and views: ");
+    DEB "Database tables and views: ";
     QSqlQuery query;
     const QVector<QString> types = { "table", "view" };
     for (const auto& var : types){
@@ -338,7 +338,7 @@ void ADataBaseSetup::debug()
             QString table = query.value(0).toString();
             QSqlQuery entries("SELECT COUNT(*) FROM " + table);
             entries.next();
-            DEB("Element " << query.value(0).toString()) << "with"
+            DEB "Element " << query.value(0).toString() << "with"
                 << entries.value(0).toString() << "rows";
         }
     }
@@ -358,20 +358,20 @@ bool ADataBaseSetup::createSchemata(const QStringList &statements)
         query.exec();
         if(!query.isActive()) {
             errors << statement.section(QLatin1Char(' '),2,2) + " ERROR - " + query.lastError().text();
-            DEB("Query: " << query.lastQuery());
+            DEB "Query: " << query.lastQuery();
         } else {
-            DEB("Schema added: " << statement.section(QLatin1Char(' '),2,2));
+            DEB "Schema added: " << statement.section(QLatin1Char(' '),2,2);
         }
     }
 
     if (!errors.isEmpty()) {
-        DEB("The following errors have ocurred: ");
+        DEB "The following errors have ocurred: ";
         for (const auto& error : errors) {
-            DEB(error);
+            DEB error;
         }
         return false;
     } else {
-        DEB("All schemas added successfully");
+        DEB "All schemas added successfully";
         return true;
     }
 }
@@ -385,11 +385,11 @@ bool ADataBaseSetup::createSchemata(const QStringList &statements)
  */
 bool ADataBaseSetup::commitData(QVector<QStringList> fromCSV, const QString &tableName)
 {
-    DEB("Table names: " << aDB()->getTableNames());
-    DEB("Importing Data to" << tableName);
+    DEB "Table names: " << aDB()->getTableNames();
+    DEB "Importing Data to" << tableName;
     if (!aDB()->getTableNames().contains(tableName)){
-        DEB(tableName << "is not a table in the database. Aborting.");
-        DEB("Please check input data.");
+        DEB tableName << "is not a table in the database. Aborting.";
+        DEB "Please check input data.";
         return false;
     }
     // create insert statement
@@ -401,8 +401,8 @@ bool ADataBaseSetup::commitData(QVector<QStringList> fromCSV, const QString &tab
             csvColumn.removeFirst();
             placeholder.append("?,");
         } else {
-            DEB(csvColumn.first() << "is not a column of " << tableName << "Aborting.");
-            DEB("Please check input data.");
+            DEB csvColumn.first() << "is not a column of " << tableName << "Aborting.";
+            DEB "Please check input data.";
             return false;
         }
     }
@@ -430,7 +430,7 @@ bool ADataBaseSetup::commitData(QVector<QStringList> fromCSV, const QString &tab
 
     query.exec("COMMIT;"); //commit transaction
     if (query.lastError().text().length() > 3) {
-        DEB("Error:" << query.lastError().text());
+        DEB "Error:" << query.lastError().text();
         return false;
     } else {
         qDebug() << tableName << "Database successfully updated!";

+ 10 - 10
src/functions/acalc.cpp

@@ -91,7 +91,7 @@ double ACalc::greatCircleDistanceBetweenAirports(const QString &dept, const QStr
     auto lat_lon = aDB()->customQuery(statement, 2);
 
     if (lat_lon.length() != 4) {
-        DEB("Invalid input. Aborting.");
+        DEB "Invalid input. Aborting.";
         return 0;
     }
 
@@ -210,7 +210,7 @@ int ACalc::calculateNightTime(const QString &dept, const QString &dest, QDateTim
     auto lat_lon = aDB()->customQuery(statement, 2);
 
     if (lat_lon.length() != 4) {
-        DEB("Invalid input. Aborting.");
+        DEB "Invalid input. Aborting.";
         return 0;
     }
 
@@ -238,7 +238,7 @@ bool ACalc::isNight(const QString &icao, QDateTime event_time, int night_angle)
     auto lat_lon = aDB()->customQuery(statement, 2);
 
     if (lat_lon.length() != 2) {
-        DEB("Invalid input. Aborting.");
+        DEB "Invalid input. Aborting.";
         return 0;
     }
 
@@ -266,11 +266,11 @@ void ACalc::updateAutoTimes(int acft_id)
     auto flight_list = aDB()->customQuery(statement, 1);
 
     if (flight_list.isEmpty()) {
-        DEB("No flights for this tail found.");
+        DEB "No flights for this tail found.";
         return;
     }
 
-    DEB("Updating " << flight_list.length() << " flights with this aircraft.");
+    DEB "Updating " << flight_list.length() << " flights with this aircraft.";
 
     auto acft = aDB()->getTailEntry(acft_id);
     auto acft_data = acft.getData();
@@ -281,18 +281,18 @@ void ACalc::updateAutoTimes(int acft_id)
 
         if(acft_data.value("multipilot").toInt() == 0
                 && acft_data.value("multiengine") == 0) {
-            DEB("SPSE");
+            DEB "SPSE";
             flight_data.insert("tSPSE", flight_data.value("tblk"));
             flight_data.insert("tSPME", "");
             flight_data.insert("tMP", "");
         } else if ((acft_data.value("multipilot") == 0
                     && acft.getData().value("multiengine") == 1)) {
-            DEB("SPME");
+            DEB "SPME";
             flight_data.insert("tSPME", flight_data.value("tblk"));
             flight_data.insert("tSPSE", "");
             flight_data.insert("tMP", "");
         } else if ((acft_data.value("multipilot") == 1)) {
-            DEB("MPME");
+            DEB "MPME";
             flight_data.insert("tMP", flight_data.value("tblk"));
             flight_data.insert("tSPSE", "");
             flight_data.insert("tSPME", "");
@@ -314,10 +314,10 @@ void ACalc::updateNightTimes()
     auto flight_list = aDB()->customQuery(statement, 1);
 
     if (flight_list.isEmpty()) {
-        DEB("No flights found.");
+        DEB "No flights found.";
         return;
     }
-    DEB("Updating " << flight_list.length() << " flights in the database.");
+    DEB "Updating " << flight_list.length() << " flights in the database.";
 
     for (const auto& item : flight_list) {
 

+ 2 - 2
src/functions/astat.cpp

@@ -55,8 +55,8 @@ QString AStat::totalTime(yearType year_type)
     QSqlQuery query(statement);
 
     if (!query.first()) {
-        DEB("No result found. Check Query and Error.");
-        DEB("Error: " << query.lastError().text());
+        DEB "No result found. Check Query and Error.";
+        DEB "Error: " << query.lastError().text();
         return "00:00";
     } else {
         query.previous();

+ 3 - 3
src/gui/dialogues/firstrundialog.cpp

@@ -124,7 +124,7 @@ bool FirstRunDialog::finishSetup()
 
     //check if template dir exists and create if needed.
     QDir dir("data/templates");
-    DEB(dir.path());
+    DEB dir.path();
     if (!dir.exists())
         dir.mkpath(".");
 
@@ -158,9 +158,9 @@ bool FirstRunDialog::finishSetup()
     auto oldDatabase = QFile("data/logbook.db");
     if (oldDatabase.exists()) {
         auto dateString = QDateTime::currentDateTime().toString(Qt::ISODate);
-        DEB("Backing up old database as: " << "logbook-backup-" + dateString);
+        DEB "Backing up old database as: " << "logbook-backup-" + dateString;
         if (!oldDatabase.rename("data/logbook-backup-" + dateString)) {
-            DEB("Warning: Creating backup of old database has failed.");
+            DEB "Warning: Creating backup of old database has failed.";
         }
     }
     // re-connect and create new database

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

@@ -31,7 +31,7 @@ void NewFlightDialog::onInputRejected()
 {
     auto sender_object = sender();
     auto line_edit = this->findChild<QLineEdit*>(sender_object->objectName());
-    DEB(line_edit->objectName() << "Input Rejected - " << line_edit->text());
+    DEB line_edit->objectName() << "Input Rejected - " << line_edit->text();
 }
 /////////////////////////////////////// DEBUG /////////////////////////////////////////////////////
 
@@ -158,7 +158,7 @@ void NewFlightDialog::setup()
 }
 void NewFlightDialog::readSettings()
 {
-    DEB("Reading Settings...");
+    DEB "Reading Settings...";
     QSettings settings;
     ui->FunctionComboBox->setCurrentText(ASettings::read("flightlogging/function").toString());
     ui->ApproachComboBox->setCurrentText(ASettings::read("flightlogging/approach").toString());
@@ -185,7 +185,7 @@ void NewFlightDialog::readSettings()
 
 void NewFlightDialog::writeSettings()
 {
-    DEB("Writing Settings...");
+    DEB "Writing Settings...";
 
     ASettings::write("flightlogging/function", ui->FunctionComboBox->currentText());
     ASettings::write("flightlogging/approach", ui->ApproachComboBox->currentText());
@@ -241,7 +241,7 @@ void NewFlightDialog::setupRawInputValidation()
     for (const auto &item : line_edit_settings) {
         for (const auto &line_edit : line_edits) {
             if(line_edit->objectName().contains(std::get<0>(item))) {
-                DEB("Setting up: " << line_edit->objectName());
+                DEB "Setting up: " << line_edit->objectName();
                 // Set Validator
                 auto validator = new QRegularExpressionValidator(std::get<2>(item), line_edit);
                 line_edit->setValidator(validator);
@@ -321,7 +321,7 @@ void NewFlightDialog::setPopUpCalendarEnabled(bool state)
     ui->flightDataTabWidget->removeTab(2); // hide calendar widget
 
     if (state) {
-        DEB("Enabling pop-up calendar widget...");
+        DEB "Enabling pop-up calendar widget...";
         ui->calendarWidget->installEventFilter(this);
         ui->placeLabel1->installEventFilter(this);
         ui->doftLineEdit->installEventFilter(this);
@@ -331,7 +331,7 @@ void NewFlightDialog::setPopUpCalendarEnabled(bool state)
         QObject::connect(ui->calendarWidget, &QCalendarWidget::activated,
                          this, &NewFlightDialog::onCalendarWidget_selected);
     } else {
-        DEB("Disabling pop-up calendar widget...");
+        DEB "Disabling pop-up calendar widget...";
         ui->calendarWidget->removeEventFilter(this);
         ui->placeLabel1->removeEventFilter(this);
         ui->doftLineEdit->removeEventFilter(this);
@@ -353,7 +353,7 @@ bool NewFlightDialog::eventFilter(QObject* object, QEvent* event)
     if (line_edit != nullptr) {
         if (mandatoryLineEdits.contains(line_edit) && event->type() == QEvent::FocusIn) {
             mandatoryLineEditsGood.setBit(mandatoryLineEdits.indexOf(line_edit), false);
-            DEB("Editing " << line_edit->objectName());
+            DEB "Editing " << line_edit->objectName();
             // set verification bit to false when entering a mandatory line edit
             return false;
         }
@@ -361,7 +361,7 @@ bool NewFlightDialog::eventFilter(QObject* object, QEvent* event)
             // show completion menu when pressing down arrow
             QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
             if (keyEvent->key() == Qt::Key_Down) {
-                DEB("Key down event.");
+                DEB "Key down event.";
                 line_edit->completer()->complete();
             }
             return false;
@@ -370,7 +370,7 @@ bool NewFlightDialog::eventFilter(QObject* object, QEvent* event)
             // show completion menu when pressing down arrow
             QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
             if (keyEvent->key() == Qt::Key_Down) {
-                DEB("Key down event.");
+                DEB "Key down event.";
                 line_edit->completer()->complete();
             }
             return false;
@@ -408,7 +408,7 @@ void NewFlightDialog::fillDeductibleData()
     // get acft data and fill deductible entries
     auto acft = aDB()->getTailEntry(tailsIdMap.value(ui->acftLineEdit->text()));
     if (acft.getData().isEmpty())
-        DEB("Error: No valid aircraft object available, unable to deterime auto times.");
+        DEB "Error: No valid aircraft object available, unable to deterime auto times.";
 
 
     // SP SE
@@ -488,7 +488,7 @@ void NewFlightDialog::fillDeductibleData()
 RowData NewFlightDialog::collectInput()
 {
     RowData newData;
-    DEB("Collecting Input...");
+    DEB "Collecting Input...";
     // Mandatory data
     newData.insert(DB_FLIGHTS_DOFT, ui->doftLineEdit->text());
     newData.insert(DB_FLIGHTS_DEPT, ui->deptLocLineEdit->text());
@@ -628,14 +628,14 @@ RowData NewFlightDialog::collectInput()
     newData.insert(DB_FLIGHTS_FLIGHTNUMBER, ui->FlightNumberLineEdit->text());
     newData.insert(DB_FLIGHTS_REMARKS, ui->RemarksLineEdit->text());
 
-    DEB("New Flight Data: " << newData);
+    DEB "New Flight Data: " << newData;
 
     return newData;
 }
 
 void NewFlightDialog::formFiller()
 {
-    DEB("Filling Line Edits...");
+    DEB "Filling Line Edits...";
     // get Line Edits
     auto line_edits = this->findChildren<QLineEdit *>();
     QStringList line_edits_names;
@@ -650,7 +650,7 @@ void NewFlightDialog::formFiller()
         auto rx = QRegularExpression(data_key + "LineEdit");//acftLineEdit
         for(const auto& leName : line_edits_names){
             if(rx.match(leName).hasMatch())  {
-                //DEB("Loc Match found: " << key << " - " << leName);
+                //DEB "Loc Match found: " << key << " - " << leName);
                 auto line_edit = this->findChild<QLineEdit *>(leName);
                 if(line_edit != nullptr){
                     line_edit->setText(flightEntry.getData().value(data_key).toString());
@@ -662,7 +662,7 @@ void NewFlightDialog::formFiller()
         rx = QRegularExpression(data_key + "Loc\\w+?");
         for(const auto& leName : line_edits_names){
             if(rx.match(leName).hasMatch())  {
-                //DEB("Loc Match found: " << key << " - " << leName);
+                //DEB "Loc Match found: " << key << " - " << leName);
                 auto line_edit = this->findChild<QLineEdit *>(leName);
                 if(line_edit != nullptr){
                     line_edit->setText(flightEntry.getData().value(data_key).toString());
@@ -674,10 +674,10 @@ void NewFlightDialog::formFiller()
         rx = QRegularExpression(data_key + "Time\\w+?");
         for(const auto& leName : line_edits_names){
             if(rx.match(leName).hasMatch())  {
-                //DEB("Time Match found: " << key << " - " << leName);
+                //DEB "Time Match found: " << key << " - " << leName);
                 auto line_edits = this->findChild<QLineEdit *>(leName);
                 if(line_edits != nullptr){
-                    DEB("Setting " << line_edits->objectName() << " to " << ACalc::minutesToString(flightEntry.getData().value(data_key).toInt()));
+                    DEB "Setting " << line_edits->objectName() << " to " << ACalc::minutesToString(flightEntry.getData().value(data_key).toInt());
                     line_edits->setText(ACalc::minutesToString(
                                             flightEntry.getData().value(data_key).toInt()));
                     line_edits_names.removeOne(leName);
@@ -690,7 +690,7 @@ void NewFlightDialog::formFiller()
             if(rx.match(leName).hasMatch())  {
                 auto line_edits = this->findChild<QLineEdit *>(leName);
                 if(line_edits != nullptr){
-                    DEB(pilotsIdMap.key(1));
+                    DEB pilotsIdMap.key(1);
                     line_edits->setText(pilotsIdMap.key(flightEntry.getData().value(data_key).toInt()));
                     line_edits_names.removeOne(leName);
                 }
@@ -801,7 +801,7 @@ void NewFlightDialog::addNewTail(QLineEdit *parent_line_edit)
                                   "add the registration to the database first.<br><br>Would you like to add a new aircraft to the database?",
                                   QMessageBox::Yes|QMessageBox::No);
     if (reply == QMessageBox::Yes) {
-        DEB("Add new aircraft selected");
+        DEB "Add new aircraft selected";
         // create and open new aircraft dialog
         auto na = NewTailDialog(ui->acftLineEdit->text(), this);
         na.exec();
@@ -809,8 +809,8 @@ void NewFlightDialog::addNewTail(QLineEdit *parent_line_edit)
         tailsIdMap  = aDB()->getIdMap(ADatabaseTarget::tails);
         tailsList   = aDB()->getCompletionList(ADatabaseTarget::registrations);
 
-        DEB("New Entry added. Id:" << aDB()->getLastEntry(ADatabaseTarget::tails));
-        DEB("AC Map: " << tailsIdMap);
+        DEB "New Entry added. Id:" << aDB()->getLastEntry(ADatabaseTarget::tails);
+        DEB "AC Map: " << tailsIdMap;
 
         parent_line_edit->setText(tailsIdMap.key(aDB()->getLastEntry(ADatabaseTarget::tails)));
         emit parent_line_edit->editingFinished();
@@ -833,14 +833,14 @@ void NewFlightDialog::addNewPilot(QLineEdit *parent_line_edit)
                                   "add the name to the database first.<br><br>Would you like to add a new pilot to the database?",
                                   QMessageBox::Yes|QMessageBox::No);
     if (reply == QMessageBox::Yes) {
-        DEB("Add new pilot selected");
+        DEB "Add new pilot selected";
         // create and open new pilot dialog
         auto np = NewPilotDialog(this);
         np.exec();
         // update map and list, set line edit
         pilotsIdMap  = aDB()->getIdMap(ADatabaseTarget::pilots);
         pilotList    = aDB()->getCompletionList(ADatabaseTarget::pilots);
-        DEB("Setting new entry: " << pilotsIdMap.key(aDB()->getLastEntry(ADatabaseTarget::pilots)));
+        DEB "Setting new entry: " << pilotsIdMap.key(aDB()->getLastEntry(ADatabaseTarget::pilots));
         parent_line_edit->setText(pilotsIdMap.key(aDB()->getLastEntry(ADatabaseTarget::pilots)));
         emit parent_line_edit->editingFinished();
     } else {
@@ -854,7 +854,7 @@ void NewFlightDialog::addNewPilot(QLineEdit *parent_line_edit)
 
 void NewFlightDialog::on_cancelButton_clicked()
 {
-    DEB("Cancel Button clicked.");
+    DEB "Cancel Button clicked.";
     reject();
 }
 
@@ -863,7 +863,7 @@ void NewFlightDialog::on_submitButton_clicked()
     for (const auto &line_edit : mandatoryLineEdits) {
         emit line_edit->editingFinished();
     }
-    DEB("editing finished emitted. good count: " << mandatoryLineEditsGood.count(true));
+    DEB "editing finished emitted. good count: " << mandatoryLineEditsGood.count(true);
     if (mandatoryLineEditsGood.count(true) != 7) {
         QString error_message = "Not all mandatory entries are valid.<br>The following"
                                 " item(s) are empty or missing:<br><br><center><b>";
@@ -881,11 +881,11 @@ void NewFlightDialog::on_submitButton_clicked()
         return;
     }
 
-    DEB("Submit Button clicked. Mandatory good (out of 7): " << mandatoryLineEditsGood.count(true));
+    DEB "Submit Button clicked. Mandatory good (out of 7): " << mandatoryLineEditsGood.count(true);
     auto newData = collectInput();
-    DEB("Setting Data for flightEntry...");
+    DEB "Setting Data for flightEntry...";
     flightEntry.setData(newData);
-    DEB("Committing...");
+    DEB "Committing...";
     if (!aDB()->commit(flightEntry)) {
         auto message_box = QMessageBox(this);
         message_box.setText("The following error has ocurred:\n\n"
@@ -907,7 +907,7 @@ void NewFlightDialog::on_submitButton_clicked()
 
 void NewFlightDialog::onGoodInputReceived(QLineEdit *line_edit)
 {
-    DEB(line_edit->objectName() << " - Good input received - " << line_edit->text());
+    DEB line_edit->objectName() << " - Good input received - " << line_edit->text();
     line_edit->setStyleSheet("");
 
     if (mandatoryLineEdits.contains(line_edit))
@@ -916,18 +916,18 @@ void NewFlightDialog::onGoodInputReceived(QLineEdit *line_edit)
     if (mandatoryLineEditsGood.count(true) == 7)
         onMandatoryLineEditsFilled();
 
-    DEB("Mandatory good: " << mandatoryLineEditsGood.count(true)
-        << " (out of 7) " << mandatoryLineEditsGood);
+    DEB "Mandatory good: " << mandatoryLineEditsGood.count(true)
+        << " (out of 7) " << mandatoryLineEditsGood;
 
 }
 
 void NewFlightDialog::onBadInputReceived(QLineEdit *line_edit)
 {
-    DEB(line_edit->objectName() << " - Bad input received - " << line_edit->text());
+    DEB line_edit->objectName() << " - Bad input received - " << line_edit->text();
     line_edit->setStyleSheet("border: 1px solid red");
 
-    DEB("Mandatory Good: " << mandatoryLineEditsGood.count(true) << " out of "
-        << mandatoryLineEditsGood.size() << ". Array: " << mandatoryLineEditsGood);
+    DEB "Mandatory Good: " << mandatoryLineEditsGood.count(true) << " out of "
+        << mandatoryLineEditsGood.size() << ". Array: " << mandatoryLineEditsGood;
     ui->submissonReadyLabel->setText("INCOMPLETE");
     ui->submissonReadyLabel->setStyleSheet("color: rgb(237, 212, 0);");
 }
@@ -937,7 +937,7 @@ void NewFlightDialog::onToUpperTriggered_textChanged(const QString &text)
 {
     auto sender_object = sender();
     auto line_edit = this->findChild<QLineEdit*>(sender_object->objectName());
-    DEB("Text changed - " << line_edit->objectName() << line_edit->text());
+    DEB "Text changed - " << line_edit->objectName() << line_edit->text();
     {
         const QSignalBlocker blocker(line_edit);
         line_edit->setText(text.toUpper());
@@ -948,13 +948,13 @@ void NewFlightDialog::onToUpperTriggered_textChanged(const QString &text)
 void NewFlightDialog::onMandatoryLineEditsFilled()
 {
     if (!(mandatoryLineEditsGood.count(true) == 7)) {
-        DEB("erroneously called.");
+        DEB "erroneously called.";
         return;
     };
 
     if (updateEnabled)
         fillDeductibleData();
-    DEB(mandatoryLineEditsGood);
+    DEB mandatoryLineEditsGood;
 }
 
 // make sure that when using keyboard to scroll through completer sugggestions, line edit is up to date
@@ -962,7 +962,7 @@ void NewFlightDialog::onCompleter_highlighted(const QString &completion)
 {
     auto sender_object = sender();
     auto line_edit = this->findChild<QLineEdit*>(sender_object->objectName());
-    DEB("Completer highlighted - " << line_edit->objectName() << completion);
+    DEB "Completer highlighted - " << line_edit->objectName() << completion;
     line_edit->setText(completion);
 }
 
@@ -970,7 +970,7 @@ void NewFlightDialog::onCompleter_activated(const QString &)
 {
     auto sender_object = sender();
     auto line_edit = this->findChild<QLineEdit*>(sender_object->objectName());
-    DEB("Line edit " << line_edit->objectName() << "completer activated.");
+    DEB "Line edit " << line_edit->objectName() << "completer activated.";
     emit line_edit->editingFinished();
 }
 
@@ -983,7 +983,7 @@ void NewFlightDialog::on_doftLineEdit_editingFinished()
     auto line_edit = ui->doftLineEdit;
     auto text = ui->doftLineEdit->text();
     auto label = ui->doftDisplayLabel;
-    DEB(line_edit->objectName() << "Editing finished - " << text);
+    DEB line_edit->objectName() << "Editing finished - " << text;
 
     auto date = QDate::fromString(text, Qt::ISODate);
     if (date.isValid()) {
@@ -994,7 +994,7 @@ void NewFlightDialog::on_doftLineEdit_editingFinished()
 
     //try to correct input if only numbers are entered, eg 20200101
     if(text.length() == 8) {
-        DEB("Trying to fix input...");
+        DEB "Trying to fix input...";
         text.insert(4,'-');
         text.insert(7,'-');
         date = QDate::fromString(text, Qt::ISODate);
@@ -1064,7 +1064,7 @@ void NewFlightDialog::onDoftLineEdit_entered()
 void NewFlightDialog::on_calendarCheckBox_stateChanged(int arg1)
 {
     ASettings::write("NewFlight/calendarCheckBox", ui->calendarCheckBox->isChecked());
-    DEB("Calendar check box state changed.");
+    DEB "Calendar check box state changed.";
     switch (arg1) {
     case 0: // unchecked
         setPopUpCalendarEnabled(false);
@@ -1094,7 +1094,7 @@ void NewFlightDialog::on_destLocLineEdit_editingFinished()
 void NewFlightDialog::onLocationEditingFinished(QLineEdit *line_edit, QLabel *name_label)
 {
     const auto &text = line_edit->text();
-    //DEB(line_edit->objectName() << " Editing finished. " << text);
+    //DEB line_edit->objectName() << " Editing finished. " << text);
     int airport_id = 0;
 
     // try to map iata or icao code to airport id;
@@ -1123,7 +1123,7 @@ void NewFlightDialog::onTimeLineEdit_editingFinished()
 {
     auto sender_object = sender();
     auto line_edit = this->findChild<QLineEdit*>(sender_object->objectName());
-    DEB(line_edit->objectName() << "Editing Finished -" << line_edit->text());
+    DEB line_edit->objectName() << "Editing Finished -" << line_edit->text();
 
     line_edit->setText(ACalc::formatTimeInput(line_edit->text()));
     const auto time = QTime::fromString(line_edit->text(),TIME_FORMAT);
@@ -1149,10 +1149,10 @@ void NewFlightDialog::onTimeLineEdit_editingFinished()
 void NewFlightDialog::on_acftLineEdit_editingFinished()
 {
     auto line_edit = ui->acftLineEdit;
-    //DEB(line_edit->objectName() << "Editing Finished!" << line_edit->text());
+    //DEB line_edit->objectName() << "Editing Finished!" << line_edit->text());
 
     if (tailsIdMap.value(line_edit->text()) != 0) {
-        DEB("Mapped: " << line_edit->text() << tailsIdMap.value(line_edit->text()));
+        DEB "Mapped: " << line_edit->text() << tailsIdMap.value(line_edit->text());
         auto acft = aDB()->getTailEntry(tailsIdMap.value(line_edit->text()));
         ui->acftTypeLabel->setText(acft.type());
         onGoodInputReceived(line_edit);
@@ -1162,7 +1162,7 @@ void NewFlightDialog::on_acftLineEdit_editingFinished()
     // try to fix input
     if (!line_edit->completer()->currentCompletion().isEmpty()
             && !line_edit->text().isEmpty()) {
-        DEB("Trying to fix input...");
+        DEB "Trying to fix input...";
         line_edit->setText(line_edit->completer()->currentCompletion());
         emit line_edit->editingFinished();
         return;
@@ -1182,10 +1182,10 @@ void NewFlightDialog::onPilotNameLineEdit_editingFinished()
 {
     auto sender_object = sender();
     auto line_edit = this->findChild<QLineEdit*>(sender_object->objectName());
-    //DEB(line_edit->objectName() << "Editing Finished -" << line_edit->text());
+    //DEB line_edit->objectName() << "Editing Finished -" << line_edit->text());
 
     if(line_edit->text().contains(SELF_RX)) {
-        DEB("self recognized.");
+        DEB "self recognized.";
         line_edit->setText(pilotsIdMap.key(1));
         auto pilot = aDB()->getPilotEntry(1);
         ui->picCompanyLabel->setText(pilot.getData().value(DB_TAILS_COMPANY).toString());
@@ -1194,7 +1194,7 @@ void NewFlightDialog::onPilotNameLineEdit_editingFinished()
     }
 
     if(pilotsIdMap.value(line_edit->text()) != 0) {
-        DEB("Mapped: " << line_edit->text() << pilotsIdMap.value(line_edit->text()));
+        DEB "Mapped: " << line_edit->text() << pilotsIdMap.value(line_edit->text());
         auto pilot = aDB()->getPilotEntry(pilotsIdMap.value(line_edit->text()));
         ui->picCompanyLabel->setText(pilot.getData().value(DB_TAILS_COMPANY).toString());
         onGoodInputReceived(line_edit);
@@ -1206,7 +1206,7 @@ void NewFlightDialog::onPilotNameLineEdit_editingFinished()
     }
 
     if (!line_edit->completer()->currentCompletion().isEmpty()) {
-        DEB("Trying to fix input...");
+        DEB "Trying to fix input...";
         line_edit->setText(line_edit->completer()->currentCompletion());
         emit line_edit->editingFinished();
         return;
@@ -1233,7 +1233,7 @@ void NewFlightDialog::on_restoreDefaultButton_clicked()
 
 void NewFlightDialog::on_PilotFlyingCheckBox_stateChanged(int)
 {
-    DEB("PF checkbox state changed.");
+    DEB "PF checkbox state changed.";
     if(ui->PilotFlyingCheckBox->isChecked()){
         ui->TakeoffSpinBox->setValue(1);
         ui->TakeoffCheckBox->setCheckState(Qt::Checked);

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

@@ -67,7 +67,7 @@ NewPilotDialog::NewPilotDialog(QWidget *parent) :
     QDialog(parent),
     ui(new Ui::NewPilot)
 {
-    DEB("New NewPilotDialog (newEntry)");
+    DEB "New NewPilotDialog (newEntry)";
     setup();
 
     pilotEntry = APilotEntry();
@@ -78,18 +78,18 @@ NewPilotDialog::NewPilotDialog(int rowId, QWidget *parent) :
     QDialog(parent),
     ui(new Ui::NewPilot)
 {
-    DEB("New NewPilotDialog (editEntry)");
+    DEB "New NewPilotDialog (editEntry)";
     setup();
 
     pilotEntry = aDB()->getPilotEntry(rowId);
-    DEB("Pilot Entry position: " << pilotEntry.getPosition());
+    DEB "Pilot Entry position: " << pilotEntry.getPosition();
     formFiller();
     ui->lastnameLineEdit->setFocus();
 }
 
 NewPilotDialog::~NewPilotDialog()
 {
-    DEB("Deleting New NewPilotDialog");
+    DEB "Deleting New NewPilotDialog";
     delete ui;
 }
 
@@ -97,18 +97,18 @@ void NewPilotDialog::setup()
 {
     ui->setupUi(this);
 
-    DEB("Setting up Validators...");
+    DEB "Setting up Validators...";
     for (const auto& pair : LINE_EDIT_VALIDATORS) {
         auto line_edit = parent()->findChild<QLineEdit*>(pair.first);
         if (line_edit != nullptr) {
             auto validator = new QRegularExpressionValidator(pair.second,line_edit);
             line_edit->setValidator(validator);
         } else {
-            DEB("Error: Line Edit not found: "<< pair.first << " - skipping.");
+            DEB "Error: Line Edit not found: "<< pair.first << " - skipping.";
         }
     }
 
-    DEB("Setting up completer...");
+    DEB "Setting up completer...";
     auto completer = new QCompleter(aDB()->getCompletionList(ADatabaseTarget::companies), ui->companyLineEdit);
     completer->setCompletionMode(QCompleter::InlineCompletion);
     completer->setCaseSensitivity(Qt::CaseSensitive);
@@ -128,7 +128,7 @@ void NewPilotDialog::on_buttonBox_accepted()
 
 void NewPilotDialog::formFiller()
 {
-    DEB("Filling Form...");
+    DEB "Filling Form...";
     auto line_edits = this->findChildren<QLineEdit *>();
 
     for (const auto &le : line_edits) {
@@ -139,7 +139,7 @@ void NewPilotDialog::formFiller()
 
 void NewPilotDialog::submitForm()
 {
-    DEB("Collecting User Input...");
+    DEB "Collecting User Input...";
 
     RowData new_data;
     auto line_edits = this->findChildren<QLineEdit *>();
@@ -150,8 +150,8 @@ void NewPilotDialog::submitForm()
     }
 
     pilotEntry.setData(new_data);
-    DEB("Pilot entry position: " << pilotEntry.getPosition());
-    DEB("Pilot entry data: " << pilotEntry.getData());
+    DEB "Pilot entry position: " << pilotEntry.getPosition();
+    DEB "Pilot entry data: " << pilotEntry.getData();
     if (!aDB()->commit(pilotEntry)) {
         auto message_box = QMessageBox(this);
         message_box.setText("The following error has ocurred:\n\n"

+ 12 - 12
src/gui/dialogues/newtaildialog.cpp

@@ -34,7 +34,7 @@ NewTailDialog::NewTailDialog(QString new_registration, QWidget *parent) :
     QDialog(parent),
     ui(new Ui::NewTail)
 {
-    DEB("new NewTailDialog");
+    DEB "new NewTailDialog";
     ui->setupUi(this);
 
     setupCompleter();
@@ -51,7 +51,7 @@ NewTailDialog::NewTailDialog(int row_id, QWidget *parent) :
     QDialog(parent),
     ui(new Ui::NewTail)
 {
-    DEB("New New Pilot Dialog (edit existing)");
+    DEB "New New Pilot Dialog (edit existing)";
     ui->setupUi(this);
 
     ui->searchLabel->hide();
@@ -65,7 +65,7 @@ NewTailDialog::NewTailDialog(int row_id, QWidget *parent) :
 
 NewTailDialog::~NewTailDialog()
 {
-    DEB("Deleting NewTailDialog\n");
+    DEB "Deleting NewTailDialog\n";
     delete ui;
 }
 /// Functions
@@ -113,7 +113,7 @@ void NewTailDialog::setupValidators()
  */
 void NewTailDialog::fillForm(AEntry entry, bool is_template)
 {
-    DEB("Filling Form for a/c" << entry.getPosition());
+    DEB "Filling Form for a/c" << entry.getPosition();
     //fill Line Edits
     auto line_edits = this->findChildren<QLineEdit *>();
 
@@ -149,12 +149,12 @@ bool NewTailDialog::verify()
 
     for (const auto &le : recommended_line_edits) {
         if (le->text() != "") {
-            DEB("Good: " << le);
+            DEB "Good: " << le;
             recommended_line_edits.removeOne(le);
             le->setStyleSheet("");
         } else {
             le->setStyleSheet("border: 1px solid red");
-            DEB("Not Good: " << le);
+            DEB "Not Good: " << le;
         }
     }
     for (const auto &cb : recommended_combo_boxes) {
@@ -164,7 +164,7 @@ bool NewTailDialog::verify()
             cb->setStyleSheet("");
         } else {
             cb->setStyleSheet("background: orange");
-            DEB("Not Good: " << cb);
+            DEB "Not Good: " << cb;
         }
     }
 
@@ -181,7 +181,7 @@ bool NewTailDialog::verify()
  */
 void NewTailDialog::submitForm()
 {
-    DEB("Creating Database Object...");
+    DEB "Creating Database Object...";
     RowData new_data;
     //retreive Line Edits
     auto line_edits = this->findChildren<QLineEdit *>();
@@ -254,7 +254,7 @@ void NewTailDialog::on_weightComboBox_currentIndexChanged(int index)
 
 void NewTailDialog::on_buttonBox_accepted()
 {
-    DEB("Button Box Accepted.");
+    DEB "Button Box Accepted.";
     if (ui->registrationLineEdit->text().isEmpty()) {
         auto nope = QMessageBox(this);
         nope.setText("Registration cannot be empty.");
@@ -285,17 +285,17 @@ void NewTailDialog::on_buttonBox_accepted()
             }
         }
     }
-    DEB("Form verified");
+    DEB "Form verified";
     submitForm();
 }
 
 void NewTailDialog::onSearchCompleterActivated()
 {
-    DEB("Search completer activated!");
+    DEB "Search completer activated!";
     const auto &text = ui->searchLineEdit->text();
     if (aircraftList.contains(text)) {
 
-            DEB("Template Selected. aircraft_id is: " << idMap.value(text));
+            DEB "Template Selected. aircraft_id is: " << idMap.value(text);
             //call autofiller for dialog
             fillForm(aDB()->getAircraftEntry(idMap.value(text)), true);
             ui->searchLineEdit->setStyleSheet("border: 1px solid green");

+ 4 - 4
src/gui/widgets/aircraftwidget.cpp

@@ -28,7 +28,7 @@ AircraftWidget::AircraftWidget(QWidget *parent) :
     QWidget(parent),
     ui(new Ui::AircraftWidget)
 {
-    DEB("New AircraftWidet");
+    DEB "New AircraftWidet";
     ui->setupUi(this);
     ui->stackedWidget->addWidget(this->findChild<QWidget*>("welcomePageTails"));
     ui->stackedWidget->setCurrentWidget(this->findChild<QWidget*>("welcomePageTails"));
@@ -38,7 +38,7 @@ AircraftWidget::AircraftWidget(QWidget *parent) :
 
 AircraftWidget::~AircraftWidget()
 {
-    DEB("Deleting NewAircraftWidget");
+    DEB "Deleting NewAircraftWidget";
     delete ui;
 }
 
@@ -167,7 +167,7 @@ void AircraftWidget::onDisplayModel_dataBaseUpdated()
 void AircraftWidget::tableView_selectionChanged()
 {
     if (this->findChild<NewTailDialog*>() != nullptr) {
-        DEB("Selection changed. Deleting orphaned dialog.");
+        DEB "Selection changed. Deleting orphaned dialog.";
         delete this->findChild<NewTailDialog*>();
         /// [F] if the user changes the selection without making any changes,
         /// if(selectedTails.length() == 1) spawns a new dialog without the
@@ -180,7 +180,7 @@ void AircraftWidget::tableView_selectionChanged()
 
     for (const auto& row : selection->selectedRows()) {
         selectedTails << row.data().toInt();
-        DEB("Selected Tails(s) with ID: " << selectedTails);
+        DEB "Selected Tails(s) with ID: " << selectedTails;
     }
     if(selectedTails.length() == 1) {
         auto* nt = new NewTailDialog(selectedTails.first(), this);

+ 8 - 8
src/gui/widgets/debugwidget.cpp

@@ -39,7 +39,7 @@ void DebugWidget::on_resetDatabasePushButton_clicked()
     QMessageBox mb(this);
     //check if template dir exists and create if needed.
     QDir dir("data/templates");
-    DEB(dir.path());
+    DEB dir.path();
     if (!dir.exists())
         dir.mkpath(".");
     // download latest csv
@@ -65,10 +65,10 @@ void DebugWidget::on_resetDatabasePushButton_clicked()
     auto oldDatabase = QFile("data/logbook.db");
     if (oldDatabase.exists()) {
         auto dateString = QDateTime::currentDateTime().toString(Qt::ISODate);
-        DEB("Backing up old database as: " << "logbook-backup-" + dateString + ".db");
+        DEB "Backing up old database as: " << "logbook-backup-" + dateString + ".db";
         if (oldDatabase.copy("data/logbook-backup-" + dateString + ".db")) {
             oldDatabase.remove();
-            DEB("Old Database removed.");
+            DEB "Old Database removed.";
         }
 
     }
@@ -96,7 +96,7 @@ void DebugWidget::on_fillUserDataPushButton_clicked()
     QMessageBox mb(this);
     //check if template dir exists and create if needed.
     QDir dir("data/templates");
-    DEB(dir.path());
+    DEB dir.path();
     if (!dir.exists())
         dir.mkpath(".");
     // download latest csv
@@ -146,7 +146,7 @@ void DebugWidget::on_importCsvPushButton_clicked()
 {
     ATimer timer(this);
     auto file = QFileInfo(ui->importCsvLineEdit->text());
-    DEB("File exists/is file: " << file.exists() << file.isFile() << " Path: " << file.absoluteFilePath());
+    DEB "File exists/is file: " << file.exists() << file.isFile() << " Path: " << file.absoluteFilePath();
 
     if (file.exists() && file.isFile()) {
 
@@ -192,8 +192,8 @@ void DebugWidget::on_debugPushButton_clicked()
         time2 = timer.timeNow();
     }
 
-    DEB("First block executed " << number_of_runs << " times for a total of " << time1 << " milliseconds.");
-    DEB("Second block executed " << number_of_runs << " times for a total of " << time2 << " milliseconds.");
+    DEB "First block executed " << number_of_runs << " times for a total of " << time1 << " milliseconds.");
+    DEB "Second block executed " << number_of_runs << " times for a total of " << time2 << " milliseconds.");
 */
 
 
@@ -220,7 +220,7 @@ void DebugWidget::on_debugPushButton_clicked()
             time1 = timer.timeNow();
         }
 
-        DEB("First block executed " << number_of_runs << " times for a total of " << time1 << " milliseconds.");
+        DEB "First block executed " << number_of_runs << " times for a total of " << time1 << " milliseconds.");
         // 108 - 134 milliseconds with legacy exp db api
         // 108 - 110 milliseconds with improved exp api
         // to do: with string literals*/

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

@@ -84,7 +84,7 @@ void LogbookWidget::connectSignalsAndSlots()
 
 void LogbookWidget::setupDefaultView()
 {
-    DEB("Loading Default View...");
+    DEB "Loading Default View...";
     displayModel = new QSqlTableModel;
     displayModel->setTable("viewDefault");
     displayModel->select();
@@ -117,7 +117,7 @@ void LogbookWidget::setupDefaultView()
 
 void LogbookWidget::setupEasaView()
 {
-    DEB("Loading EASA View...");
+    DEB "Loading EASA View...";
     displayModel = new QSqlTableModel;
     displayModel->setTable("viewEASA");
     displayModel->select();
@@ -168,7 +168,7 @@ void LogbookWidget::flightsTableView_selectionChanged()//
     selectedFlights.clear();
     for (const auto& row : selectionModel->selectedRows()) {
         selectedFlights.append(row.data().toInt());
-        DEB("Selected Flight(s) with ID: " << selectedFlights);
+        DEB "Selected Flight(s) with ID: " << selectedFlights;
     }
 }
 
@@ -198,7 +198,7 @@ void LogbookWidget::on_editFlightButton_clicked()
 
 void LogbookWidget::on_deleteFlightPushButton_clicked()
 {
-    DEB("Flights selected: " << selectedFlights.length());
+    DEB "Flights selected: " << selectedFlights.length();
     if (selectedFlights.length() == 0) {
         messageBox->setIcon(QMessageBox::Information);
         messageBox->setText("No Flight Selected.");
@@ -229,7 +229,7 @@ void LogbookWidget::on_deleteFlightPushButton_clicked()
         int reply = confirm.exec();
         if (reply == QMessageBox::Yes) {
             for (auto& flight : flights_list) {
-                DEB("Deleting flight: " << flight.summary());
+                DEB "Deleting flight: " << flight.summary();
                 if(!aDB()->remove(flight)) {
                     messageBox->setText(aDB()->lastError.text());
                     messageBox->exec();

+ 2 - 2
src/gui/widgets/pilotswidget.cpp

@@ -81,7 +81,7 @@ void PilotsWidget::onDisplayModel_dataBaseUpdated()
 void PilotsWidget::tableView_selectionChanged()//const QItemSelection &index, const QItemSelection &
 {
     if (this->findChild<NewPilotDialog*>() != nullptr) {
-        DEB("Selection changed. Deleting orphaned dialog.");
+        DEB "Selection changed. Deleting orphaned dialog.";
         delete this->findChild<NewPilotDialog*>();
         /// [F] if the user changes the selection without making any changes,
         /// if(selectedPilots.length() == 1) spawns a new dialog without the
@@ -95,7 +95,7 @@ void PilotsWidget::tableView_selectionChanged()//const QItemSelection &index, co
 
     for (const auto& row : selection->selectedRows()) {
         selectedPilots.append(row.data().toInt());
-        DEB("Selected Tails(s) with ID: " << selectedPilots);
+        DEB "Selected Tails(s) with ID: " << selectedPilots;
     }
     if(selectedPilots.length() == 1) {
 

+ 2 - 2
src/gui/widgets/settingswidget.cpp

@@ -112,14 +112,14 @@ void SettingsWidget::readSettings()
 
 void SettingsWidget::setupValidators()
 {
-    DEB("Setting up Validators...");
+    DEB "Setting up Validators...";
     for(const auto& pair : LINE_EDIT_VALIDATORS){
         auto line_edit = parent()->findChild<QLineEdit*>(pair.first);
         if(line_edit != nullptr){
             auto validator = new QRegularExpressionValidator(pair.second,line_edit);
             line_edit->setValidator(validator);
         }else{
-            DEB("Error: Line Edit not found: "<< pair.first << " - skipping.");
+            DEB "Error: Line Edit not found: "<< pair.first << " - skipping.";
         }
 
     }

+ 2 - 2
src/gui/widgets/totalswidget.cpp

@@ -8,8 +8,8 @@ TotalsWidget::TotalsWidget(QWidget *parent) :
 {
     ui->setupUi(this);
     auto data = AStat::totals();
-    DEB("Filling Totals Line Edits...");
-    //DEB("data: " << data);
+    DEB "Filling Totals Line Edits...";
+    //DEB "data: " << data;
     for (const auto &field : data) {
         auto line_edit = parent->findChild<QLineEdit *>(field.first + "LineEdit");
         line_edit->setText(field.second);

+ 12 - 12
src/testing/abenchmark.cpp

@@ -29,7 +29,7 @@ ABenchmark::ABenchmark(void (*function_one)(), void (*function_two)(), int numbe
             function_one();
         }
         auto stop1 = std::chrono::high_resolution_clock::now();
-        DEB("First Function execution finished (" << number_of_runs << " runs)");
+        DEB "First Function execution finished (" << number_of_runs << " runs)";
 
 
         auto start2 = std::chrono::high_resolution_clock::now();
@@ -37,14 +37,14 @@ ABenchmark::ABenchmark(void (*function_one)(), void (*function_two)(), int numbe
             function_two();
         }
         auto stop2 = std::chrono::high_resolution_clock::now();
-        DEB("Second Function execution finished (" << number_of_runs << " runs)");
+        DEB "Second Function execution finished (" << number_of_runs << " runs)";
 
-        DEB("Execution time for function 1: "
+        DEB "Execution time for function 1: "
             << std::chrono::duration_cast<std::chrono::milliseconds>(stop1 - start1).count()
-            << "milliseconds.");
-        DEB("Execution time for function 2: "
+            << "milliseconds.";
+        DEB "Execution time for function 2: "
             << std::chrono::duration_cast<std::chrono::milliseconds>(stop2 - start2).count()
-            << "milliseconds.");
+            << "milliseconds.";
 }
 
 ABenchmark::ABenchmark(bool (*function_one)(), bool (*function_two)(), int number_of_runs)
@@ -54,7 +54,7 @@ ABenchmark::ABenchmark(bool (*function_one)(), bool (*function_two)(), int numbe
         function_one();
     }
     auto stop1 = std::chrono::high_resolution_clock::now();
-    DEB("First Function execution finished (" << number_of_runs << " runs)");
+    DEB "First Function execution finished (" << number_of_runs << " runs)";
 
 
     auto start2 = std::chrono::high_resolution_clock::now();
@@ -62,12 +62,12 @@ ABenchmark::ABenchmark(bool (*function_one)(), bool (*function_two)(), int numbe
         function_two();
     }
     auto stop2 = std::chrono::high_resolution_clock::now();
-    DEB("Second Function execution finished (" << number_of_runs << " runs)");
+    DEB "Second Function execution finished (" << number_of_runs << " runs)";
 
-    DEB("Execution time for function 1: "
+    DEB "Execution time for function 1: "
         << std::chrono::duration_cast<std::chrono::milliseconds>(stop1 - start1).count()
-        << "milliseconds.");
-    DEB("Execution time for function 2: "
+        << "milliseconds.";
+    DEB "Execution time for function 2: "
         << std::chrono::duration_cast<std::chrono::milliseconds>(stop2 - start2).count()
-        << "milliseconds.");
+        << "milliseconds.";
 }

+ 1 - 2
src/testing/adebug.h

@@ -3,7 +3,6 @@
 
 #include <QDebug>
 
-#define DEB(expr) \
-    qDebug() << __PRETTY_FUNCTION__ << "\t" << expr
+#define DEB qDebug() << __PRETTY_FUNCTION__ << "\t" <<
 
 #endif

+ 10 - 10
src/testing/atimer.cpp

@@ -22,9 +22,9 @@ ATimer::ATimer(QObject *parent) : QObject(parent)
 {
      start = std::chrono::high_resolution_clock::now();
      if(parent == nullptr) {
-         DEB("Starting Timer... ");
+         DEB "Starting Timer... ";
      } else {
-         DEB("Starting Timer for: " << parent->objectName());
+         DEB "Starting Timer for: " << parent->objectName();
      }
 
 }
@@ -33,13 +33,13 @@ ATimer::~ATimer()
 {
     stop = std::chrono::high_resolution_clock::now();
     if(parent() == nullptr) {
-        DEB("Execution time: "
+        DEB "Execution time: "
                  << std::chrono::duration_cast<std::chrono::milliseconds>(stop - start).count()
-                 << "milliseconds.");
+                 << "milliseconds.";
     } else {
-        DEB("Execution time for: " << parent()->objectName() << ": "
+        DEB "Execution time for: " << parent()->objectName() << ": "
                  << std::chrono::duration_cast<std::chrono::milliseconds>(stop - start).count()
-                 << "milliseconds.");
+                 << "milliseconds.";
     }
 }
 
@@ -47,13 +47,13 @@ long ATimer::timeNow()
 {
     intermediate_point = std::chrono::high_resolution_clock::now();
     if(parent() == nullptr) {
-        DEB("Intermediate time: "
+        DEB "Intermediate time: "
                  << std::chrono::duration_cast<std::chrono::milliseconds>(intermediate_point - start).count()
-                 << "milliseconds.");
+                 << "milliseconds.";
     } else {
-        DEB("Intermediate time for: " << parent()->objectName() << ": "
+        DEB "Intermediate time for: " << parent()->objectName() << ": "
                  << std::chrono::duration_cast<std::chrono::milliseconds>(intermediate_point - start).count()
-                 << "milliseconds.");
+                 << "milliseconds.";
     }
     return std::chrono::duration_cast<std::chrono::milliseconds>(intermediate_point - start).count();
 }