Skip to content

Commit 7090c1b

Browse files
committed
Rework the way jobs are run so that everything happens in one callback,
which means thrown exceptions propagate properly and will cancel ongoing jobs. Also, the state machine is much cleaner.
1 parent 563babc commit 7090c1b

File tree

6 files changed

+167
-159
lines changed

6 files changed

+167
-159
lines changed

src/gui2/abstractsectorview.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ AbstractSectorView::AbstractSectorView(const std::string& name):
1717

1818
void AbstractSectorView::drawContent()
1919
{
20-
if (!Datastore::isConfigurationValid())
21-
return;
2220
auto diskFlux = Datastore::getDiskFlux();
2321
if (!diskFlux)
2422
return;

src/gui2/configview.cc

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ static void emitOptions(DynamicSetting<std::string>& setting,
7070
if (value)
7171
options[it.name()] = "true";
7272
setting = optionsToString(options);
73-
Datastore::rebuildConfiguration();
7473
}
7574
}
7675
}
@@ -147,7 +146,6 @@ static void emitOptions(DynamicSetting<std::string>& setting,
147146
options[it.name()] = ot.name();
148147
}
149148
setting = optionsToString(options);
150-
Datastore::rebuildConfiguration();
151149
}
152150
}
153151
}
@@ -185,10 +183,7 @@ static void formatProperties()
185183
label = name;
186184
if (ImGui::Selectable(
187185
fmt::format("{}##{}", label, name).c_str(), false))
188-
{
189186
formatSetting = name;
190-
Datastore::rebuildConfiguration();
191-
}
192187
}
193188
}
194189

@@ -234,10 +229,7 @@ static void deviceProperties()
234229

235230
for (auto& [name, device] : Datastore::getDevices())
236231
if (ImGui::Selectable(device.label.c_str(), false))
237-
{
238232
deviceNameSetting = name;
239-
Datastore::rebuildConfiguration();
240-
}
241233
}
242234

243235
/* The file path, if DEVICE_FLUXFILE, and device path, if DEVICE_MANUAL
@@ -260,10 +252,7 @@ static void deviceProperties()
260252
pathString,
261253
ImGuiInputTextFlags_CallbackCompletion |
262254
ImGuiInputTextFlags_ElideLeft))
263-
{
264255
pathSetting = pathString;
265-
Datastore::rebuildConfiguration();
266-
}
267256
};
268257

269258
if ((std::string)deviceNameSetting == DEVICE_FLUXFILE)
@@ -325,6 +314,6 @@ void ConfigView::drawContent()
325314
if (ImGui::InputTextMultiline("##customProperties",
326315
buffer,
327316
ImGui::GetContentRegionAvail(),
328-
ImGuiInputTextFlags_CallbackCompletion))
317+
ImGuiInputTextFlags_None))
329318
customSetting = buffer;
330319
}

src/gui2/controlpanelview.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ static void loadFluxFile()
3434
{
3535
settings.get<std::string>("device") = DEVICE_FLUXFILE;
3636
settings.get<std::fs::path>("fluxfile") = path;
37+
38+
Datastore::beginRead();
3739
});
3840
}
3941

@@ -50,7 +52,7 @@ static void saveFluxFile()
5052
void ControlPanelView::drawContent()
5153
{
5254
auto diskFlux = Datastore::getDiskFlux();
53-
bool busy = Datastore::isBusy() || !Datastore::isConfigurationValid();
55+
bool busy = Datastore::isBusy();
5456
bool hasImage = diskFlux && diskFlux->image;
5557

5658
if (ImGui::BeginTable("controlPanelOuter",

0 commit comments

Comments
 (0)