| 62 | } |
| 63 | |
| 64 | int CMainWindow::InitTab() |
| 65 | { |
| 66 | QWidget* pIce = nullptr; |
| 67 | #ifdef HAVE_ICE |
| 68 | QSettings set(RabbitCommon::CDir::Instance()->GetFileUserConfigure(), QSettings::IniFormat); |
| 69 | CICE::Instance()->GetParameter()->Load(set); |
| 70 | pIce = CICE::Instance()->GetParameterWidget(ui->twConfigure); |
| 71 | if(pIce) |
| 72 | { |
| 73 | // parameter widget must has slotAccept() |
| 74 | bool check = connect(this, SIGNAL(sigAccept()), pIce, SLOT(slotAccept())); |
| 75 | if(!check) |
| 76 | { |
| 77 | qCritical(App) << "Class" << pIce->metaObject()->className() |
| 78 | << "must has slot slotAccept(), please add it"; |
| 79 | } |
| 80 | Q_ASSERT(check); |
| 81 | int nIndex = ui->twConfigure->addTab(pIce, pIce->windowIcon(), |
| 82 | pIce->windowTitle()); |
| 83 | if(-1 == nIndex) |
| 84 | qCritical(App) << "addTab ice fail"; |
| 85 | } |
| 86 | #endif |
| 87 | |
| 88 | foreach(auto plugin, m_Plugins.m_Plugins) |
| 89 | { |
| 90 | CService* pService = plugin->NewService(); |
| 91 | if(!pService) continue; |
| 92 | pService->LoadConfigure(); |
| 93 | m_Service.push_back(pService); |
| 94 | QWidget* w = pService->GetParameterWidget(ui->twConfigure); |
| 95 | if(w) |
| 96 | { |
| 97 | // parameter widget must has slotAccept() |
| 98 | bool check = connect(this, SIGNAL(sigAccept()), w, SLOT(slotAccept())); |
| 99 | if(!check) |
| 100 | { |
| 101 | if(pIce) |
| 102 | qCritical(App) << "Class" << pIce->metaObject()->className() |
| 103 | << "must has slot slotAccept(), please add it"; |
| 104 | } |
| 105 | Q_ASSERT(check); |
| 106 | int nIndex = ui->twConfigure->addTab(w, plugin->Icon(), |
| 107 | plugin->DisplayName()); |
| 108 | if(-1 == nIndex) |
| 109 | qCritical(App) << "addTab fail"; |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | return 0; |
| 114 | } |
| 115 | |
| 116 | int CMainWindow::Clean() |
| 117 | { |
nothing calls this directly
no test coverage detected