1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-23 04:57:44 +00:00

Make profile select on launcher functional

This commit is contained in:
redstrate 2021-11-09 12:36:09 -05:00
parent 5367342bd9
commit 6fc04db134
2 changed files with 16 additions and 0 deletions

View file

@ -258,6 +258,9 @@ LauncherWindow::LauncherWindow(QWidget* parent) :
auto layout = new QFormLayout();
profileSelect = new QComboBox();
connect(profileSelect, &QComboBox::currentIndexChanged, [=](int index) {
reloadControls();
});
layout->addRow("Profile", profileSelect);
@ -389,12 +392,21 @@ void LauncherWindow::saveSettings() {
}
void LauncherWindow::reloadControls() {
if(currentlyReloadingControls)
return;
currentlyReloadingControls = true;
const int oldIndex = profileSelect->currentIndex();
profileSelect->clear();
for(const auto& profile : profileList()) {
profileSelect->addItem(profile);
}
profileSelect->setCurrentIndex(oldIndex);
if(profileSelect->currentIndex() == -1) {
profileSelect->setCurrentIndex(defaultProfileIndex);
}
@ -423,4 +435,6 @@ void LauncherWindow::reloadControls() {
registerButton->setEnabled(currentProfile().isSapphire);
otpEdit->setEnabled(!currentProfile().isSapphire);
currentlyReloadingControls = false;
}

View file

@ -76,6 +76,8 @@ signals:
void settingsChanged();
private:
bool currentlyReloadingControls = false;
SapphireLauncher* sapphireLauncher;
SquareBoot* squareBoot;
SquareLauncher* squareLauncher;