mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-04-19 09:21:42 -04:00
OpenExamples added Fractorium.cpp Code
This commit is contained in:
parent
552cb192aa
commit
49017137f8
@ -797,8 +797,9 @@ void Fractorium::SetFixedTableHeader(QHeaderView* header, QHeaderView::ResizeMod
|
|||||||
/// Setup and show the open XML dialog.
|
/// Setup and show the open XML dialog.
|
||||||
/// This will perform lazy instantiation.
|
/// This will perform lazy instantiation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="openExamples">true to open files in examples folder</param>
|
||||||
/// <returns>The list of filenames selected</returns>
|
/// <returns>The list of filenames selected</returns>
|
||||||
QStringList Fractorium::SetupOpenXmlDialog()
|
QStringList Fractorium::SetupOpenXmlDialog(bool openExamples)
|
||||||
{
|
{
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
|
|
||||||
@ -817,24 +818,47 @@ QStringList Fractorium::SetupOpenXmlDialog()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QStringList filenames;
|
QStringList filenames;
|
||||||
|
|
||||||
|
if(openExamples)
|
||||||
|
{
|
||||||
|
m_OpenFileDialog->selectFile("*");
|
||||||
|
m_OpenFileDialog->setDirectory(QCoreApplication::applicationDirPath() + "/FlameExamples");
|
||||||
|
m_OpenFileDialog->selectNameFilter("flame (*.flame)");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_OpenFileDialog->setDirectory(m_Settings->OpenFolder());
|
m_OpenFileDialog->setDirectory(m_Settings->OpenFolder());
|
||||||
m_OpenFileDialog->selectNameFilter(m_Settings->OpenXmlExt());
|
m_OpenFileDialog->selectNameFilter(m_Settings->OpenXmlExt());
|
||||||
|
}
|
||||||
|
|
||||||
if (m_OpenFileDialog->exec() == QDialog::Accepted)
|
if (m_OpenFileDialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
filenames = m_OpenFileDialog->selectedFiles();
|
filenames = m_OpenFileDialog->selectedFiles();
|
||||||
|
|
||||||
if (!filenames.empty())
|
if (!openExamples && !filenames.empty())
|
||||||
m_Settings->OpenFolder(QFileInfo(filenames[0]).canonicalPath());
|
m_Settings->OpenFolder(QFileInfo(filenames[0]).canonicalPath());
|
||||||
|
else
|
||||||
|
m_OpenFileDialog->selectFile("*");
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
auto defaultFilter(m_Settings->OpenXmlExt());
|
QString defaultFilter;
|
||||||
auto filenames = QFileDialog::getOpenFileNames(this, tr("Open Flame"), m_Settings->OpenFolder(), tr("flam3(*.flam3);; flame(*.flame);; xml(*.xml);; chaos (*.chaos)"), &defaultFilter);
|
QStringList filenames;
|
||||||
|
|
||||||
|
if(openExamples)
|
||||||
|
{
|
||||||
|
defaultFilter = "flame (*.flame)";
|
||||||
|
filenames = QFileDialog::getOpenFileNames(this, tr("Open Flame"), QCoreApplication::applicationDirPath() + "/FlameExamples", tr("flame(*.flame)"), &defaultFilter);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
defaultFilter = m_Settings->OpenXmlExt();
|
||||||
|
filenames = QFileDialog::getOpenFileNames(this, tr("Open Flame"), m_Settings->OpenFolder(), tr("flam3(*.flam3);; flame(*.flame);; xml(*.xml);; chaos (*.chaos)"), &defaultFilter);
|
||||||
m_Settings->OpenXmlExt(defaultFilter);
|
m_Settings->OpenXmlExt(defaultFilter);
|
||||||
|
|
||||||
if (!filenames.empty())
|
if (!filenames.empty())
|
||||||
m_Settings->OpenFolder(QFileInfo(filenames[0]).canonicalPath());
|
m_Settings->OpenFolder(QFileInfo(filenames[0]).canonicalPath());
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return filenames;
|
return filenames;
|
||||||
|
Loading…
Reference in New Issue
Block a user