@@ -246,7 +246,7 @@ void MenuState :: enter()
246
246
m_MenuContext.push (&m_ControlsMenu);
247
247
});
248
248
m_OptionsMenu.options ().emplace_back (
249
- " Back" ,
249
+ " Back" ,
250
250
[this ]{
251
251
m_pQor->save_settings ();
252
252
m_MenuContext.pop ();
@@ -256,6 +256,8 @@ void MenuState :: enter()
256
256
Menu::Option::BACK
257
257
);
258
258
259
+ init_controls_menu ();
260
+
259
261
m_MenuContext.clear (&m_MainMenu);
260
262
m_pRoot->add (m_pMenuGUI);
261
263
@@ -304,6 +306,52 @@ MenuState :: ~MenuState()
304
306
m_pPipeline->partitioner ()->clear ();
305
307
}
306
308
309
+ void MenuState :: init_controls_menu()
310
+ {
311
+ shared_ptr<Meta> binds;
312
+ TRY (binds = m_pQor->session ()->profile (0 )->config ()->
313
+ meta (" input" )->meta (" binds" )
314
+ );
315
+
316
+
317
+ if (binds)
318
+ {
319
+ for (auto && bind: *binds)
320
+ {
321
+ try {
322
+ // individual action -> key
323
+ m_Binds[bind.as <string>()].push_back (bind.key );
324
+ }catch (const boost::bad_any_cast&){
325
+ // many actions -> one key
326
+ auto bind_list = bind.as <shared_ptr<Meta>>();
327
+ for (auto && key: *bind_list)
328
+ m_Binds[key.as <string>()].push_back (bind.key );
329
+ }
330
+ }
331
+
332
+ // TODO: add empty binds for buttons not found
333
+
334
+ for (auto && bind: m_Binds)
335
+ m_ControlsMenu.options ().emplace_back (
336
+ bind.first + " : " + boost::algorithm::join (bind.second , " , " ),
337
+ [this ]{
338
+
339
+ }
340
+ );
341
+ }
342
+
343
+ m_ControlsMenu.options ().emplace_back (
344
+ " Back" ,
345
+ [this ]{
346
+ m_pQor->save_settings ();
347
+ m_MenuContext.pop ();
348
+ },
349
+ std::function<bool (int )>(), // no adjust
350
+ string (), // no desc
351
+ Menu::Option::BACK
352
+ );
353
+ }
354
+
307
355
void MenuState :: logic(Freq::Time t)
308
356
{
309
357
Actuation::logic (t);
0 commit comments