Browse Source

Continue syntax cleanup

Compiles fine now, but found a problem with incompatible openSSL versions, need to investigate further to see where the problem lies.
Seems to be related with https://bugreports.qt.io/browse/QTBUG-68156
Felix 4 years ago
parent
commit
327e9086f9

+ 1 - 0
openPilotLog.pro

@@ -14,6 +14,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
 # In order to do so, uncomment the following line.
 # You can also select to disable deprecated APIs only up to a certain version of Qt.
 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
+QMAKE_CXXFLAGS += -Wno-deprecated-copy # see https://bugreports.qt.io/browse/QTBUG-75210
 
 # [G]: need to fix this. There must be a src/* command or smth
 SOURCES += \

+ 4 - 4
src/database/adatabase.cpp

@@ -282,8 +282,8 @@ bool ADatabase::update(AEntry updated_entry)
     QSqlQuery query;
     query.prepare(statement);
     for (auto i = data.constBegin(); i != data.constEnd(); ++i) {
-        if (i.value() == QVariant(QVariant::String)) {
-            query.addBindValue(QVariant(QVariant::String));
+        if (i.value() == QVariant(QString())) {
+            query.addBindValue(QVariant(QString()));
         } else {
             query.addBindValue(i.value());
         }
@@ -327,8 +327,8 @@ bool ADatabase::insert(AEntry new_entry)
     query.prepare(statement);
 
     for (i = data.begin(); i != data.end(); ++i) {
-        if (i.value() == "") {
-            query.addBindValue(QVariant(QVariant::String));
+        if (i.value() == QVariant(QString())) {
+            query.addBindValue(QVariant(QString()));
         } else {
             query.addBindValue(i.value());
         }

+ 2 - 3
src/database/adatabasesetup.cpp

@@ -416,8 +416,7 @@ bool ADataBaseSetup::createSchemata(const QStringList &statements)
  */
 bool ADataBaseSetup::commitData(QVector<QStringList> from_csv, const QString &table_name)
 {
-    DEB << "Table names: " << aDB->getTableNames();
-    DEB << "Importing Data to" << table_name;
+    aDB->updateLayout();
     if (!aDB->getTableNames().contains(table_name)){
         DEB << table_name << "is not a table in the database. Aborting.";
         DEB << "Please check input data.";
@@ -452,7 +451,7 @@ bool ADataBaseSetup::commitData(QVector<QStringList> from_csv, const QString &ta
         query.prepare(statement);
         for(int j = 0; j < from_csv.length(); j++) {
              from_csv[j][i] == QString("") ? // make sure NULL is committed for empty values
-                         query.addBindValue(QVariant(QVariant::String))
+                         query.addBindValue(QVariant(QString()))
                        : query.addBindValue(from_csv[j][i]);
              //query.addBindValue(fromCSV[j][i]);
          }

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

@@ -53,7 +53,7 @@ static const auto COMPANY_VALID = QPair<QString, QRegularExpression> {
 static const auto EMPLOYEENR_VALID = QPair<QString, QRegularExpression> {
      "employeeidLineEdit", QRegularExpression("\\w+")};
 
-static const auto LINE_EDIT_VALIDATORS = QVector{
+static const auto LINE_EDIT_VALIDATORS = QVector<QPair<QString, QRegularExpression>> {
         FIRSTNAME_VALID,
         LASTNAME_VALID,
         PHONE_VALID,

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

@@ -27,7 +27,7 @@ static const auto MODEL_VALID = QPair<QString, QRegularExpression> {
     "modelLineEdit", QRegularExpression("[\\s\\w-]+")};
 static const auto VARIANT_VALID = QPair<QString, QRegularExpression> {
     "variantLineEdit", QRegularExpression("[\\s\\w-]+")};
-static const auto LINE_EDIT_VALIDATORS = QVector({REG_VALID, MAKE_VALID, MODEL_VALID, VARIANT_VALID});
+static const auto LINE_EDIT_VALIDATORS = QVector<QPair<QString, QRegularExpression>>({REG_VALID, MAKE_VALID, MODEL_VALID, VARIANT_VALID});
 
 
 NewTailDialog::NewTailDialog(QString new_registration, QWidget *parent) :

+ 10 - 1
src/gui/widgets/debugwidget.cpp

@@ -4,6 +4,7 @@
 #include "src/gui/widgets/logbookwidget.h"
 #include "src/gui/widgets/pilotswidget.h"
 #include "src/gui/widgets/aircraftwidget.h"
+#include <QtGlobal>
 
 DebugWidget::DebugWidget(QWidget *parent) :
     QWidget(parent),
@@ -165,7 +166,15 @@ void DebugWidget::on_importCsvPushButton_clicked()
 
 void DebugWidget::on_debugPushButton_clicked()
 {
-
+#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
+    DEB << "SSL version use for build: " << QSslSocket::sslLibraryBuildVersionString();
+    DEB << "SSL version use for run-time: " << QSslSocket::sslLibraryVersionNumber();
+    DEB << QT_VERSION_MAJOR << QT_VERSION_MINOR << "At least 5.12";
+#else
+    DEB << "SSL version use for build: " << QSslSocket::sslLibraryBuildVersionString();
+    DEB << "SSL version use for run-time: " << QSslSocket::sslLibraryVersionNumber();
+    DEB << QT_VERSION_MAJOR << QT_VERSION_MINOR << "Less than 5.12";
+#endif
 }
 
 /* //Comparing two functions template

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

@@ -42,7 +42,7 @@ static const auto EMPLOYEENR_VALID = QPair<QString, QRegularExpression> {
 static const auto PREFIX_VALID = QPair<QString, QRegularExpression> {
     "prefixLineEdit", QRegularExpression("[a-zA-Z0-9]?[a-zA-Z0-9]?[a-zA-Z0-9]")};
 
-static const auto LINE_EDIT_VALIDATORS = QVector({FIRSTNAME_VALID, LASTNAME_VALID,
+static const auto LINE_EDIT_VALIDATORS = QVector<QPair<QString, QRegularExpression>>({FIRSTNAME_VALID, LASTNAME_VALID,
                                            PHONE_VALID,     EMAIL_VALID,
                                            COMPANY_VALID,     EMPLOYEENR_VALID,
                                            PREFIX_VALID});