Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions ImFileDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,11 @@ namespace ifd {
uid = geteuid();
pw = getpwuid(uid);
if (pw) {
#ifdef __APPLE__
std::string homePath = "/Users/" + std::string(pw->pw_name);
#else
std::string homePath = "/home/" + std::string(pw->pw_name);
#endif
if (std::filesystem::exists(homePath, ec))
quickAccess->Children.push_back(new FileTreeNode(homePath));
if (std::filesystem::exists(homePath + "/Desktop", ec))
Expand Down Expand Up @@ -837,7 +840,7 @@ namespace ifd {
}
void FileDialog::m_refreshIconPreview()
{
if (m_zoom >= 5.0f) {
if (m_zoom >= 3.0f) {
if (m_previewLoader == nullptr) {
m_previewLoaderRunning = true;
m_previewLoader = new std::thread(&FileDialog::m_loadPreview, this);
Expand Down Expand Up @@ -1383,7 +1386,31 @@ namespace ifd {
}
}

// buttons
// zoom
{
bool changed = false;
int zoom_int = (int)m_zoom;
changed |= ImGui::RadioButton("Details", & zoom_int, 1);
ImGui::SameLine();
changed |= ImGui::RadioButton("Icons", & zoom_int, 2);
ImGui::SameLine();
changed |= ImGui::RadioButton("Preview", & zoom_int, 3);
ImGui::SameLine();
if (zoom_int >= 3)
{
ImGui::SameLine();
ImGui::SetNextItemWidth(75.f);
changed |= ImGui::SliderInt("##Zoom", &zoom_int, 3, 30, "");
}
if (changed)
{
m_zoom = (float) zoom_int;
m_refreshIconPreview();
}
ImGui::SameLine();
}

// buttons
float ok_cancel_width = GUI_ELEMENT_SIZE * 7;
ImGui::SetCursorPosX(ImGui::GetWindowWidth() - ok_cancel_width);
if (ImGui::Button(m_type == IFD_DIALOG_SAVE ? "Save" : "Open", ImVec2(ok_cancel_width / 2 - ImGui::GetStyle().ItemSpacing.x, 0.0f))) {
Expand Down