give users the ability to import files with wrong extension

This commit is contained in:
Syping 2017-09-17 23:27:49 +02:00
parent dc0a007774
commit 8a90ab7036
2 changed files with 29 additions and 10 deletions

View file

@ -32,6 +32,7 @@
#include "config.h"
#include <QProgressDialog>
#include <QStringBuilder>
#include <QImageReader>
#include <QProgressBar>
#include <QInputDialog>
#include <QPushButton>
@ -526,16 +527,25 @@ bool ProfileInterface::importFile(QString selectedFile, bool notMultiple)
{
if (!notMultiple)
{
QImage snapmaticImage;
QString customImageTitle;
QPixmap snapmaticPixmap(960, 536);
snapmaticPixmap.fill(Qt::black);
QPainter snapmaticPainter(&snapmaticPixmap);
if (!snapmaticImage.load(selectedFile))
QFile snapmaticFile(selectedFile);
if (!snapmaticFile.open(QFile::ReadOnly))
{
delete picture;
return false;
}
QImage snapmaticImage;
QImageReader snapmaticImageReader;
snapmaticImageReader.setDecideFormatFromContent(true);
snapmaticImageReader.setDevice(&snapmaticFile);
if (!snapmaticImageReader.read(&snapmaticImage))
{
delete picture;
return false;
}
QString customImageTitle;
QPixmap snapmaticPixmap(960, 536);
snapmaticPixmap.fill(Qt::black);
QPainter snapmaticPainter(&snapmaticPixmap);
if (snapmaticImage.height() == snapmaticImage.width())
{
// Avatar mode
@ -609,8 +619,17 @@ bool ProfileInterface::importFile(QString selectedFile, bool notMultiple)
else
{
bool success = false;
QFile snapmaticFile(selectedFile);
if (!snapmaticFile.open(QFile::ReadOnly))
{
delete picture;
return false;
}
QImage snapmaticImage;
if (!snapmaticImage.load(selectedFile))
QImageReader snapmaticImageReader;
snapmaticImageReader.setDecideFormatFromContent(true);
snapmaticImageReader.setDevice(&snapmaticFile);
if (!snapmaticImageReader.read(&snapmaticImage))
{
delete picture;
return false;

View file

@ -50,7 +50,7 @@
#ifndef GTA5SYNC_APPVER
#ifndef GTA5SYNC_DAILYB
#define GTA5SYNC_APPVER "1.4.2"
#define GTA5SYNC_APPVER "1.4.3"
#else
#define GTA5SYNC_APPVER QString("%1").arg(GTA5SYNC_DAILYB)
#endif