Permalink
Browse files

WIP saving of config for offline mode name modes

  • Loading branch information...
peterix committed Oct 17, 2018
1 parent b99167c commit cd2d3d00f8752f9c3b5e59757630a0a0513aeacc
View
@@ -487,6 +487,7 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
// Offline mode stuff
m_settings->registerSetting("OfflineModeNameMode", "UseAccountName");
m_settings->registerSetting("OfflineModeName", "Player");
// Window state and geometry
m_settings->registerSetting("MainWindowState", "");
@@ -68,6 +68,8 @@ AccountListPage::AccountListPage(QWidget *parent)
ui->offlineButtonGroup->setId(ui->rememberNamesForInstancesBtn, int(OfflineModeNameMode::RememberPerInstance));
ui->offlineButtonGroup->setId(ui->useFixedNameBtn, int(OfflineModeNameMode::UseFixedName));
connect(ui->offlineButtonGroup, SIGNAL(buttonToggled(int,bool)), this, SLOT(groupSelectionChanged(int,bool)));
updateButtonStates();
loadSettings();
}
@@ -191,6 +193,7 @@ void AccountListPage::applySettings()
s->set("OfflineModeNameMode", "UseFixedName");
break;
}
s->set("OfflineModeName", ui->mainOfflineNameEdit->text());
}
void AccountListPage::loadSettings()
@@ -213,4 +216,18 @@ void AccountListPage::loadSettings()
{
ui->useFixedNameBtn->setChecked(true);
}
ui->mainOfflineNameEdit->setText(s->get("OfflineModeName").toString());
}
void AccountListPage::groupSelectionChanged(int, bool)
{
auto sortMode = (OfflineModeNameMode)ui->offlineButtonGroup->checkedId();
if(sortMode == OfflineModeNameMode::UseFixedName)
{
ui->mainOfflineNameEdit->setEnabled(true);
}
else
{
ui->mainOfflineNameEdit->setEnabled(false);
}
}
@@ -74,6 +74,8 @@ public
void listChanged();
void groupSelectionChanged(int, bool);
//! Updates the states of the dialog's buttons.
void updateButtonStates();

0 comments on commit cd2d3d0

Please sign in to comment.