| 89 | } |
| 90 | |
| 91 | InstallLoaderDialog::InstallLoaderDialog(std::shared_ptr<PackProfile> profile, const QString& uid, QWidget* parent) |
| 92 | : QDialog(parent), profile(std::move(profile)), container(new PageContainer(this, QString(), this)), buttons(new QDialogButtonBox(this)) |
| 93 | { |
| 94 | auto layout = new QVBoxLayout(this); |
| 95 | |
| 96 | container->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); |
| 97 | layout->addWidget(container); |
| 98 | |
| 99 | auto buttonLayout = new QHBoxLayout(this); |
| 100 | |
| 101 | auto refreshButton = new QPushButton(tr("&Refresh"), this); |
| 102 | connect(refreshButton, &QPushButton::clicked, this, [this] { pageCast(container->selectedPage())->loadList(); }); |
| 103 | buttonLayout->addWidget(refreshButton); |
| 104 | |
| 105 | buttons->setOrientation(Qt::Horizontal); |
| 106 | buttons->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok); |
| 107 | buttons->button(QDialogButtonBox::Ok)->setText(tr("Ok")); |
| 108 | buttons->button(QDialogButtonBox::Cancel)->setText(tr("Cancel")); |
| 109 | connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept); |
| 110 | connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject); |
| 111 | buttonLayout->addWidget(buttons); |
| 112 | |
| 113 | layout->addLayout(buttonLayout); |
| 114 | |
| 115 | setWindowTitle(dialogTitle()); |
| 116 | setWindowModality(Qt::WindowModal); |
| 117 | resize(520, 347); |
| 118 | |
| 119 | for (BasePage* page : container->getPages()) { |
| 120 | if (page->id() == uid) |
| 121 | container->selectPage(page->id()); |
| 122 | |
| 123 | connect(pageCast(page), &VersionSelectWidget::selectedVersionChanged, this, [this, page] { |
| 124 | if (page->id() == container->selectedPage()->id()) |
| 125 | validate(container->selectedPage()); |
| 126 | }); |
| 127 | } |
| 128 | connect(container, &PageContainer::selectedPageChanged, this, [this](BasePage* previous, BasePage* current) { validate(current); }); |
| 129 | pageCast(container->selectedPage())->selectSearch(); |
| 130 | validate(container->selectedPage()); |
| 131 | } |
| 132 | |
| 133 | QList<BasePage*> InstallLoaderDialog::getPages() |
| 134 | { |
nothing calls this directly
no test coverage detected