| 2832 | } |
| 2833 | |
| 2834 | void IGFD::FileDialogInternal::configureDialog(const std::string& vKey, const std::string& vTitle, const char* vFilters, const FileDialogConfig& vConfig) { |
| 2835 | m_DialogConfig = vConfig; |
| 2836 | ResetForNewDialog(); |
| 2837 | dLGkey = vKey; |
| 2838 | dLGtitle = vTitle; |
| 2839 | |
| 2840 | // treatment |
| 2841 | if (m_DialogConfig.sidePane == nullptr) { |
| 2842 | m_DialogConfig.sidePaneWidth = 0.0f; |
| 2843 | } |
| 2844 | |
| 2845 | if (m_DialogConfig.filePathName.empty()) { |
| 2846 | if (m_DialogConfig.path.empty()) { |
| 2847 | fileManager.dLGpath = fileManager.GetCurrentPath(); |
| 2848 | } else { |
| 2849 | fileManager.dLGpath = m_DialogConfig.path; |
| 2850 | } |
| 2851 | fileManager.SetCurrentPath(m_DialogConfig.path); |
| 2852 | fileManager.dLGcountSelectionMax = (size_t)m_DialogConfig.countSelectionMax; |
| 2853 | fileManager.SetDefaultFileName(m_DialogConfig.fileName); |
| 2854 | } else { |
| 2855 | auto ps = fileManager.GetFileSystemInstance()->ParsePathFileName(m_DialogConfig.filePathName); |
| 2856 | if (ps.isOk) { |
| 2857 | fileManager.dLGpath = ps.path; |
| 2858 | fileManager.SetDefaultFileName(ps.name); |
| 2859 | filterManager.dLGdefaultExt = "." + ps.ext; |
| 2860 | } else { |
| 2861 | fileManager.dLGpath = fileManager.GetCurrentPath(); |
| 2862 | fileManager.SetDefaultFileName(""); |
| 2863 | filterManager.dLGdefaultExt.clear(); |
| 2864 | } |
| 2865 | } |
| 2866 | |
| 2867 | filterManager.dLGdefaultExt.clear(); |
| 2868 | filterManager.ParseFilters(vFilters); |
| 2869 | filterManager.SetSelectedFilterWithExt(filterManager.dLGdefaultExt); |
| 2870 | fileManager.SetCurrentPath(fileManager.dLGpath); |
| 2871 | fileManager.dLGDirectoryMode = (vFilters == nullptr); |
| 2872 | fileManager.dLGcountSelectionMax = m_DialogConfig.countSelectionMax; //-V101 |
| 2873 | fileManager.ClearAll(); |
| 2874 | showDialog = true; |
| 2875 | } |
| 2876 | |
| 2877 | const IGFD::FileDialogConfig& IGFD::FileDialogInternal::getDialogConfig() const { |
| 2878 | return m_DialogConfig; |
no test coverage detected