export file name added

This commit is contained in:
Rafael 2016-03-29 12:23:21 +02:00
parent 4c1e407cf3
commit b95a1cae68
2 changed files with 33 additions and 0 deletions

View file

@ -46,6 +46,7 @@ PictureDialog::PictureDialog(ProfileDatabase *profileDB, QWidget *parent) :
locX = "";
locY = "";
locZ = "";
smpic = 0;
}
PictureDialog::~PictureDialog()
@ -56,6 +57,7 @@ PictureDialog::~PictureDialog()
void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, bool readOk)
{
// Showing error if reading error
smpic = picture;
if (!readOk)
{
QMessageBox::warning(this, tr("Snapmatic Picture Viewer"), tr("Failed at %1").arg(picture->getLastStep()));
@ -193,6 +195,36 @@ fileDialogPreSave:
fileDialog.setSidebarUrls(sidebarUrls);
fileDialog.restoreState(settings.value("ExportPicture","").toByteArray());
if (smpic != 0)
{
QString newPictureFileName;
QString pictureStr = smpic->getPictureStr();
QStringList pictureStrList = pictureStr.split(" - ");
if (pictureStrList.length() <= 2)
{
QString dtStr = pictureStrList.at(1);
QStringList dtStrList = dtStr.split(" ");
if (dtStrList.length() <= 2)
{
QString dayStr;
QString yearStr;
QString monthStr;
QString dateStr = dtStrList.at(0);
QString timeStr = dtStrList.at(1);
timeStr.replace(":","");
QStringList dateStrList = dateStr.split("/");
if (dateStrList.length() <= 3)
{
dayStr = dateStrList.at(1);
yearStr = dateStrList.at(2);
monthStr = dateStrList.at(0);
}
newPictureFileName = yearStr + "-" + monthStr + "-" + dayStr + "_" + timeStr + ".jpg";
}
}
fileDialog.selectFile(newPictureFileName);
}
if (fileDialog.exec())
{
QStringList selectedFiles = fileDialog.selectedFiles();

View file

@ -45,6 +45,7 @@ private slots:
private:
ProfileDatabase *profileDB;
Ui::PictureDialog *ui;
SnapmaticPicture *smpic;
QString jsonDrawString;
QString windowTitleStr;
QStringList plyrsList;