|  |  | @ -59,18 +59,27 @@ bool Route::load() { | 
			
		
	
		
		
			
				
					
					|  |  |  |   return !segments_.empty(); |  |  |  |   return !segments_.empty(); | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | bool Route::loadFromServer() { |  |  |  | bool Route::loadFromServer(int retries) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   for (int i = 1; i <= retries; ++i) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     QString result; | 
			
		
	
		
		
			
				
					
					|  |  |  |     QEventLoop loop; |  |  |  |     QEventLoop loop; | 
			
		
	
		
		
			
				
					
					|  |  |  |     HttpRequest http(nullptr, !Hardware::PC()); |  |  |  |     HttpRequest http(nullptr, !Hardware::PC()); | 
			
		
	
		
		
			
				
					
					|  |  |  |   QObject::connect(&http, &HttpRequest::requestDone, [&](const QString &json, bool success, QNetworkReply::NetworkError error) { |  |  |  |     QObject::connect(&http, &HttpRequest::requestDone, [&loop, &result](const QString &json, bool success, QNetworkReply::NetworkError err) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     if (error == QNetworkReply::ContentAccessDenied || error == QNetworkReply::AuthenticationRequiredError) { |  |  |  |       result = json; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       qWarning() << ">>  Unauthorized. Authenticate with tools/lib/auth.py  <<"; |  |  |  |       loop.exit((int)err); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     loop.exit(success ? loadFromJson(json) : 0); |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     }); |  |  |  |     }); | 
			
		
	
		
		
			
				
					
					|  |  |  |     http.sendRequest(CommaApi::BASE_URL + "/v1/route/" + route_.str + "/files"); |  |  |  |     http.sendRequest(CommaApi::BASE_URL + "/v1/route/" + route_.str + "/files"); | 
			
		
	
		
		
			
				
					
					|  |  |  |   return loop.exec(); |  |  |  |     auto err = (QNetworkReply::NetworkError)loop.exec(); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     if (err == QNetworkReply::NoError) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       return loadFromJson(result); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } else if (err == QNetworkReply::ContentAccessDenied || err == QNetworkReply::AuthenticationRequiredError) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       rWarning(">>  Unauthorized. Authenticate with tools/lib/auth.py  <<"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       return false; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     rWarning("Retrying %d/%d", i, retries); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     util::sleep_for(500); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   return false; | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | bool Route::loadFromJson(const QString &json) { |  |  |  | bool Route::loadFromJson(const QString &json) { | 
			
		
	
	
		
		
			
				
					|  |  | 
 |