| 427 | } |
| 428 | |
| 429 | void ConfigRuntime::onLoad(const QUrl& Filename) { |
| 430 | // TODO: Distinguish between "load" and "overlay". |
| 431 | // Currently, the new configuration is overlaid on top of the previous one. |
| 432 | |
| 433 | if (!OpenFile(Filename.toLocalFile().toStdString().c_str())) { |
| 434 | // This basically never happens because OpenFile performs no actual syntax checks. |
| 435 | // Treat as fatal since the UI state wouldn't be consistent after ignoring the error. |
| 436 | QMessageBox err(QMessageBox::Critical, tr("Could not load config file"), tr("Failed to load \"%1\"").arg(Filename.toLocalFile()), |
| 437 | QMessageBox::Ok); |
| 438 | err.exec(); |
| 439 | QApplication::exit(); |
| 440 | return; |
| 441 | } |
| 442 | |
| 443 | ConfigModelInst.Reload(); |
| 444 | RootFSList.Reload(); |
| 445 | HostLibs.Reload(Filename.toLocalFile().toStdString().c_str()); |
| 446 | |
| 447 | QMetaObject::invokeMethod(Window, "refreshUI"); |
| 448 | } |
| 449 | |
| 450 | int main(int Argc, char** Argv) { |
| 451 | QApplication App(Argc, Argv); |