! * \brief Start * \param p: COperate instance pointer * \param set: whether open settings dialog. * true: open settings dialog and save configure file * false: don't open settings dialog * \param szFile: Configure file. * if is empty. the use default configure file. * \return */
| 1033 | * \return |
| 1034 | */ |
| 1035 | int MainWindow::Start(COperate *pOperate, bool set, QString szFile) |
| 1036 | { |
| 1037 | qDebug(log) << "MainWindow::Start: set:" << set << "; File:" << szFile; |
| 1038 | bool bSave = false; //whether is save configure file |
| 1039 | Q_ASSERT(pOperate); |
| 1040 | bool check = connect(pOperate, SIGNAL(sigRunning()), |
| 1041 | this, SLOT(slotRunning())); |
| 1042 | Q_ASSERT(check); |
| 1043 | check = connect(pOperate, SIGNAL(sigStop()), |
| 1044 | this, SLOT(slotStop())); |
| 1045 | Q_ASSERT(check); |
| 1046 | check = connect(pOperate, SIGNAL(sigFinished()), |
| 1047 | this, SLOT(slotFinished())); |
| 1048 | Q_ASSERT(check); |
| 1049 | check = connect(pOperate, SIGNAL(sigError(const int, const QString &)), |
| 1050 | this, SLOT(slotError(const int, const QString&))); |
| 1051 | Q_ASSERT(check); |
| 1052 | check = connect(pOperate, SIGNAL(sigShowMessageBox(const QString&, const QString&, |
| 1053 | const QMessageBox::Icon&)), |
| 1054 | this, SLOT(slotShowMessageBox(const QString&, const QString&, |
| 1055 | const QMessageBox::Icon&))); |
| 1056 | Q_ASSERT(check); |
| 1057 | check = connect(pOperate, SIGNAL(sigInformation(const QString&)), |
| 1058 | this, SLOT(slotInformation(const QString&))); |
| 1059 | Q_ASSERT(check); |
| 1060 | check = connect(pOperate, SIGNAL(sigUpdateName(const QString&)), |
| 1061 | this, SLOT(slotUpdateName(const QString&))); |
| 1062 | Q_ASSERT(check); |
| 1063 | check = connect(pOperate, SIGNAL(sigUpdateParameters(COperate*)), |
| 1064 | this, SLOT(slotUpdateParameters(COperate*))); |
| 1065 | Q_ASSERT(check); |
| 1066 | check = connect(pOperate, &COperate::sigFullScreen, |
| 1067 | this, [this, pOperate](bool bFull) { |
| 1068 | if(m_pView && m_pView->GetCurrentView() == pOperate->GetViewer()) { |
| 1069 | if((bFull && !isFullScreen()) || (!bFull && isFullScreen())) |
| 1070 | on_actionFull_screen_F_triggered(); |
| 1071 | } |
| 1072 | }); |
| 1073 | Q_ASSERT(check); |
| 1074 | check = connect(pOperate, &COperate::sigSecurityLevel, |
| 1075 | this, [this, pOperate]() { |
| 1076 | if(m_pView && pOperate) { |
| 1077 | if(m_pView->GetCurrentView() == pOperate->GetViewer()) |
| 1078 | slotCurrentViewChanged(pOperate->GetViewer()); |
| 1079 | } |
| 1080 | }); |
| 1081 | Q_ASSERT(check); |
| 1082 | |
| 1083 | if(set) |
| 1084 | { |
| 1085 | int nRet = pOperate->OpenDialogSettings(this); |
| 1086 | switch(nRet) |
| 1087 | { |
| 1088 | case QDialog::Rejected: |
| 1089 | m_Manager.DeleteOperate(pOperate); |
| 1090 | return 0; |
| 1091 | case QDialog::Accepted: |
| 1092 | bSave = true; |
no test coverage detected