Skip to content

Commit 8c36b67

Browse files
committed
[FIX] : places was init at instance creation. now are init when we open the dialog (#218)
1 parent 92a6ecb commit 8c36b67

1 file changed

Lines changed: 15 additions & 17 deletions

File tree

ImGuiFileDialog.cpp

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3726,9 +3726,6 @@ void IGFD::KeyExplorerFeature::SetFlashingAttenuationInSeconds(float vAttenValue
37263726
#endif // USE_EXPLORATION_BY_KEYS
37273727

37283728
IGFD::FileDialog::FileDialog() : PlacesFeature(), KeyExplorerFeature(), ThumbnailFeature() {
3729-
#ifdef USE_PLACES_FEATURE
3730-
m_InitPlaces(m_FileDialogInternal);
3731-
#endif
37323729
}
37333730
IGFD::FileDialog::~FileDialog() = default;
37343731

@@ -3741,6 +3738,9 @@ void IGFD::FileDialog::OpenDialog(const std::string& vKey, const std::string& vT
37413738
if (m_FileDialogInternal.showDialog) // if already opened, quit
37423739
return;
37433740
m_FileDialogInternal.configureDialog(vKey, vTitle, vFilters, vConfig);
3741+
#ifdef USE_PLACES_FEATURE
3742+
m_InitPlaces(m_FileDialogInternal);
3743+
#endif
37443744
}
37453745

37463746
//////////////////////////////////////////////////////////////////////////////////////////////////
@@ -4173,34 +4173,32 @@ void IGFD::FileDialog::m_SelectableItem(int vRowIdx, std::shared_ptr<FileInfos>
41734173
void IGFD::FileDialog::m_DisplayFileInfosTooltip(const int32_t& vRowIdx, const int32_t& vColumnIdx, std::shared_ptr<FileInfos> vFileInfos) {
41744174
// IsItemHovered is not sufficient since file size have two calls to Text
41754175
if ((ImGui::TableGetHoveredColumn() == vColumnIdx) && // column hovered
4176-
(ImGui::TableGetHoveredRow() == (vRowIdx+1))) { // row hovered
4177-
if (vFileInfos != nullptr && vFileInfos->tooltipColumn == vColumnIdx) {
4178-
if (!vFileInfos->tooltipMessage.empty()) {
4179-
ImGui::SetTooltip("%s", vFileInfos->tooltipMessage.c_str());
4180-
}
4181-
}
4176+
(ImGui::TableGetHoveredRow() == (vRowIdx + 1)) && // row hovered
4177+
(vFileInfos != nullptr) && // fileinfo not null
4178+
(vFileInfos->tooltipColumn == vColumnIdx) && // good tooltip column
4179+
(!vFileInfos->tooltipMessage.empty())) { // tooltip not empty
4180+
ImGui::SetTooltip("%s", vFileInfos->tooltipMessage.c_str());
41824181
}
41834182
}
41844183

41854184
void IGFD::FileDialog::m_BeginFileColorIconStyle(std::shared_ptr<FileInfos> vFileInfos, bool& vOutShowColor, std::string& vOutStr, ImFont** vOutFont) {
41864185
vOutStr.clear();
41874186
vOutShowColor = false;
41884187

4189-
if (vFileInfos->fileStyle.use_count()) //-V807 //-V522
4190-
{
4188+
if (vFileInfos->fileStyle != nullptr) {
41914189
vOutShowColor = true;
4192-
4193-
*vOutFont = vFileInfos->fileStyle->font;
4190+
*vOutFont = vFileInfos->fileStyle->font;
41944191
}
41954192

4196-
if (vOutShowColor && !vFileInfos->fileStyle->icon.empty())
4193+
if (vOutShowColor && !vFileInfos->fileStyle->icon.empty()) {
41974194
vOutStr = vFileInfos->fileStyle->icon;
4198-
else if (vFileInfos->fileType.isDir())
4195+
} else if (vFileInfos->fileType.isDir()) {
41994196
vOutStr = dirEntryString;
4200-
else if (vFileInfos->fileType.isLinkToUnknown())
4197+
} else if (vFileInfos->fileType.isLinkToUnknown()) {
42014198
vOutStr = linkEntryString;
4202-
else if (vFileInfos->fileType.isFile())
4199+
} else if (vFileInfos->fileType.isFile()) {
42034200
vOutStr = fileEntryString;
4201+
}
42044202

42054203
vOutStr += " " + vFileInfos->fileNameExt;
42064204

0 commit comments

Comments
 (0)