void CBf1View::OnSettingsDialog() { // Create dialog object CSettingsDialog aDlg; // Set data members // emg aDlg.emg_channel = emg_chan; aDlg.emg_sens = emg_sens; aDlg.emg_samp_period = emg_samp_period; // bayesian filter ba_filt.GetSettings(aDlg.bayes_thresh,aDlg.bayes_max, aDlg.bayes_switch,aDlg.bayes_drift); // vibration aDlg.vib_com = vib_com; aDlg.vib_bay_max0 = vib_bay_max0; aDlg.vib_bay_min100 = vib_bay_min100; aDlg.vib_mean_mvc = vib_mean_mvc; aDlg.vib_mean_max0 = vib_mean_max0; aDlg.vib_mean_min100 = vib_mean_min100; // Display the dialog modal, change things if okay if(aDlg.DoModal() == IDOK) { // Close port and stop sampling if these are happening if(bBfOpenandSet) OnBfClose(); if(bSampleTimer) OnSampleStop(); // Make changes // emg emg_chan = aDlg.emg_channel; emg_sens = aDlg.emg_sens; emg_samp_period = aDlg.emg_samp_period; // bayesian filter: create a new filter ba_filt = BayesFilter(aDlg.bayes_thresh,aDlg.bayes_max, aDlg.bayes_switch,aDlg.bayes_drift); // vibration vib_com = aDlg.vib_com; vib_bay_max0 = aDlg.vib_bay_max0; vib_bay_min100 = aDlg.vib_bay_min100; vib_mean_mvc = aDlg.vib_mean_mvc; vib_mean_max0 = aDlg.vib_mean_max0; vib_mean_min100 = aDlg.vib_mean_min100; } // Update the view to show most recent values GetDocument()->UpdateAllViews(NULL); }
INT_PTR CSettingsDialog::dialogProc(HWND handle, UINT message, WPARAM wParam, LPARAM lParam) { if (message == WM_INITDIALOG) { CSettingsDialog* dialog = reinterpret_cast<CSettingsDialog*>(lParam); SetWindowLongPtr(handle, GWLP_USERDATA, (LONG)dialog); dialog->OnInit(handle); return TRUE; } CSettingsDialog* dialog = reinterpret_cast<CSettingsDialog*>(GetWindowLongPtr(handle, GWLP_USERDATA)); switch (message) { case WM_COMMAND: { return dialog->OnCommand(wParam); } } return FALSE; }
int ShowSettingsDialog() { ActionStatus status; RegistryKey key(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Services\\BazisVirtualCDBus\\Parameters"), 0, true, &status); if (!key.Valid() && (status.GetErrorCode() == AccessDenied)) { TCHAR tsz[MAX_PATH + 2] = {0,}; tsz[0] = '\"'; GetModuleFileName(GetModuleHandle(0), tsz + 1, _countof(tsz) - 1); size_t len = _tcslen(tsz); tsz[len] = '\"'; tsz[len + 1] = 0; return (int)CUACInvokerDialog(tsz).DoModal(); } else { CSettingsDialog dlg; dlg.DoModal(); } return 0; }
void CFileUploaderDialog::OnSysCommand (UINT nID, LPARAM lParam) { if ((nID & 0xFFF0) == IDM_SETTINGS) { CSettingsDialog oDialog; if (IDOK == oDialog.DoModal ()) { // Set WSF/C Home s_WSFCHome = oDialog.s_WSFCHome; // Save WSF/C Home CRegKey regKey; LONG lResult; lResult = regKey.Create (HKEY_CURRENT_USER, _T("Software\\WSO2\\WeSCli\\FlickrUploader")); if (ERROR_SUCCESS == lResult) regKey.SetStringValue (_T("WSFCHome"), s_WSFCHome); } } CDialog::OnSysCommand (nID, lParam); }
void CMainWindow::openSettingsDialog() { CSettingsDialog settings; settings.addSettingsPage(new CSettingsPageInterface); settings.addSettingsPage(new CSettingsPageOperations); settings.addSettingsPage(new CSettingsPageEdit); settings.addSettingsPage(new CSettingsPageOther); connect(&settings, &CSettingsDialog::settingsChanged, this, &CMainWindow::settingsChanged); settings.exec(); }
TBool CProfileListDialog::OkToExitL(TInt aButtonId) { TBool okToExit = EFalse; CEikTextListBox *lbox = ((CEikTextListBox*)Control(EProfileListDlgProfileList)); // Buffers for current and new file names and a name HBufC *fileNameBuf = HBufC::NewLC(KMaxFileName); TPtr fileName = fileNameBuf->Des(); HBufC *nameBuf = HBufC::NewLC(KMaxFileName); TPtr name = nameBuf->Des(); switch ( aButtonId ) { case ECmdProfileListConnect: { // Connect to the selected profile TInt sel = lbox->CurrentItemIndex(); if ( sel == KDefaultProfileIndex ) { iProfileFile = iDefaultProfileFile; } else { iProfileFile = iProfileDirectory; iProfileFile.Append((*iProfileArray)[sel]); } okToExit = ETrue; break; } case ECmdProfileListEdit: { // Edit the selected profile TInt sel = lbox->CurrentItemIndex(); if ( sel == KDefaultProfileIndex ) { name = KDefaultProfileName; fileName = iDefaultProfileFile; } else { name = (*iProfileArray)[sel]; fileName = iProfileDirectory; fileName.Append(name); } // Edit settings iPutty->ReadConfigFileL(fileName); Config *cfg = iPutty->GetConfig(); CSettingsDialog *dlg = new (ELeave) CSettingsDialog(name, (sel == KDefaultProfileIndex), cfg, iPutty); switch ( dlg->ExecuteLD(R_SETTINGS_DIALOG) ) { case EEikBidOk: // Handle rename first if ( (sel != KDefaultProfileIndex) && (name.Compare((*iProfileArray)[sel]) != 0) ) { MakeNameLegal(name); // Delete current file so that we can rename to a file // that maps to the same name (e.g. changes in case) User::LeaveIfError( CEikonEnv::Static()->FsSession().Delete(fileName)); MakeNameUniqueL(name); fileName = iProfileDirectory; fileName.Append(name); // Update profile list and listbox iProfileArray->Delete(sel); iProfileArray->InsertL(sel, name); lbox->DrawNow(); } // Just write, the name can be an old one or a renamed one iPutty->WriteConfigFileL(fileName); break; case ECmdSettingsDelete: if ( sel != KDefaultProfileIndex ) { // Remove the profile from the list and update // listbox iProfileArray->Delete(sel); lbox->HandleItemRemovalL(); if ( sel >= iProfileArray->Count() ) { sel = iProfileArray->Count() - 1; } lbox->SetCurrentItemIndexAndDraw(sel); // Delete profile file User::LeaveIfError( CEikonEnv::Static()->FsSession().Delete(fileName)); } break; default: break; } okToExit = EFalse; break; } case ECmdProfileListNew: { // New profile -- start with defaults, but with a new name iPutty->ReadConfigFileL(iDefaultProfileFile); Config *cfg = iPutty->GetConfig(); name = KNewProfileName; MakeNameUniqueL(name); CSettingsDialog *dlg = new (ELeave) CSettingsDialog(name, EFalse, cfg, iPutty); if ( dlg->ExecuteLD(R_SETTINGS_DIALOG) == EEikBidOk ) { // Finalize name MakeNameLegal(name); MakeNameUniqueL(name); fileName = iProfileDirectory; fileName.Append(name); // Update the listbox iProfileArray->AppendL(name); lbox->HandleItemAdditionL(); lbox->SetCurrentItemIndexAndDraw(iProfileArray->Count() - 1); // Write out new settings iPutty->WriteConfigFileL(fileName); } okToExit = EFalse; break; } case ECmdProfileListClose: okToExit = ETrue; break; default: User::Invariant(); } CleanupStack::PopAndDestroy(2); //fileNameBuf, nameBuf return okToExit; }
// OnEditSettings() // Display settings dialog. void CEventHandlerApp::OnEditSettings() { CSettingsDialog dlgSettings; dlgSettings.DoModal(); }