void DIALOG_SPICE_MODEL::onSelectLibrary( wxCommandEvent& event ) { wxString searchPath = wxFileName( m_modelLibrary->GetValue() ).GetPath(); if( searchPath.IsEmpty() ) searchPath = Prj().GetProjectPath(); wxString wildcards = SpiceLibraryFileWildcard() + "|" + AllFilesWildcard(); wxFileDialog openDlg( this, _( "Select library" ), searchPath, "", wildcards, wxFD_OPEN | wxFD_FILE_MUST_EXIST ); if( openDlg.ShowModal() == wxID_CANCEL ) return; wxFileName libPath( openDlg.GetPath() ); // Try to convert the path to relative to project if( libPath.MakeRelativeTo( Prj().GetProjectPath() ) && !libPath.GetFullPath().StartsWith( ".." ) ) m_modelLibrary->SetValue( libPath.GetFullPath() ); else m_modelLibrary->SetValue( openDlg.GetPath() ); loadLibrary( openDlg.GetPath() ); m_modelName->Popup(); }
int main (int argc, char* argv[]) { std::vector<std::string> params(argv, argv + argc); //pause in windoze for debuggin' #ifdef _WIN32 #ifdef _DEBUG atexit(pause); #endif #endif GlobalData::create(); llvm::llvm_shutdown_obj shutdown/*(multithreaded = false)*/; //clean up llvm upon exit try { #ifdef _WIN32 char fileName[MAX_PATH] = ""; openDlg(fileName); Global().ParseMainFile(fileName); #else Global().ParseMainFile(params[1].c_str()); #endif } catch (err::FatalError) { err::Error(err::fatal, tok::Location()) << "could not recover from previous errors, aborting"; } return 0; }
void CJumpListTab::OnSelectTaskIconPath() { CFileDialog openDlg(TRUE, NULL, NULL, OFN_FILEMUSTEXIST ,L"Icon Files|*.ico;*.dll;*.exe||"); if (openDlg.DoModal()) { m_taskIconPathEditBox.SetWindowText(openDlg.GetPathName()); } }
void CJumpListTab::OnSelectTaskPath() { CFileDialog openDlg(TRUE, NULL, NULL, OFN_FILEMUSTEXIST ,L"Executable Files|*.exe;*.cmd||"); if (openDlg.DoModal()) { m_taskPathEditBox.SetWindowText(openDlg.GetPathName()); } }
void CJumpListTab::OnSelectDestinationPath() { CFileDialog openDlg(TRUE, NULL, NULL, OFN_FILEMUSTEXIST ,L"Jpeg Files|*.jpg;*.jpeg||"); if (openDlg.DoModal()) { m_destinationPathEditBox.SetWindowText(openDlg.GetPathName()); } }
/* CONSTRUCTOR */ MainWindow::MainWindow(QWidget *parent): QMainWindow(parent), ui_(new Ui::MainWindow) { sock_ = 0; log_ = false; ui_->setupUi(this); connect(ui_->pushButton, SIGNAL(clicked()), this, SLOT(sendText())); connect(ui_->actionConnect, SIGNAL(triggered()), this, SLOT(openDlg())); connect(ui_->actionQuit_2, SIGNAL(triggered()), QApplication::instance(), SLOT(quit())); connect(ui_->actionClose, SIGNAL(triggered()), this, SLOT(disconnectFromServer())); connect(this, SIGNAL(destroyed()), this, SLOT(disconnectFromServer())); }
void SIM_PLOT_FRAME::menuOpenWorkbook( wxCommandEvent& event ) { wxFileDialog openDlg( this, _( "Open simulation workbook" ), "", "", _( "Workbook file (*.wbk)|*.wbk" ), wxFD_OPEN | wxFD_FILE_MUST_EXIST ); if( openDlg.ShowModal() == wxID_CANCEL ) return; if( !loadWorkbook( openDlg.GetPath() ) ) DisplayError( this, wxT( "There was an error while opening the workbook file" ) ); }
void CPIDCPDialog::OnBnClickedOpenCPBtn() { char szFilter[] = {"All Files (*.*)|*.*||"}; controlParameterVector.clear(); CFileDialog openDlg(TRUE, NULL, NULL, 0, szFilter); if (openDlg.DoModal() == IDOK) { CString fileName = openDlg.GetFileName(); controller->openControlParaFile(fileName, &controlParameterVector); // Update the grid updateGrid(&controlParameterVector); } }
void SIM_PLOT_FRAME::menuOpenWorkbook( wxCommandEvent& event ) { wxFileDialog openDlg( this, _( "Open simulation workbook" ), m_savedWorkbooksPath, "", WorkbookFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST ); if( openDlg.ShowModal() == wxID_CANCEL ) return; m_savedWorkbooksPath = openDlg.GetDirectory(); if( !loadWorkbook( openDlg.GetPath() ) ) DisplayError( this, _( "There was an error while opening the workbook file" ) ); }
void CConnectionOptionsDlg::OnBrowseClicked() { CFileDialog openDlg( TRUE, "mdb", NULL, OFN_HIDEREADONLY, "Microsoft Access Files (*.mdb)|*.mdb|All Files (*.*)|*.*||", this ); if ( openDlg.DoModal() == IDOK ) { SetDlgItemText( IDC_ACCESS, (LPCTSTR)openDlg.GetPathName() ); } }
void CCALCViewWinDoc::OnFileOpen() { CFileDialog openDlg( true, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Text Files (*.txt)|*.txt|All Files (*.*)|*.*||", NULL, 0 ); if (openDlg.DoModal() == IDOK) { OpenFile(openDlg.GetPathName()); } }
void CMainWnd::OnBtnOpen() //打开文件 { CFileDialogEx openDlg(TRUE,_T("mp4"),0, OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT,_T("视频文件(*.mp4)\0*.mp4\0All files (*.*)\0*.*\0\0")); if(openDlg.DoModal()==IDOK) //SMessageBox(NULL,_T("OnBtnOpen"),_T("haha"),MB_OK|MB_ICONEXCLAMATION); { TCHAR szPath[MAX_PATH]; TCHAR szFileName[80 * MAX_PATH]; TCHAR * p; int nLen = 0; lstrcpyn(szPath, szFileName, openDlg.m_ofn.nFileOffset); szPath[openDlg.m_ofn.nFileOffset] = '\0'; nLen = lstrlen(szPath); if( szPath[nLen - 1] != '\\' ) { lstrcat(szPath, TEXT("\\")); } //p = szFile + openDlg.m_ofn.nFileOffset; //把指针移到第一个文件 p = szFileName + openDlg.m_ofn.nFileOffset; //把指针移到第一个文件 int sum=0; while( *p ) { ZeroMemory(szFileName, sizeof(szFileName)); lstrcat(szFileName, szPath); //给文件名加上路径 lstrcat(szFileName, p); //加上文件名 //std::wstring file_name = szFileName; char* file_name=THCAR2char(szFileName); p += lstrlen(p) +1; //移至下一个文件 sum++; //cout<<file_name<<endl ; lstrcat(szFileName, TEXT("\n")); //换行 //STRACE("%s",szFileName); } printf("%d",sum); SMessageBox(NULL, szFileName, TEXT("MultiSelect"), MB_OK); } }
void CMainWnd::OnBtnBgOpen() //播放区域打开文件按钮 { CFileDialogEx openDlg(TRUE,_T("rmvb"),0,6,_T("视频文件(*.rmvb)\0*.rmvb\0All files (*.*)\0*.*\0\0")); if(openDlg.DoModal()==IDOK) SMessageBox(NULL,_T("OnBtnBgOpen"),_T("haha"),MB_OK|MB_ICONEXCLAMATION); }
void DataFileLoader::loadCsvFile(const bool readFromClipboard) { LoadCsvFileDialog::Parameters p; QStringList filePaths; QFileDialog openDlg(nullptr, tr("Pick a text data file"), m_lastCsvPath); if (!readFromClipboard) { openDlg.setAcceptMode(QFileDialog::AcceptOpen); openDlg.setFileMode(QFileDialog::ExistingFiles); if (openDlg.exec() != QDialog::Accepted) return; filePaths = openDlg.selectedFiles(); if (filePaths.length() < 1) return; } while (true) { if (m_loadCsvFileDlg->exec() != QDialog::Accepted) return; p = m_loadCsvFileDlg->parameters(); if (p.delimiter.length() != 1 && (p.delimiter.compare("\\t") != 0)) { QMessageBox::warning(nullptr, QObject::tr("Invalid input"), QObject::tr("Delimiter must be a single character or '\\t' to represent TAB.")); continue; } if (p.decimalSeparator == p.delimiter) { QMessageBox::warning(nullptr, QObject::tr("Invalid input"), QObject::tr("Delimiter and decimal separator cannot be the same character.")); continue; } if (p.xColumn == p.yColumn) { QMessageBox::warning(nullptr, QObject::tr("Invalid input"), QObject::tr("X and Y columns cannot be the same")); continue; } break; } QChar delimiter; if (p.delimiter.compare("\\t") == 0) delimiter = '\t'; else delimiter = p.delimiter.at(0); const QByteArray &bom = p.readBom == true ? CsvFileLoader::SUPPORTED_ENCODINGS[p.encodingId].bom : QByteArray(); auto doLoad = [this, &p](const CsvFileLoader::Data &csvData, const QString &path) { QString xType; QString yType; QString xUnit; QString yUnit; QString fileName = ""; switch (p.header) { case LoadCsvFileDialog::HeaderHandling::NO_HEADER: xType = p.xType; yType = p.yType; xUnit = p.xUnit; yUnit = p.yUnit; break; case LoadCsvFileDialog::HeaderHandling::HEADER_WITH_UNITS: xType = csvData.xType; yType = csvData.yType; break; case LoadCsvFileDialog::HeaderHandling::HEADER_WITHOUT_UNITS: xType = csvData.xType; yType = csvData.yType; xUnit = p.xUnit; yUnit = p.yUnit; break; } if (yUnit.length() > 0) { if (yUnit.at(yUnit.length() - 1) == '\n') yUnit.chop(1); } std::shared_ptr<Data> data = std::shared_ptr<Data>(new Data(csvData.data, xType, xUnit, yType, yUnit)); if (path != "") fileName = QFileInfo(path).fileName(); emit dataLoaded(data, path, fileName); }; if (readFromClipboard) { CsvFileLoader::Data csvData = CsvFileLoader::readClipboard(delimiter, p.decimalSeparator, p.xColumn, p.yColumn, p.header != LoadCsvFileDialog::HeaderHandling::NO_HEADER, p.linesToSkip, p.encodingId); if (!csvData.isValid()) return; doLoad(csvData, ""); } else { for (const QString &path : filePaths) { CsvFileLoader::Data csvData = CsvFileLoader::readFile(path, delimiter, p.decimalSeparator, p.xColumn, p.yColumn, p.header != LoadCsvFileDialog::HeaderHandling::NO_HEADER, p.linesToSkip, p.encodingId, bom); if (!csvData.isValid()) continue; m_lastCsvPath = path; doLoad(csvData, path); } } }