| 33 | { |
| 34 | |
| 35 | ProviderWidget::ProviderWidget(QWidget *parent) |
| 36 | : IProjectProviderWidget(parent) |
| 37 | { |
| 38 | auto* widgetLayout = new QVBoxLayout; |
| 39 | widgetLayout->setContentsMargins(0, 0, 0, 0); |
| 40 | setLayout(widgetLayout); |
| 41 | |
| 42 | m_projects = new QListView(this); |
| 43 | connect(m_projects, &QListView::clicked, this, &ProviderWidget::projectIndexChanged); |
| 44 | |
| 45 | m_waiting = new QLabel(i18n("Waiting for response"), this); |
| 46 | m_waiting->setAlignment(Qt::AlignCenter); |
| 47 | m_waiting->hide(); |
| 48 | |
| 49 | auto *model = new ProviderModel(this); |
| 50 | m_projects->setModel(model); |
| 51 | m_projects->setEditTriggers(QAbstractItemView::NoEditTriggers); |
| 52 | m_resource = new Resource(this, model); |
| 53 | m_account = new Account(m_resource); |
| 54 | connect(m_resource, &Resource::reposUpdated, m_waiting, &QLabel::hide); |
| 55 | |
| 56 | auto *topLayout = new QHBoxLayout(); |
| 57 | m_edit = new LineEdit(this); |
| 58 | m_edit->setPlaceholderText(i18nc("@info:placeholder", "Search...")); |
| 59 | m_edit->setToolTip(i18nc("@info:tooltip", "You can press the Return key if you do not want to wait.")); |
| 60 | connect(m_edit, &LineEdit::returnPressed, this, &ProviderWidget::searchRepo); |
| 61 | topLayout->addWidget(m_edit); |
| 62 | |
| 63 | m_combo = new QComboBox(this); |
| 64 | m_combo->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); |
| 65 | connect(m_combo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ProviderWidget::searchRepo); |
| 66 | fillCombo(); |
| 67 | topLayout->addWidget(m_combo); |
| 68 | |
| 69 | auto* settings = new QPushButton(QIcon::fromTheme(QStringLiteral("configure")), QString(), this); |
| 70 | settings->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); |
| 71 | settings->setToolTip(i18nc("@info:tooltip", "Configure your GitHub account")); |
| 72 | connect(settings, &QPushButton::clicked, this, &ProviderWidget::showSettings); |
| 73 | topLayout->addWidget(settings); |
| 74 | |
| 75 | layout()->addItem(topLayout); |
| 76 | layout()->addWidget(m_waiting); |
| 77 | layout()->addWidget(m_projects); |
| 78 | } |
| 79 | |
| 80 | KDevelop::VcsJob * ProviderWidget::createWorkingCopy(const QUrl &dest) |
| 81 | { |
nothing calls this directly
no test coverage detected