Resolve Qt deprication: endl -> Qt::endl

This commit is contained in:
Albert S. 2021-06-12 22:55:56 +02:00
parent 01872e37d5
commit f67b7bbb21
9 changed files with 34 additions and 32 deletions

View File

@ -59,7 +59,7 @@ int CommandAdd::handle(QStringList arguments)
if(processedFilesCount != numFilesCount)
{
Logger::error() << "Errors occured while trying to add files to the database. Processed " << processedFilesCount
<< "out of" << numFilesCount << "files" << endl;
<< "out of" << numFilesCount << "files" << Qt::endl;
return 1;
}

View File

@ -22,7 +22,8 @@ int CommandDelete::remove(QString pattern, bool onlyDeleted, bool verbose, bool
{
if(verbose)
{
Logger::info() << "Skipping " << file.absPath << " as the file exists on the file system" << endl;
Logger::info() << "Skipping " << file.absPath << " as the file exists on the file system"
<< Qt::endl;
}
}
else
@ -33,19 +34,19 @@ int CommandDelete::remove(QString pattern, bool onlyDeleted, bool verbose, bool
{
if(verbose)
{
Logger::info() << "Deleted" << file.absPath << endl;
Logger::info() << "Deleted" << file.absPath << Qt::endl;
}
++deleted;
}
else
{
Logger::error() << "Failed to delete:" << file.absPath << ", exiting." << endl;
Logger::error() << "Failed to delete:" << file.absPath << ", exiting." << Qt::endl;
return 1;
}
}
else
{
Logger::info() << "Would delete " << file.absPath << endl;
Logger::info() << "Would delete " << file.absPath << Qt::endl;
}
}
}
@ -79,19 +80,19 @@ int CommandDelete::removePaths(const QStringList &paths, bool verbose, bool dryR
{
if(verbose)
{
Logger::info() << "Deleted" << absPath << endl;
Logger::info() << "Deleted" << absPath << Qt::endl;
}
}
else
{
Logger::error() << "Failed to delete:" << absPath << endl;
Logger::error() << "Failed to delete:" << absPath << Qt::endl;
result = 1;
}
}
}
else
{
Logger::error() << "No such file in database:" << absPath << endl;
Logger::error() << "No such file in database:" << absPath << Qt::endl;
result = 1;
}
}
@ -124,7 +125,7 @@ int CommandDelete::handle(QStringList arguments)
int result = this->remove(pattern, deleted, verbose, dryRun);
if(result != 0)
{
Logger::error() << "Removal operation did not succeed" << endl;
Logger::error() << "Removal operation did not succeed" << Qt::endl;
return result;
}
}

View File

@ -28,7 +28,7 @@ int CommandList::handle(QStringList arguments)
for(SearchResult &result : results)
{
Logger::info() << result.fileData.absPath << endl;
Logger::info() << result.fileData.absPath << Qt::endl;
}
return 0;

View File

@ -30,7 +30,7 @@ int CommandSearch::handle(QStringList arguments)
for(SearchResult &result : results)
{
Logger::info() << result.fileData.absPath << endl;
Logger::info() << result.fileData.absPath << Qt::endl;
}
return 0;

View File

@ -64,7 +64,7 @@ int CommandUpdate::handle(QStringList arguments)
}
else
{
Logger::info() << "Would update" << fileData.absPath << endl;
Logger::info() << "Would update" << fileData.absPath << Qt::endl;
}
}
}
@ -76,7 +76,8 @@ int CommandUpdate::handle(QStringList arguments)
{
if(!this->dbService->deleteFile(fileData.absPath))
{
Logger::error() << "Error: Failed to delete" << fileData.absPath << "from databas" << endl;
Logger::error()
<< "Error: Failed to delete" << fileData.absPath << "from databas" << Qt::endl;
if(!keepGoing)
{
return 1;
@ -84,13 +85,13 @@ int CommandUpdate::handle(QStringList arguments)
}
if(verbose)
{
Logger::info() << "Deleted" << fileData.absPath << endl;
Logger::info() << "Deleted" << fileData.absPath << Qt::endl;
}
}
else
{
Logger::info() << "Would delete" << fileData.absPath << endl;
Logger::info() << "Would delete" << fileData.absPath << Qt::endl;
}
}
}
@ -103,7 +104,7 @@ int CommandUpdate::handle(QStringList arguments)
if(!keepGoing)
{
Logger::error() << "Failed to update all files selected for updating. Updated" << updatedFilesCount
<< "out of" << shouldHaveUpdatedCount << "selected for upating" << endl;
<< "out of" << shouldHaveUpdatedCount << "selected for upating" << Qt::endl;
return 1;
}
}

View File

@ -15,7 +15,7 @@ QSqlDatabase DatabaseFactory::createNew()
db.setDatabaseName(this->connectionString);
if(!db.open())
{
Logger::error() << "Failed to open the database: " << this->connectionString << endl;
Logger::error() << "Failed to open the database: " << this->connectionString << Qt::endl;
throw LooqsGeneralException("Failed to create open new connection");
}
return db;
@ -32,7 +32,7 @@ QSqlDatabase DatabaseFactory::forCurrentThread()
db.setDatabaseName(this->connectionString);
if(!db.open())
{
Logger::error() << "Failed to open the database: " << this->connectionString << endl;
Logger::error() << "Failed to open the database: " << this->connectionString << Qt::endl;
throw LooqsGeneralException("Failed to create open new connection");
}
dbStore.setLocalData(db);

View File

@ -73,12 +73,12 @@ int FileSaver::processFiles(const QVector<QString> paths, std::function<SaveFile
}
if(verbose)
{
Logger::info() << "Processing " << path << endl;
Logger::info() << "Processing " << path << Qt::endl;
}
SaveFileResult result = saverFunc(path);
if(result == DBFAIL || result == PROCESSFAIL)
{
Logger::error() << "Failed to process " << path << endl;
Logger::error() << "Failed to process " << path << Qt::endl;
if(!keepGoing)
{
terminate = true;
@ -92,11 +92,11 @@ int FileSaver::processFiles(const QVector<QString> paths, std::function<SaveFile
if(result == SKIPPED)
{
Logger::info() << "Skipped" << path
<< "as it already exists in the database" << endl;
<< "as it already exists in the database" << Qt::endl;
}
else if(result == OK)
{
Logger::info() << "Added" << path << endl;
Logger::info() << "Added" << path << Qt::endl;
}
}
}
@ -125,7 +125,7 @@ SaveFileResult FileSaver::saveFile(const QFileInfo &fileInfo)
}
catch(LooqsGeneralException &e)
{
Logger::error() << "Error while processing" << absPath << ":" << e.message << endl;
Logger::error() << "Error while processing" << absPath << ":" << e.message << Qt::endl;
return PROCESSFAIL;
}
}
@ -133,7 +133,7 @@ SaveFileResult FileSaver::saveFile(const QFileInfo &fileInfo)
// Could happen if a file corrupted for example
if(pageData.isEmpty() && processor != nothingProcessor)
{
Logger::error() << "Could not get any content for " << absPath << endl;
Logger::error() << "Could not get any content for " << absPath << Qt::endl;
}
return this->dbService->saveFile(fileInfo, pageData);

View File

@ -88,12 +88,12 @@ int main(int argc, char *argv[])
}
catch(const LooqsGeneralException &e)
{
Logger::error() << "Exception caught, message: " << e.message << endl;
Logger::error() << "Exception caught, message: " << e.message << Qt::endl;
}
}
else
{
Logger::error() << "Unknown command " << commandName << endl;
Logger::error() << "Unknown command " << commandName << Qt::endl;
}
return 1;
}

View File

@ -57,7 +57,7 @@ bool SqliteDbService::deleteFile(QString path)
bool result = query.exec();
if(!result)
{
Logger::error() << "Failed to delete file" << path << endl;
Logger::error() << "Failed to delete file" << path << Qt::endl;
}
return result;
}
@ -128,20 +128,20 @@ SaveFileResult SqliteDbService::saveFile(QFileInfo fileInfo, QVector<PageData> &
if(!db.transaction())
{
Logger::error() << "Failed to open transaction for " << absPath << " : " << db.lastError() << endl;
Logger::error() << "Failed to open transaction for " << absPath << " : " << db.lastError() << Qt::endl;
return DBFAIL;
}
if(!delQuery.exec())
{
Logger::error() << "Failed DELETE query" << delQuery.lastError() << endl;
Logger::error() << "Failed DELETE query" << delQuery.lastError() << Qt::endl;
db.rollback();
return DBFAIL;
}
if(!inserterQuery.exec())
{
Logger::error() << "Failed INSERT query" << inserterQuery.lastError() << endl;
Logger::error() << "Failed INSERT query" << inserterQuery.lastError() << Qt::endl;
db.rollback();
return DBFAIL;
}
@ -157,7 +157,7 @@ SaveFileResult SqliteDbService::saveFile(QFileInfo fileInfo, QVector<PageData> &
if(!contentQuery.exec())
{
db.rollback();
Logger::error() << "Failed content insertion " << contentQuery.lastError() << endl;
Logger::error() << "Failed content insertion " << contentQuery.lastError() << Qt::endl;
return DBFAIL;
}
}
@ -165,7 +165,7 @@ SaveFileResult SqliteDbService::saveFile(QFileInfo fileInfo, QVector<PageData> &
if(!db.commit())
{
db.rollback();
Logger::error() << "Failed to commit transaction for " << absPath << " : " << db.lastError() << endl;
Logger::error() << "Failed to commit transaction for " << absPath << " : " << db.lastError() << Qt::endl;
return DBFAIL;
}
return OK;