diff --git a/texturecrafter.cpp b/texturecrafter.cpp index 5665c83..67044a8 100644 --- a/texturecrafter.cpp +++ b/texturecrafter.cpp @@ -5,13 +5,14 @@ TextureCrafter::TextureCrafter(QObject *parent) {} void TextureCrafter::packChannels(QVector imagePaths) { + QVector sourceImages; int width = 0, height = 0; QImage::Format format = QImage::Format_RGB888; for (int i = 0; i < imagePaths.length(); i++) { // if the ui layer did its job this will always be a file:// url - QString rawPath = imagePaths[i].path(); + QString rawPath = imagePaths[i].toLocalFile(); QImage newImage(rawPath); // would this cause a use after free idk // we just use the first image's dimensions and force the others to conform hehe @@ -49,9 +50,17 @@ void TextureCrafter::packChannels(QVector imagePaths) { QString outFileName = outDir.path(); outFileName.append("/out.png"); - outImage.save(outFileName); + printf("wrote to %s\n", outFileName.toLatin1().data()); + + //TODO: use libpng and do progressive write to update the progress bar + if (outImage.save(outFileName)) { + printf("cool ^-^\n"); + } else { + //TODO: return some error value to show the user + printf("that dream is fucked it is fucking fucked\n"); + } } else { - // chat its so over + printf("chat its so over\n"); } //do we need to close these??? idk lets hope qt handles it