From 8fabf871d89e8a0585595f79680ac25a85045944 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 28 Aug 2015 00:29:08 +0300 Subject: [PATCH] updated save dialog to take file path from command line instead it had in settings --HG-- branch : develop --- src/app/valentina/dialogs/dialogsavelayout.cpp | 16 +++++++++++++++- src/app/valentina/dialogs/dialogsavelayout.h | 2 +- src/app/valentina/mainwindow.cpp | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/app/valentina/dialogs/dialogsavelayout.cpp b/src/app/valentina/dialogs/dialogsavelayout.cpp index f817af65c..2a67a2463 100644 --- a/src/app/valentina/dialogs/dialogsavelayout.cpp +++ b/src/app/valentina/dialogs/dialogsavelayout.cpp @@ -122,6 +122,20 @@ QString DialogSaveLayout::MakeHelpFormatList() return out; } +//--------------------------------------------------------------------------------------------------------------------- +void DialogSaveLayout::SetFullPath(const QString &cmdFileName) +{ + QFileInfo fn(cmdFileName); + fn.makeAbsolute(); + auto p = fn.dir().absolutePath(); + auto n = fn.fileName()+"_"; + QTextStream sout(stdout); + + sout << tr("Output full path: ") << fn.filePath() << "\n"; + ui->lineEditPath->setText(p); + ui->lineEditFileName->setText(n); +} + //--------------------------------------------------------------------------------------------------------------------- DialogSaveLayout::~DialogSaveLayout() { @@ -154,7 +168,7 @@ QString DialogSaveLayout::Formate() const void DialogSaveLayout::Save() { for (int i=0; i < count; ++i) - { + { const QString name = Path()+"/"+FileName()+QString::number(i+1)+Formate(); if (QFile::exists(name)) { diff --git a/src/app/valentina/dialogs/dialogsavelayout.h b/src/app/valentina/dialogs/dialogsavelayout.h index a1ecf4477..786d34f73 100644 --- a/src/app/valentina/dialogs/dialogsavelayout.h +++ b/src/app/valentina/dialogs/dialogsavelayout.h @@ -93,7 +93,7 @@ public: QString Formate() const; void SelectFormate(const size_t formate); static QString MakeHelpFormatList(); - + void SetFullPath(const QString& cmdFileName); public slots: void Save(); void ShowExample(); diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index a7981b158..b9362c18d 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -3482,6 +3482,7 @@ void MainWindow::DoExport(const VCommandLinePtr &expParams) PrepareDetailsForLayout(details); LayoutSettings(*settings.get()); DialogSaveLayout dialog(scenes.size(), expParams->OptExportPath(), this); + dialog.SetFullPath(expParams->OptExportPath()); dialog.SelectFormate(expParams->OptExportType()); ExportLayout(dialog); }