Refactor search queries: Introduced QSSQuery

Purpose is to seperate certain logic from SQLite and generalize it more.
Even though we only have Sqlite atm, in general the database layers
must be stupid as possible, while QSSQuery should do most of the hard work.

Fixes in Tokenizer logic.
Switched to C++17.
This commit is contained in:
2019-08-17 11:06:35 +02:00
parent 05a5bac22f
commit cff481a57e
14 changed files with 500 additions and 618 deletions

View File

@ -16,6 +16,7 @@
#include "clicklabel.h"
#include "../shared/sqlitesearch.h"
#include "../shared/qssgeneralexception.h"
#include "../shared/qssquery.h"
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
@ -150,7 +151,7 @@ void MainWindow::pdfPreviewReceived(PdfPreview preview)
void MainWindow::lineEditReturnPressed()
{
QString q = ui->txtSearch->text();
if(!SqliteSearch::checkParanthesis(q))
if(!QSSQuery::checkParanthesis(q))
{
ui->lblSearchResults->setText("Invalid paranthesis");
return;
@ -163,7 +164,7 @@ void MainWindow::lineEditReturnPressed()
[&, q]()
{
SqliteSearch searcher(db);
return searcher.search(q);
return searcher.search(QSSQuery::build(q));
});
searchWatcher.setFuture(searchFuture);
}