| 2894 | } |
| 2895 | |
| 2896 | void IGFD::FileDialogInternal::configureDialog(const std::string& vKey, const std::string& vTitle, const char* vFilters, const FileDialogConfig& vConfig) { |
| 2897 | m_DialogConfig = vConfig; |
| 2898 | ResetForNewDialog(); |
| 2899 | dLGkey = vKey; |
| 2900 | dLGtitle = vTitle; |
| 2901 | |
| 2902 | // treatment |
| 2903 | if (m_DialogConfig.sidePane == nullptr) { |
| 2904 | m_DialogConfig.sidePaneWidth = 0.0f; |
| 2905 | } |
| 2906 | |
| 2907 | if (m_DialogConfig.filePathName.empty()) { |
| 2908 | if (m_DialogConfig.path.empty()) { |
| 2909 | fileManager.dLGpath = fileManager.GetCurrentPath(); |
| 2910 | } else { |
| 2911 | fileManager.dLGpath = m_DialogConfig.path; |
| 2912 | } |
| 2913 | fileManager.SetCurrentPath(m_DialogConfig.path); |
| 2914 | fileManager.dLGcountSelectionMax = (size_t)m_DialogConfig.countSelectionMax; |
| 2915 | fileManager.SetDefaultFileName(m_DialogConfig.fileName); |
| 2916 | } else { |
| 2917 | auto ps = fileManager.GetFileSystemInstance()->ParsePathFileName(m_DialogConfig.filePathName); |
| 2918 | if (ps.isOk) { |
| 2919 | fileManager.dLGpath = ps.path; |
| 2920 | fileManager.SetDefaultFileName(ps.name); |
| 2921 | filterManager.dLGdefaultExt = "." + ps.ext; |
| 2922 | } else { |
| 2923 | fileManager.dLGpath = fileManager.GetCurrentPath(); |
| 2924 | fileManager.SetDefaultFileName(""); |
| 2925 | filterManager.dLGdefaultExt.clear(); |
| 2926 | } |
| 2927 | } |
| 2928 | |
| 2929 | filterManager.dLGdefaultExt.clear(); |
| 2930 | filterManager.ParseFilters(vFilters); |
| 2931 | filterManager.SetSelectedFilterWithExt(filterManager.dLGdefaultExt); |
| 2932 | fileManager.SetCurrentPath(fileManager.dLGpath); |
| 2933 | fileManager.dLGDirectoryMode = (vFilters == nullptr); |
| 2934 | fileManager.dLGcountSelectionMax = m_DialogConfig.countSelectionMax; //-V101 |
| 2935 | fileManager.ClearAll(); |
| 2936 | showDialog = true; |
| 2937 | } |
| 2938 | |
| 2939 | const IGFD::FileDialogConfig& IGFD::FileDialogInternal::getDialogConfig() const { |
| 2940 | return m_DialogConfig; |
no test coverage detected