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) if(processedFilesCount != numFilesCount)
{ {
Logger::error() << "Errors occured while trying to add files to the database. Processed " << processedFilesCount 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; return 1;
} }

View File

@ -22,7 +22,8 @@ int CommandDelete::remove(QString pattern, bool onlyDeleted, bool verbose, bool
{ {
if(verbose) 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 else
@ -33,19 +34,19 @@ int CommandDelete::remove(QString pattern, bool onlyDeleted, bool verbose, bool
{ {
if(verbose) if(verbose)
{ {
Logger::info() << "Deleted" << file.absPath << endl; Logger::info() << "Deleted" << file.absPath << Qt::endl;
} }
++deleted; ++deleted;
} }
else else
{ {
Logger::error() << "Failed to delete:" << file.absPath << ", exiting." << endl; Logger::error() << "Failed to delete:" << file.absPath << ", exiting." << Qt::endl;
return 1; return 1;
} }
} }
else 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) if(verbose)
{ {
Logger::info() << "Deleted" << absPath << endl; Logger::info() << "Deleted" << absPath << Qt::endl;
} }
} }
else else
{ {
Logger::error() << "Failed to delete:" << absPath << endl; Logger::error() << "Failed to delete:" << absPath << Qt::endl;
result = 1; result = 1;
} }
} }
} }
else else
{ {
Logger::error() << "No such file in database:" << absPath << endl; Logger::error() << "No such file in database:" << absPath << Qt::endl;
result = 1; result = 1;
} }
} }
@ -124,7 +125,7 @@ int CommandDelete::handle(QStringList arguments)
int result = this->remove(pattern, deleted, verbose, dryRun); int result = this->remove(pattern, deleted, verbose, dryRun);
if(result != 0) if(result != 0)
{ {
Logger::error() << "Removal operation did not succeed" << endl; Logger::error() << "Removal operation did not succeed" << Qt::endl;
return result; return result;
} }
} }

View File

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

View File

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

View File

@ -64,7 +64,7 @@ int CommandUpdate::handle(QStringList arguments)
} }
else 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)) 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) if(!keepGoing)
{ {
return 1; return 1;
@ -84,13 +85,13 @@ int CommandUpdate::handle(QStringList arguments)
} }
if(verbose) if(verbose)
{ {
Logger::info() << "Deleted" << fileData.absPath << endl; Logger::info() << "Deleted" << fileData.absPath << Qt::endl;
} }
} }
else 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) if(!keepGoing)
{ {
Logger::error() << "Failed to update all files selected for updating. Updated" << updatedFilesCount 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; return 1;
} }
} }

View File

@ -15,7 +15,7 @@ QSqlDatabase DatabaseFactory::createNew()
db.setDatabaseName(this->connectionString); db.setDatabaseName(this->connectionString);
if(!db.open()) 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"); throw LooqsGeneralException("Failed to create open new connection");
} }
return db; return db;
@ -32,7 +32,7 @@ QSqlDatabase DatabaseFactory::forCurrentThread()
db.setDatabaseName(this->connectionString); db.setDatabaseName(this->connectionString);
if(!db.open()) 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"); throw LooqsGeneralException("Failed to create open new connection");
} }
dbStore.setLocalData(db); dbStore.setLocalData(db);

View File

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

View File

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

View File

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