MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / InstallLoaderDialog

Method InstallLoaderDialog

launcher/ui/dialogs/InstallLoaderDialog.cpp:91–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91InstallLoaderDialog::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
133QList<BasePage*> InstallLoaderDialog::getPages()
134{

Callers

nothing calls this directly

Calls 12

moveFunction · 0.85
QStringClass · 0.85
dialogTitleFunction · 0.85
selectSearchMethod · 0.80
pageCastFunction · 0.70
validateFunction · 0.50
loadListMethod · 0.45
selectedPageMethod · 0.45
setTextMethod · 0.45
getPagesMethod · 0.45
idMethod · 0.45
selectPageMethod · 0.45

Tested by

no test coverage detected