bool ledPresets::isClicked(int x, int y, bool dragged) { bool isclicked = false; // for (int i = 0; i < 3; i++) if (dragged) return isclicked; if (Record.isClicked(x, y)) { isRec = Record.isOn; isLedsClicked = false; return true; } if (LEDS::isClicked(x, y)) { isLedsClicked = true; // LEDS::setClicked(x, y, isRec ? color.red : color.black); ledLastClicked = LEDS::numClicked(x, y, isRec ? color.red : color.yellow); // get last clicked only after setClicked leds[ledLastClicked].color = isRec ? color.red : (presets[ledLastClicked].is_active ? color.yellow : color.black); printf("PRESET LED CLIK %i\n", ledLastClicked); LEDS::setClickedAll(); return true; } isLedsClicked = false; if (SaveXML.isClicked(x, y)) { saveXML(); } if (LoadXML.isClicked(x, y)) { loadXML(); } return false; }
bool PlaylistSaver::save(const KURL &file, int opt) { // kdDebug(66666) << k_funcinfo << "opt=" << opt << endl; if(file.isEmpty() || !file.isValid()) return false; switch (opt) { default: case 0: case XMLPlaylist: return saveXML(file, opt); case M3U: case EXTM3U: return saveM3U(file, opt); case PLS: return savePLS(file, opt); case ASX: return false; // No, I won't code that! [mETz] } }
void LLAgentPilot::save() { std::string txt_filename = gSavedSettings.getString("StatsPilotFile"); std::string xml_filename = gSavedSettings.getString("StatsPilotXMLFile"); saveTxt(txt_filename); saveXML(xml_filename); }
QString SoundSettings::saveFile ( const QString &filePath) { QFile sourceFile (filePath); QString baseDir; QString fileName; QString xmlFileName; QString retval = filePath; QDir baseDirectory; QString targetFilePath; suggestedTargetFilePath (filePath, baseDir, fileName, xmlFileName); SYS_DEBUG ("*** baseDir = %s", SYS_STR(baseDir)); SYS_DEBUG ("*** fileName = %s", SYS_STR(fileName)); baseDirectory = QDir (baseDir); if (!baseDirectory.exists()) { if (!QDir::root().mkpath(baseDir)) { SYS_WARNING ("ERROR: mkdir(%s) failed.", SYS_STR(baseDir)); goto finalize; } } targetFilePath = baseDir + QDir::separator() + fileName; xmlFileName = baseDir + QDir::separator() + xmlFileName; if (QFile(targetFilePath).exists()) { SYS_DEBUG ("The file '%s' already exists.", SYS_STR(targetFilePath)); retval = targetFilePath; goto finalize; } if (sourceFile.copy(targetFilePath)) { SYS_DEBUG ("File copy to %s success.", SYS_STR(targetFilePath)); retval = targetFilePath; } else { SYS_WARNING ("ERROR: Unable to copy %s -> %s: %m", SYS_STR(filePath), SYS_STR(targetFilePath)); } finalize: if (retval != filePath) { TrackerConnection *tracker = TrackerConnection::instance(); QString title; tracker->registerFileCopy (filePath, retval); title = tracker->niceNameFromFileName (filePath); saveXML (xmlFileName, filePath, retval, title); } return retval; }
VoxelImageData::~VoxelImageData() { CTRACE; std::string pFilename="voxelimagedata.xml"; xmlpp::Document d; Node *root=createRootNode(d,"antargisLevel"); saveXML(*root); std::string c=toString(d); // cdebug(c); saveFile(pFilename,c); }
QFile::FileError App::slotFileSave() { QFile::FileError error; /* Attempt to save with the existing name. Fall back to Save As. */ if (fileName().isEmpty() == true) error = slotFileSaveAs(); else error = saveXML(fileName()); handleFileError(error); return error; }
bool CalibrationData::save(const std::string& filename){ std::string type = boost::filesystem::path(filename).extension().string(); if (type=="xml"){ return saveXML(filename); } else if(type=="slcalib"){ return saveSLCALIB(filename); } else if (type=="m"){ return saveMatlab(filename); } else { std::cerr << "CalibrationData error save: unknown file extension: " << type << std::endl; return false; } return false; }
QFile::FileError App::slotFileSaveAs() { QString fn; /* Create a file save dialog */ QFileDialog dialog(this); dialog.setWindowTitle(tr("Save Workspace As")); dialog.setAcceptMode(QFileDialog::AcceptSave); dialog.selectFile(fileName()); /* Append file filters to the dialog */ QStringList filters; filters << tr("Workspaces (*%1)").arg(KExtWorkspace); #ifdef WIN32 filters << tr("All Files (*.*)"); #else filters << tr("All Files (*)"); #endif dialog.setNameFilters(filters); /* Append useful URLs to the dialog */ QList <QUrl> sidebar; sidebar.append(QUrl::fromLocalFile(QDir::homePath())); sidebar.append(QUrl::fromLocalFile(QDir::rootPath())); dialog.setSidebarUrls(sidebar); /* Get file name */ if (dialog.exec() != QDialog::Accepted) return QFile::NoError; fn = dialog.selectedFiles().first(); if (fn.isEmpty() == true) return QFile::NoError; /* Always use the workspace suffix */ if (fn.right(4) != KExtWorkspace) fn += KExtWorkspace; /* Set the workspace path before saving the new XML. In this way local files can be loaded even if the workspace file will be moved */ m_doc->setWorkspacePath(QFileInfo(fn).absolutePath()); /* Save the document and set workspace name */ QFile::FileError error = saveXML(fn); handleFileError(error); return error; }
bool CalibrationData::save(const QString& filename){ QFileInfo info(filename); QString type = info.suffix(); if (type=="xml"){ return saveXML(filename); } else if(type=="slcalib"){ return saveSLCALIB(filename); } else if (type=="m"){ return saveMatlab(filename); } else { std::cerr << "CalibrationData error save: unknown file extension: " << type.toStdString() << std::endl; return false; } return false; }
//------------------------------------------------------------------ void xmlParty::setFileNameSave(string iOSDocumentsDirectory, ofxXmlSettings& _XMLOne, ofxXmlSettings& _XMLTwo, button& _mathButton, vector <drawing>& _drawThese, vector<flagState>& _theFlagStates, string& theText) { // welcomeButton.thisString = "welcome "+_setUserName+"!"; //float stringSize = welcomeButton.thisString.size(); // welcomeButton.offSet.set(415, 35); //ASSIGN ALL THE BUTTON INFO HERE _mathButton.XMLFileOne = ofToString(ofGetSystemTime()) + "_" + _mathButton.myCreateProbRefresh; _mathButton.XMLFileTwo = ofToString(ofGetSystemTime()) + "_" + _mathButton.myReflectProbRefresh; xmlSetupThang(iOSDocumentsDirectory, _XMLOne, _XMLTwo, _mathButton); saveXML(iOSDocumentsDirectory, _XMLOne, _XMLTwo, _mathButton, _drawThese, _theFlagStates, theText); // mathTwoButton.XMLFileOne = ofToString(ofGetSystemTime()) + "_myCreateProbTwo.xml"; // mathTwoButton.XMLFileTwo = ofToString(ofGetSystemTime()) + "_myReflectProbTwo.xml"; // xmlSetupThang(iOSDocumentsDirectory, _XMLOne, _XMLTwo, mathTwoButton.XMLFileOne, mathTwoButton.XMLFileTwo); // saveXML(iOSDocumentsDirectory, _XMLOne, _XMLTwo, mathTwoButton.XMLFileOne, mathTwoButton.XMLFileTwo, mathTwoButton.problemText); // // mathThreeButton.XMLFileOne = ofToString(ofGetSystemTime()) + "_myCreateProbThree.xml"; // mathThreeButton.XMLFileTwo = ofToString(ofGetSystemTime()) + "_myReflectProbThree.xml"; // xmlSetupThang(iOSDocumentsDirectory, _XMLOne, _XMLTwo, mathThreeButton.XMLFileOne, mathThreeButton.XMLFileTwo); // saveXML(iOSDocumentsDirectory, _XMLOne, _XMLTwo, mathThreeButton.XMLFileOne, mathThreeButton.XMLFileTwo, mathThreeButton.problemText); // // mathFourButton.XMLFileOne = ofToString(ofGetSystemTime()) + "_myCreateProbFour.xml"; // mathFourButton.XMLFileTwo = ofToString(ofGetSystemTime()) + "_myReflectProbFour.xml"; // xmlSetupThang(iOSDocumentsDirectory, _XMLOne, _XMLTwo, mathFourButton.XMLFileOne, mathFourButton.XMLFileTwo); // saveXML(iOSDocumentsDirectory, _XMLOne, _XMLTwo, mathFourButton.XMLFileOne, mathFourButton.XMLFileTwo, mathFourButton.problemText); // // mathFiveButton.XMLFileOne = ofToString(ofGetSystemTime()) + "_myCreateProbFive.xml"; // mathFiveButton.XMLFileTwo = ofToString(ofGetSystemTime()) + "_myReflectProbFive.xml"; // xmlSetupThang(iOSDocumentsDirectory, _XMLOne, _XMLTwo, mathFiveButton.XMLFileOne, mathFiveButton.XMLFileTwo); // saveXML(iOSDocumentsDirectory, _XMLOne, _XMLTwo, mathFiveButton.XMLFileOne, mathFiveButton.XMLFileTwo, mathFiveButton.problemText); // // mathSixButton.XMLFileOne = ofToString(ofGetSystemTime()) + "_myCreateProbSix.xml"; // mathSixButton.XMLFileTwo = ofToString(ofGetSystemTime()) + "_myReflectProbSix.xml"; // xmlSetupThang(iOSDocumentsDirectory, _XMLOne, _XMLTwo, mathSixButton.XMLFileOne, mathSixButton.XMLFileTwo); // saveXML(iOSDocumentsDirectory, _XMLOne, _XMLTwo, mathSixButton.XMLFileOne, mathSixButton.XMLFileTwo, mathSixButton.problemText); // }
bool App::saveWorkspace(const QString &fileName) { QString localFilename = fileName; if (localFilename.startsWith("file:")) localFilename = QUrl(fileName).toLocalFile(); /* Always use the workspace suffix */ if (localFilename.right(4) != KExtWorkspace) localFilename += KExtWorkspace; /* Set the workspace path before saving the new XML. In this way local files can be loaded even if the workspace file will be moved */ m_doc->setWorkspacePath(QFileInfo(localFilename).absolutePath()); if (saveXML(localFilename) == QFile::NoError) { setTitle(QString("%1 - %2").arg(APPNAME).arg(localFilename)); updateRecentFilesList(localFilename); return true; } return false; }
void QNEMainWindow::createMenuBar(void) { QAction *saveXMLAct = new QAction(tr("&Export XML"), this); saveXMLAct->setShortcuts(QKeySequence::SaveXML); saveXMLAct->setStatusTip(tr("Save a file")); connect(saveXMLAct, SIGNAL(triggered()), this, SLOT(saveXML())); QAction *quitAct = new QAction(tr("&Quit"), this); quitAct->setShortcuts(QKeySequence::Quit); quitAct->setStatusTip(tr("Quit the application")); connect(quitAct, SIGNAL(triggered()), qApp, SLOT(quit())); QAction *loadAct = new QAction(tr("&Load"), this); loadAct->setShortcuts(QKeySequence::Open); loadAct->setStatusTip(tr("Open a file")); connect(loadAct, SIGNAL(triggered()), this, SLOT(loadFile())); QAction *saveAct = new QAction(tr("&Save"), this); saveAct->setShortcuts(QKeySequence::Save); saveAct->setStatusTip(tr("Save a file")); connect(saveAct, SIGNAL(triggered()), this, SLOT(saveFile())); QAction *addAct = new QAction(tr("&Add"), this); addAct->setStatusTip(tr("Add a block")); connect(addAct, SIGNAL(triggered()), this, SLOT(addBlock())); fileMenu = new QMenu(tr("&File"),this); menuBar = new QMenuBar; fileMenu->addAction(addAct); fileMenu->addAction(loadAct); fileMenu->addAction(saveAct); fileMenu->addAction(saveXMLAct); fileMenu->addSeparator(); fileMenu->addAction(quitAct); setWindowTitle(tr("Node Editor")); menuBar->addMenu(fileMenu); }
// 导出场景 bool XMLSceneSerializer::exportScene(IScene* scene, const String& filename) { m_scene = scene; LogManager::getSingleton().logMessage("XMLSceneSerializer writing XMLScene data to " + filename + "..."); // 新建xml文件 if(!newXML("Scenes")) { return false; } TiXmlElement *scenesElement = m_xmlDoc->RootElement(); LogManager::getSingleton().logMessage("Writing XMLScene data..."); writeScene(scenesElement); LogManager::getSingleton().logMessage("XMLScene data exported."); saveXML(filename); LogManager::getSingleton().logMessage("XMLSceneSerializer export successful."); closeXML(); return true; }
/******************************************************************** * Load & Save ********************************************************************/ void ColorFilters::save() { saveXML(m_path); }
//-------------------------------------------------------------- void elementWarp::save() { saveXML(xRes, yRes, &vertici[0], nPoints, &texVert[0], nPoints, &screenPos[0], nPoints, &mainVertici[0], 4, &mainIndex[0], 4); }
void LogWindow::connections() { QObject::connect(ui.pushButton, SIGNAL(clicked()), this, SLOT(hide())); QObject::connect(ui.pushButton_2, SIGNAL(clicked()), eh, SLOT(saveXML())); QObject::connect(eh, SIGNAL(layout_changed()), this, SLOT(refresh())); }