| 22 | using namespace KDevelop; |
| 23 | |
| 24 | ProjectVcsPage::ProjectVcsPage( KDevelop::IPluginController* controller, QWidget * parent ) |
| 25 | : AppWizardPageWidget(parent) |
| 26 | , m_currentImportWidget(nullptr) |
| 27 | , m_ui(new Ui::ProjectVcsPage) |
| 28 | { |
| 29 | m_ui->setupUi( this ); |
| 30 | const QList<KDevelop::IPlugin*> vcsplugins = controller->allPluginsForExtension(QStringLiteral("org.kdevelop.IBasicVersionControl")); |
| 31 | int idx = 1; |
| 32 | m_ui->vcsImportOptions->insertWidget( 0, new QWidget(this) ); |
| 33 | m_ui->vcsTypes->insertItem( 0, i18nc("@item:inlistbox No Version Control Support chosen", "None") ); |
| 34 | for (KDevelop::IPlugin* plugin : vcsplugins) { |
| 35 | auto* iface = plugin->extension<KDevelop::IBasicVersionControl>(); |
| 36 | if( iface ) |
| 37 | { |
| 38 | KDevelop::VcsImportMetadataWidget* widget = iface->createImportMetadataWidget( |
| 39 | m_ui->vcsImportOptions ); |
| 40 | if( widget ) |
| 41 | { |
| 42 | // untranslated on purpose, as English might be lingua franca at most target users |
| 43 | // perhaps make default string configurable if people request it |
| 44 | widget->setMessage(QStringLiteral("Initial import")); |
| 45 | widget->setSourceLocationEditable( false ); |
| 46 | widget->setUseSourceDirForDestination( true ); |
| 47 | m_ui->vcsTypes->insertItem( idx, iface->name() ); |
| 48 | importWidgets.push_back( widget ); |
| 49 | vcsPlugins.push_back( qMakePair( controller->pluginInfo( plugin ).pluginId(), iface->name() ) ); |
| 50 | m_ui->vcsImportOptions->insertWidget( idx, widget ); |
| 51 | idx++; |
| 52 | } |
| 53 | } |
| 54 | } |
| 55 | connect( m_ui->vcsTypes, QOverload<int>::of(&KComboBox::activated), |
| 56 | m_ui->vcsImportOptions, &QStackedWidget::setCurrentIndex ); |
| 57 | connect( m_ui->vcsTypes, QOverload<int>::of(&KComboBox::activated), |
| 58 | this, &ProjectVcsPage::vcsTypeChanged ); |
| 59 | vcsTypeChanged(m_ui->vcsTypes->currentIndex()); |
| 60 | } |
| 61 | |
| 62 | |
| 63 | void ProjectVcsPage::vcsTypeChanged( int idx ) |
nothing calls this directly
no test coverage detected