Skip to content
Snippets Groups Projects
Commit 164a3e01 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

no else after return

parent c4dcaa5c
No related branches found
No related tags found
1 merge request!427Reduce include dependences in GUI; break cyclic dependence between View and Model
...@@ -100,33 +100,28 @@ QString getFilterString() ...@@ -100,33 +100,28 @@ QString getFilterString()
bool isValidExtension(const QString& fileName) bool isValidExtension(const QString& fileName)
{ {
for (int i = 0; i < outFormats.size(); ++i) { for (int i = 0; i < outFormats.size(); ++i)
if (fileName.endsWith(outFormats[i].m_file_extention, Qt::CaseInsensitive)) if (fileName.endsWith(outFormats[i].m_file_extention, Qt::CaseInsensitive))
return true; return true;
}
return false; return false;
} }
QString getExtensionFromFilterName(const QString& filterName) QString getExtensionFromFilterName(const QString& filterName)
{ {
for (int i = 0; i < outFormats.size(); ++i) { for (int i = 0; i < outFormats.size(); ++i)
if (outFormats[i].m_filter == filterName) if (outFormats[i].m_filter == filterName)
return outFormats[i].m_file_extention; return outFormats[i].m_file_extention;
}
return ""; return "";
} }
//! Compose file name to save plot from information provided by QFileDialog //! Compose file name to save plot from information provided by QFileDialog
QString composeFileName(const QString& fileName, const QString& filterName) QString composeFileName(const QString& fileName, const QString& filterName)
{ {
QString result; if (fileName.isEmpty() || filterName.isEmpty())
if (!fileName.isEmpty() && !filterName.isEmpty()) { return "";
if (isValidExtension(fileName)) if (isValidExtension(fileName))
result = fileName; return fileName;
else return fileName + getExtensionFromFilterName(filterName);
result = fileName + getExtensionFromFilterName(filterName);
}
return result;
} }
} // namespace } // namespace
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment