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:
parent
5367342bd9
commit
6fc04db134
2 changed files with 16 additions and 0 deletions
|
@ -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;
|
||||
}
|
|
@ -76,6 +76,8 @@ signals:
|
|||
void settingsChanged();
|
||||
|
||||
private:
|
||||
bool currentlyReloadingControls = false;
|
||||
|
||||
SapphireLauncher* sapphireLauncher;
|
||||
SquareBoot* squareBoot;
|
||||
SquareLauncher* squareLauncher;
|
||||
|
|
Loading…
Add table
Reference in a new issue