Merge pull request #19928 from furgo16/startpage-option-showonlyfcstd
Start: add option to show only FreeCAD native files in custom folder
This commit is contained in:
@@ -41,6 +41,8 @@ CustomFolderModel::CustomFolderModel(QObject* parent)
|
||||
|
||||
_customFolderDirectory =
|
||||
QDir(QString::fromStdString(parameterGroup->GetASCII("CustomFolder", "")));
|
||||
|
||||
_showOnlyFCStd = parameterGroup->GetBool("ShowOnlyFCStd", false);
|
||||
}
|
||||
|
||||
void CustomFolderModel::loadCustomFolder()
|
||||
@@ -52,6 +54,11 @@ void CustomFolderModel::loadCustomFolder()
|
||||
"BaseApp/Preferences/Mod/Start/CustomFolder: cannot read custom folder %s\n",
|
||||
_customFolderDirectory.absolutePath().toStdString().c_str());
|
||||
}
|
||||
|
||||
if (_showOnlyFCStd) {
|
||||
_customFolderDirectory.setNameFilters(QStringList() << QStringLiteral("*.FCStd"));
|
||||
}
|
||||
|
||||
auto entries = _customFolderDirectory.entryList(QDir::Filter::Files | QDir::Filter::Readable,
|
||||
QDir::SortFlag::Name);
|
||||
for (const auto& entry : entries) {
|
||||
|
||||
@@ -46,6 +46,7 @@ public:
|
||||
|
||||
private:
|
||||
QDir _customFolderDirectory;
|
||||
bool _showOnlyFCStd; // Show only FreeCAD files
|
||||
};
|
||||
|
||||
} // namespace Start
|
||||
|
||||
@@ -20,6 +20,20 @@
|
||||
<string>Contents</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelShowOnlyFCStd">
|
||||
<property name="text">
|
||||
<string>Show only FreeCAD files in additional folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Show examples folder contents</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelCustomFolder">
|
||||
<property name="text">
|
||||
@@ -27,6 +41,22 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::PrefFileChooser" name="fileChooserCustomFolder" native="true">
|
||||
<property name="toolTip">
|
||||
<string>An optional custom folder to be displayed on the Start page.</string>
|
||||
</property>
|
||||
<property name="mode">
|
||||
<enum>Gui::FileChooser::Directory</enum>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>CustomFolder</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Start</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::PrefCheckBox" name="checkBoxShowExamples">
|
||||
<property name="toolTip">
|
||||
@@ -49,29 +79,25 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::PrefFileChooser" name="fileChooserCustomFolder" native="true">
|
||||
<item row="2" column="1">
|
||||
<widget class="Gui::PrefCheckBox" name="checkBoxShowOnlyFCStd">
|
||||
<property name="toolTip">
|
||||
<string>An optional custom folder to be displayed on the Start page.</string>
|
||||
<string>If the additional folder contents should include only .FCStd files</string>
|
||||
</property>
|
||||
<property name="mode">
|
||||
<enum>Gui::FileChooser::Directory</enum>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>CustomFolder</cstring>
|
||||
<cstring>ShowOnlyFCStd</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Start</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Show examples folder contents</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -53,6 +53,7 @@ void DlgStartPreferencesImp::saveSettings()
|
||||
ui->fileChooserCustomFolder->onSave();
|
||||
ui->checkBoxShowExamples->onSave();
|
||||
ui->checkBoxCloseAfterLoading->onSave();
|
||||
ui->checkBoxShowOnlyFCStd->onSave();
|
||||
}
|
||||
|
||||
void DlgStartPreferencesImp::loadSettings()
|
||||
@@ -60,6 +61,7 @@ void DlgStartPreferencesImp::loadSettings()
|
||||
ui->fileChooserCustomFolder->onRestore();
|
||||
ui->checkBoxShowExamples->onRestore();
|
||||
ui->checkBoxCloseAfterLoading->onRestore();
|
||||
ui->checkBoxShowOnlyFCStd->onRestore();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user