Skip to content

Commit

Permalink
Merge pull request #167 from kanurag94/png-xpf
Browse files Browse the repository at this point in the history
Show error message on non xaos pngs
  • Loading branch information
kanurag94 authored Jun 13, 2020
2 parents 5a34f5e + 09542f2 commit 2d9fca7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ui/image_qt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const char *writepng(xio_constpath filename, const struct image *image)
QFile::Text))
{
qDebug()<<"Could not open the file for reading";
qDebug()<<"Image will be created without xpf data";
}
QTextStream in(&f);
QString xpf_chunk = in.readAll();
Expand All @@ -86,11 +87,15 @@ const char *readpng(xio_constpath filename)
QImageReader reader(filename);
const QImage xaos_image = reader.read();
QString xpf_chunk = xaos_image.text("Metadata");
if(xpf_chunk.isNull() || xpf_chunk.isEmpty()) {
return "Not valid image";
}
QFile f(".xaos_temp.xpf");
if(!f.open(QFile::WriteOnly |
QFile::Text))
{
qDebug() << " Could not open the file for writing";
return "No file or permission";
}
QTextStream in(&f);
in<<xpf_chunk;
Expand Down

0 comments on commit 2d9fca7

Please sign in to comment.