Compare commits

...

3 Commits

Author SHA1 Message Date
ff5dbaffc0 fix some file selector glitches 2024-02-08 18:11:51 +01:00
b56d581e4b fix normal feeling sluggish 2024-02-05 16:15:10 +01:00
aa661aaaa7 default to normal fps mode again 2024-02-05 16:10:30 +01:00
5 changed files with 15 additions and 8 deletions

View File

@ -737,7 +737,11 @@ void ChatGui4::renderMessageBodyFile(Message3Registry& reg, const Message3 e) {
) { ) {
if (ImGui::Button("save to")) { if (ImGui::Button("save to")) {
_fss.requestFile( _fss.requestFile(
[](const auto& path) -> bool { return std::filesystem::is_directory(path); }, [](std::filesystem::path& path) -> bool {
// remove file path
path.remove_filename();
return std::filesystem::is_directory(path);
},
[this, &reg, e](const auto& path) { [this, &reg, e](const auto& path) {
if (reg.valid(e)) { // still valid if (reg.valid(e)) { // still valid
// TODO: trim file? // TODO: trim file?

View File

@ -18,7 +18,7 @@ FileSelector::FileSelector(void) {
} }
void FileSelector::requestFile( void FileSelector::requestFile(
std::function<bool(const std::filesystem::path& path)>&& is_valid, std::function<bool(std::filesystem::path& path)>&& is_valid,
std::function<void(const std::filesystem::path& path)>&& on_choose, std::function<void(const std::filesystem::path& path)>&& on_choose,
std::function<void(void)>&& on_cancel std::function<void(void)>&& on_cancel
) { ) {
@ -77,7 +77,9 @@ void FileSelector::render(void) {
if (current_path.has_parent_path()) { if (current_path.has_parent_path()) {
if (ImGui::TableNextColumn()) { if (ImGui::TableNextColumn()) {
if (ImGui::Selectable("D##..", false, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap)) { if (ImGui::Selectable("D##..", false, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap)) {
_current_file_path = _current_file_path.parent_path(); // the first "parent_path()" only removes the filename and the ending "/"
_current_file_path = _current_file_path.parent_path().parent_path() / "";
//_current_file_path = _current_file_path.remove_filename().parent_path() / "";
} }
} }

View File

@ -8,7 +8,7 @@ struct FileSelector {
bool _open_popup {false}; bool _open_popup {false};
std::function<bool(const std::filesystem::path& path)> _is_valid = [](auto){ return true; }; std::function<bool(std::filesystem::path& path)> _is_valid = [](auto){ return true; };
std::function<void(const std::filesystem::path& path)> _on_choose = [](auto){}; std::function<void(const std::filesystem::path& path)> _on_choose = [](auto){};
std::function<void(void)> _on_cancel = [](){}; std::function<void(void)> _on_cancel = [](){};
@ -18,8 +18,9 @@ struct FileSelector {
FileSelector(void); FileSelector(void);
// TODO: supply hints // TODO: supply hints
// HACK: until we supply hints, is_valid can modify
void requestFile( void requestFile(
std::function<bool(const std::filesystem::path& path)>&& is_valid, std::function<bool(std::filesystem::path& path)>&& is_valid,
std::function<void(const std::filesystem::path& path)>&& on_choose, std::function<void(const std::filesystem::path& path)>&& on_choose,
std::function<void(void)>&& on_cancel std::function<void(void)>&& on_cancel
); );

View File

@ -275,7 +275,7 @@ Screen* MainScreen::render(float time_delta, bool&) {
struct PerfProfileRender { struct PerfProfileRender {
float low_delay_window {1.5f}; float low_delay_window {1.5f};
float low_delay_min {1.f/60.f}; float low_delay_min {1.f/60.f};
float low_delay_max {1.f/30.f}; float low_delay_max {1.f/60.f};
float mid_delay_window {30.f}; float mid_delay_window {30.f};
float mid_delay_min {1.f/60.f}; float mid_delay_min {1.f/60.f};
@ -289,7 +289,7 @@ Screen* MainScreen::render(float time_delta, bool&) {
const static PerfProfileRender normalPerfProfile{ const static PerfProfileRender normalPerfProfile{
//1.5f, // low_delay_window //1.5f, // low_delay_window
//1.f/60.f, // low_delay_min //1.f/60.f, // low_delay_min
//1.f/30.f, // low_delay_max //1.f/60.f, // low_delay_max
//30.f, // mid_delay_window //30.f, // mid_delay_window
//1.f/60.f, // mid_delay_min //1.f/60.f, // mid_delay_min

View File

@ -94,7 +94,7 @@ struct MainScreen final : public Screen {
// 0 - normal // 0 - normal
// 1 - reduced // 1 - reduced
// 2 - power save // 2 - power save
int _fps_perf_mode {1}; int _fps_perf_mode {0};
// 0 - normal // 0 - normal
// 1 - power save // 1 - power save
int _compute_perf_mode {0}; int _compute_perf_mode {0};