| 99 | } |
| 100 | |
| 101 | void ProjectSourcePage::setSourceWidget(int index, const QUrl& repoUrl) |
| 102 | { |
| 103 | m_locationWidget = nullptr; |
| 104 | m_providerWidget = nullptr; |
| 105 | QLayoutItem *child; |
| 106 | while ((child = m_ui->remoteWidgetLayout->takeAt(0)) != nullptr) { |
| 107 | delete child->widget(); |
| 108 | delete child; |
| 109 | } |
| 110 | |
| 111 | IBasicVersionControl* vcIface = vcsPerIndex(index); |
| 112 | IProjectProvider* providerIface; |
| 113 | bool found=false; |
| 114 | if(vcIface) { |
| 115 | found=true; |
| 116 | m_locationWidget=vcIface->vcsLocation(m_ui->sourceBox); |
| 117 | connect(m_locationWidget, &VcsLocationWidget::changed, this, &ProjectSourcePage::locationChanged); |
| 118 | |
| 119 | // set after connect, to trigger handler |
| 120 | if (!repoUrl.isEmpty()) { |
| 121 | m_locationWidget->setLocation(repoUrl); |
| 122 | } |
| 123 | m_ui->remoteWidgetLayout->addWidget(m_locationWidget); |
| 124 | } else { |
| 125 | providerIface = providerPerIndex(index); |
| 126 | if(providerIface) { |
| 127 | found=true; |
| 128 | m_providerWidget=providerIface->providerWidget(m_ui->sourceBox); |
| 129 | connect(m_providerWidget, &IProjectProviderWidget::changed, this, &ProjectSourcePage::projectChanged); |
| 130 | |
| 131 | m_ui->remoteWidgetLayout->addWidget(m_providerWidget); |
| 132 | } |
| 133 | } |
| 134 | reevaluateCorrection(); |
| 135 | |
| 136 | m_ui->sourceBox->setVisible(found); |
| 137 | } |
| 138 | |
| 139 | IBasicVersionControl* ProjectSourcePage::vcsPerIndex(int index) |
| 140 | { |
nothing calls this directly
no test coverage detected