void SettingsDialog::LoadSettings(AppSettings &s /* = settings */) { showConsoleCheck->SetValue(s.GetShowConsole()); autoCloseConsoleCheck->SetValue(s.GetAutoCloseConsole()); autoUpdateCheck->SetValue(s.GetAutoUpdate()); instDirTextBox->SetValue(s.GetInstDir().GetFullPath()); minMemorySpin->SetValue(s.GetMinMemAlloc()); maxMemorySpin->SetValue(s.GetMaxMemAlloc()); javaPathTextBox->SetValue(s.GetJavaPath()); jvmArgsTextBox->SetValue(s.GetJvmArgs()); switch (s.GetGUIMode()) { case GUI_Simple: guiStyleDropDown->SetValue(guiModeSimple); break; case GUI_Default: guiStyleDropDown->SetValue(guiModeDefault); break; } }
void SettingsDialog::ApplySettings(AppSettings &s /* = settings */) { s.SetShowConsole(showConsoleCheck->IsChecked()); s.SetAutoCloseConsole(autoCloseConsoleCheck->IsChecked()); s.SetAutoUpdate(autoUpdateCheck->IsChecked()); wxFileName newInstDir = wxFileName::DirName(instDirTextBox->GetValue()); if (!s.GetInstDir().SameAs(newInstDir)) { wxFileName oldInstDir = s.GetInstDir(); int response = wxMessageBox( _T("You've changed your instance directory, would you like to transfer all of your instances?"), _T("Instance directory changed."), wxYES | wxNO | wxCANCEL | wxCENTER, this); RetryTransfer: if (response != wxCANCEL) { s.SetInstDir(newInstDir); } if (response == wxYES) { wxDir instDir(oldInstDir.GetFullPath()); wxString oldDirName; if (instDir.GetFirst(&oldDirName)) { do { oldDirName = Path::Combine(oldInstDir, oldDirName); wxFileName newDirName(oldDirName); newDirName.MakeRelativeTo(oldInstDir.GetFullPath()); newDirName.Normalize(wxPATH_NORM_ALL, newInstDir.GetFullPath()); if (!wxRenameFile(oldDirName, newDirName.GetFullPath(), false)) { wxLogError(_("Failed to move instance folder %s."), oldDirName.c_str()); } } while (instDir.GetNext(&oldDirName)); } } } s.SetMinMemAlloc(minMemorySpin->GetValue()); s.SetMaxMemAlloc(maxMemorySpin->GetValue()); s.SetJavaPath(javaPathTextBox->GetValue()); s.SetJvmArgs(jvmArgsTextBox->GetValue()); GUIMode newGUIMode; if (guiStyleDropDown->GetValue() == guiModeDefault) newGUIMode = GUI_Default; else if (guiStyleDropDown->GetValue() == guiModeSimple) newGUIMode = GUI_Simple; if (newGUIMode != s.GetGUIMode()) { s.SetGUIMode(newGUIMode); wxMessageBox(_("Changing the GUI style requires a restart in order to take effect. Please restart MultiMC."), _("Restart Required")); } }