CreateProjectDialog::CreateProjectDialog(QWidget *parent) : QDialog(parent), ui(new Ui::CreateProjectDialog) { ui->setupUi(this); connect(ui->projectName, SIGNAL(textChanged(QString)), this, SLOT(OnProjectNameChange(QString))); connect(ui->projectDirectory, SIGNAL(textChanged(QString)), this, SLOT(OnProjectDirectoryChange(QString))); connect(ui->browseButton, SIGNAL(clicked()), this, SLOT(OnBrowseButtonClick())); connect(ui->useSameDir, SIGNAL(toggled(bool)), this, SLOT(SetChooseButtonsActive(bool))); connect(ui->chooseFort10, SIGNAL(clicked()), this, SLOT(ChooseFile())); connect(ui->chooseFort11, SIGNAL(clicked()), this, SLOT(ChooseFile())); connect(ui->chooseFort13, SIGNAL(clicked()), this, SLOT(ChooseFile())); connect(ui->chooseFort14, SIGNAL(clicked()), this, SLOT(ChooseFile())); connect(ui->chooseFort15, SIGNAL(clicked()), this, SLOT(ChooseFile())); connect(ui->chooseFort19, SIGNAL(clicked()), this, SLOT(ChooseFile())); connect(ui->chooseFort20, SIGNAL(clicked()), this, SLOT(ChooseFile())); connect(ui->chooseFort22, SIGNAL(clicked()), this, SLOT(ChooseFile())); connect(ui->chooseFort23, SIGNAL(clicked()), this, SLOT(ChooseFile())); connect(ui->chooseFort24, SIGNAL(clicked()), this, SLOT(ChooseFile())); connect(ui->fort14Loc, SIGNAL(editingFinished()), this, SLOT(Fort14Changed())); ui->projectDirectory->setText(QDir::toNativeSeparators((QDir::homePath() + QDir::separator()))); projectDirectory = ui->projectDirectory->text(); projectName = ui->projectName->text(); CheckForMinimumFields(); ui->projectName->selectAll(); }
int _tmain(int argc, _TCHAR* argv[]) { ChooseFile(); ChooseAddress(); CopyFileBegin(); return 0; }
ChoseDataPage::ChoseDataPage(QWidget* parent): QWizardPage(parent) { setTitle(tr("IMPORT_CHOSE_DATA_TITLE")); gridLayout = new QGridLayout(this); label = new QLabel(this); label->setObjectName(QString::fromUtf8("label")); gridLayout->addWidget(label, 0, 0, 1, 3); pushButton = new QPushButton(this); pushButton->setText(tr("BROWSE")); connect(pushButton, SIGNAL(clicked()), SLOT(ChooseFile())); gridLayout->addWidget(pushButton, 1, 2, 1, 1); lineEdit = new QLineEdit(this); gridLayout->addWidget(lineEdit, 1, 0, 1, 1); verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); gridLayout->addItem(verticalSpacer, 2, 0, 1, 3); registerField("CustomDataPath", this, "CustomDataPath"); setLayout(gridLayout); }
void OnSelectCoreFile(wxCommandEvent&) { m_corefile->SetValue(ChooseFile(m_corefile->GetValue(), wxT("Choose core dump file"), wxT("core dump file (core*)|core*|all files|*"))); }
void OnSelectExecutable(wxCommandEvent&) { m_img->SetValue(ChooseFile(m_img->GetValue(), wxT("Choose executable file"), wxT("executable file (*)|*"))); }
void MainWindow::on_toolButton_4_clicked() { ui->LogEdit->setText(ChooseFile(ui->LogEdit->text())); }
INT_PTR CALLBACK ControlDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { // These will be garbage in WM_INITDIALOG, but we're not using them there anyway, so who cares LPBLENDSETTINGS settings = (LPBLENDSETTINGS)GetWindowLongPtr(hDlg, GWLP_USERDATA); LPBLENDRESULT results = (LPBLENDRESULT)(settings + 1); HWND *imgWindows = (HWND*)(results + 1); switch (uMsg) { case WM_INITDIALOG: { // Check the serial radio button by default HWND hwndSerialRadioBtn = GetDlgItem(hDlg, IDC_RADIO_SERIAL); SendMessage(hwndSerialRadioBtn, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); // Allocate space for BLENDSETTINGS, BLENDRESULT and the HWNDs to display the images (one for the image, one for the kernel, and one for the blend result) LPVOID userData = (LPVOID)malloc(sizeof(BLENDSETTINGS) + sizeof(BLENDRESULT) + sizeof(HWND) * 3); // Allocate space for the file names LPBLENDSETTINGS blendSettings = (LPBLENDSETTINGS)userData; blendSettings->lpszImageFile = (TCHAR*)malloc(sizeof(TCHAR) * FILENAME_SIZE); blendSettings->lpszKernelFile = (TCHAR*)malloc(sizeof(TCHAR) * FILENAME_SIZE); LPBLENDRESULT blendResult = (LPBLENDRESULT)(blendSettings + 1); blendResult->hwndNotifyWindow = hDlg; blendResult->bufs[BLENDRESULT_IMAGE].pixels = NULL; blendResult->bufs[BLENDRESULT_KERNEL].pixels = NULL; blendResult->bufs[BLENDRESULT_BLENDED].pixels = NULL; // Initialise the display windows HWND *displayWindows = (HWND*)(blendResult + 1); displayWindows[0] = (HWND)INVALID_HANDLE_VALUE; displayWindows[1] = (HWND)INVALID_HANDLE_VALUE; displayWindows[2] = (HWND)INVALID_HANDLE_VALUE; SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR)userData); return TRUE; } case WM_BLENDFINISHED: { DWORD dwError = wParam; switch (dwError) { case BLEND_GENERAL_FAILURE: MessageBox(NULL, TEXT("The images could not be blended for some reason. Please try again later."), TEXT("General Failure"), MB_ICONERROR); return TRUE; case BLEND_KERNEL_2LARGE: MessageBox(NULL, TEXT("The kernel image was too large. Its maximum dimensions must be those of the image to blend. Please select another kernel."), TEXT("Kernel Too Large"), MB_ICONERROR); return TRUE; } // Set the amount of time taken HWND hwndTimeMessage = GetDlgItem(hDlg, IDC_PROC_TIME_TXT); TCHAR buf[128] = { 0 }; _sntprintf_s(buf, _countof(buf), TEXT("Processing Time (ms): %.3f"), results->processTime); SetWindowText(hwndTimeMessage, buf); // Re-enable the start button EnableWindow(GetDlgItem(hDlg, IDSTART), TRUE); // Create the windows if we haven't already if (imgWindows[0] == (HWND)INVALID_HANDLE_VALUE) { HINSTANCE hInst = (HINSTANCE)GetWindowLongPtr(hDlg, GWLP_HINSTANCE); InitImageWindow(&imgWindows[BLENDRESULT_IMAGE], hDlg, hInst, TEXT("Original Image")); InitImageWindow(&imgWindows[BLENDRESULT_KERNEL], hDlg, hInst, TEXT("Kernel Image")); InitImageWindow(&imgWindows[BLENDRESULT_BLENDED], hDlg, hInst, TEXT("Blended Image")); for (int i = 0; i < 3; i++) { ShowWindow(imgWindows[i], SW_SHOW); } } for (int i = 0; i < 3; i++) { LPOFFSCREENBUFFER oldBuf = (LPOFFSCREENBUFFER)GetWindowLongPtr(imgWindows[i], IMG_GWLP_OFFSCREENBUFFER); LPOFFSCREENBUFFER newBuf = &results->bufs[i]; // Set the new pixels DWORD newSize = (DWORD)(DIB_WIDTHBYTES(newBuf->width * newBuf->bytesPerPixel * 8) * newBuf->height); oldBuf->pixels = realloc(oldBuf->pixels, newSize); memcpy(oldBuf->pixels, newBuf->pixels, newSize); // Copy over the new bitmap info memcpy(&oldBuf->info, &newBuf->info, sizeof(BITMAPINFO)); oldBuf->height = newBuf->height; oldBuf->width = newBuf->width; SetWindowPos(imgWindows[i], 0, 0, 0, newBuf->width, newBuf->height, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); UpdateWindow(imgWindows[i]); } return TRUE; } case WM_CLOSE: /* there are more things to go here, */ DestroyWindow(hDlg); return TRUE; case WM_DESTROY: // TODO: Destroy the child windows and tell them to free any memory they have // Free the settings object free(settings->lpszImageFile); free(settings->lpszKernelFile); // settings is actually the pointer to the whole buffer, so we need to free it last free(settings); PostQuitMessage(0); return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_IMG_BROWSE: ChooseFile(hDlg, GetDlgItem(hDlg, IDC_IMAGE_EDIT)); return TRUE; case IDC_KERNEL_BROWSE: ChooseFile(hDlg, GetDlgItem(hDlg, IDC_KERNEL_EDIT)); return TRUE; case IDSTART: { TCHAR szBlendFactor[64] = { 0 }; BYTE blendType; BOOL bIsSerial = SendMessage(GetDlgItem(hDlg, IDC_RADIO_SERIAL), BM_GETCHECK, 0, 0) == BST_CHECKED; BOOL bIsMMX = SendMessage(GetDlgItem(hDlg, IDC_RADIO_MMX), BM_GETCHECK, 0, 0) == BST_CHECKED; // Try to get the blend factor GetWindowText(GetDlgItem(hDlg, IDC_BLEND), szBlendFactor, 64); if (_stscanf_s(szBlendFactor, TEXT("%lf"), &settings->blendFactor) != 1 || settings->blendFactor < 0 || settings->blendFactor > 1) { MessageBox(hDlg, TEXT("Blend factor must be between 0 and 1."), TEXT("Invalid Blend Factor"), MB_ICONERROR); return TRUE; } // Set the blend procedure if (bIsSerial) settings->blendType = BLEND_SERIAL; else if (bIsMMX) settings->blendType = BLEND_MMX; else settings->blendType = BLEND_SSE; // Get the file names and check to make sure they're valid GetWindowText(GetDlgItem(hDlg, IDC_IMAGE_EDIT), settings->lpszImageFile, FILENAME_SIZE); GetWindowText(GetDlgItem(hDlg, IDC_KERNEL_EDIT), settings->lpszKernelFile, FILENAME_SIZE); if (!IsValidImageFile(settings->lpszImageFile)) { MessageBox(hDlg, TEXT("Invalid image file. Please select an existing file file with one of the specified extensions."), TEXT("Invalid Image File"), MB_ICONERROR); return TRUE; } else if (!IsValidImageFile(settings->lpszKernelFile)) { MessageBox(hDlg, TEXT("Invalid kernel image file. Please select an existing file with one of the specified extensions."), TEXT("Invalid Kernel Image File"), MB_ICONERROR); return TRUE; } HWND startBtnHwnd = (HWND)lParam; EnableWindow(GetDlgItem(hDlg, IDSTART), FALSE); BlendImages(settings, results); return TRUE; } } default: return FALSE; } }
/** This function processes the results of changes in configuration. @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. @param Action Specifies the type of action taken by the browser. @param QuestionId A unique value which is sent to the original exporting driver so that it can identify the type of data to expect. @param Type The type of value for the question. @param Value A pointer to the data being sent to the original exporting driver. @param ActionRequest On return, points to the action requested by the callback function. @retval EFI_SUCCESS The callback successfully handled the action. @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data. @retval EFI_DEVICE_ERROR The variable could not be saved. @retval EFI_UNSUPPORTED The specified Action is not supported by the callback. @retval EFI_INVALID_PARAMETER The parameter of Value or ActionRequest is invalid. **/ EFI_STATUS EFIAPI BootMaintCallback ( IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN EFI_BROWSER_ACTION Action, IN EFI_QUESTION_ID QuestionId, IN UINT8 Type, IN EFI_IFR_TYPE_VALUE *Value, OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest ) { BMM_CALLBACK_DATA *Private; BM_MENU_ENTRY *NewMenuEntry; BMM_FAKE_NV_DATA *CurrentFakeNVMap; UINTN Index; EFI_DEVICE_PATH_PROTOCOL * File; if (Action != EFI_BROWSER_ACTION_CHANGING && Action != EFI_BROWSER_ACTION_CHANGED) { // // Do nothing for other UEFI Action. Only do call back when data is changed. // return EFI_UNSUPPORTED; } Private = BMM_CALLBACK_DATA_FROM_THIS (This); // // Retrive uncommitted data from Form Browser // CurrentFakeNVMap = &Private->BmmFakeNvData; HiiGetBrowserData (&mBootMaintGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap); if (Action == EFI_BROWSER_ACTION_CHANGING) { if (Value == NULL) { return EFI_INVALID_PARAMETER; } UpdatePageId (Private, QuestionId); if (QuestionId < FILE_OPTION_OFFSET) { if (QuestionId < CONFIG_OPTION_OFFSET) { switch (QuestionId) { case FORM_BOOT_ADD_ID: // Leave BMM and enter FileExplorer. ChooseFile (NULL, L".efi", CreateBootOptionFromFile, &File); break; case FORM_DRV_ADD_FILE_ID: // Leave BMM and enter FileExplorer. ChooseFile (NULL, L".efi", CreateDriverOptionFromFile, &File); break; case FORM_DRV_ADD_HANDLE_ID: CleanUpPage (FORM_DRV_ADD_HANDLE_ID, Private); UpdateDrvAddHandlePage (Private); break; case FORM_BOOT_DEL_ID: CleanUpPage (FORM_BOOT_DEL_ID, Private); UpdateBootDelPage (Private); break; case FORM_BOOT_CHG_ID: case FORM_DRV_CHG_ID: UpdatePageBody (QuestionId, Private); break; case FORM_DRV_DEL_ID: CleanUpPage (FORM_DRV_DEL_ID, Private); UpdateDrvDelPage (Private); break; case FORM_CON_IN_ID: case FORM_CON_OUT_ID: case FORM_CON_ERR_ID: UpdatePageBody (QuestionId, Private); break; case FORM_CON_MODE_ID: CleanUpPage (FORM_CON_MODE_ID, Private); UpdateConModePage (Private); break; case FORM_CON_COM_ID: CleanUpPage (FORM_CON_COM_ID, Private); UpdateConCOMPage (Private); break; default: break; } } else if ((QuestionId >= TERMINAL_OPTION_OFFSET) && (QuestionId < CONSOLE_OPTION_OFFSET)) { Index = (UINT16) (QuestionId - TERMINAL_OPTION_OFFSET); Private->CurrentTerminal = Index; CleanUpPage (FORM_CON_COM_SETUP_ID, Private); UpdateTerminalPage (Private); } else if (QuestionId >= HANDLE_OPTION_OFFSET) { Index = (UINT16) (QuestionId - HANDLE_OPTION_OFFSET); NewMenuEntry = BOpt_GetMenuEntry (&DriverMenu, Index); ASSERT (NewMenuEntry != NULL); Private->HandleContext = (BM_HANDLE_CONTEXT *) NewMenuEntry->VariableContext; CleanUpPage (FORM_DRV_ADD_HANDLE_DESC_ID, Private); Private->MenuEntry = NewMenuEntry; Private->LoadContext->FilePathList = Private->HandleContext->DevicePath; UpdateDriverAddHandleDescPage (Private); } } if (QuestionId == KEY_VALUE_BOOT_FROM_FILE){ // Leave BMM and enter FileExplorer. ChooseFile (NULL, L".efi", BootFromFile, &File); } } else if (Action == EFI_BROWSER_ACTION_CHANGED) { if ((Value == NULL) || (ActionRequest == NULL)) { return EFI_INVALID_PARAMETER; } if (QuestionId == KEY_VALUE_SAVE_AND_EXIT_BOOT) { CurrentFakeNVMap->BootOptionChanged = FALSE; *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT; } else if (QuestionId == KEY_VALUE_SAVE_AND_EXIT_DRIVER) { CurrentFakeNVMap->DriverOptionChanged = FALSE; *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT; } else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_DRIVER) { // // Discard changes and exit formset // CurrentFakeNVMap->DriverOptionalData[0] = 0x0000; CurrentFakeNVMap->DriverDescriptionData[0] = 0x0000; CurrentFakeNVMap->DriverOptionChanged = FALSE; CurrentFakeNVMap->ForceReconnect = TRUE; *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT; } else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_BOOT) { // // Discard changes and exit formset // CurrentFakeNVMap->BootOptionalData[0] = 0x0000; CurrentFakeNVMap->BootDescriptionData[0] = 0x0000; CurrentFakeNVMap->BootOptionChanged = FALSE; *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT; } else if (QuestionId == KEY_VALUE_BOOT_DESCRIPTION || QuestionId == KEY_VALUE_BOOT_OPTION) { CurrentFakeNVMap->BootOptionChanged = TRUE; } else if (QuestionId == KEY_VALUE_DRIVER_DESCRIPTION || QuestionId == KEY_VALUE_DRIVER_OPTION) { CurrentFakeNVMap->DriverOptionChanged = TRUE; } if ((QuestionId >= BOOT_OPTION_DEL_QUESTION_ID) && (QuestionId < BOOT_OPTION_DEL_QUESTION_ID + MAX_MENU_NUMBER)) { if (Value->b){ // // Means user try to delete this boot option but not press F10 or "Commit Changes and Exit" menu. // CurrentFakeNVMap->BootOptionDelMark[QuestionId - BOOT_OPTION_DEL_QUESTION_ID] = TRUE; } else { // // Means user remove the old check status. // CurrentFakeNVMap->BootOptionDelMark[QuestionId - BOOT_OPTION_DEL_QUESTION_ID] = FALSE; } } else if ((QuestionId >= DRIVER_OPTION_DEL_QUESTION_ID) && (QuestionId < DRIVER_OPTION_DEL_QUESTION_ID + MAX_MENU_NUMBER)) { if (Value->b){ CurrentFakeNVMap->DriverOptionDelMark[QuestionId - DRIVER_OPTION_DEL_QUESTION_ID] = TRUE; } else { CurrentFakeNVMap->DriverOptionDelMark[QuestionId - DRIVER_OPTION_DEL_QUESTION_ID] = FALSE; } } else { switch (QuestionId) { case KEY_VALUE_SAVE_AND_EXIT: case KEY_VALUE_NO_SAVE_AND_EXIT: if (QuestionId == KEY_VALUE_SAVE_AND_EXIT) { *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT; } else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT) { DiscardChangeHandler (Private, CurrentFakeNVMap); *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT; } break; case FORM_RESET: gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); return EFI_UNSUPPORTED; default: break; } } } // // Pass changed uncommitted data back to Form Browser // HiiSetBrowserData (&mBootMaintGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap, NULL); return EFI_SUCCESS; }