| 480 | } |
| 481 | |
| 482 | Result 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 | |
| 519 | Array <CtrlrPanelResource*> CtrlrPanelResourceManager::getResourcesCopy() |
| 520 | { |
nothing calls this directly
no test coverage detected