2
0
Эх сурвалжийг харах

Fixed a bug in firstrun dialog

This still needs some work. Need to find a better way to check for first run or initial set up completed.
Felix 4 жил өмнө
parent
commit
20611fdd07

+ 4 - 0
main.cpp

@@ -40,6 +40,10 @@ bool setup()
     QString   settingsfile = QCoreApplication::applicationName() + QLatin1String(".ini");
     QFileInfo check_file(settingspath,settingsfile);
 
+    QSettings settings;
+    settings.setValue("setup/touch", true);
+    settings.sync();
+
     return check_file.exists() && check_file.isFile();
 };
 

+ 4 - 0
src/experimental/aentry.h

@@ -31,6 +31,10 @@ namespace experimental {
 /// [G]: Define what data is public and what not. For objects such as
 /// DataPosition which are consumable its no biggy. Are entries the same?
 /// If so we could avoid getters and setters
+/// [F]: In the way we are using the entries atm, we do access and edit the
+/// TableData quite frequently. Maybe the data could be public, but the
+/// position private? Except for creating a new entry, the position should
+/// never really be changed.
 /*!
  * \brief The Entry class encapsulates table metadata(table name, row id)
  *  and data for new and existing entries in the database to operate on.

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

@@ -100,13 +100,19 @@ void FirstRunDialog::on_finishButton_clicked()
             QMessageBox message_box(this);
             message_box.setText("Errors have ocurred creating the database. Without a working database The application will not be usable.");
         }
+        ASettings::write("setup/setup_complete", true);
         aDB()->disconnect(); // reset db connection to refresh layout after initial setup.
         aDB()->connect();
         auto pilot = APilotEntry(1);
         pilot.setData(data);
-        aDB()->commit(pilot);
-        qApp->quit();
-        QProcess::startDetached(qApp->arguments()[0], qApp->arguments());
+        if (aDB()->commit(pilot)) {
+            qApp->quit();
+            QProcess::startDetached(qApp->arguments()[0], qApp->arguments());
+        } else {
+            QMessageBox message_box(this);
+            message_box.setText("Errors have ocurred creating the database. Without a working database The application will not be usable.");
+        }
+
     }
 }