MCPcopy Create free account
hub / github.com/ElyPrismLauncher/Launcher / InstallLoaderDialog

Method InstallLoaderDialog

launcher/ui/dialogs/InstallLoaderDialog.cpp:87–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87InstallLoaderDialog::InstallLoaderDialog(PackProfile* profile, const QString& uid, QWidget* parent)
88 : QDialog(parent), profile(profile), container(new PageContainer(this, QString(), this)), buttons(new QDialogButtonBox(this))
89{
90 auto layout = new QVBoxLayout(this);
91 // small margins look ugly on macOS on modal windows
92 #ifndef Q_OS_MACOS
93 layout->setContentsMargins(0, 0, 0, 0);
94 #endif
95 container->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
96 layout->addWidget(container);
97
98 auto buttonLayout = new QHBoxLayout(this);
99 // small margins look ugly on macOS on modal windows
100 #ifndef Q_OS_MACOS
101 buttonLayout->setContentsMargins(0, 0, 6, 6);
102 #endif
103 auto refreshButton = new QPushButton(tr("&Refresh"), this);
104 connect(refreshButton, &QPushButton::clicked, this, [this] { pageCast(container->selectedPage())->loadList(); });
105 buttonLayout->addWidget(refreshButton);
106
107 buttons->setOrientation(Qt::Horizontal);
108 buttons->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
109 buttons->button(QDialogButtonBox::Ok)->setText(tr("Ok"));
110 buttons->button(QDialogButtonBox::Cancel)->setText(tr("Cancel"));
111 connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept);
112 connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject);
113 buttonLayout->addWidget(buttons);
114
115 container->addButtons(buttonLayout);
116
117 setWindowTitle(dialogTitle());
118 setWindowModality(Qt::WindowModal);
119 resize(520, 347);
120
121 for (BasePage* page : container->getPages()) {
122 if (page->id() == uid)
123 container->selectPage(page->id());
124
125 connect(pageCast(page), &VersionSelectWidget::selectedVersionChanged, this, [this, page] {
126 if (page->id() == container->selectedPage()->id())
127 validate(container->selectedPage());
128 });
129 }
130 connect(container, &PageContainer::selectedPageChanged, this, [this](BasePage* previous, BasePage* current) { validate(current); });
131 pageCast(container->selectedPage())->selectSearch();
132 validate(container->selectedPage());
133}
134
135QList<BasePage*> InstallLoaderDialog::getPages()
136{

Callers

nothing calls this directly

Calls 12

dialogTitleFunction · 0.85
addButtonsMethod · 0.80
selectSearchMethod · 0.80
pageCastFunction · 0.70
QStringClass · 0.50
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