void save_as(){ Mutex::Locker lock(currMutex); try{ std::string filename = saveFileDialog(); save(curr,filename); }catch(...){} }
void MainWindow::createWAV() { CreateWAVDialog *d = new CreateWAVDialog(this); if (d->exec() == QDialog::Accepted) { bool select_playCount = d->select_playCount->isChecked(); int playCount, playSeconds; if (select_playCount) { // play the song a number of times playCount = d->playCount->value(); } else { // play the song for an amount of time playSeconds = d->playForTime->time().minute()*60 + d->playForTime->time().second(); } gui::stopSongTrackerConcurrent(); QString path = saveFileDialog(SETTINGS_WAVPATH, tr("WAV PCM files (*.wav)")); if (path.isEmpty()) return; core::FileIO *io = new core::FileIO(path.toLocal8Bit(), core::IO_WRITE); gui::stopSongConcurrent(createwav_cb, io); } }
void ImagePreview::OnSave( wxCommandEvent& event ) { wxFileDialog saveFileDialog(this, _("Save Screenshot file"), "", "", "PNG files (*.png)|*.png", wxFD_SAVE|wxFD_OVERWRITE_PROMPT); if (saveFileDialog.ShowModal() == wxID_CANCEL) return; // the user changed idea... m_screen->GetBitmap().SaveFile( saveFileDialog.GetPath(), wxBITMAP_TYPE_PNG ); }
void App::OnSave(wxCommandEvent& event) { wxFileDialog saveFileDialog(this->GetTopWindow(), _("save in dat file"), "", "",_("dat file (*.dat)|*.dat"), wxFD_SAVE|wxFD_OVERWRITE_PROMPT); if (saveFileDialog.ShowModal() == wxID_CANCEL) return; // the user changed idea... // save the current contents in the file; wxString path = saveFileDialog.GetPath(); if(!path.EndsWith(".dat")) path.append(".dat"); // open file wxFileOutputStream output_stream(path); if (!output_stream.IsOk()) { wxLogError(_("Save data as '%s' failed."), saveFileDialog.GetPath()); return; } // stop measurement if(mMeasure) mMeasure=false; // save oscilloscope or fft data depending on witch page is active switch(mPage) { case PAGE_OSZI: { output_stream.Write("t[ms]\tU[v]\n",11); double * x = mOsziPage->Scale(); double * y = mOsziPage->Data(); for(unsigned int i =0;i<mDB.mValues.Elements();i++) { wxString Line; Line.Printf(wxT("%f\t%f\n"),x[i],y[i]); output_stream.Write( Line.data(),Line.size()); } break; } case PAGE_FFT: { output_stream.Write("f[Hz]\tU[v]\n",11); double out[mDB.mValues.Elements()/2+1]; FFTPanel::compute(mDB.mValues.Elements(),mDB.mValues.GetData(),out); double deltaf = 1000.0/(mDB.mEffSampleTime *mDB.mValues.Elements()); for(unsigned int k = 0; k <= mDB.mValues.Elements()/2; ++k) { wxString Line; Line.Printf(wxT("%f\t%f\n"),deltaf*(double)k,out[k]); output_stream.Write( Line.data(),Line.size()); } break; } } }
void ControlPanel::OnSavePlayfile(wxCommandEvent& event) { wxString path = saveFileDialog(wxT("Save Playfile"), playfile_wildcard); if (!path.IsEmpty()) { playfileSaved = true; playfilePath = path; // save contents of edit panel to playfilePath unloadPlayfile(playfilePath); setStatusPanelText(wxString::Format(wxT("Saved Playfile as %s"), playfilePath)); } }
void my1Form::OnSave(wxCommandEvent& WXUNUSED(event)) { wxFileDialog saveFileDialog(this, wxT("Save image file"), wxT(""), wxT(""), wxT("BMP (*.bmp)|*.bmp"), wxFD_SAVE|wxFD_OVERWRITE_PROMPT); if(saveFileDialog.ShowModal() == wxID_CANCEL) return; mCanvas->mCurrentImage->SaveFile(saveFileDialog.GetPath(),wxBITMAP_TYPE_BMP); mCanvas->mImageChanged = false; }
void RenderFrame::OnSaveImage(wxCommandEvent& WXUNUSED(event)) { /* ask for the user to select a file name and a file format to save */ wxFileDialog saveFileDialog(this, _("Save image file"), "", "render.png", "PNG(*.png)|*.png;|JPEG(*.jpg)|*.jpg;|BMP(*.bmp)|*.bmp;|TGA(*.tga)|*.tga", wxFD_SAVE | wxFD_OVERWRITE_PROMPT); if (saveFileDialog.ShowModal() == wxID_CANCEL) return; // the user has pressed cancel //..got here, save image m_render.SaveFile(saveFileDialog.GetPath()); }
void MainWindow::saveAs() { QString path = saveFileDialog(SETTINGS_FTMPATH, tr("FamiTracker files (*.ftm)")); if (path.isEmpty()) return; core::FileIO *io = new core::FileIO(path.toLocal8Bit(), core::IO_WRITE); m_dinfo->doc()->write(io); delete io; }
void wxAreaChartCtrl::CreateContextMenu() { m_contextMenu.Append(wxID_SAVEAS, wxString("Save as")); Bind(wxEVT_CONTEXT_MENU, [this](wxContextMenuEvent& evt) { PopupMenu(&m_contextMenu, ScreenToClient(evt.GetPosition())); } ); m_contextMenu.Bind(wxEVT_MENU, [this](wxCommandEvent &) { wxFileDialog saveFileDialog(this, _("Save file"), "", "", "JPEG files (*.jpg;*.jpeg)|*.jpg;*.jpeg|PNG files (*.png)|*.png", wxFD_SAVE | wxFD_OVERWRITE_PROMPT); if (saveFileDialog.ShowModal() == wxID_CANCEL) return; wxString filename = saveFileDialog.GetPath(); wxBitmapType type = wxBitmapType::wxBITMAP_TYPE_INVALID; switch (saveFileDialog.GetFilterIndex()) { case 0: type = wxBitmapType::wxBITMAP_TYPE_JPEG; if (wxImage::FindHandler(wxBitmapType::wxBITMAP_TYPE_JPEG) == 0) { wxImage::AddHandler(new wxJPEGHandler()); } break; case 1: type = wxBitmapType::wxBITMAP_TYPE_PNG; if (wxImage::FindHandler(wxBitmapType::wxBITMAP_TYPE_PNG) == 0) { wxImage::AddHandler(new wxPNGHandler()); } break; } m_areaChart.Save(filename, type, GetSize()); }, wxID_SAVEAS ); }
void MainFrame::OnSaveAsClick(wxRibbonButtonBarEvent& event) { Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage()); if(workspace) { FileHanding fileHandling(workspace); wxFileDialog saveFileDialog(this, _("Save PSP file"), "", "", "PSP files (*.psp)|*.psp", wxFD_SAVE | wxFD_OVERWRITE_PROMPT); if(saveFileDialog.ShowModal() == wxID_CANCEL) return; fileHandling.SaveProject(saveFileDialog.GetPath()); wxFileName fileName(saveFileDialog.GetPath()); workspace->SetName(fileName.GetName()); m_auiNotebook->SetPageText(m_auiNotebook->GetPageIndex(workspace), workspace->GetName()); workspace->SetSavedPath(fileName); } }
void DecryptDatabaseDialog7::clickOk(WPARAM wParam) { WCHAR filename[MAX_PATH]; WCHAR keyFilename[256]; GetDlgItemText(dialog, IDC_DECRYPT_CRYPT7_DATABASE, filename, MAX_PATH); GetDlgItemText(dialog, IDC_DECRYPT_CRYPT7_KEYFILE, keyFilename, 256); openDatabaseStruct.filename = wstrtostr(filename); openDatabaseStruct.keyFilename = wstrtostr(keyFilename); std::string suggestion = "messages.decrypted.db"; std::string filter = "*.*"; if (saveFileDialog(dialog, suggestion, filter, openDatabaseStruct.decryptedFilename)) { close(LOWORD(wParam)); } }
void MyFrame::OnSave(wxCommandEvent& WXUNUSED(event)) { wxFileDialog saveFileDialog(this, _T("Save XML file"), _T(""), _T(""), _T("XML files (*.xml)|*.xml"), wxFD_SAVE|wxFD_OVERWRITE_PROMPT); if (saveFileDialog.ShowModal() == wxID_CANCEL) return; std::ofstream outFile; outFile.open(saveFileDialog.GetPath().mbc_str(), std::ios::out | std::ios::binary); //outFile.open(saveFileDialog.GetPath().c_str(), std::ios::out | std::ios::binary); if (!outFile.is_open()) { wxLogError(_T("Cannot save current contents in file '%s'."), saveFileDialog.GetPath()); return; } string xml = m_rootNode->SaveXML(true); outFile<<xml; outFile.close(); }
void PythonEditorWidget::saveAs() { InviwoFileDialog saveFileDialog(this, "Save Python Script ...", "script"); saveFileDialog.setFileMode(QFileDialog::AnyFile); saveFileDialog.setAcceptMode(QFileDialog::AcceptSave); saveFileDialog.setConfirmOverwrite(true); saveFileDialog.addSidebarPath(PathType::Scripts); saveFileDialog.addExtension("py", "Python Script"); if (saveFileDialog.exec()) { stopFileObservation(scriptFileName_); QString path = saveFileDialog.selectedFiles().at(0); if (!path.endsWith(".py")) path.append(".py"); setFileName(path.toLocal8Bit().constData()); unsavedChanges_ = true; save(); } }
/***************************************************** ** ** Document --- saveAs ** ******************************************************/ bool Document::saveAs() { wxString filename = dataSet->getName(); if ( filename == wxT( "" )) { filename = wxString::Format( wxT( "%s.mtx" ), (const wxChar*)getHName() ); } wxString filetypes = _( "Maitreya text (*.mtx)|*.mtx| All files (*.*)|*.*" ); wxFileDialog saveFileDialog( mainwindow, _("Save file as" ), config->defSavePath, filename, filetypes, wxFD_SAVE, wxDefaultPosition ); if ( saveFileDialog.ShowModal() == wxID_OK ) { // Bugfix 7.0.3 GetDirectory returns home directory on some Linux distros instead of selected dir //filename.Clear(); //filename << saveFileDialog.GetDirectory() << wxFileName::GetPathSeparator() //<< saveFileDialog.GetFilename(); filename = saveFileDialog.GetPath(); if ( ! Horoscope::saveAs( (const wxChar*)filename )) { doMessageBox( mainwindow, wxString::Format( wxT( "%s %s" ), _( "Cannot save file" ), (const wxChar*)filename ), wxOK | wxICON_ERROR | wxCENTRE ); return false; } dirty = false; wxCommandEvent event( DOC_SAVED, mainwindow->GetId() ); event.SetEventObject( this ); wxPostEvent( mainwindow->GetParent(), event ); config->defSavePath = saveFileDialog.GetDirectory(); } else { return false; } return true; }
//! Connects the signals of widgets in the main layout to the appropriate slots. //! @see createMainLayout() void Window::mainLayoutCreateConnections() const { connect(comboInfile, SIGNAL(editTextChanged(QString)), this, SLOT(updateDisplay())); connect(comboOutfile, SIGNAL(editTextChanged(QString)), this, SLOT(updateDisplay())); connect(spinColumns, SIGNAL(valueChanged(int)), this, SLOT(updateColumnList())); connect(spinColumns, SIGNAL(valueChanged(int)), this, SLOT(updateDisplay())); connect(buttonBrowseInput, SIGNAL(clicked()), this, SLOT(openFileDialog())); connect(buttonBrowseOutput, SIGNAL(clicked()), this, SLOT(saveFileDialog())); connect(buttonProcessData, SIGNAL(clicked()), this, SLOT(dataToCsv())); connect(comboRowLimit, SIGNAL(editTextChanged(const QString&)), this, SLOT(filterLimitRowsName(const QString&))); connect(comboRowLimit, SIGNAL(editTextChanged(const QString&)), this, SLOT(updateDisplay())); connect(statusBarMessage, SIGNAL(linkActivated(QString)), this, SLOT(openSystemWebBrowser(QString))); }
/***************************************************** ** ** Document --- saveAs ** ******************************************************/ bool Document::saveAs() { wxString filename = dataSet->getName(); if ( filename == wxT( "" )) { filename = wxString::Format( wxT( "%s.mtx" ), getHName().c_str() ); } wxString filetypes = _( "Maitreya text (*.mtx)|*.mtx| All files (*.*)|*.*" ); wxFileDialog saveFileDialog( mainwindow, _("Save file as" ), config->viewprefs->defSavePath, filename, filetypes, wxFD_SAVE, wxDefaultPosition ); if ( saveFileDialog.ShowModal() == wxID_OK ) { // Bugfix 7.0.3 GetDirectory returns home directory instead of selected dir //filename.Clear(); //filename << saveFileDialog.GetDirectory() << wxFileName::GetPathSeparator() //<< saveFileDialog.GetFilename(); filename = saveFileDialog.GetPath(); if ( ! Horoscope::saveAs( filename )) { doMessageBox( mainwindow, wxString::Format( wxT( "%s %s" ), _( "Cannot save file" ), filename.c_str() ), wxOK | wxICON_ERROR | wxCENTRE ); return false; } dirty = false; DocumentManager::get()->documentSaved( this ); config->viewprefs->defSavePath = saveFileDialog.GetDirectory(); } else { return false; } return true; }
void PythonEditorWidget::saveAs() { if (script_.getSource() == defaultSource) return; // nothig to be saved InviwoFileDialog saveFileDialog(this, "Save Python Script ...", "script"); saveFileDialog.setFileMode(QFileDialog::AnyFile); saveFileDialog.setAcceptMode(QFileDialog::AcceptSave); saveFileDialog.setConfirmOverwrite(true); saveFileDialog.addSidebarPath(InviwoApplication::PATH_SCRIPTS); saveFileDialog.addExtension("py", "Python Script"); if (saveFileDialog.exec()) { stopFileObservation(scriptFileName_); QString path = saveFileDialog.selectedFiles().at(0); if (!path.endsWith(".py")) path.append(".py"); scriptFileName_ = path.toLocal8Bit().constData(); unsavedChanges_ = true; save(); } }
QString Get_AssetPath_SaveFileAs( const char* title, const char* fileName, const char* filter ) { QFileDialog saveFileDialog( GetMainFrame(), title ); { saveFileDialog.setFileMode( QFileDialog::AnyFile ); saveFileDialog.setAcceptMode( QFileDialog::AcceptSave ); saveFileDialog.setNameFilter( filter ); saveFileDialog.selectFile( fileName ); } UNDONE; // const String& pathToSrcAssets = gEditor.assets->GetPathToSrcAssets(); QString saveAsFilePath; //L_TryAgain: // if( saveFileDialog.exec() ) // { // const QStringList selectedFiles( saveFileDialog.selectedFiles() ); // Assert( selectedFiles.count() == 1 ); // // if( selectedFiles.count() > 0 ) // { // saveAsFilePath = selectedFiles.first(); // // if( !saveAsFilePath.startsWith( pathToSrcAssets.ToChars() ) ) // { // ShowQMessageBox("Invalid file path - should be a subfolder of source assets directory!"); // goto L_TryAgain; // } // } // // Assert( !saveAsFilePath.isEmpty() ); // } return saveAsFilePath; }
void imgui( ParamList& plist, float cursorPos ) { static bool opendemo=true; std::string id = plist.getPath() + "_ID"; ImGui::PushID(id.c_str()); //ImGui::BeginChild(id.c_str()); //"content"); float cposyPrev = ImGui::GetCursorPosY(); bool vis; if (plist.hasOption("hidden")) vis = ImGui::CollapsingHeader(plist.getName().c_str(), ImGuiTreeNodeFlags_AllowItemOverlap); //, NULL, true, true); else vis = ImGui::CollapsingHeader(plist.getName().c_str(), ImGuiTreeNodeFlags_AllowItemOverlap | ImGuiTreeNodeFlags_DefaultOpen); //, NULL, true, true); float cposyNext = ImGui::GetCursorPosY(); //ImGUi::SetCursorPosY(cposyPrev); //SameLine(); //ImGui::PushItemWidth(-10); // in cm_imgui_app if (!plist.hasOption("child")) { extern ImFont * iconFont; ImGui::PushFont(iconFont); ImGui::PushID("btns"); ImGui::SameLine(ImGui::GetWindowWidth()-100); if(ImGui::ButtonEx("l", ImVec2(0,0), ImGuiButtonFlags_PressedOnClick)) // Hack default onRelease with Button does not seem to work { std::string path; if(openFileDialog(path,"xml")) plist.loadXml(path.c_str()); } //ImGui::NextColumn(); ImGui::SameLine(); if(ImGui::ButtonEx("s",ImVec2(0,0), ImGuiButtonFlags_PressedOnClick))//, ImVec2(100,20))) { std::string path; if(saveFileDialog(path,"xml")) plist.saveXml(path.c_str()); } ImGui::PopID(); ImGui::PopFont(); } //ImGui::PopItemWidth(); if(!vis) { //ImGui::EndChild(); ImGui::PopID(); return; } //if(!) //ImGui::OpenNextNode(true); //if(!ImGui::TreeNode(plist.getName().c_str())) for( int i = 0; i < plist.getNumParams(); i++ ) { Param * p = plist.getParam(i); if(p->hasOption("h")) continue; if(p->hasOption("sameline")) ImGui::SameLine(); imgui(p); } for( int i = 0; i < plist.getNumChildren(); i++ ) { ImGui::Indent(); imgui(*plist.getChild(i), cursorPos+10.0 ); ImGui::Unindent(); } //ImGui::TreePop(); ImGui::PopID(); //ImGui::EndChild(); }
void AppFrame::OnMenu(wxCommandEvent& event) { if (event.GetId() >= wxID_RT_AUDIO_DEVICE && event.GetId() < wxID_RT_AUDIO_DEVICE + devices.size()) { if (activeDemodulator) { activeDemodulator->setOutputDevice(event.GetId() - wxID_RT_AUDIO_DEVICE); activeDemodulator = NULL; } } else if (event.GetId() == wxID_SET_FREQ_OFFSET) { long ofs = wxGetNumberFromUser("Shift the displayed frequency by this amount.\ni.e. -125000000 for -125 MHz", "Frequency (Hz)", "Frequency Offset", wxGetApp().getOffset(), -2000000000, 2000000000, this); if (ofs != -1) { wxGetApp().setOffset(ofs); wxGetApp().saveConfig(); } } else if (event.GetId() == wxID_SET_DS_OFF) { wxGetApp().setDirectSampling(0); wxGetApp().saveConfig(); } else if (event.GetId() == wxID_SET_DS_I) { wxGetApp().setDirectSampling(1); wxGetApp().saveConfig(); } else if (event.GetId() == wxID_SET_DS_Q) { wxGetApp().setDirectSampling(2); wxGetApp().saveConfig(); } else if (event.GetId() == wxID_SET_SWAP_IQ) { bool swap_state = !wxGetApp().getSwapIQ(); wxGetApp().setSwapIQ(swap_state); wxGetApp().saveConfig(); iqSwapMenuItem->Check(swap_state); } else if (event.GetId() == wxID_SET_PPM) { long ofs = wxGetNumberFromUser("Frequency correction for device in PPM.\ni.e. -51 for -51 PPM\n\nNote: you can adjust PPM interactively\nby holding ALT over the frequency tuning bar.\n", "Parts per million (PPM)", "Frequency Correction", wxGetApp().getPPM(), -1000, 1000, this); wxGetApp().setPPM(ofs); wxGetApp().saveConfig(); } else if (event.GetId() == wxID_SAVE) { if (!currentSessionFile.empty()) { saveSession(currentSessionFile); } else { wxFileDialog saveFileDialog(this, _("Save XML Session file"), "", "", "XML files (*.xml)|*.xml", wxFD_SAVE | wxFD_OVERWRITE_PROMPT); if (saveFileDialog.ShowModal() == wxID_CANCEL) { return; } saveSession(saveFileDialog.GetPath().ToStdString()); } } else if (event.GetId() == wxID_OPEN) { wxFileDialog openFileDialog(this, _("Open XML Session file"), "", "", "XML files (*.xml)|*.xml", wxFD_OPEN | wxFD_FILE_MUST_EXIST); if (openFileDialog.ShowModal() == wxID_CANCEL) { return; } loadSession(openFileDialog.GetPath().ToStdString()); } else if (event.GetId() == wxID_SAVEAS) { wxFileDialog saveFileDialog(this, _("Save XML Session file"), "", "", "XML files (*.xml)|*.xml", wxFD_SAVE | wxFD_OVERWRITE_PROMPT); if (saveFileDialog.ShowModal() == wxID_CANCEL) { return; } saveSession(saveFileDialog.GetPath().ToStdString()); } else if (event.GetId() == wxID_RESET) { wxGetApp().getDemodMgr().terminateAll(); wxGetApp().setFrequency(100000000); wxGetApp().setOffset(0); SetTitle(CUBICSDR_TITLE); currentSessionFile = ""; } else if (event.GetId() == wxID_EXIT) { Close(false); } else if (event.GetId() == wxID_THEME_DEFAULT) { ThemeMgr::mgr.setTheme(COLOR_THEME_DEFAULT); } else if (event.GetId() == wxID_THEME_SHARP) { ThemeMgr::mgr.setTheme(COLOR_THEME_SHARP); } else if (event.GetId() == wxID_THEME_BW) { ThemeMgr::mgr.setTheme(COLOR_THEME_BW); } else if (event.GetId() == wxID_THEME_RAD) { ThemeMgr::mgr.setTheme(COLOR_THEME_RAD); } else if (event.GetId() == wxID_THEME_TOUCH) { ThemeMgr::mgr.setTheme(COLOR_THEME_TOUCH); } else if (event.GetId() == wxID_THEME_HD) { ThemeMgr::mgr.setTheme(COLOR_THEME_HD); } else if (event.GetId() == wxID_THEME_RADAR) { ThemeMgr::mgr.setTheme(COLOR_THEME_RADAR); } switch (event.GetId()) { case wxID_BANDWIDTH_250K: wxGetApp().setSampleRate(250000); break; case wxID_BANDWIDTH_1000M: wxGetApp().setSampleRate(1000000); break; case wxID_BANDWIDTH_1024M: wxGetApp().setSampleRate(1024000); break; case wxID_BANDWIDTH_1500M: wxGetApp().setSampleRate(1500000); break; case wxID_BANDWIDTH_1800M: wxGetApp().setSampleRate(1800000); break; case wxID_BANDWIDTH_1920M: wxGetApp().setSampleRate(1920000); break; case wxID_BANDWIDTH_2000M: wxGetApp().setSampleRate(2000000); break; case wxID_BANDWIDTH_2048M: wxGetApp().setSampleRate(2048000); break; case wxID_BANDWIDTH_2160M: wxGetApp().setSampleRate(2160000); break; case wxID_BANDWIDTH_2400M: wxGetApp().setSampleRate(2400000); break; case wxID_BANDWIDTH_2560M: wxGetApp().setSampleRate(2560000); break; case wxID_BANDWIDTH_2880M: wxGetApp().setSampleRate(2880000); break; // case wxID_BANDWIDTH_3000M: // wxGetApp().setSampleRate(3000000); // break; case wxID_BANDWIDTH_3200M: wxGetApp().setSampleRate(3200000); break; } std::vector<SDRDeviceInfo *> *devs = wxGetApp().getDevices(); if (event.GetId() >= wxID_DEVICE_ID && event.GetId() <= wxID_DEVICE_ID + devs->size()) { int devId = event.GetId() - wxID_DEVICE_ID; wxGetApp().setDevice(devId); SDRDeviceInfo *dev = (*wxGetApp().getDevices())[devId]; DeviceConfig *devConfig = wxGetApp().getConfig()->getDevice(dev->getDeviceId()); int dsMode = devConfig->getDirectSampling(); if (dsMode >= 0 && dsMode <= 2) { directSamplingMenuItems[devConfig->getDirectSampling()]->Check(); } iqSwapMenuItem->Check(devConfig->getIQSwap()); } if (event.GetId() >= wxID_AUDIO_BANDWIDTH_BASE) { int evId = event.GetId(); std::vector<RtAudio::DeviceInfo>::iterator devices_i; std::map<int, RtAudio::DeviceInfo>::iterator mdevices_i; int i = 0; for (mdevices_i = outputDevices.begin(); mdevices_i != outputDevices.end(); mdevices_i++) { int menu_id = wxID_AUDIO_BANDWIDTH_BASE + wxID_AUDIO_DEVICE_MULTIPLIER * mdevices_i->first; int j = 0; for (std::vector<unsigned int>::iterator srate = mdevices_i->second.sampleRates.begin(); srate != mdevices_i->second.sampleRates.end(); srate++) { if (evId == menu_id + j) { //audioSampleRateMenuItems[menu_id+j]; //std::cout << "Would set audio sample rate on device " << mdevices_i->second.name << " (" << mdevices_i->first << ") to " << (*srate) << "Hz" << std::endl; AudioThread::setDeviceSampleRate(mdevices_i->first, *srate); } j++; } i++; } } }
void MainWindow::createActions() { pt_fileAct = new QAction(tr("&File"), this); pt_fileAct->setStatusTip(tr("Open video file")); connect(pt_fileAct, SIGNAL(triggered()), this, SLOT(callFileSelectDialog())); pt_resumeAct = new QAction(tr("&Resume"), this); pt_resumeAct->setStatusTip("Resume"); connect(pt_resumeAct, SIGNAL(triggered()), pt_videocapture, SLOT(resume())); pt_pauseAct = new QAction(tr("&Pause"), this); pt_pauseAct->setStatusTip("Pause"); connect(pt_pauseAct, SIGNAL(triggered()), pt_videocapture, SLOT(pause())); pt_backwardAct = new QAction(this); connect(pt_backwardAct, SIGNAL(triggered()), pt_videocapture, SLOT(stepBackward())); pt_forwardAct = new QAction(this); connect(pt_forwardAct, SIGNAL(triggered()), pt_videocapture, SLOT(stepForward())); pt_speedupAct = new QAction(tr("Speedx2.0"), this); pt_speedupAct->setStatusTip("Increase speed of playback by two times"); connect(pt_speedupAct, SIGNAL(triggered(bool)), pt_videocapture, SLOT(speedUp())); pt_speeddownAct = new QAction(tr("Speedx0.5"), this); pt_speeddownAct->setStatusTip("Decrease speed of playback by two times"); connect(pt_speeddownAct, SIGNAL(triggered(bool)), pt_videocapture, SLOT(speedDown())); pt_aboutAct = new QAction(tr("&About"), this); pt_aboutAct->setStatusTip("Show about"); connect(pt_aboutAct, SIGNAL(triggered()), this, SLOT(about())); pt_helpAct = new QAction(tr("&Help"), this); pt_helpAct->setStatusTip("Show help"); connect(pt_helpAct, SIGNAL(triggered()), this, SLOT(help())); pt_numAct = new QAction(tr("&Numbers"), this); pt_numAct->setStatusTip("Toogle show numbers"); pt_numAct->setCheckable(true); pt_numAct->setChecked(true); connect(pt_numAct, SIGNAL(triggered(bool)), ui->display, SLOT(setNumbersVisualization(bool))); pt_imageAct = new QAction(tr("&Image"), this); pt_imageAct->setStatusTip("Toogle show image"); pt_imageAct->setCheckable(true); pt_imageAct->setChecked(true); connect(pt_imageAct, SIGNAL(triggered(bool)), ui->display, SLOT(setImageVisualization(bool))); pt_selectionAct = new QAction(tr("&Select"), this); pt_selectionAct->setStatusTip("Toogle show selection"); pt_selectionAct->setCheckable(true); pt_selectionAct->setChecked(true); connect(pt_selectionAct, SIGNAL(triggered(bool)), ui->display, SLOT(setSelectionVisualization(bool))); pt_deviceAct = new QAction(tr("&Device"),this); pt_deviceAct->setStatusTip(tr("Open video device")); connect(pt_deviceAct, SIGNAL(triggered()), this, SLOT(callDeviceSelectDialog())); pt_plotAct = new QAction(tr("&Plot"),this); pt_plotAct->setStatusTip(tr("New plot")); connect(pt_plotAct, SIGNAL(triggered()), this, SLOT(addPlot())); pt_writeAct = new QAction(tr("&Video"), this); pt_writeAct->setStatusTip(tr("Write processed frames to a file")); pt_writeAct->setCheckable(true); pt_writeAct->setChecked(false); connect(pt_writeAct, SIGNAL(triggered(bool)), this, SLOT(callVideoWriteDialog(bool))); pt_dsAct = new QAction(tr("DSdialog"), this); pt_dsAct->setStatusTip(tr("Call DirectShow device settings dialog")); connect(pt_dsAct, SIGNAL(triggered()), this, SLOT(callDSDialog())); pt_saveWFAct = new QAction(tr("Waterfall"), this); pt_saveWFAct->setStatusTip(tr("Save waterfall image on disk")); connect(pt_saveWFAct, SIGNAL(triggered()), this, SLOT(saveFileDialog())); }
/** * SaveFileDialog を呼び出します. * * Windows の SaveFileDialog によってファイルの保存先を決定します. * * @param filters フィルタ(区切り文字は'|') * @return 選択したファイルパス.確定せずに終了したときは空文字. * *************************************************************************************************/ inline std::string saveFileDialog(const std::string &filter) { return toString(saveFileDialog(toWString(filter))); }
bool THAExports::SaveToFile() { int type = FT_PARAMETER_TXT; wxFileDialog saveFileDialog(m_pParent, wxT("Save results to file"), wxT(""), m_wxszFileName, wxT("Parameter File (*.txt)|*.txt|Parameter File (*.csv)|*.csv|Time History (*.txt)|*.txt|Time History (*.csv)|*.csv"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT); if(saveFileDialog.ShowModal() != wxID_OK) return false; m_wxszFileName = saveFileDialog.GetPath(); type = saveFileDialog.GetFilterIndex(); m_wxszFileName << m_awxchExtension[type]; saveFileDialog.SetPath(m_wxszFileName); wxTextFile * resultsFile = new wxTextFile(); if( resultsFile->Create(m_wxszFileName) || resultsFile->Open(m_wxszFileName) ) { //file writing resultsFile->Clear(); switch(type) { case FT_PARAMETER_TXT: StoreParametersTable(resultsFile, FF_TXT); break; case FT_PARAMETER_CSV: StoreParametersTable(resultsFile, FF_CSV); break; case FT_TIME_HISTORY_TXT: StoreTimeHistory(resultsFile, FF_TXT); break; case FT_TIME_HISTORY_CSV: StoreTimeHistory(resultsFile, FF_CSV); break; } //flush data to file. if( ! resultsFile->Write(wxTextFileType_Dos)) { ::wxMessageBox(wxT("Write error."), wxT("Error"), wxOK | wxICON_ERROR); //Close file. resultsFile->Close(); } else { //Close file. resultsFile->Close(); ::wxMessageBox(wxT("Datas successifully saved."), wxT("Success"), wxOK | wxICON_INFORMATION); } } else { ::wxMessageBox(wxT("Error on file creation."), wxT("Error"), wxOK | wxICON_ERROR); } delete resultsFile; return true; }