For time-consuming operations
| 436 | |
| 437 | //! For time-consuming operations |
| 438 | int MainWindow::Initial() |
| 439 | { |
| 440 | qDebug(log) << Q_FUNC_INFO; |
| 441 | |
| 442 | int nRet = 0; |
| 443 | QString szErr; |
| 444 | |
| 445 | setEnabled(false); |
| 446 | do { |
| 447 | QMessageBox initMsgBox(QMessageBox::Information, tr("Load"), tr("Load ......")); |
| 448 | initMsgBox.showNormal(); |
| 449 | qApp->processEvents(); |
| 450 | |
| 451 | QString szMsg; |
| 452 | szMsg = tr("Load plugins ......"); |
| 453 | initMsgBox.setText(szMsg); |
| 454 | slotInformation(szMsg); |
| 455 | qApp->processEvents(); |
| 456 | nRet = m_Manager.Initial(); |
| 457 | if(nRet) { |
| 458 | szErr = tr("Initial manage error"); |
| 459 | break; |
| 460 | } |
| 461 | m_Manager.EnumPlugins(this); |
| 462 | |
| 463 | auto pg = m_Manager.GetGlobalParameters(); |
| 464 | if(pg) { |
| 465 | //m_Parameter.SetGlobalParameters(pg); |
| 466 | bool bRet = QMetaObject::invokeMethod( |
| 467 | &m_Parameter, |
| 468 | "SetGlobalParameters", |
| 469 | Qt::DirectConnection, |
| 470 | Q_ARG(CParameterGlobal*, pg)); |
| 471 | if(!bRet) { |
| 472 | szErr = tr("Failed to set global parameters"); |
| 473 | qCritical(log) << szErr; |
| 474 | nRet = -1; |
| 475 | break; |
| 476 | } |
| 477 | } |
| 478 | |
| 479 | if(m_pRecent) { |
| 480 | szMsg = tr("Load list recent dock ......"); |
| 481 | initMsgBox.setText(szMsg); |
| 482 | slotInformation(szMsg); |
| 483 | qApp->processEvents(); |
| 484 | nRet = m_pRecent->Initial(); |
| 485 | if(nRet) { |
| 486 | szErr = tr("Initial recent dock error"); |
| 487 | break; |
| 488 | } |
| 489 | } |
| 490 | |
| 491 | if(m_pRecentMenu) { |
| 492 | szMsg = tr("Load recent menu ......"); |
| 493 | initMsgBox.setText(szMsg); |
| 494 | slotInformation(szMsg); |
| 495 | qApp->processEvents(); |
no test coverage detected