本文整理汇总了C++中QFile::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ QFile::remove方法的具体用法?C++ QFile::remove怎么用?C++ QFile::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QFile
的用法示例。
在下文中一共展示了QFile::remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Parser::~Parser()
{
QFile dotFile;
if (dotFile.exists(m_dotFile)) dotFile.remove(m_dotFile);
if (dotFile.exists(m_dotFile+".plain")) dotFile.remove(m_dotFile+".plain");
dotFile.close();
}
示例2: tr
void
aBackup::cleanupTmpFiles(const QString& tmpDirName, QStringList *files)
{
QFile file;
QDir dir;
file.setName(QDir::convertSeparators(tmpDirName+"/content.xml"));
aLog::print(aLog::Debug, tr("aBackup delete file %1").arg(file.name()));
file.remove();
file.setName(QDir::convertSeparators(tmpDirName+"/busines-schema.cfg"));
aLog::print(aLog::Debug, tr("aBackup delete file %1").arg(file.name()));
file.remove();
file.setName(QDir::convertSeparators(tmpDirName+"/META-INF/manifest.xml"));
aLog::print(aLog::Debug, tr("aBackup delete file %1").arg(file.name()));
file.remove();
for(uint i=0; i<files->count(); i++)
{
file.setName(QDir::convertSeparators(tmpDirName + "/templates/"+ (*files)[i]));
aLog::print(aLog::Debug, tr("aBackup delete file %1").arg(file.name()));
file.remove();
}
aLog::print(aLog::Debug, tr("aBackup delete directory %1").arg(tmpDirName + "/META-INF"));
dir.rmdir(QDir::convertSeparators(tmpDirName + "/META-INF"));
aLog::print(aLog::Debug, tr("aBackup delete directory %1").arg(tmpDirName + "/templates"));
dir.rmdir(QDir::convertSeparators(tmpDirName + "/templates"));
aLog::print(aLog::Debug, tr("aBackup delete directory %1").arg(tmpDirName));
dir.rmdir(QDir::convertSeparators(tmpDirName));
aLog::print(aLog::Info, tr("aBackup cleanup temporary files"));
}
示例3:
Parser::~Parser()
{
QFile fileHandler;
if (fileHandler.exists(m_dotFile+".plain")) fileHandler.remove(m_dotFile+".plain");
if (fileHandler.exists(m_dotFile) && m_lastErrorMsg.isEmpty()) fileHandler.remove(m_dotFile);
fileHandler.close();
}
示例4: DeleteIndex
void Aleatorio::DeleteIndex(){
QFile file; //borramos los ficheros
file.setFileName(Path + "/index.dat");
file.remove();
file.setFileName(Path + "/radit.txt");
file.remove();
file.close();
}
示例5: writeSettings
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");
}
}
示例6: appFolder
/*
* LoadData class constuctor
* Inputs: parent, QString fileInput
* Constructor takes in a route number as fileInput, such as fileInput = 10
* and looks for a file with name route10.xml. If it's not found, it lets caller
* know to create it, and if it is found it loads up specified station and time info.
*/
LoadData::LoadData(QObject* parent, QString fileInput) {
buses.clear();
stations.clear();
failFlag = false; //Fail flag set to true if file is not found
QString fileName = "route" + fileInput + ".xml";
//Open file in specified folder with inputted file name
QString appFolder(QDir::currentPath());
QString fileExtension = appFolder + "/app/native/assets/schedule/"
+ fileName;
QFile *file = new QFile(fileExtension);
if (!file->open(QIODevice::ReadOnly | QIODevice::Text)) {
//qDebug() << "Failed to open " + fileName;
//Now download file...
failFlag = true;
return;
}
qDebug() << "Start load data: " + fileName;
QDomDocument doc("route"); //Get the root node, route
QString bl = "h";
QString *errorMsg = &bl;
//If the xml file is corrupted & doesn't have root node "route", then redownload file.
if (!doc.setContent(file, true, errorMsg)) {
////qDebug() << "I failed to open " + fileName;
file->close();
//Delete file, redownload
file->remove();
failFlag = true;
return;
}
file->close();
root = doc.documentElement(); //Setup root node
}
示例7: writeAvatarFile
QString CDTpAvatarUpdate::writeAvatarFile(QFile &avatarFile)
{
if (not mCacheDir.exists() && not QDir::root().mkpath(mCacheDir.absolutePath())) {
warning() << "Could not create large avatar cache dir:" << mCacheDir.path();
return QString();
}
QTemporaryFile tempFile(mCacheDir.absoluteFilePath(QLatin1String("pinkpony")));
const QByteArray data = mNetworkReply->readAll();
if (tempFile.open() && data.count() == tempFile.write(data)) {
tempFile.close();
if (avatarFile.exists()) {
avatarFile.remove();
}
if (tempFile.rename(avatarFile.fileName())) {
tempFile.setAutoRemove(false);
return avatarFile.fileName();
}
}
return QString();
}
示例8: copiarAquivos
void janelaPrincipal::copiarAquivos(QFile &origem, QFile &destino)
{
qint64 nCopySize = origem.size();
ui->progressBarGeral->setMaximum(nCopySize);
if(!(origem.open(QFile::ReadOnly) && destino.open(QFile::ReadWrite))){
return;
}
qDebug() << QString::number(nCopySize)+" o tamanho do arquivo";
//dialog->show();
for (qint64 i = 0; i < nCopySize; i += 1024*1024) {
if(iscopy){
destino.write(origem.read(i)); // write a byte
destino.seek(i); // move to next byte to read
origem.seek(i); // move to next byte to write
ui->progressBarGeral->setValue(i);
}else {
destino.remove();
break;
}
// ui->progressBarGeral->;
}
ui->progressBarGeral->setVisible(false);
ui->progressBarGeral->setValue(0);
modeldir->refresh();
}
示例9: guardar
void DialogVarConfig::guardar()
{
QStringList retorno;
retorno<<ui->txt1->text();
retorno<<ui->txt2->currentText();
retorno<<ui->txt3->text();
retorno<<ui->txt4->text();
retorno<<ui->txt5->text();
retorno<<ui->txt6->text();
retorno<<ui->txt7->text();
retorno<<ui->txt8->text();
retorno<<ui->txt9->text();
retorno<<ui->txt10->text();
if(estado == 2){
datos.append(retorno.join(":::"));
} else if(estado == 1){
datos.removeAt(index);
datos.append(retorno.join(":::"));
}
QFile f;
f.setFileName("scriptsconfig");
f.remove();
f.open(QIODevice::WriteOnly);
f.write(datos.join("\n").toLatin1());
f.waitForBytesWritten(0);
f.close();
}
示例10: writeBatteryPar
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;
}
示例11: on_toolButtonOPenGroup_clicked
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();
}
}
示例12: writeSettings
void QtDcmPreferences::writeSettings()
{
//Remove settings file
QFile ini ( d->iniFile.fileName() );
ini.remove();
//Instantiate a QSettings object with the ini file.
QSettings prefs ( d->iniFile.fileName(), QSettings::IniFormat );
//Write local settings from the private attributes
prefs.beginGroup ( "LocalSettings" );
prefs.setValue ( "AETitle", d->aetitle );
prefs.setValue ( "Port", d->port );
prefs.setValue ( "Hostname", d->hostname );
prefs.endGroup();
prefs.beginGroup ( "Converter" );
prefs.setValue ( "Dcm2nii", d->dcm2niiPath );
prefs.setValue ( "UseDcm2nii", d->useDcm2nii );
prefs.endGroup();
//Do the job for each server
prefs.beginGroup ( "Servers" );
for ( int i = 0; i < d->servers.size(); i++ )
{
prefs.beginGroup ( "Server" + QString::number ( i + 1 ) );
prefs.setValue ( "AETitle", d->servers.at ( i )->getAetitle() );
prefs.setValue ( "Hostname", d->servers.at ( i )->getServer() );
prefs.setValue ( "Port", d->servers.at ( i )->getPort() );
prefs.setValue ( "Name", d->servers.at ( i )->getName() );
prefs.endGroup();
}
prefs.endGroup();
emit preferencesUpdated();
}
示例13: deleteFile
bool DataManager::deleteFile(int index)
{
QFile* file = m_fileVec.at(index);
if( file && file->remove() )
return true;
return false;
}
示例14: relocateImages
/*
* 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;
}
示例15: saveAs
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();
}