Skip to content

Commit 6790ec7

Browse files
committed
Fixed path setting browse.
1 parent af7659e commit 6790ec7

2 files changed

Lines changed: 19 additions & 5 deletions

File tree

frontend/include/frontend/settings/atomic_setting/combo_setting.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,10 @@ class ComboSetting : public Setting<Disengageable, ValueType>
151151
{
152152
return renderOption(option);
153153
},
154-
.dontUpdateValue = true,
155154
.makeId = [](){
156155
return Nui::val::global("generateId")().as<std::string>();
157-
}
156+
},
157+
.dontUpdateValue = true,
158158
}
159159
),
160160
//div{}("ComboSetting not implemented yet"),// TODO implement select component and use it here instead of this placeholder

frontend/include/frontend/settings/atomic_setting/path_setting.hpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class PathSetting : public Setting<Disengageable, std::filesystem::path>
3535
using SettingBase::onChange_;
3636
using SettingBase::reset;
3737
using SettingBase::help;
38+
using SettingBase::value;
3839
using SettingBase::observeEngagedToBool;
3940

4041
PathSetting(
@@ -66,13 +67,26 @@ class PathSetting : public Setting<Disengageable, std::filesystem::path>
6667
},
6768
[this](std::optional<std::vector<std::filesystem::path>> results)
6869
{
70+
// Print results:
71+
if (results)
72+
{
73+
for (const auto& path : *results)
74+
{
75+
Log::info("Selected path: {}", path.string());
76+
}
77+
}
78+
else
79+
{
80+
Log::info("Dialog was closed without selecting a path.");
81+
}
82+
6983
if (!results) // The dialog was closed without selecting a file
7084
return;
7185
if (results->empty()) // nothing was selected, but the dialog was closed with ok.
7286
return;
7387

7488
// Use the first selected path
75-
state_ = results->at(0).string();
89+
SettingBase::value(results->at(0));
7690
Nui::globalEventContext.executeActiveEventsImmediately();
7791
onChange_();
7892
}
@@ -96,7 +110,7 @@ class PathSetting : public Setting<Disengageable, std::filesystem::path>
96110
return;
97111

98112
// Use the first selected path
99-
state_ = results->at(0).string();
113+
SettingBase::value(results->at(0));
100114
Nui::globalEventContext.executeActiveEventsImmediately();
101115
onChange_();
102116
}
@@ -120,7 +134,7 @@ class PathSetting : public Setting<Disengageable, std::filesystem::path>
120134
.value = stateWithInheritance_,
121135
.attributes = {observeEngagedToBool(disabled)},
122136
.onChange = [this](auto const& state, Nui::WebApi::Event const&){
123-
this->value(std::filesystem::path{state});
137+
SettingBase::value(std::filesystem::path{state});
124138
onChange_();
125139
},
126140
.dontUpdateValue = true,

0 commit comments

Comments
 (0)