From e97551be977584896512f9b2f7de8519a78f151d Mon Sep 17 00:00:00 2001 From: Albert S Date: Sat, 12 Jun 2021 14:59:58 +0200 Subject: [PATCH] Rename all symbols to new project name --- cli/command.cpp | 2 +- cli/commandadd.cpp | 6 ++--- cli/commandlist.cpp | 4 ++-- cli/commandsearch.cpp | 2 +- cli/commandupdate.cpp | 6 ++--- cli/databasefactory.cpp | 4 ++-- cli/encodingdetector.cpp | 8 +++---- cli/filesaver.cpp | 2 +- cli/main.cpp | 4 ++-- cli/odtprocessor.cpp | 6 ++--- cli/pdfprocessor.cpp | 4 ++-- cli/sqlitedbservice.cpp | 8 +++---- cli/sqlitedbservice.h | 2 +- cli/utils.cpp | 4 ++-- cli/utils.h | 2 +- gui/main.cpp | 2 +- gui/mainwindow.cpp | 8 +++---- gui/mainwindow.h | 4 ++-- shared/common.cpp | 12 +++++----- shared/looqsgeneralexception.cpp | 2 +- shared/looqsgeneralexception.h | 14 ++++++------ shared/looqsquery.cpp | 38 ++++++++++++++++---------------- shared/looqsquery.h | 12 +++++----- shared/shared.pro | 10 ++++----- shared/sqlitesearch.cpp | 14 ++++++------ shared/sqlitesearch.h | 6 ++--- 26 files changed, 93 insertions(+), 93 deletions(-) diff --git a/cli/command.cpp b/cli/command.cpp index 7503a4d..34cbc54 100644 --- a/cli/command.cpp +++ b/cli/command.cpp @@ -2,4 +2,4 @@ #include #include #include "command.h" -#include "qssgeneralexception.h" +#include "looqsgeneralexception.h" diff --git a/cli/commandadd.cpp b/cli/commandadd.cpp index 13c79b0..1c5f718 100644 --- a/cli/commandadd.cpp +++ b/cli/commandadd.cpp @@ -17,8 +17,8 @@ int CommandAdd::handle(QStringList arguments) { QCommandLineParser parser; parser.addOptions({{{"c", "continue"}, - "Continue adding files, don't exit on first error. If this option is not given, qss will exit " - "asap, but it's possible that a few files will still be processed. " + "Continue adding files, don't exit on first error. If this option is not given, looqs will " + "exit asap, but it's possible that a few files will still be processed. " "Set -t 1 to avoid this behavior, but processing will be slower. "}, {{"a", "all"}, "On error, no files should be added, even already processed ones"}, {{"v", "verbose"}, "Print skipped and added files"}, @@ -32,7 +32,7 @@ int CommandAdd::handle(QStringList arguments) bool verbose = parser.isSet("verbose"); if(parser.isSet("all")) { - throw QSSGeneralException("To be implemented"); + throw LooqsGeneralException("To be implemented"); } if(parser.isSet("threads")) { diff --git a/cli/commandlist.cpp b/cli/commandlist.cpp index 3254469..0a13e95 100644 --- a/cli/commandlist.cpp +++ b/cli/commandlist.cpp @@ -19,12 +19,12 @@ int CommandList::handle(QStringList arguments) bool reverse = parser.isSet("reverse"); if(reverse) { - throw QSSGeneralException("Reverse option to be implemented"); + throw LooqsGeneralException("Reverse option to be implemented"); } QStringList files = parser.positionalArguments(); QString queryStrings = files.join(' '); - auto results = dbService->search(QSSQuery::build(queryStrings)); + auto results = dbService->search(LooqsQuery::build(queryStrings)); for(SearchResult &result : results) { diff --git a/cli/commandsearch.cpp b/cli/commandsearch.cpp index 95e8b09..6cc0c33 100644 --- a/cli/commandsearch.cpp +++ b/cli/commandsearch.cpp @@ -16,7 +16,7 @@ int CommandSearch::handle(QStringList arguments) QStringList files = parser.positionalArguments(); QString queryStrings = files.join(' '); - QSSQuery query = QSSQuery::build(queryStrings); + LooqsQuery query = LooqsQuery::build(queryStrings); bool reverse = parser.isSet("reverse"); if(reverse) { diff --git a/cli/commandupdate.cpp b/cli/commandupdate.cpp index f4c5a73..ad3fdd9 100644 --- a/cli/commandupdate.cpp +++ b/cli/commandupdate.cpp @@ -15,8 +15,8 @@ int CommandUpdate::handle(QStringList arguments) {"pattern", "Only consider to update files in the index matching the pattern, e. g. */.git/*.", "pattern"}, {{"d", "delete"}, "If a file does not exist anymore, delete it"}, {{"c", "continue"}, - "Continue adding files, don't exit on first error. If this option is not given, qss will exit asap, but it's " - "possible that a few files will still be processed. " + "Continue adding files, don't exit on first error. If this option is not given, looqs will exit asap, but " + "it's possible that a few files will still be processed. " "Set -t 1 to avoid this behavior, but processing will be slower."}, {{"a", "all"}, "On error, no files should be updated, even already processed ones"}, {{"t", "threads"}, "Number of threads to use.", "threads"} @@ -35,7 +35,7 @@ int CommandUpdate::handle(QStringList arguments) if(parser.isSet("all")) { - throw QSSGeneralException("To be implemented"); + throw LooqsGeneralException("To be implemented"); } if(parser.isSet("threads")) { diff --git a/cli/databasefactory.cpp b/cli/databasefactory.cpp index a3803dd..5a10740 100644 --- a/cli/databasefactory.cpp +++ b/cli/databasefactory.cpp @@ -16,7 +16,7 @@ QSqlDatabase DatabaseFactory::createNew() if(!db.open()) { Logger::error() << "Failed to open the database: " << this->connectionString << endl; - throw QSSGeneralException("Failed to create open new connection"); + throw LooqsGeneralException("Failed to create open new connection"); } return db; } @@ -33,7 +33,7 @@ QSqlDatabase DatabaseFactory::forCurrentThread() if(!db.open()) { Logger::error() << "Failed to open the database: " << this->connectionString << endl; - throw QSSGeneralException("Failed to create open new connection"); + throw LooqsGeneralException("Failed to create open new connection"); } dbStore.setLocalData(db); return db; diff --git a/cli/encodingdetector.cpp b/cli/encodingdetector.cpp index 5c4af20..a3f9ff6 100644 --- a/cli/encodingdetector.cpp +++ b/cli/encodingdetector.cpp @@ -1,6 +1,6 @@ #include #include "encodingdetector.h" -#include +#include EncodingDetector::EncodingDetector() { } @@ -11,7 +11,7 @@ QString EncodingDetector::detectEncoding(const QByteArray &data) const if(uchardet_handle_data(detector, data.data(), data.size()) != 0) { uchardet_delete(detector); - throw QSSGeneralException("Decoder failed"); + throw LooqsGeneralException("Decoder failed"); } uchardet_data_end(detector); QString encoding = uchardet_get_charset(detector); @@ -30,13 +30,13 @@ QString EncodingDetector::detectEncoding(QDataStream &s) const { uchardet_delete(detector); - throw QSSGeneralException("Decoder failed"); + throw LooqsGeneralException("Decoder failed"); } } if(n == -1) { uchardet_delete(detector); - throw QSSGeneralException("Read failed"); + throw LooqsGeneralException("Read failed"); } uchardet_data_end(detector); QString encoding = uchardet_get_charset(detector); diff --git a/cli/filesaver.cpp b/cli/filesaver.cpp index 7d596ce..c841bab 100644 --- a/cli/filesaver.cpp +++ b/cli/filesaver.cpp @@ -123,7 +123,7 @@ SaveFileResult FileSaver::saveFile(const QFileInfo &fileInfo) pageData = processor->process(Utils::readFile(absPath)); } } - catch(QSSGeneralException &e) + catch(LooqsGeneralException &e) { Logger::error() << "Error while processing" << absPath << ":" << e.message << endl; return PROCESSFAIL; diff --git a/cli/main.cpp b/cli/main.cpp index db5b53e..a63cce3 100644 --- a/cli/main.cpp +++ b/cli/main.cpp @@ -69,7 +69,7 @@ int main(int argc, char *argv[]) { Common::ensureConfigured(); } - catch(QSSGeneralException &e) + catch(LooqsGeneralException &e) { Logger::error() << "Error: " << e.message; return 1; @@ -86,7 +86,7 @@ int main(int argc, char *argv[]) { return cmd->handle(args); } - catch(const QSSGeneralException &e) + catch(const LooqsGeneralException &e) { Logger::error() << "Exception caught, message: " << e.message << endl; } diff --git a/cli/odtprocessor.cpp b/cli/odtprocessor.cpp index 884da70..9bd61b4 100644 --- a/cli/odtprocessor.cpp +++ b/cli/odtprocessor.cpp @@ -5,7 +5,7 @@ QVector OdtProcessor::process(const QByteArray &data) const { - throw QSSGeneralException("Not implemented yet"); + throw LooqsGeneralException("Not implemented yet"); } QVector OdtProcessor::process(QString path) const @@ -14,12 +14,12 @@ QVector OdtProcessor::process(QString path) const zipFile.setFileName("content.xml"); if(!zipFile.open(QIODevice::ReadOnly)) { - throw QSSGeneralException("Error while opening file " + path); + throw LooqsGeneralException("Error while opening file " + path); } QByteArray entireContent = zipFile.readAll(); if(entireContent.isEmpty()) { - throw QSSGeneralException("Error while reading content.xml of " + path); + throw LooqsGeneralException("Error while reading content.xml of " + path); } TagStripperProcessor tsp; return tsp.process(entireContent); diff --git a/cli/pdfprocessor.cpp b/cli/pdfprocessor.cpp index 22f8e3b..6a40e31 100644 --- a/cli/pdfprocessor.cpp +++ b/cli/pdfprocessor.cpp @@ -11,11 +11,11 @@ QVector PdfProcessor::process(const QByteArray &data) const QScopedPointer doc(Poppler::Document::loadFromData(data)); if(doc.isNull()) { - throw QSSGeneralException("Failed to process pdf data"); + throw LooqsGeneralException("Failed to process pdf data"); } if(doc->isLocked()) { - throw QSSGeneralException("Doc is locked"); + throw LooqsGeneralException("Doc is locked"); } QRectF entirePage; diff --git a/cli/sqlitedbservice.cpp b/cli/sqlitedbservice.cpp index 2f0de8d..b1226b9 100644 --- a/cli/sqlitedbservice.cpp +++ b/cli/sqlitedbservice.cpp @@ -12,7 +12,7 @@ bool SqliteDbService::fileExistsInDatabase(QString path, qint64 mtime) query.addBindValue(mtime); if(!query.exec()) { - throw QSSGeneralException("Error while trying to query for file existance: " + query.lastError().text()); + throw LooqsGeneralException("Error while trying to query for file existance: " + query.lastError().text()); } if(!query.next()) { @@ -21,7 +21,7 @@ bool SqliteDbService::fileExistsInDatabase(QString path, qint64 mtime) return query.value(0).toBool(); } -QVector SqliteDbService::search(const QSSQuery &query) +QVector SqliteDbService::search(const LooqsQuery &query) { auto connection = dbFactory->forCurrentThread(); SqliteSearch searcher(connection); @@ -35,7 +35,7 @@ bool SqliteDbService::fileExistsInDatabase(QString path) query.addBindValue(path); if(!query.exec()) { - throw QSSGeneralException("Error while trying to query for file existance: " + query.lastError().text()); + throw LooqsGeneralException("Error while trying to query for file existance: " + query.lastError().text()); } if(!query.next()) { @@ -82,7 +82,7 @@ int SqliteDbService::getFiles(QVector &results, QString wildCardPatter query.setForwardOnly(true); if(!query.exec()) { - throw QSSGeneralException("Error while trying to retrieve files from database: " + query.lastError().text()); + throw LooqsGeneralException("Error while trying to retrieve files from database: " + query.lastError().text()); } // TODO: port this to QRegularExpression once >5.12 gets more widespread because of this bug diff --git a/cli/sqlitedbservice.h b/cli/sqlitedbservice.h index d80857a..6d532af 100644 --- a/cli/sqlitedbservice.h +++ b/cli/sqlitedbservice.h @@ -27,7 +27,7 @@ class SqliteDbService bool deleteFile(QString path); bool fileExistsInDatabase(QString path); bool fileExistsInDatabase(QString path, qint64 mtime); - QVector search(const QSSQuery &query); + QVector search(const LooqsQuery &query); }; #endif // SQLITEDBSERVICE_H diff --git a/cli/utils.cpp b/cli/utils.cpp index 802af30..b354fc4 100644 --- a/cli/utils.cpp +++ b/cli/utils.cpp @@ -9,12 +9,12 @@ QByteArray Utils::readFile(QString path) QFile file(path); if(!file.open(QIODevice::ReadOnly)) { - throw QSSGeneralException("Failed to open file: " + path); + throw LooqsGeneralException("Failed to open file: " + path); } QByteArray data = file.readAll(); if(data.isEmpty() && file.error() != QFileDevice::FileError::NoError) { - throw QSSGeneralException("Error reading file: " + path + ", Error: " + file.error()); + throw LooqsGeneralException("Error reading file: " + path + ", Error: " + file.error()); } return data; } diff --git a/cli/utils.h b/cli/utils.h index 1f32da6..fee84c9 100644 --- a/cli/utils.h +++ b/cli/utils.h @@ -5,7 +5,7 @@ #include #include #include -#include "qssgeneralexception.h" +#include "looqsgeneralexception.h" class Utils { diff --git a/gui/main.cpp b/gui/main.cpp index d17979a..df3ee28 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -14,7 +14,7 @@ int main(int argc, char *argv[]) { Common::ensureConfigured(); } - catch(QSSGeneralException &e) + catch(LooqsGeneralException &e) { qDebug() << e.message; QMessageBox::critical(nullptr, "Error", e.message); diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index c504703..1a1a3eb 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -15,7 +15,7 @@ #include "ui_mainwindow.h" #include "clicklabel.h" #include "../shared/sqlitesearch.h" -#include "../shared/qssgeneralexception.h" +#include "../shared/looqsgeneralexception.h" #include "../shared/common.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) @@ -54,7 +54,7 @@ void MainWindow::connectSignals() auto results = searchWatcher.future().result(); handleSearchResults(results); } - catch(QSSGeneralException &e) + catch(LooqsGeneralException &e) { handleSearchError(e.message); } @@ -176,7 +176,7 @@ void MainWindow::pdfPreviewReceived(PdfPreview preview) void MainWindow::lineEditReturnPressed() { QString q = ui->txtSearch->text(); - if(!QSSQuery::checkParanthesis(q)) + if(!LooqsQuery::checkParanthesis(q)) { ui->lblSearchResults->setText("Invalid paranthesis"); return; @@ -188,7 +188,7 @@ void MainWindow::lineEditReturnPressed() [&, q]() { SqliteSearch searcher(db); - this->currentQuery = QSSQuery::build(q); + this->currentQuery = LooqsQuery::build(q); return searcher.search(this->currentQuery); }); searchWatcher.setFuture(searchFuture); diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 224d039..5111e25 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -9,7 +9,7 @@ #include #include #include "pdfworker.h" -#include "../shared/qssquery.h" +#include "../shared/looqsquery.h" namespace Ui { class MainWindow; @@ -42,7 +42,7 @@ class MainWindow : public QMainWindow unsigned int processedPdfPreviews; void handleSearchResults(const QVector &results); void handleSearchError(QString error); - QSSQuery currentQuery; + LooqsQuery currentQuery; int pdfPreviewsPerPage; void createSearchResutlMenu(QMenu &menu, const QFileInfo &fileInfo); private slots: diff --git a/shared/common.cpp b/shared/common.cpp index 4cfbba4..e564d71 100644 --- a/shared/common.cpp +++ b/shared/common.cpp @@ -7,7 +7,7 @@ #include #include #include -#include "qssgeneralexception.h" +#include "looqsgeneralexception.h" #include "common.h" #define SETTINGS_KEY_DBPATH "dbpath" @@ -66,13 +66,13 @@ void Common::ensureConfigured() { if(!dir.mkpath(dbpath)) { - throw QSSGeneralException("Failed to create dbpath directory"); + throw LooqsGeneralException("Failed to create dbpath directory"); } } - dbpath += "/qss.sqlite"; + dbpath += "/looqs.sqlite"; if(!initSqliteDatabase(dbpath)) { - throw QSSGeneralException("Failed to initialize sqlite database"); + throw LooqsGeneralException("Failed to initialize sqlite database"); } settings.setValue(SETTINGS_KEY_FIRSTRUN, false); settings.setValue(SETTINGS_KEY_DBPATH, dbpath); @@ -83,7 +83,7 @@ void Common::ensureConfigured() QString dbpath = databasePath(); if(!QFile::exists(dbpath)) { - throw QSSGeneralException("Database " + dbpath + " was not found"); + throw LooqsGeneralException("Database " + dbpath + " was not found"); } } } @@ -92,7 +92,7 @@ void Common::setupAppInfo() { QCoreApplication::setOrganizationName("quitesimple.org"); QCoreApplication::setOrganizationDomain("quitesimple.org"); - QCoreApplication::setApplicationName("qss"); + QCoreApplication::setApplicationName("looqs"); } QString Common::databasePath() diff --git a/shared/looqsgeneralexception.cpp b/shared/looqsgeneralexception.cpp index 0901f06..ef94aa9 100644 --- a/shared/looqsgeneralexception.cpp +++ b/shared/looqsgeneralexception.cpp @@ -1 +1 @@ -#include "qssgeneralexception.h" +#include "looqsgeneralexception.h" diff --git a/shared/looqsgeneralexception.h b/shared/looqsgeneralexception.h index dd04343..171ce9e 100644 --- a/shared/looqsgeneralexception.h +++ b/shared/looqsgeneralexception.h @@ -1,13 +1,13 @@ -#ifndef QSSGENERALEXCEPTION_H -#define QSSGENERALEXCEPTION_H +#ifndef LOOQSGENERALEXCEPTION_H +#define LOOQSGENERALEXCEPTION_H #include -class QSSGeneralException : public QException +class LooqsGeneralException : public QException { public: QString message; - QSSGeneralException(QString message) + LooqsGeneralException(QString message) { this->message = message; } @@ -15,10 +15,10 @@ class QSSGeneralException : public QException { throw *this; } - QSSGeneralException *clone() const override + LooqsGeneralException *clone() const override { - return new QSSGeneralException(*this); + return new LooqsGeneralException(*this); } }; -#endif // QSSGENERALEXCEPTION_H +#endif // LOOQSGENERALEXCEPTION_H diff --git a/shared/looqsquery.cpp b/shared/looqsquery.cpp index 333b4f7..6dd3379 100644 --- a/shared/looqsquery.cpp +++ b/shared/looqsquery.cpp @@ -6,29 +6,29 @@ #include #include #include -#include "qssquery.h" +#include "looqsquery.h" -const QVector &QSSQuery::getTokens() const +const QVector &LooqsQuery::getTokens() const { return tokens; } -const QVector &QSSQuery::getSortConditions() const +const QVector &LooqsQuery::getSortConditions() const { return sortConditions; } -QueryType QSSQuery::getQueryType() +QueryType LooqsQuery::getQueryType() { return static_cast(tokensMask & COMBINED); } -void QSSQuery::addSortCondition(SortCondition sc) +void LooqsQuery::addSortCondition(SortCondition sc) { this->sortConditions.append(sc); } -bool QSSQuery::checkParanthesis(QString expression) +bool LooqsQuery::checkParanthesis(QString expression) { QStack open; QStack close; @@ -104,14 +104,14 @@ QVector createSortConditions(QString sortExpression) QStringList splitted = splitted_inner[i].split(" "); if(splitted.length() < 1 || splitted.length() > 2) { - throw QSSGeneralException("sort specifier must have format [field] (asc|desc)"); + throw LooqsGeneralException("sort specifier must have format [field] (asc|desc)"); } QString field = splitted[0]; auto queryField = fromString(field); if(!queryField) { - throw QSSGeneralException("Unknown sort field supplied"); + throw LooqsGeneralException("Unknown sort field supplied"); } SortOrder order; @@ -128,7 +128,7 @@ QVector createSortConditions(QString sortExpression) } else { - throw QSSGeneralException("Unknown order specifier: " + order); + throw LooqsGeneralException("Unknown order specifier: " + order); } } else @@ -145,7 +145,7 @@ QVector createSortConditions(QString sortExpression) return result; } -void QSSQuery::addToken(Token t) +void LooqsQuery::addToken(Token t) { tokens.append(t); tokensMask |= t.type; @@ -157,14 +157,14 @@ void QSSQuery::addToken(Token t) * thus, "Downloads zip" becomes essentailly "path.contains:(Downloads) AND path.contains:(zip)" * * TODO: It's a bit ugly still*/ -QSSQuery QSSQuery::build(QString expression) +LooqsQuery LooqsQuery::build(QString expression) { if(!checkParanthesis(expression)) { - throw QSSGeneralException("Invalid paranthesis"); + throw LooqsGeneralException("Invalid paranthesis"); } - QSSQuery result; + LooqsQuery result; // TODO: merge lonewords QRegularExpression rx("((?(\\.|\\w)+):(?\\((?[^\\)]+)\\)|([\\w,])+)|(?AND|OR)" "|(?!)|(?\\(|\\))|(?\\w+))"); @@ -185,11 +185,11 @@ QSSQuery QSSQuery::build(QString expression) { if(previousWasBool()) { - throw QSSGeneralException("Can't have two booleans following each other"); + throw LooqsGeneralException("Can't have two booleans following each other"); } if(previousWas(NEGATION)) { - throw QSSGeneralException("Can't have a negation preceeding a boolean"); + throw LooqsGeneralException("Can't have a negation preceeding a boolean"); } if(boolean == "AND") { @@ -204,7 +204,7 @@ QSSQuery QSSQuery::build(QString expression) { if(previousWas(NEGATION)) { - throw QSSGeneralException("Can't have two negations following each other"); + throw LooqsGeneralException("Can't have two negations following each other"); } if(!previousWasBool()) { @@ -274,7 +274,7 @@ QSSQuery QSSQuery::build(QString expression) { if(!result.sortConditions.empty()) { - throw QSSGeneralException("Two sort statements are illegal"); + throw LooqsGeneralException("Two sort statements are illegal"); } // TODO: hack, since we are not a "filter", we must remove a preceeding (implicit) boolean if(result.tokens.last().type & BOOL == BOOL) @@ -286,7 +286,7 @@ QSSQuery QSSQuery::build(QString expression) } else { - throw QSSGeneralException("Unknown filter provided!"); + throw LooqsGeneralException("Unknown filter provided!"); } result.addToken(Token(tokenType, value)); } @@ -298,7 +298,7 @@ QSSQuery QSSQuery::build(QString expression) if(!contentsearch && sortsForContent) { - throw QSSGeneralException("We cannot sort by text if we don't search for it"); + throw LooqsGeneralException("We cannot sort by text if we don't search for it"); } return result; diff --git a/shared/looqsquery.h b/shared/looqsquery.h index 06c5c0e..bca1b1c 100644 --- a/shared/looqsquery.h +++ b/shared/looqsquery.h @@ -1,8 +1,8 @@ -#ifndef QSSQUERY_H -#define QSSQUERY_H +#ifndef LOOQSQUERY_H +#define LOOQSQUERY_H #include #include -#include "qssgeneralexception.h" +#include "looqsgeneralexception.h" #include "token.h" /* Fields that can be queried or sorted */ enum QueryField @@ -34,7 +34,7 @@ enum QueryType COMBINED = PATH_ONLY | CONTENT_ONLY }; -class QSSQuery +class LooqsQuery { private: /* Helper field to determine quertype as well as to quickly check what kind of filters etc. @@ -54,7 +54,7 @@ class QSSQuery } void addSortCondition(SortCondition sc); static bool checkParanthesis(QString query); - static QSSQuery build(QString query); + static LooqsQuery build(QString query); }; -#endif // QSSQUERY_H +#endif // LOOQSQUERY_H diff --git a/shared/shared.pro b/shared/shared.pro index a78c084..88072ea 100644 --- a/shared/shared.pro +++ b/shared/shared.pro @@ -25,16 +25,16 @@ DEFINES += QT_DEPRECATED_WARNINGS #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += sqlitesearch.cpp \ - qssgeneralexception.cpp \ - qssquery.cpp \ - common.cpp + looqsgeneralexception.cpp \ + common.cpp \ + looqsquery.cpp HEADERS += sqlitesearch.h \ filedata.h \ + looqsgeneralexception.h \ + looqsquery.h \ searchresult.h \ - qssgeneralexception.h \ token.h \ - qssquery.h \ common.h unix { target.path = /usr/lib diff --git a/shared/sqlitesearch.cpp b/shared/sqlitesearch.cpp index 254eaa7..032441d 100644 --- a/shared/sqlitesearch.cpp +++ b/shared/sqlitesearch.cpp @@ -5,7 +5,7 @@ #include #include #include "sqlitesearch.h" -#include "qssgeneralexception.h" +#include "looqsgeneralexception.h" SqliteSearch::SqliteSearch(QSqlDatabase &db) { @@ -46,7 +46,7 @@ QString SqliteSearch::createSortSql(const QVector sortConditions) QString field = fieldToColumn(sc.field); if(field == "") { - throw QSSGeneralException("Unknown sort field supplied"); + throw LooqsGeneralException("Unknown sort field supplied"); } if(sc.order == DESC) { @@ -119,10 +119,10 @@ QPair> SqliteSearch::createSql(const Token &token) "rank) ", {value}}; } - throw QSSGeneralException("Unknown token passed (should not happen)"); + throw LooqsGeneralException("Unknown token passed (should not happen)"); } -QSqlQuery SqliteSearch::makeSqlQuery(const QSSQuery &query) +QSqlQuery SqliteSearch::makeSqlQuery(const LooqsQuery &query) { QString whereSql; QString joinSql; @@ -130,7 +130,7 @@ QSqlQuery SqliteSearch::makeSqlQuery(const QSSQuery &query) bool isContentSearch = query.getTokensMask() & FILTER_CONTENT == FILTER_CONTENT; if(query.getTokens().isEmpty()) { - throw QSSGeneralException("Nothing to search for supplied"); + throw LooqsGeneralException("Nothing to search for supplied"); } for(const Token &token : query.getTokens()) @@ -185,7 +185,7 @@ QSqlQuery SqliteSearch::makeSqlQuery(const QSSQuery &query) return dbquery; } -QVector SqliteSearch::search(const QSSQuery &query) +QVector SqliteSearch::search(const LooqsQuery &query) { QVector results; QSqlQuery dbQuery = makeSqlQuery(query); @@ -195,7 +195,7 @@ QVector SqliteSearch::search(const QSSQuery &query) qDebug() << dbQuery.lastError(); qDebug() << dbQuery.executedQuery(); - throw QSSGeneralException("SQL Error: " + dbQuery.lastError().text()); + throw LooqsGeneralException("SQL Error: " + dbQuery.lastError().text()); } while(dbQuery.next()) diff --git a/shared/sqlitesearch.h b/shared/sqlitesearch.h index f3da328..ea2f70c 100644 --- a/shared/sqlitesearch.h +++ b/shared/sqlitesearch.h @@ -4,17 +4,17 @@ #include #include "searchresult.h" #include "token.h" -#include "../shared/qssquery.h" +#include "../shared/looqsquery.h" class SqliteSearch { public: SqliteSearch(QSqlDatabase &db); - QVector search(const QSSQuery &query); + QVector search(const LooqsQuery &query); private: QSqlDatabase *db; - QSqlQuery makeSqlQuery(const QSSQuery &query); + QSqlQuery makeSqlQuery(const LooqsQuery &query); QString fieldToColumn(QueryField field); QPair> createSql(const Token &token); QString createSortSql(const QVector sortConditions);