MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / restoreState

Method restoreState

Source/Core/CtrlrPanel/CtrlrPanelResourceManager.cpp:482–517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

480}
481
482Result CtrlrPanelResourceManager::restoreState (const ValueTree &savedState)
483{
484 for (int i=0; i<savedState.getNumChildren(); i++)
485 {
486 if (savedState.getChild(i).hasType(Ids::resourceLicense))
487 {
488 AlertWindow licenseWindow("License agreement", "You must agree to the below license", AlertWindow::QuestionIcon);
489 TextEditor licenseText;
490 licenseText.setMultiLine(true);
491 licenseText.setReadOnly(true);
492 licenseText.setText (savedState.getChild(i).getProperty(Ids::resourceData));
493 licenseText.setSize (500,400);
494 licenseWindow.addCustomComponent (&licenseText);
495 licenseWindow.addButton ("Yes", 1);
496 licenseWindow.addButton ("No", 0);
497 if (!licenseWindow.runModalLoop())
498 {
499 return (Result::fail("User did not agree to embedded license"));
500 }
501 }
502
503 if (savedState.getChild(i).hasType(Ids::resourceBlob) || savedState.getChild(i).hasType(Ids::resourceImage) || savedState.getChild(i).hasType(Ids::resource))
504 {
505 Result importResult = importResource (savedState.getChild(i));
506 if (!importResult.wasOk())
507 {
508 if (owner.getDialogStatus())
509 WARN(importResult.getErrorMessage());
510 else
511 _WRN(importResult.getErrorMessage());
512 }
513 }
514 }
515
516 return (Result::ok());
517}
518
519Array <CtrlrPanelResource*> CtrlrPanelResourceManager::getResourcesCopy()
520{

Callers

nothing calls this directly

Calls 11

getNumChildrenMethod · 0.80
setReadOnlyMethod · 0.80
addCustomComponentMethod · 0.80
addButtonMethod · 0.80
runModalLoopMethod · 0.80
wasOkMethod · 0.80
getDialogStatusMethod · 0.80
getChildMethod · 0.45
setTextMethod · 0.45
getPropertyMethod · 0.45
setSizeMethod · 0.45

Tested by

no test coverage detected