void ProRataMerge::merge() { accept(); // Get the list of files. for (int i = 0; i < qlwInput->count() ; i++ ) { QString qsDir = (qlwInput->item( i ))->text(); QDir dir( qsDir ); QString qsBaseName = qsDir.section( '/', -1 ); dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks); QFileInfoList list = dir.entryInfoList(); for (int j = 0; j < list.size(); ++j) { QFileInfo fileInfo = list.at(j); QString qsNewFile = qsOutputDirectory + "/" + qsBaseName + "_" + fileInfo.fileName(); //QFile::copy( fileInfo.absoluteFilePath(), qsNewFile ); QFile qfInputFile; qfInputFile.setFileName( fileInfo.absoluteFilePath() ); qfInputFile.copy( qsNewFile ); } dir.setFilter(QDir::AllDirs | QDir::NoSymLinks); QFileInfoList qfileDirList = dir.entryInfoList(); QString qsDirList = ""; for (int j = 0; j < qfileDirList.size(); ++j) { QFileInfo dirInfo = qfileDirList.at(j); if ( dirInfo.fileName() == "." || dirInfo.fileName() == ".." ) { continue; } QDir qdCurrentPointer; QString qsDestDirectory = qsOutputDirectory + "/" + qsBaseName + "_" + dirInfo.fileName(); qdCurrentPointer.mkdir( qsDestDirectory ); QDir sourceDir( dirInfo.absoluteFilePath() ); sourceDir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks); QFileInfoList list = sourceDir.entryInfoList(); for (int j = 0; j < list.size(); ++j) { QFileInfo dirInfo = list.at(j); QString qsNewFile = qsDestDirectory + "/" + qsBaseName + "_" + dirInfo.fileName(); //QFile::copy( dirInfo.absoluteFilePath(), qsNewFile ); QFile qfInputFile; qfInputFile.setFileName( dirInfo.absoluteFilePath() ); qfInputFile.copy( qsNewFile ); } } //QMessageBox::information(this, "dir list ", qsDirList ); } }
void MysqLoader::writeSettings() { QFile autostartFile; LanguageTools language; QSettings mysqloader_conf(QSettings::NativeFormat, QSettings::UserScope, APP_NAME); mysqloader_conf.beginGroup("MySQLoader"); mysqloader_conf.setValue("Autostart", autostartCheckBox->isChecked()); mysqloader_conf.setValue("Desktop_Icon", desktopIconCheckBox->isChecked()); mysqloader_conf.setValue("Set_Language", languageGroup->isChecked()); mysqloader_conf.setValue("languageNiceName", languageCombo->currentText()); mysqloader_conf.setValue("languageFileName", fileToNiceName->value( languageCombo->currentText())); mysqloader_conf.setValue("Meldung", showMeldungCheckBox->isChecked()); mysqloader_conf.setValue("Meldung_App", meldungAppCheckBox->isChecked()); mysqloader_conf.setValue("Zeige_Fenster", showDialogCheckBox->isChecked()); mysqloader_conf.endGroup(); mysqloader_conf.beginGroup("MySQL_Paths"); mysqloader_conf.setValue("MySQL_PID_FILE", pidFileEdit->text()); mysqloader_conf.setValue("MySQL_Server", mysqlEdit->text()); mysqloader_conf.endGroup(); if (autostartCheckBox->isChecked() == true) { autostartFile.copy("/usr/share/applications/mysqloader.desktop", QDir::homePath() + "/.config/autostart/mysqloader.desktop"); } else { autostartFile.remove(QDir::homePath() + "/.config/autostart/mysqloader.desktop"); } if (desktopIconCheckBox->isChecked() == true) { autostartFile.copy("/usr/share/applications/mysqloader.desktop", QDir::homePath() + "/Desktop/mysqloader.desktop"); } else { autostartFile.remove(QDir::homePath() + "/Desktop/mysqloader.desktop"); } }
void OBJBaker::loadOBJ() { if (!QDir().mkpath(_bakedOutputDir)) { handleError("Failed to create baked OBJ output folder " + _bakedOutputDir); return; } if (!QDir().mkpath(_originalOutputDir)) { handleError("Failed to create original OBJ output folder " + _originalOutputDir); return; } // check if the OBJ is local or it needs to be downloaded if (_modelURL.isLocalFile()) { // loading the local OBJ QFile localOBJ { _modelURL.toLocalFile() }; qDebug() << "Local file url: " << _modelURL << _modelURL.toString() << _modelURL.toLocalFile() << ", copying to: " << _originalModelFilePath; if (!localOBJ.exists()) { handleError("Could not find " + _modelURL.toString()); return; } // make a copy in the output folder if (!_originalOutputDir.isEmpty()) { qDebug() << "Copying to: " << _originalOutputDir << "/" << _modelURL.fileName(); localOBJ.copy(_originalOutputDir + "/" + _modelURL.fileName()); } localOBJ.copy(_originalModelFilePath); // local OBJ is loaded emit signal to trigger its baking emit OBJLoaded(); } else { // OBJ is remote, start download auto& networkAccessManager = NetworkAccessManager::getInstance(); QNetworkRequest networkRequest; // setup the request to follow re-directs and always hit the network networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true); networkRequest.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork); networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT); networkRequest.setUrl(_modelURL); qCDebug(model_baking) << "Downloading" << _modelURL; auto networkReply = networkAccessManager.get(networkRequest); connect(networkReply, &QNetworkReply::finished, this, &OBJBaker::handleOBJNetworkReply); } }
void TestAusmt::preparePatches() { GET_DIR; GET_FILES_DIR; GET_PATCHES_DIR; // Dump patches QDir patchesResDir (":/patches/"); foreach (const QString &fileName, patchesResDir.entryList(QDir::Files)) { QFile file (patchesResDir.absoluteFilePath(fileName)); if (patchesDir.exists(fileName)) { QVERIFY(QFileInfo(patchesDir.absoluteFilePath(fileName)).isFile()); QVERIFY(patchesDir.remove(fileName)); } QVERIFY(file.copy(patchesDir.absoluteFilePath(fileName))); } foreach (const QString &dirName, patchesResDir.entryList(QDir::Dirs)) { if (patchesDir.exists(dirName)) { QVERIFY(QFileInfo(patchesDir.absoluteFilePath(dirName)).isDir()); QDir subDir (patchesDir); QVERIFY(subDir.cd(dirName)); QVERIFY(subDir.removeRecursively()); } patchesDir.mkdir(dirName); QDir patchesSubDir (patchesDir); QVERIFY(patchesSubDir.cd(dirName)); QDir patchesResSubDir (patchesResDir); QVERIFY(patchesResSubDir.cd(dirName)); foreach (const QString &fileName, patchesResSubDir.entryList(QDir::Files)) { QFile file (patchesResSubDir.absoluteFilePath(fileName)); QVERIFY(file.copy(patchesSubDir.absoluteFilePath(fileName))); } } // Update patches QString makePatchName = patchesDir.absoluteFilePath(MAKE_PATCH_SH); QFile makePatch (makePatchName); QVERIFY(makePatch.exists()); QVERIFY(makePatch.setPermissions(QFileDevice::ReadUser | QFileDevice::WriteUser | QFileDevice::ExeUser)); QProcess makePatchProcess; makePatchProcess.setWorkingDirectory(patchesDir.absolutePath()); makePatchProcess.start(patchesDir.absoluteFilePath(MAKE_PATCH_SH), QStringList() << filesDir.absolutePath()); makePatchProcess.waitForFinished(-1); QCOMPARE(makePatchProcess.exitCode(), 0); }
/* * Move the images to the images folder. */ bool relocateImages(void) { bool status = 1; QStringList filters; filters << "*.png"; fileDir[ROOT]->setNameFilters(filters); QDirIterator iterator(*fileDir[ROOT]); QFile *file; QString *name; while(iterator.hasNext() && status) { file = new QFile(iterator.next()); name = new QString(file->fileName()); name->remove(0, name->lastIndexOf(QString(fileDir[ROOT]->separator()))+1); status = file->copy(fileDir[IMAGES]->absolutePath() + fileDir[IMAGES]->separator() + *name); file->remove(); delete file; delete name; } return status; }
void TestAusmt::prepareSimple() { GET_DIR; GET_VAR_DIR; GET_FILES_DIR; if (varDir.exists()) { QVERIFY(varDir.removeRecursively()); } if (filesDir.exists()) { QVERIFY(filesDir.removeRecursively()); } QVERIFY(QDir::root().mkpath(varDir.absolutePath())); QVERIFY(QDir::root().mkpath(filesDir.absolutePath())); QDir filesResDir (":/files"); foreach (const QString &fileName, filesResDir.entryList(QDir::Files)) { QFile file (filesResDir.absoluteFilePath(fileName)); if (filesDir.exists(fileName)) { QVERIFY(QFileInfo(filesDir.absoluteFilePath(fileName)).isFile()); QVERIFY(filesDir.remove(fileName)); } QVERIFY(file.copy(filesDir.absoluteFilePath(fileName))); QFile destFile (filesDir.absoluteFilePath(fileName)); QVERIFY(destFile.exists()); destFile.setPermissions(QFileDevice::ReadUser | QFileDevice::WriteUser); } generateFileMd5sums(); }
bool FileSystem::moveFile(const QString &locationTo, const QString &locationFrom) { // QImage img(getCurrentAbsoluteFileName()); // bool success; // if(SaveConfirmation::imageWasChanged(getCurrentAbsoluteFileName())) // { // img = SaveConfirmation::getChagedImage(getCurrentAbsoluteFileName()); // success = img.save(locationForSaving); // if(success) // SaveConfirmation::deleteImage(getCurrentAbsoluteFileName()); // } // else // success = img.save(locationForSaving); QFile file; if(file.exists(locationTo)) file.remove(locationTo); bool success = file.copy(locationFrom, locationTo); if(success) SaveConfirmation::deleteImage(locationTo); return success; }
bool QDSDataStore::add( const QUniqueId& id, QFile& data, const QMimeType& type ) { // Create info file and copy data file (in an atomic fashion) QDSLockedFile infoFile( infoFileName( id ) ); if ( infoFile.exists() ) { qLog(DataSharing) << "QDSDataStore::add - info file already exists"; return false; } if ( !infoFile.openLocked( QIODevice::WriteOnly ) ) { qLog(DataSharing) << "QDSDataStore::add - " << "info file can't be written to"; return false; } if ( !data.copy( dataFileName( id ) ) ) { qLog(DataSharing) << "QDSDataStore::add - couldn't copy data file"; return false; } QDataStream ds(&infoFile); ds << 1; ds << 0; ds << type.id(); return true; }
bool TextHelper::writeBatteryPar(QString batteryPar) { QFile *dtsFile = new QFile(Global::srcPath + "/" + Global::dtsPath); QFile *tempFile = new QFile(QDir::currentPath() + "/tmp/temp.txt"); QTextStream dtsTS(dtsFile); QTextStream tempTS(tempFile); if(!dtsFile->open(QIODevice::ReadOnly)) { qDebug() << Global::srcPath + "/" + Global::dtsPath << " open fail"; return false; } if(!tempFile->open(QIODevice::WriteOnly)) { qDebug() << QDir::currentPath() + "/tmp/temp.txt" << " open fail"; dtsFile->close(); return false; } QString strLine; while (!dtsTS.atEnd()) { strLine = dtsTS.readLine(); if(strLine.contains("battery {")) { tempTS << strLine << "\n"; strLine = dtsTS.readLine(); tempTS << strLine << "\n"; tempTS << " ocv_table = <"; QStringList strList = batteryPar.trimmed().split(" "); for(int i = 1; i < 21; i++) { tempTS << strList[i -1] << " "; if(i%7 == 0) { tempTS << "\n\t\t\t"; } } tempTS << strList[20]; tempTS << ">;\n"; dtsTS.readLine(); dtsTS.readLine(); dtsTS.readLine(); continue; } tempTS << strLine << "\n"; } dtsFile->close(); tempFile->flush(); tempFile->close(); if(!dtsFile->remove()) { qDebug() << "dtsFile remove fail"; return false; } if(!tempFile->copy(Global::srcPath + "/" + Global::dtsPath)) { qDebug() << "copy fail" << Global::srcPath + "/" + Global::dtsPath; return false; } return true; }
void NuevoCandidato::cargarImagen() { QFile *file =new QFile(); QString dirImagen = QFileDialog::getOpenFileName(this, tr("Imagen Candidato"), "/home/documents/imagenes/logopal", tr("Image Files (*.png *.jpg *.bmp)")); if(dirImagen.isEmpty()) { return; } QFileInfo *file2 = new QFileInfo(dirImagen); QString dirLocal("documents/imagenes/"); QString nombreImagen; QString extension; extension = file2->completeSuffix(); nombreImagen = file2->completeBaseName(); dirLocal.append(nombreImagen); dirLocal.append("."); dirLocal.append(extension); file->copy ( dirImagen, dirLocal ); imagen = dirLocal; QPixmap *logo = new QPixmap(imagen); QSize *iconSize = new QSize(95 , 95); imgen->setPixmap(logo->scaled(*iconSize)); }
void FaceTrackNoIR::saveAs() { looping++; QSettings settings("opentrack"); QString oldFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); QString fileName = QFileDialog::getSaveFileName(this, tr("Save file"), oldFile, tr("Settings file (*.ini);;All Files (*)")); if (!fileName.isEmpty()) { QFileInfo newFileInfo ( fileName ); if ((newFileInfo.exists()) && (oldFile != fileName)) { QFile newFileFile ( fileName ); newFileFile.remove(); } QFileInfo oldFileInfo ( oldFile ); if (oldFileInfo.exists()) { QFile oldFileFile ( oldFile ); oldFileFile.copy( fileName ); } settings.setValue ("SettingsFile", fileName); save(); } looping--; fill_profile_cbx(); }
void FileManager::copyFileToFolder(QString originPath, QString originName,QString newPath,QString newName) { QFile *originFile = new QFile(originPath + "/" + originName); if(QString::compare(originPath,newPath)==0 && QString::compare(originName,newName)==0) return; if(QFile::exists(newPath+"/"+newName)) QFile::remove(newPath+"/"+newName); originFile->copy(newPath + "/" + newName); delete originFile; }
void FilePersistThread::rollFileIfNecessary(QFile& file, bool notifyListenersIfRolled) { uint64_t now = usecTimestampNow(); if ((file.size() > MAX_LOG_SIZE) || (now - _lastRollTime) > MAX_LOG_AGE_USECS) { QString newFileName = getLogRollerFilename(); if (file.copy(newFileName)) { file.open(QIODevice::WriteOnly | QIODevice::Truncate); file.close(); qDebug() << "Rolled log file:" << newFileName; if (notifyListenersIfRolled) { emit rollingLogFile(newFileName); } _lastRollTime = now; } QStringList nameFilters; nameFilters << FILENAME_WILDCARD; QDir logQDir(FileUtils::standardPath(LOGS_DIRECTORY)); logQDir.setNameFilters(nameFilters); logQDir.setSorting(QDir::Time); QFileInfoList filesInDir = logQDir.entryInfoList(); qint64 totalSizeOfDir = 0; foreach(QFileInfo dirItm, filesInDir){ if (totalSizeOfDir < MAX_LOG_DIR_SIZE){ totalSizeOfDir += dirItm.size(); } else { QFile file(dirItm.filePath()); file.remove(); } } }
void DialogConfigBooks::on_toolButtonOPenGroup_clicked() { QFileDialog dlg; QString homeDir=QDir::homePath () ; QString fn = dlg.getOpenFileName(0, tr("Open xml Files..."), homeDir , trUtf8("ملف قائمة الكتب (group.xml );;xml (group.xml)")); qDebug()<<fn; if(!dlg.AcceptOpen) // return; if (!fn.isEmpty()) { QString groupPath=QDir::homePath()+"/.kirtasse/data/group.xml"; QString groupPathNew=QDir::homePath()+"/.kirtasse/data/group.xml.old"; QFile file; if(file.exists(groupPathNew)) file.remove(groupPathNew); if(file.rename(groupPath,groupPathNew)) { if(file.copy(fn,groupPath)){ Messages->treeChargeGroupe( ui->treeWidgetBooks,0,true); ui->lineEditGroup->setText(fn); ui->toolButtonGroupUpdat->setEnabled(true); } } if(ui->treeWidgetBooks->topLevelItemCount()<1) on_toolButtonGroupUpdat_clicked(); } }
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; }
void FBXBaker::loadSourceFBX() { // check if the FBX is local or first needs to be downloaded if (_modelURL.isLocalFile()) { // load up the local file QFile localFBX { _modelURL.toLocalFile() }; qDebug() << "Local file url: " << _modelURL << _modelURL.toString() << _modelURL.toLocalFile() << ", copying to: " << _originalModelFilePath; if (!localFBX.exists()) { //QMessageBox::warning(this, "Could not find " + _fbxURL.toString(), ""); handleError("Could not find " + _modelURL.toString()); return; } // make a copy in the output folder if (!_originalOutputDir.isEmpty()) { qDebug() << "Copying to: " << _originalOutputDir << "/" << _modelURL.fileName(); localFBX.copy(_originalOutputDir + "/" + _modelURL.fileName()); } localFBX.copy(_originalModelFilePath); // emit our signal to start the import of the FBX source copy emit sourceCopyReadyToLoad(); } else { // remote file, kick off a download auto& networkAccessManager = NetworkAccessManager::getInstance(); QNetworkRequest networkRequest; // setup the request to follow re-directs and always hit the network networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true); networkRequest.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork); networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT); networkRequest.setUrl(_modelURL); qCDebug(model_baking) << "Downloading" << _modelURL; auto networkReply = networkAccessManager.get(networkRequest); connect(networkReply, &QNetworkReply::finished, this, &FBXBaker::handleFBXNetworkReply); } }
/* * name : impport_doit * desc : Do import */ void PicIn_Core::import_doit() { QFile file; QString tgtName; QString tgtPath; QString yearPath; QString monthPath; QString dayPath; QString srcPath; QDate date; QDir dir; offOption(optionCancel); //If we don't do this proccessEvents(), //progress dialog would no response until this function done. QApplication::processEvents(QEventLoop::AllEvents); for(int i = 0; i < m_fileInfoList_src.size(); i++){ srcPath = m_fileInfoList_src.at(i).absoluteFilePath(); tgtPath.clear(); tgtPath = m_copyTgtList.at(i); dir = QDir(QFileInfo(tgtPath).dir()); if(!dir.exists()){ dir.mkpath(dir.absolutePath()); } // // Copy file // QDateTime laDateTime; QDateTime lmDateTime; laDateTime = QFileInfo(srcPath).lastRead(); lmDateTime = QFileInfo(srcPath).lastModified(); file.copy(srcPath, tgtPath); setLastModifyDateTime(tgtPath, laDateTime ,lmDateTime); // // Update progress bar and check cancel // emit signal_update_progress(i); if(checkOption(optionCancel)){ break; } QApplication::processEvents(QEventLoop::AllEvents); } offOption(optionCancel); }
void QChurchView::ArquivoImportarTextos(){ QStringList arquivo = dlgArquivo.getOpenFileNames(this,"Arquivos Texto",QDir::homePath()); if(!arquivo.isEmpty()){ for(int i =0; i < arquivo.size(); i++){ QFile *novo = new QFile(arquivo.at(i)); if(!novo->copy(QString::fromStdString(configuracao.getDirLetras())+QInputDialog::getText(this,"Importando:"+arquivo.at(i),"Novo Nome"))) msgBox.critical(this,"Erro:Importacao de Arquivo de Texto", "Nao foi possivel importar o arquivo " + arquivo.at(i)); } tabMain.recarregar_letras(); } }
void rollFileIfNecessary(QFile& file) { uint64_t now = usecTimestampNow(); if ((file.size() > MAX_LOG_SIZE) || (now - _lastRollTime) > MAX_LOG_AGE_USECS) { QString newFileName = getLogRollerFilename(); if (file.copy(newFileName)) { _lastRollTime = now; file.open(QIODevice::WriteOnly | QIODevice::Truncate); file.close(); qDebug() << "Rolled log file: " << newFileName; } } }
void Autostart::SetActive( bool active ) { #ifdef Q_OS_WIN QString applicationName = QCoreApplication::applicationName(); QString applicationPath = QCoreApplication::applicationFilePath(); QSettings tmpSettings( "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat ); if( active ) { tmpSettings.setValue( applicationName, QString( "\"%1\"" ).arg( QDir::toNativeSeparators( QFileInfo( applicationPath ).filePath() ) ) ); } else { tmpSettings.remove(applicationName); } #elif defined(Q_OS_MAC) LSSharedFileListRef loginItems = LSSharedFileListCreate( NULL, kLSSharedFileListSessionLoginItems, NULL ); if( !loginItems ) return; UInt32 seed = 0U; CFArrayRef currentLoginItems = LSSharedFileListCopySnapshot( loginItems, &seed ); LSSharedFileListItemRef existingItem = FindLoginItemForCurrentBundle( currentLoginItems ); if( active && (existingItem == NULL) ) { CFURLRef mainBundleURL = CFBundleCopyBundleURL( CFBundleGetMainBundle() ); LSSharedFileListInsertItemURL( loginItems, kLSSharedFileListItemBeforeFirst, NULL, NULL, mainBundleURL, NULL, NULL ); CFRelease( mainBundleURL ); } else if( !active && (existingItem != NULL) ) { LSSharedFileListItemRemove(loginItems, existingItem); } CFRelease( currentLoginItems ); CFRelease( loginItems ); #elif defined Q_OS_LINUX QString homeLocation = QStandardPaths::writableLocation( QStandardPaths::HomeLocation ); QDir* autostartPath = new QDir(homeLocation + "/.config/autostart/"); if( !active ) { QFile* desktopFile = new QFile(autostartPath->filePath("track-o-bot.desktop")); desktopFile->remove(); } else { QFile* srcFile = new QFile( ":/assets/track-o-bot.desktop" ); LOG("source: %s", srcFile->fileName().toStdString().c_str()); LOG("source exists: %s", QString::number(srcFile->exists()).toStdString().c_str()); srcFile->copy(autostartPath->filePath("track-o-bot.desktop")); } #endif }
void Project::addFile(std::string path, int type) { QFile *buffer = new QFile(path.c_str()); QFileInfo fileInfo(buffer->fileName()); if(buffer->exists ()) { //The file exists if (!buffer->open(QIODevice::ReadOnly)) { //The file can't be read qDebug()<<"Failed to open file "<< buffer->fileName(); } else { switch(type) { case F_ENNEMY: ennemy_files.push_back(path); buffer->copy(rootFolder.absolutePath() + "/ennemies/" + fileInfo.fileName()); break; case F_LEVEL: level_files.push_back(path); buffer->copy(rootFolder.absolutePath() + "/levels/" + fileInfo.fileName()); break; case F_MUSIC: music_files.push_back(path); buffer->copy(rootFolder.absolutePath() + "/musics/" + fileInfo.fileName()); break; case F_PATH: path_files.push_back(path); buffer->copy(rootFolder.absolutePath() + "/paths/" + fileInfo.fileName()); break; case F_PATTERN: pattern_files.push_back(path); buffer->copy(rootFolder.absolutePath() + "/patterns/" + fileInfo.fileName()); break; case F_PLAYER: player_files.push_back(path); buffer->copy(rootFolder.absolutePath() + "/players/" + fileInfo.fileName()); break; case F_SPRITE: sprite_files.push_back(path); buffer->copy(rootFolder.absolutePath() + "/sprites/" + fileInfo.fileName()); break; } } } }
void NavigationView::OnExportImageButtonClick() { for(int i = 0; i < myActiveOverlays; i++) { int idx = myOverlays[i]->Index; char path[DEFAULT_STRING]; sprintf(path, ImagePathFormat.c_str(), myNavigationViewData[idx].UPImageName); QFile* source = new QFile(path); sprintf(path, ImageExportPathFormat.c_str(), myNavigationViewData[idx].Timestamp, (int)myNavigationViewData[idx].X, (int)myNavigationViewData[idx].Y, myNavigationViewData[idx].Depth); source->copy(path); delete source; } }
bool TextHelper::enableCam(int camId, QString dtsPath) { QFile *dtsFile = new QFile(dtsPath); QFile *newDtsFile = new QFile(QDir::currentPath() + "/tmp/Sofia3GR-tablet.dts"); QTextStream newDts(newDtsFile); QTextStream dtsOld(dtsFile); QString strLine; if(!dtsFile->open(QIODevice::ReadOnly)) { qDebug() << "dtsFile open fail enableCam"; return false; } if(!newDtsFile->open(QIODevice::WriteOnly)) { qDebug() << "newDtsFile open fail enableCam"; dtsFile->close(); return false; } while(!dtsOld.atEnd()) { strLine = dtsOld.readLine(); if(strLine.contains("camera" + QString::number(camId, 10)) && strLine.contains(":")) { newDts << strLine << "\n"; newDts << "\t\t//status = \"disabled\";\n"; strLine = dtsOld.readLine(); continue; } newDts << strLine << "\n"; } dtsFile->close(); newDtsFile->flush(); newDtsFile->close(); if(!dtsFile->remove()) { qDebug() << "remove dtsFile fail enableCam"; return false; } if(!newDtsFile->copy(dtsPath)) { qDebug() << "camId: " << camId << "file copy fail!!!(enableCam)"; return false; } return true; }
void UserScript::Install (QNetworkAccessManager *networkManager) { const QString& temp = QDesktopServices::storageLocation (QDesktopServices::TempLocation); if (!ScriptPath_.startsWith (temp)) return; QFile tempScript (ScriptPath_); QFileInfo installPath (Util::CreateIfNotExists ("data/poshuku/fatape/scripts/"), QFileInfo(ScriptPath_).fileName ()); tempScript.copy (installPath.absoluteFilePath ()); ScriptPath_ = installPath.absoluteFilePath (); Q_FOREACH (const QString& resource, Metadata_.values ("resource")) DownloadResource (resource, networkManager); Q_FOREACH (const QString& required, Metadata_.values ("require")) DownloadRequired (required, networkManager); }
void MainWindow::on_receberButton_clicked() { QFile *ret; QFile *destino; switch(loja){ case 2: destino = new QFile("C:\\Shop\\internet\\retpafre.zip"); ret = new QFile("C:\\Documents and Settings\\Minas Casa\\Meus documentos\\Google Drive\\RET\\retpafre.zip"); break; case 3: destino = new QFile("C:\\shop\\internet\\retpafre.zip"); ret = new QFile("C:\\Users\\Vangogh\\Google Drive\\RET\\retpafre.zip"); break; case 4: destino = new QFile("C:\\shop\\internet\\retpafre.zip"); ret = new QFile("C:\\Users\\Loja Minas casa\\Google Drive\\RET\\retpafre.zip"); break; case 6: destino = new QFile("D:\\Sistema\\SHOP\\INTERNET\\retpafre.zip"); ret = new QFile("C:\\Documents and Settings\\Vangogh\\Meus documentos\\Google Drive\\RET\\retpafre.zip"); break; case 10: destino = new QFile("C:\\shop\\internet\\retpafre.zip"); ret = new QFile("C:\\Users\\loja Pmapulha\\Google Drive\\RET\\retpafre.zip"); break; default: ret = NULL; destino = NULL; break; } if(!ret->exists()){ QMessageBox msgBox; msgBox.setText("Arquivo não encontrado"); msgBox.exec(); return; } else { if(destino->exists()){ destino->remove(); } if(!ret->copy(ret->fileName(), destino->fileName())){ QMessageBox msgBox2; msgBox2.setText("Erro ao copiar"); msgBox2.exec(); } else { QMessageBox msgBox3; msgBox3.setText("Copiado"); msgBox3.exec(); } } }
void copiarArchivo::on_buttonBox_accepted() { QFile myFile (rutaOrigen); QString nombreArchivo = ui->lineEdit->text(); while(!rutaOrigen.endsWith("/")){ rutaOrigen.remove(rutaOrigen.length()-1,1); } if (!myFile.copy(rutaOrigen + nombreArchivo + ".csv")){ //if (!myFile.copy("F:/Universidad/PROYECTOS/SCOMAR/PROGRAMAS/"+ nombreArchivo + ".csv")){ QMessageBox msgBox; msgBox.setWindowTitle("MENSAJE"); msgBox.setText("ERROR COPIANDO ARCHIVO"); msgBox.exec(); this->close(); }else{ this->close(); } }
void DialogConfigBooks::on_toolButtonGroupUpdat_clicked() { QString groupPath=QDir::homePath()+"/.kirtasse/data/group.xml"; QString groupPathOld=QDir::homePath()+"/.kirtasse/data/group.xml.old"; QFile file; if(file.exists(groupPathOld)){ if(file.exists(groupPath)) file.remove(groupPath); file.rename(groupPathOld,groupPath); Messages->treeChargeGroupe( ui->treeWidgetBooks,0,true); ui->lineEditGroup->setText(groupPath); }else{ QDir appDir(QCoreApplication::applicationDirPath() ); appDir.cdUp(); QString pathApp= appDir.absolutePath()+"/share/elkirtasse"; file.copy(pathApp+"/data/group.xml",groupPath); } ui->toolButtonGroupUpdat->setEnabled(false); }
/** * Move the images to the images folder. */ bool KMLBuilder::relocateImages() { QStringList filters; filters << "*.png"; image_directory.setNameFilters(filters); qDebug() << image_directory.entryList().size(); QDirIterator iterator(image_directory); QFile *file; QString name; while(iterator.hasNext()) { file = new QFile(iterator.next()); QString fn = QFileInfo(*file).fileName(); file->copy(fileDirs["images"]->absolutePath() + QDir::separator() + fn); file->remove(); delete file; } return true; }
bool ProjectFile::CopyFile(QString oldFile, QString newDir) { QString newFile = newDir + QDir::separator() + QFileInfo(oldFile).fileName(); if (CheckForExistingFile(newFile)) { if (WarnFileExists(newFile)) { RemoveFile(newFile); } else { return false; } } QFile file (oldFile); if (file.exists()) { return file.copy(newFile); } return false; }
void IMT_MRGui::copytoarchive() { QDateTime datum = QDateTime::currentDateTime() ; QString dat_str; dat_str = datum.toString("dd-MM-yyyy_hh-mm-ss"); QString archive_path =_pathsetting->get_archivepath()+"/"+dat_str; QDir archive_dir; QFile filetocopy; if(_dicom) { archive_dir.mkpath(archive_path); for(int i=0; i<_filenames_to_archive.size();++i) { filetocopy.setFileName(_pathsetting->get_dcmrawpath()+"/"+_filenames_to_archive.at(i)); filetocopy.copy(archive_path+"/"+_filenames_to_archive.at(i)); filetocopy.remove(); } } }