| 
														
															@@ -49,21 +49,25 @@ int main(int argc, char *argv[]) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     ASettings::setup(); 
														 | 
														
														 | 
														
															     ASettings::setup(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     AStyle::setup(); 
														 | 
														
														 | 
														
															     AStyle::setup(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    aDB->connect(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    if (!aDB->connect()) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        DEB << "Error establishing database connection"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        return 2; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     if (!ASettings::read(ASettings::Setup::SetupComplete).toBool()) { 
														 | 
														
														 | 
														
															     if (!ASettings::read(ASettings::Setup::SetupComplete).toBool()) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         if(FirstRunDialog().exec() == QDialog::Rejected){ 
														 | 
														
														 | 
														
															         if(FirstRunDialog().exec() == QDialog::Rejected){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            DEB "First run not accepted. Exiting."; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            return 1; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            DEB << "First run not accepted. Exiting."; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            return 3; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         ASettings::write(ASettings::Setup::SetupComplete, true); 
														 | 
														
														 | 
														
															         ASettings::write(ASettings::Setup::SetupComplete, true); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         DEB << "Wrote setup_commplete?"; 
														 | 
														
														 | 
														
															         DEB << "Wrote setup_commplete?"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    //sqlite does not deal well with multiple connections, ensure only one instance is running 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     ARunGuard guard(QStringLiteral("opl_single_key")); 
														 | 
														
														 | 
														
															     ARunGuard guard(QStringLiteral("opl_single_key")); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     if ( !guard.tryToRun() ){ 
														 | 
														
														 | 
														
															     if ( !guard.tryToRun() ){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        DEB << "Another Instance is already running. Exiting."; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        return 2; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        DEB << "Another Instance of openPilotLog is already running. Exiting."; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        return 0; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 |