improve image formats check
iterate over important formats, and add a message box
This commit is contained in:
		
							parent
							
								
									25ef804ae7
								
							
						
					
					
						commit
						061b7a796a
					
				
							
								
								
									
										13
									
								
								src/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								src/main.cpp
									
									
									
									
									
								
							@ -45,14 +45,19 @@ int main(int argc, char *argv[])
 | 
				
			|||||||
    fontDatabase.addApplicationFont(it.next());
 | 
					    fontDatabase.addApplicationFont(it.next());
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!QImageReader::supportedImageFormats().contains("apng"))
 | 
					  QStringList missing_formats{"webp", "apng", "gif"};
 | 
				
			||||||
 | 
					  for (const QByteArray &i_format : QImageReader::supportedImageFormats())
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    qCritical() << "QApng plugin could not be loaded. Errors may occur when loading .apng files.";
 | 
					    missing_formats.removeAll(i_format.toLower());
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!QImageReader::supportedImageFormats().contains("webp"))
 | 
					  if (!missing_formats.empty())
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    qCritical() << "QWebP plugin could not be loaded. Errors may occur when loading .webp files.";
 | 
					    call_error(QString("Missing the following image formats: %1."
 | 
				
			||||||
 | 
					                       "<br/>Please make sure the client is installed correctly."
 | 
				
			||||||
 | 
					                       "<br/>If you are on Linux, you may need to install your distribution's image formats package, "
 | 
				
			||||||
 | 
					                       "as detailed in the project's <a href='https://github.com/AttorneyOnline/AO2-Client'>README<a>.")
 | 
				
			||||||
 | 
					                   .arg(missing_formats.join(", ")));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  QString p_language = Options::getInstance().language();
 | 
					  QString p_language = Options::getInstance().language();
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user