浏览代码

renaming of id to flight_id acc. new db revison

fiffty-50 4 年之前
父节点
当前提交
c5962fd21e
共有 3 个文件被更改,包括 13 次插入10 次删除
  1. 2 2
      src/classes/calc.cpp
  2. 9 8
      src/gui/widgets/logbookwidget.cpp
  3. 2 0
      src/gui/widgets/logbookwidget.h

+ 2 - 2
src/classes/calc.cpp

@@ -447,7 +447,7 @@ QString Calc::formatTimeInput(QString userinput)
 void Calc::updateAutoTimes(int acft_id)
 {
     //find all flights for aircraft
-    auto flightList = Db::multiSelect(QVector<QString>{"id"},"flights","acft",
+    auto flightList = Db::multiSelect(QVector<QString>{"flight_id"},"flights","acft",
                                       QString::number(acft_id),Db::exactMatch);
     auto acft = Aircraft(acft_id);
     for (const auto& item : flightList) {
@@ -478,7 +478,7 @@ void Calc::updateAutoTimes(int acft_id)
 void Calc::updateNightTimes()
 {
     const int nightAngle = Settings::read("flightlogging/nightangle").toInt();
-    const QVector<QString> columns = {"id"};
+    const QVector<QString> columns = {"flight_id"};
     auto flights = Db::multiSelect(columns,"flights");
     for (const auto& item : flights) {
         auto flt = new Flight(item.toInt());

+ 9 - 8
src/gui/widgets/logbookwidget.cpp

@@ -160,10 +160,12 @@ void LogbookWidget::on_editFlightButton_clicked()
         NewFlightDialog ef(this,Flight(selectedFlights.first()), Db::editExisting);
         ef.exec();
         refreshView(Settings::read("logbook/view").toInt());
+    } else if (selectedFlights.isEmpty()) {
+        nope->setText("No flight selected.\n");
+        nope->exec();
     } else {
-        QMessageBox nope(this);
-        nope.setText("More than one flight selected.\n\nEditing multiple entries is not yet supported.");
-        nope.exec();
+        nope->setText("More than one flight selected.\n\nEditing multiple entries is not yet supported.");
+        nope->exec();
     }
 }
 
@@ -177,7 +179,7 @@ void LogbookWidget::on_deleteFlightPushButton_clicked()
         QVector<QString> details;
         QString warningMsg = "The following flight(s) will be deleted:<br><br><b><tt>";
         for(const auto& selectedFlight : selectedFlights){
-            details = Db::multiSelect(columns, "flights", "id",
+            details = Db::multiSelect(columns, "flights", "flight_id",
                                        QString::number(selectedFlight), Db::exactMatch);
             for (const auto &item : details) {
                 warningMsg.append(item);
@@ -204,10 +206,9 @@ void LogbookWidget::on_deleteFlightPushButton_clicked()
             refreshView(Settings::read("logbook/view").toInt());
         }
     } else if (selectedFlights.length() == 0) {
-        QMessageBox nope(this);
-        nope.setIcon(QMessageBox::Information);
-        nope.setText("No Flight Selected.");
-        nope.exec();
+        nope->setIcon(QMessageBox::Information);
+        nope->setText("No Flight Selected.");
+        nope->exec();
     } else if (selectedFlights.length() > 10) {
         auto& warningMsg = "You have selected " + QString::number(selectedFlights.length())
                          + " flights.\n\n Deleting these flights is irreversible.\n\n"

+ 2 - 0
src/gui/widgets/logbookwidget.h

@@ -74,6 +74,8 @@ private:
 
     QMenu* menu = new QMenu(this);
 
+    QMessageBox* nope = new QMessageBox(this);
+
     void refreshView(int view_id);
 
     void defaultView();