Don't show full path for output filename in Export dialog

This commit is contained in:
David Capello 2018-03-15 22:42:53 -03:00
parent 8014c828af
commit 25322d69fe
2 changed files with 16 additions and 10 deletions

View File

@ -24,7 +24,7 @@ ExportFileWindow::ExportFileWindow(const Document* doc)
{
// Is a default output filename in the preferences?
if (!m_docPref.saveCopy.filename().empty()) {
outputFilename()->setText(m_docPref.saveCopy.filename());
m_outputFilename = m_docPref.saveCopy.filename();
}
else {
std::string newFn = base::replace_extension(
@ -35,8 +35,9 @@ ExportFileWindow::ExportFileWindow(const Document* doc)
base::get_file_path(newFn),
base::get_file_title(newFn) + "-export." + base::get_file_extension(newFn));
}
outputFilename()->setText(newFn);
m_outputFilename = newFn;
}
updateOutputFilenameButton();
// Default export configuration
resize()->setValue(
@ -48,8 +49,10 @@ ExportFileWindow::ExportFileWindow(const Document* doc)
outputFilename()->Click.connect(base::Bind<void>(
[this]{
std::string fn = SelectOutputFile();
if (!fn.empty())
outputFilename()->setText(fn);
if (!fn.empty()) {
m_outputFilename = fn;
updateOutputFilenameButton();
}
}));
}
@ -68,11 +71,6 @@ void ExportFileWindow::savePref()
m_docPref.saveCopy.applyPixelRatio(applyPixelRatio());
}
std::string ExportFileWindow::outputFilenameValue() const
{
return outputFilename()->text();
}
double ExportFileWindow::resizeValue() const
{
return base::convert_to<double>(resize()->getValue());
@ -93,4 +91,9 @@ bool ExportFileWindow::applyPixelRatio() const
return pixelRatio()->isSelected();
}
void ExportFileWindow::updateOutputFilenameButton()
{
outputFilename()->setText(base::get_file_name(m_outputFilename));
}
} // namespace app

View File

@ -25,7 +25,7 @@ namespace app {
bool show();
void savePref();
std::string outputFilenameValue() const;
const std::string& outputFilenameValue() const { return m_outputFilename; }
double resizeValue() const;
std::string layersValue() const;
std::string framesValue() const;
@ -34,8 +34,11 @@ namespace app {
obs::signal<std::string()> SelectOutputFile;
private:
void updateOutputFilenameButton();
const Document* m_doc;
DocumentPreferences& m_docPref;
std::string m_outputFilename;
};
}