From e3e56955e06409978f32cf6975e95b71e2d15d41 Mon Sep 17 00:00:00 2001 From: Syping Date: Wed, 11 Oct 2017 11:34:38 +0200 Subject: [PATCH] add auto extension --- main.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/main.cpp b/main.cpp index 3388a42..9452533 100644 --- a/main.cpp +++ b/main.cpp @@ -76,8 +76,7 @@ int main(int argc, char *argv[]) picture.setPictureTitle("Converted Picture"); SnapmaticProperties pictureSP = picture.getSnapmaticProperties(); pictureSP.uid = QString(QTime::currentTime().toString("HHmmss") + - QString("0") + - QString::number(QDate::currentDate().dayOfYear())).toInt(); + QString::number(QDate::currentDate().dayOfYear())).toInt(); pictureSP.createdDateTime = QDateTime::currentDateTime(); pictureSP.createdTimestamp = pictureSP.createdDateTime.toTime_t(); picture.setSnapmaticProperties(pictureSP); @@ -86,19 +85,29 @@ int main(int argc, char *argv[]) filePath.replace("", picture.getPictureFileName()); if (!customFormat) { + filePath.replace("", ""); if (!picture.exportPicture(filePath, SnapmaticFormat::PGTA_Format)) { - cout << "gta5view-cmd: Converting of " << args.at(1).toStdString().c_str() << " to " << args.at(2).toStdString().c_str() << " failed!" << endl; + cout << "gta5view-cmd: Converting of " << args.at(1).toStdString().c_str() << " to " << filePath.toStdString().c_str() << " failed!" << endl; return 1; } + else + { + cout << "gta5view-cmd: Converting of " << args.at(1).toStdString().c_str() << " to " << filePath.toStdString().c_str() << " successful!" << endl; + } } else { + filePath.replace("", ".g5e"); if (!picture.exportPicture(filePath, SnapmaticFormat::G5E_Format)) { - cout << "gta5view-cmd: Converting of " << args.at(1).toStdString().c_str() << " to " << args.at(2).toStdString().c_str() << " failed!" << endl; + cout << "gta5view-cmd: Converting of " << args.at(1).toStdString().c_str() << " to " << filePath.toStdString().c_str() << " failed!" << endl; return 1; } + else + { + cout << "gta5view-cmd: Converting of " << args.at(1).toStdString().c_str() << " to " << filePath.toStdString().c_str() << " successful!" << endl; + } } } else @@ -126,7 +135,8 @@ int main(int argc, char *argv[]) cout << "Usage: " << args.at(0).toStdString().c_str() << " source target -format" << endl; if (args.at(1) == "--help") { - cout << "Convert-only: (Auto Filename at Convert)" << endl; + cout << "Convert-only: (auto file name at convert)" << endl; + cout << "Convert-only: (auto file extension at convert)" << endl; cout << "Formats: jpg pgta g5e" << endl; } return 255;